@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | function check_passwd_ui($user, $passwd) { |
58 | 58 | $passwd_hash = md5($passwd.$user->email_addr); |
59 | - if(!check_passwd_hash($user, $passwd_hash)) { |
|
59 | + if (!check_passwd_hash($user, $passwd_hash)) { |
|
60 | 60 | sleep(LOGIN_FAIL_SLEEP_SEC); |
61 | 61 | page_head("Password incorrect"); |
62 | 62 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | function is_banned_email_addr($email_addr) { |
69 | 69 | global $banned_email_domains; |
70 | 70 | if (isset($banned_email_domains)) { |
71 | - foreach($banned_email_domains as $d) { |
|
71 | + foreach ($banned_email_domains as $d) { |
|
72 | 72 | $x = strstr($email_addr, $d); |
73 | 73 | if ($x == $d) return true; |
74 | 74 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // |
97 | 97 | function make_user( |
98 | 98 | $email_addr, $name, $passwd_hash, |
99 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
99 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
100 | 100 | ) { |
101 | 101 | if (!is_valid_email_addr($email_addr)) return null; |
102 | 102 | if (is_banned_email_addr($email_addr)) return null; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | show_error(tra("Passwords may only include ASCII characters.")); |
229 | 229 | } |
230 | 230 | |
231 | - if (strlen($passwd)<$min_passwd_length) { |
|
231 | + if (strlen($passwd) < $min_passwd_length) { |
|
232 | 232 | show_error( |
233 | 233 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
234 | 234 | ); |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | |
189 | 189 | // Check if consent to terms of use has been given. |
190 | 190 | // |
191 | - $myconsent = FALSE; |
|
191 | + $myconsent = false; |
|
192 | 192 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
193 | 193 | if ($checkct and check_termsofuse()) { |
194 | 194 | $agree = post_str("agree_to_terms_of_use", true); |
195 | 195 | if (!$agree) { |
196 | 196 | error_page(tra("You have not agreed to our terms of use. Please agree to the terms of use by navigating back to the previous page, in order to create your account")); |
197 | 197 | } |
198 | - $myconsent = TRUE; |
|
198 | + $myconsent = true; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // see whether the new account should be pre-enrolled in a team, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $team = BoincTeam::lookup_id($teamid); |
207 | 207 | $clone_user = BoincUser::lookup_id($team->userid); |
208 | 208 | if (!$clone_user) { |
209 | - error_page("User $userid not found"); |
|
209 | + error_page("user $userid not found"); |
|
210 | 210 | } |
211 | 211 | $project_prefs = $clone_user->project_prefs; |
212 | 212 | } else { |
@@ -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 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $subset = sanitize_tags(get_str("subset")); |
30 | 30 | $venue = sanitize_tags(get_str("venue", true)); |
31 | 31 | $columns = get_str("cols", true); |
32 | -$c = $columns?"&cols=$columns":""; |
|
32 | +$c = $columns ? "&cols=$columns" : ""; |
|
33 | 33 | check_subset($subset); |
34 | 34 | if ($action) { |
35 | 35 | check_tokens($user->authenticator); |
@@ -116,5 +116,5 @@ discard block |
||
116 | 116 | echo "<a href=prefs.php?subset=$subset$c>".tra("Back to preferences")."</a>\n"; |
117 | 117 | page_tail(); |
118 | 118 | |
119 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
119 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
120 | 120 | ?> |
@@ -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 | } |
@@ -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 |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | * Implementation of hook_perm(). |
20 | 20 | */ |
21 | 21 | function boincuser_delete_perm() { |
22 | - return array('delete own account'); |
|
22 | + return array('delete own account'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Implementation of hook_menu(). |
27 | 27 | */ |
28 | 28 | function boincuser_delete_menu() { |
29 | - $items = array(); |
|
30 | - $items['admin/boinc/user_delete'] = array( |
|
29 | + $items = array(); |
|
30 | + $items['admin/boinc/user_delete'] = array( |
|
31 | 31 | 'title' => t('Preferences: BOINC user delete'), |
32 | 32 | 'description' => t('Configure the BOINC user delete action.'), |
33 | 33 | 'page callback' => 'drupal_get_form', |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | 'access arguments' => array('administer users'), |
36 | 36 | 'type' => MENU_NORMAL_ITEM, |
37 | 37 | 'file' => 'boincuser_delete.admin.inc', |
38 | - ); |
|
38 | + ); |
|
39 | 39 | |
40 | - $items['admin/boinc/user_delete/%'] = array( |
|
40 | + $items['admin/boinc/user_delete/%'] = array( |
|
41 | 41 | 'title' => t('Admin delete user'), |
42 | 42 | 'description' => t('Deletes a user as an admin'), |
43 | 43 | 'page callback' => 'drupal_get_form', |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | 'access arguments' => array('administer users'), |
46 | 46 | 'type' => MENU_CALLBACK, |
47 | 47 | 'file' => 'boincuser_delete.admin.inc', |
48 | - ); |
|
48 | + ); |
|
49 | 49 | |
50 | - $items['user/%user/deleteconfirm/%'] = array( |
|
50 | + $items['user/%user/deleteconfirm/%'] = array( |
|
51 | 51 | 'title' => t('Final confirmation for account deletion'), |
52 | 52 | 'description' => t('Final confirmation for account deletion'), |
53 | 53 | 'page callback' => 'drupal_get_form', |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | 'access callback' => 'boincuser_delete_access', |
56 | 56 | 'access arguments' => array(1), |
57 | 57 | 'type' => MENU_CALLBACK, |
58 | - ); |
|
58 | + ); |
|
59 | 59 | |
60 | - $items['user/%user/odeleteconfirm/%'] = array( |
|
60 | + $items['user/%user/odeleteconfirm/%'] = array( |
|
61 | 61 | 'title' => t('Final confirmation for account deletion'), |
62 | 62 | 'description' => t('Final confirmation for account deletion'), |
63 | 63 | 'page callback' => 'drupal_get_form', |
@@ -65,204 +65,204 @@ discard block |
||
65 | 65 | 'access callback' => 'boincuser_delete_access', |
66 | 66 | 'access arguments' => array(1), |
67 | 67 | 'type' => MENU_CALLBACK, |
68 | - ); |
|
68 | + ); |
|
69 | 69 | |
70 | - return $items; |
|
70 | + return $items; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Checks whether a user can delete an account. |
75 | 75 | */ |
76 | 76 | function boincuser_delete_access($account) { |
77 | - global $user; |
|
78 | - return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0); |
|
77 | + global $user; |
|
78 | + return ((user_access('administer users') || (user_access('delete own account') && $account->uid == $user->uid)) && $account->uid > 0); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Implementation of hook_menu_alter(). |
83 | 83 | */ |
84 | 84 | function boincuser_delete_menu_alter(&$callbacks) { |
85 | - $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access'; |
|
86 | - $callbacks['user/%user/delete']['access arguments'] = array(1); |
|
87 | - $callbacks['user/%user/delete']['type'] = MENU_CALLBACK; |
|
85 | + $callbacks['user/%user/delete']['access callback'] = 'boincuser_delete_access'; |
|
86 | + $callbacks['user/%user/delete']['access arguments'] = array(1); |
|
87 | + $callbacks['user/%user/delete']['type'] = MENU_CALLBACK; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Implementation of hook_form_alter(). |
92 | 92 | */ |
93 | 93 | function boincuser_delete_form_alter(&$form, $form_state, $form_id) { |
94 | - global $user; |
|
94 | + global $user; |
|
95 | 95 | |
96 | - switch($form_id) { |
|
96 | + switch($form_id) { |
|
97 | 97 | case 'user_profile_form': |
98 | 98 | if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
99 | 99 | $form['delete'] = array( |
100 | - '#type' => 'submit', |
|
101 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
102 | - '#weight' => 1009, |
|
103 | - '#submit' => array('user_edit_delete_submit'), |
|
104 | - '#prefix' => '<li class="tab">', |
|
105 | - '#suffix' => '</li>', |
|
100 | + '#type' => 'submit', |
|
101 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
102 | + '#weight' => 1009, |
|
103 | + '#submit' => array('user_edit_delete_submit'), |
|
104 | + '#prefix' => '<li class="tab">', |
|
105 | + '#suffix' => '</li>', |
|
106 | 106 | ); |
107 | - } |
|
108 | - else if ( user_access('administer users') ) { |
|
107 | + } |
|
108 | + else if ( user_access('administer users') ) { |
|
109 | 109 | $form['delete'] = array( |
110 | - '#type' => 'submit', |
|
111 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
112 | - '#weight' => 1009, |
|
113 | - '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
114 | - '#prefix' => '<li class="tab">', |
|
115 | - '#suffix' => '</li>', |
|
110 | + '#type' => 'submit', |
|
111 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
112 | + '#weight' => 1009, |
|
113 | + '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
114 | + '#prefix' => '<li class="tab">', |
|
115 | + '#suffix' => '</li>', |
|
116 | 116 | ); |
117 | - } |
|
118 | - else { |
|
117 | + } |
|
118 | + else { |
|
119 | 119 | unset($form['delete']); |
120 | - } |
|
121 | - break; |
|
120 | + } |
|
121 | + break; |
|
122 | 122 | case 'user_confirm_delete': |
123 | 123 | |
124 | 124 | $disable_delete = FALSE; |
125 | - // If email address was changed less than 7 days (7 * 86400 s) |
|
126 | - // ago, it cannot be changed again. |
|
127 | - $duration = TOKEN_DURATION_ONE_WEEK; |
|
128 | - if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
125 | + // If email address was changed less than 7 days (7 * 86400 s) |
|
126 | + // ago, it cannot be changed again. |
|
127 | + $duration = TOKEN_DURATION_ONE_WEEK; |
|
128 | + if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
129 | 129 | drupal_set_message( |
130 | - bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
130 | + bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
131 | 131 | array( |
132 | - '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
132 | + '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
133 | 133 | ), NULL, 'boinc:account-credentials-change') |
134 | 134 | , 'info'); |
135 | 135 | $disable_delete = TRUE; |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - // Configure radio options |
|
139 | - $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'); |
|
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 | 140 | |
141 | - $deleteoptions = array( |
|
141 | + $deleteoptions = array( |
|
142 | 142 | 'boincuser_delete_softdelete' => bts('<b>Soft delete</b> your account. Your account will be disabled. ', array(), NULL, 'boinc:delete-user-account'), |
143 | 143 | 'boincuser_delete_delete' => bts('<b>Delete</b> your account. ', array(), NULL, 'boinc:delete-user-account'), |
144 | - ); |
|
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) { |
|
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 | 151 | case 'soft_obfuscate': |
152 | 152 | unset($deleteoptions['boincuser_delete_delete']); |
153 | - $deleteoptions['boincuser_delete_softdelete'] .= $common_acts; |
|
154 | - break; |
|
153 | + $deleteoptions['boincuser_delete_softdelete'] .= $common_acts; |
|
154 | + break; |
|
155 | 155 | case 'hard_wipe': |
156 | 156 | unset($deleteoptions['boincuser_delete_softdelete']); |
157 | - $deleteoptions['boincuser_delete_delete'] .= $common_acts; |
|
158 | - break; |
|
159 | - } |
|
157 | + $deleteoptions['boincuser_delete_delete'] .= $common_acts; |
|
158 | + break; |
|
159 | + } |
|
160 | 160 | |
161 | - $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
162 | - drupal_set_title($question); |
|
161 | + $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
162 | + drupal_set_title($question); |
|
163 | 163 | |
164 | - unset($form['description']); |
|
164 | + unset($form['description']); |
|
165 | 165 | |
166 | - $form['main'] = array( |
|
166 | + $form['main'] = array( |
|
167 | 167 | '#type' => 'fieldset', |
168 | 168 | '#weight' => 1, |
169 | - ); |
|
169 | + ); |
|
170 | 170 | |
171 | - $form['main']['fs1'] = array( |
|
171 | + $form['main']['fs1'] = array( |
|
172 | 172 | '#type' => 'fieldset', |
173 | 173 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
174 | 174 | '#weight' => 10, |
175 | 175 | '#collapsible' => TRUE, |
176 | 176 | '#collapsed' => TRUE, |
177 | - ); |
|
178 | - $form['main']['fs1']['help'] = array( |
|
177 | + ); |
|
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>" . |
|
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 | - array( |
|
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 | + "<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 | + array( |
|
183 | 183 | '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
184 | - ), NULL, 'boinc:delete-user-account'), |
|
184 | + ), NULL, 'boinc:delete-user-account'), |
|
185 | 185 | '#weight' => 11, |
186 | 186 | '#prefix' => "<div id='delete-instructions'>", |
187 | 187 | '#suffix' => "</div>", |
188 | - ); |
|
188 | + ); |
|
189 | 189 | |
190 | - if ($dtypes == 'user_decides') { |
|
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'), |
|
193 | - '#prefix' => "<div id='delete-instructions'>", |
|
194 | - '#suffix' => "</div>", |
|
195 | - '#weight' => 20, |
|
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 | + '#prefix' => "<div id='delete-instructions'>", |
|
194 | + '#suffix' => "</div>", |
|
195 | + '#weight' => 20, |
|
196 | 196 | ); |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - $form['main']['user_delete_action'] = array( |
|
199 | + $form['main']['user_delete_action'] = array( |
|
200 | 200 | '#type' => 'radios', |
201 | 201 | '#options' => $deleteoptions, |
202 | 202 | '#weight' => 21, |
203 | - ); |
|
204 | - if ($disable_delete) { |
|
203 | + ); |
|
204 | + if ($disable_delete) { |
|
205 | 205 | $form['main']['user_delete_action']['#disabled'] = TRUE; |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - // Password field |
|
209 | - if (!$disable_delete) { |
|
208 | + // Password field |
|
209 | + if (!$disable_delete) { |
|
210 | 210 | $form['main']['current_pass'] = array( |
211 | - '#type' => 'password', |
|
212 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
213 | - '#size' => 17, |
|
214 | - '#attributes' => array( |
|
211 | + '#type' => 'password', |
|
212 | + '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
213 | + '#size' => 17, |
|
214 | + '#attributes' => array( |
|
215 | 215 | 'autocomplete' => 'off', |
216 | - ), |
|
217 | - '#prefix' => "<div id='delete-password-field'>", |
|
218 | - '#suffix' => "</div>", |
|
219 | - '#weight' => 25, |
|
216 | + ), |
|
217 | + '#prefix' => "<div id='delete-password-field'>", |
|
218 | + '#suffix' => "</div>", |
|
219 | + '#weight' => 25, |
|
220 | 220 | ); |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - $form['separator_bottom'] = array( |
|
223 | + $form['separator_bottom'] = array( |
|
224 | 224 | '#value' => '<div class="separator buttons"></div>', |
225 | 225 | '#weight' => 999, |
226 | - ); |
|
226 | + ); |
|
227 | 227 | |
228 | - // Configure the action buttons |
|
229 | - $uid = $form['_account']['#value']->uid; |
|
230 | - $form['actions']['#weight'] = 1000; |
|
231 | - $form['actions']['form control tabs prefix'] = array( |
|
228 | + // Configure the action buttons |
|
229 | + $uid = $form['_account']['#value']->uid; |
|
230 | + $form['actions']['#weight'] = 1000; |
|
231 | + $form['actions']['form control tabs prefix'] = array( |
|
232 | 232 | '#value' => '<ul class="form-control tab-list">', |
233 | 233 | '#weight' => 1001, |
234 | - ); |
|
235 | - |
|
236 | - unset($form['actions']['#prefix']); |
|
237 | - unset($form['actions']['#suffix']); |
|
238 | - $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
239 | - $form['actions']['submit']['#suffix'] = '</li>'; |
|
240 | - $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
241 | - $form['actions']['submit']['#weight'] = 1002; |
|
242 | - if ($disable_delete) { |
|
234 | + ); |
|
235 | + |
|
236 | + unset($form['actions']['#prefix']); |
|
237 | + unset($form['actions']['#suffix']); |
|
238 | + $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
239 | + $form['actions']['submit']['#suffix'] = '</li>'; |
|
240 | + $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
241 | + $form['actions']['submit']['#weight'] = 1002; |
|
242 | + if ($disable_delete) { |
|
243 | 243 | $form['actions']['submit']['#disabled'] = TRUE; |
244 | 244 | $form['actions']['submit']['#value'] = ''; |
245 | - } |
|
245 | + } |
|
246 | 246 | |
247 | - $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
248 | - $form['actions']['cancel']['#suffix'] = '</li>'; |
|
249 | - $form['actions']['cancel']['#weight'] = 1003; |
|
250 | - $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
251 | - if ($disable_delete) { |
|
247 | + $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
248 | + $form['actions']['cancel']['#suffix'] = '</li>'; |
|
249 | + $form['actions']['cancel']['#weight'] = 1003; |
|
250 | + $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
251 | + if ($disable_delete) { |
|
252 | 252 | $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | - $form['actions']['form control tabs suffix'] = array( |
|
255 | + $form['actions']['form control tabs suffix'] = array( |
|
256 | 256 | '#value' => '</ul>', |
257 | 257 | '#weight' => 1010, |
258 | - ); |
|
258 | + ); |
|
259 | 259 | |
260 | - $form['#redirect'] = 'account/' . $uid; |
|
261 | - $form['#validate'] = array('boincuser_delete_validate'); |
|
262 | - $form['#submit'] = array('boincuser_delete_submit'); |
|
263 | - break; |
|
260 | + $form['#redirect'] = 'account/' . $uid; |
|
261 | + $form['#validate'] = array('boincuser_delete_validate'); |
|
262 | + $form['#submit'] = array('boincuser_delete_submit'); |
|
263 | + break; |
|
264 | 264 | |
265 | - } // switch |
|
265 | + } // switch |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | * password. |
274 | 274 | */ |
275 | 275 | function boincuser_delete_validate($form, &$form_state) { |
276 | - require_boinc('boinc_db'); |
|
276 | + require_boinc('boinc_db'); |
|
277 | 277 | |
278 | - if ($form_state['values']['user_delete_action'] == '') { |
|
278 | + if ($form_state['values']['user_delete_action'] == '') { |
|
279 | 279 | form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account')); |
280 | - } |
|
280 | + } |
|
281 | 281 | |
282 | - // check BOINC user exists |
|
283 | - $account = $form_state['values']['_account']; |
|
284 | - $boinc_user = boincuser_load($account->uid, TRUE); |
|
285 | - if (!$boinc_user) { |
|
282 | + // check BOINC user exists |
|
283 | + $account = $form_state['values']['_account']; |
|
284 | + $boinc_user = boincuser_load($account->uid, TRUE); |
|
285 | + if (!$boinc_user) { |
|
286 | 286 | return form_set_error('current_pass', |
287 | - bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account') |
|
287 | + bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account') |
|
288 | 288 | ); |
289 | - } |
|
289 | + } |
|
290 | 290 | |
291 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
291 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
292 | 292 | return true; |
293 | - } |
|
293 | + } |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -301,39 +301,39 @@ discard block |
||
301 | 301 | * to delete the account. |
302 | 302 | */ |
303 | 303 | function boincuser_delete_submit($form, &$form_state) { |
304 | - require_boinc('token'); |
|
305 | - global $user; |
|
304 | + require_boinc('token'); |
|
305 | + global $user; |
|
306 | 306 | |
307 | - $uid = $form_state['values']['_account']->uid; |
|
308 | - $account = user_load(array('uid' => $uid)); |
|
307 | + $uid = $form_state['values']['_account']->uid; |
|
308 | + $account = user_load(array('uid' => $uid)); |
|
309 | 309 | |
310 | - if (!$account) { |
|
310 | + if (!$account) { |
|
311 | 311 | drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), NULL, 'delete-user-account'), 'error'); |
312 | 312 | watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR); |
313 | 313 | return; |
314 | - } |
|
315 | - |
|
316 | - global $base_url; |
|
317 | - global $base_path; |
|
318 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
319 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
320 | - $site_url = $base_url . $base_path . "user/login"; |
|
321 | - |
|
322 | - // Perform the requested operation |
|
323 | - $op = $form_state['values']['user_delete_action']; |
|
324 | - // create token with 1 day/24 hour expiration |
|
325 | - $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
326 | - switch ($op) { |
|
314 | + } |
|
315 | + |
|
316 | + global $base_url; |
|
317 | + global $base_path; |
|
318 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
319 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
320 | + $site_url = $base_url . $base_path . "user/login"; |
|
321 | + |
|
322 | + // Perform the requested operation |
|
323 | + $op = $form_state['values']['user_delete_action']; |
|
324 | + // create token with 1 day/24 hour expiration |
|
325 | + $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
326 | + switch ($op) { |
|
327 | 327 | case 'boincuser_delete_softdelete': |
328 | 328 | $myurl = "${base_url}/user/{$account->uid}/odeleteconfirm/$mytoken"; |
329 | - break; |
|
329 | + break; |
|
330 | 330 | case 'boincuser_delete_delete': |
331 | 331 | $myurl = "${base_url}/user/{$account->uid}/deleteconfirm/$mytoken"; |
332 | - break; |
|
333 | - } |
|
332 | + break; |
|
333 | + } |
|
334 | 334 | |
335 | - $mysubject = "Instructions for account deletion at {$site_name}"; |
|
336 | - $mymessage = '' |
|
335 | + $mysubject = "Instructions for account deletion at {$site_name}"; |
|
336 | + $mymessage = '' |
|
337 | 337 | . "{$account->boincuser_name},\n" |
338 | 338 | . "\n" |
339 | 339 | . "We have received a request to DELETE your user account at " |
@@ -355,25 +355,25 @@ discard block |
||
355 | 355 | . "\n" |
356 | 356 | . "{$site_name} support team"; |
357 | 357 | |
358 | - // Create array for sending email to user to notify account is being |
|
359 | - // disabled/deleted. Then send email. |
|
360 | - $settings = array( |
|
358 | + // Create array for sending email to user to notify account is being |
|
359 | + // disabled/deleted. Then send email. |
|
360 | + $settings = array( |
|
361 | 361 | 'from' => '', |
362 | 362 | 'subject' => $mysubject, |
363 | 363 | 'message' => $mymessage, |
364 | - ); |
|
365 | - rules_action_mail_to_user($account, $settings); |
|
364 | + ); |
|
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 | - $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
370 | - // Redirect |
|
371 | - if (!empty($redirect)) { |
|
369 | + $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
370 | + // Redirect |
|
371 | + if (!empty($redirect)) { |
|
372 | 372 | drupal_goto($redirect); |
373 | - } |
|
374 | - else { |
|
373 | + } |
|
374 | + else { |
|
375 | 375 | drupal_goto(); |
376 | - } |
|
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'); |
|
388 | + require_boinc('token'); |
|
389 | 389 | |
390 | - global $user; |
|
391 | - $form = array(); |
|
390 | + global $user; |
|
391 | + $form = array(); |
|
392 | 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')) { |
|
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 | 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 | 400 | array( |
401 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
401 | + '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
402 | 402 | ), |
403 | 403 | NULL, 'boinc:delete-user-account'), 'error'); |
404 | 404 | drupal_goto(); |
405 | - } |
|
405 | + } |
|
406 | 406 | |
407 | - // Attach account to this form. |
|
408 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
407 | + // Attach account to this form. |
|
408 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
409 | 409 | |
410 | - // This form is for hard/wipe delete |
|
411 | - $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe'); |
|
410 | + // This form is for hard/wipe delete |
|
411 | + $form['_action'] = array('#type' => 'value', '#value' => 'hard_wipe'); |
|
412 | 412 | |
413 | - // Instructions |
|
414 | - $form['main']['fs1'] = array( |
|
413 | + // Instructions |
|
414 | + $form['main']['fs1'] = array( |
|
415 | 415 | '#type' => 'fieldset', |
416 | 416 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
417 | 417 | '#weight' => 10, |
418 | 418 | '#collapsible' => TRUE, |
419 | 419 | '#collapsed' => TRUE, |
420 | - ); |
|
421 | - $form['main']['fs1']['instructions1'] = array( |
|
420 | + ); |
|
421 | + $form['main']['fs1']['instructions1'] = array( |
|
422 | 422 | '#value' => '<p>'. |
423 | 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 | 424 | '</p>', |
425 | 425 | '#prefix' => "<div id='delete-instructions'>", |
426 | 426 | '#suffix' => "</div>", |
427 | - ); |
|
427 | + ); |
|
428 | 428 | |
429 | - $form['main']['fs1']['instructions2'] = array( |
|
429 | + $form['main']['fs1']['instructions2'] = array( |
|
430 | 430 | '#value' => '<p>'. |
431 | 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 | 432 | '</p>', |
433 | 433 | '#prefix' => "<div id='delete-instructions'>", |
434 | 434 | '#suffix' => "</div>", |
435 | - ); |
|
435 | + ); |
|
436 | 436 | |
437 | - // Password field |
|
438 | - $form['main']['current_pass'] = array( |
|
437 | + // Password field |
|
438 | + $form['main']['current_pass'] = array( |
|
439 | 439 | '#type' => 'password', |
440 | 440 | '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
441 | 441 | '#size' => 17, |
442 | 442 | '#attributes' => array( |
443 | - 'autocomplete' => 'off', |
|
443 | + 'autocomplete' => 'off', |
|
444 | 444 | ), |
445 | 445 | '#weight' => 25, |
446 | - ); |
|
446 | + ); |
|
447 | 447 | |
448 | - // Form control |
|
449 | - $form['form control tabs prefix'] = array( |
|
448 | + // Form control |
|
449 | + $form['form control tabs prefix'] = array( |
|
450 | 450 | '#value' => '<ul class="form-control tab-list">', |
451 | 451 | '#weight' => 1001, |
452 | - ); |
|
453 | - $form['submit'] = array( |
|
452 | + ); |
|
453 | + $form['submit'] = array( |
|
454 | 454 | '#prefix' => '<li class="first tab">', |
455 | 455 | '#type' => 'submit', |
456 | 456 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
457 | 457 | '#suffix' => '</li>', |
458 | 458 | '#weight' => 1002, |
459 | - ); |
|
460 | - $form['form control tabs'] = array( |
|
459 | + ); |
|
460 | + $form['form control tabs'] = array( |
|
461 | 461 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
462 | 462 | '#weight' => 1003, |
463 | - ); |
|
464 | - $form['form control tabs suffix'] = array( |
|
463 | + ); |
|
464 | + $form['form control tabs suffix'] = array( |
|
465 | 465 | '#value' => '</ul>', |
466 | 466 | '#weight' => 1004, |
467 | - ); |
|
467 | + ); |
|
468 | 468 | |
469 | - return $form; |
|
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'); |
|
477 | + require_boinc('token'); |
|
478 | 478 | |
479 | - global $user; |
|
480 | - $form = array(); |
|
479 | + global $user; |
|
480 | + $form = array(); |
|
481 | 481 | |
482 | - // check BOINC user exists |
|
483 | - $account = user_load(array('uid' => $user->uid)); |
|
484 | - $uid = $user->uid; |
|
485 | - $boincid = $account->boincuser_id; |
|
482 | + // check BOINC user exists |
|
483 | + $account = user_load(array('uid' => $user->uid)); |
|
484 | + $uid = $user->uid; |
|
485 | + $boincid = $account->boincuser_id; |
|
486 | 486 | |
487 | - // check $token is valid |
|
488 | - if (!is_valid_token($boincid, $token, 'D')) { |
|
487 | + // check $token is valid |
|
488 | + if (!is_valid_token($boincid, $token, 'D')) { |
|
489 | 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 | 490 | array( |
491 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
491 | + '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
492 | 492 | ), |
493 | 493 | NULL, 'boinc:delete-user-account'), 'error'); |
494 | 494 | drupal_goto(); |
495 | - } |
|
495 | + } |
|
496 | 496 | |
497 | - // Attach account to this form. |
|
498 | - $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
497 | + // Attach account to this form. |
|
498 | + $form['_account'] = array('#type' => 'value', '#value' => $account); |
|
499 | 499 | |
500 | - // This form is for hard/wipe delete |
|
501 | - $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate'); |
|
500 | + // This form is for hard/wipe delete |
|
501 | + $form['_action'] = array('#type' => 'value', '#value' => 'soft_obfuscate'); |
|
502 | 502 | |
503 | - // Instructions |
|
504 | - $form['main']['fs1'] = array( |
|
503 | + // Instructions |
|
504 | + $form['main']['fs1'] = array( |
|
505 | 505 | '#type' => 'fieldset', |
506 | 506 | '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
507 | 507 | '#weight' => 10, |
508 | 508 | '#collapsible' => TRUE, |
509 | 509 | '#collapsed' => TRUE, |
510 | - ); |
|
511 | - $form['main']['fs1']['instructions1'] = array( |
|
510 | + ); |
|
511 | + $form['main']['fs1']['instructions1'] = array( |
|
512 | 512 | '#value' => '<p>'. |
513 | 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 | 514 | '</p>', |
515 | 515 | '#prefix' => "<div id='delete-instructions'>", |
516 | 516 | '#suffix' => "</div>", |
517 | - ); |
|
517 | + ); |
|
518 | 518 | |
519 | - $form['main']['fs1']['instructions2'] = array( |
|
519 | + $form['main']['fs1']['instructions2'] = array( |
|
520 | 520 | '#value' => '<p>'. |
521 | 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 | 522 | '</p>', |
523 | 523 | '#prefix' => "<div id='delete-instructions'>", |
524 | 524 | '#suffix' => "</div>", |
525 | - ); |
|
525 | + ); |
|
526 | 526 | |
527 | - // Password field |
|
528 | - $form['main']['current_pass'] = array( |
|
527 | + // Password field |
|
528 | + $form['main']['current_pass'] = array( |
|
529 | 529 | '#type' => 'password', |
530 | 530 | '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
531 | 531 | '#size' => 17, |
532 | 532 | '#attributes' => array( |
533 | - 'autocomplete' => 'off', |
|
533 | + 'autocomplete' => 'off', |
|
534 | 534 | ), |
535 | 535 | '#weight' => 25, |
536 | - ); |
|
536 | + ); |
|
537 | 537 | |
538 | - // Form control |
|
539 | - $form['form control tabs prefix'] = array( |
|
538 | + // Form control |
|
539 | + $form['form control tabs prefix'] = array( |
|
540 | 540 | '#value' => '<ul class="form-control tab-list">', |
541 | 541 | '#weight' => 1001, |
542 | - ); |
|
543 | - $form['submit'] = array( |
|
542 | + ); |
|
543 | + $form['submit'] = array( |
|
544 | 544 | '#prefix' => '<li class="first tab">', |
545 | 545 | '#type' => 'submit', |
546 | 546 | '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
547 | 547 | '#suffix' => '</li>', |
548 | 548 | '#weight' => 1002, |
549 | - ); |
|
550 | - $form['form control tabs'] = array( |
|
549 | + ); |
|
550 | + $form['form control tabs'] = array( |
|
551 | 551 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/") . '</li>', |
552 | 552 | '#weight' => 1003, |
553 | - ); |
|
554 | - $form['form control tabs suffix'] = array( |
|
553 | + ); |
|
554 | + $form['form control tabs suffix'] = array( |
|
555 | 555 | '#value' => '</ul>', |
556 | 556 | '#weight' => 1004, |
557 | - ); |
|
557 | + ); |
|
558 | 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; |
|
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'])) { |
|
572 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
573 | 573 | return true; |
574 | - } |
|
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; |
|
581 | + global $user; |
|
582 | 582 | |
583 | - // Delete the user |
|
584 | - $account = $form_state['values']['_account']; |
|
585 | - $action = $form_state['values']['_action']; |
|
586 | - _boincuser_delete_deleteuser($account, $action); |
|
583 | + // Delete the user |
|
584 | + $account = $form_state['values']['_account']; |
|
585 | + $action = $form_state['values']['_action']; |
|
586 | + _boincuser_delete_deleteuser($account, $action); |
|
587 | 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); |
|
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 | 593 | |
594 | - // Load the anonymous user |
|
595 | - $user = drupal_anonymous_user(); |
|
594 | + // Load the anonymous user |
|
595 | + $user = drupal_anonymous_user(); |
|
596 | 596 | |
597 | - $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
598 | - // Redirect |
|
599 | - if (!empty($redirect)) { |
|
597 | + $redirect = variable_get('boincuser_delete_redirect', '<front>'); |
|
598 | + // Redirect |
|
599 | + if (!empty($redirect)) { |
|
600 | 600 | drupal_goto($redirect); |
601 | - } |
|
602 | - else { |
|
601 | + } |
|
602 | + else { |
|
603 | 603 | drupal_goto(); |
604 | - } |
|
604 | + } |
|
605 | 605 | |
606 | 606 | } |
@@ -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( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | switch($form_id) { |
97 | 97 | case 'user_profile_form': |
98 | - if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
|
98 | + if ( user_access('delete own account') and ($form['#uid'] == $user->uid) and (arg(3)=='') ) { |
|
99 | 99 | $form['delete'] = array( |
100 | 100 | '#type' => 'submit', |
101 | 101 | '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | break; |
122 | 122 | case 'user_confirm_delete': |
123 | 123 | |
124 | - $disable_delete = FALSE; |
|
124 | + $disable_delete = false; |
|
125 | 125 | // If email address was changed less than 7 days (7 * 86400 s) |
126 | 126 | // ago, it cannot be changed again. |
127 | 127 | $duration = TOKEN_DURATION_ONE_WEEK; |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
131 | 131 | array( |
132 | 132 | '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
133 | - ), NULL, 'boinc:account-credentials-change') |
|
133 | + ), null, 'boinc:account-credentials-change') |
|
134 | 134 | , 'info'); |
135 | - $disable_delete = TRUE; |
|
135 | + $disable_delete = true; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // Configure radio options |
139 | - $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 | + $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 | 140 | |
141 | 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'), |
|
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 | 144 | ); |
145 | 145 | |
146 | 146 | $dtypes = variable_get('boincuser_delete_type', 'user_decides'); |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | |
171 | 171 | $form['main']['fs1'] = array( |
172 | 172 | '#type' => 'fieldset', |
173 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
173 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
174 | 174 | '#weight' => 10, |
175 | - '#collapsible' => TRUE, |
|
176 | - '#collapsed' => TRUE, |
|
175 | + '#collapsible' => true, |
|
176 | + '#collapsed' => true, |
|
177 | 177 | ); |
178 | 178 | $form['main']['fs1']['help'] = array( |
179 | 179 | '#value' => bts( |
180 | 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 | - '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
|
184 | - ), NULL, 'boinc:delete-user-account'), |
|
183 | + '!link' => l(bts('change your email address', array(), null, 'boinc:delete-user-account'), '/account/info/edit'), |
|
184 | + ), null, 'boinc:delete-user-account'), |
|
185 | 185 | '#weight' => 11, |
186 | 186 | '#prefix' => "<div id='delete-instructions'>", |
187 | 187 | '#suffix' => "</div>", |
@@ -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, |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | '#weight' => 21, |
203 | 203 | ); |
204 | 204 | if ($disable_delete) { |
205 | - $form['main']['user_delete_action']['#disabled'] = TRUE; |
|
205 | + $form['main']['user_delete_action']['#disabled'] = true; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Password field |
209 | 209 | if (!$disable_delete) { |
210 | 210 | $form['main']['current_pass'] = array( |
211 | 211 | '#type' => 'password', |
212 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
212 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
213 | 213 | '#size' => 17, |
214 | 214 | '#attributes' => array( |
215 | 215 | 'autocomplete' => 'off', |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | unset($form['actions']['#suffix']); |
238 | 238 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
239 | 239 | $form['actions']['submit']['#suffix'] = '</li>'; |
240 | - $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
240 | + $form['actions']['submit']['#value'] = bts('Submit', array(), null, 'boinc:form-submit'); |
|
241 | 241 | $form['actions']['submit']['#weight'] = 1002; |
242 | 242 | if ($disable_delete) { |
243 | - $form['actions']['submit']['#disabled'] = TRUE; |
|
243 | + $form['actions']['submit']['#disabled'] = true; |
|
244 | 244 | $form['actions']['submit']['#value'] = ''; |
245 | 245 | } |
246 | 246 | |
247 | 247 | $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
248 | 248 | $form['actions']['cancel']['#suffix'] = '</li>'; |
249 | 249 | $form['actions']['cancel']['#weight'] = 1003; |
250 | - $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
250 | + $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'account/info/edit'); |
|
251 | 251 | if ($disable_delete) { |
252 | 252 | $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
253 | 253 | } |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | require_boinc('boinc_db'); |
277 | 277 | |
278 | 278 | if ($form_state['values']['user_delete_action'] == '') { |
279 | - form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), NULL, 'boinc:delete-user-account')); |
|
279 | + form_set_error('user_delete_action', bts('Please select an action to perform using the radio buttons.', array(), null, 'boinc:delete-user-account')); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // check BOINC user exists |
283 | 283 | $account = $form_state['values']['_account']; |
284 | - $boinc_user = boincuser_load($account->uid, TRUE); |
|
284 | + $boinc_user = boincuser_load($account->uid, true); |
|
285 | 285 | if (!$boinc_user) { |
286 | 286 | return form_set_error('current_pass', |
287 | - bts('There was a problem deleting your account. Please contact the site administrators.', array(), NULL, 'boinc:delete-user-account') |
|
287 | + bts('There was a problem deleting your account. Please contact the site administrators.', array(), null, 'boinc:delete-user-account') |
|
288 | 288 | ); |
289 | 289 | } |
290 | 290 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $account = user_load(array('uid' => $uid)); |
309 | 309 | |
310 | 310 | if (!$account) { |
311 | - drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), NULL, 'delete-user-account'), 'error'); |
|
311 | + drupal_set_message(bts('ERROR: The user account @uid does not exist.', array('@uid' => $uid), array(), null, 'delete-user-account'), 'error'); |
|
312 | 312 | watchdog('user', 'Attempted to cancel non-existing user account UID: %uid.', array('%uid' => $uid), WATCHDOG_ERROR); |
313 | 313 | return; |
314 | 314 | } |
@@ -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 |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | if (!is_valid_token($boincid, $token, 'D')) { |
399 | 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 | 400 | array( |
401 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
401 | + '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
402 | 402 | ), |
403 | - NULL, 'boinc:delete-user-account'), 'error'); |
|
403 | + null, 'boinc:delete-user-account'), 'error'); |
|
404 | 404 | drupal_goto(); |
405 | 405 | } |
406 | 406 | |
@@ -413,14 +413,14 @@ discard block |
||
413 | 413 | // Instructions |
414 | 414 | $form['main']['fs1'] = array( |
415 | 415 | '#type' => 'fieldset', |
416 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
416 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
417 | 417 | '#weight' => 10, |
418 | - '#collapsible' => TRUE, |
|
419 | - '#collapsed' => TRUE, |
|
418 | + '#collapsible' => true, |
|
419 | + '#collapsed' => true, |
|
420 | 420 | ); |
421 | 421 | $form['main']['fs1']['instructions1'] = array( |
422 | 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'). |
|
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 | 424 | '</p>', |
425 | 425 | '#prefix' => "<div id='delete-instructions'>", |
426 | 426 | '#suffix' => "</div>", |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | $form['main']['fs1']['instructions2'] = array( |
430 | 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'). |
|
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 | 432 | '</p>', |
433 | 433 | '#prefix' => "<div id='delete-instructions'>", |
434 | 434 | '#suffix' => "</div>", |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | // Password field |
438 | 438 | $form['main']['current_pass'] = array( |
439 | 439 | '#type' => 'password', |
440 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
440 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
441 | 441 | '#size' => 17, |
442 | 442 | '#attributes' => array( |
443 | 443 | 'autocomplete' => 'off', |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | $form['submit'] = array( |
454 | 454 | '#prefix' => '<li class="first tab">', |
455 | 455 | '#type' => 'submit', |
456 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
456 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
457 | 457 | '#suffix' => '</li>', |
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( |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | if (!is_valid_token($boincid, $token, 'D')) { |
489 | 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 | 490 | array( |
491 | - '!link' => l(bts('re-requesting', array(), NULL, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
491 | + '!link' => l(bts('re-requesting', array(), null, 'boinc:delete-user-account'), "/user/${uid}/delete"), |
|
492 | 492 | ), |
493 | - NULL, 'boinc:delete-user-account'), 'error'); |
|
493 | + null, 'boinc:delete-user-account'), 'error'); |
|
494 | 494 | drupal_goto(); |
495 | 495 | } |
496 | 496 | |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | // Instructions |
504 | 504 | $form['main']['fs1'] = array( |
505 | 505 | '#type' => 'fieldset', |
506 | - '#title' => bts('Instructions', array(), NULL, 'boinc:delete-user-account'), |
|
506 | + '#title' => bts('Instructions', array(), null, 'boinc:delete-user-account'), |
|
507 | 507 | '#weight' => 10, |
508 | - '#collapsible' => TRUE, |
|
509 | - '#collapsed' => TRUE, |
|
508 | + '#collapsible' => true, |
|
509 | + '#collapsed' => true, |
|
510 | 510 | ); |
511 | 511 | $form['main']['fs1']['instructions1'] = array( |
512 | 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'). |
|
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 | 514 | '</p>', |
515 | 515 | '#prefix' => "<div id='delete-instructions'>", |
516 | 516 | '#suffix' => "</div>", |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | $form['main']['fs1']['instructions2'] = array( |
520 | 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'). |
|
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 | 522 | '</p>', |
523 | 523 | '#prefix' => "<div id='delete-instructions'>", |
524 | 524 | '#suffix' => "</div>", |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | // Password field |
528 | 528 | $form['main']['current_pass'] = array( |
529 | 529 | '#type' => 'password', |
530 | - '#title' => bts('Enter your password to delete your account', array(), NULL, 'boinc:delete-user-account'), |
|
530 | + '#title' => bts('Enter your password to delete your account', array(), null, 'boinc:delete-user-account'), |
|
531 | 531 | '#size' => 17, |
532 | 532 | '#attributes' => array( |
533 | 533 | 'autocomplete' => 'off', |
@@ -543,12 +543,12 @@ discard block |
||
543 | 543 | $form['submit'] = array( |
544 | 544 | '#prefix' => '<li class="first tab">', |
545 | 545 | '#type' => 'submit', |
546 | - '#value' => bts('Submit', array(), NULL, 'boinc:form-submit'), |
|
546 | + '#value' => bts('Submit', array(), null, 'boinc:form-submit'), |
|
547 | 547 | '#suffix' => '</li>', |
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( |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | // Destroy the current session: |
589 | 589 | session_destroy(); |
590 | 590 | // Only variables can be passed by reference workaround. |
591 | - $null = NULL; |
|
591 | + $null = null; |
|
592 | 592 | user_module_invoke('logout', $null, $user); |
593 | 593 | |
594 | 594 | // 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", |
@@ -239,8 +239,7 @@ discard block |
||
239 | 239 | ), WATCHDOG_NOTICE |
240 | 240 | ); |
241 | 241 | } |
242 | - } |
|
243 | - else { |
|
242 | + } else { |
|
244 | 243 | drupal_set_message(t('You are not allowed to assume foundership of this |
245 | 244 | team.' |
246 | 245 | )); |
@@ -265,8 +264,7 @@ discard block |
||
265 | 264 | drupal_set_message(t('@team has been removed.', |
266 | 265 | array('@team' => $boincteam->name))); |
267 | 266 | drupal_goto('community/teams'); |
268 | - } |
|
269 | - else { |
|
267 | + } else { |
|
270 | 268 | drupal_set_message(t('All members must be removed from @team before the |
271 | 269 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
272 | 270 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -500,8 +498,7 @@ discard block |
||
500 | 498 | array('@team' => $boincteam->name))); |
501 | 499 | watchdog('boincteam', 'added user @uid to team @nid', |
502 | 500 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
503 | - } |
|
504 | - else { |
|
501 | + } else { |
|
505 | 502 | drupal_set_message(t('There was a problem joining @team, please try again |
506 | 503 | later', array('@team' => $boincteam->name))); |
507 | 504 | watchdog('boincteam', 'error adding user @uid to team @nid', |
@@ -528,8 +525,7 @@ discard block |
||
528 | 525 | array('@team' => $boincteam->name))); |
529 | 526 | watchdog('boincteam', 'removed user @uid from team @nid', |
530 | 527 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
531 | - } |
|
532 | - else { |
|
528 | + } else { |
|
533 | 529 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
534 | 530 | your membership to it.', array('@team' => $boincteam->name))); |
535 | 531 | } |
@@ -598,8 +594,7 @@ discard block |
||
598 | 594 | '@uid' => $account->uid, |
599 | 595 | '@nid' => $team_id |
600 | 596 | ), WATCHDOG_NOTICE); |
601 | - } |
|
602 | - else { |
|
597 | + } else { |
|
603 | 598 | drupal_set_message(t('@user is not a member of @team, so you cannot |
604 | 599 | revoke the membership.', array( |
605 | 600 | '@user' => $account->boincuser_name, |
@@ -628,14 +623,12 @@ discard block |
||
628 | 623 | '@user' => $account->boincuser_name |
629 | 624 | ) |
630 | 625 | ), 'warning'); |
631 | - } |
|
632 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
626 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
633 | 627 | // It hasn't been long enough since the last transfer request |
634 | 628 | drupal_set_message(t('A foundership change was requested during the last 90 |
635 | 629 | days, so new requests are not allowed. Please try again later.' |
636 | 630 | ), 'warning'); |
637 | - } |
|
638 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
631 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
639 | 632 | // Log the transfer request |
640 | 633 | db_set_active('boinc_rw'); |
641 | 634 | db_query(" |
@@ -841,8 +834,7 @@ discard block |
||
841 | 834 | $output .= '['; |
842 | 835 | if ($credit_needed == 1) { |
843 | 836 | $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
844 | - } |
|
845 | - else { |
|
837 | + } else { |
|
846 | 838 | $output .= bts('You must earn @count more credits!', |
847 | 839 | array('@count' => $credit_needed), |
848 | 840 | NULL, 'boinc:create-team-panel' |
@@ -895,8 +887,7 @@ discard block |
||
895 | 887 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
896 | 888 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
897 | 889 | $output .= '</div>' . "\n"; |
898 | - } |
|
899 | - else if ($user->uid == $account->uid) { |
|
890 | + } else if ($user->uid == $account->uid) { |
|
900 | 891 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
901 | 892 | $output .= '<ul class="tab-list action-list">'; |
902 | 893 | $output .= '<li class="tab primary">'; |
@@ -1110,8 +1101,7 @@ discard block |
||
1110 | 1101 | if ($request_age == 1) { |
1111 | 1102 | $output .= bts('1 day has elapsed since your request and' |
1112 | 1103 | . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
1113 | - } |
|
1114 | - else { |
|
1104 | + } else { |
|
1115 | 1105 | $output .= bts('@count days have elapsed since your request and' |
1116 | 1106 | . ' the founder has not responded.', |
1117 | 1107 | array('@count' => $request_age), |
@@ -1121,8 +1111,7 @@ discard block |
||
1121 | 1111 | if ($days_to_respond == 1) { |
1122 | 1112 | $output .= bts('You now have 1 day to assume foundership before' |
1123 | 1113 | . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
1124 | - } |
|
1125 | - else { |
|
1114 | + } else { |
|
1126 | 1115 | $output .= bts('You now have @count days to assume foundership before' |
1127 | 1116 | . ' another team member may submit a request.', |
1128 | 1117 | array('@count' => $days_to_respond), |
@@ -1133,23 +1122,20 @@ discard block |
||
1133 | 1122 | $output .= ' <li class="first last tab">' . |
1134 | 1123 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1135 | 1124 | $output .= '</ul>'; |
1136 | - } |
|
1137 | - else { |
|
1125 | + } else { |
|
1138 | 1126 | $output .= '<p>'; |
1139 | 1127 | if ($days_to_deadline == 1) { |
1140 | 1128 | $output .= bts('The team founder has 1 day to respond to your' |
1141 | 1129 | . ' transfer request.', |
1142 | 1130 | NULL, 'boinc:team-request-foundership'); |
1143 | - } |
|
1144 | - else { |
|
1131 | + } else { |
|
1145 | 1132 | $output .= bts('The team founder has @count days to respond to your' |
1146 | 1133 | . ' transfer request.', array('@count' => $days_to_deadline), |
1147 | 1134 | NULL, 'boinc:team-request-foundership'); |
1148 | 1135 | } |
1149 | 1136 | $output .= '</p>'; |
1150 | 1137 | } |
1151 | - } |
|
1152 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1138 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1153 | 1139 | // If this user does not have a transfer request pending, but new requests |
1154 | 1140 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1155 | 1141 | // who made the request has 30 additional days to assume foundership if |
@@ -1162,15 +1148,13 @@ discard block |
||
1162 | 1148 | NULL, 'boinc:team-request-foundership'); |
1163 | 1149 | if ($days_to_deadline == 1) { |
1164 | 1150 | $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
1165 | - } |
|
1166 | - else { |
|
1151 | + } else { |
|
1167 | 1152 | $output .= ' (' . bts('@count days remaining', |
1168 | 1153 | array('@count' => $days_to_deadline), |
1169 | 1154 | NULL, 'boinc:team-request-foundership') . ')'; |
1170 | 1155 | } |
1171 | 1156 | $output .= '</p>'; |
1172 | - } |
|
1173 | - else { |
|
1157 | + } else { |
|
1174 | 1158 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1175 | 1159 | . ' assume the role of founder, click below to request foundership of' |
1176 | 1160 | . ' @this_team.', |
@@ -1216,8 +1200,7 @@ discard block |
||
1216 | 1200 | $boincteam_id |
1217 | 1201 | ); |
1218 | 1202 | db_set_active('default'); |
1219 | - } |
|
1220 | - else { |
|
1203 | + } else { |
|
1221 | 1204 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1222 | 1205 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
1223 | 1206 | . '</h2>'; |
@@ -26,82 +26,82 @@ discard block |
||
26 | 26 | * Implementation of hook_menu() |
27 | 27 | */ |
28 | 28 | function boincteam_menu() { |
29 | - $items = array(); |
|
30 | - $items['community/teams/%/assume-foundership'] = array( |
|
29 | + $items = array(); |
|
30 | + $items['community/teams/%/assume-foundership'] = array( |
|
31 | 31 | 'page callback' => 'boincteam_assume_foundership', |
32 | 32 | 'page arguments' => array(2), |
33 | 33 | 'access callback' => 'boincteam_is_member', |
34 | 34 | 'access arguments' => array(2), |
35 | 35 | 'type' => MENU_CALLBACK |
36 | - ); |
|
37 | - $items['community/teams/%/join'] = array( |
|
36 | + ); |
|
37 | + $items['community/teams/%/join'] = array( |
|
38 | 38 | 'page callback' => 'boincteam_join', |
39 | 39 | 'page arguments' => array(2), |
40 | 40 | 'access arguments' => array('join boincteam'), |
41 | 41 | 'type' => MENU_CALLBACK |
42 | - ); |
|
43 | - $items['community/teams/%/leave'] = array( |
|
42 | + ); |
|
43 | + $items['community/teams/%/leave'] = array( |
|
44 | 44 | 'page callback' => 'boincteam_leave', |
45 | 45 | 'page arguments' => array(2), |
46 | 46 | 'access arguments' => array('join boincteam'), |
47 | 47 | 'type' => MENU_CALLBACK |
48 | - ); |
|
49 | - $items['community/teams/%/delete'] = array( |
|
48 | + ); |
|
49 | + $items['community/teams/%/delete'] = array( |
|
50 | 50 | 'page callback' => 'boincteam_delete', |
51 | 51 | 'page arguments' => array(2), |
52 | 52 | 'access callback' => 'boincteam_is_founder', |
53 | 53 | 'access arguments' => array(2), |
54 | 54 | 'type' => MENU_CALLBACK |
55 | - ); |
|
56 | - $items['community/teams/%/deny-foundership-request'] = array( |
|
55 | + ); |
|
56 | + $items['community/teams/%/deny-foundership-request'] = array( |
|
57 | 57 | 'page callback' => 'boincteam_deny_foundership_request', |
58 | 58 | 'page arguments' => array(2), |
59 | 59 | 'access callback' => 'boincteam_is_founder', |
60 | 60 | 'access arguments' => array(2), |
61 | 61 | 'type' => MENU_CALLBACK |
62 | - ); |
|
63 | - $items['community/teams/%/edit/admins/remove/%'] = array( |
|
62 | + ); |
|
63 | + $items['community/teams/%/edit/admins/remove/%'] = array( |
|
64 | 64 | 'page callback' => 'boincteam_remove_admin', |
65 | 65 | 'page arguments' => array(2,6), |
66 | 66 | 'access callback' => 'boincteam_is_founder', |
67 | 67 | 'access arguments' => array(2), |
68 | 68 | 'type' => MENU_CALLBACK |
69 | - ); |
|
70 | - $items['community/teams/%/edit/founder/set/%'] = array( |
|
69 | + ); |
|
70 | + $items['community/teams/%/edit/founder/set/%'] = array( |
|
71 | 71 | 'page callback' => 'boincteam_set_founder', |
72 | 72 | 'page arguments' => array(2,6), |
73 | 73 | 'access callback' => 'boincteam_is_founder', |
74 | 74 | 'access arguments' => array(2), |
75 | 75 | 'type' => MENU_CALLBACK |
76 | - ); |
|
77 | - $items['community/teams/%/edit/members/remove/%'] = array( |
|
76 | + ); |
|
77 | + $items['community/teams/%/edit/members/remove/%'] = array( |
|
78 | 78 | 'page callback' => 'boincteam_remove_member', |
79 | 79 | 'page arguments' => array(2,6), |
80 | 80 | 'access callback' => 'boincteam_is_founder', |
81 | 81 | 'access arguments' => array(2), |
82 | 82 | 'type' => MENU_CALLBACK |
83 | - ); |
|
84 | - $items['community/teams/%/history/xml'] = array( |
|
83 | + ); |
|
84 | + $items['community/teams/%/history/xml'] = array( |
|
85 | 85 | 'page callback' => 'boincteam_history_xml', |
86 | 86 | 'page arguments' => array(2), |
87 | 87 | 'access callback' => 'boincteam_is_admin', |
88 | 88 | 'access arguments' => array(2), |
89 | 89 | 'type' => MENU_CALLBACK |
90 | - ); |
|
91 | - $items['community/teams/%/request-foundership'] = array( |
|
90 | + ); |
|
91 | + $items['community/teams/%/request-foundership'] = array( |
|
92 | 92 | 'page callback' => 'boincteam_request_foundership', |
93 | 93 | 'page arguments' => array(2), |
94 | 94 | 'access callback' => 'boincteam_is_member', |
95 | 95 | 'access arguments' => array(2), |
96 | 96 | 'type' => MENU_CALLBACK |
97 | - ); |
|
98 | - $items['community/teams/%/user-name-autocomplete'] = array( |
|
97 | + ); |
|
98 | + $items['community/teams/%/user-name-autocomplete'] = array( |
|
99 | 99 | 'page callback' => '_boincuser_user_name_autocomplete', |
100 | 100 | 'access callback' => 'boincteam_is_founder', |
101 | 101 | 'access arguments' => array(2), |
102 | 102 | 'type' => MENU_CALLBACK, |
103 | - ); |
|
104 | - $items['community/teams/%/message-all-members'] = array( |
|
103 | + ); |
|
104 | + $items['community/teams/%/message-all-members'] = array( |
|
105 | 105 | 'title' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
106 | 106 | 'description' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
107 | 107 | 'page callback' => 'drupal_get_form', |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | 'access callback' => 'boincteam_is_admin', |
110 | 110 | 'access arguments' => array(2), |
111 | 111 | 'type' => MENU_CALLBACK, |
112 | - ); |
|
113 | - $items['admin/boinc/utility-team-delete'] = array( |
|
112 | + ); |
|
113 | + $items['admin/boinc/utility-team-delete'] = array( |
|
114 | 114 | 'title' => 'Utility: Delete SPAM Teams', |
115 | 115 | 'description' => 'Utililities to help delete BOINC teams created by SPAMMERs.', |
116 | 116 | 'page callback' => 'drupal_get_form', |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | 'access arguments' => array('administer site configuration'), |
119 | 119 | 'type' => MENU_NORMAL_ITEM, |
120 | 120 | 'file' => 'boincteam.admin.inc', |
121 | - ); |
|
121 | + ); |
|
122 | 122 | |
123 | - return $items; |
|
123 | + return $items; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -137,41 +137,41 @@ discard block |
||
137 | 137 | |
138 | 138 | See https://www.drupal.org/node/945102 |
139 | 139 | */ |
140 | - return array( |
|
140 | + return array( |
|
141 | 141 | 'boincteam_utility_team_table' => array( |
142 | - 'arguments' => array('form' => NULL), |
|
143 | - 'file' => 'boincteam.admin.inc', |
|
142 | + 'arguments' => array('form' => NULL), |
|
143 | + 'file' => 'boincteam.admin.inc', |
|
144 | 144 | ), |
145 | - ); |
|
145 | + ); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Implementation of hook_views_api(). |
150 | 150 | */ |
151 | 151 | function boincteam_views_api() { |
152 | - return array( |
|
152 | + return array( |
|
153 | 153 | 'api' => 2.0, |
154 | 154 | 'path' => drupal_get_path('module', 'boincteam') |
155 | - ); |
|
155 | + ); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Implementation of hook_perm() |
160 | 160 | */ |
161 | 161 | function boincteam_perm() { |
162 | - return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
162 | + return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Implementation of hook_cron() |
167 | 167 | */ |
168 | 168 | function boincteam_cron() { |
169 | - // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
170 | - $last_sync = variable_get('boincteam_last_sync', 0); |
|
171 | - if ($last_sync < time() - 24*60*60) { |
|
169 | + // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
170 | + $last_sync = variable_get('boincteam_last_sync', 0); |
|
171 | + if ($last_sync < time() - 24*60*60) { |
|
172 | 172 | boincteam_sync(); |
173 | 173 | variable_set('boincteam_last_sync', time()); |
174 | - } |
|
174 | + } |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,41 +185,41 @@ discard block |
||
185 | 185 | * Implementation of hook_views_pre_execute(). |
186 | 186 | */ |
187 | 187 | function boincteam_views_pre_execute(&$view) { |
188 | - /* Specific boinc_teams sub-views use the boinc readonly replica |
|
188 | + /* Specific boinc_teams sub-views use the boinc readonly replica |
|
189 | 189 | * DB. These sub-views defined below by their title. If additional |
190 | 190 | * sub-views need to be added, add their title to the list of cases |
191 | 191 | * below. If a sub-view needs to be reverted to use the master DB, |
192 | 192 | * then remove it from the list of cases. |
193 | 193 | */ |
194 | - if ($view->name == 'boinc_teams') { |
|
194 | + if ($view->name == 'boinc_teams') { |
|
195 | 195 | switch ($view->display[$view->current_display]->display_title) { |
196 | 196 | case 'Top teams overview pane': |
197 | 197 | case 'Top teams pane': |
198 | 198 | case 'Page': |
199 | 199 | $view->base_database = 'boinc_ro'; |
200 | 200 | } |
201 | - } |
|
201 | + } |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Implementation of hook_cron_queue_info() |
206 | 206 | */ |
207 | 207 | function boincteam_cron_queue_info() { |
208 | - $queues = array(); |
|
209 | - $queues['queue_teamdelete'] = array( |
|
208 | + $queues = array(); |
|
209 | + $queues['queue_teamdelete'] = array( |
|
210 | 210 | 'worker callback' => 'boincteam_delete', |
211 | 211 | 'time' => 60, |
212 | - ); |
|
212 | + ); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Implementation of hook_mail_alter() |
217 | 217 | */ |
218 | 218 | function boincteam_mail_alter(&$message) { |
219 | - if (isset($message['params']['boincteam_headers'])) { |
|
219 | + if (isset($message['params']['boincteam_headers'])) { |
|
220 | 220 | $message['headers']['Bcc'] = $message['params']['boincteam_headers']['Bcc']; |
221 | 221 | $message['to'] = ''; |
222 | - } |
|
222 | + } |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -231,49 +231,49 @@ discard block |
||
231 | 231 | * assume the role of founder |
232 | 232 | */ |
233 | 233 | function boincteam_assume_foundership($team_id) { |
234 | - global $user; |
|
235 | - $account = user_load($user->uid); |
|
236 | - $team = node_load($team_id); |
|
237 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
238 | - $boincteam = boincteam_load($boincteam_id); |
|
239 | - $boincuser_id = $account->boincuser_id; |
|
234 | + global $user; |
|
235 | + $account = user_load($user->uid); |
|
236 | + $team = node_load($team_id); |
|
237 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
238 | + $boincteam = boincteam_load($boincteam_id); |
|
239 | + $boincuser_id = $account->boincuser_id; |
|
240 | 240 | |
241 | - if (boincteam_foundership_transfer_ok($boincteam)) { |
|
241 | + if (boincteam_foundership_transfer_ok($boincteam)) { |
|
242 | 242 | if ($boincuser_id == $boincteam->ping_user) { |
243 | - db_set_active('boinc_rw'); |
|
244 | - db_query(" |
|
243 | + db_set_active('boinc_rw'); |
|
244 | + db_query(" |
|
245 | 245 | UPDATE {team} |
246 | 246 | SET userid = '%d', ping_user = '0', ping_time = '0' |
247 | 247 | WHERE id = '%d'", |
248 | 248 | $boincuser_id, $boincteam_id |
249 | - ); |
|
250 | - db_set_active('default'); |
|
251 | - drupal_set_message(t('You are now the founder of @team', array( |
|
249 | + ); |
|
250 | + db_set_active('default'); |
|
251 | + drupal_set_message(t('You are now the founder of @team', array( |
|
252 | 252 | '@team' => $team->title |
253 | - ))); |
|
254 | - watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
253 | + ))); |
|
254 | + watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
255 | 255 | array( |
256 | - '@current_user' => $account->uid, |
|
257 | - '@nid' => $team_id |
|
256 | + '@current_user' => $account->uid, |
|
257 | + '@nid' => $team_id |
|
258 | 258 | ), WATCHDOG_NOTICE |
259 | - ); |
|
259 | + ); |
|
260 | 260 | } |
261 | - } |
|
262 | - else { |
|
261 | + } |
|
262 | + else { |
|
263 | 263 | drupal_set_message(t('You are not allowed to assume foundership of this |
264 | 264 | team.' |
265 | 265 | )); |
266 | - } |
|
267 | - drupal_goto("community/teams/{$team_id}"); |
|
266 | + } |
|
267 | + drupal_goto("community/teams/{$team_id}"); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Delete the team, if empty |
272 | 272 | */ |
273 | 273 | function boincteam_delete($team_id) { |
274 | - $team = node_load($team_id); |
|
275 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
276 | - if ($boincteam->nusers == 1) { |
|
274 | + $team = node_load($team_id); |
|
275 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
276 | + if ($boincteam->nusers == 1) { |
|
277 | 277 | require_boinc('team'); |
278 | 278 | $boincuser = boincuser_load(); |
279 | 279 | user_quit_team($boincuser); |
@@ -282,35 +282,35 @@ discard block |
||
282 | 282 | $team->uid = 0; |
283 | 283 | node_save($team); |
284 | 284 | drupal_set_message(t('@team has been removed.', |
285 | - array('@team' => $boincteam->name))); |
|
285 | + array('@team' => $boincteam->name))); |
|
286 | 286 | drupal_goto('community/teams'); |
287 | - } |
|
288 | - else { |
|
287 | + } |
|
288 | + else { |
|
289 | 289 | drupal_set_message(t('All members must be removed from @team before the |
290 | 290 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | 291 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
292 | - } |
|
292 | + } |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Deny a foundership transfer request |
297 | 297 | */ |
298 | 298 | function boincteam_deny_foundership_request($team_id) { |
299 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
300 | - // Remove the request from the BOINC database |
|
301 | - db_set_active('boinc_rw'); |
|
302 | - db_query(" |
|
299 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
300 | + // Remove the request from the BOINC database |
|
301 | + db_set_active('boinc_rw'); |
|
302 | + db_query(" |
|
303 | 303 | UPDATE {team} |
304 | 304 | SET ping_user=0 |
305 | 305 | WHERE id = '%d'", |
306 | 306 | $boincteam_id |
307 | - ); |
|
308 | - db_set_active('default'); |
|
307 | + ); |
|
308 | + db_set_active('default'); |
|
309 | 309 | |
310 | - drupal_set_message(t('The transfer request has been denied. No additional |
|
310 | + drupal_set_message(t('The transfer request has been denied. No additional |
|
311 | 311 | requests will be allowed until 90 days have passed since this request was |
312 | 312 | made.')); |
313 | - drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
313 | + drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -318,62 +318,62 @@ discard block |
||
318 | 318 | * Get the join date of a user |
319 | 319 | */ |
320 | 320 | function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) { |
321 | - if (!$boincuser_id) { |
|
321 | + if (!$boincuser_id) { |
|
322 | 322 | global $user; |
323 | 323 | $account = user_load($user->uid); |
324 | 324 | $boincuser_id = $account->boincuser_id; |
325 | - } |
|
326 | - db_set_active('boinc_rw'); |
|
327 | - $timestamp = db_result(db_query(" |
|
325 | + } |
|
326 | + db_set_active('boinc_rw'); |
|
327 | + $timestamp = db_result(db_query(" |
|
328 | 328 | SELECT timestamp FROM {team_delta} WHERE |
329 | 329 | userid = %d AND teamid = %d AND joining = 1 |
330 | 330 | ORDER BY timestamp DESC LIMIT 1", |
331 | 331 | $boincuser_id, $boincteam_id |
332 | - )); |
|
333 | - db_set_active('default'); |
|
334 | - return $timestamp; |
|
332 | + )); |
|
333 | + db_set_active('default'); |
|
334 | + return $timestamp; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the team type for display |
339 | 339 | */ |
340 | 340 | function boincteam_get_type($team_id) { |
341 | - //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
342 | - $team = node_load($team_id); |
|
343 | - $terms = taxonomy_node_get_terms($team); |
|
344 | - if ($terms) { |
|
341 | + //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
342 | + $team = node_load($team_id); |
|
343 | + $terms = taxonomy_node_get_terms($team); |
|
344 | + if ($terms) { |
|
345 | 345 | $term = reset($terms); |
346 | 346 | return $term->name; |
347 | - } else { |
|
347 | + } else { |
|
348 | 348 | return null; |
349 | - } |
|
349 | + } |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Access a vocabulary of terms by name |
354 | 354 | */ |
355 | 355 | function boincteam_get_vocabulary_by_name($name) { |
356 | - $vocabs = taxonomy_get_vocabularies('team'); |
|
357 | - foreach ($vocabs as $vocab) { |
|
356 | + $vocabs = taxonomy_get_vocabularies('team'); |
|
357 | + foreach ($vocabs as $vocab) { |
|
358 | 358 | if ($vocab->name == $name) return $vocab->vid; |
359 | - } |
|
360 | - return null; |
|
359 | + } |
|
360 | + return null; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Output the XML of the team history |
365 | 365 | */ |
366 | 366 | function boincteam_history_xml($team_id) { |
367 | - $team = node_load($team_id); |
|
368 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
369 | - $team_history = array( |
|
367 | + $team = node_load($team_id); |
|
368 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
369 | + $team_history = array( |
|
370 | 370 | 'actions' => array( |
371 | - 'action' => array(), |
|
371 | + 'action' => array(), |
|
372 | 372 | ), |
373 | - ); |
|
373 | + ); |
|
374 | 374 | |
375 | - db_set_active('boinc_rw'); |
|
376 | - $result = db_query(" |
|
375 | + db_set_active('boinc_rw'); |
|
376 | + $result = db_query(" |
|
377 | 377 | SELECT |
378 | 378 | td.userid AS id, |
379 | 379 | u.name, |
@@ -385,40 +385,40 @@ discard block |
||
385 | 385 | WHERE td.teamid = %d |
386 | 386 | ORDER BY timestamp ASC", |
387 | 387 | $boincteam_id |
388 | - ); |
|
389 | - db_set_active('default'); |
|
388 | + ); |
|
389 | + db_set_active('default'); |
|
390 | 390 | |
391 | - while ($record = db_fetch_array($result)) { |
|
391 | + while ($record = db_fetch_array($result)) { |
|
392 | 392 | $team_history['actions']['action'][] = $record; |
393 | - } |
|
393 | + } |
|
394 | 394 | |
395 | - header('Content-type: text/xml'); |
|
396 | - echo xml_to_text(array_to_xml($team_history)); |
|
395 | + header('Content-type: text/xml'); |
|
396 | + echo xml_to_text(array_to_xml($team_history)); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
400 | 400 | * Convert a BOINC team ID to a Drupal team ID |
401 | 401 | */ |
402 | 402 | function boincteam_lookup_nid($boinc_id) { |
403 | - $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
404 | - return $drupal_id; |
|
403 | + $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
404 | + return $drupal_id; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Convert a Drupal team ID to a BOINC team ID |
409 | 409 | */ |
410 | 410 | function boincteam_lookup_id($nid) { |
411 | - $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
412 | - return $boinc_id; |
|
411 | + $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
412 | + return $boinc_id; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Get a BOINC team object |
417 | 417 | */ |
418 | 418 | function boincteam_load($boincteam_id, $full_object = FALSE) { |
419 | - require_boinc(array('team')); |
|
420 | - $team = BoincTeam::lookup_id($boincteam_id); |
|
421 | - if ($team AND $full_object) { |
|
419 | + require_boinc(array('team')); |
|
420 | + $team = BoincTeam::lookup_id($boincteam_id); |
|
421 | + if ($team AND $full_object) { |
|
422 | 422 | $team->nusers = BoincUser::count("teamid={$team->id}"); |
423 | 423 | $team->nusers_worked = BoincUser::count("teamid={$team->id} and total_credit>0"); |
424 | 424 | $team->nusers_active = BoincUser::count("teamid={$team->id} and expavg_credit>0.1"); |
@@ -426,313 +426,313 @@ discard block |
||
426 | 426 | $team->new_members = new_member_list($boincteam_id); |
427 | 427 | $team->admins = admin_list($boincteam_id); |
428 | 428 | $team->founder = BoincUser::lookup_id($team->userid); |
429 | - } |
|
430 | - return $team; |
|
429 | + } |
|
430 | + return $team; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
434 | 434 | * Check if a user is the team founder |
435 | 435 | */ |
436 | 436 | function boincteam_is_founder($nid, $uid = NULL) { |
437 | - if (!$uid) { |
|
437 | + if (!$uid) { |
|
438 | 438 | global $user; |
439 | 439 | $uid = $user->uid; |
440 | - } |
|
441 | - if (!boincteam_is_member($nid, $uid)) { |
|
440 | + } |
|
441 | + if (!boincteam_is_member($nid, $uid)) { |
|
442 | 442 | return FALSE; |
443 | - } |
|
444 | - $team_id = boincteam_lookup_id($nid); |
|
445 | - require_boinc('team'); |
|
446 | - return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
443 | + } |
|
444 | + $team_id = boincteam_lookup_id($nid); |
|
445 | + require_boinc('team'); |
|
446 | + return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Check if a user is a team admin |
451 | 451 | */ |
452 | 452 | function boincteam_is_admin($nid, $uid = NULL) { |
453 | - if (!$uid) { |
|
453 | + if (!$uid) { |
|
454 | 454 | global $user; |
455 | 455 | $uid = $user->uid; |
456 | - } |
|
457 | - if (!boincteam_is_member($nid, $uid)) { |
|
456 | + } |
|
457 | + if (!boincteam_is_member($nid, $uid)) { |
|
458 | 458 | return FALSE; |
459 | - } |
|
460 | - $team_id = boincteam_lookup_id($nid); |
|
461 | - require_boinc('team'); |
|
462 | - return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
459 | + } |
|
460 | + $team_id = boincteam_lookup_id($nid); |
|
461 | + require_boinc('team'); |
|
462 | + return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Check if a user is a team member |
467 | 467 | */ |
468 | 468 | function boincteam_is_member($nid, $uid = NULL) { |
469 | - if (!$uid) { |
|
469 | + if (!$uid) { |
|
470 | 470 | global $user; |
471 | 471 | $uid = $user->uid; |
472 | - } |
|
473 | - $account = user_load($uid); |
|
474 | - return ($account->team == $nid); |
|
472 | + } |
|
473 | + $account = user_load($uid); |
|
474 | + return ($account->team == $nid); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
478 | 478 | * Display any persistent team messages |
479 | 479 | */ |
480 | 480 | function boincteam_show_messages() { |
481 | - global $user; |
|
482 | - $uid = $user->uid; |
|
483 | - $account = user_load($uid); |
|
484 | - if ($account->team) { |
|
481 | + global $user; |
|
482 | + $uid = $user->uid; |
|
483 | + $account = user_load($uid); |
|
484 | + if ($account->team) { |
|
485 | 485 | if (boincteam_is_founder($account->team, $account->uid)) { |
486 | - // Set a notice of any pending foundership requests |
|
487 | - $boincteam_id = boincteam_lookup_id($account->team); |
|
488 | - $boincteam = boincteam_load($boincteam_id); |
|
489 | - if ($boincteam->ping_user > 0) { |
|
486 | + // Set a notice of any pending foundership requests |
|
487 | + $boincteam_id = boincteam_lookup_id($account->team); |
|
488 | + $boincteam = boincteam_load($boincteam_id); |
|
489 | + if ($boincteam->ping_user > 0) { |
|
490 | 490 | $foundership_url = "community/teams/{$account->team}/edit/founder"; |
491 | 491 | if (substr($_GET['q'], 0, strlen($foundership_url)) != $foundership_url) { |
492 | - drupal_set_message( |
|
492 | + drupal_set_message( |
|
493 | 493 | bts( |
494 | - 'A foundership transfer request has been made for your team. Please !respond.', |
|
495 | - array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | - NULL, 'boinc:team-founder-change'), |
|
494 | + 'A foundership transfer request has been made for your team. Please !respond.', |
|
495 | + array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | + NULL, 'boinc:team-founder-change'), |
|
497 | 497 | 'warning', FALSE |
498 | - ); |
|
498 | + ); |
|
499 | + } |
|
499 | 500 | } |
500 | - } |
|
501 | 501 | } |
502 | - } |
|
502 | + } |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
506 | 506 | * Add a user to a team |
507 | 507 | */ |
508 | 508 | function boincteam_join($team_id) { |
509 | - global $user; |
|
510 | - $account = user_load($user->uid); |
|
509 | + global $user; |
|
510 | + $account = user_load($user->uid); |
|
511 | 511 | |
512 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
513 | - $boincteam = boincteam_load($boincteam_id); |
|
514 | - if ($boincteam->joinable AND $account->team != $team_id) { |
|
512 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
513 | + $boincteam = boincteam_load($boincteam_id); |
|
514 | + if ($boincteam->joinable AND $account->team != $team_id) { |
|
515 | 515 | require_boinc('team'); |
516 | 516 | $boincuser = boincuser_load(); |
517 | 517 | if (user_join_team($boincteam, $boincuser)) { |
518 | - drupal_set_message(t('You are now a member of @team!', |
|
518 | + drupal_set_message(t('You are now a member of @team!', |
|
519 | 519 | array('@team' => $boincteam->name))); |
520 | - watchdog('boincteam', 'added user @uid to team @nid', |
|
520 | + watchdog('boincteam', 'added user @uid to team @nid', |
|
521 | 521 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
522 | 522 | } |
523 | 523 | else { |
524 | - drupal_set_message(t('There was a problem joining @team, please try again |
|
524 | + drupal_set_message(t('There was a problem joining @team, please try again |
|
525 | 525 | later', array('@team' => $boincteam->name))); |
526 | - watchdog('boincteam', 'error adding user @uid to team @nid', |
|
526 | + watchdog('boincteam', 'error adding user @uid to team @nid', |
|
527 | 527 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_ERROR); |
528 | 528 | } |
529 | - } |
|
530 | - drupal_goto("community/teams/{$team_id}"); |
|
529 | + } |
|
530 | + drupal_goto("community/teams/{$team_id}"); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
534 | 534 | * Leave a team |
535 | 535 | */ |
536 | 536 | function boincteam_leave($team_id) { |
537 | - global $user; |
|
538 | - $account = user_load($user->uid); |
|
537 | + global $user; |
|
538 | + $account = user_load($user->uid); |
|
539 | 539 | |
540 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
541 | - $boincteam = boincteam_load($boincteam_id); |
|
542 | - if ($account->team == $team_id) { |
|
540 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
541 | + $boincteam = boincteam_load($boincteam_id); |
|
542 | + if ($account->team == $team_id) { |
|
543 | 543 | require_boinc('team'); |
544 | 544 | $boincuser = boincuser_load(); |
545 | 545 | user_quit_team($boincuser); |
546 | 546 | drupal_set_message(t('You are no longer a member of @team.', |
547 | - array('@team' => $boincteam->name))); |
|
547 | + array('@team' => $boincteam->name))); |
|
548 | 548 | watchdog('boincteam', 'removed user @uid from team @nid', |
549 | - array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
550 | - } |
|
551 | - else { |
|
552 | - drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
549 | + array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
550 | + } |
|
551 | + else { |
|
552 | + drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
553 | 553 | your membership to it.', array('@team' => $boincteam->name))); |
554 | - } |
|
555 | - drupal_goto("community/teams/{$team_id}"); |
|
554 | + } |
|
555 | + drupal_goto("community/teams/{$team_id}"); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
559 | 559 | * Remove team admin status from a user |
560 | 560 | */ |
561 | 561 | function boincteam_remove_admin($team_id, $user_id) { |
562 | - global $user; |
|
563 | - $account = user_load($user_id); |
|
564 | - $team = node_load($team_id); |
|
565 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
566 | - $boincuser_id = $account->boincuser_id; |
|
562 | + global $user; |
|
563 | + $account = user_load($user_id); |
|
564 | + $team = node_load($team_id); |
|
565 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
566 | + $boincuser_id = $account->boincuser_id; |
|
567 | 567 | |
568 | - if (boincteam_is_admin($team_id, $account->uid)) { |
|
568 | + if (boincteam_is_admin($team_id, $account->uid)) { |
|
569 | 569 | // Update the team in the BOINC db |
570 | 570 | db_set_active('boinc_rw'); |
571 | 571 | db_query(" |
572 | 572 | DELETE FROM {team_admin} WHERE |
573 | 573 | teamid = '%d' AND userid = '%d'", |
574 | - $boincteam_id, |
|
575 | - $boincuser_id |
|
574 | + $boincteam_id, |
|
575 | + $boincuser_id |
|
576 | 576 | ); |
577 | 577 | db_set_active('default'); |
578 | 578 | drupal_set_message(t('@user is no longer an admin of @team.', |
579 | - array( |
|
579 | + array( |
|
580 | 580 | '@user' => $account->boincuser_name, |
581 | 581 | '@team' => $team->title |
582 | - ) |
|
582 | + ) |
|
583 | 583 | )); |
584 | 584 | watchdog('boincteam', 'User @current_user removed admin status for user |
585 | 585 | @uid from team @nid', |
586 | - array( |
|
586 | + array( |
|
587 | 587 | '@current_user' => $user->uid, |
588 | 588 | '@uid' => $account->uid, |
589 | 589 | '@nid' => $team_id |
590 | - ), WATCHDOG_NOTICE); |
|
591 | - } |
|
592 | - drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
590 | + ), WATCHDOG_NOTICE); |
|
591 | + } |
|
592 | + drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
596 | 596 | * Remove a user from a team |
597 | 597 | */ |
598 | 598 | function boincteam_remove_member($team_id, $user_id) { |
599 | - global $user; |
|
600 | - $account = user_load($user_id); |
|
599 | + global $user; |
|
600 | + $account = user_load($user_id); |
|
601 | 601 | |
602 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
603 | - $boincteam = boincteam_load($boincteam_id); |
|
604 | - if ($account->team == $team_id) { |
|
602 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
603 | + $boincteam = boincteam_load($boincteam_id); |
|
604 | + if ($account->team == $team_id) { |
|
605 | 605 | require_boinc('team'); |
606 | 606 | $boincuser = boincuser_load($user_id, TRUE); |
607 | 607 | user_quit_team($boincuser); |
608 | 608 | drupal_set_message(t('@user has been removed from @team.', |
609 | - array( |
|
609 | + array( |
|
610 | 610 | '@user' => $account->boincuser_name, |
611 | 611 | '@team' => $boincteam->name |
612 | - ) |
|
612 | + ) |
|
613 | 613 | )); |
614 | 614 | watchdog('boincteam', 'User @current_user removed user @uid from team @nid', |
615 | - array( |
|
615 | + array( |
|
616 | 616 | '@current_user' => $user->uid, |
617 | 617 | '@uid' => $account->uid, |
618 | 618 | '@nid' => $team_id |
619 | - ), WATCHDOG_NOTICE); |
|
620 | - } |
|
621 | - else { |
|
622 | - drupal_set_message(t('@user is not a member of @team, so you cannot |
|
619 | + ), WATCHDOG_NOTICE); |
|
620 | + } |
|
621 | + else { |
|
622 | + drupal_set_message(t('@user is not a member of @team, so you cannot |
|
623 | 623 | revoke the membership.', array( |
624 | - '@user' => $account->boincuser_name, |
|
625 | - '@team' => $boincteam->name |
|
624 | + '@user' => $account->boincuser_name, |
|
625 | + '@team' => $boincteam->name |
|
626 | 626 | ) |
627 | - )); |
|
628 | - } |
|
629 | - drupal_goto("community/teams/{$team_id}/edit/members"); |
|
627 | + )); |
|
628 | + } |
|
629 | + drupal_goto("community/teams/{$team_id}/edit/members"); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
633 | 633 | * Request a foundership transfer |
634 | 634 | */ |
635 | 635 | function boincteam_request_foundership($team_id) { |
636 | - global $user; |
|
637 | - $account = user_load($user->uid); |
|
638 | - $team = node_load($team_id); |
|
639 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
640 | - $boincteam = boincteam_load($boincteam_id); |
|
641 | - $boincuser_id = $account->boincuser_id; |
|
636 | + global $user; |
|
637 | + $account = user_load($user->uid); |
|
638 | + $team = node_load($team_id); |
|
639 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
640 | + $boincteam = boincteam_load($boincteam_id); |
|
641 | + $boincuser_id = $account->boincuser_id; |
|
642 | 642 | |
643 | - if (boincteam_is_founder($team_id, $account->uid)) { |
|
643 | + if (boincteam_is_founder($team_id, $account->uid)) { |
|
644 | 644 | // Shouldn't even be here... |
645 | 645 | drupal_set_message(t('@user is already the team founder.', |
646 | - array( |
|
646 | + array( |
|
647 | 647 | '@user' => $account->boincuser_name |
648 | - ) |
|
648 | + ) |
|
649 | 649 | ), 'warning'); |
650 | - } |
|
651 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
650 | + } |
|
651 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
652 | 652 | // It hasn't been long enough since the last transfer request |
653 | 653 | drupal_set_message(t('A foundership change was requested during the last 90 |
654 | 654 | days, so new requests are not allowed. Please try again later.' |
655 | 655 | ), 'warning'); |
656 | - } |
|
657 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
656 | + } |
|
657 | + elseif (boincteam_is_member($team_id, $account->uid)) { |
|
658 | 658 | // Log the transfer request |
659 | 659 | db_set_active('boinc_rw'); |
660 | 660 | db_query(" |
661 | 661 | UPDATE {team} |
662 | 662 | SET ping_user = '%d', ping_time='%d' |
663 | 663 | WHERE id = '%d'", |
664 | - $boincuser_id, time(), $boincteam_id |
|
664 | + $boincuser_id, time(), $boincteam_id |
|
665 | 665 | ); |
666 | 666 | db_set_active('default'); |
667 | 667 | drupal_set_message(t('You have requested foundership of @team. The current |
668 | 668 | founder has 60 days to respond to this request.', |
669 | - array( |
|
669 | + array( |
|
670 | 670 | '@team' => $team->title |
671 | - ) |
|
671 | + ) |
|
672 | 672 | )); |
673 | 673 | watchdog('boincteam', 'User @user requested foundership of team @nid', |
674 | - array( |
|
674 | + array( |
|
675 | 675 | '@current_user' => $account->uid, |
676 | 676 | '@nid' => $team_id |
677 | - ), WATCHDOG_NOTICE); |
|
678 | - } |
|
679 | - drupal_goto("community/teams/{$team_id}"); |
|
677 | + ), WATCHDOG_NOTICE); |
|
678 | + } |
|
679 | + drupal_goto("community/teams/{$team_id}"); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
683 | 683 | * Transfer foundership to another team member |
684 | 684 | */ |
685 | 685 | function boincteam_set_founder($team_id, $user_id) { |
686 | - global $user; |
|
687 | - $account = user_load($user_id); |
|
688 | - $team = node_load($team_id); |
|
689 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
690 | - $boincuser_id = $account->boincuser_id; |
|
686 | + global $user; |
|
687 | + $account = user_load($user_id); |
|
688 | + $team = node_load($team_id); |
|
689 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
690 | + $boincuser_id = $account->boincuser_id; |
|
691 | 691 | |
692 | - if (boincteam_is_member($team_id, $account->uid)) { |
|
692 | + if (boincteam_is_member($team_id, $account->uid)) { |
|
693 | 693 | // Update the team in the BOINC db |
694 | 694 | db_set_active('boinc_rw'); |
695 | 695 | db_query(" |
696 | 696 | UPDATE {team} |
697 | 697 | SET userid = '%d', ping_user=0 |
698 | 698 | WHERE id = '%d'", |
699 | - $boincuser_id, $boincteam_id |
|
699 | + $boincuser_id, $boincteam_id |
|
700 | 700 | ); |
701 | 701 | db_set_active('default'); |
702 | 702 | drupal_set_message(t('Foundership of @team has been transfered to @user.', |
703 | - array( |
|
703 | + array( |
|
704 | 704 | '@user' => $account->boincuser_name, |
705 | 705 | '@team' => $team->title |
706 | - ) |
|
706 | + ) |
|
707 | 707 | )); |
708 | 708 | watchdog('boincteam', 'User @current_user transferred foundership of team |
709 | 709 | @nid to user @uid', |
710 | - array( |
|
710 | + array( |
|
711 | 711 | '@current_user' => $user->uid, |
712 | 712 | '@uid' => $account->uid, |
713 | 713 | '@nid' => $team_id |
714 | - ), WATCHDOG_NOTICE); |
|
715 | - } |
|
716 | - drupal_goto("community/teams/{$team_id}"); |
|
714 | + ), WATCHDOG_NOTICE); |
|
715 | + } |
|
716 | + drupal_goto("community/teams/{$team_id}"); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | /** |
720 | 720 | * See if a new foundership transfer request is allowed |
721 | 721 | */ |
722 | 722 | function boincteam_new_foundership_transfer_request_ok($team_id) { |
723 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
724 | - $boincteam = boincteam_load($boincteam_id); |
|
725 | - $now = time(); |
|
726 | - if ($boincteam->ping_user <= 0) { |
|
723 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
724 | + $boincteam = boincteam_load($boincteam_id); |
|
725 | + $now = time(); |
|
726 | + if ($boincteam->ping_user <= 0) { |
|
727 | 727 | if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
728 | - return TRUE; |
|
728 | + return TRUE; |
|
729 | 729 | } |
730 | 730 | return FALSE; |
731 | - } |
|
732 | - if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
731 | + } |
|
732 | + if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
733 | 733 | return TRUE; |
734 | - } |
|
735 | - return FALSE; |
|
734 | + } |
|
735 | + return FALSE; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -754,18 +754,18 @@ discard block |
||
754 | 754 | * Check if a user has an active foundership request with a team |
755 | 755 | */ |
756 | 756 | function boincteam_user_requested_foundership($team_id, $user_id = NULL) { |
757 | - if (!$user_id) { |
|
757 | + if (!$user_id) { |
|
758 | 758 | global $user; |
759 | 759 | $user_id = $user->uid; |
760 | - } |
|
761 | - $account = user_load($user_id); |
|
762 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
763 | - $boincteam = boincteam_load($boincteam_id); |
|
760 | + } |
|
761 | + $account = user_load($user_id); |
|
762 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
763 | + $boincteam = boincteam_load($boincteam_id); |
|
764 | 764 | |
765 | - if ($boincteam->ping_user == $account->boincuser_id) { |
|
765 | + if ($boincteam->ping_user == $account->boincuser_id) { |
|
766 | 766 | // Be sure the request is still active |
767 | 767 | return !boincteam_new_foundership_transfer_request_ok($team_id); |
768 | - } |
|
768 | + } |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -777,125 +777,125 @@ discard block |
||
777 | 777 | * General info about team admins |
778 | 778 | */ |
779 | 779 | function boincteam_about_admins_panel() { |
780 | - $output = ''; |
|
781 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
782 | - $output .= '<div>'; |
|
783 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
784 | - $output .= '<ul>'; |
|
785 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
790 | - $output .= '</ul>'; |
|
791 | - $output .= '</div>'; |
|
792 | - $output .= '<div>'; |
|
793 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
794 | - $output .= '<ul>'; |
|
795 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
798 | - $output .= '</ul>'; |
|
799 | - $output .= '</div>'; |
|
800 | - $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
780 | + $output = ''; |
|
781 | + $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
782 | + $output .= '<div>'; |
|
783 | + $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
784 | + $output .= '<ul>'; |
|
785 | + $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | + $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | + $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | + $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | + $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
790 | + $output .= '</ul>'; |
|
791 | + $output .= '</div>'; |
|
792 | + $output .= '<div>'; |
|
793 | + $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
794 | + $output .= '<ul>'; |
|
795 | + $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | + $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | + $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
798 | + $output .= '</ul>'; |
|
799 | + $output .= '</div>'; |
|
800 | + $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
801 | 801 | . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
802 | 802 | . '</p>'; |
803 | - return $output; |
|
803 | + return $output; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
807 | 807 | * General info about changing the team founder |
808 | 808 | */ |
809 | 809 | function boincteam_about_founder_panel() { |
810 | - $output = ''; |
|
811 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
810 | + $output = ''; |
|
811 | + $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
812 | 812 | . '</h2>'; |
813 | - $output .= '<div>'; |
|
814 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
815 | - $output .= '<ul>'; |
|
816 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
818 | - $output .= '</ul>'; |
|
819 | - $output .= '</div>'; |
|
820 | - $output .= '<div>'; |
|
821 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
813 | + $output .= '<div>'; |
|
814 | + $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
815 | + $output .= '<ul>'; |
|
816 | + $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | + $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
818 | + $output .= '</ul>'; |
|
819 | + $output .= '</div>'; |
|
820 | + $output .= '<div>'; |
|
821 | + $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
822 | 822 | . '</p>'; |
823 | - $output .= '<ul>'; |
|
824 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
823 | + $output .= '<ul>'; |
|
824 | + $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | + $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
826 | 826 | . '</li>'; |
827 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
827 | + $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
828 | 828 | . '</li>'; |
829 | - $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
829 | + $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
830 | 830 | . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
831 | - $output .= '</ul>'; |
|
832 | - $output .= '</div>'; |
|
833 | - return $output; |
|
831 | + $output .= '</ul>'; |
|
832 | + $output .= '</div>'; |
|
833 | + return $output; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | /** |
837 | 837 | * Link to create a new team |
838 | 838 | */ |
839 | 839 | function boincteam_create_team_link_panel() { |
840 | - global $user; |
|
841 | - $account = user_load($user->uid); |
|
842 | - $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
843 | - $output = ''; |
|
844 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
845 | - $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
840 | + global $user; |
|
841 | + $account = user_load($user->uid); |
|
842 | + $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
843 | + $output = ''; |
|
844 | + $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
845 | + $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
846 | 846 | . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
847 | - $output .= '<ul class="tab-list">'; |
|
848 | - $output .= ' <li class="first last tab">'; |
|
849 | - if (isset($account->roles[$unrestricted_role])) { |
|
847 | + $output .= '<ul class="tab-list">'; |
|
848 | + $output .= ' <li class="first last tab">'; |
|
849 | + if (isset($account->roles[$unrestricted_role])) { |
|
850 | 850 | $output .= l(bts('Create new team', array(), NULL, 'boinc:create-team-panel'), 'community/teams/add'); |
851 | - } elseif ($account->uid <= 0) { |
|
851 | + } elseif ($account->uid <= 0) { |
|
852 | 852 | $output .= l( |
853 | - bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
854 | - 'user/login', |
|
855 | - array('query' => drupal_get_destination()) |
|
853 | + bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
854 | + 'user/login', |
|
855 | + array('query' => drupal_get_destination()) |
|
856 | 856 | ); |
857 | - } else { |
|
857 | + } else { |
|
858 | 858 | $min_credit_needed = variable_get('boinc_comment_min_credit', 0); |
859 | 859 | $credit_needed = $min_credit_needed - $account->boincuser_total_credit; |
860 | 860 | $output .= '['; |
861 | 861 | if ($credit_needed == 1) { |
862 | - $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
862 | + $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
863 | 863 | } |
864 | 864 | else { |
865 | - $output .= bts('You must earn @count more credits!', |
|
865 | + $output .= bts('You must earn @count more credits!', |
|
866 | 866 | array('@count' => $credit_needed), |
867 | - NULL, 'boinc:create-team-panel' |
|
868 | - ); |
|
867 | + NULL, 'boinc:create-team-panel' |
|
868 | + ); |
|
869 | 869 | } |
870 | 870 | $output .= ']'; |
871 | - } |
|
872 | - $output .= ' </li>'; |
|
873 | - $output .= '</ul>'; |
|
874 | - return $output; |
|
871 | + } |
|
872 | + $output .= ' </li>'; |
|
873 | + $output .= '</ul>'; |
|
874 | + return $output; |
|
875 | 875 | } |
876 | 876 | |
877 | 877 | /** |
878 | 878 | * Create team form |
879 | 879 | */ |
880 | 880 | function boincteam_create_team_panel() { |
881 | - $output = ''; |
|
882 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
883 | - $output .= drupal_get_form('boincteam_create_form'); |
|
881 | + $output = ''; |
|
882 | + $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
883 | + $output .= drupal_get_form('boincteam_create_form'); |
|
884 | 884 | |
885 | - return $output; |
|
885 | + return $output; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | /** |
889 | 889 | * Link to user's team |
890 | 890 | */ |
891 | 891 | function boincteam_dashboard_panel($uid = NULL) { |
892 | - global $user; |
|
893 | - if (!$uid) { |
|
892 | + global $user; |
|
893 | + if (!$uid) { |
|
894 | 894 | $uid = $user->uid; |
895 | - } |
|
896 | - $output = ''; |
|
897 | - $account = user_load($uid); |
|
898 | - if ($account->team) { |
|
895 | + } |
|
896 | + $output = ''; |
|
897 | + $account = user_load($uid); |
|
898 | + if ($account->team) { |
|
899 | 899 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
900 | 900 | $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
901 | 901 | $output .= '<div class="stats">'; |
@@ -914,254 +914,254 @@ discard block |
||
914 | 914 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
915 | 915 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
916 | 916 | $output .= '</div>' . "\n"; |
917 | - } |
|
918 | - else if ($user->uid == $account->uid) { |
|
917 | + } |
|
918 | + else if ($user->uid == $account->uid) { |
|
919 | 919 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
920 | 920 | $output .= '<ul class="tab-list action-list">'; |
921 | 921 | $output .= '<li class="tab primary">'; |
922 | 922 | $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
923 | 923 | $output .= '</li>'; |
924 | 924 | $output .= '</ul>'; |
925 | - } |
|
926 | - return $output; |
|
925 | + } |
|
926 | + return $output; |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | /** |
930 | 930 | * Edit team form |
931 | 931 | */ |
932 | 932 | function boincteam_edit_team_panel($team_id) { |
933 | - $team = node_load($team_id); |
|
934 | - $output = ''; |
|
935 | - $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
936 | - $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
933 | + $team = node_load($team_id); |
|
934 | + $output = ''; |
|
935 | + $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
936 | + $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
937 | 937 | |
938 | - return $output; |
|
938 | + return $output; |
|
939 | 939 | } |
940 | 940 | |
941 | 941 | /** |
942 | 942 | * Link to join a team |
943 | 943 | */ |
944 | 944 | function boincteam_join_team_panel($team_id) { |
945 | - $team = node_load($team_id); |
|
946 | - $output = ''; |
|
947 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
948 | - $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
945 | + $team = node_load($team_id); |
|
946 | + $output = ''; |
|
947 | + $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
948 | + $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
949 | 949 | array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
950 | - $output .= '<ul class="tab-list">'; |
|
951 | - $output .= ' <li class="first last tab">' . |
|
950 | + $output .= '<ul class="tab-list">'; |
|
951 | + $output .= ' <li class="first last tab">' . |
|
952 | 952 | l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
953 | - $output .= '</ul>'; |
|
954 | - return $output; |
|
953 | + $output .= '</ul>'; |
|
954 | + return $output; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | /** |
958 | 958 | * Link to leave a team |
959 | 959 | */ |
960 | 960 | function boincteam_leave_team_panel($team_id) { |
961 | - $team = node_load($team_id); |
|
962 | - $output = ''; |
|
963 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | - $output .= '<p>' . bts('Click here to revoke your membership with' |
|
961 | + $team = node_load($team_id); |
|
962 | + $output = ''; |
|
963 | + $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | + $output .= '<p>' . bts('Click here to revoke your membership with' |
|
965 | 965 | . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
966 | - $output .= '<ul class="tab-list">'; |
|
967 | - $output .= ' <li class="first last tab">' . |
|
966 | + $output .= '<ul class="tab-list">'; |
|
967 | + $output .= ' <li class="first last tab">' . |
|
968 | 968 | l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
969 | - $output .= '</ul>'; |
|
970 | - return $output; |
|
969 | + $output .= '</ul>'; |
|
970 | + return $output; |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | /** |
974 | 974 | * General info about team admins |
975 | 975 | */ |
976 | 976 | function boincteam_manage_admins_panel_header($team_id) { |
977 | - $output = ''; |
|
978 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
979 | - $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
980 | - $output .= '<div class="clearfix"></div>'; |
|
981 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
977 | + $output = ''; |
|
978 | + $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
979 | + $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
980 | + $output .= '<div class="clearfix"></div>'; |
|
981 | + $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
982 | 982 | |
983 | - return $output; |
|
983 | + return $output; |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | /** |
987 | 987 | * Team management tools |
988 | 988 | */ |
989 | 989 | function boincteam_management_panel($team_id) { |
990 | - $is_founder = boincteam_is_founder($team_id); |
|
991 | - $team = node_load($team_id); |
|
990 | + $is_founder = boincteam_is_founder($team_id); |
|
991 | + $team = node_load($team_id); |
|
992 | 992 | |
993 | - $output = ''; |
|
994 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
993 | + $output = ''; |
|
994 | + $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
995 | 995 | |
996 | - // PM all members |
|
997 | - if (module_exists('privatemsg')) { |
|
996 | + // PM all members |
|
997 | + if (module_exists('privatemsg')) { |
|
998 | 998 | $output .= '<div class="form-item">'; |
999 | 999 | $output .= ' <ul class="tab-list action-list">'; |
1000 | 1000 | $output .= ' <li class="first tab primary">' . |
1001 | - l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1001 | + l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1002 | 1002 | $output .= ' </ul>'; |
1003 | 1003 | $output .= ' <div class="description">'; |
1004 | 1004 | $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
1005 | 1005 | $output .= ' </div>'; |
1006 | 1006 | $output .= '</div>'; |
1007 | - } |
|
1007 | + } |
|
1008 | 1008 | |
1009 | - // Team forum |
|
1010 | - if (module_exists('boincteam_forum')) { |
|
1009 | + // Team forum |
|
1010 | + if (module_exists('boincteam_forum')) { |
|
1011 | 1011 | if ($is_founder) { |
1012 | - // Determine whether to create a forum or edit the existing forum |
|
1013 | - // (multiple forums per team could be supported in the future) |
|
1014 | - $team_forum_link_path = 'add'; |
|
1015 | - $team_forums = boincteam_forum_list(); |
|
1016 | - if ($team_forums) { |
|
1012 | + // Determine whether to create a forum or edit the existing forum |
|
1013 | + // (multiple forums per team could be supported in the future) |
|
1014 | + $team_forum_link_path = 'add'; |
|
1015 | + $team_forums = boincteam_forum_list(); |
|
1016 | + if ($team_forums) { |
|
1017 | 1017 | $team_forum = reset($team_forums); |
1018 | 1018 | $team_forum_link_path = "{$team_forum->tfid}/edit"; |
1019 | - } |
|
1020 | - $output .= '<div class="form-item">'; |
|
1021 | - $output .= ' <ul class="tab-list action-list">'; |
|
1022 | - $output .= ' <li class="first tab primary">' . |
|
1019 | + } |
|
1020 | + $output .= '<div class="form-item">'; |
|
1021 | + $output .= ' <ul class="tab-list action-list">'; |
|
1022 | + $output .= ' <li class="first tab primary">' . |
|
1023 | 1023 | l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
1024 | - "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
1024 | + "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
1025 | 1025 | ); |
1026 | - $output .= ' </li>'; |
|
1027 | - $output .= ' <div class="description">'; |
|
1028 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1029 | - $output .= ' </div>'; |
|
1030 | - $output .= '</div>'; |
|
1026 | + $output .= ' </li>'; |
|
1027 | + $output .= ' <div class="description">'; |
|
1028 | + $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1029 | + $output .= ' </div>'; |
|
1030 | + $output .= '</div>'; |
|
1031 | + } |
|
1031 | 1032 | } |
1032 | - } |
|
1033 | 1033 | |
1034 | - // Team history |
|
1035 | - $output .= '<div class="form-item">'; |
|
1036 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1037 | - $output .= ' <ul class="tab-list">'; |
|
1038 | - $output .= ' <li class="first tab primary">' . |
|
1034 | + // Team history |
|
1035 | + $output .= '<div class="form-item">'; |
|
1036 | + $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1037 | + $output .= ' <ul class="tab-list">'; |
|
1038 | + $output .= ' <li class="first tab primary">' . |
|
1039 | 1039 | l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
1040 | - $output .= ' <li class="last tab primary">' . |
|
1040 | + $output .= ' <li class="last tab primary">' . |
|
1041 | 1041 | l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
1042 | - $output .= ' </ul>'; |
|
1043 | - $output .= ' <div class="description">'; |
|
1044 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1045 | - $output .= ' </div>'; |
|
1046 | - $output .= '</div>'; |
|
1042 | + $output .= ' </ul>'; |
|
1043 | + $output .= ' <div class="description">'; |
|
1044 | + $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1045 | + $output .= ' </div>'; |
|
1046 | + $output .= '</div>'; |
|
1047 | 1047 | |
1048 | - $output .= '<div class="form-item">'; |
|
1049 | - $output .= ' <ul class="tab-list action-list">'; |
|
1048 | + $output .= '<div class="form-item">'; |
|
1049 | + $output .= ' <ul class="tab-list action-list">'; |
|
1050 | 1050 | |
1051 | - // Edit team information |
|
1052 | - $output .= ' <li class="first tab primary">' . |
|
1051 | + // Edit team information |
|
1052 | + $output .= ' <li class="first tab primary">' . |
|
1053 | 1053 | l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
1054 | 1054 | |
1055 | - // Member list |
|
1056 | - $output .= ' <li class="tab primary">' . |
|
1055 | + // Member list |
|
1056 | + $output .= ' <li class="tab primary">' . |
|
1057 | 1057 | l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
1058 | 1058 | |
1059 | - // Remove members |
|
1060 | - $output .= ' <li class="tab primary">' . |
|
1059 | + // Remove members |
|
1060 | + $output .= ' <li class="tab primary">' . |
|
1061 | 1061 | l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
1062 | 1062 | |
1063 | - if ($is_founder) { |
|
1063 | + if ($is_founder) { |
|
1064 | 1064 | |
1065 | 1065 | // Change founder |
1066 | 1066 | $output .= ' <li class="tab primary">' . |
1067 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1067 | + l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1068 | 1068 | |
1069 | - // Manage admins |
|
1069 | + // Manage admins |
|
1070 | 1070 | $output .= ' <li class="tab primary">' . |
1071 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1071 | + l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1072 | 1072 | |
1073 | 1073 | // Delete the team |
1074 | 1074 | $output .= ' <li class="last tab primary">' . |
1075 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1076 | - } |
|
1075 | + l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1076 | + } |
|
1077 | 1077 | |
1078 | - $output .= ' </ul>'; |
|
1079 | - $output .= '</div>'; |
|
1078 | + $output .= ' </ul>'; |
|
1079 | + $output .= '</div>'; |
|
1080 | 1080 | |
1081 | - return $output; |
|
1081 | + return $output; |
|
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * Link to user's team |
1086 | 1086 | */ |
1087 | 1087 | function boincteam_member_link_panel() { |
1088 | - global $user; |
|
1089 | - $account = user_load($user->uid); |
|
1090 | - $team = node_load($account->team); |
|
1091 | - $output = ''; |
|
1092 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | - $output .= '<p>' . bts('You are a member of @team.', |
|
1088 | + global $user; |
|
1089 | + $account = user_load($user->uid); |
|
1090 | + $team = node_load($account->team); |
|
1091 | + $output = ''; |
|
1092 | + $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | + $output .= '<p>' . bts('You are a member of @team.', |
|
1094 | 1094 | array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
1095 | - $output .= '<ul class="tab-list">'; |
|
1096 | - $output .= ' <li class="first last tab">' . |
|
1095 | + $output .= '<ul class="tab-list">'; |
|
1096 | + $output .= ' <li class="first last tab">' . |
|
1097 | 1097 | l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
1098 | - $output .= '</ul>'; |
|
1099 | - return $output; |
|
1098 | + $output .= '</ul>'; |
|
1099 | + return $output; |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
1103 | 1103 | * Link to request foundership transfer of a team |
1104 | 1104 | */ |
1105 | 1105 | function boincteam_request_foundership_panel($team_id) { |
1106 | - global $user; |
|
1107 | - $account = user_load($user->uid); |
|
1108 | - $team = node_load($team_id); |
|
1109 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
1110 | - $boincteam = boincteam_load($boincteam_id); |
|
1111 | - $boincuser_id = $account->boincuser_id; |
|
1112 | - $output = ''; |
|
1113 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1106 | + global $user; |
|
1107 | + $account = user_load($user->uid); |
|
1108 | + $team = node_load($team_id); |
|
1109 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
1110 | + $boincteam = boincteam_load($boincteam_id); |
|
1111 | + $boincuser_id = $account->boincuser_id; |
|
1112 | + $output = ''; |
|
1113 | + $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1114 | 1114 | |
1115 | - if (boincteam_user_requested_foundership($team_id)) { |
|
1115 | + if (boincteam_user_requested_foundership($team_id)) { |
|
1116 | 1116 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1117 | 1117 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)); |
1118 | 1118 | $request_age = 60 - $days_to_deadline; |
1119 | 1119 | $days_to_respond = 30 + $days_to_deadline; |
1120 | 1120 | if (time() > $deadline) { |
1121 | - $output .= '<p>'; |
|
1122 | - if ($request_age == 1) { |
|
1121 | + $output .= '<p>'; |
|
1122 | + if ($request_age == 1) { |
|
1123 | 1123 | $output .= bts('1 day has elapsed since your request and' |
1124 | - . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1125 | - } |
|
1126 | - else { |
|
1124 | + . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1125 | + } |
|
1126 | + else { |
|
1127 | 1127 | $output .= bts('@count days have elapsed since your request and' |
1128 | - . ' the founder has not responded.', |
|
1129 | - array('@count' => $request_age), |
|
1130 | - NULL, 'boinc:team-request-foundership'); |
|
1131 | - } |
|
1132 | - $output .= ' '; |
|
1133 | - if ($days_to_respond == 1) { |
|
1128 | + . ' the founder has not responded.', |
|
1129 | + array('@count' => $request_age), |
|
1130 | + NULL, 'boinc:team-request-foundership'); |
|
1131 | + } |
|
1132 | + $output .= ' '; |
|
1133 | + if ($days_to_respond == 1) { |
|
1134 | 1134 | $output .= bts('You now have 1 day to assume foundership before' |
1135 | - . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1136 | - } |
|
1137 | - else { |
|
1135 | + . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1136 | + } |
|
1137 | + else { |
|
1138 | 1138 | $output .= bts('You now have @count days to assume foundership before' |
1139 | - . ' another team member may submit a request.', |
|
1140 | - array('@count' => $days_to_respond), |
|
1141 | - NULL, 'boinc:team-request-foundership'); |
|
1142 | - } |
|
1143 | - $output .= '</p>'; |
|
1144 | - $output .= '<ul class="tab-list">'; |
|
1145 | - $output .= ' <li class="first last tab">' . |
|
1139 | + . ' another team member may submit a request.', |
|
1140 | + array('@count' => $days_to_respond), |
|
1141 | + NULL, 'boinc:team-request-foundership'); |
|
1142 | + } |
|
1143 | + $output .= '</p>'; |
|
1144 | + $output .= '<ul class="tab-list">'; |
|
1145 | + $output .= ' <li class="first last tab">' . |
|
1146 | 1146 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1147 | - $output .= '</ul>'; |
|
1147 | + $output .= '</ul>'; |
|
1148 | 1148 | } |
1149 | 1149 | else { |
1150 | - $output .= '<p>'; |
|
1151 | - if ($days_to_deadline == 1) { |
|
1150 | + $output .= '<p>'; |
|
1151 | + if ($days_to_deadline == 1) { |
|
1152 | 1152 | $output .= bts('The team founder has 1 day to respond to your' |
1153 | - . ' transfer request.', |
|
1154 | - NULL, 'boinc:team-request-foundership'); |
|
1155 | - } |
|
1156 | - else { |
|
1153 | + . ' transfer request.', |
|
1154 | + NULL, 'boinc:team-request-foundership'); |
|
1155 | + } |
|
1156 | + else { |
|
1157 | 1157 | $output .= bts('The team founder has @count days to respond to your' |
1158 | - . ' transfer request.', array('@count' => $days_to_deadline), |
|
1159 | - NULL, 'boinc:team-request-foundership'); |
|
1160 | - } |
|
1161 | - $output .= '</p>'; |
|
1158 | + . ' transfer request.', array('@count' => $days_to_deadline), |
|
1159 | + NULL, 'boinc:team-request-foundership'); |
|
1160 | + } |
|
1161 | + $output .= '</p>'; |
|
1162 | 1162 | } |
1163 | - } |
|
1164 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1163 | + } |
|
1164 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1165 | 1165 | // If this user does not have a transfer request pending, but new requests |
1166 | 1166 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1167 | 1167 | // who made the request has 30 additional days to assume foundership if |
@@ -1170,131 +1170,131 @@ discard block |
||
1170 | 1170 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)) + 30; |
1171 | 1171 | $output .= '<p>'; |
1172 | 1172 | $output .= bts('A team foundership change was already requested recently.' |
1173 | - . ' Only one request is allowed within a period of 90 days.', |
|
1174 | - NULL, 'boinc:team-request-foundership'); |
|
1173 | + . ' Only one request is allowed within a period of 90 days.', |
|
1174 | + NULL, 'boinc:team-request-foundership'); |
|
1175 | 1175 | if ($days_to_deadline == 1) { |
1176 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1176 | + $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1177 | 1177 | } |
1178 | 1178 | else { |
1179 | - $output .= ' (' . bts('@count days remaining', |
|
1179 | + $output .= ' (' . bts('@count days remaining', |
|
1180 | 1180 | array('@count' => $days_to_deadline), |
1181 | 1181 | NULL, 'boinc:team-request-foundership') . ')'; |
1182 | 1182 | } |
1183 | 1183 | $output .= '</p>'; |
1184 | - } |
|
1185 | - else { |
|
1184 | + } |
|
1185 | + else { |
|
1186 | 1186 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1187 | - . ' assume the role of founder, click below to request foundership of' |
|
1188 | - . ' @this_team.', |
|
1189 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1187 | + . ' assume the role of founder, click below to request foundership of' |
|
1188 | + . ' @this_team.', |
|
1189 | + array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1190 | 1190 | $output .= '<ul class="tab-list">'; |
1191 | 1191 | $output .= ' <li class="first last tab">' . |
1192 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1192 | + l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1193 | 1193 | $output .= '</ul>'; |
1194 | - } |
|
1195 | - return $output; |
|
1194 | + } |
|
1195 | + return $output; |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | /** |
1199 | 1199 | * Respond to foundership transfer requests for a team |
1200 | 1200 | */ |
1201 | 1201 | function boincteam_request_foundership_response_panel($team_id) { |
1202 | - global $user; |
|
1203 | - $account = user_load($user->uid); |
|
1204 | - $team = node_load($team_id); |
|
1205 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
1206 | - $boincteam = boincteam_load($boincteam_id); |
|
1207 | - $boincuser_id = $account->boincuser_id; |
|
1208 | - $output = ''; |
|
1202 | + global $user; |
|
1203 | + $account = user_load($user->uid); |
|
1204 | + $team = node_load($team_id); |
|
1205 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
1206 | + $boincteam = boincteam_load($boincteam_id); |
|
1207 | + $boincuser_id = $account->boincuser_id; |
|
1208 | + $output = ''; |
|
1209 | 1209 | |
1210 | - if ($boincteam->ping_user) { |
|
1210 | + if ($boincteam->ping_user) { |
|
1211 | 1211 | if ($boincteam->ping_user < 0) { |
1212 | - $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
1213 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1212 | + $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
1213 | + $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1214 | 1214 | . '</h2>'; |
1215 | - $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1215 | + $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1216 | 1216 | . ' @date, but then left the team. This request is now canceled.', |
1217 | 1217 | array( |
1218 | - '@name' => $member->boincuser_name, |
|
1219 | - '@date' => date('j M Y', $boincteam->ping_time), |
|
1218 | + '@name' => $member->boincuser_name, |
|
1219 | + '@date' => date('j M Y', $boincteam->ping_time), |
|
1220 | 1220 | ), |
1221 | 1221 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
1222 | - // Automatically cancel the request |
|
1223 | - db_set_active('boinc_rw'); |
|
1224 | - db_query(" |
|
1222 | + // Automatically cancel the request |
|
1223 | + db_set_active('boinc_rw'); |
|
1224 | + db_query(" |
|
1225 | 1225 | UPDATE {team} |
1226 | 1226 | SET ping_user=0 |
1227 | 1227 | WHERE id = '%d'", |
1228 | 1228 | $boincteam_id |
1229 | - ); |
|
1230 | - db_set_active('default'); |
|
1229 | + ); |
|
1230 | + db_set_active('default'); |
|
1231 | 1231 | } |
1232 | 1232 | else { |
1233 | - $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
1234 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1233 | + $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
1234 | + $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1235 | 1235 | . '</h2>'; |
1236 | - $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1236 | + $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1237 | 1237 | . ' This may be because you left the team or have not had contact with' |
1238 | 1238 | . ' the team for a long time.', array( |
1239 | - '@name' => $member->boincuser_name, |
|
1239 | + '@name' => $member->boincuser_name, |
|
1240 | 1240 | ) |
1241 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | - $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1241 | + , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | + $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1243 | 1243 | . ' will have the option of assuming team foundership. (note: To' |
1244 | 1244 | . ' accept the request, assign foundership to @name using the form' |
1245 | 1245 | . ' below)', |
1246 | 1246 | array( |
1247 | - '@name' => $member->boincuser_name, |
|
1248 | - '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
1247 | + '@name' => $member->boincuser_name, |
|
1248 | + '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
1249 | 1249 | ), |
1250 | 1250 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
1251 | - $output .= '<ul class="tab-list">'; |
|
1252 | - $output .= ' <li class="first last tab">' . |
|
1251 | + $output .= '<ul class="tab-list">'; |
|
1252 | + $output .= ' <li class="first last tab">' . |
|
1253 | 1253 | l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
1254 | - $output .= '</ul>'; |
|
1254 | + $output .= '</ul>'; |
|
1255 | 1255 | } |
1256 | - } |
|
1257 | - return $output; |
|
1256 | + } |
|
1257 | + return $output; |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | function boincteam_search_panel() { |
1261 | - $output = ''; |
|
1262 | - if (module_exists('global_search_teams_solr')) { |
|
1261 | + $output = ''; |
|
1262 | + if (module_exists('global_search_teams_solr')) { |
|
1263 | 1263 | $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
1264 | 1264 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1265 | 1265 | $output .= '<p>' . boincteam_search_view() . '</p>'; |
1266 | - } |
|
1267 | - return $output; |
|
1266 | + } |
|
1267 | + return $output; |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | function boincteam_search_view($type = 'team') { |
1271 | - // Get the team search form |
|
1272 | - $search_page = apachesolr_search_page_load('team_search'); |
|
1273 | - module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
1274 | - return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
1271 | + // Get the team search form |
|
1272 | + $search_page = apachesolr_search_page_load('team_search'); |
|
1273 | + module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
1274 | + return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | /** |
1278 | 1278 | * General info about the concept of teams |
1279 | 1279 | */ |
1280 | 1280 | function boincteam_topic_overview_panel() { |
1281 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1282 | - $output = ''; |
|
1283 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1284 | - $output .= '<div class="">'; |
|
1285 | - $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1281 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1282 | + $output = ''; |
|
1283 | + $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1284 | + $output .= '<div class="">'; |
|
1285 | + $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1286 | 1286 | . ' to only one team. You can join or quit a team at any time. To join a' |
1287 | 1287 | . ' team, visit its team page and click "Join this team". Each team has a' |
1288 | 1288 | . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
1289 | - $output .= '<ul>'; |
|
1290 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1295 | - $output .= '</ul>'; |
|
1296 | - $output .= '</div>'; |
|
1297 | - return $output; |
|
1289 | + $output .= '<ul>'; |
|
1290 | + $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | + $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | + $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | + $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | + $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1295 | + $output .= '</ul>'; |
|
1296 | + $output .= '</div>'; |
|
1297 | + return $output; |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1322,50 +1322,50 @@ discard block |
||
1322 | 1322 | * Link to view a team |
1323 | 1323 | */ |
1324 | 1324 | function boincteam_view_team_panel($team_id) { |
1325 | - $team = node_load($team_id); |
|
1326 | - if ($team->type != "team") { |
|
1325 | + $team = node_load($team_id); |
|
1326 | + if ($team->type != "team") { |
|
1327 | 1327 | return; |
1328 | - } |
|
1329 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1330 | - $founder = user_load(get_drupal_id($boincteam->userid)); |
|
1331 | - $new_members = array(); |
|
1332 | - if ($boincteam->new_members) { |
|
1328 | + } |
|
1329 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1330 | + $founder = user_load(get_drupal_id($boincteam->userid)); |
|
1331 | + $new_members = array(); |
|
1332 | + if ($boincteam->new_members) { |
|
1333 | 1333 | foreach ($boincteam->new_members as $member) { |
1334 | - $account = user_load(get_drupal_id($member->id)); |
|
1335 | - $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
1334 | + $account = user_load(get_drupal_id($member->id)); |
|
1335 | + $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
1336 | 1336 | } |
1337 | - } |
|
1338 | - $output = ''; |
|
1339 | - $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1340 | - $output .= '<div>'; |
|
1341 | - $output .= '<div class="left-column">'; |
|
1342 | - $output .= '<ul class="stats">'; |
|
1343 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1347 | - $output .= '</ul>'; |
|
1348 | - $output .= '</div>'; |
|
1349 | - $output .= '<div class="right-column">'; |
|
1350 | - $output .= '<ul class="stats">'; |
|
1351 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1356 | - $output .= '</ul>'; |
|
1357 | - $output .= '</div>'; |
|
1358 | - $output .= '</div>'; |
|
1359 | - $output .= '<div class="clearfix"></div>'; |
|
1360 | - if ($boincteam->url) { |
|
1337 | + } |
|
1338 | + $output = ''; |
|
1339 | + $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1340 | + $output .= '<div>'; |
|
1341 | + $output .= '<div class="left-column">'; |
|
1342 | + $output .= '<ul class="stats">'; |
|
1343 | + $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | + $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | + $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | + $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1347 | + $output .= '</ul>'; |
|
1348 | + $output .= '</div>'; |
|
1349 | + $output .= '<div class="right-column">'; |
|
1350 | + $output .= '<ul class="stats">'; |
|
1351 | + $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | + $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | + $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | + $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | + $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1356 | + $output .= '</ul>'; |
|
1357 | + $output .= '</div>'; |
|
1358 | + $output .= '</div>'; |
|
1359 | + $output .= '<div class="clearfix"></div>'; |
|
1360 | + if ($boincteam->url) { |
|
1361 | 1361 | $output .= '<div class="stats">'; |
1362 | 1362 | $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
1363 | 1363 | $output .= '</div>'; |
1364 | - } |
|
1365 | - if ($team->body) { |
|
1364 | + } |
|
1365 | + if ($team->body) { |
|
1366 | 1366 | $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
1367 | 1367 | $output .= check_markup($team->body, $team->format); |
1368 | 1368 | $output .= '</div>'; |
1369 | - } |
|
1370 | - return $output; |
|
1369 | + } |
|
1370 | + return $output; |
|
1371 | 1371 | } |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $items['community/teams/%/edit/admins/remove/%'] = array( |
64 | 64 | 'page callback' => 'boincteam_remove_admin', |
65 | - 'page arguments' => array(2,6), |
|
65 | + 'page arguments' => array(2, 6), |
|
66 | 66 | 'access callback' => 'boincteam_is_founder', |
67 | 67 | 'access arguments' => array(2), |
68 | 68 | 'type' => MENU_CALLBACK |
69 | 69 | ); |
70 | 70 | $items['community/teams/%/edit/founder/set/%'] = array( |
71 | 71 | 'page callback' => 'boincteam_set_founder', |
72 | - 'page arguments' => array(2,6), |
|
72 | + 'page arguments' => array(2, 6), |
|
73 | 73 | 'access callback' => 'boincteam_is_founder', |
74 | 74 | 'access arguments' => array(2), |
75 | 75 | 'type' => MENU_CALLBACK |
76 | 76 | ); |
77 | 77 | $items['community/teams/%/edit/members/remove/%'] = array( |
78 | 78 | 'page callback' => 'boincteam_remove_member', |
79 | - 'page arguments' => array(2,6), |
|
79 | + 'page arguments' => array(2, 6), |
|
80 | 80 | 'access callback' => 'boincteam_is_founder', |
81 | 81 | 'access arguments' => array(2), |
82 | 82 | 'type' => MENU_CALLBACK |
@@ -724,12 +724,12 @@ discard block |
||
724 | 724 | $boincteam = boincteam_load($boincteam_id); |
725 | 725 | $now = time(); |
726 | 726 | if ($boincteam->ping_user <= 0) { |
727 | - if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
|
727 | + if ($boincteam->ping_time < $now - 60*(24*60*60)) { |
|
728 | 728 | return TRUE; |
729 | 729 | } |
730 | 730 | return FALSE; |
731 | 731 | } |
732 | - if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
732 | + if ($boincteam->ping_time < $now - 90*(24*60*60)) { |
|
733 | 733 | return TRUE; |
734 | 734 | } |
735 | 735 | return FALSE; |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | * responded to the request |
741 | 741 | */ |
742 | 742 | function boincteam_foundership_transfer_ok_time($boincteam) { |
743 | - return $boincteam->ping_time + 60 * (24*60*60); |
|
743 | + return $boincteam->ping_time + 60*(24*60*60); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | /** |
@@ -778,26 +778,26 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function boincteam_about_admins_panel() { |
780 | 780 | $output = ''; |
781 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
781 | + $output .= '<h2 class="pane-title">'.bts('About team admins', array(), NULL, 'boinc:team-admins-panel').'</h2>'; |
|
782 | 782 | $output .= '<div>'; |
783 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
783 | + $output .= '<p>'.bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel').'</p>'; |
|
784 | 784 | $output .= '<ul>'; |
785 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
785 | + $output .= ' <li>'.bts('Edit team information', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
786 | + $output .= ' <li>'.bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
787 | + $output .= ' <li>'.bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
788 | + $output .= ' <li>'.bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
789 | + $output .= ' <li>'.bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
790 | 790 | $output .= '</ul>'; |
791 | 791 | $output .= '</div>'; |
792 | 792 | $output .= '<div>'; |
793 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
793 | + $output .= '<p>'.bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel').'</p>'; |
|
794 | 794 | $output .= '<ul>'; |
795 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
795 | + $output .= ' <li>'.bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
796 | + $output .= ' <li>'.bts('Remove members', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
797 | + $output .= ' <li>'.bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
798 | 798 | $output .= '</ul>'; |
799 | 799 | $output .= '</div>'; |
800 | - $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
800 | + $output .= '<p>'.bts('If a team admin quits the team, they cease to be a' |
|
801 | 801 | . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
802 | 802 | . '</p>'; |
803 | 803 | return $output; |
@@ -808,26 +808,26 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function boincteam_about_founder_panel() { |
810 | 810 | $output = ''; |
811 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
811 | + $output .= '<h2 class="pane-title">'.bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
812 | 812 | . '</h2>'; |
813 | 813 | $output .= '<div>'; |
814 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
814 | + $output .= '<p>'.bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel').'</p>'; |
|
815 | 815 | $output .= '<ul>'; |
816 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
816 | + $output .= ' <li>'.bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
817 | + $output .= ' <li>'.bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
818 | 818 | $output .= '</ul>'; |
819 | 819 | $output .= '</div>'; |
820 | 820 | $output .= '<div>'; |
821 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
821 | + $output .= '<p>'.bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
822 | 822 | . '</p>'; |
823 | 823 | $output .= '<ul>'; |
824 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
824 | + $output .= ' <li>'.bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
825 | + $output .= ' <li>'.bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
826 | 826 | . '</li>'; |
827 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
827 | + $output .= ' <li>'.bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
828 | 828 | . '</li>'; |
829 | - $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
830 | - . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
829 | + $output .= ' <li>'.bts('Current founder has 60 days to respond to a' |
|
830 | + . ' request', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
831 | 831 | $output .= '</ul>'; |
832 | 832 | $output .= '</div>'; |
833 | 833 | return $output; |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | $account = user_load($user->uid); |
842 | 842 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
843 | 843 | $output = ''; |
844 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
845 | - $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
846 | - . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
|
844 | + $output .= '<h2 class="pane-title">'.bts('Create a new team', array(), NULL, 'boinc:create-team-panel').'</h2>'; |
|
845 | + $output .= '<p>'.bts('If you cannot find a team that is right for you, you' |
|
846 | + . ' can create a team.', array(), NULL, 'boinc:create-team-panel').'</p>'; |
|
847 | 847 | $output .= '<ul class="tab-list">'; |
848 | 848 | $output .= ' <li class="first last tab">'; |
849 | 849 | if (isset($account->roles[$unrestricted_role])) { |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | */ |
880 | 880 | function boincteam_create_team_panel() { |
881 | 881 | $output = ''; |
882 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
882 | + $output .= '<h2 class="pane-title">'.bts('Create a team', array(), NULL, 'boinc:create-team-panel').'</h2>'; |
|
883 | 883 | $output .= drupal_get_form('boincteam_create_form'); |
884 | 884 | |
885 | 885 | return $output; |
@@ -897,26 +897,26 @@ discard block |
||
897 | 897 | $account = user_load($uid); |
898 | 898 | if ($account->team) { |
899 | 899 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
900 | - $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
900 | + $output .= '<h2 class="pane-title">'.bts('Team', array(), NULL, 'boinc:team-dashboard').'</h2>'; |
|
901 | 901 | $output .= '<div class="stats">'; |
902 | - $output .= ' <label>' . bts('Name', array(), NULL, 'boinc:user-or-team-name') . ': </label>'; |
|
903 | - $output .= ' <span>' . l($team->name, "community/teams/{$account->team}") . '</span>'; |
|
904 | - $output .= '</div>' . "\n"; |
|
902 | + $output .= ' <label>'.bts('Name', array(), NULL, 'boinc:user-or-team-name').': </label>'; |
|
903 | + $output .= ' <span>'.l($team->name, "community/teams/{$account->team}").'</span>'; |
|
904 | + $output .= '</div>'."\n"; |
|
905 | 905 | $output .= '<div class="stats">'; |
906 | - $output .= ' <label>' . bts('Member since', array(), NULL, 'boinc:user-info') . ': </label>'; |
|
907 | - $output .= ' <span>' . date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)) . '</span>'; |
|
908 | - $output .= '</div>' . "\n"; |
|
906 | + $output .= ' <label>'.bts('Member since', array(), NULL, 'boinc:user-info').': </label>'; |
|
907 | + $output .= ' <span>'.date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)).'</span>'; |
|
908 | + $output .= '</div>'."\n"; |
|
909 | 909 | $output .= '<div class="stats">'; |
910 | - $output .= ' <label>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': </label>'; |
|
911 | - $output .= ' <span>' . $team->country . '</span>'; |
|
912 | - $output .= '</div>' . "\n"; |
|
910 | + $output .= ' <label>'.bts('Country', array(), NULL, 'boinc:country-of-origin').': </label>'; |
|
911 | + $output .= ' <span>'.$team->country.'</span>'; |
|
912 | + $output .= '</div>'."\n"; |
|
913 | 913 | $output .= '<div class="stats">'; |
914 | - $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
915 | - $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
|
916 | - $output .= '</div>' . "\n"; |
|
914 | + $output .= ' <label>'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').': </label>'; |
|
915 | + $output .= ' <span>'.number_format($team->total_credit, 0).'</span>'; |
|
916 | + $output .= '</div>'."\n"; |
|
917 | 917 | } |
918 | 918 | else if ($user->uid == $account->uid) { |
919 | - $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
919 | + $output .= '<h2 class="pane-title">'.bts('Team (None)', array(), NULL, 'boinc:team-dashboard').'</h2>'; |
|
920 | 920 | $output .= '<ul class="tab-list action-list">'; |
921 | 921 | $output .= '<li class="tab primary">'; |
922 | 922 | $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | function boincteam_edit_team_panel($team_id) { |
933 | 933 | $team = node_load($team_id); |
934 | 934 | $output = ''; |
935 | - $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
935 | + $output .= '<h2 class="pane-title">'.$team->title.'</h2>'; |
|
936 | 936 | $output .= drupal_get_form('boincteam_edit_form', $team_id); |
937 | 937 | |
938 | 938 | return $output; |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | function boincteam_join_team_panel($team_id) { |
945 | 945 | $team = node_load($team_id); |
946 | 946 | $output = ''; |
947 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
948 | - $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
949 | - array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
|
947 | + $output .= '<h2 class="pane-title">'.bts('Join team', array(), NULL, 'boinc:join-team-panel').'</h2>'; |
|
948 | + $output .= '<p>'.bts('Click here to become a member of @this_team', |
|
949 | + array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel').'</p>'; |
|
950 | 950 | $output .= '<ul class="tab-list">'; |
951 | - $output .= ' <li class="first last tab">' . |
|
952 | - l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
951 | + $output .= ' <li class="first last tab">'. |
|
952 | + l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join").'</li>'; |
|
953 | 953 | $output .= '</ul>'; |
954 | 954 | return $output; |
955 | 955 | } |
@@ -960,12 +960,12 @@ discard block |
||
960 | 960 | function boincteam_leave_team_panel($team_id) { |
961 | 961 | $team = node_load($team_id); |
962 | 962 | $output = ''; |
963 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | - $output .= '<p>' . bts('Click here to revoke your membership with' |
|
965 | - . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
|
963 | + $output .= '<h2 class="pane-title">'.bts('Leave team', array(), NULL, 'boinc:leave-team-panel').'</h2>'; |
|
964 | + $output .= '<p>'.bts('Click here to revoke your membership with' |
|
965 | + . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel').'</p>'; |
|
966 | 966 | $output .= '<ul class="tab-list">'; |
967 | - $output .= ' <li class="first last tab">' . |
|
968 | - l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
967 | + $output .= ' <li class="first last tab">'. |
|
968 | + l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave").'</li>'; |
|
969 | 969 | $output .= '</ul>'; |
970 | 970 | return $output; |
971 | 971 | } |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | */ |
976 | 976 | function boincteam_manage_admins_panel_header($team_id) { |
977 | 977 | $output = ''; |
978 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
978 | + $output .= '<h4>'.bts('Add team admin', array(), NULL, 'boinc:team-manage-admins').'</h4>'; |
|
979 | 979 | $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
980 | 980 | $output .= '<div class="clearfix"></div>'; |
981 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
981 | + $output .= '<h4>'.bts('Current team admins', array(), NULL, 'boinc:team-manage-admins').'</h4>'; |
|
982 | 982 | |
983 | 983 | return $output; |
984 | 984 | } |
@@ -991,17 +991,17 @@ discard block |
||
991 | 991 | $team = node_load($team_id); |
992 | 992 | |
993 | 993 | $output = ''; |
994 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
994 | + $output .= '<h2 class="pane-title">'.bts('Manage team', array(), NULL, 'boinc:team-manage').'</h2>'; |
|
995 | 995 | |
996 | 996 | // PM all members |
997 | 997 | if (module_exists('privatemsg')) { |
998 | 998 | $output .= '<div class="form-item">'; |
999 | 999 | $output .= ' <ul class="tab-list action-list">'; |
1000 | - $output .= ' <li class="first tab primary">' . |
|
1001 | - l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1000 | + $output .= ' <li class="first tab primary">'. |
|
1001 | + l('Send message to team', "community/teams/{$team_id}/message-all-members").'</li>'; |
|
1002 | 1002 | $output .= ' </ul>'; |
1003 | 1003 | $output .= ' <div class="description">'; |
1004 | - $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1004 | + $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1005 | 1005 | $output .= ' </div>'; |
1006 | 1006 | $output .= '</div>'; |
1007 | 1007 | } |
@@ -1019,13 +1019,13 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | $output .= '<div class="form-item">'; |
1021 | 1021 | $output .= ' <ul class="tab-list action-list">'; |
1022 | - $output .= ' <li class="first tab primary">' . |
|
1022 | + $output .= ' <li class="first tab primary">'. |
|
1023 | 1023 | l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
1024 | 1024 | "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
1025 | 1025 | ); |
1026 | 1026 | $output .= ' </li>'; |
1027 | 1027 | $output .= ' <div class="description">'; |
1028 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1028 | + $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1029 | 1029 | $output .= ' </div>'; |
1030 | 1030 | $output .= '</div>'; |
1031 | 1031 | } |
@@ -1033,15 +1033,15 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | // Team history |
1035 | 1035 | $output .= '<div class="form-item">'; |
1036 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1036 | + $output .= ' <label>'.bts('View change history', array(), NULL, 'boinc:team-manage').'</label>'; |
|
1037 | 1037 | $output .= ' <ul class="tab-list">'; |
1038 | - $output .= ' <li class="first tab primary">' . |
|
1039 | - l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
|
1040 | - $output .= ' <li class="last tab primary">' . |
|
1041 | - l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
|
1038 | + $output .= ' <li class="first tab primary">'. |
|
1039 | + l('HTML', "community/teams/{$team_id}/history").'</li>'; |
|
1040 | + $output .= ' <li class="last tab primary">'. |
|
1041 | + l('XML', "community/teams/{$team_id}/history/xml").'</li>'; |
|
1042 | 1042 | $output .= ' </ul>'; |
1043 | 1043 | $output .= ' <div class="description">'; |
1044 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1044 | + $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1045 | 1045 | $output .= ' </div>'; |
1046 | 1046 | $output .= '</div>'; |
1047 | 1047 | |
@@ -1049,30 +1049,30 @@ discard block |
||
1049 | 1049 | $output .= ' <ul class="tab-list action-list">'; |
1050 | 1050 | |
1051 | 1051 | // Edit team information |
1052 | - $output .= ' <li class="first tab primary">' . |
|
1053 | - l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1052 | + $output .= ' <li class="first tab primary">'. |
|
1053 | + l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info").'</li>'; |
|
1054 | 1054 | |
1055 | 1055 | // Member list |
1056 | - $output .= ' <li class="tab primary">' . |
|
1057 | - l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1056 | + $output .= ' <li class="tab primary">'. |
|
1057 | + l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members").'</li>'; |
|
1058 | 1058 | |
1059 | 1059 | // Remove members |
1060 | - $output .= ' <li class="tab primary">' . |
|
1061 | - l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1060 | + $output .= ' <li class="tab primary">'. |
|
1061 | + l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members").'</li>'; |
|
1062 | 1062 | |
1063 | 1063 | if ($is_founder) { |
1064 | 1064 | |
1065 | 1065 | // Change founder |
1066 | - $output .= ' <li class="tab primary">' . |
|
1067 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1066 | + $output .= ' <li class="tab primary">'. |
|
1067 | + l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder").'</li>'; |
|
1068 | 1068 | |
1069 | 1069 | // Manage admins |
1070 | - $output .= ' <li class="tab primary">' . |
|
1071 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1070 | + $output .= ' <li class="tab primary">'. |
|
1071 | + l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins").'</li>'; |
|
1072 | 1072 | |
1073 | 1073 | // Delete the team |
1074 | - $output .= ' <li class="last tab primary">' . |
|
1075 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1074 | + $output .= ' <li class="last tab primary">'. |
|
1075 | + l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete").'</li>'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | $output .= ' </ul>'; |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | $account = user_load($user->uid); |
1090 | 1090 | $team = node_load($account->team); |
1091 | 1091 | $output = ''; |
1092 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | - $output .= '<p>' . bts('You are a member of @team.', |
|
1094 | - array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
|
1092 | + $output .= '<h2 class="pane-title">'.bts('My team', array(), NULL, 'boinc:account-team-panel').'</h2>'; |
|
1093 | + $output .= '<p>'.bts('You are a member of @team.', |
|
1094 | + array('@team' => $team->title), NULL, 'boinc:account-team-panel').'</p>'; |
|
1095 | 1095 | $output .= '<ul class="tab-list">'; |
1096 | - $output .= ' <li class="first last tab">' . |
|
1097 | - l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1096 | + $output .= ' <li class="first last tab">'. |
|
1097 | + l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}").'</li>'; |
|
1098 | 1098 | $output .= '</ul>'; |
1099 | 1099 | return $output; |
1100 | 1100 | } |
@@ -1110,11 +1110,11 @@ discard block |
||
1110 | 1110 | $boincteam = boincteam_load($boincteam_id); |
1111 | 1111 | $boincuser_id = $account->boincuser_id; |
1112 | 1112 | $output = ''; |
1113 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1113 | + $output .= '<h2 class="pane-title">'.bts('Request foundership', array(), NULL, 'boinc:team-request-foundership').'</h2>'; |
|
1114 | 1114 | |
1115 | 1115 | if (boincteam_user_requested_foundership($team_id)) { |
1116 | 1116 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1117 | - $days_to_deadline = ceil(($deadline - time()) / (24*60*60)); |
|
1117 | + $days_to_deadline = ceil(($deadline - time())/(24*60*60)); |
|
1118 | 1118 | $request_age = 60 - $days_to_deadline; |
1119 | 1119 | $days_to_respond = 30 + $days_to_deadline; |
1120 | 1120 | if (time() > $deadline) { |
@@ -1142,8 +1142,8 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | $output .= '</p>'; |
1144 | 1144 | $output .= '<ul class="tab-list">'; |
1145 | - $output .= ' <li class="first last tab">' . |
|
1146 | - l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1145 | + $output .= ' <li class="first last tab">'. |
|
1146 | + l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership").'</li>'; |
|
1147 | 1147 | $output .= '</ul>'; |
1148 | 1148 | } |
1149 | 1149 | else { |
@@ -1167,29 +1167,29 @@ discard block |
||
1167 | 1167 | // who made the request has 30 additional days to assume foundership if |
1168 | 1168 | // there is no response to the request) |
1169 | 1169 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1170 | - $days_to_deadline = ceil(($deadline - time()) / (24*60*60)) + 30; |
|
1170 | + $days_to_deadline = ceil(($deadline - time())/(24*60*60)) + 30; |
|
1171 | 1171 | $output .= '<p>'; |
1172 | 1172 | $output .= bts('A team foundership change was already requested recently.' |
1173 | 1173 | . ' Only one request is allowed within a period of 90 days.', |
1174 | 1174 | NULL, 'boinc:team-request-foundership'); |
1175 | 1175 | if ($days_to_deadline == 1) { |
1176 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1176 | + $output .= ' ('.bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership').')'; |
|
1177 | 1177 | } |
1178 | 1178 | else { |
1179 | - $output .= ' (' . bts('@count days remaining', |
|
1179 | + $output .= ' ('.bts('@count days remaining', |
|
1180 | 1180 | array('@count' => $days_to_deadline), |
1181 | - NULL, 'boinc:team-request-foundership') . ')'; |
|
1181 | + NULL, 'boinc:team-request-foundership').')'; |
|
1182 | 1182 | } |
1183 | 1183 | $output .= '</p>'; |
1184 | 1184 | } |
1185 | 1185 | else { |
1186 | - $output .= '<p>' . bts('If the team founder is not active and you want to' |
|
1186 | + $output .= '<p>'.bts('If the team founder is not active and you want to' |
|
1187 | 1187 | . ' assume the role of founder, click below to request foundership of' |
1188 | 1188 | . ' @this_team.', |
1189 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1189 | + array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership').'</p>'; |
|
1190 | 1190 | $output .= '<ul class="tab-list">'; |
1191 | - $output .= ' <li class="first last tab">' . |
|
1192 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1191 | + $output .= ' <li class="first last tab">'. |
|
1192 | + l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership").'</li>'; |
|
1193 | 1193 | $output .= '</ul>'; |
1194 | 1194 | } |
1195 | 1195 | return $output; |
@@ -1210,15 +1210,15 @@ discard block |
||
1210 | 1210 | if ($boincteam->ping_user) { |
1211 | 1211 | if ($boincteam->ping_user < 0) { |
1212 | 1212 | $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
1213 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1213 | + $output .= '<h2 class="pane-title">'.bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1214 | 1214 | . '</h2>'; |
1215 | - $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1215 | + $output .= '<p>'.bts('Team member @name requested team foundership on' |
|
1216 | 1216 | . ' @date, but then left the team. This request is now canceled.', |
1217 | 1217 | array( |
1218 | 1218 | '@name' => $member->boincuser_name, |
1219 | 1219 | '@date' => date('j M Y', $boincteam->ping_time), |
1220 | 1220 | ), |
1221 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1221 | + NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1222 | 1222 | // Automatically cancel the request |
1223 | 1223 | db_set_active('boinc_rw'); |
1224 | 1224 | db_query(" |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | else { |
1233 | 1233 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1234 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1234 | + $output .= '<h2 class="pane-title">'.bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1235 | 1235 | . '</h2>'; |
1236 | - $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1236 | + $output .= '<p>'.bts('Team member @name has requested team foundership.' |
|
1237 | 1237 | . ' This may be because you left the team or have not had contact with' |
1238 | 1238 | . ' the team for a long time.', array( |
1239 | 1239 | '@name' => $member->boincuser_name, |
1240 | 1240 | ) |
1241 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | - $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1241 | + , array(), NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1242 | + $output .= '<p>'.bts("If you don't decline the request by @date, @name" |
|
1243 | 1243 | . ' will have the option of assuming team foundership. (note: To' |
1244 | 1244 | . ' accept the request, assign foundership to @name using the form' |
1245 | 1245 | . ' below)', |
@@ -1247,10 +1247,10 @@ discard block |
||
1247 | 1247 | '@name' => $member->boincuser_name, |
1248 | 1248 | '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
1249 | 1249 | ), |
1250 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1250 | + NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1251 | 1251 | $output .= '<ul class="tab-list">'; |
1252 | - $output .= ' <li class="first last tab">' . |
|
1253 | - l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1252 | + $output .= ' <li class="first last tab">'. |
|
1253 | + l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request").'</li>'; |
|
1254 | 1254 | $output .= '</ul>'; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1260,9 +1260,9 @@ discard block |
||
1260 | 1260 | function boincteam_search_panel() { |
1261 | 1261 | $output = ''; |
1262 | 1262 | if (module_exists('global_search_teams_solr')) { |
1263 | - $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
|
1263 | + $output .= '<h2 class="pane-title">'.bts('Search teams', array(), NULL, 'boinc:search-team').'</h2>'; |
|
1264 | 1264 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1265 | - $output .= '<p>' . boincteam_search_view() . '</p>'; |
|
1265 | + $output .= '<p>'.boincteam_search_view().'</p>'; |
|
1266 | 1266 | } |
1267 | 1267 | return $output; |
1268 | 1268 | } |
@@ -1278,20 +1278,20 @@ discard block |
||
1278 | 1278 | * General info about the concept of teams |
1279 | 1279 | */ |
1280 | 1280 | function boincteam_topic_overview_panel() { |
1281 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1281 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1282 | 1282 | $output = ''; |
1283 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1283 | + $output .= '<h2 class="pane-title">'.bts('Teams', array(), NULL, 'boinc:team-general-info').'</h2>'; |
|
1284 | 1284 | $output .= '<div class="">'; |
1285 | - $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1285 | + $output .= '<p>'.bts('@project participants may form teams. You may belong' |
|
1286 | 1286 | . ' to only one team. You can join or quit a team at any time. To join a' |
1287 | 1287 | . ' team, visit its team page and click "Join this team". Each team has a' |
1288 | - . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
|
1288 | + . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info').'</p>'; |
|
1289 | 1289 | $output .= '<ul>'; |
1290 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1290 | + $output .= ' <li>'.bts('Private Message all team members', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1291 | + $output .= ' <li>'.bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1292 | + $output .= ' <li>'.bts('add or remove team admins', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1293 | + $output .= ' <li>'.bts('remove members from the team', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1294 | + $output .= ' <li>'.bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1295 | 1295 | $output .= '</ul>'; |
1296 | 1296 | $output .= '</div>'; |
1297 | 1297 | return $output; |
@@ -1336,34 +1336,34 @@ discard block |
||
1336 | 1336 | } |
1337 | 1337 | } |
1338 | 1338 | $output = ''; |
1339 | - $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1339 | + $output .= '<h2 class="pane-title">'.$boincteam->name.'</h2>'; |
|
1340 | 1340 | $output .= '<div>'; |
1341 | 1341 | $output .= '<div class="left-column">'; |
1342 | 1342 | $output .= '<ul class="stats">'; |
1343 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1343 | + $output .= ' <li>'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').': '.number_format($boincteam->total_credit, 0).'</li>'; |
|
1344 | + $output .= ' <li>'.bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC').': '.number_format($boincteam->expavg_credit, 2).'</li>'; |
|
1345 | + $output .= ' <li>'.bts('Country', array(), NULL, 'boinc:country-of-origin').': '.$boincteam->country.'</li>'; |
|
1346 | + $output .= ' <li>'.bts('Type', array(), NULL, 'boinc:view-team-info').': '.boincteam_get_type($team_id).'</li>'; |
|
1347 | 1347 | $output .= '</ul>'; |
1348 | 1348 | $output .= '</div>'; |
1349 | 1349 | $output .= '<div class="right-column">'; |
1350 | 1350 | $output .= '<ul class="stats">'; |
1351 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1351 | + $output .= ' <li>'.bts('Founder', array(), NULL, 'boinc:view-team-info').': '.l($founder->boincuser_name, "account/{$founder->uid}").'</li>'; |
|
1352 | + $output .= ' <li>'.bts('New members in last day', array(), NULL, 'boinc:view-team-info').': '.implode('·', $new_members).'</li>'; |
|
1353 | + $output .= ' <li>'.bts('Total members', array(), NULL, 'boinc:view-team-info').': '.l($boincteam->nusers, "community/teams/{$team_id}/members").'</li>'; |
|
1354 | + $output .= ' <li>'.bts('Active members', array(), NULL, 'boinc:view-team-info').': '.$boincteam->nusers_active.'</li>'; |
|
1355 | + $output .= ' <li>'.bts('Members with credit', array(), NULL, 'boinc:view-team-info').': '.$boincteam->nusers_worked.'</li>'; |
|
1356 | 1356 | $output .= '</ul>'; |
1357 | 1357 | $output .= '</div>'; |
1358 | 1358 | $output .= '</div>'; |
1359 | 1359 | $output .= '<div class="clearfix"></div>'; |
1360 | 1360 | if ($boincteam->url) { |
1361 | 1361 | $output .= '<div class="stats">'; |
1362 | - $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1362 | + $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team').': '.l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1363 | 1363 | $output .= '</div>'; |
1364 | 1364 | } |
1365 | 1365 | if ($team->body) { |
1366 | - $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
|
1366 | + $output .= '<h3>'.bts('Description', array(), NULL, 'boinc:team-description').'</h3>'; |
|
1367 | 1367 | $output .= check_markup($team->body, $team->format); |
1368 | 1368 | $output .= '</div>'; |
1369 | 1369 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | 'type' => MENU_CALLBACK, |
103 | 103 | ); |
104 | 104 | $items['community/teams/%/message-all-members'] = array( |
105 | - 'title' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
|
106 | - 'description' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
|
105 | + 'title' => bts('Send Message to Team', array(), null, 'boinc:team-manage'), |
|
106 | + 'description' => bts('Send Message to Team', array(), null, 'boinc:team-manage'), |
|
107 | 107 | 'page callback' => 'drupal_get_form', |
108 | 108 | 'page arguments' => array('boincteam_sendmessagetoteam', 2), |
109 | 109 | 'access callback' => 'boincteam_is_admin', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | return array( |
141 | 141 | 'boincteam_utility_team_table' => array( |
142 | - 'arguments' => array('form' => NULL), |
|
142 | + 'arguments' => array('form' => null), |
|
143 | 143 | 'file' => 'boincteam.admin.inc', |
144 | 144 | ), |
145 | 145 | ); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | function boincteam_delete($team_id) { |
274 | 274 | $team = node_load($team_id); |
275 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
275 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), true); |
|
276 | 276 | if ($boincteam->nusers == 1) { |
277 | 277 | require_boinc('team'); |
278 | 278 | $boincuser = boincuser_load(); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | else { |
289 | 289 | drupal_set_message(t('All members must be removed from @team before the |
290 | 290 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | - drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
|
291 | + drupal_goto(strstr($_GET['q'], '/delete', true)); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | /** |
318 | 318 | * Get the join date of a user |
319 | 319 | */ |
320 | -function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) { |
|
320 | +function boincteam_get_member_join_date($boincteam_id, $boincuser_id = null) { |
|
321 | 321 | if (!$boincuser_id) { |
322 | 322 | global $user; |
323 | 323 | $account = user_load($user->uid); |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * Get a BOINC team object |
417 | 417 | */ |
418 | -function boincteam_load($boincteam_id, $full_object = FALSE) { |
|
418 | +function boincteam_load($boincteam_id, $full_object = false) { |
|
419 | 419 | require_boinc(array('team')); |
420 | 420 | $team = BoincTeam::lookup_id($boincteam_id); |
421 | - if ($team AND $full_object) { |
|
421 | + if ($team and $full_object) { |
|
422 | 422 | $team->nusers = BoincUser::count("teamid={$team->id}"); |
423 | 423 | $team->nusers_worked = BoincUser::count("teamid={$team->id} and total_credit>0"); |
424 | 424 | $team->nusers_active = BoincUser::count("teamid={$team->id} and expavg_credit>0.1"); |
@@ -433,39 +433,39 @@ discard block |
||
433 | 433 | /** |
434 | 434 | * Check if a user is the team founder |
435 | 435 | */ |
436 | -function boincteam_is_founder($nid, $uid = NULL) { |
|
436 | +function boincteam_is_founder($nid, $uid = null) { |
|
437 | 437 | if (!$uid) { |
438 | 438 | global $user; |
439 | 439 | $uid = $user->uid; |
440 | 440 | } |
441 | 441 | if (!boincteam_is_member($nid, $uid)) { |
442 | - return FALSE; |
|
442 | + return false; |
|
443 | 443 | } |
444 | 444 | $team_id = boincteam_lookup_id($nid); |
445 | 445 | require_boinc('team'); |
446 | - return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
446 | + return is_team_founder(boincuser_load($uid, true), boincteam_load($team_id)); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Check if a user is a team admin |
451 | 451 | */ |
452 | -function boincteam_is_admin($nid, $uid = NULL) { |
|
452 | +function boincteam_is_admin($nid, $uid = null) { |
|
453 | 453 | if (!$uid) { |
454 | 454 | global $user; |
455 | 455 | $uid = $user->uid; |
456 | 456 | } |
457 | 457 | if (!boincteam_is_member($nid, $uid)) { |
458 | - return FALSE; |
|
458 | + return false; |
|
459 | 459 | } |
460 | 460 | $team_id = boincteam_lookup_id($nid); |
461 | 461 | require_boinc('team'); |
462 | - return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
462 | + return is_team_admin(boincuser_load($uid, true), boincteam_load($team_id)); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Check if a user is a team member |
467 | 467 | */ |
468 | -function boincteam_is_member($nid, $uid = NULL) { |
|
468 | +function boincteam_is_member($nid, $uid = null) { |
|
469 | 469 | if (!$uid) { |
470 | 470 | global $user; |
471 | 471 | $uid = $user->uid; |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | drupal_set_message( |
493 | 493 | bts( |
494 | 494 | 'A foundership transfer request has been made for your team. Please !respond.', |
495 | - array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | - NULL, 'boinc:team-founder-change'), |
|
497 | - 'warning', FALSE |
|
495 | + array('!respond' => l(bts('respond to the request', array(), null, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | + null, 'boinc:team-founder-change'), |
|
497 | + 'warning', false |
|
498 | 498 | ); |
499 | 499 | } |
500 | 500 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | $boincteam_id = boincteam_lookup_id($team_id); |
513 | 513 | $boincteam = boincteam_load($boincteam_id); |
514 | - if ($boincteam->joinable AND $account->team != $team_id) { |
|
514 | + if ($boincteam->joinable and $account->team != $team_id) { |
|
515 | 515 | require_boinc('team'); |
516 | 516 | $boincuser = boincuser_load(); |
517 | 517 | if (user_join_team($boincteam, $boincuser)) { |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | $boincteam = boincteam_load($boincteam_id); |
604 | 604 | if ($account->team == $team_id) { |
605 | 605 | require_boinc('team'); |
606 | - $boincuser = boincuser_load($user_id, TRUE); |
|
606 | + $boincuser = boincuser_load($user_id, true); |
|
607 | 607 | user_quit_team($boincuser); |
608 | 608 | drupal_set_message(t('@user has been removed from @team.', |
609 | 609 | array( |
@@ -725,14 +725,14 @@ discard block |
||
725 | 725 | $now = time(); |
726 | 726 | if ($boincteam->ping_user <= 0) { |
727 | 727 | if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
728 | - return TRUE; |
|
728 | + return true; |
|
729 | 729 | } |
730 | - return FALSE; |
|
730 | + return false; |
|
731 | 731 | } |
732 | 732 | if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
733 | - return TRUE; |
|
733 | + return true; |
|
734 | 734 | } |
735 | - return FALSE; |
|
735 | + return false; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | /** |
754 | 754 | * Check if a user has an active foundership request with a team |
755 | 755 | */ |
756 | -function boincteam_user_requested_foundership($team_id, $user_id = NULL) { |
|
756 | +function boincteam_user_requested_foundership($team_id, $user_id = null) { |
|
757 | 757 | if (!$user_id) { |
758 | 758 | global $user; |
759 | 759 | $user_id = $user->uid; |
@@ -778,27 +778,27 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function boincteam_about_admins_panel() { |
780 | 780 | $output = ''; |
781 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
781 | + $output .= '<h2 class="pane-title">' . bts('About team admins', array(), null, 'boinc:team-admins-panel') . '</h2>'; |
|
782 | 782 | $output .= '<div>'; |
783 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
783 | + $output .= '<p>' . bts('Team admins can:', array(), null, 'boinc:team-admins-panel') . '</p>'; |
|
784 | 784 | $output .= '<ul>'; |
785 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
785 | + $output .= ' <li>' . bts('Edit team information', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
786 | + $output .= ' <li>' . bts("View the team's join / quit history", array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
787 | + $output .= ' <li>' . bts('Moderate the team forum', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
788 | + $output .= ' <li>' . bts('Remove members from the team', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
789 | + $output .= ' <li>' . bts('Disband a team if it has no members', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
790 | 790 | $output .= '</ul>'; |
791 | 791 | $output .= '</div>'; |
792 | 792 | $output .= '<div>'; |
793 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
793 | + $output .= '<p>' . bts('Team admins cannot:', array(), null, 'boinc:team-admins-panel') . '</p>'; |
|
794 | 794 | $output .= '<ul>'; |
795 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
795 | + $output .= ' <li>' . bts('Change the team founder', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
796 | + $output .= ' <li>' . bts('Remove members', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
797 | + $output .= ' <li>' . bts('Add / Remove team admins', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
798 | 798 | $output .= '</ul>'; |
799 | 799 | $output .= '</div>'; |
800 | 800 | $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
801 | - . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
|
801 | + . ' team admin. We recommend only selecting people you know and trust', array(), null, 'boinc:team-admins-panel') |
|
802 | 802 | . '</p>'; |
803 | 803 | return $output; |
804 | 804 | } |
@@ -808,26 +808,26 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function boincteam_about_founder_panel() { |
810 | 810 | $output = ''; |
811 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
811 | + $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), null, 'boinc:team-founder-panel') |
|
812 | 812 | . '</h2>'; |
813 | 813 | $output .= '<div>'; |
814 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
814 | + $output .= '<p>' . bts('Notes about changes in foundership:', array(), null, 'boinc:team-founder-panel') . '</p>'; |
|
815 | 815 | $output .= '<ul>'; |
816 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
816 | + $output .= ' <li>' . bts('Any member of the team is eligible', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
817 | + $output .= ' <li>' . bts('Current founder becomes a normal user', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
818 | 818 | $output .= '</ul>'; |
819 | 819 | $output .= '</div>'; |
820 | 820 | $output .= '<div>'; |
821 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
821 | + $output .= '<p>' . bts('Foundership can be requested by team members:', array(), null, 'boinc:team-founder-panel') |
|
822 | 822 | . '</p>'; |
823 | 823 | $output .= '<ul>'; |
824 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
824 | + $output .= ' <li>' . bts('One request is allowed at a time', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
825 | + $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), null, 'boinc:team-founder-panel') |
|
826 | 826 | . '</li>'; |
827 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
827 | + $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), null, 'boinc:team-founder-panel') |
|
828 | 828 | . '</li>'; |
829 | 829 | $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
830 | - . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
830 | + . ' request', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
831 | 831 | $output .= '</ul>'; |
832 | 832 | $output .= '</div>'; |
833 | 833 | return $output; |
@@ -841,16 +841,16 @@ discard block |
||
841 | 841 | $account = user_load($user->uid); |
842 | 842 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
843 | 843 | $output = ''; |
844 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
844 | + $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), null, 'boinc:create-team-panel') . '</h2>'; |
|
845 | 845 | $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
846 | - . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
|
846 | + . ' can create a team.', array(), null, 'boinc:create-team-panel') . '</p>'; |
|
847 | 847 | $output .= '<ul class="tab-list">'; |
848 | 848 | $output .= ' <li class="first last tab">'; |
849 | 849 | if (isset($account->roles[$unrestricted_role])) { |
850 | - $output .= l(bts('Create new team', array(), NULL, 'boinc:create-team-panel'), 'community/teams/add'); |
|
850 | + $output .= l(bts('Create new team', array(), null, 'boinc:create-team-panel'), 'community/teams/add'); |
|
851 | 851 | } elseif ($account->uid <= 0) { |
852 | 852 | $output .= l( |
853 | - bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
853 | + bts('Login to create a new team', array(), null, 'boinc:create-team-panel'), |
|
854 | 854 | 'user/login', |
855 | 855 | array('query' => drupal_get_destination()) |
856 | 856 | ); |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | $credit_needed = $min_credit_needed - $account->boincuser_total_credit; |
860 | 860 | $output .= '['; |
861 | 861 | if ($credit_needed == 1) { |
862 | - $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
862 | + $output .= bts('You must earn 1 more credit!', array(), null, 'boinc:create-team-panel'); |
|
863 | 863 | } |
864 | 864 | else { |
865 | 865 | $output .= bts('You must earn @count more credits!', |
866 | 866 | array('@count' => $credit_needed), |
867 | - NULL, 'boinc:create-team-panel' |
|
867 | + null, 'boinc:create-team-panel' |
|
868 | 868 | ); |
869 | 869 | } |
870 | 870 | $output .= ']'; |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | */ |
880 | 880 | function boincteam_create_team_panel() { |
881 | 881 | $output = ''; |
882 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
882 | + $output .= '<h2 class="pane-title">' . bts('Create a team', array(), null, 'boinc:create-team-panel') . '</h2>'; |
|
883 | 883 | $output .= drupal_get_form('boincteam_create_form'); |
884 | 884 | |
885 | 885 | return $output; |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | /** |
889 | 889 | * Link to user's team |
890 | 890 | */ |
891 | -function boincteam_dashboard_panel($uid = NULL) { |
|
891 | +function boincteam_dashboard_panel($uid = null) { |
|
892 | 892 | global $user; |
893 | 893 | if (!$uid) { |
894 | 894 | $uid = $user->uid; |
@@ -897,29 +897,29 @@ discard block |
||
897 | 897 | $account = user_load($uid); |
898 | 898 | if ($account->team) { |
899 | 899 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
900 | - $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
900 | + $output .= '<h2 class="pane-title">' . bts('Team', array(), null, 'boinc:team-dashboard') . '</h2>'; |
|
901 | 901 | $output .= '<div class="stats">'; |
902 | - $output .= ' <label>' . bts('Name', array(), NULL, 'boinc:user-or-team-name') . ': </label>'; |
|
902 | + $output .= ' <label>' . bts('Name', array(), null, 'boinc:user-or-team-name') . ': </label>'; |
|
903 | 903 | $output .= ' <span>' . l($team->name, "community/teams/{$account->team}") . '</span>'; |
904 | 904 | $output .= '</div>' . "\n"; |
905 | 905 | $output .= '<div class="stats">'; |
906 | - $output .= ' <label>' . bts('Member since', array(), NULL, 'boinc:user-info') . ': </label>'; |
|
906 | + $output .= ' <label>' . bts('Member since', array(), null, 'boinc:user-info') . ': </label>'; |
|
907 | 907 | $output .= ' <span>' . date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)) . '</span>'; |
908 | 908 | $output .= '</div>' . "\n"; |
909 | 909 | $output .= '<div class="stats">'; |
910 | - $output .= ' <label>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': </label>'; |
|
910 | + $output .= ' <label>' . bts('Country', array(), null, 'boinc:country-of-origin') . ': </label>'; |
|
911 | 911 | $output .= ' <span>' . $team->country . '</span>'; |
912 | 912 | $output .= '</div>' . "\n"; |
913 | 913 | $output .= '<div class="stats">'; |
914 | - $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
914 | + $output .= ' <label>' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
915 | 915 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
916 | 916 | $output .= '</div>' . "\n"; |
917 | 917 | } |
918 | 918 | else if ($user->uid == $account->uid) { |
919 | - $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
919 | + $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), null, 'boinc:team-dashboard') . '</h2>'; |
|
920 | 920 | $output .= '<ul class="tab-list action-list">'; |
921 | 921 | $output .= '<li class="tab primary">'; |
922 | - $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
|
922 | + $output .= l(bts('Join a Team', array(), null, 'boinc:team-dashboard'), 'community/teams'); |
|
923 | 923 | $output .= '</li>'; |
924 | 924 | $output .= '</ul>'; |
925 | 925 | } |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | function boincteam_join_team_panel($team_id) { |
945 | 945 | $team = node_load($team_id); |
946 | 946 | $output = ''; |
947 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
947 | + $output .= '<h2 class="pane-title">' . bts('Join team', array(), null, 'boinc:join-team-panel') . '</h2>'; |
|
948 | 948 | $output .= '<p>' . bts('Click here to become a member of @this_team', |
949 | - array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
|
949 | + array('@this_team' =>$team->title), null, 'boinc:join-team-panel') . '</p>'; |
|
950 | 950 | $output .= '<ul class="tab-list">'; |
951 | 951 | $output .= ' <li class="first last tab">' . |
952 | - l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
952 | + l(bts('Join this team', array(), null, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
953 | 953 | $output .= '</ul>'; |
954 | 954 | return $output; |
955 | 955 | } |
@@ -960,12 +960,12 @@ discard block |
||
960 | 960 | function boincteam_leave_team_panel($team_id) { |
961 | 961 | $team = node_load($team_id); |
962 | 962 | $output = ''; |
963 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
963 | + $output .= '<h2 class="pane-title">' . bts('Leave team', array(), null, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | 964 | $output .= '<p>' . bts('Click here to revoke your membership with' |
965 | - . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
|
965 | + . ' @this_team', array('@this_team' =>$team->title), null, 'boinc:leave-team-panel') . '</p>'; |
|
966 | 966 | $output .= '<ul class="tab-list">'; |
967 | 967 | $output .= ' <li class="first last tab">' . |
968 | - l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
968 | + l(bts('Leave this team', array(), null, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
969 | 969 | $output .= '</ul>'; |
970 | 970 | return $output; |
971 | 971 | } |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | */ |
976 | 976 | function boincteam_manage_admins_panel_header($team_id) { |
977 | 977 | $output = ''; |
978 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
978 | + $output .= '<h4>' . bts('Add team admin', array(), null, 'boinc:team-manage-admins') . '</h4>'; |
|
979 | 979 | $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
980 | 980 | $output .= '<div class="clearfix"></div>'; |
981 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
981 | + $output .= '<h4>' . bts('Current team admins', array(), null, 'boinc:team-manage-admins') . '</h4>'; |
|
982 | 982 | |
983 | 983 | return $output; |
984 | 984 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | $team = node_load($team_id); |
992 | 992 | |
993 | 993 | $output = ''; |
994 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
994 | + $output .= '<h2 class="pane-title">' . bts('Manage team', array(), null, 'boinc:team-manage') . '</h2>'; |
|
995 | 995 | |
996 | 996 | // PM all members |
997 | 997 | if (module_exists('privatemsg')) { |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
1002 | 1002 | $output .= ' </ul>'; |
1003 | 1003 | $output .= ' <div class="description">'; |
1004 | - $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1004 | + $output .= bts('Contact all team members using e-mail.', array(), null, 'boinc:team-manage'); |
|
1005 | 1005 | $output .= ' </div>'; |
1006 | 1006 | $output .= '</div>'; |
1007 | 1007 | } |
@@ -1020,12 +1020,12 @@ discard block |
||
1020 | 1020 | $output .= '<div class="form-item">'; |
1021 | 1021 | $output .= ' <ul class="tab-list action-list">'; |
1022 | 1022 | $output .= ' <li class="first tab primary">' . |
1023 | - l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
|
1023 | + l(bts('Manage team message board', array(), null, 'boinc:team-manage'), |
|
1024 | 1024 | "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
1025 | 1025 | ); |
1026 | 1026 | $output .= ' </li>'; |
1027 | 1027 | $output .= ' <div class="description">'; |
1028 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1028 | + $output .= bts('Create or manage message board', array(), null, 'boinc:team-manage'); |
|
1029 | 1029 | $output .= ' </div>'; |
1030 | 1030 | $output .= '</div>'; |
1031 | 1031 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | // Team history |
1035 | 1035 | $output .= '<div class="form-item">'; |
1036 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1036 | + $output .= ' <label>' . bts('View change history', array(), null, 'boinc:team-manage') . '</label>'; |
|
1037 | 1037 | $output .= ' <ul class="tab-list">'; |
1038 | 1038 | $output .= ' <li class="first tab primary">' . |
1039 | 1039 | l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
1042 | 1042 | $output .= ' </ul>'; |
1043 | 1043 | $output .= ' <div class="description">'; |
1044 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1044 | + $output .= bts('See member activity', array(), null, 'boinc:team-manage'); |
|
1045 | 1045 | $output .= ' </div>'; |
1046 | 1046 | $output .= '</div>'; |
1047 | 1047 | |
@@ -1050,29 +1050,29 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | // Edit team information |
1052 | 1052 | $output .= ' <li class="first tab primary">' . |
1053 | - l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1053 | + l(bts('Edit team info', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1054 | 1054 | |
1055 | 1055 | // Member list |
1056 | 1056 | $output .= ' <li class="tab primary">' . |
1057 | - l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1057 | + l(bts('View member list', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1058 | 1058 | |
1059 | 1059 | // Remove members |
1060 | 1060 | $output .= ' <li class="tab primary">' . |
1061 | - l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1061 | + l(bts('Remove members', array(), null, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1062 | 1062 | |
1063 | 1063 | if ($is_founder) { |
1064 | 1064 | |
1065 | 1065 | // Change founder |
1066 | 1066 | $output .= ' <li class="tab primary">' . |
1067 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1067 | + l(bts('Change founder', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1068 | 1068 | |
1069 | 1069 | // Manage admins |
1070 | 1070 | $output .= ' <li class="tab primary">' . |
1071 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1071 | + l(bts('Manage team admins', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1072 | 1072 | |
1073 | 1073 | // Delete the team |
1074 | 1074 | $output .= ' <li class="last tab primary">' . |
1075 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1075 | + l(bts('Remove team', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | $output .= ' </ul>'; |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | $account = user_load($user->uid); |
1090 | 1090 | $team = node_load($account->team); |
1091 | 1091 | $output = ''; |
1092 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1092 | + $output .= '<h2 class="pane-title">' . bts('My team', array(), null, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | 1093 | $output .= '<p>' . bts('You are a member of @team.', |
1094 | - array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
|
1094 | + array('@team' => $team->title), null, 'boinc:account-team-panel') . '</p>'; |
|
1095 | 1095 | $output .= '<ul class="tab-list">'; |
1096 | 1096 | $output .= ' <li class="first last tab">' . |
1097 | - l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1097 | + l(bts('View my team', array(), null, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1098 | 1098 | $output .= '</ul>'; |
1099 | 1099 | return $output; |
1100 | 1100 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | $boincteam = boincteam_load($boincteam_id); |
1111 | 1111 | $boincuser_id = $account->boincuser_id; |
1112 | 1112 | $output = ''; |
1113 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1113 | + $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), null, 'boinc:team-request-foundership') . '</h2>'; |
|
1114 | 1114 | |
1115 | 1115 | if (boincteam_user_requested_foundership($team_id)) { |
1116 | 1116 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
@@ -1121,29 +1121,29 @@ discard block |
||
1121 | 1121 | $output .= '<p>'; |
1122 | 1122 | if ($request_age == 1) { |
1123 | 1123 | $output .= bts('1 day has elapsed since your request and' |
1124 | - . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1124 | + . ' the founder has not responded.', array(), null, 'boinc:team-request-foundership'); |
|
1125 | 1125 | } |
1126 | 1126 | else { |
1127 | 1127 | $output .= bts('@count days have elapsed since your request and' |
1128 | 1128 | . ' the founder has not responded.', |
1129 | 1129 | array('@count' => $request_age), |
1130 | - NULL, 'boinc:team-request-foundership'); |
|
1130 | + null, 'boinc:team-request-foundership'); |
|
1131 | 1131 | } |
1132 | 1132 | $output .= ' '; |
1133 | 1133 | if ($days_to_respond == 1) { |
1134 | 1134 | $output .= bts('You now have 1 day to assume foundership before' |
1135 | - . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1135 | + . ' another team member may submit a request.', array(), null, 'boinc:team-request-foundership'); |
|
1136 | 1136 | } |
1137 | 1137 | else { |
1138 | 1138 | $output .= bts('You now have @count days to assume foundership before' |
1139 | 1139 | . ' another team member may submit a request.', |
1140 | 1140 | array('@count' => $days_to_respond), |
1141 | - NULL, 'boinc:team-request-foundership'); |
|
1141 | + null, 'boinc:team-request-foundership'); |
|
1142 | 1142 | } |
1143 | 1143 | $output .= '</p>'; |
1144 | 1144 | $output .= '<ul class="tab-list">'; |
1145 | 1145 | $output .= ' <li class="first last tab">' . |
1146 | - l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1146 | + l(bts('Assume foundership', array(), null, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1147 | 1147 | $output .= '</ul>'; |
1148 | 1148 | } |
1149 | 1149 | else { |
@@ -1151,12 +1151,12 @@ discard block |
||
1151 | 1151 | if ($days_to_deadline == 1) { |
1152 | 1152 | $output .= bts('The team founder has 1 day to respond to your' |
1153 | 1153 | . ' transfer request.', |
1154 | - NULL, 'boinc:team-request-foundership'); |
|
1154 | + null, 'boinc:team-request-foundership'); |
|
1155 | 1155 | } |
1156 | 1156 | else { |
1157 | 1157 | $output .= bts('The team founder has @count days to respond to your' |
1158 | 1158 | . ' transfer request.', array('@count' => $days_to_deadline), |
1159 | - NULL, 'boinc:team-request-foundership'); |
|
1159 | + null, 'boinc:team-request-foundership'); |
|
1160 | 1160 | } |
1161 | 1161 | $output .= '</p>'; |
1162 | 1162 | } |
@@ -1171,14 +1171,14 @@ discard block |
||
1171 | 1171 | $output .= '<p>'; |
1172 | 1172 | $output .= bts('A team foundership change was already requested recently.' |
1173 | 1173 | . ' Only one request is allowed within a period of 90 days.', |
1174 | - NULL, 'boinc:team-request-foundership'); |
|
1174 | + null, 'boinc:team-request-foundership'); |
|
1175 | 1175 | if ($days_to_deadline == 1) { |
1176 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1176 | + $output .= ' (' . bts('1 day remaining', array(), null, 'boinc:team-request-foundership') . ')'; |
|
1177 | 1177 | } |
1178 | 1178 | else { |
1179 | 1179 | $output .= ' (' . bts('@count days remaining', |
1180 | 1180 | array('@count' => $days_to_deadline), |
1181 | - NULL, 'boinc:team-request-foundership') . ')'; |
|
1181 | + null, 'boinc:team-request-foundership') . ')'; |
|
1182 | 1182 | } |
1183 | 1183 | $output .= '</p>'; |
1184 | 1184 | } |
@@ -1186,10 +1186,10 @@ discard block |
||
1186 | 1186 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1187 | 1187 | . ' assume the role of founder, click below to request foundership of' |
1188 | 1188 | . ' @this_team.', |
1189 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1189 | + array('@this_team' =>$team->title), null, 'boinc:team-request-foundership') . '</p>'; |
|
1190 | 1190 | $output .= '<ul class="tab-list">'; |
1191 | 1191 | $output .= ' <li class="first last tab">' . |
1192 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1192 | + l(bts('Initiate request', array(), null, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1193 | 1193 | $output .= '</ul>'; |
1194 | 1194 | } |
1195 | 1195 | return $output; |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | if ($boincteam->ping_user) { |
1211 | 1211 | if ($boincteam->ping_user < 0) { |
1212 | 1212 | $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
1213 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1213 | + $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), null, 'boinc:team-request-foundership-response') |
|
1214 | 1214 | . '</h2>'; |
1215 | 1215 | $output .= '<p>' . bts('Team member @name requested team foundership on' |
1216 | 1216 | . ' @date, but then left the team. This request is now canceled.', |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | '@name' => $member->boincuser_name, |
1219 | 1219 | '@date' => date('j M Y', $boincteam->ping_time), |
1220 | 1220 | ), |
1221 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1221 | + null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1222 | 1222 | // Automatically cancel the request |
1223 | 1223 | db_set_active('boinc_rw'); |
1224 | 1224 | db_query(" |
@@ -1231,14 +1231,14 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | else { |
1233 | 1233 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1234 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1234 | + $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), null, 'boinc:team-request-foundership-response') |
|
1235 | 1235 | . '</h2>'; |
1236 | 1236 | $output .= '<p>' . bts('Team member @name has requested team foundership.' |
1237 | 1237 | . ' This may be because you left the team or have not had contact with' |
1238 | 1238 | . ' the team for a long time.', array( |
1239 | 1239 | '@name' => $member->boincuser_name, |
1240 | 1240 | ) |
1241 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1241 | + , array(), null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | 1242 | $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
1243 | 1243 | . ' will have the option of assuming team foundership. (note: To' |
1244 | 1244 | . ' accept the request, assign foundership to @name using the form' |
@@ -1247,10 +1247,10 @@ discard block |
||
1247 | 1247 | '@name' => $member->boincuser_name, |
1248 | 1248 | '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
1249 | 1249 | ), |
1250 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1250 | + null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1251 | 1251 | $output .= '<ul class="tab-list">'; |
1252 | 1252 | $output .= ' <li class="first last tab">' . |
1253 | - l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1253 | + l(bts('Deny request', array(), null, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1254 | 1254 | $output .= '</ul>'; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | function boincteam_search_panel() { |
1261 | 1261 | $output = ''; |
1262 | 1262 | if (module_exists('global_search_teams_solr')) { |
1263 | - $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
|
1263 | + $output .= '<h2 class="pane-title">' . bts('Search teams', array(), null, 'boinc:search-team') . '</h2>'; |
|
1264 | 1264 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1265 | 1265 | $output .= '<p>' . boincteam_search_view() . '</p>'; |
1266 | 1266 | } |
@@ -1280,18 +1280,18 @@ discard block |
||
1280 | 1280 | function boincteam_topic_overview_panel() { |
1281 | 1281 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1282 | 1282 | $output = ''; |
1283 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1283 | + $output .= '<h2 class="pane-title">' . bts('Teams', array(), null, 'boinc:team-general-info') . '</h2>'; |
|
1284 | 1284 | $output .= '<div class="">'; |
1285 | 1285 | $output .= '<p>' . bts('@project participants may form teams. You may belong' |
1286 | 1286 | . ' to only one team. You can join or quit a team at any time. To join a' |
1287 | 1287 | . ' team, visit its team page and click "Join this team". Each team has a' |
1288 | - . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
|
1288 | + . ' founder who may:', array('@project' => $site_name), null, 'boinc:team-general-info') . '</p>'; |
|
1289 | 1289 | $output .= '<ul>'; |
1290 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1290 | + $output .= ' <li>' . bts('Private Message all team members', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1291 | + $output .= ' <li>' . bts("edit the team's name and description", array(), null, 'boinc:team-general-info') . '</li>'; |
|
1292 | + $output .= ' <li>' . bts('add or remove team admins', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1293 | + $output .= ' <li>' . bts('remove members from the team', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1294 | + $output .= ' <li>' . bts('disband a team if it has no members', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1295 | 1295 | $output .= '</ul>'; |
1296 | 1296 | $output .= '</div>'; |
1297 | 1297 | return $output; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | if ($team->type != "team") { |
1327 | 1327 | return; |
1328 | 1328 | } |
1329 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1329 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), true); |
|
1330 | 1330 | $founder = user_load(get_drupal_id($boincteam->userid)); |
1331 | 1331 | $new_members = array(); |
1332 | 1332 | if ($boincteam->new_members) { |
@@ -1340,30 +1340,30 @@ discard block |
||
1340 | 1340 | $output .= '<div>'; |
1341 | 1341 | $output .= '<div class="left-column">'; |
1342 | 1342 | $output .= '<ul class="stats">'; |
1343 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1343 | + $output .= ' <li>' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | + $output .= ' <li>' . bts('Recent average credit', array(), null, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | + $output .= ' <li>' . bts('Country', array(), null, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | + $output .= ' <li>' . bts('Type', array(), null, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1347 | 1347 | $output .= '</ul>'; |
1348 | 1348 | $output .= '</div>'; |
1349 | 1349 | $output .= '<div class="right-column">'; |
1350 | 1350 | $output .= '<ul class="stats">'; |
1351 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1351 | + $output .= ' <li>' . bts('Founder', array(), null, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | + $output .= ' <li>' . bts('New members in last day', array(), null, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | + $output .= ' <li>' . bts('Total members', array(), null, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | + $output .= ' <li>' . bts('Active members', array(), null, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | + $output .= ' <li>' . bts('Members with credit', array(), null, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1356 | 1356 | $output .= '</ul>'; |
1357 | 1357 | $output .= '</div>'; |
1358 | 1358 | $output .= '</div>'; |
1359 | 1359 | $output .= '<div class="clearfix"></div>'; |
1360 | 1360 | if ($boincteam->url) { |
1361 | 1361 | $output .= '<div class="stats">'; |
1362 | - $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1362 | + $output .= bts('Website', array(), null, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1363 | 1363 | $output .= '</div>'; |
1364 | 1364 | } |
1365 | 1365 | if ($team->body) { |
1366 | - $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
|
1366 | + $output .= '<h3>' . bts('Description', array(), null, 'boinc:team-description') . '</h3>'; |
|
1367 | 1367 | $output .= check_markup($team->body, $team->format); |
1368 | 1368 | $output .= '</div>'; |
1369 | 1369 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // |
47 | 47 | function client_info_to_platform($client_info) { |
48 | 48 | if (strstr($client_info, 'Windows')) { |
49 | - if (strstr($client_info, 'Win64')||strstr($client_info, 'WOW64')) { |
|
49 | + if (strstr($client_info, 'Win64') || strstr($client_info, 'WOW64')) { |
|
50 | 50 | return 'windows_x86_64'; |
51 | 51 | } else { |
52 | 52 | return 'windows_intelx86'; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | function download_button_vbox($v, $project_id, $token, $user) { |
123 | 123 | // if no vbox version exists for platform, don't show vbox button |
124 | - if(!$v->vbox_filename) { |
|
124 | + if (!$v->vbox_filename) { |
|
125 | 125 | return; |
126 | 126 | } |
127 | 127 | return sprintf( |
@@ -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), |