@@ -93,7 +93,7 @@ |
||
93 | 93 | |
94 | 94 | // If user has preference for this message, we use that |
95 | 95 | $personal_preferences = $recipient->list_parameters('org.openpsa.notifications'); |
96 | - if ( count($personal_preferences) > 0 |
|
96 | + if (count($personal_preferences) > 0 |
|
97 | 97 | && array_key_exists("{$component}:{$action}", $personal_preferences)) { |
98 | 98 | return $personal_preferences[$action]; |
99 | 99 | } |
@@ -52,7 +52,8 @@ |
||
52 | 52 | // TODO: Should we sudo here to ensure getting correct prefs regardless of ACLs? |
53 | 53 | try { |
54 | 54 | $recipient = midcom_db_person::get_cached($recipient); |
55 | - } catch (midcom_error $e) { |
|
55 | + } |
|
56 | + catch (midcom_error $e) { |
|
56 | 57 | return false; |
57 | 58 | } |
58 | 59 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $counter = 0; |
135 | 135 | |
136 | 136 | foreach ($result as $object_guid => $empty_copy) { |
137 | - if ( $this->_user_id |
|
137 | + if ($this->_user_id |
|
138 | 138 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $object_guid, $classname, $this->_user_id)) { |
139 | 139 | debug_add("Failed to load result, read privilege on {$object_guid} not granted for the current user.", MIDCOM_LOG_INFO); |
140 | 140 | continue; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($counter <= $this->_offset) { |
146 | 146 | continue; |
147 | 147 | } |
148 | - if ( $this->_limit |
|
148 | + if ($this->_limit |
|
149 | 149 | && $counter > ($this->_offset + $this->_limit)) { |
150 | 150 | break; |
151 | 151 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | public function get_subkey($key, $property) |
225 | 225 | { |
226 | - if ( $this->_user_id |
|
226 | + if ($this->_user_id |
|
227 | 227 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $key, $this->_real_class, $this->_user_id)) { |
228 | 228 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
229 | 229 | return false; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | public function get($key) |
235 | 235 | { |
236 | - if ( $this->_user_id |
|
236 | + if ($this->_user_id |
|
237 | 237 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $key, $this->_real_class, $this->_user_id)) { |
238 | 238 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
239 | 239 | return false; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | $lastgoodnode = null; |
258 | 258 | |
259 | - while ( $parent_id |
|
259 | + while ($parent_id |
|
260 | 260 | && !isset(self::$_nodes[$parent_id])) { |
261 | 261 | try { |
262 | 262 | self::$_nodes[$parent_id] = $this->_loadNodeData($parent_id); |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | |
274 | 274 | $parent_id = $this->_get_parent_id($topic_id); |
275 | 275 | |
276 | - if ( $up |
|
276 | + if ($up |
|
277 | 277 | && $up_id = array_pop($up_ids) |
278 | 278 | && $up_id != $parent_id) { |
279 | 279 | $parent_id = $up_id; |
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | - if ( !is_null($lastgoodnode) |
|
283 | + if (!is_null($lastgoodnode) |
|
284 | 284 | && (empty($this->_lastgoodnode) || $this->_lastgoodnode < 0)) { |
285 | 285 | $this->_lastgoodnode = $lastgoodnode; |
286 | 286 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | { |
317 | 317 | $node = new midcom_helper_nav_node($this, $topic_id, $up); |
318 | 318 | |
319 | - if ( !$node->is_object_visible() |
|
319 | + if (!$node->is_object_visible() |
|
320 | 320 | || !$node->is_readable_by($this->_user_id)) { |
321 | 321 | throw new midcom_error_forbidden('Node cannot be read or is invisible'); |
322 | 322 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | }); |
362 | 362 | foreach ($leaves as $id => $leaf) { |
363 | 363 | $this->_leaves[$id] = $leaf; |
364 | - $this->_loaded_leaves[$node->id][$id] =& $this->_leaves[$id]; |
|
364 | + $this->_loaded_leaves[$node->id][$id] = & $this->_leaves[$id]; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | } |
448 | 448 | $subnode_id = $this->_nodeid($id, $up); |
449 | 449 | |
450 | - if ( !$show_noentry |
|
450 | + if (!$show_noentry |
|
451 | 451 | && self::$_nodes[$subnode_id]->noentry) { |
452 | 452 | // Hide "noentry" items |
453 | 453 | continue; |
@@ -260,10 +260,12 @@ discard block |
||
260 | 260 | && !isset(self::$_nodes[$parent_id])) { |
261 | 261 | try { |
262 | 262 | self::$_nodes[$parent_id] = $this->_loadNodeData($parent_id); |
263 | - } catch (midcom_error_forbidden $e) { |
|
263 | + } |
|
264 | + catch (midcom_error_forbidden $e) { |
|
264 | 265 | debug_add("The Node {$parent_id} is invisible, could not satisfy the dependency chain to Node #{$node_id}", MIDCOM_LOG_WARN); |
265 | 266 | return $e->getCode(); |
266 | - } catch (midcom_error $e) { |
|
267 | + } |
|
268 | + catch (midcom_error $e) { |
|
267 | 269 | return $e->getCode(); |
268 | 270 | } |
269 | 271 | |
@@ -287,7 +289,8 @@ discard block |
||
287 | 289 | |
288 | 290 | try { |
289 | 291 | self::$_nodes[$node_id] = $this->_loadNodeData($topic_id); |
290 | - } catch (midcom_error $e) { |
|
292 | + } |
|
293 | + catch (midcom_error $e) { |
|
291 | 294 | return $e->getCode(); |
292 | 295 | } |
293 | 296 | return MIDCOM_ERROK; |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $config = $this->get_config_for_topic($topic); |
71 | - if ( $object->name == 'index' |
|
71 | + if ($object->name == 'index' |
|
72 | 72 | && !$config->get('autoindex')) { |
73 | 73 | return ''; |
74 | 74 | } |
@@ -29,7 +29,8 @@ |
||
29 | 29 | foreach ($qb->execute() as $article) { |
30 | 30 | try { |
31 | 31 | $datamanager->set_storage($article); |
32 | - } catch (midcom_error $e) { |
|
32 | + } |
|
33 | + catch (midcom_error $e) { |
|
33 | 34 | $e->log(MIDCOM_LOG_WARN); |
34 | 35 | continue; |
35 | 36 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
80 | 80 | { |
81 | - if ( $object instanceof org_openpsa_contacts_group_dba |
|
81 | + if ($object instanceof org_openpsa_contacts_group_dba |
|
82 | 82 | || $object instanceof midcom_db_group) { |
83 | 83 | return "group/{$object->guid}/"; |
84 | 84 | } |
85 | - if ( $object instanceof org_openpsa_contacts_person_dba |
|
85 | + if ($object instanceof org_openpsa_contacts_person_dba |
|
86 | 86 | || $object instanceof midcom_db_person) { |
87 | 87 | return "person/{$object->guid}/"; |
88 | 88 | } |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | // We have a feed URL, but we should check if it is GeoRSS as well |
112 | 112 | $items = net_nemein_rss_fetch::raw_fetch($data['rss_url'])->get_items(); |
113 | 113 | |
114 | - if ( count($items) > 0 |
|
115 | - && ( $items[0]->get_latitude() |
|
114 | + if (count($items) > 0 |
|
115 | + && ($items[0]->get_latitude() |
|
116 | 116 | || $items[0]->get_longitude())) { |
117 | 117 | // This is a GeoRSS feed |
118 | 118 | $data['georss_url'] = $data['rss_url']; |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | $data = $this->_get_data_from_url($group->homepage); |
176 | 176 | |
177 | 177 | // Use the data we got |
178 | - if ( midcom::get()->componentloader->is_installed('org.routamc.positioning') |
|
178 | + if (midcom::get()->componentloader->is_installed('org.routamc.positioning') |
|
179 | 179 | && array_key_exists('icbm', $data)) { |
180 | 180 | // We know where the group is located |
181 | 181 | $icbm_parts = explode(',', $data['icbm']); |
182 | 182 | if (count($icbm_parts) == 2) { |
183 | 183 | $latitude = (float) $icbm_parts[0]; |
184 | 184 | $longitude = (float) $icbm_parts[1]; |
185 | - if ( abs($latitude) < 90 |
|
185 | + if (abs($latitude) < 90 |
|
186 | 186 | && abs($longitude) < 180) { |
187 | 187 | $location = new org_routamc_positioning_location_dba(); |
188 | 188 | $location->date = time(); |
@@ -159,7 +159,8 @@ |
||
159 | 159 | |
160 | 160 | try { |
161 | 161 | $object = new $classname($guid); |
162 | - } catch (midcom_error $e) { |
|
162 | + } |
|
163 | + catch (midcom_error $e) { |
|
163 | 164 | $handler->print_error($type . " {$guid} not found, error " . $e->getMessage()); |
164 | 165 | return false; |
165 | 166 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function _on_creating() |
44 | 44 | { |
45 | - return ( $this->validate_tag($this->tag) |
|
45 | + return ($this->validate_tag($this->tag) |
|
46 | 46 | && $this->_check_duplicates() == 0); |
47 | 47 | } |
48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | midcom::get()->uimessages->add(midcom::get()->i18n->get_string('net.nemein.tag', 'net.nemein.tag'), sprintf(midcom::get()->i18n->get_string('tag "%s" is not valid. tags may not be numeric', 'net.nemein.tag'), $tag), 'info'); |
67 | 67 | return false; |
68 | 68 | } |
69 | - if ( strstr($tag, '"') |
|
69 | + if (strstr($tag, '"') |
|
70 | 70 | || strstr($tag, "'")) { |
71 | 71 | midcom::get()->uimessages->add(midcom::get()->i18n->get_string('net.nemein.tag', 'net.nemein.tag'), sprintf(midcom::get()->i18n->get_string('tag "%s" is not valid. tags may not contain quotes', 'net.nemein.tag'), $tag), 'info'); |
72 | 72 | return false; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function _on_updating() |
79 | 79 | { |
80 | - return ( $this->validate_tag($this->tag) |
|
80 | + return ($this->validate_tag($this->tag) |
|
81 | 81 | && $this->_check_duplicates() == 0); |
82 | 82 | } |
83 | 83 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <h1>Merge tags</h1> |
5 | 5 | |
6 | 6 | <?php |
7 | -if ( isset($_POST['from']) |
|
7 | +if (isset($_POST['from']) |
|
8 | 8 | && isset($_POST['to'])) { |
9 | 9 | if (net_nemein_tag_handler::merge_tags($_POST['from'], $_POST['to'])) { |
10 | 10 | echo "<p>Successfully merged tag \"{$_POST['from']}\" to \"{$_POST['to']}\"</p>\n"; |
@@ -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 | } |
@@ -19,8 +19,8 @@ |
||
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'] = [ |
26 | 26 | 'handler' => [net_nemein_redirector_handler_tinyurl::class, 'list'], |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
43 | 43 | { |
44 | - if ( $object instanceof midcom_db_article |
|
44 | + if ($object instanceof midcom_db_article |
|
45 | 45 | && $topic->id == $object->topic) { |
46 | 46 | if ($object->name == 'index') { |
47 | 47 | return ''; |
@@ -30,7 +30,8 @@ |
||
30 | 30 | foreach ($result as $wikipage) { |
31 | 31 | try { |
32 | 32 | $datamanager->set_storage($wikipage); |
33 | - } catch (midcom_error $e) { |
|
33 | + } |
|
34 | + catch (midcom_error $e) { |
|
34 | 35 | $e->log(MIDCOM_LOG_WARN); |
35 | 36 | continue; |
36 | 37 | } |