@@ -28,14 +28,14 @@ |
||
28 | 28 | |
29 | 29 | public function send() |
30 | 30 | { |
31 | - if ( $this->url == '' |
|
32 | - || ( substr($this->url, 0, 1) != "/") |
|
31 | + if ($this->url == '' |
|
32 | + || (substr($this->url, 0, 1) != "/") |
|
33 | 33 | && !preg_match('|^https?://|', $this->url)) { |
34 | 34 | $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); |
35 | 35 | if ($prefix == '') { |
36 | 36 | $prefix = '/'; |
37 | 37 | } |
38 | - $this->url = "{$prefix}{$this->url}"; |
|
38 | + $this->url = "{$prefix}{$this->url}"; |
|
39 | 39 | debug_add("This is a relative URL from the local site, prepending anchor prefix: {$this->url}"); |
40 | 40 | } |
41 | 41 | $location = "Location: {$this->url}"; |
@@ -9,7 +9,7 @@ |
||
9 | 9 | continue; |
10 | 10 | } |
11 | 11 | |
12 | - if ( !$object->can_do('midgard:update') |
|
12 | + if (!$object->can_do('midgard:update') |
|
13 | 13 | || !$object->can_do('midgard:attachments')) { |
14 | 14 | printf(midcom::get()->i18n->get_string('not recreating object %s %s, reason %s', 'midcom'), $type, $object->guid, 'Insufficient privileges') . "\n"; |
15 | 15 | continue; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public function __construct($context = null) |
80 | 80 | { |
81 | - if ( is_null($context) |
|
81 | + if (is_null($context) |
|
82 | 82 | || is_numeric($context)) { |
83 | 83 | $this->_domain = midcom_core_context::get($context)->get_key(MIDCOM_CONTEXT_COMPONENT); |
84 | 84 | } else { |
@@ -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; |
@@ -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 ($object instanceof 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 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $lang_id = midcom::get()->i18n->get_current_language(); |
246 | 246 | $result = $this->_cache->fetch("{$this->_prefix}-{$guid}"); |
247 | - if ( !is_array($result) |
|
247 | + if (!is_array($result) |
|
248 | 248 | || !isset($result[$lang_id])) { |
249 | 249 | return false; |
250 | 250 | } |
@@ -72,7 +72,8 @@ |
||
72 | 72 | |
73 | 73 | try { |
74 | 74 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
75 | - } catch (midcom_error $e) { |
|
75 | + } |
|
76 | + catch (midcom_error $e) { |
|
76 | 77 | debug_add("Failed to resolve the GUID {$guid}, this is most probably an access denied error.", MIDCOM_LOG_ERROR); |
77 | 78 | debug_add('Last MidCOM error string: ' . $e->getMessage()); |
78 | 79 | return null; |
@@ -93,7 +93,7 @@ |
||
93 | 93 | if ($object instanceof midcom_db_attachment) { |
94 | 94 | // Faster linking to attachments |
95 | 95 | $parent = $object->get_parent(); |
96 | - if ( is_a($parent, midcom_db_topic::class) |
|
96 | + if (is_a($parent, midcom_db_topic::class) |
|
97 | 97 | && $nav->is_node_in_tree($parent->id, $nav->get_root_node())) { |
98 | 98 | $napobj = $nav->get_node($parent->id); |
99 | 99 | return $napobj[MIDCOM_NAV_FULLURL] . $object->name; |
@@ -213,7 +213,8 @@ |
||
213 | 213 | $browser = new Browser; |
214 | 214 | try { |
215 | 215 | $response = $browser->send($request); |
216 | - } catch (Exception $e) { |
|
216 | + } |
|
217 | + catch (Exception $e) { |
|
217 | 218 | debug_add("Failed to execute request " . $request->getUrl() . ": " . $e->getMessage(), MIDCOM_LOG_WARN); |
218 | 219 | return false; |
219 | 220 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | */ |
110 | 110 | public function members_to_fields() |
111 | 111 | { |
112 | - if ( empty($this->topic_guid) |
|
112 | + if (empty($this->topic_guid) |
|
113 | 113 | || empty($this->topic_url) |
114 | 114 | || empty($this->component)) { |
115 | 115 | //if one of those is missing, we override all three to ensure consistency |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $this->add('Setting: upload_max_filesize', self::OK, ini_get('upload_max_filesize')); |
105 | 105 | } else { |
106 | 106 | $this->add('Setting: upload_max_filesize', |
107 | - self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
107 | + self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $post_limit = $this->ini_get_filesize('post_max_size'); |
@@ -74,7 +74,8 @@ |
||
74 | 74 | $config = new midcom_services_rcs_config($config); |
75 | 75 | $config->test_rcs_config(); |
76 | 76 | $this->add("MidCOM RCS", self::OK); |
77 | - } catch (midcom_error $e) { |
|
77 | + } |
|
78 | + catch (midcom_error $e) { |
|
78 | 79 | $this->add("MidCOM RCS", self::ERROR, $e->getMessage()); |
79 | 80 | } |
80 | 81 | } else { |
@@ -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 = [ |
@@ -145,7 +145,8 @@ |
||
145 | 145 | if (is_null($this->__cached_object)) { |
146 | 146 | try { |
147 | 147 | $this->__cached_object = midcom::get()->dbfactory->get_object_by_guid($this->objectguid); |
148 | - } catch (midcom_error $e) { |
|
148 | + } |
|
149 | + catch (midcom_error $e) { |
|
149 | 150 | return false; |
150 | 151 | } |
151 | 152 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function set_assignee($assignee) |
212 | 212 | { |
213 | - if ( is_a($assignee, midcom_core_user::class) |
|
213 | + if (is_a($assignee, midcom_core_user::class) |
|
214 | 214 | || is_a($assignee, midcom_core_group::class)) { |
215 | 215 | $this->assignee = $assignee->id; |
216 | 216 | } elseif (is_string($assignee)) { |
@@ -255,27 +255,27 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | // 2. Assignee |
258 | - if ( !$this->is_magic_assignee() |
|
258 | + if (!$this->is_magic_assignee() |
|
259 | 259 | && !$this->get_assignee()) { |
260 | 260 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
264 | - if ( $this->assignee == 'SELF' |
|
264 | + if ($this->assignee == 'SELF' |
|
265 | 265 | && $this->classname != '' |
266 | 266 | && !class_exists($this->classname)) { |
267 | 267 | debug_add("The class '{$this->classname}' is not loaded, the SELF magic assignee with class restriction is invalid therefore.", MIDCOM_LOG_INFO); |
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | |
271 | - if ( $this->assignee != 'SELF' |
|
271 | + if ($this->assignee != 'SELF' |
|
272 | 272 | && $this->classname != '') { |
273 | 273 | debug_add("The classname parameter was specified without having the magic assignee SELF set, this is invalid.", MIDCOM_LOG_INFO); |
274 | 274 | return false; |
275 | 275 | } |
276 | 276 | |
277 | 277 | // Prevent owner assignments to owners |
278 | - if ( $this->assignee == 'OWNER' |
|
278 | + if ($this->assignee == 'OWNER' |
|
279 | 279 | && $this->privilegename == 'midgard:owner') { |
280 | 280 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
281 | 281 | return false; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | MIDCOM_LOG_INFO); |
288 | 288 | return false; |
289 | 289 | } |
290 | - if ( !$object->can_do('midgard:update') |
|
290 | + if (!$object->can_do('midgard:update') |
|
291 | 291 | || !$object->can_do('midgard:privileges')) { |
292 | 292 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
293 | 293 | MIDCOM_LOG_INFO); |