@@ -27,295 +27,295 @@ discard block |
||
27 | 27 | * with defined URL paths |
28 | 28 | */ |
29 | 29 | function boincuser_menu() { |
30 | - $items['account/posts'] = array( |
|
31 | - 'title' => 'Recent posts', |
|
32 | - 'description' => '', |
|
33 | - 'page callback' => 'boincuser_goto_recent_posts', |
|
34 | - 'access callback' => 'user_is_logged_in', |
|
35 | - 'type' => MENU_CALLBACK, |
|
36 | - ); |
|
37 | - $items['account/profile'] = array( |
|
38 | - 'title' => '', |
|
39 | - 'description' => '', |
|
40 | - 'page callback' => 'boincuser_view_profile', |
|
41 | - 'access callback' => 'user_is_logged_in', |
|
42 | - 'type' => MENU_NORMAL_ITEM |
|
43 | - ); |
|
44 | - $items['account/profile/view'] = array( |
|
45 | - 'title' => 'View', |
|
46 | - 'description' => 'Show a user profile', |
|
47 | - 'page callback' => 'boincuser_view_profile', |
|
48 | - 'access callback' => 'user_is_logged_in', |
|
49 | - 'type' => MENU_DEFAULT_LOCAL_TASK, |
|
50 | - 'weight' => 0 |
|
51 | - ); |
|
52 | - $items['account/profile/edit'] = array( |
|
53 | - 'title' => 'Edit', |
|
54 | - 'description' => 'Edit a user profile', |
|
55 | - 'page callback' => 'boincuser_edit_profile', |
|
56 | - 'access arguments' => array('edit own profile content'), |
|
57 | - 'type' => MENU_LOCAL_TASK, |
|
58 | - 'weight' => 5 |
|
59 | - ); |
|
60 | - $items['account/team'] = array( |
|
61 | - 'title' => 'User team', |
|
62 | - 'description' => '', |
|
63 | - 'page callback' => 'boincuser_goto_team', |
|
64 | - 'access callback' => 'user_is_logged_in', |
|
65 | - 'type' => MENU_CALLBACK, |
|
66 | - ); |
|
67 | - $items['moderate/profile/%user/approve'] = array( |
|
68 | - 'title' => 'Profile approval', |
|
69 | - 'description' => 'Approve profile content', |
|
70 | - 'page callback' => 'boincuser_moderate_profile_approve', |
|
71 | - 'page arguments' => array(2), |
|
72 | - 'access arguments' => array('edit any profile content'), |
|
73 | - 'type' => MENU_CALLBACK, |
|
74 | - 'weight' => 5 |
|
75 | - ); |
|
76 | - $items['moderate/profile/%user/edit'] = array( |
|
77 | - 'title' => 'Profile editor', |
|
78 | - 'description' => 'Edit a user profile', |
|
79 | - 'page callback' => 'boincuser_edit_profile', |
|
80 | - 'page arguments' => array(2), |
|
81 | - 'access arguments' => array('edit any profile content'), |
|
82 | - 'type' => MENU_CALLBACK, |
|
83 | - 'weight' => 5 |
|
84 | - ); |
|
85 | - $items['moderate/profile/%/reject'] = array( |
|
86 | - 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
|
87 | - 'description' => 'Reject profile content', |
|
88 | - 'page callback' => 'drupal_get_form', |
|
89 | - 'page arguments' => array('boincuser_moderate_profile_reject_form', 2), |
|
90 | - 'access arguments' => array('edit any profile content'), |
|
91 | - 'type' => MENU_CALLBACK, |
|
92 | - 'weight' => 5 |
|
93 | - ); |
|
94 | - $items['moderate/user/%/ban'] = array( |
|
95 | - 'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), |
|
96 | - 'description' => 'Ban a user from using community features', |
|
97 | - 'page callback' => 'drupal_get_form', |
|
98 | - 'page arguments' => array('boincuser_moderate_user_ban_form', 2), |
|
99 | - 'access callback' => 'boincuser_moderate_community_access', |
|
100 | - 'type' => MENU_CALLBACK, |
|
101 | - ); |
|
102 | - $items['join'] = array( |
|
103 | - 'title' => '', |
|
104 | - 'description' => '', |
|
105 | - 'page callback' => 'join_page', |
|
106 | - 'access arguments' => array('access content'), |
|
107 | - 'type' => MENU_NORMAL_ITEM |
|
108 | - ); |
|
109 | - $items['join/new'] = array( |
|
110 | - 'title' => bts("I'm new"), |
|
111 | - 'page callback' => 'join_page', |
|
112 | - 'page arguments' => array(1), |
|
113 | - 'access arguments' => array('access content'), |
|
114 | - 'type' => MENU_DEFAULT_LOCAL_TASK, |
|
115 | - 'weight' => 0 |
|
116 | - ); |
|
117 | - $items['join/boinc'] = array( |
|
118 | - 'title' => bts("I'm a BOINC user"), |
|
119 | - 'page callback' => 'join_page', |
|
120 | - 'page arguments' => array(1), |
|
121 | - 'access arguments' => array('access content'), |
|
122 | - 'type' => MENU_LOCAL_TASK, |
|
123 | - 'weight' => 5 |
|
124 | - ); |
|
125 | - $items['user/login/auth'] = array( |
|
126 | - 'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), |
|
127 | - 'description' => 'Log in using a user authenticator', |
|
128 | - 'page callback' => 'drupal_get_form', |
|
129 | - 'page arguments' => array('boincuser_authloginform'), |
|
130 | - 'access arguments' => array('access content'), |
|
131 | - 'type' => MENU_CALLBACK, |
|
132 | - ); |
|
133 | - $items['user/termsofuse'] = array( |
|
134 | - 'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), |
|
135 | - 'description' => 'A site\'s term of use.', |
|
136 | - 'page callback' => 'drupal_get_form', |
|
137 | - 'page arguments' => array('boincuser_termsofuse_form'), |
|
138 | - 'access callback' => 'user_is_logged_in', |
|
139 | - 'type' => MENU_CALLBACK, |
|
140 | - ); |
|
141 | - $items['user_control'] = array( |
|
142 | - 'page callback' => 'boincuser_control', |
|
143 | - 'access arguments' => array('access user profiles'), |
|
144 | - 'type' => MENU_CALLBACK |
|
145 | - ); |
|
146 | - $items['admin/boinc'] = array( |
|
147 | - 'title' => 'BOINC configuration', |
|
148 | - 'position' => 'right', |
|
149 | - 'weight' => -8, |
|
150 | - 'page callback' => 'system_admin_menu_block_page', |
|
151 | - 'access arguments' => array('administer site configuration'), |
|
152 | - 'file' => 'system.admin.inc', |
|
153 | - 'file path' => drupal_get_path('module', 'system'), |
|
154 | - ); |
|
155 | - $items['admin/boinc/environment'] = array( |
|
156 | - 'title' => 'Environment: General', |
|
157 | - 'description' => 'Set paths to BOINC functions and any other necessary |
|
30 | +$items['account/posts'] = array( |
|
31 | +'title' => 'Recent posts', |
|
32 | +'description' => '', |
|
33 | +'page callback' => 'boincuser_goto_recent_posts', |
|
34 | +'access callback' => 'user_is_logged_in', |
|
35 | +'type' => MENU_CALLBACK, |
|
36 | +); |
|
37 | +$items['account/profile'] = array( |
|
38 | +'title' => '', |
|
39 | +'description' => '', |
|
40 | +'page callback' => 'boincuser_view_profile', |
|
41 | +'access callback' => 'user_is_logged_in', |
|
42 | +'type' => MENU_NORMAL_ITEM |
|
43 | +); |
|
44 | +$items['account/profile/view'] = array( |
|
45 | +'title' => 'View', |
|
46 | +'description' => 'Show a user profile', |
|
47 | +'page callback' => 'boincuser_view_profile', |
|
48 | +'access callback' => 'user_is_logged_in', |
|
49 | +'type' => MENU_DEFAULT_LOCAL_TASK, |
|
50 | +'weight' => 0 |
|
51 | +); |
|
52 | +$items['account/profile/edit'] = array( |
|
53 | +'title' => 'Edit', |
|
54 | +'description' => 'Edit a user profile', |
|
55 | +'page callback' => 'boincuser_edit_profile', |
|
56 | +'access arguments' => array('edit own profile content'), |
|
57 | +'type' => MENU_LOCAL_TASK, |
|
58 | +'weight' => 5 |
|
59 | +); |
|
60 | +$items['account/team'] = array( |
|
61 | +'title' => 'User team', |
|
62 | +'description' => '', |
|
63 | +'page callback' => 'boincuser_goto_team', |
|
64 | +'access callback' => 'user_is_logged_in', |
|
65 | +'type' => MENU_CALLBACK, |
|
66 | +); |
|
67 | +$items['moderate/profile/%user/approve'] = array( |
|
68 | +'title' => 'Profile approval', |
|
69 | +'description' => 'Approve profile content', |
|
70 | +'page callback' => 'boincuser_moderate_profile_approve', |
|
71 | +'page arguments' => array(2), |
|
72 | +'access arguments' => array('edit any profile content'), |
|
73 | +'type' => MENU_CALLBACK, |
|
74 | +'weight' => 5 |
|
75 | +); |
|
76 | +$items['moderate/profile/%user/edit'] = array( |
|
77 | +'title' => 'Profile editor', |
|
78 | +'description' => 'Edit a user profile', |
|
79 | +'page callback' => 'boincuser_edit_profile', |
|
80 | +'page arguments' => array(2), |
|
81 | +'access arguments' => array('edit any profile content'), |
|
82 | +'type' => MENU_CALLBACK, |
|
83 | +'weight' => 5 |
|
84 | +); |
|
85 | +$items['moderate/profile/%/reject'] = array( |
|
86 | +'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
|
87 | +'description' => 'Reject profile content', |
|
88 | +'page callback' => 'drupal_get_form', |
|
89 | +'page arguments' => array('boincuser_moderate_profile_reject_form', 2), |
|
90 | +'access arguments' => array('edit any profile content'), |
|
91 | +'type' => MENU_CALLBACK, |
|
92 | +'weight' => 5 |
|
93 | +); |
|
94 | +$items['moderate/user/%/ban'] = array( |
|
95 | +'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), |
|
96 | +'description' => 'Ban a user from using community features', |
|
97 | +'page callback' => 'drupal_get_form', |
|
98 | +'page arguments' => array('boincuser_moderate_user_ban_form', 2), |
|
99 | +'access callback' => 'boincuser_moderate_community_access', |
|
100 | +'type' => MENU_CALLBACK, |
|
101 | +); |
|
102 | +$items['join'] = array( |
|
103 | +'title' => '', |
|
104 | +'description' => '', |
|
105 | +'page callback' => 'join_page', |
|
106 | +'access arguments' => array('access content'), |
|
107 | +'type' => MENU_NORMAL_ITEM |
|
108 | +); |
|
109 | +$items['join/new'] = array( |
|
110 | +'title' => bts("I'm new"), |
|
111 | +'page callback' => 'join_page', |
|
112 | +'page arguments' => array(1), |
|
113 | +'access arguments' => array('access content'), |
|
114 | +'type' => MENU_DEFAULT_LOCAL_TASK, |
|
115 | +'weight' => 0 |
|
116 | +); |
|
117 | +$items['join/boinc'] = array( |
|
118 | +'title' => bts("I'm a BOINC user"), |
|
119 | +'page callback' => 'join_page', |
|
120 | +'page arguments' => array(1), |
|
121 | +'access arguments' => array('access content'), |
|
122 | +'type' => MENU_LOCAL_TASK, |
|
123 | +'weight' => 5 |
|
124 | +); |
|
125 | +$items['user/login/auth'] = array( |
|
126 | +'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), |
|
127 | +'description' => 'Log in using a user authenticator', |
|
128 | +'page callback' => 'drupal_get_form', |
|
129 | +'page arguments' => array('boincuser_authloginform'), |
|
130 | +'access arguments' => array('access content'), |
|
131 | +'type' => MENU_CALLBACK, |
|
132 | +); |
|
133 | +$items['user/termsofuse'] = array( |
|
134 | +'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), |
|
135 | +'description' => 'A site\'s term of use.', |
|
136 | +'page callback' => 'drupal_get_form', |
|
137 | +'page arguments' => array('boincuser_termsofuse_form'), |
|
138 | +'access callback' => 'user_is_logged_in', |
|
139 | +'type' => MENU_CALLBACK, |
|
140 | +); |
|
141 | +$items['user_control'] = array( |
|
142 | +'page callback' => 'boincuser_control', |
|
143 | +'access arguments' => array('access user profiles'), |
|
144 | +'type' => MENU_CALLBACK |
|
145 | +); |
|
146 | +$items['admin/boinc'] = array( |
|
147 | +'title' => 'BOINC configuration', |
|
148 | +'position' => 'right', |
|
149 | +'weight' => -8, |
|
150 | +'page callback' => 'system_admin_menu_block_page', |
|
151 | +'access arguments' => array('administer site configuration'), |
|
152 | +'file' => 'system.admin.inc', |
|
153 | +'file path' => drupal_get_path('module', 'system'), |
|
154 | +); |
|
155 | +$items['admin/boinc/environment'] = array( |
|
156 | +'title' => 'Environment: General', |
|
157 | +'description' => 'Set paths to BOINC functions and any other necessary |
|
158 | 158 | variables that establish a BOINC environment.', |
159 | - 'page callback' => 'drupal_get_form', |
|
160 | - 'page arguments' => array('boincuser_admin_environment'), |
|
161 | - 'access arguments' => array('administer site configuration'), |
|
162 | - 'type' => MENU_NORMAL_ITEM, |
|
163 | - 'file' => 'boincuser.admin.inc' |
|
164 | - ); |
|
165 | - $items['admin/boinc/scheduler'] = array( |
|
166 | - 'title' => 'Environment: Scheduling server URLs', |
|
167 | - 'description' => 'Set BOINC scheduler options.', |
|
168 | - 'page callback' => 'drupal_get_form', |
|
169 | - 'page arguments' => array('boincuser_admin_scheduler'), |
|
170 | - 'access arguments' => array('administer site configuration'), |
|
171 | - 'type' => MENU_NORMAL_ITEM, |
|
172 | - 'file' => 'boincuser.admin.inc' |
|
173 | - ); |
|
174 | - $items['admin/boinc/weboptions'] = array( |
|
175 | - 'title' => 'Environment: Website Options', |
|
176 | - 'description' => 'Set options configuring this Drupal-BOINC Web site.', |
|
177 | - 'page callback' => 'drupal_get_form', |
|
178 | - 'page arguments' => array('boincuser_admin_weboptions'), |
|
179 | - 'access arguments' => array('administer site configuration'), |
|
180 | - 'type' => MENU_NORMAL_ITEM, |
|
181 | - 'file' => 'boincuser.admin.inc' |
|
182 | - ); |
|
159 | +'page callback' => 'drupal_get_form', |
|
160 | +'page arguments' => array('boincuser_admin_environment'), |
|
161 | +'access arguments' => array('administer site configuration'), |
|
162 | +'type' => MENU_NORMAL_ITEM, |
|
163 | +'file' => 'boincuser.admin.inc' |
|
164 | +); |
|
165 | +$items['admin/boinc/scheduler'] = array( |
|
166 | +'title' => 'Environment: Scheduling server URLs', |
|
167 | +'description' => 'Set BOINC scheduler options.', |
|
168 | +'page callback' => 'drupal_get_form', |
|
169 | +'page arguments' => array('boincuser_admin_scheduler'), |
|
170 | +'access arguments' => array('administer site configuration'), |
|
171 | +'type' => MENU_NORMAL_ITEM, |
|
172 | +'file' => 'boincuser.admin.inc' |
|
173 | +); |
|
174 | +$items['admin/boinc/weboptions'] = array( |
|
175 | +'title' => 'Environment: Website Options', |
|
176 | +'description' => 'Set options configuring this Drupal-BOINC Web site.', |
|
177 | +'page callback' => 'drupal_get_form', |
|
178 | +'page arguments' => array('boincuser_admin_weboptions'), |
|
179 | +'access arguments' => array('administer site configuration'), |
|
180 | +'type' => MENU_NORMAL_ITEM, |
|
181 | +'file' => 'boincuser.admin.inc' |
|
182 | +); |
|
183 | 183 | |
184 | - $items['create_account.php'] = array( |
|
185 | - 'title' => 'Create Account RPC', |
|
186 | - 'description' => 'RPC for creating user accounts.', |
|
187 | - 'page callback' => 'boincuser_create_account', |
|
188 | - 'access callback' => TRUE, |
|
189 | - 'type' => MENU_CALLBACK |
|
190 | - ); |
|
191 | - $items['account_finish.php'] = array( |
|
192 | - 'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
|
193 | - 'description' => 'RPC for after a user has created an account.', |
|
194 | - 'page callback' => 'boincuser_account_finish', |
|
195 | - 'access callback' => TRUE, |
|
196 | - 'type' => MENU_CALLBACK, |
|
197 | - ); |
|
198 | - $items['boincuser/autocomplete'] = array( |
|
199 | - 'page callback' => '_boincuser_user_name_autocomplete', |
|
200 | - 'access callback' => TRUE, |
|
201 | - 'type' => MENU_CALLBACK, |
|
202 | - ); |
|
203 | - $items['user/%user/recoveremail/%'] = array( |
|
204 | - 'title' => t('Recover previous email'), |
|
205 | - 'description' => t('Form to revert email to previous address.'), |
|
206 | - 'page callback' => 'drupal_get_form', |
|
207 | - 'page arguments' => array('boincuser_revertemail', 3), |
|
208 | - 'access callback' => 'user_is_logged_in', |
|
209 | - 'type' => MENU_CALLBACK, |
|
210 | - ); |
|
211 | - $items['recover_email.php'] = array( |
|
212 | - 'title' => t('Recover previous email'), |
|
213 | - 'description' => t('redirect'), |
|
214 | - 'page callback' => '_boincuser_redirect_recover_email', |
|
215 | - 'access callback' => TRUE, |
|
216 | - 'type' => MENU_CALLBACK, |
|
217 | - ); |
|
218 | - return $items; |
|
184 | +$items['create_account.php'] = array( |
|
185 | +'title' => 'Create Account RPC', |
|
186 | +'description' => 'RPC for creating user accounts.', |
|
187 | +'page callback' => 'boincuser_create_account', |
|
188 | +'access callback' => TRUE, |
|
189 | +'type' => MENU_CALLBACK |
|
190 | +); |
|
191 | +$items['account_finish.php'] = array( |
|
192 | +'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
|
193 | +'description' => 'RPC for after a user has created an account.', |
|
194 | +'page callback' => 'boincuser_account_finish', |
|
195 | +'access callback' => TRUE, |
|
196 | +'type' => MENU_CALLBACK, |
|
197 | +); |
|
198 | +$items['boincuser/autocomplete'] = array( |
|
199 | +'page callback' => '_boincuser_user_name_autocomplete', |
|
200 | +'access callback' => TRUE, |
|
201 | +'type' => MENU_CALLBACK, |
|
202 | +); |
|
203 | +$items['user/%user/recoveremail/%'] = array( |
|
204 | +'title' => t('Recover previous email'), |
|
205 | +'description' => t('Form to revert email to previous address.'), |
|
206 | +'page callback' => 'drupal_get_form', |
|
207 | +'page arguments' => array('boincuser_revertemail', 3), |
|
208 | +'access callback' => 'user_is_logged_in', |
|
209 | +'type' => MENU_CALLBACK, |
|
210 | +); |
|
211 | +$items['recover_email.php'] = array( |
|
212 | +'title' => t('Recover previous email'), |
|
213 | +'description' => t('redirect'), |
|
214 | +'page callback' => '_boincuser_redirect_recover_email', |
|
215 | +'access callback' => TRUE, |
|
216 | +'type' => MENU_CALLBACK, |
|
217 | +); |
|
218 | +return $items; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Implementation of hook_init() |
223 | 223 | */ |
224 | 224 | function boincuser_init() { |
225 | - global $user; |
|
226 | - // Skip this check for charts, which are loaded separately |
|
227 | - // (may get duplicate or unexpected messages otherwise) |
|
228 | - if (substr($_GET['q'], 0, 7) == 'charts/') { |
|
229 | - return; |
|
230 | - } |
|
225 | +global $user; |
|
226 | +// Skip this check for charts, which are loaded separately |
|
227 | +// (may get duplicate or unexpected messages otherwise) |
|
228 | +if (substr($_GET['q'], 0, 7) == 'charts/') { |
|
229 | +return; |
|
230 | +} |
|
231 | 231 | |
232 | - // If admin user, do some basic site functionality checks |
|
233 | - if (user_access('administer site configuration')) { |
|
234 | - // Ensure we have a configured BOINC environment |
|
235 | - boinc_get_path(); |
|
236 | - boinc_get_scheduler_tags(); |
|
237 | - } |
|
232 | +// If admin user, do some basic site functionality checks |
|
233 | +if (user_access('administer site configuration')) { |
|
234 | +// Ensure we have a configured BOINC environment |
|
235 | +boinc_get_path(); |
|
236 | +boinc_get_scheduler_tags(); |
|
237 | +} |
|
238 | 238 | |
239 | - // Check credits for the verified contributor role |
|
240 | - boincuser_check_credit_requirements(); |
|
239 | +// Check credits for the verified contributor role |
|
240 | +boincuser_check_credit_requirements(); |
|
241 | 241 | |
242 | - if (module_exists('boincteam')) { |
|
243 | - // Display any persistent team messages |
|
244 | - boincteam_show_messages(); |
|
245 | - } |
|
242 | +if (module_exists('boincteam')) { |
|
243 | +// Display any persistent team messages |
|
244 | +boincteam_show_messages(); |
|
245 | +} |
|
246 | 246 | |
247 | - // Check if user has agreed to the terms of use. If not, send the |
|
248 | - // user to the terms-of-use form. This is only makes sense if the |
|
249 | - // termsofuse is enabled, by having text in the termsofuse variable. |
|
250 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
251 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
252 | - if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
253 | - if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
|
254 | - |
|
255 | - // Admins are exempt, otherwise the admin may not be able to |
|
256 | - // access the site! |
|
257 | - $administrator_role = array_search('administrator', user_roles(true)); |
|
258 | - if (!isset($user->roles[$administrator_role])) { |
|
259 | - $path = drupal_get_path_alias($_GET['q']); |
|
260 | - |
|
261 | - // Any paths that should NOT be redirected go here. |
|
262 | - // The site will not function correctly if these are not exempt! |
|
263 | - $paths0 = array( |
|
264 | - 'user/termsofuse', |
|
265 | - 'logout', |
|
266 | - 'account/info/edit', |
|
267 | - 'user/' . $user->uid . '/edit', |
|
268 | - 'user/' . $user->uid . '/recoveremail/*', |
|
269 | - 'recover_email.php', |
|
270 | - ); |
|
271 | - if (module_exists('boincuser_delete')) { |
|
272 | - $paths0[] = 'user/' . $user->uid . '/delete'; |
|
273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
275 | - } |
|
247 | +// Check if user has agreed to the terms of use. If not, send the |
|
248 | +// user to the terms-of-use form. This is only makes sense if the |
|
249 | +// termsofuse is enabled, by having text in the termsofuse variable. |
|
250 | +$existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
251 | +$termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
252 | +if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
253 | +if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
|
254 | + |
|
255 | + // Admins are exempt, otherwise the admin may not be able to |
|
256 | + // access the site! |
|
257 | + $administrator_role = array_search('administrator', user_roles(true)); |
|
258 | + if (!isset($user->roles[$administrator_role])) { |
|
259 | + $path = drupal_get_path_alias($_GET['q']); |
|
260 | + |
|
261 | + // Any paths that should NOT be redirected go here. |
|
262 | + // The site will not function correctly if these are not exempt! |
|
263 | + $paths0 = array( |
|
264 | + 'user/termsofuse', |
|
265 | + 'logout', |
|
266 | + 'account/info/edit', |
|
267 | + 'user/' . $user->uid . '/edit', |
|
268 | + 'user/' . $user->uid . '/recoveremail/*', |
|
269 | + 'recover_email.php', |
|
270 | + ); |
|
271 | + if (module_exists('boincuser_delete')) { |
|
272 | + $paths0[] = 'user/' . $user->uid . '/delete'; |
|
273 | + $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
274 | + $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
275 | + } |
|
276 | 276 | |
277 | - // Paths added by the admin |
|
278 | - $paths1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_pathstoignore', "moderation\ncontent/moderation\nprivacy")); |
|
279 | - $paths2 = array(); |
|
280 | - if (is_array($paths1)) { |
|
281 | - $paths2 = array_map('strtolower', $paths1); |
|
282 | - } |
|
277 | + // Paths added by the admin |
|
278 | + $paths1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_pathstoignore', "moderation\ncontent/moderation\nprivacy")); |
|
279 | + $paths2 = array(); |
|
280 | + if (is_array($paths1)) { |
|
281 | + $paths2 = array_map('strtolower', $paths1); |
|
282 | + } |
|
283 | 283 | |
284 | - // paths to ignore |
|
285 | - $paths_to_ignore = array_unique( array_merge($paths0, $paths2) ); |
|
284 | + // paths to ignore |
|
285 | + $paths_to_ignore = array_unique( array_merge($paths0, $paths2) ); |
|
286 | 286 | |
287 | - if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { |
|
288 | - drupal_goto('user/termsofuse'); |
|
289 | - } |
|
290 | - } |
|
287 | + if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { |
|
288 | + drupal_goto('user/termsofuse'); |
|
291 | 289 | } |
292 | 290 | } |
293 | 291 | } |
292 | +} |
|
293 | +} |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Implementation of hook_user(); add custom actions to standard |
297 | 297 | * Drupal user operations |
298 | 298 | */ |
299 | 299 | function boincuser_user($op, &$edit, &$account, $category = NULL) { |
300 | - require_boinc('boinc_db'); |
|
301 | - require_boinc('user'); |
|
302 | - require_boinc('xml'); |
|
303 | - |
|
304 | - require_boinc('password_compat/password'); |
|
305 | - // Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
|
306 | - if (isset($account->uid) && ($account->uid > 1)) { |
|
307 | - switch($op) { |
|
308 | - case 'load': |
|
309 | - // User loading; insert BOINC data into the user object |
|
310 | - $drupal_user = db_fetch_object(db_query(" |
|
300 | +require_boinc('boinc_db'); |
|
301 | +require_boinc('user'); |
|
302 | +require_boinc('xml'); |
|
303 | + |
|
304 | +require_boinc('password_compat/password'); |
|
305 | +// Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
|
306 | +if (isset($account->uid) && ($account->uid > 1)) { |
|
307 | +switch($op) { |
|
308 | +case 'load': |
|
309 | +// User loading; insert BOINC data into the user object |
|
310 | +$drupal_user = db_fetch_object(db_query(" |
|
311 | 311 | SELECT boinc_id, penalty_expiration |
312 | 312 | FROM {boincuser} WHERE uid = %d", |
313 | - $account->uid |
|
314 | - )); |
|
315 | - $account->boincuser_id = $drupal_user->boinc_id; |
|
316 | - $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration; |
|
317 | - db_set_active('boinc_rw'); |
|
318 | - $boinc_user = db_fetch_object(db_query(" |
|
313 | +$account->uid |
|
314 | +)); |
|
315 | +$account->boincuser_id = $drupal_user->boinc_id; |
|
316 | +$account->boincuser_penalty_expiration = $drupal_user->penalty_expiration; |
|
317 | +db_set_active('boinc_rw'); |
|
318 | +$boinc_user = db_fetch_object(db_query(" |
|
319 | 319 | SELECT |
320 | 320 | name, |
321 | 321 | authenticator, |
@@ -330,30 +330,30 @@ discard block |
||
330 | 330 | email_addr_change_time |
331 | 331 | FROM {user} |
332 | 332 | WHERE id = %d", |
333 | - $account->boincuser_id |
|
334 | - )); |
|
335 | - $account->boincuser_name = $boinc_user->name; |
|
336 | - $account->boincuser_account_key = $boinc_user->authenticator; |
|
337 | - $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
338 | - $account->boincuser_total_credit = round($boinc_user->total_credit); |
|
339 | - $account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
|
340 | - $account->boincuser_expavg_time = round($boinc_user->expavg_time); |
|
341 | - $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
342 | - $account->boincuser_default_pref_set = $boinc_user->venue; |
|
343 | - $account->boincteam_id = $boinc_user->teamid; |
|
344 | - $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
|
345 | - $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time; |
|
346 | - db_set_active('default'); |
|
347 | - // Set Drupal team ID |
|
348 | - $account->team = NULL; |
|
349 | - if ($account->boincteam_id) { |
|
350 | - $account->team = db_result(db_query(" |
|
333 | +$account->boincuser_id |
|
334 | +)); |
|
335 | +$account->boincuser_name = $boinc_user->name; |
|
336 | +$account->boincuser_account_key = $boinc_user->authenticator; |
|
337 | +$account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
338 | +$account->boincuser_total_credit = round($boinc_user->total_credit); |
|
339 | +$account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
|
340 | +$account->boincuser_expavg_time = round($boinc_user->expavg_time); |
|
341 | +$account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
342 | +$account->boincuser_default_pref_set = $boinc_user->venue; |
|
343 | +$account->boincteam_id = $boinc_user->teamid; |
|
344 | +$account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
|
345 | +$account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time; |
|
346 | +db_set_active('default'); |
|
347 | +// Set Drupal team ID |
|
348 | +$account->team = NULL; |
|
349 | +if ($account->boincteam_id) { |
|
350 | +$account->team = db_result(db_query(" |
|
351 | 351 | SELECT nid FROM {boincteam} WHERE team_id = %d", |
352 | - $account->boincteam_id |
|
353 | - )); |
|
354 | - } |
|
355 | - // Set post count |
|
356 | - $account->post_count = db_result(db_query(" |
|
352 | +$account->boincteam_id |
|
353 | +)); |
|
354 | +} |
|
355 | +// Set post count |
|
356 | +$account->post_count = db_result(db_query(" |
|
357 | 357 | SELECT COUNT(*) + |
358 | 358 | ( |
359 | 359 | SELECT COUNT(*) FROM {node} |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | INNER JOIN node ON comments.nid = node.nid |
366 | 366 | WHERE comments.uid = '%d' |
367 | 367 | AND node.status = 1", |
368 | - $account->uid, $account->uid |
|
369 | - )); |
|
370 | - break; |
|
368 | +$account->uid, $account->uid |
|
369 | +)); |
|
370 | +break; |
|
371 | 371 | |
372 | - case 'view': |
|
373 | - // SAMPLE: Add BOINC data to the user profile |
|
374 | - /*$account->content['summary']['boinc_id'] = array( |
|
372 | +case 'view': |
|
373 | +// SAMPLE: Add BOINC data to the user profile |
|
374 | +/*$account->content['summary']['boinc_id'] = array( |
|
375 | 375 | '#type' => 'user_profile_item', |
376 | 376 | '#title' => bts('BIONC ID'), |
377 | 377 | '#value' => $account->boincuser_id, |
@@ -385,174 +385,174 @@ discard block |
||
385 | 385 | '#attributes' => array('class' => 'boinc-data'), |
386 | 386 | '#weight' => 10 |
387 | 387 | );*/ |
388 | - break; |
|
388 | +break; |
|
389 | 389 | |
390 | - case 'validate': |
|
391 | - if (isset($edit['validation_source'])) { |
|
392 | - switch ($edit['validation_source']) { |
|
393 | - case 'user_account': |
|
394 | - // Validate data before updating user account info |
|
395 | - boincuser_account_validate($edit, $account); |
|
396 | - break; |
|
390 | +case 'validate': |
|
391 | +if (isset($edit['validation_source'])) { |
|
392 | +switch ($edit['validation_source']) { |
|
393 | +case 'user_account': |
|
394 | +// Validate data before updating user account info |
|
395 | +boincuser_account_validate($edit, $account); |
|
396 | +break; |
|
397 | 397 | |
398 | - default: |
|
398 | +default: |
|
399 | 399 | |
400 | - } |
|
401 | - // We don't want to save validation source, so remove it |
|
402 | - $edit['validation_source'] = null; |
|
403 | - } |
|
404 | - break; |
|
400 | +} |
|
401 | + // We don't want to save validation source, so remove it |
|
402 | + $edit['validation_source'] = null; |
|
403 | + } |
|
404 | + break; |
|
405 | 405 | |
406 | - case 'insert': |
|
407 | - // New user being added to the system |
|
408 | - $imported = $_SESSION['importedUser']; |
|
409 | - unset($_SESSION['importedUser']); |
|
406 | +case 'insert': |
|
407 | + // New user being added to the system |
|
408 | + $imported = $_SESSION['importedUser']; |
|
409 | + unset($_SESSION['importedUser']); |
|
410 | 410 | |
411 | - watchdog( |
|
412 | - 'boincuser', |
|
413 | - 'Creating user account for %email_addr', |
|
414 | - array('%email_addr' => $edit['mail']), |
|
415 | - WATCHDOG_NOTICE |
|
416 | - ); |
|
411 | + watchdog( |
|
412 | + 'boincuser', |
|
413 | + 'Creating user account for %email_addr', |
|
414 | + array('%email_addr' => $edit['mail']), |
|
415 | + WATCHDOG_NOTICE |
|
416 | + ); |
|
417 | 417 | |
418 | - // The create_acount RPC will call this block of code when |
|
419 | - // user_save() is used. If user is registering using the Web |
|
420 | - // registration form, create a BOINC user and relationships. |
|
421 | - // Create a BOINC account unless importing from BOINC. |
|
422 | - if (!$imported) { |
|
418 | + // The create_acount RPC will call this block of code when |
|
419 | + // user_save() is used. If user is registering using the Web |
|
420 | + // registration form, create a BOINC user and relationships. |
|
421 | + // Create a BOINC account unless importing from BOINC. |
|
422 | + if (!$imported) { |
|
423 | 423 | |
424 | - // set email address lower-case |
|
425 | - $lower_email_addr = strtolower($edit['mail']); |
|
424 | + // set email address lower-case |
|
425 | + $lower_email_addr = strtolower($edit['mail']); |
|
426 | 426 | |
427 | - if ($edit['boincuser_name']) { |
|
428 | - $myname = $edit['boincuser_name']; |
|
429 | - } |
|
430 | - else if ($edit['name']) { |
|
431 | - $myname = $edit['name']; |
|
432 | - } |
|
433 | - else { |
|
434 | - $myname = 'noname'; |
|
435 | - } |
|
427 | + if ($edit['boincuser_name']) { |
|
428 | + $myname = $edit['boincuser_name']; |
|
429 | + } |
|
430 | + else if ($edit['name']) { |
|
431 | + $myname = $edit['name']; |
|
432 | + } |
|
433 | + else { |
|
434 | + $myname = 'noname'; |
|
435 | + } |
|
436 | 436 | |
437 | - $user_params = array( |
|
438 | - 'email_addr' => $lower_email_addr, |
|
439 | - 'name' => $myname, |
|
440 | - ); |
|
437 | + $user_params = array( |
|
438 | + 'email_addr' => $lower_email_addr, |
|
439 | + 'name' => $myname, |
|
440 | + ); |
|
441 | 441 | |
442 | - // If the 'pass' variable is already a hash, then don't hash it again. |
|
443 | - if ($edit['boinchash_flag']) { |
|
444 | - $user_params['passwd_hash'] = $edit['pass']; |
|
445 | - } |
|
446 | - else { |
|
447 | - // The passwd_hash here is only the md5() hash. This is |
|
448 | - // because BOINC make_user(), called later, will run |
|
449 | - // password_hash() on this md5 hash. |
|
450 | - $user_params['passwd_hash'] = md5($edit['pass'].$lower_email_addr); |
|
451 | - } |
|
442 | + // If the 'pass' variable is already a hash, then don't hash it again. |
|
443 | + if ($edit['boinchash_flag']) { |
|
444 | + $user_params['passwd_hash'] = $edit['pass']; |
|
445 | + } |
|
446 | + else { |
|
447 | + // The passwd_hash here is only the md5() hash. This is |
|
448 | + // because BOINC make_user(), called later, will run |
|
449 | + // password_hash() on this md5 hash. |
|
450 | + $user_params['passwd_hash'] = md5($edit['pass'].$lower_email_addr); |
|
451 | + } |
|
452 | 452 | |
453 | - $boinc_user = boincuser_register_make_user($user_params); |
|
454 | - if (!$boinc_user) { |
|
455 | - // Account exists with this email addr |
|
456 | - form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); |
|
457 | - return; |
|
458 | - } |
|
453 | + $boinc_user = boincuser_register_make_user($user_params); |
|
454 | + if (!$boinc_user) { |
|
455 | + // Account exists with this email addr |
|
456 | + form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); |
|
457 | + return; |
|
458 | + } |
|
459 | 459 | |
460 | - // Add user to community role by default (not banned) |
|
461 | - $unrestricted_role = array_search('community member', user_roles(true)); |
|
462 | - $edit['roles'] = array( |
|
463 | - $unrestricted_role => '' |
|
464 | - ); |
|
460 | + // Add user to community role by default (not banned) |
|
461 | + $unrestricted_role = array_search('community member', user_roles(true)); |
|
462 | + $edit['roles'] = array( |
|
463 | + $unrestricted_role => '' |
|
464 | + ); |
|
465 | 465 | |
466 | - // Disable show_hosts flag, set to TRUE by default |
|
467 | - db_set_active('boinc_rw'); |
|
468 | - db_query("UPDATE {user} SET show_hosts=0 WHERE id='%d'", $boinc_user->id); |
|
469 | - db_set_active('default'); |
|
466 | + // Disable show_hosts flag, set to TRUE by default |
|
467 | + db_set_active('boinc_rw'); |
|
468 | + db_query("UPDATE {user} SET show_hosts=0 WHERE id='%d'", $boinc_user->id); |
|
469 | + db_set_active('default'); |
|
470 | 470 | |
471 | - // Cross reference Drupal account with BOINC |
|
472 | - $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id); |
|
473 | - if (!$reference) { |
|
474 | - drupal_set_message(t('Error connecting BOINC account.'), 'error'); |
|
475 | - return; |
|
476 | - } |
|
471 | + // Cross reference Drupal account with BOINC |
|
472 | + $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id); |
|
473 | + if (!$reference) { |
|
474 | + drupal_set_message(t('Error connecting BOINC account.'), 'error'); |
|
475 | + return; |
|
476 | + } |
|
477 | 477 | |
478 | - // if terms of use exist, the user must agree. |
|
479 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
480 | - if (!empty($termsofuse)) { |
|
481 | - $reference2 = boincuser_consentto_termsofuse($account); |
|
482 | - } |
|
478 | + // if terms of use exist, the user must agree. |
|
479 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
480 | + if (!empty($termsofuse)) { |
|
481 | + $reference2 = boincuser_consentto_termsofuse($account); |
|
482 | + } |
|
483 | 483 | |
484 | - // Don't save custom fields to the Drupal user object |
|
485 | - $edit['boincuser_name'] = null; |
|
486 | - $edit['boinchash_flag'] = null; |
|
487 | - // Set email address to lower case in Drupal users table |
|
488 | - if ($account) { |
|
489 | - user_save($account, array('mail' => $lower_email_addr)); |
|
490 | - } |
|
491 | - } |
|
492 | - break; |
|
484 | + // Don't save custom fields to the Drupal user object |
|
485 | + $edit['boincuser_name'] = null; |
|
486 | + $edit['boinchash_flag'] = null; |
|
487 | + // Set email address to lower case in Drupal users table |
|
488 | + if ($account) { |
|
489 | + user_save($account, array('mail' => $lower_email_addr)); |
|
490 | + } |
|
491 | + } |
|
492 | + break; |
|
493 | 493 | |
494 | - case 'update': |
|
495 | - if (isset($edit['update_source'])) { |
|
496 | - require_boinc('boinc_db'); |
|
497 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
498 | - switch ($edit['update_source']) { |
|
499 | - case 'user_account': |
|
500 | - // Ensure that BOINC data is altered |
|
501 | - |
|
502 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false; |
|
503 | - $changing_pass = ($edit['pass']) ? true : false; |
|
504 | - if ($changing_email OR $changing_pass) { |
|
505 | - // set email address to lower-case |
|
506 | - $lower_email_addr = strtolower($edit['mail']); |
|
507 | - |
|
508 | - // Set password hash appropriately |
|
509 | - $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass']; |
|
510 | - $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT ); |
|
511 | - // Algorithm for changing email and/or password |
|
512 | - if ($changing_email) { |
|
513 | - // locally store current email to set as previous email |
|
514 | - $prev_email = $account->mail; |
|
515 | - $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
|
516 | - $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
|
517 | - } |
|
518 | - else { |
|
519 | - $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
|
520 | - } |
|
521 | - |
|
522 | - // Update user account information |
|
523 | - $result = $boinc_user->update($querypart); |
|
524 | - |
|
525 | - if ($changing_email) { |
|
526 | - // reload account |
|
527 | - $account = user_load($account->uid); |
|
528 | - _boincuser_send_emailchange($account, $lower_email_addr, $prev_email, user_access('administer users')); |
|
529 | - } |
|
530 | - |
|
531 | - // Change email to edit to lower-case version, this sets |
|
532 | - // email in Drupal database to the lower-case email |
|
533 | - // address. |
|
534 | - $edit['mail'] = strtolower($lower_email_addr); |
|
535 | - } |
|
536 | - |
|
537 | - // Change boinc username |
|
538 | - if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { |
|
539 | - $boincuser_name = $edit['boincuser_name']; |
|
540 | - $result = $boinc_user->update( |
|
541 | - "name='{$boincuser_name}'" |
|
542 | - ); |
|
543 | - } |
|
544 | - |
|
545 | - break; |
|
546 | - case 'user_profile': |
|
547 | - if ($edit['boincuser_name'] != $boinc_user->name) { |
|
548 | - $boincuser_name = $edit['boincuser_name']; |
|
549 | - $result = $boinc_user->update( |
|
550 | - "name='{$boincuser_name}'" |
|
551 | - ); |
|
552 | - } |
|
553 | - break; |
|
554 | - default: |
|
555 | - } |
|
494 | +case 'update': |
|
495 | + if (isset($edit['update_source'])) { |
|
496 | + require_boinc('boinc_db'); |
|
497 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
498 | + switch ($edit['update_source']) { |
|
499 | + case 'user_account': |
|
500 | + // Ensure that BOINC data is altered |
|
501 | + |
|
502 | + $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false; |
|
503 | + $changing_pass = ($edit['pass']) ? true : false; |
|
504 | + if ($changing_email OR $changing_pass) { |
|
505 | + // set email address to lower-case |
|
506 | + $lower_email_addr = strtolower($edit['mail']); |
|
507 | + |
|
508 | + // Set password hash appropriately |
|
509 | + $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass']; |
|
510 | + $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT ); |
|
511 | + // Algorithm for changing email and/or password |
|
512 | + if ($changing_email) { |
|
513 | + // locally store current email to set as previous email |
|
514 | + $prev_email = $account->mail; |
|
515 | + $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
|
516 | + $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
|
517 | + } |
|
518 | + else { |
|
519 | + $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
|
520 | + } |
|
521 | + |
|
522 | + // Update user account information |
|
523 | + $result = $boinc_user->update($querypart); |
|
524 | + |
|
525 | + if ($changing_email) { |
|
526 | + // reload account |
|
527 | + $account = user_load($account->uid); |
|
528 | + _boincuser_send_emailchange($account, $lower_email_addr, $prev_email, user_access('administer users')); |
|
529 | + } |
|
530 | + |
|
531 | + // Change email to edit to lower-case version, this sets |
|
532 | + // email in Drupal database to the lower-case email |
|
533 | + // address. |
|
534 | + $edit['mail'] = strtolower($lower_email_addr); |
|
535 | + } |
|
536 | + |
|
537 | + // Change boinc username |
|
538 | + if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { |
|
539 | + $boincuser_name = $edit['boincuser_name']; |
|
540 | + $result = $boinc_user->update( |
|
541 | + "name='{$boincuser_name}'" |
|
542 | + ); |
|
543 | + } |
|
544 | + |
|
545 | + break; |
|
546 | + case 'user_profile': |
|
547 | + if ($edit['boincuser_name'] != $boinc_user->name) { |
|
548 | + $boincuser_name = $edit['boincuser_name']; |
|
549 | + $result = $boinc_user->update( |
|
550 | + "name='{$boincuser_name}'" |
|
551 | + ); |
|
552 | + } |
|
553 | + break; |
|
554 | + default: |
|
555 | + } |
|
556 | 556 | // We don't want to save update source or duplicate custom fields, so |
557 | 557 | // remove them before continuing to core Drupal routines |
558 | 558 | $edit['update_source'] = null; |
@@ -560,17 +560,17 @@ discard block |
||
560 | 560 | } |
561 | 561 | break; |
562 | 562 | |
563 | - case 'login': |
|
564 | - // Function is forward compatible to Drupal 7 |
|
565 | - boincuser_user_login($edit, $account); |
|
566 | - break; |
|
563 | +case 'login': |
|
564 | + // Function is forward compatible to Drupal 7 |
|
565 | + boincuser_user_login($edit, $account); |
|
566 | + break; |
|
567 | 567 | |
568 | - case 'delete': |
|
569 | - // Function is forward compatible to Drupal 7 |
|
570 | - boincuser_user_delete($account); |
|
571 | - break; |
|
568 | +case 'delete': |
|
569 | + // Function is forward compatible to Drupal 7 |
|
570 | + boincuser_user_delete($account); |
|
571 | + break; |
|
572 | 572 | |
573 | - default: |
|
573 | +default: |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | } |