Passed
Branch master (7a17e1)
by Vitalii
08:27
created
default/boinc/modules/boincuser/boincuser_delete/boincuser_delete.module 1 patch
Switch Indentation   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -94,69 +94,69 @@  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
-      $common_acts = bts("All your posts and comments will be attributed to the Anonymous User. Your user profile will be deleted. Your host information will be deleted. And you will be removed from any team you are a member of.", array(), NULL, 'boinc:delete-user-account');
140
-
141
-      $deleteoptions = array(
142
-        'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), NULL, 'boinc:delete-user-account'),
143
-        'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', 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>',
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>',
144 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
+    $common_acts = bts("All your posts and comments will be attributed to the Anonymous User. Your user profile will be deleted. Your host information will be deleted. And you will be removed from any team you are a member of.", array(), NULL, 'boinc:delete-user-account');
140
+
141
+    $deleteoptions = array(
142
+      'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), NULL, 'boinc:delete-user-account'),
143
+      'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', array(), NULL, 'boinc:delete-user-account'),
144
+    );
145 145
 
146
-      $dtypes = variable_get('boincuser_delete_type', 'user_decides');
147
-      // Unset the other option if dtype is set. i.e., if dtype is set
148
-      // to soft delete, unset the hard delete option.  Likewise, add
149
-      // the 'common_acts' sentences to the option that remains.
150
-      switch ($dtypes) {
151
-        case 'soft_obfuscate':
152
-          unset($deleteoptions['boincuser_delete_delete']);
153
-          $deleteoptions['boincuser_delete_softdelete'] .= $common_acts;
154
-          break;
155
-        case 'hard_wipe':
156
-          unset($deleteoptions['boincuser_delete_softdelete']);
157
-          $deleteoptions['boincuser_delete_delete'] .= $common_acts;
158
-          break;
159
-      }
146
+    $dtypes = variable_get('boincuser_delete_type', 'user_decides');
147
+    // Unset the other option if dtype is set. i.e., if dtype is set
148
+    // to soft delete, unset the hard delete option.  Likewise, add
149
+    // the 'common_acts' sentences to the option that remains.
150
+    switch ($dtypes) {
151
+    case 'soft_obfuscate':
152
+    unset($deleteoptions['boincuser_delete_delete']);
153
+    $deleteoptions['boincuser_delete_softdelete'] .= $common_acts;
154
+    break;
155
+    case 'hard_wipe':
156
+    unset($deleteoptions['boincuser_delete_softdelete']);
157
+    $deleteoptions['boincuser_delete_delete'] .= $common_acts;
158
+    break;
159
+    }
160 160
 
161 161
       $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?';
162 162
       drupal_set_title($question);
@@ -324,56 +324,56 @@  discard block
 block discarded – undo
324 324
   // create token with 1 day/24 hour expiration
325 325
   $mytoken = create_token($account->boincuser_id, 'D', 24*60*60);
326 326
   switch ($op) {
327
-    case 'boincuser_delete_softdelete':
328
-      $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken";
327
+  case 'boincuser_delete_softdelete':
328
+    $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken";
329 329
       break;
330
-    case 'boincuser_delete_delete':
331
-      $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken";
332
-      break;
333
-  }
334
-
335
-  $mysubject = "Instructions for account deletion at {$site_name}";
336
-  $mymessage = ''
337
-    . "{$account->boincuser_name},\n"
338
-    . "\n"
339
-    . "We have received a request to DELETE your user account at "
340
-    . "${site_name}. Below in this email is a one-time token you must "
341
-    . "use. Either click on the link or copy-and-paste the URL into your "
342
-    . "browser address bar. Then you will be required to enter your password "
343
-    . "again to confirm your identity.\n"
344
-    . "\n"
345
-    . "${myurl}\n"
346
-    . "\n"
347
-    . "This one-time token will expire in 24 hours. Afterwards you must "
348
-    . "re-request deletion of your account in order to generate a new token.\n"
349
-    . "\n"
350
-    . "If you did not initiate this request, please login to the "
351
-    . "${site_name} Web site (${site_url}) and "
352
-    . "then contact the administrators.\n"
353
-    . "\n"
354
-    . "Thanks, \n"
355
-    . "\n"
356
-    . "{$site_name} support team";
357
-
358
-  // Create array for sending email to user to notify account is being
359
-  // disabled/deleted. Then send email.
360
-  $settings = array(
361
-    'from' => '',
362
-    'subject' => $mysubject,
363
-    'message' => $mymessage,
364
-  );
365
-  rules_action_mail_to_user($account, $settings);
366
-
367
-  drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
330
+case 'boincuser_delete_delete':
331
+  $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken";
332
+  break;
333
+}
368 334
 
