Completed
Pull Request — master (#2649)
by Christian
26:32
created
default/boinc/modules/boincuser/boincuser_delete/boincuser_delete.module 4 patches
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
  * Implementation of hook_perm().
20 20
  */
21 21
 function boincuser_delete_perm() {
22
-  return array('delete own account');
22
+    return array('delete own account');
23 23
 }
24 24
 
25 25
 /**
26 26
  * Implementation of hook_menu().
27 27
  */
28 28
 function boincuser_delete_menu() {
29
-  $items = array();
30
-  $items['admin/boinc/user_delete'] = array(
29
+    $items = array();
30
+    $items['admin/boinc/user_delete'] = array(
31 31
     'title' => t('Preferences: BOINC user delete'),
32 32
     'description' => t('Configure the BOINC user delete action.'),
33 33
     'page callback' => 'drupal_get_form',
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     'access arguments' => array('administer users'),
36 36
     'type' => MENU_NORMAL_ITEM,
37 37
     'file' => 'boincuser_delete.admin.inc',
38
-  );
38
+    );
39 39
 
40
-  $items['admin/boinc/user_delete/%'] = array(
40
+    $items['admin/boinc/user_delete/%'] = array(
41 41
     'title' => t('Admin delete user'),
42 42
     'description' => t('Deletes a user as an admin'),
43 43
     'page callback' => 'drupal_get_form',
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     'access arguments' => array('administer users'),
46 46
     'type' => MENU_CALLBACK,
47 47
     'file' => 'boincuser_delete.admin.inc',
48
-  );
48
+    );
49 49
 
50
-  $items['user/%user/deleteconfirm/%'] = array(
50
+    $items['user/%user/deleteconfirm/%'] = array(
51 51
     'title' => t('Final confirmation for account deletion'),
52 52
     'description' => t('Final confirmation for account deletion'),
53 53
     'page callback' => 'drupal_get_form',
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
     'access callback' => 'boincuser_delete_access',
56 56
     'access arguments' => array(1),
57 57
     'type' => MENU_CALLBACK,
58
-  );
58
+    );
59 59
 
60
-  $items['user/%user/odeleteconfirm/%'] = array(
60
+    $items['user/%user/odeleteconfirm/%'] = array(
61 61
     'title' => t('Final confirmation for account deletion'),
62 62
     'description' => t('Final confirmation for account deletion'),
63 63
     'page callback' => 'drupal_get_form',
@@ -65,181 +65,181 @@  discard block
 block discarded – undo
65 65
     'access callback' => 'boincuser_delete_access',
66 66
     'access arguments' => array(1),
67 67
     'type' => MENU_CALLBACK,
68
-  );
68
+    );
69 69
 
70
-  return $items;
70
+    return $items;
71 71
 }
72 72
 
73 73
 /**
74 74
  * Checks whether a user can delete an account.
75 75
  */
76 76
 function boincuser_delete_access($account) {
77
-  global $user;
78
-  return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0);
77
+    global $user;
78
+    return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0);
79 79
 }
80 80
 
81 81
 /**
82 82
  * Implementation of hook_menu_alter().
83 83
  */
84 84
 function boincuser_delete_menu_alter(&$callbacks) {
85
-  $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access';
86
-  $callbacks['user/%user/delete']['access arguments'] = array(1);
87
-  $callbacks['user/%user/delete']['type'] = MENU_CALLBACK;
85
+    $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access';
86
+    $callbacks['user/%user/delete']['access arguments'] = array(1);
87
+    $callbacks['user/%user/delete']['type'] = MENU_CALLBACK;
88 88
 }
89 89
 
90 90
 /**
91 91
  * Implementation of hook_form_alter().
92 92
  */
93 93
 function boincuser_delete_form_alter(&$form, $form_state, $form_id) {
94
-  global $user;
94
+    global $user;
95 95
 
96
-  switch($form_id) {
96
+    switch($form_id) {
97 97
     case 'user_profile_form':
98 98
       if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) {
99 99
         $form['delete'] = array(
100
-          '#type' => 'submit',
101
-          '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
102
-          '#weight' => 1009,
103
-          '#submit' => array('user_edit_delete_submit'),
104
-          '#prefix' => '<li class="tab">',
105
-          '#suffix' => '</li>',
100
+            '#type' => 'submit',
101
+            '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
102
+            '#weight' => 1009,
103
+            '#submit' => array('user_edit_delete_submit'),
104
+            '#prefix' => '<li class="tab">',
105
+            '#suffix' => '</li>',
106 106
         );
107
-      }
108
-      else if ( user_access('administer users') ) {
107
+        }
108
+        else if ( user_access('administer users') ) {
109 109
         $form['delete'] = array(
110
-          '#type' => 'submit',
111
-          '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
112
-          '#weight' => 1009,
113
-          '#submit' => array('_boincuser_delete_goto_admindelete'),
114
-          '#prefix' => '<li class="tab">',
115
-          '#suffix' => '</li>',
110
+            '#type' => 'submit',
111
+            '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
112
+            '#weight' => 1009,
113
+            '#submit' => array('_boincuser_delete_goto_admindelete'),
114
+            '#prefix' => '<li class="tab">',
115
+            '#suffix' => '</li>',
116 116
         );
117
-      }
118
-      else {
117
+        }
118
+        else {
119 119
         unset($form['delete']);
120
-      }
121
-      break;
120
+        }
121
+        break;
122 122
     case 'user_confirm_delete':
123 123
 
124 124
       $disable_delete = FALSE;
125
-      // If email address was changed less than 7 days (7 * 86400 s)
126
-      // ago, it cannot be changed again.
127
-      $duration = TOKEN_DURATION_ONE_WEEK;
128
-      if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) {
125
+        // If email address was changed less than 7 days (7 * 86400 s)
126
+        // ago, it cannot be changed again.
127
+        $duration = TOKEN_DURATION_ONE_WEEK;
128
+        if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) {
129 129
         drupal_set_message(
130
-          bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.",
130
+            bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.",
131 131
             array(
132
-              '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration),
132
+                '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration),
133 133
             ), NULL, 'boinc:account-credentials-change')
134 134
         , 'info');
135 135
         $disable_delete = TRUE;
136
-      }
136
+        }
137 137
 
138
-      // Configure radio options
139
-      $deleteoptions = array(
138
+        // Configure radio options
139
+        $deleteoptions = array(
140 140
         'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. Afterwards your account will be disabled, and all posts/comments will be attributed to the Anonymous User. However, your user profile will be deleted, your host information deleted, and you will be removed from any team you are a member of.', array(), NULL, 'boinc:delete-user-account'),
141 141
         'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),
142
-      );
142
+        );
143 143
 
144
-      $dtypes = variable_get('boincuser_delete_type', 'user_decides');
145
-      // unset the other option if dtype is set. i.e., if dtype is set
146
-      // to soft delete, unset the hard delete option.
147
-      switch ($dtypes) {
144
+        $dtypes = variable_get('boincuser_delete_type', 'user_decides');
145
+        // unset the other option if dtype is set. i.e., if dtype is set
146
+        // to soft delete, unset the hard delete option.
147
+        switch ($dtypes) {
148 148
         case 'soft_obfuscate':
149 149
           unset($deleteoptions['boincuser_delete_delete']);
150
-          break;
150
+            break;
151 151
         case 'hard_wipe':
152 152
           unset($deleteoptions['boincuser_delete_softdelete']);
153
-          break;
154
-      }
153
+            break;
154
+        }
155 155
 
156
-      $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?';
157
-      drupal_set_title($question);
156
+        $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?';
157
+        drupal_set_title($question);
158 158
 
159
-      unset($form['description']);
159
+        unset($form['description']);
160 160
 
161
-      $form['main'] = array(
161
+        $form['main'] = array(
162 162
         '#type' => 'fieldset',
163 163
         '#weight' => 1,
164
-      );
164
+        );
165 165
 
166
-      $form['main']['help'] = array(
166
+        $form['main']['help'] = array(
167 167
         '#value' => bts(
168
-          "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" .
169
-          "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>",
170
-          array(
168
+            "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" .
169
+            "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>",
170
+            array(
171 171
             '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'),
172
-          ), NULL, 'boinc:delete-user-account'),
172
+            ), NULL, 'boinc:delete-user-account'),
173 173
         '#weight' => 11,
174 174
         '#prefix' => "<div id='delete-instructions'>",
175 175
         '#suffix' => "</div>",
176
-      );
176
+        );
177 177
 
178
-      $form['main']['user_delete_action'] = array(
178
+        $form['main']['user_delete_action'] = array(
179 179
         '#type' => 'radios',
180 180
         '#options' => $deleteoptions,
181 181
         '#weight' => 21,
182
-      );
183
-      if ($disable_delete) {
182
+        );
183
+        if ($disable_delete) {
184 184
         $form['main']['user_delete_action']['#disabled'] = TRUE;
185
-      }
185
+        }
186 186
 
187
-      $form['separator_bottom'] = array(
187
+        $form['separator_bottom'] = array(
188 188
         '#value' => '<div class="separator buttons"></div>',
189 189
         '#weight' => 999,
190
-      );
190
+        );
191 191
 
192
-      // Password field
193
-      if (!$disable_delete) {
192
+        // Password field
193
+        if (!$disable_delete) {
194 194
         $form['main']['current_pass'] = array(
195
-          '#type' => 'password',
196
-          '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
197
-          '#size' => 17,
198
-          '#attributes' => array(
195
+            '#type' => 'password',
196
+            '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
197
+            '#size' => 17,
198
+            '#attributes' => array(
199 199
             'autocomplete' => 'off',
200
-          ),
201
-          '#weight' => 25,
200
+            ),
201
+            '#weight' => 25,
202 202
         );
203
-      }
203
+        }
204 204
 
205
-      // Configure the action buttons
206
-      $uid = $form['_account']['#value']->uid;
207
-      $form['actions']['#weight'] = 1000;
208
-      $form['actions']['form control tabs prefix'] = array(
205
+        // Configure the action buttons
206
+        $uid = $form['_account']['#value']->uid;
207
+        $form['actions']['#weight'] = 1000;
208
+        $form['actions']['form control tabs prefix'] = array(
209 209
         '#value' => '<ul class="form-control tab-list">',
210 210
         '#weight' => 1001,
211
-      );
212
-
213
-      unset($form['actions']['#prefix']);
214
-      unset($form['actions']['#suffix']);
215
-      $form['actions']['submit']['#prefix'] = '<li class="first tab">';
216
-      $form['actions']['submit']['#suffix'] = '</li>';
217
-      $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit');
218
-      $form['actions']['submit']['#weight'] = 1002;
219
-      if ($disable_delete) {
211
+        );
212
+
213
+        unset($form['actions']['#prefix']);
214
+        unset($form['actions']['#suffix']);
215
+        $form['actions']['submit']['#prefix'] = '<li class="first tab">';
216
+        $form['actions']['submit']['#suffix'] = '</li>';
217
+        $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit');
218
+        $form['actions']['submit']['#weight'] = 1002;
219
+        if ($disable_delete) {
220 220
         $form['actions']['submit']['#disabled'] = TRUE;
221 221
         $form['actions']['submit']['#value'] = '';
222
-      }
222
+        }
223 223
 
224
-      $form['actions']['cancel']['#prefix'] = '<li class="tab">';
225
-      $form['actions']['cancel']['#suffix'] = '</li>';
226
-      $form['actions']['cancel']['#weight'] = 1003;
227
-      $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit');
228
-      if ($disable_delete) {
224
+        $form['actions']['cancel']['#prefix'] = '<li class="tab">';
225
+        $form['actions']['cancel']['#suffix'] = '</li>';
226
+        $form['actions']['cancel']['#weight'] = 1003;
227
+        $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit');
228
+        if ($disable_delete) {
229 229
         $form['actions']['cancel']['#prefix'] = '<li class="first tab">';
230
-      }
230
+        }
231 231
 
232
-      $form['actions']['form control tabs suffix'] = array(
232
+        $form['actions']['form control tabs suffix'] = array(
233 233
         '#value' => '</ul>',
234 234
         '#weight' => 1010,
235
-      );
235
+        );
236 236
 
237
-      $form['#redirect'] = 'account/' . $uid;
238
-      $form['#validate'] = array('boincuser_delete_validate');
239
-      $form['#submit'] = array('boincuser_delete_submit');
240
-      break;
237
+        $form['#redirect'] = 'account/' . $uid;
238
+        $form['#validate'] = array('boincuser_delete_validate');
239
+        $form['#submit'] = array('boincuser_delete_submit');
240
+        break;
241 241
 
242
-  } // switch
242
+    } // switch
243 243
 }
244 244
 
245 245
 
@@ -250,24 +250,24 @@  discard block
 block discarded – undo
250 250
  * password.
251 251
  */
252 252
 function boincuser_delete_validate($form, &$form_state) {
253
-  require_boinc('boinc_db');
253
+    require_boinc('boinc_db');
254 254
 
255
-  if ($form_state['values']['user_delete_action'] == '') {
255
+    if ($form_state['values']['user_delete_action'] == '') {
256 256
     form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account'));
257
-  }
257
+    }
258 258
 
259
-  // check BOINC user exists
260
-  $account = $form_state['values']['_account'];
261
-  $boinc_user = boincuser_load($account->uid, TRUE);
262
-  if (!$boinc_user) {
259
+    // check BOINC user exists
260
+    $account = $form_state['values']['_account'];
261
+    $boinc_user = boincuser_load($account->uid, TRUE);
262
+    if (!$boinc_user) {
263 263
     return form_set_error('current_pass',
264
-      bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account')
264
+        bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account')
265 265
     );
266
-  }
266
+    }
267 267
 
268
-  if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
268
+    if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
269 269
     return true;
270
-  }
270
+    }
271 271
 }
272 272
 
273 273
 /**
@@ -278,41 +278,41 @@  discard block
 block discarded – undo
278 278
  * to delete the account.
279 279
  */
280 280
 function boincuser_delete_submit($form, &$form_state) {
281
-  require_boinc('token');
282
-  global $user;
281
+    require_boinc('token');
282
+    global $user;
283 283
 
284
-  $uid = $form_state['values']['_account']->uid;
285
-  $account = user_load(array('uid' => $uid));
284
+    $uid = $form_state['values']['_account']->uid;
285
+    $account = user_load(array('uid' => $uid));
286 286
 
287
-  if (!$account) {
287
+    if (!$account) {
288 288
     drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), NULL, 'delete-user-account'), 'error');
289 289
     watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR);
290 290
     return;
291
-  }
292
-
293
-  global $base_url;
294
-  global $base_path;
295
-  module_load_include('inc', 'rules', 'modules/system.rules');
296
-  $mysubject = '';
297
-  $mymessage = '';
298
-  $site_name = variable_get('site_name', 'Drupal-BOINC');
299
-  $site_url = $base_url . $base_path . "user/login";
300
-
301
-  // Perform the requested operation
302
-  $op = $form_state['values']['user_delete_action'];
303
-  // create token with 1 day/24 hour expiration
304
-  $mytoken = create_token($account->boincuser_id, 'D', 24*60*60);
305
-  switch ($op) {
291
+    }
292
+
293
+    global $base_url;
294
+    global $base_path;
295
+    module_load_include('inc', 'rules', 'modules/system.rules');
296
+    $mysubject = '';
297
+    $mymessage = '';
298
+    $site_name = variable_get('site_name', 'Drupal-BOINC');
299
+    $site_url = $base_url . $base_path . "user/login";
300
+
301
+    // Perform the requested operation
302
+    $op = $form_state['values']['user_delete_action'];
303
+    // create token with 1 day/24 hour expiration
304
+    $mytoken = create_token($account->boincuser_id, 'D', 24*60*60);
305
+    switch ($op) {
306 306
     case 'boincuser_delete_softdelete':
307 307
       $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken";
308
-      break;
308
+        break;
309 309
     case 'boincuser_delete_delete':
310 310
       $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken";
311
-      break;
312
-  }
311
+        break;
312
+    }
313 313
 
314
-  $mysubject = "Instructions for account deletion at {$site_name}";
315
-  $mymessage = ''
314
+    $mysubject = "Instructions for account deletion at {$site_name}";
315
+    $mymessage = ''
316 316
     . "{$account->boincuser_name},\n"
317 317
     . "\n"
318 318
     . "We have received a request to DELETE your user account at "
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
     . "\n"
335 335
     . "{$site_name} support team";
336 336
 
337
-  // Create array for sending email to user to notify account is being
338
-  // disabled/deleted. Then send email.
339
-  $settings = array(
337
+    // Create array for sending email to user to notify account is being
338
+    // disabled/deleted. Then send email.
339
+    $settings = array(
340 340
     'from' => '',
341 341
     'subject' => $mysubject,
342 342
     'message' => $mymessage,
343
-  );
344
-  rules_action_mail_to_user($account, $settings);
343
+    );
344
+    rules_action_mail_to_user($account, $settings);
345 345
 
346
-  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
346
+    drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
347 347
 
348
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
349
-  // Redirect
350
-  if (!empty($redirect)) {
348
+    $redirect = variable_get('boincuser_delete_redirect', '<front>');
349
+    // Redirect
350
+    if (!empty($redirect)) {
351 351
     drupal_goto($redirect);
352
-  }
353
-  else {
352
+    }
353
+    else {
354 354
     drupal_goto();
355
-  }
355
+    }
356 356
 }
357 357
 
358 358
 
@@ -364,77 +364,77 @@  discard block
 block discarded – undo
364 364
  * The final confirmation form for the user to delete their account.
365 365
  */
366 366
 function boincuser_delete_finalconfirmation(&$form_state, $token) {
367
-  require_boinc('token');
367
+    require_boinc('token');
368 368
 
369
-  global $user;
370
-  $form = array();
369
+    global $user;
370
+    $form = array();
371 371
 
372
-  // check BOINC user exists
373
-  $account = user_load(array('uid' => $user->uid));
374
-  $uid = $user->uid;
375
-  $boincid = $account->boincuser_id;
376
-  // check $token is valid
377
-  if (!is_valid_token($boincid, $token, 'D')) {
372
+    // check BOINC user exists
373
+    $account = user_load(array('uid' => $user->uid));
374
+    $uid = $user->uid;
375
+    $boincid = $account->boincuser_id;
376
+    // check $token is valid
377
+    if (!is_valid_token($boincid, $token, 'D')) {
378 378
     drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
379 379
     array(
380
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
380
+        '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
381 381
     ),
382 382
     NULL, 'boinc:delete-user-account'), 'error');
383 383
     drupal_goto();
384
-  }
384
+    }
385 385
 
386
-  // Attach account to this form.
387
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
386
+    // Attach account to this form.
387
+    $form['_account'] = array('#type' => 'value', '#value' => $account);
388 388
 
389
-  // This form is for hard/wipe delete
390
-  $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
389
+    // This form is for hard/wipe delete
390
+    $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
391 391
 
392
-  // Instructions
393
-  $form['main']['instructions1'] = array(
392
+    // Instructions
393
+    $form['main']['instructions1'] = array(
394 394
     '#value' => '<p>'.
395 395
     bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
396 396
     '</p>',
397
-  );
397
+    );
398 398
 
399
-  $form['main']['instructions2'] = array(
399
+    $form['main']['instructions2'] = array(
400 400
     '#value' => '<p>'.
401 401
     bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
402 402
     '</p>',
403
-  );
403
+    );
404 404
 
405
-  // Password field
406
-  $form['main']['current_pass'] = array(
405
+    // Password field
406
+    $form['main']['current_pass'] = array(
407 407
     '#type' => 'password',
408 408
     '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
409 409
     '#size' => 17,
410 410
     '#attributes' => array(
411
-      'autocomplete' => 'off',
411
+        'autocomplete' => 'off',
412 412
     ),
413 413
     '#weight' => 25,
414
-  );
414
+    );
415 415
 
416
-  // Form control
417
-  $form['form control tabs prefix'] = array(
416
+    // Form control
417
+    $form['form control tabs prefix'] = array(
418 418
     '#value' => '<ul class="form-control tab-list">',
419 419
     '#weight' => 1001,
420
-  );
421
-  $form['submit'] = array(
420
+    );
421
+    $form['submit'] = array(
422 422
     '#prefix' => '<li class="first tab">',
423 423
     '#type' => 'submit',
424 424
     '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
425 425
     '#suffix' => '</li>',
426 426
     '#weight' => 1002,
427
-  );
428
-  $form['form control tabs'] = array(
427
+    );
428
+    $form['form control tabs'] = array(
429 429
     '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
430 430
     '#weight' => 1003,
431
-  );
432
-  $form['form control tabs suffix'] = array(
431
+    );
432
+    $form['form control tabs suffix'] = array(
433 433
     '#value' => '</ul>',
434 434
     '#weight' => 1004,
435
-  );
435
+    );
436 436
 
437
-  return $form;
437
+    return $form;
438 438
 }
439 439
 
440 440
 /**
@@ -442,122 +442,122 @@  discard block
 block discarded – undo
442 442
  * the soft/obfuscate method.
443 443
  */
444 444
 function boincuser_delete_softdelconfirmation(&$form_state, $token) {
445
-  require_boinc('token');
445
+    require_boinc('token');
446 446
 
447
-  global $user;
448
-  $form = array();
447
+    global $user;
448
+    $form = array();
449 449
 
450
-  // check BOINC user exists
451
-  $account = user_load(array('uid' => $user->uid));
452
-  $uid = $user->uid;
453
-  $boincid = $account->boincuser_id;
450
+    // check BOINC user exists
451
+    $account = user_load(array('uid' => $user->uid));
452
+    $uid = $user->uid;
453
+    $boincid = $account->boincuser_id;
454 454
 
455
-  // check $token is valid
456
-  if (!is_valid_token($boincid, $token, 'D')) {
455
+    // check $token is valid
456
+    if (!is_valid_token($boincid, $token, 'D')) {
457 457
     drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
458 458
     array(
459
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
459
+        '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
460 460
     ),
461 461
     NULL, 'boinc:delete-user-account'), 'error');
462 462
     drupal_goto();
463
-  }
463
+    }
464 464
 
465
-  // Attach account to this form.
466
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
465
+    // Attach account to this form.
466
+    $form['_account'] = array('#type' => 'value', '#value' => $account);
467 467
 
468
-  // This form is for hard/wipe delete
469
-  $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
468
+    // This form is for hard/wipe delete
469
+    $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
470 470
 
471
-  // Instructions
472
-  $form['main']['instructions1'] = array(
471
+    // Instructions
472
+    $form['main']['instructions1'] = array(
473 473
     '#value' => '<p>'.
474 474
     bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
475 475
     '</p>',
476
-  );
476
+    );
477 477
 
478
-  $form['main']['instructions2'] = array(
478
+    $form['main']['instructions2'] = array(
479 479
     '#value' => '<p>'.
480 480
     bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
481 481
     '</p>',
482
-  );
482
+    );
483 483
 
484
-  // Password field
485
-  $form['main']['current_pass'] = array(
484
+    // Password field
485
+    $form['main']['current_pass'] = array(
486 486
     '#type' => 'password',
487 487
     '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
488 488
     '#size' => 17,
489 489
     '#attributes' => array(
490
-      'autocomplete' => 'off',
490
+        'autocomplete' => 'off',
491 491
     ),
492 492
     '#weight' => 25,
493
-  );
493
+    );
494 494
 
495
-  // Form control
496
-  $form['form control tabs prefix'] = array(
495
+    // Form control
496
+    $form['form control tabs prefix'] = array(
497 497
     '#value' => '<ul class="form-control tab-list">',
498 498
     '#weight' => 1001,
499
-  );
500
-  $form['submit'] = array(
499
+    );
500
+    $form['submit'] = array(
501 501
     '#prefix' => '<li class="first tab">',
502 502
     '#type' => 'submit',
503 503
     '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
504 504
     '#suffix' => '</li>',
505 505
     '#weight' => 1002,
506
-  );
507
-  $form['form control tabs'] = array(
506
+    );
507
+    $form['form control tabs'] = array(
508 508
     '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
509 509
     '#weight' => 1003,
510
-  );
511
-  $form['form control tabs suffix'] = array(
510
+    );
511
+    $form['form control tabs suffix'] = array(
512 512
     '#value' => '</ul>',
513 513
     '#weight' => 1004,
514
-  );
514
+    );
515 515
 
516
-  //set validation and submit to the functions below
517
-  $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
518
-  $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
519
-  return $form;
516
+    //set validation and submit to the functions below
517
+    $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
518
+    $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
519
+    return $form;
520 520
 }
521 521
 
522 522
 /**
523 523
  * Validation for final confirmation
524 524
  */
525 525
 function boincuser_delete_finalconfirmation_validate($form, &$form_state) {
526
-  $account = $form_state['values']['_account'];
527
-  $boinc_user = BoincUser::lookup_id($account->boincuser_id);
526
+    $account = $form_state['values']['_account'];
527
+    $boinc_user = BoincUser::lookup_id($account->boincuser_id);
528 528
 
529
-  if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
529
+    if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
530 530
     return true;
531
-  }
531
+    }
532 532
 }
533 533
 
534 534
 /**
535 535
  * Submit for final confirmation
536 536
  */
537 537
 function boincuser_delete_finalconfirmation_submit($form, &$form_state) {
538
-  global $user;
538
+    global $user;
539 539
 
540
-  // Delete the user
541
-  $account = $form_state['values']['_account'];
542
-  $action = $form_state['values']['_action'];
543
-  _boincuser_delete_deleteuser($account, $action);
540
+    // Delete the user
541
+    $account = $form_state['values']['_account'];
542
+    $action = $form_state['values']['_action'];
543
+    _boincuser_delete_deleteuser($account, $action);
544 544
 
545
-  // Destroy the current session:
546
-  session_destroy();
547
-  // Only variables can be passed by reference workaround.
548
-  $null = NULL;
549
-  user_module_invoke('logout', $null, $user);
545
+    // Destroy the current session:
546
+    session_destroy();
547
+    // Only variables can be passed by reference workaround.
548
+    $null = NULL;
549
+    user_module_invoke('logout', $null, $user);
550 550
 
551
-  // Load the anonymous user
552
-  $user = drupal_anonymous_user();
551
+    // Load the anonymous user
552
+    $user = drupal_anonymous_user();
553 553
 
554
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
555
-  // Redirect
556
-  if (!empty($redirect)) {
554
+    $redirect = variable_get('boincuser_delete_redirect', '<front>');
555
+    // Redirect
556
+    if (!empty($redirect)) {
557 557
     drupal_goto($redirect);
558
-  }
559
-  else {
558
+    }
559
+    else {
560 560
     drupal_goto();
561
-  }
561
+    }
562 562
 
563 563
 }
Please login to merge, or discard this patch.
Switch Indentation   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -94,64 +94,64 @@  discard block
 block discarded – undo
94 94
   global $user;
95 95
 
96 96
   switch($form_id) {
97
-    case 'user_profile_form':
98
-      if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) {
99
-        $form['delete'] = array(
100
-          '#type' => 'submit',
101
-          '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
102
-          '#weight' => 1009,
103
-          '#submit' => array('user_edit_delete_submit'),
104
-          '#prefix' => '<li class="tab">',
105
-          '#suffix' => '</li>',
106
-        );
107
-      }
108
-      else if ( user_access('administer users') ) {
109
-        $form['delete'] = array(
110
-          '#type' => 'submit',
111
-          '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
112
-          '#weight' => 1009,
113
-          '#submit' => array('_boincuser_delete_goto_admindelete'),
114
-          '#prefix' => '<li class="tab">',
115
-          '#suffix' => '</li>',
116
-        );
117
-      }
118
-      else {
119
-        unset($form['delete']);
120
-      }
121
-      break;
122
-    case 'user_confirm_delete':
123
-
124
-      $disable_delete = FALSE;
125
-      // If email address was changed less than 7 days (7 * 86400 s)
126
-      // ago, it cannot be changed again.
127
-      $duration = TOKEN_DURATION_ONE_WEEK;
128
-      if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) {
129
-        drupal_set_message(
130
-          bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.",
131
-            array(
132
-              '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration),
133
-            ), NULL, 'boinc:account-credentials-change')
134
-        , 'info');
135
-        $disable_delete = TRUE;
136
-      }
137
-
138
-      // Configure radio options
139
-      $deleteoptions = array(
140
-        'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. Afterwards your account will be disabled, and all posts/comments will be attributed to the Anonymous User. However, your user profile will be deleted, your host information deleted, and you will be removed from any team you are a member of.', array(), NULL, 'boinc:delete-user-account'),
141
-        'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),
97
+  case 'user_profile_form':
98
+    if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) {
99
+      $form['delete'] = array(
100
+        '#type' => 'submit',
101
+        '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
102
+        '#weight' => 1009,
103
+        '#submit' => array('user_edit_delete_submit'),
104
+        '#prefix' => '<li class="tab">',
105
+        '#suffix' => '</li>',
142 106
       );
107
+    }
108
+    else if ( user_access('administer users') ) {
109
+      $form['delete'] = array(
110
+        '#type' => 'submit',
111
+        '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
112
+        '#weight' => 1009,
113
+        '#submit' => array('_boincuser_delete_goto_admindelete'),
114
+        '#prefix' => '<li class="tab">',
115
+        '#suffix' => '</li>',
116
+      );
117
+    }
118
+    else {
119
+      unset($form['delete']);
120
+    }
121
+    break;
122
+  case 'user_confirm_delete':
123
+
124
+    $disable_delete = FALSE;
125
+    // If email address was changed less than 7 days (7 * 86400 s)
126
+    // ago, it cannot be changed again.
127
+    $duration = TOKEN_DURATION_ONE_WEEK;
128
+    if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) {
129
+      drupal_set_message(
130
+        bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.",
131
+          array(
132
+            '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration),
133
+          ), NULL, 'boinc:account-credentials-change')
134
+      , 'info');
135
+      $disable_delete = TRUE;
136
+    }
137
+
138
+    // Configure radio options
139
+    $deleteoptions = array(
140
+      'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. Afterwards your account will be disabled, and all posts/comments will be attributed to the Anonymous User. However, your user profile will be deleted, your host information deleted, and you will be removed from any team you are a member of.', array(), NULL, 'boinc:delete-user-account'),
141
+      'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),
142
+    );
143 143
 
144
-      $dtypes = variable_get('boincuser_delete_type', 'user_decides');
145
-      // unset the other option if dtype is set. i.e., if dtype is set
146
-      // to soft delete, unset the hard delete option.
147
-      switch ($dtypes) {
148
-        case 'soft_obfuscate':
149
-          unset($deleteoptions['boincuser_delete_delete']);
150
-          break;
151
-        case 'hard_wipe':
152
-          unset($deleteoptions['boincuser_delete_softdelete']);
153
-          break;
154
-      }
144
+    $dtypes = variable_get('boincuser_delete_type', 'user_decides');
145
+    // unset the other option if dtype is set. i.e., if dtype is set
146
+    // to soft delete, unset the hard delete option.
147
+    switch ($dtypes) {
148
+    case 'soft_obfuscate':
149
+    unset($deleteoptions['boincuser_delete_delete']);
150
+    break;
151
+    case 'hard_wipe':
152
+    unset($deleteoptions['boincuser_delete_softdelete']);
153
+    break;
154
+    }
155 155
 
156 156
       $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?';
157 157
       drupal_set_title($question);
@@ -303,56 +303,56 @@  discard block
 block discarded – undo
303 303
   // create token with 1 day/24 hour expiration
304 304
   $mytoken = create_token($account->boincuser_id, 'D', 24*60*60);
305 305
   switch ($op) {
306
-    case 'boincuser_delete_softdelete':
307
-      $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken";
308
-      break;
309
-    case 'boincuser_delete_delete':
310
-      $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken";
306
+  case 'boincuser_delete_softdelete':
307
+    $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken";
311 308
       break;
312
-  }
313
-
314
-  $mysubject = "Instructions for account deletion at {$site_name}";
315
-  $mymessage = ''
316
-    . "{$account->boincuser_name},\n"
317
-    . "\n"
318
-    . "We have received a request to DELETE your user account at "
319
-    . "${site_name}. Below in this email is a one-time token you must "
320
-    . "use. Either click on the link or copy-and-paste the URL into your "
321
-    . "browser address bar. Then you will be required to enter your password "
322
-    . "again to confirm your identity.\n"
323
-    . "\n"
324
-    . "${myurl}\n"
325
-    . "\n"
326
-    . "This one-time token will expire in 24 hours. Afterwards you must "
327
-    . "re-request deletion of your account in order to generate a new token.\n"
328
-    . "\n"
329
-    . "If you did not initiate this request, please login to the "
330
-    . "${site_name} Web site (${site_url}) and "
331
-    . "then contact the administrators.\n"
332
-    . "\n"
333
-    . "Thanks, \n"
334
-    . "\n"
335
-    . "{$site_name} support team";
336
-
337
-  // Create array for sending email to user to notify account is being
338
-  // disabled/deleted. Then send email.
339
-  $settings = array(
340
-    'from' => '',
341
-    'subject' => $mysubject,
342
-    'message' => $mymessage,
343
-  );
344
-  rules_action_mail_to_user($account, $settings);
345
-
346
-  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
309
+case 'boincuser_delete_delete':
310
+  $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken";
311
+  break;
312
+}
347 313
 
348
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
349
-  // Redirect
350
-  if (!empty($redirect)) {
351
-    drupal_goto($redirect);
352
-  }
353
-  else {
354
-    drupal_goto();
355
-  }
314
+$mysubject = "Instructions for account deletion at {$site_name}";
315
+$mymessage = ''
316
+. "{$account->boincuser_name},\n"
317
+. "\n"
318
+. "We have received a request to DELETE your user account at "
319
+. "${site_name}. Below in this email is a one-time token you must "
320
+. "use. Either click on the link or copy-and-paste the URL into your "
321
+. "browser address bar. Then you will be required to enter your password "
322
+. "again to confirm your identity.\n"
323
+. "\n"
324
+. "${myurl}\n"
325
+. "\n"
326
+. "This one-time token will expire in 24 hours. Afterwards you must "
327
+. "re-request deletion of your account in order to generate a new token.\n"
328
+. "\n"
329
+. "If you did not initiate this request, please login to the "
330
+. "${site_name} Web site (${site_url}) and "
331
+. "then contact the administrators.\n"
332
+. "\n"
333
+. "Thanks, \n"
334
+. "\n"
335
+. "{$site_name} support team";
336
+
337
+// Create array for sending email to user to notify account is being
338
+// disabled/deleted. Then send email.
339
+$settings = array(
340
+'from' => '',
341
+'subject' => $mysubject,
342
+'message' => $mymessage,
343
+);
344
+rules_action_mail_to_user($account, $settings);
345
+
346
+drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
347
+
348
+$redirect = variable_get('boincuser_delete_redirect', '<front>');
349
+// Redirect
350
+if (!empty($redirect)) {
351
+drupal_goto($redirect);
352
+}
353
+else {
354
+drupal_goto();
355
+}
356 356
 }
