From 2421cc1afa39e5e8397d3f40a87f871106b57318 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Thu, 17 Jan 2002 03:52:56 +0000 Subject: [PATCH] Fix email link; Formatting; --- addressbook/inc/class.boXport.inc.php | 64 +++-- addressbook/inc/class.boaddressbook.inc.php | 47 ++-- addressbook/inc/class.soaddressbook.inc.php | 10 +- addressbook/inc/class.uiXport.inc.php | 28 +- addressbook/inc/class.uiaddressbook.inc.php | 295 +++++++++++--------- addressbook/inc/class.uifields.inc.php | 52 ++-- addressbook/inc/class.uivcard.inc.php | 66 ++--- 7 files changed, 306 insertions(+), 256 deletions(-) diff --git a/addressbook/inc/class.boXport.inc.php b/addressbook/inc/class.boXport.inc.php index 59176f0a77..90285e5a8b 100644 --- a/addressbook/inc/class.boXport.inc.php +++ b/addressbook/inc/class.boXport.inc.php @@ -75,7 +75,10 @@ function read_sessiondata() { $data = $GLOBALS['phpgw']->session->appsession('session_data','addressbook'); - if($this->debug) { echo '
Read:'; _debug_array($data); } + if($this->debug) + { + echo '
Read:'; _debug_array($data); + } $this->start = $data['start']; $this->limit = $data['limit']; @@ -90,20 +93,23 @@ { include (PHPGW_APP_INC . '/import/' . $conv_type); - if ($private == '') { $private = 'public'; } + if($private == '') + { + $private = 'public'; + } $row = 0; $buffer = array(); $contacts = new import_conv; $buffer = $contacts->import_start_file($buffer); $fp = fopen($tsvfile,'r'); - if ($contacts->type == 'csv') + if($contacts->type == 'csv') { - while ($data = fgetcsv($fp,8000,',')) + while($data = fgetcsv($fp,8000,',')) { $num = count($data); $row++; - if ($row == 1) + if($row == 1) { $header = $data; /* Changed here to ignore the header, set to our array @@ -116,10 +122,10 @@ else { $buffer = $contacts->import_start_record($buffer); - for ($c=0; $c<$num; $c++ ) + for($c=0; $c<$num; $c++) { //Send name/value pairs along with the buffer - if ($contacts->import[$header[$c]] != '' && $data[$c] != '') + if($contacts->import[$header[$c]] != '' && $data[$c] != '') { $buffer = $contacts->import_new_attrib($buffer, $contacts->import[$header[$c]],$data[$c]); } @@ -128,25 +134,25 @@ } } } - elseif ($contacts->type == 'ldif') + elseif($contacts->type == 'ldif') { - while ($data = fgets($fp,8000)) + while($data = fgets($fp,8000)) { $url = ""; list($name,$value,$extra) = split(':', $data); - if (substr($name,0,2) == 'dn') + if(substr($name,0,2) == 'dn') { $buffer = $contacts->import_start_record($buffer); } $test = trim($value); - if ($name && !empty($test) && $extra) + if($name && !empty($test) && $extra) { // Probable url string $url = $test; $value = $extra; } - elseif ($name && empty($test) && $extra) + elseif($name && empty($test) && $extra) { // Probable multiline encoding $newval = base64_decode(trim($extra)); @@ -154,15 +160,15 @@ //echo $name.':'.$value; } - if ($name && $value) + if($name && $value) { $test = split(',mail=',$value); - if ($test[1]) + if($test[1]) { $name = "mail"; $value = $test[1]; } - if ($url) + if($url) { $name = "homeurl"; $value = $url. ':' . $value; @@ -181,32 +187,32 @@ } else { - while ($data = fgets($fp,8000)) + while($data = fgets($fp,8000)) { $data = trim($data); // RB 2001/05/07 added for Lotus Organizer - while (substr($data,-1) == '=') + while(substr($data,-1) == '=') { // '=' at end-of-line --> line to be continued with next line $data = substr($data,0,-1) . trim(fgets($fp,8000)); } - if (strstr($data,';ENCODING=QUOTED-PRINTABLE')) + if(strstr($data,';ENCODING=QUOTED-PRINTABLE')) { // RB 2001/05/07 added for Lotus Organizer $data = quoted_printable_decode(str_replace(';ENCODING=QUOTED-PRINTABLE','',$data)); } list($name,$value) = explode(':', $data,2); // RB 2001/05/09 to allow ':' in Values (not only in URL's) - if (strtolower(substr($name,0,5)) == 'begin') + if(strtolower(substr($name,0,5)) == 'begin') { $buffer = $contacts->import_start_record($buffer); } - if ($name && $value) + if($name && $value) { reset($contacts->import); - while ( list($fname,$fvalue) = each($contacts->import) ) + while(list($fname,$fvalue) = each($contacts->import)) { - if ( strstr(strtolower($name), $contacts->import[$fname]) ) + if(strstr(strtolower($name), $contacts->import[$fname])) { $buffer = $contacts->import_new_attrib($buffer,$name,$value); } @@ -227,14 +233,14 @@ function export($conv_type,$cat_id='') { include (PHPGW_APP_INC . '/export/' . $conv_type); - $buffer=array(); + $buffer = array(); $contacts = new export_conv; // Read in user custom fields, if any $customfields = array(); - while (list($col,$descr) = @each($GLOBALS['phpgw_info']['user']['preferences']['addressbook'])) + while(list($col,$descr) = @each($GLOBALS['phpgw_info']['user']['preferences']['addressbook'])) { - if ( substr($col,0,6) == 'extra_' ) + if(substr($col,0,6) == 'extra_') { $field = ereg_replace('extra_','',$col); $field = ereg_replace(' ','_',$field); @@ -246,12 +252,12 @@ 'address2' => 'address2', 'address3' => 'address3' ); - if ($contacts->type != 'vcard') + if($contacts->type != 'vcard') { $contacts->qfields = $contacts->stock_contact_fields;# + $extrafields;# + $customfields; } - if (!empty($cat_id)) + if(!empty($cat_id)) { $buffer = $contacts->export_start_file($buffer,$cat_id); } @@ -260,10 +266,10 @@ $buffer = $contacts->export_start_file($buffer); } - for ($i=0;$iids);$i++) + for($i=0;$iids);$i++) { $buffer = $contacts->export_start_record($buffer); - while( list($name,$value) = each($contacts->currentrecord) ) + while(list($name,$value) = each($contacts->currentrecord)) { $buffer = $contacts->export_new_attrib($buffer,$name,$value); } diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index 276f63da1c..13b728eed8 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -125,7 +125,10 @@ $this->filter = $_filter; } - if($this->debug) { $this->_debug_sqsof(); } + if($this->debug) + { + $this->_debug_sqsof(); + } } function _debug_sqsof() @@ -150,7 +153,7 @@ in which case the input might be an array. The server always calls this function to fill the server dispatch map using a string. */ - if (is_array($_type)) + if(is_array($_type)) { $_type = $_type['type'] ? $_type['type'] : $_type[0]; } @@ -202,9 +205,12 @@ function save_sessiondata($data) { - if ($this->use_session) + if($this->use_session) { - if($this->debug) { echo '
Save:'; _debug_array($data); } + if($this->debug) + { + echo '
Save:'; _debug_array($data); + } $GLOBALS['phpgw']->session->appsession('session_data','addressbook',$data); } } @@ -212,7 +218,10 @@ function read_sessiondata() { $data = $GLOBALS['phpgw']->session->appsession('session_data','addressbook'); - if($this->debug) { echo '
Read:'; _debug_array($data); } + if($this->debug) + { + echo '
Read:'; _debug_array($data); + } $this->start = $data['start']; $this->limit = $data['limit']; @@ -226,7 +235,7 @@ function strip_html($dirty = '') { - if ($dirty == '') + if($dirty == '') { $dirty = array(); } @@ -234,7 +243,7 @@ { if(gettype($dirty[$i]) == 'array') { - while (list($name,$value) = @each($dirty[$i])) + while(list($name,$value) = @each($dirty[$i])) { $cleaned[$i][$name] = $GLOBALS['phpgw']->strip_html($dirty[$i][$name]); } @@ -251,7 +260,10 @@ { $entries = $this->so->read_entries($data); $this->total = $this->so->contacts->total_records; - if($this->debug) { echo '
Total records="' . $this->total . '"'; } + if($this->debug) + { + echo '
Total records="' . $this->total . '"'; + } return $this->strip_html($entries); } @@ -313,8 +325,11 @@ global $name,$referer; $named = explode(' ', $name); - for ($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; } - if ($names[2]) + for($i=count($named);$i>=0;$i--) + { + $names[$i] = $named[$i]; + } + if($names[2]) { $fields['n_given'] = $names[0]; $fields['n_middle'] = $names[1]; @@ -358,13 +373,13 @@ function save_preferences($prefs,$other,$qfields,$fcat_id) { $GLOBALS['phpgw']->preferences->read_repository(); - if (is_array($prefs)) + if(is_array($prefs)) { /* _debug_array($prefs);exit; */ - while (list($pref,$x) = each($qfields)) + while(list($pref,$x) = each($qfields)) { /* echo '
checking: ' . $pref . '=' . $prefs[$pref]; */ - if ($prefs[$pref] == 'on') + if($prefs[$pref] == 'on') { $GLOBALS['phpgw']->preferences->add('addressbook',$pref,'addressbook_on'); } @@ -378,19 +393,19 @@ if(is_array($other)) { $GLOBALS['phpgw']->preferences->delete('addressbook','mainscreen_showbirthdays'); - if ($other['mainscreen_showbirthdays']) + if($other['mainscreen_showbirthdays']) { $GLOBALS['phpgw']->preferences->add('addressbook','mainscreen_showbirthdays',True); } $GLOBALS['phpgw']->preferences->delete('addressbook','default_filter'); - if ($other['default_filter']) + if($other['default_filter']) { $GLOBALS['phpgw']->preferences->add('addressbook','default_filter',True); } $GLOBALS['phpgw']->preferences->delete('addressbook','autosave_category'); - if ($other['autosave_category']) + if($other['autosave_category']) { $GLOBALS['phpgw']->preferences->add('addressbook','autosave_category',True); } diff --git a/addressbook/inc/class.soaddressbook.inc.php b/addressbook/inc/class.soaddressbook.inc.php index 438eb88dd2..d731ba4901 100644 --- a/addressbook/inc/class.soaddressbook.inc.php +++ b/addressbook/inc/class.soaddressbook.inc.php @@ -71,7 +71,7 @@ function read_entry($id,$fields) { - if ($this->rights & PHPGW_ACL_READ) + if($this->rights & PHPGW_ACL_READ) { return $this->contacts->read_single_entry($id,$fields); } @@ -84,7 +84,7 @@ function read_last_entry($fields) { - if ($this->rights & PHPGW_ACL_READ) + if($this->rights & PHPGW_ACL_READ) { return $this->contacts->read_last_entry($fields); } @@ -102,7 +102,7 @@ { $fields['tid'] = 'n'; } - if ($this->rights & PHPGW_ACL_ADD) + if($this->rights & PHPGW_ACL_ADD) { $ab_id = $fields['ab_id']; $owner = $fields['owner']; @@ -129,7 +129,7 @@ function update_entry($fields) { - if ($this->rights & PHPGW_ACL_EDIT) + if($this->rights & PHPGW_ACL_EDIT) { $ab_id = $fields['ab_id']; $owner = $fields['owner']; @@ -148,7 +148,7 @@ function delete_entry($data) { - if ($this->rights & PHPGW_ACL_DELETE) + if($this->rights & PHPGW_ACL_DELETE) { $this->contacts->delete($data['id']); } diff --git a/addressbook/inc/class.uiXport.inc.php b/addressbook/inc/class.uiXport.inc.php index e91a712641..f6bd89af96 100644 --- a/addressbook/inc/class.uiXport.inc.php +++ b/addressbook/inc/class.uiXport.inc.php @@ -49,16 +49,16 @@ /* Return a select form element with the categories option dialog in it */ function cat_option($cat_id='',$notall=False,$java=True,$multiple=False) { - if ($java) + if($java) { $jselect = ' onChange="this.form.submit();"'; } /* Setup all and none first */ $cats_link = "\n" .'\n"; - if (!$notall) + $cats_link = "\n" . ''."\n"; + $cats_link .= '' . "\n"; return $cats_link; } @@ -248,7 +251,7 @@ 'note' => 'notes' ); - if ($abc[$column]) + if($abc[$column]) { return lang($abc[$column]); } @@ -271,11 +274,11 @@ $customfields = $this->read_custom_fields(); - if (!isset($this->cat_id)) + if(!isset($this->cat_id)) { $this->cat_id = $this->prefs['default_category']; } - if ($this->prefs['autosave_category']) + if($this->prefs['autosave_category']) { $GLOBALS['phpgw']->preferences->read_repository(); $GLOBALS['phpgw']->preferences->delete('addressbook','default_category'); @@ -285,10 +288,10 @@ /* $qfields = $contacts->stock_contact_fields + $extrafields + $customfields; */ /* create column list and the top row of the table based on user prefs */ - while ($column = each($this->contacts->stock_contact_fields)) + while($column = each($this->contacts->stock_contact_fields)) { $test = strtolower($column[0]); - if (isset($this->prefs[$test]) && $this->prefs[$test]) + if(isset($this->prefs[$test]) && $this->prefs[$test]) { $showcol = $this->display_name($column[0]); $cols .= ' ' . "\n"; @@ -304,14 +307,17 @@ } /* Setup the columns for non-standard fields, since we don't allow sorting */ $nonstd = $this->extrafields + $customfields; - while ($column = each($nonstd)) + while($column = each($nonstd)) { $test = strtolower($column[1]); - if (isset($this->prefs[$test]) && $this->prefs[$test]) + if(isset($this->prefs[$test]) && $this->prefs[$test]) { $showcol = $this->display_name($column[0]); /* This must be a custom field */ - if (!$showcol) { $showcol = $column[1]; } + if(!$showcol) + { + $showcol = $column[1]; + } $cols .= ' ' . "\n"; $cols .= ' '; $cols .= $showcol; @@ -323,7 +329,7 @@ } } /* Check if prefs were set, if not, create some defaults */ - if (!$columns_to_display ) + if(!$columns_to_display ) { $columns_to_display = array( 'n_given' => 'n_given', @@ -333,10 +339,13 @@ $columns_to_display = $columns_to_display + $customfields; /* No prefs,. so cols above may have been set to '' or a bunch of */ $cols=''; - while ($column = each($columns_to_display)) + while($column = each($columns_to_display)) { $showcol = $this->display_name($column[0]); - if (!$showcol) { $showcol = $column[1]; } + if(!$showcol) + { + $showcol = $column[1]; + } $cols .= ' ' . "\n"; $cols .= ' '; $cols .= $GLOBALS['phpgw']->nextmatchs->show_sort_order($this->sort, @@ -347,7 +356,7 @@ $noprefs=lang('Please set your preferences for this application'); } - if (!$this->start) + if(!$this->start) { $this->start = 0; } @@ -363,7 +372,7 @@ } /*global $filter; */ - if (empty($this->filter) || !isset($this->filter)) + if(empty($this->filter) || !isset($this->filter)) { if($this->prefs['default_filter']) { @@ -381,7 +390,7 @@ else they may be accounts, etc. */ $qfilter = 'tid=n'; - switch ($this->filter) + switch($this->filter) { case 'blank': $nosearch = True; @@ -396,17 +405,17 @@ default: $qfilter .= ',owner=' . $this->filter; } - if ($this->cat_id) + if($this->cat_id) { $qfilter .= ',cat_id='.$this->cat_id; } - if (!$userid) + if(!$userid) { $userid = $GLOBALS['phpgw_info']['user']['account_id']; } - if ($nosearch && !$this->query) + if($nosearch && !$this->query) { $entries = array(); $total_records = 0; @@ -480,7 +489,7 @@ /* Show the entries */ /* each entry */ - for ($i=0;$itemplate->set_var('columns',''); $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); @@ -490,42 +499,46 @@ /* each entry column */ @reset($columns_to_display); - while ($column = @each($columns_to_display)) + while($column = @each($columns_to_display)) { - $ref = $data=''; + $ref = $data = ''; $coldata = $entries[$i][$column[0]]; /* echo '
coldata="' . $coldata . '"'; */ /* Some fields require special formatting. */ - if ($column[0] == 'url') + if($column[0] == 'url') { - if ( !empty($coldata) && (substr($coldata,0,7) != 'http://') ) { $coldata = 'http://' . $coldata; } - $ref=''; - $data=$coldata.''; - } - elseif ( ($column[0] == 'email') || ($column[0] == 'email_home') ) - { - if ($GLOBALS['phpgw_info']['user']['apps']['email']) + if(!empty($coldata) && (substr($coldata,0,7) != 'http://')) { - $ref=''; + $coldata = 'http://' . $coldata; + } + $ref = ''; + $data = $coldata . ''; + } + elseif(($column[0] == 'email') || ($column[0] == 'email_home')) + { + if($GLOBALS['phpgw_info']['user']['apps']['email']) + { + $ref = ''; } else { - $ref=''; + $ref = ''; } - $data=$coldata . ''; + $data = $coldata . ''; } else /* But these do not */ { - $ref = ''; $data = $coldata; + $ref = ''; + $data = $coldata; } - $this->template->set_var('col_data',$ref.$data); + $this->template->set_var('col_data',$ref . $data); $this->template->parse('columns','column',True); } - if (1) + if(1) { $this->template->set_var('row_view_link',$GLOBALS['phpgw']->link('/index.php', - 'menuaction=addressbook.uiaddressbook.view&ab_id='.$entries[$i]['id'])); + 'menuaction=addressbook.uiaddressbook.view&ab_id=' . $entries[$i]['id'])); } else { @@ -535,8 +548,10 @@ $this->template->set_var('row_vcard_link',$GLOBALS['phpgw']->link('/index.php', 'menuaction=addressbook.uivcard.out&ab_id='.$entries[$i]['id'])); + /* echo '
: ' . $contacts->grants[$myowner] . ' - ' . $myowner; */ - if ($this->contacts->check_perms($this->contacts->grants[$myowner],PHPGW_ACL_EDIT) || $myowner == $GLOBALS['phpgw_info']['user']['account_id']) + if($this->contacts->check_perms($this->contacts->grants[$myowner],PHPGW_ACL_EDIT) || + $myowner == $GLOBALS['phpgw_info']['user']['account_id']) { $this->template->set_var('row_edit','' . lang('Edit') . ''); @@ -565,11 +580,11 @@ $add_email = $GLOBALS['HTTP_POST_VARS']['add_email'] ? $GLOBALS['HTTP_POST_VARS']['add_email'] : $GLOBALS['HTTP_GET_VARS']['add_email']; $named = explode(' ', $name); - for ($i=count($named);$i>=0;$i--) + for($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; } - if ($names[2]) + if($names[2]) { $fields['n_given'] = $names[0]; $fields['n_middle'] = $names[1]; @@ -613,7 +628,7 @@ function add() { - if ($GLOBALS['HTTP_POST_VARS']['submit']) + if($GLOBALS['HTTP_POST_VARS']['submit']) { $fields = $this->get_form(); @@ -647,13 +662,14 @@ function edit() { - if ($GLOBALS['HTTP_POST_VARS']['submit']) + if($GLOBALS['HTTP_POST_VARS']['submit']) { $_fields = $this->get_form(); /* _debug_array($_fields);exit; */ $check = $this->bo->read_entry(array('id' => $_fields['ab_id'], 'fields' => array('owner' => 'owner','tid' => 'tid'))); - if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id']) + if(($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && + $check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id']) { $userid = $check[0]['owner']; } @@ -677,8 +693,8 @@ /* First, make sure they have permission to this entry */ $check = $this->bo->read_entry(array('id' => $GLOBALS['HTTP_GET_VARS']['ab_id'], 'fields' => array('owner' => 'owner','tid' => 'tid'))); - if ( !$this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && - ($check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id']) ) + if(!$this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && + ($check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); $GLOBALS['phpgw']->common->phpgw_exit(); @@ -708,7 +724,8 @@ $this->template->set_var('cancel_link','
'); - if (($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $GLOBALS['phpgw_info']['user']['account_id']) + if(($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || + $check[0]['owner'] == $GLOBALS['phpgw_info']['user']['account_id']) { $this->template->set_var('delete_link',''); $this->template->set_var('delete_button',''); @@ -721,18 +738,19 @@ { $ab_id = $GLOBALS['HTTP_POST_VARS']['entry']['ab_id'] ? $GLOBALS['HTTP_POST_VARS']['entry']['ab_id'] : $GLOBALS['HTTP_POST_VARS']['ab_id']; $confirm = $GLOBALS['HTTP_GET_VARS']['confirm'] ? $GLOBALS['HTTP_GET_VARS']['confirm'] :$GLOBALS['HTTP_POST_VARS']['confirm']; - if (!$ab_id) + if(!$ab_id) { $ab_id = $GLOBALS['HTTP_GET_VARS']['ab_id']; // else plain Link in delete does not work } - if (!$ab_id) + if(!$ab_id) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); } $check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner','tid' => 'tid'))); - if (!(($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])) + if(!(($this->contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || + $check[0]['owner'] == $GLOBALS['phpgw_info']['user']['account_id'])) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); $GLOBALS['phpgw']->common->phpgw_exit(); @@ -740,7 +758,7 @@ $this->template->set_file(array('delete' => 'delete.tpl')); - if ($confirm != 'true') + if($confirm != 'true') { $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); @@ -772,18 +790,18 @@ $tmp = $check[0]['owner']; $perms = $this->contacts->check_perms($this->contacts->grants[$tmp],PHPGW_ACL_READ); - if ( (!$perms) && ($check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id']) ) + if((!$perms) && ($check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); $GLOBALS['phpgw']->common->phpgw_exit(); } - if (!$ab_id) + if(!$ab_id) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index')); $GLOBALS['phpgw']->common->phpgw_exit(); } - elseif (!$submit && $ab_id) + elseif(!$submit && $ab_id) { $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); @@ -797,9 +815,9 @@ $customfields = $this->read_custom_fields(); /* _debug_array($this->prefs); */ - while (list($column,$x) = each($this->contacts->stock_contact_fields)) + while(list($column,$x) = each($this->contacts->stock_contact_fields)) { - if (isset($this->prefs[$column]) && $this->prefs[$column]) + if(isset($this->prefs[$column]) && $this->prefs[$column]) { $columns_to_display[$column] = True; $colname[$column] = $column; @@ -807,7 +825,7 @@ } /* No prefs? */ - if (!$columns_to_display ) + if(!$columns_to_display ) { $columns_to_display = array( 'n_given' => 'n_given', @@ -818,7 +836,7 @@ 'email' => 'email', 'email_home' => 'email_home' ); - while ($column = each($columns_to_display)) + while($column = each($columns_to_display)) { $colname[$column[0]] = $column[1]; } @@ -832,7 +850,7 @@ $record_owner = $fields[0]['owner']; - if ($fields[0]['access'] == 'private') + if($fields[0]['access'] == 'private') { $access_check = lang('private'); } @@ -844,7 +862,7 @@ $this->template->set_var('lang_viewpref',lang('Address book - view') . $noprefs); @reset($qfields); - while (list($column,$null) = @each($qfields)) + while(list($column,$null) = @each($qfields)) { if($this->display_name($colname[$column])) { @@ -859,20 +877,20 @@ $this->template->set_var('display_col',ucfirst($column)); } $ref = $data = ''; - if ($fields[0][$column]) + if($fields[0][$column]) { $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); $this->template->set_var('th_bg',$tr_color); $coldata = $fields[0][$column]; /* Some fields require special formatting. */ - if ( ($column == 'note' || $column == 'pubkey') && $coldata ) + if(($column == 'note' || $column == 'pubkey') && $coldata) { $datarray = explode ("\n",$coldata); - if ($datarray[1]) + if($datarray[1]) { - while (list($key,$info) = each ($datarray)) + while(list($key,$info) = each ($datarray)) { - if ($key) + if($key) { $data .= ' ' .$info; } @@ -893,14 +911,14 @@ { $data .= $this->contacts->formatted_address($fields[0]['id'],'',False); } - elseif ($column == 'url' && $coldata) + elseif($column == 'url' && $coldata) { $ref = ''; $data = $coldata . ''; } - elseif ( (($column == 'email') || ($column == 'email_home')) && $coldata) + elseif((($column == 'email') || ($column == 'email_home')) && $coldata) { - if ($GLOBALS['phpgw_info']['user']['apps']['email']) + if($GLOBALS['phpgw_info']['user']['apps']['email']) { $ref=''; @@ -917,7 +935,7 @@ $ref = ''; $data = $coldata; } - if (!$data) + if(!$data) { $this->template->set_var('ref_data',' '); } @@ -934,17 +952,17 @@ $fields['cat_id'] = is_array($this->cat_id) ? implode(',',$this->cat_id) : $this->cat_id; $cats = explode(',',$fields[0]['cat_id']); - if ($cats[1]) + if($cats[1]) { - while (list($key,$contactscat) = each($cats)) + while(list($key,$contactscat) = each($cats)) { - if ($contactscat) + if($contactscat) { $catinfo = $this->cat->return_single(intval($contactscat)); $catname .= $catinfo[0]['name'] . '; '; } } - if (!$this->cat_id) + if(!$this->cat_id) { $this->cat_id = $cats[0]; } @@ -954,13 +972,16 @@ $fields[0]['cat_id'] = ereg_replace(',','',$fields[0]['cat_id']); $catinfo = $this->cat->return_single(intval($fields[0]['cat_id'])); $catname = $catinfo[0]['name']; - if (!$this->cat_id) + if(!$this->cat_id) { $this->cat_id = $fields[0]['cat_id']; } } - if (!$catname) { $catname = lang('none'); } + if(!$catname) + { + $catname = lang('none'); + } /* These are in the footer */ $this->template->set_var('lang_owner',lang('Record owner')); @@ -970,11 +991,12 @@ $this->template->set_var('lang_category',lang('Category')); $this->template->set_var('catname',$catname); - if (($this->contacts->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $GLOBALS['phpgw_info']['user']['account_id'])) + if(($this->contacts->grants[$record_owner] & PHPGW_ACL_EDIT) || + ($record_owner == $GLOBALS['phpgw_info']['user']['account_id'])) { $extra_vars = array('cd' => 16,'query' => $this->query,'cat_id' => $this->cat_id); - if ($referer) + if($referer) { $extra_vars += array('referer' => urlencode($referer)); } @@ -985,7 +1007,7 @@ $this->template->set_var('copy_button',$this->html_1button_form('submit','copy', $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.copy&ab_id=' . $fields[0]['id']))); - if ($fields[0]['n_family'] && $fields[0]['n_given']) + if($fields[0]['n_family'] && $fields[0]['n_given']) { $this->template->set_var('vcard_button',$this->html_1button_form('VCardForm','VCard', $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$ab_id))); @@ -1024,14 +1046,14 @@ $qfields = $this->contacts->stock_contact_fields + $this->extrafields + $customfields; - if ($submit) + if($submit) { $totalerrors = 0; - if (!count($prefs)) + if(!count($prefs)) { $errors[$totalerrors++] = lang('You must select at least 1 column to display'); } - if (!$totalerrors) + if(!$totalerrors) { @reset($qfields); $this->bo->save_preferences($prefs,$other,$qfields,$fcat_id); @@ -1041,7 +1063,7 @@ $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); - if ($totalerrors) + if($totalerrors) { echo '

' . $GLOBALS['phpgw']->common->error_list($errors) . '
'; } @@ -1053,18 +1075,21 @@ $i = 0; $j = 0; $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); - while (list($col, $descr) = each($qfields)) + while(list($col, $descr) = each($qfields)) { /* echo '
test: $col - $i $j - ' . count($abc); */ $i++; $j++; $showcol = $this->display_name($col); - if (!$showcol) { $showcol = $col; } + if(!$showcol) + { + $showcol = $col; + } /* yank the *'s prior to testing for a valid column description */ $coltest = ereg_replace('\*','',$showcol); - if ($coltest) + if($coltest) { $this->template->set_var($col,$showcol); - if ($GLOBALS['phpgw_info']['user']['preferences']['addressbook'][$col]) + if($GLOBALS['phpgw_info']['user']['preferences']['addressbook'][$col]) { $this->template->set_var($col.'_checked',' checked'); } @@ -1075,7 +1100,7 @@ } } - if ($customfields) + if($customfields) { $custom_var = ' @@ -1084,7 +1109,7 @@ '; - while( list($cf) = each($customfields) ) + while(list($cf) = each($customfields)) { $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); $custom_var .= "\n" . '' . "\n"; @@ -1105,7 +1130,7 @@ $this->template->set_var(tr_color,$tr_color); $this->template->set_var('lang_showbirthday',lang('show birthday reminders on main screen')); - if ($this->prefs['mainscreen_showbirthdays']) + if($this->prefs['mainscreen_showbirthdays']) { $this->template->set_var('show_birthday',' checked'); } @@ -1123,7 +1148,7 @@ $this->template->set_var('filter_select',$this->formatted_list('other[default_filter]',$list,$this->prefs['default_filter'])); $this->template->set_var('lang_autosave',lang('Autosave default category')); - if ($this->prefs['autosave_category']) + if($this->prefs['autosave_category']) { $this->template->set_var('autosave',' checked'); } @@ -1162,14 +1187,14 @@ } /* _debug_array($entry); exit; */ - if (!$entry['bday_month'] && !$entry['bday_day'] && !$entry['bday_year']) + if(!$entry['bday_month'] && !$entry['bday_day'] && !$entry['bday_year']) { $fields['bday'] = ''; } else { $bday_day = $entry['bday_day']; - if (strlen($bday_day) == 1) + if(strlen($bday_day) == 1) { $bday_day = '0' . $entry['bday_day']; } @@ -1186,9 +1211,9 @@ $fields['n_middle'] = $entry['middle']; $fields['n_prefix'] = $entry['prefix']; $fields['n_suffix'] = $entry['suffix']; - if ($entry['prefix']) { $pspc = ' '; } - if ($entry['middle']) { $mspc = ' '; } else { $nspc = ' '; } - if ($entry['suffix']) { $sspc = ' '; } + if($entry['prefix']) { $pspc = ' '; } + if($entry['middle']) { $mspc = ' '; } else { $nspc = ' '; } + if($entry['suffix']) { $sspc = ' '; } $fields['fn'] = $entry['prefix'].$pspc.$entry['firstname'].$nspc.$mspc.$entry['middle'].$mspc.$entry['lastname'].$sspc.$entry['suffix']; $fields['email'] = $entry['email']; $fields['email_type'] = $entry['email_type']; @@ -1256,7 +1281,7 @@ $fields['adr_two_type'] = substr($typeb,0,-1); $custom = $this->read_custom_fields(); - while (list($name,$val) = @each($custom)) + while(list($name,$val) = @each($custom)) { $fields[$name] = $entry[$val]; } @@ -1267,7 +1292,7 @@ $fields['note'] = $entry['notes']; $fields['label'] = $entry['label']; - if ($entry['access'] == True) + if($entry['access'] == True) { $fields['access'] = 'private'; } @@ -1276,7 +1301,7 @@ $fields['access'] = 'public'; } - if (is_array($fcat_id)) + if(is_array($fcat_id)) { $fields['cat_id'] = count($fcat_id) > 1 ? ','.implode(',',$fcat_id).',' : $fcat_id[0]; } @@ -1287,7 +1312,7 @@ $fields['ab_id'] = $entry['ab_id']; $fields['tid'] = $entry['tid']; - if (!$fields['tid']) + if(!$fields['tid']) { $fields['tid'] = 'n'; } @@ -1304,7 +1329,7 @@ $this->template->set_file(array('form' => 'form.tpl')); - if ( ($GLOBALS['phpgw_info']['server']['countrylist'] == 'user_choice' && + if(($GLOBALS['phpgw_info']['server']['countrylist'] == 'user_choice' && $GLOBALS['phpgw_info']['user']['preferences']['common']['countrylist'] == 'use_select') || ($GLOBALS['phpgw_info']['server']['countrylist'] == 'force_select')) { @@ -1371,7 +1396,7 @@ } $cats_link = $this->cat_option($cat_id,True,False,True); - if ($access == 'private') + if($access == 'private') { $access_check = ' checked'; } @@ -1380,7 +1405,7 @@ $access_check = ''; } - if ($customfields) + if($customfields) { while(list($name,$value) = each($customfields)) { @@ -1395,15 +1420,15 @@ } } - if ($format != "view") + if($format != "view") { /* Preferred phone number radio buttons */ $pref[0] = ''; $pref[1] = '(' . lang('pref') . ')'; - while (list($name,$val) = each($this->contacts->tel_types)) + while(list($name,$val) = each($this->contacts->tel_types)) { $str[$name] = "\n".' template->set_var("pref_".$name,$str[$name]); } - if (strlen($bday) > 2) + if(strlen($bday) > 2) { list( $month, $day, $year ) = split( '/', $bday ); $temp_month[$month] = ' selected'; @@ -1456,14 +1481,14 @@ } $time_zone = '' . "\n"; $email_type = ''; reset($this->contacts->email_types); $hemail_type = ''; reset($this->contacts->adr_types); - while (list($type,$val) = each($this->contacts->adr_types)) + while(list($type,$val) = each($this->contacts->adr_types)) { $badrtype .= "\n".'contacts->adr_types); - while (list($type,$val) = each($this->contacts->adr_types)) + while(list($type,$val) = each($this->contacts->adr_types)) { $hadrtype .= "\n".''; - if ($bday == '//') + if($bday == '//') { $bday = ''; } } - if ($action) + if($action) { echo '
'; } - if (!ereg('^http://',$url)) + if(!ereg('^http://',$url)) { $url = 'http://' . $url; } $birthday = $GLOBALS['phpgw']->common->dateformatorder($bday_year,$bday_month,$bday_day) . '(e.g. 1969)'; - if ($format == 'edit') + if($format == 'edit') { $create .= '' . lang("Created by") . ':' . '' @@ -1620,7 +1651,7 @@ $this->template->set_var('bzip',$bzip); $this->template->set_var('lang_bcountry',lang('Business Country')); $this->template->set_var('bcountry',$bcountry); - if ($countrylist) + if($countrylist) { $this->template->set_var('bcountry',$GLOBALS['phpgw']->country->form_select($bcountry,'entry[bcountry]')); } @@ -1646,7 +1677,7 @@ $this->template->set_var('lang_hzip',lang('Home Zip Code')); $this->template->set_var('hzip',$hzip); $this->template->set_var('lang_hcountry',lang('Home Country')); - if ($countrylist) + if($countrylist) { $this->template->set_var('hcountry',$GLOBALS['phpgw']->country->form_select($hcountry,'entry[hcountry]')); } @@ -1670,7 +1701,7 @@ $this->template->set_var('lang_cats',lang('Category')); $this->template->set_var('cats_link',$cats_link); - if ($customfields) + if($customfields) { $this->template->set_var('lang_custom',lang('Custom Fields').':'); $this->template->set_var('custom',$custom); diff --git a/addressbook/inc/class.uifields.inc.php b/addressbook/inc/class.uifields.inc.php index 093c2b26a5..3c4b79ab04 100644 --- a/addressbook/inc/class.uifields.inc.php +++ b/addressbook/inc/class.uifields.inc.php @@ -66,12 +66,12 @@ $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done')); $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php')); - if (!$start) + if(!$start) { $start = 0; } - if (!$sort) + if(!$sort) { $sort = 'ASC'; } @@ -92,7 +92,7 @@ $GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit')); $GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete')); - for ($i=0;$inextmatchs->alternate_row_color($tr_color); $GLOBALS['phpgw']->template->set_var(tr_color,$tr_color); @@ -136,22 +136,22 @@ $GLOBALS['phpgw']->template->set_block('form','add','addhandle'); $GLOBALS['phpgw']->template->set_block('form','edit','edithandle'); - if ($GLOBALS['HTTP_POST_VARS']['submit']) + if($GLOBALS['HTTP_POST_VARS']['submit']) { $errorcount = 0; - if (!$field_name) + if(!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field !'); } $fields = $this->read_custom_fields($start,$limit,$field_name); - if ($fields[0]['name']) + if($fields[0]['name']) { $error[$errorcount++] = lang('That field name has been used already !'); } - if (! $error) + if(!$error) { $field_name = addslashes($field_name); $this->save_custom_field($field,$field_name); @@ -161,15 +161,15 @@ $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); - if ($errorcount) + if($errorcount) { $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); } - if (($submit) && (! $error) && (! $errorcount)) + if(($submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',lang('Field x has been added !', $field_name)); } - if ((! $submit) && (! $error) && (! $errorcount)) + if((! $submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',''); } @@ -202,7 +202,6 @@ echo lang('access not permitted'); $GLOBALS['phpgw']->common->phpgw_footer(); $GLOBALS['phpgw']->common->phpgw_exit(); - } $field = $GLOBALS['HTTP_POST_VARS']['field'] ? $GLOBALS['HTTP_POST_VARS']['field'] : $GLOBALS['HTTP_GET_VARS']['field']; @@ -212,7 +211,7 @@ $sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort']; $submit = $GLOBALS['HTTP_POST_VARS']['submit']; - if (!$field) + if(!$field) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifields.index&sort=$sort&query=$query&start=$start")); } @@ -226,14 +225,17 @@ . '' . "\n" . '' . "\n"; - if ($submit) + if($submit) { $errorcount = 0; - if (!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field!'); } + if(!$field_name) + { + $error[$errorcount++] = lang('Please enter a name for that field!'); + } $field_name = addslashes($field_name); - if (! $error) + if(!$error) { $this->save_custom_field($field,$field_name); } @@ -242,20 +244,20 @@ $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); - if ($errorcount) + if($errorcount) { $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); } - if (($submit) && (! $error) && (! $errorcount)) + if(($submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',lang('Field x has been updated !', $field_name)); } - if ((! $submit) && (! $error) && (! $errorcount)) + if((!$submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',''); } - if ($submit) + if($submit) { $field = $field_name; } @@ -294,12 +296,12 @@ $query = $GLOBALS['HTTP_POST_VARS']['query'] ? $GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query']; $sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort']; - if (!$field) + if(!$field) { Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uifields.index')); } - if ($GLOBALS['HTTP_POST_VARS']['confirm']) + if($GLOBALS['HTTP_POST_VARS']['confirm']) { $this->save_custom_field($field); Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifields.index&start=$start&query=$query&sort=$sort")); @@ -343,15 +345,15 @@ $i = 0; $j = 0; $fields = array(); @reset($GLOBALS['phpgw_info']['user']['preferences']['addressbook']); - while (list($col,$descr) = @each($GLOBALS['phpgw_info']['user']['preferences']['addressbook'])) + while(list($col,$descr) = @each($GLOBALS['phpgw_info']['user']['preferences']['addressbook'])) { - if ( substr($col,0,6) == 'extra_' ) + if(substr($col,0,6) == 'extra_') { $fields[$j]['name'] = ereg_replace('extra_','',$col); $fields[$j]['name'] = ereg_replace(' ','_',$fields[$j]['name']); $fields[$j]['id'] = $i; - if ($query && ($fields[$j]['name'] != $query)) + if($query && ($fields[$j]['name'] != $query)) { unset($fields[$j]['name']); unset($fields[$j]['id']); @@ -371,7 +373,7 @@ function save_custom_field($old='',$new='') { $GLOBALS['phpgw']->preferences->read_repository($GLOBALS['phpgw_info']['user']['account_id']); - if ($old) + if($old) { $GLOBALS['phpgw']->preferences->delete("addressbook","extra_".$old); } diff --git a/addressbook/inc/class.uivcard.inc.php b/addressbook/inc/class.uivcard.inc.php index 03d97b82c7..0cdc009938 100644 --- a/addressbook/inc/class.uivcard.inc.php +++ b/addressbook/inc/class.uivcard.inc.php @@ -26,7 +26,7 @@ 'out' => True ); - var $extrafields = array( + var $extrafields = array( 'ophone' => 'ophone', 'address2' => 'address2', 'address3' => 'address3' @@ -34,9 +34,7 @@ function uivcard() { - global $phpgw; - - $this->template = $phpgw->template; + $this->template = $GLOBALS['phpgw']->template; $this->contacts = CreateObject('phpgwapi.contacts'); $this->browser = CreateObject('phpgwapi.browser'); $this->vcard = CreateObject('phpgwapi.vcard'); @@ -45,14 +43,14 @@ function in() { - global $phpgw,$phpgw_info,$action; + $action = $GLOBALS['HTTP_POST_VARS']['action']; - $phpgw->common->phpgw_header(); + $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); - echo ''; + echo ''; - if ($action == 'GetFile') + if($action == 'GetFile') { echo '
' . lang('You must select a vcard. (*.vcf)') . '


'; } @@ -60,7 +58,7 @@ $this->template->set_file(array('vcardin' => 'vcardin.tpl')); $this->template->set_var('vcard_header','

 ' . lang('Address book - VCard in') . '


'); - $this->template->set_var('action_url',$phpgw->link('/index.php','menuaction=addressbook.boaddressbook.add_vcard')); + $this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.boaddressbook.add_vcard')); $this->template->set_var('lang_access',lang('Access')); $this->template->set_var('lang_groups',lang('Which groups')); $this->template->set_var('access_option',$access_option); @@ -68,36 +66,36 @@ $this->template->pparse('out','vcardin'); - $phpgw->common->phpgw_footer(); + $GLOBALS['phpgw']->common->phpgw_footer(); } function out() { - global $phpgw,$phpgw_info,$ab_id,$nolname,$nofname; + global $ab_id,$nolname,$nofname; - if ($nolname || $nofname) + if($nolname || $nofname) { - $phpgw->common->phpgw_header(); + $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); } - if (!$ab_id) + if(!$ab_id) { - Header('Location: ' . $phpgw->link('/addressbook/index.php')); - $phpgw->common->phpgw_exit(); + Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/index.php')); + $GLOBALS['phpgw']->common->phpgw_exit(); } // First, make sure they have permission to this entry $check = $this->bo->read_entry(array('id' => $ab_id, 'fields' => array('owner' => 'owner'))); $perms = $this->contacts->check_perms($this->contacts->grants[$check[0]['owner']],PHPGW_ACL_READ); - if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) ) + if((!$perms) && ($check[0]['owner'] != $GLOBALS['phpgw_info']['user']['account_id'])) { - Header("Location: " . $phpgw->link('/index.php','menuaction=addressbook.uiaddressbook.get_list')); - $phpgw->common->phpgw_exit(); + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.get_list')); + $GLOBALS['phpgw']->common->phpgw_exit(); } - $extrafields = array('address2' => 'address2'); + $extrafields = array('address2' => 'address2'); $qfields = $this->contacts->stock_contact_fields + $extrafields; $fieldlist = $this->bo->read_entry(array('id' => $ab_id, 'fields' => $qfields)); @@ -124,49 +122,49 @@ if($lastname == '') { /* Run away here. */ - Header('Location: ' . $phpgw->link('/index.php',"menuaction=addressbook.uivcard.out&nolname=1&ab_id=$ab_id")); + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.out&nolname=1&ab_id=' . $ab_id)); } if($firstname == '') { - Header('Location: ' . $phpgw->link('/index.php',"menuaction=addressbook.uivcard.out&nofname=1&ab_id=$ab_id")); + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.out&nofname=1&ab_id=' . $ab_id)); } if ($email) { $fn = explode('@',$email); - $filename = sprintf("%s.vcf", $fn[0]); + $filename = sprintf('%s.vcf', $fn[0]); } elseif ($hemail) { $fn = explode('@',$hemail); - $filename = sprintf("%s.vcf", $fn[0]); + $filename = sprintf('%s.vcf', $fn[0]); } else { $fn = strtolower($firstname); - $filename = sprintf("%s.vcf", $fn); + $filename = sprintf('%s.vcf', $fn); } // set translation variable $myexport = $this->vcard->export; // check that each $fields exists in the export array and // set a new array to equal the translation and original value - while( list($name,$value) = each($fields) ) + while(list($name,$value) = each($fields)) { - if ($myexport[$name] && ($value != "") ) + if($myexport[$name] && ($value != '')) { - //echo '
'.$name."=".$fields[$name]."\n"; + //echo '
'.$name.'='.$fields[$name]."\n"; $buffer[$myexport[$name]] = $value; } } // create a vcard from this translated array - $entry = $this->vcard->out($buffer); + $entry = $this->vcard->out($buffer); // print it using browser class for headers // filename, mimetype, no length, default nocache True $this->browser->content_header($filename,'text/x-vcard'); echo $entry; - $phpgw->common->exit; + $GLOBALS['phpgw']->common->exit; } /* !nolname && !nofname */ if($nofname) @@ -174,8 +172,7 @@ echo '

'; echo lang("This person's first name was not in the address book.") .'
'; echo lang('Vcards require a first name entry.') . '

'; - echo '
' . lang('OK') . ''; + echo '' . lang('OK') . ''; echo '
'; } @@ -184,14 +181,13 @@ echo '

'; echo lang("This person's last name was not in the address book.") . '
'; echo lang('Vcards require a last name entry.') . '

'; - echo '' . lang('OK') . ''; + echo '' . lang('OK') . ''; echo '
'; } if($nolname || $nofname) { - $phpgw->common->phpgw_footer(); + $GLOBALS['phpgw']->common->phpgw_footer(); } } }