@@ -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; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Sanity check expires |
303 | - if ( !is_int($expires) |
|
303 | + if (!is_int($expires) |
|
304 | 304 | || $expires < -1) { |
305 | 305 | throw new midcom_error("\$expires has to be a positive integer or zero or -1, is now {$expires}."); |
306 | 306 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $etag = md5("{$last_modified}{$attachment->name}{$attachment->mimetype}{$attachment->guid}"); |
314 | 314 | |
315 | 315 | // Check etag and return 304 if necessary |
316 | - if ( $expires <> 0 |
|
316 | + if ($expires <> 0 |
|
317 | 317 | && $this->cache->content->_check_not_modified($last_modified, $etag)) { |
318 | 318 | if (!_midcom_headers_sent()) { |
319 | 319 | $this->cache->content->cache_control_headers(); |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | function get_host_name() |
492 | 492 | { |
493 | 493 | if (!$this->_cached_host_name) { |
494 | - if ( array_key_exists("SSL_PROTOCOL", $_SERVER) |
|
495 | - || ( array_key_exists('HTTPS', $_SERVER) |
|
494 | + if (array_key_exists("SSL_PROTOCOL", $_SERVER) |
|
495 | + || (array_key_exists('HTTPS', $_SERVER) |
|
496 | 496 | && $_SERVER['HTTPS'] == 'on') |
497 | 497 | || $_SERVER["SERVER_PORT"] == 443) { |
498 | 498 | $protocol = "https"; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | $port = ""; |
504 | 504 | if (strpos($_SERVER['SERVER_NAME'], ':') === false) { |
505 | - if ( ($protocol == "http" && $_SERVER["SERVER_PORT"] != 80) |
|
505 | + if (($protocol == "http" && $_SERVER["SERVER_PORT"] != 80) |
|
506 | 506 | || ($protocol == "https" && $_SERVER["SERVER_PORT"] != 443)) { |
507 | 507 | $port = ":" . $_SERVER["SERVER_PORT"]; |
508 | 508 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | private function _process_cache($value) |
127 | 127 | { |
128 | 128 | if ($value == 'invalidate') { |
129 | - if ( !is_array(midcom::get()->config->get('indexer_reindex_allowed_ips')) |
|
129 | + if (!is_array(midcom::get()->config->get('indexer_reindex_allowed_ips')) |
|
130 | 130 | || !in_array($_SERVER['REMOTE_ADDR'], midcom::get()->config->get('indexer_reindex_allowed_ips'))) { |
131 | 131 | midcom::get()->auth->require_valid_user('basic'); |
132 | 132 | midcom::get()->auth->require_admin_user(); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | private function _get_remaining_url($value) |
174 | 174 | { |
175 | 175 | $redirect_to = ''; |
176 | - if ( !empty($value) |
|
176 | + if (!empty($value) |
|
177 | 177 | || !empty($this->_context->parser->argv)) { |
178 | 178 | $redirect_to = "{$value}/" . implode($this->_context->parser->argv, '/'); |
179 | 179 | $redirect_to = preg_replace('%^(.*?):/([^/])%', '\\1://\\2', $redirect_to); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public function get_parent_guid_uncached() |
83 | 83 | { |
84 | - if ( $this->up |
|
84 | + if ($this->up |
|
85 | 85 | || $this->title != '__org_openpsa_calendar') { |
86 | 86 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
87 | 87 | if ($this->id != $root_event->id) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | //Check up |
144 | - if ( !$this->up |
|
144 | + if (!$this->up |
|
145 | 145 | && $this->title != '__org_openpsa_calendar') { |
146 | 146 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
147 | 147 | $this->up = $root_event->id; |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | private function _check_timerange() |
174 | 174 | { |
175 | 175 | //Force types |
176 | - $this->start = (int)$this->start; |
|
177 | - $this->end = (int)$this->end; |
|
178 | - if ( !$this->start |
|
176 | + $this->start = (int) $this->start; |
|
177 | + $this->end = (int) $this->end; |
|
178 | + if (!$this->start |
|
179 | 179 | || !$this->end) { |
180 | 180 | debug_add('Event must have start and end timestamps'); |
181 | 181 | midcom_connection::set_error(MGD_ERR_RANGE); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * Force start and end seconds to 1 and 0 respectively |
187 | 187 | * (to avoid stupid one second overlaps) |
188 | 188 | */ |
189 | - $this->start = mktime( date('G', $this->start), |
|
189 | + $this->start = mktime(date('G', $this->start), |
|
190 | 190 | date('i', $this->start), |
191 | 191 | 1, |
192 | 192 | date('n', $this->start), |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | $lastgoodnode = null; |
258 | 258 | |
259 | - while ( $parent_id |
|
259 | + while ($parent_id |
|
260 | 260 | && !isset(self::$_nodes[$parent_id])) { |
261 | 261 | try { |
262 | 262 | self::$_nodes[$parent_id] = $this->_loadNodeData($parent_id); |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | |
274 | 274 | $parent_id = $this->_get_parent_id($topic_id); |
275 | 275 | |
276 | - if ( $up |
|
276 | + if ($up |
|
277 | 277 | && $up_id = array_pop($up_ids) |
278 | 278 | && $up_id != $parent_id) { |
279 | 279 | $parent_id = $up_id; |
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | - if ( !is_null($lastgoodnode) |
|
283 | + if (!is_null($lastgoodnode) |
|
284 | 284 | && (empty($this->_lastgoodnode) || $this->_lastgoodnode < 0)) { |
285 | 285 | $this->_lastgoodnode = $lastgoodnode; |
286 | 286 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | { |
317 | 317 | $node = new midcom_helper_nav_node($this, $topic_id, $up); |
318 | 318 | |
319 | - if ( !$node->is_object_visible() |
|
319 | + if (!$node->is_object_visible() |
|
320 | 320 | || !$node->is_readable_by($this->_user_id)) { |
321 | 321 | throw new midcom_error_forbidden('Node cannot be read or is invisible'); |
322 | 322 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | }); |
362 | 362 | foreach ($leaves as $id => $leaf) { |
363 | 363 | $this->_leaves[$id] = $leaf; |
364 | - $this->_loaded_leaves[$node->id][$id] =& $this->_leaves[$id]; |
|
364 | + $this->_loaded_leaves[$node->id][$id] = & $this->_leaves[$id]; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | } |
448 | 448 | $subnode_id = $this->_nodeid($id, $up); |
449 | 449 | |
450 | - if ( !$show_noentry |
|
450 | + if (!$show_noentry |
|
451 | 451 | && self::$_nodes[$subnode_id]->noentry) { |
452 | 452 | // Hide "noentry" items |
453 | 453 | continue; |
@@ -260,10 +260,12 @@ discard block |
||
260 | 260 | && !isset(self::$_nodes[$parent_id])) { |
261 | 261 | try { |
262 | 262 | self::$_nodes[$parent_id] = $this->_loadNodeData($parent_id); |
263 | - } catch (midcom_error_forbidden $e) { |
|
263 | + } |
|
264 | + catch (midcom_error_forbidden $e) { |
|
264 | 265 | debug_add("The Node {$parent_id} is invisible, could not satisfy the dependency chain to Node #{$node_id}", MIDCOM_LOG_WARN); |
265 | 266 | return $e->getCode(); |
266 | - } catch (midcom_error $e) { |
|
267 | + } |
|
268 | + catch (midcom_error $e) { |
|
267 | 269 | return $e->getCode(); |
268 | 270 | } |
269 | 271 | |
@@ -287,7 +289,8 @@ discard block |
||
287 | 289 | |
288 | 290 | try { |
289 | 291 | self::$_nodes[$node_id] = $this->_loadNodeData($topic_id); |
290 | - } catch (midcom_error $e) { |
|
292 | + } |
|
293 | + catch (midcom_error $e) { |
|
291 | 294 | return $e->getCode(); |
292 | 295 | } |
293 | 296 | return MIDCOM_ERROK; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function is_readable_by($user_id) |
32 | 32 | { |
33 | - return ( !$user_id |
|
33 | + return (!$user_id |
|
34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, 'midcom_db_topic', $user_id)); |
35 | 35 | } |
36 | 36 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
68 | 68 | $this->_controller->schemadb = $schemadb; |
69 | 69 | $this->_controller->schemaname = 'default'; |
70 | - $this->_controller->callback_object =& $this; |
|
70 | + $this->_controller->callback_object = & $this; |
|
71 | 71 | |
72 | 72 | // Suggest to create the same type of a folder as the parent is |
73 | 73 | $component_suggestion = $this->_topic->component; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | if (!$this->_new_topic->create()) { |
103 | 103 | debug_print_r('We operated on this object:', $this->_new_topic); |
104 | - throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
104 | + throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $this->_new_topic; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | // No topics matching path, check for attachments |
124 | - $att_qb = midcom_db_attachment::new_query_builder(); |
|
124 | + $att_qb = midcom_db_attachment::new_query_builder(); |
|
125 | 125 | $att_qb->add_constraint('name', '=', $this->argv[0]); |
126 | 126 | $att_qb->add_constraint('parentguid', '=', $this->get_current_object()->guid); |
127 | 127 | if ($att_qb->count() == 0) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | private function _filter_schema_fields($key) |
164 | 164 | { |
165 | - if ( $key == 'metadata' |
|
165 | + if ($key == 'metadata' |
|
166 | 166 | || in_array($key, $this->_config->get('object_skip_fields'))) { |
167 | 167 | return false; |
168 | 168 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | private function _add_string_field($key, $type) |
174 | 174 | { |
175 | - if ( $key == 'component' |
|
175 | + if ($key == 'component' |
|
176 | 176 | && $type == 'midcom_db_topic') { |
177 | 177 | $this->_add_component_dropdown($key); |
178 | 178 | return; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | private function _add_int_field($key) |
223 | 223 | { |
224 | - if ( $key == 'start' |
|
224 | + if ($key == 'start' |
|
225 | 225 | || $key == 'end' |
226 | 226 | || $key == 'added' |
227 | 227 | || $key == 'date') { |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $height = 30; |
266 | 266 | |
267 | 267 | // Check the user preference and configuration |
268 | - if ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | - || ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
268 | + if (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | + || (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
270 | 270 | && $this->_config->get('tinymce_enabled'))) { |
271 | 271 | $widget = 'tinymce'; |
272 | 272 | } |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | $height = 30; |
280 | 280 | |
281 | 281 | // Check the user preference and configuration |
282 | - if ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | - || ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
282 | + if (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | + || (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
284 | 284 | && $this->_config->get('codemirror_enabled'))) { |
285 | 285 | $widget = 'codemirror'; |
286 | 286 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | if ($score1 > $score2) { |
543 | 543 | return 1; |
544 | 544 | } |
545 | - if ( $score1 < 3 |
|
545 | + if ($score1 < 3 |
|
546 | 546 | || $score1 > 6) { |
547 | 547 | return strnatcmp($first, $second); |
548 | 548 | } |