@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $clientip = $_SERVER['REMOTE_ADDR']; |
193 | 193 | } |
194 | 194 | |
195 | - if ( midcom::get()->config->get('auth_check_client_ip') |
|
195 | + if (midcom::get()->config->get('auth_check_client_ip') |
|
196 | 196 | && $session->clientip != $clientip) { |
197 | 197 | debug_add("The session {$session->guid} (#{$session->id}) had mismatching client IP.", MIDCOM_LOG_INFO); |
198 | 198 | debug_add("Expected {$session->clientip}, got {$clientip}."); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | private function _load_person() |
255 | 255 | { |
256 | 256 | if (!$this->user) { |
257 | - debug_add("Failed to authenticate the given user: ". midcom_connection::get_error_string(), |
|
257 | + debug_add("Failed to authenticate the given user: " . midcom_connection::get_error_string(), |
|
258 | 258 | MIDCOM_LOG_INFO); |
259 | 259 | return false; |
260 | 260 | } |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | $result = array(); |
441 | 441 | $query_result = array_keys($mc->list_keys()); |
442 | 442 | foreach ($query_result as $userid) { |
443 | - if ( ($user = $this->auth->get_user($userid)) |
|
443 | + if (($user = $this->auth->get_user($userid)) |
|
444 | 444 | && $user->is_online()) { |
445 | 445 | $result[$user->guid] = $user; |
446 | 446 | } |
@@ -175,7 +175,8 @@ |
||
175 | 175 | { |
176 | 176 | try { |
177 | 177 | $session = new midcom_core_login_session_db($sessionid); |
178 | - } catch (Exception $e) { |
|
178 | + } |
|
179 | + catch (Exception $e) { |
|
179 | 180 | debug_add('Login session ' . $sessionid . ' failed to load: ' . $e->getMessage(), MIDCOM_LOG_INFO); |
180 | 181 | return false; |
181 | 182 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | public function _on_initialize() |
20 | 20 | { |
21 | 21 | // Match / |
22 | - if ( is_null($this->_config->get('redirection_type')) |
|
23 | - || ( $this->_topic->can_do('net.nemein.redirector:noredirect') |
|
22 | + if (is_null($this->_config->get('redirection_type')) |
|
23 | + || ($this->_topic->can_do('net.nemein.redirector:noredirect') |
|
24 | 24 | && !$this->_config->get('admin_redirection'))) { |
25 | 25 | $this->_request_switch['redirect'] = array( |
26 | 26 | 'handler' => array('net_nemein_redirector_handler_tinyurl', 'list'), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // Catch first the configuration option for showing editing interface instead |
79 | 79 | // of redirecting administrators |
80 | - if ( $this->_topic->can_do('net.nemein.redirector:noredirect') |
|
80 | + if ($this->_topic->can_do('net.nemein.redirector:noredirect') |
|
81 | 81 | && !$this->_config->get('admin_redirection')) { |
82 | 82 | midcom::get()->relocate("{$this->_topic->name}/edit/{$args[0]}/"); |
83 | 83 | } |
@@ -152,7 +152,8 @@ |
||
152 | 152 | try { |
153 | 153 | $topic = new midcom_db_topic($id); |
154 | 154 | $id = $topic->id; |
155 | - } catch (midcom_error $e) { |
|
155 | + } |
|
156 | + catch (midcom_error $e) { |
|
156 | 157 | $e->log(); |
157 | 158 | break; |
158 | 159 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | that is populated only once, and even then only the |
131 | 131 | first time we encounter a namespaced wikilink */ |
132 | 132 | static $folder_tree = array(); |
133 | - if ( count($folder_tree) == 0 |
|
133 | + if (count($folder_tree) == 0 |
|
134 | 134 | || $force_resolve_folder_tree) { |
135 | 135 | $folder_tree = $this->_resolve_folder_tree($force_as_root); |
136 | 136 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $localpath = $path; |
161 | 161 | $matches['latest_parent'] = $folder_tree['/']; |
162 | 162 | $missing_levels = 0; |
163 | - while ( $localpath |
|
163 | + while ($localpath |
|
164 | 164 | && $localpath != '/') { |
165 | 165 | $localpath = dirname($localpath); |
166 | 166 | $missing_levels++; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $root_folder = $folder; |
189 | 189 | $max = 100; |
190 | - while ( $folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
190 | + while ($folder[MIDCOM_NAV_COMPONENT] == 'net.nemein.wiki' |
|
191 | 191 | && (($parent = $nap->get_node_uplink($folder[MIDCOM_NAV_ID])) != -1) |
192 | 192 | && $max > 0) { |
193 | 193 | $root_folder = $folder; |
@@ -196,7 +196,8 @@ |
||
196 | 196 | |
197 | 197 | try { |
198 | 198 | $diff_fields = $rcs_handler->get_diff($prev_version, $this_version, 'unified'); |
199 | - } catch (midcom_error $e) { |
|
199 | + } |
|
200 | + catch (midcom_error $e) { |
|
200 | 201 | $e->log(); |
201 | 202 | return ''; |
202 | 203 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | public function _on_creating() |
31 | 31 | { |
32 | - if ( $this->title == '' |
|
32 | + if ($this->title == '' |
|
33 | 33 | || !$this->topic) { |
34 | 34 | // We must have wikiword and topic at this stage |
35 | 35 | return false; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return $this->render_link($parts[1], $parts[2]) . $after; |
225 | 225 | |
226 | 226 | // Macro [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
227 | - case ( preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
227 | + case (preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
228 | 228 | && method_exists($this, "_run_macro_{$macro_parts[1]}")): |
229 | 229 | $method = "_run_macro_{$macro_parts[1]}"; |
230 | 230 | return $this->$method($macro_parts[2], $match[0], $after); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $folder = $wikipage_match['latest_parent']; |
258 | 258 | } |
259 | 259 | |
260 | - if ( isset($folder[MIDCOM_NAV_OBJECT]) |
|
260 | + if (isset($folder[MIDCOM_NAV_OBJECT]) |
|
261 | 261 | && $folder[MIDCOM_NAV_OBJECT]->can_do('midgard:create')) { |
262 | 262 | $workflow = $this->get_workflow('datamanager2'); |
263 | 263 | return "<a href=\"{$folder[MIDCOM_NAV_ABSOLUTEURL]}create/?wikiword={$wikipage_match['remaining_path']}\" " . $workflow->render_attributes() . " class=\"wiki_missing\" title=\"" . $this->_l10n->get('click to create') . "\">{$text}</a>"; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $links[$parts[1]] = $parts[2]; |
301 | 301 | break; |
302 | 302 | // Ignore macros [something: <data>] (for example [abbr: BOFH - Bastard Operator From Hell] or [photo: <GUID>]) |
303 | - case ( preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
303 | + case (preg_match('/^(.*?): (.*)/', $fulltext, $macro_parts) |
|
304 | 304 | && method_exists($this, "_run_macro_{$macro_parts[1]}")): |
305 | 305 | continue 2; |
306 | 306 |
@@ -63,7 +63,8 @@ |
||
63 | 63 | |
64 | 64 | try { |
65 | 65 | $attachment = new midcom_db_attachment($guid); |
66 | - } catch (midcom_error $e) { |
|
66 | + } |
|
67 | + catch (midcom_error $e) { |
|
67 | 68 | $e->log(); |
68 | 69 | return "<span class=\"missing_photo\" title=\"{$guid}\">{$fulltag}</span>{$after}"; |
69 | 70 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | if (!$this->_page->create()) { |
67 | 67 | debug_print_r('We operated on this object:', $this->_page); |
68 | - throw new midcom_error('Failed to create a new page. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
68 | + throw new midcom_error('Failed to create a new page. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $this->_page; |
@@ -114,7 +114,8 @@ |
||
114 | 114 | } else { |
115 | 115 | try { |
116 | 116 | net_nemein_wiki_viewer::initialize_index_article($topic); |
117 | - } catch (midcom_error $e) { |
|
117 | + } |
|
118 | + catch (midcom_error $e) { |
|
118 | 119 | // Could not create index |
119 | 120 | $topic->delete(); |
120 | 121 | throw $e; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function __construct() |
38 | 38 | { |
39 | - $this->_request_data['page'] =& $this->_page; |
|
39 | + $this->_request_data['page'] = & $this->_page; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | if (midcom::get()->config->get('enable_ajax_editing')) { |
48 | 48 | $this->_controller = midcom_helper_datamanager2_controller::create('ajax'); |
49 | - $this->_controller->schemadb =& $this->_request_data['schemadb']; |
|
49 | + $this->_controller->schemadb = & $this->_request_data['schemadb']; |
|
50 | 50 | $this->_controller->set_storage($this->_page); |
51 | 51 | $this->_controller->process_ajax(); |
52 | 52 | $this->_datamanager = $this->_controller->datamanager; |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | $toc .= "\n<ol class=\"midcom_helper_toc_formatter level_{$current_list_level}\">\n"; |
273 | 273 | foreach ($headings[4] as $key => $heading) { |
274 | 274 | $anchor = 'heading-' . md5($heading); |
275 | - $tag_level =& $headings[3][$key]; |
|
276 | - $heading_code =& $headings[0][$key]; |
|
277 | - $heading_tag =& $headings[2][$key]; |
|
275 | + $tag_level = & $headings[3][$key]; |
|
276 | + $heading_code = & $headings[0][$key]; |
|
277 | + $heading_tag = & $headings[2][$key]; |
|
278 | 278 | $heading_new_code = "<a id='{$anchor}'></a>{$heading_code}"; |
279 | 279 | $content = str_replace($heading_code, $heading_new_code, $content); |
280 | 280 | if ($current_tag_level === false) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
303 | - $toc .= "<li class='{$heading_tag}'><a href='#{$anchor}'>" . strip_tags($heading) . "</a>"; |
|
303 | + $toc .= "<li class='{$heading_tag}'><a href='#{$anchor}'>" . strip_tags($heading) . "</a>"; |
|
304 | 304 | } |
305 | 305 | for ($i = $current_list_level; $i > 0; $i--) { |
306 | 306 | $toc .= "</li>\n</ol>\n"; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | $user = midcom::get()->auth->user->get_storage(); |
369 | 369 | |
370 | - if ( array_key_exists('target', $_POST) |
|
370 | + if (array_key_exists('target', $_POST) |
|
371 | 371 | && $_POST['target'] == 'folder') { |
372 | 372 | // We're subscribing to the whole wiki |
373 | 373 | $object = $this->_topic; |
@@ -31,7 +31,8 @@ |
||
31 | 31 | foreach ($feeds as $feed) { |
32 | 32 | try { |
33 | 33 | midcom_db_topic::get_cached($feed->node); |
34 | - } catch (midcom_error $e) { |
|
34 | + } |
|
35 | + catch (midcom_error $e) { |
|
35 | 36 | debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR); |
36 | 37 | continue; |
37 | 38 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $etag = trim($parser->data['headers']['etag']); |
102 | 102 | |
103 | 103 | $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag'); |
104 | - if ( !empty($feed_etag) |
|
104 | + if (!empty($feed_etag) |
|
105 | 105 | && $feed_etag == $etag) { |
106 | 106 | // Feed hasn't changed, skip updating |
107 | 107 | debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $guid = $item->get_id(); |
188 | 188 | $title = $item->get_title(); |
189 | 189 | |
190 | - if ( ( empty($title) |
|
190 | + if ((empty($title) |
|
191 | 191 | || trim($title) == '...') |
192 | 192 | && empty($guid)) { |
193 | 193 | // Something wrong with this entry, skip it |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $meta_values['published'] = $article_date; |
256 | 256 | } |
257 | 257 | |
258 | - if ( $this->apply_values($article, $values, $meta_values) |
|
258 | + if ($this->apply_values($article, $values, $meta_values) |
|
259 | 259 | && !$article->update()) { |
260 | 260 | return false; |
261 | 261 | } |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | private function find_author(net_nemein_rss_parser_item $item) |
285 | 285 | { |
286 | 286 | // Try to figure out item author |
287 | - if ( $this->_feed->forceauthor |
|
287 | + if ($this->_feed->forceauthor |
|
288 | 288 | && $this->_feed->defaultauthor) { |
289 | 289 | // Feed has a "default author" set, use it |
290 | 290 | return new midcom_db_person($this->_feed->defaultauthor); |
291 | 291 | } |
292 | 292 | $author = $this->match_item_author($item); |
293 | 293 | $fallback_person_id = 1; |
294 | - if ( !$author |
|
294 | + if (!$author |
|
295 | 295 | || $author->id == $fallback_person_id) { |
296 | 296 | if ($this->_feed->defaultauthor) { |
297 | 297 | // Feed has a "default author" set, use it |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - if ( !empty($author_info['username']) |
|
480 | + if (!empty($author_info['username']) |
|
481 | 481 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
482 | 482 | return $person->get_storage(); |
483 | 483 | } |