forked from extern/egroupware
removed unnecessary instancations and using static methods of html and egw_link class
This commit is contained in:
parent
5fd3ea2641
commit
f9abc6fa2a
@ -87,10 +87,6 @@
|
||||
{
|
||||
return '';
|
||||
}
|
||||
if(!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
|
||||
}
|
||||
$ids = array();
|
||||
foreach(split(' *[,;] *',$cats) as $cat)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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']);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user