357 357
 
358 358
 
@@ -364,77 +364,77 @@  discard block
 block discarded – undo
364 364
  * The final confirmation form for the user to delete their account.
365 365
  */
366 366
 function boincuser_delete_finalconfirmation(&$form_state, $token) {
367
-  require_boinc('token');
368
-
369
-  global $user;
370
-  $form = array();
371
-
372
-  // check BOINC user exists
373
-  $account = user_load(array('uid' => $user->uid));
374
-  $uid = $user->uid;
375
-  $boincid = $account->boincuser_id;
376
-  // check $token is valid
377
-  if (!is_valid_token($boincid, $token, 'D')) {
378
-    drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
379
-    array(
380
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
381
-    ),
382
-    NULL, 'boinc:delete-user-account'), 'error');
383
-    drupal_goto();
384
-  }
385
-
386
-  // Attach account to this form.
387
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
388
-
389
-  // This form is for hard/wipe delete
390
-  $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
391
-
392
-  // Instructions
393
-  $form['main']['instructions1'] = array(
394
-    '#value' => '<p>'.
395
-    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
396
-    '</p>',
397
-  );
398
-
399
-  $form['main']['instructions2'] = array(
400
-    '#value' => '<p>'.
401
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
402
-    '</p>',
403
-  );
404
-
405
-  // Password field
406
-  $form['main']['current_pass'] = array(
407
-    '#type' => 'password',
408
-    '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
409
-    '#size' => 17,
410
-    '#attributes' => array(
411
-      'autocomplete' => 'off',
412
-    ),
413
-    '#weight' => 25,
414
-  );
415
-
416
-  // Form control
417
-  $form['form control tabs prefix'] = array(
418
-    '#value' => '<ul class="form-control tab-list">',
419
-    '#weight' => 1001,
420
-  );
421
-  $form['submit'] = array(
422
-    '#prefix' => '<li class="first tab">',
423
-    '#type' => 'submit',
424
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
425
-    '#suffix' => '</li>',
426
-    '#weight' => 1002,
427
-  );
428
-  $form['form control tabs'] = array(
429
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
430
-    '#weight' => 1003,
431
-  );
432
-  $form['form control tabs suffix'] = array(
433
-    '#value' => '</ul>',
434
-    '#weight' => 1004,
435
-  );
367
+require_boinc('token');
368
+
369
+global $user;
370
+$form = array();
371
+
372
+// check BOINC user exists
373
+$account = user_load(array('uid' => $user->uid));
374
+$uid = $user->uid;
375
+$boincid = $account->boincuser_id;
376
+// check $token is valid
377
+if (!is_valid_token($boincid, $token, 'D')) {
378
+drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
379
+array(
380
+  '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
381
+),
382
+NULL, 'boinc:delete-user-account'), 'error');
383
+drupal_goto();
384
+}
436 385
 
437
-  return $form;
386
+// Attach account to this form.
387
+$form['_account'] = array('#type' => 'value', '#value' => $account);
388
+
389
+// This form is for hard/wipe delete
390
+$form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
391
+
392
+// Instructions
393
+$form['main']['instructions1'] = array(
394
+'#value' => '<p>'.
395
+bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
396
+'</p>',
397
+);
398
+
399
+$form['main']['instructions2'] = array(
400
+'#value' => '<p>'.
401
+bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
402
+'</p>',
403
+);
404
+
405
+// Password field
406
+$form['main']['current_pass'] = array(
407
+'#type' => 'password',
408
+'#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
409
+'#size' => 17,
410
+'#attributes' => array(
411
+  'autocomplete' => 'off',
412
+),
413
+'#weight' => 25,
414
+);
415
+
416
+// Form control
417
+$form['form control tabs prefix'] = array(
418
+'#value' => '<ul class="form-control tab-list">',
419
+'#weight' => 1001,
420
+);
421
+$form['submit'] = array(
422
+'#prefix' => '<li class="first tab">',
423
+'#type' => 'submit',
424
+'#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
425
+'#suffix' => '</li>',
426
+'#weight' => 1002,
427
+);
428
+$form['form control tabs'] = array(
429
+'#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
430
+'#weight' => 1003,
431
+);
432
+$form['form control tabs suffix'] = array(
433
+'#value' => '</ul>',
434
+'#weight' => 1004,
435
+);
436
+
437
+return $form;
438 438
 }
439 439
 
440 440
 /**
@@ -442,122 +442,122 @@  discard block
 block discarded – undo
442 442
  * the soft/obfuscate method.
443 443
  */
444 444
 function boincuser_delete_softdelconfirmation(&$form_state, $token) {
445
-  require_boinc('token');
446
-
447
-  global $user;
448
-  $form = array();
449
-
450
-  // check BOINC user exists
451
-  $account = user_load(array('uid' => $user->uid));
452
-  $uid = $user->uid;
453
-  $boincid = $account->boincuser_id;
454
-
455
-  // check $token is valid
456
-  if (!is_valid_token($boincid, $token, 'D')) {
457
-    drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
458
-    array(
459
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
460
-    ),
461
-    NULL, 'boinc:delete-user-account'), 'error');
462
-    drupal_goto();
463
-  }
464
-
465
-  // Attach account to this form.
466
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
467
-
468
-  // This form is for hard/wipe delete
469
-  $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
470
-
471
-  // Instructions
472
-  $form['main']['instructions1'] = array(
473
-    '#value' => '<p>'.
474
-    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
475
-    '</p>',
476
-  );
477
-
478
-  $form['main']['instructions2'] = array(
479
-    '#value' => '<p>'.
480
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
481
-    '</p>',
482
-  );
483
-
484
-  // Password field
485
-  $form['main']['current_pass'] = array(
486
-    '#type' => 'password',
487
-    '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
488
-    '#size' => 17,
489
-    '#attributes' => array(
490
-      'autocomplete' => 'off',
491
-    ),
492
-    '#weight' => 25,
493
-  );
494
-
495
-  // Form control
496
-  $form['form control tabs prefix'] = array(
497
-    '#value' => '<ul class="form-control tab-list">',
498
-    '#weight' => 1001,
499
-  );
500
-  $form['submit'] = array(
501
-    '#prefix' => '<li class="first tab">',
502
-    '#type' => 'submit',
503
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
504
-    '#suffix' => '</li>',
505
-    '#weight' => 1002,
506
-  );
507
-  $form['form control tabs'] = array(
508
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
509
-    '#weight' => 1003,
510
-  );
511
-  $form['form control tabs suffix'] = array(
512
-    '#value' => '</ul>',
513
-    '#weight' => 1004,
514
-  );
445
+require_boinc('token');
446
+
447
+global $user;
448
+$form = array();
449
+
450
+// check BOINC user exists
451
+$account = user_load(array('uid' => $user->uid));
452
+$uid = $user->uid;
453
+$boincid = $account->boincuser_id;
454
+
455
+// check $token is valid
456
+if (!is_valid_token($boincid, $token, 'D')) {
457
+drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
458
+array(
459
+  '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
460
+),
461
+NULL, 'boinc:delete-user-account'), 'error');
462
+drupal_goto();
463
+}
515 464
 
516
-  //set validation and submit to the functions below
517
-  $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
518
-  $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
519
-  return $form;
465
+// Attach account to this form.
466
+$form['_account'] = array('#type' => 'value', '#value' => $account);
467
+
468
+// This form is for hard/wipe delete
469
+$form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
470
+
471
+// Instructions
472
+$form['main']['instructions1'] = array(
473
+'#value' => '<p>'.
474
+bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
475
+'</p>',
476
+);
477
+
478
+$form['main']['instructions2'] = array(
479
+'#value' => '<p>'.
480
+bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
481
+'</p>',
482
+);
483
+
484
+// Password field
485
+$form['main']['current_pass'] = array(
486
+'#type' => 'password',
487
+'#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
488
+'#size' => 17,
489
+'#attributes' => array(
490
+  'autocomplete' => 'off',
491
+),
492
+'#weight' => 25,
493
+);
494
+
495
+// Form control
496
+$form['form control tabs prefix'] = array(
497
+'#value' => '<ul class="form-control tab-list">',
498
+'#weight' => 1001,
499
+);
500
+$form['submit'] = array(
501
+'#prefix' => '<li class="first tab">',
502
+'#type' => 'submit',
503
+'#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
504
+'#suffix' => '</li>',
505
+'#weight' => 1002,
506
+);
507
+$form['form control tabs'] = array(
508
+'#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
509
+'#weight' => 1003,
510
+);
511
+$form['form control tabs suffix'] = array(
512
+'#value' => '</ul>',
513
+'#weight' => 1004,
514
+);
515
+
516
+//set validation and submit to the functions below
517
+$form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
518
+$form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
519
+return $form;
520 520
 }
521 521
 
522 522
 /**
523 523
  * Validation for final confirmation
524 524
  */
525 525
 function boincuser_delete_finalconfirmation_validate($form, &$form_state) {
526
-  $account = $form_state['values']['_account'];
527
-  $boinc_user = BoincUser::lookup_id($account->boincuser_id);
526
+$account = $form_state['values']['_account'];
527
+$boinc_user = BoincUser::lookup_id($account->boincuser_id);
528 528
 
529
-  if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
530
-    return true;
531
-  }
529
+if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
530
+return true;
531
+}
532 532
 }
533 533
 
534 534
 /**
535 535
  * Submit for final confirmation
536 536
  */
537 537
 function boincuser_delete_finalconfirmation_submit($form, &$form_state) {
538
-  global $user;
539
-
540
-  // Delete the user
541
-  $account = $form_state['values']['_account'];
542
-  $action = $form_state['values']['_action'];
543
-  _boincuser_delete_deleteuser($account, $action);
544
-
545
-  // Destroy the current session:
546
-  session_destroy();
547
-  // Only variables can be passed by reference workaround.
548
-  $null = NULL;
549
-  user_module_invoke('logout', $null, $user);
550
-
551
-  // Load the anonymous user
552
-  $user = drupal_anonymous_user();
553
-
554
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
555
-  // Redirect
556
-  if (!empty($redirect)) {
557
-    drupal_goto($redirect);
558
-  }
559
-  else {
560
-    drupal_goto();
561
-  }
538
+global $user;
539
+
540
+// Delete the user
541
+$account = $form_state['values']['_account'];
542
+$action = $form_state['values']['_action'];
543
+_boincuser_delete_deleteuser($account, $action);
544
+
545
+// Destroy the current session:
546
+session_destroy();
547
+// Only variables can be passed by reference workaround.
548
+$null = NULL;
549
+user_module_invoke('logout', $null, $user);
550
+
551
+// Load the anonymous user
552
+$user = drupal_anonymous_user();
553
+
554
+$redirect = variable_get('boincuser_delete_redirect', '<front>');
555
+// Redirect
556
+if (!empty($redirect)) {
557
+drupal_goto($redirect);
558
+}
559
+else {
560
+drupal_goto();
561
+}
562 562
 
563 563
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 function boincuser_delete_form_alter(&$form, $form_state, $form_id) {
94 94
   global $user;
95 95
 
96
-  switch($form_id) {
96
+  switch ($form_id) {
97 97
     case 'user_profile_form':
98
-      if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) {
98
+      if (user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3) == '')) {
99 99
         $form['delete'] = array(
100 100
           '#type' => 'submit',
101 101
           '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
           '#suffix' => '</li>',
106 106
         );
107 107
       }
108
-      else if ( user_access('administer users') ) {
108
+      else if (user_access('administer users')) {
109 109
         $form['delete'] = array(
110 110
           '#type' => 'submit',
111 111
           '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
           break;
154 154
       }
155 155
 
156
-      $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?';
156
+      $question = 'Are you sure you want to delete the account <em>'.htmlspecialchars($form['_account']['#value']->boincuser_name).'</em>?';
157 157
       drupal_set_title($question);
158 158
 
159 159
       unset($form['description']);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
       $form['main']['help'] = array(
167 167
         '#value' => bts(
168
-          "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" .
168
+          "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>".
169 169
           "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>",
170 170
           array(
171 171
             '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'),
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         '#weight' => 1010,
235 235
       );
236 236
 
237
-      $form['#redirect'] = 'account/' . $uid;
237
+      $form['#redirect'] = 'account/'.$uid;
238 238
       $form['#validate'] = array('boincuser_delete_validate');
239 239
       $form['#submit'] = array('boincuser_delete_submit');
240 240
       break;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
   $mysubject = '';
297 297
   $mymessage = '';
298 298
   $site_name = variable_get('site_name', 'Drupal-BOINC');
299
-  $site_url = $base_url . $base_path . "user/login";
299
+  $site_url = $base_url.$base_path."user/login";
300 300
 
301 301
   // Perform the requested operation
302 302
   $op = $form_state['values']['user_delete_action'];
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
   );
344 344
   rules_action_mail_to_user($account, $settings);
345 345
 
346
-  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
346
+  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'), 'info');
347 347
 
348 348
   $redirect = variable_get('boincuser_delete_redirect', '<front>');
349 349
   // Redirect
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
     '#weight' => 1002,
427 427
   );
428 428
   $form['form control tabs'] = array(
429
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
429
+    '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/").'</li>',
430 430
     '#weight' => 1003,
431 431
   );
432 432
   $form['form control tabs suffix'] = array(
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     '#weight' => 1002,
506 506
   );
507 507
   $form['form control tabs'] = array(
508
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
508
+    '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/").'</li>',
509 509
     '#weight' => 1003,
510 510
   );
511 511
   $form['form control tabs suffix'] = array(
Please login to merge, or discard this patch.
Upper-Lower-Casing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
   switch($form_id) {
97 97
     case 'user_profile_form':
98
-      if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) {
98
+      if ( user_access('delete own account') and ($form['#uid'] == $user->uid) and (arg(3)=='') ) {
99 99
         $form['delete'] = array(
100 100
           '#type' => 'submit',
101 101
           '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'),
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
       break;
122 122
     case 'user_confirm_delete':
123 123
 
124
-      $disable_delete = FALSE;
124
+      $disable_delete = false;
125 125
       // If email address was changed less than 7 days (7 * 86400 s)
126 126
       // ago, it cannot be changed again.
127 127
       $duration = TOKEN_DURATION_ONE_WEEK;
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
           bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.",
131 131
             array(
132 132
               '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration),
133
-            ), NULL, 'boinc:account-credentials-change')
133
+            ), null, 'boinc:account-credentials-change')
134 134
         , 'info');
135
-        $disable_delete = TRUE;
135
+        $disable_delete = true;
136 136
       }
137 137
 
138 138
       // Configure radio options
139 139
       $deleteoptions = array(
140
-        'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. Afterwards your account will be disabled, and all posts/comments will be attributed to the Anonymous User. However, your user profile will be deleted, your host information deleted, and you will be removed from any team you are a member of.', array(), NULL, 'boinc:delete-user-account'),
141
-        'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),
140
+        'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. Afterwards your account will be disabled, and all posts/comments will be attributed to the Anonymous User. However, your user profile will be deleted, your host information deleted, and you will be removed from any team you are a member of.', array(), null, 'boinc:delete-user-account'),
141
+        'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), null, 'boinc:delete-user-account'),
142 142
       );
143 143
 
144 144
       $dtypes = variable_get('boincuser_delete_type', 'user_decides');
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
           "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" .
169 169
           "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>",
170 170
           array(
171
-            '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'),
172
-          ), NULL, 'boinc:delete-user-account'),
171
+            '!link' => l(bts('change your email address', array(), null, 'boinc:delete-user-account'), '/account/info/edit'),
172
+          ), null, 'boinc:delete-user-account'),
173 173
         '#weight' => 11,
174 174
         '#prefix' => "<div id='delete-instructions'>",
175 175
         '#suffix' => "</div>",
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         '#weight' => 21,
182 182
       );
183 183
       if ($disable_delete) {
184
-        $form['main']['user_delete_action']['#disabled'] = TRUE;
184
+        $form['main']['user_delete_action']['#disabled'] = true;
185 185
       }
186 186
 
187 187
       $form['separator_bottom'] = array(
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
       if (!$disable_delete) {
194 194
         $form['main']['current_pass'] = array(
195 195
           '#type' => 'password',
196
-          '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
196
+          '#title' => bts('Enter your password before clicking Submit', array(), null, 'boinc:delete-user-account'),
197 197
           '#size' => 17,
198 198
           '#attributes' => array(
199 199
             'autocomplete' => 'off',
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
       unset($form['actions']['#suffix']);
215 215
       $form['actions']['submit']['#prefix'] = '<li class="first tab">';
216 216
       $form['actions']['submit']['#suffix'] = '</li>';
217
-      $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit');
217
+      $form['actions']['submit']['#value'] = bts('Submit', array(), null, 'boinc:form-submit');
218 218
       $form['actions']['submit']['#weight'] = 1002;
219 219
       if ($disable_delete) {
220
-        $form['actions']['submit']['#disabled'] = TRUE;
220
+        $form['actions']['submit']['#disabled'] = true;
221 221
         $form['actions']['submit']['#value'] = '';
222 222
       }
223 223
 
224 224
       $form['actions']['cancel']['#prefix'] = '<li class="tab">';
225 225
       $form['actions']['cancel']['#suffix'] = '</li>';
226 226
       $form['actions']['cancel']['#weight'] = 1003;
227
-      $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit');
227
+      $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'account/info/edit');
228 228
       if ($disable_delete) {
229 229
         $form['actions']['cancel']['#prefix'] = '<li class="first tab">';
230 230
       }
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
   require_boinc('boinc_db');
254 254
 
255 255
   if ($form_state['values']['user_delete_action'] == '') {
256
-    form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account'));
256
+    form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), null, 'boinc:delete-user-account'));
257 257
   }
258 258
 
259 259
   // check BOINC user exists
260 260
   $account = $form_state['values']['_account'];
261
-  $boinc_user = boincuser_load($account->uid, TRUE);
261
+  $boinc_user = boincuser_load($account->uid, true);
262 262
   if (!$boinc_user) {
263 263
     return form_set_error('current_pass',
264
-      bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account')
264
+      bts('There was a problem deleting your account. Please contact the site administrators.', array(), null, 'boinc:delete-user-account')
265 265
     );
266 266
   }
267 267
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
   $account = user_load(array('uid' => $uid));
286 286
 
287 287
   if (!$account) {
288
-    drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), NULL, 'delete-user-account'), 'error');
288
+    drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), null, 'delete-user-account'), 'error');
289 289
     watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR);
290 290
     return;
291 291
   }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
   );
344 344
   rules_action_mail_to_user($account, $settings);
345 345
 
346
-  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
346
+  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), null, 'boinc:delete-user-account'),'info');
347 347
 
348 348
   $redirect = variable_get('boincuser_delete_redirect', '<front>');
349 349
   // Redirect
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
   if (!is_valid_token($boincid, $token, 'D')) {
378 378
     drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
379 379
     array(
380
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
380
+      '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"),
381 381
     ),
382
-    NULL, 'boinc:delete-user-account'), 'error');
382
+    null, 'boinc:delete-user-account'), 'error');
383 383
     drupal_goto();
384 384
   }
385 385
 
@@ -392,20 +392,20 @@  discard block
 block discarded – undo
392 392
   // Instructions
393 393
   $form['main']['instructions1'] = array(
394 394
     '#value' => '<p>'.
395
-    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
395
+    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), null, 'boinc:delete-user-account').
396 396
     '</p>',
397 397
   );
398 398
 
399 399
   $form['main']['instructions2'] = array(
400 400
     '#value' => '<p>'.
401
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
401
+    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), null, 'boinc:delete-user-account').
402 402
     '</p>',
403 403
   );
404 404
 
405 405
   // Password field
406 406
   $form['main']['current_pass'] = array(
407 407
     '#type' => 'password',
408
-    '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
408
+    '#title' => bts('Enter your password before clicking Submit', array(), null, 'boinc:delete-user-account'),
409 409
     '#size' => 17,
410 410
     '#attributes' => array(
411 411
       'autocomplete' => 'off',
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
   $form['submit'] = array(
422 422
     '#prefix' => '<li class="first tab">',
423 423
     '#type' => 'submit',
424
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
424
+    '#value' => bts('Submit', array(), null, 'boinc:form-submit'),
425 425
     '#suffix' => '</li>',
426 426
     '#weight' => 1002,
427 427
   );
428 428
   $form['form control tabs'] = array(
429
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
429
+    '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/") . '</li>',
430 430
     '#weight' => 1003,
431 431
   );
432 432
   $form['form control tabs suffix'] = array(
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
   if (!is_valid_token($boincid, $token, 'D')) {
457 457
     drupal_set_message(bts('ERROR: You have supplied an incorrect (most likely expired) token. Please obtain a new token by !link your account be deleted.',
458 458
     array(
459
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
459
+      '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"),
460 460
     ),
461
-    NULL, 'boinc:delete-user-account'), 'error');
461
+    null, 'boinc:delete-user-account'), 'error');
462 462
     drupal_goto();
463 463
   }
464 464
 
@@ -471,20 +471,20 @@  discard block
 block discarded – undo
471 471
   // Instructions
472 472
   $form['main']['instructions1'] = array(
473 473
     '#value' => '<p>'.
474
-    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), NULL, 'boinc:delete-user-account').
474
+    bts('You are one-step away from deleting your account. Enter your password in the textbox below and click submit. This action is irreversable: once you delete your account, there is no way un-delete.', array(), null, 'boinc:delete-user-account').
475 475
     '</p>',
476 476
   );
477 477
 
478 478
   $form['main']['instructions2'] = array(
479 479
     '#value' => '<p>'.
480
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
480
+    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), null, 'boinc:delete-user-account').
481 481
     '</p>',
482 482
   );
483 483
 
484 484
   // Password field
485 485
   $form['main']['current_pass'] = array(
486 486
     '#type' => 'password',
487
-    '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'),
487
+    '#title' => bts('Enter your password before clicking Submit', array(), null, 'boinc:delete-user-account'),
488 488
     '#size' => 17,
489 489
     '#attributes' => array(
490 490
       'autocomplete' => 'off',
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
   $form['submit'] = array(
501 501
     '#prefix' => '<li class="first tab">',
502 502
     '#type' => 'submit',
503
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
503
+    '#value' => bts('Submit', array(), null, 'boinc:form-submit'),
504 504
     '#suffix' => '</li>',
505 505
     '#weight' => 1002,
506 506
   );
507 507
   $form['form control tabs'] = array(
508
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
508
+    '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/") . '</li>',
509 509
     '#weight' => 1003,
510 510
   );
511 511
   $form['form control tabs suffix'] = array(
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
   // Destroy the current session:
546 546
   session_destroy();
547 547
   // Only variables can be passed by reference workaround.
548
-  $null = NULL;
548
+  $null = null;
549 549
   user_module_invoke('logout', $null, $user);
550 550
 
551 551
   // Load the anonymous user
Please login to merge, or discard this patch.
modules/boincuser/boincuser_delete/includes/boincuser_delete.helpers.inc 4 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * Helper functions
10 10
  */
11 11
 function _boincuser_delete_goto_admindelete($form, &$form_state) {
12
-  drupal_goto('/admin/boinc/user_delete/' . $form['#uid']);
12
+    drupal_goto('/admin/boinc/user_delete/' . $form['#uid']);
13 13
 }
14 14
 
15 15
 function _boincuser_delete_cancel($form, &$form_state) {
16
-  drupal_goto('/user/' . $form['#uid'] . '/edit');
16
+    drupal_goto('/user/' . $form['#uid'] . '/edit');
17 17
 }
18 18
 
19 19
 /**
20 20
  * Validation user password function.
21 21
  */
22 22
 function _boincuser_delete_validatepasswd($boinc_user, $current_pass) {
23
-  if (!$current_pass) {
23
+    if (!$current_pass) {
24 24
     return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account'));
25
-  }
25
+    }
26 26
 
27
-  $given_hash = md5($current_pass . $boinc_user->email_addr);
27
+    $given_hash = md5($current_pass . $boinc_user->email_addr);
28 28
 
29
-  if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
29
+    if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
30 30
     return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account'));
31
-  }
31
+    }
32 32
 
33
-  return true;
33
+    return true;
34 34
 }
35 35
 
36 36
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -41,52 +41,52 @@  discard block
 block discarded – undo
41 41
  * Delete the user function.
42 42
  */
43 43
 function _boincuser_delete_deleteuser($account, $action=NULL) {
44
-  require_boinc('user_util');
45
-  require_boinc('delete_account');
44
+    require_boinc('user_util');
45
+    require_boinc('delete_account');
46 46
 
47
-  $boinc_user = BoincUser::lookup_id($account->boincuser_id);
47
+    $boinc_user = BoincUser::lookup_id($account->boincuser_id);
48 48
 
49
-  // watchdog message
50
-  watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname',
51
-  array(
49
+    // watchdog message
50
+    watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname',
51
+    array(
52 52
     '%uid' =>  $account->uid,
53 53
     '%boincuser_id' => $account->boincuser_id,
54 54
     '%displayname' => $account->boincuser_name,
55
-  ), WATCHDOG_NOTICE);
55
+    ), WATCHDOG_NOTICE);
56 56
 
57
-  // delete the account - This will delete the boinc user from the
58
-  // boinc project database, and then delete the Drupal user using the
59
-  // hook_user() functions.
57
+    // delete the account - This will delete the boinc user from the
58
+    // boinc project database, and then delete the Drupal user using the
59
+    // hook_user() functions.
60 60
 
61
-  switch ($action) {
61
+    switch ($action) {
62 62
     case 'soft_obfuscate':
63 63
       obfuscate_account($boinc_user);
64
-      _boincuser_delete_comment_reassign($account);
65
-      _boincuser_delete_node_reassign($account);
66
-      _boincuser_delete_privatemsg_delete($account);
67
-      _boincuser_delete_friends($account);
68
-      // delete the user's profile
69
-      $profile = content_profile_load('profile', $account->uid);
70
-      node_delete($profile->$nid);
71
-      // Drupal account -
72
-      //  * 'block'/disable the account
73
-      //  * set name, mail, pass, and init to deleted
74
-      //  * erase signature
75
-      $myarray = array(
64
+        _boincuser_delete_comment_reassign($account);
65
+        _boincuser_delete_node_reassign($account);
66
+        _boincuser_delete_privatemsg_delete($account);
67
+        _boincuser_delete_friends($account);
68
+        // delete the user's profile
69
+        $profile = content_profile_load('profile', $account->uid);
70
+        node_delete($profile->$nid);
71
+        // Drupal account -
72
+        //  * 'block'/disable the account
73
+        //  * set name, mail, pass, and init to deleted
74
+        //  * erase signature
75
+        $myarray = array(
76 76
         'status'    => 0,
77 77
         'name'      => 'deleted_' . time() . '_' . random_string(),
78 78
         'mail'      => 'deleted_' . time() . '_' . random_string(),
79 79
         'pass'      => 'deleted_' . time() . '_' . random_string(),
80 80
         'signature' => '',
81 81
         'init'      => 'deleted_' . time() . '_' . random_string(),
82
-      );
83
-      user_save($account, $myarray);
84
-      break;
82
+        );
83
+        user_save($account, $myarray);
84
+        break;
85 85
     case 'hard_wipe':
86 86
       wipe_account($boinc_user);
87
-      user_delete(array(), $account->uid);
88
-      break;
89
-  }
87
+        user_delete(array(), $account->uid);
88
+        break;
89
+    }
90 90
 }
91 91
 
92 92
 /**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
  * Copied from node.module, node_user()
96 96
  */
97 97
 function _boincuser_delete_node_reassign($account) {
98
-  db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid);
99
-  db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid);
98
+    db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid);
99
+    db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid);
100 100
 }
101 101
 
102 102
 /**
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
  * Copied from comment.module, comment_user()
106 106
  */
107 107
 function _boincuser_delete_comment_reassign($account) {
108
-  // bug in comment module, remove user name from comments.
109
-  db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid);
108
+    // bug in comment module, remove user name from comments.
109
+    db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid);
110 110
 
111
-  db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid);
112
-  db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid);
111
+    db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid);
112
+    db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid);
113 113
 }
114 114
 
115 115
 /**
@@ -118,23 +118,23 @@  discard block
 block discarded – undo
118 118
  * Copied from privatemsg module, case 'delete' in privatemsg_user().
119 119
  */
120 120
 function _boincuser_delete_privatemsg_delete($account) {
121
-  // Load all mids of the messages the user wrote.
122
-  $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid);
123
-  $mids = array();
124
-  while ($row = db_fetch_array($result)) {
121
+    // Load all mids of the messages the user wrote.
122
+    $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid);
123
+    $mids = array();
124
+    while ($row = db_fetch_array($result)) {
125 125
     $mids[] = $row['mid'];
126
-  }
126
+    }
127 127
 
128
-  // Delete messages the user wrote.
129
-  db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid);
128
+    // Delete messages the user wrote.
129
+    db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid);
130 130
 
131
-  if (!empty($mids)) {
131
+    if (!empty($mids)) {
132 132
     // Delete recipient entries in {pm_index} of the messages the user wrote.
133 133
     db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids);
134
-  }
134
+    }
135 135
 
136
-  // Delete recipient entries of that user.
137
-  db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid);
136
+    // Delete recipient entries of that user.
137
+    db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid);
138 138
 }
139 139
 
140 140
 /**
@@ -143,6 +143,6 @@  discard block
 block discarded – undo
143 143
  * Copied from flag_friend, flag_friend_user()
144 144
  */
145 145
 function _boincuser_delete_friends($account) {
146
-  // remove any friend relationships if an account is removed
146
+    // remove any friend relationships if an account is removed
147 147
     db_query("DELETE FROM {flag_friend} WHERE uid = %d OR friend_uid = %d", $account->uid, $account->uid);
148 148
 }
149 149
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * Helper functions
10 10
  */
11 11
 function _boincuser_delete_goto_admindelete($form, &$form_state) {
12
-  drupal_goto('/admin/boinc/user_delete/' . $form['#uid']);
12
+drupal_goto('/admin/boinc/user_delete/' . $form['#uid']);
13 13
 }
14 14
 
15 15
 function _boincuser_delete_cancel($form, &$form_state) {
16
-  drupal_goto('/user/' . $form['#uid'] . '/edit');
16
+drupal_goto('/user/' . $form['#uid'] . '/edit');
17 17
 }
18 18
 
19 19
 /**
20 20
  * Validation user password function.
21 21
  */
22 22
 function _boincuser_delete_validatepasswd($boinc_user, $current_pass) {
23
-  if (!$current_pass) {
24
-    return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account'));
25
-  }
23
+if (!$current_pass) {
24
+return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account'));
25
+}
26 26
 
27
-  $given_hash = md5($current_pass . $boinc_user->email_addr);
27
+$given_hash = md5($current_pass . $boinc_user->email_addr);
28 28
 
29
-  if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
30
-    return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account'));
31
-  }
29
+if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
30
+return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account'));
31
+}
32 32
 
33
-  return true;
33
+return true;
34 34
 }
35 35
 
36 36
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -41,52 +41,52 @@  discard block
 block discarded – undo
41 41
  * Delete the user function.
42 42
  */
43 43
 function _boincuser_delete_deleteuser($account, $action=NULL) {
44
-  require_boinc('user_util');
45
-  require_boinc('delete_account');
46
-
47
-  $boinc_user = BoincUser::lookup_id($account->boincuser_id);
48
-
49
-  // watchdog message
50
-  watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname',
51
-  array(
52
-    '%uid' =>  $account->uid,
53
-    '%boincuser_id' => $account->boincuser_id,
54
-    '%displayname' => $account->boincuser_name,
55
-  ), WATCHDOG_NOTICE);
56
-
57
-  // delete the account - This will delete the boinc user from the
58
-  // boinc project database, and then delete the Drupal user using the
59
-  // hook_user() functions.
60
-
61
-  switch ($action) {
62
-    case 'soft_obfuscate':
63
-      obfuscate_account($boinc_user);
64
-      _boincuser_delete_comment_reassign($account);
65
-      _boincuser_delete_node_reassign($account);
66
-      _boincuser_delete_privatemsg_delete($account);
67
-      _boincuser_delete_friends($account);
68
-      // delete the user's profile
69
-      $profile = content_profile_load('profile', $account->uid);
70
-      node_delete($profile->$nid);
71
-      // Drupal account -
72
-      //  * 'block'/disable the account
73
-      //  * set name, mail, pass, and init to deleted
74
-      //  * erase signature
75
-      $myarray = array(
76
-        'status'    => 0,
77
-        'name'      => 'deleted_' . time() . '_' . random_string(),
78
-        'mail'      => 'deleted_' . time() . '_' . random_string(),
79
-        'pass'      => 'deleted_' . time() . '_' . random_string(),
80
-        'signature' => '',
81
-        'init'      => 'deleted_' . time() . '_' . random_string(),
82
-      );
83
-      user_save($account, $myarray);
84
-      break;
85
-    case 'hard_wipe':
86
-      wipe_account($boinc_user);
87
-      user_delete(array(), $account->uid);
88
-      break;
89
-  }
44
+require_boinc('user_util');
45
+require_boinc('delete_account');
46
+
47
+$boinc_user = BoincUser::lookup_id($account->boincuser_id);
48
+
49
+// watchdog message
50
+watchdog('boincuser_delete', 'Deleting account drupal UID: %uid, BOINC id: %boincuser_id., BOINC displayname: %displayname',
51
+array(
52
+'%uid' =>  $account->uid,
53
+'%boincuser_id' => $account->boincuser_id,
54
+'%displayname' => $account->boincuser_name,
55
+), WATCHDOG_NOTICE);
56
+
57
+// delete the account - This will delete the boinc user from the
58
+// boinc project database, and then delete the Drupal user using the
59
+// hook_user() functions.
60
+
61
+switch ($action) {
62
+case 'soft_obfuscate':
63
+obfuscate_account($boinc_user);
64
+_boincuser_delete_comment_reassign($account);
65
+_boincuser_delete_node_reassign($account);
66
+_boincuser_delete_privatemsg_delete($account);
67
+_boincuser_delete_friends($account);
68
+// delete the user's profile
69
+$profile = content_profile_load('profile', $account->uid);
70
+node_delete($profile->$nid);
71
+// Drupal account -
72
+//  * 'block'/disable the account
73
+//  * set name, mail, pass, and init to deleted
74
+//  * erase signature
75
+$myarray = array(
76
+'status'    => 0,
77
+'name'      => 'deleted_' . time() . '_' . random_string(),
78
+'mail'      => 'deleted_' . time() . '_' . random_string(),
79
+'pass'      => 'deleted_' . time() . '_' . random_string(),
80
+'signature' => '',
81
+'init'      => 'deleted_' . time() . '_' . random_string(),
82
+);
83
+user_save($account, $myarray);
84
+break;
85
+case 'hard_wipe':
86
+wipe_account($boinc_user);
87
+user_delete(array(), $account->uid);
88
+break;
89
+}
90 90
 }
