@@ -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; |
@@ -85,7 +85,8 @@ |
||
85 | 85 | $productgroup = new org_openpsa_products_product_group_dba($this->_product->productGroup); |
86 | 86 | $title = str_replace('<PRODUCTGROUP_TITLE>', $productgroup->title, $title); |
87 | 87 | $title = str_replace('<PRODUCTGROUP_CODE>', $productgroup->code, $title); |
88 | - } catch (midcom_error $e) { |
|
88 | + } |
|
89 | + catch (midcom_error $e) { |
|
89 | 90 | $title = str_replace(array('<PRODUCTGROUP_TITLE>', '<PRODUCTGROUP_CODE>'), '', $title); |
90 | 91 | } |
91 | 92 | } |
@@ -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 | } |
@@ -171,7 +171,8 @@ |
||
171 | 171 | //create reflector with linked object to get the right label |
172 | 172 | try { |
173 | 173 | $linked_object = midcom::get()->dbfactory->get_object_by_guid($entry->linkGuid); |
174 | - } catch (midcom_error $e) { |
|
174 | + } |
|
175 | + catch (midcom_error $e) { |
|
175 | 176 | unset($data['entries'][$i]); |
176 | 177 | $e->log(); |
177 | 178 | continue; |
@@ -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); |
@@ -426,7 +426,8 @@ discard block |
||
426 | 426 | $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); |
427 | 427 | $ret['project'] = '<a href="' . $prefix . 'project/' . $project->guid . '/">' . $project->title . '</a>'; |
428 | 428 | $ret['index_project'] = $project->title; |
429 | - } catch (midcom_error $e) { |
|
429 | + } |
|
430 | + catch (midcom_error $e) { |
|
430 | 431 | $e->log(); |
431 | 432 | } |
432 | 433 | |
@@ -437,7 +438,8 @@ discard block |
||
437 | 438 | $customer_url = "{$this->_request_data['contacts_url']}group/{$customer->guid}/"; |
438 | 439 | $ret['customer'] = "<a href='{$customer_url}' title='{$customer->official}'>{$customer->get_label()}</a>"; |
439 | 440 | $ret['index_customer'] = $customer->name; |
440 | - } catch (midcom_error $e) { |
|
441 | + } |
|
442 | + catch (midcom_error $e) { |
|
441 | 443 | $ret['customer'] = ''; |
442 | 444 | $ret['index_customer'] = ''; |
443 | 445 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | |
94 | 94 | // If user has preference for this message, we use that |
95 | 95 | $personal_preferences = $recipient->list_parameters('org.openpsa.notifications'); |
96 | - if ( count($personal_preferences) > 0 |
|
96 | + if (count($personal_preferences) > 0 |
|
97 | 97 | && array_key_exists("{$component}:{$action}", $personal_preferences)) { |
98 | 98 | return $personal_preferences[$action]; |
99 | 99 | } |
@@ -52,7 +52,8 @@ |
||
52 | 52 | // TODO: Should we sudo here to ensure getting correct prefs regardless of ACLs? |
53 | 53 | try { |
54 | 54 | $recipient = midcom_db_person::get_cached($recipient); |
55 | - } catch (midcom_error $e) { |
|
55 | + } |
|
56 | + catch (midcom_error $e) { |
|
56 | 57 | return false; |
57 | 58 | } |
58 | 59 |
@@ -64,7 +64,8 @@ discard block |
||
64 | 64 | { |
65 | 65 | try { |
66 | 66 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($guid); |
67 | - } catch (midcom_error $e) { |
|
67 | + } |
|
68 | + catch (midcom_error $e) { |
|
68 | 69 | if (midcom_connection::get_error() == MGD_ERR_OBJECT_DELETED) { |
69 | 70 | $relocate = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . '__mfa/asgard/object/deleted/' . $guid . '/'; |
70 | 71 | midcom::get()->relocate($relocate); |
@@ -232,8 +233,7 @@ discard block |
||
232 | 233 | $this->_new_object = new $create_type(); |
233 | 234 | $mgd_type = midcom::get()->dbclassloader->get_mgdschema_class_name_for_midcom_class($create_type); |
234 | 235 | |
235 | - if ($parent_property = midgard_object_class::get_property_parent($mgd_type)) |
|
236 | - { |
|
236 | + if ($parent_property = midgard_object_class::get_property_parent($mgd_type)) { |
|
237 | 237 | $this->_new_object->$parent_property = $controller->formmanager->get_value($parent_property); |
238 | 238 | } |
239 | 239 |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | $this->_load_schemadb(); |
169 | 169 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
170 | - $this->_controller->schemadb =& $this->_schemadb; |
|
170 | + $this->_controller->schemadb = & $this->_schemadb; |
|
171 | 171 | $this->_controller->set_storage($this->_object, 'object'); |
172 | 172 | if (!$this->_controller->initialize()) { |
173 | 173 | throw new midcom_error("Failed to initialize a DM2 controller instance for object {$this->_object->guid}."); |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | return $this->_prepare_relocate($this->_object); |
185 | 185 | |
186 | 186 | case 'edit': |
187 | - $qf =& $this->_controller->formmanager->form; |
|
188 | - if ( $qf->isSubmitted() |
|
187 | + $qf = & $this->_controller->formmanager->form; |
|
188 | + if ($qf->isSubmitted() |
|
189 | 189 | && !$qf->validate()) { |
190 | 190 | foreach ($qf->_errors as $field => $error) { |
191 | - $element =& $qf->getElement($field); |
|
191 | + $element = & $qf->getElement($field); |
|
192 | 192 | $message = sprintf($this->_l10n->get('validation error in field %s: %s'), $element->getLabel(), $error); |
193 | 193 | midcom::get()->uimessages->add( |
194 | 194 | $this->_l10n->get('midgard.admin.asgard'), |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | if (!$this->_new_object->create()) { |
233 | 233 | debug_print_r('We operated on this object:', $this->_new_object); |
234 | - throw new midcom_error('Failed to create a new object. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
234 | + throw new midcom_error('Failed to create a new object. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $this->_new_object; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | midcom::get()->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); |
261 | 261 | |
262 | 262 | $data['defaults'] = array(); |
263 | - if ( $handler_id == '____mfa-asgard-object_create_toplevel' |
|
263 | + if ($handler_id == '____mfa-asgard-object_create_toplevel' |
|
264 | 264 | || $handler_id == '____mfa-asgard-object_create_chooser') { |
265 | 265 | midcom::get()->auth->require_user_do('midgard:create', null, $this->_new_type); |
266 | 266 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
281 | - $this->_controller->schemadb =& $this->_schemadb; |
|
281 | + $this->_controller->schemadb = & $this->_schemadb; |
|
282 | 282 | $this->_controller->schema = 'object'; |
283 | - $this->_controller->callback_object =& $this; |
|
283 | + $this->_controller->callback_object = & $this; |
|
284 | 284 | $this->_controller->defaults = $this->_get_defaults(); |
285 | 285 | if (!$this->_controller->initialize()) { |
286 | 286 | throw new midcom_error("Failed to initialize a DM2 create controller."); |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | $parent_property = null; |
322 | 322 | $new_type_reflector = midcom_helper_reflector::get($this->_new_type); |
323 | 323 | $link_properties = $new_type_reflector->get_link_properties(); |
324 | - $type_to_link_to = midcom_helper_reflector::class_rewrite(get_class($this->_object)); |
|
324 | + $type_to_link_to = midcom_helper_reflector::class_rewrite(get_class($this->_object)); |
|
325 | 325 | foreach ($link_properties as $child_property => $link) { |
326 | 326 | $linked_type = midcom_helper_reflector::class_rewrite($link['class']); |
327 | 327 | if (midcom_helper_reflector::is_same_class($linked_type, $type_to_link_to) |
328 | - || ( $link['type'] == MGD_TYPE_GUID |
|
328 | + || ($link['type'] == MGD_TYPE_GUID |
|
329 | 329 | && is_null($link['class']))) { |
330 | 330 | $parent_property = $link['target']; |
331 | 331 | break; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | // Allow setting defaults from query string, useful for things like "create event for today" and chooser |
341 | - if ( isset($_GET['defaults']) |
|
341 | + if (isset($_GET['defaults']) |
|
342 | 342 | && is_array($_GET['defaults'])) { |
343 | 343 | $get_defaults = array_intersect_key($_GET['defaults'], $this->_schemadb['object']->fields); |
344 | 344 | $defaults = array_merge($defaults, array_map('trim', $get_defaults)); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | { |
357 | 357 | if ($handler_id == '____mfa-asgard-object_create_chooser') { |
358 | 358 | midcom_show_style('midgard_admin_asgard_popup_header'); |
359 | - if ( $this->_new_object |
|
359 | + if ($this->_new_object |
|
360 | 360 | || isset($data['cancelled'])) { |
361 | 361 | $data['jsdata'] = $this->_object_to_jsdata($this->_new_object); |
362 | 362 | midcom_show_style('midgard_admin_asgard_object_create_after'); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $url = $type; |
408 | 408 | |
409 | 409 | $class_extends = $this->_config->get('class_extends'); |
410 | - if ( is_array($class_extends) |
|
410 | + if (is_array($class_extends) |
|
411 | 411 | && array_key_exists($type, $class_extends)) { |
412 | 412 | $url = $class_extends[$type]; |
413 | 413 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | // Load the nullstorage controller |
508 | 508 | $this->_controller = midcom_helper_datamanager2_controller::create('nullstorage'); |
509 | - $this->_controller->schemadb =& $this->_schemadb; |
|
509 | + $this->_controller->schemadb = & $this->_schemadb; |
|
510 | 510 | |
511 | 511 | if (!$this->_controller->initialize()) { |
512 | 512 | throw new midcom_error('Failed to initialize the controller'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Skip components beginning with midcom or midgard |
85 | - if ( preg_match('/^(midcom|midgard)\./', $manifest->name) |
|
85 | + if (preg_match('/^(midcom|midgard)\./', $manifest->name) |
|
86 | 86 | && $manifest->name != 'midcom.helper.search') { |
87 | 87 | continue; |
88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | asort($components); |
100 | 100 | |
101 | 101 | // Set the parent component to be the first if applicable |
102 | - if ( $parent_component !== '' |
|
102 | + if ($parent_component !== '' |
|
103 | 103 | && array_key_exists($parent_component, $components)) { |
104 | 104 | $temp = array(); |
105 | 105 | $temp[$parent_component] = $components[$parent_component]; |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | foreach (self::get_component_list() as $component => $details) { |
131 | - if ( $component !== $parent_component |
|
131 | + if ($component !== $parent_component |
|
132 | 132 | && !$all) { |
133 | - if ( is_array(midcom::get()->config->get('component_listing_allowed')) |
|
133 | + if (is_array(midcom::get()->config->get('component_listing_allowed')) |
|
134 | 134 | && !in_array($component, midcom::get()->config->get('component_listing_allowed'))) { |
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
138 | - if ( is_array(midcom::get()->config->get('component_listing_excluded')) |
|
138 | + if (is_array(midcom::get()->config->get('component_listing_excluded')) |
|
139 | 139 | && in_array($component, midcom::get()->config->get('component_listing_excluded'))) { |
140 | 140 | continue; |
141 | 141 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | class midcom_config_test |
15 | 15 | { |
16 | 16 | const OK = 0; |
17 | - const WARNING = 1; |
|
17 | + const WARNING = 1; |
|
18 | 18 | const ERROR = 2; |
19 | 19 | |
20 | 20 | private $messages = array( |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $this->add('Setting: upload_max_filesize', self::OK, ini_get('upload_max_filesize')); |
105 | 105 | } else { |
106 | 106 | $this->add('Setting: upload_max_filesize', |
107 | - self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
107 | + self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $post_limit = $this->ini_get_filesize('post_max_size'); |
@@ -74,7 +74,8 @@ |
||
74 | 74 | $config = new midcom_services_rcs_config($config); |
75 | 75 | $config->test_rcs_config(); |
76 | 76 | $this->add("MidCOM RCS", self::OK); |
77 | - } catch (midcom_error $e) { |
|
77 | + } |
|
78 | + catch (midcom_error $e) { |
|
78 | 79 | $this->add("MidCOM RCS", self::ERROR, $e->getMessage()); |
79 | 80 | } |
80 | 81 | } else { |