@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param string $contact_app |
| 81 | 81 | */ |
| 82 | - function __construct($contact_app='addressbook') |
|
| 82 | + function __construct($contact_app = 'addressbook') |
|
| 83 | 83 | { |
| 84 | 84 | parent::__construct($contact_app); |
| 85 | 85 | |
@@ -93,23 +93,23 @@ discard block |
||
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | // make sure the hook for export_limit is registered |
| 96 | - if (!Api\Hooks::exists('export_limit','addressbook')) Api\Hooks::read(true); |
|
| 96 | + if (!Api\Hooks::exists('export_limit', 'addressbook')) Api\Hooks::read(true); |
|
| 97 | 97 | |
| 98 | - $this->config =& $GLOBALS['egw_info']['server']; |
|
| 98 | + $this->config = & $GLOBALS['egw_info']['server']; |
|
| 99 | 99 | |
| 100 | 100 | // check if a contact specific export limit is set, if yes use it also for etemplate's csv export |
| 101 | - $this->config['export_limit'] = $this->config['contact_export_limit'] = Api\Storage\Merge::getExportLimit($app='addressbook'); |
|
| 101 | + $this->config['export_limit'] = $this->config['contact_export_limit'] = Api\Storage\Merge::getExportLimit($app = 'addressbook'); |
|
| 102 | 102 | |
| 103 | 103 | if ($this->config['copy_fields'] && ($fields = is_array($this->config['copy_fields']) ? |
| 104 | 104 | $this->config['copy_fields'] : unserialize($this->config['copy_fields']))) |
| 105 | 105 | { |
| 106 | 106 | // Set country code if country name is selected |
| 107 | - $supported_fields = $this->get_fields('supported',null,0); |
|
| 108 | - if(in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname',$fields)) |
|
| 107 | + $supported_fields = $this->get_fields('supported', null, 0); |
|
| 108 | + if (in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname', $fields)) |
|
| 109 | 109 | { |
| 110 | 110 | $fields[] = 'adr_one_countrycode'; |
| 111 | 111 | } |
| 112 | - if(in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname',$fields)) |
|
| 112 | + if (in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname', $fields)) |
|
| 113 | 113 | { |
| 114 | 114 | $fields[] = 'adr_two_countrycode'; |
| 115 | 115 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param string $msg =null message to show |
| 126 | 126 | * @param boolean $do_email =false do an email-selection popup or the regular index-page |
| 127 | 127 | */ |
| 128 | - function index($_content=null,$msg=null,$do_email=false) |
|
| 128 | + function index($_content = null, $msg = null, $do_email = false) |
|
| 129 | 129 | { |
| 130 | 130 | //echo "<p>uicontacts::index(".print_r($_content,true).",'$msg')</p>\n"; |
| 131 | 131 | if (($re_submit = is_array($_content))) |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | else |
| 159 | 159 | { |
| 160 | 160 | $success = $failed = $action_msg = null; |
| 161 | - if ($this->action($_content['nm']['action'],$_content['nm']['selected'],$_content['nm']['select_all'], |
|
| 162 | - $success,$failed,$action_msg,$_content['do_email'] ? 'email' : 'index',$msg,$_content['nm']['checkboxes'])) |
|
| 161 | + if ($this->action($_content['nm']['action'], $_content['nm']['selected'], $_content['nm']['select_all'], |
|
| 162 | + $success, $failed, $action_msg, $_content['do_email'] ? 'email' : 'index', $msg, $_content['nm']['checkboxes'])) |
|
| 163 | 163 | { |
| 164 | - $msg .= lang('%1 contact(s) %2',$success,$action_msg); |
|
| 164 | + $msg .= lang('%1 contact(s) %2', $success, $action_msg); |
|
| 165 | 165 | Framework::message($msg); |
| 166 | 166 | } |
| 167 | - elseif(is_null($msg)) |
|
| 167 | + elseif (is_null($msg)) |
|
| 168 | 168 | { |
| 169 | - $msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
| 170 | - Framework::message($msg,'error'); |
|
| 169 | + $msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
| 170 | + Framework::message($msg, 'error'); |
|
| 171 | 171 | } |
| 172 | 172 | $msg = ''; |
| 173 | 173 | } |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | $typeselection = $_content['nm']['col_filter']['tid']; |
| 189 | 189 | } |
| 190 | - elseif($_GET['add_list']) |
|
| 190 | + elseif ($_GET['add_list']) |
|
| 191 | 191 | { |
| 192 | - $list = $this->add_list($_GET['add_list'],$_GET['owner']?$_GET['owner']:$this->user); |
|
| 192 | + $list = $this->add_list($_GET['add_list'], $_GET['owner'] ? $_GET['owner'] : $this->user); |
|
| 193 | 193 | if ($list === true) |
| 194 | 194 | { |
| 195 | 195 | $msg = lang('List already exists!'); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | ); |
| 209 | 209 | $to = $_content['nm']['to']; |
| 210 | 210 | $content = array(); |
| 211 | - if($msg || $_GET['msg']) |
|
| 211 | + if ($msg || $_GET['msg']) |
|
| 212 | 212 | { |
| 213 | 213 | Framework::message($msg ? $msg : $_GET['msg']); |
| 214 | 214 | } |
@@ -217,23 +217,23 @@ discard block |
||
| 217 | 217 | if (!is_array($content['nm'])) |
| 218 | 218 | { |
| 219 | 219 | $content['nm'] = array( |
| 220 | - 'get_rows' => 'addressbook.addressbook_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 221 | - 'bottom_too' => false, // I show the nextmatch-line (arrows, filters, search, ...) again after the rows |
|
| 222 | - 'never_hide' => True, // I never hide the nextmatch-line if less then maxmatch entrie |
|
| 223 | - 'start' => 0, // IO position in list |
|
| 224 | - 'cat_id' => '', // IO category, if not 'no_cat' => True |
|
| 225 | - 'search' => '', // IO search pattern |
|
| 226 | - 'order' => 'n_family', // IO name of the column to sort after (optional for the sortheaders) |
|
| 227 | - 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 228 | - 'col_filter' => array(), // IO array of column-name value pairs (optional for the filterheaders) |
|
| 220 | + 'get_rows' => 'addressbook.addressbook_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 221 | + 'bottom_too' => false, // I show the nextmatch-line (arrows, filters, search, ...) again after the rows |
|
| 222 | + 'never_hide' => True, // I never hide the nextmatch-line if less then maxmatch entrie |
|
| 223 | + 'start' => 0, // IO position in list |
|
| 224 | + 'cat_id' => '', // IO category, if not 'no_cat' => True |
|
| 225 | + 'search' => '', // IO search pattern |
|
| 226 | + 'order' => 'n_family', // IO name of the column to sort after (optional for the sortheaders) |
|
| 227 | + 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 228 | + 'col_filter' => array(), // IO array of column-name value pairs (optional for the filterheaders) |
|
| 229 | 229 | //'cat_id_label' => lang('Categories'), |
| 230 | 230 | //'filter_label' => lang('Addressbook'), // I label for filter (optional) |
| 231 | - 'filter' => '', // =All // IO filter, if not 'no_filter' => True |
|
| 232 | - 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
| 233 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 231 | + 'filter' => '', // =All // IO filter, if not 'no_filter' => True |
|
| 232 | + 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
| 233 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 234 | 234 | //'filter2_label'=> lang('Distribution lists'), // IO filter2, if not 'no_filter2' => True |
| 235 | - 'filter2' => '', // IO filter2, if not 'no_filter2' => True |
|
| 236 | - 'filter2_no_lang'=> True, // I set no_lang for filter2 (=dont translate the options) |
|
| 235 | + 'filter2' => '', // IO filter2, if not 'no_filter2' => True |
|
| 236 | + 'filter2_no_lang'=> True, // I set no_lang for filter2 (=dont translate the options) |
|
| 237 | 237 | 'lettersearch' => true, |
| 238 | 238 | 'do_email' => $do_email ? 1 : 0, |
| 239 | 239 | // using a positiv list now, as we constantly adding new columns in addressbook, but not removing them from default |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | 'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/ |
| 245 | 245 | 'filter2_onchange' => "return app.addressbook.filter2_onchange();", |
| 246 | 246 | 'filter2_tags' => true, |
| 247 | - 'manual' => $do_email ? ' ' : false, // space for the manual icon |
|
| 247 | + 'manual' => $do_email ? ' ' : false, // space for the manual icon |
|
| 248 | 248 | //'actions' => $this->get_actions(), // set on each request, as it depends on some filters |
| 249 | 249 | 'row_id' => 'id', |
| 250 | 250 | 'row_modified' => 'modified', |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | // use the state of the last session stored in the user prefs |
| 261 | 261 | if (($state = @unserialize($this->prefs[$do_email ? 'email_state' : 'index_state']))) |
| 262 | 262 | { |
| 263 | - $content['nm'] = array_merge($content['nm'],$state); |
|
| 263 | + $content['nm'] = array_merge($content['nm'], $state); |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | $sel_options['cat_id'] = array('' => lang('All categories'), '0' => lang('None')); |
| 267 | 267 | |
| 268 | 268 | $content['nm']['placeholder_actions'] = array('add'); |
| 269 | 269 | // Edit and delete list actions depends on permissions |
| 270 | - if($this->get_lists(Acl::EDIT)) |
|
| 270 | + if ($this->get_lists(Acl::EDIT)) |
|
| 271 | 271 | { |
| 272 | 272 | $content['nm']['placeholder_actions'][] = 'rename_list'; |
| 273 | 273 | $content['nm']['placeholder_actions'][] = 'delete_list'; |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | if (isset($typeselection)) $content['nm']['col_filter']['tid'] = $typeselection; |
| 281 | 281 | // save the tid for use in creating new addressbook entrys via UI. Current tid is to be used as type of new entrys |
| 282 | 282 | //error_log(__METHOD__.__LINE__.' '.$content['nm']['col_filter']['tid']); |
| 283 | - Api\Cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']); |
|
| 283 | + Api\Cache::setSession('addressbook', 'active_tid', $content['nm']['col_filter']['tid']); |
|
| 284 | 284 | if ($this->lists_available()) |
| 285 | 285 | { |
| 286 | - $sel_options['filter2'] = $this->get_lists(Acl::READ,array('' => lang('No distribution list'))); |
|
| 287 | - $sel_options['filter2']['add'] = lang('Add a new list').'...'; // put it at the end |
|
| 286 | + $sel_options['filter2'] = $this->get_lists(Acl::READ, array('' => lang('No distribution list'))); |
|
| 287 | + $sel_options['filter2']['add'] = lang('Add a new list').'...'; // put it at the end |
|
| 288 | 288 | } |
| 289 | 289 | if ($do_email) |
| 290 | 290 | { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $content['nm']['header_left'] = 'addressbook.email.left'; |
| 303 | 303 | } |
| 304 | 304 | // Organisation stuff is not (yet) availible with ldap |
| 305 | - elseif($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap') |
|
| 305 | + elseif ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap') |
|
| 306 | 306 | { |
| 307 | 307 | $content['nm']['header_left'] = 'addressbook.index.left'; |
| 308 | 308 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $sel_options['adr_one_countrycode']['-custom-'] = lang('No country selected'); |
| 316 | 316 | |
| 317 | 317 | // if there is any export limit set, pass it on to the nextmatch, to be evaluated by the export |
| 318 | - if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit']=$this->config['contact_export_limit']; |
|
| 318 | + if (isset($this->config['contact_export_limit']) && (int)$this->config['contact_export_limit']) $content['nm']['export_limit'] = $this->config['contact_export_limit']; |
|
| 319 | 319 | |
| 320 | 320 | // Merge to email dialog needs the infolog types |
| 321 | 321 | $infolog = new infolog_bo(); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // dont show tid-selection if we have only one content_type |
| 325 | 325 | // be a bit more sophisticated about it |
| 326 | 326 | $availabletypes = array_keys($this->content_types); |
| 327 | - if ($content['nm']['col_filter']['tid'] && !in_array($content['nm']['col_filter']['tid'],$availabletypes)) |
|
| 327 | + if ($content['nm']['col_filter']['tid'] && !in_array($content['nm']['col_filter']['tid'], $availabletypes)) |
|
| 328 | 328 | { |
| 329 | 329 | //_debug_array(array('Typefilter:'=> $content['nm']['col_filter']['tid'],'Available Types:'=>$availabletypes,'action:'=>'remove invalid filter')); |
| 330 | 330 | unset($content['nm']['col_filter']['tid']); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | if (!isset($content['nm']['col_filter']['tid'])) $content['nm']['col_filter']['tid'] = $availabletypes[0]; |
| 333 | 333 | if (count($this->content_types) > 1) |
| 334 | 334 | { |
| 335 | - foreach($this->content_types as $tid => $data) |
|
| 335 | + foreach ($this->content_types as $tid => $data) |
|
| 336 | 336 | { |
| 337 | 337 | $sel_options['tid'][$tid] = $data['name']; |
| 338 | 338 | } |
@@ -350,20 +350,20 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $content['nm']['actions'] = $this->get_actions($content['nm']['col_filter']['tid']); |
| 352 | 352 | |
| 353 | - if (!isset($sel_options['grouped_view'][(string) $content['nm']['grouped_view']])) |
|
| 353 | + if (!isset($sel_options['grouped_view'][(string)$content['nm']['grouped_view']])) |
|
| 354 | 354 | { |
| 355 | 355 | $sel_options['grouped_view'] += $this->_get_grouped_name((string)$content['nm']['grouped_view']); |
| 356 | 356 | } |
| 357 | 357 | // unset the filters regarding grouped views, when there is no group selected |
| 358 | - if (empty($sel_options['grouped_view'][(string) $content['nm']['grouped_view']]) || stripos($grouped_view,":") === false ) |
|
| 358 | + if (empty($sel_options['grouped_view'][(string)$content['nm']['grouped_view']]) || stripos($grouped_view, ":") === false) |
|
| 359 | 359 | { |
| 360 | 360 | $this->unset_grouped_filters($content['nm']); |
| 361 | 361 | } |
| 362 | - $content['nm']['grouped_view_label'] = $sel_options['grouped_view'][(string) $content['nm']['grouped_view']]; |
|
| 362 | + $content['nm']['grouped_view_label'] = $sel_options['grouped_view'][(string)$content['nm']['grouped_view']]; |
|
| 363 | 363 | |
| 364 | 364 | $this->tmpl->read($do_email ? 'addressbook.email' : 'addressbook.index'); |
| 365 | 365 | return $this->tmpl->exec($do_email ? 'addressbook.addressbook_ui.emailpopup' : 'addressbook.addressbook_ui.index', |
| 366 | - $content,$sel_options,array(),$preserv,$do_email ? 2 : 0); |
|
| 366 | + $content, $sel_options, array(), $preserv, $do_email ? 2 : 0); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @param string $tid_filter =null |
| 373 | 373 | * @return array see Etemplate\Widget\Nextmatch::get_actions() |
| 374 | 374 | */ |
| 375 | - public function get_actions($tid_filter=null) |
|
| 375 | + public function get_actions($tid_filter = null) |
|
| 376 | 376 | { |
| 377 | 377 | // Contact view |
| 378 | 378 | $actions = array( |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | 'caption' => 'CRM-View', |
| 381 | 381 | 'default' => $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list'] != '~edit~', |
| 382 | 382 | 'allowOnMultiple' => false, |
| 383 | - 'group' => $group=1, |
|
| 383 | + 'group' => $group = 1, |
|
| 384 | 384 | 'onExecute' => 'javaScript:app.addressbook.view', |
| 385 | 385 | 'enableClass' => 'contact_contact', |
| 386 | 386 | 'hideOnDisabled' => true, |
@@ -423,14 +423,14 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | // CRM view options |
| 425 | 425 | $crm_count = 0; |
| 426 | - $crm_apps = array('infolog','tracker'); |
|
| 427 | - foreach($crm_apps as $app) |
|
| 426 | + $crm_apps = array('infolog', 'tracker'); |
|
| 427 | + foreach ($crm_apps as $app) |
|
| 428 | 428 | { |
| 429 | 429 | if ($GLOBALS['egw_info']['user']['apps'][$app]) $crm_count++; |
| 430 | 430 | } |
| 431 | - if($crm_count > 1) |
|
| 431 | + if ($crm_count > 1) |
|
| 432 | 432 | { |
| 433 | - foreach($crm_apps as $app) |
|
| 433 | + foreach ($crm_apps as $app) |
|
| 434 | 434 | { |
| 435 | 435 | $actions['view']['children']["view-$app"] = array( |
| 436 | 436 | 'caption' => $app, |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | 'caption' => 'View', |
| 446 | 446 | 'default' => true, |
| 447 | 447 | 'allowOnMultiple' => false, |
| 448 | - 'group' => $group=1, |
|
| 448 | + 'group' => $group = 1, |
|
| 449 | 449 | 'enableClass' => 'contact_organisation', |
| 450 | 450 | 'hideOnDisabled' => true |
| 451 | 451 | ), |
@@ -466,29 +466,29 @@ discard block |
||
| 466 | 466 | 'caption' => 'View', |
| 467 | 467 | 'default' => true, |
| 468 | 468 | 'allowOnMultiple' => false, |
| 469 | - 'group' => $group=1, |
|
| 469 | + 'group' => $group = 1, |
|
| 470 | 470 | 'enableClass' => 'contact_duplicate', |
| 471 | 471 | 'hideOnDisabled' => true |
| 472 | 472 | ) |
| 473 | 473 | ); |
| 474 | 474 | |
| 475 | - ++$group; // other AB related stuff group: lists, AB's, categories |
|
| 475 | + ++$group; // other AB related stuff group: lists, AB's, categories |
|
| 476 | 476 | // categories submenu |
| 477 | 477 | $actions['cat'] = array( |
| 478 | 478 | 'caption' => 'Categories', |
| 479 | 479 | 'group' => $group, |
| 480 | 480 | 'children' => array( |
| 481 | 481 | 'cat_add' => Etemplate\Widget\Nextmatch::category_action( |
| 482 | - 'addressbook',$group,'Add category', 'cat_add_', |
|
| 483 | - true, 0,Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH,false |
|
| 484 | - )+array( |
|
| 482 | + 'addressbook', $group, 'Add category', 'cat_add_', |
|
| 483 | + true, 0, Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH, false |
|
| 484 | + ) + array( |
|
| 485 | 485 | 'icon' => 'foldertree_nolines_plus', |
| 486 | 486 | 'disableClass' => 'rowNoEdit', |
| 487 | 487 | ), |
| 488 | 488 | 'cat_del' => Etemplate\Widget\Nextmatch::category_action( |
| 489 | - 'addressbook',$group,'Delete category', 'cat_del_', |
|
| 490 | - true, 0,Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH,false |
|
| 491 | - )+array( |
|
| 489 | + 'addressbook', $group, 'Delete category', 'cat_del_', |
|
| 490 | + true, 0, Etemplate\Widget\Nextmatch::DEFAULT_MAX_MENU_LENGTH, false |
|
| 491 | + ) + array( |
|
| 492 | 492 | 'icon' => 'foldertree_nolines_minus', |
| 493 | 493 | 'disableClass' => 'rowNoEdit', |
| 494 | 494 | ), |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | 'children' => $add_lists, |
| 516 | 516 | 'prefix' => 'to_list_', |
| 517 | 517 | 'icon' => 'foldertree_nolines_plus', |
| 518 | - 'enabled' => ($add_lists?true:false), // if there are editable lists, allow to add a contact to one of them, |
|
| 518 | + 'enabled' => ($add_lists ?true:false), // if there are editable lists, allow to add a contact to one of them, |
|
| 519 | 519 | //'disableClass' => 'rowNoEdit', // wether you are allowed to edit the contact or not, as you alter a list, not the contact |
| 520 | 520 | ), |
| 521 | 521 | 'remove_from_list' => array( |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | 'icon' => 'foldertree_nolines_minus', |
| 525 | 525 | 'enabled' => 'javaScript:app.addressbook.nm_compare_field', |
| 526 | 526 | 'fieldId' => 'exec[nm][filter2]', |
| 527 | - 'fieldValue' => '!', // enable if list != '' |
|
| 527 | + 'fieldValue' => '!', // enable if list != '' |
|
| 528 | 528 | ), |
| 529 | 529 | 'rename_list' => array( |
| 530 | 530 | 'caption' => 'Rename selected distribution list', |
| 531 | 531 | 'icon' => 'edit', |
| 532 | 532 | 'enabled' => 'javaScript:app.addressbook.nm_compare_field', |
| 533 | 533 | 'fieldId' => 'exec[nm][filter2]', |
| 534 | - 'fieldValue' => '!', // enable if list != '' |
|
| 534 | + 'fieldValue' => '!', // enable if list != '' |
|
| 535 | 535 | 'onExecute' => 'javaScript:app.addressbook.rename_list' |
| 536 | 536 | ), |
| 537 | 537 | 'delete_list' => array( |
@@ -540,10 +540,10 @@ discard block |
||
| 540 | 540 | 'icon' => 'delete', |
| 541 | 541 | 'enabled' => 'javaScript:app.addressbook.nm_compare_field', |
| 542 | 542 | 'fieldId' => 'exec[nm][filter2]', |
| 543 | - 'fieldValue' => '!', // enable if list != '' |
|
| 543 | + 'fieldValue' => '!', // enable if list != '' |
|
| 544 | 544 | ), |
| 545 | 545 | ); |
| 546 | - if(is_subclass_of('etemplate', 'etemplate_new')) |
|
| 546 | + if (is_subclass_of('etemplate', 'etemplate_new')) |
|
| 547 | 547 | { |
| 548 | 548 | $actions['lists']['children']['remove_from_list']['fieldId'] = 'filter2'; |
| 549 | 549 | $actions['lists']['children']['rename_list']['fieldId'] = 'filter2'; |
@@ -553,18 +553,18 @@ discard block |
||
| 553 | 553 | // move to AB |
| 554 | 554 | if (($move2addressbooks = $this->get_addressbooks(Acl::ADD))) // do we have addressbooks, we should |
| 555 | 555 | { |
| 556 | - unset($move2addressbooks[0]); // do not offer action to move contact to an account, as we dont support that currrently |
|
| 557 | - foreach($move2addressbooks as $owner => $label) |
|
| 556 | + unset($move2addressbooks[0]); // do not offer action to move contact to an account, as we dont support that currrently |
|
| 557 | + foreach ($move2addressbooks as $owner => $label) |
|
| 558 | 558 | { |
| 559 | 559 | $icon = $type_label = null; |
| 560 | - $this->type_icon((int)$owner, substr($owner,-1) == 'p', 'n', $icon, $type_label); |
|
| 560 | + $this->type_icon((int)$owner, substr($owner, -1) == 'p', 'n', $icon, $type_label); |
|
| 561 | 561 | $move2addressbooks[$owner] = array( |
| 562 | 562 | 'icon' => $icon, |
| 563 | 563 | 'caption' => $label, |
| 564 | 564 | ); |
| 565 | 565 | } |
| 566 | 566 | // copy checkbox |
| 567 | - $move2addressbooks= array( |
|
| 567 | + $move2addressbooks = array( |
|
| 568 | 568 | 'copy' =>array( |
| 569 | 569 | 'id' => 'move_to_copy', |
| 570 | 570 | 'caption' => 'Copy instead of move', |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | 'hideOnDisabled' => true |
| 598 | 598 | ); |
| 599 | 599 | |
| 600 | - ++$group; // integration with other apps: infolog, calendar, filemanager |
|
| 600 | + ++$group; // integration with other apps: infolog, calendar, filemanager |
|
| 601 | 601 | if ($GLOBALS['egw_info']['user']['apps']['infolog']) |
| 602 | 602 | { |
| 603 | 603 | $actions['infolog_app'] = array( |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | 'icon' => 'new', |
| 619 | 619 | 'url' => 'menuaction=infolog.infolog_ui.edit&type=task&action=addressbook&action_id=$id', |
| 620 | 620 | 'popup' => Link::get_registry('infolog', 'add_popup'), |
| 621 | - 'onExecute' => 'javaScript:app.addressbook.add_task', // call server for org-view only |
|
| 621 | + 'onExecute' => 'javaScript:app.addressbook.add_task', // call server for org-view only |
|
| 622 | 622 | ), |
| 623 | 623 | ), |
| 624 | 624 | 'hideOnMobile' => true |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | 'caption' => 'Show', |
| 637 | 637 | 'icon' => 'view', |
| 638 | 638 | 'onExecute' => 'javaScript:app.addressbook.view_calendar', |
| 639 | - 'targetapp' => 'calendar', // open in calendar tab, |
|
| 639 | + 'targetapp' => 'calendar', // open in calendar tab, |
|
| 640 | 640 | 'hideOnDisabled' => true, |
| 641 | 641 | ), |
| 642 | 642 | 'calendar_add' => array( |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | 'icon' => 'map', |
| 717 | 717 | 'group' => ++$group, |
| 718 | 718 | 'enableClass' => 'contact_contact', |
| 719 | - 'children' => array ( |
|
| 719 | + 'children' => array( |
|
| 720 | 720 | 'private' => array( |
| 721 | 721 | 'caption' => 'Private Address', |
| 722 | 722 | 'enabled' => 'javaScript:app.addressbook.geoLocation_enabled', |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | ); |
| 734 | 734 | // check if user is an admin or the export is not generally turned off (contact_export_limit is non-numerical, eg. no) |
| 735 | 735 | $exception = Api\Storage\Merge::is_export_limit_excepted(); |
| 736 | - if ((isset($GLOBALS['egw_info']['user']['apps']['admin']) || $exception) || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit']) |
|
| 736 | + if ((isset($GLOBALS['egw_info']['user']['apps']['admin']) || $exception) || !$this->config['contact_export_limit'] || (int)$this->config['contact_export_limit']) |
|
| 737 | 737 | { |
| 738 | 738 | $actions['export'] = array( |
| 739 | 739 | 'caption' => 'Export', |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | ), |
| 750 | 750 | 'vcard' => array( |
| 751 | 751 | 'caption' => 'Export as VCard', |
| 752 | - 'postSubmit' => true, // download needs post submit (not Ajax) to work |
|
| 752 | + 'postSubmit' => true, // download needs post submit (not Ajax) to work |
|
| 753 | 753 | 'icon' => Vfs::mime_icon('text/vcard'), |
| 754 | 754 | ), |
| 755 | 755 | ), |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | $this->prefs['document_dir'], $group, 'Insert in document', 'document_', |
| 762 | 762 | $this->prefs['default_document'], $this->config['contact_export_limit'] |
| 763 | 763 | ); |
| 764 | - if (isset($GLOBALS['egw_info']['apps']['stylite']) && ($GLOBALS['egw_info']['user']['apps']['felamimail']||$GLOBALS['egw_info']['user']['apps']['mail'])) |
|
| 764 | + if (isset($GLOBALS['egw_info']['apps']['stylite']) && ($GLOBALS['egw_info']['user']['apps']['felamimail'] || $GLOBALS['egw_info']['user']['apps']['mail'])) |
|
| 765 | 765 | { |
| 766 | 766 | $actions['mail'] = array( |
| 767 | 767 | 'caption' => lang('Mail VCard'), |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | 'disableClass' => 'rowNoDelete', |
| 785 | 785 | ); |
| 786 | 786 | } |
| 787 | - if ($this->grants[0] & Acl::DELETE) |
|
| 787 | + if ($this->grants[0]&Acl::DELETE) |
|
| 788 | 788 | { |
| 789 | 789 | $actions['delete_account'] = array( |
| 790 | 790 | 'caption' => 'Delete', |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | ); |
| 798 | 798 | $actions['delete']['hideOnDisabled'] = true; |
| 799 | 799 | } |
| 800 | - if($tid_filter == 'D') |
|
| 800 | + if ($tid_filter == 'D') |
|
| 801 | 801 | { |
| 802 | 802 | $actions['undelete'] = array( |
| 803 | 803 | 'caption' => 'Un-delete', |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | if (isset($actions['export']['children']['csv']) && |
| 810 | 810 | (!isset($GLOBALS['egw_info']['user']['apps']['importexport']) || |
| 811 | - !importexport_helper_functions::has_definitions('addressbook','export'))) |
|
| 811 | + !importexport_helper_functions::has_definitions('addressbook', 'export'))) |
|
| 812 | 812 | { |
| 813 | 813 | unset($actions['export']['children']['csv']); |
| 814 | 814 | } |
@@ -843,13 +843,13 @@ discard block |
||
| 843 | 843 | protected function _get_grouped_name($view_id) |
| 844 | 844 | { |
| 845 | 845 | $group_name = array(); |
| 846 | - if (strpos($view_id,'*AND*')!== false) $view_id = str_replace('*AND*','&',$view_id); |
|
| 847 | - foreach(explode('|||',$view_id) as $part) |
|
| 846 | + if (strpos($view_id, '*AND*') !== false) $view_id = str_replace('*AND*', '&', $view_id); |
|
| 847 | + foreach (explode('|||', $view_id) as $part) |
|
| 848 | 848 | { |
| 849 | - list(,$name) = explode(':',$part,2); |
|
| 849 | + list(,$name) = explode(':', $part, 2); |
|
| 850 | 850 | if ($name) $group_name[] = $name; |
| 851 | 851 | } |
| 852 | - $name = implode(': ',$group_name); |
|
| 852 | + $name = implode(': ', $group_name); |
|
| 853 | 853 | return $name ? array($view_id => $name) : array(); |
| 854 | 854 | } |
| 855 | 855 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | unset($query['col_filter']['org_name']); |
| 864 | 864 | unset($query['col_filter']['org_unit']); |
| 865 | 865 | unset($query['col_filter']['adr_one_locality']); |
| 866 | - foreach(array_keys(static::$duplicate_fields) as $field) |
|
| 866 | + foreach (array_keys(static::$duplicate_fields) as $field) |
|
| 867 | 867 | { |
| 868 | 868 | unset($query['col_filter'][$field]); |
| 869 | 869 | } |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | // Query doesn't like empties |
| 882 | 882 | unset($query['col_filter']['parent_id']); |
| 883 | 883 | |
| 884 | - if($query['actions'] && $query['actions']['open']) |
|
| 884 | + if ($query['actions'] && $query['actions']['open']) |
|
| 885 | 885 | { |
| 886 | 886 | // Just switched from contact view, update actions |
| 887 | 887 | $query['actions'] = $this->get_actions($query['col_filter']['tid']); |
@@ -909,10 +909,10 @@ discard block |
||
| 909 | 909 | } |
| 910 | 910 | $query['org_view'] = $query['grouped_view']; |
| 911 | 911 | // switch the distribution list selection off for ldap |
| 912 | - if($this->contact_repository != 'sql') |
|
| 912 | + if ($this->contact_repository != 'sql') |
|
| 913 | 913 | { |
| 914 | 914 | $query['no_filter2'] = true; |
| 915 | - unset($query['col_filter']['list']); // does not work here |
|
| 915 | + unset($query['col_filter']['list']); // does not work here |
|
| 916 | 916 | } |
| 917 | 917 | else |
| 918 | 918 | { |
@@ -920,8 +920,8 @@ discard block |
||
| 920 | 920 | } |
| 921 | 921 | break; |
| 922 | 922 | case 'addressbook.index.duplicate_rows': |
| 923 | - $query['no_filter2'] = true; // switch the distribution list selection off |
|
| 924 | - unset($query['col_filter']['list']); // does not work for duplicates |
|
| 923 | + $query['no_filter2'] = true; // switch the distribution list selection off |
|
| 924 | + unset($query['col_filter']['list']); // does not work for duplicates |
|
| 925 | 925 | $rows = parent::duplicates($query); |
| 926 | 926 | break; |
| 927 | 927 | } |
@@ -943,12 +943,12 @@ discard block |
||
| 943 | 943 | * @param array $content =null submitted content |
| 944 | 944 | * @param string $msg =null message to show |
| 945 | 945 | */ |
| 946 | - function emailpopup($content=null,$msg=null) |
|
| 946 | + function emailpopup($content = null, $msg = null) |
|
| 947 | 947 | { |
| 948 | - if (strpos($GLOBALS['egw_info']['flags']['java_script'],'addEmail') === false) |
|
| 948 | + if (strpos($GLOBALS['egw_info']['flags']['java_script'], 'addEmail') === false) |
|
| 949 | 949 | { |
| 950 | 950 | $handler = 'opener.addEmail(to,email)'; |
| 951 | - $GLOBALS['egw_info']['flags']['java_script'].= " |
|
| 951 | + $GLOBALS['egw_info']['flags']['java_script'] .= " |
|
| 952 | 952 | <script> |
| 953 | 953 | window.egw_LAB.wait(function() { |
| 954 | 954 | window.focus(); |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | </script> |
| 979 | 979 | "; |
| 980 | 980 | } |
| 981 | - return $this->index($content,$msg,true); |
|
| 981 | + return $this->index($content, $msg, true); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /** |
@@ -992,19 +992,19 @@ discard block |
||
| 992 | 992 | { |
| 993 | 993 | $org_contacts = array(); |
| 994 | 994 | $query = !$_query ? Api\Cache::getSession('addressbook', 'index') : $_query; |
| 995 | - $query['num_rows'] = -1; // all |
|
| 996 | - if(!is_array($query['col_filter'])) $query['col_filter'] = array(); |
|
| 995 | + $query['num_rows'] = -1; // all |
|
| 996 | + if (!is_array($query['col_filter'])) $query['col_filter'] = array(); |
|
| 997 | 997 | |
| 998 | - if(!is_array($org)) $org = array($org); |
|
| 999 | - foreach($org as $org_name) |
|
| 998 | + if (!is_array($org)) $org = array($org); |
|
| 999 | + foreach ($org as $org_name) |
|
| 1000 | 1000 | { |
| 1001 | 1001 | $query['grouped_view'] = $org_name; |
| 1002 | 1002 | $checked = array(); |
| 1003 | 1003 | $readonlys = null; |
| 1004 | - $this->get_rows($query,$checked,$readonlys,true); // true = only return the id's |
|
| 1005 | - if($checked[0]) |
|
| 1004 | + $this->get_rows($query, $checked, $readonlys, true); // true = only return the id's |
|
| 1005 | + if ($checked[0]) |
|
| 1006 | 1006 | { |
| 1007 | - $org_contacts = array_merge($org_contacts,$checked); |
|
| 1007 | + $org_contacts = array_merge($org_contacts, $checked); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | } |
| 1010 | 1010 | Api\Json\Response::get()->data(array_unique($org_contacts)); |
@@ -1018,33 +1018,33 @@ discard block |
||
| 1018 | 1018 | function infolog_org_view($org) |
| 1019 | 1019 | { |
| 1020 | 1020 | $query = Api\Cache::getSession('addressbook', 'index'); |
| 1021 | - $query['num_rows'] = -1; // all |
|
| 1021 | + $query['num_rows'] = -1; // all |
|
| 1022 | 1022 | $query['grouped_view'] = $org; |
| 1023 | 1023 | $query['searchletter'] = ''; |
| 1024 | 1024 | $checked = $readonlys = null; |
| 1025 | - $this->get_rows($query,$checked,$readonlys,true); // true = only return the id's |
|
| 1025 | + $this->get_rows($query, $checked, $readonlys, true); // true = only return the id's |
|
| 1026 | 1026 | |
| 1027 | 1027 | if (count($checked) > 1) // use a nicely formatted org-name as title in infolog |
| 1028 | 1028 | { |
| 1029 | 1029 | $parts = array(); |
| 1030 | - if (strpos($org,'*AND*')!== false) $org = str_replace('*AND*','&',$org); |
|
| 1031 | - foreach(explode('|||',$org) as $part) |
|
| 1030 | + if (strpos($org, '*AND*') !== false) $org = str_replace('*AND*', '&', $org); |
|
| 1031 | + foreach (explode('|||', $org) as $part) |
|
| 1032 | 1032 | { |
| 1033 | - list(,$part) = explode(':',$part,2); |
|
| 1033 | + list(,$part) = explode(':', $part, 2); |
|
| 1034 | 1034 | if ($part) $parts[] = $part; |
| 1035 | 1035 | } |
| 1036 | - $org = implode(', ',$parts); |
|
| 1036 | + $org = implode(', ', $parts); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | else |
| 1039 | 1039 | { |
| 1040 | - $org = ''; // use infolog default of link-title |
|
| 1040 | + $org = ''; // use infolog default of link-title |
|
| 1041 | 1041 | } |
| 1042 | - Egw::redirect_link('/index.php',array( |
|
| 1042 | + Egw::redirect_link('/index.php', array( |
|
| 1043 | 1043 | 'menuaction' => 'infolog.infolog_ui.index', |
| 1044 | 1044 | 'action' => 'addressbook', |
| 1045 | - 'action_id' => implode(',',$checked), |
|
| 1045 | + 'action_id' => implode(',', $checked), |
|
| 1046 | 1046 | 'action_title' => $org, |
| 1047 | - ),'infolog'); |
|
| 1047 | + ), 'infolog'); |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | /** |
@@ -1069,31 +1069,31 @@ discard block |
||
| 1069 | 1069 | $owner = $this->default_addressbook; |
| 1070 | 1070 | } |
| 1071 | 1071 | // Check for valid list & permissions |
| 1072 | - if(!(int)$list_id && !$this->check_list(null,EGW_ACL_ADD|EGW_ACL_EDIT,$owner)) |
|
| 1072 | + if (!(int)$list_id && !$this->check_list(null, EGW_ACL_ADD|EGW_ACL_EDIT, $owner)) |
|
| 1073 | 1073 | { |
| 1074 | - Api\Json\Response::get()->apply('egw.message', array( lang('List creation failed, no rights!'),'error')); |
|
| 1074 | + Api\Json\Response::get()->apply('egw.message', array(lang('List creation failed, no rights!'), 'error')); |
|
| 1075 | 1075 | return; |
| 1076 | 1076 | } |
| 1077 | 1077 | if ((int)$list_id && !$this->check_list((int)$list_id, Acl::EDIT, $owner)) |
| 1078 | 1078 | { |
| 1079 | - Api\Json\Response::get()->apply('egw.message', array( lang('Insufficent rights to edit this list!'),'error')); |
|
| 1079 | + Api\Json\Response::get()->apply('egw.message', array(lang('Insufficent rights to edit this list!'), 'error')); |
|
| 1080 | 1080 | return; |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | $list = array('list_owner' => $owner); |
| 1084 | 1084 | |
| 1085 | 1085 | // Rename |
| 1086 | - if($list_id) |
|
| 1086 | + if ($list_id) |
|
| 1087 | 1087 | { |
| 1088 | 1088 | $list = $this->read_list((int)$list_id); |
| 1089 | 1089 | } |
| 1090 | 1090 | $list['list_name'] = $new_name; |
| 1091 | 1091 | |
| 1092 | - $new_id = $this->add_list(array('list_id' => (int)$list_id), $list['list_owner'],array(),$list); |
|
| 1092 | + $new_id = $this->add_list(array('list_id' => (int)$list_id), $list['list_owner'], array(), $list); |
|
| 1093 | 1093 | |
| 1094 | - if($contacts) |
|
| 1094 | + if ($contacts) |
|
| 1095 | 1095 | { |
| 1096 | - $this->add2list($contacts,$new_id); |
|
| 1096 | + $this->add2list($contacts, $new_id); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | Api\Json\Response::get()->apply('egw.message', array( |
| 1099 | 1099 | $new_id == $list_id ? lang('Distribution list renamed') : lang('List created'), |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | * |
| 1109 | 1109 | * @param string $account_id |
| 1110 | 1110 | */ |
| 1111 | - function ajax_get_contact ($account_id) |
|
| 1111 | + function ajax_get_contact($account_id) |
|
| 1112 | 1112 | { |
| 1113 | 1113 | $bo = new Api\Contacts(); |
| 1114 | 1114 | $contact = $bo->read('account:'.$account_id); |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | { |
| 1126 | 1126 | $query = Api\Cache::getSession('addressbook', 'index'); |
| 1127 | 1127 | unset($query['advanced_search']); |
| 1128 | - Api\Cache::setSession('addressbook','index',$query); |
|
| 1128 | + Api\Cache::setSession('addressbook', 'index', $query); |
|
| 1129 | 1129 | Api\Cache::setSession('addressbook', 'advanced_search', false); |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1141,60 +1141,60 @@ discard block |
||
| 1141 | 1141 | * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
| 1142 | 1142 | * @return boolean true if all actions succeded, false otherwise |
| 1143 | 1143 | */ |
| 1144 | - function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg, $checkboxes = NULL) |
|
| 1144 | + function action($action, $checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg, $checkboxes = NULL) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | //echo "<p>uicontacts::action('$action',".print_r($checked,true).','.(int)$use_all.",...)</p>\n"; |
| 1147 | 1147 | $success = $failed = 0; |
| 1148 | - if ($use_all || in_array($action,array('remove_from_list','delete_list'))) |
|
| 1148 | + if ($use_all || in_array($action, array('remove_from_list', 'delete_list'))) |
|
| 1149 | 1149 | { |
| 1150 | 1150 | // get the whole selection |
| 1151 | 1151 | $query = is_array($session_name) ? $session_name : Api\Cache::getSession('addressbook', $session_name); |
| 1152 | 1152 | |
| 1153 | 1153 | if ($use_all) |
| 1154 | 1154 | { |
| 1155 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 1156 | - $query['num_rows'] = -1; // all |
|
| 1155 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 1156 | + $query['num_rows'] = -1; // all |
|
| 1157 | 1157 | $readonlys = null; |
| 1158 | - $this->get_rows($query,$checked,$readonlys,true); // true = only return the id's |
|
| 1158 | + $this->get_rows($query, $checked, $readonlys, true); // true = only return the id's |
|
| 1159 | 1159 | } |
| 1160 | 1160 | } |
| 1161 | 1161 | // replace org_name:* id's with all id's of that org |
| 1162 | - $grouped_contacts = $this->find_grouped_ids($action, $checked, $use_all, $success,$failed,$action_msg,$session_name, $msg); |
|
| 1163 | - if ($grouped_contacts) $checked = array_unique($checked ? array_merge($checked,$grouped_contacts) : $grouped_contacts); |
|
| 1162 | + $grouped_contacts = $this->find_grouped_ids($action, $checked, $use_all, $success, $failed, $action_msg, $session_name, $msg); |
|
| 1163 | + if ($grouped_contacts) $checked = array_unique($checked ? array_merge($checked, $grouped_contacts) : $grouped_contacts); |
|
| 1164 | 1164 | //_debug_array($checked); exit; |
| 1165 | 1165 | |
| 1166 | - if (substr($action,0,8) == 'move_to_') |
|
| 1166 | + if (substr($action, 0, 8) == 'move_to_') |
|
| 1167 | 1167 | { |
| 1168 | - $action = (int)substr($action,8).(substr($action,-1) == 'p' ? 'p' : ''); |
|
| 1168 | + $action = (int)substr($action, 8).(substr($action, -1) == 'p' ? 'p' : ''); |
|
| 1169 | 1169 | } |
| 1170 | - elseif (substr($action,0,8) == 'to_list_') |
|
| 1170 | + elseif (substr($action, 0, 8) == 'to_list_') |
|
| 1171 | 1171 | { |
| 1172 | - $to_list = (int)substr($action,8); |
|
| 1172 | + $to_list = (int)substr($action, 8); |
|
| 1173 | 1173 | $action = 'to_list'; |
| 1174 | 1174 | } |
| 1175 | - elseif (substr($action,0,9) == 'document_') |
|
| 1175 | + elseif (substr($action, 0, 9) == 'document_') |
|
| 1176 | 1176 | { |
| 1177 | - $document = substr($action,9); |
|
| 1177 | + $document = substr($action, 9); |
|
| 1178 | 1178 | $action = 'document'; |
| 1179 | 1179 | } |
| 1180 | - elseif(substr($action,0,4) == 'cat_') // cat_add_123 or cat_del_456 |
|
| 1180 | + elseif (substr($action, 0, 4) == 'cat_') // cat_add_123 or cat_del_456 |
|
| 1181 | 1181 | { |
| 1182 | 1182 | $cat_id = (int)substr($action, 8); |
| 1183 | - $action = substr($action,0,7); |
|
| 1183 | + $action = substr($action, 0, 7); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | // Security: stop non-admins to export more then the configured number of contacts |
| 1186 | - if (in_array($action,array('csv','vcard')) && $this->config['contact_export_limit'] && !Api\Storage\Merge::is_export_limit_excepted() && |
|
| 1186 | + if (in_array($action, array('csv', 'vcard')) && $this->config['contact_export_limit'] && !Api\Storage\Merge::is_export_limit_excepted() && |
|
| 1187 | 1187 | (!is_numeric($this->config['contact_export_limit']) || count($checked) > $this->config['contact_export_limit'])) |
| 1188 | 1188 | { |
| 1189 | 1189 | $action_msg = lang('exported'); |
| 1190 | 1190 | $failed = count($checked); |
| 1191 | 1191 | return false; |
| 1192 | 1192 | } |
| 1193 | - switch($action) |
|
| 1193 | + switch ($action) |
|
| 1194 | 1194 | { |
| 1195 | 1195 | case 'vcard': |
| 1196 | 1196 | $action_msg = lang('exported'); |
| 1197 | - $vcard = new addressbook_vcal('addressbook','text/vcard'); |
|
| 1197 | + $vcard = new addressbook_vcal('addressbook', 'text/vcard'); |
|
| 1198 | 1198 | $vcard->export($checked); |
| 1199 | 1199 | // does not return! |
| 1200 | 1200 | $Ok = false; |
@@ -1202,10 +1202,10 @@ discard block |
||
| 1202 | 1202 | |
| 1203 | 1203 | case 'merge': |
| 1204 | 1204 | $error_msg = null; |
| 1205 | - $success = $this->merge($checked,$error_msg); |
|
| 1205 | + $success = $this->merge($checked, $error_msg); |
|
| 1206 | 1206 | $failed = count($checked) - (int)$success; |
| 1207 | 1207 | $action_msg = lang('merged'); |
| 1208 | - $checked = array(); // to not start the single actions |
|
| 1208 | + $checked = array(); // to not start the single actions |
|
| 1209 | 1209 | break; |
| 1210 | 1210 | |
| 1211 | 1211 | case 'delete_list': |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | { |
| 1214 | 1214 | $msg = lang('You need to select a distribution list'); |
| 1215 | 1215 | } |
| 1216 | - elseif($this->delete_list($query['filter2']) === false) |
|
| 1216 | + elseif ($this->delete_list($query['filter2']) === false) |
|
| 1217 | 1217 | { |
| 1218 | 1218 | $msg = lang('Insufficent rights to delete this list!'); |
| 1219 | 1219 | } |
@@ -1233,49 +1233,49 @@ discard block |
||
| 1233 | 1233 | return false; |
| 1234 | 1234 | |
| 1235 | 1235 | case 'infolog_add': |
| 1236 | - Framework::popup(Egw::link('/index.php',array( |
|
| 1236 | + Framework::popup(Egw::link('/index.php', array( |
|
| 1237 | 1237 | 'menuaction' => 'infolog.infolog_ui.edit', |
| 1238 | 1238 | 'type' => 'task', |
| 1239 | 1239 | 'action' => 'addressbook', |
| 1240 | - 'action_id' => implode(',',$checked), |
|
| 1241 | - )),'_blank',Link::get_registry('infolog', 'add_popup')); |
|
| 1242 | - $msg = ''; // no message, as we send none in javascript too and users sees opening popup |
|
| 1240 | + 'action_id' => implode(',', $checked), |
|
| 1241 | + )), '_blank', Link::get_registry('infolog', 'add_popup')); |
|
| 1242 | + $msg = ''; // no message, as we send none in javascript too and users sees opening popup |
|
| 1243 | 1243 | return false; |
| 1244 | 1244 | |
| 1245 | 1245 | case 'calendar_add': // add appointment for org-views, other views are handled directly in javascript |
| 1246 | - Framework::popup(Egw::link('/index.php',array( |
|
| 1246 | + Framework::popup(Egw::link('/index.php', array( |
|
| 1247 | 1247 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
| 1248 | - 'participants' => 'c'.implode(',c',$checked), |
|
| 1249 | - )),'_blank',Link::get_registry('calendar', 'add_popup')); |
|
| 1250 | - $msg = ''; // no message, as we send none in javascript too and users sees opening popup |
|
| 1248 | + 'participants' => 'c'.implode(',c', $checked), |
|
| 1249 | + )), '_blank', Link::get_registry('calendar', 'add_popup')); |
|
| 1250 | + $msg = ''; // no message, as we send none in javascript too and users sees opening popup |
|
| 1251 | 1251 | return false; |
| 1252 | 1252 | |
| 1253 | 1253 | case 'calendar_view': // show calendar for org-views, although all views are handled directly in javascript |
| 1254 | - Egw::redirect_link('/index.php',array( |
|
| 1254 | + Egw::redirect_link('/index.php', array( |
|
| 1255 | 1255 | 'menuaction' => 'calendar.calendar_uiviews.index', |
| 1256 | - 'owner' => 'c'.implode(',c',$checked), |
|
| 1256 | + 'owner' => 'c'.implode(',c', $checked), |
|
| 1257 | 1257 | )); |
| 1258 | 1258 | } |
| 1259 | - foreach($checked as $id) |
|
| 1259 | + foreach ($checked as $id) |
|
| 1260 | 1260 | { |
| 1261 | - switch($action) |
|
| 1261 | + switch ($action) |
|
| 1262 | 1262 | { |
| 1263 | 1263 | case 'cat_add': |
| 1264 | 1264 | case 'cat_del': |
| 1265 | - if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::EDIT,$contact))) |
|
| 1265 | + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::EDIT, $contact))) |
|
| 1266 | 1266 | { |
| 1267 | 1267 | $action_msg = $action == 'cat_add' ? lang('categorie added') : lang('categorie delete'); |
| 1268 | - $cat_ids = $contact['cat_id'] ? explode(',', $contact['cat_id']) : array(); //existing Api\Categories |
|
| 1268 | + $cat_ids = $contact['cat_id'] ? explode(',', $contact['cat_id']) : array(); //existing Api\Categories |
|
| 1269 | 1269 | if ($action == 'cat_add') |
| 1270 | 1270 | { |
| 1271 | 1271 | $cat_ids[] = $cat_id; |
| 1272 | 1272 | $cat_ids = array_unique($cat_ids); |
| 1273 | 1273 | } |
| 1274 | - elseif ((($key = array_search($cat_id,$cat_ids))) !== false) |
|
| 1274 | + elseif ((($key = array_search($cat_id, $cat_ids))) !== false) |
|
| 1275 | 1275 | { |
| 1276 | 1276 | unset($cat_ids[$key]); |
| 1277 | 1277 | } |
| 1278 | - $ids = $cat_ids ? implode(',',$cat_ids) : null; |
|
| 1278 | + $ids = $cat_ids ? implode(',', $cat_ids) : null; |
|
| 1279 | 1279 | if ($ids !== $contact['cat_id']) |
| 1280 | 1280 | { |
| 1281 | 1281 | $contact['cat_id'] = $ids; |
@@ -1286,10 +1286,10 @@ discard block |
||
| 1286 | 1286 | |
| 1287 | 1287 | case 'delete': |
| 1288 | 1288 | $action_msg = lang('deleted'); |
| 1289 | - if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::DELETE,$contact))) |
|
| 1289 | + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::DELETE, $contact))) |
|
| 1290 | 1290 | { |
| 1291 | - if ($contact['owner'] || // regular contact or |
|
| 1292 | - empty($contact['account_id']) || // accounts without account_id |
|
| 1291 | + if ($contact['owner'] || // regular contact or |
|
| 1292 | + empty($contact['account_id']) || // accounts without account_id |
|
| 1293 | 1293 | // already deleted account (should no longer happen, but needed to allow for cleanup) |
| 1294 | 1294 | $contact['tid'] == self::DELETED_TYPE) |
| 1295 | 1295 | { |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | // delete single account --> redirect to admin |
| 1299 | 1299 | elseif (count($checked) == 1 && $contact['account_id']) |
| 1300 | 1300 | { |
| 1301 | - Egw::redirect_link('/index.php',array( |
|
| 1301 | + Egw::redirect_link('/index.php', array( |
|
| 1302 | 1302 | 'menuaction' => 'admin.admin_account.delete', |
| 1303 | 1303 | 'account_id' => $contact['account_id'], |
| 1304 | 1304 | )); |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | } |
| 1361 | 1361 | else |
| 1362 | 1362 | { |
| 1363 | - $Ok = $this->remove_from_list($id,$query['filter2']) !== false; |
|
| 1363 | + $Ok = $this->remove_from_list($id, $query['filter2']) !== false; |
|
| 1364 | 1364 | } |
| 1365 | 1365 | break; |
| 1366 | 1366 | |
@@ -1373,28 +1373,28 @@ discard block |
||
| 1373 | 1373 | } |
| 1374 | 1374 | else |
| 1375 | 1375 | { |
| 1376 | - $Ok = $this->add2list($id,$to_list) !== false; |
|
| 1376 | + $Ok = $this->add2list($id, $to_list) !== false; |
|
| 1377 | 1377 | } |
| 1378 | 1378 | break; |
| 1379 | 1379 | |
| 1380 | 1380 | default: // move to an other addressbook |
| 1381 | - if (!(int)$action || !($this->grants[(string) (int) $action] & Acl::EDIT)) // might be ADD in the future |
|
| 1381 | + if (!(int)$action || !($this->grants[(string)(int)$action]&Acl::EDIT)) // might be ADD in the future |
|
| 1382 | 1382 | { |
| 1383 | 1383 | return false; |
| 1384 | 1384 | } |
| 1385 | 1385 | if (!$checkboxes['move_to_copy']) |
| 1386 | 1386 | { |
| 1387 | 1387 | $action_msg = lang('moved'); |
| 1388 | - if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::DELETE,$contact))) |
|
| 1388 | + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::DELETE, $contact))) |
|
| 1389 | 1389 | { |
| 1390 | 1390 | if (!$contact['owner']) // no (mass-)move of Api\Accounts |
| 1391 | 1391 | { |
| 1392 | 1392 | $Ok = false; |
| 1393 | 1393 | } |
| 1394 | - elseif ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action,-1) == 'p')) |
|
| 1394 | + elseif ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action, -1) == 'p')) |
|
| 1395 | 1395 | { |
| 1396 | - $contact['owner'] = (int) $action; |
|
| 1397 | - $contact['private'] = (int)(substr($action,-1) == 'p'); |
|
| 1396 | + $contact['owner'] = (int)$action; |
|
| 1397 | + $contact['private'] = (int)(substr($action, -1) == 'p'); |
|
| 1398 | 1398 | $Ok = $this->save($contact); |
| 1399 | 1399 | } |
| 1400 | 1400 | } |
@@ -1402,14 +1402,14 @@ discard block |
||
| 1402 | 1402 | else |
| 1403 | 1403 | { |
| 1404 | 1404 | $action_msg = lang('copied'); |
| 1405 | - if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::READ,$contact))) |
|
| 1405 | + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(Acl::READ, $contact))) |
|
| 1406 | 1406 | { |
| 1407 | - if ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action,-1) == 'p')) |
|
| 1407 | + if ($contact['owner'] != (int)$action || $contact['private'] != (int)(substr($action, -1) == 'p')) |
|
| 1408 | 1408 | { |
| 1409 | - $this->copy_contact($contact, false); // do NOT use self::$copy_fields, copy everything but uid etc. |
|
| 1409 | + $this->copy_contact($contact, false); // do NOT use self::$copy_fields, copy everything but uid etc. |
|
| 1410 | 1410 | $links = $contact['link_to']['to_id']; |
| 1411 | - $contact['owner'] = (int) $action; |
|
| 1412 | - $contact['private'] = (int)(substr($action,-1) == 'p'); |
|
| 1411 | + $contact['owner'] = (int)$action; |
|
| 1412 | + $contact['private'] = (int)(substr($action, -1) == 'p'); |
|
| 1413 | 1413 | $Ok = $this->save($contact); |
| 1414 | 1414 | if ($Ok && is_array($links)) |
| 1415 | 1415 | { |
@@ -1448,38 +1448,38 @@ discard block |
||
| 1448 | 1448 | * |
| 1449 | 1449 | * @return array List of contact IDs in the provided groups |
| 1450 | 1450 | */ |
| 1451 | - protected function find_grouped_ids($action,&$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
|
| 1451 | + protected function find_grouped_ids($action, &$checked, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg) |
|
| 1452 | 1452 | { |
| 1453 | 1453 | unset($use_all); |
| 1454 | 1454 | $grouped_contacts = array(); |
| 1455 | - foreach((array)$checked as $n => $id) |
|
| 1455 | + foreach ((array)$checked as $n => $id) |
|
| 1456 | 1456 | { |
| 1457 | - if (substr($id,0,9) == 'org_name:' || substr($id, 0,10) == 'duplicate:') |
|
| 1457 | + if (substr($id, 0, 9) == 'org_name:' || substr($id, 0, 10) == 'duplicate:') |
|
| 1458 | 1458 | { |
| 1459 | 1459 | if (count($checked) == 1 && !count($grouped_contacts) && $action == 'infolog') |
| 1460 | 1460 | { |
| 1461 | - return $this->infolog_org_view($id); // uses the org-name, instead of 'selected contacts' |
|
| 1461 | + return $this->infolog_org_view($id); // uses the org-name, instead of 'selected contacts' |
|
| 1462 | 1462 | } |
| 1463 | 1463 | unset($checked[$n]); |
| 1464 | 1464 | $query = Api\Cache::getSession('addressbook', $session_name); |
| 1465 | - $query['num_rows'] = -1; // all |
|
| 1465 | + $query['num_rows'] = -1; // all |
|
| 1466 | 1466 | $query['grouped_view'] = $id; |
| 1467 | 1467 | unset($query['filter2']); |
| 1468 | 1468 | $extra = $readonlys = null; |
| 1469 | - $this->get_rows($query,$extra,$readonlys,true); // true = only return the id's |
|
| 1469 | + $this->get_rows($query, $extra, $readonlys, true); // true = only return the id's |
|
| 1470 | 1470 | |
| 1471 | 1471 | // Merge them here, so we only merge the ones that are duplicates, |
| 1472 | 1472 | // not merge all selected together |
| 1473 | - if($action == 'merge_duplicates') |
|
| 1473 | + if ($action == 'merge_duplicates') |
|
| 1474 | 1474 | { |
| 1475 | 1475 | $loop_success = $loop_fail = 0; |
| 1476 | - $this->action('merge', $extra, false, $loop_success, $loop_fail, $action_msg,$session_name,$msg); |
|
| 1476 | + $this->action('merge', $extra, false, $loop_success, $loop_fail, $action_msg, $session_name, $msg); |
|
| 1477 | 1477 | $success += $loop_success; |
| 1478 | 1478 | $failed += $loop_fail; |
| 1479 | 1479 | } |
| 1480 | 1480 | if ($extra[0]) |
| 1481 | 1481 | { |
| 1482 | - $grouped_contacts = array_merge($grouped_contacts,$extra); |
|
| 1482 | + $grouped_contacts = array_merge($grouped_contacts, $extra); |
|
| 1483 | 1483 | } |
| 1484 | 1484 | } |
| 1485 | 1485 | } |
@@ -1495,22 +1495,22 @@ discard block |
||
| 1495 | 1495 | * @param boolean $only_copy_fields =true true: only copy fields configured for copying (eg. no name), |
| 1496 | 1496 | * false: copy everything, but never to copy fields |
| 1497 | 1497 | */ |
| 1498 | - function copy_contact(array &$content, $only_copy_fields=true) |
|
| 1498 | + function copy_contact(array &$content, $only_copy_fields = true) |
|
| 1499 | 1499 | { |
| 1500 | 1500 | $content['link_to']['to_id'] = 0; |
| 1501 | - Link::link('addressbook',$content['link_to']['to_id'],'addressbook',$content['id'], |
|
| 1502 | - lang('Copied by %1, from record #%2.',Api\Accounts::format_username('', |
|
| 1503 | - $GLOBALS['egw_info']['user']['account_firstname'],$GLOBALS['egw_info']['user']['account_lastname']), |
|
| 1501 | + Link::link('addressbook', $content['link_to']['to_id'], 'addressbook', $content['id'], |
|
| 1502 | + lang('Copied by %1, from record #%2.', Api\Accounts::format_username('', |
|
| 1503 | + $GLOBALS['egw_info']['user']['account_firstname'], $GLOBALS['egw_info']['user']['account_lastname']), |
|
| 1504 | 1504 | $content['id'])); |
| 1505 | 1505 | // create a new contact with the content of the old |
| 1506 | - foreach(array_keys($content) as $key) |
|
| 1506 | + foreach (array_keys($content) as $key) |
|
| 1507 | 1507 | { |
| 1508 | - if($only_copy_fields && !in_array($key, self::$copy_fields) || in_array($key, array('id','etag','carddav_name','uid'))) |
|
| 1508 | + if ($only_copy_fields && !in_array($key, self::$copy_fields) || in_array($key, array('id', 'etag', 'carddav_name', 'uid'))) |
|
| 1509 | 1509 | { |
| 1510 | 1510 | unset($content[$key]); |
| 1511 | 1511 | } |
| 1512 | 1512 | } |
| 1513 | - if(!isset($content['owner'])) |
|
| 1513 | + if (!isset($content['owner'])) |
|
| 1514 | 1514 | { |
| 1515 | 1515 | $content['owner'] = $this->default_private ? $this->user.'p' : $this->default_addressbook; |
| 1516 | 1516 | } |
@@ -1528,7 +1528,7 @@ discard block |
||
| 1528 | 1528 | * @param boolean $id_only =false if true only return (via $rows) an array of contact-ids, dont save state to session |
| 1529 | 1529 | * @return int total number of contacts matching the selection |
| 1530 | 1530 | */ |
| 1531 | - function get_rows(&$query,&$rows,&$readonlys,$id_only=false) |
|
| 1531 | + function get_rows(&$query, &$rows, &$readonlys, $id_only = false) |
|
| 1532 | 1532 | { |
| 1533 | 1533 | $do_email = $query['do_email']; |
| 1534 | 1534 | $what = $query['sitemgr_display'] ? $query['sitemgr_display'] : ($do_email ? 'email' : 'index'); |
@@ -1537,7 +1537,7 @@ discard block |
||
| 1537 | 1537 | { |
| 1538 | 1538 | $store_query = $query; |
| 1539 | 1539 | // Do not store these |
| 1540 | - foreach(array('options-cat_id','actions','action_links','placeholder_actions') as $key) |
|
| 1540 | + foreach (array('options-cat_id', 'actions', 'action_links', 'placeholder_actions') as $key) |
|
| 1541 | 1541 | { |
| 1542 | 1542 | unset($store_query[$key]); |
| 1543 | 1543 | } |
@@ -1548,28 +1548,28 @@ discard block |
||
| 1548 | 1548 | { |
| 1549 | 1549 | $old_state = Api\Cache::getSession('addressbook', $what); |
| 1550 | 1550 | } |
| 1551 | - if (!isset($this->grouped_views[(string) $query['grouped_view']]) || strpos($query['grouped_view'],':') === false) |
|
| 1551 | + if (!isset($this->grouped_views[(string)$query['grouped_view']]) || strpos($query['grouped_view'], ':') === false) |
|
| 1552 | 1552 | { |
| 1553 | 1553 | // we don't have a grouped view, unset the according col_filters |
| 1554 | 1554 | $this->unset_grouped_filters($query); |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | - if (isset($this->grouped_views[(string) $query['grouped_view']])) |
|
| 1557 | + if (isset($this->grouped_views[(string)$query['grouped_view']])) |
|
| 1558 | 1558 | { |
| 1559 | 1559 | // we have a grouped view, reset the advanced search |
| 1560 | - if(!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search']; |
|
| 1560 | + if (!$query['search'] && $old_state['advanced_search']) $query['advanced_search'] = $old_state['advanced_search']; |
|
| 1561 | 1561 | } |
| 1562 | - elseif(!$query['search'] && array_key_exists('advanced_search',$old_state)) // eg. paging in an advanced search |
|
| 1562 | + elseif (!$query['search'] && array_key_exists('advanced_search', $old_state)) // eg. paging in an advanced search |
|
| 1563 | 1563 | { |
| 1564 | 1564 | $query['advanced_search'] = $old_state['advanced_search']; |
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | // Make sure old lettersearch filter doesn't stay - current letter filter will be added later |
| 1568 | - foreach($query['col_filter'] as $key => $col_filter) |
|
| 1568 | + foreach ($query['col_filter'] as $key => $col_filter) |
|
| 1569 | 1569 | { |
| 1570 | - if(!is_numeric($key)) continue; |
|
| 1571 | - if(preg_match('/'.$GLOBALS['egw']->db->capabilities['case_insensitive_like']. |
|
| 1572 | - ' '.$GLOBALS['egw']->db->quote('[a-z]%').'$/i',$col_filter) == 1 |
|
| 1570 | + if (!is_numeric($key)) continue; |
|
| 1571 | + if (preg_match('/'.$GLOBALS['egw']->db->capabilities['case_insensitive_like']. |
|
| 1572 | + ' '.$GLOBALS['egw']->db->quote('[a-z]%').'$/i', $col_filter) == 1 |
|
| 1573 | 1573 | ) |
| 1574 | 1574 | { |
| 1575 | 1575 | unset($query['col_filter'][$key]); |
@@ -1584,16 +1584,16 @@ discard block |
||
| 1584 | 1584 | { |
| 1585 | 1585 | if ($old_state['filter'] === '0') // user changed to org_view |
| 1586 | 1586 | { |
| 1587 | - $query['filter'] = ''; // --> change filter to all contacts |
|
| 1587 | + $query['filter'] = ''; // --> change filter to all contacts |
|
| 1588 | 1588 | } |
| 1589 | 1589 | else // user changed to accounts |
| 1590 | 1590 | { |
| 1591 | - $query['grouped_view'] = ''; // --> change to regular contacts view |
|
| 1591 | + $query['grouped_view'] = ''; // --> change to regular contacts view |
|
| 1592 | 1592 | } |
| 1593 | 1593 | } |
| 1594 | 1594 | if ($query['grouped_view'] && isset($this->grouped_views[$old_state['grouped_view']]) && !isset($this->grouped_views[$query['grouped_view']])) |
| 1595 | 1595 | { |
| 1596 | - $query['searchletter'] = ''; // reset lettersearch if viewing the contacts of one group (org or duplicates) |
|
| 1596 | + $query['searchletter'] = ''; // reset lettersearch if viewing the contacts of one group (org or duplicates) |
|
| 1597 | 1597 | } |
| 1598 | 1598 | // save the state of the index in the user prefs |
| 1599 | 1599 | $state = serialize(array( |
@@ -1606,9 +1606,9 @@ discard block |
||
| 1606 | 1606 | )); |
| 1607 | 1607 | if ($state != $this->prefs[$what.'_state'] && !$query['csv_export']) |
| 1608 | 1608 | { |
| 1609 | - $GLOBALS['egw']->preferences->add('addressbook',$what.'_state',$state); |
|
| 1609 | + $GLOBALS['egw']->preferences->add('addressbook', $what.'_state', $state); |
|
| 1610 | 1610 | // save prefs, but do NOT invalid the cache (unnecessary) |
| 1611 | - $GLOBALS['egw']->preferences->save_repository(false,'user',false); |
|
| 1611 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', false); |
|
| 1612 | 1612 | } |
| 1613 | 1613 | } |
| 1614 | 1614 | unset($old_state); |
@@ -1623,11 +1623,11 @@ discard block |
||
| 1623 | 1623 | } |
| 1624 | 1624 | if ($query['filter'] !== '') // not all addressbooks |
| 1625 | 1625 | { |
| 1626 | - $query['col_filter']['owner'] = (string) (int) $query['filter']; |
|
| 1626 | + $query['col_filter']['owner'] = (string)(int)$query['filter']; |
|
| 1627 | 1627 | |
| 1628 | 1628 | if ($this->private_addressbook) |
| 1629 | 1629 | { |
| 1630 | - $query['col_filter']['private'] = substr($query['filter'],-1) == 'p' ? 1 : 0; |
|
| 1630 | + $query['col_filter']['private'] = substr($query['filter'], -1) == 'p' ? 1 : 0; |
|
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | else |
@@ -1637,7 +1637,7 @@ discard block |
||
| 1637 | 1637 | } |
| 1638 | 1638 | if ((int)$query['filter2']) // not no distribution list |
| 1639 | 1639 | { |
| 1640 | - $query['col_filter']['list'] = (string) (int) $query['filter2']; |
|
| 1640 | + $query['col_filter']['list'] = (string)(int)$query['filter2']; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | else |
| 1643 | 1643 | { |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | $query['no_filter2'] = false; |
| 1657 | 1657 | |
| 1658 | 1658 | // Grouped view |
| 1659 | - if (isset($this->grouped_views[(string) $query['grouped_view']]) && !$query['col_filter']['parent_id']) |
|
| 1659 | + if (isset($this->grouped_views[(string)$query['grouped_view']]) && !$query['col_filter']['parent_id']) |
|
| 1660 | 1660 | { |
| 1661 | 1661 | $query['grouped_view_label'] = ''; |
| 1662 | 1662 | $rows = $this->get_grouped_rows($query); |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | { |
| 1672 | 1672 | $query['template'] = $do_email ? 'addressbook.email.rows' : 'addressbook.index.rows'; |
| 1673 | 1673 | } |
| 1674 | - if($query['col_filter']['parent_id']) |
|
| 1674 | + if ($query['col_filter']['parent_id']) |
|
| 1675 | 1675 | { |
| 1676 | 1676 | $query['grouped_view'] = $query['col_filter']['parent_id']; |
| 1677 | 1677 | $query['template'] = strpos($query['grouped_view'], 'duplicate') === 0 ? |
@@ -1681,11 +1681,11 @@ discard block |
||
| 1681 | 1681 | unset($query['col_filter']['parent_id']); |
| 1682 | 1682 | if ($query['grouped_view']) // view the contacts of one organisation only |
| 1683 | 1683 | { |
| 1684 | - if (strpos($query['grouped_view'],'*AND*') !== false) $query['grouped_view'] = str_replace('*AND*','&',$query['grouped_view']); |
|
| 1685 | - $fields = explode(',',$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); |
|
| 1686 | - foreach(explode('|||',$query['grouped_view']) as $part) |
|
| 1684 | + if (strpos($query['grouped_view'], '*AND*') !== false) $query['grouped_view'] = str_replace('*AND*', '&', $query['grouped_view']); |
|
| 1685 | + $fields = explode(',', $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); |
|
| 1686 | + foreach (explode('|||', $query['grouped_view']) as $part) |
|
| 1687 | 1687 | { |
| 1688 | - list($name,$value) = explode(':',$part,2); |
|
| 1688 | + list($name, $value) = explode(':', $part, 2); |
|
| 1689 | 1689 | // do NOT set invalid column, as this gives an SQL error ("AND AND" in sql) |
| 1690 | 1690 | if (static::$duplicate_fields[$name] && $value && ( |
| 1691 | 1691 | strpos($query['grouped_view'], 'duplicate:') === 0 && in_array($name, $fields) || |
@@ -1696,14 +1696,14 @@ discard block |
||
| 1696 | 1696 | } |
| 1697 | 1697 | } |
| 1698 | 1698 | } |
| 1699 | - else if($query['actions'] && !$query['actions']['edit']) |
|
| 1699 | + else if ($query['actions'] && !$query['actions']['edit']) |
|
| 1700 | 1700 | { |
| 1701 | 1701 | // Just switched from grouped view, update actions |
| 1702 | 1702 | $query['actions'] = $this->get_actions($query['col_filter']['tid']); |
| 1703 | 1703 | } |
| 1704 | 1704 | // translate the select order to the really used over all 3 columns |
| 1705 | 1705 | $sort = $query['sort']; |
| 1706 | - switch($query['order']) // "xxx<>'' DESC" sorts contacts with empty order-criteria always at the end |
|
| 1706 | + switch ($query['order']) // "xxx<>'' DESC" sorts contacts with empty order-criteria always at the end |
|
| 1707 | 1707 | { // we don't exclude them, as the total would otherwise depend on the order-criteria |
| 1708 | 1708 | case 'org_name': |
| 1709 | 1709 | $order = "egw_addressbook.org_name<>''DESC,egw_addressbook.org_name $sort,n_family $sort,n_given $sort"; |
@@ -1737,8 +1737,8 @@ discard block |
||
| 1737 | 1737 | } |
| 1738 | 1738 | if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter |
| 1739 | 1739 | { |
| 1740 | - $no_letter_search = array('adr_one_postalcode', 'adr_two_postalcode', 'contact_id', 'contact_created','contact_modified'); |
|
| 1741 | - $query['col_filter'][] = (in_array($query['order'],$no_letter_search) ? 'org_name' : (substr($query['order'],0,1)=='#'?'':'egw_addressbook.').$query['order']).' '. |
|
| 1740 | + $no_letter_search = array('adr_one_postalcode', 'adr_two_postalcode', 'contact_id', 'contact_created', 'contact_modified'); |
|
| 1741 | + $query['col_filter'][] = (in_array($query['order'], $no_letter_search) ? 'org_name' : (substr($query['order'], 0, 1) == '#' ? '' : 'egw_addressbook.').$query['order']).' '. |
|
| 1742 | 1742 | $GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote($query['searchletter'].'%'); |
| 1743 | 1743 | } |
| 1744 | 1744 | $wildcard = '%'; |
@@ -1752,34 +1752,34 @@ discard block |
||
| 1752 | 1752 | unset($query['advanced_search']['meth_select']); |
| 1753 | 1753 | } |
| 1754 | 1754 | //if ($do_email ) $email_only = array('id','owner','tid','n_fn','n_family','n_given','org_name','email','email_home'); |
| 1755 | - $rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'],$id_only, |
|
| 1756 | - $order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']); |
|
| 1755 | + $rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'], $id_only, |
|
| 1756 | + $order, '', $wildcard, false, $op, array((int)$query['start'], (int)$query['num_rows']), $query['col_filter']); |
|
| 1757 | 1757 | |
| 1758 | 1758 | // do we need to read the custom fields, depends on the column is enabled and customfields exist |
| 1759 | 1759 | // $query['csv_export'] allways needs to read ALL cf's |
| 1760 | 1760 | $columsel = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows']; |
| 1761 | - $available_distib_lists=$this->get_lists(Acl::READ); |
|
| 1762 | - $columselection = $columsel && !$query['csv_export'] ? explode(',',$columsel) : array(); |
|
| 1761 | + $available_distib_lists = $this->get_lists(Acl::READ); |
|
| 1762 | + $columselection = $columsel && !$query['csv_export'] ? explode(',', $columsel) : array(); |
|
| 1763 | 1763 | $ids = $calendar_participants = array(); |
| 1764 | 1764 | if (!$id_only && $rows) |
| 1765 | 1765 | { |
| 1766 | - $show_custom_fields = (in_array('customfields',$columselection)) && $this->customfields; |
|
| 1767 | - $show_calendar = $this->config['disable_event_column'] != 'True' && in_array('calendar_calendar',$columselection); |
|
| 1768 | - $show_distributionlist = in_array('distrib_lists',$columselection) || count($available_distib_lists); |
|
| 1766 | + $show_custom_fields = (in_array('customfields', $columselection)) && $this->customfields; |
|
| 1767 | + $show_calendar = $this->config['disable_event_column'] != 'True' && in_array('calendar_calendar', $columselection); |
|
| 1768 | + $show_distributionlist = in_array('distrib_lists', $columselection) || count($available_distib_lists); |
|
| 1769 | 1769 | if ($show_calendar || $show_custom_fields || $show_distributionlist) |
| 1770 | 1770 | { |
| 1771 | - foreach($rows as $val) |
|
| 1771 | + foreach ($rows as $val) |
|
| 1772 | 1772 | { |
| 1773 | 1773 | $ids[] = $val['id']; |
| 1774 | 1774 | $calendar_participants[$val['id']] = $val['account_id'] ? $val['account_id'] : 'c'.$val['id']; |
| 1775 | 1775 | } |
| 1776 | 1776 | if ($show_custom_fields) |
| 1777 | 1777 | { |
| 1778 | - foreach($columselection as $col) |
|
| 1778 | + foreach ($columselection as $col) |
|
| 1779 | 1779 | { |
| 1780 | - if ($col[0] == '#') $selected_cfs[] = substr($col,1); |
|
| 1780 | + if ($col[0] == '#') $selected_cfs[] = substr($col, 1); |
|
| 1781 | 1781 | } |
| 1782 | - $customfields = $this->read_customfields($ids,$selected_cfs); |
|
| 1782 | + $customfields = $this->read_customfields($ids, $selected_cfs); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | // TODO: we need to find out where the csv_export query has been used and try to clean up |
| 1785 | 1785 | // this columnselection condition statements. |
@@ -1788,7 +1788,7 @@ discard block |
||
| 1788 | 1788 | //_debug_array($this->get_lists(Acl::EDIT)); |
| 1789 | 1789 | if ($show_distributionlist && $available_distib_lists) |
| 1790 | 1790 | { |
| 1791 | - $distributionlist = $this->read_distributionlist($ids,array_keys($available_distib_lists)); |
|
| 1791 | + $distributionlist = $this->read_distributionlist($ids, array_keys($available_distib_lists)); |
|
| 1792 | 1792 | } |
| 1793 | 1793 | } |
| 1794 | 1794 | } |
@@ -1797,20 +1797,20 @@ discard block |
||
| 1797 | 1797 | |
| 1798 | 1798 | if ($id_only) |
| 1799 | 1799 | { |
| 1800 | - foreach($rows as $n => $row) |
|
| 1800 | + foreach ($rows as $n => $row) |
|
| 1801 | 1801 | { |
| 1802 | 1802 | $rows[$n] = $row['id']; |
| 1803 | 1803 | } |
| 1804 | - return $this->total; // no need to set other fields or $readonlys |
|
| 1804 | + return $this->total; // no need to set other fields or $readonlys |
|
| 1805 | 1805 | } |
| 1806 | 1806 | $order = $query['order']; |
| 1807 | 1807 | |
| 1808 | 1808 | $readonlys = array(); |
| 1809 | - foreach($rows as $n => &$row) |
|
| 1809 | + foreach ($rows as $n => &$row) |
|
| 1810 | 1810 | { |
| 1811 | 1811 | $given = $row['n_given'] ? $row['n_given'] : ($row['n_prefix'] ? $row['n_prefix'] : ''); |
| 1812 | 1812 | |
| 1813 | - switch($order) |
|
| 1813 | + switch ($order) |
|
| 1814 | 1814 | { |
| 1815 | 1815 | default: // postalcode, created, modified, ... |
| 1816 | 1816 | case 'org_name': |
@@ -1827,43 +1827,43 @@ discard block |
||
| 1827 | 1827 | break; |
| 1828 | 1828 | case 'n_fileas': |
| 1829 | 1829 | if (!$row['n_fileas']) $row['n_fileas'] = $this->fileas($row); |
| 1830 | - list($row['line1'],$row['line2']) = explode(': ',$row['n_fileas']); |
|
| 1830 | + list($row['line1'], $row['line2']) = explode(': ', $row['n_fileas']); |
|
| 1831 | 1831 | break; |
| 1832 | 1832 | } |
| 1833 | - if (isset($this->grouped_views[(string) $query['grouped_view']])) |
|
| 1833 | + if (isset($this->grouped_views[(string)$query['grouped_view']])) |
|
| 1834 | 1834 | { |
| 1835 | 1835 | $row['type'] = 'home'; |
| 1836 | 1836 | $row['type_label'] = $query['grouped_view'] == 'duplicate' ? lang('Duplicates') : lang('Organisation'); |
| 1837 | 1837 | |
| 1838 | - if ($query['filter'] && !($this->grants[(int)$query['filter']] & Acl::DELETE)) |
|
| 1838 | + if ($query['filter'] && !($this->grants[(int)$query['filter']]&Acl::DELETE)) |
|
| 1839 | 1839 | { |
| 1840 | 1840 | $row['class'] .= 'rowNoDelete '; |
| 1841 | 1841 | } |
| 1842 | - $row['class'] .= 'rowNoEdit '; // no edit in OrgView |
|
| 1842 | + $row['class'] .= 'rowNoEdit '; // no edit in OrgView |
|
| 1843 | 1843 | $row['class'] .= $query['grouped_view'] == 'duplicates' ? 'contact_duplicate' : 'contact_organisation '; |
| 1844 | 1844 | } |
| 1845 | 1845 | else |
| 1846 | 1846 | { |
| 1847 | - $this->type_icon($row['owner'],$row['private'],$row['tid'],$row['type'],$row['type_label']); |
|
| 1847 | + $this->type_icon($row['owner'], $row['private'], $row['tid'], $row['type'], $row['type_label']); |
|
| 1848 | 1848 | |
| 1849 | - static $tel2show = array('tel_work','tel_cell','tel_home','tel_fax'); |
|
| 1849 | + static $tel2show = array('tel_work', 'tel_cell', 'tel_home', 'tel_fax'); |
|
| 1850 | 1850 | static $prefer_marker = null; |
| 1851 | 1851 | if (is_null($prefer_marker)) |
| 1852 | 1852 | { |
| 1853 | 1853 | // as et2 adds options with .text(), it can't be entities, but php knows no string literals with utf-8 |
| 1854 | 1854 | $prefer_marker = html_entity_decode(' ☆', ENT_NOQUOTES, 'utf-8'); |
| 1855 | 1855 | } |
| 1856 | - foreach($tel2show as $name) |
|
| 1856 | + foreach ($tel2show as $name) |
|
| 1857 | 1857 | { |
| 1858 | - $row[$name] .= ' '.($row['tel_prefer'] == $name ? $prefer_marker : ''); // .' ' to NOT remove the field |
|
| 1858 | + $row[$name] .= ' '.($row['tel_prefer'] == $name ? $prefer_marker : ''); // .' ' to NOT remove the field |
|
| 1859 | 1859 | } |
| 1860 | 1860 | // allways show the prefered phone, if not already shown |
| 1861 | - if (!in_array($row['tel_prefer'],$tel2show) && $row[$row['tel_prefer']]) |
|
| 1861 | + if (!in_array($row['tel_prefer'], $tel2show) && $row[$row['tel_prefer']]) |
|
| 1862 | 1862 | { |
| 1863 | 1863 | $row['tel_prefered'] = $row[$row['tel_prefer']].$prefer_marker; |
| 1864 | 1864 | } |
| 1865 | 1865 | // Show nice name as status text |
| 1866 | - if($row['tel_prefer']) |
|
| 1866 | + if ($row['tel_prefer']) |
|
| 1867 | 1867 | { |
| 1868 | 1868 | $row['tel_prefer_label'] = $this->contact_fields[$row['tel_prefer']]; |
| 1869 | 1869 | } |
@@ -1871,33 +1871,33 @@ discard block |
||
| 1871 | 1871 | { |
| 1872 | 1872 | $row['class'] .= 'rowAccount rowNoDelete '; |
| 1873 | 1873 | } |
| 1874 | - elseif (!$this->check_perms(Acl::DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == self::DELETED_TYPE)) |
|
| 1874 | + elseif (!$this->check_perms(Acl::DELETE, $row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == self::DELETED_TYPE)) |
|
| 1875 | 1875 | { |
| 1876 | 1876 | $row['class'] .= 'rowNoDelete '; |
| 1877 | 1877 | } |
| 1878 | - if (!$this->check_perms(Acl::EDIT,$row)) |
|
| 1878 | + if (!$this->check_perms(Acl::EDIT, $row)) |
|
| 1879 | 1879 | { |
| 1880 | 1880 | $row['class'] .= 'rowNoEdit '; |
| 1881 | 1881 | } |
| 1882 | 1882 | $row['class'] .= 'contact_contact '; |
| 1883 | 1883 | |
| 1884 | - unset($row['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 1884 | + unset($row['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 1885 | 1885 | |
| 1886 | 1886 | if (isset($customfields[$row['id']])) |
| 1887 | 1887 | { |
| 1888 | - foreach($this->customfields as $name => $data) |
|
| 1888 | + foreach ($this->customfields as $name => $data) |
|
| 1889 | 1889 | { |
| 1890 | 1890 | $row['#'.$name] = $customfields[$row['id']]['#'.$name]; |
| 1891 | 1891 | } |
| 1892 | 1892 | } |
| 1893 | 1893 | if (isset($distributionlist[$row['id']])) |
| 1894 | 1894 | { |
| 1895 | - $row['distrib_lists'] = implode("\n",array_values($distributionlist[$row['id']])); |
|
| 1895 | + $row['distrib_lists'] = implode("\n", array_values($distributionlist[$row['id']])); |
|
| 1896 | 1896 | //if ($show_distributionlist) $readonlys['distrib_lists'] =true; |
| 1897 | 1897 | } |
| 1898 | 1898 | if (isset($calendar[$calendar_participants[$row['id']]])) |
| 1899 | 1899 | { |
| 1900 | - foreach($calendar[$calendar_participants[$row['id']]] as $name => $data) |
|
| 1900 | + foreach ($calendar[$calendar_participants[$row['id']]] as $name => $data) |
|
| 1901 | 1901 | { |
| 1902 | 1902 | $row[$name] = $data; |
| 1903 | 1903 | } |
@@ -1905,13 +1905,13 @@ discard block |
||
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | 1907 | // hide region for address format 'postcode_city' |
| 1908 | - if (($row['addr_format'] = $this->addr_format_by_country($row['adr_one_countryname']))=='postcode_city') unset($row['adr_one_region']); |
|
| 1909 | - if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname']))=='postcode_city') unset($row['adr_two_region']); |
|
| 1908 | + if (($row['addr_format'] = $this->addr_format_by_country($row['adr_one_countryname'])) == 'postcode_city') unset($row['adr_one_region']); |
|
| 1909 | + if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname'])) == 'postcode_city') unset($row['adr_two_region']); |
|
| 1910 | 1910 | |
| 1911 | 1911 | // respect category permissions |
| 1912 | - if(!empty($row['cat_id'])) |
|
| 1912 | + if (!empty($row['cat_id'])) |
|
| 1913 | 1913 | { |
| 1914 | - $row['cat_id'] = $this->categories->check_list(Acl::READ,$row['cat_id']); |
|
| 1914 | + $row['cat_id'] = $this->categories->check_list(Acl::READ, $row['cat_id']); |
|
| 1915 | 1915 | } |
| 1916 | 1916 | } |
| 1917 | 1917 | $rows['no_distribution_list'] = (bool)$query['filter2']; |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | 1925 | // Disable next/last date if so configured |
| 1926 | - if($this->config['disable_event_column'] == 'True') |
|
| 1926 | + if ($this->config['disable_event_column'] == 'True') |
|
| 1927 | 1927 | { |
| 1928 | 1928 | $rows['no_event_column'] = true; |
| 1929 | 1929 | } |
@@ -1936,23 +1936,21 @@ discard block |
||
| 1936 | 1936 | $header = array(); |
| 1937 | 1937 | if ($query['filter'] !== '' && !isset($this->grouped_views[$query['grouped_view']])) |
| 1938 | 1938 | { |
| 1939 | - $header[] = ($query['filter'] == '0' ? lang('accounts') : |
|
| 1940 | - ($GLOBALS['egw']->accounts->get_type($query['filter']) == 'g' ? |
|
| 1941 | - lang('Group %1',$GLOBALS['egw']->accounts->id2name($query['filter'])) : |
|
| 1942 | - Api\Accounts::username((int)$query['filter']). |
|
| 1943 | - (substr($query['filter'],-1) == 'p' ? ' ('.lang('private').')' : ''))); |
|
| 1939 | + $header[] = ($query['filter'] == '0' ? lang('accounts') : ($GLOBALS['egw']->accounts->get_type($query['filter']) == 'g' ? |
|
| 1940 | + lang('Group %1', $GLOBALS['egw']->accounts->id2name($query['filter'])) : Api\Accounts::username((int)$query['filter']). |
|
| 1941 | + (substr($query['filter'], -1) == 'p' ? ' ('.lang('private').')' : ''))); |
|
| 1944 | 1942 | } |
| 1945 | 1943 | if ($query['grouped_view']) |
| 1946 | 1944 | { |
| 1947 | 1945 | $header[] = $query['grouped_view_label']; |
| 1948 | 1946 | // Make sure option is there |
| 1949 | - if(!array_key_exists($query['grouped_view'], $this->grouped_views)) |
|
| 1947 | + if (!array_key_exists($query['grouped_view'], $this->grouped_views)) |
|
| 1950 | 1948 | { |
| 1951 | 1949 | $this->grouped_views += $this->_get_grouped_name($query['grouped_view']); |
| 1952 | 1950 | $rows['sel_options']['grouped_view'] = $this->grouped_views; |
| 1953 | 1951 | } |
| 1954 | 1952 | } |
| 1955 | - if($query['advanced_search']) |
|
| 1953 | + if ($query['advanced_search']) |
|
| 1956 | 1954 | { |
| 1957 | 1955 | $header[] = lang('Advanced search'); |
| 1958 | 1956 | } |
@@ -1963,11 +1961,11 @@ discard block |
||
| 1963 | 1961 | if ($query['searchletter']) |
| 1964 | 1962 | { |
| 1965 | 1963 | $order = $order == 'n_given' ? lang('first name') : ($order == 'n_family' ? lang('last name') : lang('Organisation')); |
| 1966 | - $header[] = lang("%1 starts with '%2'",$order,$query['searchletter']); |
|
| 1964 | + $header[] = lang("%1 starts with '%2'", $order, $query['searchletter']); |
|
| 1967 | 1965 | } |
| 1968 | 1966 | if ($query['search'] && !$query['advanced_search']) // do not add that, if we have advanced search active |
| 1969 | 1967 | { |
| 1970 | - $header[] = lang("Search for '%1'",$query['search']); |
|
| 1968 | + $header[] = lang("Search for '%1'", $query['search']); |
|
| 1971 | 1969 | } |
| 1972 | 1970 | $GLOBALS['egw_info']['flags']['app_header'] = implode(': ', $header); |
| 1973 | 1971 | |
@@ -1983,7 +1981,7 @@ discard block |
||
| 1983 | 1981 | * @param string &$icon icon-name |
| 1984 | 1982 | * @param string &$label translated label |
| 1985 | 1983 | */ |
| 1986 | - function type_icon($owner,$private,$tid,&$icon,&$label) |
|
| 1984 | + function type_icon($owner, $private, $tid, &$icon, &$label) |
|
| 1987 | 1985 | { |
| 1988 | 1986 | if (!$owner) |
| 1989 | 1987 | { |
@@ -1998,7 +1996,7 @@ discard block |
||
| 1998 | 1996 | elseif ($GLOBALS['egw']->accounts->get_type($owner) == 'g') |
| 1999 | 1997 | { |
| 2000 | 1998 | $icon = 'group'; |
| 2001 | - $label = lang('group %1',$GLOBALS['egw']->accounts->id2name($owner)); |
|
| 1999 | + $label = lang('group %1', $GLOBALS['egw']->accounts->id2name($owner)); |
|
| 2002 | 2000 | } |
| 2003 | 2001 | else |
| 2004 | 2002 | { |
@@ -2006,9 +2004,9 @@ discard block |
||
| 2006 | 2004 | $label = $owner == $this->user ? lang('personal') : Api\Accounts::username($owner); |
| 2007 | 2005 | } |
| 2008 | 2006 | // show tid icon for tid!='n' AND only if one is defined |
| 2009 | - if ($tid != 'n' && Api\Image::find('addressbook',$this->content_types[$tid]['name'])) |
|
| 2007 | + if ($tid != 'n' && Api\Image::find('addressbook', $this->content_types[$tid]['name'])) |
|
| 2010 | 2008 | { |
| 2011 | - $icon = Api\Image::find('addressbook',$this->content_types[$tid]['name']); |
|
| 2009 | + $icon = Api\Image::find('addressbook', $this->content_types[$tid]['name']); |
|
| 2012 | 2010 | } |
| 2013 | 2011 | |
| 2014 | 2012 | // Legacy - from when icons could be anywhere |
@@ -2026,19 +2024,19 @@ discard block |
||
| 2026 | 2024 | * @param int $_GET['contact_id'] contact_id mainly for popup use |
| 2027 | 2025 | * @param bool $_GET['makecp'] true if you want to copy the contact given by $_GET['contact_id'] |
| 2028 | 2026 | */ |
| 2029 | - function edit($content=null) |
|
| 2027 | + function edit($content = null) |
|
| 2030 | 2028 | { |
| 2031 | 2029 | if (is_array($content)) |
| 2032 | 2030 | { |
| 2033 | 2031 | list($button) = @each($content['button']); |
| 2034 | 2032 | unset($content['button']); |
| 2035 | - $content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p'); |
|
| 2036 | - $content['owner'] = (string) (int) $content['owner']; |
|
| 2033 | + $content['private'] = (int)($content['owner'] && substr($content['owner'], -1) == 'p'); |
|
| 2034 | + $content['owner'] = (string)(int)$content['owner']; |
|
| 2037 | 2035 | $content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $content['cat_id_tree'] : $content['cat_id']; |
| 2038 | 2036 | if ($this->config['private_cf_tab']) $content = (array)$content['private_cfs'] + $content; |
| 2039 | 2037 | unset($content['private_cfs']); |
| 2040 | 2038 | |
| 2041 | - switch($button) |
|
| 2039 | + switch ($button) |
|
| 2042 | 2040 | { |
| 2043 | 2041 | case 'save': |
| 2044 | 2042 | case 'apply': |
@@ -2050,7 +2048,7 @@ discard block |
||
| 2050 | 2048 | // photo might be changed by ajax_upload_photo |
| 2051 | 2049 | if (!array_key_exists('jpegphoto', $content)) |
| 2052 | 2050 | { |
| 2053 | - $content['photo_unchanged'] = true; // hint no need to store photo |
|
| 2051 | + $content['photo_unchanged'] = true; // hint no need to store photo |
|
| 2054 | 2052 | } |
| 2055 | 2053 | $links = false; |
| 2056 | 2054 | if (!$content['id'] && is_array($content['link_to']['to_id'])) |
@@ -2063,12 +2061,12 @@ discard block |
||
| 2063 | 2061 | $old_org_entry = $this->read($content['id']); |
| 2064 | 2062 | $old_fullname = ($old_org_entry['n_fn'] ? $old_org_entry['n_fn'] : parent::fullname($old_org_entry)); |
| 2065 | 2063 | } |
| 2066 | - if ( $content['n_fn'] != $fullname || $fullname != $old_fullname) |
|
| 2064 | + if ($content['n_fn'] != $fullname || $fullname != $old_fullname) |
|
| 2067 | 2065 | { |
| 2068 | 2066 | unset($content['n_fn']); |
| 2069 | 2067 | } |
| 2070 | 2068 | // Country codes |
| 2071 | - foreach(array('adr_one', 'adr_two') as $c_prefix) |
|
| 2069 | + foreach (array('adr_one', 'adr_two') as $c_prefix) |
|
| 2072 | 2070 | { |
| 2073 | 2071 | if ($content[$c_prefix.'_countrycode'] == '-custom-') |
| 2074 | 2072 | { |
@@ -2077,7 +2075,7 @@ discard block |
||
| 2077 | 2075 | } |
| 2078 | 2076 | $content['msg'] = ''; |
| 2079 | 2077 | $this->error = false; |
| 2080 | - foreach((array)$content['pre_save_callbacks'] as $callback) |
|
| 2078 | + foreach ((array)$content['pre_save_callbacks'] as $callback) |
|
| 2081 | 2079 | { |
| 2082 | 2080 | try { |
| 2083 | 2081 | if (($success_msg = call_user_func_array($callback, array(&$content)))) |
@@ -2087,7 +2085,7 @@ discard block |
||
| 2087 | 2085 | } |
| 2088 | 2086 | catch (Exception $ex) { |
| 2089 | 2087 | $content['msg'] .= ($content['msg'] ? ', ' : '').$ex->getMessage(); |
| 2090 | - $button = 'apply'; // do not close dialog |
|
| 2088 | + $button = 'apply'; // do not close dialog |
|
| 2091 | 2089 | $this->error = true; |
| 2092 | 2090 | break; |
| 2093 | 2091 | } |
@@ -2102,7 +2100,7 @@ discard block |
||
| 2102 | 2100 | |
| 2103 | 2101 | unset($content['jpegphoto'], $content['photo_unchanged']); |
| 2104 | 2102 | |
| 2105 | - foreach((array)$content['post_save_callbacks'] as $callback) |
|
| 2103 | + foreach ((array)$content['post_save_callbacks'] as $callback) |
|
| 2106 | 2104 | { |
| 2107 | 2105 | try { |
| 2108 | 2106 | if (($success_msg = call_user_func_array($callback, array(&$content)))) |
@@ -2110,58 +2108,58 @@ discard block |
||
| 2110 | 2108 | $content['msg'] .= ', '.$success_msg; |
| 2111 | 2109 | } |
| 2112 | 2110 | } |
| 2113 | - catch(Api\Exception\Redirect $r) |
|
| 2111 | + catch (Api\Exception\Redirect $r) |
|
| 2114 | 2112 | { |
| 2115 | 2113 | // catch it to continue execution and rethrow it later |
| 2116 | 2114 | } |
| 2117 | 2115 | catch (Exception $ex) { |
| 2118 | 2116 | $content['msg'] .= ', '.$ex->getMessage(); |
| 2119 | - $button = 'apply'; // do not close dialog |
|
| 2117 | + $button = 'apply'; // do not close dialog |
|
| 2120 | 2118 | $this->error = true; |
| 2121 | 2119 | break; |
| 2122 | 2120 | } |
| 2123 | 2121 | } |
| 2124 | 2122 | |
| 2125 | - if ($content['change_org'] && $old_org_entry && ($changed = $this->changed_fields($old_org_entry,$content,true)) && |
|
| 2126 | - ($members = $this->org_similar($old_org_entry['org_name'],$changed))) |
|
| 2123 | + if ($content['change_org'] && $old_org_entry && ($changed = $this->changed_fields($old_org_entry, $content, true)) && |
|
| 2124 | + ($members = $this->org_similar($old_org_entry['org_name'], $changed))) |
|
| 2127 | 2125 | { |
| 2128 | 2126 | //foreach($changed as $name => $old_value) echo "<p>$name: '$old_value' --> '{$content[$name]}'</p>\n"; |
| 2129 | - list($changed_members,$changed_fields,$failed_members) = $this->change_org($old_org_entry['org_name'],$changed,$content,$members); |
|
| 2127 | + list($changed_members, $changed_fields, $failed_members) = $this->change_org($old_org_entry['org_name'], $changed, $content, $members); |
|
| 2130 | 2128 | if ($changed_members) |
| 2131 | 2129 | { |
| 2132 | - $content['msg'] .= ', '.lang('%1 fields in %2 other organisation member(s) changed',$changed_fields,$changed_members); |
|
| 2130 | + $content['msg'] .= ', '.lang('%1 fields in %2 other organisation member(s) changed', $changed_fields, $changed_members); |
|
| 2133 | 2131 | } |
| 2134 | 2132 | if ($failed_members) |
| 2135 | 2133 | { |
| 2136 | - $content['msg'] .= ', '.lang('failed to change %1 organisation member(s) (insufficent rights) !!!',$failed_members); |
|
| 2134 | + $content['msg'] .= ', '.lang('failed to change %1 organisation member(s) (insufficent rights) !!!', $failed_members); |
|
| 2137 | 2135 | } |
| 2138 | 2136 | } |
| 2139 | 2137 | } |
| 2140 | - elseif($this->error === true) |
|
| 2138 | + elseif ($this->error === true) |
|
| 2141 | 2139 | { |
| 2142 | 2140 | $content['msg'] = lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
| 2143 | - lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
| 2144 | - htmlspecialchars(Egw::link('/index.php',array( |
|
| 2141 | + lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'. |
|
| 2142 | + htmlspecialchars(Egw::link('/index.php', array( |
|
| 2145 | 2143 | 'menuaction' => 'addressbook.addressbook_ui.edit', |
| 2146 | 2144 | 'contact_id' => $content['id'], |
| 2147 | - ))).'">','</a>'); |
|
| 2148 | - break; // dont refresh the list |
|
| 2145 | + ))).'">', '</a>'); |
|
| 2146 | + break; // dont refresh the list |
|
| 2149 | 2147 | } |
| 2150 | 2148 | else |
| 2151 | 2149 | { |
| 2152 | 2150 | $content['msg'] = lang('Error saving the contact !!!'). |
| 2153 | 2151 | ($this->error ? ' '.$this->error : ''); |
| 2154 | - $button = 'apply'; // to not leave the dialog |
|
| 2152 | + $button = 'apply'; // to not leave the dialog |
|
| 2155 | 2153 | } |
| 2156 | 2154 | // writing links for new entry, existing ones are handled by the widget itself |
| 2157 | 2155 | if ($links && $content['id']) |
| 2158 | 2156 | { |
| 2159 | - Link::link('addressbook',$content['id'],$links); |
|
| 2157 | + Link::link('addressbook', $content['id'], $links); |
|
| 2160 | 2158 | } |
| 2161 | 2159 | // Update client side global datastore |
| 2162 | 2160 | $response = Api\Json\Response::get(); |
| 2163 | 2161 | $response->generic('data', array('uid' => 'addressbook::'.$content['id'], 'data' => $content)); |
| 2164 | - Framework::refresh_opener($content['msg'], 'addressbook', $content['id'], $content['id'] ? 'edit' : 'add', |
|
| 2162 | + Framework::refresh_opener($content['msg'], 'addressbook', $content['id'], $content['id'] ? 'edit' : 'add', |
|
| 2165 | 2163 | null, null, null, $this->error ? 'error' : 'success'); |
| 2166 | 2164 | |
| 2167 | 2165 | // re-throw redirect exception, if there's no error |
@@ -2183,11 +2181,11 @@ discard block |
||
| 2183 | 2181 | |
| 2184 | 2182 | case 'delete': |
| 2185 | 2183 | $success = $failed = $action_msg = null; |
| 2186 | - if($this->action('delete',array($content['id']),false,$success,$failed,$action_msg,'',$content['msg'])) |
|
| 2184 | + if ($this->action('delete', array($content['id']), false, $success, $failed, $action_msg, '', $content['msg'])) |
|
| 2187 | 2185 | { |
| 2188 | 2186 | if ($GLOBALS['egw']->currentapp == 'addressbook') |
| 2189 | 2187 | { |
| 2190 | - Framework::refresh_opener(lang('Contact deleted'), 'addressbook', $content['id'], 'delete' ); |
|
| 2188 | + Framework::refresh_opener(lang('Contact deleted'), 'addressbook', $content['id'], 'delete'); |
|
| 2191 | 2189 | Framework::window_close(); |
| 2192 | 2190 | } |
| 2193 | 2191 | else |
@@ -2212,7 +2210,7 @@ discard block |
||
| 2212 | 2210 | // new contact --> set some defaults |
| 2213 | 2211 | if ($contact_id && is_array($content = $this->read($contact_id))) |
| 2214 | 2212 | { |
| 2215 | - $contact_id = $content['id']; // it could have been: "account:$account_id" |
|
| 2213 | + $contact_id = $content['id']; // it could have been: "account:$account_id" |
|
| 2216 | 2214 | if (!$this->check_perms(Acl::EDIT, $content)) |
| 2217 | 2215 | { |
| 2218 | 2216 | $view = true; |
@@ -2256,52 +2254,52 @@ discard block |
||
| 2256 | 2254 | { |
| 2257 | 2255 | $content['owner'] = (string)($state['filter'] == 0 ? '' : $state['filter']); |
| 2258 | 2256 | } |
| 2259 | - $content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p'); |
|
| 2260 | - if ($content['owner'] === '' || !($this->grants[$content['owner'] = (string) (int) $content['owner']] & Acl::ADD)) |
|
| 2257 | + $content['private'] = (int)($content['owner'] && substr($content['owner'], -1) == 'p'); |
|
| 2258 | + if ($content['owner'] === '' || !($this->grants[$content['owner'] = (string)(int)$content['owner']]&Acl::ADD)) |
|
| 2261 | 2259 | { |
| 2262 | 2260 | $content['owner'] = $this->default_addressbook; |
| 2263 | 2261 | $content['private'] = (int)$this->default_private; |
| 2264 | 2262 | |
| 2265 | - if (!($this->grants[$content['owner'] = (string) (int) $content['owner']] & Acl::ADD)) |
|
| 2263 | + if (!($this->grants[$content['owner'] = (string)(int)$content['owner']]&Acl::ADD)) |
|
| 2266 | 2264 | { |
| 2267 | - $content['owner'] = (string) $this->user; |
|
| 2265 | + $content['owner'] = (string)$this->user; |
|
| 2268 | 2266 | $content['private'] = 0; |
| 2269 | 2267 | } |
| 2270 | 2268 | } |
| 2271 | 2269 | $new_type = array_keys($this->content_types); |
| 2272 | 2270 | // fetch active type to preset the type, if param typeid is not passed |
| 2273 | - $active_tid = Api\Cache::getSession('addressbook','active_tid'); |
|
| 2271 | + $active_tid = Api\Cache::getSession('addressbook', 'active_tid'); |
|
| 2274 | 2272 | if ($active_tid && strtoupper($active_tid) === 'D') unset($active_tid); |
| 2275 | - $content['tid'] = $_GET['typeid'] ? $_GET['typeid'] : ($active_tid?$active_tid:$new_type[0]); |
|
| 2276 | - foreach($this->get_contact_columns() as $field) |
|
| 2273 | + $content['tid'] = $_GET['typeid'] ? $_GET['typeid'] : ($active_tid ? $active_tid : $new_type[0]); |
|
| 2274 | + foreach ($this->get_contact_columns() as $field) |
|
| 2277 | 2275 | { |
| 2278 | 2276 | if ($_GET['presets'][$field]) |
| 2279 | 2277 | { |
| 2280 | - if ($field=='email'||$field=='email_home') |
|
| 2278 | + if ($field == 'email' || $field == 'email_home') |
|
| 2281 | 2279 | { |
| 2282 | - $singleAddress = imap_rfc822_parse_adrlist($_GET['presets'][$field],''); |
|
| 2280 | + $singleAddress = imap_rfc822_parse_adrlist($_GET['presets'][$field], ''); |
|
| 2283 | 2281 | //error_log(__METHOD__.__LINE__.' Address:'.$singleAddress[0]->mailbox."@".$singleAddress[0]->host.", ".$singleAddress[0]->personal); |
| 2284 | - if (!(!is_array($singleAddress) || count($singleAddress)<1)) |
|
| 2282 | + if (!(!is_array($singleAddress) || count($singleAddress) < 1)) |
|
| 2285 | 2283 | { |
| 2286 | 2284 | $content[$field] = $singleAddress[0]->mailbox."@".$singleAddress[0]->host; |
| 2287 | 2285 | if (!empty($singleAddress[0]->personal)) |
| 2288 | 2286 | { |
| 2289 | - if (strpos($singleAddress[0]->personal,',')===false) |
|
| 2287 | + if (strpos($singleAddress[0]->personal, ',') === false) |
|
| 2290 | 2288 | { |
| 2291 | - list($P_n_given,$P_n_family,$P_org_name)=explode(' ',$singleAddress[0]->personal,3); |
|
| 2292 | - if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given); |
|
| 2293 | - if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family); |
|
| 2294 | - if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name); |
|
| 2289 | + list($P_n_given, $P_n_family, $P_org_name) = explode(' ', $singleAddress[0]->personal, 3); |
|
| 2290 | + if (strlen(trim($P_n_given)) > 0) $content['n_given'] = trim($P_n_given); |
|
| 2291 | + if (strlen(trim($P_n_family)) > 0) $content['n_family'] = trim($P_n_family); |
|
| 2292 | + if (strlen(trim($P_org_name)) > 0) $content['org_name'] = trim($P_org_name); |
|
| 2295 | 2293 | } |
| 2296 | 2294 | else |
| 2297 | 2295 | { |
| 2298 | - list($P_n_family,$P_other)=explode(',',$singleAddress[0]->personal,2); |
|
| 2299 | - if (strlen(trim($P_n_family))>0) $content['n_family'] = trim($P_n_family); |
|
| 2300 | - if (strlen(trim($P_other))>0) |
|
| 2296 | + list($P_n_family, $P_other) = explode(',', $singleAddress[0]->personal, 2); |
|
| 2297 | + if (strlen(trim($P_n_family)) > 0) $content['n_family'] = trim($P_n_family); |
|
| 2298 | + if (strlen(trim($P_other)) > 0) |
|
| 2301 | 2299 | { |
| 2302 | - list($P_n_given,$P_org_name)=explode(',',$P_other,2); |
|
| 2303 | - if (strlen(trim($P_n_given))>0) $content['n_given'] = trim($P_n_given); |
|
| 2304 | - if (strlen(trim($P_org_name))>0) $content['org_name'] = trim($P_org_name); |
|
| 2300 | + list($P_n_given, $P_org_name) = explode(',', $P_other, 2); |
|
| 2301 | + if (strlen(trim($P_n_given)) > 0) $content['n_given'] = trim($P_n_given); |
|
| 2302 | + if (strlen(trim($P_org_name)) > 0) $content['org_name'] = trim($P_org_name); |
|
| 2305 | 2303 | } |
| 2306 | 2304 | } |
| 2307 | 2305 | } |
@@ -2319,13 +2317,13 @@ discard block |
||
| 2319 | 2317 | } |
| 2320 | 2318 | if (isset($_GET['presets'])) |
| 2321 | 2319 | { |
| 2322 | - foreach(array('email','email_home','n_family','n_given','org_name') as $field) |
|
| 2320 | + foreach (array('email', 'email_home', 'n_family', 'n_given', 'org_name') as $field) |
|
| 2323 | 2321 | { |
| 2324 | 2322 | if (!empty($content[$field])) |
| 2325 | 2323 | { |
| 2326 | 2324 | //Set the presets fields in content in order to be able to use them later in client side for checking duplication only on first time load |
| 2327 | 2325 | // after save/apply we unset them |
| 2328 | - $content['presets_fields'][]= $field; |
|
| 2326 | + $content['presets_fields'][] = $field; |
|
| 2329 | 2327 | break; |
| 2330 | 2328 | } |
| 2331 | 2329 | } |
@@ -2337,12 +2335,12 @@ discard block |
||
| 2337 | 2335 | //_debug_array($content); |
| 2338 | 2336 | } |
| 2339 | 2337 | |
| 2340 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
| 2338 | + if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
| 2341 | 2339 | |
| 2342 | - if($content && $_GET['makecp']) // copy the contact |
|
| 2340 | + if ($content && $_GET['makecp']) // copy the contact |
|
| 2343 | 2341 | { |
| 2344 | 2342 | $this->copy_contact($content); |
| 2345 | - $content['msg'] = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('addressbook','entry'))); |
|
| 2343 | + $content['msg'] = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('addressbook', 'entry'))); |
|
| 2346 | 2344 | $view = false; |
| 2347 | 2345 | } |
| 2348 | 2346 | else |
@@ -2353,12 +2351,12 @@ discard block |
||
| 2353 | 2351 | if (!$contact_id && isset($_REQUEST['link_app']) && isset($_REQUEST['link_id']) && !is_array($content['link_to']['to_id'])) |
| 2354 | 2352 | { |
| 2355 | 2353 | $link_ids = is_array($_REQUEST['link_id']) ? $_REQUEST['link_id'] : array($_REQUEST['link_id']); |
| 2356 | - foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
|
| 2354 | + foreach (is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app) |
|
| 2357 | 2355 | { |
| 2358 | 2356 | $link_id = $link_ids[$n]; |
| 2359 | - if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id)) // gard against XSS |
|
| 2357 | + if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i', $link_app.':'.$link_id)) // gard against XSS |
|
| 2360 | 2358 | { |
| 2361 | - Link::link('addressbook',$content['link_to']['to_id'],$link_app,$link_id); |
|
| 2359 | + Link::link('addressbook', $content['link_to']['to_id'], $link_app, $link_id); |
|
| 2362 | 2360 | } |
| 2363 | 2361 | } |
| 2364 | 2362 | } |
@@ -2366,8 +2364,8 @@ discard block |
||
| 2366 | 2364 | if ($content['id']) |
| 2367 | 2365 | { |
| 2368 | 2366 | // last and next calendar date |
| 2369 | - list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); |
|
| 2370 | - if(is_array($dates)) $content += $dates; |
|
| 2367 | + list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']), false)); |
|
| 2368 | + if (is_array($dates)) $content += $dates; |
|
| 2371 | 2369 | } |
| 2372 | 2370 | |
| 2373 | 2371 | // Registry has view_id as contact_id, so set it (custom fields uses it) |
@@ -2378,7 +2376,7 @@ discard block |
||
| 2378 | 2376 | |
| 2379 | 2377 | // Avoid setting conflicts with private custom fields |
| 2380 | 2378 | $content['private_cfs'] = array(); |
| 2381 | - foreach(Api\Storage\Customfields::get('addressbook', true) as $name => $cf) |
|
| 2379 | + foreach (Api\Storage\Customfields::get('addressbook', true) as $name => $cf) |
|
| 2382 | 2380 | { |
| 2383 | 2381 | if ($this->config['private_cf_tab'] && $cf['private'] && isset($content['#'.$name])) |
| 2384 | 2382 | { |
@@ -2391,7 +2389,7 @@ discard block |
||
| 2391 | 2389 | $content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']); |
| 2392 | 2390 | |
| 2393 | 2391 | //_debug_array($content); |
| 2394 | - $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(Acl::DELETE,$content); |
|
| 2392 | + $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(Acl::DELETE, $content); |
|
| 2395 | 2393 | $readonlys['button[copy]'] = $readonlys['button[edit]'] = $readonlys['button[vcard]'] = true; |
| 2396 | 2394 | $readonlys['button[save]'] = $readonlys['button[apply]'] = $view; |
| 2397 | 2395 | if ($view) |
@@ -2403,19 +2401,18 @@ discard block |
||
| 2403 | 2401 | $sel_options['fileas_type'] = $this->fileas_options($content); |
| 2404 | 2402 | $sel_options['adr_one_countrycode']['-custom-'] = lang('Custom'); |
| 2405 | 2403 | $sel_options['owner'] = $this->get_addressbooks(Acl::ADD); |
| 2406 | - if ($content['owner']) unset($sel_options['owner'][0]); // do not offer to switch to accounts, as we do not support moving contacts to accounts |
|
| 2407 | - if ((string) $content['owner'] !== '') |
|
| 2404 | + if ($content['owner']) unset($sel_options['owner'][0]); // do not offer to switch to accounts, as we do not support moving contacts to accounts |
|
| 2405 | + if ((string)$content['owner'] !== '') |
|
| 2408 | 2406 | { |
| 2409 | 2407 | if (!isset($sel_options['owner'][(int)$content['owner']])) |
| 2410 | 2408 | { |
| 2411 | - $sel_options['owner'][(int)$content['owner']] = !$content['owner'] ? lang('Accounts') : |
|
| 2412 | - Api\Accounts::username($content['owner']); |
|
| 2409 | + $sel_options['owner'][(int)$content['owner']] = !$content['owner'] ? lang('Accounts') : Api\Accounts::username($content['owner']); |
|
| 2413 | 2410 | } |
| 2414 | - $readonlys['owner'] = !$content['owner'] || // dont allow to move accounts, as this mean deleting the user incl. all content he owns |
|
| 2415 | - $content['id'] && !$this->check_perms(Acl::DELETE,$content); // you need delete rights to move an existing contact into an other addressbook |
|
| 2411 | + $readonlys['owner'] = !$content['owner'] || // dont allow to move accounts, as this mean deleting the user incl. all content he owns |
|
| 2412 | + $content['id'] && !$this->check_perms(Acl::DELETE, $content); // you need delete rights to move an existing contact into an other addressbook |
|
| 2416 | 2413 | } |
| 2417 | 2414 | // set the unsupported fields from the backend to readonly |
| 2418 | - foreach($this->get_fields('unsupported',$content['id'],$content['owner']) as $field) |
|
| 2415 | + foreach ($this->get_fields('unsupported', $content['id'], $content['owner']) as $field) |
|
| 2419 | 2416 | { |
| 2420 | 2417 | $readonlys[$field] = true; |
| 2421 | 2418 | } |
@@ -2425,7 +2422,7 @@ discard block |
||
| 2425 | 2422 | $readonlys['__ALL__'] = true; |
| 2426 | 2423 | $readonlys['button[cancel]'] = false; |
| 2427 | 2424 | |
| 2428 | - foreach($this->own_account_acl as $field) |
|
| 2425 | + foreach ($this->own_account_acl as $field) |
|
| 2429 | 2426 | { |
| 2430 | 2427 | $readonlys[$field] = false; |
| 2431 | 2428 | } |
@@ -2447,9 +2444,9 @@ discard block |
||
| 2447 | 2444 | if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas']; |
| 2448 | 2445 | // disable not needed tabs |
| 2449 | 2446 | $readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']); |
| 2450 | - $readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts; |
|
| 2447 | + $readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'], $content['owner']) == $this->so_accounts; |
|
| 2451 | 2448 | $readonlys['tabs']['custom_private'] = $readonlys['tabs']['custom'] || !$this->config['private_cf_tab']; |
| 2452 | - $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; |
|
| 2449 | + $readonlys['tabs']['distribution_list'] = !$content['distrib_lists']; #false; |
|
| 2453 | 2450 | $readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] || |
| 2454 | 2451 | $this->account_repository != 'sql' && $content['account_id']; |
| 2455 | 2452 | if (!$content['id']) $readonlys['button[delete]'] = !$content['id']; |
@@ -2461,7 +2458,7 @@ discard block |
||
| 2461 | 2458 | { |
| 2462 | 2459 | $this->_set_readonlys_for_own_account_acl($readonlys, $content['id']); |
| 2463 | 2460 | } |
| 2464 | - for($i = -23; $i<=23; $i++) |
|
| 2461 | + for ($i = -23; $i <= 23; $i++) |
|
| 2465 | 2462 | { |
| 2466 | 2463 | $tz[$i] = ($i > 0 ? '+' : '').$i; |
| 2467 | 2464 | } |
@@ -2469,11 +2466,11 @@ discard block |
||
| 2469 | 2466 | $content['tz'] = $content['tz'] ? $content['tz'] : '0'; |
| 2470 | 2467 | if (count($this->content_types) > 1) |
| 2471 | 2468 | { |
| 2472 | - foreach($this->content_types as $type => $data) |
|
| 2469 | + foreach ($this->content_types as $type => $data) |
|
| 2473 | 2470 | { |
| 2474 | 2471 | $sel_options['tid'][$type] = $data['name']; |
| 2475 | 2472 | } |
| 2476 | - $content['typegfx'] = Api\Html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); |
|
| 2473 | + $content['typegfx'] = Api\Html::image('addressbook', $this->content_types[$content['tid']]['options']['icon'], '', ' width="16px" height="16px"'); |
|
| 2477 | 2474 | } |
| 2478 | 2475 | else |
| 2479 | 2476 | { |
@@ -2487,10 +2484,10 @@ discard block |
||
| 2487 | 2484 | ); |
| 2488 | 2485 | |
| 2489 | 2486 | // Links for deleted entries |
| 2490 | - if($content['tid'] == self::DELETED_TYPE) |
|
| 2487 | + if ($content['tid'] == self::DELETED_TYPE) |
|
| 2491 | 2488 | { |
| 2492 | 2489 | $content['link_to']['show_deleted'] = true; |
| 2493 | - if(!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge') |
|
| 2490 | + if (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge') |
|
| 2494 | 2491 | { |
| 2495 | 2492 | $readonlys['button[delete]'] = true; |
| 2496 | 2493 | } |
@@ -2499,33 +2496,33 @@ discard block |
||
| 2499 | 2496 | // Enable history |
| 2500 | 2497 | $this->setup_history($content, $sel_options); |
| 2501 | 2498 | |
| 2502 | - $content['photo'] = $this->photo_src($content['id'],$content['jpegphoto'],'photo',$content['etag']); |
|
| 2499 | + $content['photo'] = $this->photo_src($content['id'], $content['jpegphoto'], 'photo', $content['etag']); |
|
| 2503 | 2500 | |
| 2504 | 2501 | if ($content['private']) $content['owner'] .= 'p'; |
| 2505 | 2502 | |
| 2506 | 2503 | // for custom types, check if we have a custom edit template named "addressbook.edit.$type", $type is the name |
| 2507 | - if (in_array($content['tid'], array('n',self::DELETED_TYPE)) || !$this->tmpl->read('addressbook.edit.'.$this->content_types[$content['tid']]['name'])) |
|
| 2504 | + if (in_array($content['tid'], array('n', self::DELETED_TYPE)) || !$this->tmpl->read('addressbook.edit.'.$this->content_types[$content['tid']]['name'])) |
|
| 2508 | 2505 | { |
| 2509 | 2506 | $this->tmpl->read('addressbook.edit'); |
| 2510 | 2507 | } |
| 2511 | 2508 | |
| 2512 | 2509 | // allow other apps to add tabs to addressbook edit |
| 2513 | 2510 | $preserve = $content; |
| 2514 | - unset($preserve['jpegphoto'], $content['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 2511 | + unset($preserve['jpegphoto'], $content['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 2515 | 2512 | $this->tmpl->setElementAttribute('tabs', 'add_tabs', true); |
| 2516 | - $tabs =& $this->tmpl->getElementAttribute('tabs', 'tabs'); |
|
| 2513 | + $tabs = & $this->tmpl->getElementAttribute('tabs', 'tabs'); |
|
| 2517 | 2514 | if (($first_call = !isset($tabs))) |
| 2518 | 2515 | { |
| 2519 | 2516 | $tabs = array(); |
| 2520 | 2517 | } |
| 2521 | 2518 | //error_log(__LINE__.': '.__METHOD__."() first_call=$first_call"); |
| 2522 | - $hook_data = Api\Hooks::process(array('location' => 'addressbook_edit')+$content); |
|
| 2519 | + $hook_data = Api\Hooks::process(array('location' => 'addressbook_edit') + $content); |
|
| 2523 | 2520 | //error_log(__METHOD__."() hook_data=".array2string($hook_data)); |
| 2524 | - foreach($hook_data as $extra_tabs) |
|
| 2521 | + foreach ($hook_data as $extra_tabs) |
|
| 2525 | 2522 | { |
| 2526 | 2523 | if (!$extra_tabs) continue; |
| 2527 | 2524 | |
| 2528 | - foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 2525 | + foreach (isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 2529 | 2526 | { |
| 2530 | 2527 | if ($extra_tab['data'] && is_array($extra_tab['data'])) |
| 2531 | 2528 | { |
@@ -2570,15 +2567,15 @@ discard block |
||
| 2570 | 2567 | * @param array &$readonlys |
| 2571 | 2568 | * @param int $id |
| 2572 | 2569 | */ |
| 2573 | - function _set_readonlys_for_own_account_acl(&$readonlys,$id) |
|
| 2570 | + function _set_readonlys_for_own_account_acl(&$readonlys, $id) |
|
| 2574 | 2571 | { |
| 2575 | 2572 | // regular fields depending on the backend |
| 2576 | - foreach($this->get_fields('supported',$id,0) as $field) |
|
| 2573 | + foreach ($this->get_fields('supported', $id, 0) as $field) |
|
| 2577 | 2574 | { |
| 2578 | - if (!$this->own_account_acl || !in_array($field,$this->own_account_acl)) |
|
| 2575 | + if (!$this->own_account_acl || !in_array($field, $this->own_account_acl)) |
|
| 2579 | 2576 | { |
| 2580 | 2577 | $readonlys[$field] = true; |
| 2581 | - switch($field) |
|
| 2578 | + switch ($field) |
|
| 2582 | 2579 | { |
| 2583 | 2580 | case 'tel_work': |
| 2584 | 2581 | case 'tel_cell': |
@@ -2594,16 +2591,16 @@ discard block |
||
| 2594 | 2591 | // custom fields |
| 2595 | 2592 | if ($this->customfields) |
| 2596 | 2593 | { |
| 2597 | - foreach(array_keys($this->customfields) as $name) |
|
| 2594 | + foreach (array_keys($this->customfields) as $name) |
|
| 2598 | 2595 | { |
| 2599 | - if (!$this->own_account_acl || !in_array('#'.$name,$this->own_account_acl)) |
|
| 2596 | + if (!$this->own_account_acl || !in_array('#'.$name, $this->own_account_acl)) |
|
| 2600 | 2597 | { |
| 2601 | 2598 | $readonlys['#'.$name] = true; |
| 2602 | 2599 | } |
| 2603 | 2600 | } |
| 2604 | 2601 | } |
| 2605 | 2602 | // links |
| 2606 | - if (!$this->own_account_acl || !in_array('link_to',$this->own_account_acl)) |
|
| 2603 | + if (!$this->own_account_acl || !in_array('link_to', $this->own_account_acl)) |
|
| 2607 | 2604 | { |
| 2608 | 2605 | $readonlys['link_to'] = true; |
| 2609 | 2606 | } |
@@ -2621,10 +2618,10 @@ discard block |
||
| 2621 | 2618 | * 'data' => array of id => "full name (addressbook)" pairs |
| 2622 | 2619 | * 'fileas_options' |
| 2623 | 2620 | */ |
| 2624 | - public function ajax_check_values($values, $name, $own_id=0) |
|
| 2621 | + public function ajax_check_values($values, $name, $own_id = 0) |
|
| 2625 | 2622 | { |
| 2626 | 2623 | $matches = null; |
| 2627 | - $fields = explode(',',$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); |
|
| 2624 | + $fields = explode(',', $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); |
|
| 2628 | 2625 | |
| 2629 | 2626 | $ret = array('doublicates' => array(), 'msg' => null); |
| 2630 | 2627 | |
@@ -2648,17 +2645,17 @@ discard block |
||
| 2648 | 2645 | |
| 2649 | 2646 | // if name, firstname or org changed and enough are specified, check for doublicates |
| 2650 | 2647 | $specified_count = 0; |
| 2651 | - foreach($fields as $field) |
|
| 2648 | + foreach ($fields as $field) |
|
| 2652 | 2649 | { |
| 2653 | - if($values[trim($field)]) |
|
| 2650 | + if ($values[trim($field)]) |
|
| 2654 | 2651 | { |
| 2655 | 2652 | $specified_count++; |
| 2656 | 2653 | } |
| 2657 | 2654 | } |
| 2658 | - if (in_array($name,$fields) && $specified_count >= 2) |
|
| 2655 | + if (in_array($name, $fields) && $specified_count >= 2) |
|
| 2659 | 2656 | { |
| 2660 | 2657 | $filter = array(); |
| 2661 | - foreach($fields as $n) // use email too, to exclude obvious false positives |
|
| 2658 | + foreach ($fields as $n) // use email too, to exclude obvious false positives |
|
| 2662 | 2659 | { |
| 2663 | 2660 | if (!empty($values[$n])) $filter[$n] = $values[$n]; |
| 2664 | 2661 | } |
@@ -2667,7 +2664,7 @@ discard block |
||
| 2667 | 2664 | } |
| 2668 | 2665 | if ($contacts) |
| 2669 | 2666 | { |
| 2670 | - foreach($contacts as $contact) |
|
| 2667 | + foreach ($contacts as $contact) |
|
| 2671 | 2668 | { |
| 2672 | 2669 | if ($own_id && $contact['id'] == $own_id) continue; |
| 2673 | 2670 | |
@@ -2691,26 +2688,24 @@ discard block |
||
| 2691 | 2688 | * |
| 2692 | 2689 | * @param array $content |
| 2693 | 2690 | */ |
| 2694 | - function view(array $content=null) |
|
| 2691 | + function view(array $content = null) |
|
| 2695 | 2692 | { |
| 2696 | 2693 | // CRM list comes from content, request, or preference |
| 2697 | - $crm_list = $content['crm_list'] ? $content['crm_list'] : |
|
| 2698 | - ($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']); |
|
| 2699 | - if(!$crm_list || $crm_list == '~edit~') $crm_list = 'infolog'; |
|
| 2694 | + $crm_list = $content['crm_list'] ? $content['crm_list'] : ($_GET['crm_list'] ? $_GET['crm_list'] : $GLOBALS['egw_info']['user']['preferences']['addressbook']['crm_list']); |
|
| 2695 | + if (!$crm_list || $crm_list == '~edit~') $crm_list = 'infolog'; |
|
| 2700 | 2696 | |
| 2701 | - if(is_array($content)) |
|
| 2697 | + if (is_array($content)) |
|
| 2702 | 2698 | { |
| 2703 | 2699 | list($button) = each($content['button']); |
| 2704 | 2700 | switch ($content['toolbar'] ? $content['toolbar'] : $button) |
| 2705 | 2701 | { |
| 2706 | - case 'vcard': |
|
| 2707 | - Egw::redirect_link('/index.php','menuaction=addressbook.uivcard.out&ab_id=' .$content['id']); |
|
| 2702 | + case 'vcard' : Egw::redirect_link('/index.php', 'menuaction=addressbook.uivcard.out&ab_id='.$content['id']); |
|
| 2708 | 2703 | |
| 2709 | 2704 | case 'cancel': |
| 2710 | - Egw::redirect_link('/index.php','menuaction=addressbook.addressbook_ui.index&ajax=true'); |
|
| 2705 | + Egw::redirect_link('/index.php', 'menuaction=addressbook.addressbook_ui.index&ajax=true'); |
|
| 2711 | 2706 | |
| 2712 | 2707 | case 'delete': |
| 2713 | - Egw::redirect_link('/index.php',array( |
|
| 2708 | + Egw::redirect_link('/index.php', array( |
|
| 2714 | 2709 | 'menuaction' => 'addressbook.addressbook_ui.index', |
| 2715 | 2710 | 'msg' => $this->delete($content) ? lang('Contact deleted') : lang('Error deleting the contact !!!'), |
| 2716 | 2711 | )); |
@@ -2728,9 +2723,9 @@ discard block |
||
| 2728 | 2723 | $num_rows = $this->get_rows($query, $rows, $readonlys, true); |
| 2729 | 2724 | //error_log(__METHOD__."() get_rows()=$num_rows rows=".array2string($rows)); |
| 2730 | 2725 | $contact_id = $rows[0]; |
| 2731 | - if(!$contact_id || !is_array($content = $this->read($contact_id))) |
|
| 2726 | + if (!$contact_id || !is_array($content = $this->read($contact_id))) |
|
| 2732 | 2727 | { |
| 2733 | - Egw::redirect_link('/index.php',array( |
|
| 2728 | + Egw::redirect_link('/index.php', array( |
|
| 2734 | 2729 | 'menuaction' => 'addressbook.addressbook_ui.index', |
| 2735 | 2730 | 'msg' => $content, |
| 2736 | 2731 | 'ajax' => 'true' |
@@ -2739,14 +2734,14 @@ discard block |
||
| 2739 | 2734 | $content['index'] = $query['start']; |
| 2740 | 2735 | |
| 2741 | 2736 | // List nextmatch is already there, just update the filter |
| 2742 | - if($contact_id && Api\Json\Request::isJSONRequest()) |
|
| 2737 | + if ($contact_id && Api\Json\Request::isJSONRequest()) |
|
| 2743 | 2738 | { |
| 2744 | - switch($crm_list) |
|
| 2739 | + switch ($crm_list) |
|
| 2745 | 2740 | { |
| 2746 | 2741 | case 'infolog': |
| 2747 | 2742 | case 'tracker': |
| 2748 | 2743 | default: |
| 2749 | - Api\Json\Response::get()->apply('app.addressbook.view_set_list',Array(Array('action'=>'addressbook', 'action_id' => $contact_id))); |
|
| 2744 | + Api\Json\Response::get()->apply('app.addressbook.view_set_list', Array(Array('action'=>'addressbook', 'action_id' => $contact_id))); |
|
| 2750 | 2745 | break; |
| 2751 | 2746 | } |
| 2752 | 2747 | |
@@ -2777,13 +2772,13 @@ discard block |
||
| 2777 | 2772 | $_GET['index'] = 0; |
| 2778 | 2773 | } |
| 2779 | 2774 | $contact_id = $_GET['contact_id'] ? $_GET['contact_id'] : ((int)$_GET['account_id'] ? 'account:'.(int)$_GET['account_id'] : 0); |
| 2780 | - if(!$contact_id || !is_array($content = $this->read($contact_id))) |
|
| 2775 | + if (!$contact_id || !is_array($content = $this->read($contact_id))) |
|
| 2781 | 2776 | { |
| 2782 | - Egw::redirect_link('/index.php',array( |
|
| 2777 | + Egw::redirect_link('/index.php', array( |
|
| 2783 | 2778 | 'menuaction' => 'addressbook.addressbook_ui.index', |
| 2784 | 2779 | 'msg' => $content, |
| 2785 | 2780 | 'ajax' => 'true' |
| 2786 | - )+(isset($_GET['search']) ? array('search' => $_GET['search']) : array())); |
|
| 2781 | + ) + (isset($_GET['search']) ? array('search' => $_GET['search']) : array())); |
|
| 2787 | 2782 | } |
| 2788 | 2783 | if (isset($_GET['index'])) |
| 2789 | 2784 | { |
@@ -2796,25 +2791,25 @@ discard block |
||
| 2796 | 2791 | $num_rows = $this->get_rows($query, $rows, $readonlys, true); |
| 2797 | 2792 | } |
| 2798 | 2793 | } |
| 2799 | - $content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 2794 | + $content['jpegphoto'] = !empty($content['jpegphoto']); // unused and messes up json encoding (not utf-8) |
|
| 2800 | 2795 | |
| 2801 | 2796 | // make everything not explicit mentioned readonly |
| 2802 | 2797 | $readonlys['__ALL__'] = true; |
| 2803 | 2798 | $readonlys['photo'] = $readonlys['button[cancel]'] = $readonlys['button[copy]'] = |
| 2804 | 2799 | $readonlys['button[ok]'] = $readonlys['button[more]'] = $readonlys['toolbar'] = false; |
| 2805 | 2800 | |
| 2806 | - foreach(array_keys($this->contact_fields) as $key) |
|
| 2801 | + foreach (array_keys($this->contact_fields) as $key) |
|
| 2807 | 2802 | { |
| 2808 | - if (in_array($key,array('tel_home','tel_work','tel_cell','tel_fax'))) |
|
| 2803 | + if (in_array($key, array('tel_home', 'tel_work', 'tel_cell', 'tel_fax'))) |
|
| 2809 | 2804 | { |
| 2810 | 2805 | $content[$key.'2'] = $content[$key]; |
| 2811 | 2806 | } |
| 2812 | 2807 | } |
| 2813 | 2808 | |
| 2814 | 2809 | // respect category permissions |
| 2815 | - if(!empty($content['cat_id'])) |
|
| 2810 | + if (!empty($content['cat_id'])) |
|
| 2816 | 2811 | { |
| 2817 | - $content['cat_id'] = $this->categories->check_list(Acl::READ,$content['cat_id']); |
|
| 2812 | + $content['cat_id'] = $this->categories->check_list(Acl::READ, $content['cat_id']); |
|
| 2818 | 2813 | } |
| 2819 | 2814 | $content['cat_id_tree'] = $content['cat_id']; |
| 2820 | 2815 | |
@@ -2824,12 +2819,12 @@ discard block |
||
| 2824 | 2819 | 'to_id' => $content['id'], |
| 2825 | 2820 | ); |
| 2826 | 2821 | // Links for deleted entries |
| 2827 | - if($content['tid'] == self::DELETED_TYPE) |
|
| 2822 | + if ($content['tid'] == self::DELETED_TYPE) |
|
| 2828 | 2823 | { |
| 2829 | 2824 | $content['link_to']['show_deleted'] = true; |
| 2830 | 2825 | } |
| 2831 | - $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(Acl::DELETE,$content); |
|
| 2832 | - $readonlys['button[edit]'] = !$this->check_perms(Acl::EDIT,$content); |
|
| 2826 | + $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(Acl::DELETE, $content); |
|
| 2827 | + $readonlys['button[edit]'] = !$this->check_perms(Acl::EDIT, $content); |
|
| 2833 | 2828 | |
| 2834 | 2829 | // how to display addresses |
| 2835 | 2830 | $content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']); |
@@ -2837,7 +2832,7 @@ discard block |
||
| 2837 | 2832 | |
| 2838 | 2833 | $sel_options['fileas_type'][$content['fileas_type']] = $this->fileas($content); |
| 2839 | 2834 | $sel_options['owner'] = $this->get_addressbooks(); |
| 2840 | - for($i = -23; $i<=23; $i++) |
|
| 2835 | + for ($i = -23; $i <= 23; $i++) |
|
| 2841 | 2836 | { |
| 2842 | 2837 | $tz[$i] = ($i > 0 ? '+' : '').$i; |
| 2843 | 2838 | } |
@@ -2845,11 +2840,11 @@ discard block |
||
| 2845 | 2840 | $content['tz'] = $content['tz'] ? $content['tz'] : 0; |
| 2846 | 2841 | if (count($this->content_types) > 1) |
| 2847 | 2842 | { |
| 2848 | - foreach($this->content_types as $type => $data) |
|
| 2843 | + foreach ($this->content_types as $type => $data) |
|
| 2849 | 2844 | { |
| 2850 | 2845 | $sel_options['tid'][$type] = $data['name']; |
| 2851 | 2846 | } |
| 2852 | - $content['typegfx'] = Api\Html::image('addressbook',$this->content_types[$content['tid']]['options']['icon'],'',' width="16px" height="16px"'); |
|
| 2847 | + $content['typegfx'] = Api\Html::image('addressbook', $this->content_types[$content['tid']]['options']['icon'], '', ' width="16px" height="16px"'); |
|
| 2853 | 2848 | } |
| 2854 | 2849 | else |
| 2855 | 2850 | { |
@@ -2866,7 +2861,7 @@ discard block |
||
| 2866 | 2861 | { |
| 2867 | 2862 | $content['owner'] .= 'p'; |
| 2868 | 2863 | } |
| 2869 | - $this->tmpl->set_cell_attribute('change_org','disabled',true); |
|
| 2864 | + $this->tmpl->set_cell_attribute('change_org', 'disabled', true); |
|
| 2870 | 2865 | |
| 2871 | 2866 | // Prevent double countries - invalid code blanks it, disabling doesn't work |
| 2872 | 2867 | $content['adr_one_countrycode'] = '-'; |
@@ -2879,14 +2874,14 @@ discard block |
||
| 2879 | 2874 | $readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']); |
| 2880 | 2875 | $readonlys['tabs']['custom'] = !$this->customfields; |
| 2881 | 2876 | $readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; |
| 2882 | - $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; |
|
| 2877 | + $readonlys['tabs']['distribution_list'] = !$content['distrib_lists']; #false; |
|
| 2883 | 2878 | $readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] || |
| 2884 | 2879 | $this->account_repository != 'sql' && $content['account_id']; |
| 2885 | 2880 | if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; |
| 2886 | 2881 | |
| 2887 | 2882 | // last and next calendar date |
| 2888 | - if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); |
|
| 2889 | - if(is_array($dates)) $content += $dates; |
|
| 2883 | + if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']), false)); |
|
| 2884 | + if (is_array($dates)) $content += $dates; |
|
| 2890 | 2885 | |
| 2891 | 2886 | // Disable importexport |
| 2892 | 2887 | $GLOBALS['egw_info']['flags']['disable_importexport']['export'] = true; |
@@ -2928,7 +2923,7 @@ discard block |
||
| 2928 | 2923 | { |
| 2929 | 2924 | unset($actions['back']); |
| 2930 | 2925 | } |
| 2931 | - if (!isset($content['index']) || $content['index'] >= $num_rows-1) |
|
| 2926 | + if (!isset($content['index']) || $content['index'] >= $num_rows - 1) |
|
| 2932 | 2927 | { |
| 2933 | 2928 | unset($actions['next']); |
| 2934 | 2929 | } |
@@ -2940,7 +2935,7 @@ discard block |
||
| 2940 | 2935 | // need to load list's app.js now, as exec calls header before other app can include it |
| 2941 | 2936 | Framework::includeJS('/'.$crm_list.'/js/app.js'); |
| 2942 | 2937 | |
| 2943 | - $this->tmpl->exec('addressbook.addressbook_ui.view',$content,$sel_options,$readonlys,array( |
|
| 2938 | + $this->tmpl->exec('addressbook.addressbook_ui.view', $content, $sel_options, $readonlys, array( |
|
| 2944 | 2939 | 'id' => $content['id'], |
| 2945 | 2940 | 'index' => $content['index'], |
| 2946 | 2941 | 'crm_list' => $crm_list |
@@ -2948,12 +2943,12 @@ discard block |
||
| 2948 | 2943 | |
| 2949 | 2944 | // Only load this on first time - we're using AJAX, so it stays there through submits. |
| 2950 | 2945 | // Sending it again (via ajax) will break the addressbook.view etemplate2 |
| 2951 | - if($contact_id) |
|
| 2946 | + if ($contact_id) |
|
| 2952 | 2947 | { |
| 2953 | 2948 | Api\Hooks::single(array( |
| 2954 | 2949 | 'location' => 'addressbook_view', |
| 2955 | 2950 | 'ab_id' => $content['id'] |
| 2956 | - ),$crm_list); |
|
| 2951 | + ), $crm_list); |
|
| 2957 | 2952 | } |
| 2958 | 2953 | } |
| 2959 | 2954 | |
@@ -2965,30 +2960,30 @@ discard block |
||
| 2965 | 2960 | */ |
| 2966 | 2961 | function email2link($email) |
| 2967 | 2962 | { |
| 2968 | - if (strpos($email,'@') == false) return ''; |
|
| 2963 | + if (strpos($email, '@') == false) return ''; |
|
| 2969 | 2964 | |
| 2970 | - if($GLOBALS['egw_info']['user']['apps']['mail']) |
|
| 2965 | + if ($GLOBALS['egw_info']['user']['apps']['mail']) |
|
| 2971 | 2966 | { |
| 2972 | 2967 | return array( |
| 2973 | 2968 | 'menuaction' => 'mail.mail_compose.compose', |
| 2974 | 2969 | 'send_to' => base64_encode($email) |
| 2975 | 2970 | ); |
| 2976 | 2971 | } |
| 2977 | - if($GLOBALS['egw_info']['user']['apps']['felamimail']) |
|
| 2972 | + if ($GLOBALS['egw_info']['user']['apps']['felamimail']) |
|
| 2978 | 2973 | { |
| 2979 | 2974 | return array( |
| 2980 | 2975 | 'menuaction' => 'felamimail.uicompose.compose', |
| 2981 | 2976 | 'send_to' => base64_encode($email) |
| 2982 | 2977 | ); |
| 2983 | 2978 | } |
| 2984 | - if($GLOBALS['egw_info']['user']['apps']['email']) |
|
| 2979 | + if ($GLOBALS['egw_info']['user']['apps']['email']) |
|
| 2985 | 2980 | { |
| 2986 | 2981 | return array( |
| 2987 | 2982 | 'menuaction' => 'email.uicompose.compose', |
| 2988 | 2983 | 'to' => $email, |
| 2989 | 2984 | ); |
| 2990 | 2985 | } |
| 2991 | - return 'mailto:' . $email; |
|
| 2986 | + return 'mailto:'.$email; |
|
| 2992 | 2987 | } |
| 2993 | 2988 | |
| 2994 | 2989 | /** |
@@ -2997,9 +2992,9 @@ discard block |
||
| 2997 | 2992 | * @param array $_content |
| 2998 | 2993 | * @return string |
| 2999 | 2994 | */ |
| 3000 | - function search($_content=array()) |
|
| 2995 | + function search($_content = array()) |
|
| 3001 | 2996 | { |
| 3002 | - if(!empty($_content)) |
|
| 2997 | + if (!empty($_content)) |
|
| 3003 | 2998 | { |
| 3004 | 2999 | |
| 3005 | 3000 | $_content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $_content['cat_id_tree'] : $_content['cat_id']; |
@@ -3014,10 +3009,10 @@ discard block |
||
| 3014 | 3009 | } |
| 3015 | 3010 | else |
| 3016 | 3011 | { |
| 3017 | - $query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select')))); |
|
| 3012 | + $query['advanced_search'] = array_intersect_key($_content, array_flip(array_merge($this->get_contact_columns(), array('operator', 'meth_select')))); |
|
| 3018 | 3013 | foreach ($query['advanced_search'] as $key => $value) |
| 3019 | 3014 | { |
| 3020 | - if(!$value) unset($query['advanced_search'][$key]); |
|
| 3015 | + if (!$value) unset($query['advanced_search'][$key]); |
|
| 3021 | 3016 | } |
| 3022 | 3017 | // Skip n_fn, it causes problems in sql |
| 3023 | 3018 | unset($query['advanced_search']['n_fn']); |
@@ -3033,7 +3028,7 @@ discard block |
||
| 3033 | 3028 | $response->call("app.addressbook.adv_search", array('advanced_search' => $_content['button']['search'] ? $query['advanced_search'] : '')); |
| 3034 | 3029 | if ($_content['button']['cancelsearch']) |
| 3035 | 3030 | { |
| 3036 | - Framework::window_close (); |
|
| 3031 | + Framework::window_close(); |
|
| 3037 | 3032 | |
| 3038 | 3033 | // No need to reload popup |
| 3039 | 3034 | return; |
@@ -3050,7 +3045,7 @@ discard block |
||
| 3050 | 3045 | // Avoid ID conflict with tree & selectboxes |
| 3051 | 3046 | $content['cat_id_tree'] = $content['cat_id']; |
| 3052 | 3047 | |
| 3053 | - for($i = -23; $i<=23; $i++) |
|
| 3048 | + for ($i = -23; $i <= 23; $i++) |
|
| 3054 | 3049 | { |
| 3055 | 3050 | $tz[$i] = ($i > 0 ? '+' : '').$i; |
| 3056 | 3051 | } |
@@ -3059,8 +3054,8 @@ discard block |
||
| 3059 | 3054 | //foreach($this->content_types as $type => $data) $sel_options['tid'][$type] = $data['name']; |
| 3060 | 3055 | |
| 3061 | 3056 | // configure search options |
| 3062 | - $sel_options['owner'] = $this->get_addressbooks(Acl::READ,lang('all')); |
|
| 3063 | - $sel_options['operator'] = array( |
|
| 3057 | + $sel_options['owner'] = $this->get_addressbooks(Acl::READ, lang('all')); |
|
| 3058 | + $sel_options['operator'] = array( |
|
| 3064 | 3059 | 'AND' => 'AND', |
| 3065 | 3060 | 'OR' => 'OR', |
| 3066 | 3061 | ); |
@@ -3070,12 +3065,12 @@ discard block |
||
| 3070 | 3065 | ); |
| 3071 | 3066 | if ($this->customfields) |
| 3072 | 3067 | { |
| 3073 | - foreach($this->customfields as $name => $data) |
|
| 3068 | + foreach ($this->customfields as $name => $data) |
|
| 3074 | 3069 | { |
| 3075 | 3070 | if (substr($data['type'], 0, 6) == 'select' && !($data['rows'] > 1)) |
| 3076 | 3071 | { |
| 3077 | 3072 | if (!isset($content['#'.$name])) $content['#'.$name] = ''; |
| 3078 | - if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one'); |
|
| 3073 | + if (!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one'); |
|
| 3079 | 3074 | } |
| 3080 | 3075 | // Make them not required, otherwise you can't search |
| 3081 | 3076 | $this->tmpl->setElementAttribute('#'.$name, 'needed', FALSE); |
@@ -3101,8 +3096,8 @@ discard block |
||
| 3101 | 3096 | |
| 3102 | 3097 | if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; |
| 3103 | 3098 | |
| 3104 | - $this->tmpl->set_cell_attribute('change_org','disabled',true); |
|
| 3105 | - return $this->tmpl->exec('addressbook.addressbook_ui.search',$content,$sel_options,$readonlys,array(),2); |
|
| 3099 | + $this->tmpl->set_cell_attribute('change_org', 'disabled', true); |
|
| 3100 | + return $this->tmpl->exec('addressbook.addressbook_ui.search', $content, $sel_options, $readonlys, array(), 2); |
|
| 3106 | 3101 | } |
| 3107 | 3102 | |
| 3108 | 3103 | /** |
@@ -3111,12 +3106,12 @@ discard block |
||
| 3111 | 3106 | * |
| 3112 | 3107 | * @param type $contact_id |
| 3113 | 3108 | */ |
| 3114 | - function ajax_noPhotoExists ($contact_id) |
|
| 3109 | + function ajax_noPhotoExists($contact_id) |
|
| 3115 | 3110 | { |
| 3116 | 3111 | $response = Api\Json\Response::get(); |
| 3117 | 3112 | $response->data((!($contact = $this->read($contact_id)) || |
| 3118 | - empty($contact['jpegphoto']) && !(($contact['files'] & Api\Contacts::FILES_BIT_PHOTO) && |
|
| 3119 | - ($size = filesize($url=Api\Link::vfs_path('addressbook', $contact_id, Api\Contacts::FILES_PHOTO)))))); |
|
| 3113 | + empty($contact['jpegphoto']) && !(($contact['files']&Api\Contacts::FILES_BIT_PHOTO) && |
|
| 3114 | + ($size = filesize($url = Api\Link::vfs_path('addressbook', $contact_id, Api\Contacts::FILES_PHOTO)))))); |
|
| 3120 | 3115 | } |
| 3121 | 3116 | |
| 3122 | 3117 | /** |
@@ -3125,13 +3120,13 @@ discard block |
||
| 3125 | 3120 | * @param string $etemplate_exec_id to update id, files, etag, ... |
| 3126 | 3121 | * @param file string $file null means to delete |
| 3127 | 3122 | */ |
| 3128 | - function ajax_update_photo ($etemplate_exec_id, $file) |
|
| 3123 | + function ajax_update_photo($etemplate_exec_id, $file) |
|
| 3129 | 3124 | { |
| 3130 | 3125 | $et_request = Api\Etemplate\Request::read($etemplate_exec_id); |
| 3131 | 3126 | $response = Api\Json\Response::get(); |
| 3132 | 3127 | if ($file) |
| 3133 | 3128 | { |
| 3134 | - $filteredFile = substr($file, strpos($file, ",")+1); |
|
| 3129 | + $filteredFile = substr($file, strpos($file, ",") + 1); |
|
| 3135 | 3130 | // resize photo if wider then default width of 240pixel (keeping aspect ratio) |
| 3136 | 3131 | $decoded = $this->resize_photo(base64_decode($filteredFile)); |
| 3137 | 3132 | } |
@@ -3139,7 +3134,7 @@ discard block |
||
| 3139 | 3134 | // add photo into current eT2 request |
| 3140 | 3135 | $et_request->preserv = array_merge($et_request->preserv, array( |
| 3141 | 3136 | 'jpegphoto' => is_null($file) ? $file : $decoded, |
| 3142 | - 'photo_unchanged' => false, // hint photo is changed |
|
| 3137 | + 'photo_unchanged' => false, // hint photo is changed |
|
| 3143 | 3138 | )); |
| 3144 | 3139 | } |
| 3145 | 3140 | |
@@ -3154,14 +3149,14 @@ discard block |
||
| 3154 | 3149 | public function pubkey_uploaded(array $file, $widget_id, Api\Etemplate\Request $request, Api\Json\Response $response) |
| 3155 | 3150 | { |
| 3156 | 3151 | //error_log(__METHOD__."(".array2string($file).", ...) widget_id=$widget_id, id=".$request->content['id'].", files=".$request->content['files']); |
| 3157 | - unset($file, $response); // not used, but required by function signature |
|
| 3158 | - list(,,$path) = explode(':', $widget_id); |
|
| 3152 | + unset($file, $response); // not used, but required by function signature |
|
| 3153 | + list(,, $path) = explode(':', $widget_id); |
|
| 3159 | 3154 | $bit = $path === Api\Contacts::FILES_PGP_PUBKEY ? Api\Contacts::FILES_BIT_PGP_PUBKEY : Api\Contacts::FILES_BIT_SMIME_PUBKEY; |
| 3160 | - if (!($request->content['files'] & $bit) && $this->check_perms(Acl::EDIT, $request->content)) |
|
| 3155 | + if (!($request->content['files']&$bit) && $this->check_perms(Acl::EDIT, $request->content)) |
|
| 3161 | 3156 | { |
| 3162 | 3157 | $content = $request->content; |
| 3163 | 3158 | $content['files'] |= $bit; |
| 3164 | - $content['photo_unchanged'] = true; // hint no need to store photo |
|
| 3159 | + $content['photo_unchanged'] = true; // hint no need to store photo |
|
| 3165 | 3160 | if ($this->save($content)) |
| 3166 | 3161 | { |
| 3167 | 3162 | $changed = array_diff_assoc($content, $request->content); |
@@ -3179,19 +3174,18 @@ discard block |
||
| 3179 | 3174 | function photo() |
| 3180 | 3175 | { |
| 3181 | 3176 | ob_start(); |
| 3182 | - $contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : |
|
| 3183 | - (isset($_GET['account_id']) ? 'account:'.$_GET['account_id'] : 0); |
|
| 3177 | + $contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : (isset($_GET['account_id']) ? 'account:'.$_GET['account_id'] : 0); |
|
| 3184 | 3178 | |
| 3185 | - if (substr($contact_id,0,8) == 'account:') |
|
| 3179 | + if (substr($contact_id, 0, 8) == 'account:') |
|
| 3186 | 3180 | { |
| 3187 | - $contact_id = $GLOBALS['egw']->accounts->id2name(substr($contact_id,8),'person_id'); |
|
| 3181 | + $contact_id = $GLOBALS['egw']->accounts->id2name(substr($contact_id, 8), 'person_id'); |
|
| 3188 | 3182 | } |
| 3189 | 3183 | if (!($contact = $this->read($contact_id)) || |
| 3190 | - empty($contact['jpegphoto']) && // LDAP/AD (not updated SQL) |
|
| 3191 | - !(($contact['files'] & Api\Contacts::FILES_BIT_PHOTO) && // new SQL in VFS |
|
| 3192 | - ($size = filesize($url=Api\Link::vfs_path('addressbook', $contact_id, Api\Contacts::FILES_PHOTO))))) |
|
| 3184 | + empty($contact['jpegphoto']) && // LDAP/AD (not updated SQL) |
|
| 3185 | + !(($contact['files']&Api\Contacts::FILES_BIT_PHOTO) && // new SQL in VFS |
|
| 3186 | + ($size = filesize($url = Api\Link::vfs_path('addressbook', $contact_id, Api\Contacts::FILES_PHOTO))))) |
|
| 3193 | 3187 | { |
| 3194 | - Egw::redirect(Api\Image::find('addressbook','photo')); |
|
| 3188 | + Egw::redirect(Api\Image::find('addressbook', 'photo')); |
|
| 3195 | 3189 | } |
| 3196 | 3190 | // use an etag over the image mapp |
| 3197 | 3191 | $etag = '"'.$contact_id.':'.$contact['etag'].'"'; |
@@ -3203,14 +3197,14 @@ discard block |
||
| 3203 | 3197 | // different url with different etag parameter will force a reload |
| 3204 | 3198 | if (isset($_GET['etag'])) |
| 3205 | 3199 | { |
| 3206 | - Api\Session::cache_control(30*86400); // cache for 30 days |
|
| 3200 | + Api\Session::cache_control(30 * 86400); // cache for 30 days |
|
| 3207 | 3201 | } |
| 3208 | 3202 | // if servers send a If-None-Match header, response with 304 Not Modified, if etag matches |
| 3209 | 3203 | if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag) |
| 3210 | 3204 | { |
| 3211 | 3205 | header("HTTP/1.1 304 Not Modified"); |
| 3212 | 3206 | } |
| 3213 | - elseif(!empty($contact['jpegphoto'])) |
|
| 3207 | + elseif (!empty($contact['jpegphoto'])) |
|
| 3214 | 3208 | { |
| 3215 | 3209 | header('Content-length: '.bytes($contact['jpegphoto'])); |
| 3216 | 3210 | echo $contact['jpegphoto']; |
@@ -3260,15 +3254,15 @@ discard block |
||
| 3260 | 3254 | echo $GLOBALS['egw']->framework->navbar(); |
| 3261 | 3255 | |
| 3262 | 3256 | // check if user has admin rights AND if a valid fileas type is given (Security) |
| 3263 | - if (!$this->is_admin() || $_GET['type'] != '' && !in_array($_GET['type'],$this->fileas_types)) |
|
| 3257 | + if (!$this->is_admin() || $_GET['type'] != '' && !in_array($_GET['type'], $this->fileas_types)) |
|
| 3264 | 3258 | { |
| 3265 | 3259 | echo '<h1>'.lang('Permission denied !!!')."</h1>\n"; |
| 3266 | 3260 | } |
| 3267 | 3261 | else |
| 3268 | 3262 | { |
| 3269 | 3263 | $errors = null; |
| 3270 | - $updated = parent::set_all_fileas($_GET['type'],(boolean)$_GET['all'],$errors,true); // true = ignore Acl |
|
| 3271 | - echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).',$updated,$errors)."</b></p>\n"; |
|
| 3264 | + $updated = parent::set_all_fileas($_GET['type'], (boolean)$_GET['all'], $errors, true); // true = ignore Acl |
|
| 3265 | + echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).', $updated, $errors)."</b></p>\n"; |
|
| 3272 | 3266 | } |
| 3273 | 3267 | echo $GLOBALS['egw']->framework->footer(); |
| 3274 | 3268 | } |
@@ -3292,8 +3286,8 @@ discard block |
||
| 3292 | 3286 | else |
| 3293 | 3287 | { |
| 3294 | 3288 | $errors = null; |
| 3295 | - $updated = parent::set_all_cleanup($errors,true); // true = ignore Acl |
|
| 3296 | - echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).',$updated,$errors)."</b></p>\n"; |
|
| 3289 | + $updated = parent::set_all_cleanup($errors, true); // true = ignore Acl |
|
| 3290 | + echo '<p style="margin-top: 20px;"><b>'.lang('%1 contacts updated (%2 errors).', $updated, $errors)."</b></p>\n"; |
|
| 3297 | 3291 | } |
| 3298 | 3292 | echo $GLOBALS['egw']->framework->footer(); |
| 3299 | 3293 | } |
@@ -3306,7 +3300,7 @@ discard block |
||
| 3306 | 3300 | if ($this->contact_repository == 'ldap' || !$content['id'] || |
| 3307 | 3301 | $this->account_repository == 'ldap' && $content['account_id']) |
| 3308 | 3302 | { |
| 3309 | - return; // no history for ldap as history table only allows integer id's |
|
| 3303 | + return; // no history for ldap as history table only allows integer id's |
|
| 3310 | 3304 | } |
| 3311 | 3305 | $content['history'] = array( |
| 3312 | 3306 | 'id' => $content['id'], |
@@ -3321,7 +3315,7 @@ discard block |
||
| 3321 | 3315 | ), |
| 3322 | 3316 | ); |
| 3323 | 3317 | |
| 3324 | - foreach($this->content_types as $id => $settings) |
|
| 3318 | + foreach ($this->content_types as $id => $settings) |
|
| 3325 | 3319 | { |
| 3326 | 3320 | $content['history']['status-widgets']['tid'][$id] = $settings['name']; |
| 3327 | 3321 | } |