91 91
 
92 92
 /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * Helper functions
10 10
  */
11 11
 function _boincuser_delete_goto_admindelete($form, &$form_state) {
12
-  drupal_goto('/admin/boinc/user_delete/' . $form['#uid']);
12
+  drupal_goto('/admin/boinc/user_delete/'.$form['#uid']);
13 13
 }
14 14
 
15 15
 function _boincuser_delete_cancel($form, &$form_state) {
16
-  drupal_goto('/user/' . $form['#uid'] . '/edit');
16
+  drupal_goto('/user/'.$form['#uid'].'/edit');
17 17
 }
18 18
 
19 19
 /**
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account'));
25 25
   }
26 26
 
27
-  $given_hash = md5($current_pass . $boinc_user->email_addr);
27
+  $given_hash = md5($current_pass.$boinc_user->email_addr);
28 28
 
29
-  if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
29
+  if ((!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash)) {
30 30
     return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account'));
31 31
   }
32 32
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 /**
41 41
  * Delete the user function.
42 42
  */
43
-function _boincuser_delete_deleteuser($account, $action=NULL) {
43
+function _boincuser_delete_deleteuser($account, $action = NULL) {
44 44
   require_boinc('user_util');
45 45
   require_boinc('delete_account');
46 46
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
       //  * erase signature
75 75
       $myarray = array(
76 76
         'status'    => 0,
77
-        'name'      => 'deleted_' . time() . '_' . random_string(),
78
-        'mail'      => 'deleted_' . time() . '_' . random_string(),
79
-        'pass'      => 'deleted_' . time() . '_' . random_string(),
77
+        'name'      => 'deleted_'.time().'_'.random_string(),
78
+        'mail'      => 'deleted_'.time().'_'.random_string(),
79
+        'pass'      => 'deleted_'.time().'_'.random_string(),
80 80
         'signature' => '',
81
-        'init'      => 'deleted_' . time() . '_' . random_string(),
81
+        'init'      => 'deleted_'.time().'_'.random_string(),
82 82
       );
83 83
       user_save($account, $myarray);
84 84
       break;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
   if (!empty($mids)) {
132 132
     // Delete recipient entries in {pm_index} of the messages the user wrote.
133
-    db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids);
133
+    db_query('DELETE FROM {pm_index} WHERE mid IN ('.db_placeholders($mids).')', $mids);
134 134
   }
135 135
 
136 136
   // Delete recipient entries of that user.
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function _boincuser_delete_validatepasswd($boinc_user, $current_pass) {
23 23
   if (!$current_pass) {
24
-    return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), NULL, 'boinc:delete-user-account'));
24
+    return form_set_error('current_pass', bts('Authentication is required when requesting account deletion.', array(), null, 'boinc:delete-user-account'));
25 25
   }
26 26
 
27 27
   $given_hash = md5($current_pass . $boinc_user->email_addr);
28 28
 
29 29
   if ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) {
30
-    return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:delete-user-account'));
30
+    return form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), null, 'boinc:delete-user-account'));
31 31
   }
32 32
 
33 33
   return true;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 /**
41 41
  * Delete the user function.
42 42
  */
43
-function _boincuser_delete_deleteuser($account, $action=NULL) {
43
+function _boincuser_delete_deleteuser($account, $action=null) {
44 44
   require_boinc('user_util');
45 45
   require_boinc('delete_account');
46 46
 
Please login to merge, or discard this patch.
default/boinc/modules/boincuser/boincuser_delete/boincuser_delete.admin.inc 3 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@  discard block
 block discarded – undo
13 13
  *   a form array
14 14
  */
15 15
 function boincuser_delete_settings() {
16
-  $form = array();
16
+    $form = array();
17 17
 
18
-  $default = array(
18
+    $default = array(
19 19
     'boincuser_delete_type' => variable_get('boincuser_delete_type', ''),
20 20
     'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'),
21
-  );
21
+    );
22 22
 
23
-  $form['options'] = array(
23
+    $form['options'] = array(
24 24
     '#type' => 'fieldset',
25 25
     '#title' => t('Options'),
26
-  );
27
-  $form['options']['help'] = array(
26
+    );
27
+    $form['options']['help'] = array(
28 28
     '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'),
29 29
     '#weight' => 11,
30
-  );
31
-  $form['options']['boincuser_delete_type'] = array(
30
+    );
31
+    $form['options']['boincuser_delete_type'] = array(
32 32
     '#type' => 'radios',
33 33
     '#title' => t('Type of delete'),
34 34
     '#default_value' => $default['boincuser_delete_type'],
35 35
     '#options' => array(
36
-       'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'),
37
-       'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'),
38
-       'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'),
36
+        'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'),
37
+        'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'),
38
+        'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'),
39 39
     ),
40 40
     '#weight' => 21,
41
-  );
41
+    );
42 42
 
43
-  $form['redirect'] = array(
43
+    $form['redirect'] = array(
44 44
     '#type' => 'fieldset',
45 45
     '#title' => t('Redirect'),
46
-  );
47
-  $form['redirect']['boincuser_delete_redirect'] = array(
46
+    );
47
+    $form['redirect']['boincuser_delete_redirect'] = array(
48 48
     '#type' => 'textfield',
49 49
     '#title' => t('Redirection page'),
50 50
     '#default_value' => $default['boincuser_delete_redirect'],
51 51
     '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')),
52
-  );
52
+    );
53 53
 
54
-  return system_settings_form($form);
54
+    return system_settings_form($form);
55 55
 }
56 56
 
57 57
 
@@ -60,119 +60,119 @@  discard block
 block discarded – undo
60 60
  * password checks.
61 61
  */
62 62
 function boincuser_delete_admindelete(&$form_state, $uid) {
63
-  $form = array();
63
+    $form = array();
64 64
 
65
-  $form['#uid'] = $uid;
65
+    $form['#uid'] = $uid;
66 66
 
67
-  $form['account']['help'] = array(
67
+    $form['account']['help'] = array(
68 68
     '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>",
69 69
     '#weight' => -1,
70 70
     '#prefix' => "<div id='delete-instructions'>",
71 71
     '#suffix' => "</div>",
72
-  );
72
+    );
73 73
 
74
-  $account = user_load($uid);
75
-  if ($account) {
74
+    $account = user_load($uid);
75
+    if ($account) {
76 76
     drupal_set_title($account->boincuser_name);
77 77
 
78 78
     $form['account']['boincuser_name'] = array(
79
-      '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))),
79
+        '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))),
80 80
     );
81 81
     $form['account']['boincuser_id'] = array(
82
-      '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id,
82
+        '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id,
83 83
     );
84 84
     $form['account']['drupal_name'] = array(
85
-      '#value' => t('<li>Drupal username (internal): ') . $account->name,
85
+        '#value' => t('<li>Drupal username (internal): ') . $account->name,
86 86
     );
87 87
     $form['account']['user_id'] = array(
88
-      '#value' => t('<li>Drupal user ID: ') . $account->uid,
88
+        '#value' => t('<li>Drupal user ID: ') . $account->uid,
89 89
     );
90 90
 
91 91
     $form['account']['user_delete_action'] = array(
92 92
         '#type' => 'radios',
93 93
         '#options' => array(
94
-          'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'),
95
-          'boincuser_delete_delete' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),),
96
-      );
94
+            'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'),
95
+            'boincuser_delete_delete' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),),
96
+        );
97 97
 
98 98
     $form['account']['surecheckbox'] = array(
99
-      '#type' => 'checkbox',
100
-      '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.',
99
+        '#type' => 'checkbox',
100
+        '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.',
101 101
         array('%name' => $account->boincuser_name)
102
-      ),
103
-      '#default_value' => FALSE,
102
+        ),
103
+        '#default_value' => FALSE,
104 104
     );
105 105
 
106 106
     $form['account']['current_pass'] = array(
107
-      '#type' => 'password',
108
-      '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'),
109
-      '#size' => 17,
110
-      '#attributes' => array(
107
+        '#type' => 'password',
108
+        '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'),
109
+        '#size' => 17,
110
+        '#attributes' => array(
111 111
         'autocomplete' => 'off',
112
-      ),
113
-      '#weight' => 25,
112
+        ),
113
+        '#weight' => 25,
114 114
     );
115 115
 
116 116
     // Action buttons
117 117
     $form['actions']['submit'] = array(
118
-      '#type' => 'submit',
119
-      '#value' => t('Submit'),
118
+        '#type' => 'submit',
119
+        '#value' => t('Submit'),
120 120
     );
121 121
     $form['actions']['cancel'] = array(
122
-      '#type' => 'button',
123
-      '#value' => t('Cancel'),
124
-      '#executes_submit_callback' => TRUE,
125
-      '#validate' => array(),
126
-      '#submit' => array('_boincuser_delete_cancel'),
122
+        '#type' => 'button',
123
+        '#value' => t('Cancel'),
124
+        '#executes_submit_callback' => TRUE,
125
+        '#validate' => array(),
126
+        '#submit' => array('_boincuser_delete_cancel'),
127 127
     );
128 128
 
129 129
     $form['#redirect'] = 'account';
130
-  }
131
-  else {
130
+    }
131
+    else {
132 132
     $form['noaccount'] = array(
133
-      '#value' => t('No such user with UID: %uid', array('%uid' => $uid)),
133
+        '#value' => t('No such user with UID: %uid', array('%uid' => $uid)),
134 134
     );
135
-  }
135
+    }
136 136
 
137
-  return $form;
137
+    return $form;
138 138
 }
139 139
 
140 140
 /**
141 141
  * Validation function for admin delete user.
142 142
  */
143 143
 function boincuser_delete_admindelete_validate($form, &$form_state) {
144
-  global $user;
145
-  $boinc_user = boincuser_load($user->uid, TRUE);
144
+    global $user;
145
+    $boinc_user = boincuser_load($user->uid, TRUE);
146 146
 
147
-  if ($form_state['values']['user_delete_action'] == '') {
147
+    if ($form_state['values']['user_delete_action'] == '') {
148 148
     form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account'));
149
-  }
149
+    }
150 150
 
151
-  if (!($form_state['values']['surecheckbox'])) {
151
+    if (!($form_state['values']['surecheckbox'])) {
152 152
     return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.'));
153
-  }
153
+    }
154 154
 
155
-  if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
155
+    if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
156 156
     return true;
157
-  }
157
+    }
158 158
 }
159 159
 
160 160
 /**
161 161
  * Submit function for admin delete user.
162 162
  */
163 163
 function boincuser_delete_admindelete_submit($form, &$form_state) {
164
-  // This is the account to be deleted, and not the administrator's
165
-  // account.
166
-  $account = user_load(array('uid' => $form['#uid']));
164
+    // This is the account to be deleted, and not the administrator's
165
+    // account.
166
+    $account = user_load(array('uid' => $form['#uid']));
167 167
 
168
-  drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.',
168
+    drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.',
169 169
     array(
170
-      '@uid' => $form['#uid'],
171
-      '@displayname' => $account->boincuser_name,
170
+        '@uid' => $form['#uid'],
171
+        '@displayname' => $account->boincuser_name,
172 172
     )), 'warning');
173 173
 
174
-  // Delete the user
175
-  _boincuser_delete_deleteuser($account, $action);
174
+    // Delete the user
175
+    _boincuser_delete_deleteuser($account, $action);
176 176
 
177
-  drupal_goto('/admin/boinc/user_delete');
177
+    drupal_goto('/admin/boinc/user_delete');
178 178
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
   $form['#uid'] = $uid;
66 66
 
67 67
   $form['account']['help'] = array(
68
-    '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>",
68
+    '#value' => "<p>".t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!")."</p><p>".t("You are deleting the following user, link opens in new window:")."</p>",
69 69
     '#weight' => -1,
70 70
     '#prefix' => "<div id='delete-instructions'>",
71 71
     '#suffix' => "</div>",
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
     drupal_set_title($account->boincuser_name);
77 77
 
78 78
     $form['account']['boincuser_name'] = array(
79
-      '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))),
79
+      '#value' => t('<li>BOINC username (public displayname): ').l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))),
80 80
     );
81 81
     $form['account']['boincuser_id'] = array(
82
-      '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id,
82
+      '#value' => t('<li>BOINC user ID: ').$account->boincuser_id,
83 83
     );
84 84
     $form['account']['drupal_name'] = array(
85
-      '#value' => t('<li>Drupal username (internal): ') . $account->name,
85
+      '#value' => t('<li>Drupal username (internal): ').$account->name,
86 86
     );
87 87
     $form['account']['user_id'] = array(
88
-      '#value' => t('<li>Drupal user ID: ') . $account->uid,
88
+      '#value' => t('<li>Drupal user ID: ').$account->uid,
89 89
     );
90 90
 
91 91
     $form['account']['user_delete_action'] = array(
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
     $form['account']['user_delete_action'] = array(
92 92
         '#type' => 'radios',
93 93
         '#options' => array(
94
-          'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'),
95
-          'boincuser_delete_delete' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),),
94
+          'boincuser_delete_softdelete' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), null, 'boinc:delete-user-account'),
95
+          'boincuser_delete_delete' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), null, 'boinc:delete-user-account'),),
96 96
       );
97 97
 
98 98
     $form['account']['surecheckbox'] = array(
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
       '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.',
101 101
         array('%name' => $account->boincuser_name)
102 102
       ),
103
-      '#default_value' => FALSE,
103
+      '#default_value' => false,
104 104
     );
105 105
 
106 106
     $form['account']['current_pass'] = array(
107 107
       '#type' => 'password',
108
-      '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'),
108
+      '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), null, 'boinc:delete-user-account'),
109 109
       '#size' => 17,
110 110
       '#attributes' => array(
111 111
         'autocomplete' => 'off',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     $form['actions']['cancel'] = array(
122 122
       '#type' => 'button',
123 123
       '#value' => t('Cancel'),
124
-      '#executes_submit_callback' => TRUE,
124
+      '#executes_submit_callback' => true,
125 125
       '#validate' => array(),
126 126
       '#submit' => array('_boincuser_delete_cancel'),
127 127
     );
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
  */
143 143
 function boincuser_delete_admindelete_validate($form, &$form_state) {
144 144
   global $user;
145
-  $boinc_user = boincuser_load($user->uid, TRUE);
145
+  $boinc_user = boincuser_load($user->uid, true);
146 146
 
147 147
   if ($form_state['values']['user_delete_action'] == '') {
148
-    form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account'));
148
+    form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), null, 'boinc:delete-user-account'));
149 149
   }
150 150
 
151 151
   if (!($form_state['values']['surecheckbox'])) {
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/boincuser.module 2 patches
Indentation   +825 added lines, -825 removed lines patch added patch discarded remove patch
@@ -27,44 +27,44 @@  discard block
 block discarded – undo
27 27
  * with defined URL paths
28 28
  */
29 29
 function boincuser_menu() {
30
-  $items['account/posts'] = array(
30
+    $items['account/posts'] = array(
31 31
     'title' => 'Recent posts',
32 32
     'description' => '',
33 33
     'page callback' => 'boincuser_goto_recent_posts',
34 34
     'access callback' => 'user_is_logged_in',
35 35
     'type' => MENU_CALLBACK,
36
-  );
37
-  $items['account/profile'] = array(
36
+    );
37
+    $items['account/profile'] = array(
38 38
     'title' => '',
39 39
     'description' => '',
40 40
     'page callback' => 'boincuser_view_profile',
41 41
     'access callback' => 'user_is_logged_in',
42 42
     'type' => MENU_NORMAL_ITEM
43
-  );
44
-  $items['account/profile/view'] = array(
43
+    );
44
+    $items['account/profile/view'] = array(
45 45
     'title' => 'View',
46 46
     'description' => 'Show a user profile',
47 47
     'page callback' => 'boincuser_view_profile',
48 48
     'access callback' => 'user_is_logged_in',
49 49
     'type' => MENU_DEFAULT_LOCAL_TASK,
50 50
     'weight' => 0
51
-  );
52
-  $items['account/profile/edit'] = array(
51
+    );
52
+    $items['account/profile/edit'] = array(
53 53
     'title' => 'Edit',
54 54
     'description' => 'Edit a user profile',
55 55
     'page callback' => 'boincuser_edit_profile',
56 56
     'access callback' => 'user_is_logged_in',
57 57
     'type' => MENU_LOCAL_TASK,
58 58
     'weight' => 5
59
-  );
60
-  $items['account/team'] = array(
59
+    );
60
+    $items['account/team'] = array(
61 61
     'title' => 'User team',
62 62
     'description' => '',
63 63
     'page callback' => 'boincuser_goto_team',
64 64
     'access callback' => 'user_is_logged_in',
65 65
     'type' => MENU_CALLBACK,
66
-  );
67
-  $items['moderate/profile/%user/approve'] = array(
66
+    );
67
+    $items['moderate/profile/%user/approve'] = array(
68 68
     'title' => 'Profile approval',
69 69
     'description' => 'Approve profile content',
70 70
     'page callback' => 'boincuser_moderate_profile_approve',
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
     'access arguments' => array('edit any profile content'),
73 73
     'type' => MENU_CALLBACK,
74 74
     'weight' => 5
75
-  );
76
-  $items['moderate/profile/%user/edit'] = array(
75
+    );
76
+    $items['moderate/profile/%user/edit'] = array(
77 77
     'title' => 'Profile editor',
78 78
     'description' => 'Edit a user profile',
79 79
     'page callback' => 'boincuser_edit_profile',
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     'access arguments' => array('edit any profile content'),
82 82
     'type' => MENU_CALLBACK,
83 83
     'weight' => 5
84
-  );
85
-  $items['moderate/profile/%/reject'] = array(
84
+    );
85
+    $items['moderate/profile/%/reject'] = array(
86 86
     'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'),
87 87
     'description' => 'Reject profile content',
88 88
     'page callback' => 'drupal_get_form',
@@ -90,60 +90,60 @@  discard block
 block discarded – undo
90 90
     'access arguments' => array('edit any profile content'),
91 91
     'type' => MENU_CALLBACK,
92 92
     'weight' => 5
93
-  );
94
-  $items['moderate/user/%/ban'] = array(
93
+    );
94
+    $items['moderate/user/%/ban'] = array(
95 95
     'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'),
96 96
     'description' => 'Ban a user from using community features',
97 97
     'page callback' => 'drupal_get_form',
98 98
     'page arguments' => array('boincuser_moderate_user_ban_form', 2),
99 99
     'access callback' => 'boincuser_moderate_community_access',
100 100
     'type' => MENU_CALLBACK,
101
-  );
102
-  $items['join'] = array(
101
+    );
102
+    $items['join'] = array(
103 103
     'title' => '',
104 104
     'description' => '',
105 105
     'page callback' => 'join_page',
106 106
     'access arguments' => array('access content'),
107 107
     'type' => MENU_NORMAL_ITEM
108
-  );
109
-  $items['join/new'] = array(
108
+    );
109
+    $items['join/new'] = array(
110 110
     'title' => bts("I'm new"),
111 111
     'page callback' => 'join_page',
112 112
     'page arguments' => array(1),
113 113
     'access arguments' => array('access content'),
114 114
     'type' => MENU_DEFAULT_LOCAL_TASK,
115 115
     'weight' => 0
116
-  );
117
-  $items['join/boinc'] = array(
116
+    );
117
+    $items['join/boinc'] = array(
118 118
     'title' => bts("I'm a BOINC user"),
119 119
     'page callback' => 'join_page',
120 120
     'page arguments' => array(1),
121 121
     'access arguments' => array('access content'),
122 122
     'type' => MENU_LOCAL_TASK,
123 123
     'weight' => 5
124
-  );
125
-  $items['user/login/auth'] = array(
124
+    );
125
+    $items['user/login/auth'] = array(
126 126
     'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'),
127 127
     'description' => 'Log in using a user authenticator',
128 128
     'page callback' => 'drupal_get_form',
129 129
     'page arguments' => array('boincuser_authloginform'),
130 130
     'access arguments' => array('access content'),
131 131
     'type' => MENU_CALLBACK,
132
-  );
133
-  $items['user/termsofuse'] = array(
132
+    );
133
+    $items['user/termsofuse'] = array(
134 134
     'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'),
135 135
     'description' => 'A site\'s term of use.',
136 136
     'page callback' => 'drupal_get_form',
137 137
     'page arguments' => array('boincuser_termsofuse_form'),
138 138
     'access callback' => 'user_is_logged_in',
139 139
     'type' => MENU_CALLBACK,
140
-  );
141
-  $items['user_control'] = array(
140
+    );
141
+    $items['user_control'] = array(
142 142
     'page callback' => 'boincuser_control',
143 143
     'access arguments' => array('access user profiles'),
144 144
     'type' => MENU_CALLBACK
145
-  );
146
-  $items['admin/boinc'] = array(
145
+    );
146
+    $items['admin/boinc'] = array(
147 147
     'title' => 'BOINC configuration',
148 148
     'position' => 'right',
149 149
     'weight' => -8,
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
     'access arguments' => array('administer site configuration'),
152 152
     'file' => 'system.admin.inc',
153 153
     'file path' => drupal_get_path('module', 'system'),
154
-  );
155
-  $items['admin/boinc/environment'] = array(
154
+    );
155
+    $items['admin/boinc/environment'] = array(
156 156
     'title' => 'Environment: General',
157 157
     'description' => 'Set paths to BOINC functions and any other necessary
158 158
       variables that establish a BOINC environment.',
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
     'access arguments' => array('administer site configuration'),
162 162
     'type' => MENU_NORMAL_ITEM,
163 163
     'file' => 'boincuser.admin.inc'
164
-  );
165
-  $items['admin/boinc/scheduler'] = array(
164
+    );
165
+    $items['admin/boinc/scheduler'] = array(
166 166
     'title' => 'Environment: Scheduling server URLs',
167 167
     'description' => 'Set BOINC scheduler options.',
168 168
     'page callback' => 'drupal_get_form',
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
     'access arguments' => array('administer site configuration'),
171 171
     'type' => MENU_NORMAL_ITEM,
172 172
     'file' => 'boincuser.admin.inc'
173
-  );
174
-  $items['admin/boinc/weboptions'] = array(
173
+    );
174
+    $items['admin/boinc/weboptions'] = array(
175 175
     'title' => 'Environment: Website Options',
176 176
     'description' => 'Set options configuring this Drupal-BOINC Web site.',
177 177
     'page callback' => 'drupal_get_form',
@@ -179,109 +179,109 @@  discard block
 block discarded – undo
179 179
     'access arguments' => array('administer site configuration'),
180 180
     'type' => MENU_NORMAL_ITEM,
181 181
     'file' => 'boincuser.admin.inc'
182
-  );
182
+    );
183 183
   
184
-  $items['create_account.php'] = array(
184
+    $items['create_account.php'] = array(
185 185
     'title' => 'Create Account RPC',
186 186
     'description' => 'RPC for creating user accounts.',
187 187
     'page callback' => 'boincuser_create_account',
188 188
     'access callback' => TRUE,
189 189
     'type' => MENU_CALLBACK
190
-  );
191
-  $items['account_finish.php'] = array(
190
+    );
191
+    $items['account_finish.php'] = array(
192 192
     'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'),
193 193
     'description' => 'RPC for after a user has created an account.',
194 194
     'page callback' => 'boincuser_account_finish',
195 195
     'access callback' => TRUE,
196 196
     'type' => MENU_CALLBACK,
197
-  );
198
-  $items['boincuser/autocomplete'] = array(
197
+    );
198
+    $items['boincuser/autocomplete'] = array(
199 199
     'page callback' => '_boincuser_user_name_autocomplete',
200 200
     'access callback' => TRUE,
201 201
     'type' => MENU_CALLBACK,
202
-  );
203
-  $items['user/%user/recoveremail/%'] = array(
202
+    );
203
+    $items['user/%user/recoveremail/%'] = array(
204 204
     'title' => t('Recover previous email'),
205 205
     'description' => t('Form to revert email to previous address.'),
206 206
     'page callback' => 'drupal_get_form',
207 207
     'page arguments' => array('boincuser_revertemail', 3),
208 208
     'access callback' => 'user_is_logged_in',
209 209
     'type' => MENU_CALLBACK,
210
-  );
211
-  $items['recover_email.php'] = array(
210
+    );
211
+    $items['recover_email.php'] = array(
212 212
     'title' => t('Recover previous email'),
213 213
     'description' => t('redirect'),
214 214
     'page callback' => '_boincuser_redirect_recover_email',
215 215
     'access callback' => TRUE,
216 216
     'type' => MENU_CALLBACK,
217
-  );
218
-  return $items;
217
+    );
218
+    return $items;
219 219
 }
220 220
 
221 221
 /**
222 222
  * Implementation of hook_init()
223 223
  */
224 224
 function boincuser_init() {
225
-  global $user;
226
-  // Skip this check for charts, which are loaded separately
227
-  // (may get duplicate or unexpected messages otherwise)
228
-  if (substr($_GET['q'], 0, 7) == 'charts/') {
225
+    global $user;
226
+    // Skip this check for charts, which are loaded separately
227
+    // (may get duplicate or unexpected messages otherwise)
228
+    if (substr($_GET['q'], 0, 7) == 'charts/') {
229 229
     return;
230
-  }
230
+    }
231 231
 
232
-  // If admin user, do some basic site functionality checks
233
-  if (user_access('administer site configuration')) {
232
+    // If admin user, do some basic site functionality checks
233
+    if (user_access('administer site configuration')) {
234 234
     // Ensure we have a configured BOINC environment
235 235
     boinc_get_path();
236 236
     boinc_get_scheduler_tags();
237
-  }
237
+    }
238 238
   
239
-  // Check credits for the verified contributor role
240
-  boincuser_check_credit_requirements();
239
+    // Check credits for the verified contributor role
240
+    boincuser_check_credit_requirements();
241 241
   
242
-  if (module_exists('boincteam')) {
242
+    if (module_exists('boincteam')) {
243 243
     // Display any persistent team messages
244 244
     boincteam_show_messages();
245
-  }
245
+    }
246 246
 
247
-  // Check if user has agreed to the terms of use. If not, send the
248
-  // user to the terms-of-use form. This is only makes sense if the
249
-  // termsofuse is enabled, by having text in the termsofuse variable.
250
-  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
251
-  $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
252
-  if ( (!empty($termsofuse)) and ($user->uid) ) {
247
+    // Check if user has agreed to the terms of use. If not, send the
248
+    // user to the terms-of-use form. This is only makes sense if the
249
+    // termsofuse is enabled, by having text in the termsofuse variable.
250
+    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
251
+    $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
252
+    if ( (!empty($termsofuse)) and ($user->uid) ) {
253 253
     if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) {
254 254
 
255
-      // Admins are exempt, otherwise the admin may not be able to
256
-      // access the site!
257
-      $administrator_role = array_search('administrator', user_roles(true));
258
-      if (!isset($user->roles[$administrator_role])) {
255
+        // Admins are exempt, otherwise the admin may not be able to
256
+        // access the site!
257
+        $administrator_role = array_search('administrator', user_roles(true));
258
+        if (!isset($user->roles[$administrator_role])) {
259 259
         $path = drupal_get_path_alias($_GET['q']);
260 260
 
261 261
         // Any paths that should NOT be redirected go here.
262 262
         // @todo - replace this static array with one that allows
263 263
         // admins to specify custom paths (patterns) to ignore.
264 264
         $paths_to_ignore = array(
265
-          'user/termsofuse',
266
-          'logout',
267
-          'privacy',
268
-          'moderation',
269
-          'account/info/edit',
270
-          'user/' . $user->uid . '/edit',
271
-          'user/' . $user->uid . '/recoveremail/*',
272
-          'recover_email.php',
265
+            'user/termsofuse',
266
+            'logout',
267
+            'privacy',
268
+            'moderation',
269
+            'account/info/edit',
270
+            'user/' . $user->uid . '/edit',
271
+            'user/' . $user->uid . '/recoveremail/*',
272
+            'recover_email.php',
273 273
         );
274 274
         if (module_exists('boincuser_delete')) {
275
-          $paths_to_ignore[] = 'user/' . $user->uid . '/delete';
276
-          $paths_to_ignore[] = 'user/' . $user->uid . '/deleteconfirm/*';
277
-          $paths_to_ignore[] = 'user/' . $user->uid . '/odeleteconfirm/*';
275
+            $paths_to_ignore[] = 'user/' . $user->uid . '/delete';
276
+            $paths_to_ignore[] = 'user/' . $user->uid . '/deleteconfirm/*';
277
+            $paths_to_ignore[] = 'user/' . $user->uid . '/odeleteconfirm/*';
278 278
         }
279 279
         if (!_boincuser_ignore_paths($path, $paths_to_ignore)) {
280
-          drupal_goto('user/termsofuse');
280
+            drupal_goto('user/termsofuse');
281
+        }
281 282
         }
282
-      }
283 283
     }
284
-  }
284
+    }
285 285
 }
286 286
 
287 287
 /**
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
  * Drupal user operations
290 290
  */
291 291
 function boincuser_user($op, &$edit, &$account, $category = NULL) {
292
-  require_boinc('boinc_db');
293
-  require_boinc('user');
294
-  require_boinc('xml');
292
+    require_boinc('boinc_db');
293
+    require_boinc('user');
294
+    require_boinc('xml');
295 295
 
296
-  require_boinc('password_compat/password');
297
-  // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
298
-  if ($account->uid > 1) {
296
+    require_boinc('password_compat/password');
297
+    // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
298
+    if ($account->uid > 1) {
299 299
     switch($op) {
300 300
     case 'load':
301 301
       // User loading; insert BOINC data into the user object
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
         SELECT boinc_id, penalty_expiration
304 304
         FROM {boincuser} WHERE uid = %d",
305 305
         $account->uid
306
-      ));
307
-      $account->boincuser_id = $drupal_user->boinc_id;
308
-      $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
309
-      db_set_active('boinc_rw');
310
-      $boinc_user = db_fetch_object(db_query("
306
+        ));
307
+        $account->boincuser_id = $drupal_user->boinc_id;
308
+        $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
309
+        db_set_active('boinc_rw');
310
+        $boinc_user = db_fetch_object(db_query("
311 311
         SELECT
312 312
           name,
313 313
           authenticator,
@@ -323,29 +323,29 @@  discard block
 block discarded – undo
323 323
         FROM {user}
324 324
         WHERE id = %d",
325 325
         $account->boincuser_id
326
-      ));
327
-      $account->boincuser_name = $boinc_user->name;
328
-      $account->boincuser_account_key = $boinc_user->authenticator;
329
-      $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
330
-      $account->boincuser_total_credit = round($boinc_user->total_credit);
331
-      $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
332
-      $account->boincuser_expavg_time = round($boinc_user->expavg_time);
333
-      $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
334
-      $account->boincuser_default_pref_set = $boinc_user->venue;
335
-      $account->boincteam_id = $boinc_user->teamid;
336
-      $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr;
337
-      $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time;
338
-      db_set_active('default');
339
-      // Set Drupal team ID
340
-      $account->team = NULL;
341
-      if ($account->boincteam_id) {
326
+        ));
327
+        $account->boincuser_name = $boinc_user->name;
328
+        $account->boincuser_account_key = $boinc_user->authenticator;
329
+        $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
330
+        $account->boincuser_total_credit = round($boinc_user->total_credit);
331
+        $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
332
+        $account->boincuser_expavg_time = round($boinc_user->expavg_time);
333
+        $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
334
+        $account->boincuser_default_pref_set = $boinc_user->venue;
335
+        $account->boincteam_id = $boinc_user->teamid;
336
+        $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr;
337
+        $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time;
338
+        db_set_active('default');
339
+        // Set Drupal team ID
340
+        $account->team = NULL;
341
+        if ($account->boincteam_id) {
342 342
         $account->team = db_result(db_query("
343 343
           SELECT nid FROM {boincteam} WHERE team_id = %d",
344
-          $account->boincteam_id
344
+            $account->boincteam_id
345 345
         ));
346
-      }
347
-      // Set post count
348
-      $account->post_count = db_result(db_query("
346
+        }
347
+        // Set post count
348
+        $account->post_count = db_result(db_query("
349 349
         SELECT COUNT(*) +
350 350
         (
351 351
           SELECT COUNT(*) FROM {node}
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
         WHERE comments.uid = '%d'
359 359
         AND node.status = 1",
360 360
         $account->uid, $account->uid
361
-      ));
362
-      break;
361
+        ));
362
+        break;
363 363
       
364 364
     case 'view':
365 365
       // SAMPLE: Add BOINC data to the user profile
@@ -385,60 +385,60 @@  discard block
 block discarded – undo
385 385
         case 'user_account':
386 386
           // Validate data before updating user account info
387 387
           boincuser_account_validate($edit, $account);
388
-          break;
388
+            break;
389 389
         
390 390
         default:
391 391
           
392 392
         }
393 393
         // We don't want to save validation source, so remove it
394 394
         $edit['validation_source'] = null;
395
-      }
396
-      break;
395
+        }
396
+        break;
397 397
       
398 398
     case 'insert':
399 399
       // New user being added to the system
400 400
       $imported = $_SESSION['importedUser'];
401
-      unset($_SESSION['importedUser']);
401
+        unset($_SESSION['importedUser']);
402 402
       
403
-      watchdog(
403
+        watchdog(
404 404
         'boincuser',
405 405
         'Creating user account for %email_addr',
406 406
         array('%email_addr' => $edit['mail']),
407 407
         WATCHDOG_NOTICE
408
-      );
408
+        );
409 409
       
