From e5f0cdbbf6667ae68b1986c1b08980647e99d2e2 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 24 Apr 2008 18:50:02 +0000 Subject: [PATCH] fixed PHP notices --- lam/lib/modules/inetOrgPerson.inc | 6 ++++-- lam/lib/modules/phpGroupwareUser.inc | 6 +++--- lam/templates/config/confmain.php | 17 +++++++---------- lam/templates/config/conftypes.php | 4 ++-- lam/templates/config/mainmanage.php | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index d22ee6d3..3eae010f 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -673,7 +673,7 @@ class inetOrgPerson extends baseModule { if ( !get_preg($this->attributes['title'][0], 'title')) $errors[] = $this->messages['title'][0]; if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0]; if ( !get_preg($this->attributes['businessCategory'][0], 'businessCategory')) $errors[] = $this->messages['businessCategory'][0]; - if ($_POST['userPassword']) { + if (isset($_POST['userPassword'])) { if ($_POST['userPassword'] != $_POST['userPassword2']) { $errors[] = $this->messages['userPassword'][0]; } @@ -692,7 +692,9 @@ class inetOrgPerson extends baseModule { } } } - if ($_POST['delPhoto']) $this->attributes['jpegPhoto'] = array(); + if (isset($_POST['delPhoto'])) { + $this->attributes['jpegPhoto'] = array(); + } // Return error-messages return $errors; } diff --git a/lam/lib/modules/phpGroupwareUser.inc b/lam/lib/modules/phpGroupwareUser.inc index 55e1ed68..59546815 100644 --- a/lam/lib/modules/phpGroupwareUser.inc +++ b/lam/lib/modules/phpGroupwareUser.inc @@ -193,6 +193,9 @@ class phpGroupwareUser extends baseModule { * @return array list of info/error messages */ public function process_attributes() { + if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) { + $this->attributes['phpgwAccountStatus'][0] = $_POST['phpgwAccountStatus']; + } if (isset($_POST['form_subpage_phpGroupwareUser_attributes_addObjectClass'])) { $this->attributes['objectClass'][] = 'phpgwAccount'; $this->attributes['phpgwAccountExpires'][0] = "-1"; @@ -205,9 +208,6 @@ class phpGroupwareUser extends baseModule { } } } - if (isset($this->attributes['objectClass']) && in_array('phpgwAccount', $this->attributes['objectClass'])) { - $this->attributes['phpgwAccountStatus'][0] = $_POST['phpgwAccountStatus']; - } return array(); } diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index ece04ba6..3b4d2ace 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -48,7 +48,7 @@ if (isset($_POST['passwd'])) $passwd = $_POST['passwd']; // check if password was entered // if not: load login page -if (!$passwd && !isset($_SESSION['conf_isAuthenticated'])) { +if (!isset($passwd) && !isset($_SESSION['conf_isAuthenticated'])) { $_SESSION['conf_message'] = _("No password was entered!"); /** go back to login if password is empty */ require('conflogin.php'); @@ -62,7 +62,7 @@ $conf = &$_SESSION['conf_config']; // check if password is valid // if not: load login page -if (!$conf->check_Passwd($passwd) && !($_SESSION['conf_isAuthenticated'] === $conf->getName())) { +if ((!isset($_SESSION['conf_isAuthenticated']) || !($_SESSION['conf_isAuthenticated'] === $conf->getName())) && !$conf->check_Passwd($passwd)) { $sessionKeys = array_keys($_SESSION); for ($i = 0; $i < sizeof($sessionKeys); $i++) { if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]); @@ -77,21 +77,21 @@ $_SESSION['conf_isAuthenticated'] = $conf->getName(); // check if button was pressed and if we have to save the setting or go back to login if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){ // go to final page - if ($_POST['submitconf']){ + if (isset($_POST['submitconf'])){ saveSettings(); } // go to modules page - elseif ($_POST['editmodules']){ + elseif (isset($_POST['editmodules'])){ metaRefresh("confmodules.php"); exit; } // go to types page - elseif ($_POST['edittypes']){ + elseif (isset($_POST['edittypes'])){ metaRefresh("conftypes.php"); exit; } // back to login - else if ($_POST['back']){ + else if (isset($_POST['back'])){ metaRefresh("../login.php"); exit; } @@ -465,9 +465,6 @@ echo ("

 

"); echo ("

* = ". _("required") . "

"); -// password for configuration -echo ("

\n"); - echo ("\n"); echo ("\n"); echo ("\n"); @@ -560,7 +557,7 @@ function saveSettings() { } // checkboxes elseif ($_SESSION['conf_types'][$element] == "checkbox") { - if ($_POST[$element] == "on") $options[$element] = array('true'); + if (isset($_POST[$element]) && ($_POST[$element] == "on")) $options[$element] = array('true'); else $options[$element] = array('false'); } // dropdownbox diff --git a/lam/templates/config/conftypes.php b/lam/templates/config/conftypes.php index af4e66fe..05568b64 100644 --- a/lam/templates/config/conftypes.php +++ b/lam/templates/config/conftypes.php @@ -67,7 +67,7 @@ if (isset($_POST['postAvailable'])) { $errors = array(); // user pressed submit/abort button -if ($_POST['submit']) { +if (isset($_POST['submit'])) { // check settings $allOK = true; $postKeys = array_keys($_POST); @@ -111,7 +111,7 @@ if ($_POST['submit']) { } } // no changes -elseif ($_POST['abort']) { +elseif (isset($_POST['abort'])) { $_SESSION['conf_accountTypes'] = $_SESSION['conf_accountTypesOld']; metarefresh('confmain.php?typesback=true'); exit; diff --git a/lam/templates/config/mainmanage.php b/lam/templates/config/mainmanage.php index b980fc64..2827d631 100644 --- a/lam/templates/config/mainmanage.php +++ b/lam/templates/config/mainmanage.php @@ -70,7 +70,7 @@ echo $_SESSION['header'];