369
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
370
-  // Redirect
371
-  if (!empty($redirect)) {
372
-    drupal_goto($redirect);
373
-  }
374
-  else {
375
-    drupal_goto();
376
-  }
335
+$mysubject = "Instructions for account deletion at {$site_name}";
336
+$mymessage = ''
337
+. "{$account->boincuser_name},\n"
338
+. "\n"
339
+. "We have received a request to DELETE your user account at "
340
+. "${site_name}. Below in this email is a one-time token you must "
341
+. "use. Either click on the link or copy-and-paste the URL into your "
342
+. "browser address bar. Then you will be required to enter your password "
343
+. "again to confirm your identity.\n"
344
+. "\n"
345
+. "${myurl}\n"
346
+. "\n"
347
+. "This one-time token will expire in 24 hours. Afterwards you must "
348
+. "re-request deletion of your account in order to generate a new token.\n"
349
+. "\n"
350
+. "If you did not initiate this request, please login to the "
351
+. "${site_name} Web site (${site_url}) and "
352
+. "then contact the administrators.\n"
353
+. "\n"
354
+. "Thanks, \n"
355
+. "\n"
356
+. "{$site_name} support team";
357
+
358
+// Create array for sending email to user to notify account is being
359
+// disabled/deleted. Then send email.
360
+$settings = array(
361
+'from' => '',
362
+'subject' => $mysubject,
363
+'message' => $mymessage,
364
+);
365
+rules_action_mail_to_user($account, $settings);
366
+
367
+drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info');
368
+
369
+$redirect = variable_get('boincuser_delete_redirect', '<front>');
370
+// Redirect
371
+if (!empty($redirect)) {
372
+drupal_goto($redirect);
373
+}
374
+else {
375
+drupal_goto();
376
+}
377 377
 }
378 378
 
379 379
 
@@ -385,88 +385,88 @@  discard block
 block discarded – undo
385 385
  * The final confirmation form for the user to delete their account.
386 386
  */
387 387
 function boincuser_delete_finalconfirmation(&$form_state, $token) {
388
-  require_boinc('token');
389
-
390
-  global $user;
391
-  $form = array();
392
-
393
-  // check BOINC user exists
394
-  $account = user_load(array('uid' => $user->uid));
395
-  $uid = $user->uid;
396
-  $boincid = $account->boincuser_id;
397
-  // check $token is valid
398
-  if (!is_valid_token($boincid, $token, 'D')) {
399
-    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.',
400
-    array(
401
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
402
-    ),
403
-    NULL, 'boinc:delete-user-account'), 'error');
404
-    drupal_goto();
405
-  }
406
-
407
-  // Attach account to this form.
408
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
409
-
410
-  // This form is for hard/wipe delete
411
-  $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
412
-
413
-  // Instructions
414
-  $form['main']['fs1'] = array(
415
-    '#type' => 'fieldset',
416
-    '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'),
417
-    '#weight' => 10,
418
-    '#collapsible' => TRUE,
419
-    '#collapsed' => TRUE,
420
-  );
421
-  $form['main']['fs1']['instructions1'] = array(
422
-    '#value' => '<p>'.
423
-    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').
424
-    '</p>',
425
-    '#prefix' => "<div id='delete-instructions'>",
426
-    '#suffix' => "</div>",
427
-  );
428
-
429
-  $form['main']['fs1']['instructions2'] = array(
430
-    '#value' => '<p>'.
431
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
432
-    '</p>',
433
-    '#prefix' => "<div id='delete-instructions'>",
434
-    '#suffix' => "</div>",
435
-  );
436
-
437
-  // Password field
438
-  $form['main']['current_pass'] = array(
439
-    '#type' => 'password',
440
-    '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'),
441
-    '#size' => 17,
442
-    '#attributes' => array(
443
-      'autocomplete' => 'off',
444
-    ),
445
-    '#weight' => 25,
446
-  );
447
-
448
-  // Form control
449
-  $form['form control tabs prefix'] = array(
450
-    '#value' => '<ul class="form-control tab-list">',
451
-    '#weight' => 1001,
452
-  );
453
-  $form['submit'] = array(
454
-    '#prefix' => '<li class="first tab">',
455
-    '#type' => 'submit',
456
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
457
-    '#suffix' => '</li>',
458
-    '#weight' => 1002,
459
-  );
460
-  $form['form control tabs'] = array(
461
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
462
-    '#weight' => 1003,
463
-  );
464
-  $form['form control tabs suffix'] = array(
465
-    '#value' => '</ul>',
466
-    '#weight' => 1004,
467
-  );
388
+require_boinc('token');
389
+
390
+global $user;
391
+$form = array();
392
+
393
+// check BOINC user exists
394
+$account = user_load(array('uid' => $user->uid));
395
+$uid = $user->uid;
396
+$boincid = $account->boincuser_id;
397
+// check $token is valid
398
+if (!is_valid_token($boincid, $token, 'D')) {
399
+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.',
400
+array(
401
+  '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
402
+),
403
+NULL, 'boinc:delete-user-account'), 'error');
404
+drupal_goto();
405
+}
468 406
 
