diff --git a/addressbook/csv_import.php b/addressbook/csv_import.php index a0d502e119..8060b68350 100644 --- a/addressbook/csv_import.php +++ b/addressbook/csv_import.php @@ -87,10 +87,6 @@ { return ''; } - if(!is_object($GLOBALS['egw']->categories)) - { - $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories'); - } $ids = array(); foreach(split(' *[,;] *',$cats) as $cat) { diff --git a/addressbook/inc/class.addressbook_display.inc.php b/addressbook/inc/class.addressbook_display.inc.php index 92f48640d0..21f00e3aa4 100755 --- a/addressbook/inc/class.addressbook_display.inc.php +++ b/addressbook/inc/class.addressbook_display.inc.php @@ -39,9 +39,9 @@ function get_rows(&$query,&$rows,&$readonlys,$id_only=false) $query['template'] = $query['sitemgr_display'].'.rows'; foreach($query['fields'] as $name) - { + { $rows['show'][$name]=true; - } + } return $total; @@ -88,7 +88,7 @@ function get_rows(&$query,&$rows,&$readonlys,$id_only=false) 'csv_fields' => false, ); - $content['nm1']['fields'] = $fields; + $content['nm1']['fields'] = $fields; } return $tpl->exec('addressbook.addressbook_display.display',$content,$sel_options,$readonlys,$preserv); diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index 35c67e30c9..0d19bb6168 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -37,6 +37,13 @@ class boaddressbook * @var array */ var $mapping=array(); + + /** + * User agent: 'KDE-AddressBook', 'eGWOSync', ... + * + * @var string + */ + var $user_agent; /** * Contstructor @@ -45,11 +52,7 @@ class boaddressbook */ function boaddressbook() { - if (!is_object($GLOBALS['egw']->contacts)) - { - $GLOBALS['egw']->contacts =& new contacts(); - } - $this->contacts =& $GLOBALS['egw']->contacts; + $this->contacts = $GLOBALS['egw']->contacts; // are we called via xmlrpc? if (!is_object($GLOBALS['server']) || !$GLOBALS['server']->last_method) @@ -152,7 +155,7 @@ class boaddressbook function set_mapping_for_user_agent() { //error_log("set_mapping_for_user_agent(): HTTP_USER_AGENT='$_SERVER[HTTP_USER_AGENT]'"); - switch($_SERVER['HTTP_USER_AGENT']) + switch($this->user_agent = $_SERVER['HTTP_USER_AGENT']) { case 'KDE-AddressBook': $this->mapping = array( @@ -353,7 +356,14 @@ class boaddressbook { $read_customfields = !isset($param['customfields']) || $param['customfields']; - return $this->data2xmlrpc($this->contacts->old_read( + $extra_accounts = array(); + if ($this->user_agent == 'KDE-AddressBook' && strpos($this->contacts->contact_repository,$this->contacts->account_repository) === false) + { + $extra_accounts = $this->contacts->search(array(),false,'','','',false,'AND',false,array( + 'contact_owner' => 0, + )); + } + return $this->data2xmlrpc(array_merge($this->contacts->old_read( (int) $param['start'], (int) $param['limit'], $param['fields'], @@ -363,7 +373,7 @@ class boaddressbook $param['order'], $param['lastmod'] ? $param['lastmod'] : -1, $param['cquery'] - ),$read_customfields); + ),$extra_accounts),$read_customfields); } /** diff --git a/addressbook/inc/class.bocontacts.inc.php b/addressbook/inc/class.bocontacts.inc.php index edd4a9c5cb..c60d5a811f 100755 --- a/addressbook/inc/class.bocontacts.inc.php +++ b/addressbook/inc/class.bocontacts.inc.php @@ -1011,11 +1011,6 @@ class bocontacts extends socontacts } if (!$this->save($target)) return 0; - if (!is_object($GLOBALS['egw']->link)) - { - require_once(EGW_API_INC.'/class.bolink.inc.php'); - $GLOBALS['egw']->link =& new bolink(); - } $success = 1; foreach($contacts as $contact) { @@ -1133,11 +1128,6 @@ class bocontacts extends socontacts */ function addr_format_by_country($country) { - if (!is_object($GLOBALS['egw']->country)) - { - require_once(EGW_API_INC.'/class.country.inc.php'); - $GLOBALS['egw']->country =& new country; - } $code = $GLOBALS['egw']->country->country_code($country); switch($code) diff --git a/addressbook/inc/class.csv_export.inc.php b/addressbook/inc/class.csv_export.inc.php index 358d90d733..427b03f095 100644 --- a/addressbook/inc/class.csv_export.inc.php +++ b/addressbook/inc/class.csv_export.inc.php @@ -114,10 +114,6 @@ class csv_export } if ($data['tel_prefer']) $data['tel_prefer'] = $fields[$data['tel_prefer']]; - if (!is_object($GLOBALS['egw']->categories)) - { - $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories','addressbook'); - } $cats = array(); foreach(explode(',',$data['cat_id']) as $cat_id) { diff --git a/addressbook/inc/class.so_ldap.inc.php b/addressbook/inc/class.so_ldap.inc.php index b377ce3043..0dfc96345e 100644 --- a/addressbook/inc/class.so_ldap.inc.php +++ b/addressbook/inc/class.so_ldap.inc.php @@ -240,10 +240,6 @@ class so_ldap */ function connect() { - if (!is_object($GLOBALS['egw']->ldap)) - { - $GLOBALS['egw']->ldap =& CreateObject('phpgwapi.ldap'); - } // if ldap is NOT the contact repository, we only do accounts and need to use the account-data if (substr($GLOBALS['egw_info']['server']['contact_repository'],-4) != 'ldap') // not (ldap or sql-ldap) { diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index d10275be08..a1234831fb 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -561,10 +561,6 @@ class socontacts // the nextmatch custom-filter-header country-select returns a 2 letter country-code if (isset($filter['adr_one_countryname']) && strlen($filter['adr_one_countryname']) == 2) { - if (!is_object($GLOBALS['egw']->country)) - { - $GLOBALS['egw']->country =& CreateObject('phpgwapi.country'); - } $filter['adr_one_countryname'] = $GLOBALS['egw']->country->get_full_name($filter['adr_one_countryname']); } $backend =& $this->get_backend(null,$filter['owner']); diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index 235a986c2b..049285bebc 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -674,7 +674,6 @@ class uicontacts extends bocontacts } if($email) { - if(!@is_object($GLOBALS['egw']->js)) $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); $GLOBALS['egw']->js->set_onload("addEmail('".addslashes( $contact['n_fn'] ? $contact['n_fn'].' <'.$email.'>' : $email)."');"); $Ok = true; @@ -1120,10 +1119,6 @@ class uicontacts extends bocontacts } if ($query['cat_id']) { - if (!is_object($GLOBALS['egw']->categories)) - { - $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories'); - } $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Category').' '.$GLOBALS['egw']->categories->id2name($query['cat_id']); } if ($query['searchletter']) @@ -1343,11 +1338,6 @@ class uicontacts extends bocontacts } elseif ($GLOBALS['egw_info']['user']['preferences']['common']['country']) { - if (!is_object($GLOBALS['egw']->country)) - { - require_once(EGW_API_INC.'/class.country.inc.php'); - $GLOBALS['egw']->country =& new country; - } $content['adr_one_countryname'] = $GLOBALS['egw']->country->get_full_name($GLOBALS['egw_info']['user']['preferences']['common']['country']); } @@ -1466,7 +1456,7 @@ class uicontacts extends bocontacts { $sel_options['tid'][$type] = $data['name']; } - $content['typegfx'] = $GLOBALS['egw']->html->image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); + $content['typegfx'] = html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); } else { @@ -1664,7 +1654,7 @@ $readonlys['button[vcard]'] = true; { $sel_options['tid'][$type] = $data['name']; } - $content['typegfx'] = $GLOBALS['egw']->html->image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); + $content['typegfx'] = html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); } else { diff --git a/addressbook/inc/hook_config.inc.php b/addressbook/inc/hook_config.inc.php index fac74b3bba..7a4fc103ac 100644 --- a/addressbook/inc/hook_config.inc.php +++ b/addressbook/inc/hook_config.inc.php @@ -51,11 +51,7 @@ function own_account_acl($config) $fields['#'.$name] = $data['label']; } } - if (!is_object($GLOBALS['egw']->html)) - { - $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); - } - return $GLOBALS['egw']->html->checkbox_multiselect('newsettings[own_account_acl]',$config['own_account_acl'],$fields,true,'',4); + return html::checkbox_multiselect('newsettings[own_account_acl]',$config['own_account_acl'],$fields,true,'',4); } function org_fileds_to_update($config) @@ -85,6 +81,6 @@ function org_fileds_to_update($config) { $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); } - return $GLOBALS['egw']->html->checkbox_multiselect('newsettings[org_fileds_to_update]', + return html::checkbox_multiselect('newsettings[org_fileds_to_update]', $config['org_fileds_to_update'] ? $config['org_fileds_to_update'] : $bocontacts->org_fields,$fields,true,'',4); }