startLSsession() ) { LSerror::addErrorCode('LSsession_22'); $_ERRORS = true; } } $data=NULL; if (!isset($_ERRORS)) { switch($_REQUEST['template']) { case 'login': switch($_REQUEST['action']) { case 'onLdapServerChanged': if ( isset($_REQUEST['server']) ) { $GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); $data = array(); if ( $GLOBALS['LSsession'] -> LSldapConnect() ) { session_start(); if (isset($_SESSION['LSsession_topDn'])) { $sel = $_SESSION['LSsession_topDn']; } else { $sel = NULL; } $list = $GLOBALS['LSsession'] -> getSubDnLdapServerOptions($sel); if (is_string($list)) { $data['list_topDn'] = ""; $data['subDnLabel'] = $GLOBALS['LSsession'] -> getSubDnLabel(); } } $data['recoverPassword'] = isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword']); } break; } break; case 'recoverPassword': switch($_REQUEST['action']) { case 'onLdapServerChanged': if ( isset($_REQUEST['server']) ) { $GLOBALS['LSsession'] -> setLdapServer($_REQUEST['server']); $data=array('recoverPassword' => isset($GLOBALS['LSsession'] -> ldapServer['recoverPassword'])); } break; } break; case 'LSform': switch($_REQUEST['action']) { case 'onAddFieldBtnClick': if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); $object -> loadData($_REQUEST['objectdn']); $form = $object -> getForm($_REQUEST['idform']); $emptyField=$form -> getEmptyField($_REQUEST['attribute']); if ( $emptyField ) { $data = array( 'html' => $form -> getEmptyField($_REQUEST['attribute']), 'fieldId' => $_REQUEST['fieldId'], 'fieldtype' => get_class($form -> getElement($_REQUEST['attribute'])) ); } } } break; case 'LSformElement_select_object_refresh': if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); $form = $object -> getForm($_REQUEST['idform']); $field=$form -> getElement($_REQUEST['attribute']); $val = $field -> getValuesFromSession(); if ( $val ) { $data = array( 'objects' => $val ); } } } break; case 'LSformElement_select_object_searchAdd': if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); $form = $object -> getForm($_REQUEST['idform']); $field=$form -> getElement($_REQUEST['attribute']); $data['objects'] = $field -> searchAdd($_REQUEST['pattern']); } } break; case 'generatePassword': if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); if ($object) { $form = $object -> getForm($_REQUEST['idform']); if ($form) { $field=$form -> getElement($_REQUEST['attribute']); if ($field) { $val = $field -> generatePassword(); if ( $val ) { $data = array( 'generatePassword' => $val ); } } } } } } break; case 'verifyPassword': if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); $form = $object -> getForm($_REQUEST['idform']); $object -> loadData($_REQUEST['objectdn']); $field=$form -> getElement($_REQUEST['attribute']); $val = $field -> verifyPassword($_REQUEST['fieldValue']); $data = array( 'verifyPassword' => $val ); } } break; } break; case 'LSrelation': switch($_REQUEST['action']) { case 'refreshSession': if ((isset($_REQUEST['id'])) && (isset($_REQUEST['href'])) ) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { $conf = $_SESSION['LSrelation'][$_REQUEST['id']]; if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { $object = new $conf['objectType'](); if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { $relationConf = $object->config['LSrelation'][$conf['relationName']]; if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); $list = $objRel -> $relationConf['list_function']($object); $_SESSION['LSselect'][$relationConf['LSobject']]=array(); if (is_array($list)) { foreach($list as $o) { $_SESSION['LSselect'][$relationConf['LSobject']][] = $o -> getDn(); } } $data = array( 'href' => $_REQUEST['href'], 'id' => $_REQUEST['id'] ); } else { LSerror::addErrorCode('LSrelations_01',$relationName); } } else { LSerror::addErrorCode('LSsession_11'); } } } else { LSerror::addErrorCode('LSsession_12'); } } else { LSerror::addErrorCode('LSsession_12'); } } else { LSerror::addErrorCode('LSsession_12'); } } break; case 'refreshList': if (isset($_REQUEST['id'])) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { $conf = $_SESSION['LSrelation'][$_REQUEST['id']]; if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { $object = new $conf['objectType'](); if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { $relationConf = $object->config['LSrelation'][$conf['relationName']]; if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) { $objRel = new $relationConf['LSobject'](); if($objRel -> $relationConf['update_function']($object,$_SESSION['LSselect'][$relationConf['LSobject']])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $list = $objRel -> $relationConf['list_function']($object); if (is_array($list)&&(!empty($list))) { foreach($list as $o) { $data['html'].= "