410
-      // The create_acount RPC will call this block of code when
411
-      // user_save() is used. If user is registering using the Web
412
-      // registration form, create a BOINC user and relationships.
413
-      // Create a BOINC account unless importing from BOINC.
414
-      if (!$imported) {
410
+        // The create_acount RPC will call this block of code when
411
+        // user_save() is used. If user is registering using the Web
412
+        // registration form, create a BOINC user and relationships.
413
+        // Create a BOINC account unless importing from BOINC.
414
+        if (!$imported) {
415 415
 
416 416
         if ($edit['boincuser_name']) {
417
-          $myname = $edit['boincuser_name'];
417
+            $myname = $edit['boincuser_name'];
418 418
         }
419 419
         else if ($edit['name']) {
420
-          $myname = $edit['name'];
420
+            $myname = $edit['name'];
421 421
         }
422 422
         else {
423
-          $myname = 'noname';
423
+            $myname = 'noname';
424 424
         }
425 425
 
426 426
         $user_params = array(
427
-          'email_addr' => $edit['mail'],
428
-          'name' => $myname,
429
-          'passwd_hash' => password_hash( md5($edit['pass'].$edit['mail']) , PASSWORD_DEFAULT ),
427
+            'email_addr' => $edit['mail'],
428
+            'name' => $myname,
429
+            'passwd_hash' => password_hash( md5($edit['pass'].$edit['mail']) , PASSWORD_DEFAULT ),
430 430
         );
431 431
         $boinc_user = boincuser_register_make_user($user_params);
432 432
         if (!$boinc_user) {
433
-          // Account exists with this email addr
434
-          form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user'));
435
-          return;
433
+            // Account exists with this email addr
434
+            form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user'));
435
+            return;
436 436
         }
437 437
 
438 438
         // Add user to community role by default (not banned)
439 439
         $unrestricted_role = array_search('community member', user_roles(true)); 
440 440
         $edit['roles'] = array(
441
-          $unrestricted_role => ''
441
+            $unrestricted_role => ''
442 442
         );
443 443
 
444 444
         // Disable show_hosts flag, set to TRUE by default
@@ -449,20 +449,20 @@  discard block
 block discarded – undo
449 449
         // Cross reference Drupal account with BOINC
450 450
         $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id);
451 451
         if (!$reference) {
452
-          drupal_set_message(t('Error connecting BOINC account.'), 'error');
453
-          return;
452
+            drupal_set_message(t('Error connecting BOINC account.'), 'error');
453
+            return;
454 454
         }
455 455
 
456 456
         // if terms of use exist, the user must agree.
457 457
         $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
458 458
         if (!empty($termsofuse)) {
459
-          $reference2 = boincuser_consentto_termsofuse($account);
459
+            $reference2 = boincuser_consentto_termsofuse($account);
460 460
         }
461 461
 
462 462
         // Don't save custom fields to the Drupal user object
463 463
         $edit['boincuser_name'] = null;
464
-      }
465
-      break;
464
+        }
465
+        break;
466 466
       
467 467
     case 'update':
468 468
       if (isset($edit['update_source'])) {
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
           // Ensure that BOINC data is altered
474 474
 
475 475
           $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
476
-          $changing_pass = ($edit['pass']) ? true : false;
477
-          if ($changing_email OR $changing_pass) {
476
+            $changing_pass = ($edit['pass']) ? true : false;
477
+            if ($changing_email OR $changing_pass) {
478 478
             // Set password hash appropriately
479 479
             $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
480 480
             $passwd_hash = password_hash( md5($passwd.$edit['mail']), PASSWORD_DEFAULT );
@@ -482,65 +482,65 @@  discard block
 block discarded – undo
482 482
 
483 483
             // Algorithm for changing email and/or password
484 484
             if ($changing_email) {
485
-              // locally store current email to set as previous email
486
-              $prev_email = $account->mail;
487
-              $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time();
488
-              $querypart = "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime";
485
+                // locally store current email to set as previous email
486
+                $prev_email = $account->mail;
487
+                $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time();
488
+                $querypart = "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime";
489 489
             }
490 490
             else {
491
-              $querypart = "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}'";
491
+                $querypart = "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}'";
492 492
             }
493 493
 
494 494
             // Update user account information
495 495
             $result = $boinc_user->update($querypart);
496 496
 
497 497
             if ($changing_email) {
498
-              // reload account
499
-              $account = user_load($account->uid);
500
-              _boincuser_send_emailchange($account, $email_addr, $prev_email, user_access('administer users'));
498
+                // reload account
499
+                $account = user_load($account->uid);
500
+                _boincuser_send_emailchange($account, $email_addr, $prev_email, user_access('administer users'));
501
+            }
501 502
             }
502
-          }
503 503
 
504
-          // Change boinc username
505
-          if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) {
504
+            // Change boinc username
505
+            if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) {
506 506
             $boincuser_name = $edit['boincuser_name'];
507 507
             $result = $boinc_user->update(
508 508
                 "name='{$boincuser_name}'"
509 509
             );
510
-          }
510
+            }
511 511
 
512
-          break;
512
+            break;
513 513
         case 'user_profile':
514 514
           if ($edit['boincuser_name'] != $boinc_user->name) {
515 515
             $boincuser_name = $edit['boincuser_name'];
516 516
             $result = $boinc_user->update(
517 517
                 "name='{$boincuser_name}'"
518 518
             );
519
-          }
520
-          break;
519
+            }
520
+            break;
521 521
         default:
522 522
         }
523 523
         // We don't want to save update source or duplicate custom fields, so
524 524
         // remove them before continuing to core Drupal routines
525 525
         $edit['update_source'] = null;
526 526
         $edit['boincuser_name'] = null;
527
-      }
528
-      break;
527
+        }
528
+        break;
529 529
 
530 530
     case 'login':
531 531
       // Function is forward compatible to Drupal 7
532 532
       boincuser_user_login($edit, $account);
533
-      break;
533
+        break;
534 534
 
535 535
     case 'delete':
536 536
       // Function is forward compatible to Drupal 7
537 537
       boincuser_user_delete($account);
538
-      break;
538
+        break;
539 539
 
540 540
     default:
541 541
       
542 542
     }
543
-  }
543
+    }
544 544
 }
545 545
 
546 546
 /**
@@ -549,39 +549,39 @@  discard block
 block discarded – undo
549 549
  *(forward compatible to Drupal 7).
550 550
  */
551 551
 function boincuser_user_login(&$edit, $account) {
552
-  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
553
-  $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
554
-
555
-  // Use the same code as boincuser_form_alter(), for case
556
-  // 'user_profile_form', if the refering page is the user password
557
-  // reset form, then do not check for terms of use.
558
-  $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1;
559
-  if ($reset_pass) {
552
+    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
553
+    $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
554
+
555
+    // Use the same code as boincuser_form_alter(), for case
556
+    // 'user_profile_form', if the refering page is the user password
557
+    // reset form, then do not check for terms of use.
558
+    $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1;
559
+    if ($reset_pass) {
560 560
     return;
561
-  }
561
+    }
562 562
 
563
-  // Check if user has agreed to terms of use.
564
-  if ( (!empty($termsofuse)) and ($account->uid) and 
563
+    // Check if user has agreed to terms of use.
564
+    if ( (!empty($termsofuse)) and ($account->uid) and 
565 565
        (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) {
566 566
 
567 567
     // Admins are exempted.
568 568
     $administrator_role = array_search('administrator', user_roles(true));
569 569
     if (!isset($account->roles[$administrator_role])) {
570 570
 
571
-      // Find and save the current destination and use as an parameter
572
-      // to send the user back to here he/she came from.
573
-      $np = ltrim('user/termsofuse', '/');
574
-      $path_for_destination = rawurlencode($np);
571
+        // Find and save the current destination and use as an parameter
572
+        // to send the user back to here he/she came from.
573
+        $np = ltrim('user/termsofuse', '/');
574
+        $path_for_destination = rawurlencode($np);
575 575
 
576
-      $query_for_destination = '';
577
-      $prevdest = $_REQUEST['destination'];
578
-      if ($prevdest) {
576
+        $query_for_destination = '';
577
+        $prevdest = $_REQUEST['destination'];
578
+        if ($prevdest) {
579 579
         $query_for_destination = '?destination=' . $prevdest;
580
-      }
581
-      $_REQUEST['destination'] = $path_for_destination . $query_for_destination;
580
+        }
581
+        $_REQUEST['destination'] = $path_for_destination . $query_for_destination;
582 582
 
583 583
     }
584
-  }
584
+    }
585 585
 }
586 586
 
587 587
 /**
@@ -590,16 +590,16 @@  discard block
 block discarded – undo
590 590
  */
591 591
 function boincuser_user_delete($account) {
592 592
 
593
-  $boincid = $account->boincuser_id;
594
-  // bug in comment module, remove user name from comments. Find all
595
-  // comments with uid=0 and clear the field 'name'.
596
-  $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0");
593
+    $boincid = $account->boincuser_id;
594
+    // bug in comment module, remove user name from comments. Find all
595
+    // comments with uid=0 and clear the field 'name'.
596
+    $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0");
597 597
 
598
-  // Delete entry in drupal boincuser table.
599
-  $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid);
600
-  if (!$qrc2) {
598
+    // Delete entry in drupal boincuser table.
599
+    $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid);
600
+    if (!$qrc2) {
601 601
     watchdog('user', 'Error deleting user account, boincuser table UID: %uid.', array('%uid' => $account->uid), WATCHDOG_ERROR);
602
-  }
602
+    }
603 603
 }
604 604
 
605 605
 
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
  * Obsolete in Drupal 7...
609 609
  */
610 610
 function boincuser_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
611
-  // In Drupal 7, these operation cases will all exist as their own hooks,
612
-  // so let's approximate that here so that this function can simply be removed
613
-  // upon migration to 7
614
-  switch($op) {
615
-  case 'update':
611
+    // In Drupal 7, these operation cases will all exist as their own hooks,
612
+    // so let's approximate that here so that this function can simply be removed
613
+    // upon migration to 7
614
+    switch($op) {
615
+    case 'update':
616 616
     boincuser_node_update($node);
617
-  }
617
+    }
618 618
 }
619 619
 
620 620
 /**
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
  * is updated (forward compatible to Drupal 7)
623 623
  */
624 624
 function boincuser_node_update($node) {
625
-  switch($node->type) {
626
-  case 'profile':
625
+    switch($node->type) {
626
+    case 'profile':
627 627
     // Update the BOINC database directly
628 628
     $account = user_load($node->uid);
629 629
     // Save user account data
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
       UPDATE user
636 636
       SET country = '%s', postal_code = '%s', url = '%s', has_profile = 1
637 637
       WHERE id = %d",
638
-      $country, $postal_code, $url, $account->boincuser_id
638
+        $country, $postal_code, $url, $account->boincuser_id
639 639
     );
640 640
     db_set_active('default');
641 641
     if (!$account_updated) {
642
-      drupal_set_message(t('Error saving BOINC account info.'), 'error');
642
+        drupal_set_message(t('Error saving BOINC account info.'), 'error');
643 643
     }
644 644
     // Save profile data
645 645
     $response1 = $node->field_background[0]['value'];
@@ -650,16 +650,16 @@  discard block
 block discarded – undo
650 650
       SET userid = %d, response1 = '%s', response2 = '%s'
651 651
       ON DUPLICATE KEY UPDATE
652 652
         response1 = '%s', response2 = '%s'",
653
-      $account->boincuser_id, $response1, $response2,
654
-      $response1, $response2
653
+        $account->boincuser_id, $response1, $response2,
654
+        $response1, $response2
655 655
     );
656 656
     db_set_active('default');
657 657
     if (!$profile_updated) {
658
-      drupal_set_message(t('Error saving BOINC profile.'), 'error');
658
+        drupal_set_message(t('Error saving BOINC profile.'), 'error');
659 659
     }
660 660
     break;
661 661
     
662
-  default:
662
+    default:
663 663
     
664 664
   }
665 665
 }
@@ -668,21 +668,21 @@  discard block
 block discarded – undo
668 668
 * Implementation of hook_views_api()
669 669
 */
670 670
 function boincuser_views_api() {
671
-  return array(
671
+    return array(
672 672
     'api' => 2.0,
673 673
     'path' => drupal_get_path('module', 'boincuser')
674
-  );
674
+    );
675 675
 }
676 676
 
677 677
 /**
678 678
 * Implementation of hook_form_alter()
679 679
 */
680 680
 function boincuser_form_alter(&$form, $form_state, $form_id) {
681
-  require_boinc('token');
681
+    require_boinc('token');
682 682
 
683
-  global $user;
684
-  switch ($form_id) {
685
-  case 'flag_confirm':
683
+    global $user;
684
+    switch ($form_id) {
685
+    case 'flag_confirm':
686 686
     // The URL seems to be the only way to put any kind of context to this
687 687
     // request!
688 688
     $action = arg(2);
@@ -691,25 +691,25 @@  discard block
 block discarded – undo
691 691
     
692 692
     // Wrap action buttons for styling consistency
693 693
     $form['form control tabs prefix'] = array(
694
-      '#value' => '<ul class="form-control tab-list">',
695
-      '#weight' => 1001,
694
+        '#value' => '<ul class="form-control tab-list">',
695
+        '#weight' => 1001,
696 696
     );
697 697
     
698 698
     switch ($flag_type) {
699 699
     case 'friend':
700 700
       $friend_id = $form['content_id']['#value'];
701
-      $flag = flag_get_flag('friend');
702
-      $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);
701
+        $flag = flag_get_flag('friend');
702
+        $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);
703 703
       
704
-      // General friend form overrides
705
-      $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';
706
-      $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page');
707
-      $form['flag_friend_submit']['#type'] = 'submit';
708
-      $form['flag_friend_submit']['#suffix'] = '</li>';
709
-      $form['flag_friend_submit']['#weight'] = 1002;
704
+        // General friend form overrides
705
+        $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';
706
+        $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page');
707
+        $form['flag_friend_submit']['#type'] = 'submit';
708
+        $form['flag_friend_submit']['#suffix'] = '</li>';
709
+        $form['flag_friend_submit']['#weight'] = 1002;
710 710
       
711
-      switch ($friend_status) {
712
-      case FLAG_FRIEND_BOTH:
711
+        switch ($friend_status) {
712
+        case FLAG_FRIEND_BOTH:
713 713
       case FLAG_FRIEND_FLAGGED:
714 714
         unset($form['actions']);
715 715
         $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove');
@@ -718,53 +718,53 @@  discard block
 block discarded – undo
718 718
         $form['#submit'][] = 'boincuser_fix_unfriend_form_submit';
719 719
         $form['#submit'][] = $final_handler;
720 720
         break;
721
-      case FLAG_FRIEND_PENDING:
721
+        case FLAG_FRIEND_PENDING:
722 722
         unset($form['actions']);
723 723
         $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page');
724 724
         break;
725
-      case FLAG_FRIEND_APPROVAL:
725
+        case FLAG_FRIEND_APPROVAL:
726 726
         if ($action == 'flag') {
727
-          $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page');
727
+            $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page');
728 728
         }
729 729
         elseif ($action == 'unflag') {
730
-          unset($form['actions']);
731
-          $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page');
730
+            unset($form['actions']);
731
+            $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page');
732 732
         }
733 733
         break;
734
-      case FLAG_FRIEND_UNFLAGGED:
734
+        case FLAG_FRIEND_UNFLAGGED:
735 735
       default:
736 736
         $user_links[] = array(
737
-          'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'),
738
-          'href' => "flag/confirm/flag/friend/{$account->uid}"
737
+            'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'),
738
+            'href' => "flag/confirm/flag/friend/{$account->uid}"
739 739
         );
740
-      }
741
-      break;
740
+        }
741
+        break;
742 742
       
743 743
     default:
744 744
     }
745 745
     
746 746
     $form['cancel'] = array(
747
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>',
748
-      '#weight' => 1004,
747
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>',
748
+        '#weight' => 1004,
749 749
     );
750 750
     $form['form control tabs suffix'] = array(
751
-      '#value' => '</ul>',
752
-      '#weight' => 1010,
751
+        '#value' => '</ul>',
752
+        '#weight' => 1010,
753 753
     );
754 754
     
755 755
     break;
756 756
     
757
-  // General node edit form
758
-  case 'news_node_form':
757
+    // General node edit form
758
+    case 'news_node_form':
759 759
     $form['separator_bottom'] = array(
760
-      '#value' => '<div class="separator buttons"></div>',
761
-      '#weight' => 999,
760
+        '#value' => '<div class="separator buttons"></div>',
761
+        '#weight' => 999,
762 762
     );
763 763
     
764 764
     // Wrap action buttons for styling consistency
765 765
     $form['buttons']['form control tabs prefix'] = array(
766
-      '#value' => '<ul class="form-control tab-list">',
767
-      '#weight' => 1001,
766
+        '#value' => '<ul class="form-control tab-list">',
767
+        '#weight' => 1001,
768 768
     );
769 769
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
770 770
     $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save');
@@ -777,15 +777,15 @@  discard block
 block discarded – undo
777 777
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
778 778
     $form['buttons']['preview_changes']['#weight'] = 1004;
779 779
     $form['buttons']['cancel'] = array(
780
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>',
781
-      '#weight' => 1005,
780
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>',
781
+        '#weight' => 1005,
782 782
     );
783 783
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
784 784
     $form['buttons']['delete']['#suffix'] = '</li>';
785 785
     $form['buttons']['delete']['#weight'] = 1006;
786 786
     $form['buttons']['form control tabs suffix'] = array(
787
-      '#value' => '</ul>',
788
-      '#weight' => 1010,
787
+        '#value' => '</ul>',
788
+        '#weight' => 1010,
789 789
     );
790 790
     
791 791
     // Preview is ugly, unset until it works
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
 
794 794
     break;
795 795
   
796
-  case 'node_delete_confirm':
796
+    case 'node_delete_confirm':
797 797
     $form['separator_bottom'] = array(
798
-      '#value' => '<div class="separator buttons"></div>',
799
-      '#weight' => 999,
798
+        '#value' => '<div class="separator buttons"></div>',
799
+        '#weight' => 999,
800 800
     );
801 801
     
802 802
     // Wrap action buttons for styling consistency
803 803
     $form['actions']['form control tabs prefix'] = array(
804
-      '#value' => '<ul class="form-control tab-list">',
805
-      '#weight' => 1001,
804
+        '#value' => '<ul class="form-control tab-list">',
805
+        '#weight' => 1001,
806 806
     );
807 807
     $form['actions']['submit']['#prefix'] = '<li class="first tab">';
808 808
     $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete');
@@ -810,23 +810,23 @@  discard block
 block discarded – undo
810 810
     $form['actions']['submit']['#weight'] = 1002;
811 811
     $form['actions']['cancel'] = array(
812 812
         '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>',
813
-      '#weight' => 1005,
813
+        '#weight' => 1005,
814 814
     );
815 815
     $form['actions']['form control tabs suffix'] = array(
816
-      '#value' => '</ul>',
817
-      '#weight' => 1010,
816
+        '#value' => '</ul>',
817
+        '#weight' => 1010,
818 818
     );
819 819
     $form['#redirect'] = 'account/profile';
820 820
     break;
821 821
     
822
-  case 'privatemsg_new':
822
+    case 'privatemsg_new':
823 823
     
824 824
     $form['privatemsg']['body']['#title'] = '';
825 825
     
826 826
     // Wrap action buttons for styling consistency
827 827
     $form['privatemsg']['form control tabs prefix'] = array(
828
-      '#value' => '<ul class="form-control tab-list">',
829
-      '#weight' => 1001,
828
+        '#value' => '<ul class="form-control tab-list">',
829
+        '#weight' => 1001,
830 830
     );
831 831
     $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">';
832 832
     $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message');
@@ -836,26 +836,26 @@  discard block
 block discarded – undo
836 836
     $form['privatemsg']['preview']['#suffix'] = '</li>';
837 837
     $form['privatemsg']['preview']['#weight'] = 1003;
838 838
     $form['privatemsg']['cancel'] = array(
839
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
840
-      '#weight' => 1004,
839
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
840
+        '#weight' => 1004,
841 841
     );
842 842
     $form['privatemsg']['form control tabs suffix'] = array(
843
-      '#value' => '</ul>',
844
-      '#weight' => 1010,
843
+        '#value' => '</ul>',
844
+        '#weight' => 1010,
845 845
     );
846 846
     
847 847
     unset($form['privatemsg']['recipient_display']);
848 848
     
849 849
     break;
850 850
     
851
-  // Login form
852
-  case 'user_login':
851
+    // Login form
852
+    case 'user_login':
853 853
   case 'user_login_block':
854 854
       drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link'));
855 855
     // Replace name with email in login form
856 856
     unset($form['name']);
857 857
     array_unshift($form, array(
858
-      'email' => array(
858
+        'email' => array(
859 859
         '#type' => 'textfield',
860 860
         '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'),
861 861
         '#size' => ($form_id == 'user_login_block') ? 15 : 60,
@@ -863,18 +863,18 @@  discard block
 block discarded – undo
863 863
         '#required' => TRUE,
864 864
         '#attributes' => array('tabindex' => '1'),
865 865
         '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page')
866
-      ),
867
-      'validation_source' => array(
866
+        ),
867
+        'validation_source' => array(
868 868
         '#type' => 'hidden',
869 869
         '#value' => 'user_login'
870
-      )
870
+        )
871 871
     ));
872 872
     $form['#redirect'] = 'home';
873 873
     
874 874
     // Wrap action buttons for styling consistency
875 875
     $form['buttons']['form control tabs prefix'] = array(
876
-      '#value' => '<ul class="form-control tab-list">',
877
-      '#weight' => 1001,
876
+        '#value' => '<ul class="form-control tab-list">',
877
+        '#weight' => 1001,
878 878
     );
879 879
     $form['buttons']['submit'] = $form['submit'];
880 880
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
@@ -882,8 +882,8 @@  discard block
 block discarded – undo
882 882
     $form['buttons']['submit']['#suffix'] = '</li>';
883 883
     $form['buttons']['submit']['#weight'] = 1002;
884 884
     $form['buttons']['form control tabs suffix'] = array(
885
-      '#value' => '</ul>',
886
-      '#weight' => 1010,
885
+        '#value' => '</ul>',
886
+        '#weight' => 1010,
887 887
     );
888 888
     unset($form['submit']);
889 889
     
@@ -892,23 +892,23 @@  discard block
 block discarded – undo
892 892
     isset($form['buttons']['submit']['#attributes']) ? array_push($form['buttons']['submit']['#attributes'], array('tabindex' => '3')) : $form['buttons']['submit']['#attributes'] = array('tabindex' => '3');
893 893
     // If the user login form is being submitted, use BOINC validation handler.
894 894
     if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) {
895
-      // Find the local validation function's entry so we can replace it.
896
-      $array_key = array_search('user_login_authenticate_validate', $form['#validate']);
897
-      if ($array_key === FALSE) {
895
+        // Find the local validation function's entry so we can replace it.
896
+        $array_key = array_search('user_login_authenticate_validate', $form['#validate']);
897
+        if ($array_key === FALSE) {
898 898
         // Could not find it. Some other module must have run form_alter().
899 899
         // We will simply add our validation just before the final validator.
900 900
         $final_validator = array_pop($form['#validate']);
901 901
         $form['#validate'][] = 'boincuser_login_validate';
902 902
         $form['#validate'][] = $final_validator;
903
-      } else {
903
+        } else {
904 904
         // Replace the local validation function with BOINC validation
905 905
         $form['#validate'][$array_key] = 'boincuser_login_validate';
906
-      }
906
+        }
907 907
     }
908 908
     break;
909 909
     
910
-  // User credentials form
911
-  case 'user_profile_form':
910
+    // User credentials form
911
+    case 'user_profile_form':
912 912
 
913 913
     // Use the displaly name as the title, not the username
914 914
     $account = user_load($form['#uid']);
@@ -916,28 +916,28 @@  discard block
 block discarded – undo
916 916
     
917 917
     // Message for admins
918 918
     if (user_access('administer users')) {
919
-      drupal_set_message(
919
+        drupal_set_message(
920 920
         bts('WARNING: You are editing the information for user. Please note: you may change a user\'s password by itself. But to change the user\'s email address you must change both the email address and the password simultaneously.')
921
-      , 'warning');
921
+        , 'warning');
922 922
     }
923 923
 
924 924
     // Set special message if user has not agreed to TOU
925 925
     $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
926 926
     $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
927 927
     if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) {
928
-      drupal_set_message(
928
+        drupal_set_message(
929 929
         bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.',
930 930
         array(
931
-          '@project' => variable_get('site_name','Drupal-BOINC'),
931
+            '@project' => variable_get('site_name','Drupal-BOINC'),
932 932
         ), NULL, 'boinc:account-credentials-change')
933
-      , 'info');
933
+        , 'info');
934 934
     }
935 935
 
936 936
     // A bit hackish... but don't require the user to enter his password if
937 937
     // coming from the password reset function
938 938
     $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1;
939 939
     if ($reset_pass) {
940
-      $_SESSION['reset_pass'] = 1;
940
+        $_SESSION['reset_pass'] = 1;
941 941
     }
942 942
 
943 943
     // Adjust form elements already present
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
     $form['account']['pass']['#size'] = 17;
950 950
 
951 951
     if (user_access('administer users')) {
952
-      // Add BOINC username (aka displayname)
953
-      $form['account']['boincuser_name'] = array(
952
+        // Add BOINC username (aka displayname)
953
+        $form['account']['boincuser_name'] = array(
954 954
         '#type' => 'textfield',
955 955
         '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'),
956 956
         '#default_value' => $account->boincuser_name,
@@ -958,68 +958,68 @@  discard block
 block discarded – undo
958 958
         '#required' => TRUE,
959 959
         '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'),
960 960
         '#size' => 40,
961
-      );
961
+        );
962 962
     }
963 963
 
964 964
     // If email address was changed less than 7 days (7 * 86400 s)
965 965
     // ago, it cannot be changed again.
966 966
     $duration = TOKEN_DURATION_ONE_WEEK;
967 967
     if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) {
968
-      $form['account']['mail']['#required'] = FALSE;
969
-      $form['account']['mailhelp'] = array(
968
+        $form['account']['mail']['#required'] = FALSE;
969
+        $form['account']['mailhelp'] = array(
970 970
         '#value' => bts("You email address was changed within the past seven (7) days. Please look for an email to !prev_email if you need to revert this change. You may change your email address on !time.",
971
-          array(
971
+            array(
972 972
             '!prev_email' => $account->boincuser_previous_email_addr,
973 973
             '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration),
974
-          ), NULL, 'boinc:account-credentials-change'),
975
-      );
974
+            ), NULL, 'boinc:account-credentials-change'),
975
+        );
976 976
     }
977 977
 
978 978
     if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) {
979
-      // Add a password authenticator, required to change email or pw
980
-      $form['account']['current_pass'] = array(
979
+        // Add a password authenticator, required to change email or pw
980
+        $form['account']['current_pass'] = array(
981 981
         '#type' => 'password',
982 982
         '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'),
983 983
         '#description' => bts('Enter your current password if changing your email
984 984
           address or password.', array(), NULL, 'boinc:account-credentials-change'),
985 985
         '#size' => 17,
986 986
         '#attributes' => array(
987
-          'autocomplete' => 'off',
987
+            'autocomplete' => 'off',
988 988
         ),
989
-      );
989
+        );
990 990
     }
991 991
     
992 992
     // Add account keys, CPID, etc
993 993
     $form['account']['boincuser_id'] = array(
994
-      '#value' => '
994
+        '#value' => '
995 995
         <div class="form-item">
996 996
           <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
997 997
           <span>' . $account->boincuser_id . '</span>
998 998
         </div>',
999 999
     );
1000 1000
     $form['account']['user_id'] = array(
1001
-      '#value' => '
1001
+        '#value' => '
1002 1002
         <div class="form-item">
1003 1003
           <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
1004 1004
           <span>' . $account->uid . '</span>
1005 1005
         </div>',
1006 1006
     );
1007 1007
     $form['account']['account_key'] = array(
1008
-      '#value' => '
1008
+        '#value' => '
1009 1009
         <div class="form-item">
1010 1010
           <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label>
1011 1011
           <span>' . $account->boincuser_account_key . '</span>
1012 1012
         </div>',
1013 1013
     );
1014 1014
     $form['account']['weak_account_key'] = array(
1015
-      '#value' => '
1015
+        '#value' => '
1016 1016
         <div class="form-item">
1017 1017
           <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label>
1018 1018
           <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span>
1019 1019
         </div>',
1020 1020
     );
1021 1021
     $form['account']['cpid'] = array(
1022
-      '#value' => '
1022
+        '#value' => '
1023 1023
         <div class="form-item">
1024 1024
           <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
1025 1025
           <span>' . $account->boincuser_cpid . '</span>
@@ -1027,30 +1027,30 @@  discard block
 block discarded – undo
1027 1027
     );
1028 1028
     
1029 1029
     $form['account']['separator_bottom'] = array(
1030
-      '#value' => '<div class="separator buttons"></div>'
1030
+        '#value' => '<div class="separator buttons"></div>'
1031 1031
     );
1032 1032
     
1033 1033
     // Wrap action buttons for styling consistency
1034 1034
     $form['form control tabs prefix'] = array(
1035
-      '#value' => '<ul class="form-control tab-list">',
1036
-      '#weight' => 1001,
1035
+        '#value' => '<ul class="form-control tab-list">',
1036
+        '#weight' => 1001,
1037 1037
     );
1038 1038
     $form['submit']['#prefix'] = '<li class="first tab">';
1039 1039
     $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save');
1040 1040
     $form['submit']['#suffix'] = '</li>';
1041 1041
     $form['submit']['#weight'] = 1002;
1042 1042
     $form['cancel'] = array(
1043
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1044
-      '#weight' => 1003,
1043
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1044
+        '#weight' => 1003,
1045 1045
     );
1046 1046
     if (isset($form['delete']) AND is_array($form['delete'])) {
1047
-      $form['delete']['#prefix'] = '<li class="first alt tab">';
1048
-      $form['delete']['#suffix'] = '</li>';
1049
-      $form['delete']['#weight'] = 1004;
1047
+        $form['delete']['#prefix'] = '<li class="first alt tab">';
1048
+        $form['delete']['#suffix'] = '</li>';
1049
+        $form['delete']['#weight'] = 1004;
1050 1050
     }
1051 1051
     $form['form control tabs suffix'] = array(
1052
-      '#value' => '</ul>',
1053
-      '#weight' => 1010,
1052
+        '#value' => '</ul>',
1053
+        '#weight' => 1010,
1054 1054
     );
1055 1055
     
1056 1056
     // Rearrange form elements
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
     // Remove redundant / unnecessary form elements
1071 1071
     unset($form['theme_select']);
1072 1072
     if (!module_exists('boincuser_delete')) {
1073
-      unset($form['delete']);
1073
+        unset($form['delete']);
1074 1074
     }
1075 1075
     
1076 1076
     // These are on the Community preferences form (boincwork module)
@@ -1086,18 +1086,18 @@  discard block
 block discarded – undo
1086 1086
     
1087 1087
     // Internal fields to indicate where these user changes are taking place
1088 1088
     array_unshift($form, array(
1089
-      'validation_source' => array(
1089
+        'validation_source' => array(
1090 1090
         '#type' => 'hidden',
1091 1091
         '#value' => 'user_account'
1092
-      ),
1093
-      'update_source' => array(
1092
+        ),
1093
+        'update_source' => array(
1094 1094
         '#type' => 'hidden',
1095 1095
         '#value' => 'user_account'
1096
-      )
1096
+        )
1097 1097
     ));
1098 1098
     break;
1099 1099
     
1100
-  case 'profile_node_form':
1100
+    case 'profile_node_form':
1101 1101
     
1102 1102
     // Use the display name as the title, not the username
1103 1103
     $account = user_load($form['uid']['#value']);
@@ -1108,22 +1108,22 @@  discard block
 block discarded – undo
1108 1108
     $form['title']['#access'] = FALSE;
1109 1109
 
1110 1110
     $form['separator_bottom'] = array(
1111
-      '#value' => '<div class="separator buttons"></div>',
1112
-      '#weight' => 999,
1111
+        '#value' => '<div class="separator buttons"></div>',
1112
+        '#weight' => 999,
1113 1113
     );
1114 1114
     
1115 1115
     if (module_exists('captcha')) {
1116
-      // Add an optional captcha
1117
-      $form['profile_captcha'] = array(
1116
+        // Add an optional captcha
1117
+        $form['profile_captcha'] = array(
1118 1118
         '#type' => 'captcha',
1119 1119
         '#weight' => 1000,
1120
-      );
1120
+        );
1121 1121
     }
1122 1122
     
1123 1123
     // Wrap action buttons for styling consistency
1124 1124
     $form['buttons']['form control tabs prefix'] = array(
1125
-      '#value' => '<ul class="form-control tab-list">',
1126
-      '#weight' => 1001,
1125
+        '#value' => '<ul class="form-control tab-list">',
1126
+        '#weight' => 1001,
1127 1127
     );
1128 1128
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
1129 1129
     $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save');
@@ -1136,8 +1136,8 @@  discard block
 block discarded – undo
1136 1136
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
1137 1137
     $form['buttons']['preview_changes']['#weight'] = 1004;
1138 1138
     $form['buttons']['cancel'] = array(
1139
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1140
-      '#weight' => 1005,
1139
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1140
+        '#weight' => 1005,
1141 1141
     );
1142 1142
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
1143 1143
     $form['buttons']['delete']['#suffix'] = '</li>';
@@ -1145,8 +1145,8 @@  discard block
 block discarded – undo
1145 1145
     $form['buttons']['delete']['#weight'] = 1006;
1146 1146
     $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit');
1147 1147
     $form['buttons']['form control tabs suffix'] = array(
1148
-      '#value' => '</ul>',
1149
-      '#weight' => 1010,
1148
+        '#value' => '</ul>',
1149
+        '#weight' => 1010,
1150 1150
     );
1151 1151
     
1152 1152
     $form['#after_build'][] = 'boincuser_profile_node_form_after_build';
@@ -1159,74 +1159,74 @@  discard block
 block discarded – undo
1159 1159
     
1160 1160
     // Internal fields to indicate where these user changes are taking place
1161 1161
     array_unshift($form, array(
1162
-      'validation_source' => array(
1162
+        'validation_source' => array(
1163 1163
         '#type' => 'hidden',
1164 1164
         '#value' => 'user_profile'
1165
-      ),
1166
-      'update_source' => array(
1165
+        ),
1166
+        'update_source' => array(
1167 1167
         '#type' => 'hidden',
1168 1168
         '#value' => 'user_profile'
1169
-      )
1169
+        )
1170 1170
     ));
