From dc7578a39ae40768f6f64309d8757d7633f4088c Mon Sep 17 00:00:00 2001 From: skeeter Date: Mon, 14 May 2001 03:54:40 +0000 Subject: [PATCH] Various cleanups. Trying to remove some warnings when generating php errors to a file. --- calendar/inc/class.calendar.inc.php | 4 +++- phpgwapi/inc/class.acl.inc.php | 1 + phpgwapi/inc/class.applications.inc.php | 5 +++-- phpgwapi/inc/class.common.inc.php | 8 +++++-- phpgwapi/inc/class.hooks.inc.php | 19 +++++++--------- phpgwapi/inc/class.preferences.inc.php | 25 +++++++++++++++------- phpgwapi/inc/functions.inc.php | 4 +++- phpgwapi/templates/verdilak/navbar.inc.php | 17 ++++++++------- 8 files changed, 50 insertions(+), 33 deletions(-) diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 2d5d29f86c..65e4dc97ea 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -15,7 +15,9 @@ /* $Id$ */ CreateObject('calendar.calendar_item'); -if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal') == False) +if(isset($phpgw_info['server']['calendar_type']) && + $phpgw_info['server']['calendar_type'] == 'mcal' && + extension_loaded('mcal') == False) { $phpgw_info['server']['calendar_type'] = 'sql'; } diff --git a/phpgwapi/inc/class.acl.inc.php b/phpgwapi/inc/class.acl.inc.php index 4304be9c9f..e426a70b74 100644 --- a/phpgwapi/inc/class.acl.inc.php +++ b/phpgwapi/inc/class.acl.inc.php @@ -540,6 +540,7 @@ else { $rights = 0; + $apps[$db2->f('acl_appname')] = 0; } $rights |= $db2->f('acl_rights'); $apps[$db2->f('acl_appname')] |= $rights; diff --git a/phpgwapi/inc/class.applications.inc.php b/phpgwapi/inc/class.applications.inc.php index 148505a888..60d2ab649e 100755 --- a/phpgwapi/inc/class.applications.inc.php +++ b/phpgwapi/inc/class.applications.inc.php @@ -60,7 +60,8 @@ function read_repository() { global $phpgw, $phpgw_info; - if (gettype($phpgw_info['apps']) != 'array') + if (!isset($phpgw_info['apps']) || + gettype($phpgw_info['apps']) != 'array') { $this->read_installed_apps(); } @@ -71,7 +72,7 @@ while ($app = each($phpgw_info['apps'])) { // $check = $phpgw->acl->check('run',1,$app[0]); - $check = $apps[$app[0]]; + $check = (isset($apps[$app[0]])?$apps[$app[0]]:False); if ($check) { $this->data[$app[0]] = array( diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 89607f4f2f..d44077acf3 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -800,7 +800,10 @@ $this->navbar(False); include(PHPGW_INCLUDE_ROOT . '/phpgwapi/templates/' . $phpgw_info['server']['template_set'] . '/navbar.inc.php'); - if ((! isset($phpgw_info['flags']['nonavbar']) || ! $phpgw_info['flags']['nonavbar']) && ! $phpgw_info['flags']['navbar_target']) + if ((!isset($phpgw_info['flags']['nonavbar']) || + !$phpgw_info['flags']['nonavbar']) && + (!isset($phpgw_info['flags']['navbar_target']) || + !$phpgw_info['flags']['navbar_target'])) { echo parse_navbar(); } @@ -1165,7 +1168,8 @@ } /* This is going to be used to switch to the nntp class */ - if ($phpgw_info['flags']['newsmode']) + if (isset($phpgw_info['flags']['newsmode']) && + $phpgw_info['flags']['newsmode']) { $prefs['email']['mail_server_type'] = 'nntp'; } diff --git a/phpgwapi/inc/class.hooks.inc.php b/phpgwapi/inc/class.hooks.inc.php index 4c70bbaf73..99b0d0279f 100644 --- a/phpgwapi/inc/class.hooks.inc.php +++ b/phpgwapi/inc/class.hooks.inc.php @@ -23,16 +23,6 @@ /* $Id$ */ - $d1 = strtolower(substr($phpgw_info["server"]["api_inc"],0,3)); - $d2 = strtolower(substr($phpgw_info["server"]["server_root"],0,3)); - $d3 = strtolower(substr($phpgw_info["server"]["app_inc"],0,3)); - if($d1 == "htt" || $d1 == "ftp" || $d2 == "htt" || $d2 == "ftp" || $d3 == "htt" || $d3 == "ftp") - { - echo "Failed attempt to break in via an old Security Hole!
\n"; - exit; - } - unset($d1);unset($d2);unset($d3); - /*! @class hooks @abstract class which gives ability for applications to set and use hooks to communicate with each other @@ -56,7 +46,14 @@ $return_array[$db->f("hook_id")]["location"] = $db->f("hook_location"); $return_array[$db->f("hook_id")]["filename"] = $db->f("hook_filename"); } - return $return_array; + if(isset($return_array)) + { + return $return_array; + } + else + { + return False; + } } /*! diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php index 6179aefad6..97a929963b 100644 --- a/phpgwapi/inc/class.preferences.inc.php +++ b/phpgwapi/inc/class.preferences.inc.php @@ -221,32 +221,41 @@ $phpgw_info["user"]["preferences"] = array(); } /* This takes care of new users who dont have proper default prefs setup */ - if (! $phpgw_info["flags"]["nocommon_preferences"]) { - if (! $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) { + if (!isset($phpgw_info['flags']['nocommon_preferences']) || + !$phpgw_info["flags"]["nocommon_preferences"]) { + $preferences_update = False; + if (!isset($phpgw_info['user']['preferences']['common']['maxmatchs']) || + !$phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) { $this->add("common","maxmatchs",15); $preferences_update = True; } - if (! $phpgw_info["user"]["preferences"]["common"]["theme"]) { + if (!isset($phpgw_info['user']['preferences']['common']['theme']) || + !$phpgw_info["user"]["preferences"]["common"]["theme"]) { $this->add("common","theme","default"); $preferences_update = True; } - if (! $phpgw_info["user"]["preferences"]["common"]["template_set"]) { + if (!isset($phpgw_info['user']['preferences']['common']['template_set']) || + !$phpgw_info["user"]["preferences"]["common"]["template_set"]) { $this->add("common","template_set","default"); $preferences_update = True; } - if (! $phpgw_info["user"]["preferences"]["common"]["dateformat"]) { + if (!isset($phpgw_info['user']['preferences']['common']['dateformat']) || + !$phpgw_info["user"]["preferences"]["common"]["dateformat"]) { $this->add("common","dateformat","m/d/Y"); $preferences_update = True; } - if (! $phpgw_info["user"]["preferences"]["common"]["timeformat"]) { + if (!isset($phpgw_info['user']['preferences']['common']['timeformat']) || + !$phpgw_info["user"]["preferences"]["common"]["timeformat"]) { $this->add("common","timeformat",12); $preferences_update = True; } - if (! $phpgw_info["user"]["preferences"]["common"]["lang"]) { + if (!isset($phpgw_info['user']['preferences']['common']['lang']) || + !$phpgw_info["user"]["preferences"]["common"]["lang"]) { $this->add("common","lang",$phpgw->common->getPreferredLanguage()); $preferences_update = True; } - if ($preferences_update) { + if ($preferences_update) + { $this->save_repository(); } unset($preferences_update); diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 69ba911cfe..8274011585 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -403,7 +403,9 @@ /*************************************************************************\ * If they are using frames, we need to set some variables * \*************************************************************************/ - if (($phpgw_info["user"]["preferences"]["common"]["useframes"] && $phpgw_info["server"]["useframes"] == "allowed") + if (((isset($phpgw_info['user']['preferences']['common']['useframes']) && + $phpgw_info["user"]["preferences"]["common"]["useframes"]) && + $phpgw_info["server"]["useframes"] == "allowed") || ($phpgw_info["server"]["useframes"] == "always")) { $phpgw_info["flags"]["navbar_target"] = "phpgw_body"; } diff --git a/phpgwapi/templates/verdilak/navbar.inc.php b/phpgwapi/templates/verdilak/navbar.inc.php index ef9f97ae64..ae43c34f32 100644 --- a/phpgwapi/templates/verdilak/navbar.inc.php +++ b/phpgwapi/templates/verdilak/navbar.inc.php @@ -23,12 +23,7 @@ $tpl->set_var('img_root',$phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/verdilak/images'); $tpl->set_var('table_bg_color',$phpgw_info['theme']['navbar_bg']); - - if ($phpgw_info['flags']['navbar_target']) - { - $target = ' target="' . $phpgw_info['flags']['navbar_target'] . '"'; - } - + $applications = ''; while ($app = each($phpgw_info['navbar'])) { if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && ! ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout') @@ -43,13 +38,19 @@ { $title .= '
' . lang($app[1]['title']); } - $applications .= '
' . $title . ''; + $applications .= '
'; unset($title); } } $tpl->set_var('applications',$applications); - if ($phpgw_info['theme']['special_logo']) + if (isset($phpgw_info['theme']['special_logo'])) { $tpl->set_var('logo',$phpgw_info['theme']['special_logo']); }