Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/user/handler/group/list.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
         if (midcom::get()->auth->can_user_do('midgard:create', null, 'midcom_db_group'))
34 34
         {
35 35
             $workflow = $this->get_workflow('datamanager2');
36
-            $this->_view_toolbar->add_item($workflow->get_button("group/create/", array
37
-            (
36
+            $this->_view_toolbar->add_item($workflow->get_button("group/create/", array(
38 37
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create group'),
39 38
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png',
40 39
             )));
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/lostpassword.php 2 patches
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     private function _reset_password()
113 113
     {
114
-        if (! midcom::get()->auth->request_sudo($this->_component))
114
+        if (!midcom::get()->auth->request_sudo($this->_component))
115 115
         {
116 116
             throw new midcom_error('Failed to request sudo privileges.');
117 117
         }
@@ -164,13 +164,12 @@  discard block
 block discarded – undo
164 164
     private function _send_reset_mail($person, $password)
165 165
     {
166 166
         $from = $this->_config->get('lostpassword_reset_mail_sender');
167
-        if (! $from)
167
+        if (!$from)
168 168
         {
169 169
             $from = $person->email;
170 170
         }
171 171
 
172
-        $parameters = array
173
-        (
172
+        $parameters = array(
174 173
             'PERSON' => $person,
175 174
             'PASSWORD' => $password,
176 175
         );
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/list.php 2 patches
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
         $workflow = $this->get_workflow('datamanager2');
68 68
         if (midcom::get()->auth->can_user_do('midgard:create', null, 'midcom_db_person'))
69 69
         {
70
-            $this->_view_toolbar->add_item($workflow->get_button("create/", array
71
-            (
70
+            $this->_view_toolbar->add_item($workflow->get_button("create/", array(
72 71
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'),
73 72
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png',
74 73
             )));
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
 
77 76
         if (midcom::get()->auth->can_user_do('midgard:create', null, 'midcom_db_group'))
78 77
         {
79
-            $this->_view_toolbar->add_item($workflow->get_button("group/create/", array
80
-            (
78
+            $this->_view_toolbar->add_item($workflow->get_button("group/create/", array(
81 79
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create group'),
82 80
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png',
83 81
             )));
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
                 if ($field == 'username')
145 145
                 {
146 146
                     midcom_core_account::add_username_constraint($qb, 'LIKE', $value . '%');
147
-                }
148
-                else
147
+                } else
149 148
                 {
150 149
                     $qb->add_constraint($field, 'LIKE', $value . '%');
151 150
                 }
@@ -157,8 +156,7 @@  discard block
 block discarded – undo
157 156
             if ($field == 'username')
158 157
             {
159 158
                 midcom_core_account::add_username_order($qb, $direction);
160
-            }
161
-            else
159
+            } else
162 160
             {
163 161
                 $qb->add_order($field, $direction);
164 162
             }
@@ -203,8 +201,7 @@  discard block
 block discarded – undo
203 201
             {
204 202
                 $group = org_openpsa_contacts_group_dba::get_cached($gid);
205 203
                 $entry['groups'][] = '<a href="' . $prefix . 'group/' . $group->guid . '/">' . $group->get_label() . '</a>';
206
-            }
207
-            catch (midcom_error $e)
204
+            } catch (midcom_error $e)
208 205
             {
209 206
                 $e->log();
210 207
             }
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/person/view.php 1 patch
Spacing   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,15 +43,14 @@  discard block
 block discarded – undo
43 43
         $this->add_breadcrumb('', $this->_person->get_label());
44 44
 
45 45
         $auth = midcom::get()->auth;
46
-        if (   $this->_person->id == midcom_connection::get_user()
46
+        if ($this->_person->id == midcom_connection::get_user()
47 47
             || $auth->can_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface'))
48 48
         {
49 49
             $buttons = array();
50 50
             $workflow = $this->get_workflow('datamanager2');
51 51
             if ($this->_person->can_do('midgard:update'))
52 52
             {
53
-                $buttons[] = $workflow->get_button("edit/{$this->_person->guid}/", array
54
-                (
53
+                $buttons[] = $workflow->get_button("edit/{$this->_person->guid}/", array(
55 54
                     MIDCOM_TOOLBAR_ACCESSKEY => 'e',
56 55
                 ));
57 56
             }
@@ -60,11 +59,10 @@  discard block
 block discarded – undo
60 59
                 $delete_workflow = $this->get_workflow('delete', array('object' => $this->_person));
61 60
                 $buttons[] = $delete_workflow->get_button("delete/{$this->_person->guid}/");
62 61
             }
63
-            if (   midcom_connection::is_user($this->_person)
62
+            if (midcom_connection::is_user($this->_person)
64 63
                 && $this->_person->can_do('midgard:privileges'))
65 64
             {
66
-                $buttons[] = $workflow->get_button("privileges/{$this->_person->guid}/", array
67
-                (
65
+                $buttons[] = $workflow->get_button("privileges/{$this->_person->guid}/", array(
68 66
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("permissions"),
69 67
                     MIDCOM_TOOLBAR_ICON => 'midgard.admin.asgard/permissions-16.png',
70 68
                 ));
@@ -72,8 +70,7 @@  discard block
 block discarded – undo
72 70
 
73 71
             if ($this->_person->can_do('midgard:update'))
74 72
             {
75
-                $buttons[] = $workflow->get_button("person/notifications/{$this->_person->guid}/", array
76
-                (
73
+                $buttons[] = $workflow->get_button("person/notifications/{$this->_person->guid}/", array(
77 74
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("notification settings"),
78 75
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock-discussion.png',
79 76
                 ));
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/person/account.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
         $accounthelper = new org_openpsa_user_accounthelper($this->_person);
195 195
 
196 196
         // Update account
197
-        if (   !$accounthelper->set_account($formmanager->get_value("username"), $password)
197
+        if (!$accounthelper->set_account($formmanager->get_value("username"), $password)
198 198
             && midcom_connection::get_error() != MGD_ERR_OK)
199 199
         {
200 200
             // Failure, give a message
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/person/edit.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
         midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_person->get_label()));
49 49
 
50 50
         $data['controller'] = $this->get_controller('simple', $this->_person);
51
-        $workflow = $this->get_workflow('datamanager2', array
52
-        (
51
+        $workflow = $this->get_workflow('datamanager2', array(
53 52
             'controller' => $data['controller'],
54 53
             'save_callback' => array($this, 'save_callback')
55 54
         ));
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/person/create.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
                     'title' => 'account_fieldset',
47 47
                     'css_group' => 'area meta',
48 48
                 );
49
-            }
50
-            else if ($current == $last)
49
+            } else if ($current == $last)
51 50
             {
52 51
                 $field['end_fieldset'] = '';
53 52
             }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
         {
42 42
             if ($current++ == 0)
43 43
             {
44
-                $field['start_fieldset'] = array
45
-                (
44
+                $field['start_fieldset'] = array(
46 45
                     'title' => 'account_fieldset',
47 46
                     'css_group' => 'area meta',
48 47
                 );
@@ -87,8 +86,7 @@  discard block
 block discarded – undo
87 86
         midcom::get()->head->set_pagetitle($this->_l10n->get('create person'));
88 87
 
89 88
         $data['controller'] = $this->get_controller('create');
90
-        $workflow = $this->get_workflow('datamanager2', array
91
-        (
89
+        $workflow = $this->get_workflow('datamanager2', array(
92 90
             'controller' => $data['controller'],
93 91
             'save_callback' => array($this, 'save_callback')
94 92
         ));
@@ -107,14 +105,14 @@  discard block
 block discarded – undo
107 105
     /**
108 106
      * DM2 creation callback.
109 107
      */
110
-    public function & dm2_create_callback (&$controller)
108
+    public function & dm2_create_callback(&$controller)
111 109
     {
112 110
         // Create a new person
113 111
         $this->_person = new midcom_db_person;
114
-        if (! $this->_person->create())
112
+        if (!$this->_person->create())
115 113
         {
116 114
             debug_print_r('We operated on this object:', $this->_person);
117
-            throw new midcom_error('Failed to create a new person. Last Midgard error was: '. midcom_connection::get_error_string());
115
+            throw new midcom_error('Failed to create a new person. Last Midgard error was: ' . midcom_connection::get_error_string());
118 116
         }
119 117
 
120 118
         return $this->_person;
Please login to merge, or discard this patch.
lib/org/openpsa/user/accounthelper.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -467,7 +467,7 @@
 block discarded – undo
467 467
 
468 468
         if (!midcom_services_at_interface::register($release_time, 'org.openpsa.user', 'reopen_account', $args))
469 469
         {
470
-             throw new midcom_error("Failed to register interface for re_open the user account, last Midgard error was: " . midcom_connection::get_error_string());
470
+                throw new midcom_error("Failed to register interface for re_open the user account, last Midgard error was: " . midcom_connection::get_error_string());
471 471
         }
472 472
         $this->_person->set_parameter("org_openpsa_user_blocked_account", "account_password", $account->get_password());
473 473
         $account->set_password('', false);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
             $mail->body = $this->_config->get('welcome_mail_body');
117 117
 
118 118
             // Make replacements to body
119
-            $mail->parameters = array
120
-            (
119
+            $mail->parameters = array(
121 120
                 "USERNAME" => $username,
122 121
                 "PASSWORD" => $password,
123 122
                 "SITE_URL" => midcom::get()->config->get('midcom_site_url')
@@ -163,7 +162,7 @@  discard block
 block discarded – undo
163 162
             $new_password_encrypted = midcom_connection::prepare_password($new_password);
164 163
 
165 164
             //check if the new encrypted password was already used
166
-            if (    $this->check_password_reuse($new_password_encrypted)
165
+            if ($this->check_password_reuse($new_password_encrypted)
167 166
                  && $this->check_password_strength($new_password))
168 167
             {
169 168
                 $this->_save_old_password();
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
         while ($length--)
219 218
         {
220 219
             $offset = 1;
221
-            if (   $length == 1
220
+            if ($length == 1
222 221
                 || $password == '')
223 222
             {
224 223
                 //make sure password doesn't begin or end in punctuation character
@@ -240,7 +239,7 @@  discard block
 block discarded – undo
240 239
         do
241 240
         {
242 241
             $password = self::generate_password($length);
243
-        } while(!$this->check_password_strength($password));
242
+        } while (!$this->check_password_strength($password));
244 243
         return $password;
245 244
     }
246 245
 
@@ -380,7 +379,7 @@  discard block
 block discarded – undo
380 379
             $repeated = true;
381 380
             for ($j = 0; $j < $plen && ($j + $i + $plen) < strlen($password); $j++)
382 381
             {
383
-                if (   (substr($password, $j + $i, 1) == substr($password, $j + $i + $plen, 1))
382
+                if ((substr($password, $j + $i, 1) == substr($password, $j + $i + $plen, 1))
384 383
                     && $repeated)
385 384
                 {
386 385
                     $repeated = true;
@@ -446,8 +445,7 @@  discard block
 block discarded – undo
446 445
             return false;
447 446
         }
448 447
         $release_time = time() + ($timeframe_minutes * 60);
449
-        $args = array
450
-        (
448
+        $args = array(
451 449
             'guid' => $this->_person->guid,
452 450
             'parameter_name' => 'org_openpsa_user_blocked_account',
453 451
             'password' => 'account_password',
@@ -539,7 +537,7 @@  discard block
 block discarded – undo
539 537
 
540 538
     public static function get_person_by_formdata($data)
541 539
     {
542
-        if (   empty($data['username'])
540
+        if (empty($data['username'])
543 541
             || empty($data['password']))
544 542
         {
545 543
             return false;
@@ -576,7 +574,7 @@  discard block
 block discarded – undo
576 574
         $max_attempts = midcom_baseclasses_components_configuration::get($component, 'config')->get('max_password_attempts');
577 575
         $timeframe = midcom_baseclasses_components_configuration::get($component, 'config')->get('password_block_timeframe_min');
578 576
 
579
-        if (   $max_attempts == 0
577
+        if ($max_attempts == 0
580 578
             || $timeframe == 0)
581 579
         {
582 580
             return $stat;
@@ -603,8 +601,8 @@  discard block
 block discarded – undo
603 601
          * If the maximum number of attemps is reached and the oldest attempt
604 602
          * on the stack is within our defined timeframe, we block the account
605 603
          */
606
-        if (   sizeof($attempts) >= $max_attempts
607
-            && $attempts[$max_attempts-1] >= (time() - ($timeframe * 60)))
604
+        if (sizeof($attempts) >= $max_attempts
605
+            && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60)))
608 606
         {
609 607
             $this->disable_account();
610 608
             $stat = false;
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
         {
85 85
             $generated_password = true;
86 86
             $password = $this->generate_safe_password($this->_config->get("min_password_length"));
87
-        }
88
-        else
87
+        } else
89 88
         {
90 89
             $generated_password = false;
91 90
         }
@@ -129,8 +128,7 @@  discard block
 block discarded – undo
129 128
                 $this->delete_account();
130 129
                 return false;
131 130
             }
132
-        }
133
-        else if ($generated_password)
131
+        } else if ($generated_password)
134 132
         {
135 133
             /*
136 134
              * no welcome mail was sent:
@@ -168,8 +166,7 @@  discard block
 block discarded – undo
168 166
             {
169 167
                 $this->_save_old_password();
170 168
                 $account->set_password($new_password);
171
-            }
172
-            else
169
+            } else
173 170
             {
174 171
                 $this->errstr = "password strength too low";
175 172
                 return false;
@@ -311,8 +308,7 @@  discard block
 block discarded – undo
311 308
             {
312 309
                 $old_passwords_array = array_slice($old_passwords_array, 0, $max);
313 310
             }
314
-        }
315
-        else
311
+        } else
316 312
         {
317 313
             $old_passwords_array = array();
318 314
         }
@@ -384,8 +380,7 @@  discard block
 block discarded – undo
384 380
                     && $repeated)
385 381
                 {
386 382
                     $repeated = true;
387
-                }
388
-                else
383
+                } else
389 384
                 {
390 385
                     $repeated = false;
391 386
                 }
@@ -398,8 +393,7 @@  discard block
 block discarded – undo
398 393
             {
399 394
                 $i += $plen - 1;
400 395
                 $repeated = false;
401
-            }
402
-            else
396
+            } else
403 397
             {
404 398
                 $result .= substr($password, $i, 1);
405 399
             }
Please login to merge, or discard this patch.
lib/org/openpsa/projects/project.php 2 patches
Spacing   +12 added lines, -23 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_project';
16 16
 
17
-    public $autodelete_dependents = array
18
-    (
17
+    public $autodelete_dependents = array(
19 18
         'org_openpsa_contacts_role_dba' => 'objectGuid'
20 19
     );
21 20
 
@@ -31,46 +30,38 @@  discard block
 block discarded – undo
31 30
      *
32 31
      * @var array
33 32
      */
34
-    private $_status_map = array
35
-    (
36
-        'rejected' => array
37
-        (
33
+    private $_status_map = array(
34
+        'rejected' => array(
38 35
             'ongoing' => org_openpsa_projects_task_status_dba::REOPENED, // If there's an ongoing task, the project seems to have resumed
39 36
             'not_started' => org_openpsa_projects_task_status_dba::PROPOSED, // There are pending tasks, so maybe the project is back to start
40 37
             'rejected' => null, // Sanity check
41 38
             'on_hold' => org_openpsa_projects_task_status_dba::ONHOLD, //Blocker task
42 39
             'closed' => org_openpsa_projects_task_status_dba::COMPLETED //Work seems to have been finished
43 40
         ),
44
-        'not_started' => array
45
-        (
41
+        'not_started' => array(
46 42
             'ongoing' => org_openpsa_projects_task_status_dba::STARTED, //Work seems to have been started
47 43
             'on_hold' => org_openpsa_projects_task_status_dba::ONHOLD, // Or is on hold
48 44
             'not_started' => null,
49 45
             'closed' => org_openpsa_projects_task_status_dba::COMPLETED // Or is even finished already
50 46
         ),
51
-        'ongoing' => array
52
-        (
47
+        'ongoing' => array(
53 48
             'ongoing' => null, //Only do something if there are no ongoing tasks
54 49
             'on_hold' => org_openpsa_projects_task_status_dba::ONHOLD, //Blocker task
55
-            'not_started' => array
56
-            (
50
+            'not_started' => array(
57 51
                 'closed' => org_openpsa_projects_task_status_dba::ONHOLD, //Project is in limbo: Some tasks are finished, others didn't begin yet
58 52
                 'not_started' => org_openpsa_projects_task_status_dba::PROPOSED //Back to start: Someone withdrew acceptance
59 53
             ),
60 54
             'closed' => org_openpsa_projects_task_status_dba::ONHOLD //Work seems to have been finished
61 55
         ),
62
-        'closed' => array
63
-        (
56
+        'closed' => array(
64 57
             'not_started' => org_openpsa_projects_task_status_dba::REOPENED, //Something new came up, reopen
65 58
             'ongoing' => org_openpsa_projects_task_status_dba::REOPENED, //Something new came up, reopen
66 59
             'closed' => null, //Sanity check
67 60
             'on_hold' => org_openpsa_projects_task_status_dba::ONHOLD
68 61
         ),
69
-        'on_hold' => array
70
-        (
62
+        'on_hold' => array(
71 63
             'on_hold' => null, //only if no task is on hold we have to look for something else
72
-            'not_started' => array
73
-            (
64
+            'not_started' => array(
74 65
                 'closed' => null,
75 66
                 'not_started' => org_openpsa_projects_task_status_dba::PROPOSED // If nothing is closed, ongoing or on hold, let's try not_started
76 67
             ),
@@ -177,8 +168,7 @@  discard block
 block discarded – undo
177 168
      */
178 169
     function get_task_count()
179 170
     {
180
-        $numbers = array
181
-        (
171
+        $numbers = array(
182 172
             'not_started' => 0,
183 173
             'ongoing' => 0,
184 174
             'on_hold' => 0,
@@ -202,8 +192,7 @@  discard block
 block discarded – undo
202 192
      */
203 193
     function get_task_hours()
204 194
     {
205
-        $numbers = array
206
-        (
195
+        $numbers = array(
207 196
             'plannedHours' => 0,
208 197
             'reportedHours' => 0
209 198
         );
@@ -266,7 +255,7 @@  discard block
 block discarded – undo
266 255
             $new_status = $this->_find_status($this->_status_map[$this->status_type], $status_types);
267 256
         }
268 257
 
269
-        if (   !is_null($new_status)
258
+        if (!is_null($new_status)
270 259
             && $this->status != $new_status)
271 260
         {
272 261
             $this->status = $new_status;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
             if (array_key_exists($this->_schema, $schemadb))
69 69
             {
70 70
                 $schema_name = $this->_schema;
71
-            }
72
-            else
71
+            } else
73 72
             {
74 73
                 $schema_name = key($schemadb);
75 74
             }
@@ -110,8 +109,7 @@  discard block
 block discarded – undo
110 109
             {
111 110
                 $this->_rows[] = array($row);
112 111
             }
113
-        }
114
-        else
112
+        } else
115 113
         {
116 114
             $this->_rows = $rows;
117 115
         }
Please login to merge, or discard this patch.