From 160a5e3c40ca5c62d93b5647534f33dd534c73d8 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 15 May 2008 17:32:59 +0000 Subject: [PATCH] reduced PHP notices --- lam/lib/modules.inc | 2 +- lam/lib/modules/account.inc | 6 +++--- lam/lib/modules/inetOrgPerson.inc | 10 +++++----- lam/lib/modules/sambaGroupMapping.inc | 2 +- lam/templates/account/edit.php | 2 +- lam/templates/delete.php | 2 +- lam/templates/login.php | 4 +--- lam/templates/massBuildAccounts.php | 2 +- lam/templates/massDoUpload.php | 2 +- lam/templates/masscreate.php | 2 +- 10 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index bb33a313..ffa08d02 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -710,7 +710,7 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex if (isset($values[$input[$i][$j]['name']])) { if ($values[$input[$i][$j]['name']][0] == "true") $output .= ' checked'; } - elseif ($input[$i][$j]['checked']) $output .= ' checked'; + elseif (isset($input[$i][$j]['checked']) && ($input[$i][$j]['checked'])) $output .= ' checked'; } // other input element else { diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index df5c4b52..0bfcb458 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -46,7 +46,7 @@ class account extends baseModule { * @see baseModule::get_metaData() */ function get_metaData() { - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { $modules = $_SESSION['config']->get_AccountModules($this->get_scope()); } $return = array(); @@ -74,7 +74,7 @@ class account extends baseModule { $return['PDF_fields'] = array( 'description' ); - if ($_SESSION['loggedIn'] && !in_array('posixAccount', $modules)) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true) && !in_array('posixAccount', $modules)) { $return['PDF_fields'][] = 'uid'; } // help Entries @@ -101,7 +101,7 @@ class account extends baseModule { ) ); // upload columns - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { if ($this->get_scope() == 'user') { $return['upload_columns'][] = array( 'name' => 'account_hosts', diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 3eae010f..ac0bbade 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -142,7 +142,7 @@ class inetOrgPerson extends baseModule { 'title', 'telephoneNumber', 'facsimileTelephoneNumber', 'street', 'postOfficeBox', 'postalCode', 'postalAddress', 'sn', 'userPassword', 'description', 'homePhone', 'roomNumber', 'businessCategory', 'l', 'st', 'physicalDeliveryOfficeName', 'carLicense'); - if (($_SESSION['loggedIn']) && $this->supportUnixHosts()) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true) && $this->supportUnixHosts()) { $return['attributes'][] = 'host'; } // self service search attributes @@ -320,7 +320,7 @@ class inetOrgPerson extends baseModule { ) ); // cn and uid for upload (only if posixAccount is not loaded) - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { $modules = $_SESSION['config']->get_AccountModules($this->get_scope()); if (!in_array('posixAccount', $modules)) { $return['upload_columns'][] = array( @@ -341,7 +341,7 @@ class inetOrgPerson extends baseModule { } } // Unix workstations for upload - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { if ($this->supportUnixHosts()) { $return['upload_columns'][] = array( 'name' => 'inetOrgPerson_hosts', @@ -376,7 +376,7 @@ class inetOrgPerson extends baseModule { 'carLicense', 'officeName' ); - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { $modules = $_SESSION['config']->get_AccountModules($this->get_scope()); if (!in_array('posixAccount', $modules)) { $return['PDF_fields'][] = 'uid'; @@ -1660,7 +1660,7 @@ class inetOrgPerson extends baseModule { fclose($handle); $return['add']['jpegPhoto'][0] = $data; } - if ($_POST['removeReplacePhoto'] == 'on') { + if (isset($_POST['removeReplacePhoto']) && ($_POST['removeReplacePhoto'] == 'on')) { if ($_FILES['replacePhotoFile'] && ($_FILES['replacePhotoFile']['size'] > 0)) { $handle = fopen($_FILES['replacePhotoFile']['tmp_name'], "r"); $data = fread($handle, 1000000); diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 2a8ecc7f..4c8c50ba 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -273,7 +273,7 @@ class sambaGroupMapping extends baseModule { ); // upload fields // search existing Samba 3 domains - if ($_SESSION['loggedIn']) { + if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) { $domains = search_domains(); $domainNames = array(); for ($i = 0; $i < sizeof($domains); $i++) $domainNames[] = $domains[$i]->name; diff --git a/lam/templates/account/edit.php b/lam/templates/account/edit.php index 7d7f86b0..11c412fc 100644 --- a/lam/templates/account/edit.php +++ b/lam/templates/account/edit.php @@ -47,7 +47,7 @@ include_once('../../lib/modules.inc'); startSecureSession(); // Redirect to startpage if user is not loged in -if (!isset($_SESSION['loggedIn'])) { +if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) { metaRefresh("../login.php"); exit; } diff --git a/lam/templates/delete.php b/lam/templates/delete.php index bc1815d1..424a6a6c 100644 --- a/lam/templates/delete.php +++ b/lam/templates/delete.php @@ -54,7 +54,7 @@ if (!checkIfWriteAccessIsAllowed()) { } // Redirect to startpage if user is not loged in -if (!isset($_SESSION['loggedIn'])) { +if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) { metaRefresh("login.php"); exit; } diff --git a/lam/templates/login.php b/lam/templates/login.php index 431ef70c..c051a71c 100644 --- a/lam/templates/login.php +++ b/lam/templates/login.php @@ -455,9 +455,7 @@ elseif(!empty($_POST['profileChange'])) { display_LoginPage($_SESSION['config']); // Load login page } // Load login page -else -{ - $_SESSION['loggedIn'] = false; +else { $default_Config = new LAMCfgMain(); $default_Profile = $default_Config->default; $_SESSION["config"] = new LAMConfig($default_Profile); // Create new Config object diff --git a/lam/templates/massBuildAccounts.php b/lam/templates/massBuildAccounts.php index 19868550..02a9e3e6 100644 --- a/lam/templates/massBuildAccounts.php +++ b/lam/templates/massBuildAccounts.php @@ -45,7 +45,7 @@ startSecureSession(); if (!checkIfWriteAccessIsAllowed()) die(); // Redirect to startpage if user is not loged in -if (!isset($_SESSION['loggedIn'])) { +if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) { metaRefresh("login.php"); exit; } diff --git a/lam/templates/massDoUpload.php b/lam/templates/massDoUpload.php index 68631242..9cf74fc9 100644 --- a/lam/templates/massDoUpload.php +++ b/lam/templates/massDoUpload.php @@ -49,7 +49,7 @@ startSecureSession(); if (!checkIfWriteAccessIsAllowed()) die(); // Redirect to startpage if user is not loged in -if (!isset($_SESSION['loggedIn'])) { +if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) { metaRefresh("login.php"); exit; } diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index 98a5eafe..1e8119da 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -45,7 +45,7 @@ startSecureSession(); if (!checkIfWriteAccessIsAllowed()) die(); // Redirect to startpage if user is not loged in -if (!isset($_SESSION['loggedIn'])) { +if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) { metaRefresh("login.php"); exit; }