@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function show($show_simple = false) |
| 148 | 148 | { |
| 149 | - if ( $show_simple |
|
| 149 | + if ($show_simple |
|
| 150 | 150 | || !midcom::get()->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) { |
| 151 | 151 | $this->show_simple(); |
| 152 | 152 | return; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function show_simple($prefer_fancy = false) |
| 179 | 179 | { |
| 180 | - if ( $prefer_fancy |
|
| 180 | + if ($prefer_fancy |
|
| 181 | 181 | && midcom::get()->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) { |
| 182 | 182 | return $this->show(); |
| 183 | 183 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | // Complete fields |
| 465 | 465 | $this->indexed = time(); |
| 466 | - if ( $this->author == '' |
|
| 466 | + if ($this->author == '' |
|
| 467 | 467 | && isset($this->creator->name)) { |
| 468 | 468 | $this->author = $this->creator->name; |
| 469 | 469 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | public function read_metadata_from_object($object) |
| 607 | 607 | { |
| 608 | 608 | // Published is set to non-empty value, use it as creation data |
| 609 | - if ( !empty($object->metadata->published) |
|
| 609 | + if (!empty($object->metadata->published) |
|
| 610 | 610 | && !preg_match('/0{1,4}-0{1,2}0{1,2}\s+0{1,2}:0{1,2}:0{1,2}/', $object->metadata->published)) { |
| 611 | 611 | $this->created = $this->read_unixtime($object->metadata->published); |
| 612 | 612 | } elseif (isset($object->metadata->created)) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | return @strtotime($stamp); |
| 646 | 646 | } |
| 647 | 647 | // Unix timestamp |
| 648 | - return (int)$stamp; |
|
| 648 | + return (int) $stamp; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -680,7 +680,8 @@ |
||
| 680 | 680 | { |
| 681 | 681 | try { |
| 682 | 682 | return midcom_db_person::get_cached($id); |
| 683 | - } catch (midcom_error $e) { |
|
| 683 | + } |
|
| 684 | + catch (midcom_error $e) { |
|
| 684 | 685 | return false; |
| 685 | 686 | } |
| 686 | 687 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | private function process_attachment() |
| 95 | 95 | { |
| 96 | - if ( !isset($this->attachment->metadata) |
|
| 96 | + if (!isset($this->attachment->metadata) |
|
| 97 | 97 | || !is_object($this->attachment->metadata)) { |
| 98 | 98 | return; |
| 99 | 99 | } |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (strlen(trim($this->attachment->title)) > 0) { |
| 145 | - $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
| 145 | + $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
| 146 | 146 | $this->content .= "\n{$this->attachment->title}\n{$this->attachment->name}"; |
| 147 | 147 | } else { |
| 148 | - $this->title = $this->attachment->name; |
|
| 148 | + $this->title = $this->attachment->name; |
|
| 149 | 149 | $this->content .= "\n{$this->attachment->name}"; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -85,7 +85,8 @@ |
||
| 85 | 85 | |
| 86 | 86 | try { |
| 87 | 87 | $this->session->start(); |
| 88 | - } catch (RuntimeException $e) { |
|
| 88 | + } |
|
| 89 | + catch (RuntimeException $e) { |
|
| 89 | 90 | debug_add($e->getMessage(), MIDCOM_LOG_ERROR); |
| 90 | 91 | return false; |
| 91 | 92 | } |
@@ -67,15 +67,15 @@ |
||
| 67 | 67 | return true; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( !midcom::get()->config->get('sessioning_service_enable') |
|
| 71 | - && !( midcom::get()->config->get('sessioning_service_always_enable_for_users') |
|
| 70 | + if (!midcom::get()->config->get('sessioning_service_enable') |
|
| 71 | + && !(midcom::get()->config->get('sessioning_service_always_enable_for_users') |
|
| 72 | 72 | && midcom_connection::get_user())) { |
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $this->session = new Session(null, new NamespacedAttributeBag('midcom_session_data', $this->ns_separator)); |
| 77 | 77 | // Try to start session only if the client sends the id OR we need to set data |
| 78 | - if ( !isset($_REQUEST[$this->session->getName()]) |
|
| 78 | + if (!isset($_REQUEST[$this->session->getName()]) |
|
| 79 | 79 | && !$unconditional_start) { |
| 80 | 80 | return false; |
| 81 | 81 | } |
@@ -113,12 +113,12 @@ |
||
| 113 | 113 | return $status; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Get the object of a revision |
|
| 118 | - * |
|
| 119 | - * @param string revision identifier of revision wanted |
|
| 120 | - * @return array array representation of the object |
|
| 121 | - */ |
|
| 116 | + /** |
|
| 117 | + * Get the object of a revision |
|
| 118 | + * |
|
| 119 | + * @param string revision identifier of revision wanted |
|
| 120 | + * @return array array representation of the object |
|
| 121 | + */ |
|
| 122 | 122 | public function get_revision($revision) |
| 123 | 123 | { |
| 124 | 124 | if (empty($this->_guid)) { |
@@ -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 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function read_authentication_data() |
| 26 | 26 | { |
| 27 | - if ( !array_key_exists('midcom_services_auth_frontend_form_submit', $_REQUEST) |
|
| 27 | + if (!array_key_exists('midcom_services_auth_frontend_form_submit', $_REQUEST) |
|
| 28 | 28 | || !array_key_exists('username', $_REQUEST) |
| 29 | 29 | || !array_key_exists('password', $_REQUEST)) { |
| 30 | 30 | return null; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | // Store the submitted form if the session expired, but user wants to save the data |
| 54 | 54 | if (count($_POST) > 0) { |
| 55 | - $data =& midcom_core_context::get()->get_custom_key('request_data'); |
|
| 55 | + $data = & midcom_core_context::get()->get_custom_key('request_data'); |
|
| 56 | 56 | |
| 57 | 57 | $data['restored_form_data'] = array(); |
| 58 | 58 | |
@@ -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; |