Completed
Pull Request — master (#2472)
by Kevin
17:29 queued 05:29
created
drupal/sites/default/boinc/modules/boincuser/boincuser.module 1 patch
Switch Indentation   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -27,198 +27,198 @@  discard block
 block discarded – undo
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 callback' => 'user_is_logged_in',
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_control'] = array(
134
-    'page callback' => 'boincuser_control',
135
-    'access arguments' => array('access user profiles'),
136
-    'type' => MENU_CALLBACK
137
-  );
138
-  $items['admin/boinc'] = array(
139
-    'title' => 'BOINC configuration',
140
-    'position' => 'right',
141
-    'weight' => -8,
142
-    'page callback' => 'system_admin_menu_block_page',
143
-    'access arguments' => array('administer site configuration'),
144
-    'file' => 'system.admin.inc',
145
-    'file path' => drupal_get_path('module', 'system'),
146
-  );
147
-  $items['admin/boinc/environment'] = array(
148
-    'title' => 'Environment: General',
149
-    '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 callback' => 'user_is_logged_in',
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_control'] = array(
134
+'page callback' => 'boincuser_control',
135
+'access arguments' => array('access user profiles'),
136
+'type' => MENU_CALLBACK
137
+);
138
+$items['admin/boinc'] = array(
139
+'title' => 'BOINC configuration',
140
+'position' => 'right',
141
+'weight' => -8,
142
+'page callback' => 'system_admin_menu_block_page',
143
+'access arguments' => array('administer site configuration'),
144
+'file' => 'system.admin.inc',
145
+'file path' => drupal_get_path('module', 'system'),
146
+);
147
+$items['admin/boinc/environment'] = array(
148
+'title' => 'Environment: General',
149
+'description' => 'Set paths to BOINC functions and any other necessary
150 150
       variables that establish a BOINC environment.',
151
-    'page callback' => 'drupal_get_form',
152
-    'page arguments' => array('boincuser_admin_environment'),
153
-    'access arguments' => array('administer site configuration'),
154
-    'type' => MENU_NORMAL_ITEM,
155
-    'file' => 'boincuser.admin.inc'
156
-  );
157
-  $items['admin/boinc/scheduler'] = array(
158
-    'title' => 'Environment: Scheduling server URLs',
159
-    'description' => 'Set BOINC scheduler options.',
160
-    'page callback' => 'drupal_get_form',
161
-    'page arguments' => array('boincuser_admin_scheduler'),
162
-    'access arguments' => array('administer site configuration'),
163
-    'type' => MENU_NORMAL_ITEM,
164
-    'file' => 'boincuser.admin.inc'
165
-  );
166
-  $items['admin/boinc/weboptions'] = array(
167
-    'title' => 'Environment: Website Options',
168
-    'description' => 'Set options configuring this Drupal-BOINC Web site.',
169
-    'page callback' => 'drupal_get_form',
170
-    'page arguments' => array('boincuser_admin_weboptions'),
171
-    'access arguments' => array('administer site configuration'),
172
-    'type' => MENU_NORMAL_ITEM,
173
-    'file' => 'boincuser.admin.inc'
174
-  );
151
+'page callback' => 'drupal_get_form',
152
+'page arguments' => array('boincuser_admin_environment'),
153
+'access arguments' => array('administer site configuration'),
154
+'type' => MENU_NORMAL_ITEM,
155
+'file' => 'boincuser.admin.inc'
156
+);
157
+$items['admin/boinc/scheduler'] = array(
158
+'title' => 'Environment: Scheduling server URLs',
159
+'description' => 'Set BOINC scheduler options.',
160
+'page callback' => 'drupal_get_form',
161
+'page arguments' => array('boincuser_admin_scheduler'),
162
+'access arguments' => array('administer site configuration'),
163
+'type' => MENU_NORMAL_ITEM,
164
+'file' => 'boincuser.admin.inc'
165
+);
166
+$items['admin/boinc/weboptions'] = array(
167
+'title' => 'Environment: Website Options',
168
+'description' => 'Set options configuring this Drupal-BOINC Web site.',
169
+'page callback' => 'drupal_get_form',
170
+'page arguments' => array('boincuser_admin_weboptions'),
171
+'access arguments' => array('administer site configuration'),
172
+'type' => MENU_NORMAL_ITEM,
173
+'file' => 'boincuser.admin.inc'
174
+);
175 175
   
176
-  $items['create_account.php'] = array(
177
-    'title' => 'Create Account RPC',
178
-    'description' => 'RPC for creating user accounts.',
179
-    'page callback' => 'boincuser_create_account',
180
-    'access callback' => TRUE,
181
-    'type' => MENU_CALLBACK
182
-  );
183
-  $items['account_finish.php'] = array(
184
-    'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'),
185
-    'description' => 'RPC for after a user has created an account.',
186
-    'page callback' => 'boincuser_account_finish',
187
-    'access callback' => TRUE,
188
-    'type' => MENU_CALLBACK,
189
-  );
190
-  $items['boincuser/autocomplete'] = array(
191
-    'page callback' => '_boincuser_user_name_autocomplete',
192
-    'access callback' => TRUE,
193
-    'type' => MENU_CALLBACK,
194
-  );
195
-  return $items;
176
+$items['create_account.php'] = array(
177
+'title' => 'Create Account RPC',
178
+'description' => 'RPC for creating user accounts.',
179
+'page callback' => 'boincuser_create_account',
180
+'access callback' => TRUE,
181
+'type' => MENU_CALLBACK
182
+);
183
+$items['account_finish.php'] = array(
184
+'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'),
185
+'description' => 'RPC for after a user has created an account.',
186
+'page callback' => 'boincuser_account_finish',
187
+'access callback' => TRUE,
188
+'type' => MENU_CALLBACK,
189
+);
190
+$items['boincuser/autocomplete'] = array(
191
+'page callback' => '_boincuser_user_name_autocomplete',
192
+'access callback' => TRUE,
193
+'type' => MENU_CALLBACK,
194
+);
195
+return $items;
196 196
 }