1171 1171
     break;
1172 1172
   
1173
-  // Registration form
1174
-  case 'user_register':
1173
+    // Registration form
1174
+    case 'user_register':
1175 1175
     array_unshift($form, array(
1176
-      'boincuser_name' => array(
1176
+        'boincuser_name' => array(
1177 1177
         '#type' => 'textfield', 
1178 1178
         '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), 
1179 1179
         '#default_value' => $edit['boincuser_name'], 
1180 1180
         '#maxlength' => USERNAME_MAX_LENGTH, 
1181 1181
         '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), 
1182 1182
         '#required' => TRUE
1183
-      ),
1183
+        ),
1184 1184
     ));
1185 1185
     // Set name temporarily to dummy value to beat validation
1186 1186
     $form['name'] = array(
1187
-      '#type' => 'hidden',
1188
-      '#value' => rand() . '.' . time()
1187
+        '#type' => 'hidden',
1188
+        '#value' => rand() . '.' . time()
1189 1189
     );
1190 1190
     
1191 1191
     // Terms of use section
1192 1192
     $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
1193 1193
     if (!empty($termsofuse)) {
1194
-      $form['title1'] = array(
1194
+        $form['title1'] = array(
1195 1195
         '#weight' => -12,
1196 1196
         '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>',
1197 1197
         '#prefix' => '<div id="register-title1">',
1198 1198
         '#suffix' => '</div>',
1199
-      );
1199
+        );
1200 1200
 
1201
-      $form['termsofuse'] = array(
1201
+        $form['termsofuse'] = array(
1202 1202
         '#weight' => -10,
1203 1203
         '#value' => bts($termsofuse, array(), NULL, 'project:user-register'),
1204 1204
         '#prefix' => '<div id="register-termsofuse">',
1205 1205
         '#suffix' => '</div>',
1206
-      );
1206
+        );
1207 1207
 
1208
-      $form['agreeTOU'] = array(
1208
+        $form['agreeTOU'] = array(
1209 1209
         '#type' => 'checkbox',
1210 1210
         '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'),
1211 1211
         '#weight' => -8,
1212 1212
         '#prefix' => '<div id="register-checkbox">',
1213 1213
         '#suffix' => '</div>',
1214
-      );
1214
+        );
1215 1215
     }
1216 1216
 
1217 1217
     $form['title2'] = array(
1218
-      '#weight' => -6,
1219
-      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>',
1220
-      '#prefix' => '<div id="register-title2">',
1221
-      '#suffix' => '</div>',
1218
+        '#weight' => -6,
1219
+        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>',
1220
+        '#prefix' => '<div id="register-title2">',
1221
+        '#suffix' => '</div>',
1222 1222
     );
1223 1223
 
1224 1224
     if (module_exists('captcha')) {
1225
-      // Add an optional captcha
1226
-      $form['register_captcha'] = array(
1225
+        // Add an optional captcha
1226
+        $form['register_captcha'] = array(
1227 1227
         '#type' => 'captcha',
1228 1228
         '#weight' => 1000,
1229
-      );
1229
+        );
1230 1230
     }
1231 1231
     
1232 1232
     $form['#validate'][] = 'boincuser_register_validate';
@@ -1234,35 +1234,35 @@  discard block
 block discarded – undo
1234 1234
     $form['submit']['#weight'] = 1001;
1235 1235
     break;
1236 1236
     
1237
-  // Request new password form
1238
-  case 'user_pass':
1237
+    // Request new password form
1238
+    case 'user_pass':
1239 1239
     drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password'));
1240 1240
     // Replace name/email text box with email only; retain "name" label
1241 1241
     // for compatibility with standard Drupal submit function
1242 1242
     unset($form['name']);
1243 1243
     array_unshift($form, array(
1244
-      'name' => array(
1244
+        'name' => array(
1245 1245
         '#type' => 'textfield',
1246 1246
         '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'),
1247 1247
         '#size' => 60,
1248 1248
         '#maxlength' => EMAIL_MAX_LENGTH,
1249 1249
         '#required' => TRUE,
1250 1250
         '#description' => bts(
1251
-          'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',
1252
-          array(
1251
+            'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',
1252
+            array(
1253 1253
             '!authenticator_login' => l(
1254
-              bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'),
1255
-              'user/login/auth'
1254
+                bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'),
1255
+                'user/login/auth'
1256
+            )
1256 1257
             )
1257
-          )
1258 1258
         , NULL, 'boinc:forgot-password'),
1259
-      ),
1259
+        ),
1260 1260
     ));
1261 1261
     
1262 1262
     // Wrap action buttons for styling consistency
1263 1263
     $form['buttons']['form control tabs prefix'] = array(
1264
-      '#value' => '<ul class="form-control tab-list">',
1265
-      '#weight' => 1001,
1264
+        '#value' => '<ul class="form-control tab-list">',
1265
+        '#weight' => 1001,
1266 1266
     );
1267 1267
     $form['buttons']['submit'] = $form['submit'];
1268 1268
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
@@ -1270,26 +1270,26 @@  discard block
 block discarded – undo
1270 1270
     $form['buttons']['submit']['#suffix'] = '</li>';
1271 1271
     $form['buttons']['submit']['#weight'] = 1002;
1272 1272
     $form['buttons']['cancel'] = array(
1273
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>',
1274
-      '#weight' => 1005,
1273
+        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>',
1274
+        '#weight' => 1005,
1275 1275
     );
1276 1276
     $form['buttons']['form control tabs suffix'] = array(
1277
-      '#value' => '</ul>',
1278
-      '#weight' => 1010,
1277
+        '#value' => '</ul>',
1278
+        '#weight' => 1010,
1279 1279
     );
1280 1280
     unset($form['submit']);
1281 1281
     
1282 1282
     // If the form is being submitted, use BOINC validation handler.
1283 1283
     if (isset($form_state['post']['name'])) {
1284
-      // Prepend the BOINC validation function to local validation
1285
-      array_unshift($form['#validate'], 'boincuser_request_pass_validate');
1284
+        // Prepend the BOINC validation function to local validation
1285
+        array_unshift($form['#validate'], 'boincuser_request_pass_validate');
1286 1286
     }
1287 1287
     break;
1288 1288
     
1289
-  case 'views_exposed_form':
1289
+    case 'views_exposed_form':
1290 1290
       $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user');
1291 1291
     break;
1292
-  }
1292
+    }
1293 1293
 }
1294 1294
 
1295 1295
 /**
@@ -1297,10 +1297,10 @@  discard block
 block discarded – undo
1297 1297
  * built; this is called from boincuser_form_alter()
1298 1298
  */
1299 1299
 function boincuser_profile_node_form_after_build($form, &$form_state) {
1300
-  // Move to community prefs form
1301
-  $form_state['storage']['avatar'] = $form['field_image'];
1302
-  unset($form['field_image']);
1303
-  return $form;
1300
+    // Move to community prefs form
1301
+    $form_state['storage']['avatar'] = $form['field_image'];
1302
+    unset($form['field_image']);
1303
+    return $form;
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1308,8 +1308,8 @@  discard block
 block discarded – undo
1308 1308
  * @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6
1309 1309
  */
1310 1310
 function boincuser_elements() {
1311
-  $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';
1312
-  return $type;
1311
+    $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';
1312
+    return $type;
1313 1313
 }
1314 1314
 
1315 1315
 /**
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
  * profile form
1318 1318
  */
1319 1319
 function boincuser_process_password_confirm($element) {
1320
-  // Check if parent element is "account".
1321
-  if ($element['#array_parents'][0] == 'account') {
1320
+    // Check if parent element is "account".
1321
+    if ($element['#array_parents'][0] == 'account') {
1322 1322
     $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password');
1323
-  }
1324
-  return $element;
1323
+    }
1324
+    return $element;
1325 1325
 }
1326 1326
 
1327 1327
 /**
@@ -1329,40 +1329,40 @@  discard block
 block discarded – undo
1329 1329
  * Register theme functions for use in this module.
1330 1330
  */
1331 1331
 function boincuser_theme($existing, $type, $theme, $path) {
1332
-  return array(
1332
+    return array(
1333 1333
     'boincuser_user_pass' => array(
1334
-      'arguments' => array()
1334
+        'arguments' => array()
1335 1335
     )
1336
-  );
1336
+    );
1337 1337
 }
1338 1338
 
1339 1339
 /**
1340 1340
  * Implementation of hook_token_values
1341 1341
  */
1342 1342
 function boincuser_token_values($type, $object = NULL, $options = array()) {
1343
-  if ($type == 'user') {
1343
+    if ($type == 'user') {
1344 1344
     $account = user_load($object->uid);
1345 1345
     $tokens['display-name'] = $account->boincuser_name;
1346 1346
     return $tokens;
1347
-  }
1347
+    }
1348 1348
 }
1349 1349
 
1350 1350
 /**
1351 1351
  * Implementation of hook_token_list
1352 1352
  */
1353 1353
 function boincuser_token_list($type = 'all') {
1354
-  if ($type == 'user' || $type == 'all') {
1354
+    if ($type == 'user' || $type == 'all') {
1355 1355
     $tokens['user']['display-name']      = t("The user's name that should be displayed");
1356 1356
     return $tokens;
1357
-  }
1357
+    }
1358 1358
 }
1359 1359
 
1360 1360
 /**
1361 1361
  * Implementation of hook_views_pre_execute()
1362 1362
  */
1363 1363
 function boincuser_views_pre_execute(&$view) {
1364
-  $account_id = $view->args[0];
1365
-  if ($view->name=="user_activity") {
1364
+    $account_id = $view->args[0];
1365
+    if ($view->name=="user_activity") {
1366 1366
     // Run the following custom query for the user_activity view
1367 1367
     $view->build_info['query']= "
1368 1368
       SELECT node_revisions.vid AS vid,
@@ -1394,25 +1394,25 @@  discard block
 block discarded – undo
1394 1394
     
1395 1395
     // count_query determines the pager.  Do this so the right item count is returned.
1396 1396
     $view->build_info['count_query'] = $view->build_info['query'];
1397
-  }
1397
+    }
1398 1398
 }
1399 1399
 
1400 1400
 /**
1401 1401
  * Implementation of hook_cron()
1402 1402
  */
1403 1403
 function boincuser_cron() {
1404
-  // Delete expired users in the BOINC database, user_delete table.
1405
-  require_boinc('boinc_db');
1406
-  $num_deleted = BoincUserDeleted::delete_expired();
1407
-  if ($num_deleted>0) {
1404
+    // Delete expired users in the BOINC database, user_delete table.
1405
+    require_boinc('boinc_db');
1406
+    $num_deleted = BoincUserDeleted::delete_expired();
1407
+    if ($num_deleted>0) {
1408 1408
     watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE);
1409
-  }
1409
+    }
1410 1410
 
1411
-  // Delete expired tokens from token table
1412
-  $tokens_deleted = BoincToken::delete_expired();
1413
-  if ($tokens_deleted>0) {
1411
+    // Delete expired tokens from token table
1412
+    $tokens_deleted = BoincToken::delete_expired();
1413
+    if ($tokens_deleted>0) {
1414 1414
     watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE);
1415
-  }
1415
+    }
1416 1416
 }
1417 1417
 
1418 1418
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -1423,17 +1423,17 @@  discard block
 block discarded – undo
1423 1423
  * Page callback shortcut to recent posts for the logged in user
1424 1424
  */
1425 1425
 function boincuser_goto_recent_posts() {
1426
-  global $user;
1427
-  drupal_goto("account/{$user->uid}/posts");
1426
+    global $user;
1427
+    drupal_goto("account/{$user->uid}/posts");
1428 1428
 }
1429 1429
 
1430 1430
 /**
1431 1431
  * Page callback shortcut to the team of the logged in user
1432 1432
  */
1433 1433
 function boincuser_goto_team() {
1434
-  global $user;
1435
-  $account = user_load($user->uid);
1436
-  drupal_goto("community/teams/{$account->team}");
1434
+    global $user;
1435
+    $account = user_load($user->uid);
1436
+    drupal_goto("community/teams/{$account->team}");
1437 1437
 }
1438 1438
 
1439 1439
 /**
@@ -1442,83 +1442,83 @@  discard block
 block discarded – undo
1442 1442
  * user profile pages, so use a wrapper for display
1443 1443
  */
1444 1444
 function boincuser_view_profile($account = null) {
1445
-  // Create the user profile page
1446
-  if (!$account) {
1445
+    // Create the user profile page
1446
+    if (!$account) {
1447 1447
     global $user;
1448 1448
     $account = $user;
1449
-  }
1450
-  // For now, just call the user module profile view function
1451
-  user_build_content($account);
1452
-  return theme('user_profile', $account);
1449
+    }
1450
+    // For now, just call the user module profile view function
1451
+    user_build_content($account);
1452
+    return theme('user_profile', $account);
1453 1453
 }
1454 1454
 
1455 1455
 /**
1456 1456
  * Page callback for editing a user profile
1457 1457
  */
1458 1458
 function boincuser_edit_profile($account = null) {
1459
-  // Create the user profile form
1460
-  if (!$account) {
1459
+    // Create the user profile form
1460
+    if (!$account) {
1461 1461
     global $user;
1462 1462
     $account = $user;
1463
-  }
1464
-  // Render the form
1465
-  module_load_include('pages.inc', 'node', 'node');
1466
-  return content_profile_page_edit('profile', $account);
1463
+    }
1464
+    // Render the form
1465
+    module_load_include('pages.inc', 'node', 'node');
1466
+    return content_profile_page_edit('profile', $account);
1467 1467
 }
1468 1468
 
1469 1469
 /**
1470
-  * Join page menu callback.
1471
-  * Display instructions on joining for new or existing BOINC users
1472
-  */
1470
+ * Join page menu callback.
1471
+ * Display instructions on joining for new or existing BOINC users
1472
+ */
1473 1473
 function join_page($type = null) {
1474
-  global $base_url;
1475
-  /* The paths/links to the rules-and-policies page is hardcoded
1474
+    global $base_url;
1475
+    /* The paths/links to the rules-and-policies page is hardcoded
1476 1476
    * here. An improvement would be admin settings for the Join Page
1477 1477
    * where this path could be set.
1478 1478
    */
1479
-  $ruleslinkA = 'rules-and-policies';
1480
-  $ruleslinkB = 'content/rules-and-policies';
1481
-  $site_name = variable_get('site_name', 'Drupal-BOINC');
1482
-  $registration_enabled = variable_get('user_register', 0);
1483
-  $output = '<div class="join">';
1484
-  switch ($type) {
1485
-  case 'boinc':
1479
+    $ruleslinkA = 'rules-and-policies';
1480
+    $ruleslinkB = 'content/rules-and-policies';
1481
+    $site_name = variable_get('site_name', 'Drupal-BOINC');
1482
+    $registration_enabled = variable_get('user_register', 0);
1483
+    $output = '<div class="join">';
1484
+    switch ($type) {
1485
+    case 'boinc':
1486 1486
     $output .= '<ol>';
1487 1487
     if ($registration_enabled) {
1488
-      $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1489
-      array(
1488
+        $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1489
+        array(
1490 1490
         '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'),
1491 1491
         '@sitename' => $site_name,
1492
-      ), NULL, 'boinc:join-page') . '</li>';
1492
+        ), NULL, 'boinc:join-page') . '</li>';
1493 1493
     }
1494 1494
     $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>';
1495 1495
     $output .= '  <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.",
1496 1496
     array(
1497
-      '@sitename' => $site_name,
1498
-      '@siteurl' => $base_url,
1497
+        '@sitename' => $site_name,
1498
+        '@siteurl' => $base_url,
1499 1499
     ), NULL, 'boinc:join-page') . '</li>';
1500 1500
     if ($registration_enabled) {
1501
-      $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.",
1501
+        $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.",
1502 1502
         array(
1503
-          '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1503
+            '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1504 1504
         ), NULL, 'boinc:join-page') . '</li>';
1505 1505
     }
1506 1506
     else {
1507
-      $output .= '<li>' . bts("If you're running a command-line version of BOINC,
1507
+        $output .= '<li>' . bts("If you're running a command-line version of BOINC,
1508 1508
         please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.",
1509 1509
         array(
1510
-          '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1510
+            '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1511 1511
         ), NULL, 'boinc:join-page') . '</li>';
1512 1512
     }
1513 1513
     $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please
1514 1514
       upgrade to a more recent version of BOINC to create an account
1515 1515
       at @this_project.",
1516
-      array(
1516
+        array(
1517 1517
         '@this_project' => $site_name,
1518
-      ), NULL, 'boinc:join-page') . '</li>';
1518
+        ), NULL, 'boinc:join-page') . '</li>';
1519 1519
     $output .=  '</ol>';
1520 1520
     break;
1521
-  case 'new':
1521
+    case 'new':
1522 1522
   default:
1523 1523
     // Determine if there is a link to rules-and-policies
1524 1524
     //$ruleslink='';
@@ -1533,16 +1533,16 @@  discard block
 block discarded – undo
1533 1533
     // Join page output
1534 1534
     $output .= '<ol>';
1535 1535
     if ($registration_enabled) {
1536
-      $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1537
-      array(
1536
+        $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1537
+        array(
1538 1538
         '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'),
1539 1539
         '@sitename' => $site_name,
1540
-      ), NULL, 'boinc:join-page') . '</li>';
1540
+        ), NULL, 'boinc:join-page') . '</li>';
1541 1541
     }
1542 1542
     else if ( menu_valid_path(array('link_path' => $ruleslink)) ) {
1543
-      $output .= '  <li>' . bts("Read our !rules_and_policies.", array(
1543
+        $output .= '  <li>' . bts("Read our !rules_and_policies.", array(
1544 1544
         '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink),
1545
-      ), NULL, 'boinc:join-page') . '</li>';
1545
+        ), NULL, 'boinc:join-page') . '</li>';
1546 1546
     }
1547 1547
     $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page');
1548 1548
     $output .= '    <p>';
@@ -1552,73 +1552,73 @@  discard block
 block discarded – undo
1552 1552
     $output .= '  </li>';
1553 1553
     $output .= '  <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>';
1554 1554
     $output .= '  <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array(
1555
-      '@sitename' => $site_name,
1556
-      '@siteurl' => $base_url,
1555
+        '@sitename' => $site_name,
1556
+        '@siteurl' => $base_url,
1557 1557
     ), NULL, 'boinc:join-page') . '</li>';
1558 1558
     $output .=  '</ol>';
1559
-  }
1560
-  $output .= '</div>';
1561
-  return $output;
1559
+    }
1560
+    $output .= '</div>';
1561
+    return $output;
1562 1562
 }
1563 1563
 
1564 1564
 /**
1565
-  * Home page content for embedding in Panels page
1566
-  */
1565
+ * Home page content for embedding in Panels page
1566
+ */
1567 1567
 function boincuser_home_page() {
1568
-  global $user;
1569
-  $site_name = variable_get('site_name', 'Drupal-BOINC');
1570
-  // get the front page message from database; this is set in the admin interface under BOINC Other
1571
-  $site_message = variable_get('boinc_other_frontpage','');
1568
+    global $user;
1569
+    $site_name = variable_get('site_name', 'Drupal-BOINC');
1570
+    // get the front page message from database; this is set in the admin interface under BOINC Other
1571
+    $site_message = variable_get('boinc_other_frontpage','');
1572 1572
 
1573
-  // Determine the user of the day
1574
-  $current_uotd = db_fetch_object(db_query("
1573
+    // Determine the user of the day
1574
+    $current_uotd = db_fetch_object(db_query("
1575 1575
     SELECT
1576 1576
       uid,
1577 1577
       uotd_time
1578 1578
     FROM {boincuser}
1579 1579
     ORDER BY uotd_time DESC
1580 1580
     LIMIT 1"
1581
-  ));
1582
-  if ($current_uotd->uotd_time < strtotime('today midnight')) {
1581
+    ));
1582
+    if ($current_uotd->uotd_time < strtotime('today midnight')) {
1583 1583
     $uotd = boincuser_select_user_of_the_day();
1584
-  }
1585
-  else {
1584
+    }
1585
+    else {
1586 1586
     $uotd = user_load($current_uotd->uid);
1587
-  }
1588
-  $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
1589
-  $output = '<h2 class="pane-title">';
1590
-  $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page'));
1591
-  $output .= '</h2>';
1592
-  $output .= '<div class="boinc-overview balance-height-front">';
1593
-  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>';
1594
-  if ($user->uid) {
1587
+    }
1588
+    $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
1589
+    $output = '<h2 class="pane-title">';
1590
+    $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page'));
1591
+    $output .= '</h2>';
1592
+    $output .= '<div class="boinc-overview balance-height-front">';
1593
+    $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>';
1594
+    if ($user->uid) {
1595 1595
     $output .= '  <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1596
-  }
1597
-  else {
1596
+    }
1597
+    else {
1598 1598
     $output .= '  <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>';
1599
-  }
1600
-  $output .= '</div>';
1601
-  $output .= '<div class="boinc-overview-details">';
1602
-  $output .= '  <div class="detail-container">';
1603
-  $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1604
-  $output .= '      <div class="picture">';
1605
-  $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1599
+    }
1600
+    $output .= '</div>';
1601
+    $output .= '<div class="boinc-overview-details">';
1602
+    $output .= '  <div class="detail-container">';
1603
+    $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1604
+    $output .= '      <div class="picture">';
1605
+    $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1606 1606
     $uotd_image['alt'], array(), FALSE);
1607
-  $output .= '      </div>';
1608
-  $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>';
1609
-  $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1610
-  $output .= '    </a>';
1611
-  $output .= '    <div class="volunteers">';
1612
-  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>';
1613
-  $output .= '      <div class="platforms">';
1614
-  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>';
1615
-  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>';
1616
-  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>';
1617
-  $output .= '      </div>';
1618
-  $output .= '    </div>';
1619
-  $output .= '  </div>';
1620
-  $output .= '</div>';
1621
-  return $output;
1607
+    $output .= '      </div>';
1608
+    $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>';
1609
+    $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1610
+    $output .= '    </a>';
1611
+    $output .= '    <div class="volunteers">';
1612
+    $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>';
1613
+    $output .= '      <div class="platforms">';
1614
+    $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>';
1615
+    $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>';
1616
+    $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>';
1617
+    $output .= '      </div>';
1618
+    $output .= '    </div>';
1619
+    $output .= '  </div>';
1620
+    $output .= '</div>';
1621
+    return $output;
1622 1622
 }
1623 1623
 
1624 1624
 /**
@@ -1626,80 +1626,80 @@  discard block
 block discarded – undo
1626 1626
  * Create a new user account based on supplied parameters.
1627 1627
  */
1628 1628
 function boincuser_create_account() {
1629
-  global $base_url;
1629
+    global $base_url;
1630 1630
 
1631
-  require_boinc('boinc_db');
1632
-  require_boinc('user_util');
1633
-  require_boinc('xml');
1634
-  $params = array(
1631
+    require_boinc('boinc_db');
1632
+    require_boinc('user_util');
1633
+    require_boinc('xml');
1634
+    $params = array(
1635 1635
     'email_addr' => isset($_GET['email_addr']) ? $_GET['email_addr'] : '',
1636 1636
     'user_name' => isset($_GET['user_name']) ? $_GET['user_name'] : '',
1637 1637
     'passwd_hash' => isset($_GET['passwd_hash']) ? $_GET['passwd_hash'] : ''
1638
-  );
1638
+    );
1639 1639
   
1640
-  // Begin output
1641
-  xml_header();
1640
+    // Begin output
1641
+    xml_header();
1642 1642
   
1643
-  // Account creation disabled
1644
-  $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE);
1645
-  if (!$enablethisRPC) {
1643
+    // Account creation disabled
1644
+    $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE);
1645
+    if (!$enablethisRPC) {
1646 1646
     $mess = bts('Account creation is done through our Web site. Please register at @url', array(
1647
-      '@url' => $base_url . '/user/registration',
1647
+        '@url' => $base_url . '/user/registration',
1648 1648
     ),
1649 1649
     NULL, 'boinc:create_account');
1650 1650
     xml_error(-208, $mess);
1651
-  }
1652
-  // Invalid invite code
1651
+    }
1652
+    // Invalid invite code
1653 1653
   
1654
-  // Validate input
1655
-  if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) {
1654
+    // Validate input
1655
+    if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) {
1656 1656
     xml_error(-205);
1657
-  }
1657
+    }
1658 1658
 
1659
-  // Make sure user_name is unique and cleaned
1660
-  $unique_name = create_proper_drupalname($params['user_name']);
1661
-  if ($error = user_validate_name($unique_name)) {
1659
+    // Make sure user_name is unique and cleaned
1660
+    $unique_name = create_proper_drupalname($params['user_name']);
1661
+    if ($error = user_validate_name($unique_name)) {
1662 1662
     xml_error(-188, $error);
1663
-  }
1664
-  if (strlen($params['passwd_hash']) != 32) {
1663
+    }
1664
+    if (strlen($params['passwd_hash']) != 32) {
1665 1665
     xml_error(-1, 'password hash length not 32');
1666
-  }
1666
+    }
1667 1667
   
1668
-  // Process input
1669
-  // Check this email against previous email addresses.
1670
-  $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']);
1671
-  if ($tmpuser) {
1668
+    // Process input
1669
+    // Check this email against previous email addresses.
1670
+    $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']);
1671
+    if ($tmpuser) {
1672 1672
     xml_error(-137);
1673
-  }
1673
+    }
1674 1674
 
1675
-  // Check this email on current email addresses.
1676
-  $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);
1677
-  if ($boinc_user) {
1675
+    // Check this email on current email addresses.
1676
+    $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);
1677
+    if ($boinc_user) {
1678 1678
     // Return authenticator for existing users
1679 1679
     if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or
1680 1680
     password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) {
1681
-      $output = array('authenticator' => $boinc_user->authenticator);
1681
+        $output = array('authenticator' => $boinc_user->authenticator);
1682 1682
     }
1683 1683
     else {
1684
-      xml_error(-137);
1684
+        xml_error(-137);
1685 1685
     }
1686
-  }
1687
-  else {
1686
+    }
1687
+    else {
1688 1688
     // Verify that there isn't somehow a Drupal user already (not possible with proper function)
1689 1689
     if ($existing_user = user_load(array('mail' => $params['email_addr']))) {
1690
-      xml_error(-137, 'account error');
1690
+        xml_error(-137, 'account error');
1691 1691
     }
1692 1692
     // Create new account
1693 1693
     $unrestricted_role = array_search('community member', user_roles(true));
1694 1694
 
1695 1695
     $newUser = array(
1696
-      'name' => $unique_name,
1697
-      'pass' => null, // $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db
1698
-      'mail' => $params['email_addr'],
1699
-      'status' => 1,
1700
-      'init' => $params['email_addr'],
1701
-      'roles' => array($unrestricted_role => ''),
1702
-      'boincuser_name' => $params['user_name'],
1696
+        'name' => $unique_name,
1697
+        'pass' => null, // $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db
1698
+        'mail' => $params['email_addr'],
1699
+        'status' => 1,
1700
+        'init' => $params['email_addr'],
1701
+        'roles' => array($unrestricted_role => ''),
1702
+        'boincuser_name' => $params['user_name'],
1703 1703
     );
1704 1704
 
1705 1705
     // Create the drupal user. If the drupal user cannot be created,
@@ -1707,17 +1707,17 @@  discard block
 block discarded – undo
1707 1707
     // The user is created in the 'insert' op in hook_user.
1708 1708
     $user = user_save(null, $newUser);
1709 1709
     if (!$user) {
1710
-      watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING);
1711
-      xml_error(-137, 'error creating BOINC account');
1710
+        watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING);
1711
+        xml_error(-137, 'error creating BOINC account');
1712 1712
     }// if drupal user created.
1713 1713
 
1714 1714
     $output = array('authenticator' => $user->boincuser_account_key);
1715
-  }// if existing user found.
1715
+    }// if existing user found.
1716 1716
 
1717
-  // Output authenticator
1718
-  echo " <account_out>\n";
1719
-  echo "   <authenticator>{$output['authenticator']}</authenticator>\n";
1720
-  echo "</account_out>\n";
1717
+    // Output authenticator
1718
+    echo " <account_out>\n";
1719
+    echo "   <authenticator>{$output['authenticator']}</authenticator>\n";
1720
+    echo "</account_out>\n";
1721 1721
 }
1722 1722
 
1723 1723
 /**
@@ -1725,166 +1725,166 @@  discard block
 block discarded – undo
1725 1725
  * account is created using the BOINC clinet.
1726 1726
  */
1727 1727
 function boincuser_account_finish() {
1728
-  global $user;
1728
+    global $user;
1729 1729
 
1730
-  $authtoken = isset($_GET['auth']) ? $_GET['auth'] : '';
1730
+    $authtoken = isset($_GET['auth']) ? $_GET['auth'] : '';
1731 1731
 
1732
-  // Ensure there is a authentication token before continuing
1733
-  if (empty($authtoken)) {
1732
+    // Ensure there is a authentication token before continuing
1733
+    if (empty($authtoken)) {
1734 1734
     drupal_not_found();
1735 1735
     return ;
1736
-  }
1736
+    }
1737 1737
 
1738
-  if (strlen($authtoken) != 32) {
1738
+    if (strlen($authtoken) != 32) {
1739 1739
     drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error');
1740 1740
     drupal_goto();
1741
-  }
1741
+    }
1742 1742
 
1743
-  require_boinc('boinc_db');
1744
-  $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'");
1745
-  if (!$boinc_user) {
1743
+    require_boinc('boinc_db');
1744
+    $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'");
1745
+    if (!$boinc_user) {
1746 1746
     drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error');
1747 1747
     drupal_goto();
1748
-  }
1749
-  $user = user_load(get_drupal_id($boinc_user->id));
1748
+    }
1749
+    $user = user_load(get_drupal_id($boinc_user->id));
1750 1750
 
1751
-  if (!$user) {
1751
+    if (!$user) {
1752 1752
     drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), NULL, 'boinc:account-finish'), 'error');
1753 1753
     drupal_goto();
1754
-  }
1754
+    }
1755 1755
 
1756
-  // Lookup path to custom account finish page
1757
-  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') );
1758
-  if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) {
1756
+    // Lookup path to custom account finish page
1757
+    $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') );
1758
+    if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) {
1759 1759
     $node = menu_get_object('node', 1, $customaccountfinishpath);
1760 1760
     if ($node) {
1761
-      return node_page_view($node);
1761
+        return node_page_view($node);
1762
+    }
1762 1763
     }
1763
-  }
1764 1764
 
1765
-  // open links in new window
1766
-  $options = array(
1765
+    // open links in new window
1766
+    $options = array(
1767 1767
     'attributes' => array( 'target' => '_blank' ),
1768
-  );
1768
+    );
1769 1769
 
1770
-  // Check moderation page exists
1771
-  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') );
1772
-  if ( menu_valid_path(array('link_path' => $moderationpath)) ) {
1770
+    // Check moderation page exists
1771
+    $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') );
1772
+    if ( menu_valid_path(array('link_path' => $moderationpath)) ) {
1773 1773
     $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish');
1774
-  } else {
1774
+    } else {
1775 1775
     $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish');
1776
-  }
1776
+    }
1777 1777
 
1778
-  $username = $user->boincuser_name;
1779
-  $site_name = variable_get('site_name', 'Drupal-BOINC');
1780
-  $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)',
1781
-  array(
1778
+    $username = $user->boincuser_name;
1779
+    $site_name = variable_get('site_name', 'Drupal-BOINC');
1780
+    $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)',
1781
+    array(
1782 1782
     '@user_name' => $username,
1783 1783
     '@site_name' => $site_name,
1784
-  ), NULL, 'boinc:account-finish') . "</p>";
1784
+    ), NULL, 'boinc:account-finish') . "</p>";
1785 1785
 
1786
-  $links = array(
1786
+    $links = array(
1787 1787
     array(
1788
-      'data' => bts('Change your username at !community_preferences.', array(
1788
+        'data' => bts('Change your username at !community_preferences.', array(
1789 1789
         '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options),
1790
-      ), NULL, 'boinc:account-finish'),
1791
-      'children' => array(
1790
+        ), NULL, 'boinc:account-finish'),
1791
+        'children' => array(
1792 1792
         bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'),
1793 1793
         bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'),
1794
-      ),
1794
+        ),
1795 1795
     ),
1796 1796
     array(
1797
-      'data' => bts('Change your !computing_preferences.', array(
1797
+        'data' => bts('Change your !computing_preferences.', array(
1798 1798
         '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options),
1799
-      ), NULL, 'boinc:account-finish'),
1800
-      'children' => array(
1799
+        ), NULL, 'boinc:account-finish'),
1800
+        'children' => array(
1801 1801
         bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), NULL, 'boinc:account-finish'),
1802 1802
         bts('By default, you will run @site_name tasks without any additional configuration.', array(
1803
-          '@site_name' => $site_name,
1803
+            '@site_name' => $site_name,
1804 1804
         ), NULL, 'boinc:account-finish'),
1805 1805
         bts('It is recommended new volunteers leave the default settings until they gain experience running some tasks. Ask questions in the !forums to get advice before making changes to a setting you don\'t understand.', array(
1806
-          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options),
1806
+            '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options),
1807 1807
         ), NULL, 'boinc:account-finish'),
1808
-      ),
1808
+        ),
1809 1809
     ),
1810 1810
     array(
1811 1811
         'data' => bts('Create a !user_profile.', array(
1812
-          '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options),
1812
+            '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options),
1813 1813
         ), NULL, 'boinc:account-finish'),
1814
-      'children' => array(
1814
+        'children' => array(
1815 1815
         bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array(
1816
-          '@site_name' => $site_name,
1816
+            '@site_name' => $site_name,
1817 1817
         ), NULL, 'boinc:account-finish'),
1818 1818
         $modsentence,
1819
-      ),
1819
+        ),
1820 1820
     ),
1821 1821
     array(
1822
-      'data' => bts('Join a !team.', array(
1822
+        'data' => bts('Join a !team.', array(
1823 1823
         '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options),
1824
-      ), NULL, 'boinc:account-finish'),
1825
-      'children' => array(
1824
+        ), NULL, 'boinc:account-finish'),
1825
+        'children' => array(
1826 1826
         bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'),
1827
-      ),
1827
+        ),
1828 1828
     ),
