ldapmanagementpage.class.php (fogproject-1.5.7) | : | ldapmanagementpage.class.php (fogproject-1.5.8) | ||
---|---|---|---|---|
skipping to change at line 395 | skipping to change at line 395 | |||
echo '</div>'; | echo '</div>'; | |||
} | } | |||
/** | /** | |||
* Create the new item | * Create the new item | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function addPost() | public function addPost() | |||
{ | { | |||
self::$HookManager->processEvent('LDAP_ADD'); | self::$HookManager->processEvent('LDAP_ADD'); | |||
$ports = array_map( | ||||
'trim', | ||||
explode( | ||||
',', | ||||
self::getSetting('LDAP_PORTS') | ||||
) | ||||
); | ||||
$name = filter_input( | $name = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'name' | 'name' | |||
); | ); | |||
$description = filter_input( | $description = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'description' | 'description' | |||
); | ); | |||
$address = filter_input( | $address = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
skipping to change at line 475 | skipping to change at line 482 | |||
if (empty($searchDN)) { | if (empty($searchDN)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please enter a Search Base DN') | _('Please enter a Search Base DN') | |||
); | ); | |||
} | } | |||
if (empty($port)) { | if (empty($port)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please select an LDAP port to use') | _('Please select an LDAP port to use') | |||
); | ); | |||
} | } | |||
if (!in_array($port, array(389, 636))) { | if (!in_array($port, $ports)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please select a valid ldap port') | _('Please select a valid ldap port') | |||
); | ); | |||
} | } | |||
if (empty($adminGroup) && empty($userGroup)) { | if (empty($adminGroup) && empty($userGroup)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please Enter an admin or mobile lookup name') | _('Please Enter an admin or mobile lookup name') | |||
); | ); | |||
} | } | |||
if (empty($userNamAttr)) { | if (empty($userNamAttr)) { | |||
skipping to change at line 655 | skipping to change at line 662 | |||
_('Base Only'), | _('Base Only'), | |||
_('Subtree Only'), | _('Subtree Only'), | |||
_('Subree and Below') | _('Subree and Below') | |||
); | ); | |||
$searchSel = self::selectForm( | $searchSel = self::selectForm( | |||
'searchScope', | 'searchScope', | |||
$searchScopes, | $searchScopes, | |||
$searchScope, | $searchScope, | |||
true | true | |||
); | ); | |||
$ports = array(389, 636); | $ports = array_map( | |||
'trim', | ||||
explode( | ||||
',', | ||||
self::getSetting('LDAP_PORTS') | ||||
) | ||||
); | ||||
$portssel = self::selectForm( | $portssel = self::selectForm( | |||
'port', | 'port', | |||
$ports, | $ports, | |||
$port | $port | |||
); | ); | |||
$useGroupMatch = ( | $useGroupMatch = ( | |||
isset($_POST['useGroupMatch']) ?: $this->obj->get('useGroupMatch') | isset($_POST['useGroupMatch']) ?: $this->obj->get('useGroupMatch') | |||
); | ); | |||
$useMatch = ( | $useMatch = ( | |||
$useGroupMatch ? | $useGroupMatch ? | |||
skipping to change at line 860 | skipping to change at line 873 | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function editPost() | public function editPost() | |||
{ | { | |||
self::$HookManager | self::$HookManager | |||
->processEvent( | ->processEvent( | |||
'LDAP_EDIT_POST', | 'LDAP_EDIT_POST', | |||
array('LDAP'=> &$this->obj) | array('LDAP'=> &$this->obj) | |||
); | ); | |||
$ports = array_map( | ||||
'trim', | ||||
explode( | ||||
',', | ||||
self::getSetting('LDAP_PORTS') | ||||
) | ||||
); | ||||
$name = filter_input( | $name = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'name' | 'name' | |||
); | ); | |||
$description = filter_input( | $description = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'description' | 'description' | |||
); | ); | |||
$address = filter_input( | $address = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
skipping to change at line 937 | skipping to change at line 957 | |||
if (empty($searchDN)) { | if (empty($searchDN)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please enter a Search Base DN') | _('Please enter a Search Base DN') | |||
); | ); | |||
} | } | |||
if (empty($port)) { | if (empty($port)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please select an LDAP port to use') | _('Please select an LDAP port to use') | |||
); | ); | |||
} | } | |||
if (!in_array($port, array(389, 636))) { | if (!in_array($port, $ports)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please select a valid ldap port') | _('Please select a valid ldap port') | |||
); | ); | |||
} | } | |||
if (empty($adminGroup) && empty($userGroup)) { | if (empty($adminGroup) && empty($userGroup)) { | |||
throw new Exception( | throw new Exception( | |||
_('Please Enter an admin or mobile lookup name') | _('Please Enter an admin or mobile lookup name') | |||
); | ); | |||
} | } | |||
if (empty($userNamAttr)) { | if (empty($userNamAttr)) { | |||
skipping to change at line 1110 | skipping to change at line 1130 | |||
return is_numeric($v); | return is_numeric($v); | |||
}, explode(',', $filter)))|| | }, explode(',', $filter)))|| | |||
in_array(false, array_map(function ($v) { | in_array(false, array_map(function ($v) { | |||
return is_numeric($v); | return is_numeric($v); | |||
}, explode(',', $ports)))) { | }, explode(',', $ports)))) { | |||
$msg = json_encode( | $msg = json_encode( | |||
array( | array( | |||
'error' => _('Not all elements in filter or ports setting are integer'), | 'error' => _('Not all elements in filter or ports setting are integer'), | |||
'title' => _('Settings Update Fail') | 'title' => _('Settings Update Fail') | |||
) | ) | |||
); | ); | |||
} else { | } else { | |||
self::setSetting('LDAP_PORTS', $ports); | self::setSetting('LDAP_PORTS', $ports); | |||
self::setSetting('FOG_USER_FILTER', $filter); | self::setSetting('FOG_USER_FILTER', $filter); | |||
$msg = json_encode( | $msg = json_encode( | |||
array( | array( | |||
'msg' => _('Settings successfully stored !'), | 'msg' => _('Settings successfully stored !'), | |||
'title' => _('Settings Update Success') | 'title' => _('Settings Update Success') | |||
) | ) | |||
); | ); | |||
} | } | |||
} catch (Exception $e) { | } catch (Exception $e) { | |||
$msg = json_encode( | $msg = json_encode( | |||
array( | array( | |||
'error' => $e->getMessage(), | 'error' => $e->getMessage(), | |||
'title' => _('Settings Update Fail') | 'title' => _('Settings Update Fail') | |||
) | ) | |||
); | ); | |||
} | } | |||
echo $msg; | echo $msg; | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 25 lines changed or added |