fixed some PHP notices and sorting
This commit is contained in:
parent
722daabb64
commit
b6fda6b305
|
@ -1605,7 +1605,7 @@ class accountContainer {
|
||||||
// find new attributes
|
// find new attributes
|
||||||
if (isset($attributes[$name]) && is_array($attributes[$name])) {
|
if (isset($attributes[$name]) && is_array($attributes[$name])) {
|
||||||
foreach ($attributes[$name] as $j => $value) {
|
foreach ($attributes[$name] as $j => $value) {
|
||||||
if (is_array($orig[$name])) {
|
if (isset($orig[$name]) && is_array($orig[$name])) {
|
||||||
if (!in_array($value, $orig[$name]))
|
if (!in_array($value, $orig[$name]))
|
||||||
if ($value != '') {
|
if ($value != '') {
|
||||||
$toadd[$name][] = $value;
|
$toadd[$name][] = $value;
|
||||||
|
@ -1615,7 +1615,7 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// find unchanged attributes
|
// find unchanged attributes
|
||||||
if (is_array($orig[$name]) && is_array($attributes[$name])) {
|
if (isset($orig[$name]) && is_array($orig[$name]) && is_array($attributes[$name])) {
|
||||||
foreach ($attributes[$name] as $j => $value) {
|
foreach ($attributes[$name] as $j => $value) {
|
||||||
if (($value != '') && in_array($value, $orig[$name])) {
|
if (($value != '') && in_array($value, $orig[$name])) {
|
||||||
$notchanged[$name][] = $value;
|
$notchanged[$name][] = $value;
|
||||||
|
@ -1913,9 +1913,15 @@ class accountContainer {
|
||||||
// create complete new dn
|
// create complete new dn
|
||||||
else {
|
else {
|
||||||
$attr = array();
|
$attr = array();
|
||||||
if (is_array($attributes[$this->finalDN]['add'])) $attr = array_merge_recursive($attr, $attributes[$this->finalDN]['add']);
|
if (isset($attributes[$this->finalDN]['add']) && is_array($attributes[$this->finalDN]['add'])) {
|
||||||
if (is_array($attributes[$this->finalDN]['notchanged'])) $attr = array_merge_recursive($attr, $attributes[$this->finalDN]['notchanged']);
|
$attr = array_merge_recursive($attr, $attributes[$this->finalDN]['add']);
|
||||||
if (is_array($attributes[$this->finalDN]['modify'])) $attr = array_merge_recursive($attr, $attributes[$this->finalDN]['modify']);
|
}
|
||||||
|
if (isset($attributes[$this->finalDN]['notchanged']) && is_array($attributes[$this->finalDN]['notchanged'])) {
|
||||||
|
$attr = array_merge_recursive($attr, $attributes[$this->finalDN]['notchanged']);
|
||||||
|
}
|
||||||
|
if (isset($attributes[$this->finalDN]['modify']) && is_array($attributes[$this->finalDN]['modify'])) {
|
||||||
|
$attr = array_merge_recursive($attr, $attributes[$this->finalDN]['modify']);
|
||||||
|
}
|
||||||
$success = ldap_add($_SESSION['ldap']->server(), $this->finalDN, $attr);
|
$success = ldap_add($_SESSION['ldap']->server(), $this->finalDN, $attr);
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to create DN: ' . $this->finalDN . ' (' . ldap_err2str(ldap_errno($_SESSION['ldap']->server())) . ').');
|
logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to create DN: ' . $this->finalDN . ' (' . ldap_err2str(ldap_errno($_SESSION['ldap']->server())) . ').');
|
||||||
|
|
|
@ -431,6 +431,9 @@ class eduPerson extends baseModule {
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
if (!in_array('eduPerson', $this->attributes['objectClass'])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// primary affiliation
|
// primary affiliation
|
||||||
$this->attributes['eduPersonPrimaryAffiliation'][0] = $_POST['primaryAffiliation'];
|
$this->attributes['eduPersonPrimaryAffiliation'][0] = $_POST['primaryAffiliation'];
|
||||||
|
|
|
@ -422,7 +422,7 @@ class kolabUser extends baseModule {
|
||||||
$this->attributes['objectClass'][] = 'kolabInetOrgPerson';
|
$this->attributes['objectClass'][] = 'kolabInetOrgPerson';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($_POST['form_subpage_kolabUser_deleteUser_open']) return array();
|
if (isset($_POST['form_subpage_kolabUser_deleteUser_open'])) return array();
|
||||||
$this->attributes['kolabInvitationPolicy'] = array();
|
$this->attributes['kolabInvitationPolicy'] = array();
|
||||||
// country
|
// country
|
||||||
if (isset($_POST['country'])) {
|
if (isset($_POST['country'])) {
|
||||||
|
|
|
@ -90,7 +90,10 @@ class ldapPublicKey extends baseModule {
|
||||||
*/
|
*/
|
||||||
function display_html_attributes() {
|
function display_html_attributes() {
|
||||||
$return = array();
|
$return = array();
|
||||||
|
$keyCount = 0;
|
||||||
// list current keys
|
// list current keys
|
||||||
|
if (isset($this->attributes['sshPublicKey'])) {
|
||||||
|
$keyCount = sizeof($this->attributes['sshPublicKey']);
|
||||||
for ($i = 0; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'text', 'text' => _('SSH public key')),
|
array('kind' => 'text', 'text' => _('SSH public key')),
|
||||||
|
@ -98,13 +101,14 @@ class ldapPublicKey extends baseModule {
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'delKey' . $i, 'value' => _("Remove")),
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'delKey' . $i, 'value' => _("Remove")),
|
||||||
array('kind' => 'help', 'value' => 'key'));
|
array('kind' => 'help', 'value' => 'key'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// input box for new key
|
// input box for new key
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'text', 'text' => _('New SSH public key')),
|
array('kind' => 'text', 'text' => _('New SSH public key')),
|
||||||
array('kind' => 'input', 'name' => 'sshPublicKey', 'type' => 'text', 'size' => '50', 'maxlength' => '2048', 'value' => ''),
|
array('kind' => 'input', 'name' => 'sshPublicKey', 'type' => 'text', 'size' => '50', 'maxlength' => '2048', 'value' => ''),
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'addKey', 'value' => _("Add")),
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'addKey', 'value' => _("Add")),
|
||||||
array('kind' => 'help', 'value' => 'key'),
|
array('kind' => 'help', 'value' => 'key'),
|
||||||
array('kind' => 'input', 'type' => 'hidden', 'value' => sizeof($this->attributes['sshPublicKey']), 'name' => 'key_number'));
|
array('kind' => 'input', 'type' => 'hidden', 'value' => $keyCount, 'name' => 'key_number'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,9 +178,11 @@ class nisnetgroup extends baseModule {
|
||||||
array('kind' => 'text', 'text' => _("Group name").'*'),
|
array('kind' => 'text', 'text' => _("Group name").'*'),
|
||||||
array('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30', 'maxlength' => '20', 'value' => $groupName),
|
array('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30', 'maxlength' => '20', 'value' => $groupName),
|
||||||
array('kind' => 'help', 'value' => 'cn'));
|
array('kind' => 'help', 'value' => 'cn'));
|
||||||
|
$description = '';
|
||||||
|
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0];
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'text', 'text' => _('Description')),
|
array('kind' => 'text', 'text' => _('Description')),
|
||||||
array('kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0]),
|
array('kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $description),
|
||||||
array ('kind' => 'help', 'value' => 'description'));
|
array ('kind' => 'help', 'value' => 'description'));
|
||||||
$subgroups = array();
|
$subgroups = array();
|
||||||
if (isset($this->attributes['memberNisNetgroup']) && is_array($this->attributes['memberNisNetgroup'])) {
|
if (isset($this->attributes['memberNisNetgroup']) && is_array($this->attributes['memberNisNetgroup'])) {
|
||||||
|
|
|
@ -536,7 +536,7 @@ class posixGroup extends baseModule implements passwordService {
|
||||||
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_removePassword'])) {
|
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_removePassword'])) {
|
||||||
unset($this->attributes['userPassword']);
|
unset($this->attributes['userPassword']);
|
||||||
}
|
}
|
||||||
if ($_POST['changegids']) $this->changegids=true;
|
if (isset($_POST['changegids'])) $this->changegids=true;
|
||||||
else $this->changegids=false;
|
else $this->changegids=false;
|
||||||
if (($this->attributes['gidNumber'][0] != $_POST['gidNumber']) || !isset($this->attributes['gidNumber'][0])) {
|
if (($this->attributes['gidNumber'][0] != $_POST['gidNumber']) || !isset($this->attributes['gidNumber'][0])) {
|
||||||
// Check if GID is valid. If none value was entered, the next useable value will be inserted
|
// Check if GID is valid. If none value was entered, the next useable value will be inserted
|
||||||
|
|
|
@ -153,7 +153,7 @@ echo "<table style=\"border-color: grey\" cellpadding=\"10\" border=\"0\" cellsp
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
foreach ($sortedTypes as $type => $label) {
|
foreach ($sortedTypes as $type => $label) {
|
||||||
$style = 'style="display:none;"';
|
$style = 'style="display:none;"';
|
||||||
if ((!isset($_POST['type']) && ($counter == 0)) || ($_POST['type'] == $type)) {
|
if ((!isset($_POST['type']) && ($counter == 0)) || (isset($_POST['type']) && ($_POST['type'] == $type))) {
|
||||||
// show first account type or last selected one
|
// show first account type or last selected one
|
||||||
$style = '';
|
$style = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ if (isset($_POST['createOU']) || isset($_POST['deleteOU'])) {
|
||||||
include 'main_header.php';
|
include 'main_header.php';
|
||||||
// display messages
|
// display messages
|
||||||
if ($error || $message || $text) {
|
if ($error || $message || $text) {
|
||||||
if ($text) echo $text;
|
if (isset($text)) echo $text;
|
||||||
elseif ($error) {
|
elseif (isset($error)) {
|
||||||
StatusMessage("ERROR", "", $error);
|
StatusMessage("ERROR", "", $error);
|
||||||
echo ("<br><a href=\"ou_edit.php\">" . _("Back to OU-Editor") . "</a>\n");
|
echo ("<br><a href=\"ou_edit.php\">" . _("Back to OU-Editor") . "</a>\n");
|
||||||
}
|
}
|
||||||
|
@ -138,17 +138,22 @@ display_main();
|
||||||
* Displays the main page of the OU editor
|
* Displays the main page of the OU editor
|
||||||
*/
|
*/
|
||||||
function display_main() {
|
function display_main() {
|
||||||
$types = $_SESSION['config']->get_ActiveTypes();
|
|
||||||
// display main page
|
// display main page
|
||||||
include 'main_header.php';
|
include 'main_header.php';
|
||||||
echo "<h1>" . _("OU editor") . "</h1>";
|
echo "<h1>" . _("OU editor") . "</h1>";
|
||||||
echo ("<br>\n");
|
echo ("<br>\n");
|
||||||
echo ("<form action=\"ou_edit.php\" method=\"post\">\n");
|
echo ("<form action=\"ou_edit.php\" method=\"post\">\n");
|
||||||
|
|
||||||
|
$types = array();
|
||||||
|
$typeList = $_SESSION['config']->get_ActiveTypes();
|
||||||
|
for ($i = 0; $i < sizeof($typeList); $i++) {
|
||||||
|
$types[$typeList[$i]] = getTypeAlias($typeList[$i]);
|
||||||
|
}
|
||||||
|
natcasesort($types);
|
||||||
$options = "";
|
$options = "";
|
||||||
for ($i = 0; $i < sizeof($types); $i++) {
|
foreach ($types as $name => $title) {
|
||||||
$options .= "<optgroup label=\"" . getTypeAlias($types[$i]) . "\">\n";
|
$options .= "<optgroup label=\"" . $title . "\">\n";
|
||||||
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($types[$i]));
|
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($name));
|
||||||
for ($u = 0; $u < sizeof($units); $u++) {
|
for ($u = 0; $u < sizeof($units); $u++) {
|
||||||
$options .= "<option>" . $units[$u] . "</option>\n";
|
$options .= "<option>" . $units[$u] . "</option>\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,19 @@ setlanguage();
|
||||||
|
|
||||||
$types = $_SESSION['config']->get_ActiveTypes();
|
$types = $_SESSION['config']->get_ActiveTypes();
|
||||||
$profileClasses = array();
|
$profileClasses = array();
|
||||||
|
$profileClassesTemp = array();
|
||||||
for ($i = 0; $i < sizeof($types); $i++) {
|
for ($i = 0; $i < sizeof($types); $i++) {
|
||||||
$profileClasses[] = array(
|
$profileClassesTemp[getTypeAlias($types[$i])] = array(
|
||||||
'scope' => $types[$i],
|
'scope' => $types[$i],
|
||||||
'title' => getTypeAlias($types[$i]),
|
'title' => getTypeAlias($types[$i]),
|
||||||
'profiles' => "");
|
'profiles' => "");
|
||||||
}
|
}
|
||||||
|
$profileClassesKeys = array_keys($profileClassesTemp);
|
||||||
|
natcasesort($profileClassesKeys);
|
||||||
|
$profileClassesKeys = array_values($profileClassesKeys);
|
||||||
|
for ($i = 0; $i < sizeof($profileClassesKeys); $i++) {
|
||||||
|
$profileClasses[] = $profileClassesTemp[$profileClassesKeys[$i]];
|
||||||
|
}
|
||||||
|
|
||||||
// check if user is logged in, if not go to login
|
// check if user is logged in, if not go to login
|
||||||
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
||||||
|
|
|
@ -107,12 +107,7 @@ if (isset($_POST['save'])) {
|
||||||
// print error messages if any
|
// print error messages if any
|
||||||
if (sizeof($errors) > 0) {
|
if (sizeof($errors) > 0) {
|
||||||
for ($i = 0; $i < sizeof($errors); $i++) {
|
for ($i = 0; $i < sizeof($errors); $i++) {
|
||||||
if (sizeof($errors[$i]) > 3) { // messages with additional variables
|
call_user_func_array('StatusMessage', $errors[$i]);
|
||||||
StatusMessage($errors[$i][0], $errors[$i][1], $errors[$i][2], $errors[$i][3]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
StatusMessage($errors[$i][0], $errors[$i][1], $errors[$i][2]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo "<br>\n";
|
echo "<br>\n";
|
||||||
}
|
}
|
||||||
|
@ -246,7 +241,11 @@ for ($m = 0; $m < sizeof($modules); $m++) {
|
||||||
// profile name and submit/abort buttons
|
// profile name and submit/abort buttons
|
||||||
echo ("<b>" . _("Profile name") . ":</b> \n");
|
echo ("<b>" . _("Profile name") . ":</b> \n");
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
echo ("<input tabindex=\"$tabindex\" type=\"text\" name=\"profname\" value=\"" . $_GET['edit'] . "\">\n");
|
$profName = '';
|
||||||
|
if (isset($_GET['edit'])) {
|
||||||
|
$profName = $_GET['edit'];
|
||||||
|
}
|
||||||
|
echo ("<input tabindex=\"$tabindex\" type=\"text\" name=\"profname\" value=\"" . $profName . "\">\n");
|
||||||
printHelpLink(getHelp('', '360'), '360');
|
printHelpLink(getHelp('', '360'), '360');
|
||||||
echo "<br><br>\n";
|
echo "<br><br>\n";
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
|
|
Loading…
Reference in New Issue