1829 1829
     array(
1830
-      'data' => bts('Go to your !account_dashboard.', array(
1830
+        'data' => bts('Go to your !account_dashboard.', array(
1831 1831
         '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options),
1832
-      ), NULL, 'boinc:account-finish'),
1833
-      'children' => array(
1832
+        ), NULL, 'boinc:account-finish'),
1833
+        'children' => array(
1834 1834
         bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'),
1835
-      ),
1835
+        ),
1836 1836
     ),
1837 1837
     array(
1838
-      'data' => bts('Visit our !help pages.', array(
1838
+        'data' => bts('Visit our !help pages.', array(
1839 1839
         '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options)
1840
-      ), NULL, 'boinc:account-finish'),
1841
-      'children' => array(
1840
+        ), NULL, 'boinc:account-finish'),
1841
+        'children' => array(
1842 1842
         bts('Ask for help in our community\'s !forums.', array(
1843
-          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options)
1843
+            '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options)
1844 1844
         ), NULL, 'boinc:account-finish'),
1845
-      ),
1845
+        ),
1846 1846
     ),
1847
-  );
1847
+    );
1848 1848
 
1849
-  //List of links
1850
-  $output .= theme_item_list($links, $title = NULL, $type='ul');
1849
+    //List of links
1850
+    $output .= theme_item_list($links, $title = NULL, $type='ul');
1851 1851
 
1852
-  return $output;
1852
+    return $output;
1853 1853
 }
1854 1854
 
1855 1855
 /**
1856 1856
  * Determine if the user has permission to control community access
1857 1857
  */
1858 1858
 function boincuser_moderate_community_access() {
1859
-  if (user_access('assign community member role')
1859
+    if (user_access('assign community member role')
1860 1860
   OR user_access('assign all roles')) {
1861 1861
     return TRUE;
1862
-  }
1863
-  return FALSE;
1862
+    }
1863
+    return FALSE;
1864 1864
 }
1865 1865
 
1866 1866
 /**
1867 1867
  * Get the count of items in the moderation queue
1868 1868
  */
1869 1869
 function boincuser_moderation_queue_count($caller = 'user') {
1870
-  $allowed = FALSE;
1871
-  switch ($caller) {
1872
-  case 'cron':
1870
+    $allowed = FALSE;
1871
+    switch ($caller) {
1872
+    case 'cron':
1873 1873
     $allowed = TRUE;
1874 1874
     break;
1875
-  case 'user':
1875
+    case 'user':
1876 1876
   default:
1877 1877
     $allowed = user_access('edit any profile content');
1878
-  }
1879
-  if ($allowed) {
1878
+    }
1879
+    if ($allowed) {
1880 1880
     return db_result(db_query("
1881 1881
       SELECT COUNT(*)
1882 1882
       FROM {node}
1883 1883
       WHERE type = 'profile'
1884 1884
       AND moderate = 1"
1885 1885
     ));
1886
-  }
1887
-  return NULL;
1886
+    }
1887
+    return NULL;
1888 1888
 }
1889 1889
 
1890 1890
 /**
@@ -1893,43 +1893,43 @@  discard block
 block discarded – undo
1893 1893
  * than through the user account info form.
1894 1894
  */
1895 1895
 function boincuser_control($uid = NULL, $action = NULL) {
1896
-  if (!$uid OR !$account = user_load($uid)) {
1896
+    if (!$uid OR !$account = user_load($uid)) {
1897 1897
     // What are you even doing here...
1898 1898
     return FALSE;
1899
-  }
1900
-  switch ($action) {
1901
-  case 'ban':
1899
+    }
1900
+    switch ($action) {
1901
+    case 'ban':
1902 1902
     if (boincuser_moderate_community_access()) {
1903
-      $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
1904
-      $boincuser_record = array(
1903
+        $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
1904
+        $boincuser_record = array(
1905 1905
         'uid' => $uid,
1906 1906
         'penalty_expiration' => time() + $penalty_period,
1907
-      );
1908
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
1909
-      $community_role = array_search('community member', user_roles(true));
1910
-      if (isset($account->roles[$community_role])) {
1907
+        );
1908
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
1909
+        $community_role = array_search('community member', user_roles(true));
1910
+        if (isset($account->roles[$community_role])) {
1911 1911
         unset($account->roles[$community_role]);
1912 1912
         user_save($account, array('roles' => $account->roles));
1913
-      }
1913
+        }
1914 1914
     }
1915 1915
     break;
1916
-  case 'lift-ban':
1916
+    case 'lift-ban':
1917 1917
     if (boincuser_moderate_community_access()) {
1918
-      $boincuser_record = array(
1918
+        $boincuser_record = array(
1919 1919
         'uid' => $uid,
1920 1920
         'penalty_expiration' => 0,
1921
-      );
1922
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
1923
-      $community_role = array_search('community member', user_roles(true));
1924
-      if (!isset($account->roles[$community_role])) {
1921
+        );
1922
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
1923
+        $community_role = array_search('community member', user_roles(true));
1924
+        if (!isset($account->roles[$community_role])) {
1925 1925
         $account->roles[$community_role] = 'community member';
1926 1926
         user_save($account, array('roles' => $account->roles));
1927
-      }
1927
+        }
1928 1928
     }
1929 1929
     break;
1930
-  default:
1930
+    default:
1931 1931
   }
1932
-  drupal_goto("account/{$account->uid}");
1932
+    drupal_goto("account/{$account->uid}");
1933 1933
 }
1934 1934
 
1935 1935
 /**
@@ -1937,29 +1937,29 @@  discard block
 block discarded – undo
1937 1937
  * moderation flag.
1938 1938
  */
1939 1939
 function boincuser_moderate_profile_approve($account) {
1940
-  $node = new stdClass;
1941
-  $node->type = 'profile';
1942
-  $node->language = '';
1943
-  $nid = content_profile_profile_exists($node, $account->uid);
1944
-  $profile = node_load($nid);
1945
-  $profile->moderate = 0;
1946
-  $profile->status = 1;
1947
-  node_save($profile);
1948
-  drupal_set_message('This profile has been marked as approved.');
1949
-  drupal_goto();
1940
+    $node = new stdClass;
1941
+    $node->type = 'profile';
1942
+    $node->language = '';
1943
+    $nid = content_profile_profile_exists($node, $account->uid);
1944
+    $profile = node_load($nid);
1945
+    $profile->moderate = 0;
1946
+    $profile->status = 1;
1947
+    node_save($profile);
1948
+    drupal_set_message('This profile has been marked as approved.');
1949
+    drupal_goto();
1950 1950
 }
1951 1951
 
1952 1952
 /**
1953 1953
  * Mark a user profile as rejected and notify the user of the reason.
1954 1954
  */
1955 1955
 function boincuser_moderate_profile_reject($uid, $reason = '') {
1956
-  $account = user_load($uid);
1957
-  $node = new stdClass;
1958
-  $node->type = 'profile';
1959
-  $node->language = '';
1960
-  $nid = content_profile_profile_exists($node, $uid);
1961
-  $profile = node_load($nid);
1962
-  if ($profile->nid) {
1956
+    $account = user_load($uid);
1957
+    $node = new stdClass;
1958
+    $node->type = 'profile';
1959
+    $node->language = '';
1960
+    $nid = content_profile_profile_exists($node, $uid);
1961
+    $profile = node_load($nid);
1962
+    if ($profile->nid) {
1963 1963
     global $user;
1964 1964
     global $base_url;
1965 1965
     global $base_path;
@@ -1970,64 +1970,64 @@  discard block
 block discarded – undo
1970 1970
     $profile->status = 0;
1971 1971
     node_save($profile);
1972 1972
     $settings = array(
1973
-      'from' => '',
1974
-      'subject' => "Profile moderation at {$site_name}",
1975
-      'message' => ''
1976
-      . "{$account->boincuser_name},\n"
1977
-      . "\n"
1978
-      . "{$moderator->boincuser_name} has rejected your profile at"
1979
-      . " {$site_name} for the following reason: \n"
1980
-      . "\n"
1981
-      . "{$reason}\n"
1982
-      . "\n"
1983
-      . "\n"
1984
-      . "Since it has not been approved, your profile is not visible to other"
1985
-      . " {$site_name} users. Please make the needed changes here:\n"
1986
-      . "\n"
1987
-      . "{$site_url}account/profile \n"
1988
-      . "\n"
1989
-      . "Thanks, \n"
1990
-      . "\n"
1991
-      . "{$site_name} support team",
1973
+        'from' => '',
1974
+        'subject' => "Profile moderation at {$site_name}",
1975
+        'message' => ''
1976
+        . "{$account->boincuser_name},\n"
1977
+        . "\n"
1978
+        . "{$moderator->boincuser_name} has rejected your profile at"
1979
+        . " {$site_name} for the following reason: \n"
1980
+        . "\n"
1981
+        . "{$reason}\n"
1982
+        . "\n"
1983
+        . "\n"
1984
+        . "Since it has not been approved, your profile is not visible to other"
1985
+        . " {$site_name} users. Please make the needed changes here:\n"
1986
+        . "\n"
1987
+        . "{$site_url}account/profile \n"
1988
+        . "\n"
1989
+        . "Thanks, \n"
1990
+        . "\n"
1991
+        . "{$site_name} support team",
1992 1992
     );
1993 1993
     rules_action_mail_to_user($account, $settings);
1994 1994
     drupal_set_message('This profile has been marked as rejected.');
1995
-  }
1996
-  drupal_goto();
1995
+    }
1996
+    drupal_goto();
1997 1997
 }
1998 1998
 
1999 1999
 /**
2000 2000
  * Ban a user and send a notification of the reason.
2001 2001
  */
2002 2002
 function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') {
2003
-  if (user_access('assign community member role')
2003
+    if (user_access('assign community member role')
2004 2004
   OR user_access('assign all roles')) {
2005 2005
     $account = user_load($uid);
2006 2006
     if ($account->uid) {
2007
-      module_load_include('inc', 'rules', 'modules/system.rules');
2008
-      if ($duration === '') {
2007
+        module_load_include('inc', 'rules', 'modules/system.rules');
2008
+        if ($duration === '') {
2009 2009
         $duration = variable_get('boinc_penalty_period', 7*24*60*60);
2010
-      }
2011
-      $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;
2012
-      $boincuser_record = array(
2010
+        }
2011
+        $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;
2012
+        $boincuser_record = array(
2013 2013
         'uid' => $uid,
2014 2014
         'penalty_expiration' => $penalty_expiration,
2015
-      );
2016
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
2015
+        );
2016
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
2017 2017
       
2018
-      $community_role = array_search('community member', user_roles(true));
2019
-      if (isset($account->roles[$community_role])) {
2018
+        $community_role = array_search('community member', user_roles(true));
2019
+        if (isset($account->roles[$community_role])) {
2020 2020
         unset($account->roles[$community_role]);
2021 2021
         user_save($account, array('roles' => $account->roles));
2022
-      }
2022
+        }
2023 2023
       
2024
-      global $user;
2025
-      global $base_url;
2026
-      global $base_path;
2027
-      $site_name = variable_get('site_name', 'Drupal-BOINC');
2028
-      $site_url = $base_url . $base_path;
2029
-      $moderator = user_load($user->uid);
2030
-      $settings = array(
2024
+        global $user;
2025
+        global $base_url;
2026
+        global $base_path;
2027
+        $site_name = variable_get('site_name', 'Drupal-BOINC');
2028
+        $site_url = $base_url . $base_path;
2029
+        $moderator = user_load($user->uid);
2030
+        $settings = array(
2031 2031
         'from' => '',
2032 2032
         'subject' => "User moderation at {$site_name}",
2033 2033
         'message' => ''
@@ -2048,12 +2048,12 @@  discard block
 block discarded – undo
2048 2048
         . "Thanks, \n"
2049 2049
         . "\n"
2050 2050
         . "{$site_name} support team",
2051
-      );
2052
-      rules_action_mail_to_user($account, $settings);
2053
-      drupal_set_message('This user has been banned.');
2051
+        );
2052
+        rules_action_mail_to_user($account, $settings);
2053
+        drupal_set_message('This user has been banned.');
2054 2054
     }
2055
-  }
2056
-  drupal_goto();
2055
+    }
2056
+    drupal_goto();
2057 2057
 }
2058 2058
 
2059 2059
 
@@ -2065,15 +2065,15 @@  discard block
 block discarded – undo
2065 2065
  *
2066 2066
  */
2067 2067
 function boincuser_get_weak_auth($boinc_id = null) {
2068
-  if (!$boinc_id) {
2068
+    if (!$boinc_id) {
2069 2069
     global $user;
2070 2070
     $account = user_load($user->uid);
2071 2071
     $boinc_id = $account->boincuser_id;
2072
-  }
2072
+    }
2073 2073
   
2074
-  $boinc_user = boincuser_load($account->boincuser_id);
2074
+    $boinc_user = boincuser_load($account->boincuser_id);
2075 2075
   
2076
-  return weak_auth($boinc_user);
2076
+    return weak_auth($boinc_user);
2077 2077
 }
2078 2078
 
2079 2079
 /**
@@ -2082,75 +2082,75 @@  discard block
 block discarded – undo
2082 2082
  * Drupal User so must be inserted into comments, etc. (not so by default)
2083 2083
  */
2084 2084
 function boincuser_get_user_profile_image($uid, $avatar = TRUE) {
2085
-  // Though the function name implies otherwise, get the avatar by default
2086
-  $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';
2087
-  $image_fid = db_result(db_query("
2085
+    // Though the function name implies otherwise, get the avatar by default
2086
+    $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';
2087
+    $image_fid = db_result(db_query("
2088 2088
     SELECT ctp.%s
2089 2089
     FROM {content_type_profile} ctp
2090 2090
     INNER JOIN {node} n ON ctp.nid = n.nid
2091 2091
     WHERE n.uid = %d AND n.type = '%s'",
2092 2092
     $image_field, $uid, 'profile'));
2093
-  $user_image['image'] = field_file_load($image_fid);
2094
-  if (!$user_image['image']['filepath']) {
2093
+    $user_image['image'] = field_file_load($image_fid);
2094
+    if (!$user_image['image']['filepath']) {
2095 2095
     // Load the default image if one does not exist
2096 2096
     $account = user_load($uid);
2097 2097
     if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) {
2098
-      // Use a Gravatar rather than the system default image
2099
-      $options = array(
2098
+        // Use a Gravatar rather than the system default image
2099
+        $options = array(
2100 2100
         'size' => 100,
2101 2101
         'rating' => 'G',
2102
-      );
2103
-      // Get the Gravatar URL and see if the image exists
2104
-      $url = gravatar_get_gravatar($account->mail, $options);
2105
-      $headers = @get_headers($url);
2106
-      if (preg_match("|200|", $headers[0])) {
2102
+        );
2103
+        // Get the Gravatar URL and see if the image exists
2104
+        $url = gravatar_get_gravatar($account->mail, $options);
2105
+        $headers = @get_headers($url);
2106
+        if (preg_match("|200|", $headers[0])) {
2107 2107
         return $url;
2108
-      }
2108
+        }
2109 2109
     }
2110 2110
     // Get default image if nothing else works
2111 2111
     $content_node_widget_settings = db_result(db_query("SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = '%s'", ($avatar ? 'field_image' : 'field_profile_image')));
2112 2112
     $content_node_widget_settings = unserialize($content_node_widget_settings);
2113 2113
     $user_image['image'] = $content_node_widget_settings['default_image'];
2114
-  }
2115
-  $user = user_load($uid);
2116
-  // Use boinc username for image alt/title attributes
2117
-  $user_image['alt'] = $user->boincuser_name;
2118
-  return $user_image;
2114
+    }
2115
+    $user = user_load($uid);
2116
+    // Use boinc username for image alt/title attributes
2117
+    $user_image['alt'] = $user->boincuser_name;
2118
+    return $user_image;
2119 2119
 }
2120 2120
 
2121 2121
 /**
2122 2122
  * Generate a table of a user's projects
2123 2123
  */
2124 2124
 function boincuser_get_projects_table($account = null) {
2125
-  if ($account AND is_numeric($account)) {
2125
+    if ($account AND is_numeric($account)) {
2126 2126
     $account = user_load($account);
2127
-  }
2128
-  $projects = boincuser_get_projects($account);
2129
-  if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard');
2127
+    }
2128
+    $projects = boincuser_get_projects($account);
2129
+    if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard');
2130 2130
   
2131
-  $output = '';
2132
-  $output .= '<table class="user-projects">' . "\n";
2133
-  $output .= '<thead>' . "\n";
2134
-  $output .= '  <tr>' . "\n";
2135
-  $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n";
2136
-  $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n";
2137
-  $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n";
2138
-  $output .= '  </tr>' . "\n";
2139
-  $output .= '</thead>' . "\n";
2140
-  $output .= '<tbody>' . "\n";
2141
-  foreach ($projects AS $project) {
2131
+    $output = '';
2132
+    $output .= '<table class="user-projects">' . "\n";
2133
+    $output .= '<thead>' . "\n";
2134
+    $output .= '  <tr>' . "\n";
2135
+    $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n";
2136
+    $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n";
2137
+    $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n";
2138
+    $output .= '  </tr>' . "\n";
2139
+    $output .= '</thead>' . "\n";
2140
+    $output .= '<tbody>' . "\n";
2141
+    foreach ($projects AS $project) {
2142 2142
     $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;
2143 2143
     $output .= '  <tr>' . "\n";
2144 2144
     $output .= '    <td>' . l($project->name, $url) . '</td>' . "\n";
2145 2145
     $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; 
2146 2146
     $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";
2147 2147
     $output .= '  </tr>' . "\n";
2148
-  }
2149
-  $output .= '</tbody>' . "\n";
2150
-  $output .= '</table>' . "\n";
2151
-  $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
2152
-  //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
2153
-  return $output;
2148
+    }
2149
+    $output .= '</tbody>' . "\n";
2150
+    $output .= '</table>' . "\n";
2151
+    $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
2152
+    //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
2153
+    return $output;
2154 2154
 }
2155 2155
 
2156 2156
 /**
@@ -2158,25 +2158,25 @@  discard block
 block discarded – undo
2158 2158
  */
2159 2159
 function boincuser_get_stats_user_data($cpid = null) {
2160 2160
   
2161
-  // [TODO] Set this stuff in site config!
2162
-  $stats_server = 'stats.gridrepublic.org';
2163
-  $stats_rpc = 'rpc/get_user.php';
2161
+    // [TODO] Set this stuff in site config!
2162
+    $stats_server = 'stats.gridrepublic.org';
2163
+    $stats_rpc = 'rpc/get_user.php';
2164 2164
   
2165
-  // Construct query string
2166
-  $get = array(
2165
+    // Construct query string
2166
+    $get = array(
2167 2167
     'cpid' => $cpid
2168
-  );
2169
-  $args = array();
2170
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
2171
-  $query = '?' . implode('&', $args);
2168
+    );
2169
+    $args = array();
2170
+    foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
2171
+    $query = '?' . implode('&', $args);
2172 2172
   
2173
-  // Load XML from RPC
2174
-  $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
2175
-  $result = drupal_http_request($target_url);
2176
-  if (in_array($result->code, array(200, 304))) {
2173
+    // Load XML from RPC
2174
+    $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
2175
+    $result = drupal_http_request($target_url);
2176
+    if (in_array($result->code, array(200, 304))) {
2177 2177
     return simplexml_load_string($result->data);
2178
-  }
2179
-  return NULL;
2178
+    }
2179
+    return NULL;
2180 2180
 }
2181 2181
 
2182 2182
 /**
@@ -2184,15 +2184,15 @@  discard block
 block discarded – undo
2184 2184
  */
2185 2185
 function boincuser_get_projects($account = null) {
2186 2186
   
2187
-  // Use the current user by default
2188
-  if (!$account) {
2187
+    // Use the current user by default
2188
+    if (!$account) {
2189 2189
     global $user;
2190 2190
     $account = user_load($user->uid);
2191
-  }
2191
+    }
2192 2192
   
2193
-  $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);
2193
+    $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);
2194 2194
   
2195
-  return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;
2195
+    return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;
2196 2196
 }
2197 2197
 
2198 2198
 
@@ -2200,11 +2200,11 @@  discard block
 block discarded – undo
2200 2200
  * Get the links to display under the user profile
2201 2201
  */
2202 2202
 function boincuser_get_profile_links($uid) {
2203
-  global $user;
2204
-  $account = user_load($uid);
2205
-  $profile = content_profile_load('profile', $account->uid);
2206
-  $output = '';
2207
-  if ($profile) {
2203
+    global $user;
2204
+    $account = user_load($uid);
2205
+    $profile = content_profile_load('profile', $account->uid);
2206
+    $output = '';
2207
+    if ($profile) {
2208 2208
     $profile_is_approved = ($profile->status AND !$profile->moderate);
2209 2209
     $user_is_moderator = user_access('edit any profile content');
2210 2210
     $is_own_profile = ($user->uid == $account->uid);
@@ -2212,15 +2212,15 @@  discard block
 block discarded – undo
2212 2212
     $links = array();
2213 2213
     
2214 2214
     if ($profile->moderate AND $user_is_moderator) {
2215
-      $links['approve_profile'] = array(
2215
+        $links['approve_profile'] = array(
2216 2216
         'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'),
2217 2217
         'href' => "{$profile_moderation_path}/approve",
2218 2218
         'attributes' => array(
2219
-          'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'),
2220
-          'class' => 'first primary tab',
2219
+            'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'),
2220
+            'class' => 'first primary tab',
2221 2221
         )
2222
-      );
2223
-      /*$links['edit_profile'] = array(
2222
+        );
2223
+        /*$links['edit_profile'] = array(
2224 2224
         'title' => bts('Edit profile', array(), NULL, 'boinc:moderate-user'),
2225 2225
         'href' => "{$profile_moderation_path}/edit",
2226 2226
         'attributes' => array(
@@ -2228,27 +2228,27 @@  discard block
 block discarded – undo
2228 2228
           'class' => 'tab',
2229 2229
         )
2230 2230
       );*/
2231
-      $links['reject_profile'] = array(
2231
+        $links['reject_profile'] = array(
2232 2232
         'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'),
2233 2233
         'href' => "{$profile_moderation_path}/reject",
2234 2234
         'attributes' => array(
2235
-          'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'),
2236
-          'class' => 'tab',
2235
+            'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'),
2236
+            'class' => 'tab',
2237 2237
         )
2238
-      );
2238
+        );
2239 2239
     }
2240 2240
     $output .= '<ul class="tab-list">';
2241 2241
     $count = 0;
2242 2242
     foreach ($links as $key => $link) {
2243
-      $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
2244
-      $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
2245
-      $output .= '</li>';
2246
-      $count++;
2243
+        $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
2244
+        $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
2245
+        $output .= '</li>';
2246
+        $count++;
2247 2247
     }
2248 2248
     $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user', $account->uid) . '</li>';
2249 2249
     $output .= '</ul>';
2250
-  }
2251
-  return $output;
2250
+    }
2251
+    return $output;
2252 2252
 /*
2253 2253
 <ul class="tab-list">
2254 2254
   <li class="primary first tab">
@@ -2285,36 +2285,36 @@  discard block
 block discarded – undo
2285 2285
  */
2286 2286
 function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
2287 2287
 
2288
-  foreach ($documents as $document) {
2288
+    foreach ($documents as $document) {
2289 2289
     if ( $document->entity_type=='node' AND $document->bundle=='profile' ) {
2290
-      // Node information.
2291
-      $nid = $document->entity_id;
2292
-      $node = node_load($nid);
2293
-      $account = user_load($node->uid);
2294
-
2295
-      // Use boincuser name and not drupal user name
2296
-      $document->label = apachesolr_clean_text($account->boincuser_name);
2297
-      // Author information
2298
-      if ($node->uid == 0 || strlen($node->name) == 0) {
2290
+        // Node information.
2291
+        $nid = $document->entity_id;
2292
+        $node = node_load($nid);
2293
+        $account = user_load($node->uid);
2294
+
2295
+        // Use boincuser name and not drupal user name
2296
+        $document->label = apachesolr_clean_text($account->boincuser_name);
2297
+        // Author information
2298
+        if ($node->uid == 0 || strlen($node->name) == 0) {
2299 2299
         // @see user_validate_name(). !'0' === TRUE.
2300 2300
         $document->ss_name = '0';
2301
-      }
2302
-      else {
2301
+        }
2302
+        else {
2303 2303
         $document->ss_name = $account->boincuser_name;
2304 2304
         // We want the name to be searchable for keywords.
2305 2305
         $document->tos_name = $account->boincuser_name;
2306
-      }
2306
+        }
2307 2307
 
2308
-      // Rename "Profle" to "User"
2309
-      $document->bundle = "User";
2310
-      $document->bundle_name = "User";
2308
+        // Rename "Profle" to "User"
2309
+        $document->bundle = "User";
2310
+        $document->bundle_name = "User";
2311 2311
 
2312
-      // Replace the Solr document's created field with the date the user 
2313
-      // account was created. This replaces the node creation date typically 
2314
-      // used for indexing nodes.
2315
-      $document->ds_created = apachesolr_date_iso($account->created);
2312
+        // Replace the Solr document's created field with the date the user 
2313
+        // account was created. This replaces the node creation date typically 
2314
+        // used for indexing nodes.
2315
+        $document->ds_created = apachesolr_date_iso($account->created);
2316
+    }
2316 2317
     }
2317
-  }
2318 2318
 
2319 2319
 }
2320 2320
 
@@ -2326,23 +2326,23 @@  discard block
 block discarded – undo
2326 2326
  * Implementation of hook_privatemsg_name_lookup();
2327 2327
  */
2328 2328
 function boincuser_privatemsg_name_lookup($string) {
2329
-  // Get the BOINC ID from the name string, and lookup the
2330
-  // corresponding drupal user.
2331
-  $boincname = substr($string, 0, strrpos($string, '_'));
2332
-  $boincid = substr($string, strrpos($string, '_') + 1);
2333
-  $drupalid = get_drupal_id($boincid);
2334
-
2335
-  // Name has spaced replaced with special UTF-8 characters in
2336
-  // privatemsg module. We need to convert them back to spaces for the
2337
-  // check below.
2338
-  $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname);
2339
-  if ($drupalid>0) {
2329
+    // Get the BOINC ID from the name string, and lookup the
2330
+    // corresponding drupal user.
2331
+    $boincname = substr($string, 0, strrpos($string, '_'));
2332
+    $boincid = substr($string, strrpos($string, '_') + 1);
2333
+    $drupalid = get_drupal_id($boincid);
2334
+
2335
+    // Name has spaced replaced with special UTF-8 characters in
2336
+    // privatemsg module. We need to convert them back to spaces for the
2337
+    // check below.
2338
+    $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname);
2339
+    if ($drupalid>0) {
2340 2340
     if ($recipient = user_load(array('uid' => $drupalid))) {
2341
-      // Double-check that the loaded user matches both boincuser_id
2342
-      // and boincuser_name.
2343
-      if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) {
2341
+        // Double-check that the loaded user matches both boincuser_id
2342
+        // and boincuser_name.
2343
+        if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) {
2344 2344
         return $recipient;
2345
-      }
2345
+        }
2346
+    }
2346 2347
     }
2347
-  }
2348 2348
 }
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     'type' => MENU_CALLBACK
190 190
   );
191 191
   $items['account_finish.php'] = array(
192
-    'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'),
192
+    'title' => 'Welcome to '.variable_get('site_name', 'Drupal-BOINC'),
193 193
     'description' => 'RPC for after a user has created an account.',
194 194
     'page callback' => 'boincuser_account_finish',
195 195
     'access callback' => TRUE,
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
   // termsofuse is enabled, by having text in the termsofuse variable.
250 250
   $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
251 251
   $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