469
-  return $form;
407
+// Attach account to this form.
408
+$form['_account'] = array('#type' => 'value', '#value' => $account);
409
+
410
+// This form is for hard/wipe delete
411
+$form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe');
412
+
413
+// Instructions
414
+$form['main']['fs1'] = array(
415
+'#type' => 'fieldset',
416
+'#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'),
417
+'#weight' => 10,
418
+'#collapsible' => TRUE,
419
+'#collapsed' => TRUE,
420
+);
421
+$form['main']['fs1']['instructions1'] = array(
422
+'#value' => '<p>'.
423
+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').
424
+'</p>',
425
+'#prefix' => "<div id='delete-instructions'>",
426
+'#suffix' => "</div>",
427
+);
428
+
429
+$form['main']['fs1']['instructions2'] = array(
430
+'#value' => '<p>'.
431
+bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
432
+'</p>',
433
+'#prefix' => "<div id='delete-instructions'>",
434
+'#suffix' => "</div>",
435
+);
436
+
437
+// Password field
438
+$form['main']['current_pass'] = array(
439
+'#type' => 'password',
440
+'#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'),
441
+'#size' => 17,
442
+'#attributes' => array(
443
+  'autocomplete' => 'off',
444
+),
445
+'#weight' => 25,
446
+);
447
+
448
+// Form control
449
+$form['form control tabs prefix'] = array(
450
+'#value' => '<ul class="form-control tab-list">',
451
+'#weight' => 1001,
452
+);
453
+$form['submit'] = array(
454
+'#prefix' => '<li class="first tab">',
455
+'#type' => 'submit',
456
+'#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
457
+'#suffix' => '</li>',
458
+'#weight' => 1002,
459
+);
460
+$form['form control tabs'] = array(
461
+'#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
462
+'#weight' => 1003,
463
+);
464
+$form['form control tabs suffix'] = array(
465
+'#value' => '</ul>',
466
+'#weight' => 1004,
467
+);
468
+
469
+return $form;
470 470
 }
471 471
 
472 472
 /**
@@ -474,133 +474,133 @@  discard block
 block discarded – undo
474 474
  * the soft/obfuscate method.
475 475
  */
