@@ -453,7 +453,8 @@ discard block |
||
453 | 453 | |
454 | 454 | try { |
455 | 455 | @exec($command, $output, $status); |
456 | - } catch (Exception $e) { |
|
456 | + } |
|
457 | + catch (Exception $e) { |
|
457 | 458 | debug_add($e->getMessage()); |
458 | 459 | } |
459 | 460 | |
@@ -549,7 +550,8 @@ discard block |
||
549 | 550 | |
550 | 551 | try { |
551 | 552 | $object = midcom::get()->dbfactory->get_object_by_guid($this->_guid); |
552 | - } catch (midcom_error $e) { |
|
553 | + } |
|
554 | + catch (midcom_error $e) { |
|
553 | 555 | debug_add("{$this->_guid} could not be resolved to object", MIDCOM_LOG_ERROR); |
554 | 556 | return false; |
555 | 557 | } |
@@ -105,12 +105,12 @@ |
||
105 | 105 | return $status; |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Get the object of a revision |
|
110 | - * |
|
111 | - * @param string $revision identifier of revision wanted |
|
112 | - * @return array array representation of the object |
|
113 | - */ |
|
108 | + /** |
|
109 | + * Get the object of a revision |
|
110 | + * |
|
111 | + * @param string $revision identifier of revision wanted |
|
112 | + * @return array array representation of the object |
|
113 | + */ |
|
114 | 114 | public function get_revision($revision) |
115 | 115 | { |
116 | 116 | if (empty($this->_guid)) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $i += 3; |
296 | 296 | |
297 | - while ( $i < $total |
|
297 | + while ($i < $total |
|
298 | 298 | && substr($lines[$i], 0, 4) != '----' |
299 | 299 | && substr($lines[$i], 0, 5) != '=====') { |
300 | 300 | $i++; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | private function rcs_writefile($guid, $data) |
334 | 334 | { |
335 | - if ( !is_writable($this->_config->get_rcs_root()) |
|
335 | + if (!is_writable($this->_config->get_rcs_root()) |
|
336 | 336 | || empty($guid)) { |
337 | 337 | return false; |
338 | 338 | } |
@@ -735,7 +735,8 @@ |
||
735 | 735 | */ |
736 | 736 | try { |
737 | 737 | return $object->get_by_id($object->id); |
738 | - } catch (exception $e) { |
|
738 | + } |
|
739 | + catch (exception $e) { |
|
739 | 740 | return false; |
740 | 741 | } |
741 | 742 | } |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | if ($parent !== null) { |
134 | 134 | // Attachments are a special case |
135 | 135 | if ($object instanceof midcom_db_attachment) { |
136 | - if ( !$parent->can_do('midgard:attachments') |
|
136 | + if (!$parent->can_do('midgard:attachments') |
|
137 | 137 | || !$parent->can_do('midgard:update')) { |
138 | 138 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
139 | 139 | MIDCOM_LOG_ERROR); |
140 | 140 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
141 | 141 | return false; |
142 | 142 | } |
143 | - } elseif ( !$parent->can_do('midgard:create') |
|
143 | + } elseif (!$parent->can_do('midgard:create') |
|
144 | 144 | && !midcom::get()->auth->can_user_do('midgard:create', null, get_class($object))) { |
145 | 145 | debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.", |
146 | 146 | MIDCOM_LOG_ERROR); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | // Default the owner to first group of current user |
266 | - if ( empty($object->metadata->owner) |
|
266 | + if (empty($object->metadata->owner) |
|
267 | 267 | && $first_group = midcom::get()->auth->user->get_first_group_guid()) { |
268 | 268 | $object->metadata->set('owner', $first_group); |
269 | 269 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | */ |
721 | 721 | public static function get_by_guid(midcom_core_dbaobject $object, $guid) |
722 | 722 | { |
723 | - if ( !midcom::get()->auth->admin |
|
723 | + if (!midcom::get()->auth->admin |
|
724 | 724 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
725 | 725 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
726 | 726 | return false; |
@@ -143,7 +143,7 @@ |
||
143 | 143 | |
144 | 144 | $this->_modules[$name] = new $classname(); |
145 | 145 | $this->_modules[$name]->initialize(); |
146 | - $this->$name =& $this->_modules[$name]; |
|
146 | + $this->$name = & $this->_modules[$name]; |
|
147 | 147 | array_unshift($this->_unload_queue, $name); |
148 | 148 | } |
149 | 149 |
@@ -336,7 +336,7 @@ |
||
336 | 336 | public function update_cache() |
337 | 337 | { |
338 | 338 | // Check if the attachment can be read anonymously |
339 | - if ( midcom::get()->config->get('attachment_cache_enabled') |
|
339 | + if (midcom::get()->config->get('attachment_cache_enabled') |
|
340 | 340 | && !$this->can_do('midgard:read', 'EVERYONE')) { |
341 | 341 | // Not public file, ensure it is removed |
342 | 342 | $filename = $this->get_cache_path(); |
@@ -98,8 +98,8 @@ |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // Check the Metadata if and only if we are configured to do so. |
101 | - if ( is_object($this->object) |
|
102 | - && ( midcom::get()->config->get('show_hidden_objects') == false |
|
101 | + if (is_object($this->object) |
|
102 | + && (midcom::get()->config->get('show_hidden_objects') == false |
|
103 | 103 | || midcom::get()->config->get('show_unapproved_objects') == false)) { |
104 | 104 | // Check Hiding, Scheduling and Approval |
105 | 105 | $metadata = $this->object->metadata; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function is_readable_by($user_id) |
30 | 30 | { |
31 | - return ( empty($this->object) |
|
31 | + return (empty($this->object) |
|
32 | 32 | || !$this->guid |
33 | 33 | || !$user_id |
34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, $this->object->__midcom_class_name__, $user_id)); |
@@ -52,7 +52,8 @@ |
||
52 | 52 | } elseif (!empty($this->data[MIDCOM_NAV_GUID])) { |
53 | 53 | try { |
54 | 54 | $this->data[MIDCOM_NAV_OBJECT] = midcom::get()->dbfactory->get_object_by_guid($this->data[MIDCOM_NAV_GUID]); |
55 | - } catch (midcom_error $e) { |
|
55 | + } |
|
56 | + catch (midcom_error $e) { |
|
56 | 57 | } |
57 | 58 | } else { |
58 | 59 | debug_add("Warning: The leaf {$this->leafid} of topic {$topic->id} does set neither a GUID nor an object."); |
@@ -166,7 +166,8 @@ discard block |
||
166 | 166 | break; |
167 | 167 | } |
168 | 168 | } |
169 | - } catch (midcom_error $e) { |
|
169 | + } |
|
170 | + catch (midcom_error $e) { |
|
170 | 171 | } |
171 | 172 | |
172 | 173 | $path_parts = array_reverse($path_parts); |
@@ -410,7 +411,8 @@ discard block |
||
410 | 411 | && $db_style = $this->get_style_id_from_path($root_topic->style)) { |
411 | 412 | $_style = $this->_get_element_in_styletree($db_style, $_element); |
412 | 413 | } |
413 | - } catch (midcom_error_forbidden $e) { |
|
414 | + } |
|
415 | + catch (midcom_error_forbidden $e) { |
|
414 | 416 | $e->log(); |
415 | 417 | } |
416 | 418 |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $element = $matches[2]; |
302 | 302 | } |
303 | 303 | |
304 | - if ( isset($stylepath) |
|
304 | + if (isset($stylepath) |
|
305 | 305 | && $styleid = $this->get_style_id_from_path($stylepath)) { |
306 | 306 | array_unshift($this->_scope, $styleid); |
307 | 307 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | public function render($preparsed, $path) |
346 | 346 | { |
347 | 347 | if (midcom_core_context::get()->has_custom_key('request_data')) { |
348 | - $data =& midcom_core_context::get()->get_custom_key('request_data'); |
|
348 | + $data = & midcom_core_context::get()->get_custom_key('request_data'); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | if (eval('?>' . $preparsed) === false) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | try { |
381 | 381 | $root_topic = $context->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
382 | - if ( $root_topic->style |
|
382 | + if ($root_topic->style |
|
383 | 383 | && $db_style = $this->get_style_id_from_path($root_topic->style)) { |
384 | 384 | $_style = $this->_get_element_in_styletree($db_style, $_element); |
385 | 385 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | if (array_key_exists($src, $this->_styles)) { |
415 | 415 | return $this->_styles[$src]; |
416 | 416 | } |
417 | - if ( $this->_scope[0] != '' |
|
417 | + if ($this->_scope[0] != '' |
|
418 | 418 | && $result = $this->_get_element_in_styletree($this->_scope[0], $_element)) { |
419 | 419 | $this->_styles[$src] = $result; |
420 | 420 | return $this->_styles[$src]; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | if (array_key_exists($src, $this->_snippets)) { |
433 | 433 | return $this->_snippets[$src]; |
434 | 434 | } |
435 | - if ( midcom::get()->config->get('theme') |
|
435 | + if (midcom::get()->config->get('theme') |
|
436 | 436 | && $content = midcom_helper_misc::get_element_content($_element)) { |
437 | 437 | $this->_snippets[$src] = $content; |
438 | 438 | return $content; |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | } |
490 | 490 | } else { |
491 | 491 | $style = $topic->style ?: midcom_core_context::get()->get_inherited_style(); |
492 | - if ( is_string($style) |
|
492 | + if (is_string($style) |
|
493 | 493 | && strpos($style, 'theme:') === 0) { |
494 | 494 | $theme_dir = OPENPSA2_THEME_ROOT . midcom::get()->config->get('theme') . '/style'; |
495 | 495 | $parts = explode('/', str_replace('theme:/', '', $style)); |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $this->_styledirs_append[$context->id] = []; |
669 | 669 | } |
670 | 670 | |
671 | - if ( $this->_topic |
|
671 | + if ($this->_topic |
|
672 | 672 | && $_st = $this->_get_component_style($this->_topic)) { |
673 | 673 | array_unshift($this->_scope, $_st); |
674 | 674 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function leave_context() |
688 | 688 | { |
689 | - if ( $this->_topic |
|
689 | + if ($this->_topic |
|
690 | 690 | && $this->_get_component_style($this->_topic)) { |
691 | 691 | array_shift($this->_scope); |
692 | 692 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
41 | 41 | { |
42 | - if ( $object instanceof org_openpsa_documents_document_dba |
|
42 | + if ($object instanceof org_openpsa_documents_document_dba |
|
43 | 43 | && $object->topic == $topic->id) { |
44 | 44 | return "document/{$object->guid}/"; |
45 | 45 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | debug_add("task->start() called with user #" . midcom_connection::get_user()); |
172 | 172 | //PONDER: Check actual status objects for more accurate logic ? |
173 | - if ( $task->status >= org_openpsa_projects_task_status_dba::STARTED |
|
173 | + if ($task->status >= org_openpsa_projects_task_status_dba::STARTED |
|
174 | 174 | && $task->status <= org_openpsa_projects_task_status_dba::APPROVED) { |
175 | 175 | //We already have started status |
176 | 176 | debug_add('Task has already been started'); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | private static function is_manager($task) |
384 | 384 | { |
385 | - return ( $task->manager == 0 |
|
385 | + return ($task->manager == 0 |
|
386 | 386 | || midcom_connection::get_user() == $task->manager); |
387 | 387 | } |
388 | 388 | } |
@@ -356,7 +356,8 @@ |
||
356 | 356 | // The agreement allows invoicing only approved hours, therefore don't mark unapproved |
357 | 357 | $qb->add_constraint('metadata.isapproved', '=', true); |
358 | 358 | } |
359 | - } catch (midcom_error $e) { |
|
359 | + } |
|
360 | + catch (midcom_error $e) { |
|
360 | 361 | $e->log(); |
361 | 362 | } |
362 | 363 |