197 197
 
198 198
 /**
199 199
  *
200 200
  */
201 201
 function boincuser_init() {
202
-  // Skip this check for charts, which are loaded separately
203
-  // (may get duplicate or unexpected messages otherwise)
204
-  if (substr($_GET['q'], 0, 7) == 'charts/') {
205
-    return;
206
-  }
202
+// Skip this check for charts, which are loaded separately
203
+// (may get duplicate or unexpected messages otherwise)
204
+if (substr($_GET['q'], 0, 7) == 'charts/') {
205
+return;
206
+}
207 207
 
208
-  // If admin user, do some basic site functionality checks
209
-  if (user_access('administer site configuration')) {
210
-    // Ensure we have a configured BOINC environment
211
-    boinc_get_path();
212
-    boinc_get_scheduler_tags();
213
-  }
208
+// If admin user, do some basic site functionality checks
209
+if (user_access('administer site configuration')) {
210
+// Ensure we have a configured BOINC environment
211
+boinc_get_path();
212
+boinc_get_scheduler_tags();
213
+}
214 214
   
215
-  // Check credits for the verified contributor role
216
-  boincuser_check_credit_requirements();
215
+// Check credits for the verified contributor role
216
+boincuser_check_credit_requirements();
217 217
   
218
-  if (module_exists('boincteam')) {
219
-    // Display any persistent team messages
220
-    boincteam_show_messages();
221
-  }
218
+if (module_exists('boincteam')) {
219
+// Display any persistent team messages
220
+boincteam_show_messages();
221
+}
222 222
 }
223 223
 
224 224
 /**
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
  * Drupal user operations
227 227
  */
228 228
 function boincuser_user($op, &$edit, &$account, $category = NULL) {
229
-  // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
230
-  if ($account->uid > 1) {
231
-    switch($op) {
232
-    case 'load':
233
-      // User loading; insert BOINC data into the user object
234
-      $drupal_user = db_fetch_object(db_query("
229
+// Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
230
+if ($account->uid > 1) {
231
+switch($op) {
232
+case 'load':
233
+// User loading; insert BOINC data into the user object
234
+$drupal_user = db_fetch_object(db_query("
235 235
         SELECT boinc_id, penalty_expiration
236 236
         FROM {boincuser} WHERE uid = %d",
237
-        $account->uid
238
-      ));
239
-      $account->boincuser_id = $drupal_user->boinc_id;
240
-      $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
241
-      db_set_active('boinc_rw');
242
-      $boinc_user = db_fetch_object(db_query("
237
+$account->uid
238
+));
239
+$account->boincuser_id = $drupal_user->boinc_id;
240
+$account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
241
+db_set_active('boinc_rw');
242
+$boinc_user = db_fetch_object(db_query("
243 243
         SELECT
244 244
           name,
245 245
           authenticator,
@@ -252,28 +252,28 @@  discard block
 block discarded – undo
252 252
           venue
253 253
         FROM {user}
254 254
         WHERE id = %d",
255
-        $account->boincuser_id
256
-      ));
257
-      $account->boincuser_name = $boinc_user->name;
258
-      $account->boincuser_account_key = $boinc_user->authenticator;
259
-      $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
260
-      $account->boincuser_total_credit = round($boinc_user->total_credit);
261
-      $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
262
-      $account->boincuser_expavg_time = round($boinc_user->expavg_time);
263
-      $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
264
-      $account->boincuser_default_pref_set = $boinc_user->venue;
265
-      $account->boincteam_id = $boinc_user->teamid;
266
-      db_set_active('default');
267
-      // Set Drupal team ID
268
-      $account->team = NULL;
269
-      if ($account->boincteam_id) {
270
-        $account->team = db_result(db_query("
255
+$account->boincuser_id
256
+));
257
+$account->boincuser_name = $boinc_user->name;
258
+$account->boincuser_account_key = $boinc_user->authenticator;
259
+$account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
260
+$account->boincuser_total_credit = round($boinc_user->total_credit);
261
+$account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
262
+$account->boincuser_expavg_time = round($boinc_user->expavg_time);
263
+$account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
264
+$account->boincuser_default_pref_set = $boinc_user->venue;
265
+$account->boincteam_id = $boinc_user->teamid;
266
+db_set_active('default');
267
+// Set Drupal team ID
268
+$account->team = NULL;
269
+if ($account->boincteam_id) {
270
+$account->team = db_result(db_query("
271 271
           SELECT nid FROM {boincteam} WHERE team_id = %d",
272
-          $account->boincteam_id
273
-        ));
274
-      }
275
-      // Set post count
276
-      $account->post_count = db_result(db_query("
272
+$account->boincteam_id
273
+));
274
+}
275
+// Set post count
276
+$account->post_count = db_result(db_query("
277 277
         SELECT COUNT(*) +
278 278
         (
279 279
           SELECT COUNT(*) FROM {node}
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
         INNER JOIN node ON comments.nid = node.nid
286 286
         WHERE comments.uid = '%d'
287 287
         AND node.status = 1",
288
-        $account->uid, $account->uid
289
-      ));
290
-      break;
288
+$account->uid, $account->uid
289
+));
290
+break;
291 291
       
292
-    case 'view':
293
-      // SAMPLE: Add BOINC data to the user profile
294
-      /*$account->content['summary']['boinc_id'] = array(
292
+case 'view':
293
+// SAMPLE: Add BOINC data to the user profile
294
+/*$account->content['summary']['boinc_id'] = array(
295 295
         '#type' => 'user_profile_item',
296 296
         '#title' => bts('BIONC ID'),
297 297
         '#value' => $account->boincuser_id,
@@ -305,137 +305,137 @@  discard block
 block discarded – undo
305 305
         '#attributes' => array('class' => 'boinc-data'),
306 306
         '#weight' => 10
307 307
       );*/
308
-      break;
308
+break;
309 309
       
310
-    case 'validate':
311
-      if (isset($edit['validation_source'])) {
312
-        switch ($edit['validation_source']) {
313
-        case 'user_register':
314
-          // Information being checked before adding a user
315
-          if (!boincuser_register_validate($edit)) {
316
-            // BOINC user validation failed for registration; set an error accordingly
317
-            form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $edit['mail'], '@project' => PROJECT), NULL, 'boinc:add-new-user'));
318
-          }
319
-          else {
320
-            // Save profile information for use during Insert
321
-            $_SESSION['profileInfo'] = array(
322
-              'country' => $edit['field_country'][0]['value'],
323
-              'zip' => $edit['field_zip'][0]['value'],                  
324
-              'url' => $edit['field_url'][0]['value'],
325
-              'background' => $edit['field_background'][0]['value'],
326
-              'opinions' => $edit['field_opinions'][0]['value']
327
-            );
328
-            // With BOINC validation passed, make sure name is unique
329
-            $edit['name'] = create_proper_drupalname($edit['boincuser_name']);
330
-          }
331
-          break;
310
+case 'validate':
311
+if (isset($edit['validation_source'])) {
312
+switch ($edit['validation_source']) {
313
+case 'user_register':
314
+// Information being checked before adding a user
315
+if (!boincuser_register_validate($edit)) {
316
+// BOINC user validation failed for registration; set an error accordingly
317
+form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $edit['mail'], '@project' => PROJECT), NULL, 'boinc:add-new-user'));
318
+}
319
+else {
320
+// Save profile information for use during Insert
321
+$_SESSION['profileInfo'] = array(
322
+'country' => $edit['field_country'][0]['value'],
323
+'zip' => $edit['field_zip'][0]['value'],                  
324
+'url' => $edit['field_url'][0]['value'],
325
+'background' => $edit['field_background'][0]['value'],
326
+'opinions' => $edit['field_opinions'][0]['value']
327
+);
328
+// With BOINC validation passed, make sure name is unique
329
+$edit['name'] = create_proper_drupalname($edit['boincuser_name']);
330
+}
331
+break;
332 332
           
333
-        case 'user_account':
334
-          // Validate data before updating user account info
335
-          boincuser_account_validate($edit, $account);
336
-          break;
333
+case 'user_account':
334
+// Validate data before updating user account info
335
+boincuser_account_validate($edit, $account);
336
+break;
337 337
         
338
-        default:
338
+default:
339 339
           
340
-        }
341
-        // We don't want to save validation source, so remove it
342
-        $edit['validation_source'] = null;
343
-      }
344
-      break;
340
+}
341
+    // We don't want to save validation source, so remove it
342
+    $edit['validation_source'] = null;
343
+  }
344
+  break;
345 345
       