476 476
 function boincuser_delete_softdelconfirmation(&$form_state, $token) {
477
-  require_boinc('token');
478
-
479
-  global $user;
480
-  $form = array();
481
-
482
-  // check BOINC user exists
483
-  $account = user_load(array('uid' => $user->uid));
484
-  $uid = $user->uid;
485
-  $boincid = $account->boincuser_id;
486
-
487
-  // check $token is valid
488
-  if (!is_valid_token($boincid, $token, 'D')) {
489
-    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.',
490
-    array(
491
-      '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
492
-    ),
493
-    NULL, 'boinc:delete-user-account'), 'error');
494
-    drupal_goto();
495
-  }
496
-
497
-  // Attach account to this form.
498
-  $form['_account'] = array('#type' => 'value', '#value' => $account);
499
-
500
-  // This form is for hard/wipe delete
501
-  $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
502
-
503
-  // Instructions
504
-  $form['main']['fs1'] = array(
505
-    '#type' => 'fieldset',
506
-    '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'),
507
-    '#weight' => 10,
508
-    '#collapsible' => TRUE,
509
-    '#collapsed' => TRUE,
510
-  );
511
-  $form['main']['fs1']['instructions1'] = array(
512
-    '#value' => '<p>'.
513
-    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').
514
-    '</p>',
515
-    '#prefix' => "<div id='delete-instructions'>",
516
-    '#suffix' => "</div>",
517
-  );
518
-
519
-  $form['main']['fs1']['instructions2'] = array(
520
-    '#value' => '<p>'.
521
-    bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
522
-    '</p>',
523
-    '#prefix' => "<div id='delete-instructions'>",
524
-    '#suffix' => "</div>",
525
-  );
526
-
527
-  // Password field
528
-  $form['main']['current_pass'] = array(
529
-    '#type' => 'password',
530
-    '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'),
531
-    '#size' => 17,
532
-    '#attributes' => array(
533
-      'autocomplete' => 'off',
534
-    ),
535
-    '#weight' => 25,
536
-  );
537
-
538
-  // Form control
539
-  $form['form control tabs prefix'] = array(
540
-    '#value' => '<ul class="form-control tab-list">',
541
-    '#weight' => 1001,
542
-  );
543
-  $form['submit'] = array(
544
-    '#prefix' => '<li class="first tab">',
545
-    '#type' => 'submit',
546
-    '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
547
-    '#suffix' => '</li>',
548
-    '#weight' => 1002,
549
-  );
550
-  $form['form control tabs'] = array(
551
-    '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
552
-    '#weight' => 1003,
553
-  );
554
-  $form['form control tabs suffix'] = array(
555
-    '#value' => '</ul>',
556
-    '#weight' => 1004,
557
-  );
477
+require_boinc('token');
478
+
479
+global $user;
480
+$form = array();
481
+
482
+// check BOINC user exists
483
+$account = user_load(array('uid' => $user->uid));
484
+$uid = $user->uid;
485
+$boincid = $account->boincuser_id;
486
+
487
+// check $token is valid
488
+if (!is_valid_token($boincid, $token, 'D')) {
489
+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.',
490
+array(
491
+  '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"),
492
+),
493
+NULL, 'boinc:delete-user-account'), 'error');
494
+drupal_goto();
495
+}
558 496
 
559
-  //set validation and submit to the functions below
560
-  $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
561
-  $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
562
-  return $form;
497
+// Attach account to this form.
498
+$form['_account'] = array('#type' => 'value', '#value' => $account);
499
+
500
+// This form is for hard/wipe delete
501
+$form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate');
502
+
503
+// Instructions
504
+$form['main']['fs1'] = array(
505
+'#type' => 'fieldset',
506
+'#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'),
507
+'#weight' => 10,
508
+'#collapsible' => TRUE,
509
+'#collapsed' => TRUE,
510
+);
511
+$form['main']['fs1']['instructions1'] = array(
512
+'#value' => '<p>'.
513
+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').
514
+'</p>',
515
+'#prefix' => "<div id='delete-instructions'>",
516
+'#suffix' => "</div>",
517
+);
518
+
519
+$form['main']['fs1']['instructions2'] = array(
520
+'#value' => '<p>'.
521
+bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account').
522
+'</p>',
523
+'#prefix' => "<div id='delete-instructions'>",
524
+'#suffix' => "</div>",
525
+);
526
+
527
+// Password field
528
+$form['main']['current_pass'] = array(
529
+'#type' => 'password',
530
+'#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'),
531
+'#size' => 17,
532
+'#attributes' => array(
533
+  'autocomplete' => 'off',
534
+),
535
+'#weight' => 25,
536
+);
537
+
538
+// Form control
539
+$form['form control tabs prefix'] = array(
540
+'#value' => '<ul class="form-control tab-list">',
541
+'#weight' => 1001,
542
+);
543
+$form['submit'] = array(
544
+'#prefix' => '<li class="first tab">',
545
+'#type' => 'submit',
546
+'#value' => bts('Submit', array(), NULL, 'boinc:form-submit'),
547
+'#suffix' => '</li>',
548
+'#weight' => 1002,
549
+);
550
+$form['form control tabs'] = array(
551
+'#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>',
552
+'#weight' => 1003,
553
+);
554
+$form['form control tabs suffix'] = array(
555
+'#value' => '</ul>',
556
+'#weight' => 1004,
557
+);
558
+
559
+//set validation and submit to the functions below
560
+$form['#validate'][] = 'boincuser_delete_finalconfirmation_validate';
561
+$form['#submit'][] = 'boincuser_delete_finalconfirmation_submit';
562
+return $form;
563 563
 }
