@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function read_object($person) |
134 | 134 | { |
135 | - if ( !is_object($person) |
|
135 | + if (!is_object($person) |
|
136 | 136 | || !midcom::get()->dbfactory->is_a($person, 'midcom_db_person')) { |
137 | 137 | // Given $person is not one |
138 | 138 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - if ( $this->_config->get('jabber_enable_presence') |
|
159 | + if ($this->_config->get('jabber_enable_presence') |
|
160 | 160 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
161 | 161 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
162 | 162 | } |
163 | 163 | |
164 | - if ( $this->_config->get('skype_enable_presence') |
|
164 | + if ($this->_config->get('skype_enable_presence') |
|
165 | 165 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
166 | 166 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
167 | 167 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | // Show picture |
238 | 238 | // TODO: Implement photo also in local way |
239 | - if ( $this->_config->get('gravatar_enable') |
|
239 | + if ($this->_config->get('gravatar_enable') |
|
240 | 240 | && !empty($this->contact_details['email'])) { |
241 | 241 | $size = $this->_config->get('gravatar_size'); |
242 | 242 | $gravatar_url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($this->contact_details['email']) . "&size=" . $size; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | private function _show_groups() |
317 | 317 | { |
318 | - if ( !$this->show_groups |
|
318 | + if (!$this->show_groups |
|
319 | 319 | || empty($this->contact_details['id'])) { |
320 | 320 | return; |
321 | 321 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $cards_to_show[] = $cardname; |
382 | 382 | } |
383 | 383 | } else { |
384 | - if ( $customer->$property |
|
384 | + if ($customer->$property |
|
385 | 385 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
386 | 386 | $inherited_cards_only = false; |
387 | 387 | $multiple_addresses = true; |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | |
404 | 404 | foreach ($cards_to_show as $cardname) { |
405 | 405 | echo '<div class="vcard">'; |
406 | - if ( $multiple_addresses |
|
407 | - || ( $cardname != 'visiting' |
|
406 | + if ($multiple_addresses |
|
407 | + || ($cardname != 'visiting' |
|
408 | 408 | && !$inherited_cards_only)) { |
409 | 409 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
410 | 410 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $workflow = $this->get_workflow('datamanager2', array('controller' => $data['controller'])); |
56 | 56 | $response = $workflow->run(); |
57 | 57 | |
58 | - if ( $workflow->get_state() == 'save' |
|
58 | + if ($workflow->get_state() == 'save' |
|
59 | 59 | && $this->_master->create_account($this->person, $data["controller"]->formmanager)) { |
60 | 60 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('person %s created'), $this->person->name)); |
61 | 61 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $accounthelper = new org_openpsa_user_accounthelper($this->person); |
155 | 155 | |
156 | 156 | // Update account |
157 | - if ( !$accounthelper->set_account($formmanager->get_value("username"), $password) |
|
157 | + if (!$accounthelper->set_account($formmanager->get_value("username"), $password) |
|
158 | 158 | && midcom_connection::get_error() != MGD_ERR_OK) { |
159 | 159 | // Failure, give a message |
160 | 160 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get("failed to update the user account, reason") . ': ' . midcom_connection::get_error_string(), 'error'); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $filename = $generator->from_string($this->invoice->get_label()) . '.pdf'; |
88 | 88 | |
89 | 89 | // tmp filename |
90 | - $tmp_file = midcom::get()->config->get('midcom_tempdir') . "/". $filename; |
|
90 | + $tmp_file = midcom::get()->config->get('midcom_tempdir') . "/" . $filename; |
|
91 | 91 | |
92 | 92 | // render pdf to tmp filename |
93 | 93 | $pdf_builder->render($tmp_file); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $attachment->update(); |
101 | 101 | } else { |
102 | 102 | $attachment = $this->invoice->create_attachment($filename, $this->invoice->get_label(), "application/pdf"); |
103 | - if ( !$attachment |
|
103 | + if (!$attachment |
|
104 | 104 | || !$this->invoice->set_parameter("midcom.helper.datamanager2.type.blobs", "guids_pdf_file", $attachment->guid . ":" . $attachment->guid)) { |
105 | 105 | throw new midcom_error("Failed to create invoice attachment for pdf"); |
106 | 106 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | |
59 | 59 | if (midcom::get()->config->get('enable_ajax_editing')) { |
60 | 60 | $data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
61 | - $data['controller']->schemadb =& $data['schemadb_product']; |
|
61 | + $data['controller']->schemadb = & $data['schemadb_product']; |
|
62 | 62 | $data['controller']->set_storage($this->_product); |
63 | 63 | $data['controller']->process_ajax(); |
64 | 64 | $data['datamanager'] = $data['controller']->datamanager; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $new_password_encrypted = midcom_connection::prepare_password($new_password); |
147 | 147 | |
148 | 148 | //check if the new encrypted password was already used |
149 | - if ( $this->check_password_reuse($new_password_encrypted) |
|
149 | + if ($this->check_password_reuse($new_password_encrypted) |
|
150 | 150 | && $this->check_password_strength($new_password)) { |
151 | 151 | $this->_save_old_password(); |
152 | 152 | $account->set_password($new_password); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | for ($i = 0; $i < strlen($password); $i++) { |
337 | 337 | $repeated = true; |
338 | 338 | for ($j = 0; $j < $plen && ($j + $i + $plen) < strlen($password); $j++) { |
339 | - if ( (substr($password, $j + $i, 1) == substr($password, $j + $i + $plen, 1)) |
|
339 | + if ((substr($password, $j + $i, 1) == substr($password, $j + $i + $plen, 1)) |
|
340 | 340 | && $repeated) { |
341 | 341 | $repeated = true; |
342 | 342 | } else { |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | public static function get_person_by_formdata($data) |
480 | 480 | { |
481 | - if ( empty($data['username']) |
|
481 | + if (empty($data['username']) |
|
482 | 482 | || empty($data['password'])) { |
483 | 483 | return false; |
484 | 484 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $max_attempts = midcom_baseclasses_components_configuration::get($component, 'config')->get('max_password_attempts'); |
513 | 513 | $timeframe = midcom_baseclasses_components_configuration::get($component, 'config')->get('password_block_timeframe_min'); |
514 | 514 | |
515 | - if ( $max_attempts == 0 |
|
515 | + if ($max_attempts == 0 |
|
516 | 516 | || $timeframe == 0) { |
517 | 517 | return $stat; |
518 | 518 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * If the maximum number of attemps is reached and the oldest attempt |
535 | 535 | * on the stack is within our defined timeframe, we block the account |
536 | 536 | */ |
537 | - if ( count($attempts) >= $max_attempts |
|
537 | + if (count($attempts) >= $max_attempts |
|
538 | 538 | && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60))) { |
539 | 539 | $this->disable_account(); |
540 | 540 | $stat = false; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | $reflector = midcom_helper_reflector::get($linked_object); |
124 | - $link_html = "<a href='" . midcom::get()->permalinks->create_permalink($linked_object->guid) . "'>" . $reflector->get_object_label($linked_object) ."</a>"; |
|
124 | + $link_html = "<a href='" . midcom::get()->permalinks->create_permalink($linked_object->guid) . "'>" . $reflector->get_object_label($linked_object) . "</a>"; |
|
125 | 125 | $data['linked_objects'][$entry->linkGuid] = $link_html; |
126 | 126 | $data['linked_raw_objects'][$entry->linkGuid] = $reflector->get_object_label($linked_object); |
127 | 127 | } |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | //check if there is a page & rows - parameter passed - if add them to qb |
152 | 152 | if (array_key_exists('page', $_POST) && array_key_exists('rows', $_POST)) { |
153 | 153 | $this->_request_data['page'] = $_POST['page']; |
154 | - $this->qb->set_limit((int)$_POST['rows']); |
|
155 | - $offset = ((int)$_POST['page'] - 1) * (int)$_POST['rows']; |
|
154 | + $this->qb->set_limit((int) $_POST['rows']); |
|
155 | + $offset = ((int) $_POST['page'] - 1) * (int) $_POST['rows']; |
|
156 | 156 | $this->qb->set_offset($offset); |
157 | 157 | } |
158 | 158 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | { |
31 | 31 | $classes = array(); |
32 | 32 | foreach (midcom_connection::get_schema_types() as $mgdschema) { |
33 | - if ( substr($mgdschema, 0, 2) == '__' |
|
34 | - || ( class_exists('midgard_reflector_object') |
|
33 | + if (substr($mgdschema, 0, 2) == '__' |
|
34 | + || (class_exists('midgard_reflector_object') |
|
35 | 35 | && !midgard_reflector_object::has_metadata_class($mgdschema))) { |
36 | 36 | continue; |
37 | 37 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // In Midgard2 we can have objects that don't |
45 | 45 | // have metadata. These should not be shown |
46 | 46 | // in trash. |
47 | - if ( class_exists('midgard_reflector_object') |
|
47 | + if (class_exists('midgard_reflector_object') |
|
48 | 48 | && !midgard_reflector_object::has_metadata_class($type)) { |
49 | 49 | debug_add("{$type} has no metadata, skipping"); |
50 | 50 | continue; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $data['reflector'] = midcom_helper_reflector::get($data['type']); |
95 | 95 | $data['label_property'] = $data['reflector']->get_label_property(); |
96 | 96 | |
97 | - if ( isset($_POST['undelete']) |
|
97 | + if (isset($_POST['undelete']) |
|
98 | 98 | && is_array($_POST['undelete'])) { |
99 | 99 | if (isset($_POST['purge'])) { |
100 | 100 | $this->_purge(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | case 'proposed': |
123 | 123 | $html = $this->render_status($task->manager, "from %s"); |
124 | 124 | $task->get_members(); |
125 | - if ( $task->can_do('midgard:update') |
|
125 | + if ($task->can_do('midgard:update') |
|
126 | 126 | && isset($task->resources[midcom_connection::get_user()])) { |
127 | 127 | $html .= '<form method="post" action="' . $prefix . 'workflow/' . $task->guid . '/">'; |
128 | 128 | //TODO: If we need all resources to accept task hide tools when we have accepted and replace with "pending acceptance from..." |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $entry['id'] = $task->id; |
245 | 245 | $entry['index_task'] = $task->title; |
246 | 246 | $entry['task'] = '<a href="' . $task_url . '"><img class="status-icon" src="' . MIDCOM_STATIC_URL . '/stock-icons/16x16/' . $task->get_icon() . '" /> ' . $task->title . '</a>'; |
247 | - if ( $this->_request_data['view_identifier'] == 'my_tasks' |
|
247 | + if ($this->_request_data['view_identifier'] == 'my_tasks' |
|
248 | 248 | || $this->_request_data['view_identifier'] == 'project_tasks') { |
249 | 249 | $entry['status_control'] = org_openpsa_projects_workflow::render_status_control($task); |
250 | 250 | $status_type = $this->_get_status_type($task); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | if ($data['view'] == 'json') { |
394 | 394 | midcom_show_style('show-json-tasks'); |
395 | 395 | } else { |
396 | - if ( $data['view_identifier'] != 'my_tasks' |
|
396 | + if ($data['view_identifier'] != 'my_tasks' |
|
397 | 397 | && $data['view_identifier'] != 'agreement') { |
398 | 398 | midcom_show_style('show-priority-filter'); |
399 | 399 | } |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $e->log(); |
431 | 431 | } |
432 | 432 | |
433 | - if ( $this->_request_data['view_identifier'] != 'agreement' |
|
433 | + if ($this->_request_data['view_identifier'] != 'agreement' |
|
434 | 434 | && $this->_request_data['view_identifier'] != 'project_tasks') { |
435 | 435 | try { |
436 | 436 | $customer = org_openpsa_contacts_group_dba::get_cached($task->customer); |