Test Setup Failed
Pull Request — master (#190)
by
unknown
15:14
created
lib/midcom/helper/reflector/main.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
         $label_prop = $this->get_label_property();
433 433
 
434
-        if (    is_string($label_prop)
434
+        if (is_string($label_prop)
435 435
              && $label_prop != 'guid'
436 436
              && midcom::get()->dbfactory->property_exists($this->_dummy_object, $label_prop)) {
437 437
             $search_properties[$label_prop] = true;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                 continue;
493 493
             }
494 494
 
495
-            if (   !$ref->is_link($property)
495
+            if (!$ref->is_link($property)
496 496
                 && $ref->get_midgard_type($property) != MGD_TYPE_GUID) {
497 497
                 continue;
498 498
             }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 return $schema_type;
557 557
             }
558 558
         }
559
-        if (   isset($extends[$schema_type])
559
+        if (isset($extends[$schema_type])
560 560
             && class_exists($extends[$schema_type])) {
561 561
             return $extends[$schema_type];
562 562
         }
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     {
577 577
         $one = self::resolve_baseclass($class_one);
578 578
         $two = self::resolve_baseclass($class_two);
579
-        return (   $one == $two
579
+        return ($one == $two
580 580
                 || self::class_rewrite($one) == $two
581 581
                 || $one == self::class_rewrite($two));
582 582
     }
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         // Check for decorators first
636 636
         if (!empty($class_instance->__mgdschema_class_name__)) {
637 637
             $parent_class = $class_instance->__mgdschema_class_name__;
638
-            if (   !empty($class_instance->__object)
638
+            if (!empty($class_instance->__object)
639 639
                 && !$class_instance->__object instanceof $class_instance->__mgdschema_class_name__) {
640 640
                 $parent_class = get_class($class_instance->__object);
641 641
                 debug_add('mgdschema object class ' . $parent_class . ' is not an instance of ' . $class_instance->__mgdschema_class_name__, MIDCOM_LOG_INFO);
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         $name_exceptions = $this->_config->get('name_exceptions');
671 671
         foreach ($name_exceptions as $class => $property) {
672 672
             if (midcom::get()->dbfactory->is_a($object, $class)) {
673
-                if (   $property !== false
673
+                if ($property !== false
674 674
                     && !midcom::get()->dbfactory->property_exists($object, $property)) {
675 675
                     debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR);
676 676
                     self::$_cache['name'][$key] = false;
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
         if (is_null($title_property)) {
729 729
             $title_property = self::get_title_property($object);
730 730
         }
731
-        if (   empty($title_property)
731
+        if (empty($title_property)
732 732
             || !midcom::get()->dbfactory->property_exists($object, $title_property)) {
733 733
             // Could not resolve valid property
734 734
             return false;
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
         foreach ($title_exceptions as $class => $property) {
777 777
             if (midcom::get()->dbfactory->is_a($object, $class)) {
778
-                if (   $property !== false
778
+                if ($property !== false
779 779
                     && !midcom::get()->dbfactory->property_exists($object, $property)) {
780 780
                     debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR);
781 781
                     self::$_cache['title'][$key] = false;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,7 +240,8 @@  discard block
 block discarded – undo
240 240
             // Not a MidCOM DBA object
241 241
             try {
242 242
                 $obj = midcom::get()->dbfactory->convert_midgard_to_midcom($object);
243
-            } catch (midcom_error $e) {
243
+            }
244
+            catch (midcom_error $e) {
244 245
                 return false;
245 246
             }
246 247
         } else {
@@ -705,7 +706,8 @@  discard block
 block discarded – undo
705 706
         }
706 707
         try {
707 708
             self::$_cache['name'][$key] = self::get($object)->get_name_property_nonstatic($object);
708
-        } catch (midcom_error $e) {
709
+        }
710
+        catch (midcom_error $e) {
709 711
             debug_add('Could not get reflector instance for class ' . $key . ': ' . $e->getMessage(), MIDCOM_LOG_ERROR);
710 712
             self::$_cache['name'][$key] = null;
711 713
         }
Please login to merge, or discard this patch.
lib/midcom/core/group.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
lib/midcom/core/privilege.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,8 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/midcom/core/dbaobject.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,8 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
lib/midcom/core/querybuilder.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             midcom::get()->debug->log_php_error(MIDCOM_LOG_ERROR);
80 80
             return array();
81 81
         }
82
-        if (   empty($result)
82
+        if (empty($result)
83 83
             && $false_on_empty_mgd_resultset) {
84 84
             return false;
85 85
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             }
100 100
 
101 101
             // Check approval
102
-            if (   $this->hide_invisible
102
+            if ($this->hide_invisible
103 103
                 && !midcom::get()->config->get('show_unapproved_objects')
104 104
                 && !$object->__object->is_approved()) {
105 105
                 continue;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             debug_print_function_stack('We were called from here:');
141 141
         }
142 142
 
143
-        if (   empty($this->_limit)
143
+        if (empty($this->_limit)
144 144
             && empty($this->_offset)) {
145 145
             // No point to do windowing
146 146
             $newresult = $this->_execute_and_check_privileges();
@@ -192,23 +192,23 @@  discard block
 block discarded – undo
192 192
         if (!$this->_window_size) {
193 193
             // Try to be smart about the window size
194 194
             switch (true) {
195
-                case (   empty($this->_offset)
195
+                case (empty($this->_offset)
196 196
                       && $this->_limit):
197 197
                     // Get limited number from start (I supposed generally less than 50% will be unreadable)
198 198
                     $this->_window_size = round($this->_limit * 1.5);
199 199
                     break;
200
-                case (   empty($this->_limit)
200
+                case (empty($this->_limit)
201 201
                       && $this->_offset):
202 202
                     // Get rest from offset
203 203
                     /* TODO: Somehow factor in that if we have huge number of objects and relatively small offset we want to increase window size
204 204
                     $full_object_count = $this->_query->count();
205 205
                     */
206 206
                     $this->_window_size = $this->_offset * 2;
207
-                case (   $this->_offset > $this->_limit):
207
+                case ($this->_offset > $this->_limit):
208 208
                     // Offset is greater than limit, basically this is almost the same problem as above
209 209
                     $this->_window_size = $this->_offset * 2;
210 210
                     break;
211
-                case (   $this->_limit > $this->_offset):
211
+                case ($this->_limit > $this->_offset):
212 212
                     // Limit is greater than offset, this is probably similar to getting limited number from beginning
213 213
                     $this->_window_size = $this->_limit * 2;
214 214
                     break;
Please login to merge, or discard this patch.
lib/midcom/services/dbclassloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
lib/midcom/services/auth/main.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -787,7 +787,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/midcom/debug.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -193,7 +193,8 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
lib/midcom/baseclasses/core/dbobject.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -735,7 +735,8 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 
716 716
         $object->__exec_get_by_id((int) $id);
717 717
 
718
-        if (   $object->id != 0
718
+        if ($object->id != 0
719 719
             && $object->action != 'delete') {
720 720
             if (!$object->can_do('midgard:read')) {
721 721
                 debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$object->guid} not granted for the current user.",
@@ -741,14 +741,14 @@  discard block
 block discarded – undo
741 741
      */
742 742
     public static function get_by_guid(midcom_core_dbaobject $object, $guid)
743 743
     {
744
-        if (   !midcom::get()->auth->admin
744
+        if (!midcom::get()->auth->admin
745 745
             && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) {
746 746
             debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR);
747 747
             return false;
748 748
         }
749 749
         $object->__exec_get_by_guid((string) $guid);
750 750
 
751
-        if (   $object->id != 0
751
+        if ($object->id != 0
752 752
             && $object->action != 'delete') {
753 753
             $object->_on_loaded();
754 754
             return true;
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
     {
770 770
         $object->__exec_get_by_path((string) $path);
771 771
 
772
-        if (   $object->id != 0
772
+        if ($object->id != 0
773 773
             && $object->action != 'delete') {
774 774
             if (!$object->can_do('midgard:read')) {
775 775
                 $object->__object = new $object->__mgdschema_class_name__;
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
             debug_add('Cannot set parameters on a non-persistant object.', MIDCOM_LOG_WARN);
993 993
             return false;
994 994
         }
995
-        if (   empty($domain)
995
+        if (empty($domain)
996 996
             || empty($name)
997 997
             || !is_string($domain)
998 998
             || !is_string($name)) {
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
             return false;
1003 1003
         }
1004 1004
 
1005
-        if (   !$object->can_do('midgard:update')
1005
+        if (!$object->can_do('midgard:update')
1006 1006
             || !$object->can_do('midgard:parameters')) {
1007 1007
             debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($object) . " {$object->guid} not granted for the current user.",
1008 1008
                 MIDCOM_LOG_ERROR);
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
             debug_add('Cannot delete parameters on a non-persistant object.', MIDCOM_LOG_WARN);
1047 1047
             return false;
1048 1048
         }
1049
-        if (   empty($domain)
1049
+        if (empty($domain)
1050 1050
             || empty($name)
1051 1051
             || !is_string($domain)
1052 1052
             || !is_string($name)) {
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
             return false;
1057 1057
         }
1058 1058
 
1059
-        if (   !$object->can_do('midgard:update')
1059
+        if (!$object->can_do('midgard:update')
1060 1060
             || !$object->can_do('midgard:parameters')) {
1061 1061
             debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($object) . " {$object->guid} not granted for the current user.",
1062 1062
                 MIDCOM_LOG_ERROR);
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
      */
1117 1117
     public static function set_privilege(midcom_core_dbaobject $object, $privilege, $assignee = null, $value = MIDCOM_PRIVILEGE_ALLOW, $classname = '')
1118 1118
     {
1119
-        if (   !$object->can_do('midgard:update')
1119
+        if (!$object->can_do('midgard:update')
1120 1120
             || !$object->can_do('midgard:privileges')) {
1121 1121
             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.",
1122 1122
                 MIDCOM_LOG_ERROR);
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
      */
1151 1151
     public static function unset_privilege(midcom_core_dbaobject $object, $privilege, $assignee = null, $classname = '')
1152 1152
     {
1153
-        if (   !$object->can_do('midgard:update')
1153
+        if (!$object->can_do('midgard:update')
1154 1154
             || !$object->can_do('midgard:privileges')) {
1155 1155
             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.",
1156 1156
                 MIDCOM_LOG_ERROR);
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
             return false;
1268 1268
         }
1269 1269
 
1270
-        if (   !$object->can_do('midgard:update')
1270
+        if (!$object->can_do('midgard:update')
1271 1271
             || !$object->can_do('midgard:attachments')) {
1272 1272
             debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($object) . " {$object->guid} not granted for the current user.",
1273 1273
                 MIDCOM_LOG_ERROR);
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
             return false;
1294 1294
         }
1295 1295
 
1296
-        if (   !$object->can_do('midgard:update')
1296
+        if (!$object->can_do('midgard:update')
1297 1297
             || !$object->can_do('midgard:attachments')) {
1298 1298
             debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($object) . " {$object->guid} not granted for the current user.",
1299 1299
                 MIDCOM_LOG_ERROR);
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
         $attachment->parentguid = $object->guid;
1308 1308
 
1309 1309
         if (!$attachment->create()) {
1310
-            debug_add("Could not create the attachment '{$name}' for " . get_class($object) . " {$object->guid}: "  . midcom_connection::get_error_string(),
1310
+            debug_add("Could not create the attachment '{$name}' for " . get_class($object) . " {$object->guid}: " . midcom_connection::get_error_string(),
1311 1311
                 MIDCOM_LOG_INFO);
1312 1312
             return false;
1313 1313
         }
Please login to merge, or discard this patch.