346
-    case 'insert':
347
-      // New user being added to the system
348
-      $profile_info = $_SESSION['profileInfo'];
349
-      $imported = $_SESSION['importedUser'];
350
-      unset($_SESSION['profileInfo']);
351
-      unset($_SESSION['importedUser']);
346
+case 'insert':
347
+  // New user being added to the system
348
+  $profile_info = $_SESSION['profileInfo'];
349
+  $imported = $_SESSION['importedUser'];
350
+  unset($_SESSION['profileInfo']);
351
+  unset($_SESSION['importedUser']);
352 352
       
353
-      watchdog(
354
-        'boincuser',
355
-        'Creating user account for %email_addr',
356
-        array('%email_addr' => $edit['mail']),
357
-        WATCHDOG_NOTICE
358
-      );
353
+  watchdog(
354
+    'boincuser',
355
+    'Creating user account for %email_addr',
356
+    array('%email_addr' => $edit['mail']),
357
+    WATCHDOG_NOTICE
358
+  );
359 359
       
360
-      // NOTE: Registrations are normally handled via the create_account RPC,
361
-      // so the following will not run (kept in case form registration is used)
360
+  // NOTE: Registrations are normally handled via the create_account RPC,
361
+  // so the following will not run (kept in case form registration is used)
362 362
       
363
-      // If from the registration form, create a BOINC user and relationships
363
+  // If from the registration form, create a BOINC user and relationships
364 364
       
