@@ -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( |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $element = $matches[2]; |
311 | 311 | } |
312 | 312 | |
313 | - if ( isset($stylepath) |
|
313 | + if (isset($stylepath) |
|
314 | 314 | && $styleid = $this->get_style_id_from_path($stylepath)) { |
315 | 315 | array_unshift($this->_scope, $styleid); |
316 | 316 | } |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function render($preparsed, $path, array $data = array()) |
356 | 356 | { |
357 | - if ( empty($data) |
|
357 | + if (empty($data) |
|
358 | 358 | && midcom_core_context::get()->has_custom_key('request_data')) { |
359 | - $data =& midcom_core_context::get()->get_custom_key('request_data'); |
|
359 | + $data = & midcom_core_context::get()->get_custom_key('request_data'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | if (eval('?>' . $preparsed) === false) { |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | try { |
392 | 392 | $root_topic = $context->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
393 | - if ( $root_topic->style |
|
393 | + if ($root_topic->style |
|
394 | 394 | && $db_style = $this->get_style_id_from_path($root_topic->style)) { |
395 | 395 | $_style = $this->_get_element_in_styletree($db_style, $_element); |
396 | 396 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | if (array_key_exists($src, $this->_styles)) { |
426 | 426 | return $this->_styles[$src]; |
427 | 427 | } |
428 | - if ( $this->_scope[0] != '' |
|
428 | + if ($this->_scope[0] != '' |
|
429 | 429 | && $result = $this->_get_element_in_styletree($this->_scope[0], $_element)) { |
430 | 430 | $this->_styles[$src] = $result; |
431 | 431 | return $this->_styles[$src]; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | if (array_key_exists($src, $this->_snippets)) { |
444 | 444 | return $this->_snippets[$src]; |
445 | 445 | } |
446 | - if ( midcom::get()->config->get('theme') |
|
446 | + if (midcom::get()->config->get('theme') |
|
447 | 447 | && $content = midcom_helper_misc::get_element_content($_element)) { |
448 | 448 | $this->_snippets[$src] = $content; |
449 | 449 | return $content; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $current_context = midcom_core_context::get()->id; |
453 | 453 | foreach ($this->_styledirs[$current_context] as $path) { |
454 | - $filename = $path . "/{$_element}.php"; |
|
454 | + $filename = $path . "/{$_element}.php"; |
|
455 | 455 | if (file_exists($filename)) { |
456 | 456 | $this->_snippets[$filename] = file_get_contents($filename); |
457 | 457 | return $this->_snippets[$filename]; |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | } |
502 | 502 | } else { |
503 | 503 | $style = $topic->style; |
504 | - if ( !$topic->style |
|
504 | + if (!$topic->style |
|
505 | 505 | && !empty($GLOBALS['midcom_style_inherited'])) { |
506 | 506 | $style = $GLOBALS['midcom_style_inherited']; |
507 | 507 | } |
508 | - if ( is_string($style) |
|
508 | + if (is_string($style) |
|
509 | 509 | && strpos($style, 'theme:') === 0) { |
510 | 510 | $theme_dir = OPENPSA2_THEME_ROOT . midcom::get()->config->get('theme') . '/style'; |
511 | 511 | $parts = explode('/', str_replace('theme:/', '', $style)); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | { |
534 | 534 | // get component's snippetdir (for default styles) |
535 | 535 | $loader = midcom::get()->componentloader; |
536 | - if ( !$topic |
|
536 | + if (!$topic |
|
537 | 537 | || !$topic->guid) { |
538 | 538 | return null; |
539 | 539 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | /* then the contextstyle */ |
670 | 670 | $this->_styledirs[$current_context][count($this->_styledirs[$current_context])] = $component_style; |
671 | 671 | |
672 | - $this->_styledirs[$current_context] = array_merge($this->_styledirs[$current_context], $this->_styledirs_append[$current_context]); |
|
672 | + $this->_styledirs[$current_context] = array_merge($this->_styledirs[$current_context], $this->_styledirs_append[$current_context]); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | /** |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | $this->_styledirs_append[$context] = array(); |
699 | 699 | } |
700 | 700 | |
701 | - if ( $this->_topic |
|
701 | + if ($this->_topic |
|
702 | 702 | && $_st = $this->_get_component_style($this->_topic)) { |
703 | 703 | array_unshift($this->_scope, $_st); |
704 | 704 | } |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function leave_context() |
720 | 720 | { |
721 | - if ( $this->_topic |
|
721 | + if ($this->_topic |
|
722 | 722 | && $this->_get_component_style($this->_topic)) { |
723 | 723 | array_shift($this->_scope); |
724 | 724 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $qb = call_user_func(array($this->_request['class'], 'new_query_builder')); |
54 | 54 | |
55 | - if ( !empty($this->_request['constraints']) |
|
55 | + if (!empty($this->_request['constraints']) |
|
56 | 56 | && is_array($this->_request['constraints'])) { |
57 | 57 | $this->_apply_constraints($qb, $this->_request['constraints']); |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $qb->end_group(); |
65 | 65 | } |
66 | 66 | |
67 | - if ( !empty($this->_request['orders']) |
|
67 | + if (!empty($this->_request['orders']) |
|
68 | 68 | && is_array($this->_request['orders'])) { |
69 | 69 | ksort($this->_request['orders']); |
70 | 70 | foreach ($this->_request['orders'] as $data) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | ksort($constraints); |
85 | 85 | foreach ($constraints as $key => $data) { |
86 | - if ( !array_key_exists('value', $data) |
|
86 | + if (!array_key_exists('value', $data) |
|
87 | 87 | || empty($data['field']) |
88 | 88 | || empty($data['op'])) { |
89 | 89 | debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | { |
157 | 157 | $query = $this->_request["term"]; |
158 | 158 | $wildcard_query = $query; |
159 | - if ( isset($this->_request['auto_wildcards']) |
|
159 | + if (isset($this->_request['auto_wildcards']) |
|
160 | 160 | && strpos($query, '%') === false) { |
161 | 161 | switch ($this->_request['auto_wildcards']) { |
162 | 162 | case 'start': |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | self::$_data = self::$_defaults; |
276 | 276 | } |
277 | 277 | |
278 | - if ( null === $subkey |
|
278 | + if (null === $subkey |
|
279 | 279 | && isset(self::$_data[$key])) { |
280 | 280 | return self::$_data[$key]; |
281 | 281 | } |
282 | - if ( null !== $subkey |
|
282 | + if (null !== $subkey |
|
283 | 283 | && isset(self::$_data[$key][$subkey])) { |
284 | 284 | return self::$_data[$key][$subkey]; |
285 | 285 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if ($part === '') { |
342 | 342 | continue; |
343 | 343 | } |
344 | - if ( midcom::get()->config->get('theme') |
|
344 | + if (midcom::get()->config->get('theme') |
|
345 | 345 | && !$args_started |
346 | 346 | && midcom_helper_misc::check_page_exists($part)) { |
347 | 347 | $page_style .= '/' . $part; |
@@ -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), |