@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $rawdata = base64_decode($_COOKIE['midcom_services_i18n']); |
139 | 139 | $array = unserialize($rawdata); |
140 | 140 | |
141 | - if ( !array_key_exists('language', $array) |
|
141 | + if (!array_key_exists('language', $array) |
|
142 | 142 | || !array_key_exists('charset', $array)) { |
143 | 143 | debug_add("Rejecting cookie, it seems invalid."); |
144 | 144 | return; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $lang = substr($lang, 0, 2); |
168 | 168 | $q = $this->_get_q($params); |
169 | 169 | |
170 | - if ( !isset($http_langs[$lang]) |
|
170 | + if (!isset($http_langs[$lang]) |
|
171 | 171 | || $http_langs[$lang] < $q) { |
172 | 172 | $http_langs[$lang] = $q; |
173 | 173 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | function iconv($source_charset, $destination_charset, $string) |
497 | 497 | { |
498 | 498 | $result = @iconv($source_charset, $destination_charset, $string); |
499 | - if ( $result === false |
|
499 | + if ($result === false |
|
500 | 500 | && strlen($string) > 0) { |
501 | 501 | debug_add("Iconv returned failed to convert a string, returning an empty string.", MIDCOM_LOG_WARN); |
502 | 502 | debug_print_r("Tried to convert this string from {$source_charset} to {$destination_charset}:", $string); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | // Get parent from DB and compare to catch moves |
78 | 78 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
79 | 79 | $parent_entry_from_object = $this->get_guid($parent->guid); |
80 | - if ( $parent_entry_from_object |
|
80 | + if ($parent_entry_from_object |
|
81 | 81 | && $parent_entry_from_object[MIDCOM_NAV_ID] != $cached_node_id) { |
82 | 82 | $this->_cache->delete($this->_prefix . '-' . $parent_entry_from_object[MIDCOM_NAV_ID] . '-leaves'); |
83 | 83 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $parent_id = $napobject[MIDCOM_NAV_NODEID]; |
93 | 93 | $parent_entry = $this->get_node($parent_id); |
94 | 94 | |
95 | - if ( $parent_entry |
|
95 | + if ($parent_entry |
|
96 | 96 | && array_key_exists(MIDCOM_NAV_SUBNODES, $parent_entry)) { |
97 | 97 | unset($parent_entry[MIDCOM_NAV_SUBNODES]); |
98 | 98 | $this->put_node($parent_id, $parent_entry); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if ($parent = $napobject[MIDCOM_NAV_OBJECT]->get_parent()) { |
103 | 103 | $parent_entry_from_object = $this->get_guid($parent->guid); |
104 | 104 | |
105 | - if ( !empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
105 | + if (!empty($parent_entry_from_object[MIDCOM_NAV_ID]) |
|
106 | 106 | && !empty($parent_entry[MIDCOM_NAV_ID]) |
107 | 107 | && $parent_entry_from_object[MIDCOM_NAV_ID] != $parent_entry[MIDCOM_NAV_ID]) { |
108 | 108 | unset($parent_entry_from_object[MIDCOM_NAV_SUBNODES]); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $nav = new midcom_helper_nav; |
129 | 129 | if (is_a($object, 'midcom_db_topic')) { |
130 | 130 | $napobject = $nav->get_node($object->id); |
131 | - } elseif ( ($node = $nav->find_closest_topic($object)) |
|
131 | + } elseif (($node = $nav->find_closest_topic($object)) |
|
132 | 132 | && $nodeobject = $nav->get_node($node->id)) { |
133 | 133 | $napobject = $nav->get_leaf($nodeobject[MIDCOM_NAV_ID] . '-' . $object->id); |
134 | 134 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | $lang_id = midcom::get()->i18n->get_current_language(); |
155 | 155 | $result = $this->_cache->fetch("{$this->_prefix}-{$key}"); |
156 | - if ( !is_array($result) |
|
156 | + if (!is_array($result) |
|
157 | 157 | || !isset($result[$lang_id])) { |
158 | 158 | return false; |
159 | 159 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | $lang_id = midcom::get()->i18n->get_current_language(); |
179 | 179 | $result = $this->_cache->fetch("{$this->_prefix}-{$key}"); |
180 | - if ( !is_array($result) |
|
180 | + if (!is_array($result) |
|
181 | 181 | || !isset($result[$lang_id])) { |
182 | 182 | return false; |
183 | 183 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $lang_id = midcom::get()->i18n->get_current_language(); |
264 | 264 | $result = $this->_cache->fetch("{$this->_prefix}-{$guid}"); |
265 | - if ( !is_array($result) |
|
265 | + if (!is_array($result) |
|
266 | 266 | || !isset($result[$lang_id])) { |
267 | 267 | return false; |
268 | 268 | } |
@@ -132,7 +132,8 @@ |
||
132 | 132 | && $nodeobject = $nav->get_node($node->id)) { |
133 | 133 | $napobject = $nav->get_leaf($nodeobject[MIDCOM_NAV_ID] . '-' . $object->id); |
134 | 134 | } |
135 | - } catch (midcom_error $e) { |
|
135 | + } |
|
136 | + catch (midcom_error $e) { |
|
136 | 137 | $e->log(); |
137 | 138 | } |
138 | 139 | return $napobject; |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | $this->_uncached = midcom::get()->config->get('cache_module_content_uncached'); |
279 | 279 | $this->_headers_strategy = strtolower(midcom::get()->config->get('cache_module_content_headers_strategy')); |
280 | 280 | $this->_headers_strategy_authenticated = strtolower(midcom::get()->config->get('cache_module_content_headers_strategy_authenticated')); |
281 | - $this->_default_lifetime = (int)midcom::get()->config->get('cache_module_content_default_lifetime'); |
|
282 | - $this->_default_lifetime_authenticated = (int)midcom::get()->config->get('cache_module_content_default_lifetime_authenticated'); |
|
281 | + $this->_default_lifetime = (int) midcom::get()->config->get('cache_module_content_default_lifetime'); |
|
282 | + $this->_default_lifetime_authenticated = (int) midcom::get()->config->get('cache_module_content_default_lifetime_authenticated'); |
|
283 | 283 | $this->_force_headers = midcom::get()->config->get('cache_module_content_headers_force'); |
284 | 284 | |
285 | 285 | switch ($this->_headers_strategy) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | _midcom_header('Cache-Control: post-check=0, pre-check=0', false); |
452 | 452 | |
453 | 453 | //Suppress "Pragma: no-cache" header, because otherwise file downloads don't work in IE < 9 with https. |
454 | - if ( !isset($_SERVER['HTTPS']) |
|
454 | + if (!isset($_SERVER['HTTPS']) |
|
455 | 455 | || !isset($_SERVER['HTTP_USER_AGENT']) |
456 | 456 | || !preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { |
457 | 457 | _midcom_header('Pragma: no-cache'); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function expires($timestamp) |
509 | 509 | { |
510 | - if ( is_null($this->_expires) |
|
510 | + if (is_null($this->_expires) |
|
511 | 511 | || $this->_expires > $timestamp) { |
512 | 512 | $this->_expires = $timestamp; |
513 | 513 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | */ |
784 | 784 | public function write_meta_cache($content_id, $etag) |
785 | 785 | { |
786 | - if ( $this->_uncached |
|
786 | + if ($this->_uncached |
|
787 | 787 | || $this->_no_cache) { |
788 | 788 | return; |
789 | 789 | } |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $to_save[$guid] = $guidmap; |
833 | 833 | } |
834 | 834 | |
835 | - if ( $content_id !== $request_id |
|
835 | + if ($content_id !== $request_id |
|
836 | 836 | && !in_array($request_id, $guidmap)) { |
837 | 837 | $guidmap[] = $request_id; |
838 | 838 | $to_save[$guid] = $guidmap; |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | |
845 | 845 | public function check_dl_hit($context, $dl_config) |
846 | 846 | { |
847 | - if ( $this->_no_cache |
|
847 | + if ($this->_no_cache |
|
848 | 848 | || $this->_live_mode) { |
849 | 849 | return false; |
850 | 850 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | public function store_dl_content($context, $dl_config, $dl_cache_data) |
867 | 867 | { |
868 | - if ( $this->_no_cache |
|
868 | + if ($this->_no_cache |
|
869 | 869 | || $this->_live_mode |
870 | 870 | || $this->_uncached) { |
871 | 871 | return; |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | $time = $meta['lastmodified']; |
950 | 950 | } |
951 | 951 | } |
952 | - if ( $time == 0 |
|
952 | + if ($time == 0 |
|
953 | 953 | || !is_numeric($time)) { |
954 | 954 | $time = time(); |
955 | 955 | } |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | |
961 | 961 | $this->cache_control_headers(); |
962 | 962 | |
963 | - if ( is_array($this->_force_headers) |
|
963 | + if (is_array($this->_force_headers) |
|
964 | 964 | && !empty($this->_force_headers)) { |
965 | 965 | foreach ($this->_force_headers as $header => $value) { |
966 | 966 | $header_string = "{$header}: {$value}"; |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $expires = false; |
1006 | 1006 | $strategy = $this->_headers_strategy; |
1007 | 1007 | $default_lifetime = $this->_default_lifetime; |
1008 | - if ( midcom::get()->auth->is_valid_user() |
|
1008 | + if (midcom::get()->auth->is_valid_user() |
|
1009 | 1009 | || midcom_connection::get_user()) { |
1010 | 1010 | $strategy = $this->_headers_strategy_authenticated; |
1011 | 1011 | $default_lifetime = $this->_default_lifetime_authenticated; |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $schemadb[$schema]->fields[$key]['title'] = $schemadb[$schema]->l10n_schema->get($schemadb[$schema]->fields[$key]['title']); |
115 | 115 | } |
116 | 116 | |
117 | - if ( !isset($this->_request_data['config']->_local[$key]) |
|
117 | + if (!isset($this->_request_data['config']->_local[$key]) |
|
118 | 118 | || $this->_request_data['config']->_local[$key] == $this->_request_data['config']->_global[$key]) { |
119 | 119 | // No local configuration setting, note to user that this is the global value |
120 | 120 | $schemadb[$schema]->fields[$key]['title'] = $schemadb[$schema]->l10n_schema->get($schemadb[$schema]->fields[$key]['title']); |
121 | - $schemadb[$schema]->fields[$key]['title'] .= " <span class=\"global\">(" . $this->_l10n->get('global value') .")</span>"; |
|
121 | + $schemadb[$schema]->fields[$key]['title'] .= " <span class=\"global\">(" . $this->_l10n->get('global value') . ")</span>"; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | foreach ($config as $key => $value) { |
309 | - if ( is_array($value) |
|
309 | + if (is_array($value) |
|
310 | 310 | || is_object($value)) { |
311 | 311 | /** |
312 | 312 | * See http://trac.midgard-project.org/ticket/1442 |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $newval = $post[$key]; |
328 | 328 | } |
329 | 329 | |
330 | - if ( is_a($this->_controller->datamanager->types[$key], 'midcom_helper_datamanager2_type_select') |
|
330 | + if (is_a($this->_controller->datamanager->types[$key], 'midcom_helper_datamanager2_type_select') |
|
331 | 331 | || is_a($this->_controller->datamanager->types[$key], 'midcom_helper_datamanager2_type_boolean')) { |
332 | 332 | // We want the actual values regardless of widget |
333 | 333 | $newval = $this->_controller->datamanager->types[$key]->convert_to_storage(); |
@@ -306,7 +306,7 @@ |
||
306 | 306 | * See http://trac.midgard-project.org/ticket/1442 |
307 | 307 | $topic->set_parameter($this->_request_data['name'], var_export($value, true)); |
308 | 308 | */ |
309 | - continue; |
|
309 | + continue; |
|
310 | 310 | } |
311 | 311 | $topic->set_parameter($this->_request_data['name'], $key, $value); |
312 | 312 | } |
@@ -405,7 +405,8 @@ |
||
405 | 405 | |
406 | 406 | try { |
407 | 407 | $this->_check_config($config); |
408 | - } catch (Exception $e) { |
|
408 | + } |
|
409 | + catch (Exception $e) { |
|
409 | 410 | midcom::get()->uimessages->add( |
410 | 411 | $this->_l10n_midcom->get('component configuration'), |
411 | 412 | sprintf($this->_l10n->get('configuration save failed: %s'), $e->getMessage()), |
@@ -378,7 +378,7 @@ |
||
378 | 378 | // repositories are "merged" manually |
379 | 379 | $directories = array(); |
380 | 380 | $manifests = array(); |
381 | - exec('find ' . MIDCOM_ROOT . ' ' . dirname(MIDCOM_ROOT) . '/src -follow -type d -name "config"', $directories); |
|
381 | + exec('find ' . MIDCOM_ROOT . ' ' . dirname(MIDCOM_ROOT) . '/src -follow -type d -name "config"', $directories); |
|
382 | 382 | foreach ($directories as $directory) { |
383 | 383 | $candidates[] = "{$directory}/manifest.inc"; |
384 | 384 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // Set the status |
184 | - if ( $this->can_do('net.nehmer.comments:moderation') |
|
184 | + if ($this->can_do('net.nehmer.comments:moderation') |
|
185 | 185 | && !$this->_sudo_requested) { |
186 | 186 | $this->status = net_nehmer_comments_comment::ABUSE; |
187 | 187 | } else { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | // Set the status |
208 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
208 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
209 | 209 | || $this->_sudo_requested) { |
210 | 210 | return false; |
211 | 211 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Set the status |
232 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
232 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
233 | 233 | || $this->_sudo_requested) { |
234 | 234 | return false; |
235 | 235 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function report_not_abuse() |
250 | 250 | { |
251 | - if ( !$this->can_do('net.nehmer.comments:moderation') |
|
251 | + if (!$this->can_do('net.nehmer.comments:moderation') |
|
252 | 252 | || $this->_sudo_requested) { |
253 | 253 | return false; |
254 | 254 | } |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | { |
352 | 352 | $config = midcom_baseclasses_components_configuration::get('net.nehmer.comments', 'config'); |
353 | 353 | |
354 | - if ( $config->get('ratings_enable') |
|
355 | - && ( $config->get('ratings_cache_to_object') |
|
354 | + if ($config->get('ratings_enable') |
|
355 | + && ($config->get('ratings_cache_to_object') |
|
356 | 356 | || $config->get('comment_count_cache_to_object'))) { |
357 | 357 | // Handle ratings |
358 | 358 | $comments = net_nehmer_comments_comment::list_by_objectguid($this->objectguid); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | |
416 | - if ( empty($this->title) |
|
416 | + if (empty($this->title) |
|
417 | 417 | && empty($this->content)) { |
418 | 418 | // No need to send notifications about empty rating entries |
419 | 419 | return false; |
@@ -408,7 +408,8 @@ |
||
408 | 408 | //Get the parent object |
409 | 409 | try { |
410 | 410 | $parent = midcom::get()->dbfactory->get_object_by_guid($this->objectguid); |
411 | - } catch (midcom_error $e) { |
|
411 | + } |
|
412 | + catch (midcom_error $e) { |
|
412 | 413 | $e->log(); |
413 | 414 | return false; |
414 | 415 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $this->load_comment($args[0], false); |
40 | 40 | $moderators = $this->_config->get('moderators'); |
41 | - if ( $this->_comment->report_abuse() |
|
41 | + if ($this->_comment->report_abuse() |
|
42 | 42 | && $moderators) { |
43 | 43 | // Prepare notification message |
44 | 44 | $message = array(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $message['content'] = ''; |
47 | 47 | $logs = $this->_comment->get_logs(); |
48 | 48 | if (count($logs) > 0) { |
49 | - $message['content'] .= $this->_l10n->get('moderation history').":\n\n"; |
|
49 | + $message['content'] .= $this->_l10n->get('moderation history') . ":\n\n"; |
|
50 | 50 | foreach ($logs as $time => $log) { |
51 | 51 | $reported = $this->_l10n->get_formatter()->datetime(strtotime("{$time}Z")); |
52 | 52 | $message['content'] .= $this->_l10n->get(sprintf('%s: %s by %s (from %s)', "$reported:\n", $this->_l10n->get($log['action']), $log['reporter'], $log['ip'])) . "\n\n"; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->_comment = new net_nehmer_comments_comment($identifier); |
120 | 120 | |
121 | 121 | if (!$this->_comment->can_do('midgard:update')) { |
122 | - $this->_comment->_sudo_requested = midcom::get()->auth->request_sudo('net.nehmer.comments');; |
|
122 | + $this->_comment->_sudo_requested = midcom::get()->auth->request_sudo('net.nehmer.comments'); ; |
|
123 | 123 | } |
124 | 124 | if ($require_moderation_privilege) { |
125 | 125 | $this->_comment->require_do('net.nehmer.comments:moderation'); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $tagstring = self::resolve_tagname($tagname); |
69 | 69 | $tag = net_nemein_tag_tag_dba::get_by_tag($tagstring); |
70 | 70 | if (!$tag) { |
71 | - $tag = new net_nemein_tag_tag_dba(); |
|
71 | + $tag = new net_nemein_tag_tag_dba(); |
|
72 | 72 | $tag->tag = $tagstring; |
73 | 73 | $tag->url = $url; |
74 | 74 | if (!$tag->create()) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return; |
78 | 78 | } |
79 | 79 | } |
80 | - $link = new net_nemein_tag_link_dba(); |
|
80 | + $link = new net_nemein_tag_link_dba(); |
|
81 | 81 | $link->tag = $tag->id; |
82 | 82 | $link->context = self::resolve_context($tagname); |
83 | 83 | $link->value = self::resolve_value($tagname); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function copy_tags($from, $to, $component = null) |
191 | 191 | { |
192 | - if ( !is_object($from) |
|
192 | + if (!is_object($from) |
|
193 | 193 | || !is_object($to)) { |
194 | 194 | return false; |
195 | 195 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $quote_open = false; |
494 | 494 | for ($i = 0; $i < (strlen($tags_string) + 1); $i++) { |
495 | 495 | $char = substr($tags_string, $i, 1); |
496 | - if ( ( $char == ' ' |
|
496 | + if (($char == ' ' |
|
497 | 497 | && !$quote_open) |
498 | 498 | || $i == strlen($tags_string)) { |
499 | 499 | $tags[] = $current_tag; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $quote_open = false; |
505 | 505 | continue; |
506 | 506 | } |
507 | - if ( $char === '"' |
|
507 | + if ($char === '"' |
|
508 | 508 | || $char === "'") { |
509 | 509 | $quote_open = $char; |
510 | 510 | continue; |
@@ -384,7 +384,8 @@ discard block |
||
384 | 384 | $value = $link->value; |
385 | 385 | |
386 | 386 | $tags[$key] = $value; |
387 | - } catch (midcom_error $e) { |
|
387 | + } |
|
388 | + catch (midcom_error $e) { |
|
388 | 389 | $e->log(); |
389 | 390 | } |
390 | 391 | } |
@@ -443,7 +444,8 @@ discard block |
||
443 | 444 | try { |
444 | 445 | $tag = net_nemein_tag_tag_dba::get_cached($link->tag); |
445 | 446 | $link_object_map[$link->fromGuid][$tag->tag] = $link; |
446 | - } catch (midcom_error $e) { |
|
447 | + } |
|
448 | + catch (midcom_error $e) { |
|
447 | 449 | $e->log(); |
448 | 450 | } |
449 | 451 | } |
@@ -472,7 +474,8 @@ discard block |
||
472 | 474 | $tmpobject = midcom::get()->dbfactory->convert_midgard_to_midcom($tmpobject); |
473 | 475 | } |
474 | 476 | $return[] = $tmpobject; |
475 | - } catch (midcom_error $e) { |
|
477 | + } |
|
478 | + catch (midcom_error $e) { |
|
476 | 479 | $e->log(); |
477 | 480 | } |
478 | 481 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - if ( is_null($position['longitude']) |
|
136 | + if (is_null($position['longitude']) |
|
137 | 137 | || is_null($position['latitude'])) { |
138 | 138 | // Not enough information for positioning, we need both lon and lat |
139 | 139 | return false; |