@@ -66,7 +66,8 @@ discard block |
||
66 | 66 | try { |
67 | 67 | $person1 = new org_openpsa_contacts_person_dba($param->parentguid); |
68 | 68 | $person2 = new org_openpsa_contacts_person_dba($param->name); |
69 | - } catch (midcom_error $e) { |
|
69 | + } |
|
70 | + catch (midcom_error $e) { |
|
70 | 71 | $i++; |
71 | 72 | continue; |
72 | 73 | } |
@@ -137,7 +138,8 @@ discard block |
||
137 | 138 | try { |
138 | 139 | $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
139 | 140 | $merger->merge_delete($person1, $person2); |
140 | - } catch (midcom_error $e) { |
|
141 | + } |
|
142 | + catch (midcom_error $e) { |
|
141 | 143 | // TODO: Localize |
142 | 144 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
143 | 145 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | private function load_next() |
45 | 45 | { |
46 | - $i =& $this->_request_data['loop_i']; |
|
46 | + $i = & $this->_request_data['loop_i']; |
|
47 | 47 | while ($i < 100) { |
48 | 48 | debug_add("Loop iteration {$i}"); |
49 | 49 | $qb = new midgard_query_builder('midgard_parameter'); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | continue; |
72 | 72 | } |
73 | 73 | // Make sure we actually have enough rights to do this |
74 | - if ( !$person1->can_do('midgard:update') |
|
74 | + if (!$person1->can_do('midgard:update') |
|
75 | 75 | || !$person1->can_do('midgard:delete') |
76 | 76 | || !$person2->can_do('midgard:update') |
77 | 77 | || !$person2->can_do('midgard:delete')) { |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
83 | - if ( $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
83 | + if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
84 | 84 | || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) { |
85 | 85 | debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
86 | 86 | $i++; |
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - $this->_request_data['probability'] = (float)$param->value; |
|
90 | + $this->_request_data['probability'] = (float) $param->value; |
|
91 | 91 | $this->_request_data['person1'] = $person1; |
92 | 92 | $this->_request_data['person2'] = $person2; |
93 | 93 | break; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | private function process_submit() |
98 | 98 | { |
99 | - if ( !empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
99 | + if (!empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
100 | 100 | && !empty($_POST['org_openpsa_contacts_handler_duplicates_person_options']) |
101 | 101 | && count($_POST['org_openpsa_contacts_handler_duplicates_person_options']) == 2) { |
102 | 102 | $option1 = new org_openpsa_contacts_person_dba($_POST['org_openpsa_contacts_handler_duplicates_person_options'][1]); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ($keep == 'both') { |
106 | 106 | $option1->require_do('midgard:update'); |
107 | 107 | $option2->require_do('midgard:update'); |
108 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
108 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
109 | 109 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) { |
110 | 110 | // Clear the possible duplicate parameters |
111 | 111 | $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | } |
124 | 124 | } else { |
125 | 125 | if ($keep == $option1->guid) { |
126 | - $person1 =& $option1; |
|
127 | - $person2 =& $option2; |
|
126 | + $person1 = & $option1; |
|
127 | + $person2 = & $option2; |
|
128 | 128 | } elseif ($keep == $option2->guid) { |
129 | - $person1 =& $option2; |
|
130 | - $person2 =& $option1; |
|
129 | + $person1 = & $option2; |
|
130 | + $person2 = & $option1; |
|
131 | 131 | } else { |
132 | 132 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
133 | 133 | } |
@@ -196,7 +196,8 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $event = new org_openpsa_calendar_event_dba($member->event); |
198 | 198 | $set_as_modified = true; |
199 | - } catch (midcom_error $e) { |
|
199 | + } |
|
200 | + catch (midcom_error $e) { |
|
200 | 201 | debug_add("event_resource #{$member->id} links ot bogus event #{$member->event}, skipping and removing", MIDCOM_LOG_WARN); |
201 | 202 | $member->delete(); |
202 | 203 | return; |
@@ -224,7 +225,8 @@ discard block |
||
224 | 225 | |
225 | 226 | try { |
226 | 227 | $event = new org_openpsa_calendar_event_dba($member->eid); |
227 | - } catch (midcom_error $e) { |
|
228 | + } |
|
229 | + catch (midcom_error $e) { |
|
228 | 230 | debug_add("eventmember #{$member->id} links to bogus event #{$member->eid}, skipping and removing", MIDCOM_LOG_WARN); |
229 | 231 | $member->delete(); |
230 | 232 | return; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | // TODO: Shared tasks need a separate check (different member object) |
127 | 127 | |
128 | - if ( !empty($this->busy_members) |
|
128 | + if (!empty($this->busy_members) |
|
129 | 129 | || !empty($this->busy_resources)) { |
130 | 130 | //Unresolved conflicts (note return value is for conflicts not lack of them) |
131 | 131 | midcom::get()->auth->drop_sudo(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | //These events have been robbed of (some of) their resources |
139 | 139 | $creator = midcom_db_person::get_cached($event->metadata->creator); |
140 | 140 | $other_participants = array_diff_key($event->participants, array($creator->id => true)); |
141 | - if ( count($other_participants) == 0 |
|
141 | + if (count($other_participants) == 0 |
|
142 | 142 | && count($event->resources) == 0) { |
143 | 143 | /* If modified event has no-one or only creator as participant and no resources |
144 | 144 | then delete it (as it's unlikely the stub event is useful anymore) */ |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | if (array_key_exists($member->event, $modified_events)) { |
192 | - $event =& $modified_events[$member->event]; |
|
192 | + $event = & $modified_events[$member->event]; |
|
193 | 193 | $set_as_modified = false; |
194 | 194 | } else { |
195 | 195 | try { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
205 | 205 | |
206 | - if ( $event->tentative |
|
206 | + if ($event->tentative |
|
207 | 207 | && $rob_tentative) { |
208 | 208 | debug_add('event is tentative, robbing resources'); |
209 | 209 | $event->resources = array_diff_key($event->resources, $this->_event->resources); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | debug_add("overlap found in event {$event->title} (#{$event->id})"); |
232 | 232 | |
233 | - if ( $event->tentative |
|
233 | + if ($event->tentative |
|
234 | 234 | && $rob_tentative) { |
235 | 235 | debug_add('event is tentative, robbing participants'); |
236 | 236 | $event->participants = array_diff_key($event->participants, $this->_event->participants); |
@@ -737,7 +737,8 @@ |
||
737 | 737 | $iterator = new RecursiveIteratorIterator($dir); |
738 | 738 | // ignore backup files |
739 | 739 | return new RegexIterator($iterator, '/[^~]$/i'); |
740 | - } catch (UnexpectedValueException $e) { |
|
740 | + } |
|
741 | + catch (UnexpectedValueException $e) { |
|
741 | 742 | debug_add("failed to create iterator:" . $e->getMessage(), MIDCOM_LOG_ERROR); |
742 | 743 | return array(); |
743 | 744 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | $images_identifier = $info[0]; |
308 | - if ( !empty($this->attachments_info[$blobs_identifier]['object']) |
|
308 | + if (!empty($this->attachments_info[$blobs_identifier]['object']) |
|
309 | 309 | && is_object($this->attachments_info[$blobs_identifier]['object'])) { |
310 | 310 | $this->titles[$images_identifier] = $this->attachments_info[$blobs_identifier]['object']->title; |
311 | 311 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | if (empty($main['object']->guid)) { |
365 | 365 | //Panic, broken identifier |
366 | - debug_add("Identifier '{$identifier}' does not have a valid object behind it", MIDCOM_LOG_ERROR); |
|
366 | + debug_add("Identifier '{$identifier}' does not have a valid object behind it", MIDCOM_LOG_ERROR); |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | debug_print_r('$this->attachments_info', $this->attachments_info); |
466 | 466 | return; |
467 | 467 | } |
468 | - $info =& $this->attachments_info[$identifier]; |
|
468 | + $info = & $this->attachments_info[$identifier]; |
|
469 | 469 | $this->_info_heuristics($info, $identifier); |
470 | 470 | $attachment->set_parameter('midcom.helper.datamanager2.type.images', 'images_identifier', $info['images_identifier']); |
471 | 471 | // This would be the name of the 'derived_images' key. |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | $this->attachments_info[$identifier]['images_identifier'] = $images_identifier; |
509 | 509 | $this->attachments_info[$identifier]['images_name'] = $images_name; |
510 | - $this->images[$images_identifier][$images_name] =& $this->attachments_info[$identifier]; |
|
510 | + $this->images[$images_identifier][$images_name] = & $this->attachments_info[$identifier]; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -533,16 +533,16 @@ discard block |
||
533 | 533 | protected function _sort_images_callback($a, $b) |
534 | 534 | { |
535 | 535 | // safety against broken images |
536 | - if ( !empty($a['main']['object']) |
|
536 | + if (!empty($a['main']['object']) |
|
537 | 537 | && !empty($b['main']['object'])) { |
538 | 538 | $a_obj = $a['main']['object']; |
539 | 539 | $b_obj = $b['main']['object']; |
540 | 540 | } else { |
541 | 541 | // Try to read the sort values from some other key |
542 | - if ( is_array($a) |
|
542 | + if (is_array($a) |
|
543 | 543 | && is_array($b)) { |
544 | 544 | foreach ($a as $key => $data) { |
545 | - if ( !empty($data['object']) |
|
545 | + if (!empty($data['object']) |
|
546 | 546 | && !empty($b[$key]['object'])) { |
547 | 547 | $a_obj = $data['object']; |
548 | 548 | $b_obj = $b[$key]['object']; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
553 | - if ( empty($a_obj) |
|
553 | + if (empty($a_obj) |
|
554 | 554 | && empty($b_obj)) { |
555 | 555 | return 0; |
556 | 556 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | private function _batch_handler_cleanup($tmp_dir, $new_name) |
654 | 654 | { |
655 | 655 | debug_add("called with: '{$tmp_dir}', '{$new_name}'"); |
656 | - if ( !empty($tmp_dir) |
|
656 | + if (!empty($tmp_dir) |
|
657 | 657 | && $tmp_dir !== '/' |
658 | 658 | /* TODO: better tmp dir matching */ |
659 | 659 | && preg_match('|^/tmp/|', $tmp_dir)) { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | debug_add("executing '{$cmd}'"); |
662 | 662 | exec($cmd, $output, $ret); |
663 | 663 | } |
664 | - if ( empty($new_name) |
|
664 | + if (empty($new_name) |
|
665 | 665 | /* TODO: better tmp dir matching */ |
666 | 666 | || !preg_match('|^/tmp/|', $new_name)) { |
667 | 667 | return; |
@@ -431,7 +431,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -240,7 +240,8 @@ discard block |
||
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 |
||
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 | } |
@@ -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 | { |
@@ -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 | } |