@@ -94,8 +94,7 @@ discard block |
||
94 | 94 | '#prefix' => '<li class="tab">', |
95 | 95 | '#suffix' => '</li>', |
96 | 96 | ); |
97 | - } |
|
98 | - else if ( user_access('administer users') ) { |
|
97 | + } else if ( user_access('administer users') ) { |
|
99 | 98 | $form['delete'] = array( |
100 | 99 | '#type' => 'submit', |
101 | 100 | '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
@@ -104,8 +103,7 @@ discard block |
||
104 | 103 | '#prefix' => '<li class="tab">', |
105 | 104 | '#suffix' => '</li>', |
106 | 105 | ); |
107 | - } |
|
108 | - else { |
|
106 | + } else { |
|
109 | 107 | unset($form['delete']); |
110 | 108 | } |
111 | 109 | break; |
@@ -295,8 +293,7 @@ discard block |
||
295 | 293 | // Redirect |
296 | 294 | if (!empty($redirect)) { |
297 | 295 | drupal_goto($redirect); |
298 | - } |
|
299 | - else { |
|
296 | + } else { |
|
300 | 297 | drupal_goto(); |
301 | 298 | } |
302 | 299 | } |
@@ -429,8 +426,7 @@ discard block |
||
429 | 426 | // Redirect |
430 | 427 | if (!empty($redirect)) { |
431 | 428 | drupal_goto($redirect); |
432 | - } |
|
433 | - else { |
|
429 | + } else { |
|
434 | 430 | drupal_goto(); |
435 | 431 | } |
436 | 432 |
@@ -94,69 +94,69 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -93,9 +93,9 @@ discard block |
||
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 |
||
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'), |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | break; |
159 | 159 | } |
160 | 160 | |
161 | - $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
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); |
163 | 163 | |
164 | 164 | unset($form['description']); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | ); |
178 | 178 | $form['main']['fs1']['help'] = array( |
179 | 179 | '#value' => bts( |
180 | - "<p>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>" . |
|
180 | + "<p>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>". |
|
181 | 181 | "<p>If necessary, you may !link first before deleting your account. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
182 | 182 | array( |
183 | 183 | '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | if ($dtypes == 'user_decides') { |
191 | 191 | $form['main']['common'] = array( |
192 | - '#value' => bts('All choices: ', array(), NULL, 'boinc:delete-user-account') . $common_acts . '<p>' . bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), NULL, 'boinc:delete-user-account'), |
|
192 | + '#value' => bts('All choices: ', array(), NULL, 'boinc:delete-user-account').$common_acts.'<p>'.bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), NULL, 'boinc:delete-user-account'), |
|
193 | 193 | '#prefix' => "<div id='delete-instructions'>", |
194 | 194 | '#suffix' => "</div>", |
195 | 195 | '#weight' => 20, |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | '#weight' => 1010, |
258 | 258 | ); |
259 | 259 | |
260 | - $form['#redirect'] = 'account/' . $uid; |
|
260 | + $form['#redirect'] = 'account/'.$uid; |
|
261 | 261 | $form['#validate'] = array('boincuser_delete_validate'); |
262 | 262 | $form['#submit'] = array('boincuser_delete_submit'); |
263 | 263 | break; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | global $base_path; |
318 | 318 | module_load_include('inc', 'rules', 'modules/system.rules'); |
319 | 319 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
320 | - $site_url = $base_url . $base_path . "user/login"; |
|
320 | + $site_url = $base_url.$base_path."user/login"; |
|
321 | 321 | |
322 | 322 | // Perform the requested operation |
323 | 323 | $op = $form_state['values']['user_delete_action']; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | ); |
365 | 365 | rules_action_mail_to_user($account, $settings); |
366 | 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'); |
|
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 | 368 | |
369 | 369 | $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
370 | 370 | // Redirect |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | '#weight' => 1002, |
459 | 459 | ); |
460 | 460 | $form['form control tabs'] = array( |
461 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
|
461 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/").'</li>', |
|
462 | 462 | '#weight' => 1003, |
463 | 463 | ); |
464 | 464 | $form['form control tabs suffix'] = array( |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | '#weight' => 1002, |
549 | 549 | ); |
550 | 550 | $form['form control tabs'] = array( |
551 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
|
551 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/").'</li>', |
|
552 | 552 | '#weight' => 1003, |
553 | 553 | ); |
554 | 554 | $form['form control tabs suffix'] = array( |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | * Implementation of hook_perm(). |
21 | 21 | */ |
22 | 22 | function boincuser_delete_perm() { |
23 | - return array('delete own account'); |
|
23 | + return array('delete own account'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Implementation of hook_menu(). |
28 | 28 | */ |
29 | 29 | function boincuser_delete_menu() { |
30 | - $items = array(); |
|
31 | - $items['admin/boinc/user_delete'] = array( |
|
30 | + $items = array(); |
|
31 | + $items['admin/boinc/user_delete'] = array( |
|
32 | 32 | 'title' => t('Preferences: BOINC user delete'), |
33 | 33 | 'description' => t('Configure the BOINC user delete action.'), |
34 | 34 | 'page callback' => 'drupal_get_form', |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | 'access arguments' => array('administer users'), |
37 | 37 | 'type' => MENU_NORMAL_ITEM, |
38 | 38 | 'file' => 'boincuser_delete.admin.inc', |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - $items['admin/boinc/user_delete/%'] = array( |
|
41 | + $items['admin/boinc/user_delete/%'] = array( |
|
42 | 42 | 'title' => t('Admin delete user'), |
43 | 43 | 'description' => t('Deletes a user as an admin'), |
44 | 44 | 'page callback' => 'drupal_get_form', |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | 'access arguments' => array('administer users'), |
47 | 47 | 'type' => MENU_CALLBACK, |
48 | 48 | 'file' => 'boincuser_delete.admin.inc', |
49 | - ); |
|
49 | + ); |
|
50 | 50 | |
51 | - $items['user/%user/deleteconfirm/%'] = array( |
|
51 | + $items['user/%user/deleteconfirm/%'] = array( |
|
52 | 52 | 'title' => t('Final confirmation for account deletion'), |
53 | 53 | 'description' => t('Final confirmation for account deletion'), |
54 | 54 | 'page callback' => 'drupal_get_form', |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | 'access callback' => 'boincuser_delete_access', |
57 | 57 | 'access arguments' => array(1), |
58 | 58 | 'type' => MENU_CALLBACK, |
59 | - ); |
|
59 | + ); |
|
60 | 60 | |
61 | - $items['user/%user/odeleteconfirm/%'] = array( |
|
61 | + $items['user/%user/odeleteconfirm/%'] = array( |
|
62 | 62 | 'title' => t('Final confirmation for account deletion'), |
63 | 63 | 'description' => t('Final confirmation for account deletion'), |
64 | 64 | 'page callback' => 'drupal_get_form', |
@@ -66,204 +66,204 @@ discard block |
||
66 | 66 | 'access callback' => 'boincuser_delete_access', |
67 | 67 | 'access arguments' => array(1), |
68 | 68 | 'type' => MENU_CALLBACK, |
69 | - ); |
|
69 | + ); |
|
70 | 70 | |
71 | - return $items; |
|
71 | + return $items; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Checks whether a user can delete an account. |
76 | 76 | */ |
77 | 77 | function boincuser_delete_access($account) { |
78 | - global $user; |
|
79 | - return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0); |
|
78 | + global $user; |
|
79 | + return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Implementation of hook_menu_alter(). |
84 | 84 | */ |
85 | 85 | function boincuser_delete_menu_alter(&$callbacks) { |
86 | - $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access'; |
|
87 | - $callbacks['user/%user/delete']['access arguments'] = array(1); |
|
88 | - $callbacks['user/%user/delete']['type'] = MENU_CALLBACK; |
|
86 | + $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access'; |
|
87 | + $callbacks['user/%user/delete']['access arguments'] = array(1); |
|
88 | + $callbacks['user/%user/delete']['type'] = MENU_CALLBACK; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Implementation of hook_form_alter(). |
93 | 93 | */ |
94 | 94 | function boincuser_delete_form_alter(&$form, $form_state, $form_id) { |
95 | - global $user; |
|
95 | + global $user; |
|
96 | 96 | |
97 | - switch($form_id) { |
|
97 | + switch($form_id) { |
|
98 | 98 | case 'user_profile_form': |
99 | 99 | if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
100 | 100 | $form['delete'] = array( |
101 | - '#type' => 'submit', |
|
102 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
103 | - '#weight' => 1009, |
|
104 | - '#submit' => array('user_edit_delete_submit'), |
|
105 | - '#prefix' => '<li class="tab">', |
|
106 | - '#suffix' => '</li>', |
|
101 | + '#type' => 'submit', |
|
102 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
103 | + '#weight' => 1009, |
|
104 | + '#submit' => array('user_edit_delete_submit'), |
|
105 | + '#prefix' => '<li class="tab">', |
|
106 | + '#suffix' => '</li>', |
|
107 | 107 | ); |
108 | - } |
|
109 | - else if ( user_access('administer users') ) { |
|
108 | + } |
|
109 | + else if ( user_access('administer users') ) { |
|
110 | 110 | $form['delete'] = array( |
111 | - '#type' => 'submit', |
|
112 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
113 | - '#weight' => 1009, |
|
114 | - '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
115 | - '#prefix' => '<li class="tab">', |
|
116 | - '#suffix' => '</li>', |
|
111 | + '#type' => 'submit', |
|
112 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
113 | + '#weight' => 1009, |
|
114 | + '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
115 | + '#prefix' => '<li class="tab">', |
|
116 | + '#suffix' => '</li>', |
|
117 | 117 | ); |
118 | - } |
|
119 | - else { |
|
118 | + } |
|
119 | + else { |
|
120 | 120 | unset($form['delete']); |
121 | - } |
|
122 | - break; |
|
121 | + } |
|
122 | + break; |
|
123 | 123 | case 'user_confirm_delete': |
124 | 124 | |
125 | 125 | $disable_delete = FALSE; |
126 | - // If email address was changed less than 7 days (7 * 86400 s) |
|
127 | - // ago, it cannot be changed again. |
|
128 | - $duration = TOKEN_DURATION_ONE_WEEK; |
|
129 | - if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
126 | + // If email address was changed less than 7 days (7 * 86400 s) |
|
127 | + // ago, it cannot be changed again. |
|
128 | + $duration = TOKEN_DURATION_ONE_WEEK; |
|
129 | + if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
130 | 130 | drupal_set_message( |
131 | - bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
131 | + bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
132 | 132 | array( |
133 | - '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
133 | + '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
134 | 134 | ), NULL, 'boinc:account-credentials-change') |
135 | 135 | , 'info'); |
136 | 136 | $disable_delete = TRUE; |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - // Configure radio options |
|
140 | - $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'); |
|
139 | + // Configure radio options |
|
140 | + $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'); |
|
141 | 141 | |
142 | - $deleteoptions = array( |
|
142 | + $deleteoptions = array( |
|
143 | 143 | 'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), NULL, 'boinc:delete-user-account'), |
144 | 144 | 'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', array(), NULL, 'boinc:delete-user-account'), |
145 | - ); |
|
145 | + ); |
|
146 | 146 | |
147 | - $dtypes = variable_get('boincuser_delete_type', 'user_decides'); |
|
148 | - // Unset the other option if dtype is set. i.e., if dtype is set |
|
149 | - // to soft delete, unset the hard delete option. Likewise, add |
|
150 | - // the 'common_acts' sentences to the option that remains. |
|
151 | - switch ($dtypes) { |
|
147 | + $dtypes = variable_get('boincuser_delete_type', 'user_decides'); |
|
148 | + // Unset the other option if dtype is set. i.e., if dtype is set |
|
149 | + // to soft delete, unset the hard delete option. Likewise, add |
|
150 | + // the 'common_acts' sentences to the option that remains. |
|
151 | + switch ($dtypes) { |
|
152 | 152 | case 'soft_obfuscate': |
153 | 153 | unset($deleteoptions['boincuser_delete_delete']); |
154 | - $deleteoptions['boincuser_delete_softdelete'] .= $common_acts; |
|
155 | - break; |
|
154 | + $deleteoptions['boincuser_delete_softdelete'] .= $common_acts; |
|
155 | + break; |
|
156 | 156 | case 'hard_wipe': |
157 | 157 | unset($deleteoptions['boincuser_delete_softdelete']); |
158 | - $deleteoptions['boincuser_delete_delete'] .= $common_acts; |
|
159 | - break; |
|
160 | - } |
|
158 | + $deleteoptions['boincuser_delete_delete'] .= $common_acts; |
|
159 | + break; |
|
160 | + } |
|
161 | 161 | |
162 | - $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
163 | - drupal_set_title($question); |
|
162 | + $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
163 | + drupal_set_title($question); |
|
164 | 164 | |
165 | - unset($form['description']); |
|
165 | + unset($form['description']); |
|
166 | 166 | |
167 | - $form['main'] = array( |
|
167 | + $form['main'] = array( |
|
168 | 168 | '#type' => 'fieldset', |
169 | 169 | '#weight' => 1, |
170 | - ); |
|
170 | + ); |
|
171 | 171 | |
172 | - $form['main']['fs1'] = array( |
|
172 | + $form['main']['fs1'] = array( |
|
173 | 173 | '#type' => 'fieldset', |
174 | 174 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
175 | 175 | '#weight' => 10, |
176 | 176 | '#collapsible' => TRUE, |
177 | 177 | '#collapsed' => TRUE, |
178 | - ); |
|
179 | - $form['main']['fs1']['help'] = array( |
|
178 | + ); |
|
179 | + $form['main']['fs1']['help'] = array( |
|
180 | 180 | '#value' => bts( |
181 | - "<p>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>" . |
|
182 | - "<p>If necessary, you may !link first before deleting your account. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
|
183 | - array( |
|
181 | + "<p>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>" . |
|
182 | + "<p>If necessary, you may !link first before deleting your account. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
|
183 | + array( |
|
184 | 184 | '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
185 | - ), NULL, 'boinc:delete-user-account'), |
|
185 | + ), NULL, 'boinc:delete-user-account'), |
|
186 | 186 | '#weight' => 11, |
187 | 187 | '#prefix' => "<div id='delete-instructions'>", |
188 | 188 | '#suffix' => "</div>", |
189 | - ); |
|
189 | + ); |
|
190 | 190 | |
191 | - if ($dtypes == 'user_decides') { |
|
191 | + if ($dtypes == 'user_decides') { |
|
192 | 192 | $form['main']['common'] = array( |
193 | - '#value' => bts('All choices: ', array(), NULL, 'boinc:delete-user-account') . $common_acts . '<p>' . bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), NULL, 'boinc:delete-user-account'), |
|
194 | - '#prefix' => "<div id='delete-instructions'>", |
|
195 | - '#suffix' => "</div>", |
|
196 | - '#weight' => 20, |
|
193 | + '#value' => bts('All choices: ', array(), NULL, 'boinc:delete-user-account') . $common_acts . '<p>' . bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), NULL, 'boinc:delete-user-account'), |
|
194 | + '#prefix' => "<div id='delete-instructions'>", |
|
195 | + '#suffix' => "</div>", |
|
196 | + '#weight' => 20, |
|
197 | 197 | ); |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - $form['main']['user_delete_action'] = array( |
|
200 | + $form['main']['user_delete_action'] = array( |
|
201 | 201 | '#type' => 'radios', |
202 | 202 | '#options' => $deleteoptions, |
203 | 203 | '#weight' => 21, |
204 | - ); |
|
205 | - if ($disable_delete) { |
|
204 | + ); |
|
205 | + if ($disable_delete) { |
|
206 | 206 | $form['main']['user_delete_action']['#disabled'] = TRUE; |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | - // Password field |
|
210 | - if (!$disable_delete) { |
|
209 | + // Password field |
|
210 | + if (!$disable_delete) { |
|
211 | 211 | $form['main']['current_pass'] = array( |
212 | - '#type' => 'password', |
|
213 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
214 | - '#size' => 17, |
|
215 | - '#attributes' => array( |
|
212 | + '#type' => 'password', |
|
213 | + '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
214 | + '#size' => 17, |
|
215 | + '#attributes' => array( |
|
216 | 216 | 'autocomplete' => 'off', |
217 | - ), |
|
218 | - '#prefix' => "<div id='delete-password-field'>", |
|
219 | - '#suffix' => "</div>", |
|
220 | - '#weight' => 25, |
|
217 | + ), |
|
218 | + '#prefix' => "<div id='delete-password-field'>", |
|
219 | + '#suffix' => "</div>", |
|
220 | + '#weight' => 25, |
|
221 | 221 | ); |
222 | - } |
|
222 | + } |
|
223 | 223 | |
224 | - $form['separator_bottom'] = array( |
|
224 | + $form['separator_bottom'] = array( |
|
225 | 225 | '#value' => '<div class="separator buttons"></div>', |
226 | 226 | '#weight' => 999, |
227 | - ); |
|
227 | + ); |
|
228 | 228 | |
229 | - // Configure the action buttons |
|
230 | - $uid = $form['_account']['#value']->uid; |
|
231 | - $form['actions']['#weight'] = 1000; |
|
232 | - $form['actions']['form control tabs prefix'] = array( |
|
229 | + // Configure the action buttons |
|
230 | + $uid = $form['_account']['#value']->uid; |
|
231 | + $form['actions']['#weight'] = 1000; |
|
232 | + $form['actions']['form control tabs prefix'] = array( |
|
233 | 233 | '#value' => '<ul class="form-control tab-list">', |
234 | 234 | '#weight' => 1001, |
235 | - ); |
|
236 | - |
|
237 | - unset($form['actions']['#prefix']); |
|
238 | - unset($form['actions']['#suffix']); |
|
239 | - $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
240 | - $form['actions']['submit']['#suffix'] = '</li>'; |
|
241 | - $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
242 | - $form['actions']['submit']['#weight'] = 1002; |
|
243 | - if ($disable_delete) { |
|
235 | + ); |
|
236 | + |
|
237 | + unset($form['actions']['#prefix']); |
|
238 | + unset($form['actions']['#suffix']); |
|
239 | + $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
240 | + $form['actions']['submit']['#suffix'] = '</li>'; |
|
241 | + $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
242 | + $form['actions']['submit']['#weight'] = 1002; |
|
243 | + if ($disable_delete) { |
|
244 | 244 | $form['actions']['submit']['#disabled'] = TRUE; |
245 | 245 | $form['actions']['submit']['#value'] = ''; |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | - $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
249 | - $form['actions']['cancel']['#suffix'] = '</li>'; |
|
250 | - $form['actions']['cancel']['#weight'] = 1003; |
|
251 | - $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
252 | - if ($disable_delete) { |
|
248 | + $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
249 | + $form['actions']['cancel']['#suffix'] = '</li>'; |
|
250 | + $form['actions']['cancel']['#weight'] = 1003; |
|
251 | + $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
252 | + if ($disable_delete) { |
|
253 | 253 | $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | - $form['actions']['form control tabs suffix'] = array( |
|
256 | + $form['actions']['form control tabs suffix'] = array( |
|
257 | 257 | '#value' => '</ul>', |
258 | 258 | '#weight' => 1010, |
259 | - ); |
|
259 | + ); |
|
260 | 260 | |
261 | - $form['#redirect'] = 'account/' . $uid; |
|
262 | - $form['#validate'] = array('boincuser_delete_validate'); |
|
263 | - $form['#submit'] = array('boincuser_delete_submit'); |
|
264 | - break; |
|
261 | + $form['#redirect'] = 'account/' . $uid; |
|
262 | + $form['#validate'] = array('boincuser_delete_validate'); |
|
263 | + $form['#submit'] = array('boincuser_delete_submit'); |
|
264 | + break; |
|
265 | 265 | |
266 | - } // switch |
|
266 | + } // switch |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -274,29 +274,29 @@ discard block |
||
274 | 274 | * password. |
275 | 275 | */ |
276 | 276 | function boincuser_delete_validate($form, &$form_state) { |
277 | - require_boinc('boinc_db'); |
|
277 | + require_boinc('boinc_db'); |
|
278 | 278 | |
279 | - if ($form_state['values']['user_delete_action'] == '') { |
|
279 | + if ($form_state['values']['user_delete_action'] == '') { |
|
280 | 280 | form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account')); |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | - // check BOINC user exists |
|
284 | - $account = $form_state['values']['_account']; |
|
285 | - $boinc_user = boincuser_load($account->uid, TRUE); |
|
286 | - if (!$boinc_user) { |
|
283 | + // check BOINC user exists |
|
284 | + $account = $form_state['values']['_account']; |
|
285 | + $boinc_user = boincuser_load($account->uid, TRUE); |
|
286 | + if (!$boinc_user) { |
|
287 | 287 | rules_invoke_event('boincuser_delete_general_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
288 | 288 | return form_set_error('current_pass', |
289 | - bts('There was a problem deleting your account. The @project administrators have been contacted.', |
|
290 | - array( |
|
289 | + bts('There was a problem deleting your account. The @project administrators have been contacted.', |
|
290 | + array( |
|
291 | 291 | '@project' => variable_get('site_name', 'Drupal-BOINC'), |
292 | - ) |
|
293 | - , NULL, 'boinc:delete-user-account') |
|
292 | + ) |
|
293 | + , NULL, 'boinc:delete-user-account') |
|
294 | 294 | ); |
295 | - } |
|
295 | + } |
|
296 | 296 | |
297 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
297 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
298 | 298 | return true; |
299 | - } |
|
299 | + } |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -307,46 +307,46 @@ discard block |
||
307 | 307 | * to delete the account. |
308 | 308 | */ |
309 | 309 | function boincuser_delete_submit($form, &$form_state) { |
310 | - require_boinc('token'); |
|
311 | - global $user; |
|
310 | + require_boinc('token'); |
|
311 | + global $user; |
|
312 | 312 | |
313 | - $uid = $form_state['values']['_account']->uid; |
|
314 | - $account = user_load(array('uid' => $uid)); |
|
313 | + $uid = $form_state['values']['_account']->uid; |
|
314 | + $account = user_load(array('uid' => $uid)); |
|
315 | 315 | |
316 | - if (!$account) { |
|
316 | + if (!$account) { |
|
317 | 317 | rules_invoke_event('boincuser_delete_uid_invalid_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
318 | 318 | drupal_set_message( |
319 | - bts('ERROR: The user account @uid does not exist. The @project administrators have been notified.', |
|
319 | + bts('ERROR: The user account @uid does not exist. The @project administrators have been notified.', |
|
320 | 320 | array( |
321 | - '@uid' => $uid, |
|
322 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
321 | + '@uid' => $uid, |
|
322 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
323 | 323 | ), NULL, 'delete-user-account'), |
324 | - 'error'); |
|
324 | + 'error'); |
|
325 | 325 | watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR); |
326 | 326 | return; |
327 | - } |
|
328 | - |
|
329 | - global $base_url; |
|
330 | - global $base_path; |
|
331 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
332 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
333 | - $site_url = $base_url . $base_path . "user/login"; |
|
334 | - |
|
335 | - // Perform the requested operation |
|
336 | - $op = $form_state['values']['user_delete_action']; |
|
337 | - // create token with 1 day/24 hour expiration |
|
338 | - $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
339 | - switch ($op) { |
|
327 | + } |
|
328 | + |
|
329 | + global $base_url; |
|
330 | + global $base_path; |
|
331 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
332 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
333 | + $site_url = $base_url . $base_path . "user/login"; |
|
334 | + |
|
335 | + // Perform the requested operation |
|
336 | + $op = $form_state['values']['user_delete_action']; |
|
337 | + // create token with 1 day/24 hour expiration |
|
338 | + $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
339 | + switch ($op) { |
|
340 | 340 | case 'boincuser_delete_softdelete': |
341 | 341 | $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken"; |
342 | - break; |
|
342 | + break; |
|
343 | 343 | case 'boincuser_delete_delete': |
344 | 344 | $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken"; |
345 | - break; |
|
346 | - } |
|
345 | + break; |
|
346 | + } |
|
347 | 347 | |
348 | - $mysubject = "Instructions for account deletion at {$site_name}"; |
|
349 | - $mymessage = '' |
|
348 | + $mysubject = "Instructions for account deletion at {$site_name}"; |
|
349 | + $mymessage = '' |
|
350 | 350 | . "{$account->boincuser_name},\n" |
351 | 351 | . "\n" |
352 | 352 | . "We have received a request to DELETE your user account at " |
@@ -368,25 +368,25 @@ discard block |
||
368 | 368 | . "\n" |
369 | 369 | . "{$site_name} support team"; |
370 | 370 | |
371 | - // Create array for sending email to user to notify account is being |
|
372 | - // disabled/deleted. Then send email. |
|
373 | - $settings = array( |
|
371 | + // Create array for sending email to user to notify account is being |
|
372 | + // disabled/deleted. Then send email. |
|
373 | + $settings = array( |
|
374 | 374 | 'from' => '', |
375 | 375 | 'subject' => $mysubject, |
376 | 376 | 'message' => $mymessage, |
377 | - ); |
|
378 | - rules_action_mail_to_user($account, $settings); |
|
377 | + ); |
|
378 | + rules_action_mail_to_user($account, $settings); |
|
379 | 379 | |
380 | - drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info'); |
|
380 | + drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info'); |
|
381 | 381 | |
382 | - $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
383 | - // Redirect |
|
384 | - if (!empty($redirect)) { |
|
382 | + $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
383 | + // Redirect |
|
384 | + if (!empty($redirect)) { |
|
385 | 385 | drupal_goto($redirect); |
386 | - } |
|
387 | - else { |
|
386 | + } |
|
387 | + else { |
|
388 | 388 | drupal_goto(); |
389 | - } |
|
389 | + } |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -398,88 +398,88 @@ discard block |
||
398 | 398 | * The final confirmation form for the user to delete their account. |
399 | 399 | */ |
400 | 400 | function boincuser_delete_finalconfirmation(&$form_state, $token) { |
401 | - require_boinc('token'); |
|
401 | + require_boinc('token'); |
|
402 | 402 | |
403 | - global $user; |
|
404 | - $form = array(); |
|
403 | + global $user; |
|
404 | + $form = array(); |
|
405 | 405 | |
406 | - // check BOINC user exists |
|
407 | - $account = user_load(array('uid' => $user->uid)); |
|
408 | - $uid = $user->uid; |
|
409 | - $boincid = $account->boincuser_id; |
|
410 | - // check $token is valid |
|
411 | - if (!is_valid_token($boincid, $token, 'D')) { |
|
406 | + // check BOINC user exists |
|
407 | + $account = user_load(array('uid' => $user->uid)); |
|
408 | + $uid = $user->uid; |
|
409 | + $boincid = $account->boincuser_id; |
|
410 | + // check $token is valid |
|
411 | + if (!is_valid_token($boincid, $token, 'D')) { |
|
412 | 412 | 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.', |
413 | 413 | array( |
414 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
414 | + '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
415 | 415 | ), |
416 | 416 | NULL, 'boinc:delete-user-account'), 'error'); |
417 | 417 | drupal_goto(); |
418 | - } |
|
418 | + } |
|
419 | 419 | |
420 | - // Attach account to this form. |
|
421 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
420 | + // Attach account to this form. |
|
421 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
422 | 422 | |
423 | - // This form is for hard/wipe delete |
|
424 | - $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe'); |
|
423 | + // This form is for hard/wipe delete |
|
424 | + $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe'); |
|
425 | 425 | |
426 | - // Instructions |
|
427 | - $form['main']['fs1'] = array( |
|
426 | + // Instructions |
|
427 | + $form['main']['fs1'] = array( |
|
428 | 428 | '#type' => 'fieldset', |
429 | 429 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
430 | 430 | '#weight' => 10, |
431 | 431 | '#collapsible' => TRUE, |
432 | 432 | '#collapsed' => TRUE, |
433 | - ); |
|
434 | - $form['main']['fs1']['instructions1'] = array( |
|
433 | + ); |
|
434 | + $form['main']['fs1']['instructions1'] = array( |
|
435 | 435 | '#value' => '<p>'. |
436 | 436 | 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'). |
437 | 437 | '</p>', |
438 | 438 | '#prefix' => "<div id='delete-instructions'>", |
439 | 439 | '#suffix' => "</div>", |
440 | - ); |
|
440 | + ); |
|
441 | 441 | |
442 | - $form['main']['fs1']['instructions2'] = array( |
|
442 | + $form['main']['fs1']['instructions2'] = array( |
|
443 | 443 | '#value' => '<p>'. |
444 | 444 | bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account'). |
445 | 445 | '</p>', |
446 | 446 | '#prefix' => "<div id='delete-instructions'>", |
447 | 447 | '#suffix' => "</div>", |
448 | - ); |
|
448 | + ); |
|
449 | 449 | |
450 | - // Password field |
|
451 | - $form['main']['current_pass'] = array( |
|
450 | + // Password field |
|
451 | + $form['main']['current_pass'] = array( |
|
452 | 452 | '#type' => 'password', |
453 | 453 | '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
454 | 454 | '#size' => 17, |
455 | 455 | '#attributes' => array( |
456 | - 'autocomplete' => 'off', |
|
456 | + 'autocomplete' => 'off', |
|
457 | 457 | ), |
458 | 458 | '#weight' => 25, |
459 | - ); |
|
459 | + ); |
|
460 | 460 | |
461 | - // Form control |
|
462 | - $form['form control tabs prefix'] = array( |
|
461 | + // Form control |
|
462 | + $form['form control tabs prefix'] = array( |
|
463 | 463 | '#value' => '<ul class="form-control tab-list">', |
464 | 464 | '#weight' => 1001, |
465 | - ); |
|
466 | - $form['submit'] = array( |
|
465 | + ); |
|
466 | + $form['submit'] = array( |
|
467 | 467 | '#prefix' => '<li class="first tab">', |
468 | 468 | '#type' => 'submit', |
469 | 469 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
470 | 470 | '#suffix' => '</li>', |
471 | 471 | '#weight' => 1002, |
472 | - ); |
|
473 | - $form['form control tabs'] = array( |
|
472 | + ); |
|
473 | + $form['form control tabs'] = array( |
|
474 | 474 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
475 | 475 | '#weight' => 1003, |
476 | - ); |
|
477 | - $form['form control tabs suffix'] = array( |
|
476 | + ); |
|
477 | + $form['form control tabs suffix'] = array( |
|
478 | 478 | '#value' => '</ul>', |
479 | 479 | '#weight' => 1004, |
480 | - ); |
|
480 | + ); |
|
481 | 481 | |
482 | - return $form; |
|
482 | + return $form; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -487,133 +487,133 @@ discard block |
||
487 | 487 | * the soft/obfuscate method. |
488 | 488 | */ |
489 | 489 | function boincuser_delete_softdelconfirmation(&$form_state, $token) { |
490 | - require_boinc('token'); |
|
490 | + require_boinc('token'); |
|
491 | 491 | |
492 | - global $user; |
|
493 | - $form = array(); |
|
492 | + global $user; |
|
493 | + $form = array(); |
|
494 | 494 | |
495 | - // check BOINC user exists |
|
496 | - $account = user_load(array('uid' => $user->uid)); |
|
497 | - $uid = $user->uid; |
|
498 | - $boincid = $account->boincuser_id; |
|
495 | + // check BOINC user exists |
|
496 | + $account = user_load(array('uid' => $user->uid)); |
|
497 | + $uid = $user->uid; |
|
498 | + $boincid = $account->boincuser_id; |
|
499 | 499 | |
500 | - // check $token is valid |
|
501 | - if (!is_valid_token($boincid, $token, 'D')) { |
|
500 | + // check $token is valid |
|
501 | + if (!is_valid_token($boincid, $token, 'D')) { |
|
502 | 502 | 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.', |
503 | 503 | array( |
504 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
504 | + '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
505 | 505 | ), |
506 | 506 | NULL, 'boinc:delete-user-account'), 'error'); |
507 | 507 | drupal_goto(); |
508 | - } |
|
508 | + } |
|
509 | 509 | |
510 | - // Attach account to this form. |
|
511 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
510 | + // Attach account to this form. |
|
511 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
512 | 512 | |
513 | - // This form is for hard/wipe delete |
|
514 | - $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate'); |
|
513 | + // This form is for hard/wipe delete |
|
514 | + $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate'); |
|
515 | 515 | |
516 | - // Instructions |
|
517 | - $form['main']['fs1'] = array( |
|
516 | + // Instructions |
|
517 | + $form['main']['fs1'] = array( |
|
518 | 518 | '#type' => 'fieldset', |
519 | 519 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
520 | 520 | '#weight' => 10, |
521 | 521 | '#collapsible' => TRUE, |
522 | 522 | '#collapsed' => TRUE, |
523 | - ); |
|
524 | - $form['main']['fs1']['instructions1'] = array( |
|
523 | + ); |
|
524 | + $form['main']['fs1']['instructions1'] = array( |
|
525 | 525 | '#value' => '<p>'. |
526 | 526 | 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'). |
527 | 527 | '</p>', |
528 | 528 | '#prefix' => "<div id='delete-instructions'>", |
529 | 529 | '#suffix' => "</div>", |
530 | - ); |
|
530 | + ); |
|
531 | 531 | |
532 | - $form['main']['fs1']['instructions2'] = array( |
|
532 | + $form['main']['fs1']['instructions2'] = array( |
|
533 | 533 | '#value' => '<p>'. |
534 | 534 | bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account'). |
535 | 535 | '</p>', |
536 | 536 | '#prefix' => "<div id='delete-instructions'>", |
537 | 537 | '#suffix' => "</div>", |
538 | - ); |
|
538 | + ); |
|
539 | 539 | |
540 | - // Password field |
|
541 | - $form['main']['current_pass'] = array( |
|
540 | + // Password field |
|
541 | + $form['main']['current_pass'] = array( |
|
542 | 542 | '#type' => 'password', |
543 | 543 | '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
544 | 544 | '#size' => 17, |
545 | 545 | '#attributes' => array( |
546 | - 'autocomplete' => 'off', |
|
546 | + 'autocomplete' => 'off', |
|
547 | 547 | ), |
548 | 548 | '#weight' => 25, |
549 | - ); |
|
549 | + ); |
|
550 | 550 | |
551 | - // Form control |
|
552 | - $form['form control tabs prefix'] = array( |
|
551 | + // Form control |
|
552 | + $form['form control tabs prefix'] = array( |
|
553 | 553 | '#value' => '<ul class="form-control tab-list">', |
554 | 554 | '#weight' => 1001, |
555 | - ); |
|
556 | - $form['submit'] = array( |
|
555 | + ); |
|
556 | + $form['submit'] = array( |
|
557 | 557 | '#prefix' => '<li class="first tab">', |
558 | 558 | '#type' => 'submit', |
559 | 559 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
560 | 560 | '#suffix' => '</li>', |
561 | 561 | '#weight' => 1002, |
562 | - ); |
|
563 | - $form['form control tabs'] = array( |
|
562 | + ); |
|
563 | + $form['form control tabs'] = array( |
|
564 | 564 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
565 | 565 | '#weight' => 1003, |
566 | - ); |
|
567 | - $form['form control tabs suffix'] = array( |
|
566 | + ); |
|
567 | + $form['form control tabs suffix'] = array( |
|
568 | 568 | '#value' => '</ul>', |
569 | 569 | '#weight' => 1004, |
570 | - ); |
|
570 | + ); |
|
571 | 571 | |
572 | - //set validation and submit to the functions below |
|
573 | - $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate'; |
|
574 | - $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit'; |
|
575 | - return $form; |
|
572 | + //set validation and submit to the functions below |
|
573 | + $form['#validate'][] = 'boincuser_delete_finalconfirmation_validate'; |
|
574 | + $form['#submit'][] = 'boincuser_delete_finalconfirmation_submit'; |
|
575 | + return $form; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
579 | 579 | * Validation for final confirmation |
580 | 580 | */ |
581 | 581 | function boincuser_delete_finalconfirmation_validate($form, &$form_state) { |
582 | - $account = $form_state['values']['_account']; |
|
583 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
582 | + $account = $form_state['values']['_account']; |
|
583 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
584 | 584 | |
585 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
585 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
586 | 586 | return true; |
587 | - } |
|
587 | + } |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | /** |
591 | 591 | * Submit for final confirmation |
592 | 592 | */ |
593 | 593 | function boincuser_delete_finalconfirmation_submit($form, &$form_state) { |
594 | - global $user; |
|
594 | + global $user; |
|
595 | 595 | |
596 | - // Delete the user |
|
597 | - $account = $form_state['values']['_account']; |
|
598 | - $action = $form_state['values']['_action']; |
|
599 | - _boincuser_delete_deleteuser($account, $action); |
|
596 | + // Delete the user |
|
597 | + $account = $form_state['values']['_account']; |
|
598 | + $action = $form_state['values']['_action']; |
|
599 | + _boincuser_delete_deleteuser($account, $action); |
|
600 | 600 | |
601 | - // Destroy the current session: |
|
602 | - session_destroy(); |
|
603 | - // Only variables can be passed by reference workaround. |
|
604 | - $null = NULL; |
|
605 | - user_module_invoke('logout', $null, $user); |
|
601 | + // Destroy the current session: |
|
602 | + session_destroy(); |
|
603 | + // Only variables can be passed by reference workaround. |
|
604 | + $null = NULL; |
|
605 | + user_module_invoke('logout', $null, $user); |
|
606 | 606 | |
607 | - // Load the anonymous user |
|
608 | - $user = drupal_anonymous_user(); |
|
607 | + // Load the anonymous user |
|
608 | + $user = drupal_anonymous_user(); |
|
609 | 609 | |
610 | - $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
611 | - // Redirect |
|
612 | - if (!empty($redirect)) { |
|
610 | + $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
611 | + // Redirect |
|
612 | + if (!empty($redirect)) { |
|
613 | 613 | drupal_goto($redirect); |
614 | - } |
|
615 | - else { |
|
614 | + } |
|
615 | + else { |
|
616 | 616 | drupal_goto(); |
617 | - } |
|
617 | + } |
|
618 | 618 | |
619 | 619 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | switch($form_id) { |
98 | 98 | case 'user_profile_form': |
99 | - if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
|
99 | + if ( user_access('delete own account') and ($form['#uid'] == $user->uid) and (arg(3)=='') ) { |
|
100 | 100 | $form['delete'] = array( |
101 | 101 | '#type' => 'submit', |
102 | 102 | '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | break; |
123 | 123 | case 'user_confirm_delete': |
124 | 124 | |
125 | - $disable_delete = FALSE; |
|
125 | + $disable_delete = false; |
|
126 | 126 | // If email address was changed less than 7 days (7 * 86400 s) |
127 | 127 | // ago, it cannot be changed again. |
128 | 128 | $duration = TOKEN_DURATION_ONE_WEEK; |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
132 | 132 | array( |
133 | 133 | '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
134 | - ), NULL, 'boinc:account-credentials-change') |
|
134 | + ), null, 'boinc:account-credentials-change') |
|
135 | 135 | , 'info'); |
136 | - $disable_delete = TRUE; |
|
136 | + $disable_delete = true; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | // Configure radio options |
140 | - $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 | + $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'); |
|
141 | 141 | |
142 | 142 | $deleteoptions = array( |
143 | - 'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), NULL, 'boinc:delete-user-account'), |
|
144 | - 'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', array(), NULL, 'boinc:delete-user-account'), |
|
143 | + 'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), null, 'boinc:delete-user-account'), |
|
144 | + 'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', array(), null, 'boinc:delete-user-account'), |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | $dtypes = variable_get('boincuser_delete_type', 'user_decides'); |
@@ -171,18 +171,18 @@ discard block |
||
171 | 171 | |
172 | 172 | $form['main']['fs1'] = array( |
173 | 173 | '#type' => 'fieldset', |
174 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
174 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
175 | 175 | '#weight' => 10, |
176 | - '#collapsible' => TRUE, |
|
177 | - '#collapsed' => TRUE, |
|
176 | + '#collapsible' => true, |
|
177 | + '#collapsed' => true, |
|
178 | 178 | ); |
179 | 179 | $form['main']['fs1']['help'] = array( |
180 | 180 | '#value' => bts( |
181 | 181 | "<p>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>" . |
182 | 182 | "<p>If necessary, you may !link first before deleting your account. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
183 | 183 | array( |
184 | - '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
|
185 | - ), NULL, 'boinc:delete-user-account'), |
|
184 | + '!link' => l(bts('change your email address', array(), null, 'boinc:delete-user-account'), '/account/info/edit'), |
|
185 | + ), null, 'boinc:delete-user-account'), |
|
186 | 186 | '#weight' => 11, |
187 | 187 | '#prefix' => "<div id='delete-instructions'>", |
188 | 188 | '#suffix' => "</div>", |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | if ($dtypes == 'user_decides') { |
192 | 192 | $form['main']['common'] = array( |
193 | - '#value' => bts('All choices: ', array(), NULL, 'boinc:delete-user-account') . $common_acts . '<p>' . bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), NULL, 'boinc:delete-user-account'), |
|
193 | + '#value' => bts('All choices: ', array(), null, 'boinc:delete-user-account') . $common_acts . '<p>' . bts('Disabled means some of your personal data, such as your username and email address, are kept on our systems. Choose \'delete your account\' if you want all personal data to be removed.', array(), null, 'boinc:delete-user-account'), |
|
194 | 194 | '#prefix' => "<div id='delete-instructions'>", |
195 | 195 | '#suffix' => "</div>", |
196 | 196 | '#weight' => 20, |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | '#weight' => 21, |
204 | 204 | ); |
205 | 205 | if ($disable_delete) { |
206 | - $form['main']['user_delete_action']['#disabled'] = TRUE; |
|
206 | + $form['main']['user_delete_action']['#disabled'] = true; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Password field |
210 | 210 | if (!$disable_delete) { |
211 | 211 | $form['main']['current_pass'] = array( |
212 | 212 | '#type' => 'password', |
213 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
213 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
214 | 214 | '#size' => 17, |
215 | 215 | '#attributes' => array( |
216 | 216 | 'autocomplete' => 'off', |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | unset($form['actions']['#suffix']); |
239 | 239 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
240 | 240 | $form['actions']['submit']['#suffix'] = '</li>'; |
241 | - $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
241 | + $form['actions']['submit']['#value'] = bts('Submit', array(), null, 'boinc:form-submit'); |
|
242 | 242 | $form['actions']['submit']['#weight'] = 1002; |
243 | 243 | if ($disable_delete) { |
244 | - $form['actions']['submit']['#disabled'] = TRUE; |
|
244 | + $form['actions']['submit']['#disabled'] = true; |
|
245 | 245 | $form['actions']['submit']['#value'] = ''; |
246 | 246 | } |
247 | 247 | |
248 | 248 | $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
249 | 249 | $form['actions']['cancel']['#suffix'] = '</li>'; |
250 | 250 | $form['actions']['cancel']['#weight'] = 1003; |
251 | - $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
251 | + $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'account/info/edit'); |
|
252 | 252 | if ($disable_delete) { |
253 | 253 | $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
254 | 254 | } |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | require_boinc('boinc_db'); |
278 | 278 | |
279 | 279 | if ($form_state['values']['user_delete_action'] == '') { |
280 | - form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account')); |
|
280 | + form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), null, 'boinc:delete-user-account')); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | // check BOINC user exists |
284 | 284 | $account = $form_state['values']['_account']; |
285 | - $boinc_user = boincuser_load($account->uid, TRUE); |
|
285 | + $boinc_user = boincuser_load($account->uid, true); |
|
286 | 286 | if (!$boinc_user) { |
287 | 287 | rules_invoke_event('boincuser_delete_general_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
288 | 288 | return form_set_error('current_pass', |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | array( |
291 | 291 | '@project' => variable_get('site_name', 'Drupal-BOINC'), |
292 | 292 | ) |
293 | - , NULL, 'boinc:delete-user-account') |
|
293 | + , null, 'boinc:delete-user-account') |
|
294 | 294 | ); |
295 | 295 | } |
296 | 296 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | array( |
321 | 321 | '@uid' => $uid, |
322 | 322 | '@project' => variable_get('site_name', 'Drupal-BOINC'), |
323 | - ), NULL, 'delete-user-account'), |
|
323 | + ), null, 'delete-user-account'), |
|
324 | 324 | 'error'); |
325 | 325 | watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR); |
326 | 326 | return; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ); |
378 | 378 | rules_action_mail_to_user($account, $settings); |
379 | 379 | |
380 | - drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), NULL, 'boinc:delete-user-account'),'info'); |
|
380 | + drupal_set_message(bts("INFO: You have requested account deletion. Please check your email for further instructions.", array(), null, 'boinc:delete-user-account'),'info'); |
|
381 | 381 | |
382 | 382 | $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
383 | 383 | // Redirect |
@@ -411,9 +411,9 @@ discard block |
||
411 | 411 | if (!is_valid_token($boincid, $token, 'D')) { |
412 | 412 | 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.', |
413 | 413 | array( |
414 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
414 | + '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
415 | 415 | ), |
416 | - NULL, 'boinc:delete-user-account'), 'error'); |
|
416 | + null, 'boinc:delete-user-account'), 'error'); |
|
417 | 417 | drupal_goto(); |
418 | 418 | } |
419 | 419 | |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | // Instructions |
427 | 427 | $form['main']['fs1'] = array( |
428 | 428 | '#type' => 'fieldset', |
429 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
429 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
430 | 430 | '#weight' => 10, |
431 | - '#collapsible' => TRUE, |
|
432 | - '#collapsed' => TRUE, |
|
431 | + '#collapsible' => true, |
|
432 | + '#collapsed' => true, |
|
433 | 433 | ); |
434 | 434 | $form['main']['fs1']['instructions1'] = array( |
435 | 435 | '#value' => '<p>'. |
436 | - 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'). |
|
436 | + 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'). |
|
437 | 437 | '</p>', |
438 | 438 | '#prefix' => "<div id='delete-instructions'>", |
439 | 439 | '#suffix' => "</div>", |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | |
442 | 442 | $form['main']['fs1']['instructions2'] = array( |
443 | 443 | '#value' => '<p>'. |
444 | - bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account'). |
|
444 | + bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), null, 'boinc:delete-user-account'). |
|
445 | 445 | '</p>', |
446 | 446 | '#prefix' => "<div id='delete-instructions'>", |
447 | 447 | '#suffix' => "</div>", |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | // Password field |
451 | 451 | $form['main']['current_pass'] = array( |
452 | 452 | '#type' => 'password', |
453 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
453 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
454 | 454 | '#size' => 17, |
455 | 455 | '#attributes' => array( |
456 | 456 | 'autocomplete' => 'off', |
@@ -466,12 +466,12 @@ discard block |
||
466 | 466 | $form['submit'] = array( |
467 | 467 | '#prefix' => '<li class="first tab">', |
468 | 468 | '#type' => 'submit', |
469 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
469 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
470 | 470 | '#suffix' => '</li>', |
471 | 471 | '#weight' => 1002, |
472 | 472 | ); |
473 | 473 | $form['form control tabs'] = array( |
474 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
|
474 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/") . '</li>', |
|
475 | 475 | '#weight' => 1003, |
476 | 476 | ); |
477 | 477 | $form['form control tabs suffix'] = array( |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | if (!is_valid_token($boincid, $token, 'D')) { |
502 | 502 | 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.', |
503 | 503 | array( |
504 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
504 | + '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
505 | 505 | ), |
506 | - NULL, 'boinc:delete-user-account'), 'error'); |
|
506 | + null, 'boinc:delete-user-account'), 'error'); |
|
507 | 507 | drupal_goto(); |
508 | 508 | } |
509 | 509 | |
@@ -516,14 +516,14 @@ discard block |
||
516 | 516 | // Instructions |
517 | 517 | $form['main']['fs1'] = array( |
518 | 518 | '#type' => 'fieldset', |
519 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
519 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
520 | 520 | '#weight' => 10, |
521 | - '#collapsible' => TRUE, |
|
522 | - '#collapsed' => TRUE, |
|
521 | + '#collapsible' => true, |
|
522 | + '#collapsed' => true, |
|
523 | 523 | ); |
524 | 524 | $form['main']['fs1']['instructions1'] = array( |
525 | 525 | '#value' => '<p>'. |
526 | - 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'). |
|
526 | + 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'). |
|
527 | 527 | '</p>', |
528 | 528 | '#prefix' => "<div id='delete-instructions'>", |
529 | 529 | '#suffix' => "</div>", |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | $form['main']['fs1']['instructions2'] = array( |
533 | 533 | '#value' => '<p>'. |
534 | - bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), NULL, 'boinc:delete-user-account'). |
|
534 | + bts('If you wish to cancel, click cancel and you will be taken to your account dashboard.', array(), null, 'boinc:delete-user-account'). |
|
535 | 535 | '</p>', |
536 | 536 | '#prefix' => "<div id='delete-instructions'>", |
537 | 537 | '#suffix' => "</div>", |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | // Password field |
541 | 541 | $form['main']['current_pass'] = array( |
542 | 542 | '#type' => 'password', |
543 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
543 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
544 | 544 | '#size' => 17, |
545 | 545 | '#attributes' => array( |
546 | 546 | 'autocomplete' => 'off', |
@@ -556,12 +556,12 @@ discard block |
||
556 | 556 | $form['submit'] = array( |
557 | 557 | '#prefix' => '<li class="first tab">', |
558 | 558 | '#type' => 'submit', |
559 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
559 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
560 | 560 | '#suffix' => '</li>', |
561 | 561 | '#weight' => 1002, |
562 | 562 | ); |
563 | 563 | $form['form control tabs'] = array( |
564 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
|
564 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "account/") . '</li>', |
|
565 | 565 | '#weight' => 1003, |
566 | 566 | ); |
567 | 567 | $form['form control tabs suffix'] = array( |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | // Destroy the current session: |
602 | 602 | session_destroy(); |
603 | 603 | // Only variables can be passed by reference workaround. |
604 | - $null = NULL; |
|
604 | + $null = null; |
|
605 | 605 | user_module_invoke('logout', $null, $user); |
606 | 606 | |
607 | 607 | // Load the anonymous user |
@@ -174,8 +174,7 @@ |
||
174 | 174 | array("agree_to_terms_of_use", "", false), |
175 | 175 | ); |
176 | 176 | form_checkboxes(tra("Do you agree to the terms of use above?"), $myitems, 'tabindex="0"'); |
177 | - } |
|
178 | - else { |
|
177 | + } else { |
|
179 | 178 | // error - no terms of use for user to agree to! |
180 | 179 | } |
181 | 180 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | tra("Must be at least %1 characters", $min_passwd_length), |
101 | 101 | tra("Password") |
102 | 102 | ), |
103 | - "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd") |
|
103 | + "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd") |
|
104 | 104 | ); |
105 | 105 | if (USER_COUNTRY) { |
106 | 106 | form_select( |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | } else { |
146 | 146 | $x = tra("Email address:"); |
147 | 147 | } |
148 | - form_input_text($x, "email_addr", '', 'text', $attrs='autofocus tabindex="1"'); |
|
148 | + form_input_text($x, "email_addr", '', 'text', $attrs = 'autofocus tabindex="1"'); |
|
149 | 149 | form_input_text( |
150 | - tra("Password:").'<br><small><a href="get_passwd.php">' . tra("forgot password?") . "</a></small>", |
|
150 | + tra("Password:").'<br><small><a href="get_passwd.php">'.tra("forgot password?")."</a></small>", |
|
151 | 151 | "passwd", |
152 | 152 | "", |
153 | 153 | "password", |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | if (!is_null($teamid)) { |
190 | - if ($teamid==0) { |
|
190 | + if ($teamid == 0) { |
|
191 | 191 | user_quit_team($user); |
192 | 192 | } else { |
193 | 193 | $team = BoincTeam::lookup_id_nocache($teamid); |
@@ -240,15 +240,15 @@ discard block |
||
240 | 240 | // table. If one or more of these consent_xyz parameters are NOT |
241 | 241 | // present, the RPC will still return 'success', even though the |
242 | 242 | // consent table is not updated. |
243 | -if ( (isset($consent_name) and isset($consent_flag) and isset($consent_not_required) and isset($consent_source)) ) { |
|
243 | +if ((isset($consent_name) and isset($consent_flag) and isset($consent_not_required) and isset($consent_source))) { |
|
244 | 244 | list($checkct, $ctid) = check_consent_type($consent_name); |
245 | 245 | if ($checkct) { |
246 | 246 | |
247 | 247 | // Check to see if latest consent of this name is already |
248 | 248 | // given. |
249 | - $cr= BoincConsent::lookup("userid={$user->id} AND consent_type_id='${ctid}' ORDER BY consent_time DESC LIMIT 1"); |
|
250 | - if ( (($cr) and ($cr->consent_flag!=$consent_flag)) or |
|
251 | - (!$cr) ) { |
|
249 | + $cr = BoincConsent::lookup("userid={$user->id} AND consent_type_id='${ctid}' ORDER BY consent_time DESC LIMIT 1"); |
|
250 | + if ((($cr) and ($cr->consent_flag != $consent_flag)) or |
|
251 | + (!$cr)) { |
|
252 | 252 | |
253 | 253 | $rc = consent_to_a_policy($user, $ctid, $consent_flag, $consent_not_required, $consent_source, time()); |
254 | 254 | if (!$rc) { |
@@ -104,7 +104,7 @@ |
||
104 | 104 | // set to 1. |
105 | 105 | if ($consent_flag==0) { |
106 | 106 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
107 | - } else { |
|
107 | + } else { |
|
108 | 108 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
109 | 109 | } |
110 | 110 | if (!$rc) { |
@@ -106,7 +106,7 @@ |
||
106 | 106 | } |
107 | 107 | if (!$checkct) { |
108 | 108 | error_log("Project configuration error! " . |
109 | - "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!" |
|
109 | + "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!" |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | // Consistency checks |
101 | 101 | // |
102 | 102 | if (!check_termsofuse()) { |
103 | - error_log("Project configuration error! " . |
|
103 | + error_log("Project configuration error! ". |
|
104 | 104 | "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!" |
105 | 105 | ); |
106 | 106 | } |
107 | 107 | if (!$checkct) { |
108 | - error_log("Project configuration error! " . |
|
108 | + error_log("Project configuration error! ". |
|
109 | 109 | "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!" |
110 | 110 | ); |
111 | 111 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | // |
115 | 115 | if (is_null($consent_flag) or !$source) { |
116 | 116 | xml_error(ERR_ACCT_REQUIRE_CONSENT, |
117 | - "This project requires you to consent to its terms of use. " . |
|
118 | - "Please update your BOINC software " . |
|
119 | - "or register via the project's website " . |
|
117 | + "This project requires you to consent to its terms of use. ". |
|
118 | + "Please update your BOINC software ". |
|
119 | + "or register via the project's website ". |
|
120 | 120 | "or contact your account manager's provider." |
121 | 121 | ); |
122 | 122 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | // * not agree. |
153 | 153 | // -> no create account RPC at all |
154 | 154 | // |
155 | - if ( (!is_null($consent_flag)) and $source) { |
|
155 | + if ((!is_null($consent_flag)) and $source) { |
|
156 | 156 | // Record the user giving consent in database - if consent_flag is 0, |
157 | 157 | // this is an 'anonymous account' and consent_not_required is |
158 | 158 | // set to 1. |
159 | - if ($consent_flag==0) { |
|
159 | + if ($consent_flag == 0) { |
|
160 | 160 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
161 | - } else { |
|
161 | + } else { |
|
162 | 162 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
163 | 163 | } |
164 | 164 | if (!$rc) { |
@@ -53,7 +53,7 @@ |
||
53 | 53 | // Toggles the enable flag |
54 | 54 | function mct_toggle_field($field) { |
55 | 55 | $ctid = post_int("consent_type_id"); |
56 | - $toggle = post_str("toggle" . $field); |
|
56 | + $toggle = post_str("toggle".$field); |
|
57 | 57 | if ($toggle == "Click to Enable") { |
58 | 58 | $state = 1; |
59 | 59 | $action = "Enabled"; |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | if ($toggle == "Click to Enable") { |
47 | 47 | $state = 1; |
48 | 48 | $action = "Enabled"; |
49 | - } |
|
50 | - else { |
|
49 | + } else { |
|
51 | 50 | $state = 0; |
52 | 51 | $action = "Disabled"; |
53 | 52 | } |
@@ -91,12 +90,10 @@ discard block |
||
91 | 90 | if (!in_rops()) { |
92 | 91 | if (!($ct->enabled)) { |
93 | 92 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Enable\"></td>"; |
94 | - } |
|
95 | - else { |
|
93 | + } else { |
|
96 | 94 | echo " <td><input class=\"btn btn-default\" name=toggleenabled type=submit value=\"Click to Disable\"></td>"; |
97 | 95 | } |
98 | - } |
|
99 | - else { |
|
96 | + } else { |
|
100 | 97 | echo " <td>$ct->enabled</td>"; |
101 | 98 | } |
102 | 99 | |
@@ -107,12 +104,10 @@ discard block |
||
107 | 104 | if (!in_rops()) { |
108 | 105 | if (!($ct->privacypref)) { |
109 | 106 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Enable\"></td>"; |
110 | - } |
|
111 | - else { |
|
107 | + } else { |
|
112 | 108 | echo " <td><input class=\"btn btn-default\" name=toggleprivacypref type=submit value=\"Click to Disable\"></td>"; |
113 | 109 | } |
114 | - } |
|
115 | - else { |
|
110 | + } else { |
|
116 | 111 | echo " <td>$ct->privacypref</td>"; |
117 | 112 | } |
118 | 113 | |
@@ -156,11 +151,9 @@ discard block |
||
156 | 151 | |
157 | 152 | if (post_str("add_consenttype", true)) { |
158 | 153 | add_consenttype(); |
159 | -} |
|
160 | -else if (post_str("toggleenabled", true)) { |
|
154 | +} else if (post_str("toggleenabled", true)) { |
|
161 | 155 | mct_toggle_field("enabled"); |
162 | -} |
|
163 | -else if (post_str("toggleprivacypref", true)) { |
|
156 | +} else if (post_str("toggleprivacypref", true)) { |
|
164 | 157 | mct_toggle_field("privacypref"); |
165 | 158 | } |
166 | 159 |
@@ -4,110 +4,110 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function discussion_forums_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: access comments |
|
10 | - $permissions['access comments'] = array( |
|
9 | + // Exported permission: access comments |
|
10 | + $permissions['access comments'] = array( |
|
11 | 11 | 'name' => 'access comments', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
14 | - '1' => 'anonymous user', |
|
15 | - '2' => 'authenticated user', |
|
13 | + '0' => 'administrator', |
|
14 | + '1' => 'anonymous user', |
|
15 | + '2' => 'authenticated user', |
|
16 | 16 | ), |
17 | - ); |
|
17 | + ); |
|
18 | 18 | |
19 | - // Exported permission: administer comments |
|
20 | - $permissions['administer comments'] = array( |
|
19 | + // Exported permission: administer comments |
|
20 | + $permissions['administer comments'] = array( |
|
21 | 21 | 'name' => 'administer comments', |
22 | 22 | 'roles' => array( |
23 | - '0' => 'administrator', |
|
24 | - '1' => 'moderator', |
|
23 | + '0' => 'administrator', |
|
24 | + '1' => 'moderator', |
|
25 | 25 | ), |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - // Exported permission: administer forums |
|
29 | - $permissions['administer forums'] = array( |
|
28 | + // Exported permission: administer forums |
|
29 | + $permissions['administer forums'] = array( |
|
30 | 30 | 'name' => 'administer forums', |
31 | 31 | 'roles' => array( |
32 | - '0' => 'administrator', |
|
32 | + '0' => 'administrator', |
|
33 | 33 | ), |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | - // Exported permission: assign community member role |
|
37 | - $permissions['assign community member role'] = array( |
|
36 | + // Exported permission: assign community member role |
|
37 | + $permissions['assign community member role'] = array( |
|
38 | 38 | 'name' => 'assign community member role', |
39 | 39 | 'roles' => array( |
40 | - '0' => 'moderator', |
|
40 | + '0' => 'moderator', |
|
41 | 41 | ), |
42 | - ); |
|
42 | + ); |
|
43 | 43 | |
44 | - // Exported permission: create forum topics |
|
45 | - $permissions['create forum topics'] = array( |
|
44 | + // Exported permission: create forum topics |
|
45 | + $permissions['create forum topics'] = array( |
|
46 | 46 | 'name' => 'create forum topics', |
47 | 47 | 'roles' => array( |
48 | - '0' => 'administrator', |
|
49 | - '1' => 'community member', |
|
50 | - '2' => 'moderator', |
|
51 | - '3' => 'verified contributor', |
|
48 | + '0' => 'administrator', |
|
49 | + '1' => 'community member', |
|
50 | + '2' => 'moderator', |
|
51 | + '3' => 'verified contributor', |
|
52 | 52 | ), |
53 | - ); |
|
53 | + ); |
|
54 | 54 | |
55 | - // Exported permission: delete any forum topic |
|
56 | - $permissions['delete any forum topic'] = array( |
|
55 | + // Exported permission: delete any forum topic |
|
56 | + $permissions['delete any forum topic'] = array( |
|
57 | 57 | 'name' => 'delete any forum topic', |
58 | 58 | 'roles' => array( |
59 | - '0' => 'administrator', |
|
59 | + '0' => 'administrator', |
|
60 | 60 | ), |
61 | - ); |
|
61 | + ); |
|
62 | 62 | |
63 | - // Exported permission: delete own forum topics |
|
64 | - $permissions['delete own forum topics'] = array( |
|
63 | + // Exported permission: delete own forum topics |
|
64 | + $permissions['delete own forum topics'] = array( |
|
65 | 65 | 'name' => 'delete own forum topics', |
66 | 66 | 'roles' => array( |
67 | - '0' => 'administrator', |
|
67 | + '0' => 'administrator', |
|
68 | 68 | ), |
69 | - ); |
|
69 | + ); |
|
70 | 70 | |
71 | - // Exported permission: edit any forum topic |
|
72 | - $permissions['edit any forum topic'] = array( |
|
71 | + // Exported permission: edit any forum topic |
|
72 | + $permissions['edit any forum topic'] = array( |
|
73 | 73 | 'name' => 'edit any forum topic', |
74 | 74 | 'roles' => array( |
75 | - '0' => 'administrator', |
|
76 | - '1' => 'moderator', |
|
75 | + '0' => 'administrator', |
|
76 | + '1' => 'moderator', |
|
77 | 77 | ), |
78 | - ); |
|
78 | + ); |
|
79 | 79 | |
80 | - // Exported permission: edit own forum topics |
|
81 | - $permissions['edit own forum topics'] = array( |
|
80 | + // Exported permission: edit own forum topics |
|
81 | + $permissions['edit own forum topics'] = array( |
|
82 | 82 | 'name' => 'edit own forum topics', |
83 | 83 | 'roles' => array( |
84 | - '0' => 'administrator', |
|
85 | - '1' => 'community member', |
|
86 | - '2' => 'verified contributor', |
|
84 | + '0' => 'administrator', |
|
85 | + '1' => 'community member', |
|
86 | + '2' => 'verified contributor', |
|
87 | 87 | ), |
88 | - ); |
|
88 | + ); |
|
89 | 89 | |
90 | - // Exported permission: post comments |
|
91 | - $permissions['post comments'] = array( |
|
90 | + // Exported permission: post comments |
|
91 | + $permissions['post comments'] = array( |
|
92 | 92 | 'name' => 'post comments', |
93 | 93 | 'roles' => array( |
94 | - '0' => 'administrator', |
|
95 | - '1' => 'community member', |
|
96 | - '2' => 'moderator', |
|
97 | - '3' => 'verified contributor', |
|
94 | + '0' => 'administrator', |
|
95 | + '1' => 'community member', |
|
96 | + '2' => 'moderator', |
|
97 | + '3' => 'verified contributor', |
|
98 | 98 | ), |
99 | - ); |
|
99 | + ); |
|
100 | 100 | |
101 | - // Exported permission: post comments without approval |
|
102 | - $permissions['post comments without approval'] = array( |
|
101 | + // Exported permission: post comments without approval |
|
102 | + $permissions['post comments without approval'] = array( |
|
103 | 103 | 'name' => 'post comments without approval', |
104 | 104 | 'roles' => array( |
105 | - '0' => 'administrator', |
|
106 | - '1' => 'community member', |
|
107 | - '2' => 'moderator', |
|
108 | - '3' => 'verified contributor', |
|
105 | + '0' => 'administrator', |
|
106 | + '1' => 'community member', |
|
107 | + '2' => 'moderator', |
|
108 | + '3' => 'verified contributor', |
|
109 | 109 | ), |
110 | - ); |
|
110 | + ); |
|
111 | 111 | |
112 | - return $permissions; |
|
112 | + return $permissions; |
|
113 | 113 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | show_type($vers, $stats); |
156 | 156 | } |
157 | 157 | foreach ($data->darwin as $vers=>$state) { |
158 | - show_type("Darwin $vers", $state); |
|
158 | + show_type("darwin $vers", $state); |
|
159 | 159 | } |
160 | 160 | show_type("Linux total", $data->linux); |
161 | 161 | foreach ($data->other as $vers=>$stats) { |
@@ -22,14 +22,14 @@ |
||
22 | 22 | require_once("../inc/util.inc"); |
23 | 23 | require_once("../inc/cache.inc"); |
24 | 24 | |
25 | -$min_credit = .1; // only count hosts with this much RAC |
|
25 | +$min_credit = .1; // only count hosts with this much RAC |
|
26 | 26 | $total_rac = 0; |
27 | 27 | |
28 | 28 | define("CACHE_PERIOD", 7*86400); |
29 | 29 | |
30 | 30 | function show_type($type, $stats) { |
31 | 31 | global $total_rac; |
32 | - $pct = $total_rac?number_format(100*$stats->rac/$total_rac, 4):0; |
|
32 | + $pct = $total_rac ?number_format(100*$stats->rac/$total_rac, 4) : 0; |
|
33 | 33 | row_array(array($type, $stats->nhosts, "$pct %")); |
34 | 34 | } |
35 | 35 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | start_table(); |
28 | 28 | echo " |
29 | 29 | <tr><td>" |
30 | - . tra("Leader boards for %1",PROJECT).": |
|
30 | + . tra("Leader boards for %1", PROJECT).": |
|
31 | 31 | <ul> |
32 | 32 | <li><a href=\"top_users.php\">" . tra("Participants")."</a> |
33 | 33 | "; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if (!DISABLE_TEAMS) { |
39 | 39 | echo " |
40 | - <li><a href=\"top_teams.php\">" . tra("Teams"). "</a> |
|
40 | + <li><a href=\"top_teams.php\">" . tra("Teams")."</a> |
|
41 | 41 | "; |
42 | 42 | if ($credit_by_app) { |
43 | 43 | echo "<ul><li><a href=per_app_list.php?is_team=1>Per application</a></ul>\n"; |
@@ -9,11 +9,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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. |
@@ -21,13 +21,13 @@ discard block |
||
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 |
||
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 |
@@ -9,28 +9,28 @@ discard block |
||
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,56 +41,56 @@ discard block |
||
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; |
|
87 | + user_delete(array(), $account->uid); |
|
88 | + break; |
|
89 | 89 | default: |
90 | 90 | watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
91 | 91 | '%action' => $action, |
92 | - ), WATCHDOG_ERROR); |
|
93 | - } |
|
92 | + ), WATCHDOG_ERROR); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * Copied from node.module, node_user() |
100 | 100 | */ |
101 | 101 | function _boincuser_delete_node_reassign($account) { |
102 | - db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | - db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
102 | + db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $account->uid); |
|
103 | + db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $account->uid); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * Copied from comment.module, comment_user() |
110 | 110 | */ |
111 | 111 | function _boincuser_delete_comment_reassign($account) { |
112 | - // bug in comment module, remove user name from comments. |
|
113 | - db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
112 | + // bug in comment module, remove user name from comments. |
|
113 | + db_query("UPDATE {comments} SET comments.name='' WHERE uid =%d", $account->uid); |
|
114 | 114 | |
115 | - db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | - db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
115 | + db_query('UPDATE {comments} SET uid = 0 WHERE uid = %d', $account->uid); |
|
116 | + db_query('UPDATE {node_comment_statistics} SET last_comment_uid = 0 WHERE last_comment_uid = %d', $account->uid); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | * Copied from privatemsg module, case 'delete' in privatemsg_user(). |
123 | 123 | */ |
124 | 124 | function _boincuser_delete_privatemsg_delete($account) { |
125 | - // Load all mids of the messages the user wrote. |
|
126 | - $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | - $mids = array(); |
|
128 | - while ($row = db_fetch_array($result)) { |
|
125 | + // Load all mids of the messages the user wrote. |
|
126 | + $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid); |
|
127 | + $mids = array(); |
|
128 | + while ($row = db_fetch_array($result)) { |
|
129 | 129 | $mids[] = $row['mid']; |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - // Delete messages the user wrote. |
|
133 | - db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
132 | + // Delete messages the user wrote. |
|
133 | + db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid); |
|
134 | 134 | |
135 | - if (!empty($mids)) { |
|
135 | + if (!empty($mids)) { |
|
136 | 136 | // Delete recipient entries in {pm_index} of the messages the user wrote. |
137 | 137 | db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids); |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Delete recipient entries of that user. |
|
141 | - db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
140 | + // Delete recipient entries of that user. |
|
141 | + db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,6 +147,6 @@ discard block |
||
147 | 147 | * Copied from flag_friend, flag_friend_user() |
148 | 148 | */ |
149 | 149 | function _boincuser_delete_friends($account) { |
150 | - // remove any friend relationships if an account is removed |
|
150 | + // remove any friend relationships if an account is removed |
|
151 | 151 | db_query("DELETE FROM {flag_friend} WHERE uid = %d OR friend_uid = %d", $account->uid, $account->uid); |
152 | 152 | } |
153 | 153 | \ No newline at end of file |
@@ -59,37 +59,37 @@ |
||
59 | 59 | // hook_user() functions. |
60 | 60 | |
61 | 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 | - default: |
|
90 | - watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
91 | - '%action' => $action, |
|
92 | - ), WATCHDOG_ERROR); |
|
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 | + default: |
|
90 | + watchdog('boincuser_delete', 'Delete action is %action, which is not \'soft_obfuscate\' or \'hard_wipe\'.', array( |
|
91 | + '%action' => $action, |
|
92 | + ), WATCHDOG_ERROR); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 |