@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->_guid = $args[0]; |
203 | 203 | $this->_load_object(); |
204 | 204 | |
205 | - if ( !$this->_backend->version_exists($args[1]) |
|
205 | + if (!$this->_backend->version_exists($args[1]) |
|
206 | 206 | || !$this->_backend->version_exists($args[2])) { |
207 | 207 | throw new midcom_error_notfound("One of the revisions {$args[1]} or {$args[2]} does not exist."); |
208 | 208 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->_request_data['earlier_revision'] = $this->_backend->get_prev_version($args[1]); |
218 | 218 | $this->_request_data['previous_revision'] = $args[1]; |
219 | 219 | $this->_request_data['latest_revision'] = $args[2]; |
220 | - $this->_request_data['next_revision'] = $this->_backend->get_next_version($args[2]); |
|
220 | + $this->_request_data['next_revision'] = $this->_backend->get_next_version($args[2]); |
|
221 | 221 | |
222 | 222 | $this->_request_data['guid'] = $args[0]; |
223 | 223 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | // Set the version numbers |
292 | 292 | $data['previous_revision'] = $this->_backend->get_prev_version($args[1]); |
293 | 293 | $data['latest_revision'] = $args[1]; |
294 | - $data['next_revision'] = $this->_backend->get_next_version($args[1]); |
|
294 | + $data['next_revision'] = $this->_backend->get_next_version($args[1]); |
|
295 | 295 | $data['guid'] = $args[0]; |
296 | 296 | } |
297 | 297 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $this->_object->require_do('midgard:update'); |
319 | 319 | // TODO: set another privilege for restoring? |
320 | 320 | |
321 | - if ( $this->_backend->version_exists($args[1]) |
|
321 | + if ($this->_backend->version_exists($args[1]) |
|
322 | 322 | && $this->_backend->restore_to_revision($args[1])) { |
323 | 323 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('restore to version %s successful'), $args[1])); |
324 | 324 | return new midcom_response_relocate(midcom::get()->permalinks->create_permalink($this->_object->guid)); |
@@ -336,7 +336,7 @@ |
||
336 | 336 | public function update_cache() |
337 | 337 | { |
338 | 338 | // Check if the attachment can be read anonymously |
339 | - if ( midcom::get()->config->get('attachment_cache_enabled') |
|
339 | + if (midcom::get()->config->get('attachment_cache_enabled') |
|
340 | 340 | && !$this->can_do('midgard:read', 'EVERYONE')) { |
341 | 341 | // Not public file, ensure it is removed |
342 | 342 | $filename = $this->get_cache_path(); |
@@ -98,8 +98,8 @@ |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // Check the Metadata if and only if we are configured to do so. |
101 | - if ( is_object($this->object) |
|
102 | - && ( midcom::get()->config->get('show_hidden_objects') == false |
|
101 | + if (is_object($this->object) |
|
102 | + && (midcom::get()->config->get('show_hidden_objects') == false |
|
103 | 103 | || midcom::get()->config->get('show_unapproved_objects') == false)) { |
104 | 104 | // Check Hiding, Scheduling and Approval |
105 | 105 | $metadata = $this->object->metadata; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function is_readable_by($user_id) |
30 | 30 | { |
31 | - return ( empty($this->object) |
|
31 | + return (empty($this->object) |
|
32 | 32 | || !$this->guid |
33 | 33 | || !$user_id |
34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, $this->object->__midcom_class_name__, $user_id)); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->_cookie_path = midcom_connection::get_url('self'); |
53 | 53 | } |
54 | 54 | |
55 | - if ( !empty($_SERVER['HTTPS']) |
|
55 | + if (!empty($_SERVER['HTTPS']) |
|
56 | 56 | && $_SERVER['HTTPS'] !== 'off' |
57 | 57 | && midcom::get()->config->get('auth_backend_simple_cookie_secure')) { |
58 | 58 | $this->_secure_cookie = true; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @todo checksumming ? (though hijacking this is only slightly simpler than hijacking cookies) |
74 | 74 | */ |
75 | 75 | debug_add('Found cookie-id in _GET but not in _COOKIE, referencing', MIDCOM_LOG_INFO); |
76 | - $_COOKIE[$this->_cookie_id] =& $_GET[$this->_cookie_id]; |
|
76 | + $_COOKIE[$this->_cookie_id] = & $_GET[$this->_cookie_id]; |
|
77 | 77 | $reset_cookie = true; |
78 | 78 | } else { |
79 | 79 | return false; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $cache_id = $user_id . '::' . $object_guid; |
519 | 519 | |
520 | 520 | if (!array_key_exists($cache_id, self::$_privileges_cache)) { |
521 | - if ( empty($object_guid) |
|
521 | + if (empty($object_guid) |
|
522 | 522 | || empty($object_class)) { |
523 | 523 | /* No idea if there should be some special log message written */ |
524 | 524 | return array(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
631 | 631 | // <== out of SUDO |
632 | 632 | |
633 | - if ( $parent_guid == $guid |
|
633 | + if ($parent_guid == $guid |
|
634 | 634 | || !mgd_is_guid($parent_guid)) { |
635 | 635 | $base_privileges = array(); |
636 | 636 | } else { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | // Determine parent ownership |
642 | 642 | $is_owner = false; |
643 | 643 | $last_owner_scope = -1; |
644 | - if ( array_key_exists('midgard:owner', $base_privileges) |
|
644 | + if (array_key_exists('midgard:owner', $base_privileges) |
|
645 | 645 | && $base_privileges['midgard:owner'] == MIDCOM_PRIVILEGE_ALLOW) { |
646 | 646 | $is_owner = true; |
647 | 647 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | $valid_privileges[$scope][$privilege->privilegename] = $privilege->value; |
683 | 683 | |
684 | - if ( $privilege->privilegename == 'midgard:owner' |
|
684 | + if ($privilege->privilegename == 'midgard:owner' |
|
685 | 685 | && $scope > $last_owner_scope) { |
686 | 686 | $is_owner = ($privilege->value == MIDCOM_PRIVILEGE_ALLOW); |
687 | 687 | $last_owner_scope = $scope; |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | $content_privilege = null; |
893 | 893 | |
894 | 894 | foreach ($object_privileges as $privilege) { |
895 | - if ( $privilege->privilegename != $privilegename |
|
895 | + if ($privilege->privilegename != $privilegename |
|
896 | 896 | || $privilege->scope <= $last_scope |
897 | 897 | || !$privilege->does_privilege_apply($user_id)) { |
898 | 898 | continue; |
@@ -903,10 +903,10 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | //owner privileges override everything but person privileges, so we have to cross-check those here |
906 | - if ( $privilegename != 'midgard:owner' |
|
906 | + if ($privilegename != 'midgard:owner' |
|
907 | 907 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
908 | 908 | $owner_privileges = $this->get_owner_default_privileges(); |
909 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
909 | + if (array_key_exists($privilegename, $owner_privileges) |
|
910 | 910 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
911 | 911 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
912 | 912 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
931 | 931 | // <== out of SUDO |
932 | 932 | |
933 | - if ( $parent_guid == $guid |
|
933 | + if ($parent_guid == $guid |
|
934 | 934 | || !mgd_is_guid($parent_guid)) { |
935 | 935 | return false; |
936 | 936 | } |
@@ -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 | } |
@@ -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; |