diff --git a/addressbook/view.php b/addressbook/view.php index fe962892b4..f30e1cdd4e 100755 --- a/addressbook/view.php +++ b/addressbook/view.php @@ -12,15 +12,15 @@ /* $Id$ */ - $phpgw_info["flags"] = array( - "noheader" => True, - "nonavbar" => True, - "currentapp" => "addressbook", - "enable_contacts_class" => True, - "enable_nextmatchs_class" => True + $phpgw_info['flags'] = array( + 'noheader' => True, + 'nonavbar' => True, + 'currentapp' => 'addressbook', + 'enable_contacts_class' => True, + 'enable_nextmatchs_class' => True ); - include("../header.inc.php"); + include('../header.inc.php'); $this = CreateObject("phpgwapi.contacts"); @@ -35,66 +35,75 @@ $phpgw->common->phpgw_exit(); } - if (!$ab_id) { - Header("Location: " . $phpgw->link("/addressbook/index.php")); - } elseif (!$submit && $ab_id) { + if (!$ab_id) + { + Header("Location: " . $phpgw->link('/addressbook/index.php')); + } + elseif (!$submit && $ab_id) + { $phpgw->common->phpgw_header(); echo parse_navbar(); } - $t = new Template($phpgw->common->get_tpl_dir("addressbook")); + $t = new Template($phpgw->common->get_tpl_dir('addressbook')); $t->set_file(array( - "view" => "view.tpl", - "view_header" => "view_header.tpl", - "view_row" => "view_row.tpl", - "view_footer" => "view_footer.tpl" + 'view' => 'view.tpl', + 'view_header' => 'view_header.tpl', + 'view_row' => 'view_row.tpl', + 'view_footer' => 'view_footer.tpl' )); $customfields = array(); - while (list($col,$descr) = @each($phpgw_info["user"]["preferences"]["addressbook"])) { - if ( substr($col,0,6) == 'extra_' ) { + while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook'])) + { + if ( substr($col,0,6) == 'extra_' ) + { $field = ereg_replace('extra_','',$col); $field = ereg_replace(' ','_',$field); $customfields[$field] = ucfirst($field); } } - while ($column = each($this->stock_contact_fields)) { - if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && - $phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { + while ($column = each($this->stock_contact_fields)) + { + if (isset($phpgw_info['user']['preferences']['addressbook'][$column[0]]) && + $phpgw_info['user']['preferences']['addressbook'][$column[0]]) + { $columns_to_display[$column[0]] = True; $colname[$column[0]] = $column[0]; } } // No prefs? - if (!$columns_to_display ) { + if (!$columns_to_display ) + { $columns_to_display = array( - "n_given" => "n_given", - "n_family" => "n_family", - "org_name" => "org_name", - "tel_work" => "tel_work", - "tel_home" => "tel_home", - "email" => "email", - "email_home" => "email_home" + 'n_given' => 'n_given', + 'n_family' => 'n_family', + 'org_name' => 'org_name', + 'tel_work' => 'tel_work', + 'tel_home' => 'tel_home', + 'email' => 'email', + 'email_home' => 'email_home' ); - while ($column = each($columns_to_display)) { + while ($column = each($columns_to_display)) + { $colname[$column[0]] = $column[1]; } - $noprefs= " - " . lang("Please set your preferences for this app"); + $noprefs = " - " . lang('Please set your preferences for this app'); } // merge in extra fields $extrafields = array( - "ophone" => "ophone", - "address2" => "address2", - "address3" => "address3" + 'ophone' => 'ophone', + 'address2' => 'address2', + 'address3' => 'address3' ); $qfields = $this->stock_contact_fields + $extrafields + $customfields; - $fields = addressbook_read_entry($ab_id,$qfields); + $fields = addressbook_read_entry($ab_id,$qfields); - $record_owner = $fields[0]["owner"]; + $record_owner = $fields[0]['owner']; if ($fields[0]["access"] == 'private') { @@ -108,7 +117,8 @@ $t->set_var('lang_viewpref',lang("Address book - view") . $noprefs); @reset($qfields); - while (list($column,$null) = @each($qfields)) { // each entry column + while (list($column,$null) = @each($qfields)) // each entry column + { if(display_name($colname[$column])) { $t->set_var('display_col',display_name($colname[$column])); @@ -127,7 +137,7 @@ $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $t->set_var('th_bg',$tr_color); $coldata = $fields[0][$column]; - // Some fields require special formatting. + // Some fields require special formatting. if ( ($column == "note" || $column == "label" || $column == "pubkey") && $coldata ) { $datarray = explode ("\n",$coldata); @@ -182,28 +192,28 @@ { $t->set_var('ref_data',$ref . $data); } - $t->parse("cols","view_row",True); + $t->parse('cols','view_row',True); } } $cat = CreateObject('phpgwapi.categories'); - $catinfo = $cat->return_single($fields[0]['cat_id']); - $catname = $catinfo[0]["name"]; + $catinfo = $cat->return_single($fields[0]['cat_id']); + $catname = $catinfo[0]['name']; if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } - $cat->app_name = "phpgw"; + $cat->app_name = 'phpgw'; $catinfo = $cat->return_single($fields[0]['cat_id']); - $catname .= $catinfo[0]["name"]; + $catname .= $catinfo[0]['name']; if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } if (!$catname) { $catname = lang('none'); } // These are in the footer - $t->set_var('lang_owner',lang("Record owner")); + $t->set_var('lang_owner',lang('Record owner')); $t->set_var('owner',$phpgw->common->grab_owner_name($record_owner)); $t->set_var('lang_access',lang("Record access")); $t->set_var('access',$access_check); - $t->set_var('lang_category',lang("Category")); + $t->set_var('lang_category',lang('Category')); $t->set_var('catname',$catname); $sfields = rawurlencode(serialize($fields[0])); @@ -225,7 +235,7 @@ $t->set_var('edit_button',''); } - $copylink = '