365
-      if ($profile_info and !$imported) {
366
-        // Create a BOINC account unless importing from BOINC
367
-        $user_params = array(
368
-          'email_addr' => $edit['mail'],
369
-          'name' => $edit['boincuser_name'],
370
-          'passwd_hash' => md5($edit['pass'].$edit['mail']),
371
-          'country' => $profile_info['country'],
372
-          'postal_code' => $profile_info['zip']
373
-        );
374
-        $boinc_user = boincuser_register_make_user($user_params);
375
-        if (!$boinc_user) {
376
-          // Account exists with this email addr
377
-          form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user'));
378
-          return;
379
-        }
380
-        // Add user to community role by default (not banned)
381
-        $unrestricted_role = array_search('community member', user_roles(true)); 
382
-        $edit['roles'] = array(
383
-          $unrestricted_role => ''
384
-        );
385
-        // Set profile data in BOINC db
386
-        db_set_active('boinc_rw');
387
-        // TODO: add language, image support; error handling
388
-        $reference = db_query("INSERT INTO {profile} SET userid='%d', response1='%s', response2='%s', verification=0", $boinc_user->id, $profile_info['background'], $profile_info['opinions']);
389
-        if (!$reference) {
390
-          drupal_set_message(t('Error creating BOINC profile.'), 'error');
391
-        }
392
-        $reference = db_query("UPDATE {user} SET url='%s' WHERE id='%d'", $profile_info['url'], $boinc_user->id);
393
-        if (!$reference) {
394
-          drupal_set_message(t('Error updating BOINC account.'), 'error');
395
-        }
396
-        db_set_active('default');
397
-        // Cross reference Drupal account with BOINC
398
-        $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id);
399
-        if (!$reference) {
400
-          drupal_set_message(t('Error connecting BOINC account.'), 'error');
401
-          return;
402
-        }
403
-        // Don't save custom fields to the Drupal user object
404
-        $edit['boincuser_name'] = null;
405
-      }
406
-      break;
365
+  if ($profile_info and !$imported) {
366
+    // Create a BOINC account unless importing from BOINC
367
+    $user_params = array(
368
+      'email_addr' => $edit['mail'],
369
+      'name' => $edit['boincuser_name'],
370
+      'passwd_hash' => md5($edit['pass'].$edit['mail']),
371
+      'country' => $profile_info['country'],
372
+      'postal_code' => $profile_info['zip']
373
+    );
374
+    $boinc_user = boincuser_register_make_user($user_params);
375
+    if (!$boinc_user) {
376
+      // Account exists with this email addr
377
+      form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user'));
378
+      return;
379
+    }
380
+    // Add user to community role by default (not banned)
381
+    $unrestricted_role = array_search('community member', user_roles(true)); 
382
+    $edit['roles'] = array(
383
+      $unrestricted_role => ''
384
+    );
385
+    // Set profile data in BOINC db
386
+    db_set_active('boinc_rw');
387
+    // TODO: add language, image support; error handling
388
+    $reference = db_query("INSERT INTO {profile} SET userid='%d', response1='%s', response2='%s', verification=0", $boinc_user->id, $profile_info['background'], $profile_info['opinions']);
389
+    if (!$reference) {
390
+      drupal_set_message(t('Error creating BOINC profile.'), 'error');
391
+    }
392
+    $reference = db_query("UPDATE {user} SET url='%s' WHERE id='%d'", $profile_info['url'], $boinc_user->id);
393
+    if (!$reference) {
394
+      drupal_set_message(t('Error updating BOINC account.'), 'error');
395
+    }
396
+    db_set_active('default');
397
+    // Cross reference Drupal account with BOINC
398
+    $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id);
399
+    if (!$reference) {
400
+      drupal_set_message(t('Error connecting BOINC account.'), 'error');
401
+      return;
402
+    }
403
+    // Don't save custom fields to the Drupal user object
404
+    $edit['boincuser_name'] = null;
405
+  }
406
+  break;
407 407
       
408
-    case 'update':
409
-      if (isset($edit['update_source'])) {
410
-        require_boinc('boinc_db');
411
-        $boinc_user = BoincUser::lookup_id($account->boincuser_id);
412
-        switch ($edit['update_source']) {
413
-        case 'user_account':
414
-          // Ensure that BOINC data is altered
415
-          $boinc_user = BoincUser::lookup_id($account->boincuser_id);
416
-          $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
417
-          $changing_pass = ($edit['pass']) ? true : false;
418
-          if ($changing_email OR $changing_pass) {
419
-            // Set password hash appropriately
420
-            $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
421
-            $passwd_hash = md5($passwd.$edit['mail']);
422
-            $email_addr = $edit['mail'];
423
-            // Update user account information
424
-            $result = $boinc_user->update(
425
-                "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}'"
426
-            );
427
-          }
428
-          break;
429
-        case 'user_profile':
430
-          if ($edit['boincuser_name'] != $boinc_user->name) {
431
-            $boincuser_name = $edit['boincuser_name'];
432
-            $result = $boinc_user->update(
433
-                "name='{$boincuser_name}'"
434
-            );
435
-          }
436
-          break;
437
-        default:
438
-        }
408
+case 'update':
409
+  if (isset($edit['update_source'])) {
410
+    require_boinc('boinc_db');
411
+    $boinc_user = BoincUser::lookup_id($account->boincuser_id);
412
+    switch ($edit['update_source']) {
413
+    case 'user_account':
414
+    // Ensure that BOINC data is altered
415
+    $boinc_user = BoincUser::lookup_id($account->boincuser_id);
416
+    $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
417
+    $changing_pass = ($edit['pass']) ? true : false;
418
+    if ($changing_email OR $changing_pass) {
419
+    // Set password hash appropriately
420
+    $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
421
+    $passwd_hash = md5($passwd.$edit['mail']);
422
+    $email_addr = $edit['mail'];
423
+    // Update user account information
424
+    $result = $boinc_user->update(
425
+    "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}'"
426
+    );
427
+    }
428
+    break;
429
+    case 'user_profile':
430
+    if ($edit['boincuser_name'] != $boinc_user->name) {
431
+    $boincuser_name = $edit['boincuser_name'];
432
+    $result = $boinc_user->update(
433
+    "name='{$boincuser_name}'"
434
+    );
435
+    }
436
+    break;
437
+    default:
438
+    }
439 439
         // We don't want to save update source or duplicate custom fields, so
440 440
         // remove them before continuing to core Drupal routines
441 441
         $edit['update_source'] = null;
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
       }
444 444
       break;
445 445
 
446
-    case 'delete':
447
-      // Function is forward compatible to Drupal 7
448
-      boincuser_user_delete($account);
449
-      break;
446
+case 'delete':
447
+  // Function is forward compatible to Drupal 7
448
+  boincuser_user_delete($account);
449
+  break;
450 450
 
451
-    default:
451
+default:
452 452
       
453 453
     }
