@@ -92,7 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | try { |
94 | 94 | $this->_storage = new midgard_group($id); |
95 | - } catch (Exception $e) { |
|
95 | + } |
|
96 | + catch (Exception $e) { |
|
96 | 97 | debug_add('Tried to load a midcom_core_group, but got error ' . $e->getMessage(), MIDCOM_LOG_ERROR); |
97 | 98 | debug_print_r('Passed argument was:', $id); |
98 | 99 | throw new midcom_error($e->getMessage()); |
@@ -151,7 +152,8 @@ discard block |
||
151 | 152 | try { |
152 | 153 | $user = new midcom_core_user($member->uid); |
153 | 154 | $return[$user->id] = $user; |
154 | - } catch (midcom_error $e) { |
|
155 | + } |
|
156 | + catch (midcom_error $e) { |
|
155 | 157 | debug_add("The membership record {$member->id} is invalid, the user {$member->uid} failed to load.", MIDCOM_LOG_ERROR); |
156 | 158 | debug_add('Last Midgard error was: ' . $e->getMessage()); |
157 | 159 | debug_print_r('Membership record was:', $member); |
@@ -183,7 +185,8 @@ discard block |
||
183 | 185 | try { |
184 | 186 | $group = new midcom_core_group($gid); |
185 | 187 | $return[$group->id] = $group; |
186 | - } catch (midcom_error $e) { |
|
188 | + } |
|
189 | + catch (midcom_error $e) { |
|
187 | 190 | debug_add("The group {$gid} is unknown, skipping the membership record.", MIDCOM_LOG_ERROR); |
188 | 191 | debug_add('Last Midgard error was: ' . midcom_connection::get_error_string()); |
189 | 192 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function set_assignee($assignee) |
213 | 213 | { |
214 | - if ( is_a($assignee, 'midcom_core_user') |
|
214 | + if (is_a($assignee, 'midcom_core_user') |
|
215 | 215 | || is_a($assignee, 'midcom_core_group')) { |
216 | 216 | $this->assignee = $assignee->id; |
217 | 217 | } elseif (is_string($assignee)) { |
@@ -256,27 +256,27 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | // 2. Assignee |
259 | - if ( !$this->is_magic_assignee() |
|
259 | + if (!$this->is_magic_assignee() |
|
260 | 260 | && !$this->get_assignee()) { |
261 | 261 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | - if ( $this->assignee == 'SELF' |
|
265 | + if ($this->assignee == 'SELF' |
|
266 | 266 | && $this->classname != '' |
267 | 267 | && !class_exists($this->classname)) { |
268 | 268 | debug_add("The class '{$this->classname}' is not loaded, the SELF magic assignee with class restriction is invalid therefore.", MIDCOM_LOG_INFO); |
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
272 | - if ( $this->assignee != 'SELF' |
|
272 | + if ($this->assignee != 'SELF' |
|
273 | 273 | && $this->classname != '') { |
274 | 274 | debug_add("The classname parameter was specified without having the magic assignee SELF set, this is invalid.", MIDCOM_LOG_INFO); |
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | |
278 | 278 | // Prevent owner assignments to owners |
279 | - if ( $this->assignee == 'OWNER' |
|
279 | + if ($this->assignee == 'OWNER' |
|
280 | 280 | && $this->privilegename == 'midgard:owner') { |
281 | 281 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
282 | 282 | return false; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | MIDCOM_LOG_INFO); |
289 | 289 | return false; |
290 | 290 | } |
291 | - if ( !$object->can_do('midgard:update') |
|
291 | + if (!$object->can_do('midgard:update') |
|
292 | 292 | || !$object->can_do('midgard:privileges')) { |
293 | 293 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
294 | 294 | MIDCOM_LOG_INFO); |
@@ -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 | } |
@@ -98,7 +98,8 @@ |
||
98 | 98 | try { |
99 | 99 | $mgdschemaclass = $this->__mgdschema_class_name__; |
100 | 100 | $this->__object = new $mgdschemaclass($id); |
101 | - } catch (midgard_error_exception $e) { |
|
101 | + } |
|
102 | + catch (midgard_error_exception $e) { |
|
102 | 103 | debug_add('Constructing ' . $this->__mgdschema_class_name__ . ' object ' . $id . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_WARN); |
103 | 104 | throw new midcom_error_midgard($e, $id); |
104 | 105 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | if (is_object($id)) { |
86 | 86 | $this->__object = midcom::get()->dbfactory->convert_midcom_to_midgard($id); |
87 | 87 | } else { |
88 | - if ( is_string($id) |
|
88 | + if (is_string($id) |
|
89 | 89 | && strlen($id) == 1) { |
90 | 90 | debug_add('Constructing ' . $this->__mgdschema_class_name__ . ' object ' . $id . ' with ID typecast to string. Changing typecast.', MIDCOM_LOG_INFO); |
91 | 91 | $id = (int) $id; |
92 | 92 | } |
93 | - if ( is_int($id) |
|
93 | + if (is_int($id) |
|
94 | 94 | && $id < 1) { |
95 | 95 | throw new midcom_error($id . ' is not a valid database ID'); |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | //Some useful information for performance tuning |
107 | - if ( midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
107 | + if (midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
108 | 108 | && $this->__object->guid) { |
109 | 109 | static $guids = array(); |
110 | 110 | static $total = 0; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if ( $this->__object->guid |
|
129 | + if ($this->__object->guid |
|
130 | 130 | && mgd_is_guid($this->__object->guid)) { |
131 | 131 | midcom_baseclasses_core_dbobject::post_db_load_checks($this); |
132 | 132 | } |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | } |
679 | 679 | public function enable_rcs() |
680 | 680 | { |
681 | - $this->_use_rcs = true; |
|
681 | + $this->_use_rcs = true; |
|
682 | 682 | } |
683 | 683 | public function set_rcs_message($msg) |
684 | 684 | { |
@@ -69,7 +69,8 @@ discard block |
||
69 | 69 | { |
70 | 70 | try { |
71 | 71 | $result = $this->_query->execute(); |
72 | - } catch (Exception $e) { |
|
72 | + } |
|
73 | + catch (Exception $e) { |
|
73 | 74 | debug_add("Query failed: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
74 | 75 | return array(); |
75 | 76 | } |
@@ -90,7 +91,8 @@ discard block |
||
90 | 91 | $classname = $this->_real_class; |
91 | 92 | try { |
92 | 93 | $object = new $classname($object); |
93 | - } catch (midcom_error $e) { |
|
94 | + } |
|
95 | + catch (midcom_error $e) { |
|
94 | 96 | if ($e->getCode() == MIDCOM_ERRFORBIDDEN) { |
95 | 97 | $this->denied++; |
96 | 98 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | debug_add("Query failed: " . $e->getMessage(), MIDCOM_LOG_ERROR); |
74 | 74 | return array(); |
75 | 75 | } |
76 | - if ( empty($result) |
|
76 | + if (empty($result) |
|
77 | 77 | && $false_on_empty_mgd_resultset) { |
78 | 78 | return false; |
79 | 79 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Check approval |
96 | - if ( $this->hide_invisible |
|
96 | + if ($this->hide_invisible |
|
97 | 97 | && !midcom::get()->config->get('show_unapproved_objects') |
98 | 98 | && !$object->__object->is_approved()) { |
99 | 99 | continue; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | debug_print_function_stack('We were called from here:'); |
135 | 135 | } |
136 | 136 | |
137 | - if ( empty($this->_limit) |
|
137 | + if (empty($this->_limit) |
|
138 | 138 | && empty($this->_offset)) { |
139 | 139 | // No point to do windowing |
140 | 140 | $newresult = $this->_execute_and_check_privileges(); |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | if (!$this->_window_size) { |
187 | 187 | // Try to be smart about the window size |
188 | 188 | switch (true) { |
189 | - case ( empty($this->_offset) |
|
189 | + case (empty($this->_offset) |
|
190 | 190 | && $this->_limit): |
191 | 191 | // Get limited number from start (I supposed generally less than 50% will be unreadable) |
192 | 192 | $this->_window_size = round($this->_limit * 1.5); |
193 | 193 | break; |
194 | - case ( empty($this->_limit) |
|
194 | + case (empty($this->_limit) |
|
195 | 195 | && $this->_offset): |
196 | 196 | // Get rest from offset |
197 | 197 | /* TODO: Somehow factor in that if we have huge number of objects and relatively small offset we want to increase window size |
198 | 198 | $full_object_count = $this->_query->count(); |
199 | 199 | */ |
200 | 200 | $this->_window_size = $this->_offset * 2; |
201 | - case ( $this->_offset > $this->_limit): |
|
201 | + case ($this->_offset > $this->_limit): |
|
202 | 202 | // Offset is greater than limit, basically this is almost the same problem as above |
203 | 203 | $this->_window_size = $this->_offset * 2; |
204 | 204 | break; |
205 | - case ( $this->_limit > $this->_offset): |
|
205 | + case ($this->_limit > $this->_offset): |
|
206 | 206 | // Limit is greater than offset, this is probably similar to getting limited number from beginning |
207 | 207 | $this->_window_size = $this->_limit * 2; |
208 | 208 | break; |
@@ -153,7 +153,7 @@ |
||
153 | 153 | foreach ($definitions as $mgdschema_class => $midcom_class) { |
154 | 154 | $this->_mgdschema_class_handler[$midcom_class] = $component; |
155 | 155 | |
156 | - if ( substr($mgdschema_class, 0, 8) == 'midgard_' |
|
156 | + if (substr($mgdschema_class, 0, 8) == 'midgard_' |
|
157 | 157 | || substr($mgdschema_class, 0, 12) == 'midcom_core_' |
158 | 158 | || $mgdschema_class == midcom::get()->config->get('person_class')) { |
159 | 159 | $this->_midgard_classes[$mgdschema_class] = $midcom_class; |
@@ -787,7 +787,8 @@ discard block |
||
787 | 787 | $param = $param->__object; |
788 | 788 | } |
789 | 789 | $this->_user_cache[$id] = new midcom_core_user($param); |
790 | - } catch (midcom_error $e) { |
|
790 | + } |
|
791 | + catch (midcom_error $e) { |
|
791 | 792 | // Keep it silent while missing user object can mess here |
792 | 793 | $this->_user_cache[$id] = false; |
793 | 794 | } |
@@ -849,7 +850,8 @@ discard block |
||
849 | 850 | $tmp = new midcom_core_group($id); |
850 | 851 | $id = $tmp->id; |
851 | 852 | $this->_group_cache[$id] = $tmp; |
852 | - } catch (midcom_error $e) { |
|
853 | + } |
|
854 | + catch (midcom_error $e) { |
|
853 | 855 | $this->_group_cache[$id] = false; |
854 | 856 | debug_add("Group with identifier {$id} could not be loaded: " . $e->getMessage(), MIDCOM_LOG_WARN); |
855 | 857 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | $person_class = midcom::get()->config->get('person_class'); |
186 | 186 | $person = new $person_class($this->user->guid); |
187 | - if ( midcom::get()->config->get('auth_save_prev_login') |
|
187 | + if (midcom::get()->config->get('auth_save_prev_login') |
|
188 | 188 | && $person->get_parameter('midcom', 'last_login')) { |
189 | 189 | $person->set_parameter('midcom', 'prev_login', $person->get_parameter('midcom', 'last_login')); |
190 | 190 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | // There was form data sent before authentication was re-required |
205 | - if ( isset($_POST['restore_form_data']) |
|
205 | + if (isset($_POST['restore_form_data']) |
|
206 | 206 | && isset($_POST['restored_form_data'])) { |
207 | 207 | foreach ($_POST['restored_form_data'] as $key => $string) { |
208 | 208 | $value = @unserialize(base64_decode($string)); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | private function _sync_user_with_backend() |
227 | 227 | { |
228 | - $this->user =& $this->_auth_backend->user; |
|
228 | + $this->user = & $this->_auth_backend->user; |
|
229 | 229 | // This check is a bit fuzzy but will work as long as MidgardAuth is in sync with |
230 | 230 | // MidCOM auth. |
231 | 231 | $this->admin = (midcom_connection::is_admin() || midcom_connection::get('root')); |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | */ |
256 | 256 | private function _initialize_user_from_midgard() |
257 | 257 | { |
258 | - if ( midcom_connection::get_user() |
|
258 | + if (midcom_connection::get_user() |
|
259 | 259 | && $user = $this->get_user(midcom_connection::get_user())) { |
260 | 260 | $this->user = $user; |
261 | - if ( midcom_connection::is_admin() |
|
261 | + if (midcom_connection::is_admin() |
|
262 | 262 | || midcom_connection::get('root')) { |
263 | 263 | $this->admin = true; |
264 | 264 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return true; |
354 | 354 | } |
355 | 355 | if (is_null($user)) { |
356 | - $user =& $this->user; |
|
356 | + $user = & $this->user; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | if ($user == 'EVERYONE') { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function require_admin_user($message = null) |
583 | 583 | { |
584 | - if ( !$this->admin |
|
584 | + if (!$this->admin |
|
585 | 585 | && !$this->_component_sudo) { |
586 | 586 | if ($message === null) { |
587 | 587 | $message = midcom::get()->i18n->get_string('access denied: admin level privileges required', 'midcom'); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | public function require_admin_or_ip($domain) |
602 | 602 | { |
603 | 603 | $ips = midcom::get()->config->get('indexer_reindex_allowed_ips'); |
604 | - if ( $ips |
|
604 | + if ($ips |
|
605 | 605 | && in_array($_SERVER['REMOTE_ADDR'], $ips)) { |
606 | 606 | if (!$this->request_sudo($domain)) { |
607 | 607 | throw new midcom_error('Failed to acquire SUDO rights. Aborting.'); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | |
931 | 931 | // Determine login warning so that wrong user/pass is shown. |
932 | 932 | $login_warning = ''; |
933 | - if ( $this->auth_credentials_found |
|
933 | + if ($this->auth_credentials_found |
|
934 | 934 | && is_null($this->user)) { |
935 | 935 | $login_warning = midcom::get()->i18n->get_string('login message - user or password wrong', 'midcom'); |
936 | 936 | } |
@@ -193,7 +193,8 @@ |
||
193 | 193 | $log_method = 'error'; |
194 | 194 | } |
195 | 195 | $this->firephp->$log_method($message); |
196 | - } catch (Exception $e) { |
|
196 | + } |
|
197 | + catch (Exception $e) { |
|
197 | 198 | // Ignore FirePHP errors for now |
198 | 199 | } |
199 | 200 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | fputs($file, $prefix . trim($message) . "\n"); |
182 | 182 | fclose($file); |
183 | 183 | |
184 | - if ( $this->firephp |
|
184 | + if ($this->firephp |
|
185 | 185 | && !_midcom_headers_sent()) { |
186 | 186 | try { |
187 | 187 | $log_method = $this->_loglevels[$loglevel]; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | |
216 | 216 | while ($bt) { |
217 | 217 | $caller = array_shift($bt); |
218 | - if ( array_key_exists('class', $caller) |
|
218 | + if (array_key_exists('class', $caller) |
|
219 | 219 | && $caller['class'] == 'midcom_debug') { |
220 | 220 | continue; |
221 | 221 | } |
222 | 222 | |
223 | - if ( !array_key_exists('function', $bt[0]) |
|
223 | + if (!array_key_exists('function', $bt[0]) |
|
224 | 224 | || $bt[0]['function'] != 'require') { |
225 | 225 | $caller = array_shift($bt); |
226 | 226 | } |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | if (array_key_exists('class', $caller)) { |
232 | 232 | $return .= $caller['class'] . '::'; |
233 | 233 | } |
234 | - if ( array_key_exists('function', $caller) |
|
234 | + if (array_key_exists('function', $caller) |
|
235 | 235 | && substr($caller['function'], 0, 6) != 'debug_') { |
236 | 236 | $return .= $caller['function'] . ': '; |
237 | 237 | } else { |
238 | - $return .= $caller['file'] . ' (' . $caller['line']. '): '; |
|
238 | + $return .= $caller['file'] . ' (' . $caller['line'] . '): '; |
|
239 | 239 | } |
240 | 240 | return $return; |
241 | 241 | } |
@@ -735,7 +735,8 @@ |
||
735 | 735 | */ |
736 | 736 | try { |
737 | 737 | return $object->get_by_id($object->id); |
738 | - } catch (exception $e) { |
|
738 | + } |
|
739 | + catch (exception $e) { |
|
739 | 740 | return false; |
740 | 741 | } |
741 | 742 | } |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | if (!is_null($parent)) { |
135 | 135 | // Attachments are a special case |
136 | 136 | if (midcom::get()->dbfactory->is_a($object, 'midgard_attachment')) { |
137 | - if ( !$parent->can_do('midgard:attachments') |
|
137 | + if (!$parent->can_do('midgard:attachments') |
|
138 | 138 | || !$parent->can_do('midgard:update')) { |
139 | 139 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
140 | 140 | MIDCOM_LOG_ERROR); |
141 | 141 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
142 | 142 | return false; |
143 | 143 | } |
144 | - } elseif ( !$parent->can_do('midgard:create') |
|
144 | + } elseif (!$parent->can_do('midgard:create') |
|
145 | 145 | && !midcom::get()->auth->can_user_do('midgard:create', null, get_class($object))) { |
146 | 146 | debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.", |
147 | 147 | MIDCOM_LOG_ERROR); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // Default the owner to first group of current user |
268 | - if ( empty($object->metadata->owner) |
|
268 | + if (empty($object->metadata->owner) |
|
269 | 269 | && $first_group = midcom::get()->auth->user->get_first_group_guid()) { |
270 | 270 | $object->metadata->set('owner', $first_group); |
271 | 271 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | |
703 | 703 | $object->__object->get_by_id((int) $id); |
704 | 704 | |
705 | - if ( $object->id != 0 |
|
705 | + if ($object->id != 0 |
|
706 | 706 | && $object->action != 'delete') { |
707 | 707 | if (!$object->can_do('midgard:read')) { |
708 | 708 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public static function get_by_guid(midcom_core_dbaobject $object, $guid) |
730 | 730 | { |
731 | - if ( !midcom::get()->auth->admin |
|
731 | + if (!midcom::get()->auth->admin |
|
732 | 732 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
733 | 733 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
734 | 734 | return false; |
735 | 735 | } |
736 | 736 | $object->__object->get_by_guid((string) $guid); |
737 | 737 | |
738 | - if ( $object->id != 0 |
|
738 | + if ($object->id != 0 |
|
739 | 739 | && $object->action != 'delete') { |
740 | 740 | $object->_on_loaded(); |
741 | 741 | return true; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | { |
757 | 757 | $object->__object->get_by_path((string) $path); |
758 | 758 | |
759 | - if ( $object->id != 0 |
|
759 | + if ($object->id != 0 |
|
760 | 760 | && $object->action != 'delete') { |
761 | 761 | if (!$object->can_do('midgard:read')) { |
762 | 762 | $object->__object = new $object->__mgdschema_class_name__; |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | debug_add('Cannot set parameters on a non-persistant object.', MIDCOM_LOG_WARN); |
980 | 980 | return false; |
981 | 981 | } |
982 | - if ( empty($domain) |
|
982 | + if (empty($domain) |
|
983 | 983 | || empty($name) |
984 | 984 | || !is_string($domain) |
985 | 985 | || !is_string($name)) { |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | return false; |
990 | 990 | } |
991 | 991 | |
992 | - if ( !$object->can_do('midgard:update') |
|
992 | + if (!$object->can_do('midgard:update') |
|
993 | 993 | || !$object->can_do('midgard:parameters')) { |
994 | 994 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
995 | 995 | MIDCOM_LOG_ERROR); |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | debug_add('Cannot delete parameters on a non-persistant object.', MIDCOM_LOG_WARN); |
1034 | 1034 | return false; |
1035 | 1035 | } |
1036 | - if ( empty($domain) |
|
1036 | + if (empty($domain) |
|
1037 | 1037 | || empty($name) |
1038 | 1038 | || !is_string($domain) |
1039 | 1039 | || !is_string($name)) { |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | return false; |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - if ( !$object->can_do('midgard:update') |
|
1046 | + if (!$object->can_do('midgard:update') |
|
1047 | 1047 | || !$object->can_do('midgard:parameters')) { |
1048 | 1048 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
1049 | 1049 | MIDCOM_LOG_ERROR); |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | */ |
1104 | 1104 | public static function set_privilege(midcom_core_dbaobject $object, $privilege, $assignee = null, $value = MIDCOM_PRIVILEGE_ALLOW, $classname = '') |
1105 | 1105 | { |
1106 | - if ( !$object->can_do('midgard:update') |
|
1106 | + if (!$object->can_do('midgard:update') |
|
1107 | 1107 | || !$object->can_do('midgard:privileges')) { |
1108 | 1108 | debug_add("Failed to set a privilege, midgard:update or midgard:privileges on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
1109 | 1109 | MIDCOM_LOG_ERROR); |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | */ |
1138 | 1138 | public static function unset_privilege(midcom_core_dbaobject $object, $privilege, $assignee = null, $classname = '') |
1139 | 1139 | { |
1140 | - if ( !$object->can_do('midgard:update') |
|
1140 | + if (!$object->can_do('midgard:update') |
|
1141 | 1141 | || !$object->can_do('midgard:privileges')) { |
1142 | 1142 | debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
1143 | 1143 | MIDCOM_LOG_ERROR); |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | return false; |
1255 | 1255 | } |
1256 | 1256 | |
1257 | - if ( !$object->can_do('midgard:update') |
|
1257 | + if (!$object->can_do('midgard:update') |
|
1258 | 1258 | || !$object->can_do('midgard:attachments')) { |
1259 | 1259 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
1260 | 1260 | MIDCOM_LOG_ERROR); |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | return false; |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if ( !$object->can_do('midgard:update') |
|
1283 | + if (!$object->can_do('midgard:update') |
|
1284 | 1284 | || !$object->can_do('midgard:attachments')) { |
1285 | 1285 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($object) . " {$object->guid} not granted for the current user.", |
1286 | 1286 | MIDCOM_LOG_ERROR); |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $attachment->parentguid = $object->guid; |
1295 | 1295 | |
1296 | 1296 | if (!$attachment->create()) { |
1297 | - debug_add("Could not create the attachment '{$name}' for " . get_class($object) . " {$object->guid}: " . midcom_connection::get_error_string(), |
|
1297 | + debug_add("Could not create the attachment '{$name}' for " . get_class($object) . " {$object->guid}: " . midcom_connection::get_error_string(), |
|
1298 | 1298 | MIDCOM_LOG_INFO); |
1299 | 1299 | return false; |
1300 | 1300 | } |
@@ -138,7 +138,8 @@ discard block |
||
138 | 138 | try { |
139 | 139 | $this->_object = new $classname($this->_id); |
140 | 140 | return $this->_object; |
141 | - } catch (Exception $e) { |
|
141 | + } |
|
142 | + catch (Exception $e) { |
|
142 | 143 | $this->_stop($e->getMessage(), $e->getCode()); |
143 | 144 | } |
144 | 145 | } |
@@ -211,7 +212,8 @@ discard block |
||
211 | 212 | if (is_null($this->_response)) { |
212 | 213 | $this->_stop('Could not handle request, unknown method', 405); |
213 | 214 | } |
214 | - } catch (midcom_error $e) { |
|
215 | + } |
|
216 | + catch (midcom_error $e) { |
|
215 | 217 | $this->_responseStatus = $e->getCode(); |
216 | 218 | return $this->_send_response($e->getMessage()); |
217 | 219 | } |