Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/contacts/group.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
     public $__midcom_class_name__ = __CLASS__;
15 15
     public $__mgdschema_class_name__ = 'org_openpsa_organization';
16 16
 
17
-    public $autodelete_dependents = array
18
-    (
17
+    public $autodelete_dependents = array(
19 18
         'org_openpsa_contacts_member_dba' => 'gid'
20 19
     );
21 20
 
@@ -32,7 +31,7 @@  discard block
 block discarded – undo
32 31
 
33 32
     public function __set($name, $value)
34 33
     {
35
-        if (   $name == 'homepage'
34
+        if ($name == 'homepage'
36 35
             && !empty($value)
37 36
             && $value != $this->homepage)
38 37
         {
@@ -83,7 +82,7 @@  discard block
 block discarded – undo
83 82
 
84 83
     public function __get($property)
85 84
     {
86
-        if (   $property == 'invoice_label'
85
+        if ($property == 'invoice_label'
87 86
             || $property == 'postal_label')
88 87
         {
89 88
             if (!isset($this->_address_extras[$property]))
@@ -124,8 +123,7 @@  discard block
 block discarded – undo
124 123
     {
125 124
         if ($this->_register_prober)
126 125
         {
127
-            $args = array
128
-            (
126
+            $args = array(
129 127
                 'group' => $this->guid,
130 128
             );
131 129
             midcom_services_at_interface::register(time() + 60, 'org.openpsa.contacts', 'check_url', $args);
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/duplicates/check.php 1 patch
Spacing   +12 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
         //Search for all potential duplicates (more detailed checking is done later)
49 49
         $check_persons = $this->get_person_candidates($person);
50 50
 
51
-        $person = $this->normalize_fields(array
52
-        (
51
+        $person = $this->normalize_fields(array(
53 52
             'firstname' => $person->firstname,
54 53
             'lastname' => $person->lastname,
55 54
             'email' => $person->email,
@@ -122,8 +121,7 @@  discard block
 block discarded – undo
122 121
      */
123 122
     function p_duplicate_person(array $person1, array $person2)
124 123
     {
125
-        $ret = array
126
-        (
124
+        $ret = array(
127 125
             'p' => 0,
128 126
             'email_match' => false,
129 127
             'handphone_match' => false,
@@ -144,7 +142,7 @@  discard block
 block discarded – undo
144 142
             // if user's lastname is part of the email address, check to see if the difference is only in the domain part
145 143
             $email1 = preg_replace('/@.+/', '', $person1['email']);
146 144
             $email2 = preg_replace('/@.+/', '', $person2['email']);
147
-            if (   strpos($email1, $person1['lastname']) !== false
145
+            if (strpos($email1, $person1['lastname']) !== false
148 146
                 && $email1 == $email2)
149 147
             {
150 148
                 $ret['email_match'] = true;
@@ -203,7 +201,7 @@  discard block
 block discarded – undo
203 201
 
204 202
     private function match($property, array $data1, array $data2)
205 203
     {
206
-        if (   !empty($data1[$property])
204
+        if (!empty($data1[$property])
207 205
             && $data1[$property] == $data2[$property])
208 206
         {
209 207
             return true;
@@ -243,8 +241,7 @@  discard block
 block discarded – undo
243 241
 
244 242
         $check_groups = $this->get_group_candidates($group);
245 243
 
246
-        $group = $this->normalize_fields(array
247
-        (
244
+        $group = $this->normalize_fields(array(
248 245
             'official' => $group->official,
249 246
             'street' => $group->street,
250 247
             'phone' => $group->phone,
@@ -303,8 +300,7 @@  discard block
 block discarded – undo
303 300
      */
304 301
     function p_duplicate_group(array $group1, array $group2)
305 302
     {
306
-        $ret = array
307
-        (
303
+        $ret = array(
308 304
             'p' => 0,
309 305
             'homepage_match' => false,
310 306
             'phone_match' => false,
@@ -370,7 +366,7 @@  discard block
 block discarded – undo
370 366
         $persons = $this->get_person_candidates();
371 367
 
372 368
         $params = array();
373
-        $params['objects'] =& $persons;
369
+        $params['objects'] = & $persons;
374 370
         $params['mode'] = 'person';
375 371
 
376 372
         array_walk($persons, array($this, 'check_all_arraywalk'), $params);
@@ -442,7 +438,7 @@  discard block
 block discarded – undo
442 438
                 continue;
443 439
             }
444 440
 
445
-            if (   $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
441
+            if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
446 442
                 || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid))
447 443
             {
448 444
                 // Not-duplicate parameter found, returning zero probability
@@ -472,7 +468,7 @@  discard block
 block discarded – undo
472 468
 
473 469
         $groups = $this->get_group_candidates();
474 470
         $params = array();
475
-        $params['objects'] =& $groups;
471
+        $params['objects'] = & $groups;
476 472
         $params['mode'] = 'group';
477 473
         array_walk($groups, array($this, 'check_all_arraywalk'), $params);
478 474
 
@@ -517,7 +513,7 @@  discard block
 block discarded – undo
517 513
                 }
518 514
             }
519 515
         }
520
-        debug_add("Done on " . time() . ", took: " . (time() - $time_start) .  " seconds");
516
+        debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds");
521 517
         if ($output)
522 518
         {
523 519
             echo "INFO: DONE with persons. Elapsed time " . (time() - $time_start) . " seconds<br/>\n";
@@ -557,10 +553,10 @@  discard block
 block discarded – undo
557 553
             }
558 554
         }
559 555
 
560
-        debug_add("Done on " . time() . ", took: " . (time()-$time_start) .  " seconds");
556
+        debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds");
561 557
         if ($output)
562 558
         {
563
-            echo "INFO: DONE with groups. Elapsed time: " . (time()-$time_start) ." seconds<br/>\n";
559
+            echo "INFO: DONE with groups. Elapsed time: " . (time() - $time_start) . " seconds<br/>\n";
564 560
             flush();
565 561
         }
566 562
     }
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/duplicates/merge.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function merge($obj1, $obj2, $merge_mode)
48 48
     {
49
-        if (   $merge_mode !== 'all'
49
+        if ($merge_mode !== 'all'
50 50
             && $merge_mode !== 'future')
51 51
         {
52 52
             debug_add("invalid mode {$merge_mode}", MIDCOM_LOG_ERROR);
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
                         {
98 98
                             $dup = $this->check_duplicate($results, $result, $conf['duplicate_check']);
99 99
 
100
-                            if (   is_object($dup)
100
+                            if (is_object($dup)
101 101
                                 || $dup === false)
102 102
                             {
103
-                                if (   !is_object($dup)
103
+                                if (!is_object($dup)
104 104
                                     || !array_key_exists($dup->id, $todelete))
105 105
                                 {
106 106
                                     $todelete[$result->id] = $result;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                         }
112 112
                     }
113 113
                 }
114
-                if (   $needs_update
114
+                if ($needs_update
115 115
                     && !$result->update())
116 116
                 {
117 117
                     throw new midcom_error("Failed to update {$classname} #{$result->id}, errstr: " . midcom_connection::get_error_string());
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         foreach ($results as $result)
172 172
         {
173
-            if (   $result->$field === $object->$field
173
+            if ($result->$field === $object->$field
174 174
                 && $result->id !== $object->id)
175 175
             {
176 176
                 return $result;
@@ -182,8 +182,7 @@  discard block
 block discarded – undo
182 182
     private function merge_persons($person1, $person2)
183 183
     {
184 184
         // Copy fields missing from person1 and present in person2 over
185
-        $skip_properties = array
186
-        (
185
+        $skip_properties = array(
187 186
             'id' => true,
188 187
             'guid' => true,
189 188
         );
@@ -191,7 +190,7 @@  discard block
 block discarded – undo
191 190
         foreach ($person2 as $property => $value)
192 191
         {
193 192
             // Copy only simple properties not marked to be skipped missing from person1
194
-            if (   empty($person2->$property)
193
+            if (empty($person2->$property)
195 194
                 || !empty($person1->$property)
196 195
                 || isset($skip_properties[$property])
197 196
                 || !is_scalar($value))
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/viewer.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,10 +74,8 @@
 block discarded – undo
74 74
      */
75 75
     public function get_calendar_options()
76 76
     {
77
-        $options = array
78
-        (
79
-            'businessHours' => array
80
-            (
77
+        $options = array(
78
+            'businessHours' => array(
81 79
                 'start' => $this->_config->get('day_start_time') . ':00',
82 80
                 'end' => $this->_config->get('day_end_time') . ':00',
83 81
                 'dow' => array(1, 2, 3, 4, 5)
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/event.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         }
167 167
 
168 168
         //Check up
169
-        if (   !$this->up
169
+        if (!$this->up
170 170
             && $this->title != '__org_openpsa_calendar')
171 171
         {
172 172
             $root_event = org_openpsa_calendar_interface::find_root_event();
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
     private function _check_timerange()
203 203
     {
204 204
         //Force types
205
-        $this->start = (int)$this->start;
206
-        $this->end = (int)$this->end;
207
-        if (   !$this->start
205
+        $this->start = (int) $this->start;
206
+        $this->end = (int) $this->end;
207
+        if (!$this->start
208 208
             || !$this->end)
209 209
         {
210 210
             debug_add('Event must have start and end timestamps');
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
          * Force start and end seconds to 1 and 0 respectively
217 217
          * (to avoid stupid one second overlaps)
218 218
          */
219
-        $this->start = mktime(  date('G', $this->start),
219
+        $this->start = mktime(date('G', $this->start),
220 220
                                 date('i', $this->start),
221 221
                                 1,
222 222
                                 date('n', $this->start),
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      */
326 326
     private function _suspects_classes_present()
327 327
     {
328
-        return (   class_exists('org_openpsa_relatedto_dba')
328
+        return (class_exists('org_openpsa_relatedto_dba')
329 329
                 && class_exists('org_openpsa_relatedto_suspect'));
330 330
     }
331 331
 
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/event/member.php 1 patch
Spacing   +11 added lines, -14 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             $event = new org_openpsa_calendar_event_dba($this->eid);
74 74
         }
75 75
 
76
-        if (    $recipient->id == midcom_connection::get_user()
76
+        if ($recipient->id == midcom_connection::get_user()
77 77
              && !$event->send_notify_me)
78 78
         {
79 79
             //Do not send notification to current user
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 return false;
120 120
         }
121 121
 
122
-        if (   $type == 'cancel'
122
+        if ($type == 'cancel'
123 123
             || $type == 'remove')
124 124
         {
125 125
             // TODO: Create iCal export with correct delete commands
@@ -129,10 +129,8 @@  discard block
 block discarded – undo
129 129
             $generator = midcom::get()->serviceloader->load('midcom_core_service_urlgenerator');
130 130
             $encoder = new org_openpsa_calendar_vcal;
131 131
             $encoder->add_event($event);
132
-            $message['attachments'] = array
133
-            (
134
-                array
135
-                (
132
+            $message['attachments'] = array(
133
+                array(
136 134
                     'name' => $generator->from_string(sprintf('%s on %s', $event->title, date('Ymd_Hi', $event->start))) . '.ics',
137 135
                     'mimetype' => 'text/calendar',
138 136
                     'content' => (string) $encoder,
@@ -208,7 +206,7 @@  discard block
 block discarded – undo
208 206
         {
209 207
             $ymd = date('Ymd', $stamp);
210 208
             debug_add("making sure date {$ymd} has at least one event");
211
-            $stamp = mktime(0, 0, 1, date('m', $stamp), date('d', $stamp)+1, date('Y', $stamp));
209
+            $stamp = mktime(0, 0, 1, date('m', $stamp), date('d', $stamp) + 1, date('Y', $stamp));
212 210
             if (array_key_exists($ymd, $events_by_date))
213 211
             {
214 212
                 continue;
@@ -227,13 +225,13 @@  discard block
 block discarded – undo
227 225
             $workday_starts = 8;
228 226
             $workday_ends = 16;
229 227
 
230
-            $workday_starts_ts = mktime($workday_starts, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]);
231
-            $workday_ends_ts = mktime($workday_ends, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]);
228
+            $workday_starts_ts = mktime($workday_starts, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]);
229
+            $workday_ends_ts = mktime($workday_ends, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]);
232 230
             $last_end_time = false;
233 231
             $last_event = false;
234 232
             foreach ($events as $event)
235 233
             {
236
-                if (   $event->end <= $workday_starts_ts
234
+                if ($event->end <= $workday_starts_ts
237 235
                     || $event->start >= $workday_ends_ts)
238 236
                 {
239 237
                     // We need not to consider this event, it is outside the defined workday
@@ -271,8 +269,8 @@  discard block
 block discarded – undo
271 269
             {
272 270
                 $last_end_time = $workday_starts_ts;
273 271
             }
274
-            if (   $last_end_time < $workday_ends_ts
275
-                && (($workday_ends_ts- $last_end_time) >= $amount))
272
+            if ($last_end_time < $workday_ends_ts
273
+                && (($workday_ends_ts - $last_end_time) >= $amount))
276 274
             {
277 275
                 $slots[] = self::_create_slot($last_end_time, $workday_ends_ts, $last_event);
278 276
             }
@@ -283,8 +281,7 @@  discard block
 block discarded – undo
283 281
 
284 282
     private static function _create_slot($start, $end, $previous, $next = false)
285 283
     {
286
-        return array
287
-        (
284
+        return array(
288 285
             'start' => $start,
289 286
             'end' => $end,
290 287
             'previous' => $previous,
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/vcal.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@
 block discarded – undo
99 99
                 // Attendee must have email address of valid format, these must also be unique.
100 100
                 $person->email = preg_replace('/[^0-9_\x61-\x7a]/i', '_', strtolower($person->name)) . '[email protected]';
101 101
             }
102
-            $parameters = array
103
-            (
102
+            $parameters = array(
104 103
                 'ROLE' => 'REQ-PARTICIPANT',
105 104
                 'CUTYPE' => 'INDIVIDUAL',
106 105
                 'PARTSTAT' => 'ACCEPTED',
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/handler/view.php 1 patch
Spacing   +14 added lines, -27 removed lines patch added patch discarded remove patch
@@ -49,30 +49,25 @@  discard block
 block discarded – undo
49 49
         $buttons = array();
50 50
         if ($this->_root_event->can_do('midgard:create'))
51 51
         {
52
-            $buttons[] = $workflow->get_button('#', array
53
-            (
52
+            $buttons[] = $workflow->get_button('#', array(
54 53
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create event'),
55 54
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png',
56
-                MIDCOM_TOOLBAR_OPTIONS  => array
57
-                (
55
+                MIDCOM_TOOLBAR_OPTIONS  => array(
58 56
                     'id' => 'openpsa_calendar_add_event',
59 57
                 )
60 58
             ));
61 59
         }
62
-        $buttons[] = array
63
-        (
60
+        $buttons[] = array(
64 61
             MIDCOM_TOOLBAR_URL => "filters/?org_openpsa_calendar_returnurl=" . midcom_connection::get_url('uri'),
65 62
             MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('choose calendars'),
66 63
             MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/preferences-desktop.png',
67 64
         );
68 65
 
69
-        $buttons[] = array
70
-        (
66
+        $buttons[] = array(
71 67
             MIDCOM_TOOLBAR_URL => '#',
72 68
             MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('go to'),
73 69
             MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_jump-to.png',
74
-            MIDCOM_TOOLBAR_OPTIONS  => array
75
-            (
70
+            MIDCOM_TOOLBAR_OPTIONS  => array(
76 71
                 'rel' => 'directlink',
77 72
                 'id' => 'date-navigation',
78 73
             )
@@ -164,8 +159,7 @@  discard block
 block discarded – undo
164 159
             {
165 160
                 if ($holiday = $util->getHoliday($country, $from, $region))
166 161
                 {
167
-                    $events[] = array
168
-                    (
162
+                    $events[] = array(
169 163
                         'title' => $holiday->getName(),
170 164
                         'start' => $from->format('Y-m-d'),
171 165
                         'className' => array(),
@@ -220,8 +214,7 @@  discard block
 block discarded – undo
220 214
                         $label = $user->name;
221 215
                     }
222 216
 
223
-                    $events[$event->guid] = array
224
-                    (
217
+                    $events[$event->guid] = array(
225 218
                         'id' => $event->guid,
226 219
                         'title' => $label,
227 220
                         'location' => $event->location,
@@ -275,10 +268,8 @@  discard block
 block discarded – undo
275 268
         // Add toolbar items
276 269
         if ($this->_request_data['view'] == 'default')
277 270
         {
278
-            $buttons = array
279
-            (
280
-                array
281
-                (
271
+            $buttons = array(
272
+                array(
282 273
                     MIDCOM_TOOLBAR_URL => 'event/edit/' . $this->_request_data['event']->guid . '/',
283 274
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'),
284 275
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
@@ -291,13 +282,11 @@  discard block
 block discarded – undo
291 282
                 $workflow = $this->get_workflow('delete', array('object' => $data['event']));
292 283
                 $buttons[] = $workflow->get_button("event/delete/{$data['event']->guid}/");
293 284
             }
294
-            $buttons[] = array
295
-            (
285
+            $buttons[] = array(
296 286
                 MIDCOM_TOOLBAR_URL => 'javascript:window.print()',
297 287
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('print'),
298 288
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png',
299
-                MIDCOM_TOOLBAR_OPTIONS  => array
300
-                (
289
+                MIDCOM_TOOLBAR_OPTIONS  => array(
301 290
                     'rel' => 'directlink',
302 291
                 )
303 292
             );
@@ -308,10 +297,8 @@  discard block
 block discarded – undo
308 297
             {
309 298
                 $user = midcom::get()->auth->user->get_storage();
310 299
                 $date = $this->_l10n->get_formatter()->date();
311
-                $relatedto_button_settings = array
312
-                (
313
-                    'wikinote'      => array
314
-                    (
300
+                $relatedto_button_settings = array(
301
+                    'wikinote'      => array(
315 302
                         'component' => 'net.nemein.wiki',
316 303
                         'node'  => false,
317 304
                         'wikiword'  => str_replace('/', '-', sprintf($this->_l10n->get($this->_config->get('wiki_title_skeleton')), $data['event']->title, $date, $user->name)),
@@ -333,7 +320,7 @@  discard block
 block discarded – undo
333 320
 
334 321
         if (!$this->_request_data['event']->can_do('org.openpsa.calendar:read'))
335 322
         {
336
-            $stat =    $this->_datamanager->set_schema('private')
323
+            $stat = $this->_datamanager->set_schema('private')
337 324
                     && $this->_datamanager->set_storage($this->_request_data['event']);
338 325
         }
339 326
         else
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/handler/create.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * DM2 creation callback, binds to the current content topic.
67 67
      */
68
-    public function & dm2_create_callback (&$controller)
68
+    public function & dm2_create_callback(&$controller)
69 69
     {
70 70
         $this->_event = new org_openpsa_calendar_event_dba();
71 71
         $this->_event->up = $this->_root_event->id;
Please login to merge, or discard this patch.