@@ -87,7 +87,8 @@ |
||
87 | 87 | $param = $param->__object; |
88 | 88 | } |
89 | 89 | $this->_user_cache[$id] = new midcom_core_user($param); |
90 | - } catch (midcom_error $e) { |
|
90 | + } |
|
91 | + catch (midcom_error $e) { |
|
91 | 92 | // Keep it silent while missing user object can mess here |
92 | 93 | $this->_user_cache[$id] = null; |
93 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return null; |
101 | 101 | } |
102 | 102 | |
103 | - if ( midcom::get()->config->get('auth_check_client_ip') |
|
103 | + if (midcom::get()->config->get('auth_check_client_ip') |
|
104 | 104 | && $data['clientip'] != $request->getClientIp()) { |
105 | 105 | debug_add("The session had mismatching client IP.", MIDCOM_LOG_INFO); |
106 | 106 | debug_add("Expected {$data['clientip']}, got {$request->getClientIp()}."); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return null; |
115 | 115 | } |
116 | 116 | |
117 | - if ( !$this->check_timestamp($data['timestamp'], $user) |
|
117 | + if (!$this->check_timestamp($data['timestamp'], $user) |
|
118 | 118 | || !$this->authenticate($user->username, '', true)) { |
119 | 119 | $this->logout($user); |
120 | 120 | return null; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $parent = $object->get_parent(); |
166 | 166 | |
167 | - if ( is_a($object, midcom_db_parameter::class) |
|
167 | + if (is_a($object, midcom_db_parameter::class) |
|
168 | 168 | && !empty($parent->guid)) { |
169 | 169 | // Add "parameters" list to breadcrumb if we're in a param |
170 | 170 | $breadcrumb[] = [ |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | $i = 0; |
177 | - while ( !empty($parent->guid) |
|
177 | + while (!empty($parent->guid) |
|
178 | 178 | && $i < 10) { |
179 | 179 | $i++; |
180 | 180 | $parent_reflector = midcom_helper_reflector::get($parent); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function add_string_field(string $key, string $type) |
66 | 66 | { |
67 | - if ( $key == 'component' |
|
67 | + if ($key == 'component' |
|
68 | 68 | && $type == midcom_db_topic::class) { |
69 | 69 | $this->_add_component_dropdown($key); |
70 | 70 | return; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | parent::add_longtext_field($key); |
135 | 135 | |
136 | 136 | // Check the user preference and configuration |
137 | - if ( in_array($key, ['content', 'description']) |
|
137 | + if (in_array($key, ['content', 'description']) |
|
138 | 138 | && midgard_admin_asgard_plugin::get_preference('tinymce_enabled')) { |
139 | 139 | $this->schema['fields'][$key]['widget'] = 'tinymce'; |
140 | 140 | } |
141 | 141 | |
142 | - if ( in_array($key, ['value', 'code']) |
|
142 | + if (in_array($key, ['value', 'code']) |
|
143 | 143 | && midgard_admin_asgard_plugin::get_preference('codemirror_enabled')) { |
144 | 144 | $this->schema['fields'][$key]['widget'] = 'codemirror'; |
145 | 145 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | if ($score1 > $score2) { |
258 | 258 | return 1; |
259 | 259 | } |
260 | - if ( $score1 < 3 |
|
260 | + if ($score1 < 3 |
|
261 | 261 | || $score1 > 6) { |
262 | 262 | return strnatcmp($first, $second); |
263 | 263 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | { |
278 | 278 | $success = true; |
279 | 279 | foreach ($this->_request_data['config']->_global as $global_key => $global_value) { |
280 | - if ( isset($config[$global_key]) |
|
280 | + if (isset($config[$global_key]) |
|
281 | 281 | && $config[$global_key] != $global_value) { |
282 | 282 | continue; |
283 | 283 | // Skip the ones we will set next |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | foreach ($config as $key => $value) { |
293 | - if ( is_array($value) |
|
293 | + if (is_array($value) |
|
294 | 294 | || is_object($value)) { |
295 | 295 | /** |
296 | 296 | * See http://trac.midgard-project.org/ticket/1442 |
@@ -61,11 +61,11 @@ |
||
61 | 61 | $fields[$key] = $this->detect_schema($key, $value); |
62 | 62 | } |
63 | 63 | |
64 | - if ( !isset($this->config->_local[$key]) |
|
64 | + if (!isset($this->config->_local[$key]) |
|
65 | 65 | || $this->config->_local[$key] == $this->config->_global[$key]) { |
66 | 66 | // No local configuration setting, note to user that this is the global value |
67 | 67 | $fields[$key]['title'] = $schema->get_l10n()->get($fields[$key]['title']); |
68 | - $fields[$key]['title'] .= " <span class=\"global\">(" . midcom::get()->i18n->get_string('global value', 'midgard.admin.asgard') .")</span>"; |
|
68 | + $fields[$key]['title'] .= " <span class=\"global\">(" . midcom::get()->i18n->get_string('global value', 'midgard.admin.asgard') . ")</span>"; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | $files = []; |
180 | 180 | $pattern = $component_dir . '*.{' . $this->_i18n->get_current_language() . ',' . $this->_i18n->get_fallback_language() . '}.txt'; |
181 | 181 | |
182 | - foreach (glob($pattern, GLOB_NOSORT|GLOB_BRACE) as $path) { |
|
182 | + foreach (glob($pattern, GLOB_NOSORT | GLOB_BRACE) as $path) { |
|
183 | 183 | $entry = basename($path); |
184 | - if ( str_starts_with($entry, 'index') |
|
184 | + if (str_starts_with($entry, 'index') |
|
185 | 185 | || str_starts_with($entry, 'handler') |
186 | 186 | || str_starts_with($entry, 'urlmethod')) { |
187 | 187 | // Ignore dotfiles, handlers & index.lang.txt |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $data = []; |
233 | 233 | |
234 | 234 | $exec_path = midcom::get()->componentloader->path_to_snippetpath($component) . '/exec/'; |
235 | - if ( !is_dir($exec_path) |
|
235 | + if (!is_dir($exec_path) |
|
236 | 236 | || !is_readable($exec_path)) { |
237 | 237 | // Directory not accessible, skip loading it |
238 | 238 | return $data; |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | { |
44 | 44 | try { |
45 | 45 | $tmp = midgard_object_class::get_object_by_guid($guid); |
46 | - } catch (mgd_exception $e) { |
|
46 | + } |
|
47 | + catch (mgd_exception $e) { |
|
47 | 48 | debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO); |
48 | 49 | |
49 | 50 | throw new midcom_error_midgard($e, $guid); |
@@ -163,7 +164,8 @@ discard block |
||
163 | 164 | |
164 | 165 | try { |
165 | 166 | return $this->get_cached($classname, $parent_guid); |
166 | - } catch (midcom_error $e) { |
|
167 | + } |
|
168 | + catch (midcom_error $e) { |
|
167 | 169 | return null; |
168 | 170 | } |
169 | 171 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | throw new midcom_error_midgard($e, $guid); |
50 | 50 | } |
51 | 51 | $person_class = midcom::get()->config->get('person_class'); |
52 | - if ( get_class($tmp) == 'midgard_person' |
|
52 | + if (get_class($tmp) == 'midgard_person' |
|
53 | 53 | && $person_class != 'midgard_person') { |
54 | 54 | $tmp = new $person_class($guid); |
55 | 55 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | $object = new $classname($src); |
81 | 81 | $cache[$classname][$object->guid] = $object; |
82 | - $cache[$classname][$object->id] =& $cache[$classname][$object->guid]; |
|
82 | + $cache[$classname][$object->id] = & $cache[$classname][$object->guid]; |
|
83 | 83 | return $cache[$classname][$object->guid]; |
84 | 84 | } |
85 | 85 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return true; |
128 | 128 | } |
129 | 129 | |
130 | - if ( isset($object->__object) |
|
130 | + if (isset($object->__object) |
|
131 | 131 | && is_object($object->__object) |
132 | 132 | && $object->__object instanceof $class) { |
133 | 133 | // Decorator whose MgdSchema object matches |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return $this->get_parent_data_uncached($object); |
151 | 151 | }); |
152 | 152 | |
153 | - if ( empty($parent_guid) |
|
153 | + if (empty($parent_guid) |
|
154 | 154 | || $parent_guid === $object->guid) { |
155 | 155 | return null; |
156 | 156 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | //Check up |
144 | - if ( !$this->up |
|
144 | + if (!$this->up |
|
145 | 145 | && $this->title != '__org_openpsa_calendar') { |
146 | 146 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
147 | 147 | $this->up = $root_event->id; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | private function _check_timerange() : bool |
168 | 168 | { |
169 | - if ( !$this->start |
|
169 | + if (!$this->start |
|
170 | 170 | || !$this->end) { |
171 | 171 | debug_add('Event must have start and end timestamps'); |
172 | 172 | midcom_connection::set_error(MGD_ERR_RANGE); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($guid); |
37 | 37 | |
38 | - if ( !is_a($this->_object, midcom_db_topic::class) |
|
38 | + if (!is_a($this->_object, midcom_db_topic::class) |
|
39 | 39 | && !is_a($this->_object, midcom_db_article::class)) { |
40 | 40 | throw new midcom_error_notfound("Moving only topics and articles is supported."); |
41 | 41 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $folder = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
77 | 77 | } |
78 | 78 | |
79 | - if ( is_a($this->_object, midcom_db_topic::class) |
|
79 | + if (is_a($this->_object, midcom_db_topic::class) |
|
80 | 80 | && $folder->up == $this->_object->id) { |
81 | 81 | $tree_disabled = true; |
82 | 82 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $selected = ' checked="checked"'; |
90 | 90 | } |
91 | 91 | |
92 | - if ( !is_a($this->_object, midcom_db_topic::class) |
|
92 | + if (!is_a($this->_object, midcom_db_topic::class) |
|
93 | 93 | && $folder->component !== $this->current_folder->component) { |
94 | 94 | // Non-topic objects may only be moved under folders of same component |
95 | 95 | $class = 'wrong_component'; |
@@ -47,7 +47,8 @@ |
||
47 | 47 | $target = new midcom_db_topic($request->request->getInt('move_to')); |
48 | 48 | $this->_move_object($target); |
49 | 49 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('moved %s to %s'), $this->_topic->get_label(), $target->get_label())); |
50 | - } catch (midcom_error $e) { |
|
50 | + } |
|
51 | + catch (midcom_error $e) { |
|
51 | 52 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $e->getMessage(), 'error'); |
52 | 53 | } |
53 | 54 | } |