@@ -62,7 +62,7 @@ |
||
62 | 62 | echo tra("Invalid password."); |
63 | 63 | } else { |
64 | 64 | $passwd_hash = md5($passwd.$email_addr); |
65 | - $database_passwd_hash = password_hash($passwd_hash , PASSWORD_DEFAULT); |
|
65 | + $database_passwd_hash = password_hash($passwd_hash, PASSWORD_DEFAULT); |
|
66 | 66 | $email_addr = BoincDb::escape_string($email_addr); |
67 | 67 | $user->email_addr_change_time = time(); |
68 | 68 | $result = $user->update( |
@@ -56,9 +56,9 @@ |
||
56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |
57 | 57 | ); |
58 | 58 | $result = delete_token($userid, $token, TOKEN_TYPE_CHANGE_EMAIL); |
59 | - } |
|
59 | + } |
|
60 | 60 | } else { |
61 | - echo tra("Invalid token."); |
|
61 | + echo tra("Invalid token."); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | echo tra("Invalid token."); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } else { |
51 | 51 | echo tra("Email address has been reverted.")."<br /><br />".tra("You need to reset your password: ")."<a href=\"".secure_url_base()."get_passwd.php\">".secure_url_base()."get_passwd.php</a>"; |
52 | 52 | |
53 | - $database_passwd_hash = password_hash(random_string() , PASSWORD_DEFAULT); |
|
53 | + $database_passwd_hash = password_hash(random_string(), PASSWORD_DEFAULT); |
|
54 | 54 | //Change previous_email |
55 | 55 | $result = $tmpuser->update( |
56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |
@@ -11,39 +11,39 @@ |
||
11 | 11 | BoincToken::insert("(token,userid,type,create_time, expire_time) values ('$token', 0, 'T', $now, $now+3600)"); |
12 | 12 | |
13 | 13 | $boincTokens = BoincToken::enum("userid=0"); |
14 | -foreach($boincTokens as $boincToken) { |
|
15 | - echo $boincToken->token . "\n"; |
|
16 | - echo $boincToken->userid . "\n"; |
|
17 | - echo $boincToken->type . "\n"; |
|
18 | - echo $boincToken->create_time . "\n"; |
|
19 | - echo $boincToken->expire_time . "\n"; |
|
14 | +foreach ($boincTokens as $boincToken) { |
|
15 | + echo $boincToken->token."\n"; |
|
16 | + echo $boincToken->userid."\n"; |
|
17 | + echo $boincToken->type."\n"; |
|
18 | + echo $boincToken->create_time."\n"; |
|
19 | + echo $boincToken->expire_time."\n"; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | echo "---------------\n"; |
23 | 23 | $boincToken = BoincToken::lookup("userid=0"); |
24 | -echo $boincToken->token . "\n"; |
|
25 | -echo $boincToken->userid . "\n"; |
|
26 | -echo $boincToken->type . "\n"; |
|
27 | -echo $boincToken->create_time . "\n"; |
|
28 | -echo $boincToken->expire_time . "\n"; |
|
24 | +echo $boincToken->token."\n"; |
|
25 | +echo $boincToken->userid."\n"; |
|
26 | +echo $boincToken->type."\n"; |
|
27 | +echo $boincToken->create_time."\n"; |
|
28 | +echo $boincToken->expire_time."\n"; |
|
29 | 29 | |
30 | 30 | echo "---------------\n"; |
31 | 31 | $boincToken = BoincToken::lookup_valid_token(0, $token, 'T'); |
32 | -if ( $boincToken != null ) { |
|
32 | +if ($boincToken != null) { |
|
33 | 33 | echo "Found valid token\n"; |
34 | 34 | } |
35 | 35 | |
36 | 36 | echo "---------------\n"; |
37 | 37 | $boincToken = BoincToken::lookup_valid_token(0, 'notrealtoken', 'T'); |
38 | -if ( $boincToken == null ) { |
|
38 | +if ($boincToken == null) { |
|
39 | 39 | echo "Successfully didn't find invalid token\n"; |
40 | 40 | } |
41 | 41 | |
42 | 42 | echo "---------------\n"; |
43 | 43 | $user = new BoincUser(); |
44 | -$user->id=0; |
|
44 | +$user->id = 0; |
|
45 | 45 | $token = create_token($user->id, TOKEN_TYPE_DELETE_ACCOUNT, TOKEN_DURATION_ONE_DAY); |
46 | -if ( is_valid_token($user->id, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
|
46 | +if (is_valid_token($user->id, $token, TOKEN_TYPE_DELETE_ACCOUNT)) { |
|
47 | 47 | echo "Successfully created and validated delete account token"; |
48 | 48 | } |
49 | 49 |
@@ -44,9 +44,9 @@ |
||
44 | 44 | page_head(tra("Delete Account")); |
45 | 45 | |
46 | 46 | echo "<p>".tra("Thank you for verifying ownership of your account.")."</p>" |
47 | - ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
48 | - ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
49 | - ."<br/>"; |
|
47 | + ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
48 | + ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
49 | + ."<br/>"; |
|
50 | 50 | |
51 | 51 | form_start(secure_url_base()."delete_account_confirm.php", "post"); |
52 | 52 | form_input_hidden("token", $token); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | page_head(tra("Account Deleted")); |
84 | 84 | |
85 | - echo "<p>".tra("Your account has been deleted. If you want to contribute to %1 in the future you will need to create a new account.",PROJECT)."</p>"; |
|
85 | + echo "<p>".tra("Your account has been deleted. If you want to contribute to %1 in the future you will need to create a new account.", PROJECT)."</p>"; |
|
86 | 86 | |
87 | 87 | page_tail(); |
88 | 88 | } |
@@ -99,8 +99,7 @@ |
||
99 | 99 | ); |
100 | 100 | |
101 | 101 | $form['#redirect'] = 'account'; |
102 | - } |
|
103 | - else { |
|
102 | + } else { |
|
104 | 103 | $form['noaccount'] = array( |
105 | 104 | '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
106 | 105 | ); |
@@ -13,45 +13,45 @@ discard block |
||
13 | 13 | * a form array |
14 | 14 | */ |
15 | 15 | function boincuser_delete_settings() { |
16 | - $form = array(); |
|
16 | + $form = array(); |
|
17 | 17 | |
18 | - $default = array( |
|
18 | + $default = array( |
|
19 | 19 | 'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
20 | 20 | 'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
21 | - ); |
|
21 | + ); |
|
22 | 22 | |
23 | - $form['options'] = array( |
|
23 | + $form['options'] = array( |
|
24 | 24 | '#type' => 'fieldset', |
25 | 25 | '#title' => t('Options'), |
26 | - ); |
|
27 | - $form['options']['help'] = array( |
|
26 | + ); |
|
27 | + $form['options']['help'] = array( |
|
28 | 28 | '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
29 | 29 | '#weight' => 11, |
30 | - ); |
|
31 | - $form['options']['boincuser_delete_type'] = array( |
|
30 | + ); |
|
31 | + $form['options']['boincuser_delete_type'] = array( |
|
32 | 32 | '#type' => 'radios', |
33 | 33 | '#title' => t('Type of delete'), |
34 | 34 | '#default_value' => $default['boincuser_delete_type'], |
35 | 35 | '#options' => array( |
36 | - 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | - 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | - 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
36 | + 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | + 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | + 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | 39 | ), |
40 | 40 | '#weight' => 21, |
41 | - ); |
|
41 | + ); |
|
42 | 42 | |
43 | - $form['redirect'] = array( |
|
43 | + $form['redirect'] = array( |
|
44 | 44 | '#type' => 'fieldset', |
45 | 45 | '#title' => t('Redirect'), |
46 | - ); |
|
47 | - $form['redirect']['boincuser_delete_redirect'] = array( |
|
46 | + ); |
|
47 | + $form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | 48 | '#type' => 'textfield', |
49 | 49 | '#title' => t('Redirection page'), |
50 | 50 | '#default_value' => $default['boincuser_delete_redirect'], |
51 | 51 | '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
52 | - ); |
|
52 | + ); |
|
53 | 53 | |
54 | - return system_settings_form($form); |
|
54 | + return system_settings_form($form); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -60,124 +60,124 @@ discard block |
||
60 | 60 | * password checks. |
61 | 61 | */ |
62 | 62 | function boincuser_delete_admindelete(&$form_state, $uid) { |
63 | - $form = array(); |
|
63 | + $form = array(); |
|
64 | 64 | |
65 | - $form['#uid'] = $uid; |
|
65 | + $form['#uid'] = $uid; |
|
66 | 66 | |
67 | - $form['account']['help'] = array( |
|
67 | + $form['account']['help'] = array( |
|
68 | 68 | '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
69 | 69 | '#weight' => -1, |
70 | 70 | '#prefix' => "<div id='delete-instructions'>", |
71 | 71 | '#suffix' => "</div>", |
72 | - ); |
|
72 | + ); |
|
73 | 73 | |
74 | - $account = user_load($uid); |
|
75 | - if ($account) { |
|
74 | + $account = user_load($uid); |
|
75 | + if ($account) { |
|
76 | 76 | drupal_set_title($account->boincuser_name); |
77 | 77 | |
78 | 78 | $form['account']['boincuser_name'] = array( |
79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
79 | + '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | 80 | ); |
81 | 81 | $form['account']['boincuser_id'] = array( |
82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
82 | + '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | 83 | ); |
84 | 84 | $form['account']['drupal_name'] = array( |
85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
85 | + '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | 86 | ); |
87 | 87 | $form['account']['user_id'] = array( |
88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
88 | + '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $form['account']['user_delete_action'] = array( |
92 | 92 | '#type' => 'radios', |
93 | 93 | '#options' => array( |
94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | - ); |
|
94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | + ); |
|
97 | 97 | |
98 | 98 | $form['account']['surecheckbox'] = array( |
99 | - '#type' => 'checkbox', |
|
100 | - '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
99 | + '#type' => 'checkbox', |
|
100 | + '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | 101 | array('%name' => $account->boincuser_name) |
102 | - ), |
|
103 | - '#default_value' => FALSE, |
|
102 | + ), |
|
103 | + '#default_value' => FALSE, |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | $form['account']['current_pass'] = array( |
107 | - '#type' => 'password', |
|
108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | - '#size' => 17, |
|
110 | - '#attributes' => array( |
|
107 | + '#type' => 'password', |
|
108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | + '#size' => 17, |
|
110 | + '#attributes' => array( |
|
111 | 111 | 'autocomplete' => 'off', |
112 | - ), |
|
113 | - '#weight' => 25, |
|
112 | + ), |
|
113 | + '#weight' => 25, |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | // Action buttons |
117 | 117 | $form['actions']['submit'] = array( |
118 | - '#type' => 'submit', |
|
119 | - '#value' => t('Submit'), |
|
118 | + '#type' => 'submit', |
|
119 | + '#value' => t('Submit'), |
|
120 | 120 | ); |
121 | 121 | $form['actions']['cancel'] = array( |
122 | - '#type' => 'button', |
|
123 | - '#value' => t('Cancel'), |
|
124 | - '#executes_submit_callback' => TRUE, |
|
125 | - '#validate' => array(), |
|
126 | - '#submit' => array('_boincuser_delete_cancel'), |
|
122 | + '#type' => 'button', |
|
123 | + '#value' => t('Cancel'), |
|
124 | + '#executes_submit_callback' => TRUE, |
|
125 | + '#validate' => array(), |
|
126 | + '#submit' => array('_boincuser_delete_cancel'), |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $form['#redirect'] = 'account'; |
130 | - } |
|
131 | - else { |
|
130 | + } |
|
131 | + else { |
|
132 | 132 | $form['noaccount'] = array( |
133 | - '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
133 | + '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | 134 | ); |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - return $form; |
|
137 | + return $form; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Validation function for admin delete user. |
142 | 142 | */ |
143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
144 | - global $user; |
|
145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
144 | + global $user; |
|
145 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
146 | 146 | |
147 | - if ($form_state['values']['user_delete_action'] == '') { |
|
147 | + if ($form_state['values']['user_delete_action'] == '') { |
|
148 | 148 | form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
151 | + if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | 152 | form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | - if (!($form_state['values']['surecheckbox'])) { |
|
155 | + if (!($form_state['values']['surecheckbox'])) { |
|
156 | 156 | return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
159 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | 160 | return true; |
161 | - } |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Submit function for admin delete user. |
166 | 166 | */ |
167 | 167 | function boincuser_delete_admindelete_submit($form, &$form_state) { |
168 | - // This is the account to be deleted, and not the administrator's |
|
169 | - // account. |
|
170 | - $account = user_load(array('uid' => $form['#uid'])); |
|
171 | - $action = $form_state['values']['user_delete_action']; |
|
168 | + // This is the account to be deleted, and not the administrator's |
|
169 | + // account. |
|
170 | + $account = user_load(array('uid' => $form['#uid'])); |
|
171 | + $action = $form_state['values']['user_delete_action']; |
|
172 | 172 | |
173 | - drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
173 | + drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | 174 | array( |
175 | - '@uid' => $form['#uid'], |
|
176 | - '@displayname' => $account->boincuser_name, |
|
175 | + '@uid' => $form['#uid'], |
|
176 | + '@displayname' => $account->boincuser_name, |
|
177 | 177 | )), 'warning'); |
178 | 178 | |
179 | - // Delete the user |
|
180 | - _boincuser_delete_deleteuser($account, $action); |
|
179 | + // Delete the user |
|
180 | + _boincuser_delete_deleteuser($account, $action); |
|
181 | 181 | |
182 | - drupal_goto('/admin/boinc/user_delete'); |
|
182 | + drupal_goto('/admin/boinc/user_delete'); |
|
183 | 183 | } |
@@ -13,45 +13,45 @@ discard block |
||
13 | 13 | * a form array |
14 | 14 | */ |
15 | 15 | function boincuser_delete_settings() { |
16 | - $form = array(); |
|
17 | - |
|
18 | - $default = array( |
|
19 | - 'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
|
20 | - 'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
|
21 | - ); |
|
22 | - |
|
23 | - $form['options'] = array( |
|
24 | - '#type' => 'fieldset', |
|
25 | - '#title' => t('Options'), |
|
26 | - ); |
|
27 | - $form['options']['help'] = array( |
|
28 | - '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
|
29 | - '#weight' => 11, |
|
30 | - ); |
|
31 | - $form['options']['boincuser_delete_type'] = array( |
|
32 | - '#type' => 'radios', |
|
33 | - '#title' => t('Type of delete'), |
|
34 | - '#default_value' => $default['boincuser_delete_type'], |
|
35 | - '#options' => array( |
|
36 | - 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | - 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | - 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | - ), |
|
40 | - '#weight' => 21, |
|
41 | - ); |
|
42 | - |
|
43 | - $form['redirect'] = array( |
|
44 | - '#type' => 'fieldset', |
|
45 | - '#title' => t('Redirect'), |
|
46 | - ); |
|
47 | - $form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | - '#type' => 'textfield', |
|
49 | - '#title' => t('Redirection page'), |
|
50 | - '#default_value' => $default['boincuser_delete_redirect'], |
|
51 | - '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
|
52 | - ); |
|
53 | - |
|
54 | - return system_settings_form($form); |
|
16 | +$form = array(); |
|
17 | + |
|
18 | +$default = array( |
|
19 | +'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
|
20 | +'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
|
21 | +); |
|
22 | + |
|
23 | +$form['options'] = array( |
|
24 | +'#type' => 'fieldset', |
|
25 | +'#title' => t('Options'), |
|
26 | +); |
|
27 | +$form['options']['help'] = array( |
|
28 | +'#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
|
29 | +'#weight' => 11, |
|
30 | +); |
|
31 | +$form['options']['boincuser_delete_type'] = array( |
|
32 | +'#type' => 'radios', |
|
33 | +'#title' => t('Type of delete'), |
|
34 | +'#default_value' => $default['boincuser_delete_type'], |
|
35 | +'#options' => array( |
|
36 | + 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
37 | + 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
38 | + 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
39 | +), |
|
40 | +'#weight' => 21, |
|
41 | +); |
|
42 | + |
|
43 | +$form['redirect'] = array( |
|
44 | +'#type' => 'fieldset', |
|
45 | +'#title' => t('Redirect'), |
|
46 | +); |
|
47 | +$form['redirect']['boincuser_delete_redirect'] = array( |
|
48 | +'#type' => 'textfield', |
|
49 | +'#title' => t('Redirection page'), |
|
50 | +'#default_value' => $default['boincuser_delete_redirect'], |
|
51 | +'#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
|
52 | +); |
|
53 | + |
|
54 | +return system_settings_form($form); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -60,124 +60,124 @@ discard block |
||
60 | 60 | * password checks. |
61 | 61 | */ |
62 | 62 | function boincuser_delete_admindelete(&$form_state, $uid) { |
63 | - $form = array(); |
|
64 | - |
|
65 | - $form['#uid'] = $uid; |
|
66 | - |
|
67 | - $form['account']['help'] = array( |
|
68 | - '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
|
69 | - '#weight' => -1, |
|
70 | - '#prefix' => "<div id='delete-instructions'>", |
|
71 | - '#suffix' => "</div>", |
|
63 | +$form = array(); |
|
64 | + |
|
65 | +$form['#uid'] = $uid; |
|
66 | + |
|
67 | +$form['account']['help'] = array( |
|
68 | +'#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
|
69 | +'#weight' => -1, |
|
70 | +'#prefix' => "<div id='delete-instructions'>", |
|
71 | +'#suffix' => "</div>", |
|
72 | +); |
|
73 | + |
|
74 | +$account = user_load($uid); |
|
75 | +if ($account) { |
|
76 | +drupal_set_title($account->boincuser_name); |
|
77 | + |
|
78 | +$form['account']['boincuser_name'] = array( |
|
79 | + '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | +); |
|
81 | +$form['account']['boincuser_id'] = array( |
|
82 | + '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | +); |
|
84 | +$form['account']['drupal_name'] = array( |
|
85 | + '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | +); |
|
87 | +$form['account']['user_id'] = array( |
|
88 | + '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | +); |
|
90 | + |
|
91 | +$form['account']['user_delete_action'] = array( |
|
92 | + '#type' => 'radios', |
|
93 | + '#options' => array( |
|
94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
72 | 96 | ); |
73 | 97 | |
74 | - $account = user_load($uid); |
|
75 | - if ($account) { |
|
76 | - drupal_set_title($account->boincuser_name); |
|
77 | - |
|
78 | - $form['account']['boincuser_name'] = array( |
|
79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | - ); |
|
81 | - $form['account']['boincuser_id'] = array( |
|
82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
83 | - ); |
|
84 | - $form['account']['drupal_name'] = array( |
|
85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
86 | - ); |
|
87 | - $form['account']['user_id'] = array( |
|
88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
89 | - ); |
|
90 | - |
|
91 | - $form['account']['user_delete_action'] = array( |
|
92 | - '#type' => 'radios', |
|
93 | - '#options' => array( |
|
94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
96 | - ); |
|
97 | - |
|
98 | - $form['account']['surecheckbox'] = array( |
|
99 | - '#type' => 'checkbox', |
|
100 | - '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | - array('%name' => $account->boincuser_name) |
|
102 | - ), |
|
103 | - '#default_value' => FALSE, |
|
104 | - ); |
|
105 | - |
|
106 | - $form['account']['current_pass'] = array( |
|
107 | - '#type' => 'password', |
|
108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | - '#size' => 17, |
|
110 | - '#attributes' => array( |
|
111 | - 'autocomplete' => 'off', |
|
112 | - ), |
|
113 | - '#weight' => 25, |
|
114 | - ); |
|
115 | - |
|
116 | - // Action buttons |
|
117 | - $form['actions']['submit'] = array( |
|
118 | - '#type' => 'submit', |
|
119 | - '#value' => t('Submit'), |
|
120 | - ); |
|
121 | - $form['actions']['cancel'] = array( |
|
122 | - '#type' => 'button', |
|
123 | - '#value' => t('Cancel'), |
|
124 | - '#executes_submit_callback' => TRUE, |
|
125 | - '#validate' => array(), |
|
126 | - '#submit' => array('_boincuser_delete_cancel'), |
|
127 | - ); |
|
128 | - |
|
129 | - $form['#redirect'] = 'account'; |
|
130 | - } |
|
131 | - else { |
|
132 | - $form['noaccount'] = array( |
|
133 | - '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | - ); |
|
135 | - } |
|
136 | - |
|
137 | - return $form; |
|
98 | +$form['account']['surecheckbox'] = array( |
|
99 | + '#type' => 'checkbox', |
|
100 | + '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
101 | + array('%name' => $account->boincuser_name) |
|
102 | + ), |
|
103 | + '#default_value' => FALSE, |
|
104 | +); |
|
105 | + |
|
106 | +$form['account']['current_pass'] = array( |
|
107 | + '#type' => 'password', |
|
108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
109 | + '#size' => 17, |
|
110 | + '#attributes' => array( |
|
111 | + 'autocomplete' => 'off', |
|
112 | + ), |
|
113 | + '#weight' => 25, |
|
114 | +); |
|
115 | + |
|
116 | +// Action buttons |
|
117 | +$form['actions']['submit'] = array( |
|
118 | + '#type' => 'submit', |
|
119 | + '#value' => t('Submit'), |
|
120 | +); |
|
121 | +$form['actions']['cancel'] = array( |
|
122 | + '#type' => 'button', |
|
123 | + '#value' => t('Cancel'), |
|
124 | + '#executes_submit_callback' => TRUE, |
|
125 | + '#validate' => array(), |
|
126 | + '#submit' => array('_boincuser_delete_cancel'), |
|
127 | +); |
|
128 | + |
|
129 | +$form['#redirect'] = 'account'; |
|
130 | +} |
|
131 | +else { |
|
132 | +$form['noaccount'] = array( |
|
133 | + '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
134 | +); |
|
135 | +} |
|
136 | + |
|
137 | +return $form; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Validation function for admin delete user. |
142 | 142 | */ |
143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
144 | - global $user; |
|
145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
144 | +global $user; |
|
145 | +$boinc_user = boincuser_load($user->uid, TRUE); |
|
146 | 146 | |
147 | - if ($form_state['values']['user_delete_action'] == '') { |
|
148 | - form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
|
149 | - } |
|
147 | +if ($form_state['values']['user_delete_action'] == '') { |
|
148 | +form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
|
149 | +} |
|
150 | 150 | |
151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | - form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
|
153 | - } |
|
151 | +if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
152 | +form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
|
153 | +} |
|
154 | 154 | |
155 | - if (!($form_state['values']['surecheckbox'])) { |
|
156 | - return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
|
157 | - } |
|
155 | +if (!($form_state['values']['surecheckbox'])) { |
|
156 | +return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
|
157 | +} |
|
158 | 158 | |
159 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | - return true; |
|
161 | - } |
|
159 | +if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
160 | +return true; |
|
161 | +} |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Submit function for admin delete user. |
166 | 166 | */ |
167 | 167 | function boincuser_delete_admindelete_submit($form, &$form_state) { |
168 | - // This is the account to be deleted, and not the administrator's |
|
169 | - // account. |
|
170 | - $account = user_load(array('uid' => $form['#uid'])); |
|
171 | - $action = $form_state['values']['user_delete_action']; |
|
168 | +// This is the account to be deleted, and not the administrator's |
|
169 | +// account. |
|
170 | +$account = user_load(array('uid' => $form['#uid'])); |
|
171 | +$action = $form_state['values']['user_delete_action']; |
|
172 | 172 | |
173 | - drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | - array( |
|
175 | - '@uid' => $form['#uid'], |
|
176 | - '@displayname' => $account->boincuser_name, |
|
177 | - )), 'warning'); |
|
173 | +drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
174 | +array( |
|
175 | + '@uid' => $form['#uid'], |
|
176 | + '@displayname' => $account->boincuser_name, |
|
177 | +)), 'warning'); |
|
178 | 178 | |
179 | - // Delete the user |
|
180 | - _boincuser_delete_deleteuser($account, $action); |
|
179 | +// Delete the user |
|
180 | +_boincuser_delete_deleteuser($account, $action); |
|
181 | 181 | |
182 | - drupal_goto('/admin/boinc/user_delete'); |
|
182 | +drupal_goto('/admin/boinc/user_delete'); |
|
183 | 183 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $form['#uid'] = $uid; |
66 | 66 | |
67 | 67 | $form['account']['help'] = array( |
68 | - '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
|
68 | + '#value' => "<p>".t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!")."</p><p>".t("You are deleting the following user, link opens in new window:")."</p>", |
|
69 | 69 | '#weight' => -1, |
70 | 70 | '#prefix' => "<div id='delete-instructions'>", |
71 | 71 | '#suffix' => "</div>", |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | drupal_set_title($account->boincuser_name); |
77 | 77 | |
78 | 78 | $form['account']['boincuser_name'] = array( |
79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
79 | + '#value' => t('<li>BOINC username (public displayname): ').l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
80 | 80 | ); |
81 | 81 | $form['account']['boincuser_id'] = array( |
82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
82 | + '#value' => t('<li>BOINC user ID: ').$account->boincuser_id, |
|
83 | 83 | ); |
84 | 84 | $form['account']['drupal_name'] = array( |
85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
85 | + '#value' => t('<li>Drupal username (internal): ').$account->name, |
|
86 | 86 | ); |
87 | 87 | $form['account']['user_id'] = array( |
88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
88 | + '#value' => t('<li>Drupal user ID: ').$account->uid, |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $form['account']['user_delete_action'] = array( |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
149 | 149 | } |
150 | 150 | |
151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
151 | + if (($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe')) { |
|
152 | 152 | form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
153 | 153 | } |
154 | 154 |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | $form['account']['user_delete_action'] = array( |
92 | 92 | '#type' => 'radios', |
93 | 93 | '#options' => array( |
94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), null, 'boinc:delete-user-account'), |
|
95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), null, 'boinc:delete-user-account'),), |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | $form['account']['surecheckbox'] = array( |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
101 | 101 | array('%name' => $account->boincuser_name) |
102 | 102 | ), |
103 | - '#default_value' => FALSE, |
|
103 | + '#default_value' => false, |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | $form['account']['current_pass'] = array( |
107 | 107 | '#type' => 'password', |
108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), null, 'boinc:delete-user-account'), |
|
109 | 109 | '#size' => 17, |
110 | 110 | '#attributes' => array( |
111 | 111 | 'autocomplete' => 'off', |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $form['actions']['cancel'] = array( |
122 | 122 | '#type' => 'button', |
123 | 123 | '#value' => t('Cancel'), |
124 | - '#executes_submit_callback' => TRUE, |
|
124 | + '#executes_submit_callback' => true, |
|
125 | 125 | '#validate' => array(), |
126 | 126 | '#submit' => array('_boincuser_delete_cancel'), |
127 | 127 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
144 | 144 | global $user; |
145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
145 | + $boinc_user = boincuser_load($user->uid, true); |
|
146 | 146 | |
147 | 147 | if ($form_state['values']['user_delete_action'] == '') { |
148 | 148 | form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
@@ -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", |
@@ -58,10 +58,10 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $master_url, $project_id; |
63 | 63 | panel( |
64 | - $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
|
64 | + $user ?tra("Welcome, %1", $user->name) : tra("What is %1?", PROJECT), |
|
65 | 65 | function() use($user) { |
66 | 66 | global $no_web_account_creation, $master_url, $project_id; |
67 | 67 | if ($user) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $master_url, $project_id; |
63 | 63 | panel( |
64 | 64 | $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
@@ -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) { |