564 564
 
565 565
 /**
566 566
  * Validation for final confirmation
567 567
  */
568 568
 function boincuser_delete_finalconfirmation_validate($form, &$form_state) {
569
-  $account = $form_state['values']['_account'];
570
-  $boinc_user = BoincUser::lookup_id($account->boincuser_id);
569
+$account = $form_state['values']['_account'];
570
+$boinc_user = BoincUser::lookup_id($account->boincuser_id);
571 571
 
572
-  if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
573
-    return true;
574
-  }
572
+if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) {
573
+return true;
574
+}
575 575
 }
576 576
 
577 577
 /**
578 578
  * Submit for final confirmation
579 579
  */
580 580
 function boincuser_delete_finalconfirmation_submit($form, &$form_state) {
581
-  global $user;
582
-
583
-  // Delete the user
584
-  $account = $form_state['values']['_account'];
585
-  $action = $form_state['values']['_action'];
586
-  _boincuser_delete_deleteuser($account, $action);
587
-
588
-  // Destroy the current session:
589
-  session_destroy();
590
-  // Only variables can be passed by reference workaround.
591
-  $null = NULL;
592
-  user_module_invoke('logout', $null, $user);
593
-
594
-  // Load the anonymous user
595
-  $user = drupal_anonymous_user();
596
-
597
-  $redirect = variable_get('boincuser_delete_redirect', '<front>');
598
-  // Redirect
599
-  if (!empty($redirect)) {
600
-    drupal_goto($redirect);
601
-  }
602
-  else {
603
-    drupal_goto();
604
-  }
581
+global $user;
582
+
583
+// Delete the user
584
+$account = $form_state['values']['_account'];
585
+$action = $form_state['values']['_action'];
586
+_boincuser_delete_deleteuser($account, $action);
587
+
588
+// Destroy the current session:
589
+session_destroy();
590
+// Only variables can be passed by reference workaround.
591
+$null = NULL;
592
+user_module_invoke('logout', $null, $user);
593
+
594
+// Load the anonymous user
595
+$user = drupal_anonymous_user();
596
+
597
+$redirect = variable_get('boincuser_delete_redirect', '<front>');
598
+// Redirect
599
+if (!empty($redirect)) {
600
+drupal_goto($redirect);
601
+}
602
+else {
603
+drupal_goto();
604
+}
605 605
 
606 606
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/includes/boincwork.helpers.inc 1 patch
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
     }
644 644
     break;
645 645
     
646
-    default:
647
-      // Don't generate form elements for things that aren't explicitly form
648
-      // elements (i.e. 'title', '@attributes' keys, and the like)
646
+  default:
647
+    // Don't generate form elements for things that aren't explicitly form
648
+    // elements (i.e. 'title', '@attributes' keys, and the like)
649 649
   }
650 650
 }
651 651
 
@@ -1990,29 +1990,29 @@  discard block
 block discarded – undo
1990 1990
  */
