fixed some PHP notices

This commit is contained in:
Roland Gruber 2007-10-05 18:09:49 +00:00
parent dbe925a813
commit 1356231d8a
7 changed files with 28 additions and 26 deletions

View File

@ -360,7 +360,7 @@ abstract class baseModule {
$identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]); $identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]);
for ($i = 0; $i < sizeof($identifiers); $i++) { for ($i = 0; $i < sizeof($identifiers); $i++) {
// check if option is required // check if option is required
if ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required'] && ($options[$identifiers[$i]][0] == '')) { if (isset($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required']) && ($options[$identifiers[$i]][0] == '')) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required_message']; $messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['required_message'];
} }
switch ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type']) { switch ($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['type']) {

View File

@ -265,12 +265,11 @@ class lamList {
function cmp_array(&$a, &$b) { function cmp_array(&$a, &$b) {
// sort specifies the sort column // sort specifies the sort column
$sort = $this->sortColumn; $sort = $this->sortColumn;
$attr_array = $this->attrArray;
// sort by first column if no attribute is given // sort by first column if no attribute is given
if (!$sort) $sort = strtolower($attr_array[0]); if (!$sort) $sort = strtolower($this->attrArray[0]);
if ($sort != "dn") { if ($sort != "dn") {
// sort by first attribute with name $sort // sort by first attribute with name $sort
return strnatcasecmp($a[$sort][0], $b[$sort][0]); return @strnatcasecmp($a[$sort][0], $b[$sort][0]);
} }
else { else {
return strnatcasecmp($a[$sort], $b[$sort]); return strnatcasecmp($a[$sort], $b[$sort]);

View File

@ -322,7 +322,9 @@ function checkConfigOptions($scopes, $options) {
for ($i = 0; $i < sizeof($modules); $i++) { for ($i = 0; $i < sizeof($modules); $i++) {
$m = new $modules[$i]('none'); $m = new $modules[$i]('none');
$errors = $m->check_configOptions($scopes[$modules[$i]], $options); $errors = $m->check_configOptions($scopes[$modules[$i]], $options);
$return = array_merge($return, $errors); if (isset($errors) && is_array($errors)) {
$return = array_merge($return, $errors);
}
} }
return $return; return $return;
} }

View File

@ -440,11 +440,11 @@ class posixAccount extends baseModule {
* @return boolean true, if settings are complete * @return boolean true, if settings are complete
*/ */
function module_complete() { function module_complete() {
if ($this->attributes['uid'][0] == '') return false; if (!isset($this->attributes['uid'][0]) || ($this->attributes['uid'][0] == '')) return false;
if ($this->attributes['uidNumber'][0] == '') return false; if (!isset($this->attributes['uidNumber'][0]) || ($this->attributes['uidNumber'][0] == '')) return false;
if ($this->attributes['gidNumber'][0] == '') return false; if (!isset($this->attributes['gidNumber'][0]) || ($this->attributes['gidNumber'][0] == '')) return false;
if ($this->attributes['homeDirectory'][0] == '') return false; if (!isset($this->attributes['homeDirectory'][0]) || ($this->attributes['homeDirectory'][0] == '')) return false;
if ($this->attributes['loginShell'][0] == '') return false; if (!isset($this->attributes['loginShell'][0]) || ($this->attributes['loginShell'][0] == '')) return false;
return true; return true;
} }
@ -456,6 +456,7 @@ class posixAccount extends baseModule {
function load_attributes($attr) { function load_attributes($attr) {
parent::load_attributes($attr); parent::load_attributes($attr);
// get additional group memberships // get additional group memberships
if (!isset($attr['uid'][0])) return;
$dn_groups = $_SESSION['cache']->get_cache(array('memberUid', 'cn'), 'posixGroup', 'group'); $dn_groups = $_SESSION['cache']->get_cache(array('memberUid', 'cn'), 'posixGroup', 'group');
if (is_array($dn_groups)) { if (is_array($dn_groups)) {
$DNs = array_keys($dn_groups); $DNs = array_keys($dn_groups);

View File

@ -503,7 +503,7 @@ class sambaSamAccount extends baseModule {
*/ */
function load_attributes($attr) { function load_attributes($attr) {
parent::load_attributes($attr); parent::load_attributes($attr);
if (is_string($this->attributes['sambaAcctFlags'][0])) { if (isset($this->attributes['sambaAcctFlags'][0])) {
if (strpos($this->attributes['sambaAcctFlags'][0], "D")) $this->deactivated = true; if (strpos($this->attributes['sambaAcctFlags'][0], "D")) $this->deactivated = true;
else $this->deactivated = false; else $this->deactivated = false;
if (strpos($this->attributes['sambaAcctFlags'][0], "N")) $this->nopwd = true; if (strpos($this->attributes['sambaAcctFlags'][0], "N")) $this->nopwd = true;
@ -601,11 +601,11 @@ class sambaSamAccount extends baseModule {
else { else {
$this->nopwd = false; $this->nopwd = false;
} }
if ($_POST['sambaAcctFlagsS']) $flag .= "S"; if (isset($_POST['sambaAcctFlagsS'])) $flag .= "S";
if ($_POST['sambaAcctFlagsH']) $flag .= "H"; if (isset($_POST['sambaAcctFlagsH'])) $flag .= "H";
if ($_POST['sambaAcctFlagsW']) $flag .= "W"; if (isset($_POST['sambaAcctFlagsW'])) $flag .= "W";
if ($_POST['sambaAcctFlagsU']) $flag .= "U"; if (isset($_POST['sambaAcctFlagsU'])) $flag .= "U";
if ($_POST['sambaAcctFlagsL']) $flag .= "L"; if (isset($_POST['sambaAcctFlagsL'])) $flag .= "L";
// Expand string to fixed length // Expand string to fixed length
$flag = str_pad($flag, 12); $flag = str_pad($flag, 12);
// End character // End character

View File

@ -186,7 +186,7 @@ class lamUserList extends lamList {
*/ */
function listPrintTableCellContent(&$entry, &$attribute) { function listPrintTableCellContent(&$entry, &$attribute) {
// check if there is something to display at all // check if there is something to display at all
if (!is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1)) return; if (!isset($entry[$attribute]) || !is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1)) return;
if (isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']); if (isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']);
// translate GID to group name // translate GID to group name
if (($attribute == "gidnumber") && ($this->trans_primary == "on")) { if (($attribute == "gidnumber") && ($this->trans_primary == "on")) {

View File

@ -502,15 +502,15 @@ function saveSettings() {
$chmodOwner = 0; $chmodOwner = 0;
$chmodGroup = 0; $chmodGroup = 0;
$chmodOther = 0; $chmodOther = 0;
if ($_POST['chmod_owr'] == 'on') $chmodOwner += 4; if (isset($_POST['chmod_owr']) && ($_POST['chmod_owr'] == 'on')) $chmodOwner += 4;
if ($_POST['chmod_oww'] == 'on') $chmodOwner += 2; if (isset($_POST['chmod_oww']) && ($_POST['chmod_oww'] == 'on')) $chmodOwner += 2;
if ($_POST['chmod_owe'] == 'on') $chmodOwner += 1; if (isset($_POST['chmod_owe']) && ($_POST['chmod_owe'] == 'on')) $chmodOwner += 1;
if ($_POST['chmod_grr'] == 'on') $chmodGroup += 4; if (isset($_POST['chmod_grr']) && ($_POST['chmod_grr'] == 'on')) $chmodGroup += 4;
if ($_POST['chmod_grw'] == 'on') $chmodGroup += 2; if (isset($_POST['chmod_grw']) && ($_POST['chmod_grw'] == 'on')) $chmodGroup += 2;
if ($_POST['chmod_gre'] == 'on') $chmodGroup += 1; if (isset($_POST['chmod_gre']) && ($_POST['chmod_gre'] == 'on')) $chmodGroup += 1;
if ($_POST['chmod_otr'] == 'on') $chmodOther += 4; if (isset($_POST['chmod_otr']) && ($_POST['chmod_otr'] == 'on')) $chmodOther += 4;
if ($_POST['chmod_otw'] == 'on') $chmodOther += 2; if (isset($_POST['chmod_otw']) && ($_POST['chmod_otw'] == 'on')) $chmodOther += 2;
if ($_POST['chmod_ote'] == 'on') $chmodOther += 1; if (isset($_POST['chmod_ote']) && ($_POST['chmod_ote'] == 'on')) $chmodOther += 1;
$chmod = $chmodOwner . $chmodGroup . $chmodOther; $chmod = $chmodOwner . $chmodGroup . $chmodOther;
if (!$conf->set_scriptrights($chmod)) { if (!$conf->set_scriptrights($chmod)) {
$errors[] = array("ERROR", _("Script rights are invalid!")); $errors[] = array("ERROR", _("Script rights are invalid!"));