fixed several PHP notices

This commit is contained in:
Roland Gruber 2005-02-22 20:20:47 +00:00
parent dbb175de50
commit 1e53b1bb16
9 changed files with 87 additions and 78 deletions

View File

@ -356,16 +356,16 @@ function pwd_is_enabled($hash) {
if ($sr) {
$units = ldap_get_entries($_SESSION['ldap']->server, $sr);
// delete count entry
array_shift($units);
unset($units['count']);
// extract attributes
for ($i = 0; $i < sizeof($units); $i++) {
$ret[$i] = new samba3domain();
$ret[$i]->dn = $units[$i]['dn'];
$ret[$i]->name = $units[$i]['sambadomainname'][0];
$ret[$i]->SID = $units[$i]['sambasid'][0];
$ret[$i]->nextRID = $units[$i]['sambanextrid'][0];
$ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0];
$ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0];
if (isset($units[$i]['sambanextrid'][0])) $ret[$i]->nextRID = $units[$i]['sambanextrid'][0];
if (isset($units[$i]['sambanextgrouprid'][0])) $ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0];
if (isset($units[$i]['sambanextuserrid'][0])) $ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0];
if (isset($units[$i]['sambaalgorithmicridbase'][0])) $ret[$i]->RIDbase = $units[$i]['sambaalgorithmicridbase'][0];
}
// sort array by domain name

View File