454 454
   }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/boincuser.views.inc 1 patch
Switch Indentation   +254 added lines, -254 removed lines patch added patch discarded remove patch
@@ -13,255 +13,255 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function boincuser_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for user table
18
-  // -----------------------------------------------------------------------------------------------
16
+// -----------------------------------------------------------------------------------------------
17
+// Definition for user table
18
+// -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['user']['table']['group'] = t('BOINC');
20
+$data['user']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['user']['table']['base'] = array(
23
-      'field' => 'id',
24
-      'title' => t('BOINC user'),
25
-      'help' => t('BOINC account data for a user'),
26
-      'database' => 'boinc_ro'
27
-  );
22
+$data['user']['table']['base'] = array(
23
+  'field' => 'id',
24
+  'title' => t('BOINC user'),
25
+  'help' => t('BOINC account data for a user'),
26
+  'database' => 'boinc_ro'
27
+);
28 28
 
29
-  // Describe each of the individual fields in this table to Views. For
30
-  // each field, you may define what field, sort, argument, and/or filter
31
-  // handlers it supports. This will determine where in the Views interface you
32
-  // may use the field.
29
+// Describe each of the individual fields in this table to Views. For
30
+// each field, you may define what field, sort, argument, and/or filter
31
+// handlers it supports. This will determine where in the Views interface you
32
+// may use the field.
33 33
   
34
-  // Primary keys allowed as arguments
34
+// Primary keys allowed as arguments
35 35
   
36
-  $data['user']['id'] = array(
37
-    'title' => bts('Id', array(), NULL, 'boinc:user-id'),
38
-    'help' => t('The BOINC ID of the user account.'),
39
-    'field' => array(
40
-      'handler' => 'views_handler_field_numeric',
41
-      'click sortable' => TRUE
42
-    ),
43
-    'argument' => array(
44
-      'handler' => 'views_handler_argument_boincuser_id', // custom handler
45
-      'name field' => 'title', // the field to display in the summary.
46
-      'numeric' => TRUE,
47
-      'validate type' => 'id'
48
-    ),
49
-    'filter' => array(
50
-      'handler' => 'views_handler_filter_numeric'
51
-    ),
52
-    'sort' => array(
53
-      'handler' => 'views_handler_sort_numeric'
54
-    )
55
-  );
56
-  $data['user']['teamid'] = array(
57
-    'title' => bts('Team ID', array(), NULL, 'boinc:team-id'),
58
-    'help' => t('The ID of the user\'s team.'),
59
-    'field' => array(
60
-      'handler' => 'views_handler_field_numeric',
61
-      'click sortable' => TRUE,
62
-    ),
63
-    'argument' => array(
64
-      'handler' => 'views_handler_argument_boincteam_id', // custom handler
65
-      'name field' => 'title', // the field to display in the summary.
66
-      'numeric' => TRUE,
67
-      'validate type' => 'id'
68
-    ),
69
-    'filter' => array(
70
-      'handler' => 'views_handler_filter_numeric'
71
-    ),
72
-    'sort' => array(
73
-      'handler' => 'views_handler_sort_numeric'
74
-    )
75
-  );
36
+$data['user']['id'] = array(
37
+'title' => bts('Id', array(), NULL, 'boinc:user-id'),
38
+'help' => t('The BOINC ID of the user account.'),
39
+'field' => array(
40
+  'handler' => 'views_handler_field_numeric',
41
+  'click sortable' => TRUE
42
+),
43
+'argument' => array(
44
+  'handler' => 'views_handler_argument_boincuser_id', // custom handler
45
+  'name field' => 'title', // the field to display in the summary.
46
+  'numeric' => TRUE,
47
+  'validate type' => 'id'
48
+),
49
+'filter' => array(
50
+  'handler' => 'views_handler_filter_numeric'
51
+),
52
+'sort' => array(
53
+  'handler' => 'views_handler_sort_numeric'
54
+)
55
+);
56
+$data['user']['teamid'] = array(
57
+'title' => bts('Team ID', array(), NULL, 'boinc:team-id'),
58
+'help' => t('The ID of the user\'s team.'),
59
+'field' => array(
60
+  'handler' => 'views_handler_field_numeric',
61
+  'click sortable' => TRUE,
62
+),
63
+'argument' => array(
64
+  'handler' => 'views_handler_argument_boincteam_id', // custom handler
65
+  'name field' => 'title', // the field to display in the summary.
66
+  'numeric' => TRUE,
67
+  'validate type' => 'id'
68
+),
69
+'filter' => array(
70
+  'handler' => 'views_handler_filter_numeric'
71
+),
72
+'sort' => array(
73
+  'handler' => 'views_handler_sort_numeric'
74
+)
75
+);
76 76
   
77
-  // Descriptions of general host fields (alphabetized)
77
+// Descriptions of general host fields (alphabetized)
78 78
   