252
-  if ( (!empty($termsofuse)) and ($user->uid) ) {
253
-    if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) {
252
+  if ((!empty($termsofuse)) and ($user->uid)) {
253
+    if (!boincuser_check_termsofuse($user) and ($existinguser_tou)) {
254 254
 
255 255
       // Admins are exempt, otherwise the admin may not be able to
256 256
       // access the site!
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
           'privacy',
268 268
           'moderation',
269 269
           'account/info/edit',
270
-          'user/' . $user->uid . '/edit',
271
-          'user/' . $user->uid . '/recoveremail/*',
270
+          'user/'.$user->uid.'/edit',
271
+          'user/'.$user->uid.'/recoveremail/*',
272 272
           'recover_email.php',
273 273
         );
274 274
         if (module_exists('boincuser_delete')) {
275
-          $paths_to_ignore[] = 'user/' . $user->uid . '/delete';
276
-          $paths_to_ignore[] = 'user/' . $user->uid . '/deleteconfirm/*';
277
-          $paths_to_ignore[] = 'user/' . $user->uid . '/odeleteconfirm/*';
275
+          $paths_to_ignore[] = 'user/'.$user->uid.'/delete';
276
+          $paths_to_ignore[] = 'user/'.$user->uid.'/deleteconfirm/*';
277
+          $paths_to_ignore[] = 'user/'.$user->uid.'/odeleteconfirm/*';
278 278
         }
279 279
         if (!_boincuser_ignore_paths($path, $paths_to_ignore)) {
280 280
           drupal_goto('user/termsofuse');
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
   require_boinc('password_compat/password');
297 297
   // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
298 298
   if ($account->uid > 1) {
299
-    switch($op) {
299
+    switch ($op) {
300 300
     case 'load':
301 301
       // User loading; insert BOINC data into the user object
302 302
       $drupal_user = db_fetch_object(db_query("
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
       ));
327 327
       $account->boincuser_name = $boinc_user->name;
328 328
       $account->boincuser_account_key = $boinc_user->authenticator;
329
-      $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
329
+      $account->boincuser_weak_auth = md5($boinc_user->authenticator.$boinc_user->passwd_hash);
330 330
       $account->boincuser_total_credit = round($boinc_user->total_credit);
331 331
       $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
332 332
       $account->boincuser_expavg_time = round($boinc_user->expavg_time);
333
-      $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
333
+      $account->boincuser_cpid = md5($boinc_user->cross_project_id.$account->mail);
334 334
       $account->boincuser_default_pref_set = $boinc_user->venue;
335 335
       $account->boincteam_id = $boinc_user->teamid;
336 336
       $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr;
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         $user_params = array(
427 427
           'email_addr' => $edit['mail'],
428 428
           'name' => $myname,
429
-          'passwd_hash' => password_hash( md5($edit['pass'].$edit['mail']) , PASSWORD_DEFAULT ),
429
+          'passwd_hash' => password_hash(md5($edit['pass'].$edit['mail']), PASSWORD_DEFAULT),
430 430
         );
431 431
         $boinc_user = boincuser_register_make_user($user_params);
432 432
         if (!$boinc_user) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
           if ($changing_email OR $changing_pass) {
478 478
             // Set password hash appropriately
479 479
             $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
480
-            $passwd_hash = password_hash( md5($passwd.$edit['mail']), PASSWORD_DEFAULT );
480
+            $passwd_hash = password_hash(md5($passwd.$edit['mail']), PASSWORD_DEFAULT);
481 481
             $email_addr = $edit['mail'];
482 482
 
483 483
             // Algorithm for changing email and/or password
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
   }
562 562
 
563 563
   // Check if user has agreed to terms of use.
564
-  if ( (!empty($termsofuse)) and ($account->uid) and 
565
-       (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) {
564
+  if ((!empty($termsofuse)) and ($account->uid) and 
565
+       (!boincuser_check_termsofuse($account)) and ($existinguser_tou)) {
566 566
 
567 567
     // Admins are exempted.
568 568
     $administrator_role = array_search('administrator', user_roles(true));
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
       $query_for_destination = '';
577 577
       $prevdest = $_REQUEST['destination'];
578 578
       if ($prevdest) {
579
-        $query_for_destination = '?destination=' . $prevdest;
579
+        $query_for_destination = '?destination='.$prevdest;
580 580
       }
581
-      $_REQUEST['destination'] = $path_for_destination . $query_for_destination;
581
+      $_REQUEST['destination'] = $path_for_destination.$query_for_destination;
582 582
 
583 583
     }
584 584
   }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
   // In Drupal 7, these operation cases will all exist as their own hooks,
612 612
   // so let's approximate that here so that this function can simply be removed
613 613
   // upon migration to 7
614
-  switch($op) {
614
+  switch ($op) {
615 615
   case 'update':
616 616
     boincuser_node_update($node);
617 617
   }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
  * is updated (forward compatible to Drupal 7)
623 623
  */
624 624
 function boincuser_node_update($node) {
625
-  switch($node->type) {
625
+  switch ($node->type) {
626 626
   case 'profile':
627 627
     // Update the BOINC database directly
628 628
     $account = user_load($node->uid);
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
     }
745 745
     
746 746
     $form['cancel'] = array(
747
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>',
747
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest).'</li>',
748 748
       '#weight' => 1004,
749 749
     );
750 750
     $form['form control tabs suffix'] = array(
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
778 778
     $form['buttons']['preview_changes']['#weight'] = 1004;
779 779
     $form['buttons']['cancel'] = array(
780
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>',
780
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>',
781 781
       '#weight' => 1005,
782 782
     );
783 783
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     $form['actions']['submit']['#suffix'] = '</li>';
810 810
     $form['actions']['submit']['#weight'] = 1002;
811 811
     $form['actions']['cancel'] = array(
812
-        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>',
812
+        '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>',
813 813
       '#weight' => 1005,
814 814
     );
815 815
     $form['actions']['form control tabs suffix'] = array(
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
     $form['privatemsg']['preview']['#suffix'] = '</li>';
837 837
     $form['privatemsg']['preview']['#weight'] = 1003;
838 838
     $form['privatemsg']['cancel'] = array(
839
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
839
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>',
840 840
       '#weight' => 1004,
841 841
     );
842 842
     $form['privatemsg']['form control tabs suffix'] = array(
@@ -924,11 +924,11 @@  discard block
 block discarded – undo
924 924
     // Set special message if user has not agreed to TOU
925 925
     $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE);
926 926
     $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
927
-    if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) {
927
+    if ((!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users'))) {
928 928
       drupal_set_message(
929 929
         bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.',
930 930
         array(
931
-          '@project' => variable_get('site_name','Drupal-BOINC'),
931
+          '@project' => variable_get('site_name', 'Drupal-BOINC'),
932 932
         ), NULL, 'boinc:account-credentials-change')
933 933
       , 'info');
934 934
     }
@@ -993,36 +993,36 @@  discard block
 block discarded – undo
993 993
     $form['account']['boincuser_id'] = array(
994 994
       '#value' => '
995 995
         <div class="form-item">
996
-          <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
997
-          <span>' . $account->boincuser_id . '</span>
996
+          <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change').'</label>
997
+          <span>' . $account->boincuser_id.'</span>
998 998
         </div>',
999 999
     );
1000 1000
     $form['account']['user_id'] = array(
1001 1001
       '#value' => '
1002 1002
         <div class="form-item">
1003
-          <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
1004
-          <span>' . $account->uid . '</span>
1003
+          <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change').'</label>
1004
+          <span>' . $account->uid.'</span>
1005 1005
         </div>',
1006 1006
     );
1007 1007
     $form['account']['account_key'] = array(
1008 1008
       '#value' => '
1009 1009
         <div class="form-item">
1010
-          <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label>
1011
-          <span>' . $account->boincuser_account_key . '</span>
1010
+          <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change').'</label>
1011
+          <span>' . $account->boincuser_account_key.'</span>
1012 1012
         </div>',
1013 1013
     );
1014 1014
     $form['account']['weak_account_key'] = array(
1015 1015
       '#value' => '
1016 1016
         <div class="form-item">
1017
-          <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label>
1018
-          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span>
1017
+          <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change').'</label>
1018
+          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span>
1019 1019
         </div>',
1020 1020
     );
1021 1021
     $form['account']['cpid'] = array(
1022 1022
       '#value' => '
1023 1023
         <div class="form-item">
1024
-          <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label>
1025
-          <span>' . $account->boincuser_cpid . '</span>
1024
+          <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change').'</label>
1025
+          <span>' . $account->boincuser_cpid.'</span>
1026 1026
         </div>',
1027 1027
     );
1028 1028
     
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
     $form['submit']['#suffix'] = '</li>';
1041 1041
     $form['submit']['#weight'] = 1002;
1042 1042
     $form['cancel'] = array(
1043
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1043
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>',
1044 1044
       '#weight' => 1003,
1045 1045
     );
1046 1046
     if (isset($form['delete']) AND is_array($form['delete'])) {
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
1137 1137
     $form['buttons']['preview_changes']['#weight'] = 1004;
1138 1138
     $form['buttons']['cancel'] = array(
1139
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>',
1139
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>',
1140 1140
       '#weight' => 1005,
1141 1141
     );
1142 1142
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
     // Set name temporarily to dummy value to beat validation
1186 1186
     $form['name'] = array(
1187 1187
       '#type' => 'hidden',
1188
-      '#value' => rand() . '.' . time()
1188
+      '#value' => rand().'.'.time()
1189 1189
     );
1190 1190
     
1191 1191
     // Terms of use section
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
     if (!empty($termsofuse)) {
1194 1194
       $form['title1'] = array(
1195 1195
         '#weight' => -12,
1196
-        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>',
1196
+        '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register').'</h2>',
1197 1197
         '#prefix' => '<div id="register-title1">',
1198 1198
         '#suffix' => '</div>',
1199 1199
       );
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
     $form['title2'] = array(
1218 1218
       '#weight' => -6,
1219
-      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>',
1219
+      '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register').'</h2>',
1220 1220
       '#prefix' => '<div id="register-title2">',
1221 1221
       '#suffix' => '</div>',
1222 1222
     );
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
     $form['buttons']['submit']['#suffix'] = '</li>';
1271 1271
     $form['buttons']['submit']['#weight'] = 1002;
1272 1272
     $form['buttons']['cancel'] = array(
1273
-      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>',
1273
+      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login').'</li>',
1274 1274
       '#weight' => 1005,
1275 1275
     );
1276 1276
     $form['buttons']['form control tabs suffix'] = array(
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
  */
1353 1353
 function boincuser_token_list($type = 'all') {
1354 1354
   if ($type == 'user' || $type == 'all') {
1355
-    $tokens['user']['display-name']      = t("The user's name that should be displayed");
1355
+    $tokens['user']['display-name'] = t("The user's name that should be displayed");
1356 1356
     return $tokens;
1357 1357
   }
1358 1358
 }
@@ -1362,9 +1362,9 @@  discard block
 block discarded – undo
1362 1362
  */
1363 1363
 function boincuser_views_pre_execute(&$view) {
1364 1364
   $account_id = $view->args[0];
1365
-  if ($view->name=="user_activity") {
1365
+  if ($view->name == "user_activity") {
1366 1366
     // Run the following custom query for the user_activity view
1367
-    $view->build_info['query']= "
1367
+    $view->build_info['query'] = "
1368 1368
       SELECT node_revisions.vid AS vid,
1369 1369
         node.nid AS node_nid,
1370 1370
         node.uid AS users_node_uid,
@@ -1404,13 +1404,13 @@  discard block
 block discarded – undo
1404 1404
   // Delete expired users in the BOINC database, user_delete table.
1405 1405
   require_boinc('boinc_db');
1406 1406
   $num_deleted = BoincUserDeleted::delete_expired();
1407
-  if ($num_deleted>0) {
1407
+  if ($num_deleted > 0) {
1408 1408
     watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE);
1409 1409
   }
1410 1410
 
1411 1411
   // Delete expired tokens from token table
1412 1412
   $tokens_deleted = BoincToken::delete_expired();
1413
-  if ($tokens_deleted>0) {
1413
+  if ($tokens_deleted > 0) {
1414 1414
     watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE);
1415 1415
   }
1416 1416
 }
@@ -1485,38 +1485,38 @@  discard block
 block discarded – undo
1485 1485
   case 'boinc':
1486 1486
     $output .= '<ol>';
1487 1487
     if ($registration_enabled) {
1488
-      $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1488
+      $output .= '<li>'.bts('First !create_an_account here at @sitename.',
1489 1489
       array(
1490 1490
         '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'),
1491 1491
         '@sitename' => $site_name,
1492
-      ), NULL, 'boinc:join-page') . '</li>';
1492
+      ), NULL, 'boinc:join-page').'</li>';
1493 1493
     }
1494
-    $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>';
1495
-    $output .= '  <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.",
1494
+    $output .= '  <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>';
1495
+    $output .= '  <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.",
1496 1496
     array(
1497 1497
       '@sitename' => $site_name,
1498 1498
       '@siteurl' => $base_url,
1499
-    ), NULL, 'boinc:join-page') . '</li>';
1499
+    ), NULL, 'boinc:join-page').'</li>';
1500 1500
     if ($registration_enabled) {
1501
-      $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.",
1501
+      $output .= '<li>'.bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.",
1502 1502
         array(
1503 1503
           '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1504
-        ), NULL, 'boinc:join-page') . '</li>';
1504
+        ), NULL, 'boinc:join-page').'</li>';
1505 1505
     }
1506 1506
     else {
1507
-      $output .= '<li>' . bts("If you're running a command-line version of BOINC,
1507
+      $output .= '<li>'.bts("If you're running a command-line version of BOINC,
1508 1508
         please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.",
1509 1509
         array(
1510 1510
           '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'),
1511
-        ), NULL, 'boinc:join-page') . '</li>';
1511
+        ), NULL, 'boinc:join-page').'</li>';
1512 1512
     }
1513
-    $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please
1513
+    $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please
1514 1514
       upgrade to a more recent version of BOINC to create an account
1515 1515
       at @this_project.",
1516 1516
       array(
1517 1517
         '@this_project' => $site_name,
1518
-      ), NULL, 'boinc:join-page') . '</li>';
1519
-    $output .=  '</ol>';
1518
+      ), NULL, 'boinc:join-page').'</li>';
1519
+    $output .= '</ol>';
1520 1520
     break;
1521 1521
   case 'new':
1522 1522
   default:
@@ -1528,34 +1528,34 @@  discard block
 block discarded – undo
1528 1528
     //  $ruleslink = drupal_lookup_path('source', $ruleslinkB);
1529 1529
     //}
1530 1530
 
1531
-    $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') );
1531
+    $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', ''));
1532 1532
 
1533 1533
     // Join page output
1534 1534
     $output .= '<ol>';
1535 1535
     if ($registration_enabled) {
1536
-      $output .= '<li>' . bts('First !create_an_account here at @sitename.',
1536
+      $output .= '<li>'.bts('First !create_an_account here at @sitename.',
1537 1537
       array(
1538 1538
         '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'),
1539 1539
         '@sitename' => $site_name,
1540
-      ), NULL, 'boinc:join-page') . '</li>';
1540
+      ), NULL, 'boinc:join-page').'</li>';
1541 1541
     }
1542
-    else if ( menu_valid_path(array('link_path' => $ruleslink)) ) {
1543
-      $output .= '  <li>' . bts("Read our !rules_and_policies.", array(
1542
+    else if (menu_valid_path(array('link_path' => $ruleslink))) {
1543
+      $output .= '  <li>'.bts("Read our !rules_and_policies.", array(
1544 1544
         '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink),
1545
-      ), NULL, 'boinc:join-page') . '</li>';
1545
+      ), NULL, 'boinc:join-page').'</li>';
1546 1546
     }
1547
-    $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page');
1547
+    $output .= '  <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page');
1548 1548
     $output .= '    <p>';
1549 1549
     $output .= '      <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>';
1550 1550
     $output .= '    </p>';
1551
-    $output .= '    ' . bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page');
1551
+    $output .= '    '.bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page');
1552 1552
     $output .= '  </li>';
1553
-    $output .= '  <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>';
1554
-    $output .= '  <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array(
1553
+    $output .= '  <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>';
1554
+    $output .= '  <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array(
1555 1555
       '@sitename' => $site_name,
1556 1556
       '@siteurl' => $base_url,
1557
-    ), NULL, 'boinc:join-page') . '</li>';
1558
-    $output .=  '</ol>';
1557
+    ), NULL, 'boinc:join-page').'</li>';
1558
+    $output .= '</ol>';
1559 1559
   }
1560 1560
   $output .= '</div>';
1561 1561
   return $output;
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
   global $user;
1569 1569
   $site_name = variable_get('site_name', 'Drupal-BOINC');
1570 1570
   // get the front page message from database; this is set in the admin interface under BOINC Other
1571
-  $site_message = variable_get('boinc_other_frontpage','');
1571
+  $site_message = variable_get('boinc_other_frontpage', '');
1572 1572
 
1573 1573
   // Determine the user of the day
1574 1574
   $current_uotd = db_fetch_object(db_query("
@@ -1590,30 +1590,30 @@  discard block
 block discarded – undo
1590 1590
   $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page'));
1591 1591
   $output .= '</h2>';
1592 1592
   $output .= '<div class="boinc-overview balance-height-front">';
1593
-  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>';
1593
+  $output .= '  <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>';
1594 1594
   if ($user->uid) {
1595
-    $output .= '  <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1595
+    $output .= '  <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>';
1596 1596
   }
1597 1597
   else {
1598
-    $output .= '  <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>';
1598
+    $output .= '  <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>';
1599 1599
   }
1600 1600
   $output .= '</div>';
1601 1601
   $output .= '<div class="boinc-overview-details">';
1602 1602
   $output .= '  <div class="detail-container">';
1603
-  $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1603
+  $output .= '    <a class="user-of-the-day" href="account/'.$uotd->uid.'">';
1604 1604
   $output .= '      <div class="picture">';
1605 1605
   $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1606 1606
     $uotd_image['alt'], array(), FALSE);
1607 1607
   $output .= '      </div>';
1608
-  $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>';
1609
-  $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1608
+  $output .= '      <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>';
1609
+  $output .= '      <div class="detail">'.$uotd->boincuser_name.'</div>';
1610 1610
   $output .= '    </a>';
1611 1611
   $output .= '    <div class="volunteers">';
1612
-  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>';
1612
+  $output .= '      <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>';
1613 1613
   $output .= '      <div class="platforms">';
1614
-  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>';
1615
-  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>';
1616
-  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>';
1614
+  $output .= '        <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>';
1615
+  $output .= '        <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>';
1616
+  $output .= '        <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>';
1617 1617
   $output .= '      </div>';
1618 1618
   $output .= '    </div>';
1619 1619
   $output .= '  </div>';
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
   $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE);
1645 1645
   if (!$enablethisRPC) {
1646 1646
     $mess = bts('Account creation is done through our Web site. Please register at @url', array(
1647
-      '@url' => $base_url . '/user/registration',
1647
+      '@url' => $base_url.'/user/registration',
1648 1648
     ),
1649 1649
     NULL, 'boinc:create_account');
1650 1650
     xml_error(-208, $mess);
@@ -1676,8 +1676,8 @@  discard block
 block discarded – undo
1676 1676
   $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);
1677 1677
   if ($boinc_user) {
1678 1678
     // Return authenticator for existing users
1679
-    if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or
1680
-    password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) {
1679
+    if (($params['passwd_hash'] == $boinc_user->passwd_hash) or
1680
+    password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) {
1681 1681
       $output = array('authenticator' => $boinc_user->authenticator);
1682 1682
     }
1683 1683
     else {
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
   // Ensure there is a authentication token before continuing
1733 1733
   if (empty($authtoken)) {
1734 1734
     drupal_not_found();
1735
-    return ;
1735
+    return;
1736 1736
   }
1737 1737
 
1738 1738
   if (strlen($authtoken) != 32) {
@@ -1754,8 +1754,8 @@  discard block
 block discarded – undo
1754 1754
   }
1755 1755
 
1756 1756
   // Lookup path to custom account finish page
1757
-  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') );
1758
-  if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) {
1757
+  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', ''));
1758
+  if (menu_valid_path(array('link_path' => $customaccountfinishpath))) {
1759 1759
     $node = menu_get_object('node', 1, $customaccountfinishpath);
1760 1760
     if ($node) {
1761 1761
       return node_page_view($node);
@@ -1764,12 +1764,12 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
   // open links in new window
1766 1766
   $options = array(
1767
-    'attributes' => array( 'target' => '_blank' ),
1767
+    'attributes' => array('target' => '_blank'),
1768 1768
   );
1769 1769
 
1770 1770
   // Check moderation page exists
1771
-  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') );
1772
-  if ( menu_valid_path(array('link_path' => $moderationpath)) ) {
1771
+  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', ''));
1772
+  if (menu_valid_path(array('link_path' => $moderationpath))) {
1773 1773
     $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish');
1774 1774
   } else {
1775 1775
     $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish');
@@ -1777,11 +1777,11 @@  discard block
 block discarded – undo
1777 1777
 
1778 1778
   $username = $user->boincuser_name;
1779 1779
   $site_name = variable_get('site_name', 'Drupal-BOINC');
1780
-  $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)',
1780
+  $output = "<p>".bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)',
1781 1781
   array(
1782 1782
     '@user_name' => $username,
1783 1783
     '@site_name' => $site_name,
1784
-  ), NULL, 'boinc:account-finish') . "</p>";
1784
+  ), NULL, 'boinc:account-finish')."</p>";
1785 1785
 
1786 1786
   $links = array(
1787 1787
     array(
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
   );
1848 1848
 
1849 1849
   //List of links
1850
-  $output .= theme_item_list($links, $title = NULL, $type='ul');
1850
+  $output .= theme_item_list($links, $title = NULL, $type = 'ul');
1851 1851
 
1852 1852
   return $output;
1853 1853
 }
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
     global $base_url;
1965 1965
     global $base_path;
1966 1966
     $site_name = variable_get('site_name', 'Drupal-BOINC');
1967
-    $site_url = $base_url . $base_path;
1967
+    $site_url = $base_url.$base_path;
1968 1968
     $moderator = user_load($user->uid);
1969 1969
     $profile->moderate = 0;
1970 1970
     $profile->status = 0;
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
       global $base_url;
2026 2026
       global $base_path;
2027 2027
       $site_name = variable_get('site_name', 'Drupal-BOINC');
2028
-      $site_url = $base_url . $base_path;
2028
+      $site_url = $base_url.$base_path;
2029 2029
       $moderator = user_load($user->uid);
2030 2030
       $settings = array(
2031 2031
         'from' => '',
@@ -2129,25 +2129,25 @@  discard block
 block discarded – undo
2129 2129
   if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard');
2130 2130
   
2131 2131
   $output = '';
2132
-  $output .= '<table class="user-projects">' . "\n";
2133
-  $output .= '<thead>' . "\n";
2134
-  $output .= '  <tr>' . "\n";
2135
-  $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n";
2136
-  $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n";
2137
-  $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n";
2138
-  $output .= '  </tr>' . "\n";
2139
-  $output .= '</thead>' . "\n";
2140
-  $output .= '<tbody>' . "\n";
2132
+  $output .= '<table class="user-projects">'."\n";
2133
+  $output .= '<thead>'."\n";
2134
+  $output .= '  <tr>'."\n";
2135
+  $output .= '    <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n";
2136
+  $output .= '    <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n";
2137
+  $output .= '    <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n";
2138
+  $output .= '  </tr>'."\n";
2139
+  $output .= '</thead>'."\n";
2140
+  $output .= '<tbody>'."\n";
2141 2141
   foreach ($projects AS $project) {
2142
-    $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;
2143
-    $output .= '  <tr>' . "\n";
2144
-    $output .= '    <td>' . l($project->name, $url) . '</td>' . "\n";
2145
-    $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; 
2146
-    $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";
2147
-    $output .= '  </tr>' . "\n";
2142
+    $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id;
2143
+    $output .= '  <tr>'."\n";
2144
+    $output .= '    <td>'.l($project->name, $url).'</td>'."\n";
2145
+    $output .= '    <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; 
2146
+    $output .= '    <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n";
2147
+    $output .= '  </tr>'."\n";
2148 2148
   }
2149
-  $output .= '</tbody>' . "\n";
2150
-  $output .= '</table>' . "\n";
2149
+  $output .= '</tbody>'."\n";
2150
+  $output .= '</table>'."\n";
2151 2151
   $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
2152 2152
   //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
2153 2153
   return $output;
@@ -2167,8 +2167,8 @@  discard block
 block discarded – undo
2167 2167
     'cpid' => $cpid
2168 2168
   );
2169 2169
   $args = array();
2170
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
2171
-  $query = '?' . implode('&', $args);
2170
+  foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value);
2171
+  $query = '?'.implode('&', $args);
2172 2172
   
2173 2173
   // Load XML from RPC
2174 2174
   $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
@@ -2240,12 +2240,12 @@  discard block
 block discarded – undo
2240 2240
     $output .= '<ul class="tab-list">';
2241 2241
     $count = 0;
2242 2242
     foreach ($links as $key => $link) {
2243
-      $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
2243
+      $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">';
2244 2244
       $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
2245 2245
       $output .= '</li>';
2246 2246
       $count++;
2247 2247
     }
2248
-    $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user', $account->uid) . '</li>';
2248
+    $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user', $account->uid).'</li>';
2249 2249
     $output .= '</ul>';
2250 2250
   }
2251 2251
   return $output;
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
 function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
2287 2287
 
