From a77fd203f3666165b84cfb8fae8e2e7ebbbbe19d Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Tue, 2 Oct 2001 03:52:56 +0000 Subject: [PATCH] GLOBALS --- phpgwapi/inc/class.categories.inc.php | 15 +++----- phpgwapi/inc/class.preferences.inc.php | 50 ++++++++++++-------------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index 4f3fdfa47e..6d9a36e3f4 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -91,8 +91,6 @@ */ function return_array($type,$start,$limit = True,$query = '',$sort = '',$order = '',$public = False, $parent_id = '') { - global $phpgw, $phpgw_info; - if ($public) { $public_cats = " OR cat_appname='phpgw' "; @@ -208,21 +206,19 @@ */ function categories($accountid = '',$app_name = '') { - global $phpgw, $phpgw_info; - $account_id = get_account_id($accountid); if (! $app_name) { - $app_name = $phpgw_info['flags']['currentapp']; + $app_name = $GLOBALS['phpgw_info']['flags']['currentapp']; } $this->account_id = $account_id; $this->app_name = $app_name; - $this->db = $phpgw->db; + $this->db = $GLOBALS['phpgw']->db; $this->db2 = $this->db; $this->total_records = $this->db2->num_rows(); - $this->grants = $phpgw->acl->get_grants($app_name); + $this->grants = $GLOBALS['phpgw']->acl->get_grants($app_name); $this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public); } @@ -253,7 +249,6 @@ */ function formated_list($format,$type,$selected = '',$public = False,$site_link = 'site') { - global $phpgw; $filter = $this->filter($type); if (!is_array($selected)) @@ -272,7 +267,7 @@ { $s .= ' selected'; } - $s .= '>' . $phpgw->strip_html($cats[$i]['name']); + $s .= '>' . $GLOBALS['phpgw']->strip_html($cats[$i]['name']); if ($cats[$i]['app_name'] == 'phpgw') { $s .= '<' . lang('Global') . '>'; @@ -312,7 +307,7 @@ $s .= '' . "\n"; $s .= '' . $image_set . '' . "\n"; - $s .= '' . $space_set . '' . $phpgw->strip_html($cats[$i]['name']) + $s .= '' . $space_set . '' . $GLOBALS['phpgw']->strip_html($cats[$i]['name']) . '' . "\n"; $s .= '' . "\n"; } diff --git a/phpgwapi/inc/class.preferences.inc.php b/phpgwapi/inc/class.preferences.inc.php index 34ff9f1b68..4e7302c46c 100644 --- a/phpgwapi/inc/class.preferences.inc.php +++ b/phpgwapi/inc/class.preferences.inc.php @@ -49,8 +49,7 @@ */ function preferences($account_id = '') { - global $phpgw, $phpgw_info; - $this->db = $phpgw->db; + $this->db = $GLOBALS['phpgw']->db; $this->account_id = get_account_id($account_id); } @@ -166,10 +165,8 @@ */ function save_repository($update_session_info = False) { - global $phpgw, $phpgw_info; - $temp_data = $this->data; - if (! $phpgw->acl->check('session_only_preferences',1,'preferences')) + if (! $GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences')) { $this->db->transaction_begin(); $this->db->query("delete from phpgw_preferences where preference_owner='" . $this->account_id @@ -190,13 +187,13 @@ } else { - $phpgw_info['user']['preferences'] = $this->data; - $phpgw->session->save_repositories(); + $GLOBALS['phpgw_info']['user']['preferences'] = $this->data; + $GLOBALS['phpgw']->session->save_repositories(); } - if ($phpgw_info['server']['cache_phpgw_info'] && $this->account_id == $phpgw_info['user']['account_id']) + if ($GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $this->account_id == $GLOBALS['phpgw_info']['user']['account_id']) { - $phpgw->session->read_repositories(False); + $GLOBALS['phpgw']->session->read_repositories(False); } return $temp_data; @@ -238,50 +235,49 @@ */ function verify_basic_settings() { - global $phpgw, $phpgw_info; - if (gettype($phpgw_info['user']['preferences']) != 'array') + if (gettype($GLOBALS['phpgw_info']['user']['preferences']) != 'array') { - $phpgw_info['user']['preferences'] = array(); + $GLOBALS['phpgw_info']['user']['preferences'] = array(); } /* This takes care of new users who dont have proper default prefs setup */ - if (!isset($phpgw_info['flags']['nocommon_preferences']) || - !$phpgw_info['flags']['nocommon_preferences']) + if (!isset($GLOBALS['phpgw_info']['flags']['nocommon_preferences']) || + !$GLOBALS['phpgw_info']['flags']['nocommon_preferences']) { $preferences_update = False; - if (!isset($phpgw_info['user']['preferences']['common']['maxmatchs']) || - !$phpgw_info['user']['preferences']['common']['maxmatchs']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) { $this->add('common','maxmatchs',15); $preferences_update = True; } - if (!isset($phpgw_info['user']['preferences']['common']['theme']) || - !$phpgw_info['user']['preferences']['common']['theme']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']) { $this->add('common','theme','default'); $preferences_update = True; } - if (!isset($phpgw_info['user']['preferences']['common']['template_set']) || - !$phpgw_info['user']['preferences']['common']['template_set']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']) { $this->add('common','template_set','default'); $preferences_update = True; } - if (!isset($phpgw_info['user']['preferences']['common']['dateformat']) || - !$phpgw_info['user']['preferences']['common']['dateformat']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) { $this->add('common','dateformat','m/d/Y'); $preferences_update = True; } - if (!isset($phpgw_info['user']['preferences']['common']['timeformat']) || - !$phpgw_info['user']['preferences']['common']['timeformat']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat']) { $this->add('common','timeformat',12); $preferences_update = True; } - if (!isset($phpgw_info['user']['preferences']['common']['lang']) || - !$phpgw_info['user']['preferences']['common']['lang']) + if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) || + !$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) { - $this->add('common','lang',$phpgw->common->getPreferredLanguage()); + $this->add('common','lang',$GLOBALS['phpgw']->common->getPreferredLanguage()); $preferences_update = True; } if ($preferences_update)