1991 1991
 function pretty_application_version($appverid, $vernum, $plan_class, $plfm) {
1992 1992
   switch ($appverid) {
1993
-    case ANON_PLATFORM_UNKNOWN:
1994
-      return "Anonymous platform";
1995
-    case ANON_PLATFORM_CPU:
1996
-      return "Anonymous platform CPU";
1997
-    case ANON_PLATFORM_NVIDIA:
1998
-      return "Anonymous platform NVIDIA GPU";
1999
-    case ANON_PLATFORM_ATI:
2000
-      return "Anonymous platform AMD GPU";
2001
-    case ANON_PLATFORM_INTEL:
2002
-      return "Anonymous platform Intel GPU";
2003
-    case 0:
2004
-      return "---";
2005
-    default:
2006
-      // Handle the case where the appversid is still negative. This
2007
-      // may be cause BOINC has introduced a new anonymous platform
2008
-      // that is not handled by the above case statements.
2009
-      if ($appverid < 0) {
2010
-        return "Unknown Anonymous platform";
2011
-      }
2012
-      else {
2013
-        $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
2014
-        $prettyc = ($plan_class) ? "($av->plan_class)" : '';
2015
-        return "v$prettyv $prettyc $plfm";
2016
-      }
1993
+  case ANON_PLATFORM_UNKNOWN:
1994
+    return "Anonymous platform";
1995
+  case ANON_PLATFORM_CPU:
1996
+    return "Anonymous platform CPU";
1997
+  case ANON_PLATFORM_NVIDIA:
1998
+    return "Anonymous platform NVIDIA GPU";
1999
+  case ANON_PLATFORM_ATI:
2000
+    return "Anonymous platform AMD GPU";
2001
+  case ANON_PLATFORM_INTEL:
2002
+    return "Anonymous platform Intel GPU";
2003
+  case 0:
2004
+    return "---";
2005
+  default:
2006
+    // Handle the case where the appversid is still negative. This
2007
+    // may be cause BOINC has introduced a new anonymous platform
2008
+    // that is not handled by the above case statements.
2009
+    if ($appverid < 0) {
2010
+      return "Unknown Anonymous platform";
2011
+    }
2012
+    else {
2013
+      $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
2014
+      $prettyc = ($plan_class) ? "($av->plan_class)" : '';
2015
+      return "v$prettyv $prettyc $plfm";
2016
+    }
2017 2017
   }
2018 2018
 }
Please login to merge, or discard this patch.
html/user/submit_rpc_handler.php 1 patch
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1049,24 +1049,24 @@
 block discarded – undo
1049 1049
 log_write("----- Handling RPC; command ".$r->getName());
1050 1050
 
1051 1051
 switch ($r->getName()) {
1052
-    case 'abort_batch': handle_abort_batch($r); break;
1053
-    case 'abort_jobs': handle_abort_jobs($r); break;
1054
-    case 'create_batch': create_batch($r); break;
1055
-    case 'estimate_batch': estimate_batch($r); break;
1056
-    case 'get_templates': get_templates($r); break;
1057
-    case 'ping': ping($r); break;
1058
-    case 'query_batch': query_batch($r); break;
1059
-    case 'query_batch2': query_batch2($r); break;
1060
-    case 'query_batches': query_batches($r); break;
1061
-    case 'query_job': query_job($r); break;
1062
-    case 'query_completed_job': query_completed_job($r); break;
1063
-    case 'retire_batch': handle_retire_batch($r); break;
1064
-    case 'set_expire_time': handle_set_expire_time($r); break;
1065
-    case 'submit_batch': submit_batch($r); break;
1066
-    default:
1067
-        log_write("bad command");
1068
-        xml_error(-1, "bad command: ".$r->getName());
1069
-        break;
1052
+case 'abort_batch': handle_abort_batch($r); break;
1053
+case 'abort_jobs': handle_abort_jobs($r); break;
1054
+case 'create_batch': create_batch($r); break;
1055
+case 'estimate_batch': estimate_batch($r); break;
1056
+case 'get_templates': get_templates($r); break;
1057
+case 'ping': ping($r); break;
1058
+case 'query_batch': query_batch($r); break;
1059
+case 'query_batch2': query_batch2($r); break;
1060
+case 'query_batches': query_batches($r); break;
1061
+case 'query_job': query_job($r); break;
1062
+case 'query_completed_job': query_completed_job($r); break;
1063
+case 'retire_batch': handle_retire_batch($r); break;
1064
+case 'set_expire_time': handle_set_expire_time($r); break;
1065
+case 'submit_batch': submit_batch($r); break;
1066
+default:
1067
+    log_write("bad command");
1068
+    xml_error(-1, "bad command: ".$r->getName());
1069
+    break;
1070 1070
 }
1071 1071
 
1072 1072
 log_write("RPC done");
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/boincuser.admin.inc 1 patch
Switch Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -32,42 +32,42 @@
 block discarded – undo
32 32
   * existing BOINC web interface.
33 33
   */
