@@ -32,7 +32,8 @@ |
||
32 | 32 | foreach ($qb->execute() as $article) { |
33 | 33 | try { |
34 | 34 | $dm->set_storage($article); |
35 | - } catch (midcom_error $e) { |
|
35 | + } |
|
36 | + catch (midcom_error $e) { |
|
36 | 37 | $e->log(MIDCOM_LOG_WARN); |
37 | 38 | continue; |
38 | 39 | } |
@@ -112,7 +112,8 @@ |
||
112 | 112 | foreach ($qb->execute() as $article) { |
113 | 113 | try { |
114 | 114 | $datamanager->set_storage($article); |
115 | - } catch (midcom_error $e) { |
|
115 | + } |
|
116 | + catch (midcom_error $e) { |
|
116 | 117 | $e->log(); |
117 | 118 | continue; |
118 | 119 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function set_privilege($privilege, $assignee = null, $value = MIDCOM_PRIVILEGE_ALLOW, $classname = '') |
60 | 60 | { |
61 | - if ( !$this->can_do('midgard:update') |
|
61 | + if (!$this->can_do('midgard:update') |
|
62 | 62 | || !$this->can_do('midgard:privileges')) { |
63 | 63 | debug_add("Failed to set a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
64 | 64 | MIDCOM_LOG_ERROR); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function unset_privilege($privilege, $assignee = null, $classname = '') |
93 | 93 | { |
94 | - if ( !$this->can_do('midgard:update') |
|
94 | + if (!$this->can_do('midgard:update') |
|
95 | 95 | || !$this->can_do('midgard:privileges')) { |
96 | 96 | debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
97 | 97 | MIDCOM_LOG_ERROR); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ( !$this->can_do('midgard:update') |
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | - MIDCOM_LOG_ERROR); |
|
221 | + MIDCOM_LOG_ERROR); |
|
222 | 222 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
223 | 223 | return false; |
224 | 224 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if ( !$this->can_do('midgard:update') |
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | - MIDCOM_LOG_ERROR); |
|
274 | + MIDCOM_LOG_ERROR); |
|
275 | 275 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
276 | 276 | return false; |
277 | 277 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | debug_add('Cannot set parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
206 | 206 | return false; |
207 | 207 | } |
208 | - if ( empty($domain) |
|
208 | + if (empty($domain) |
|
209 | 209 | || empty($name) |
210 | 210 | || !is_string($domain) |
211 | 211 | || !is_string($name)) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - if ( !$this->can_do('midgard:update') |
|
218 | + if (!$this->can_do('midgard:update') |
|
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | 221 | MIDCOM_LOG_ERROR); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | debug_add('Cannot delete parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
259 | 259 | return false; |
260 | 260 | } |
261 | - if ( empty($domain) |
|
261 | + if (empty($domain) |
|
262 | 262 | || empty($name) |
263 | 263 | || !is_string($domain) |
264 | 264 | || !is_string($name)) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | |
271 | - if ( !$this->can_do('midgard:update') |
|
271 | + if (!$this->can_do('midgard:update') |
|
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | 274 | MIDCOM_LOG_ERROR); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | - if ( !$this->can_do('midgard:update') |
|
66 | + if (!$this->can_do('midgard:update') |
|
67 | 67 | || !$this->can_do('midgard:attachments')) { |
68 | 68 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
69 | 69 | MIDCOM_LOG_ERROR); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | |
91 | - if ( !$this->can_do('midgard:update') |
|
91 | + if (!$this->can_do('midgard:update') |
|
92 | 92 | || !$this->can_do('midgard:attachments')) { |
93 | 93 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
94 | 94 | MIDCOM_LOG_ERROR); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $attachment->parentguid = $this->guid; |
103 | 103 | |
104 | 104 | if (!$attachment->create()) { |
105 | - debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
105 | + debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
106 | 106 | MIDCOM_LOG_INFO); |
107 | 107 | return false; |
108 | 108 | } |
@@ -194,7 +194,7 @@ |
||
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | - if ( !empty($this->_old_username) |
|
197 | + if (!empty($this->_old_username) |
|
198 | 198 | && $this->_old_username !== $new_username) { |
199 | 199 | if (!$history = @unserialize($this->_person->get_parameter('midcom', 'username_history'))) { |
200 | 200 | $history = []; |
@@ -724,7 +724,8 @@ discard block |
||
724 | 724 | $param = $param->__object; |
725 | 725 | } |
726 | 726 | $this->_user_cache[$id] = new midcom_core_user($param); |
727 | - } catch (midcom_error $e) { |
|
727 | + } |
|
728 | + catch (midcom_error $e) { |
|
728 | 729 | // Keep it silent while missing user object can mess here |
729 | 730 | $this->_user_cache[$id] = false; |
730 | 731 | } |
@@ -759,7 +760,8 @@ discard block |
||
759 | 760 | $param = $param->__object; |
760 | 761 | } |
761 | 762 | $this->_group_cache[$id] = new midcom_core_group($param); |
762 | - } catch (midcom_error $e) { |
|
763 | + } |
|
764 | + catch (midcom_error $e) { |
|
763 | 765 | debug_add("Group with identifier {$id} could not be loaded: " . $e->getMessage(), MIDCOM_LOG_WARN); |
764 | 766 | $this->_group_cache[$id] = false; |
765 | 767 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->acl = new midcom_services_auth_acl($this); |
125 | 125 | |
126 | 126 | // Initialize from midgard |
127 | - if ( midcom_connection::get_user() |
|
127 | + if (midcom_connection::get_user() |
|
128 | 128 | && $user = $this->get_user(midcom_connection::get_user())) { |
129 | 129 | $this->set_user($user); |
130 | 130 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | $person_class = midcom::get()->config->get('person_class'); |
151 | 151 | $person = new $person_class($this->user->guid); |
152 | - if ( midcom::get()->config->get('auth_save_prev_login') |
|
152 | + if (midcom::get()->config->get('auth_save_prev_login') |
|
153 | 153 | && $person->get_parameter('midcom', 'last_login')) { |
154 | 154 | $person->set_parameter('midcom', 'prev_login', $person->get_parameter('midcom', 'last_login')); |
155 | 155 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | return true; |
270 | 270 | } |
271 | 271 | if ($user === null) { |
272 | - $user =& $this->user; |
|
272 | + $user = & $this->user; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | if ($user == 'EVERYONE') { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | public function require_admin_or_ip($domain) |
481 | 481 | { |
482 | 482 | $ips = midcom::get()->config->get('indexer_reindex_allowed_ips'); |
483 | - if ( $ips |
|
483 | + if ($ips |
|
484 | 484 | && in_array($_SERVER['REMOTE_ADDR'], $ips)) { |
485 | 485 | if (!$this->request_sudo($domain)) { |
486 | 486 | throw new midcom_error('Failed to acquire SUDO rights. Aborting.'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
87 | - if ( midcom::get()->config->get('auth_check_client_ip') |
|
87 | + if (midcom::get()->config->get('auth_check_client_ip') |
|
88 | 88 | && $data['clientip'] != $request->getClientIp()) { |
89 | 89 | debug_add("The session had mismatching client IP.", MIDCOM_LOG_INFO); |
90 | 90 | debug_add("Expected {$data['clientip']}, got {$request->getClientIp()}."); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
101 | - if ( !$this->check_timestamp($data['timestamp'], $user) |
|
101 | + if (!$this->check_timestamp($data['timestamp'], $user) |
|
102 | 102 | || !$this->authenticate($user->username, '', true)) { |
103 | 103 | $this->logout($user); |
104 | 104 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $user = midcom_connection::login($username, $password, $trusted); |
146 | 146 | |
147 | 147 | if (!$user) { |
148 | - debug_add("Failed to authenticate the given user: ". midcom_connection::get_error_string(), |
|
148 | + debug_add("Failed to authenticate the given user: " . midcom_connection::get_error_string(), |
|
149 | 149 | MIDCOM_LOG_INFO); |
150 | 150 | return false; |
151 | 151 | } |
@@ -93,7 +93,8 @@ |
||
93 | 93 | // ->source will always contain the document GUID |
94 | 94 | $data['document'] = new org_openpsa_documents_document_dba($document->source); |
95 | 95 | $this->datamanager->set_storage($data['document']); |
96 | - } catch (midcom_error $e) { |
|
96 | + } |
|
97 | + catch (midcom_error $e) { |
|
97 | 98 | $e->log(); |
98 | 99 | continue; |
99 | 100 | } |