79
-  $data['user']['authenticator'] = array(
80
-    'title' => bts('Account Key', array(), NULL, 'boinc:user-info'),
81
-    'help' => t('The BOINC account key of the user.'),
82
-    'field' => array(
83
-      'handler' => 'views_handler_field',
84
-      'click sortable' => TRUE
85
-    ),
86
-    'filter' => array(
87
-      'handler' => 'views_handler_filter_string'
88
-    ),
89
-    'sort' => array(
90
-      'handler' => 'views_handler_sort_string'
91
-    )
92
-  );
93
-  $data['user']['country'] = array(
94
-    'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'),
95
-    'help' => t('The country of the user.'),
96
-    'field' => array(
97
-      'handler' => 'views_handler_field',
98
-      'click sortable' => TRUE
99
-    ),
100
-    'filter' => array(
101
-      'handler' => 'views_handler_filter_string'
102
-    ),
103
-    'sort' => array(
104
-      'handler' => 'views_handler_sort_string'
105
-    )
106
-  );
107
-  $data['user']['create_time'] = array(
108
-    'title' => bts('Member since', array(), NULL, 'boinc:user-info'),
109
-    'help' => t('When the BOINC account was created.'),
110
-    'field' => array(
111
-      'handler' => 'views_handler_field_date',
112
-      'click sortable' => TRUE
113
-    ),
114
-    'filter' => array(
115
-      'handler' => 'views_handler_filter_date'
116
-    ),
117
-    'sort' => array(
118
-      'handler' => 'views_handler_sort_date'
119
-    )
120
-  );
121
-  $data['user']['cross_project_id'] = array(
122
-    'title' => bts('CPID', array(), NULL, 'boinc:user-info'),
123
-    'help' => t('The cross project user identifier.'),
124
-    'field' => array(
125
-      'handler' => 'views_handler_field',
126
-      'click sortable' => TRUE
127
-    ),
128
-    'filter' => array(
129
-      'handler' => 'views_handler_filter_string'
130
-    ),
131
-    'sort' => array(
132
-      'handler' => 'views_handler_sort_string'
133
-    )
134
-  );
135
-  $data['user']['email_addr'] = array(
136
-      'title' => bts('Email Address', array(), NULL, 'boinc:user-info'),
137
-    'help' => t('The BOINC account email address.'),
138
-    'field' => array(
139
-      'handler' => 'views_handler_field',
140
-      'click sortable' => TRUE
141
-    ),
142
-    'filter' => array(
143
-      'handler' => 'views_handler_filter_string'
144
-    ),
145
-    'sort' => array(
146
-      'handler' => 'views_handler_sort_string'
147
-    )
148
-  );
149
-  $data['user']['expavg_credit'] = array(
150
-    'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'),
151
-    'help' => t('A decaying average of credit per day for the user.'),
152
-    'field' => array(
153
-      'handler' => 'views_handler_field_numeric',
154
-      'click sortable' => TRUE,
155
-      'float' => TRUE
156
-    ),
157
-    'filter' => array(
158
-      'handler' => 'views_handler_filter_numeric'
159
-    ),
160
-    'sort' => array(
161
-      'handler' => 'views_handler_sort_numeric'
162
-    )
163
-  );
164
-  $data['user']['name'] = array(
165
-    'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'),
166
-    'help' => t('The BOINC account user name.'),
167
-    'field' => array(
168
-      'handler' => 'views_handler_field',
169
-      'click sortable' => TRUE
170
-    ),
171
-    'filter' => array(
172
-      'handler' => 'views_handler_filter_string'
173
-    ),
174
-    'sort' => array(
175
-      'handler' => 'views_handler_sort_string'
176
-    )                           
177
-  );
178
-  $data['user']['passwd_hash'] = array(
179
-    'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'),
180
-    'help' => t('The user password hash'),
181
-    'field' => array(
182
-      'handler' => 'views_handler_field',
183
-      'click sortable' => TRUE
184
-    ),
185
-    'filter' => array(
186
-      'handler' => 'views_handler_filter_string'
187
-    ),
188
-    'sort' => array(
189
-      'handler' => 'views_handler_sort_string'
190
-    )
191
-  );
192
-  $data['user']['postal_code'] = array(
193
-    'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'),
194
-    'help' => t('The postal code of the user.'),
195
-    'field' => array(
196
-      'handler' => 'views_handler_field',
197
-      'click sortable' => TRUE
198
-    ),
199
-    'filter' => array(
200
-      'handler' => 'views_handler_filter_string'
201
-    ),
202
-    'sort' => array(
203
-      'handler' => 'views_handler_sort_string'
204
-    )
205
-  );
206
-  $data['user']['send_email'] = array(
207
-    'title' => bts('Send Email', array(), NULL, 'boinc:user-info'),
208
-    'help' => t('User preference to allow email communications.'),
209
-    'field' => array(
210
-      'handler' => 'views_handler_field_numeric',
211
-      'click sortable' => TRUE
212
-    ),
213
-    'filter' => array(
214
-      'handler' => 'views_handler_filter_numeric'
215
-    ),
216
-    'sort' => array(
217
-      'handler' => 'views_handler_sort_numeric'
218
-    )
219
-  );
220
-  $data['user']['show_hosts'] = array(
221
-    'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'),
222
-    'help' => t('User preference to display owned computers.'),
223
-    'field' => array(
224
-      'handler' => 'views_handler_field_numeric',
225
-      'click sortable' => TRUE
226
-    ),
227
-    'filter' => array(
228
-      'handler' => 'views_handler_filter_numeric'
229
-    ),
230
-    'sort' => array(
231
-      'handler' => 'views_handler_sort_numeric'
232
-    )
233
-  );
234
-  $data['user']['total_credit'] = array(
235
-    'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
236
-    'help' => t('The total accumulated BOINC credit for the user.'),
237
-    'field' => array(
238
-      'handler' => 'views_handler_field_numeric',
239
-      'click sortable' => TRUE,
240
-      'float' => TRUE
241
-    ),
242
-    'filter' => array(
243
-      'handler' => 'views_handler_filter_numeric'
244
-    ),
245
-    'sort' => array(
246
-      'handler' => 'views_handler_sort_numeric'
247
-    )
248
-  );
249
-  $data['user']['url'] = array(
250
-    'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'),
251
-    'help' => t('The URL provided by the user'),
252
-    'field' => array(
253
-      'handler' => 'views_handler_field',
254
-      'click sortable' => TRUE
255
-    ),
256
-    'filter' => array(
257
-      'handler' => 'views_handler_filter_string'
258
-    ),
259
-    'sort' => array(
260
-      'handler' => 'views_handler_sort_string'
261
-    )
262
-  );
79
+$data['user']['authenticator'] = array(
80
+'title' => bts('Account Key', array(), NULL, 'boinc:user-info'),
81
+'help' => t('The BOINC account key of the user.'),
82
+'field' => array(
83
+  'handler' => 'views_handler_field',
84
+  'click sortable' => TRUE
85
+),
86
+'filter' => array(
87
+  'handler' => 'views_handler_filter_string'
88
+),
89
+'sort' => array(
90
+  'handler' => 'views_handler_sort_string'
91
+)
92
+);
93
+$data['user']['country'] = array(
94
+'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'),
95
+'help' => t('The country of the user.'),
96
+'field' => array(
97
+  'handler' => 'views_handler_field',
98
+  'click sortable' => TRUE
99
+),
100
+'filter' => array(
101
+  'handler' => 'views_handler_filter_string'
102
+),
103
+'sort' => array(
104
+  'handler' => 'views_handler_sort_string'
105
+)
106
+);
107
+$data['user']['create_time'] = array(
108
+'title' => bts('Member since', array(), NULL, 'boinc:user-info'),
109
+'help' => t('When the BOINC account was created.'),
110
+'field' => array(
111
+  'handler' => 'views_handler_field_date',
112
+  'click sortable' => TRUE
113
+),
114
+'filter' => array(
115
+  'handler' => 'views_handler_filter_date'
116
+),
117
+'sort' => array(
118
+  'handler' => 'views_handler_sort_date'
119
+)
120
+);
121
+$data['user']['cross_project_id'] = array(
122
+'title' => bts('CPID', array(), NULL, 'boinc:user-info'),
123
+'help' => t('The cross project user identifier.'),
124
+'field' => array(
125
+  'handler' => 'views_handler_field',
126
+  'click sortable' => TRUE
127
+),
128
+'filter' => array(
129
+  'handler' => 'views_handler_filter_string'
130
+),
131
+'sort' => array(
132
+  'handler' => 'views_handler_sort_string'
133
+)
134
+);
135
+$data['user']['email_addr'] = array(
136
+  'title' => bts('Email Address', array(), NULL, 'boinc:user-info'),
137
+'help' => t('The BOINC account email address.'),
138
+'field' => array(
139
+  'handler' => 'views_handler_field',
140
+  'click sortable' => TRUE
141
+),
142
+'filter' => array(
143
+  'handler' => 'views_handler_filter_string'
144
+),
145
+'sort' => array(
146
+  'handler' => 'views_handler_sort_string'
147
+)
148
+);
149
+$data['user']['expavg_credit'] = array(
150
+'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'),
151
+'help' => t('A decaying average of credit per day for the user.'),
152
+'field' => array(
153
+  'handler' => 'views_handler_field_numeric',
154
+  'click sortable' => TRUE,
155
+  'float' => TRUE
156
+),
157
+'filter' => array(
158
+  'handler' => 'views_handler_filter_numeric'
159
+),
160
+'sort' => array(
161
+  'handler' => 'views_handler_sort_numeric'
162
+)
163
+);
164
+$data['user']['name'] = array(
165
+'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'),
166
+'help' => t('The BOINC account user name.'),
167
+'field' => array(
168
+  'handler' => 'views_handler_field',
169
+  'click sortable' => TRUE
170
+),
171
+'filter' => array(
172
+  'handler' => 'views_handler_filter_string'
173
+),
174
+'sort' => array(
175
+  'handler' => 'views_handler_sort_string'
176
+)                           
177
+);
178
+$data['user']['passwd_hash'] = array(
179
+'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'),
180
+'help' => t('The user password hash'),
181
+'field' => array(
182
+  'handler' => 'views_handler_field',
183
+  'click sortable' => TRUE
184
+),
185
+'filter' => array(
186
+  'handler' => 'views_handler_filter_string'
187
+),
188
+'sort' => array(
189
+  'handler' => 'views_handler_sort_string'
190
+)
191
+);
192
+$data['user']['postal_code'] = array(
193
+'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'),
194
+'help' => t('The postal code of the user.'),
195
+'field' => array(
196
+  'handler' => 'views_handler_field',
197
+  'click sortable' => TRUE
198
+),
199
+'filter' => array(
200
+  'handler' => 'views_handler_filter_string'
201
+),
202
+'sort' => array(
203
+  'handler' => 'views_handler_sort_string'
204
+)
205
+);
206
+$data['user']['send_email'] = array(
207
+'title' => bts('Send Email', array(), NULL, 'boinc:user-info'),
208
+'help' => t('User preference to allow email communications.'),
209
+'field' => array(
210
+  'handler' => 'views_handler_field_numeric',
211
+  'click sortable' => TRUE
212
+),
213
+'filter' => array(
214
+  'handler' => 'views_handler_filter_numeric'
215
+),
216
+'sort' => array(
217
+  'handler' => 'views_handler_sort_numeric'
218
+)
219
+);
220
+$data['user']['show_hosts'] = array(
221
+'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'),
222
+'help' => t('User preference to display owned computers.'),
223
+'field' => array(
224
+  'handler' => 'views_handler_field_numeric',
225
+  'click sortable' => TRUE
226
+),
227
+'filter' => array(
228
+  'handler' => 'views_handler_filter_numeric'
229
+),
230
+'sort' => array(
231
+  'handler' => 'views_handler_sort_numeric'
232
+)
233
+);
234
+$data['user']['total_credit'] = array(
235
+'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
236
+'help' => t('The total accumulated BOINC credit for the user.'),
237
+'field' => array(
238
+  'handler' => 'views_handler_field_numeric',
239
+  'click sortable' => TRUE,
240
+  'float' => TRUE
241
+),
242
+'filter' => array(
243
+  'handler' => 'views_handler_filter_numeric'
244
+),
245
+'sort' => array(
246
+  'handler' => 'views_handler_sort_numeric'
247
+)
248
+);
249
+$data['user']['url'] = array(
250
+'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'),
251
+'help' => t('The URL provided by the user'),
252
+'field' => array(
253
+  'handler' => 'views_handler_field',
254
+  'click sortable' => TRUE
255
+),
256
+'filter' => array(
257
+  'handler' => 'views_handler_filter_string'
258
+),
259
+'sort' => array(
260
+  'handler' => 'views_handler_sort_string'
261
+)
262
+);
263 263
   