2288 2288
   foreach ($documents as $document) {
2289
-    if ( $document->entity_type=='node' AND $document->bundle=='profile' ) {
2289
+    if ($document->entity_type == 'node' AND $document->bundle == 'profile') {
2290 2290
       // Node information.
2291 2291
       $nid = $document->entity_id;
2292 2292
       $node = node_load($nid);
@@ -2336,11 +2336,11 @@  discard block
 block discarded – undo
2336 2336
   // privatemsg module. We need to convert them back to spaces for the
2337 2337
   // check below.
2338 2338
   $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname);
2339
-  if ($drupalid>0) {
2339
+  if ($drupalid > 0) {
2340 2340
     if ($recipient = user_load(array('uid' => $drupalid))) {
2341 2341
       // Double-check that the loaded user matches both boincuser_id
2342 2342
       // and boincuser_name.
2343
-      if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) {
2343
+      if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) {
2344 2344
         return $recipient;
2345 2345
       }
2346 2346
     }
Please login to merge, or discard this patch.
drupal/sites/all/features/boinc_standard/boinc_standard.pages_default.inc 2 patches
Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -4,113 +4,113 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_default_page_manager_pages().
5 5
  */
6 6
 function boinc_standard_default_page_manager_pages() {
7
-  $page = new stdClass;
8
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
9
-  $page->api_version = 1;
10
-  $page->name = 'about_us';
11
-  $page->task = 'page';
12
-  $page->admin_title = 'About Us';
13
-  $page->admin_description = '';
14
-  $page->path = 'about.fail';
15
-  $page->access = array(
7
+    $page = new stdClass;
8
+    $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
9
+    $page->api_version = 1;
10
+    $page->name = 'about_us';
11
+    $page->task = 'page';
12
+    $page->admin_title = 'About Us';
13
+    $page->admin_description = '';
14
+    $page->path = 'about.fail';
15
+    $page->access = array(
16 16
     'type' => 'none',
17 17
     'settings' => NULL,
18
-  );
19
-  $page->menu = array();
20
-  $page->arguments = array();
21
-  $page->conf = array();
22
-  $page->default_handlers = array();
23
-  $pages['about_us'] = $page;
18
+    );
19
+    $page->menu = array();
20
+    $page->arguments = array();
21
+    $page->conf = array();
22
+    $page->default_handlers = array();
23
+    $pages['about_us'] = $page;
24 24
 
25
-  $page = new stdClass;
26
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
27
-  $page->api_version = 1;
28
-  $page->name = 'account_dashboard';
29
-  $page->task = 'page';
30
-  $page->admin_title = 'Dashboard';
31
-  $page->admin_description = '';
32
-  $page->path = 'dashboard';
33
-  $page->access = array(
25
+    $page = new stdClass;
26
+    $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
27
+    $page->api_version = 1;
28
+    $page->name = 'account_dashboard';
29
+    $page->task = 'page';
30
+    $page->admin_title = 'Dashboard';
31
+    $page->admin_description = '';
32
+    $page->path = 'dashboard';
33
+    $page->access = array(
34 34
     'plugins' => array(
35
-      1 => array(
35
+        1 => array(
36 36
         'name' => 'role',
37 37
         'settings' => array(
38
-          'rids' => array(
38
+            'rids' => array(
39 39
             0 => 2,
40
-          ),
40
+            ),
41 41
         ),
42 42
         'context' => 'logged-in-user',
43 43
         'not' => FALSE,
44
-      ),
44
+        ),
45 45
     ),
46 46
     'logic' => 'and',
47 47
     'type' => 'none',
48 48
     'settings' => NULL,
49
-  );
50
-  $page->menu = array(
49
+    );
50
+    $page->menu = array(
51 51
     'type' => 'none',
52 52
     'title' => 'Dashboard',
53 53
     'name' => 'navigation',
54 54
     'weight' => '0',
55 55
     'parent' => array(
56
-      'type' => 'normal',
57
-      'title' => 'Account',
58
-      'name' => 'navigation',
59
-      'weight' => '0',
56
+        'type' => 'normal',
57
+        'title' => 'Account',
58
+        'name' => 'navigation',
59
+        'weight' => '0',
60 60
     ),
61
-  );
62
-  $page->arguments = array();
63
-  $page->conf = array();
64
-  $page->default_handlers = array();
65
-  $handler = new stdClass;
66
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
67
-  $handler->api_version = 1;
68
-  $handler->name = 'page_account_dashboard_panel_context';
69
-  $handler->task = 'page';
70
-  $handler->subtask = 'account_dashboard';
71
-  $handler->handler = 'panel_context';
72
-  $handler->weight = 0;
73
-  $handler->conf = array(
61
+    );
62
+    $page->arguments = array();
63
+    $page->conf = array();
64
+    $page->default_handlers = array();
65
+    $handler = new stdClass;
66
+    $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
67
+    $handler->api_version = 1;
68
+    $handler->name = 'page_account_dashboard_panel_context';
69
+    $handler->task = 'page';
70
+    $handler->subtask = 'account_dashboard';
71
+    $handler->handler = 'panel_context';
72
+    $handler->weight = 0;
73
+    $handler->conf = array(
74 74
     'title' => 'Landing page',
75 75
     'no_blocks' => FALSE,
76 76
     'pipeline' => 'ipe',
77 77
     'css_id' => '',
78 78
     'css' => '',
79 79
     'contexts' => array(
80
-      0 => array(
80
+        0 => array(
81 81
         'name' => 'user',
82 82
         'id' => 1,
83 83
         'identifier' => 'User',
84 84
         'keyword' => 'user',
85 85
         'context_settings' => array(
86
-          'type' => 'current',
87
-          'user' => '',
88
-          'uid' => '',
86
+            'type' => 'current',
87
+            'user' => '',
88
+            'uid' => '',
89
+        ),
89 90
         ),
90
-      ),
91 91
     ),
92 92
     'relationships' => array(),
93 93
     'access' => array(
94
-      'plugins' => array(),
95
-      'logic' => 'and',
94
+        'plugins' => array(),
95
+        'logic' => 'and',
96 96
     ),
97
-  );
98
-  $display = new panels_display;
99
-  $display->layout = 'one_sidebar_second';
100
-  $display->layout_settings = array();
101
-  $display->panel_settings = array(
97
+    );
98
+    $display = new panels_display;
99
+    $display->layout = 'one_sidebar_second';
100
+    $display->layout_settings = array();
101
+    $display->panel_settings = array(
102 102
     'style_settings' => array(
103
-      'default' => NULL,
104
-      'content' => NULL,
105
-      'sidebar_first' => NULL,
103
+        'default' => NULL,
104
+        'content' => NULL,
105
+        'sidebar_first' => NULL,
106 106
     ),
107
-  );
108
-  $display->cache = array();
109
-  $display->title = 'Dashboard';
110
-  $display->storage_type = 'page_manager';
111
-  $display->storage_id = 'page_account_dashboard_panel_context';
112
-  $display->content = array();
113
-  $display->panels = array();
107
+    );
108
+    $display->cache = array();
109
+    $display->title = 'Dashboard';
110
+    $display->storage_type = 'page_manager';
111
+    $display->storage_id = 'page_account_dashboard_panel_context';
112
+    $display->content = array();
113
+    $display->panels = array();
114 114
     $pane = new stdClass;
115 115
     $pane->pid = 'new-1';
116 116
     $pane->panel = 'content';
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
     $pane->shown = TRUE;
120 120
     $pane->access = array();
121 121
     $pane->configuration = array(
122
-      'override_title' => 1,
123
-      'override_title_text' => 'My stats',
122
+        'override_title' => 1,
123
+        'override_title_text' => 'My stats',
124 124
     );
125 125
     $pane->cache = array();
126 126
     $pane->style = array(
127
-      'settings' => NULL,
127
+        'settings' => NULL,
128 128
     );
129 129
     $pane->css = array(
130
-      'css_id' => '',
131
-      'css_class' => 'panel-primary container shadow',
130
+        'css_id' => '',
131
+        'css_class' => 'panel-primary container shadow',
132 132
     );
133 133
     $pane->extras = array();
134 134
     $pane->position = 0;
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
     $pane->configuration = array();
145 145
     $pane->cache = array();
146 146
     $pane->style = array(
147
-      'settings' => NULL,
147
+        'settings' => NULL,
148 148
     );
149 149
     $pane->css = array(
150
-      'css_id' => '',
151
-      'css_class' => 'panel-primary container shadow',
150
+        'css_id' => '',
151
+        'css_class' => 'panel-primary container shadow',
152 152
     );
153 153
     $pane->extras = array();
154 154
     $pane->position = 1;
@@ -161,31 +161,31 @@  discard block
 block discarded – undo
161 161
     $pane->subtype = 'custom';
162 162
     $pane->shown = TRUE;
163 163
     $pane->access = array(
164
-      'plugins' => array(
164
+        'plugins' => array(
165 165
         1 => array(
166
-          'name' => 'perm',
167
-          'settings' => array(
166
+            'name' => 'perm',
167
+            'settings' => array(
168 168
             'perm' => 'edit any profile content',
169
-          ),
170
-          'context' => 'context_user_1',
171
-          'not' => FALSE,
169
+            ),
170
+            'context' => 'context_user_1',
171
+            'not' => FALSE,
172
+        ),
172 173
         ),
173
-      ),
174 174
     );
175 175
     $pane->configuration = array(
176
-      'admin_title' => 'Moderation overview',
177
-      'title' => '',
178
-      'body' => '<?php print boinccore_moderation_overview_panel(); ?>',
179
-      'format' => '3',
180
-      'substitute' => 1,
176
+        'admin_title' => 'Moderation overview',
177
+        'title' => '',
178
+        'body' => '<?php print boinccore_moderation_overview_panel(); ?>',
179
+        'format' => '3',
180
+        'substitute' => 1,
181 181
     );
182 182
     $pane->cache = array();
183 183
     $pane->style = array(
184
-      'settings' => NULL,
184
+        'settings' => NULL,
185 185
     );
186 186
     $pane->css = array(
187
-      'css_id' => '',
188
-      'css_class' => 'panel-secondary container shadow',
187
+        'css_id' => '',
188
+        'css_class' => 'panel-secondary container shadow',
189 189
     );
190 190
     $pane->extras = array();
191 191
     $pane->position = 0;
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
     $pane->shown = TRUE;
200 200
     $pane->access = array();
201 201
     $pane->configuration = array(
202
-      'override_title' => 0,
203
-      'override_title_text' => '',
202
+        'override_title' => 0,
203
+        'override_title_text' => '',
204 204
     );
205 205
     $pane->cache = array();
206 206
     $pane->style = array(
207
-      'settings' => NULL,
207
+        'settings' => NULL,
208 208
     );
209 209
     $pane->css = array(
210
-      'css_id' => '',
211
-      'css_class' => 'panel-secondary container shadow',
210
+        'css_id' => '',
211
+        'css_class' => 'panel-secondary container shadow',
212 212
     );
213 213
     $pane->extras = array();
214 214
     $pane->position = 1;
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
     $pane->shown = TRUE;
223 223
     $pane->access = array();
224 224
     $pane->configuration = array(
225
-      'admin_title' => 'Team summary',
226
-      'title' => '',
227
-      'body' => '<?php 
225
+        'admin_title' => 'Team summary',
226
+        'title' => '',
227
+        'body' => '<?php 
228 228
 if (module_exists(\'boincteam\')) {
229 229
   echo boincteam_dashboard_panel();
230 230
 }
231 231
 ?>',
232
-      'format' => '3',
233
-      'substitute' => 1,
232
+        'format' => '3',
233
+        'substitute' => 1,
234 234
     );
235 235
     $pane->cache = array();
236 236
     $pane->style = array(
237
-      'settings' => NULL,
237
+        'settings' => NULL,
238 238
     );
239 239
     $pane->css = array(
240
-      'css_id' => 'team-dashboard-pane',
241
-      'css_class' => 'panel-secondary container shadow',
240
+        'css_id' => 'team-dashboard-pane',
241
+        'css_class' => 'panel-secondary container shadow',
242 242
     );
243 243
     $pane->extras = array();
244 244
     $pane->position = 2;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
     $pane->shown = TRUE;
253 253
     $pane->access = array();
254 254
     $pane->configuration = array(
255
-      'admin_title' => 'User activity summary',
256
-      'title' => '',
257
-      'body' => '<?php
255
+        'admin_title' => 'User activity summary',
256
+        'title' => '',
257
+        'body' => '<?php
258 258
 
259 259
 global $user;
260 260
 $uid = $user->uid;
@@ -263,16 +263,16 @@  discard block
 block discarded – undo
263 263
 echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\';
264 264
 
265 265
 ?>',
266
-      'format' => '3',
267
-      'substitute' => 1,
266
+        'format' => '3',
267
+        'substitute' => 1,
268 268
     );
269 269
     $pane->cache = array();
270 270
     $pane->style = array(
271
-      'settings' => NULL,
271
+        'settings' => NULL,
272 272
     );
273 273
     $pane->css = array(
274
-      'css_id' => '',
275
-      'css_class' => 'panel-secondary container shadow',
274
+        'css_id' => '',
275
+        'css_class' => 'panel-secondary container shadow',
276 276
     );
277 277
     $pane->extras = array();
278 278
     $pane->position = 3;
@@ -286,74 +286,74 @@  discard block
 block discarded – undo
286 286
     $pane->shown = TRUE;
287 287
     $pane->access = array();
288 288
     $pane->configuration = array(
289
-      'override_pager_settings' => 0,
290
-      'use_pager' => 0,
291
-      'nodes_per_page' => '6',
292
-      'pager_id' => '',
293
-      'offset' => '0',
294
-      'more_link' => 1,
295
-      'feed_icons' => 0,
296
-      'panel_args' => 0,
297
-      'link_to_view' => 0,
298
-      'args' => '',
299
-      'url' => '',
300
-      'display' => 'block_1',
301
-      'context' => array(
289
+        'override_pager_settings' => 0,
290
+        'use_pager' => 0,
291
+        'nodes_per_page' => '6',
292
+        'pager_id' => '',
293
+        'offset' => '0',
294
+        'more_link' => 1,
295
+        'feed_icons' => 0,
296
+        'panel_args' => 0,
297
+        'link_to_view' => 0,
298
+        'args' => '',
299
+        'url' => '',
300
+        'display' => 'block_1',
301
+        'context' => array(
302 302
         0 => 'context_user_1.uid',
303
-      ),
304
-      'override_title' => 0,
305
-      'override_title_text' => '',
303
+        ),
304
+        'override_title' => 0,
305
+        'override_title_text' => '',
306 306
     );
307 307
     $pane->cache = array();
308 308
     $pane->style = array(
309
-      'settings' => NULL,
309
+        'settings' => NULL,
310 310
     );
311 311
     $pane->css = array(
312
-      'css_id' => '',
313
-      'css_class' => 'panel-secondary container shadow',
312
+        'css_id' => '',
313
+        'css_class' => 'panel-secondary container shadow',
314 314
     );
315 315
     $pane->extras = array();
316 316
     $pane->position = 4;
317 317
     $display->content['new-7'] = $pane;
318 318
     $display->panels['sidebar_first'][4] = 'new-7';
319
-  $display->hide_title = PANELS_TITLE_FIXED;
320
-  $display->title_pane = 'new-1';
321
-  $handler->conf['display'] = $display;
322
-  $page->default_handlers[$handler->name] = $handler;
323
-  $pages['account_dashboard'] = $page;
319
+    $display->hide_title = PANELS_TITLE_FIXED;
320
+    $display->title_pane = 'new-1';
321
+    $handler->conf['display'] = $display;
322
+    $page->default_handlers[$handler->name] = $handler;
323
+    $pages['account_dashboard'] = $page;
324 324
 
325
-  $page = new stdClass;
326
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
327
-  $page->api_version = 1;
328
-  $page->name = 'boinc_user';
329
-  $page->task = 'page';
330
-  $page->admin_title = 'User profile template (boinc)';
331
-  $page->admin_description = '';
332
-  $page->path = 'account/%user';
333
-  $page->access = array(
325
+    $page = new stdClass;
326
+    $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
327
+    $page->api_version = 1;
328
+    $page->name = 'boinc_user';
329
+    $page->task = 'page';
330
+    $page->admin_title = 'User profile template (boinc)';
331
+    $page->admin_description = '';
332
+    $page->path = 'account/%user';
333
+    $page->access = array(
334 334
     'type' => 'none',
335 335
     'settings' => NULL,
336
-  );
337
-  $page->menu = array();
338
-  $page->arguments = array(
336
+    );
337
+    $page->menu = array();
338
+    $page->arguments = array(
339 339
     'user' => array(
340
-      'id' => 1,
341
-      'identifier' => 'User: ID',
342
-      'name' => 'uid',
343
-      'settings' => array(),
340
+        'id' => 1,
341
+        'identifier' => 'User: ID',
342
+        'name' => 'uid',
343
+        'settings' => array(),
344 344
     ),
345
-  );
346
-  $page->conf = array();
347
-  $page->default_handlers = array();
348
-  $handler = new stdClass;
349
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
350
-  $handler->api_version = 1;
351
-  $handler->name = 'page_boinc_user_panel_context_2';
352
-  $handler->task = 'page';
353
-  $handler->subtask = 'boinc_user';
354
-  $handler->handler = 'panel_context';
355
-  $handler->weight = 1;
356
-  $handler->conf = array(
345
+    );
346
+    $page->conf = array();
347
+    $page->default_handlers = array();
348
+    $handler = new stdClass;
349
+    $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
350
+    $handler->api_version = 1;
351
+    $handler->name = 'page_boinc_user_panel_context_2';
352
+    $handler->task = 'page';
353
+    $handler->subtask = 'boinc_user';
354
+    $handler->handler = 'panel_context';
355
+    $handler->weight = 1;
356
+    $handler->conf = array(
357 357
     'title' => 'Panel',
358 358
     'no_blocks' => 0,
359 359
     'pipeline' => 'standard',
@@ -362,37 +362,37 @@  discard block
 block discarded – undo
362 362
     'contexts' => array(),
363 363
     'relationships' => array(),
364 364
     'access' => array(
365
-      'plugins' => array(
365
+        'plugins' => array(
366 366
         0 => array(
367
-          'name' => 'php',
368
-          'settings' => array(
367
+            'name' => 'php',
368
+            'settings' => array(
369 369
             'description' => 'if user status then show profile',
370 370
             'php' => '$account = $contexts[\'argument_uid_1\']->data;
371 371
 return ($account->status);
372 372
 ',
373
-          ),
374
-          'not' => FALSE,
373
+            ),
374
+            'not' => FALSE,
375
+        ),
375 376
         ),
376
-      ),
377
-      'logic' => 'and',
377
+        'logic' => 'and',
378 378
     ),
379
-  );
380
-  $display = new panels_display;
381
-  $display->layout = 'one_sidebar_second';
382
-  $display->layout_settings = array();
383
-  $display->panel_settings = array(
379
+    );
380
+    $display = new panels_display;
381
+    $display->layout = 'one_sidebar_second';
382
+    $display->layout_settings = array();
383
+    $display->panel_settings = array(
384 384
     'style_settings' => array(
385
-      'default' => NULL,
386
-      'content' => NULL,
387
-      'sidebar_first' => NULL,
385
+        'default' => NULL,
386
+        'content' => NULL,
387
+        'sidebar_first' => NULL,
388 388
     ),
389
-  );
390
-  $display->cache = array();
391
-  $display->title = 'Account';
392
-  $display->storage_type = 'page_manager';
393
-  $display->storage_id = 'page_boinc_user_panel_context_2';
394
-  $display->content = array();
395
-  $display->panels = array();
389
+    );
390
+    $display->cache = array();
391
+    $display->title = 'Account';
392
+    $display->storage_type = 'page_manager';
393
+    $display->storage_id = 'page_boinc_user_panel_context_2';
394
+    $display->content = array();
395
+    $display->panels = array();
396 396
     $pane = new stdClass;
397 397
     $pane->pid = 'new-1';
398 398
     $pane->panel = 'content';
@@ -401,19 +401,19 @@  discard block
 block discarded – undo
401 401
     $pane->shown = TRUE;
402 402
     $pane->access = array();
403 403
     $pane->configuration = array(
404
-      'context' => array(
404
+        'context' => array(
405 405
         0 => 'argument_uid_1',
406
-      ),
407
-      'override_title' => 0,
408
-      'override_title_text' => '',
406
+        ),
407
+        'override_title' => 0,
408
+        'override_title_text' => '',
409 409
     );
410 410
     $pane->cache = array();
411 411
     $pane->style = array(
412
-      'settings' => NULL,
412
+        'settings' => NULL,
413 413
     );
414 414
     $pane->css = array(
415
-      'css_id' => '',
416
-      'css_class' => 'panel-primary container shadow',
415
+        'css_id' => '',
416
+        'css_class' => 'panel-primary container shadow',
417 417
     );
418 418
     $pane->extras = array();
419 419
     $pane->position = 0;
@@ -427,16 +427,16 @@  discard block
 block discarded – undo
427 427
     $pane->shown = TRUE;
428 428
     $pane->access = array();
429 429
     $pane->configuration = array(
430
-      'override_title' => 0,
431
-      'override_title_text' => '',
430
+        'override_title' => 0,
431
+        'override_title_text' => '',
432 432
     );
433 433
     $pane->cache = array();
434 434
     $pane->style = array(
435
-      'settings' => NULL,
435
+        'settings' => NULL,
436 436
     );
437 437
     $pane->css = array(
438
-      'css_id' => '',
439
-      'css_class' => 'panel-secondary container shadow',
438
+        'css_id' => '',
439
+        'css_class' => 'panel-secondary container shadow',
440 440
     );
441 441
     $pane->extras = array();
442 442
     $pane->position = 0;
@@ -450,23 +450,23 @@  discard block
 block discarded – undo
450 450
     $pane->shown = TRUE;
451 451
     $pane->access = array();
452 452
     $pane->configuration = array(
453
-      'admin_title' => 'Team summary',
454
-      'title' => '',
455
-      'body' => '<?php 
453
+        'admin_title' => 'Team summary',
454
+        'title' => '',
455
+        'body' => '<?php 
456 456
 if (module_exists(\'boincteam\')) {
457 457
   echo boincteam_dashboard_panel(%user:uid);
458 458
 }
459 459
 ?>',
460
-      'format' => '3',
461
-      'substitute' => 1,
460
+        'format' => '3',
461
+        'substitute' => 1,
462 462
     );
463 463
     $pane->cache = array();
464 464
     $pane->style = array(
465
-      'settings' => NULL,
465
+        'settings' => NULL,
466 466
     );
467 467
     $pane->css = array(
468
-      'css_id' => 'team-dashboard-pane',
469
-      'css_class' => 'panel-secondary container shadow',
468
+        'css_id' => 'team-dashboard-pane',
469
+        'css_class' => 'panel-secondary container shadow',
470 470
     );
471 471
     $pane->extras = array();
472 472
     $pane->position = 1;
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
     $pane->shown = TRUE;
481 481
     $pane->access = array();
482 482
     $pane->configuration = array(
483
-      'admin_title' => 'User activity summary',
484
-      'title' => '',
485
-      'body' => '<?php
483
+        'admin_title' => 'User activity summary',
484
+        'title' => '',
485
+        'body' => '<?php
486 486
 
487 487
 $uid = arg(1);
488 488
 $account = user_load($uid);
@@ -490,16 +490,16 @@  discard block
 block discarded – undo
490 490
 echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\';
491 491
 
492 492
 ?>',
493
-      'format' => '3',
494
-      'substitute' => 0,
493
+        'format' => '3',
494
+        'substitute' => 0,
495 495
     );
496 496
     $pane->cache = array();
497 497
     $pane->style = array(
498
-      'settings' => NULL,
498
+        'settings' => NULL,
499 499
     );
500 500
     $pane->css = array(
501
-      'css_id' => '',
502
-      'css_class' => 'panel-secondary container shadow',
501
+        'css_id' => '',
502
+        'css_class' => 'panel-secondary container shadow',
503 503
     );
504 504
     $pane->extras = array();
505 505
     $pane->position = 2;
@@ -513,31 +513,31 @@  discard block
 block discarded – undo
513 513
     $pane->shown = TRUE;
514 514
     $pane->access = array();
515 515
     $pane->configuration = array(
516
-      'override_pager_settings' => 0,
517
-      'use_pager' => 0,
518
-      'nodes_per_page' => '6',
519
-      'pager_id' => '',
520
-      'offset' => '0',
521
-      'more_link' => 0,
522
-      'feed_icons' => 0,
523
-      'panel_args' => 0,
524
-      'link_to_view' => 0,
525
-      'args' => '',
526
-      'url' => '',
527
-      'display' => 'block_1',
528
-      'context' => array(
516
+        'override_pager_settings' => 0,
517
+        'use_pager' => 0,
518
+        'nodes_per_page' => '6',
519
+        'pager_id' => '',
520
+        'offset' => '0',
521
+        'more_link' => 0,
522
+        'feed_icons' => 0,
523
+        'panel_args' => 0,
524
+        'link_to_view' => 0,
525
+        'args' => '',
526
+        'url' => '',
527
+        'display' => 'block_1',
528
+        'context' => array(
529 529
         0 => 'argument_uid_1.uid',
530
-      ),
531
-      'override_title' => 0,
532
-      'override_title_text' => '',
530
+        ),
531
+        'override_title' => 0,
532
+        'override_title_text' => '',
533 533
     );
534 534
     $pane->cache = array();
535 535
     $pane->style = array(
536
-      'settings' => NULL,
536
+        'settings' => NULL,
537 537
     );
538 538
     $pane->css = array(
539
-      'css_id' => '',
540
-      'css_class' => 'panel-secondary container shadow',
539
+        'css_id' => '',
540
+        'css_class' => 'panel-secondary container shadow',
541 541
     );
542 542
     $pane->extras = array();
543 543
     $pane->position = 3;
@@ -551,66 +551,66 @@  discard block
 block discarded – undo
551 551
     $pane->shown = TRUE;
552 552
     $pane->access = array();
553 553
     $pane->configuration = array(
554
-      'admin_title' => 'Project list',
555
-      'title' => 'Projects',
556
-      'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>',
557
-      'format' => '3',
558
-      'substitute' => 1,
554
+        'admin_title' => 'Project list',
555
+        'title' => 'Projects',
556
+        'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>',
557
+        'format' => '3',
558
+        'substitute' => 1,
559 559
     );
560 560
     $pane->cache = array();
561 561
     $pane->style = array(
562
-      'settings' => NULL,
562
+        'settings' => NULL,
563 563
     );
564 564
     $pane->css = array(
565
-      'css_id' => '',
566
-      'css_class' => 'panel-secondary container shadow',
565
+        'css_id' => '',
566
+        'css_class' => 'panel-secondary container shadow',
567 567
     );
568 568
     $pane->extras = array();
569 569
     $pane->position = 4;
570 570
     $display->content['new-6'] = $pane;
571 571
     $display->panels['sidebar_first'][4] = 'new-6';
572
-  $display->hide_title = PANELS_TITLE_FIXED;
573
-  $display->title_pane = '0';
574
-  $handler->conf['display'] = $display;
575
-  $page->default_handlers[$handler->name] = $handler;
576
-  $pages['boinc_user'] = $page;
572
+    $display->hide_title = PANELS_TITLE_FIXED;
573
+    $display->title_pane = '0';
574
+    $handler->conf['display'] = $display;
575
+    $page->default_handlers[$handler->name] = $handler;
576
+    $pages['boinc_user'] = $page;
577 577
 
578
-  $page = new stdClass;
579
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
580
-  $page->api_version = 1;
581
-  $page->name = 'home';
582
-  $page->task = 'page';
583
-  $page->admin_title = 'Home page';
584
-  $page->admin_description = '';
585
-  $page->path = 'home';
586
-  $page->access = array(
578
+    $page = new stdClass;
579
+    $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
580
+    $page->api_version = 1;
581
+    $page->name = 'home';
582
+    $page->task = 'page';
583
+    $page->admin_title = 'Home page';
584
+    $page->admin_description = '';
585
+    $page->path = 'home';
586
+    $page->access = array(
587 587
     'type' => 'none',
588 588
     'settings' => NULL,
589
-  );
590
-  $page->menu = array(
589
+    );
590
+    $page->menu = array(
591 591
     'type' => 'normal',
592 592
     'title' => 'Home',
593 593
     'name' => 'navigation',
594 594
     'weight' => '0',
595 595
     'parent' => array(
596
-      'type' => 'none',
597
-      'title' => '',
598
-      'name' => 'navigation',
599
-      'weight' => '0',
596
+        'type' => 'none',
597
+        'title' => '',
598
+        'name' => 'navigation',
599
+        'weight' => '0',
600 600
     ),
601
-  );
602
-  $page->arguments = array();
603
-  $page->conf = array();
604
-  $page->default_handlers = array();
605
-  $handler = new stdClass;
606
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
607
-  $handler->api_version = 1;
608
-  $handler->name = 'page_home_panel_context';
609
-  $handler->task = 'page';
610
-  $handler->subtask = 'home';
611
-  $handler->handler = 'panel_context';
612
-  $handler->weight = 0;
613
-  $handler->conf = array(
601
+    );
602
+    $page->arguments = array();
603
+    $page->conf = array();
604
+    $page->default_handlers = array();
605
+    $handler = new stdClass;
606
+    $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
607
+    $handler->api_version = 1;
608
+    $handler->name = 'page_home_panel_context';
609
+    $handler->task = 'page';
610
+    $handler->subtask = 'home';
611
+    $handler->handler = 'panel_context';
612
+    $handler->weight = 0;
613
+    $handler->conf = array(
614 614
     'title' => 'Landing page',
615 615
     'no_blocks' => FALSE,
616 616
     'pipeline' => 'ipe',
@@ -618,23 +618,23 @@  discard block
 block discarded – undo
618 618
     'css' => '',
619 619
     'contexts' => array(),
620 620
     'relationships' => array(),
621
-  );
622
-  $display = new panels_display;
623
-  $display->layout = 'one_sidebar_second';
624
-  $display->layout_settings = array();
625
-  $display->panel_settings = array(
621
+    );
622
+    $display = new panels_display;
623
+    $display->layout = 'one_sidebar_second';
624
+    $display->layout_settings = array();
625
+    $display->panel_settings = array(
626 626
     'style_settings' => array(
627
-      'default' => NULL,
628
-      'content' => NULL,
629
-      'sidebar_first' => NULL,
627
+        'default' => NULL,
628
+        'content' => NULL,
629
+        'sidebar_first' => NULL,
630 630
     ),
631
-  );
632
-  $display->cache = array();
633
-  $display->title = '';
634
-  $display->storage_type = 'page_manager';
635
-  $display->storage_id = 'page_home_panel_context';
636
-  $display->content = array();
637
-  $display->panels = array();
631
+    );
632
+    $display->cache = array();
633
+    $display->title = '';
634
+    $display->storage_type = 'page_manager';
635
+    $display->storage_id = 'page_home_panel_context';
636
+    $display->content = array();
637
+    $display->panels = array();
638 638
     $pane = new stdClass;
639 639
     $pane->pid = 'new-1';
640 640
     $pane->panel = 'content';
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
     $pane->subtype = 'custom';
643 643
     $pane->shown = TRUE;
644 644
     $pane->access = array(
645
-      'plugins' => array(),
645
+        'plugins' => array(),
646 646
     );
647 647
     $pane->configuration = array(
648
-      'admin_title' => 'BOINC overview',
649
-      'title' => '',
650
-      'body' => '<?php print boincuser_home_page(); ?>',
651
-      'format' => '3',
652
-      'substitute' => TRUE,
648
+        'admin_title' => 'BOINC overview',
649
+        'title' => '',
650
+        'body' => '<?php print boincuser_home_page(); ?>',
651
+        'format' => '3',
652
+        'substitute' => TRUE,
653 653
     );
654 654
     $pane->cache = array();
655 655
     $pane->style = array(
656
-      'settings' => NULL,
656
+        'settings' => NULL,
657 657
     );
658 658
     $pane->css = array(
659
-      'css_id' => '',
660
-      'css_class' => 'panel-primary container shadow',
659
+        'css_id' => '',
660
+        'css_class' => 'panel-primary container shadow',
661 661
     );
662 662
     $pane->extras = array();
663 663
     $pane->position = 0;
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
     $pane->shown = TRUE;
672 672
     $pane->access = array();
673 673
     $pane->configuration = array(
674
-      'override_title' => 0,
675
-      'override_title_text' => '',
674
+        'override_title' => 0,
675
+        'override_title_text' => '',
676 676
     );
677 677
     $pane->cache = array();
678 678
     $pane->style = array(
679
-      'settings' => NULL,
679
+        'settings' => NULL,
680 680
     );
681 681
     $pane->css = array(
682
-      'css_id' => '',
683
-      'css_class' => 'panel-secondary container shadow balance-height-front no-resize',
682
+        'css_id' => '',
683
+        'css_class' => 'panel-secondary container shadow balance-height-front no-resize',
684 684
     );
685 685
     $pane->extras = array();
686 686
     $pane->position = 0;
@@ -694,39 +694,39 @@  discard block
 block discarded – undo
694 694
     $pane->shown = TRUE;
695 695
     $pane->access = array();
696 696
     $pane->configuration = array(
697
-      'override_pager_settings' => 1,
698
-      'use_pager' => 0,
699
-      'nodes_per_page' => '2',
700
-      'pager_id' => '',
701
-      'offset' => '0',
702
-      'more_link' => 1,
703
-      'feed_icons' => 1,
704
-      'panel_args' => 0,
705
-      'link_to_view' => 0,
706
-      'args' => '',
707
-      'url' => '',
708
-      'display' => 'page_2',
709
-      'override_title' => 1,
710
-      'override_title_text' => '',
697
+        'override_pager_settings' => 1,
698
+        'use_pager' => 0,
699
+        'nodes_per_page' => '2',
700
+        'pager_id' => '',
701
+        'offset' => '0',
702
+        'more_link' => 1,
703
+        'feed_icons' => 1,
704
+        'panel_args' => 0,
705
+        'link_to_view' => 0,
706
+        'args' => '',
707
+        'url' => '',
708
+        'display' => 'page_2',
709
+        'override_title' => 1,
710
+        'override_title_text' => '',
711 711
     );
712 712
     $pane->cache = array();
713 713
     $pane->style = array(
714
-      'settings' => NULL,
714
+        'settings' => NULL,
715 715
     );
716 716
     $pane->css = array(
717
-      'css_id' => '',
718
-      'css_class' => 'panel-secondary container shadow balance-height-front',
717
+        'css_id' => '',
718
+        'css_class' => 'panel-secondary container shadow balance-height-front',
719 719
     );
720 720
     $pane->extras = array();
721 721
     $pane->position = 1;
722 722
     $display->content['new-3'] = $pane;
723 723
     $display->panels['sidebar_first'][1] = 'new-3';
724
-  $display->hide_title = PANELS_TITLE_NONE;
725
-  $display->title_pane = '0';
726
-  $handler->conf['display'] = $display;
727
-  $page->default_handlers[$handler->name] = $handler;
728
-  $pages['home'] = $page;
724
+    $display->hide_title = PANELS_TITLE_NONE;
725
+    $display->title_pane = '0';
726
+    $handler->conf['display'] = $display;
727
+    $page->default_handlers[$handler->name] = $handler;
728
+    $pages['home'] = $page;
729 729
 
730
- return $pages;
730
+    return $pages;
731 731
 
732 732
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  */
6 6
 function boinc_standard_default_page_manager_pages() {
7 7
   $page = new stdClass;
8
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
8
+  $page->disabled = false; /* Edit this to true to make a default page disabled initially */
9 9
   $page->api_version = 1;
10 10
   $page->name = 'about_us';
11 11
   $page->task = 'page';
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $page->path = 'about.fail';
15 15
   $page->access = array(
16 16
     'type' => 'none',
17
-    'settings' => NULL,
17
+    'settings' => null,
18 18
   );
19 19
   $page->menu = array();
20 20
   $page->arguments = array();
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
   $pages['about_us'] = $page;
24 24
 
25 25
   $page = new stdClass;
26
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
26
+  $page->disabled = false; /* Edit this to true to make a default page disabled initially */
27 27
   $page->api_version = 1;
28 28
   $page->name = 'account_dashboard';
29 29
   $page->task = 'page';
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
           ),
41 41
         ),
42 42
         'context' => 'logged-in-user',
43
-        'not' => FALSE,
43
+        'not' => false,
44 44
       ),
45 45
     ),
46 46
     'logic' => 'and',
47 47
     'type' => 'none',
48
-    'settings' => NULL,
48
+    'settings' => null,
49 49
   );
50 50
   $page->menu = array(
51 51
     'type' => 'none',
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
   $page->conf = array();
64 64
   $page->default_handlers = array();
65 65
   $handler = new stdClass;
66
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
66
+  $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */
67 67
   $handler->api_version = 1;
68 68
   $handler->name = 'page_account_dashboard_panel_context';
69 69
   $handler->task = 'page';
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
   $handler->weight = 0;
73 73
   $handler->conf = array(
74 74
     'title' => 'Landing page',
75
-    'no_blocks' => FALSE,
75
+    'no_blocks' => false,
76 76
     'pipeline' => 'ipe',
77 77
     'css_id' => '',
78 78
     'css' => '',
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
   $display->layout_settings = array();
101 101
   $display->panel_settings = array(
102 102
     'style_settings' => array(
103
-      'default' => NULL,
104
-      'content' => NULL,
105
-      'sidebar_first' => NULL,
103
+      'default' => null,
104
+      'content' => null,
105
+      'sidebar_first' => null,
106 106
     ),
107 107
   );
108 108
   $display->cache = array();
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     $pane->panel = 'content';
117 117
     $pane->type = 'panels_mini';
118 118
     $pane->subtype = 'dashboard_tables';
119
-    $pane->shown = TRUE;
119
+    $pane->shown = true;
120 120
     $pane->access = array();
121 121
     $pane->configuration = array(
122 122
       'override_title' => 1,
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     );
125 125
     $pane->cache = array();
126 126
     $pane->style = array(
127
-      'settings' => NULL,
127
+      'settings' => null,
128 128
     );
129 129
     $pane->css = array(
130 130
       'css_id' => '',
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
     $pane->panel = 'content';
140 140
     $pane->type = 'views_panes';
141 141
     $pane->subtype = 'subscriptions-panel_pane_1';
142
-    $pane->shown = TRUE;
142
+    $pane->shown = true;
143 143
     $pane->access = array();
144 144
     $pane->configuration = array();
145 145
     $pane->cache = array();
146 146
     $pane->style = array(
147
-      'settings' => NULL,
147
+      'settings' => null,
148 148
     );
149 149
     $pane->css = array(
150 150
       'css_id' => '',
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     $pane->panel = 'sidebar_first';
160 160
     $pane->type = 'custom';
161 161
     $pane->subtype = 'custom';
162
-    $pane->shown = TRUE;
162
+    $pane->shown = true;
163 163
     $pane->access = array(
164 164
       'plugins' => array(
165 165
         1 => array(
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             'perm' => 'edit any profile content',
169 169
           ),
170 170
           'context' => 'context_user_1',
171
-          'not' => FALSE,
171
+          'not' => false,
172 172
         ),
173 173
       ),
174 174
     );
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     );
182 182
     $pane->cache = array();
183 183
     $pane->style = array(
184
-      'settings' => NULL,
184
+      'settings' => null,
185 185
     );
186 186
     $pane->css = array(
187 187
       'css_id' => '',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     $pane->panel = 'sidebar_first';
197 197
     $pane->type = 'panels_mini';
198 198
     $pane->subtype = 'user_mail_summary';
199
-    $pane->shown = TRUE;
199
+    $pane->shown = true;
200 200
     $pane->access = array();
201 201
     $pane->configuration = array(
202 202
       'override_title' => 0,
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     );
205 205
     $pane->cache = array();
206 206
     $pane->style = array(
207
-      'settings' => NULL,
207
+      'settings' => null,
208 208
     );
209 209
     $pane->css = array(
210 210
       'css_id' => '',
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     $pane->panel = 'sidebar_first';
220 220
     $pane->type = 'custom';
221 221
     $pane->subtype = 'custom';
222
-    $pane->shown = TRUE;
222
+    $pane->shown = true;
223 223
     $pane->access = array();
224 224
     $pane->configuration = array(
225 225
       'admin_title' => 'Team summary',
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     );
235 235
     $pane->cache = array();
236 236
     $pane->style = array(
237
-      'settings' => NULL,
237
+      'settings' => null,
238 238
     );
239 239
     $pane->css = array(
240 240
       'css_id' => 'team-dashboard-pane',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     $pane->panel = 'sidebar_first';
250 250
     $pane->type = 'custom';
251 251
     $pane->subtype = 'custom';
252
-    $pane->shown = TRUE;
252
+    $pane->shown = true;
253 253
     $pane->access = array();
254 254
     $pane->configuration = array(
255 255
       'admin_title' => 'User activity summary',
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     );
269 269
     $pane->cache = array();
270 270
     $pane->style = array(
271
-      'settings' => NULL,
271
+      'settings' => null,
272 272
     );
273 273
     $pane->css = array(
274 274
       'css_id' => '',
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     $pane->panel = 'sidebar_first';
284 284
     $pane->type = 'views';
285 285
     $pane->subtype = 'boinc_friends';
286
-    $pane->shown = TRUE;
286
+    $pane->shown = true;
287 287
     $pane->access = array();
288 288
     $pane->configuration = array(
289 289
       'override_pager_settings' => 0,
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     );
307 307
     $pane->cache = array();
308 308
     $pane->style = array(
309
-      'settings' => NULL,
309
+      'settings' => null,
310 310
     );
311 311
     $pane->css = array(
312 312
       'css_id' => '',
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
   $pages['account_dashboard'] = $page;
324 324
 
325 325
   $page = new stdClass;
326
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
326
+  $page->disabled = false; /* Edit this to true to make a default page disabled initially */
327 327
   $page->api_version = 1;
328 328
   $page->name = 'boinc_user';
329 329
   $page->task = 'page';
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
   $page->path = 'account/%user';
333 333
   $page->access = array(
334 334
     'type' => 'none',
335
-    'settings' => NULL,
335
+    'settings' => null,
336 336
   );
337 337
   $page->menu = array();
338 338
   $page->arguments = array(
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
   $page->conf = array();
347 347
   $page->default_handlers = array();
348 348
   $handler = new stdClass;
349
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
349
+  $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */
350 350
   $handler->api_version = 1;
351 351
   $handler->name = 'page_boinc_user_panel_context_2';
352 352
   $handler->task = 'page';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 return ($account->status);
372 372
 ',
373 373
           ),
374
-          'not' => FALSE,
374
+          'not' => false,
375 375
         ),
376 376
       ),
377 377
       'logic' => 'and',
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
   $display->layout_settings = array();
383 383
   $display->panel_settings = array(
384 384
     'style_settings' => array(
385
-      'default' => NULL,
386
-      'content' => NULL,
387
-      'sidebar_first' => NULL,
385
+      'default' => null,
386
+      'content' => null,
387
+      'sidebar_first' => null,
388 388
     ),
389 389
   );
390 390
   $display->cache = array();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     $pane->panel = 'content';
399 399
     $pane->type = 'panels_mini';
400 400
     $pane->subtype = 'user_profile';
401
-    $pane->shown = TRUE;
401
+    $pane->shown = true;
402 402
     $pane->access = array();
403 403
     $pane->configuration = array(
404 404
       'context' => array(
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     );
410 410
     $pane->cache = array();
411 411
     $pane->style = array(
412
-      'settings' => NULL,
412
+      'settings' => null,
413 413
     );
414 414
     $pane->css = array(
415 415
       'css_id' => '',
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     $pane->panel = 'sidebar_first';
425 425
     $pane->type = 'views_panes';
426 426
     $pane->subtype = 'boinc_account_stats-panel_pane_2';
427
-    $pane->shown = TRUE;
427
+    $pane->shown = true;
428 428
     $pane->access = array();
429 429
     $pane->configuration = array(
430 430
       'override_title' => 0,
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     );
433 433
     $pane->cache = array();
434 434
     $pane->style = array(
435
-      'settings' => NULL,
435
+      'settings' => null,
436 436
     );
437 437
     $pane->css = array(
438 438
       'css_id' => '',
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     $pane->panel = 'sidebar_first';
448 448
     $pane->type = 'custom';
449 449
     $pane->subtype = 'custom';
450
-    $pane->shown = TRUE;
450
+    $pane->shown = true;
451 451
     $pane->access = array();
452 452
     $pane->configuration = array(
453 453
       'admin_title' => 'Team summary',
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     );
463 463
     $pane->cache = array();
464 464
     $pane->style = array(
465
-      'settings' => NULL,
465
+      'settings' => null,
466 466
     );
467 467
     $pane->css = array(
468 468
       'css_id' => 'team-dashboard-pane',
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     $pane->panel = 'sidebar_first';
478 478
     $pane->type = 'custom';
479 479
     $pane->subtype = 'custom';
480
-    $pane->shown = TRUE;
480
+    $pane->shown = true;
481 481
     $pane->access = array();
482 482
     $pane->configuration = array(
483 483
       'admin_title' => 'User activity summary',
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     );
496 496
     $pane->cache = array();
497 497
     $pane->style = array(
498
-      'settings' => NULL,
498
+      'settings' => null,
499 499
     );
500 500
     $pane->css = array(
501 501
       'css_id' => '',
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
     $pane->panel = 'sidebar_first';
511 511
     $pane->type = 'views';
512 512
     $pane->subtype = 'boinc_friends';
513
-    $pane->shown = TRUE;
513
+    $pane->shown = true;
514 514
     $pane->access = array();
515 515
     $pane->configuration = array(
516 516
       'override_pager_settings' => 0,
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     );
534 534
     $pane->cache = array();
535 535
     $pane->style = array(
536
-      'settings' => NULL,
536
+      'settings' => null,
537 537
     );
538 538
     $pane->css = array(
539 539
       'css_id' => '',
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     $pane->panel = 'sidebar_first';
549 549
     $pane->type = 'custom';
550 550
     $pane->subtype = 'custom';
551
-    $pane->shown = TRUE;
551
+    $pane->shown = true;
552 552
     $pane->access = array();
553 553
     $pane->configuration = array(
554 554
       'admin_title' => 'Project list',
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     );
560 560
     $pane->cache = array();
561 561
     $pane->style = array(
562
-      'settings' => NULL,
562
+      'settings' => null,
563 563
     );
564 564
     $pane->css = array(
565 565
       'css_id' => '',
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
   $pages['boinc_user'] = $page;
577 577
 
578 578
   $page = new stdClass;
579
-  $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
579
+  $page->disabled = false; /* Edit this to true to make a default page disabled initially */
580 580
   $page->api_version = 1;
581 581
   $page->name = 'home';
582 582
   $page->task = 'page';
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
   $page->path = 'home';
586 586
   $page->access = array(
587 587
     'type' => 'none',
588
-    'settings' => NULL,
588
+    'settings' => null,
589 589
   );
590 590
   $page->menu = array(
591 591
     'type' => 'normal',
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
   $page->conf = array();
604 604
   $page->default_handlers = array();
605 605
   $handler = new stdClass;
606
-  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
606
+  $handler->disabled = false; /* Edit this to true to make a default handler disabled initially */
607 607
   $handler->api_version = 1;
608 608
   $handler->name = 'page_home_panel_context';
609 609
   $handler->task = 'page';
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
   $handler->weight = 0;
613 613
   $handler->conf = array(
614 614
     'title' => 'Landing page',
615
-    'no_blocks' => FALSE,
615
+    'no_blocks' => false,
616 616
     'pipeline' => 'ipe',
617 617
     'css_id' => '',
618 618
     'css' => '',
@@ -624,9 +624,9 @@  discard block
 block discarded – undo
624 624
   $display->layout_settings = array();
625 625
   $display->panel_settings = array(
626 626
     'style_settings' => array(
627
-      'default' => NULL,
628
-      'content' => NULL,
629
-      'sidebar_first' => NULL,
627
+      'default' => null,
628
+      'content' => null,
629
+      'sidebar_first' => null,
630 630
     ),
631 631
   );
632 632
   $display->cache = array();
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
     $pane->panel = 'content';
641 641
     $pane->type = 'custom';
642 642
     $pane->subtype = 'custom';
643
-    $pane->shown = TRUE;
643
+    $pane->shown = true;
644 644
     $pane->access = array(
645 645
       'plugins' => array(),
646 646
     );
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
       'title' => '',
650 650
       'body' => '<?php print boincuser_home_page(); ?>',
651 651
       'format' => '3',
652
-      'substitute' => TRUE,
652
+      'substitute' => true,
653 653
     );
654 654
     $pane->cache = array();
655 655
     $pane->style = array(
656
-      'settings' => NULL,
656
+      'settings' => null,
657 657
     );
658 658
     $pane->css = array(
659 659
       'css_id' => '',
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     $pane->panel = 'sidebar_first';
669 669
     $pane->type = 'panels_mini';
670 670
     $pane->subtype = 'project_stats_overview';
671
-    $pane->shown = TRUE;
671
+    $pane->shown = true;
672 672
     $pane->access = array();
673 673
     $pane->configuration = array(
674 674
       'override_title' => 0,
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
     );
677 677
     $pane->cache = array();
678 678
     $pane->style = array(
679
-      'settings' => NULL,
679
+      'settings' => null,
680 680
     );
681 681
     $pane->css = array(
682 682
       'css_id' => '',
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     $pane->panel = 'sidebar_first';
692 692
     $pane->type = 'views';
693 693
     $pane->subtype = 'news';
694
-    $pane->shown = TRUE;
694
+    $pane->shown = true;
695 695
     $pane->access = array();
696 696
     $pane->configuration = array(
697 697
       'override_pager_settings' => 1,
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
     );
712 712
     $pane->cache = array();
713 713
     $pane->style = array(
714
-      'settings' => NULL,
714
+      'settings' => null,
715 715
     );
716 716
     $pane->css = array(
717 717
       'css_id' => '',
Please login to merge, or discard this patch.