@@ -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; |
@@ -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 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $counter = 0; |
135 | 135 | |
136 | 136 | foreach ($result as $object_guid => $empty_copy) { |
137 | - if ( $this->_user_id |
|
137 | + if ($this->_user_id |
|
138 | 138 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $object_guid, $classname, $this->_user_id)) { |
139 | 139 | debug_add("Failed to load result, read privilege on {$object_guid} not granted for the current user.", MIDCOM_LOG_INFO); |
140 | 140 | continue; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($counter <= $this->_offset) { |
146 | 146 | continue; |
147 | 147 | } |
148 | - if ( $this->_limit |
|
148 | + if ($this->_limit |
|
149 | 149 | && $counter > ($this->_offset + $this->_limit)) { |
150 | 150 | break; |
151 | 151 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | public function get_subkey($key, $property) |
225 | 225 | { |
226 | - if ( $this->_user_id |
|
226 | + if ($this->_user_id |
|
227 | 227 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $key, $this->_real_class, $this->_user_id)) { |
228 | 228 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
229 | 229 | return false; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | public function get($key) |
235 | 235 | { |
236 | - if ( $this->_user_id |
|
236 | + if ($this->_user_id |
|
237 | 237 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $key, $this->_real_class, $this->_user_id)) { |
238 | 238 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
239 | 239 | return false; |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $config = $this->get_config_for_topic($topic); |
71 | - if ( $object->name == 'index' |
|
71 | + if ($object->name == 'index' |
|
72 | 72 | && !$config->get('autoindex')) { |
73 | 73 | return ''; |
74 | 74 | } |
@@ -29,7 +29,8 @@ |
||
29 | 29 | foreach ($qb->execute() as $article) { |
30 | 30 | try { |
31 | 31 | $datamanager->set_storage($article); |
32 | - } catch (midcom_error $e) { |
|
32 | + } |
|
33 | + catch (midcom_error $e) { |
|
33 | 34 | $e->log(MIDCOM_LOG_WARN); |
34 | 35 | continue; |
35 | 36 | } |