refactoring

This commit is contained in:
Roland Gruber 2017-10-24 21:06:18 +02:00
parent f1decc1f4c
commit fce8908a72
3 changed files with 15 additions and 23 deletions

View File

@ -92,19 +92,21 @@ if (isset($_POST['add_suff']) || isset($_POST['cancel'])) {
if (!@ldap_add($_SESSION['ldap']->server(), $dn, $attr)) {
// check if we have to add parent entries
if (ldap_errno($_SESSION['ldap']->server()) == 32) {
$temp = explode(",", $suff);
$dnParts = explode(",", $suff);
$subsuffs = array();
// make list of subsuffixes
for ($k = 0; $k < sizeof($temp); $k++) {
$part = explode("=", $temp[$k]);
if ($part[0] == "ou") $subsuffs[] = implode(",", array_slice($temp, $k));
$dnPartsCount = sizeof($dnParts);
for ($k = 0; $k < $dnPartsCount; $k++) {
$part = explode("=", $dnParts[$k]);
if ($part[0] == "ou") $subsuffs[] = implode(",", array_slice($dnParts, $k));
else {
$subsuffs[] = implode(",", array_slice($temp, $k));
$subsuffs[] = implode(",", array_slice($dnParts, $k));
break;
}
}
// create missing entries
for ($k = sizeof($subsuffs) - 1; $k >= 0; $k--) {
$subsuffCount = sizeof($subsuffs);
for ($k = $subsuffCount - 1; $k >= 0; $k--) {
// check if subsuffix is present
$info = ldap_read($_SESSION['ldap']->server(), escapeDN($subsuffs[$k]), "objectclass=*", array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
$res = ldap_get_entries($_SESSION['ldap']->server(), $info);

View File

@ -294,9 +294,9 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
if (!empty($config_object)) {
// check extensions
$extList = getRequiredExtensions();
for ($i = 0; $i < sizeof($extList); $i++) {
if (!extension_loaded($extList[$i])) {
StatusMessage("ERROR", "A required PHP extension is missing!", $extList[$i]);
foreach ($extList as $extension) {
if (!extension_loaded($extension)) {
StatusMessage("ERROR", "A required PHP extension is missing!", $extension);
echo "<br>";
}
}
@ -369,14 +369,14 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
if ($config_object->getLoginMethod() == LAMConfig::LOGIN_LIST) {
$admins = $config_object->get_Admins();
$adminList = array();
for($i = 0; $i < count($admins); $i++) {
$text = explode(",", $admins[$i]);
foreach ($admins as $admin) {
$text = explode(",", $admin);
$text = explode("=", $text[0]);
if (isset($text[1])) {
$adminList[$text[1]] = $admins[$i];
$adminList[$text[1]] = $admin;
}
else {
$adminList[$text[0]] = $admins[$i];
$adminList[$text[0]] = $admin;
}
}
$selectedAdmin = array();

View File

@ -144,16 +144,6 @@ if (isset($_POST['submit'])) {
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/" . $cssEntry . "\">\n";
}
if (isset($profile->additionalCSS) && ($profile->additionalCSS != '')) {
$CSSlinks = explode("\n", $profile->additionalCSS);
for ($i = 0; $i < sizeof($CSSlinks); $i++) {
$CSSlinks[$i] = trim($CSSlinks[$i]);
if ($CSSlinks[$i] == '') {
continue;
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $CSSlinks[$i] . "\">\n";
}
}
?>
</head>
<body class="admin">