34 34
 function boincuser_admin_environment(&$form_state) {
35
-  global $base_url;
36
-  $form = array();
37
-  $default = array(
38
-    'boinc_root_dir' => variable_get('boinc_root_dir', ''),
39
-    'boinc_config_xml_dir' => variable_get('boinc_config_xml_dir', ''),
40
-    'boinc_html_inc_dir' => variable_get('boinc_html_inc_dir', ''),
41
-    'boinc_project_config_dir' => variable_get('boinc_project_config_dir', ''),
42
-    'boinc_user_image_dir' => variable_get('boinc_user_image_dir', ''),
43
-    'boinc_host_sched_logs_dir' => variable_get('boinc_host_sched_logs_dir', ''),
44
-    'boinc_server_status_url' => variable_get('boinc_server_status_url', ''),
45
-    'boinc_app_list_url' => variable_get('boinc_app_list_url', ''),
46
-    'boinc_admin_mailing_list' => variable_get('boinc_admin_mailing_list', ''),
47
-    'boinc_admin_mailing_list_subject_tag' => variable_get('boinc_admin_mailing_list_subject_tag', ''),
48
-    'boinc_debug_mode' => variable_get('boinc_debug_mode', 0),
49
-    'boinc_project_config_keywords' => variable_get('boinc_project_config_keywords', ''),
50
-  );
51
-  //drupal_set_message(print_r($default, true));
52
-  //drupal_set_message(print_r($form_state, true));
53
-  // Show overrides if the root dir is set and others have not been detected
54
-  $show_overrides = FALSE;
55
-  if ($default['boinc_root_dir']) {
56
-    foreach ($default as $key => $dir) {
57
-      switch ($key) {
58
-      case 'boinc_config_xml_dir':
59
-      case 'boinc_html_inc_dir':
60
-      case 'boinc_project_config_dir':
61
-      case 'boinc_user_image_dir':
62
-        // If any of these values are not set, show the overrides section
63
-        if (!$dir) {
64
-          $default[$key] = $form_state['values'][$key];
65
-          $show_overrides = TRUE;
66
-          break;
67
-        }
68
-        break;
69
-      default:
70
-      }
35
+global $base_url;
36
+$form = array();
37
+$default = array(
38
+'boinc_root_dir' => variable_get('boinc_root_dir', ''),
39
+'boinc_config_xml_dir' => variable_get('boinc_config_xml_dir', ''),
40
+'boinc_html_inc_dir' => variable_get('boinc_html_inc_dir', ''),
41
+'boinc_project_config_dir' => variable_get('boinc_project_config_dir', ''),
42
+'boinc_user_image_dir' => variable_get('boinc_user_image_dir', ''),
43
+'boinc_host_sched_logs_dir' => variable_get('boinc_host_sched_logs_dir', ''),
44
+'boinc_server_status_url' => variable_get('boinc_server_status_url', ''),
45
+'boinc_app_list_url' => variable_get('boinc_app_list_url', ''),
46
+'boinc_admin_mailing_list' => variable_get('boinc_admin_mailing_list', ''),
47
+'boinc_admin_mailing_list_subject_tag' => variable_get('boinc_admin_mailing_list_subject_tag', ''),
48
+'boinc_debug_mode' => variable_get('boinc_debug_mode', 0),
49
+'boinc_project_config_keywords' => variable_get('boinc_project_config_keywords', ''),
50
+);
51
+//drupal_set_message(print_r($default, true));
52
+//drupal_set_message(print_r($form_state, true));
53
+// Show overrides if the root dir is set and others have not been detected
54
+$show_overrides = FALSE;
55
+if ($default['boinc_root_dir']) {
56
+foreach ($default as $key => $dir) {
57
+  switch ($key) {
58
+  case 'boinc_config_xml_dir':
59
+  case 'boinc_html_inc_dir':
60
+  case 'boinc_project_config_dir':
61
+  case 'boinc_user_image_dir':
62
+  // If any of these values are not set, show the overrides section
63
+  if (!$dir) {
64
+  $default[$key] = $form_state['values'][$key];
65
+  $show_overrides = TRUE;
66
+  break;
67
+  }
68
+  break;
69
+  default:
70
+  }
71 71
       if ($show_overrides) {
72 72
         break;
73 73
       }
Please login to merge, or discard this patch.