@@ -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 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $filename = $this->_generate_rcs_filename($object->guid); |
89 | - $rcsfilename = "{$filename},v"; |
|
89 | + $rcsfilename = "{$filename},v"; |
|
90 | 90 | |
91 | 91 | if (!file_exists($rcsfilename)) { |
92 | 92 | // The methods return basically what the RCS unix level command returns, so nonzero value is error and zero is ok... |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | // , must become . to work. Therefore this: |
122 | 122 | str_replace(',', '.', $revision); |
123 | 123 | |
124 | - $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null"); |
|
124 | + $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null"); |
|
125 | 125 | |
126 | 126 | $data = $this->rcs_readfile($this->_guid); |
127 | 127 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | if ($message_array[0] != 'Object') { |
263 | 263 | $history['user'] = $message_array[0]; |
264 | 264 | } |
265 | - $history['ip'] = $message_array[1]; |
|
265 | + $history['ip'] = $message_array[1]; |
|
266 | 266 | $history['message'] = $message_array[2]; |
267 | 267 | } |
268 | 268 | return $history; |
@@ -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 | } |
@@ -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)) { |
@@ -135,7 +135,8 @@ discard block |
||
135 | 135 | |
136 | 136 | try { |
137 | 137 | return $this->_backend->index($documents); |
138 | - } catch (Exception $e) { |
|
138 | + } |
|
139 | + catch (Exception $e) { |
|
139 | 140 | debug_add("Indexing error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
140 | 141 | return false; |
141 | 142 | } |
@@ -175,7 +176,8 @@ discard block |
||
175 | 176 | } |
176 | 177 | try { |
177 | 178 | return $this->_backend->delete($RIs); |
178 | - } catch (Exception $e) { |
|
179 | + } |
|
180 | + catch (Exception $e) { |
|
179 | 181 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
180 | 182 | return false; |
181 | 183 | } |
@@ -196,7 +198,8 @@ discard block |
||
196 | 198 | |
197 | 199 | try { |
198 | 200 | return $this->_backend->delete_all($constraint); |
199 | - } catch (Exception $e) { |
|
201 | + } |
|
202 | + catch (Exception $e) { |
|
200 | 203 | debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
201 | 204 | return false; |
202 | 205 | } |
@@ -230,7 +233,8 @@ discard block |
||
230 | 233 | |
231 | 234 | try { |
232 | 235 | $result_raw = $this->_backend->query($query, $filter, $options); |
233 | - } catch (Exception $e) { |
|
236 | + } |
|
237 | + catch (Exception $e) { |
|
234 | 238 | debug_add("Query error: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
235 | 239 | return false; |
236 | 240 | } |
@@ -256,7 +260,8 @@ discard block |
||
256 | 260 | if (!empty($document->topic_guid)) { |
257 | 261 | try { |
258 | 262 | midcom_db_topic::get_cached($document->topic_guid); |
259 | - } catch (midcom_error $e) { |
|
263 | + } |
|
264 | + catch (midcom_error $e) { |
|
260 | 265 | // Skip document, the object is hidden. |
261 | 266 | debug_add("Skipping the generic document {$document->title}, its topic seems to be invisible, we cannot proceed."); |
262 | 267 | continue; |
@@ -269,7 +274,8 @@ discard block |
||
269 | 274 | // Strip language code from end of RI if it looks like "<GUID>_<LANG>" |
270 | 275 | try { |
271 | 276 | midcom::get()->dbfactory->get_object_by_guid(preg_replace('/^([0-9a-f]{32,80})_[a-z]{2}$/', '\\1', $document->RI)); |
272 | - } catch (midcom_error $e) { |
|
277 | + } |
|
278 | + catch (midcom_error $e) { |
|
273 | 279 | // Skip document, the object is hidden, deleted or otherwise unavailable. |
274 | 280 | //@todo Maybe nonexistent objects should be removed from index? |
275 | 281 | continue; |
@@ -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 | } |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | if (!is_null($parent)) { |
133 | 133 | // Attachments are a special case |
134 | 134 | if ($object instanceof midcom_db_attachment) { |
135 | - if ( !$parent->can_do('midgard:attachments') |
|
135 | + if (!$parent->can_do('midgard:attachments') |
|
136 | 136 | || !$parent->can_do('midgard:update')) { |
137 | 137 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
138 | 138 | MIDCOM_LOG_ERROR); |
139 | 139 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
140 | 140 | return false; |
141 | 141 | } |
142 | - } elseif ( !$parent->can_do('midgard:create') |
|
142 | + } elseif (!$parent->can_do('midgard:create') |
|
143 | 143 | && !midcom::get()->auth->can_user_do('midgard:create', null, get_class($object))) { |
144 | 144 | 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.", |
145 | 145 | 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 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | */ |
723 | 723 | public static function get_by_guid(midcom_core_dbaobject $object, $guid) |
724 | 724 | { |
725 | - if ( !midcom::get()->auth->admin |
|
725 | + if (!midcom::get()->auth->admin |
|
726 | 726 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
727 | 727 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
728 | 728 | return false; |
@@ -138,7 +138,8 @@ discard block |
||
138 | 138 | try { |
139 | 139 | $this->_object = new $classname($this->_id); |
140 | 140 | return $this->_object; |
141 | - } catch (Exception $e) { |
|
141 | + } |
|
142 | + catch (Exception $e) { |
|
142 | 143 | $this->_stop($e->getMessage(), $e->getCode()); |
143 | 144 | } |
144 | 145 | } |
@@ -211,7 +212,8 @@ discard block |
||
211 | 212 | if (is_null($this->_response)) { |
212 | 213 | $this->_stop('Could not handle request, unknown method', 405); |
213 | 214 | } |
214 | - } catch (midcom_error $e) { |
|
215 | + } |
|
216 | + catch (midcom_error $e) { |
|
215 | 217 | $this->_responseStatus = $e->getCode(); |
216 | 218 | return $this->_send_response($e->getMessage()); |
217 | 219 | } |
@@ -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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | midcom::get()->auth->require_valid_user(); |
37 | 37 | midcom::get()->skip_page_style = true; |
38 | 38 | |
39 | - $this->add_stylesheet(MIDCOM_STATIC_URL ."/midcom.helper.imagepopup/styling.css", 'screen'); |
|
39 | + $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.helper.imagepopup/styling.css", 'screen'); |
|
40 | 40 | |
41 | 41 | $data['filetype'] = $args[0]; |
42 | 42 | $data['object'] = null; |
@@ -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."); |