@ -159,6 +159,7 @@ class Ldap{
$sr = @ldap_search($this->server(), $suffix, "objectClass=organizationalunit", array("DN"));
if ($sr) {
$units = ldap_get_entries($this->server, $sr);
unset($units['count']);
// extract Dns
for ($i = 0; $i < sizeof($units); $i++) {
if ($units[$i]['dn']) $ret[] = $units[$i]['dn'];

View File

@ -40,7 +40,7 @@ $Id$
function listBuildFilter($post, $attributes) {
$filter = array();
for ($i = 0; $i < sizeof($attributes); $i++) {
if (eregi('^([0-9a-z_\\*\\$])+$', $_POST["filter" . strtolower($attributes[$i])])) {
if (isset($_POST["filter" . strtolower($attributes[$i])]) && eregi('^([0-9a-z_\\*\\$])+$', $_POST["filter" . strtolower($attributes[$i])])) {
$filter[$attributes[$i]]['original'] = $_POST["filter" . strtolower($attributes[$i])];
$filter[$attributes[$i]]['regex'] = $_POST["filter" . strtolower($attributes[$i])];
// replace special characters
@ -212,11 +212,13 @@ function listPrintTableHeader($scope, $searchFilter, $desc_array, $attr_array, $
echo "</td>\n";
// print input boxes for filters
for ($k = 0; $k < sizeof ($desc_array); $k++) {
$value = "";
if (isset($_POST["filter" . strtolower($attr_array[$k])])) {
$value = " value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\"";
}
echo "<td>";
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) .
"\" value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\"" .
"title=\"" . _("Here you can input small filters (e.g. 'value' or 'v*').") . "\"" .
">");
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) ."\"" .
$value . "title=\"" . _("Here you can input small filters (e.g. 'value' or 'v*').") . "\">");
echo "</td>\n";
}
echo "</tr>\n";
@ -229,14 +231,14 @@ function listPrintTableHeader($scope, $searchFilter, $desc_array, $attr_array, $
*/
function listDoPost($scope) {
// check if button was pressed and if we have to add/delete an account
if ($_POST['new'] || $_POST['del'] || $_POST['pdf'] || $_POST['pdf_all']){
if (isset($_POST['new']) || isset($_POST['del']) || isset($_POST['pdf']) || isset($_POST['pdf_all'])){
// add new account
if ($_POST['new']){
if (isset($_POST['new'])){
metaRefresh("../account/edit.php?type=" . $scope);
exit;
}
// delete account(s)
elseif ($_POST['del']){
elseif (isset($_POST['del'])){
// search for checkboxes
$accounts = array_keys($_POST, "on");
$_SESSION['delete_dn'] = array();
@ -249,7 +251,7 @@ function listDoPost($scope) {
}
}
// PDF for selected accounts
elseif ($_POST['pdf']){
elseif (isset($_POST['pdf'])){
$pdf_structure = $_POST['pdf_structure'];
// search for checkboxes
$accounts = array_keys($_POST, "on");
@ -266,7 +268,7 @@ function listDoPost($scope) {
}
}
// PDF for all accounts
elseif ($_POST['pdf_all']){
elseif (isset($_POST['pdf_all'])){
$list = array();
for ($i = 0; $i < sizeof($_SESSION[$scope . 'info']); $i++) {
$_SESSION["accountPDF-$i"] = new accountContainer($scope, "accountPDF-$i");

View File

@ -317,7 +317,7 @@ class posixAccount extends baseModule {
),
'homeDirectory' => array(
"Headline" => _("Home directory"),
"Text" => _("$user and $group are replaced with username or primary groupname.")
"Text" => _('$user and $group are replaced with username or primary groupname.')
),
/*'userPassword' =>*/
'userPassword_no' => array(

View File

@ -47,9 +47,6 @@ setlanguage();
$scope = 'domain';
// get sorting column when register_globals is off
$sort = $_GET['sort'];
// copy HTTP-GET variables to HTTP-POST
$_POST = $_POST + $_GET;
@ -57,14 +54,14 @@ $info = $_SESSION[$scope . 'info'];
$dom_units = $_SESSION['dom_units'];
// check if button was pressed and if we have to add/delete a domain
if ($_POST['new_domain'] || $_POST['del_domain']){
if (isset($_POST['new_domain']) || isset($_POST['del_domain'])){
// add new domain
if ($_POST['new_domain']){
if (isset($_POST['new_domain'])){
metaRefresh("../domain.php?action=new");
exit;
}
// delete domain(s)
if ($_POST['del_domain']){
if (isset($_POST['del_domain'])){
// search for checkboxes
$domains = array_keys($_POST, "on");
$domainstr = implode(";", $domains);
@ -82,8 +79,9 @@ echo "</head><body>\n";
echo "<script src=\"../../lib/functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
// get current page
$page = $_GET["page"];
if (!$page) $page = 1;
if (isset($_GET["page"])) $page = $_GET["page"];
else $page = 1;
// take maximum count of domain entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_page_entries = 10; // default setting, if not yet set
@ -101,14 +99,17 @@ $desc_array[] = strtoupper(_("Domain name"));
$desc_array[] = strtoupper(_("Domain SID"));
$desc_array[] = "DN";
if (isset($_GET["sort"])) $sort = $_GET["sort"];
else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['dom_suffix']) $dom_suffix = $_POST['dom_suffix']; // new suffix selected via combobox
elseif ($_SESSION['dom_suffix']) $dom_suffix = $_SESSION['dom_suffix']; // old suffix from session
if (isset($_POST['dom_suffix'])) $dom_suffix = $_POST['dom_suffix']; // new suffix selected via combobox
elseif (isset($_SESSION['dom_suffix'])) $dom_suffix = $_SESSION['dom_suffix']; // old suffix from session
else $dom_suffix = $_SESSION["config"]->get_DomainSuffix(); // default suffix
$refresh = true;
if ($_GET['norefresh']) $refresh = false;
if ($_POST['refresh']) $refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
if (isset($_POST['refresh'])) $refresh = true;
if ($refresh) {
// configure search filter
@ -194,7 +195,7 @@ listDrawNavigationBar(sizeof($info), $max_page_entries, $page, $sort, '', "domai
echo ("<br>\n");
}
if (! $_GET['norefresh']) {
if ($refresh) {
// generate list of possible suffixes
$dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix());
}

View File

@ -51,9 +51,6 @@ setlanguage();
$scope = 'group';
// get sorting column when register_globals is off
$sort = $_GET['sort'];
// copy HTTP-GET variables to HTTP-POST
$_POST = $_POST + $_GET;
@ -76,8 +73,9 @@ $temp_array = explode(";", $attr_string);
$hash_table = listGetAttributeGroupArray();
// get current page
$page = $_GET["page"];
if (!$page) $page = 1;
if (isset($_GET["page"])) $page = $_GET["page"];
else $page = 1;
// take maximum count of group entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_page_entries = 10; // default setting, if not yet set
@ -102,14 +100,18 @@ for ($i = 0; $i < sizeof($temp_array); $i++) {
}
}
// get sorting column
if (isset($_GET["sort"])) $sort = $_GET["sort"];
else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['grp_suffix']) $grp_suffix = $_POST['grp_suffix']; // new suffix selected via combobox
elseif ($_SESSION['grp_suffix']) $grp_suffix = $_SESSION['grp_suffix']; // old suffix from session
else $grp_suffix = $_SESSION["config"]->get_GroupSuffix(); // default suffix
$refresh = true;
if ($_GET['norefresh']) $refresh = false;
if ($_POST['refresh']) $refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
if (isset($_POST['refresh'])) $refresh = true;
if ($refresh) {
// configure search filter
@ -180,7 +182,7 @@ if (sizeof($info) > 0) {
" onMouseOut=\"group_out(this, '" . $i . "')\"" .
" onClick=\"group_click(this, '" . $i . "')\"" .
" onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=group&amp;DN=" . $info[$i]['dn'] . "'\">");
if ($_GET['selectall'] == "yes") {
if (isset($_GET['selectall'])) {
echo " <td height=22 align=\"center\"><input onClick=\"group_click(this, '" . $i . "')\" type=\"checkbox\"" .
" name=\"" . $i . "\" checked></td>";
}
@ -241,7 +243,7 @@ listDrawNavigationBar(sizeof($info), $max_page_entries, $page, $sort, $searchFil
echo ("<br>\n");
}
if (! $_GET['norefresh']) {
if ($refresh) {
// generate list of possible suffixes
$grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix());
}

View File

@ -51,9 +51,6 @@ setlanguage();
$scope = 'host';
// get sorting column when register_globals is off
$sort = $_GET['sort'];
// copy HTTP-GET variables to HTTP-POST
$_POST = $_POST + $_GET;
@ -76,8 +73,9 @@ $temp_array = explode(";", $attr_string);
$hash_table = listGetAttributeHostArray();
// get current page
$page = $_GET["page"];
if (!$page) $page = 1;
if (isset($_GET["page"])) $page = $_GET["page"];
else $page = 1;
// take maximum count of host entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_page_entries = 10; // default setting, if not yet set
@ -102,14 +100,18 @@ else {
}
}
// get sorting column
if (isset($_GET["sort"])) $sort = $_GET["sort"];
else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['hst_suffix']) $hst_suffix = $_POST['hst_suffix']; // new suffix selected via combobox
elseif ($_SESSION['hst_suffix']) $hst_suffix = $_SESSION['hst_suffix']; // old suffix from session
else $hst_suffix = $_SESSION["config"]->get_HostSuffix(); // default suffix
$refresh = true;
if ($_GET['norefresh']) $refresh = false;
if ($_POST['refresh']) $refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
if (isset($_POST['refresh'])) $refresh = true;
if ($refresh) {
// configure search filter
@ -180,7 +182,7 @@ if (sizeof($info) > 0) {
" onMouseOut=\"host_out(this, '" . $i . "')\"" .
" onClick=\"host_click(this, '" . $i . "')\"" .
" onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=host&amp;DN=" . $info[$i]['dn'] . "'\">");
if ($_GET['selectall'] == "yes") {
if (isset($_GET['selectall'])) {
echo " <td height=22 align=\"center\"><input onClick=\"host_click(this, '" . $i . "')\"" .
" type=\"checkbox\" checked name=\"" . $i . "\"></td>";
}
@ -225,7 +227,7 @@ listDrawNavigationBar(sizeof($info), $max_page_entries, $page, $sort, $searchFil
echo ("<br>\n");
}
if (! $_GET['norefresh']) {
if ($refresh) {
// generate list of possible suffixes
$hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix());
}

View File

@ -56,12 +56,17 @@ $scope = 'user';
// copy HTTP-GET variables to HTTP-POST
$_POST = $_POST + $_GET;
$refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
if (isset($_POST['refresh'])) $refresh = true;
// check if primary group should be translated
if ($_POST['trans_primary'] == "on") $trans_primary = "on";
if (isset($_POST['trans_primary'])) $trans_primary = "on";
else $trans_primary = "off";
$trans_primary_hash = $_SESSION['trans_primary_hash'];
if (isset($_SESSION['trans_primary_hash'])) $trans_primary_hash = $_SESSION['trans_primary_hash'];
else $trans_primary_hash = array();
// generate hash table for group translation
if ($trans_primary == "on" && !$_GET["norefresh"]) {
if ($trans_primary == "on" && ($refresh || (sizeof($trans_primary_hash) == 0))) {
$trans_primary_hash = array();
$suffix = $_SESSION['config']->get_groupSuffix();
$filter = "objectClass=posixGroup";
@ -90,8 +95,9 @@ echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\"
echo "</head><body>\n";
echo "<script src=\"../../lib/functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
$page = $_GET["page"];
if (!$page) $page = 1;
// get current page
if (isset($_GET["page"])) $page = $_GET["page"];
else $page = 1;
// take maximum count of user entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0) {
@ -124,9 +130,8 @@ for ($i = 0; $i < sizeof($temp_array); $i++) {
}
}
$sort = $_GET["sort"];
if (!$sort)
$sort = strtolower($attr_array[0]);
if (isset($_GET["sort"])) $sort = $_GET["sort"];
else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['usr_suffix']) $usr_suffix = $_POST['usr_suffix']; // new suffix selected via combobox
@ -138,10 +143,6 @@ else $usr_suffix = $_SESSION["config"]->get_UserSuffix(); // default suffix
$module_filter = get_ldap_filter("user"); // basic filter is provided by modules
$filter = "(&" . $module_filter . ")";
$refresh = true;
if ($_GET['norefresh']) $refresh = false;
if ($_POST['refresh']) $refresh = true;
if ($refresh) {
$attrs = $attr_array;
$sr = @ldap_search($_SESSION["ldap"]->server(), $usr_suffix, $filter, $attrs);
@ -212,7 +213,7 @@ if ($user_count != 0) {
if ($trans_primary == "on") {
// translate GIDs
for ($i = 0; $i < sizeof($info); $i++) {
if ($trans_primary_hash[$info[$i]['gidnumber'][0]]) {
if (isset($trans_primary_hash[$info[$i]['gidnumber'][0]])) {
$info[$i]['gidnumber'][0] = $trans_primary_hash[$info[$i]['gidnumber'][0]];
}
}
@ -229,7 +230,7 @@ if ($user_count != 0) {
"onClick=\"user_click(this, '" . $i . "')\"\n" .
"onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=user&amp;DN=" . $info[$i]['dn'] . "'\">\n");
// checkboxes if selectall = "yes"
if ($_GET['selectall'] == "yes") {
if (isset($_GET['selectall'])) {
echo "<td height=22 align=\"center\">\n<input onClick=\"user_click(this, '" . $i . "')\" type=\"checkbox\" name=\"" .
$i . "\" checked>\n</td>\n";
}
@ -275,7 +276,7 @@ if ($user_count != 0) {
echo ("<br>");
}
if (! $_GET['norefresh']) {
if ($refresh) {
// generate list of possible suffixes
$usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix());
}

View File

@ -33,7 +33,7 @@ function display_LoginPage($config_object,$profile)
global $error_message;
// generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand()
if(function_exists(mcrypt_create_iv)) {
if(function_exists('mcrypt_create_iv')) {
$key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
if (! $key) {