264
-  return $data;
264
+return $data;
265 265
 }
266 266
 
267 267
 /*
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
  */
273 273
 
274 274
 function boincuser_views_handlers() {
275
-  return array(
276
-    'info' => array(
277
-      'path' => drupal_get_path('module', 'boincuser') . '/views',
278
-    ),
279
-    'handlers' => array(
280
-      'views_handler_argument_boincuser_id' => array(
281
-        'parent' => 'views_handler_argument_numeric'
282
-      ),
283
-      'views_handler_argument_boincteam_id' => array(
284
-        'parent' => 'views_handler_argument_numeric'
285
-      ),
286
-    )
287
-  );
275
+return array(
276
+'info' => array(
277
+  'path' => drupal_get_path('module', 'boincuser') . '/views',
278
+),
279
+'handlers' => array(
280
+  'views_handler_argument_boincuser_id' => array(
281
+    'parent' => 'views_handler_argument_numeric'
282
+  ),
283
+  'views_handler_argument_boincteam_id' => array(
284
+    'parent' => 'views_handler_argument_numeric'
285
+  ),
286
+)
287
+);
288 288
 }
Please login to merge, or discard this patch.
html/inc/password_compat/password.inc 1 patch
Switch Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
             }
51 51
             $resultLength = 0;
52 52
             switch ($algo) {
53
-                case PASSWORD_BCRYPT:
54
-                    $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
-                    if (isset($options['cost'])) {
56
-                        $cost = (int) $options['cost'];
57
-                        if ($cost < 4 || $cost > 31) {
58
-                            trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
-                            return null;
60
-                        }
53
+            case PASSWORD_BCRYPT:
54
+                $cost = PASSWORD_BCRYPT_DEFAULT_COST;
55
+                if (isset($options['cost'])) {
56
+                    $cost = (int) $options['cost'];
57
+                    if ($cost < 4 || $cost > 31) {
58
+                        trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING);
59
+                        return null;
61 60
                     }
62
-                    // The length of salt to generate
63
-                    $raw_salt_len = 16;
64
-                    // The length required in the final serialization
65
-                    $required_salt_len = 22;
66
-                    $hash_format = sprintf("$2y$%02d$", $cost);
67
-                    // The expected length of the final crypt() output
68
-                    $resultLength = 60;
69
-                    break;
70
-                default:
71
-                    trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
-                    return null;
61
+                }
62
+                // The length of salt to generate
63
+                $raw_salt_len = 16;
64
+                // The length required in the final serialization
65
+                $required_salt_len = 22;
66
+                $hash_format = sprintf("$2y$%02d$", $cost);
67
+                // The expected length of the final crypt() output
68
+                $resultLength = 60;
69
+                break;
70
+            default:
71
+                trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING);
72
+                return null;
73 73
             }
