From afe2795f2d256d4d455bc6203a264195818125ea Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 25 Mar 2008 16:37:37 +0000 Subject: [PATCH] removed unnecessary instancations and using static methods of html and egw_link class --- admin/inc/class.uiaccess_history.inc.php | 4 -- admin/inc/class.uiaccounts.inc.php | 60 ++++------------------- admin/inc/class.uiapplications.inc.php | 20 -------- admin/inc/class.uiasyncservice.inc.php | 16 +----- admin/inc/class.uicategories.inc.php | 14 +----- admin/inc/class.uiconfig.inc.php | 4 -- admin/inc/class.uicurrentsessions.inc.php | 4 -- admin/inc/class.uilog.inc.php | 4 -- admin/inc/class.uimainscreen.inc.php | 9 ---- 9 files changed, 12 insertions(+), 123 deletions(-) diff --git a/admin/inc/class.uiaccess_history.inc.php b/admin/inc/class.uiaccess_history.inc.php index e88a21a267..75b824e2f8 100644 --- a/admin/inc/class.uiaccess_history.inc.php +++ b/admin/inc/class.uiaccess_history.inc.php @@ -46,10 +46,6 @@ $order = get_var('order',array('POST'),0); $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('View access log'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index 0725b05fe6..3095b13241 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -126,10 +126,6 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['admin']['title'].' - '. lang('User groups'); @@ -237,8 +233,8 @@ 'sort' => $sort ); $p->set_var(array( - 'query' => $GLOBALS['egw']->html->htmlspecialchars($GLOBALS['query']), - 'query_type' => is_array($query_types) ? $GLOBALS['egw']->html->select('query_type',$_REQUEST['query_type'],$query_types) : '', + 'query' => html::htmlspecialchars($GLOBALS['query']), + 'query_type' => is_array($query_types) ? html::select('query_type',$_REQUEST['query_type'],$query_types) : '', //'lang_group' => lang('group'), //'group' => $uiaccountsel->selection('group_id','admin_uiaccount_listusers_group_id',$_REQUEST['group_id'],'groups',0,False,'','this.form.submit();',lang('all')), 'accounts_url' => $GLOBALS['egw']->link('/index.php',$link_data), @@ -288,13 +284,8 @@ { if ($GLOBALS['egw']->acl->check('account_access',1,'admin')) { - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/admin/index.php')); + $GLOBALS['egw']->redirect_link('/admin/index.php'); } - if (!is_object($GLOBALS['egw']->html)) - { - $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); - } - if($param_cd) { $cd = $param_cd; @@ -338,10 +329,6 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['admin']['title'].' - '. lang('User accounts'); @@ -383,7 +370,7 @@ 'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,$link_data), 'lang_showing' => ($_REQUEST['group_id'] ? $GLOBALS['egw']->common->grab_owner_name($_REQUEST['group_id']).': ' : ''). ($GLOBALS['query'] ? lang("Search %1 '%2'",lang($uiaccountsel->query_types[$_REQUEST['query_type']]), - $GLOBALS['egw']->html->htmlspecialchars($GLOBALS['query'])).': ' : '') + html::htmlspecialchars($GLOBALS['query'])).': ' : '') .$this->nextmatchs->show_hits($total,$start), 'right_next_matchs' => $this->nextmatchs->right('/index.php',$start,$total,$link_data), 'lang_loginid' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data), @@ -400,8 +387,8 @@ 'sort' => $sort, ); $p->set_var(array( - 'query' => $GLOBALS['egw']->html->htmlspecialchars($GLOBALS['query']), - 'query_type' => is_array($uiaccountsel->query_types) ? $GLOBALS['egw']->html->select('query_type',$_REQUEST['query_type'],$uiaccountsel->query_types) : '', + 'query' => html::htmlspecialchars($GLOBALS['query']), + 'query_type' => is_array($uiaccountsel->query_types) ? html::select('query_type',$_REQUEST['query_type'],$uiaccountsel->query_types) : '', 'lang_group' => lang('group'), 'group' => $uiaccountsel->selection('group_id','admin_uiaccount_listusers_group_id',$_REQUEST['group_id'],'groups',0,False,'','this.form.submit();',lang('all')), 'accounts_url' => $GLOBALS['egw']->link('/index.php',$link_data), @@ -613,10 +600,7 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } + $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -695,10 +679,6 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -949,10 +929,6 @@ } unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -1147,10 +1123,6 @@ { unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -1161,10 +1133,6 @@ //fix from Maanus 280105 $accounts =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); - if (!is_object($GLOBALS['egw']->uiaccountsel)) - { - $GLOBALS['egw']->uiaccountsel =& CreateObject('phpgwapi.uiaccountsel'); - } $p->set_var('accounts',$GLOBALS['egw']->uiaccountsel->selection('account_user[]','admin_uiaccounts_user',$group_info['account_user'],'accounts',min(3+count($group_info['account_user']),10),false,'style="width: 300px;"')); $var = Array( @@ -1199,7 +1167,7 @@ { $p->set_var(array( 'lang_email' => lang('Email'), - 'email' => $GLOBALS['egw']->html->input('account_email',$group_repository['account_email'],'',' style="width: 100%;"'), + 'email' => html::input('account_email',$group_repository['account_email'],'',' style="width: 100%;"'), )); } reset($GLOBALS['egw_info']['apps']); @@ -1264,10 +1232,6 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -1478,7 +1442,7 @@ { array_push($selarray,$value['account_id']); } - $t->set_var('groups_select','
' .$GLOBALS['egw']->html->checkbox_multiselect('account_groups[]',$selarray,$allGroupsSorted,true,'',min(3+count($allGroupsSorted),10),' style="width: 300px; text-align:left" ').'
'); + $t->set_var('groups_select','
' .html::checkbox_multiselect('account_groups[]',$selarray,$allGroupsSorted,true,'',min(3+count($allGroupsSorted),10),' style="width: 300px; text-align:left" ').'
'); /* create list of available apps */ $apps =& CreateObject('phpgwapi.applications',$_account_id); @@ -1589,10 +1553,6 @@ unset($GLOBALS['egw_info']['flags']['noheader']); unset($GLOBALS['egw_info']['flags']['nonavbar']); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); @@ -1630,7 +1590,7 @@ { if($GLOBALS['egw']->acl->check('group_access',16,'admin') || $_POST['cancel']) { - $GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); + $GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups'); $GLOBALS['egw']->common->egw_exit(); } elseif($_POST['submit']) diff --git a/admin/inc/class.uiapplications.inc.php b/admin/inc/class.uiapplications.inc.php index 4fe81ddf74..2a7651cf37 100644 --- a/admin/inc/class.uiapplications.inc.php +++ b/admin/inc/class.uiapplications.inc.php @@ -41,10 +41,6 @@ $can_delete = !$GLOBALS['egw']->acl->check('applications_access',8,'admin'); $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Installed applications'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); @@ -220,10 +216,6 @@ } $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Add new application'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); @@ -302,10 +294,6 @@ } $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit application'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); @@ -364,10 +352,6 @@ $GLOBALS['egw']->template->set_file(array('body' => 'delete_common.tpl')); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); @@ -387,10 +371,6 @@ { $GLOBALS['egw']->redirect_link('/index.php'); } - if (!is_object($GLOBALS['egw']->hooks)) - { - $GLOBALS['egw']->hooks =& CreateObject('phpgwapi.hooks'); - } $GLOBALS['egw']->hooks->register_all_hooks(); if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited diff --git a/admin/inc/class.uiasyncservice.inc.php b/admin/inc/class.uiasyncservice.inc.php index 38297ae84f..54bf2c06d2 100644 --- a/admin/inc/class.uiasyncservice.inc.php +++ b/admin/inc/class.uiasyncservice.inc.php @@ -27,13 +27,6 @@ var $public_functions = array( 'index' => True, ); - function uiasyncservice() - { - if (!is_object($GLOBALS['egw']->asyncservice)) - { - $GLOBALS['egw']->asyncservice =& CreateObject('phpgwapi.asyncservice'); - } - } function index() { @@ -42,10 +35,7 @@ $GLOBALS['egw']->redirect_link('/index.php'); } $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Asynchronous timed services'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } + $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['egw']->common->egw_header(); echo parse_navbar(); @@ -211,10 +201,6 @@ function test($to) { - if (!is_object($GLOBALS['egw']->send)) - { - $GLOBALS['egw']->send =& CreateObject('phpgwapi.send'); - } $returncode = $GLOBALS['egw']->send->msg('email',$to,$subject='Asynchronous timed services','Greatings from cron ;-)'); if (!$returncode) // not nice, but better than failing silently diff --git a/admin/inc/class.uicategories.inc.php b/admin/inc/class.uicategories.inc.php index bf90166ed8..4f1d24881d 100644 --- a/admin/inc/class.uicategories.inc.php +++ b/admin/inc/class.uicategories.inc.php @@ -52,10 +52,6 @@ $this->acl_delete = !$GLOBALS['egw']->acl->check('global_categories_access',32,'admin'); $this->acl_add_sub= !$GLOBALS['egw']->acl->check('global_categories_access',64,'admin'); - if(!@is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); $this->appname = get_var('appname',array('GET','POST')); @@ -418,11 +414,7 @@ $this->template->set_var('cat_description',$GLOBALS['egw']->strip_html($cat['description'])); $this->template->set_var('category_list',$this->bo->cats->formatted_list(array('selected' => $cat['parent'],'self' => $this->cat_id))); - if (!is_object($GLOBALS['egw']->html)) - { - $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); - } - $this->template->set_var('color',$GLOBALS['egw']->html->inputColor('cat_data[color]',$cat['data']['color'],lang('Click to select a color'))); + $this->template->set_var('color',html::inputColor('cat_data[color]',$cat['data']['color'],lang('Click to select a color'))); //$options = '