fixed several minor problems after code analysis

This commit is contained in:
Roland Gruber 2004-09-14 18:56:41 +00:00
parent 3b47260d69
commit a8ddb13545
9 changed files with 25 additions and 17 deletions

View File

@ -322,7 +322,7 @@ class Cipher_blowfish {
var $_rounds = 16;
/** Constructor */
function Cipher_blowfish($params = null)
function Cipher_blowfish()
{
}

View File

@ -224,6 +224,7 @@ class Ldap{
ldap_free_result($sr);
return $ret;
}
else return "";
}
/**
@ -301,7 +302,7 @@ class Ldap{
if ($info) {
$this->objectClasses = $info[0]['objectclasses'];
array_shift($this->objectClasses);
return true;
return;
}
}
// if search failed save empty result
@ -357,7 +358,7 @@ class Ldap{
}
}
}
@closedir($h);
@closedir($dir);
}
}
@ -488,6 +489,7 @@ class Ldap{
elseif ($part_a == max($part_a, $part_b)) return 1;
else return -1;
}
return -1;
}
/**

View File

@ -59,12 +59,12 @@ function listSort($sort, $attr_array, $info) {
if ($sort != "dn") {
// sort by first attribute with name $sort
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
elseif ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
}
else {
if ($a[$sort] == $b[$sort]) return 0;
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
elseif ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
else return -1;
}
}

View File

@ -326,6 +326,7 @@ function saveHostProfile($attributes, $profile) {
* Deletes a user profile
*
* @param string $file name of profile (Without .pru)
* @return boolean true if profile was deleted
*/
function delUserProfile($file) {
if (!$_SESSION['loggedIn'] == true) return false;
@ -334,12 +335,14 @@ function delUserProfile($file) {
if (is_file($prof)) {
return @unlink($prof);
}
else return false;
}
/**
* Deletes a group profile
*
* @param string $file name of profile (Without .prg)
* @return boolean true if profile was deleted
*/
function delGroupProfile($file) {
if (!$_SESSION['loggedIn'] == true) return false;
@ -348,12 +351,14 @@ function delGroupProfile($file) {
if (is_file($prof)) {
return @unlink($prof);
}
else return false;
}
/**
* Deletes a host profile
*
* @param string $file name of profile (Without .prh)
* @return boolean true if profile was deleted
*/
function delHostProfile($file) {
if (!$_SESSION['loggedIn'] == true) return false;
@ -362,6 +367,7 @@ function delHostProfile($file) {
if (is_file($prof)) {
return @unlink($prof);
}
else return false;
}
?>

View File

@ -89,7 +89,7 @@ echo $_SESSION['header'];
<tr><td style="border-style:none" >&nbsp;</td></tr>
<?php
// print message if login was incorrect
if ($message) {
if ($message) { // $message is set by confmain.php (requires conflogin.php then)
echo ("<tr><td style=\"border-style:none\" rowspan=\"2\"></td>" .
"<td style=\"border-style:none\" colspan=2 align=\"center\"><b><font color=red>" . $message . "</font></b></td>" .
"<td style=\"border-style:none\" rowspan=\"2\"></td></tr>");

View File

@ -264,7 +264,7 @@ elseif ($_POST['sub_save']) {
if ($_POST['dom_DN'] != $newDN) {
$success = ldap_rename($_SESSION['ldap']->server(), $_POST['dom_DN'], $RDN, $_POST['dom_suffix'], true);
}
if ($success) StatusMessage("INFO", _("Domain has been modified."), $DN);
if ($success) StatusMessage("INFO", _("Domain has been modified."), $_POST['dom_DN']);
else StatusMessage("ERROR", "", _("Failed to modify domain!"));
}
// add entry

View File

@ -135,7 +135,7 @@ echo ("<form action=\"listdomains.php\" method=\"post\">\n");
// draw navigation bar if domain accounts were found
if (sizeof($dom_info) > 0) {
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, $searchFilter, "domain", _("%s Samba domain(s) found"));
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, '', "domain", _("%s Samba domain(s) found"));
echo ("<br>\n");
}
@ -185,7 +185,7 @@ echo ("<br>");
// draw navigation bar if domain accounts were found
if (sizeof($dom_info) > 0) {
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, $searchFilter, "domain", _("%s Samba domain(s) found"));
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, '', "domain", _("%s Samba domain(s) found"));
echo ("<br>\n");
}

View File

@ -110,21 +110,21 @@ else { // input data is valid, save profile
// save profile
if ($_POST['accounttype'] == "user") {
if (saveUserProfile($options, $_POST['profname'])) {
echo StatusMessage("INFO", _("Profile was saved."), $profname);
echo StatusMessage("INFO", _("Profile was saved."), $_POST['profname']);
}
else StatusMessage("ERROR", _("Unable to save profile!"), $profname);
else StatusMessage("ERROR", _("Unable to save profile!"), $_POST['profname']);
}
elseif ($_POST['accounttype'] == "group") {
if (saveGroupProfile($options, $_POST['profname'])) {
echo StatusMessage("INFO", _("Profile was saved."), $profname);
echo StatusMessage("INFO", _("Profile was saved."), $_POST['profname']);
}
else StatusMessage("ERROR", _("Unable to save profile!"), $profname);
else StatusMessage("ERROR", _("Unable to save profile!"), $_POST['profname']);
}
elseif ($_POST['accounttype'] == "host") {
if (saveHostProfile($options, $_POST['profname'])) {
echo StatusMessage("INFO", _("Profile was saved."), $profname);
echo StatusMessage("INFO", _("Profile was saved."), $_POST['profname']);
}
else StatusMessage("ERROR", _("Unable to save profile!"), $profname);
else StatusMessage("ERROR", _("Unable to save profile!"), $_POST['profname']);
}
echo ("<br><p><a href=\"profilemain.php\">" . _("Back to Profile Editor") . "</a></p>");
}

View File

@ -68,8 +68,8 @@ $options = getProfileOptions($type);
$old_options = array();
if ($_GET['edit']) {
if ($type == "user") $old_options = loadUserProfile($_GET['edit']);
else if ($type == "group") $old_options = loadGroupProfile($_GET['edit']);
else if ($type == "host") $old_options = loadHostProfile($_GET['edit']);
elseif ($type == "group") $old_options = loadGroupProfile($_GET['edit']);
elseif ($type == "host") $old_options = loadHostProfile($_GET['edit']);
}
// display formular