74 74
             $salt_req_encoding = false;
75 75
             if (isset($options['salt'])) {
76 76
                 switch (gettype($options['salt'])) {
77
-                    case 'NULL':
78
-                    case 'boolean':
79
-                    case 'integer':
80
-                    case 'double':
81
-                    case 'string':
77
+                case 'NULL':
78
+                case 'boolean':
79
+                case 'integer':
80
+                case 'double':
81
+                case 'string':
82
+                    $salt = (string) $options['salt'];
83
+                    break;
84
+                case 'object':
85
+                    if (method_exists($options['salt'], '__tostring')) {
82 86
                         $salt = (string) $options['salt'];
83 87
                         break;
84
-                    case 'object':
85
-                        if (method_exists($options['salt'], '__tostring')) {
86
-                            $salt = (string) $options['salt'];
87
-                            break;
88
-                        }
89
-                    case 'array':
90
-                    case 'resource':
91
-                    default:
92
-                        trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
-                        return null;
88
+                    }
89
+                case 'array':
90
+                case 'resource':
91
+                default:
92
+                    trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);
93
+                    return null;
94 94
                 }
95 95
                 if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) {
96 96
                     trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING);
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
                 return true;
213 213
             }
214 214
             switch ($algo) {
215
-                case PASSWORD_BCRYPT:
216
-                    $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
-                    if ($cost !== $info['options']['cost']) {
218
-                        return true;
219
-                    }
220
-                    break;
215
+            case PASSWORD_BCRYPT:
216
+                $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST;
217
+                if ($cost !== $info['options']['cost']) {
218
+                    return true;
219
+                }
220
+                break;
221 221
             }
222 222
             return false;
223 223
         }
Please login to merge, or discard this patch.