@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | |
186 | 186 | while ($bt) { |
187 | 187 | $caller = array_shift($bt); |
188 | - if ( array_key_exists('class', $caller) |
|
188 | + if (array_key_exists('class', $caller) |
|
189 | 189 | && $caller['class'] == 'midcom_debug') { |
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | |
193 | - if ( !array_key_exists('function', $bt[0]) |
|
193 | + if (!array_key_exists('function', $bt[0]) |
|
194 | 194 | || $bt[0]['function'] != 'require') { |
195 | 195 | $caller = array_shift($bt); |
196 | 196 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | if (array_key_exists('class', $caller)) { |
202 | 202 | $return .= $caller['class'] . '::'; |
203 | 203 | } |
204 | - if ( array_key_exists('function', $caller) |
|
204 | + if (array_key_exists('function', $caller) |
|
205 | 205 | && substr($caller['function'], 0, 6) != 'debug_') { |
206 | 206 | $return .= $caller['function'] . ': '; |
207 | 207 | } else { |
208 | - $return .= $caller['file'] . ' (' . $caller['line']. '): '; |
|
208 | + $return .= $caller['file'] . ' (' . $caller['line'] . '): '; |
|
209 | 209 | } |
210 | 210 | return $return; |
211 | 211 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $rawdata = base64_decode($_COOKIE['midcom_services_i18n']); |
130 | 130 | $array = unserialize($rawdata); |
131 | 131 | |
132 | - if ( !array_key_exists('language', $array) |
|
132 | + if (!array_key_exists('language', $array) |
|
133 | 133 | || !array_key_exists('charset', $array)) { |
134 | 134 | debug_add("Rejecting cookie, it seems invalid."); |
135 | 135 | return; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $lang = substr($lang, 0, 2); |
159 | 159 | $q = $this->_get_q($params); |
160 | 160 | |
161 | - if ( !isset($http_langs[$lang]) |
|
161 | + if (!isset($http_langs[$lang]) |
|
162 | 162 | || $http_langs[$lang] < $q) { |
163 | 163 | $http_langs[$lang] = $q; |
164 | 164 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | private function iconv($source_charset, $destination_charset, $string) |
422 | 422 | { |
423 | 423 | $result = @iconv($source_charset, $destination_charset, $string); |
424 | - if ( $result === false |
|
424 | + if ($result === false |
|
425 | 425 | && strlen($string) > 0) { |
426 | 426 | debug_add("Iconv returned failed to convert a string, returning an empty string.", MIDCOM_LOG_WARN); |
427 | 427 | debug_print_r("Tried to convert this string from {$source_charset} to {$destination_charset}:", $string); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($args[0]); |
36 | 36 | |
37 | - if ( !is_a($this->_object, 'midcom_db_topic') |
|
37 | + if (!is_a($this->_object, 'midcom_db_topic') |
|
38 | 38 | && !is_a($this->_object, 'midcom_db_article')) { |
39 | 39 | throw new midcom_error_notfound("Moving only topics and articles is supported."); |
40 | 40 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $folder = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
76 | 76 | } |
77 | 77 | |
78 | - if ( is_a($this->_object, 'midcom_db_topic') |
|
78 | + if (is_a($this->_object, 'midcom_db_topic') |
|
79 | 79 | && $folder->up == $this->_object->id) { |
80 | 80 | $tree_disabled = true; |
81 | 81 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $selected = ' checked="checked"'; |
89 | 89 | } |
90 | 90 | |
91 | - if ( !is_a($this->_object, 'midcom_db_topic') |
|
91 | + if (!is_a($this->_object, 'midcom_db_topic') |
|
92 | 92 | && $folder->component !== $this->_request_data['current_folder']->component) { |
93 | 93 | // Non-topic objects may only be moved under folders of same component |
94 | 94 | $class = 'wrong_component'; |
@@ -46,7 +46,8 @@ |
||
46 | 46 | $target = new midcom_db_topic((int) $_POST['move_to']); |
47 | 47 | $this->_move_object($target); |
48 | 48 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('moved %s to %s'), $this->_topic->get_label(), $target->get_label())); |
49 | - } catch (midcom_error $e) { |
|
49 | + } |
|
50 | + catch (midcom_error $e) { |
|
50 | 51 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $e->getMessage(), 'error'); |
51 | 52 | } |
52 | 53 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->object = midcom::get()->dbfactory->get_object_by_guid($guid); |
48 | 48 | |
49 | - if ( !midcom::get()->config->get('midcom_services_rcs_enable') |
|
49 | + if (!midcom::get()->config->get('midcom_services_rcs_enable') |
|
50 | 50 | || !$this->object->_use_rcs) { |
51 | 51 | throw new midcom_error_notfound("Revision control not supported for " . get_class($this->object) . "."); |
52 | 52 | } |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | public function _handler_history($handler_id, array $args, array &$data) |
184 | 184 | { |
185 | 185 | // Check if the comparison request is valid |
186 | - if ( !empty($_GET['first']) && !empty($_GET['last']) |
|
187 | - && $_GET['first'] !== $_GET['last']) { |
|
186 | + if (!empty($_GET['first']) && !empty($_GET['last']) |
|
187 | + && $_GET['first'] !== $_GET['last']) { |
|
188 | 188 | return new midcom_response_relocate($this->url_prefix . "diff/{$args[0]}/{$_GET['first']}/{$_GET['last']}/"); |
189 | 189 | } |
190 | 190 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | $this->load_object($args[0]); |
220 | 220 | |
221 | - if ( !$this->backend->version_exists($args[1]) |
|
221 | + if (!$this->backend->version_exists($args[1]) |
|
222 | 222 | || !$this->backend->version_exists($args[2])) { |
223 | 223 | throw new midcom_error_notfound("One of the revisions {$args[1]} or {$args[2]} does not exist."); |
224 | 224 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $this->object->require_do('midgard:update'); |
293 | 293 | // TODO: set another privilege for restoring? |
294 | 294 | |
295 | - if ( $this->backend->version_exists($args[1]) |
|
295 | + if ($this->backend->version_exists($args[1]) |
|
296 | 296 | && $this->backend->restore_to_revision($args[1])) { |
297 | 297 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.rcs'), sprintf($this->_l10n->get('restore to version %s successful'), $args[1])); |
298 | 298 | return new midcom_response_relocate($this->get_object_url()); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | $data['default_mode'] = 'view'; |
150 | 150 | |
151 | - if ( !midgard_admin_asgard_plugin::get_preference('edit_mode') |
|
151 | + if (!midgard_admin_asgard_plugin::get_preference('edit_mode') |
|
152 | 152 | && midcom_baseclasses_components_configuration::get('midgard.admin.asgard', 'config')->get('edit_mode') == 1) { |
153 | 153 | $data['default_mode'] = 'edit'; |
154 | 154 | } elseif (midgard_admin_asgard_plugin::get_preference('edit_mode') == 1) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $parent = $object->get_parent(); |
191 | 191 | |
192 | - if ( is_a($object, 'midcom_db_parameter') |
|
192 | + if (is_a($object, 'midcom_db_parameter') |
|
193 | 193 | && !empty($parent->guid)) { |
194 | 194 | // Add "parameters" list to breadcrumb if we're in a param |
195 | 195 | $breadcrumb[] = array( |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | $i = 0; |
202 | - while ( !empty($parent->guid) |
|
202 | + while (!empty($parent->guid) |
|
203 | 203 | && $i < 10) { |
204 | 204 | $i++; |
205 | 205 | $parent_reflector = midcom_helper_reflector::get($parent); |
@@ -26,12 +26,12 @@ |
||
26 | 26 | private function find_duplicates() |
27 | 27 | { |
28 | 28 | $qb = org_openpsa_projects_task_resource_dba::new_query_builder(); |
29 | - $qb->add_constraint('person', '=', (int)$this->person); |
|
30 | - $qb->add_constraint('task', '=', (int)$this->task); |
|
31 | - $qb->add_constraint('orgOpenpsaObtype', '=', (int)$this->orgOpenpsaObtype); |
|
29 | + $qb->add_constraint('person', '=', (int) $this->person); |
|
30 | + $qb->add_constraint('task', '=', (int) $this->task); |
|
31 | + $qb->add_constraint('orgOpenpsaObtype', '=', (int) $this->orgOpenpsaObtype); |
|
32 | 32 | |
33 | 33 | if ($this->id) { |
34 | - $qb->add_constraint('id', '<>', (int)$this->id); |
|
34 | + $qb->add_constraint('id', '<>', (int) $this->id); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return ($qb->count() > 0); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | protected function _add_visibility_checks() |
130 | 130 | { |
131 | - if ( $this->hide_invisible |
|
131 | + if ($this->hide_invisible |
|
132 | 132 | && !$this->_visibility_checks_added) { |
133 | 133 | if (!midcom::get()->config->get('show_hidden_objects')) { |
134 | 134 | $this->add_constraint('metadata.hidden', '=', false); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // Deal with empty arrays, which would produce invalid queries |
195 | 195 | // This is done here to avoid repetitive code in callers, and because |
196 | 196 | // it's easy enough to generalize: IN empty set => always false, NOT IN empty set => always true |
197 | - if ( is_array($value) |
|
197 | + if (is_array($value) |
|
198 | 198 | && empty($value)) { |
199 | 199 | if ($operator == 'NOT IN') { |
200 | 200 | return true; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $this->_add_visibility_checks(); |
107 | 107 | |
108 | - if ( empty($this->_limit) |
|
108 | + if (empty($this->_limit) |
|
109 | 109 | && empty($this->_offset)) { |
110 | 110 | // No point to do windowing |
111 | 111 | $newresult = $this->_execute_and_check_privileges(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | $this->_query->set_limit($window_size); |
152 | 152 | |
153 | - while ( ($resultset = $this->_execute_and_check_privileges()) |
|
153 | + while (($resultset = $this->_execute_and_check_privileges()) |
|
154 | 154 | || $this->denied > $denied) { |
155 | 155 | $size = count($resultset); |
156 | 156 | $total_size = $size + ($this->denied - $denied); |
@@ -58,7 +58,8 @@ |
||
58 | 58 | $classname = $this->_real_class; |
59 | 59 | try { |
60 | 60 | $newresult[] = new $classname($object); |
61 | - } catch (midcom_error $e) { |
|
61 | + } |
|
62 | + catch (midcom_error $e) { |
|
62 | 63 | if ($e->getCode() == MIDCOM_ERRFORBIDDEN) { |
63 | 64 | $this->denied++; |
64 | 65 | } |
@@ -244,8 +244,8 @@ |
||
244 | 244 | } |
245 | 245 | } elseif ( $item_name == 'username' |
246 | 246 | && $object instanceof midcom_db_person) { |
247 | - $account = new midcom_core_account($object); |
|
248 | - return $account->get_username(); |
|
247 | + $account = new midcom_core_account($object); |
|
248 | + return $account->get_username(); |
|
249 | 249 | } |
250 | 250 | return $object->$item_name; |
251 | 251 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $qb = call_user_func(array($this->_request['class'], 'new_query_builder')); |
54 | 54 | |
55 | - if ( !empty($this->_request['constraints']) |
|
55 | + if (!empty($this->_request['constraints']) |
|
56 | 56 | && is_array($this->_request['constraints'])) { |
57 | 57 | $this->_apply_constraints($qb, $this->_request['constraints']); |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $qb->end_group(); |
65 | 65 | } |
66 | 66 | |
67 | - if ( !empty($this->_request['orders']) |
|
67 | + if (!empty($this->_request['orders']) |
|
68 | 68 | && is_array($this->_request['orders'])) { |
69 | 69 | ksort($this->_request['orders']); |
70 | 70 | foreach ($this->_request['orders'] as $data) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | ksort($constraints); |
85 | 85 | foreach ($constraints as $key => $data) { |
86 | - if ( !array_key_exists('value', $data) |
|
86 | + if (!array_key_exists('value', $data) |
|
87 | 87 | || empty($data['field']) |
88 | 88 | || empty($data['op'])) { |
89 | 89 | debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | { |
157 | 157 | $query = $this->_request["term"]; |
158 | 158 | $wildcard_query = $query; |
159 | - if ( isset($this->_request['auto_wildcards']) |
|
159 | + if (isset($this->_request['auto_wildcards']) |
|
160 | 160 | && strpos($query, '%') === false) { |
161 | 161 | switch ($this->_request['auto_wildcards']) { |
162 | 162 | case 'start': |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | break; |
244 | 244 | } |
245 | - } elseif ( $item_name == 'username' |
|
245 | + } elseif ($item_name == 'username' |
|
246 | 246 | && $object instanceof midcom_db_person) { |
247 | 247 | $account = new midcom_core_account($object); |
248 | 248 | return $account->get_username(); |