ldapsaisie/public_html/view.php

194 lines
7.1 KiB
PHP
Raw Permalink Normal View History

<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
require_once 'core.php';
if(LSsession :: startLSsession()) {
if (isset($_REQUEST['LSobject'])) {
$LSobject = $_REQUEST['LSobject'];
$dn = isset($_REQUEST['dn'])?urldecode($_REQUEST['dn']):null;
if (LSsession :: in_menu($LSobject)) {
if ( $LSobject == 'SELF' ) {
$LSobject = LSsession :: getLSuserObject() -> getType();
$dn = LSsession :: getLSuserObjectDn();
}
if ( LSsession :: loadLSobject($LSobject) ) {
// Affichage d'un objet
if ( $dn!='' ) {
if (LSsession :: canAccess($LSobject,$dn)) {
if ( LSsession :: canEdit($LSobject,$dn) ) {
$LSview_actions[] = array(
'label' => _('Modify'),
'url' =>'modify.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn),
'action' => 'modify'
);
}
if (LSsession :: canCreate($LSobject)) {
$LSview_actions[] = array(
'label' => _('Copy'),
'url' =>'create.php?LSobject='.$LSobject.'&amp;load='.urlencode($dn),
'action' => 'copy'
);
}
if (LSsession :: canRemove($LSobject,$dn)) {
$LSview_actions[] = array(
'label' => _('Delete'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn),
'action' => 'delete'
);
}
2011-03-25 18:05:26 +01:00
// Custum Actions
$customActionsConfig = LSconfig :: get('LSobjects.'.$LSobject.'.customActions');
if (is_array($customActionsConfig)) {
foreach($customActionsConfig as $name => $config) {
if (LSsession :: canExecuteCustomAction($dn,$LSobject,$name)) {
$LSview_actions[] = array (
'label' => ((isset($config['label']))?__($config['label']):__($name)),
'hideLabel' => ((isset($config['hideLabel']))?$config['hideLabel']:False),
'url' => 'custom_action.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn).'&amp;customAction='.$name,
'action' => ((isset($config['icon']))?$config['icon']:'generate'),
'class' => 'LScustomActions'.(($config['noConfirmation'])?' LScustomActions_noConfirmation':'')
2011-03-25 18:05:26 +01:00
);
}
}
}
if (LSsession :: getLSuserObjectDn() != $dn) {
$object = new $LSobject();
$object -> loadData($dn);
LStemplate :: assign('pagetitle',$object -> getDisplayName());
}
else {
$object = LSsession :: getLSuserObject();
LStemplate :: assign('pagetitle',_('My account'));
}
$view = $object -> getView();
$view -> displayView();
// LSrelations
- LSmail : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSrelation : - Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - Modification du JS pour faire appels à ces méthodes - La méthode displayInLSview() remplace le bloc du fichier view.php pour l'affichage des relations d'un objet. - Internationalisation. - LSselect : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSformElement_password : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_select_object : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_mail : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSformElement_image : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSsession : - Ajout de méthodes statiques gérant les appels Ajax des formulaires de login et de recupération de mot de passe. - Modification des JS pour faire appels à ces méthodes - Ajout d'un mécanisme permettant de garder la session PHP active - Modification de LSdefault.js pour gérer ce mécanisme - LSform : - Ajout de méthodes statiques gérant les appels Ajax des formulaires - Ajout de la méthode loadDependenciesDisplayView() gérant les dépendances d'affichage d'une LSview. - Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - view.php / modify.php /select.php : Utilisation des nouvelles fonctionnalités pour gérer les dépendances et les LSrelations. - LSview : Modification de l'internationnalisation.
2009-02-20 15:05:22 +01:00
if (LSsession :: loadLSclass('LSrelation')) {
LSrelation :: displayInLSview($object);
}
LStemplate :: assign('LSview_actions',$LSview_actions);
LSsession :: setTemplate('view.tpl');
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
// Affichage d'une liste d'un type d'objet
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
elseif (LSsession :: loadLSclass('LSsearch')) {
$object = new $LSobject();
LStemplate :: assign('pagetitle',$object -> getLabel());
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$LSsearch = new LSsearch($LSobject,'LSview');
$LSsearch -> setParamsFormPostData();
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$searchForm = array (
'action' => $_SERVER['PHP_SELF'],
'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ),
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
'labels' => array (
'submit' => _('Search'),
'approx' => _('Approximative search'),
'recursive' => _('Recursive search')
),
'values' => array (
'pattern' => $LSsearch->getParam('pattern'),
'approx' => $LSsearch->getParam('approx'),
'recursive' => $LSsearch->getParam('recursive')
),
'names' => array (
'submit' => 'LSsearch_submit'
),
'hiddenFields' => $LSsearch -> getHiddenFieldForm(),
'predefinedFilter' => $LSsearch->getParam('predefinedFilter')
);
LStemplate :: assign('searchForm',$searchForm);
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$LSview_actions=array();
if(LSsession :: canCreate($LSobject)) {
$LSview_actions['create'] = array (
'label' => 'New',
'url' => 'create.php?LSobject='.$LSobject,
'action' => 'create'
);
}
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$LSview_actions['refresh'] = array (
'label' => 'Refresh',
'url' => 'view.php?LSobject='.$LSobject.'&amp;refresh',
'action' => 'refresh'
);
/*$LSview_actions['purge'] = array (
'label' => 'Purge the cache',
'url' => 'view.php?LSobject='.$LSobject.'&amp;LSsearchPurgeSession',
'action' => 'delete'
);*/
LStemplate :: assign('LSview_actions',$LSview_actions);
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$LSsearch -> run();
$LSsearch -> redirectWhenOnlyOneResult();
2010-11-16 19:22:56 +01:00
$page=(isset($_REQUEST['page'])?(int)$_REQUEST['page']:0);
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
$page = $LSsearch -> getPage($page);
LStemplate :: assign('page',$page);
LStemplate :: assign('LSsearch',$LSsearch);
- LSmail : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSrelation : - Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - Modification du JS pour faire appels à ces méthodes - La méthode displayInLSview() remplace le bloc du fichier view.php pour l'affichage des relations d'un objet. - Internationalisation. - LSselect : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSformElement_password : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_select_object : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_mail : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSformElement_image : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSsession : - Ajout de méthodes statiques gérant les appels Ajax des formulaires de login et de recupération de mot de passe. - Modification des JS pour faire appels à ces méthodes - Ajout d'un mécanisme permettant de garder la session PHP active - Modification de LSdefault.js pour gérer ce mécanisme - LSform : - Ajout de méthodes statiques gérant les appels Ajax des formulaires - Ajout de la méthode loadDependenciesDisplayView() gérant les dépendances d'affichage d'une LSview. - Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - view.php / modify.php /select.php : Utilisation des nouvelles fonctionnalités pour gérer les dépendances et les LSrelations. - LSview : Modification de l'internationnalisation.
2009-02-20 15:05:22 +01:00
if (LSsession :: loadLSclass('LSform')) {
LSform :: loadDependenciesDisplayView();
}
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
LSsession :: setTemplate('viewSearch.tpl');
}
else {
LSsession :: addErrorCode('LSsession_05','LSsearch');
}
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSsession :: setTemplate('login.tpl');
}
// Affichage des retours d'erreurs
LSsession :: displayTemplate();
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
if (isset($LSsearch)) {
$LSsearch->afterUsingResult();
}
?>