@@ -27,44 +27,44 @@ discard block  | 
                                                    ||
| 27 | 27 | * with defined URL paths  | 
                                                        
| 28 | 28 | */  | 
                                                        
| 29 | 29 |  function boincuser_menu() { | 
                                                        
| 30 | - $items['account/posts'] = array(  | 
                                                        |
| 30 | + $items['account/posts'] = array(  | 
                                                        |
| 31 | 31 | 'title' => 'Recent posts',  | 
                                                        
| 32 | 32 | 'description' => '',  | 
                                                        
| 33 | 33 | 'page callback' => 'boincuser_goto_recent_posts',  | 
                                                        
| 34 | 34 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 35 | 35 | 'type' => MENU_CALLBACK,  | 
                                                        
| 36 | - );  | 
                                                        |
| 37 | - $items['account/profile'] = array(  | 
                                                        |
| 36 | + );  | 
                                                        |
| 37 | + $items['account/profile'] = array(  | 
                                                        |
| 38 | 38 | 'title' => '',  | 
                                                        
| 39 | 39 | 'description' => '',  | 
                                                        
| 40 | 40 | 'page callback' => 'boincuser_view_profile',  | 
                                                        
| 41 | 41 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 42 | 42 | 'type' => MENU_NORMAL_ITEM  | 
                                                        
| 43 | - );  | 
                                                        |
| 44 | - $items['account/profile/view'] = array(  | 
                                                        |
| 43 | + );  | 
                                                        |
| 44 | + $items['account/profile/view'] = array(  | 
                                                        |
| 45 | 45 | 'title' => 'View',  | 
                                                        
| 46 | 46 | 'description' => 'Show a user profile',  | 
                                                        
| 47 | 47 | 'page callback' => 'boincuser_view_profile',  | 
                                                        
| 48 | 48 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 49 | 49 | 'type' => MENU_DEFAULT_LOCAL_TASK,  | 
                                                        
| 50 | 50 | 'weight' => 0  | 
                                                        
| 51 | - );  | 
                                                        |
| 52 | - $items['account/profile/edit'] = array(  | 
                                                        |
| 51 | + );  | 
                                                        |
| 52 | + $items['account/profile/edit'] = array(  | 
                                                        |
| 53 | 53 | 'title' => 'Edit',  | 
                                                        
| 54 | 54 | 'description' => 'Edit a user profile',  | 
                                                        
| 55 | 55 | 'page callback' => 'boincuser_edit_profile',  | 
                                                        
| 56 | 56 |      'access arguments' => array('edit own profile content'), | 
                                                        
| 57 | 57 | 'type' => MENU_LOCAL_TASK,  | 
                                                        
| 58 | 58 | 'weight' => 5  | 
                                                        
| 59 | - );  | 
                                                        |
| 60 | - $items['account/team'] = array(  | 
                                                        |
| 59 | + );  | 
                                                        |
| 60 | + $items['account/team'] = array(  | 
                                                        |
| 61 | 61 | 'title' => 'User team',  | 
                                                        
| 62 | 62 | 'description' => '',  | 
                                                        
| 63 | 63 | 'page callback' => 'boincuser_goto_team',  | 
                                                        
| 64 | 64 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 65 | 65 | 'type' => MENU_CALLBACK,  | 
                                                        
| 66 | - );  | 
                                                        |
| 67 | - $items['moderate/profile/%user/approve'] = array(  | 
                                                        |
| 66 | + );  | 
                                                        |
| 67 | + $items['moderate/profile/%user/approve'] = array(  | 
                                                        |
| 68 | 68 | 'title' => 'Profile approval',  | 
                                                        
| 69 | 69 | 'description' => 'Approve profile content',  | 
                                                        
| 70 | 70 | 'page callback' => 'boincuser_moderate_profile_approve',  | 
                                                        
@@ -72,8 +72,8 @@ discard block  | 
                                                    ||
| 72 | 72 |      'access arguments' => array('edit any profile content'), | 
                                                        
| 73 | 73 | 'type' => MENU_CALLBACK,  | 
                                                        
| 74 | 74 | 'weight' => 5  | 
                                                        
| 75 | - );  | 
                                                        |
| 76 | - $items['moderate/profile/%user/edit'] = array(  | 
                                                        |
| 75 | + );  | 
                                                        |
| 76 | + $items['moderate/profile/%user/edit'] = array(  | 
                                                        |
| 77 | 77 | 'title' => 'Profile editor',  | 
                                                        
| 78 | 78 | 'description' => 'Edit a user profile',  | 
                                                        
| 79 | 79 | 'page callback' => 'boincuser_edit_profile',  | 
                                                        
@@ -81,8 +81,8 @@ discard block  | 
                                                    ||
| 81 | 81 |      'access arguments' => array('edit any profile content'), | 
                                                        
| 82 | 82 | 'type' => MENU_CALLBACK,  | 
                                                        
| 83 | 83 | 'weight' => 5  | 
                                                        
| 84 | - );  | 
                                                        |
| 85 | - $items['moderate/profile/%/reject'] = array(  | 
                                                        |
| 84 | + );  | 
                                                        |
| 85 | + $items['moderate/profile/%/reject'] = array(  | 
                                                        |
| 86 | 86 |      'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        
| 87 | 87 | 'description' => 'Reject profile content',  | 
                                                        
| 88 | 88 | 'page callback' => 'drupal_get_form',  | 
                                                        
@@ -90,60 +90,60 @@ discard block  | 
                                                    ||
| 90 | 90 |      'access arguments' => array('edit any profile content'), | 
                                                        
| 91 | 91 | 'type' => MENU_CALLBACK,  | 
                                                        
| 92 | 92 | 'weight' => 5  | 
                                                        
| 93 | - );  | 
                                                        |
| 94 | - $items['moderate/user/%/ban'] = array(  | 
                                                        |
| 93 | + );  | 
                                                        |
| 94 | + $items['moderate/user/%/ban'] = array(  | 
                                                        |
| 95 | 95 |      'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), | 
                                                        
| 96 | 96 | 'description' => 'Ban a user from using community features',  | 
                                                        
| 97 | 97 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 98 | 98 |      'page arguments' => array('boincuser_moderate_user_ban_form', 2), | 
                                                        
| 99 | 99 | 'access callback' => 'boincuser_moderate_community_access',  | 
                                                        
| 100 | 100 | 'type' => MENU_CALLBACK,  | 
                                                        
| 101 | - );  | 
                                                        |
| 102 | - $items['join'] = array(  | 
                                                        |
| 101 | + );  | 
                                                        |
| 102 | + $items['join'] = array(  | 
                                                        |
| 103 | 103 | 'title' => '',  | 
                                                        
| 104 | 104 | 'description' => '',  | 
                                                        
| 105 | 105 | 'page callback' => 'join_page',  | 
                                                        
| 106 | 106 |      'access arguments' => array('access content'), | 
                                                        
| 107 | 107 | 'type' => MENU_NORMAL_ITEM  | 
                                                        
| 108 | - );  | 
                                                        |
| 109 | - $items['join/new'] = array(  | 
                                                        |
| 108 | + );  | 
                                                        |
| 109 | + $items['join/new'] = array(  | 
                                                        |
| 110 | 110 |      'title' => bts("I'm new"), | 
                                                        
| 111 | 111 | 'page callback' => 'join_page',  | 
                                                        
| 112 | 112 | 'page arguments' => array(1),  | 
                                                        
| 113 | 113 |      'access arguments' => array('access content'), | 
                                                        
| 114 | 114 | 'type' => MENU_DEFAULT_LOCAL_TASK,  | 
                                                        
| 115 | 115 | 'weight' => 0  | 
                                                        
| 116 | - );  | 
                                                        |
| 117 | - $items['join/boinc'] = array(  | 
                                                        |
| 116 | + );  | 
                                                        |
| 117 | + $items['join/boinc'] = array(  | 
                                                        |
| 118 | 118 |      'title' => bts("I'm a BOINC user"), | 
                                                        
| 119 | 119 | 'page callback' => 'join_page',  | 
                                                        
| 120 | 120 | 'page arguments' => array(1),  | 
                                                        
| 121 | 121 |      'access arguments' => array('access content'), | 
                                                        
| 122 | 122 | 'type' => MENU_LOCAL_TASK,  | 
                                                        
| 123 | 123 | 'weight' => 5  | 
                                                        
| 124 | - );  | 
                                                        |
| 125 | - $items['user/login/auth'] = array(  | 
                                                        |
| 124 | + );  | 
                                                        |
| 125 | + $items['user/login/auth'] = array(  | 
                                                        |
| 126 | 126 |      'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), | 
                                                        
| 127 | 127 | 'description' => 'Log in using a user authenticator',  | 
                                                        
| 128 | 128 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 129 | 129 |      'page arguments' => array('boincuser_authloginform'), | 
                                                        
| 130 | 130 |      'access arguments' => array('access content'), | 
                                                        
| 131 | 131 | 'type' => MENU_CALLBACK,  | 
                                                        
| 132 | - );  | 
                                                        |
| 133 | - $items['user/termsofuse'] = array(  | 
                                                        |
| 132 | + );  | 
                                                        |
| 133 | + $items['user/termsofuse'] = array(  | 
                                                        |
| 134 | 134 |      'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), | 
                                                        
| 135 | 135 | 'description' => 'A site\'s term of use.',  | 
                                                        
| 136 | 136 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 137 | 137 |      'page arguments' => array('boincuser_termsofuse_form'), | 
                                                        
| 138 | 138 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 139 | 139 | 'type' => MENU_CALLBACK,  | 
                                                        
| 140 | - );  | 
                                                        |
| 141 | - $items['user_control'] = array(  | 
                                                        |
| 140 | + );  | 
                                                        |
| 141 | + $items['user_control'] = array(  | 
                                                        |
| 142 | 142 | 'page callback' => 'boincuser_control',  | 
                                                        
| 143 | 143 |      'access arguments' => array('access user profiles'), | 
                                                        
| 144 | 144 | 'type' => MENU_CALLBACK  | 
                                                        
| 145 | - );  | 
                                                        |
| 146 | - $items['admin/boinc'] = array(  | 
                                                        |
| 145 | + );  | 
                                                        |
| 146 | + $items['admin/boinc'] = array(  | 
                                                        |
| 147 | 147 | 'title' => 'BOINC configuration',  | 
                                                        
| 148 | 148 | 'position' => 'right',  | 
                                                        
| 149 | 149 | 'weight' => -8,  | 
                                                        
@@ -151,8 +151,8 @@ discard block  | 
                                                    ||
| 151 | 151 |      'access arguments' => array('administer site configuration'), | 
                                                        
| 152 | 152 | 'file' => 'system.admin.inc',  | 
                                                        
| 153 | 153 |      'file path' => drupal_get_path('module', 'system'), | 
                                                        
| 154 | - );  | 
                                                        |
| 155 | - $items['admin/boinc/environment'] = array(  | 
                                                        |
| 154 | + );  | 
                                                        |
| 155 | + $items['admin/boinc/environment'] = array(  | 
                                                        |
| 156 | 156 | 'title' => 'Environment: General',  | 
                                                        
| 157 | 157 | 'description' => 'Set paths to BOINC functions and any other necessary  | 
                                                        
| 158 | 158 | variables that establish a BOINC environment.',  | 
                                                        
@@ -161,8 +161,8 @@ discard block  | 
                                                    ||
| 161 | 161 |      'access arguments' => array('administer site configuration'), | 
                                                        
| 162 | 162 | 'type' => MENU_NORMAL_ITEM,  | 
                                                        
| 163 | 163 | 'file' => 'boincuser.admin.inc'  | 
                                                        
| 164 | - );  | 
                                                        |
| 165 | - $items['admin/boinc/scheduler'] = array(  | 
                                                        |
| 164 | + );  | 
                                                        |
| 165 | + $items['admin/boinc/scheduler'] = array(  | 
                                                        |
| 166 | 166 | 'title' => 'Environment: Scheduling server URLs',  | 
                                                        
| 167 | 167 | 'description' => 'Set BOINC scheduler options.',  | 
                                                        
| 168 | 168 | 'page callback' => 'drupal_get_form',  | 
                                                        
@@ -170,8 +170,8 @@ discard block  | 
                                                    ||
| 170 | 170 |      'access arguments' => array('administer site configuration'), | 
                                                        
| 171 | 171 | 'type' => MENU_NORMAL_ITEM,  | 
                                                        
| 172 | 172 | 'file' => 'boincuser.admin.inc'  | 
                                                        
| 173 | - );  | 
                                                        |
| 174 | - $items['admin/boinc/weboptions'] = array(  | 
                                                        |
| 173 | + );  | 
                                                        |
| 174 | + $items['admin/boinc/weboptions'] = array(  | 
                                                        |
| 175 | 175 | 'title' => 'Environment: Website Options',  | 
                                                        
| 176 | 176 | 'description' => 'Set options configuring this Drupal-BOINC Web site.',  | 
                                                        
| 177 | 177 | 'page callback' => 'drupal_get_form',  | 
                                                        
@@ -179,117 +179,117 @@ discard block  | 
                                                    ||
| 179 | 179 |      'access arguments' => array('administer site configuration'), | 
                                                        
| 180 | 180 | 'type' => MENU_NORMAL_ITEM,  | 
                                                        
| 181 | 181 | 'file' => 'boincuser.admin.inc'  | 
                                                        
| 182 | - );  | 
                                                        |
| 182 | + );  | 
                                                        |
| 183 | 183 | |
| 184 | - $items['create_account.php'] = array(  | 
                                                        |
| 184 | + $items['create_account.php'] = array(  | 
                                                        |
| 185 | 185 | 'title' => 'Create Account RPC',  | 
                                                        
| 186 | 186 | 'description' => 'RPC for creating user accounts.',  | 
                                                        
| 187 | 187 | 'page callback' => 'boincuser_create_account',  | 
                                                        
| 188 | 188 | 'access callback' => TRUE,  | 
                                                        
| 189 | 189 | 'type' => MENU_CALLBACK  | 
                                                        
| 190 | - );  | 
                                                        |
| 191 | - $items['account_finish.php'] = array(  | 
                                                        |
| 190 | + );  | 
                                                        |
| 191 | + $items['account_finish.php'] = array(  | 
                                                        |
| 192 | 192 |      'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), | 
                                                        
| 193 | 193 | 'description' => 'RPC for after a user has created an account.',  | 
                                                        
| 194 | 194 | 'page callback' => 'boincuser_account_finish',  | 
                                                        
| 195 | 195 | 'access callback' => TRUE,  | 
                                                        
| 196 | 196 | 'type' => MENU_CALLBACK,  | 
                                                        
| 197 | - );  | 
                                                        |
| 198 | - $items['boincuser/autocomplete'] = array(  | 
                                                        |
| 197 | + );  | 
                                                        |
| 198 | + $items['boincuser/autocomplete'] = array(  | 
                                                        |
| 199 | 199 | 'page callback' => '_boincuser_user_name_autocomplete',  | 
                                                        
| 200 | 200 | 'access callback' => TRUE,  | 
                                                        
| 201 | 201 | 'type' => MENU_CALLBACK,  | 
                                                        
| 202 | - );  | 
                                                        |
| 203 | - $items['user/%user/recoveremail/%'] = array(  | 
                                                        |
| 202 | + );  | 
                                                        |
| 203 | + $items['user/%user/recoveremail/%'] = array(  | 
                                                        |
| 204 | 204 |      'title' => t('Recover previous email'), | 
                                                        
| 205 | 205 |      'description' => t('Form to revert email to previous address.'), | 
                                                        
| 206 | 206 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 207 | 207 |      'page arguments' => array('boincuser_revertemail', 3), | 
                                                        
| 208 | 208 | 'access callback' => 'user_is_logged_in',  | 
                                                        
| 209 | 209 | 'type' => MENU_CALLBACK,  | 
                                                        
| 210 | - );  | 
                                                        |
| 211 | - $items['recover_email.php'] = array(  | 
                                                        |
| 210 | + );  | 
                                                        |
| 211 | + $items['recover_email.php'] = array(  | 
                                                        |
| 212 | 212 |      'title' => t('Recover previous email'), | 
                                                        
| 213 | 213 |      'description' => t('redirect'), | 
                                                        
| 214 | 214 | 'page callback' => '_boincuser_redirect_recover_email',  | 
                                                        
| 215 | 215 | 'access callback' => TRUE,  | 
                                                        
| 216 | 216 | 'type' => MENU_CALLBACK,  | 
                                                        
| 217 | - );  | 
                                                        |
| 218 | - return $items;  | 
                                                        |
| 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/') { | 
                                                        |
| 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 | 229 | return;  | 
                                                        
| 230 | - }  | 
                                                        |
| 230 | + }  | 
                                                        |
| 231 | 231 | |
| 232 | - // If admin user, do some basic site functionality checks  | 
                                                        |
| 233 | -  if (user_access('administer site configuration')) { | 
                                                        |
| 232 | + // If admin user, do some basic site functionality checks  | 
                                                        |
| 233 | +    if (user_access('administer site configuration')) { | 
                                                        |
| 234 | 234 | // Ensure we have a configured BOINC environment  | 
                                                        
| 235 | 235 | boinc_get_path();  | 
                                                        
| 236 | 236 | boinc_get_scheduler_tags();  | 
                                                        
| 237 | - }  | 
                                                        |
| 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')) { | 
                                                        |
| 242 | +    if (module_exists('boincteam')) { | 
                                                        |
| 243 | 243 | // Display any persistent team messages  | 
                                                        
| 244 | 244 | boincteam_show_messages();  | 
                                                        
| 245 | - }  | 
                                                        |
| 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) ) { | 
                                                        |
| 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 | 253 |      if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { | 
                                                        
| 254 | 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])) { | 
                                                        |
| 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 | 259 | $path = drupal_get_path_alias($_GET['q']);  | 
                                                        
| 260 | 260 | |
| 261 | 261 | // Any paths that should NOT be redirected go here.  | 
                                                        
| 262 | 262 | // The site will not function correctly if these are not exempt!  | 
                                                        
| 263 | 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',  | 
                                                        |
| 264 | + 'user/termsofuse',  | 
                                                        |
| 265 | + 'logout',  | 
                                                        |
| 266 | + 'account/info/edit',  | 
                                                        |
| 267 | + 'user/' . $user->uid . '/edit',  | 
                                                        |
| 268 | + 'user/' . $user->uid . '/recoveremail/*',  | 
                                                        |
| 269 | + 'recover_email.php',  | 
                                                        |
| 270 | 270 | );  | 
                                                        
| 271 | 271 |          if (module_exists('boincuser_delete')) { | 
                                                        
| 272 | - $paths0[] = 'user/' . $user->uid . '/delete';  | 
                                                        |
| 273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*';  | 
                                                        |
| 274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*';  | 
                                                        |
| 272 | + $paths0[] = 'user/' . $user->uid . '/delete';  | 
                                                        |
| 273 | + $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*';  | 
                                                        |
| 274 | + $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*';  | 
                                                        |
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
| 277 | 277 | // Paths added by the admin  | 
                                                        
| 278 | 278 |          $paths1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_pathstoignore', "moderation\ncontent/moderation\nprivacy")); | 
                                                        
| 279 | 279 | $paths2 = array();  | 
                                                        
| 280 | 280 |          if (is_array($paths1)) { | 
                                                        
| 281 | -          $paths2 = array_map('strtolower', $paths1); | 
                                                        |
| 281 | +            $paths2 = array_map('strtolower', $paths1); | 
                                                        |
| 282 | 282 | }  | 
                                                        
| 283 | 283 | |
| 284 | 284 | // paths to ignore  | 
                                                        
| 285 | 285 | $paths_to_ignore = array_unique( array_merge($paths0, $paths2) );  | 
                                                        
| 286 | 286 | |
| 287 | 287 |          if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { | 
                                                        
| 288 | -          drupal_goto('user/termsofuse'); | 
                                                        |
| 288 | +            drupal_goto('user/termsofuse'); | 
                                                        |
| 289 | + }  | 
                                                        |
| 289 | 290 | }  | 
                                                        
| 290 | - }  | 
                                                        |
| 291 | 291 | }  | 
                                                        
| 292 | - }  | 
                                                        |
| 292 | + }  | 
                                                        |
| 293 | 293 | }  | 
                                                        
| 294 | 294 | |
| 295 | 295 | /**  | 
                                                        
@@ -297,13 +297,13 @@ discard block  | 
                                                    ||
| 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'); | 
                                                        |
| 300 | +    require_boinc('boinc_db'); | 
                                                        |
| 301 | +    require_boinc('user'); | 
                                                        |
| 302 | +    require_boinc('xml'); | 
                                                        |
| 303 | 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)) { | 
                                                        |
| 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 | 307 |      switch($op) { | 
                                                        
| 308 | 308 | case 'load':  | 
                                                        
| 309 | 309 | // User loading; insert BOINC data into the user object  | 
                                                        
@@ -311,11 +311,11 @@ discard block  | 
                                                    ||
| 311 | 311 | SELECT boinc_id, penalty_expiration  | 
                                                        
| 312 | 312 |          FROM {boincuser} WHERE uid = %d", | 
                                                        
| 313 | 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(" | 
                                                        |
| 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,  | 
                                                        
@@ -331,29 +331,29 @@ discard block  | 
                                                    ||
| 331 | 331 |          FROM {user} | 
                                                        
| 332 | 332 | WHERE id = %d",  | 
                                                        
| 333 | 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) { | 
                                                        |
| 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 | 350 |          $account->team = db_result(db_query(" | 
                                                        
| 351 | 351 |            SELECT nid FROM {boincteam} WHERE team_id = %d", | 
                                                        
| 352 | - $account->boincteam_id  | 
                                                        |
| 352 | + $account->boincteam_id  | 
                                                        |
| 353 | 353 | ));  | 
                                                        
| 354 | - }  | 
                                                        |
| 355 | - // Set post count  | 
                                                        |
| 356 | -      $account->post_count = db_result(db_query(" | 
                                                        |
| 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} | 
                                                        
@@ -366,8 +366,8 @@ discard block  | 
                                                    ||
| 366 | 366 | WHERE comments.uid = '%d'  | 
                                                        
| 367 | 367 | AND node.status = 1",  | 
                                                        
| 368 | 368 | $account->uid, $account->uid  | 
                                                        
| 369 | - ));  | 
                                                        |
| 370 | - break;  | 
                                                        |
| 369 | + ));  | 
                                                        |
| 370 | + break;  | 
                                                        |
| 371 | 371 | |
| 372 | 372 | case 'view':  | 
                                                        
| 373 | 373 | // SAMPLE: Add BOINC data to the user profile  | 
                                                        
@@ -393,74 +393,74 @@ discard block  | 
                                                    ||
| 393 | 393 | case 'user_account':  | 
                                                        
| 394 | 394 | // Validate data before updating user account info  | 
                                                        
| 395 | 395 | boincuser_account_validate($edit, $account);  | 
                                                        
| 396 | - break;  | 
                                                        |
| 396 | + break;  | 
                                                        |
| 397 | 397 | |
| 398 | 398 | default:  | 
                                                        
| 399 | 399 | |
| 400 | 400 | }  | 
                                                        
| 401 | 401 | // We don't want to save validation source, so remove it  | 
                                                        
| 402 | 402 | $edit['validation_source'] = null;  | 
                                                        
| 403 | - }  | 
                                                        |
| 404 | - break;  | 
                                                        |
| 403 | + }  | 
                                                        |
| 404 | + break;  | 
                                                        |
| 405 | 405 | |
| 406 | 406 | case 'insert':  | 
                                                        
| 407 | 407 | // New user being added to the system  | 
                                                        
| 408 | 408 | $imported = $_SESSION['importedUser'];  | 
                                                        
| 409 | - unset($_SESSION['importedUser']);  | 
                                                        |
| 409 | + unset($_SESSION['importedUser']);  | 
                                                        |
| 410 | 410 | |
| 411 | - watchdog(  | 
                                                        |
| 411 | + watchdog(  | 
                                                        |
| 412 | 412 | 'boincuser',  | 
                                                        
| 413 | 413 | 'Creating user account for %email_addr',  | 
                                                        
| 414 | 414 |          array('%email_addr' => $edit['mail']), | 
                                                        
| 415 | 415 | WATCHDOG_NOTICE  | 
                                                        
| 416 | - );  | 
                                                        |
| 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 | 424 | // set email address lower-case  | 
                                                        
| 425 | 425 | $lower_email_addr = strtolower($edit['mail']);  | 
                                                        
| 426 | 426 | |
| 427 | 427 |          if ($edit['boincuser_name']) { | 
                                                        
| 428 | - $myname = $edit['boincuser_name'];  | 
                                                        |
| 428 | + $myname = $edit['boincuser_name'];  | 
                                                        |
| 429 | 429 | }  | 
                                                        
| 430 | 430 |          else if ($edit['name']) { | 
                                                        
| 431 | - $myname = $edit['name'];  | 
                                                        |
| 431 | + $myname = $edit['name'];  | 
                                                        |
| 432 | 432 | }  | 
                                                        
| 433 | 433 |          else { | 
                                                        
| 434 | - $myname = 'noname';  | 
                                                        |
| 434 | + $myname = 'noname';  | 
                                                        |
| 435 | 435 | }  | 
                                                        
| 436 | 436 | |
| 437 | 437 | $user_params = array(  | 
                                                        
| 438 | - 'email_addr' => $lower_email_addr,  | 
                                                        |
| 439 | - 'name' => $myname,  | 
                                                        |
| 438 | + 'email_addr' => $lower_email_addr,  | 
                                                        |
| 439 | + 'name' => $myname,  | 
                                                        |
| 440 | 440 | );  | 
                                                        
| 441 | 441 | |
| 442 | 442 | // If the 'pass' variable is already a hash, then don't hash it again.  | 
                                                        
| 443 | 443 |          if ($edit['boinchash_flag']) { | 
                                                        
| 444 | - $user_params['passwd_hash'] = $edit['pass'];  | 
                                                        |
| 444 | + $user_params['passwd_hash'] = $edit['pass'];  | 
                                                        |
| 445 | 445 | }  | 
                                                        
| 446 | 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);  | 
                                                        |
| 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 | 451 | }  | 
                                                        
| 452 | 452 | |
| 453 | 453 | $boinc_user = boincuser_register_make_user($user_params);  | 
                                                        
| 454 | 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;  | 
                                                        |
| 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 | 458 | }  | 
                                                        
| 459 | 459 | |
| 460 | 460 | // Add user to community role by default (not banned)  | 
                                                        
| 461 | 461 |          $unrestricted_role = array_search('community member', user_roles(true)); | 
                                                        
| 462 | 462 | $edit['roles'] = array(  | 
                                                        
| 463 | - $unrestricted_role => ''  | 
                                                        |
| 463 | + $unrestricted_role => ''  | 
                                                        |
| 464 | 464 | );  | 
                                                        
| 465 | 465 | |
| 466 | 466 | // Disable show_hosts flag, set to TRUE by default  | 
                                                        
@@ -471,14 +471,14 @@ discard block  | 
                                                    ||
| 471 | 471 | // Cross reference Drupal account with BOINC  | 
                                                        
| 472 | 472 |          $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id); | 
                                                        
| 473 | 473 |          if (!$reference) { | 
                                                        
| 474 | -          drupal_set_message(t('Error connecting BOINC account.'), 'error'); | 
                                                        |
| 475 | - return;  | 
                                                        |
| 474 | +            drupal_set_message(t('Error connecting BOINC account.'), 'error'); | 
                                                        |
| 475 | + return;  | 
                                                        |
| 476 | 476 | }  | 
                                                        
| 477 | 477 | |
| 478 | 478 | // if terms of use exist, the user must agree.  | 
                                                        
| 479 | 479 |          $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 480 | 480 |          if (!empty($termsofuse)) { | 
                                                        
| 481 | - $reference2 = boincuser_consentto_termsofuse($account);  | 
                                                        |
| 481 | + $reference2 = boincuser_consentto_termsofuse($account);  | 
                                                        |
| 482 | 482 | }  | 
                                                        
| 483 | 483 | |
| 484 | 484 | // Don't save custom fields to the Drupal user object  | 
                                                        
@@ -486,10 +486,10 @@ discard block  | 
                                                    ||
| 486 | 486 | $edit['boinchash_flag'] = null;  | 
                                                        
| 487 | 487 | // Set email address to lower case in Drupal users table  | 
                                                        
| 488 | 488 |          if ($account) { | 
                                                        
| 489 | -          user_save($account, array('mail' => $lower_email_addr)); | 
                                                        |
| 489 | +            user_save($account, array('mail' => $lower_email_addr)); | 
                                                        |
| 490 | 490 | }  | 
                                                        
| 491 | - }  | 
                                                        |
| 492 | - break;  | 
                                                        |
| 491 | + }  | 
                                                        |
| 492 | + break;  | 
                                                        |
| 493 | 493 | |
| 494 | 494 | case 'update':  | 
                                                        
| 495 | 495 |        if (isset($edit['update_source'])) { | 
                                                        
@@ -500,8 +500,8 @@ discard block  | 
                                                    ||
| 500 | 500 | // Ensure that BOINC data is altered  | 
                                                        
| 501 | 501 | |
| 502 | 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) { | 
                                                        |
| 503 | + $changing_pass = ($edit['pass']) ? true : false;  | 
                                                        |
| 504 | +            if ($changing_email OR $changing_pass) { | 
                                                        |
| 505 | 505 | // set email address to lower-case  | 
                                                        
| 506 | 506 | $lower_email_addr = strtolower($edit['mail']);  | 
                                                        
| 507 | 507 | |
@@ -510,47 +510,47 @@ discard block  | 
                                                    ||
| 510 | 510 | $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT );  | 
                                                        
| 511 | 511 | // Algorithm for changing email and/or password  | 
                                                        
| 512 | 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"; | 
                                                        |
| 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 | 517 | }  | 
                                                        
| 518 | 518 |              else { | 
                                                        
| 519 | -              $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; | 
                                                        |
| 519 | +                $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; | 
                                                        |
| 520 | 520 | }  | 
                                                        
| 521 | 521 | |
| 522 | 522 | // Update user account information  | 
                                                        
| 523 | 523 | $result = $boinc_user->update($querypart);  | 
                                                        
| 524 | 524 | |
| 525 | 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')); | 
                                                        |
| 526 | + // reload account  | 
                                                        |
| 527 | + $account = user_load($account->uid);  | 
                                                        |
| 528 | +                _boincuser_send_emailchange($account, $lower_email_addr, $prev_email, user_access('administer users')); | 
                                                        |
| 529 | 529 | }  | 
                                                        
| 530 | 530 | |
| 531 | 531 | // Change email to edit to lower-case version, this sets  | 
                                                        
| 532 | 532 | // email in Drupal database to the lower-case email  | 
                                                        
| 533 | 533 | // address.  | 
                                                        
| 534 | 534 | $edit['mail'] = strtolower($lower_email_addr);  | 
                                                        
| 535 | - }  | 
                                                        |
| 535 | + }  | 
                                                        |
| 536 | 536 | |
| 537 | - // Change boinc username  | 
                                                        |
| 538 | -          if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { | 
                                                        |
| 537 | + // Change boinc username  | 
                                                        |
| 538 | +            if ($edit['boincuser_name'] and ($edit['boincuser_name'] != $boinc_user->name)) { | 
                                                        |
| 539 | 539 | $boincuser_name = $edit['boincuser_name'];  | 
                                                        
| 540 | 540 | $result = $boinc_user->update(  | 
                                                        
| 541 | 541 |                  "name='{$boincuser_name}'" | 
                                                        
| 542 | 542 | );  | 
                                                        
| 543 | - }  | 
                                                        |
| 543 | + }  | 
                                                        |
| 544 | 544 | |
| 545 | - break;  | 
                                                        |
| 545 | + break;  | 
                                                        |
| 546 | 546 | case 'user_profile':  | 
                                                        
| 547 | 547 |            if ($edit['boincuser_name'] != $boinc_user->name) { | 
                                                        
| 548 | 548 | $boincuser_name = $edit['boincuser_name'];  | 
                                                        
| 549 | 549 | $result = $boinc_user->update(  | 
                                                        
| 550 | 550 |                  "name='{$boincuser_name}'" | 
                                                        
| 551 | 551 | );  | 
                                                        
| 552 | - }  | 
                                                        |
| 553 | - break;  | 
                                                        |
| 552 | + }  | 
                                                        |
| 553 | + break;  | 
                                                        |
| 554 | 554 | default:  | 
                                                        
| 555 | 555 | }  | 
                                                        
| 556 | 556 | // We don't want to save update source or duplicate custom fields, so  | 
                                                        
@@ -558,23 +558,23 @@ discard block  | 
                                                    ||
| 558 | 558 | $edit['update_source'] = null;  | 
                                                        
| 559 | 559 | $edit['boincuser_name'] = null;  | 
                                                        
| 560 | 560 | $edit['current_pass'] = null;  | 
                                                        
| 561 | - }  | 
                                                        |
| 562 | - break;  | 
                                                        |
| 561 | + }  | 
                                                        |
| 562 | + break;  | 
                                                        |
| 563 | 563 | |
| 564 | 564 | case 'login':  | 
                                                        
| 565 | 565 | // Function is forward compatible to Drupal 7  | 
                                                        
| 566 | 566 | boincuser_user_login($edit, $account);  | 
                                                        
| 567 | - break;  | 
                                                        |
| 567 | + break;  | 
                                                        |
| 568 | 568 | |
| 569 | 569 | case 'delete':  | 
                                                        
| 570 | 570 | // Function is forward compatible to Drupal 7  | 
                                                        
| 571 | 571 | boincuser_user_delete($account);  | 
                                                        
| 572 | - break;  | 
                                                        |
| 572 | + break;  | 
                                                        |
| 573 | 573 | |
| 574 | 574 | default:  | 
                                                        
| 575 | 575 | |
| 576 | 576 | }  | 
                                                        
| 577 | - }  | 
                                                        |
| 577 | + }  | 
                                                        |
| 578 | 578 | }  | 
                                                        
| 579 | 579 | |
| 580 | 580 | /**  | 
                                                        
@@ -583,39 +583,39 @@ discard block  | 
                                                    ||
| 583 | 583 | *(forward compatible to Drupal 7).  | 
                                                        
| 584 | 584 | */  | 
                                                        
| 585 | 585 |  function boincuser_user_login(&$edit, $account) { | 
                                                        
| 586 | -  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        |
| 587 | -  $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        |
| 588 | -  | 
                                                        |
| 589 | - // Use the same code as boincuser_form_alter(), for case  | 
                                                        |
| 590 | - // 'user_profile_form', if the refering page is the user password  | 
                                                        |
| 591 | - // reset form, then do not check for terms of use.  | 
                                                        |
| 592 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1;  | 
                                                        |
| 593 | -  if ($reset_pass) { | 
                                                        |
| 586 | +    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        |
| 587 | +    $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        |
| 588 | +  | 
                                                        |
| 589 | + // Use the same code as boincuser_form_alter(), for case  | 
                                                        |
| 590 | + // 'user_profile_form', if the refering page is the user password  | 
                                                        |
| 591 | + // reset form, then do not check for terms of use.  | 
                                                        |
| 592 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1;  | 
                                                        |
| 593 | +    if ($reset_pass) { | 
                                                        |
| 594 | 594 | return;  | 
                                                        
| 595 | - }  | 
                                                        |
| 595 | + }  | 
                                                        |
| 596 | 596 | |
| 597 | - // Check if user has agreed to terms of use.  | 
                                                        |
| 598 | - if ( (!empty($termsofuse)) and ($account->uid) and  | 
                                                        |
| 597 | + // Check if user has agreed to terms of use.  | 
                                                        |
| 598 | + if ( (!empty($termsofuse)) and ($account->uid) and  | 
                                                        |
| 599 | 599 |         (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { | 
                                                        
| 600 | 600 | |
| 601 | 601 | // Admins are exempted.  | 
                                                        
| 602 | 602 |      $administrator_role = array_search('administrator', user_roles(true)); | 
                                                        
| 603 | 603 |      if (!isset($account->roles[$administrator_role])) { | 
                                                        
| 604 | 604 | |
| 605 | - // Find and save the current destination and use as an parameter  | 
                                                        |
| 606 | - // to send the user back to here he/she came from.  | 
                                                        |
| 607 | -      $np = ltrim('user/termsofuse', '/'); | 
                                                        |
| 608 | - $path_for_destination = rawurlencode($np);  | 
                                                        |
| 605 | + // Find and save the current destination and use as an parameter  | 
                                                        |
| 606 | + // to send the user back to here he/she came from.  | 
                                                        |
| 607 | +        $np = ltrim('user/termsofuse', '/'); | 
                                                        |
| 608 | + $path_for_destination = rawurlencode($np);  | 
                                                        |
| 609 | 609 | |
| 610 | - $query_for_destination = '';  | 
                                                        |
| 611 | - $prevdest = $_REQUEST['destination'];  | 
                                                        |
| 612 | -      if ($prevdest) { | 
                                                        |
| 610 | + $query_for_destination = '';  | 
                                                        |
| 611 | + $prevdest = $_REQUEST['destination'];  | 
                                                        |
| 612 | +        if ($prevdest) { | 
                                                        |
| 613 | 613 | $query_for_destination = '?destination=' . $prevdest;  | 
                                                        
| 614 | - }  | 
                                                        |
| 615 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination;  | 
                                                        |
| 614 | + }  | 
                                                        |
| 615 | + $_REQUEST['destination'] = $path_for_destination . $query_for_destination;  | 
                                                        |
| 616 | 616 | |
| 617 | 617 | }  | 
                                                        
| 618 | - }  | 
                                                        |
| 618 | + }  | 
                                                        |
| 619 | 619 | }  | 
                                                        
| 620 | 620 | |
| 621 | 621 | /**  | 
                                                        
@@ -624,16 +624,16 @@ discard block  | 
                                                    ||
| 624 | 624 | */  | 
                                                        
| 625 | 625 |  function boincuser_user_delete($account) { | 
                                                        
| 626 | 626 | |
| 627 | - $boincid = $account->boincuser_id;  | 
                                                        |
| 628 | - // bug in comment module, remove user name from comments. Find all  | 
                                                        |
| 629 | - // comments with uid=0 and clear the field 'name'.  | 
                                                        |
| 630 | -  $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); | 
                                                        |
| 627 | + $boincid = $account->boincuser_id;  | 
                                                        |
| 628 | + // bug in comment module, remove user name from comments. Find all  | 
                                                        |
| 629 | + // comments with uid=0 and clear the field 'name'.  | 
                                                        |
| 630 | +    $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); | 
                                                        |
| 631 | 631 | |
| 632 | - // Delete entry in drupal boincuser table.  | 
                                                        |
| 633 | -  $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); | 
                                                        |
| 634 | -  if (!$qrc2) { | 
                                                        |
| 632 | + // Delete entry in drupal boincuser table.  | 
                                                        |
| 633 | +    $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); | 
                                                        |
| 634 | +    if (!$qrc2) { | 
                                                        |
| 635 | 635 |      watchdog('user', 'Error deleting user account, boincuser table UID: %uid.', array('%uid' => $account->uid), WATCHDOG_ERROR); | 
                                                        
| 636 | - }  | 
                                                        |
| 636 | + }  | 
                                                        |
| 637 | 637 | }  | 
                                                        
| 638 | 638 | |
| 639 | 639 | |
@@ -642,13 +642,13 @@ discard block  | 
                                                    ||
| 642 | 642 | * Obsolete in Drupal 7...  | 
                                                        
| 643 | 643 | */  | 
                                                        
| 644 | 644 |  function boincuser_nodeapi(&$node, $op, $a3 = null, $a4 = null) { | 
                                                        
| 645 | - // In Drupal 7, these operation cases will all exist as their own hooks,  | 
                                                        |
| 646 | - // so let's approximate that here so that this function can simply be removed  | 
                                                        |
| 647 | - // upon migration to 7  | 
                                                        |
| 648 | -  switch($op) { | 
                                                        |
| 649 | - case 'update':  | 
                                                        |
| 645 | + // In Drupal 7, these operation cases will all exist as their own hooks,  | 
                                                        |
| 646 | + // so let's approximate that here so that this function can simply be removed  | 
                                                        |
| 647 | + // upon migration to 7  | 
                                                        |
| 648 | +    switch($op) { | 
                                                        |
| 649 | + case 'update':  | 
                                                        |
| 650 | 650 | boincuser_node_update($node);  | 
                                                        
| 651 | - }  | 
                                                        |
| 651 | + }  | 
                                                        |
| 652 | 652 | }  | 
                                                        
| 653 | 653 | |
| 654 | 654 | /**  | 
                                                        
@@ -656,8 +656,8 @@ discard block  | 
                                                    ||
| 656 | 656 | * is updated (forward compatible to Drupal 7)  | 
                                                        
| 657 | 657 | */  | 
                                                        
| 658 | 658 |  function boincuser_node_update($node) { | 
                                                        
| 659 | -  switch($node->type) { | 
                                                        |
| 660 | - case 'profile':  | 
                                                        |
| 659 | +    switch($node->type) { | 
                                                        |
| 660 | + case 'profile':  | 
                                                        |
| 661 | 661 | // Update the BOINC database directly  | 
                                                        
| 662 | 662 | $account = user_load($node->uid);  | 
                                                        
| 663 | 663 | // Save user account data  | 
                                                        
@@ -669,11 +669,11 @@ discard block  | 
                                                    ||
| 669 | 669 | UPDATE user  | 
                                                        
| 670 | 670 | SET country = '%s', postal_code = '%s', url = '%s', has_profile = 1  | 
                                                        
| 671 | 671 | WHERE id = %d",  | 
                                                        
| 672 | - $country, $postal_code, $url, $account->boincuser_id  | 
                                                        |
| 672 | + $country, $postal_code, $url, $account->boincuser_id  | 
                                                        |
| 673 | 673 | );  | 
                                                        
| 674 | 674 |      db_set_active('default'); | 
                                                        
| 675 | 675 |      if (!$account_updated) { | 
                                                        
| 676 | -      drupal_set_message(t('Error saving BOINC account info.'), 'error'); | 
                                                        |
| 676 | +        drupal_set_message(t('Error saving BOINC account info.'), 'error'); | 
                                                        |
| 677 | 677 | }  | 
                                                        
| 678 | 678 | // Save profile data  | 
                                                        
| 679 | 679 | $response1 = $node->field_background[0]['value'];  | 
                                                        
@@ -684,16 +684,16 @@ discard block  | 
                                                    ||
| 684 | 684 | SET userid = %d, response1 = '%s', response2 = '%s'  | 
                                                        
| 685 | 685 | ON DUPLICATE KEY UPDATE  | 
                                                        
| 686 | 686 | response1 = '%s', response2 = '%s'",  | 
                                                        
| 687 | - $account->boincuser_id, $response1, $response2,  | 
                                                        |
| 688 | - $response1, $response2  | 
                                                        |
| 687 | + $account->boincuser_id, $response1, $response2,  | 
                                                        |
| 688 | + $response1, $response2  | 
                                                        |
| 689 | 689 | );  | 
                                                        
| 690 | 690 |      db_set_active('default'); | 
                                                        
| 691 | 691 |      if (!$profile_updated) { | 
                                                        
| 692 | -      drupal_set_message(t('Error saving BOINC profile.'), 'error'); | 
                                                        |
| 692 | +        drupal_set_message(t('Error saving BOINC profile.'), 'error'); | 
                                                        |
| 693 | 693 | }  | 
                                                        
| 694 | 694 | break;  | 
                                                        
| 695 | 695 | |
| 696 | - default:  | 
                                                        |
| 696 | + default:  | 
                                                        |
| 697 | 697 | |
| 698 | 698 | }  | 
                                                        
| 699 | 699 | }  | 
                                                        
@@ -702,21 +702,21 @@ discard block  | 
                                                    ||
| 702 | 702 | * Implementation of hook_views_api()  | 
                                                        
| 703 | 703 | */  | 
                                                        
| 704 | 704 |  function boincuser_views_api() { | 
                                                        
| 705 | - return array(  | 
                                                        |
| 705 | + return array(  | 
                                                        |
| 706 | 706 | 'api' => 2.0,  | 
                                                        
| 707 | 707 |      'path' => drupal_get_path('module', 'boincuser') | 
                                                        
| 708 | - );  | 
                                                        |
| 708 | + );  | 
                                                        |
| 709 | 709 | }  | 
                                                        
| 710 | 710 | |
| 711 | 711 | /**  | 
                                                        
| 712 | 712 | * Implementation of hook_form_alter()  | 
                                                        
| 713 | 713 | */  | 
                                                        
| 714 | 714 |  function boincuser_form_alter(&$form, $form_state, $form_id) { | 
                                                        
| 715 | -  require_boinc('token'); | 
                                                        |
| 715 | +    require_boinc('token'); | 
                                                        |
| 716 | 716 | |
| 717 | - global $user;  | 
                                                        |
| 718 | -  switch ($form_id) { | 
                                                        |
| 719 | - case 'flag_confirm':  | 
                                                        |
| 717 | + global $user;  | 
                                                        |
| 718 | +    switch ($form_id) { | 
                                                        |
| 719 | + case 'flag_confirm':  | 
                                                        |
| 720 | 720 | // The URL seems to be the only way to put any kind of context to this  | 
                                                        
| 721 | 721 | // request!  | 
                                                        
| 722 | 722 | $action = arg(2);  | 
                                                        
@@ -725,25 +725,25 @@ discard block  | 
                                                    ||
| 725 | 725 | |
| 726 | 726 | // Wrap action buttons for styling consistency  | 
                                                        
| 727 | 727 | $form['form control tabs prefix'] = array(  | 
                                                        
| 728 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 729 | - '#weight' => 1001,  | 
                                                        |
| 728 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 729 | + '#weight' => 1001,  | 
                                                        |
| 730 | 730 | );  | 
                                                        
| 731 | 731 | |
| 732 | 732 |      switch ($flag_type) { | 
                                                        
| 733 | 733 | case 'friend':  | 
                                                        
| 734 | 734 | $friend_id = $form['content_id']['#value'];  | 
                                                        
| 735 | -      $flag = flag_get_flag('friend'); | 
                                                        |
| 736 | - $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);  | 
                                                        |
| 737 | -  | 
                                                        |
| 738 | - // General friend form overrides  | 
                                                        |
| 739 | - $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';  | 
                                                        |
| 740 | -      $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 741 | - $form['flag_friend_submit']['#type'] = 'submit';  | 
                                                        |
| 742 | - $form['flag_friend_submit']['#suffix'] = '</li>';  | 
                                                        |
| 743 | - $form['flag_friend_submit']['#weight'] = 1002;  | 
                                                        |
| 744 | -  | 
                                                        |
| 745 | -      switch ($friend_status) { | 
                                                        |
| 746 | - case FLAG_FRIEND_BOTH:  | 
                                                        |
| 735 | +        $flag = flag_get_flag('friend'); | 
                                                        |
| 736 | + $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);  | 
                                                        |
| 737 | +  | 
                                                        |
| 738 | + // General friend form overrides  | 
                                                        |
| 739 | + $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';  | 
                                                        |
| 740 | +        $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 741 | + $form['flag_friend_submit']['#type'] = 'submit';  | 
                                                        |
| 742 | + $form['flag_friend_submit']['#suffix'] = '</li>';  | 
                                                        |
| 743 | + $form['flag_friend_submit']['#weight'] = 1002;  | 
                                                        |
| 744 | +  | 
                                                        |
| 745 | +        switch ($friend_status) { | 
                                                        |
| 746 | + case FLAG_FRIEND_BOTH:  | 
                                                        |
| 747 | 747 | case FLAG_FRIEND_FLAGGED:  | 
                                                        
| 748 | 748 | unset($form['actions']);  | 
                                                        
| 749 | 749 |          $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); | 
                                                        
@@ -752,53 +752,53 @@ discard block  | 
                                                    ||
| 752 | 752 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit';  | 
                                                        
| 753 | 753 | $form['#submit'][] = $final_handler;  | 
                                                        
| 754 | 754 | break;  | 
                                                        
| 755 | - case FLAG_FRIEND_PENDING:  | 
                                                        |
| 755 | + case FLAG_FRIEND_PENDING:  | 
                                                        |
| 756 | 756 | unset($form['actions']);  | 
                                                        
| 757 | 757 |          $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); | 
                                                        
| 758 | 758 | break;  | 
                                                        
| 759 | - case FLAG_FRIEND_APPROVAL:  | 
                                                        |
| 759 | + case FLAG_FRIEND_APPROVAL:  | 
                                                        |
| 760 | 760 |          if ($action == 'flag') { | 
                                                        
| 761 | -          $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 761 | +            $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 762 | 762 | }  | 
                                                        
| 763 | 763 |          elseif ($action == 'unflag') { | 
                                                        
| 764 | - unset($form['actions']);  | 
                                                        |
| 765 | -          $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 764 | + unset($form['actions']);  | 
                                                        |
| 765 | +            $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 766 | 766 | }  | 
                                                        
| 767 | 767 | break;  | 
                                                        
| 768 | - case FLAG_FRIEND_UNFLAGGED:  | 
                                                        |
| 768 | + case FLAG_FRIEND_UNFLAGGED:  | 
                                                        |
| 769 | 769 | default:  | 
                                                        
| 770 | 770 | $user_links[] = array(  | 
                                                        
| 771 | -          'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), | 
                                                        |
| 772 | -          'href' => "flag/confirm/flag/friend/{$account->uid}" | 
                                                        |
| 771 | +            'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), | 
                                                        |
| 772 | +            'href' => "flag/confirm/flag/friend/{$account->uid}" | 
                                                        |
| 773 | 773 | );  | 
                                                        
| 774 | - }  | 
                                                        |
| 775 | - break;  | 
                                                        |
| 774 | + }  | 
                                                        |
| 775 | + break;  | 
                                                        |
| 776 | 776 | |
| 777 | 777 | default:  | 
                                                        
| 778 | 778 | }  | 
                                                        
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array(  | 
                                                        
| 781 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', | 
                                                        |
| 782 | - '#weight' => 1004,  | 
                                                        |
| 781 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', | 
                                                        |
| 782 | + '#weight' => 1004,  | 
                                                        |
| 783 | 783 | );  | 
                                                        
| 784 | 784 | $form['form control tabs suffix'] = array(  | 
                                                        
| 785 | - '#value' => '</ul>',  | 
                                                        |
| 786 | - '#weight' => 1010,  | 
                                                        |
| 785 | + '#value' => '</ul>',  | 
                                                        |
| 786 | + '#weight' => 1010,  | 
                                                        |
| 787 | 787 | );  | 
                                                        
| 788 | 788 | |
| 789 | 789 | break;  | 
                                                        
| 790 | 790 | |
| 791 | - // General node edit form  | 
                                                        |
| 792 | - case 'news_node_form':  | 
                                                        |
| 791 | + // General node edit form  | 
                                                        |
| 792 | + case 'news_node_form':  | 
                                                        |
| 793 | 793 | $form['separator_bottom'] = array(  | 
                                                        
| 794 | - '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 795 | - '#weight' => 999,  | 
                                                        |
| 794 | + '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 795 | + '#weight' => 999,  | 
                                                        |
| 796 | 796 | );  | 
                                                        
| 797 | 797 | |
| 798 | 798 | // Wrap action buttons for styling consistency  | 
                                                        
| 799 | 799 | $form['buttons']['form control tabs prefix'] = array(  | 
                                                        
| 800 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 801 | - '#weight' => 1001,  | 
                                                        |
| 800 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 801 | + '#weight' => 1001,  | 
                                                        |
| 802 | 802 | );  | 
                                                        
| 803 | 803 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 804 | 804 |      $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        
@@ -811,15 +811,15 @@ discard block  | 
                                                    ||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 813 | 813 | $form['buttons']['cancel'] = array(  | 
                                                        
| 814 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 815 | - '#weight' => 1005,  | 
                                                        |
| 814 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 815 | + '#weight' => 1005,  | 
                                                        |
| 816 | 816 | );  | 
                                                        
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
| 818 | 818 | $form['buttons']['delete']['#suffix'] = '</li>';  | 
                                                        
| 819 | 819 | $form['buttons']['delete']['#weight'] = 1006;  | 
                                                        
| 820 | 820 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
| 821 | - '#value' => '</ul>',  | 
                                                        |
| 822 | - '#weight' => 1010,  | 
                                                        |
| 821 | + '#value' => '</ul>',  | 
                                                        |
| 822 | + '#weight' => 1010,  | 
                                                        |
| 823 | 823 | );  | 
                                                        
| 824 | 824 | |
| 825 | 825 | // Preview is ugly, unset until it works  | 
                                                        
@@ -827,16 +827,16 @@ discard block  | 
                                                    ||
| 827 | 827 | |
| 828 | 828 | break;  | 
                                                        
| 829 | 829 | |
| 830 | - case 'node_delete_confirm':  | 
                                                        |
| 830 | + case 'node_delete_confirm':  | 
                                                        |
| 831 | 831 | $form['separator_bottom'] = array(  | 
                                                        
| 832 | - '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 833 | - '#weight' => 999,  | 
                                                        |
| 832 | + '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 833 | + '#weight' => 999,  | 
                                                        |
| 834 | 834 | );  | 
                                                        
| 835 | 835 | |
| 836 | 836 | // Wrap action buttons for styling consistency  | 
                                                        
| 837 | 837 | $form['actions']['form control tabs prefix'] = array(  | 
                                                        
| 838 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 839 | - '#weight' => 1001,  | 
                                                        |
| 838 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 839 | + '#weight' => 1001,  | 
                                                        |
| 840 | 840 | );  | 
                                                        
| 841 | 841 | $form['actions']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 842 | 842 |      $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); | 
                                                        
@@ -844,23 +844,23 @@ discard block  | 
                                                    ||
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002;  | 
                                                        
| 845 | 845 | $form['actions']['cancel'] = array(  | 
                                                        
| 846 | 846 |          '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        
| 847 | - '#weight' => 1005,  | 
                                                        |
| 847 | + '#weight' => 1005,  | 
                                                        |
| 848 | 848 | );  | 
                                                        
| 849 | 849 | $form['actions']['form control tabs suffix'] = array(  | 
                                                        
| 850 | - '#value' => '</ul>',  | 
                                                        |
| 851 | - '#weight' => 1010,  | 
                                                        |
| 850 | + '#value' => '</ul>',  | 
                                                        |
| 851 | + '#weight' => 1010,  | 
                                                        |
| 852 | 852 | );  | 
                                                        
| 853 | 853 | $form['#redirect'] = 'account/profile';  | 
                                                        
| 854 | 854 | break;  | 
                                                        
| 855 | 855 | |
| 856 | - case 'privatemsg_new':  | 
                                                        |
| 856 | + case 'privatemsg_new':  | 
                                                        |
| 857 | 857 | |
| 858 | 858 | $form['privatemsg']['body']['#title'] = '';  | 
                                                        
| 859 | 859 | |
| 860 | 860 | // Wrap action buttons for styling consistency  | 
                                                        
| 861 | 861 | $form['privatemsg']['form control tabs prefix'] = array(  | 
                                                        
| 862 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 863 | - '#weight' => 1001,  | 
                                                        |
| 862 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 863 | + '#weight' => 1001,  | 
                                                        |
| 864 | 864 | );  | 
                                                        
| 865 | 865 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 866 | 866 |      $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); | 
                                                        
@@ -870,26 +870,26 @@ discard block  | 
                                                    ||
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>';  | 
                                                        
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003;  | 
                                                        
| 872 | 872 | $form['privatemsg']['cancel'] = array(  | 
                                                        
| 873 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 874 | - '#weight' => 1004,  | 
                                                        |
| 873 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 874 | + '#weight' => 1004,  | 
                                                        |
| 875 | 875 | );  | 
                                                        
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array(  | 
                                                        
| 877 | - '#value' => '</ul>',  | 
                                                        |
| 878 | - '#weight' => 1010,  | 
                                                        |
| 877 | + '#value' => '</ul>',  | 
                                                        |
| 878 | + '#weight' => 1010,  | 
                                                        |
| 879 | 879 | );  | 
                                                        
| 880 | 880 | |
| 881 | 881 | unset($form['privatemsg']['recipient_display']);  | 
                                                        
| 882 | 882 | |
| 883 | 883 | break;  | 
                                                        
| 884 | 884 | |
| 885 | - // Login form  | 
                                                        |
| 886 | - case 'user_login':  | 
                                                        |
| 885 | + // Login form  | 
                                                        |
| 886 | + case 'user_login':  | 
                                                        |
| 887 | 887 | case 'user_login_block':  | 
                                                        
| 888 | 888 |        drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); | 
                                                        
| 889 | 889 | // Replace name with email in login form  | 
                                                        
| 890 | 890 | unset($form['name']);  | 
                                                        
| 891 | 891 | array_unshift($form, array(  | 
                                                        
| 892 | - 'email' => array(  | 
                                                        |
| 892 | + 'email' => array(  | 
                                                        |
| 893 | 893 | '#type' => 'textfield',  | 
                                                        
| 894 | 894 |          '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), | 
                                                        
| 895 | 895 | '#size' => ($form_id == 'user_login_block') ? 15 : 60,  | 
                                                        
@@ -897,18 +897,18 @@ discard block  | 
                                                    ||
| 897 | 897 | '#required' => TRUE,  | 
                                                        
| 898 | 898 |          '#attributes' => array('tabindex' => '1'), | 
                                                        
| 899 | 899 |          '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') | 
                                                        
| 900 | - ),  | 
                                                        |
| 901 | - 'validation_source' => array(  | 
                                                        |
| 900 | + ),  | 
                                                        |
| 901 | + 'validation_source' => array(  | 
                                                        |
| 902 | 902 | '#type' => 'hidden',  | 
                                                        
| 903 | 903 | '#value' => 'user_login'  | 
                                                        
| 904 | - )  | 
                                                        |
| 904 | + )  | 
                                                        |
| 905 | 905 | ));  | 
                                                        
| 906 | 906 | $form['#redirect'] = 'home';  | 
                                                        
| 907 | 907 | |
| 908 | 908 | // Wrap action buttons for styling consistency  | 
                                                        
| 909 | 909 | $form['buttons']['form control tabs prefix'] = array(  | 
                                                        
| 910 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 911 | - '#weight' => 1001,  | 
                                                        |
| 910 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 911 | + '#weight' => 1001,  | 
                                                        |
| 912 | 912 | );  | 
                                                        
| 913 | 913 | $form['buttons']['submit'] = $form['submit'];  | 
                                                        
| 914 | 914 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
@@ -916,8 +916,8 @@ discard block  | 
                                                    ||
| 916 | 916 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 917 | 917 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 918 | 918 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
| 919 | - '#value' => '</ul>',  | 
                                                        |
| 920 | - '#weight' => 1010,  | 
                                                        |
| 919 | + '#value' => '</ul>',  | 
                                                        |
| 920 | + '#weight' => 1010,  | 
                                                        |
| 921 | 921 | );  | 
                                                        
| 922 | 922 | unset($form['submit']);  | 
                                                        
| 923 | 923 | |
@@ -926,23 +926,23 @@ discard block  | 
                                                    ||
| 926 | 926 |      isset($form['buttons']['submit']['#attributes']) ? array_push($form['buttons']['submit']['#attributes'], array('tabindex' => '3')) : $form['buttons']['submit']['#attributes'] = array('tabindex' => '3'); | 
                                                        
| 927 | 927 | // If the user login form is being submitted, use BOINC validation handler.  | 
                                                        
| 928 | 928 |      if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { | 
                                                        
| 929 | - // Find the local validation function's entry so we can replace it.  | 
                                                        |
| 930 | -      $array_key = array_search('user_login_authenticate_validate', $form['#validate']); | 
                                                        |
| 931 | -      if ($array_key === FALSE) { | 
                                                        |
| 929 | + // Find the local validation function's entry so we can replace it.  | 
                                                        |
| 930 | +        $array_key = array_search('user_login_authenticate_validate', $form['#validate']); | 
                                                        |
| 931 | +        if ($array_key === FALSE) { | 
                                                        |
| 932 | 932 | // Could not find it. Some other module must have run form_alter().  | 
                                                        
| 933 | 933 | // We will simply add our validation just before the final validator.  | 
                                                        
| 934 | 934 | $final_validator = array_pop($form['#validate']);  | 
                                                        
| 935 | 935 | $form['#validate'][] = 'boincuser_login_validate';  | 
                                                        
| 936 | 936 | $form['#validate'][] = $final_validator;  | 
                                                        
| 937 | -      } else { | 
                                                        |
| 937 | +        } else { | 
                                                        |
| 938 | 938 | // Replace the local validation function with BOINC validation  | 
                                                        
| 939 | 939 | $form['#validate'][$array_key] = 'boincuser_login_validate';  | 
                                                        
| 940 | - }  | 
                                                        |
| 940 | + }  | 
                                                        |
| 941 | 941 | }  | 
                                                        
| 942 | 942 | break;  | 
                                                        
| 943 | 943 | |
| 944 | - // User credentials form  | 
                                                        |
| 945 | - case 'user_profile_form':  | 
                                                        |
| 944 | + // User credentials form  | 
                                                        |
| 945 | + case 'user_profile_form':  | 
                                                        |
| 946 | 946 | |
| 947 | 947 | // Use the displaly name as the title, not the username  | 
                                                        
| 948 | 948 | $account = user_load($form['#uid']);  | 
                                                        
@@ -950,28 +950,28 @@ discard block  | 
                                                    ||
| 950 | 950 | |
| 951 | 951 | // Message for admins  | 
                                                        
| 952 | 952 |      if (user_access('administer users')) { | 
                                                        
| 953 | - drupal_set_message(  | 
                                                        |
| 953 | + drupal_set_message(  | 
                                                        |
| 954 | 954 |          bts('WARNING: You are editing the information for user. Please note: you may change a user\'s password by itself. But to change the user\'s email address you must change both the email address and the password simultaneously.') | 
                                                        
| 955 | - , 'warning');  | 
                                                        |
| 955 | + , 'warning');  | 
                                                        |
| 956 | 956 | }  | 
                                                        
| 957 | 957 | |
| 958 | 958 | // Set special message if user has not agreed to TOU  | 
                                                        
| 959 | 959 |      $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        
| 960 | 960 |      $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 961 | 961 |      if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { | 
                                                        
| 962 | - drupal_set_message(  | 
                                                        |
| 962 | + drupal_set_message(  | 
                                                        |
| 963 | 963 |          bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', | 
                                                        
| 964 | 964 | array(  | 
                                                        
| 965 | -          '@project' => variable_get('site_name','Drupal-BOINC'), | 
                                                        |
| 965 | +            '@project' => variable_get('site_name','Drupal-BOINC'), | 
                                                        |
| 966 | 966 | ), NULL, 'boinc:account-credentials-change')  | 
                                                        
| 967 | - , 'info');  | 
                                                        |
| 967 | + , 'info');  | 
                                                        |
| 968 | 968 | }  | 
                                                        
| 969 | 969 | |
| 970 | 970 | // A bit hackish... but don't require the user to enter his password if  | 
                                                        
| 971 | 971 | // coming from the password reset function  | 
                                                        
| 972 | 972 |      $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; | 
                                                        
| 973 | 973 |      if ($reset_pass) { | 
                                                        
| 974 | - $_SESSION['reset_pass'] = 1;  | 
                                                        |
| 974 | + $_SESSION['reset_pass'] = 1;  | 
                                                        |
| 975 | 975 | }  | 
                                                        
| 976 | 976 | |
| 977 | 977 | // Adjust form elements already present  | 
                                                        
@@ -983,8 +983,8 @@ discard block  | 
                                                    ||
| 983 | 983 | $form['account']['pass']['#size'] = 17;  | 
                                                        
| 984 | 984 | |
| 985 | 985 |      if (user_access('administer users')) { | 
                                                        
| 986 | - // Add BOINC username (aka displayname)  | 
                                                        |
| 987 | - $form['account']['boincuser_name'] = array(  | 
                                                        |
| 986 | + // Add BOINC username (aka displayname)  | 
                                                        |
| 987 | + $form['account']['boincuser_name'] = array(  | 
                                                        |
| 988 | 988 | '#type' => 'textfield',  | 
                                                        
| 989 | 989 |          '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), | 
                                                        
| 990 | 990 | '#default_value' => $account->boincuser_name,  | 
                                                        
@@ -992,68 +992,68 @@ discard block  | 
                                                    ||
| 992 | 992 | '#required' => TRUE,  | 
                                                        
| 993 | 993 |          '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), | 
                                                        
| 994 | 994 | '#size' => 40,  | 
                                                        
| 995 | - );  | 
                                                        |
| 995 | + );  | 
                                                        |
| 996 | 996 | }  | 
                                                        
| 997 | 997 | |
| 998 | 998 | // If email address was changed less than 7 days (7 * 86400 s)  | 
                                                        
| 999 | 999 | // ago, it cannot be changed again.  | 
                                                        
| 1000 | 1000 | $duration = TOKEN_DURATION_ONE_WEEK;  | 
                                                        
| 1001 | 1001 |      if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { | 
                                                        
| 1002 | - $form['account']['mail']['#required'] = FALSE;  | 
                                                        |
| 1003 | - $form['account']['mailhelp'] = array(  | 
                                                        |
| 1002 | + $form['account']['mail']['#required'] = FALSE;  | 
                                                        |
| 1003 | + $form['account']['mailhelp'] = array(  | 
                                                        |
| 1004 | 1004 |          '#value' => bts("You email address was changed within the past seven (7) days. Please look for an email to !prev_email if you need to revert this change. You may change your email address on !time.", | 
                                                        
| 1005 | - array(  | 
                                                        |
| 1005 | + array(  | 
                                                        |
| 1006 | 1006 | '!prev_email' => $account->boincuser_previous_email_addr,  | 
                                                        
| 1007 | 1007 |              '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), | 
                                                        
| 1008 | - ), NULL, 'boinc:account-credentials-change'),  | 
                                                        |
| 1009 | - );  | 
                                                        |
| 1008 | + ), NULL, 'boinc:account-credentials-change'),  | 
                                                        |
| 1009 | + );  | 
                                                        |
| 1010 | 1010 | }  | 
                                                        
| 1011 | 1011 | |
| 1012 | 1012 |      if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { | 
                                                        
| 1013 | - // Add a password authenticator, required to change email or pw  | 
                                                        |
| 1014 | - $form['account']['current_pass'] = array(  | 
                                                        |
| 1013 | + // Add a password authenticator, required to change email or pw  | 
                                                        |
| 1014 | + $form['account']['current_pass'] = array(  | 
                                                        |
| 1015 | 1015 | '#type' => 'password',  | 
                                                        
| 1016 | 1016 |          '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), | 
                                                        
| 1017 | 1017 |          '#description' => bts('Enter your current password if changing your email | 
                                                        
| 1018 | 1018 | address or password.', array(), NULL, 'boinc:account-credentials-change'),  | 
                                                        
| 1019 | 1019 | '#size' => 17,  | 
                                                        
| 1020 | 1020 | '#attributes' => array(  | 
                                                        
| 1021 | - 'autocomplete' => 'off',  | 
                                                        |
| 1021 | + 'autocomplete' => 'off',  | 
                                                        |
| 1022 | 1022 | ),  | 
                                                        
| 1023 | - );  | 
                                                        |
| 1023 | + );  | 
                                                        |
| 1024 | 1024 | }  | 
                                                        
| 1025 | 1025 | |
| 1026 | 1026 | // Add account keys, CPID, etc  | 
                                                        
| 1027 | 1027 | $form['account']['boincuser_id'] = array(  | 
                                                        
| 1028 | - '#value' => '  | 
                                                        |
| 1028 | + '#value' => '  | 
                                                        |
| 1029 | 1029 | <div class="form-item">  | 
                                                        
| 1030 | 1030 |            <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        
| 1031 | 1031 | <span>' . $account->boincuser_id . '</span>  | 
                                                        
| 1032 | 1032 | </div>',  | 
                                                        
| 1033 | 1033 | );  | 
                                                        
| 1034 | 1034 | $form['account']['user_id'] = array(  | 
                                                        
| 1035 | - '#value' => '  | 
                                                        |
| 1035 | + '#value' => '  | 
                                                        |
| 1036 | 1036 | <div class="form-item">  | 
                                                        
| 1037 | 1037 |            <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        
| 1038 | 1038 | <span>' . $account->uid . '</span>  | 
                                                        
| 1039 | 1039 | </div>',  | 
                                                        
| 1040 | 1040 | );  | 
                                                        
| 1041 | 1041 | $form['account']['account_key'] = array(  | 
                                                        
| 1042 | - '#value' => '  | 
                                                        |
| 1042 | + '#value' => '  | 
                                                        |
| 1043 | 1043 | <div class="form-item">  | 
                                                        
| 1044 | 1044 |            <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        
| 1045 | 1045 | <span>' . $account->boincuser_account_key . '</span>  | 
                                                        
| 1046 | 1046 | </div>',  | 
                                                        
| 1047 | 1047 | );  | 
                                                        
| 1048 | 1048 | $form['account']['weak_account_key'] = array(  | 
                                                        
| 1049 | - '#value' => '  | 
                                                        |
| 1049 | + '#value' => '  | 
                                                        |
| 1050 | 1050 | <div class="form-item">  | 
                                                        
| 1051 | 1051 |            <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        
| 1052 | 1052 |            <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> | 
                                                        
| 1053 | 1053 | </div>',  | 
                                                        
| 1054 | 1054 | );  | 
                                                        
| 1055 | 1055 | $form['account']['cpid'] = array(  | 
                                                        
| 1056 | - '#value' => '  | 
                                                        |
| 1056 | + '#value' => '  | 
                                                        |
| 1057 | 1057 | <div class="form-item">  | 
                                                        
| 1058 | 1058 |            <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        
| 1059 | 1059 | <span>' . $account->boincuser_cpid . '</span>  | 
                                                        
@@ -1061,30 +1061,30 @@ discard block  | 
                                                    ||
| 1061 | 1061 | );  | 
                                                        
| 1062 | 1062 | |
| 1063 | 1063 | $form['account']['separator_bottom'] = array(  | 
                                                        
| 1064 | - '#value' => '<div class="separator buttons"></div>'  | 
                                                        |
| 1064 | + '#value' => '<div class="separator buttons"></div>'  | 
                                                        |
| 1065 | 1065 | );  | 
                                                        
| 1066 | 1066 | |
| 1067 | 1067 | // Wrap action buttons for styling consistency  | 
                                                        
| 1068 | 1068 | $form['form control tabs prefix'] = array(  | 
                                                        
| 1069 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1070 | - '#weight' => 1001,  | 
                                                        |
| 1069 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1070 | + '#weight' => 1001,  | 
                                                        |
| 1071 | 1071 | );  | 
                                                        
| 1072 | 1072 | $form['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 1073 | 1073 |      $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>';  | 
                                                        
| 1075 | 1075 | $form['submit']['#weight'] = 1002;  | 
                                                        
| 1076 | 1076 | $form['cancel'] = array(  | 
                                                        
| 1077 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1078 | - '#weight' => 1003,  | 
                                                        |
| 1077 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1078 | + '#weight' => 1003,  | 
                                                        |
| 1079 | 1079 | );  | 
                                                        
| 1080 | 1080 |      if (isset($form['delete']) AND is_array($form['delete'])) { | 
                                                        
| 1081 | - $form['delete']['#prefix'] = '<li class="first alt tab">';  | 
                                                        |
| 1082 | - $form['delete']['#suffix'] = '</li>';  | 
                                                        |
| 1083 | - $form['delete']['#weight'] = 1004;  | 
                                                        |
| 1081 | + $form['delete']['#prefix'] = '<li class="first alt tab">';  | 
                                                        |
| 1082 | + $form['delete']['#suffix'] = '</li>';  | 
                                                        |
| 1083 | + $form['delete']['#weight'] = 1004;  | 
                                                        |
| 1084 | 1084 | }  | 
                                                        
| 1085 | 1085 | $form['form control tabs suffix'] = array(  | 
                                                        
| 1086 | - '#value' => '</ul>',  | 
                                                        |
| 1087 | - '#weight' => 1010,  | 
                                                        |
| 1086 | + '#value' => '</ul>',  | 
                                                        |
| 1087 | + '#weight' => 1010,  | 
                                                        |
| 1088 | 1088 | );  | 
                                                        
| 1089 | 1089 | |
| 1090 | 1090 | // Rearrange form elements  | 
                                                        
@@ -1104,7 +1104,7 @@ discard block  | 
                                                    ||
| 1104 | 1104 | // Remove redundant / unnecessary form elements  | 
                                                        
| 1105 | 1105 | unset($form['theme_select']);  | 
                                                        
| 1106 | 1106 |      if (!module_exists('boincuser_delete')) { | 
                                                        
| 1107 | - unset($form['delete']);  | 
                                                        |
| 1107 | + unset($form['delete']);  | 
                                                        |
| 1108 | 1108 | }  | 
                                                        
| 1109 | 1109 | |
| 1110 | 1110 | // These are on the Community preferences form (boincwork module)  | 
                                                        
@@ -1120,18 +1120,18 @@ discard block  | 
                                                    ||
| 1120 | 1120 | |
| 1121 | 1121 | // Internal fields to indicate where these user changes are taking place  | 
                                                        
| 1122 | 1122 | array_unshift($form, array(  | 
                                                        
| 1123 | - 'validation_source' => array(  | 
                                                        |
| 1123 | + 'validation_source' => array(  | 
                                                        |
| 1124 | 1124 | '#type' => 'hidden',  | 
                                                        
| 1125 | 1125 | '#value' => 'user_account'  | 
                                                        
| 1126 | - ),  | 
                                                        |
| 1127 | - 'update_source' => array(  | 
                                                        |
| 1126 | + ),  | 
                                                        |
| 1127 | + 'update_source' => array(  | 
                                                        |
| 1128 | 1128 | '#type' => 'hidden',  | 
                                                        
| 1129 | 1129 | '#value' => 'user_account'  | 
                                                        
| 1130 | - )  | 
                                                        |
| 1130 | + )  | 
                                                        |
| 1131 | 1131 | ));  | 
                                                        
| 1132 | 1132 | break;  | 
                                                        
| 1133 | 1133 | |
| 1134 | - case 'profile_node_form':  | 
                                                        |
| 1134 | + case 'profile_node_form':  | 
                                                        |
| 1135 | 1135 | |
| 1136 | 1136 | // Use the display name as the title, not the username  | 
                                                        
| 1137 | 1137 | $account = user_load($form['uid']['#value']);  | 
                                                        
@@ -1142,22 +1142,22 @@ discard block  | 
                                                    ||
| 1142 | 1142 | $form['title']['#access'] = FALSE;  | 
                                                        
| 1143 | 1143 | |
| 1144 | 1144 | $form['separator_bottom'] = array(  | 
                                                        
| 1145 | - '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 1146 | - '#weight' => 999,  | 
                                                        |
| 1145 | + '#value' => '<div class="separator buttons"></div>',  | 
                                                        |
| 1146 | + '#weight' => 999,  | 
                                                        |
| 1147 | 1147 | );  | 
                                                        
| 1148 | 1148 | |
| 1149 | 1149 |      if (module_exists('captcha')) { | 
                                                        
| 1150 | - // Add an optional captcha  | 
                                                        |
| 1151 | - $form['profile_captcha'] = array(  | 
                                                        |
| 1150 | + // Add an optional captcha  | 
                                                        |
| 1151 | + $form['profile_captcha'] = array(  | 
                                                        |
| 1152 | 1152 | '#type' => 'captcha',  | 
                                                        
| 1153 | 1153 | '#weight' => 1000,  | 
                                                        
| 1154 | - );  | 
                                                        |
| 1154 | + );  | 
                                                        |
| 1155 | 1155 | }  | 
                                                        
| 1156 | 1156 | |
| 1157 | 1157 | // Wrap action buttons for styling consistency  | 
                                                        
| 1158 | 1158 | $form['buttons']['form control tabs prefix'] = array(  | 
                                                        
| 1159 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1160 | - '#weight' => 1001,  | 
                                                        |
| 1159 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1160 | + '#weight' => 1001,  | 
                                                        |
| 1161 | 1161 | );  | 
                                                        
| 1162 | 1162 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 1163 | 1163 |      $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        
@@ -1170,8 +1170,8 @@ discard block  | 
                                                    ||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 1172 | 1172 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1173 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1174 | - '#weight' => 1005,  | 
                                                        |
| 1173 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1174 | + '#weight' => 1005,  | 
                                                        |
| 1175 | 1175 | );  | 
                                                        
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
| 1177 | 1177 | $form['buttons']['delete']['#suffix'] = '</li>';  | 
                                                        
@@ -1179,8 +1179,8 @@ discard block  | 
                                                    ||
| 1179 | 1179 | $form['buttons']['delete']['#weight'] = 1006;  | 
                                                        
| 1180 | 1180 |      $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); | 
                                                        
| 1181 | 1181 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
| 1182 | - '#value' => '</ul>',  | 
                                                        |
| 1183 | - '#weight' => 1010,  | 
                                                        |
| 1182 | + '#value' => '</ul>',  | 
                                                        |
| 1183 | + '#weight' => 1010,  | 
                                                        |
| 1184 | 1184 | );  | 
                                                        
| 1185 | 1185 | |
| 1186 | 1186 | $form['#after_build'][] = 'boincuser_profile_node_form_after_build';  | 
                                                        
@@ -1193,33 +1193,33 @@ discard block  | 
                                                    ||
| 1193 | 1193 | |
| 1194 | 1194 | // Internal fields to indicate where these user changes are taking place  | 
                                                        
| 1195 | 1195 | array_unshift($form, array(  | 
                                                        
| 1196 | - 'validation_source' => array(  | 
                                                        |
| 1196 | + 'validation_source' => array(  | 
                                                        |
| 1197 | 1197 | '#type' => 'hidden',  | 
                                                        
| 1198 | 1198 | '#value' => 'user_profile'  | 
                                                        
| 1199 | - ),  | 
                                                        |
| 1200 | - 'update_source' => array(  | 
                                                        |
| 1199 | + ),  | 
                                                        |
| 1200 | + 'update_source' => array(  | 
                                                        |
| 1201 | 1201 | '#type' => 'hidden',  | 
                                                        
| 1202 | 1202 | '#value' => 'user_profile'  | 
                                                        
| 1203 | - )  | 
                                                        |
| 1203 | + )  | 
                                                        |
| 1204 | 1204 | ));  | 
                                                        
| 1205 | 1205 | break;  | 
                                                        
| 1206 | 1206 | |
| 1207 | - // Registration form  | 
                                                        |
| 1208 | - case 'user_register':  | 
                                                        |
| 1207 | + // Registration form  | 
                                                        |
| 1208 | + case 'user_register':  | 
                                                        |
| 1209 | 1209 | array_unshift($form, array(  | 
                                                        
| 1210 | - 'boincuser_name' => array(  | 
                                                        |
| 1210 | + 'boincuser_name' => array(  | 
                                                        |
| 1211 | 1211 | '#type' => 'textfield',  | 
                                                        
| 1212 | 1212 |          '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), | 
                                                        
| 1213 | 1213 | '#default_value' => $edit['boincuser_name'],  | 
                                                        
| 1214 | 1214 | '#maxlength' => USERNAME_MAX_LENGTH,  | 
                                                        
| 1215 | 1215 |          '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), | 
                                                        
| 1216 | 1216 | '#required' => TRUE  | 
                                                        
| 1217 | - ),  | 
                                                        |
| 1217 | + ),  | 
                                                        |
| 1218 | 1218 | ));  | 
                                                        
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation  | 
                                                        
| 1220 | 1220 | $form['name'] = array(  | 
                                                        
| 1221 | - '#type' => 'hidden',  | 
                                                        |
| 1222 | - '#value' => rand() . '.' . time()  | 
                                                        |
| 1221 | + '#type' => 'hidden',  | 
                                                        |
| 1222 | + '#value' => rand() . '.' . time()  | 
                                                        |
| 1223 | 1223 | );  | 
                                                        
| 1224 | 1224 | |
| 1225 | 1225 | // Add JS for submit button disabling  | 
                                                        
@@ -1229,50 +1229,50 @@ discard block  | 
                                                    ||
| 1229 | 1229 |      $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 1230 | 1230 |      if (!empty($termsofuse)) { | 
                                                        
| 1231 | 1231 | |
| 1232 | - $form['termsofuse'] = array(  | 
                                                        |
| 1232 | + $form['termsofuse'] = array(  | 
                                                        |
| 1233 | 1233 | '#type' => 'fieldset',  | 
                                                        
| 1234 | 1234 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div.  | 
                                                        
| 1235 | 1235 | '#suffix' => '</div>',  | 
                                                        
| 1236 | 1236 | '#tree' => TRUE,  | 
                                                        
| 1237 | 1237 | '#weight' => -15,  | 
                                                        
| 1238 | - );  | 
                                                        |
| 1238 | + );  | 
                                                        |
| 1239 | 1239 | |
| 1240 | - $form['termsofuse']['title1'] = array(  | 
                                                        |
| 1240 | + $form['termsofuse']['title1'] = array(  | 
                                                        |
| 1241 | 1241 | '#weight' => -12,  | 
                                                        
| 1242 | 1242 |          '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', | 
                                                        
| 1243 | 1243 | '#prefix' => '<div id="register-title1">',  | 
                                                        
| 1244 | 1244 | '#suffix' => '</div>',  | 
                                                        
| 1245 | - );  | 
                                                        |
| 1245 | + );  | 
                                                        |
| 1246 | 1246 | |
| 1247 | - $form['termsofuse']['body'] = array(  | 
                                                        |
| 1247 | + $form['termsofuse']['body'] = array(  | 
                                                        |
| 1248 | 1248 | '#weight' => -10,  | 
                                                        
| 1249 | 1249 | '#value' => bts($termsofuse, array(), NULL, 'project:user-register'),  | 
                                                        
| 1250 | 1250 | '#prefix' => '<div id="register-termsofuse">',  | 
                                                        
| 1251 | 1251 | '#suffix' => '</div>',  | 
                                                        
| 1252 | - );  | 
                                                        |
| 1252 | + );  | 
                                                        |
| 1253 | 1253 | |
| 1254 | - $form['termsofuse']['agreeTOU'] = array(  | 
                                                        |
| 1254 | + $form['termsofuse']['agreeTOU'] = array(  | 
                                                        |
| 1255 | 1255 | '#type' => 'checkbox',  | 
                                                        
| 1256 | 1256 |          '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), | 
                                                        
| 1257 | 1257 | '#weight' => -8,  | 
                                                        
| 1258 | 1258 | '#prefix' => '<div id="register-checkbox">',  | 
                                                        
| 1259 | 1259 | '#suffix' => '</div>',  | 
                                                        
| 1260 | - );  | 
                                                        |
| 1260 | + );  | 
                                                        |
| 1261 | 1261 | }  | 
                                                        
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array(  | 
                                                        
| 1264 | - '#weight' => -6,  | 
                                                        |
| 1265 | -      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', | 
                                                        |
| 1266 | - '#prefix' => '<div id="register-title2">',  | 
                                                        |
| 1267 | - '#suffix' => '</div>',  | 
                                                        |
| 1264 | + '#weight' => -6,  | 
                                                        |
| 1265 | +        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', | 
                                                        |
| 1266 | + '#prefix' => '<div id="register-title2">',  | 
                                                        |
| 1267 | + '#suffix' => '</div>',  | 
                                                        |
| 1268 | 1268 | );  | 
                                                        
| 1269 | 1269 | |
| 1270 | 1270 |      if (module_exists('captcha')) { | 
                                                        
| 1271 | - // Add an optional captcha  | 
                                                        |
| 1272 | - $form['register_captcha'] = array(  | 
                                                        |
| 1271 | + // Add an optional captcha  | 
                                                        |
| 1272 | + $form['register_captcha'] = array(  | 
                                                        |
| 1273 | 1273 | '#type' => 'captcha',  | 
                                                        
| 1274 | 1274 | '#weight' => 1000,  | 
                                                        
| 1275 | - );  | 
                                                        |
| 1275 | + );  | 
                                                        |
| 1276 | 1276 | }  | 
                                                        
| 1277 | 1277 | |
| 1278 | 1278 | $form['#validate'][] = 'boincuser_register_validate';  | 
                                                        
@@ -1280,45 +1280,45 @@ discard block  | 
                                                    ||
| 1280 | 1280 | $form['submit']['#weight'] = 1001;  | 
                                                        
| 1281 | 1281 | break;  | 
                                                        
| 1282 | 1282 | |
| 1283 | - // Request new password form  | 
                                                        |
| 1284 | - case 'user_pass':  | 
                                                        |
| 1283 | + // Request new password form  | 
                                                        |
| 1284 | + case 'user_pass':  | 
                                                        |
| 1285 | 1285 |      drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); | 
                                                        
| 1286 | 1286 | // Replace name/email text box with email only; retain "name" label  | 
                                                        
| 1287 | 1287 | // for compatibility with standard Drupal submit function  | 
                                                        
| 1288 | 1288 | unset($form['name']);  | 
                                                        
| 1289 | 1289 | array_unshift($form, array(  | 
                                                        
| 1290 | - 'name' => array(  | 
                                                        |
| 1290 | + 'name' => array(  | 
                                                        |
| 1291 | 1291 | '#type' => 'textfield',  | 
                                                        
| 1292 | 1292 |          '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), | 
                                                        
| 1293 | 1293 | '#size' => 60,  | 
                                                        
| 1294 | 1294 | '#maxlength' => EMAIL_MAX_LENGTH,  | 
                                                        
| 1295 | 1295 | '#required' => TRUE,  | 
                                                        
| 1296 | 1296 | '#description' => bts(  | 
                                                        
| 1297 | - 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',  | 
                                                        |
| 1298 | - array(  | 
                                                        |
| 1297 | + 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',  | 
                                                        |
| 1298 | + array(  | 
                                                        |
| 1299 | 1299 | '!authenticator_login' => l(  | 
                                                        
| 1300 | -              bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), | 
                                                        |
| 1301 | - 'user/login/auth'  | 
                                                        |
| 1300 | +                bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), | 
                                                        |
| 1301 | + 'user/login/auth'  | 
                                                        |
| 1302 | + )  | 
                                                        |
| 1302 | 1303 | )  | 
                                                        
| 1303 | - )  | 
                                                        |
| 1304 | 1304 | , NULL, 'boinc:forgot-password'),  | 
                                                        
| 1305 | - ),  | 
                                                        |
| 1305 | + ),  | 
                                                        |
| 1306 | 1306 | ));  | 
                                                        
| 1307 | 1307 | |
| 1308 | 1308 |      if (module_exists('captcha')) { | 
                                                        
| 1309 | - // Add an optional captcha  | 
                                                        |
| 1310 | - $form['register_captcha'] = array(  | 
                                                        |
| 1309 | + // Add an optional captcha  | 
                                                        |
| 1310 | + $form['register_captcha'] = array(  | 
                                                        |
| 1311 | 1311 | '#type' => 'captcha',  | 
                                                        
| 1312 | 1312 | '#weight' => 0,  | 
                                                        
| 1313 | 1313 | '#prefix' => '<div id="captcha-password-reset">',  | 
                                                        
| 1314 | 1314 | '#suffix' => '</div>'  | 
                                                        
| 1315 | - );  | 
                                                        |
| 1315 | + );  | 
                                                        |
| 1316 | 1316 | }  | 
                                                        
| 1317 | 1317 | |
| 1318 | 1318 | // Wrap action buttons for styling consistency  | 
                                                        
| 1319 | 1319 | $form['buttons']['form control tabs prefix'] = array(  | 
                                                        
| 1320 | - '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1321 | - '#weight' => 1001,  | 
                                                        |
| 1320 | + '#value' => '<ul class="form-control tab-list">',  | 
                                                        |
| 1321 | + '#weight' => 1001,  | 
                                                        |
| 1322 | 1322 | );  | 
                                                        
| 1323 | 1323 | $form['buttons']['submit'] = $form['submit'];  | 
                                                        
| 1324 | 1324 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
@@ -1326,26 +1326,26 @@ discard block  | 
                                                    ||
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 1328 | 1328 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1329 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', | 
                                                        |
| 1330 | - '#weight' => 1005,  | 
                                                        |
| 1329 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', | 
                                                        |
| 1330 | + '#weight' => 1005,  | 
                                                        |
| 1331 | 1331 | );  | 
                                                        
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
| 1333 | - '#value' => '</ul>',  | 
                                                        |
| 1334 | - '#weight' => 1010,  | 
                                                        |
| 1333 | + '#value' => '</ul>',  | 
                                                        |
| 1334 | + '#weight' => 1010,  | 
                                                        |
| 1335 | 1335 | );  | 
                                                        
| 1336 | 1336 | unset($form['submit']);  | 
                                                        
| 1337 | 1337 | |
| 1338 | 1338 | // If the form is being submitted, use BOINC validation handler.  | 
                                                        
| 1339 | 1339 |      if (isset($form_state['post']['name'])) { | 
                                                        
| 1340 | - // Prepend the BOINC validation function to local validation  | 
                                                        |
| 1341 | - array_unshift($form['#validate'], 'boincuser_request_pass_validate');  | 
                                                        |
| 1340 | + // Prepend the BOINC validation function to local validation  | 
                                                        |
| 1341 | + array_unshift($form['#validate'], 'boincuser_request_pass_validate');  | 
                                                        |
| 1342 | 1342 | }  | 
                                                        
| 1343 | 1343 | break;  | 
                                                        
| 1344 | 1344 | |
| 1345 | - case 'views_exposed_form':  | 
                                                        |
| 1345 | + case 'views_exposed_form':  | 
                                                        |
| 1346 | 1346 |        $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); | 
                                                        
| 1347 | 1347 | break;  | 
                                                        
| 1348 | - }  | 
                                                        |
| 1348 | + }  | 
                                                        |
| 1349 | 1349 | }  | 
                                                        
| 1350 | 1350 | |
| 1351 | 1351 | /**  | 
                                                        
@@ -1353,10 +1353,10 @@ discard block  | 
                                                    ||
| 1353 | 1353 | * built; this is called from boincuser_form_alter()  | 
                                                        
| 1354 | 1354 | */  | 
                                                        
| 1355 | 1355 |  function boincuser_profile_node_form_after_build($form, &$form_state) { | 
                                                        
| 1356 | - // Move to community prefs form  | 
                                                        |
| 1357 | - $form_state['storage']['avatar'] = $form['field_image'];  | 
                                                        |
| 1358 | - unset($form['field_image']);  | 
                                                        |
| 1359 | - return $form;  | 
                                                        |
| 1356 | + // Move to community prefs form  | 
                                                        |
| 1357 | + $form_state['storage']['avatar'] = $form['field_image'];  | 
                                                        |
| 1358 | + unset($form['field_image']);  | 
                                                        |
| 1359 | + return $form;  | 
                                                        |
| 1360 | 1360 | }  | 
                                                        
| 1361 | 1361 | |
| 1362 | 1362 | /**  | 
                                                        
@@ -1364,8 +1364,8 @@ discard block  | 
                                                    ||
| 1364 | 1364 | * @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6  | 
                                                        
| 1365 | 1365 | */  | 
                                                        
| 1366 | 1366 |  function boincuser_elements() { | 
                                                        
| 1367 | - $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';  | 
                                                        |
| 1368 | - return $type;  | 
                                                        |
| 1367 | + $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';  | 
                                                        |
| 1368 | + return $type;  | 
                                                        |
| 1369 | 1369 | }  | 
                                                        
| 1370 | 1370 | |
| 1371 | 1371 | /**  | 
                                                        
@@ -1373,11 +1373,11 @@ discard block  | 
                                                    ||
| 1373 | 1373 | * profile form  | 
                                                        
| 1374 | 1374 | */  | 
                                                        
| 1375 | 1375 |  function boincuser_process_password_confirm($element) { | 
                                                        
| 1376 | - // Check if parent element is "account".  | 
                                                        |
| 1377 | -  if ($element['#array_parents'][0] == 'account') { | 
                                                        |
| 1376 | + // Check if parent element is "account".  | 
                                                        |
| 1377 | +    if ($element['#array_parents'][0] == 'account') { | 
                                                        |
| 1378 | 1378 |      $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); | 
                                                        
| 1379 | - }  | 
                                                        |
| 1380 | - return $element;  | 
                                                        |
| 1379 | + }  | 
                                                        |
| 1380 | + return $element;  | 
                                                        |
| 1381 | 1381 | }  | 
                                                        
| 1382 | 1382 | |
| 1383 | 1383 | /**  | 
                                                        
@@ -1385,42 +1385,42 @@ discard block  | 
                                                    ||
| 1385 | 1385 | * Register theme functions for use in this module.  | 
                                                        
| 1386 | 1386 | */  | 
                                                        
| 1387 | 1387 |  function boincuser_theme($existing, $type, $theme, $path) { | 
                                                        
| 1388 | - return array(  | 
                                                        |
| 1388 | + return array(  | 
                                                        |
| 1389 | 1389 | 'boincuser_user_pass' => array(  | 
                                                        
| 1390 | - 'arguments' => array()  | 
                                                        |
| 1390 | + 'arguments' => array()  | 
                                                        |
| 1391 | 1391 | )  | 
                                                        
| 1392 | - );  | 
                                                        |
| 1392 | + );  | 
                                                        |
| 1393 | 1393 | }  | 
                                                        
| 1394 | 1394 | |
| 1395 | 1395 | /**  | 
                                                        
| 1396 | 1396 | * Implementation of hook_token_values  | 
                                                        
| 1397 | 1397 | */  | 
                                                        
| 1398 | 1398 |  function boincuser_token_values($type, $object = NULL, $options = array()) { | 
                                                        
| 1399 | -  if ($type == 'user') { | 
                                                        |
| 1399 | +    if ($type == 'user') { | 
                                                        |
| 1400 | 1400 | $account = user_load($object->uid);  | 
                                                        
| 1401 | 1401 | $tokens['display-name'] = $account->boincuser_name;  | 
                                                        
| 1402 | 1402 | return $tokens;  | 
                                                        
| 1403 | - }  | 
                                                        |
| 1403 | + }  | 
                                                        |
| 1404 | 1404 | }  | 
                                                        
| 1405 | 1405 | |
| 1406 | 1406 | /**  | 
                                                        
| 1407 | 1407 | * Implementation of hook_token_list  | 
                                                        
| 1408 | 1408 | */  | 
                                                        
| 1409 | 1409 |  function boincuser_token_list($type = 'all') { | 
                                                        
| 1410 | -  if ($type == 'user' || $type == 'all') { | 
                                                        |
| 1410 | +    if ($type == 'user' || $type == 'all') { | 
                                                        |
| 1411 | 1411 |      $tokens['user']['display-name']      = t("The user's name that should be displayed"); | 
                                                        
| 1412 | 1412 | return $tokens;  | 
                                                        
| 1413 | - }  | 
                                                        |
| 1413 | + }  | 
                                                        |
| 1414 | 1414 | }  | 
                                                        
| 1415 | 1415 | |
| 1416 | 1416 | /**  | 
                                                        
| 1417 | 1417 | * Implementation of hook_views_pre_execute()  | 
                                                        
| 1418 | 1418 | */  | 
                                                        
| 1419 | 1419 |  function boincuser_views_pre_execute(&$view) { | 
                                                        
| 1420 | -  if ($view->args) { | 
                                                        |
| 1420 | +    if ($view->args) { | 
                                                        |
| 1421 | 1421 | $account_id = $view->args[0];  | 
                                                        
| 1422 | - }  | 
                                                        |
| 1423 | -  if ($view->name=="user_activity") { | 
                                                        |
| 1422 | + }  | 
                                                        |
| 1423 | +    if ($view->name=="user_activity") { | 
                                                        |
| 1424 | 1424 | // Run the following custom query for the user_activity view  | 
                                                        
| 1425 | 1425 | $view->build_info['query']= "  | 
                                                        
| 1426 | 1426 | SELECT node_revisions.vid AS vid,  | 
                                                        
@@ -1452,25 +1452,25 @@ discard block  | 
                                                    ||
| 1452 | 1452 | |
| 1453 | 1453 | // count_query determines the pager. Do this so the right item count is returned.  | 
                                                        
| 1454 | 1454 | $view->build_info['count_query'] = $view->build_info['query'];  | 
                                                        
| 1455 | - }  | 
                                                        |
| 1455 | + }  | 
                                                        |
| 1456 | 1456 | }  | 
                                                        
| 1457 | 1457 | |
| 1458 | 1458 | /**  | 
                                                        
| 1459 | 1459 | * Implementation of hook_cron()  | 
                                                        
| 1460 | 1460 | */  | 
                                                        
| 1461 | 1461 |  function boincuser_cron() { | 
                                                        
| 1462 | - // Delete expired users in the BOINC database, user_delete table.  | 
                                                        |
| 1463 | -  require_boinc('boinc_db'); | 
                                                        |
| 1464 | - $num_deleted = BoincUserDeleted::delete_expired();  | 
                                                        |
| 1465 | -  if ($num_deleted>0) { | 
                                                        |
| 1462 | + // Delete expired users in the BOINC database, user_delete table.  | 
                                                        |
| 1463 | +    require_boinc('boinc_db'); | 
                                                        |
| 1464 | + $num_deleted = BoincUserDeleted::delete_expired();  | 
                                                        |
| 1465 | +    if ($num_deleted>0) { | 
                                                        |
| 1466 | 1466 |      watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); | 
                                                        
| 1467 | - }  | 
                                                        |
| 1467 | + }  | 
                                                        |
| 1468 | 1468 | |
| 1469 | - // Delete expired tokens from token table  | 
                                                        |
| 1470 | - $tokens_deleted = BoincToken::delete_expired();  | 
                                                        |
| 1471 | -  if ($tokens_deleted>0) { | 
                                                        |
| 1469 | + // Delete expired tokens from token table  | 
                                                        |
| 1470 | + $tokens_deleted = BoincToken::delete_expired();  | 
                                                        |
| 1471 | +    if ($tokens_deleted>0) { | 
                                                        |
| 1472 | 1472 |      watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); | 
                                                        
| 1473 | - }  | 
                                                        |
| 1473 | + }  | 
                                                        |
| 1474 | 1474 | }  | 
                                                        
| 1475 | 1475 | |
| 1476 | 1476 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * *  | 
                                                        
@@ -1481,17 +1481,17 @@ discard block  | 
                                                    ||
| 1481 | 1481 | * Page callback shortcut to recent posts for the logged in user  | 
                                                        
| 1482 | 1482 | */  | 
                                                        
| 1483 | 1483 |  function boincuser_goto_recent_posts() { | 
                                                        
| 1484 | - global $user;  | 
                                                        |
| 1485 | -  drupal_goto("account/{$user->uid}/posts"); | 
                                                        |
| 1484 | + global $user;  | 
                                                        |
| 1485 | +    drupal_goto("account/{$user->uid}/posts"); | 
                                                        |
| 1486 | 1486 | }  | 
                                                        
| 1487 | 1487 | |
| 1488 | 1488 | /**  | 
                                                        
| 1489 | 1489 | * Page callback shortcut to the team of the logged in user  | 
                                                        
| 1490 | 1490 | */  | 
                                                        
| 1491 | 1491 |  function boincuser_goto_team() { | 
                                                        
| 1492 | - global $user;  | 
                                                        |
| 1493 | - $account = user_load($user->uid);  | 
                                                        |
| 1494 | -  drupal_goto("community/teams/{$account->team}"); | 
                                                        |
| 1492 | + global $user;  | 
                                                        |
| 1493 | + $account = user_load($user->uid);  | 
                                                        |
| 1494 | +    drupal_goto("community/teams/{$account->team}"); | 
                                                        |
| 1495 | 1495 | }  | 
                                                        
| 1496 | 1496 | |
| 1497 | 1497 | /**  | 
                                                        
@@ -1500,93 +1500,93 @@ discard block  | 
                                                    ||
| 1500 | 1500 | * user profile pages, so use a wrapper for display  | 
                                                        
| 1501 | 1501 | */  | 
                                                        
| 1502 | 1502 |  function boincuser_view_profile($account = null) { | 
                                                        
| 1503 | - // Create the user profile page  | 
                                                        |
| 1504 | -  if (!$account) { | 
                                                        |
| 1503 | + // Create the user profile page  | 
                                                        |
| 1504 | +    if (!$account) { | 
                                                        |
| 1505 | 1505 | global $user;  | 
                                                        
| 1506 | 1506 | $account = $user;  | 
                                                        
| 1507 | - }  | 
                                                        |
| 1507 | + }  | 
                                                        |
| 1508 | 1508 | |
| 1509 | -  $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); | 
                                                        |
| 1510 | -  $verified_contributor = array_search('verified contributor', user_roles(true)); | 
                                                        |
| 1511 | -  if (!isset($account->roles[$verified_contributor])) { | 
                                                        |
| 1509 | +    $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); | 
                                                        |
| 1510 | +    $verified_contributor = array_search('verified contributor', user_roles(true)); | 
                                                        |
| 1511 | +    if (!isset($account->roles[$verified_contributor])) { | 
                                                        |
| 1512 | 1512 | drupal_set_message(bts(  | 
                                                        
| 1513 | 1513 | 'You may only create or modify your user profile after earning @count credits.',  | 
                                                        
| 1514 | 1514 |          array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' | 
                                                        
| 1515 | 1515 | ), 'warning', FALSE);  | 
                                                        
| 1516 | - }  | 
                                                        |
| 1516 | + }  | 
                                                        |
| 1517 | 1517 | |
| 1518 | - // For now, just call the user module profile view function  | 
                                                        |
| 1519 | - user_build_content($account);  | 
                                                        |
| 1520 | -  return theme('user_profile', $account); | 
                                                        |
| 1518 | + // For now, just call the user module profile view function  | 
                                                        |
| 1519 | + user_build_content($account);  | 
                                                        |
| 1520 | +    return theme('user_profile', $account); | 
                                                        |
| 1521 | 1521 | }  | 
                                                        
| 1522 | 1522 | |
| 1523 | 1523 | /**  | 
                                                        
| 1524 | 1524 | * Page callback for editing a user profile  | 
                                                        
| 1525 | 1525 | */  | 
                                                        
| 1526 | 1526 |  function boincuser_edit_profile($account = null) { | 
                                                        
| 1527 | - // Create the user profile form  | 
                                                        |
| 1528 | -  if (!$account) { | 
                                                        |
| 1527 | + // Create the user profile form  | 
                                                        |
| 1528 | +    if (!$account) { | 
                                                        |
| 1529 | 1529 | global $user;  | 
                                                        
| 1530 | 1530 | $account = $user;  | 
                                                        
| 1531 | - }  | 
                                                        |
| 1532 | - // Render the form  | 
                                                        |
| 1533 | -  module_load_include('pages.inc', 'node', 'node'); | 
                                                        |
| 1534 | -  return content_profile_page_edit('profile', $account); | 
                                                        |
| 1531 | + }  | 
                                                        |
| 1532 | + // Render the form  | 
                                                        |
| 1533 | +    module_load_include('pages.inc', 'node', 'node'); | 
                                                        |
| 1534 | +    return content_profile_page_edit('profile', $account); | 
                                                        |
| 1535 | 1535 | }  | 
                                                        
| 1536 | 1536 | |
| 1537 | 1537 | /**  | 
                                                        
| 1538 | - * Join page menu callback.  | 
                                                        |
| 1539 | - * Display instructions on joining for new or existing BOINC users  | 
                                                        |
| 1540 | - */  | 
                                                        |
| 1538 | + * Join page menu callback.  | 
                                                        |
| 1539 | + * Display instructions on joining for new or existing BOINC users  | 
                                                        |
| 1540 | + */  | 
                                                        |
| 1541 | 1541 |  function join_page($type = null) { | 
                                                        
| 1542 | - global $base_url;  | 
                                                        |
| 1543 | - /* The paths/links to the rules-and-policies page is hardcoded  | 
                                                        |
| 1542 | + global $base_url;  | 
                                                        |
| 1543 | + /* The paths/links to the rules-and-policies page is hardcoded  | 
                                                        |
| 1544 | 1544 | * here. An improvement would be admin settings for the Join Page  | 
                                                        
| 1545 | 1545 | * where this path could be set.  | 
                                                        
| 1546 | 1546 | */  | 
                                                        
| 1547 | - $ruleslinkA = 'rules-and-policies';  | 
                                                        |
| 1548 | - $ruleslinkB = 'content/rules-and-policies';  | 
                                                        |
| 1549 | -  $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1550 | -  $registration_enabled = variable_get('user_register', 0); | 
                                                        |
| 1551 | - $output = '<div class="join">';  | 
                                                        |
| 1552 | -  switch ($type) { | 
                                                        |
| 1553 | - case 'boinc':  | 
                                                        |
| 1547 | + $ruleslinkA = 'rules-and-policies';  | 
                                                        |
| 1548 | + $ruleslinkB = 'content/rules-and-policies';  | 
                                                        |
| 1549 | +    $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1550 | +    $registration_enabled = variable_get('user_register', 0); | 
                                                        |
| 1551 | + $output = '<div class="join">';  | 
                                                        |
| 1552 | +    switch ($type) { | 
                                                        |
| 1553 | + case 'boinc':  | 
                                                        |
| 1554 | 1554 | $output .= '<ol>';  | 
                                                        
| 1555 | 1555 |      if ($registration_enabled) { | 
                                                        
| 1556 | -      $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1557 | - array(  | 
                                                        |
| 1556 | +        $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1557 | + array(  | 
                                                        |
| 1558 | 1558 |          '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        
| 1559 | 1559 | '@sitename' => $site_name,  | 
                                                        
| 1560 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1560 | + ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1561 | 1561 | }  | 
                                                        
| 1562 | 1562 |      $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        
| 1563 | 1563 |      $output .= '  <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", | 
                                                        
| 1564 | 1564 | array(  | 
                                                        
| 1565 | - '@sitename' => $site_name,  | 
                                                        |
| 1566 | - '@siteurl' => $base_url,  | 
                                                        |
| 1565 | + '@sitename' => $site_name,  | 
                                                        |
| 1566 | + '@siteurl' => $base_url,  | 
                                                        |
| 1567 | 1567 | ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        
| 1568 | 1568 |      if ($registration_enabled) { | 
                                                        
| 1569 | -      $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", | 
                                                        |
| 1569 | +        $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", | 
                                                        |
| 1570 | 1570 | array(  | 
                                                        
| 1571 | -          '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        |
| 1571 | +            '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        |
| 1572 | 1572 | ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        
| 1573 | 1573 | }  | 
                                                        
| 1574 | 1574 |      else { | 
                                                        
| 1575 | -      $output .= '<li>' . bts("If you're running a command-line version of BOINC, | 
                                                        |
| 1575 | +        $output .= '<li>' . bts("If you're running a command-line version of BOINC, | 
                                                        |
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.",  | 
                                                        
| 1577 | 1577 | array(  | 
                                                        
| 1578 | -          '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        |
| 1578 | +            '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        |
| 1579 | 1579 | ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        
| 1580 | 1580 | }  | 
                                                        
| 1581 | 1581 |      $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please | 
                                                        
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account  | 
                                                        
| 1583 | 1583 | at @this_project.",  | 
                                                        
| 1584 | - array(  | 
                                                        |
| 1584 | + array(  | 
                                                        |
| 1585 | 1585 | '@this_project' => $site_name,  | 
                                                        
| 1586 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1586 | + ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1587 | 1587 | $output .= '</ol>';  | 
                                                        
| 1588 | 1588 | break;  | 
                                                        
| 1589 | - case 'new':  | 
                                                        |
| 1589 | + case 'new':  | 
                                                        |
| 1590 | 1590 | default:  | 
                                                        
| 1591 | 1591 | // Determine if there is a link to rules-and-policies  | 
                                                        
| 1592 | 1592 | //$ruleslink='';  | 
                                                        
@@ -1601,95 +1601,95 @@ discard block  | 
                                                    ||
| 1601 | 1601 | // Join page output  | 
                                                        
| 1602 | 1602 | $output .= '<ol>';  | 
                                                        
| 1603 | 1603 |      if ($registration_enabled) { | 
                                                        
| 1604 | -      $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1605 | - array(  | 
                                                        |
| 1604 | +        $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1605 | + array(  | 
                                                        |
| 1606 | 1606 |          '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        
| 1607 | 1607 | '@sitename' => $site_name,  | 
                                                        
| 1608 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1608 | + ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1609 | 1609 | }  | 
                                                        
| 1610 | 1610 |      else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { | 
                                                        
| 1611 | -      $output .= '  <li>' . bts("Read our !rules_and_policies.", array( | 
                                                        |
| 1611 | +        $output .= '  <li>' . bts("Read our !rules_and_policies.", array( | 
                                                        |
| 1612 | 1612 |          '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), | 
                                                        
| 1613 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1613 | + ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1614 | 1614 | }  | 
                                                        
| 1615 | 1615 |      $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); | 
                                                        
| 1616 | 1616 | $output .= ' <p>';  | 
                                                        
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>';  | 
                                                        
| 1618 | 1618 | $output .= ' </p>';  | 
                                                        
| 1619 | 1619 |      $output .= '    ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( | 
                                                        
| 1620 | - '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>',  | 
                                                        |
| 1621 | - '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>',  | 
                                                        |
| 1620 | + '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>',  | 
                                                        |
| 1621 | + '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>',  | 
                                                        |
| 1622 | 1622 | ), NULL, 'boinc:join-page');  | 
                                                        
| 1623 | 1623 | $output .= ' </li>';  | 
                                                        
| 1624 | 1624 |      $output .= '  <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        
| 1625 | 1625 |      $output .= '  <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( | 
                                                        
| 1626 | - '@sitename' => $site_name,  | 
                                                        |
| 1627 | - '@siteurl' => $base_url,  | 
                                                        |
| 1626 | + '@sitename' => $site_name,  | 
                                                        |
| 1627 | + '@siteurl' => $base_url,  | 
                                                        |
| 1628 | 1628 | ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        
| 1629 | 1629 | $output .= '</ol>';  | 
                                                        
| 1630 | - }  | 
                                                        |
| 1631 | - $output .= '</div>';  | 
                                                        |
| 1632 | - return $output;  | 
                                                        |
| 1630 | + }  | 
                                                        |
| 1631 | + $output .= '</div>';  | 
                                                        |
| 1632 | + return $output;  | 
                                                        |
| 1633 | 1633 | }  | 
                                                        
| 1634 | 1634 | |
| 1635 | 1635 | /**  | 
                                                        
| 1636 | - * Home page content for embedding in Panels page  | 
                                                        |
| 1637 | - */  | 
                                                        |
| 1636 | + * Home page content for embedding in Panels page  | 
                                                        |
| 1637 | + */  | 
                                                        |
| 1638 | 1638 |  function boincuser_home_page() { | 
                                                        
| 1639 | - global $user;  | 
                                                        |
| 1640 | -  $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1641 | - // get the front page message from database; this is set in the admin interface under BOINC Other  | 
                                                        |
| 1642 | -  $site_message = variable_get('boinc_other_frontpage',''); | 
                                                        |
| 1639 | + global $user;  | 
                                                        |
| 1640 | +    $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1641 | + // get the front page message from database; this is set in the admin interface under BOINC Other  | 
                                                        |
| 1642 | +    $site_message = variable_get('boinc_other_frontpage',''); | 
                                                        |
| 1643 | 1643 | |
| 1644 | - // Determine the user of the day  | 
                                                        |
| 1645 | -  $current_uotd = db_fetch_object(db_query(" | 
                                                        |
| 1644 | + // Determine the user of the day  | 
                                                        |
| 1645 | +    $current_uotd = db_fetch_object(db_query(" | 
                                                        |
| 1646 | 1646 | SELECT  | 
                                                        
| 1647 | 1647 | uid,  | 
                                                        
| 1648 | 1648 | uotd_time  | 
                                                        
| 1649 | 1649 |      FROM {boincuser} | 
                                                        
| 1650 | 1650 | ORDER BY uotd_time DESC  | 
                                                        
| 1651 | 1651 | LIMIT 1"  | 
                                                        
| 1652 | - ));  | 
                                                        |
| 1653 | -  if ($current_uotd->uotd_time < strtotime('today midnight')) { | 
                                                        |
| 1652 | + ));  | 
                                                        |
| 1653 | +    if ($current_uotd->uotd_time < strtotime('today midnight')) { | 
                                                        |
| 1654 | 1654 | $uotd = boincuser_select_user_of_the_day();  | 
                                                        
| 1655 | - }  | 
                                                        |
| 1656 | -  else { | 
                                                        |
| 1655 | + }  | 
                                                        |
| 1656 | +    else { | 
                                                        |
| 1657 | 1657 | $uotd = user_load($current_uotd->uid);  | 
                                                        
| 1658 | - }  | 
                                                        |
| 1659 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);  | 
                                                        |
| 1660 | - $output = '<h2 class="pane-title">';  | 
                                                        |
| 1661 | -  $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); | 
                                                        |
| 1662 | - $output .= '</h2>';  | 
                                                        |
| 1663 | - $output .= '<div class="boinc-overview balance-height-front">';  | 
                                                        |
| 1664 | -  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; | 
                                                        |
| 1665 | -  if ($user->uid) { | 
                                                        |
| 1658 | + }  | 
                                                        |
| 1659 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);  | 
                                                        |
| 1660 | + $output = '<h2 class="pane-title">';  | 
                                                        |
| 1661 | +    $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); | 
                                                        |
| 1662 | + $output .= '</h2>';  | 
                                                        |
| 1663 | + $output .= '<div class="boinc-overview balance-height-front">';  | 
                                                        |
| 1664 | +    $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; | 
                                                        |
| 1665 | +    if ($user->uid) { | 
                                                        |
| 1666 | 1666 |      $output .= '  <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        
| 1667 | - }  | 
                                                        |
| 1668 | -  else { | 
                                                        |
| 1667 | + }  | 
                                                        |
| 1668 | +    else { | 
                                                        |
| 1669 | 1669 |      $output .= '  <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        
| 1670 | - }  | 
                                                        |
| 1671 | - $output .= '</div>';  | 
                                                        |
| 1672 | - $output .= '<div class="boinc-overview-details">';  | 
                                                        |
| 1673 | - $output .= ' <div class="detail-container">';  | 
                                                        |
| 1674 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">';  | 
                                                        |
| 1675 | - $output .= ' <div class="picture">';  | 
                                                        |
| 1676 | -  $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], | 
                                                        |
| 1670 | + }  | 
                                                        |
| 1671 | + $output .= '</div>';  | 
                                                        |
| 1672 | + $output .= '<div class="boinc-overview-details">';  | 
                                                        |
| 1673 | + $output .= ' <div class="detail-container">';  | 
                                                        |
| 1674 | + $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">';  | 
                                                        |
| 1675 | + $output .= ' <div class="picture">';  | 
                                                        |
| 1676 | +    $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], | 
                                                        |
| 1677 | 1677 | $uotd_image['alt'], array(), FALSE);  | 
                                                        
| 1678 | - $output .= ' </div>';  | 
                                                        |
| 1679 | -  $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1680 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>';  | 
                                                        |
| 1681 | - $output .= ' </a>';  | 
                                                        |
| 1682 | - $output .= ' <div class="volunteers">';  | 
                                                        |
| 1683 | -  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1684 | - $output .= ' <div class="platforms">';  | 
                                                        |
| 1685 | -  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1686 | -  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1687 | -  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1688 | - $output .= ' </div>';  | 
                                                        |
| 1689 | - $output .= ' </div>';  | 
                                                        |
| 1690 | - $output .= ' </div>';  | 
                                                        |
| 1691 | - $output .= '</div>';  | 
                                                        |
| 1692 | - return $output;  | 
                                                        |
| 1678 | + $output .= ' </div>';  | 
                                                        |
| 1679 | +    $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1680 | + $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>';  | 
                                                        |
| 1681 | + $output .= ' </a>';  | 
                                                        |
| 1682 | + $output .= ' <div class="volunteers">';  | 
                                                        |
| 1683 | +    $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1684 | + $output .= ' <div class="platforms">';  | 
                                                        |
| 1685 | +    $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1686 | +    $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1687 | +    $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1688 | + $output .= ' </div>';  | 
                                                        |
| 1689 | + $output .= ' </div>';  | 
                                                        |
| 1690 | + $output .= ' </div>';  | 
                                                        |
| 1691 | + $output .= '</div>';  | 
                                                        |
| 1692 | + return $output;  | 
                                                        |
| 1693 | 1693 | }  | 
                                                        
| 1694 | 1694 | |
| 1695 | 1695 | /**  | 
                                                        
@@ -1697,81 +1697,81 @@ discard block  | 
                                                    ||
| 1697 | 1697 | * Create a new user account based on supplied parameters.  | 
                                                        
| 1698 | 1698 | */  | 
                                                        
| 1699 | 1699 |  function boincuser_create_account() { | 
                                                        
| 1700 | - global $base_url;  | 
                                                        |
| 1700 | + global $base_url;  | 
                                                        |
| 1701 | 1701 | |
| 1702 | -  require_boinc('boinc_db'); | 
                                                        |
| 1703 | -  require_boinc('user_util'); | 
                                                        |
| 1704 | -  require_boinc('xml'); | 
                                                        |
| 1705 | - $params = array(  | 
                                                        |
| 1702 | +    require_boinc('boinc_db'); | 
                                                        |
| 1703 | +    require_boinc('user_util'); | 
                                                        |
| 1704 | +    require_boinc('xml'); | 
                                                        |
| 1705 | + $params = array(  | 
                                                        |
| 1706 | 1706 | 'email_addr' => isset($_GET['email_addr']) ? $_GET['email_addr'] : '',  | 
                                                        
| 1707 | 1707 | 'user_name' => isset($_GET['user_name']) ? $_GET['user_name'] : '',  | 
                                                        
| 1708 | 1708 | 'passwd_hash' => isset($_GET['passwd_hash']) ? $_GET['passwd_hash'] : ''  | 
                                                        
| 1709 | - );  | 
                                                        |
| 1709 | + );  | 
                                                        |
| 1710 | 1710 | |
| 1711 | - // Begin output  | 
                                                        |
| 1712 | - xml_header();  | 
                                                        |
| 1711 | + // Begin output  | 
                                                        |
| 1712 | + xml_header();  | 
                                                        |
| 1713 | 1713 | |
| 1714 | - // Account creation disabled  | 
                                                        |
| 1715 | -  $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); | 
                                                        |
| 1716 | -  if (!$enablethisRPC) { | 
                                                        |
| 1714 | + // Account creation disabled  | 
                                                        |
| 1715 | +    $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); | 
                                                        |
| 1716 | +    if (!$enablethisRPC) { | 
                                                        |
| 1717 | 1717 |      $mess = bts('Account creation is done through our Web site. Please register at @url', array( | 
                                                        
| 1718 | - '@url' => $base_url . '/user/registration',  | 
                                                        |
| 1718 | + '@url' => $base_url . '/user/registration',  | 
                                                        |
| 1719 | 1719 | ),  | 
                                                        
| 1720 | 1720 | NULL, 'boinc:create_account');  | 
                                                        
| 1721 | 1721 | xml_error(-208, $mess);  | 
                                                        
| 1722 | - }  | 
                                                        |
| 1723 | - // Invalid invite code  | 
                                                        |
| 1722 | + }  | 
                                                        |
| 1723 | + // Invalid invite code  | 
                                                        |
| 1724 | 1724 | |
| 1725 | - // Validate input  | 
                                                        |
| 1726 | -  if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { | 
                                                        |
| 1725 | + // Validate input  | 
                                                        |
| 1726 | +    if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { | 
                                                        |
| 1727 | 1727 | xml_error(-205);  | 
                                                        
| 1728 | - }  | 
                                                        |
| 1728 | + }  | 
                                                        |
| 1729 | 1729 | |
| 1730 | - // Make sure user_name is unique and cleaned  | 
                                                        |
| 1731 | - $unique_name = create_proper_drupalname($params['user_name']);  | 
                                                        |
| 1732 | -  if ($error = user_validate_name($unique_name)) { | 
                                                        |
| 1730 | + // Make sure user_name is unique and cleaned  | 
                                                        |
| 1731 | + $unique_name = create_proper_drupalname($params['user_name']);  | 
                                                        |
| 1732 | +    if ($error = user_validate_name($unique_name)) { | 
                                                        |
| 1733 | 1733 | xml_error(-188, $error);  | 
                                                        
| 1734 | - }  | 
                                                        |
| 1735 | -  if (strlen($params['passwd_hash']) != 32) { | 
                                                        |
| 1734 | + }  | 
                                                        |
| 1735 | +    if (strlen($params['passwd_hash']) != 32) { | 
                                                        |
| 1736 | 1736 | xml_error(-1, 'password hash length not 32');  | 
                                                        
| 1737 | - }  | 
                                                        |
| 1737 | + }  | 
                                                        |
| 1738 | 1738 | |
| 1739 | - // Process input  | 
                                                        |
| 1740 | - // Check this email against previous email addresses.  | 
                                                        |
| 1741 | - $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']);  | 
                                                        |
| 1742 | -  if ($tmpuser) { | 
                                                        |
| 1739 | + // Process input  | 
                                                        |
| 1740 | + // Check this email against previous email addresses.  | 
                                                        |
| 1741 | + $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']);  | 
                                                        |
| 1742 | +    if ($tmpuser) { | 
                                                        |
| 1743 | 1743 | xml_error(-137);  | 
                                                        
| 1744 | - }  | 
                                                        |
| 1744 | + }  | 
                                                        |
| 1745 | 1745 | |
| 1746 | - // Check this email on current email addresses.  | 
                                                        |
| 1747 | - $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);  | 
                                                        |
| 1748 | -  if ($boinc_user) { | 
                                                        |
| 1746 | + // Check this email on current email addresses.  | 
                                                        |
| 1747 | + $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);  | 
                                                        |
| 1748 | +    if ($boinc_user) { | 
                                                        |
| 1749 | 1749 | // Return authenticator for existing users  | 
                                                        
| 1750 | 1750 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or  | 
                                                        
| 1751 | 1751 |      password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { | 
                                                        
| 1752 | -      $output = array('authenticator' => $boinc_user->authenticator); | 
                                                        |
| 1752 | +        $output = array('authenticator' => $boinc_user->authenticator); | 
                                                        |
| 1753 | 1753 | }  | 
                                                        
| 1754 | 1754 |      else { | 
                                                        
| 1755 | - xml_error(-137);  | 
                                                        |
| 1755 | + xml_error(-137);  | 
                                                        |
| 1756 | 1756 | }  | 
                                                        
| 1757 | - }  | 
                                                        |
| 1758 | -  else { | 
                                                        |
| 1757 | + }  | 
                                                        |
| 1758 | +    else { | 
                                                        |
| 1759 | 1759 | // Verify that there isn't somehow a Drupal user already (not possible with proper function)  | 
                                                        
| 1760 | 1760 |      if ($existing_user = user_load(array('mail' => $params['email_addr']))) { | 
                                                        
| 1761 | - xml_error(-137, 'account error');  | 
                                                        |
| 1761 | + xml_error(-137, 'account error');  | 
                                                        |
| 1762 | 1762 | }  | 
                                                        
| 1763 | 1763 | // Create new account  | 
                                                        
| 1764 | 1764 |      $unrestricted_role = array_search('community member', user_roles(true)); | 
                                                        
| 1765 | 1765 | |
| 1766 | 1766 | $newUser = array(  | 
                                                        
| 1767 | - 'name' => $unique_name,  | 
                                                        |
| 1768 | - 'pass' => $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db  | 
                                                        |
| 1769 | - 'mail' => $params['email_addr'],  | 
                                                        |
| 1770 | - 'status' => 1,  | 
                                                        |
| 1771 | - 'init' => $params['email_addr'],  | 
                                                        |
| 1772 | - 'roles' => array($unrestricted_role => ''),  | 
                                                        |
| 1773 | - 'boincuser_name' => $params['user_name'],  | 
                                                        |
| 1774 | - 'boinchash_flag' => TRUE,  | 
                                                        |
| 1767 | + 'name' => $unique_name,  | 
                                                        |
| 1768 | + 'pass' => $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db  | 
                                                        |
| 1769 | + 'mail' => $params['email_addr'],  | 
                                                        |
| 1770 | + 'status' => 1,  | 
                                                        |
| 1771 | + 'init' => $params['email_addr'],  | 
                                                        |
| 1772 | + 'roles' => array($unrestricted_role => ''),  | 
                                                        |
| 1773 | + 'boincuser_name' => $params['user_name'],  | 
                                                        |
| 1774 | + 'boinchash_flag' => TRUE,  | 
                                                        |
| 1775 | 1775 | );  | 
                                                        
| 1776 | 1776 | |
| 1777 | 1777 | // Create the drupal user. If the drupal user cannot be created,  | 
                                                        
@@ -1779,17 +1779,17 @@ discard block  | 
                                                    ||
| 1779 | 1779 | // The user is created in the 'insert' op in hook_user.  | 
                                                        
| 1780 | 1780 | $user = user_save(null, $newUser);  | 
                                                        
| 1781 | 1781 |      if (!$user) { | 
                                                        
| 1782 | -      watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); | 
                                                        |
| 1783 | - xml_error(-137, 'error creating BOINC account');  | 
                                                        |
| 1782 | +        watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); | 
                                                        |
| 1783 | + xml_error(-137, 'error creating BOINC account');  | 
                                                        |
| 1784 | 1784 | }// if drupal user created.  | 
                                                        
| 1785 | 1785 | |
| 1786 | 1786 |      $output = array('authenticator' => $user->boincuser_account_key); | 
                                                        
| 1787 | - }// if existing user found.  | 
                                                        |
| 1787 | + }// if existing user found.  | 
                                                        |
| 1788 | 1788 | |
| 1789 | - // Output authenticator  | 
                                                        |
| 1790 | - echo " <account_out>\n";  | 
                                                        |
| 1791 | -  echo "   <authenticator>{$output['authenticator']}</authenticator>\n"; | 
                                                        |
| 1792 | - echo "</account_out>\n";  | 
                                                        |
| 1789 | + // Output authenticator  | 
                                                        |
| 1790 | + echo " <account_out>\n";  | 
                                                        |
| 1791 | +    echo "   <authenticator>{$output['authenticator']}</authenticator>\n"; | 
                                                        |
| 1792 | + echo "</account_out>\n";  | 
                                                        |
| 1793 | 1793 | }  | 
                                                        
| 1794 | 1794 | |
| 1795 | 1795 | /**  | 
                                                        
@@ -1797,166 +1797,166 @@ discard block  | 
                                                    ||
| 1797 | 1797 | * account is created using the BOINC clinet.  | 
                                                        
| 1798 | 1798 | */  | 
                                                        
| 1799 | 1799 |  function boincuser_account_finish() { | 
                                                        
| 1800 | - global $user;  | 
                                                        |
| 1800 | + global $user;  | 
                                                        |
| 1801 | 1801 | |
| 1802 | - $authtoken = isset($_GET['auth']) ? $_GET['auth'] : '';  | 
                                                        |
| 1802 | + $authtoken = isset($_GET['auth']) ? $_GET['auth'] : '';  | 
                                                        |
| 1803 | 1803 | |
| 1804 | - // Ensure there is a authentication token before continuing  | 
                                                        |
| 1805 | -  if (empty($authtoken)) { | 
                                                        |
| 1804 | + // Ensure there is a authentication token before continuing  | 
                                                        |
| 1805 | +    if (empty($authtoken)) { | 
                                                        |
| 1806 | 1806 | drupal_not_found();  | 
                                                        
| 1807 | 1807 | return ;  | 
                                                        
| 1808 | - }  | 
                                                        |
| 1808 | + }  | 
                                                        |
| 1809 | 1809 | |
| 1810 | -  if (strlen($authtoken) != 32) { | 
                                                        |
| 1810 | +    if (strlen($authtoken) != 32) { | 
                                                        |
| 1811 | 1811 |      drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        
| 1812 | 1812 | drupal_goto();  | 
                                                        
| 1813 | - }  | 
                                                        |
| 1813 | + }  | 
                                                        |
| 1814 | 1814 | |
| 1815 | -  require_boinc('boinc_db'); | 
                                                        |
| 1816 | -  $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); | 
                                                        |
| 1817 | -  if (!$boinc_user) { | 
                                                        |
| 1815 | +    require_boinc('boinc_db'); | 
                                                        |
| 1816 | +    $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); | 
                                                        |
| 1817 | +    if (!$boinc_user) { | 
                                                        |
| 1818 | 1818 |      drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        
| 1819 | 1819 | drupal_goto();  | 
                                                        
| 1820 | - }  | 
                                                        |
| 1821 | - $user = user_load(get_drupal_id($boinc_user->id));  | 
                                                        |
| 1820 | + }  | 
                                                        |
| 1821 | + $user = user_load(get_drupal_id($boinc_user->id));  | 
                                                        |
| 1822 | 1822 | |
| 1823 | -  if (!$user) { | 
                                                        |
| 1823 | +    if (!$user) { | 
                                                        |
| 1824 | 1824 |      drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        
| 1825 | 1825 | drupal_goto();  | 
                                                        
| 1826 | - }  | 
                                                        |
| 1826 | + }  | 
                                                        |
| 1827 | 1827 | |
| 1828 | - // Lookup path to custom account finish page  | 
                                                        |
| 1829 | -  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); | 
                                                        |
| 1830 | -  if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { | 
                                                        |
| 1828 | + // Lookup path to custom account finish page  | 
                                                        |
| 1829 | +    $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); | 
                                                        |
| 1830 | +    if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { | 
                                                        |
| 1831 | 1831 |      $node = menu_get_object('node', 1, $customaccountfinishpath); | 
                                                        
| 1832 | 1832 |      if ($node) { | 
                                                        
| 1833 | - return node_page_view($node);  | 
                                                        |
| 1833 | + return node_page_view($node);  | 
                                                        |
| 1834 | + }  | 
                                                        |
| 1834 | 1835 | }  | 
                                                        
| 1835 | - }  | 
                                                        |
| 1836 | 1836 | |
| 1837 | - // open links in new window  | 
                                                        |
| 1838 | - $options = array(  | 
                                                        |
| 1837 | + // open links in new window  | 
                                                        |
| 1838 | + $options = array(  | 
                                                        |
| 1839 | 1839 | 'attributes' => array( 'target' => '_blank' ),  | 
                                                        
| 1840 | - );  | 
                                                        |
| 1840 | + );  | 
                                                        |
| 1841 | 1841 | |
| 1842 | - // Check moderation page exists  | 
                                                        |
| 1843 | -  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); | 
                                                        |
| 1844 | -  if ( menu_valid_path(array('link_path' => $moderationpath)) ) { | 
                                                        |
| 1842 | + // Check moderation page exists  | 
                                                        |
| 1843 | +    $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); | 
                                                        |
| 1844 | +    if ( menu_valid_path(array('link_path' => $moderationpath)) ) { | 
                                                        |
| 1845 | 1845 |      $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); | 
                                                        
| 1846 | -  } else { | 
                                                        |
| 1846 | +    } else { | 
                                                        |
| 1847 | 1847 |      $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); | 
                                                        
| 1848 | - }  | 
                                                        |
| 1848 | + }  | 
                                                        |
| 1849 | 1849 | |
| 1850 | - $username = $user->boincuser_name;  | 
                                                        |
| 1851 | -  $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1852 | -  $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', | 
                                                        |
| 1853 | - array(  | 
                                                        |
| 1850 | + $username = $user->boincuser_name;  | 
                                                        |
| 1851 | +    $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 1852 | +    $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', | 
                                                        |
| 1853 | + array(  | 
                                                        |
| 1854 | 1854 | '@user_name' => $username,  | 
                                                        
| 1855 | 1855 | '@site_name' => $site_name,  | 
                                                        
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>";  | 
                                                        |
| 1856 | + ), NULL, 'boinc:account-finish') . "</p>";  | 
                                                        |
| 1857 | 1857 | |
| 1858 | - $links = array(  | 
                                                        |
| 1858 | + $links = array(  | 
                                                        |
| 1859 | 1859 | array(  | 
                                                        
| 1860 | -      'data' => bts('Change your username at !community_preferences.', array( | 
                                                        |
| 1860 | +        'data' => bts('Change your username at !community_preferences.', array( | 
                                                        |
| 1861 | 1861 |          '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), | 
                                                        
| 1862 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1863 | - 'children' => array(  | 
                                                        |
| 1862 | + ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1863 | + 'children' => array(  | 
                                                        |
| 1864 | 1864 |          bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), | 
                                                        
| 1865 | 1865 |          bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), | 
                                                        
| 1866 | - ),  | 
                                                        |
| 1866 | + ),  | 
                                                        |
| 1867 | 1867 | ),  | 
                                                        
| 1868 | 1868 | array(  | 
                                                        
| 1869 | -      'data' => bts('Change your !computing_preferences.', array( | 
                                                        |
| 1869 | +        'data' => bts('Change your !computing_preferences.', array( | 
                                                        |
| 1870 | 1870 |          '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), | 
                                                        
| 1871 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1872 | - 'children' => array(  | 
                                                        |
| 1871 | + ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1872 | + 'children' => array(  | 
                                                        |
| 1873 | 1873 |          bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), NULL, 'boinc:account-finish'), | 
                                                        
| 1874 | 1874 |          bts('By default, you will run @site_name tasks without any additional configuration.', array( | 
                                                        
| 1875 | - '@site_name' => $site_name,  | 
                                                        |
| 1875 | + '@site_name' => $site_name,  | 
                                                        |
| 1876 | 1876 | ), NULL, 'boinc:account-finish'),  | 
                                                        
| 1877 | 1877 |          bts('It is recommended new volunteers leave the default settings until they gain experience running some tasks. Ask questions in the !forums to get advice before making changes to a setting you don\'t understand.', array( | 
                                                        
| 1878 | -          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), | 
                                                        |
| 1878 | +            '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), | 
                                                        |
| 1879 | 1879 | ), NULL, 'boinc:account-finish'),  | 
                                                        
| 1880 | - ),  | 
                                                        |
| 1880 | + ),  | 
                                                        |
| 1881 | 1881 | ),  | 
                                                        
| 1882 | 1882 | array(  | 
                                                        
| 1883 | 1883 |          'data' => bts('Create a !user_profile.', array( | 
                                                        
| 1884 | -          '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), | 
                                                        |
| 1884 | +            '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), | 
                                                        |
| 1885 | 1885 | ), NULL, 'boinc:account-finish'),  | 
                                                        
| 1886 | - 'children' => array(  | 
                                                        |
| 1886 | + 'children' => array(  | 
                                                        |
| 1887 | 1887 |          bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( | 
                                                        
| 1888 | - '@site_name' => $site_name,  | 
                                                        |
| 1888 | + '@site_name' => $site_name,  | 
                                                        |
| 1889 | 1889 | ), NULL, 'boinc:account-finish'),  | 
                                                        
| 1890 | 1890 | $modsentence,  | 
                                                        
| 1891 | - ),  | 
                                                        |
| 1891 | + ),  | 
                                                        |
| 1892 | 1892 | ),  | 
                                                        
| 1893 | 1893 | array(  | 
                                                        
| 1894 | -      'data' => bts('Join a !team.', array( | 
                                                        |
| 1894 | +        'data' => bts('Join a !team.', array( | 
                                                        |
| 1895 | 1895 |          '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), | 
                                                        
| 1896 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1897 | - 'children' => array(  | 
                                                        |
| 1896 | + ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1897 | + 'children' => array(  | 
                                                        |
| 1898 | 1898 |          bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), | 
                                                        
| 1899 | - ),  | 
                                                        |
| 1899 | + ),  | 
                                                        |
| 1900 | 1900 | ),  | 
                                                        
| 1901 | 1901 | array(  | 
                                                        
| 1902 | -      'data' => bts('Go to your !account_dashboard.', array( | 
                                                        |
| 1902 | +        'data' => bts('Go to your !account_dashboard.', array( | 
                                                        |
| 1903 | 1903 |          '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), | 
                                                        
| 1904 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1905 | - 'children' => array(  | 
                                                        |
| 1904 | + ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1905 | + 'children' => array(  | 
                                                        |
| 1906 | 1906 |          bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), | 
                                                        
| 1907 | - ),  | 
                                                        |
| 1907 | + ),  | 
                                                        |
| 1908 | 1908 | ),  | 
                                                        
| 1909 | 1909 | array(  | 
                                                        
| 1910 | -      'data' => bts('Visit our !help pages.', array( | 
                                                        |
| 1910 | +        'data' => bts('Visit our !help pages.', array( | 
                                                        |
| 1911 | 1911 |          '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) | 
                                                        
| 1912 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1913 | - 'children' => array(  | 
                                                        |
| 1912 | + ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1913 | + 'children' => array(  | 
                                                        |
| 1914 | 1914 |          bts('Ask for help in our community\'s !forums.', array( | 
                                                        
| 1915 | -          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) | 
                                                        |
| 1915 | +            '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) | 
                                                        |
| 1916 | 1916 | ), NULL, 'boinc:account-finish'),  | 
                                                        
| 1917 | - ),  | 
                                                        |
| 1917 | + ),  | 
                                                        |
| 1918 | 1918 | ),  | 
                                                        
| 1919 | - );  | 
                                                        |
| 1919 | + );  | 
                                                        |
| 1920 | 1920 | |
| 1921 | - //List of links  | 
                                                        |
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul');  | 
                                                        |
| 1921 | + //List of links  | 
                                                        |
| 1922 | + $output .= theme_item_list($links, $title = NULL, $type='ul');  | 
                                                        |
| 1923 | 1923 | |
| 1924 | - return $output;  | 
                                                        |
| 1924 | + return $output;  | 
                                                        |
| 1925 | 1925 | }  | 
                                                        
| 1926 | 1926 | |
| 1927 | 1927 | /**  | 
                                                        
| 1928 | 1928 | * Determine if the user has permission to control community access  | 
                                                        
| 1929 | 1929 | */  | 
                                                        
| 1930 | 1930 |  function boincuser_moderate_community_access() { | 
                                                        
| 1931 | -  if (user_access('assign community member role') | 
                                                        |
| 1931 | +    if (user_access('assign community member role') | 
                                                        |
| 1932 | 1932 |    OR user_access('assign all roles')) { | 
                                                        
| 1933 | 1933 | return TRUE;  | 
                                                        
| 1934 | - }  | 
                                                        |
| 1935 | - return FALSE;  | 
                                                        |
| 1934 | + }  | 
                                                        |
| 1935 | + return FALSE;  | 
                                                        |
| 1936 | 1936 | }  | 
                                                        
| 1937 | 1937 | |
| 1938 | 1938 | /**  | 
                                                        
| 1939 | 1939 | * Get the count of items in the moderation queue  | 
                                                        
| 1940 | 1940 | */  | 
                                                        
| 1941 | 1941 |  function boincuser_moderation_queue_count($caller = 'user') { | 
                                                        
| 1942 | - $allowed = FALSE;  | 
                                                        |
| 1943 | -  switch ($caller) { | 
                                                        |
| 1944 | - case 'cron':  | 
                                                        |
| 1942 | + $allowed = FALSE;  | 
                                                        |
| 1943 | +    switch ($caller) { | 
                                                        |
| 1944 | + case 'cron':  | 
                                                        |
| 1945 | 1945 | $allowed = TRUE;  | 
                                                        
| 1946 | 1946 | break;  | 
                                                        
| 1947 | - case 'user':  | 
                                                        |
| 1947 | + case 'user':  | 
                                                        |
| 1948 | 1948 | default:  | 
                                                        
| 1949 | 1949 |      $allowed = user_access('edit any profile content'); | 
                                                        
| 1950 | - }  | 
                                                        |
| 1951 | -  if ($allowed) { | 
                                                        |
| 1950 | + }  | 
                                                        |
| 1951 | +    if ($allowed) { | 
                                                        |
| 1952 | 1952 |      return db_result(db_query(" | 
                                                        
| 1953 | 1953 | SELECT COUNT(*)  | 
                                                        
| 1954 | 1954 |        FROM {node} | 
                                                        
| 1955 | 1955 | WHERE type = 'profile'  | 
                                                        
| 1956 | 1956 | AND moderate = 1"  | 
                                                        
| 1957 | 1957 | ));  | 
                                                        
| 1958 | - }  | 
                                                        |
| 1959 | - return NULL;  | 
                                                        |
| 1958 | + }  | 
                                                        |
| 1959 | + return NULL;  | 
                                                        |
| 1960 | 1960 | }  | 
                                                        
| 1961 | 1961 | |
| 1962 | 1962 | /**  | 
                                                        
@@ -1965,43 +1965,43 @@ discard block  | 
                                                    ||
| 1965 | 1965 | * than through the user account info form.  | 
                                                        
| 1966 | 1966 | */  | 
                                                        
| 1967 | 1967 |  function boincuser_control($uid = NULL, $action = NULL) { | 
                                                        
| 1968 | -  if (!$uid OR !$account = user_load($uid)) { | 
                                                        |
| 1968 | +    if (!$uid OR !$account = user_load($uid)) { | 
                                                        |
| 1969 | 1969 | // What are you even doing here...  | 
                                                        
| 1970 | 1970 | return FALSE;  | 
                                                        
| 1971 | - }  | 
                                                        |
| 1972 | -  switch ($action) { | 
                                                        |
| 1973 | - case 'ban':  | 
                                                        |
| 1971 | + }  | 
                                                        |
| 1972 | +    switch ($action) { | 
                                                        |
| 1973 | + case 'ban':  | 
                                                        |
| 1974 | 1974 |      if (boincuser_moderate_community_access()) { | 
                                                        
| 1975 | -      $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); | 
                                                        |
| 1976 | - $boincuser_record = array(  | 
                                                        |
| 1975 | +        $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); | 
                                                        |
| 1976 | + $boincuser_record = array(  | 
                                                        |
| 1977 | 1977 | 'uid' => $uid,  | 
                                                        
| 1978 | 1978 | 'penalty_expiration' => time() + $penalty_period,  | 
                                                        
| 1979 | - );  | 
                                                        |
| 1980 | -      drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 1981 | -      $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 1982 | -      if (isset($account->roles[$community_role])) { | 
                                                        |
| 1979 | + );  | 
                                                        |
| 1980 | +        drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 1981 | +        $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 1982 | +        if (isset($account->roles[$community_role])) { | 
                                                        |
| 1983 | 1983 | unset($account->roles[$community_role]);  | 
                                                        
| 1984 | 1984 |          user_save($account, array('roles' => $account->roles)); | 
                                                        
| 1985 | - }  | 
                                                        |
| 1985 | + }  | 
                                                        |
| 1986 | 1986 | }  | 
                                                        
| 1987 | 1987 | break;  | 
                                                        
| 1988 | - case 'lift-ban':  | 
                                                        |
| 1988 | + case 'lift-ban':  | 
                                                        |
| 1989 | 1989 |      if (boincuser_moderate_community_access()) { | 
                                                        
| 1990 | - $boincuser_record = array(  | 
                                                        |
| 1990 | + $boincuser_record = array(  | 
                                                        |
| 1991 | 1991 | 'uid' => $uid,  | 
                                                        
| 1992 | 1992 | 'penalty_expiration' => 0,  | 
                                                        
| 1993 | - );  | 
                                                        |
| 1994 | -      drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 1995 | -      $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 1996 | -      if (!isset($account->roles[$community_role])) { | 
                                                        |
| 1993 | + );  | 
                                                        |
| 1994 | +        drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 1995 | +        $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 1996 | +        if (!isset($account->roles[$community_role])) { | 
                                                        |
| 1997 | 1997 | $account->roles[$community_role] = 'community member';  | 
                                                        
| 1998 | 1998 |          user_save($account, array('roles' => $account->roles)); | 
                                                        
| 1999 | - }  | 
                                                        |
| 1999 | + }  | 
                                                        |
| 2000 | 2000 | }  | 
                                                        
| 2001 | 2001 | break;  | 
                                                        
| 2002 | - default:  | 
                                                        |
| 2002 | + default:  | 
                                                        |
| 2003 | 2003 | }  | 
                                                        
| 2004 | -  drupal_goto("account/{$account->uid}"); | 
                                                        |
| 2004 | +    drupal_goto("account/{$account->uid}"); | 
                                                        |
| 2005 | 2005 | }  | 
                                                        
| 2006 | 2006 | |
| 2007 | 2007 | /**  | 
                                                        
@@ -2009,29 +2009,29 @@ discard block  | 
                                                    ||
| 2009 | 2009 | * moderation flag.  | 
                                                        
| 2010 | 2010 | */  | 
                                                        
| 2011 | 2011 |  function boincuser_moderate_profile_approve($account) { | 
                                                        
| 2012 | - $node = new stdClass;  | 
                                                        |
| 2013 | - $node->type = 'profile';  | 
                                                        |
| 2014 | - $node->language = '';  | 
                                                        |
| 2015 | - $nid = content_profile_profile_exists($node, $account->uid);  | 
                                                        |
| 2016 | - $profile = node_load($nid);  | 
                                                        |
| 2017 | - $profile->moderate = 0;  | 
                                                        |
| 2018 | - $profile->status = 1;  | 
                                                        |
| 2019 | - node_save($profile);  | 
                                                        |
| 2020 | -  drupal_set_message('This profile has been marked as approved.'); | 
                                                        |
| 2021 | - drupal_goto();  | 
                                                        |
| 2012 | + $node = new stdClass;  | 
                                                        |
| 2013 | + $node->type = 'profile';  | 
                                                        |
| 2014 | + $node->language = '';  | 
                                                        |
| 2015 | + $nid = content_profile_profile_exists($node, $account->uid);  | 
                                                        |
| 2016 | + $profile = node_load($nid);  | 
                                                        |
| 2017 | + $profile->moderate = 0;  | 
                                                        |
| 2018 | + $profile->status = 1;  | 
                                                        |
| 2019 | + node_save($profile);  | 
                                                        |
| 2020 | +    drupal_set_message('This profile has been marked as approved.'); | 
                                                        |
| 2021 | + drupal_goto();  | 
                                                        |
| 2022 | 2022 | }  | 
                                                        
| 2023 | 2023 | |
| 2024 | 2024 | /**  | 
                                                        
| 2025 | 2025 | * Mark a user profile as rejected and notify the user of the reason.  | 
                                                        
| 2026 | 2026 | */  | 
                                                        
| 2027 | 2027 |  function boincuser_moderate_profile_reject($uid, $reason = '') { | 
                                                        
| 2028 | - $account = user_load($uid);  | 
                                                        |
| 2029 | - $node = new stdClass;  | 
                                                        |
| 2030 | - $node->type = 'profile';  | 
                                                        |
| 2031 | - $node->language = '';  | 
                                                        |
| 2032 | - $nid = content_profile_profile_exists($node, $uid);  | 
                                                        |
| 2033 | - $profile = node_load($nid);  | 
                                                        |
| 2034 | -  if ($profile->nid) { | 
                                                        |
| 2028 | + $account = user_load($uid);  | 
                                                        |
| 2029 | + $node = new stdClass;  | 
                                                        |
| 2030 | + $node->type = 'profile';  | 
                                                        |
| 2031 | + $node->language = '';  | 
                                                        |
| 2032 | + $nid = content_profile_profile_exists($node, $uid);  | 
                                                        |
| 2033 | + $profile = node_load($nid);  | 
                                                        |
| 2034 | +    if ($profile->nid) { | 
                                                        |
| 2035 | 2035 | global $user;  | 
                                                        
| 2036 | 2036 | global $base_url;  | 
                                                        
| 2037 | 2037 | global $base_path;  | 
                                                        
@@ -2042,64 +2042,64 @@ discard block  | 
                                                    ||
| 2042 | 2042 | $profile->status = 0;  | 
                                                        
| 2043 | 2043 | node_save($profile);  | 
                                                        
| 2044 | 2044 | $settings = array(  | 
                                                        
| 2045 | - 'from' => '',  | 
                                                        |
| 2046 | -      'subject' => "Profile moderation at {$site_name}", | 
                                                        |
| 2047 | - 'message' => ''  | 
                                                        |
| 2048 | -      . "{$account->boincuser_name},\n" | 
                                                        |
| 2049 | - . "\n"  | 
                                                        |
| 2050 | -      . "{$moderator->boincuser_name} has rejected your profile at" | 
                                                        |
| 2051 | -      . " {$site_name} for the following reason: \n" | 
                                                        |
| 2052 | - . "\n"  | 
                                                        |
| 2053 | -      . "{$reason}\n" | 
                                                        |
| 2054 | - . "\n"  | 
                                                        |
| 2055 | - . "\n"  | 
                                                        |
| 2056 | - . "Since it has not been approved, your profile is not visible to other"  | 
                                                        |
| 2057 | -      . " {$site_name} users. Please make the needed changes here:\n" | 
                                                        |
| 2058 | - . "\n"  | 
                                                        |
| 2059 | -      . "{$site_url}account/profile \n" | 
                                                        |
| 2060 | - . "\n"  | 
                                                        |
| 2061 | - . "Thanks, \n"  | 
                                                        |
| 2062 | - . "\n"  | 
                                                        |
| 2063 | -      . "{$site_name} support team", | 
                                                        |
| 2045 | + 'from' => '',  | 
                                                        |
| 2046 | +        'subject' => "Profile moderation at {$site_name}", | 
                                                        |
| 2047 | + 'message' => ''  | 
                                                        |
| 2048 | +        . "{$account->boincuser_name},\n" | 
                                                        |
| 2049 | + . "\n"  | 
                                                        |
| 2050 | +        . "{$moderator->boincuser_name} has rejected your profile at" | 
                                                        |
| 2051 | +        . " {$site_name} for the following reason: \n" | 
                                                        |
| 2052 | + . "\n"  | 
                                                        |
| 2053 | +        . "{$reason}\n" | 
                                                        |
| 2054 | + . "\n"  | 
                                                        |
| 2055 | + . "\n"  | 
                                                        |
| 2056 | + . "Since it has not been approved, your profile is not visible to other"  | 
                                                        |
| 2057 | +        . " {$site_name} users. Please make the needed changes here:\n" | 
                                                        |
| 2058 | + . "\n"  | 
                                                        |
| 2059 | +        . "{$site_url}account/profile \n" | 
                                                        |
| 2060 | + . "\n"  | 
                                                        |
| 2061 | + . "Thanks, \n"  | 
                                                        |
| 2062 | + . "\n"  | 
                                                        |
| 2063 | +        . "{$site_name} support team", | 
                                                        |
| 2064 | 2064 | );  | 
                                                        
| 2065 | 2065 | rules_action_mail_to_user($account, $settings);  | 
                                                        
| 2066 | 2066 |      drupal_set_message('This profile has been marked as rejected.'); | 
                                                        
| 2067 | - }  | 
                                                        |
| 2068 | - drupal_goto();  | 
                                                        |
| 2067 | + }  | 
                                                        |
| 2068 | + drupal_goto();  | 
                                                        |
| 2069 | 2069 | }  | 
                                                        
| 2070 | 2070 | |
| 2071 | 2071 | /**  | 
                                                        
| 2072 | 2072 | * Ban a user and send a notification of the reason.  | 
                                                        
| 2073 | 2073 | */  | 
                                                        
| 2074 | 2074 |  function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { | 
                                                        
| 2075 | -  if (user_access('assign community member role') | 
                                                        |
| 2075 | +    if (user_access('assign community member role') | 
                                                        |
| 2076 | 2076 |    OR user_access('assign all roles')) { | 
                                                        
| 2077 | 2077 | $account = user_load($uid);  | 
                                                        
| 2078 | 2078 |      if ($account->uid) { | 
                                                        
| 2079 | -      module_load_include('inc', 'rules', 'modules/system.rules'); | 
                                                        |
| 2080 | -      if ($duration === '') { | 
                                                        |
| 2079 | +        module_load_include('inc', 'rules', 'modules/system.rules'); | 
                                                        |
| 2080 | +        if ($duration === '') { | 
                                                        |
| 2081 | 2081 |          $duration = variable_get('boinc_penalty_period', 7*24*60*60); | 
                                                        
| 2082 | - }  | 
                                                        |
| 2083 | - $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;  | 
                                                        |
| 2084 | - $boincuser_record = array(  | 
                                                        |
| 2082 | + }  | 
                                                        |
| 2083 | + $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;  | 
                                                        |
| 2084 | + $boincuser_record = array(  | 
                                                        |
| 2085 | 2085 | 'uid' => $uid,  | 
                                                        
| 2086 | 2086 | 'penalty_expiration' => $penalty_expiration,  | 
                                                        
| 2087 | - );  | 
                                                        |
| 2088 | -      drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 2087 | + );  | 
                                                        |
| 2088 | +        drupal_write_record('boincuser', $boincuser_record, 'uid'); | 
                                                        |
| 2089 | 2089 | |
| 2090 | -      $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 2091 | -      if (isset($account->roles[$community_role])) { | 
                                                        |
| 2090 | +        $community_role = array_search('community member', user_roles(true)); | 
                                                        |
| 2091 | +        if (isset($account->roles[$community_role])) { | 
                                                        |
| 2092 | 2092 | unset($account->roles[$community_role]);  | 
                                                        
| 2093 | 2093 |          user_save($account, array('roles' => $account->roles)); | 
                                                        
| 2094 | - }  | 
                                                        |
| 2095 | -  | 
                                                        |
| 2096 | - global $user;  | 
                                                        |
| 2097 | - global $base_url;  | 
                                                        |
| 2098 | - global $base_path;  | 
                                                        |
| 2099 | -      $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 2100 | - $site_url = $base_url . $base_path;  | 
                                                        |
| 2101 | - $moderator = user_load($user->uid);  | 
                                                        |
| 2102 | - $settings = array(  | 
                                                        |
| 2094 | + }  | 
                                                        |
| 2095 | +  | 
                                                        |
| 2096 | + global $user;  | 
                                                        |
| 2097 | + global $base_url;  | 
                                                        |
| 2098 | + global $base_path;  | 
                                                        |
| 2099 | +        $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        |
| 2100 | + $site_url = $base_url . $base_path;  | 
                                                        |
| 2101 | + $moderator = user_load($user->uid);  | 
                                                        |
| 2102 | + $settings = array(  | 
                                                        |
| 2103 | 2103 | 'from' => '',  | 
                                                        
| 2104 | 2104 |          'subject' => "User moderation at {$site_name}", | 
                                                        
| 2105 | 2105 | 'message' => ''  | 
                                                        
@@ -2120,12 +2120,12 @@ discard block  | 
                                                    ||
| 2120 | 2120 | . "Thanks, \n"  | 
                                                        
| 2121 | 2121 | . "\n"  | 
                                                        
| 2122 | 2122 |          . "{$site_name} support team", | 
                                                        
| 2123 | - );  | 
                                                        |
| 2124 | - rules_action_mail_to_user($account, $settings);  | 
                                                        |
| 2125 | -      drupal_set_message('This user has been banned.'); | 
                                                        |
| 2123 | + );  | 
                                                        |
| 2124 | + rules_action_mail_to_user($account, $settings);  | 
                                                        |
| 2125 | +        drupal_set_message('This user has been banned.'); | 
                                                        |
| 2126 | 2126 | }  | 
                                                        
| 2127 | - }  | 
                                                        |
| 2128 | - drupal_goto();  | 
                                                        |
| 2127 | + }  | 
                                                        |
| 2128 | + drupal_goto();  | 
                                                        |
| 2129 | 2129 | }  | 
                                                        
| 2130 | 2130 | |
| 2131 | 2131 | |
@@ -2137,15 +2137,15 @@ discard block  | 
                                                    ||
| 2137 | 2137 | *  | 
                                                        
| 2138 | 2138 | */  | 
                                                        
| 2139 | 2139 |  function boincuser_get_weak_auth($boinc_id = null) { | 
                                                        
| 2140 | -  if (!$boinc_id) { | 
                                                        |
| 2140 | +    if (!$boinc_id) { | 
                                                        |
| 2141 | 2141 | global $user;  | 
                                                        
| 2142 | 2142 | $account = user_load($user->uid);  | 
                                                        
| 2143 | 2143 | $boinc_id = $account->boincuser_id;  | 
                                                        
| 2144 | - }  | 
                                                        |
| 2144 | + }  | 
                                                        |
| 2145 | 2145 | |
| 2146 | - $boinc_user = boincuser_load($account->boincuser_id);  | 
                                                        |
| 2146 | + $boinc_user = boincuser_load($account->boincuser_id);  | 
                                                        |
| 2147 | 2147 | |
| 2148 | - return weak_auth($boinc_user);  | 
                                                        |
| 2148 | + return weak_auth($boinc_user);  | 
                                                        |
| 2149 | 2149 | }  | 
                                                        
| 2150 | 2150 | |
| 2151 | 2151 | /**  | 
                                                        
@@ -2154,75 +2154,75 @@ discard block  | 
                                                    ||
| 2154 | 2154 | * Drupal User so must be inserted into comments, etc. (not so by default)  | 
                                                        
| 2155 | 2155 | */  | 
                                                        
| 2156 | 2156 |  function boincuser_get_user_profile_image($uid, $avatar = TRUE) { | 
                                                        
| 2157 | - // Though the function name implies otherwise, get the avatar by default  | 
                                                        |
| 2158 | - $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';  | 
                                                        |
| 2159 | -  $image_fid = db_result(db_query(" | 
                                                        |
| 2157 | + // Though the function name implies otherwise, get the avatar by default  | 
                                                        |
| 2158 | + $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';  | 
                                                        |
| 2159 | +    $image_fid = db_result(db_query(" | 
                                                        |
| 2160 | 2160 | SELECT ctp.%s  | 
                                                        
| 2161 | 2161 |      FROM {content_type_profile} ctp | 
                                                        
| 2162 | 2162 |      INNER JOIN {node} n ON ctp.nid = n.nid | 
                                                        
| 2163 | 2163 | WHERE n.uid = %d AND n.type = '%s'",  | 
                                                        
| 2164 | 2164 | $image_field, $uid, 'profile'));  | 
                                                        
| 2165 | - $user_image['image'] = field_file_load($image_fid);  | 
                                                        |
| 2166 | -  if (!$user_image['image']['filepath']) { | 
                                                        |
| 2165 | + $user_image['image'] = field_file_load($image_fid);  | 
                                                        |
| 2166 | +    if (!$user_image['image']['filepath']) { | 
                                                        |
| 2167 | 2167 | // Load the default image if one does not exist  | 
                                                        
| 2168 | 2168 | $account = user_load($uid);  | 
                                                        
| 2169 | 2169 |      if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { | 
                                                        
| 2170 | - // Use a Gravatar rather than the system default image  | 
                                                        |
| 2171 | - $options = array(  | 
                                                        |
| 2170 | + // Use a Gravatar rather than the system default image  | 
                                                        |
| 2171 | + $options = array(  | 
                                                        |
| 2172 | 2172 | 'size' => 100,  | 
                                                        
| 2173 | 2173 | 'rating' => 'G',  | 
                                                        
| 2174 | - );  | 
                                                        |
| 2175 | - // Get the Gravatar URL and see if the image exists  | 
                                                        |
| 2176 | - $url = gravatar_get_gravatar($account->mail, $options);  | 
                                                        |
| 2177 | - $headers = @get_headers($url);  | 
                                                        |
| 2178 | -      if (preg_match("|200|", $headers[0])) { | 
                                                        |
| 2174 | + );  | 
                                                        |
| 2175 | + // Get the Gravatar URL and see if the image exists  | 
                                                        |
| 2176 | + $url = gravatar_get_gravatar($account->mail, $options);  | 
                                                        |
| 2177 | + $headers = @get_headers($url);  | 
                                                        |
| 2178 | +        if (preg_match("|200|", $headers[0])) { | 
                                                        |
| 2179 | 2179 | return $url;  | 
                                                        
| 2180 | - }  | 
                                                        |
| 2180 | + }  | 
                                                        |
| 2181 | 2181 | }  | 
                                                        
| 2182 | 2182 | // Get default image if nothing else works  | 
                                                        
| 2183 | 2183 |      $content_node_widget_settings = db_result(db_query("SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = '%s'", ($avatar ? 'field_image' : 'field_profile_image'))); | 
                                                        
| 2184 | 2184 | $content_node_widget_settings = unserialize($content_node_widget_settings);  | 
                                                        
| 2185 | 2185 | $user_image['image'] = $content_node_widget_settings['default_image'];  | 
                                                        
| 2186 | - }  | 
                                                        |
| 2187 | - $user = user_load($uid);  | 
                                                        |
| 2188 | - // Use boinc username for image alt/title attributes  | 
                                                        |
| 2189 | - $user_image['alt'] = $user->boincuser_name;  | 
                                                        |
| 2190 | - return $user_image;  | 
                                                        |
| 2186 | + }  | 
                                                        |
| 2187 | + $user = user_load($uid);  | 
                                                        |
| 2188 | + // Use boinc username for image alt/title attributes  | 
                                                        |
| 2189 | + $user_image['alt'] = $user->boincuser_name;  | 
                                                        |
| 2190 | + return $user_image;  | 
                                                        |
| 2191 | 2191 | }  | 
                                                        
| 2192 | 2192 | |
| 2193 | 2193 | /**  | 
                                                        
| 2194 | 2194 | * Generate a table of a user's projects  | 
                                                        
| 2195 | 2195 | */  | 
                                                        
| 2196 | 2196 |  function boincuser_get_projects_table($account = null) { | 
                                                        
| 2197 | -  if ($account AND is_numeric($account)) { | 
                                                        |
| 2197 | +    if ($account AND is_numeric($account)) { | 
                                                        |
| 2198 | 2198 | $account = user_load($account);  | 
                                                        
| 2199 | - }  | 
                                                        |
| 2200 | - $projects = boincuser_get_projects($account);  | 
                                                        |
| 2201 | -  if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); | 
                                                        |
| 2202 | -  | 
                                                        |
| 2203 | - $output = '';  | 
                                                        |
| 2204 | - $output .= '<table class="user-projects">' . "\n";  | 
                                                        |
| 2205 | - $output .= '<thead>' . "\n";  | 
                                                        |
| 2206 | - $output .= ' <tr>' . "\n";  | 
                                                        |
| 2207 | -  $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; | 
                                                        |
| 2208 | -  $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; | 
                                                        |
| 2209 | -  $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; | 
                                                        |
| 2210 | - $output .= ' </tr>' . "\n";  | 
                                                        |
| 2211 | - $output .= '</thead>' . "\n";  | 
                                                        |
| 2212 | - $output .= '<tbody>' . "\n";  | 
                                                        |
| 2213 | -  foreach ($projects AS $project) { | 
                                                        |
| 2199 | + }  | 
                                                        |
| 2200 | + $projects = boincuser_get_projects($account);  | 
                                                        |
| 2201 | +    if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); | 
                                                        |
| 2202 | +  | 
                                                        |
| 2203 | + $output = '';  | 
                                                        |
| 2204 | + $output .= '<table class="user-projects">' . "\n";  | 
                                                        |
| 2205 | + $output .= '<thead>' . "\n";  | 
                                                        |
| 2206 | + $output .= ' <tr>' . "\n";  | 
                                                        |
| 2207 | +    $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; | 
                                                        |
| 2208 | +    $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; | 
                                                        |
| 2209 | +    $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; | 
                                                        |
| 2210 | + $output .= ' </tr>' . "\n";  | 
                                                        |
| 2211 | + $output .= '</thead>' . "\n";  | 
                                                        |
| 2212 | + $output .= '<tbody>' . "\n";  | 
                                                        |
| 2213 | +    foreach ($projects AS $project) { | 
                                                        |
| 2214 | 2214 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;  | 
                                                        
| 2215 | 2215 | $output .= ' <tr>' . "\n";  | 
                                                        
| 2216 | 2216 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n";  | 
                                                        
| 2217 | 2217 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n";  | 
                                                        
| 2218 | 2218 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";  | 
                                                        
| 2219 | 2219 | $output .= ' </tr>' . "\n";  | 
                                                        
| 2220 | - }  | 
                                                        |
| 2221 | - $output .= '</tbody>' . "\n";  | 
                                                        |
| 2222 | - $output .= '</table>' . "\n";  | 
                                                        |
| 2223 | -  $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; | 
                                                        |
| 2224 | -  //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; | 
                                                        |
| 2225 | - return $output;  | 
                                                        |
| 2220 | + }  | 
                                                        |
| 2221 | + $output .= '</tbody>' . "\n";  | 
                                                        |
| 2222 | + $output .= '</table>' . "\n";  | 
                                                        |
| 2223 | +    $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; | 
                                                        |
| 2224 | +    //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; | 
                                                        |
| 2225 | + return $output;  | 
                                                        |
| 2226 | 2226 | }  | 
                                                        
| 2227 | 2227 | |
| 2228 | 2228 | /**  | 
                                                        
@@ -2230,25 +2230,25 @@ discard block  | 
                                                    ||
| 2230 | 2230 | */  | 
                                                        
| 2231 | 2231 |  function boincuser_get_stats_user_data($cpid = null) { | 
                                                        
| 2232 | 2232 | |
| 2233 | - // [TODO] Set this stuff in site config!  | 
                                                        |
| 2234 | - $stats_server = 'stats.gridrepublic.org';  | 
                                                        |
| 2235 | - $stats_rpc = 'rpc/get_user.php';  | 
                                                        |
| 2233 | + // [TODO] Set this stuff in site config!  | 
                                                        |
| 2234 | + $stats_server = 'stats.gridrepublic.org';  | 
                                                        |
| 2235 | + $stats_rpc = 'rpc/get_user.php';  | 
                                                        |
| 2236 | 2236 | |
| 2237 | - // Construct query string  | 
                                                        |
| 2238 | - $get = array(  | 
                                                        |
| 2237 | + // Construct query string  | 
                                                        |
| 2238 | + $get = array(  | 
                                                        |
| 2239 | 2239 | 'cpid' => $cpid  | 
                                                        
| 2240 | - );  | 
                                                        |
| 2241 | - $args = array();  | 
                                                        |
| 2242 | -  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); | 
                                                        |
| 2243 | -  $query = '?' . implode('&', $args); | 
                                                        |
| 2244 | -  | 
                                                        |
| 2245 | - // Load XML from RPC  | 
                                                        |
| 2246 | -  $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; | 
                                                        |
| 2247 | - $result = drupal_http_request($target_url);  | 
                                                        |
| 2248 | -  if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { | 
                                                        |
| 2240 | + );  | 
                                                        |
| 2241 | + $args = array();  | 
                                                        |
| 2242 | +    foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); | 
                                                        |
| 2243 | +    $query = '?' . implode('&', $args); | 
                                                        |
| 2244 | +  | 
                                                        |
| 2245 | + // Load XML from RPC  | 
                                                        |
| 2246 | +    $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; | 
                                                        |
| 2247 | + $result = drupal_http_request($target_url);  | 
                                                        |
| 2248 | +    if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { | 
                                                        |
| 2249 | 2249 | return simplexml_load_string($result->data);  | 
                                                        
| 2250 | - }  | 
                                                        |
| 2251 | - return NULL;  | 
                                                        |
| 2250 | + }  | 
                                                        |
| 2251 | + return NULL;  | 
                                                        |
| 2252 | 2252 | }  | 
                                                        
| 2253 | 2253 | |
| 2254 | 2254 | /**  | 
                                                        
@@ -2256,15 +2256,15 @@ discard block  | 
                                                    ||
| 2256 | 2256 | */  | 
                                                        
| 2257 | 2257 |  function boincuser_get_projects($account = null) { | 
                                                        
| 2258 | 2258 | |
| 2259 | - // Use the current user by default  | 
                                                        |
| 2260 | -  if (!$account) { | 
                                                        |
| 2259 | + // Use the current user by default  | 
                                                        |
| 2260 | +    if (!$account) { | 
                                                        |
| 2261 | 2261 | global $user;  | 
                                                        
| 2262 | 2262 | $account = user_load($user->uid);  | 
                                                        
| 2263 | - }  | 
                                                        |
| 2263 | + }  | 
                                                        |
| 2264 | 2264 | |
| 2265 | - $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);  | 
                                                        |
| 2265 | + $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);  | 
                                                        |
| 2266 | 2266 | |
| 2267 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;  | 
                                                        |
| 2267 | + return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;  | 
                                                        |
| 2268 | 2268 | }  | 
                                                        
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2272,11 +2272,11 @@ discard block  | 
                                                    ||
| 2272 | 2272 | * Get the links to display under the user profile  | 
                                                        
| 2273 | 2273 | */  | 
                                                        
| 2274 | 2274 |  function boincuser_get_profile_links($uid) { | 
                                                        
| 2275 | - global $user;  | 
                                                        |
| 2276 | - $account = user_load($uid);  | 
                                                        |
| 2277 | -  $profile = content_profile_load('profile', $account->uid); | 
                                                        |
| 2278 | - $output = '';  | 
                                                        |
| 2279 | -  if ($profile) { | 
                                                        |
| 2275 | + global $user;  | 
                                                        |
| 2276 | + $account = user_load($uid);  | 
                                                        |
| 2277 | +    $profile = content_profile_load('profile', $account->uid); | 
                                                        |
| 2278 | + $output = '';  | 
                                                        |
| 2279 | +    if ($profile) { | 
                                                        |
| 2280 | 2280 | $profile_is_approved = ($profile->status AND !$profile->moderate);  | 
                                                        
| 2281 | 2281 |      $user_is_moderator = user_access('edit any profile content'); | 
                                                        
| 2282 | 2282 | $is_own_profile = ($user->uid == $account->uid);  | 
                                                        
@@ -2284,15 +2284,15 @@ discard block  | 
                                                    ||
| 2284 | 2284 | $links = array();  | 
                                                        
| 2285 | 2285 | |
| 2286 | 2286 |      if ($profile->moderate AND $user_is_moderator) { | 
                                                        
| 2287 | - $links['approve_profile'] = array(  | 
                                                        |
| 2287 | + $links['approve_profile'] = array(  | 
                                                        |
| 2288 | 2288 |          'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        
| 2289 | 2289 |          'href' => "{$profile_moderation_path}/approve", | 
                                                        
| 2290 | 2290 | 'attributes' => array(  | 
                                                        
| 2291 | -          'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2292 | - 'class' => 'first primary tab',  | 
                                                        |
| 2291 | +            'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2292 | + 'class' => 'first primary tab',  | 
                                                        |
| 2293 | 2293 | )  | 
                                                        
| 2294 | - );  | 
                                                        |
| 2295 | - /*$links['edit_profile'] = array(  | 
                                                        |
| 2294 | + );  | 
                                                        |
| 2295 | + /*$links['edit_profile'] = array(  | 
                                                        |
| 2296 | 2296 |          'title' => bts('Edit profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        
| 2297 | 2297 |          'href' => "{$profile_moderation_path}/edit", | 
                                                        
| 2298 | 2298 | 'attributes' => array(  | 
                                                        
@@ -2300,27 +2300,27 @@ discard block  | 
                                                    ||
| 2300 | 2300 | 'class' => 'tab',  | 
                                                        
| 2301 | 2301 | )  | 
                                                        
| 2302 | 2302 | );*/  | 
                                                        
| 2303 | - $links['reject_profile'] = array(  | 
                                                        |
| 2303 | + $links['reject_profile'] = array(  | 
                                                        |
| 2304 | 2304 |          'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        
| 2305 | 2305 |          'href' => "{$profile_moderation_path}/reject", | 
                                                        
| 2306 | 2306 | 'attributes' => array(  | 
                                                        
| 2307 | -          'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2308 | - 'class' => 'tab',  | 
                                                        |
| 2307 | +            'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2308 | + 'class' => 'tab',  | 
                                                        |
| 2309 | 2309 | )  | 
                                                        
| 2310 | - );  | 
                                                        |
| 2310 | + );  | 
                                                        |
| 2311 | 2311 | }  | 
                                                        
| 2312 | 2312 | $output .= '<ul class="tab-list">';  | 
                                                        
| 2313 | 2313 | $count = 0;  | 
                                                        
| 2314 | 2314 |      foreach ($links as $key => $link) { | 
                                                        
| 2315 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';  | 
                                                        |
| 2316 | -      $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); | 
                                                        |
| 2317 | - $output .= '</li>';  | 
                                                        |
| 2318 | - $count++;  | 
                                                        |
| 2315 | + $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';  | 
                                                        |
| 2316 | +        $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); | 
                                                        |
| 2317 | + $output .= '</li>';  | 
                                                        |
| 2318 | + $count++;  | 
                                                        |
| 2319 | 2319 | }  | 
                                                        
| 2320 | 2320 |      $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; | 
                                                        
| 2321 | 2321 | $output .= '</ul>';  | 
                                                        
| 2322 | - }  | 
                                                        |
| 2323 | - return $output;  | 
                                                        |
| 2322 | + }  | 
                                                        |
| 2323 | + return $output;  | 
                                                        |
| 2324 | 2324 | /*  | 
                                                        
| 2325 | 2325 | <ul class="tab-list">  | 
                                                        
| 2326 | 2326 | <li class="primary first tab">  | 
                                                        
@@ -2357,36 +2357,36 @@ discard block  | 
                                                    ||
| 2357 | 2357 | */  | 
                                                        
| 2358 | 2358 |  function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { | 
                                                        
| 2359 | 2359 | |
| 2360 | -  foreach ($documents as $document) { | 
                                                        |
| 2360 | +    foreach ($documents as $document) { | 
                                                        |
| 2361 | 2361 |      if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { | 
                                                        
| 2362 | - // Node information.  | 
                                                        |
| 2363 | - $nid = $document->entity_id;  | 
                                                        |
| 2364 | - $node = node_load($nid);  | 
                                                        |
| 2365 | - $account = user_load($node->uid);  | 
                                                        |
| 2366 | -  | 
                                                        |
| 2367 | - // Use boincuser name and not drupal user name  | 
                                                        |
| 2368 | - $document->label = apachesolr_clean_text($account->boincuser_name);  | 
                                                        |
| 2369 | - // Author information  | 
                                                        |
| 2370 | -      if ($node->uid == 0 || strlen($node->name) == 0) { | 
                                                        |
| 2362 | + // Node information.  | 
                                                        |
| 2363 | + $nid = $document->entity_id;  | 
                                                        |
| 2364 | + $node = node_load($nid);  | 
                                                        |
| 2365 | + $account = user_load($node->uid);  | 
                                                        |
| 2366 | +  | 
                                                        |
| 2367 | + // Use boincuser name and not drupal user name  | 
                                                        |
| 2368 | + $document->label = apachesolr_clean_text($account->boincuser_name);  | 
                                                        |
| 2369 | + // Author information  | 
                                                        |
| 2370 | +        if ($node->uid == 0 || strlen($node->name) == 0) { | 
                                                        |
| 2371 | 2371 | // @see user_validate_name(). !'0' === TRUE.  | 
                                                        
| 2372 | 2372 | $document->ss_name = '0';  | 
                                                        
| 2373 | - }  | 
                                                        |
| 2374 | -      else { | 
                                                        |
| 2373 | + }  | 
                                                        |
| 2374 | +        else { | 
                                                        |
| 2375 | 2375 | $document->ss_name = $account->boincuser_name;  | 
                                                        
| 2376 | 2376 | // We want the name to be searchable for keywords.  | 
                                                        
| 2377 | 2377 | $document->tos_name = $account->boincuser_name;  | 
                                                        
| 2378 | - }  | 
                                                        |
| 2378 | + }  | 
                                                        |
| 2379 | 2379 | |
| 2380 | - // Rename "Profle" to "User"  | 
                                                        |
| 2381 | - $document->bundle = "User";  | 
                                                        |
| 2382 | - $document->bundle_name = "User";  | 
                                                        |
| 2380 | + // Rename "Profle" to "User"  | 
                                                        |
| 2381 | + $document->bundle = "User";  | 
                                                        |
| 2382 | + $document->bundle_name = "User";  | 
                                                        |
| 2383 | 2383 | |
| 2384 | - // Replace the Solr document's created field with the date the user  | 
                                                        |
| 2385 | - // account was created. This replaces the node creation date typically  | 
                                                        |
| 2386 | - // used for indexing nodes.  | 
                                                        |
| 2387 | - $document->ds_created = apachesolr_date_iso($account->created);  | 
                                                        |
| 2384 | + // Replace the Solr document's created field with the date the user  | 
                                                        |
| 2385 | + // account was created. This replaces the node creation date typically  | 
                                                        |
| 2386 | + // used for indexing nodes.  | 
                                                        |
| 2387 | + $document->ds_created = apachesolr_date_iso($account->created);  | 
                                                        |
| 2388 | + }  | 
                                                        |
| 2388 | 2389 | }  | 
                                                        
| 2389 | - }  | 
                                                        |
| 2390 | 2390 | |
| 2391 | 2391 | }  | 
                                                        
| 2392 | 2392 | |
@@ -2398,23 +2398,23 @@ discard block  | 
                                                    ||
| 2398 | 2398 | * Implementation of hook_privatemsg_name_lookup();  | 
                                                        
| 2399 | 2399 | */  | 
                                                        
| 2400 | 2400 |  function boincuser_privatemsg_name_lookup($string) { | 
                                                        
| 2401 | - // Get the BOINC ID from the name string, and lookup the  | 
                                                        |
| 2402 | - // corresponding drupal user.  | 
                                                        |
| 2403 | - $boincname = substr($string, 0, strrpos($string, '_'));  | 
                                                        |
| 2404 | - $boincid = substr($string, strrpos($string, '_') + 1);  | 
                                                        |
| 2405 | - $drupalid = get_drupal_id($boincid);  | 
                                                        |
| 2406 | -  | 
                                                        |
| 2407 | - // Name has spaced replaced with special UTF-8 characters in  | 
                                                        |
| 2408 | - // privatemsg module. We need to convert them back to spaces for the  | 
                                                        |
| 2409 | - // check below.  | 
                                                        |
| 2410 | -  $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); | 
                                                        |
| 2411 | -  if ($drupalid>0) { | 
                                                        |
| 2401 | + // Get the BOINC ID from the name string, and lookup the  | 
                                                        |
| 2402 | + // corresponding drupal user.  | 
                                                        |
| 2403 | + $boincname = substr($string, 0, strrpos($string, '_'));  | 
                                                        |
| 2404 | + $boincid = substr($string, strrpos($string, '_') + 1);  | 
                                                        |
| 2405 | + $drupalid = get_drupal_id($boincid);  | 
                                                        |
| 2406 | +  | 
                                                        |
| 2407 | + // Name has spaced replaced with special UTF-8 characters in  | 
                                                        |
| 2408 | + // privatemsg module. We need to convert them back to spaces for the  | 
                                                        |
| 2409 | + // check below.  | 
                                                        |
| 2410 | +    $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); | 
                                                        |
| 2411 | +    if ($drupalid>0) { | 
                                                        |
| 2412 | 2412 |      if ($recipient = user_load(array('uid' => $drupalid))) { | 
                                                        
| 2413 | - // Double-check that the loaded user matches both boincuser_id  | 
                                                        |
| 2414 | - // and boincuser_name.  | 
                                                        |
| 2415 | -      if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { | 
                                                        |
| 2413 | + // Double-check that the loaded user matches both boincuser_id  | 
                                                        |
| 2414 | + // and boincuser_name.  | 
                                                        |
| 2415 | +        if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { | 
                                                        |
| 2416 | 2416 | return $recipient;  | 
                                                        
| 2417 | - }  | 
                                                        |
| 2417 | + }  | 
                                                        |
| 2418 | + }  | 
                                                        |
| 2418 | 2419 | }  | 
                                                        
| 2419 | - }  | 
                                                        |
| 2420 | 2420 | }  | 
                                                        
@@ -189,7 +189,7 @@ discard block  | 
                                                    ||
| 189 | 189 | 'type' => MENU_CALLBACK  | 
                                                        
| 190 | 190 | );  | 
                                                        
| 191 | 191 | $items['account_finish.php'] = array(  | 
                                                        
| 192 | -    'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), | 
                                                        |
| 192 | +    'title' => 'Welcome to '.variable_get('site_name', 'Drupal-BOINC'), | 
                                                        |
| 193 | 193 | 'description' => 'RPC for after a user has created an account.',  | 
                                                        
| 194 | 194 | 'page callback' => 'boincuser_account_finish',  | 
                                                        
| 195 | 195 | 'access callback' => TRUE,  | 
                                                        
@@ -249,8 +249,8 @@ discard block  | 
                                                    ||
| 249 | 249 | // termsofuse is enabled, by having text in the termsofuse variable.  | 
                                                        
| 250 | 250 |    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        
| 251 | 251 |    $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 252 | -  if ( (!empty($termsofuse)) and ($user->uid) ) { | 
                                                        |
| 253 | -    if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { | 
                                                        |
| 252 | +  if ((!empty($termsofuse)) and ($user->uid)) { | 
                                                        |
| 253 | +    if (!boincuser_check_termsofuse($user) and ($existinguser_tou)) { | 
                                                        |
| 254 | 254 | |
| 255 | 255 | // Admins are exempt, otherwise the admin may not be able to  | 
                                                        
| 256 | 256 | // access the site!  | 
                                                        
@@ -264,14 +264,14 @@ discard block  | 
                                                    ||
| 264 | 264 | 'user/termsofuse',  | 
                                                        
| 265 | 265 | 'logout',  | 
                                                        
| 266 | 266 | 'account/info/edit',  | 
                                                        
| 267 | - 'user/' . $user->uid . '/edit',  | 
                                                        |
| 268 | - 'user/' . $user->uid . '/recoveremail/*',  | 
                                                        |
| 267 | + 'user/'.$user->uid.'/edit',  | 
                                                        |
| 268 | + 'user/'.$user->uid.'/recoveremail/*',  | 
                                                        |
| 269 | 269 | 'recover_email.php',  | 
                                                        
| 270 | 270 | );  | 
                                                        
| 271 | 271 |          if (module_exists('boincuser_delete')) { | 
                                                        
| 272 | - $paths0[] = 'user/' . $user->uid . '/delete';  | 
                                                        |
| 273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*';  | 
                                                        |
| 274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*';  | 
                                                        |
| 272 | + $paths0[] = 'user/'.$user->uid.'/delete';  | 
                                                        |
| 273 | + $paths0[] = 'user/'.$user->uid.'/deleteconfirm/*';  | 
                                                        |
| 274 | + $paths0[] = 'user/'.$user->uid.'/odeleteconfirm/*';  | 
                                                        |
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
| 277 | 277 | // Paths added by the admin  | 
                                                        
@@ -282,7 +282,7 @@ discard block  | 
                                                    ||
| 282 | 282 | }  | 
                                                        
| 283 | 283 | |
| 284 | 284 | // paths to ignore  | 
                                                        
| 285 | - $paths_to_ignore = array_unique( array_merge($paths0, $paths2) );  | 
                                                        |
| 285 | + $paths_to_ignore = array_unique(array_merge($paths0, $paths2));  | 
                                                        |
| 286 | 286 | |
| 287 | 287 |          if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { | 
                                                        
| 288 | 288 |            drupal_goto('user/termsofuse'); | 
                                                        
@@ -304,7 +304,7 @@ discard block  | 
                                                    ||
| 304 | 304 |    require_boinc('password_compat/password'); | 
                                                        
| 305 | 305 | // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)  | 
                                                        
| 306 | 306 |    if (isset($account->uid) && ($account->uid > 1)) { | 
                                                        
| 307 | -    switch($op) { | 
                                                        |
| 307 | +    switch ($op) { | 
                                                        |
| 308 | 308 | case 'load':  | 
                                                        
| 309 | 309 | // User loading; insert BOINC data into the user object  | 
                                                        
| 310 | 310 |        $drupal_user = db_fetch_object(db_query(" | 
                                                        
@@ -334,11 +334,11 @@ discard block  | 
                                                    ||
| 334 | 334 | ));  | 
                                                        
| 335 | 335 | $account->boincuser_name = $boinc_user->name;  | 
                                                        
| 336 | 336 | $account->boincuser_account_key = $boinc_user->authenticator;  | 
                                                        
| 337 | - $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);  | 
                                                        |
| 337 | + $account->boincuser_weak_auth = md5($boinc_user->authenticator.$boinc_user->passwd_hash);  | 
                                                        |
| 338 | 338 | $account->boincuser_total_credit = round($boinc_user->total_credit);  | 
                                                        
| 339 | 339 | $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);  | 
                                                        
| 340 | 340 | $account->boincuser_expavg_time = round($boinc_user->expavg_time);  | 
                                                        
| 341 | - $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);  | 
                                                        |
| 341 | + $account->boincuser_cpid = md5($boinc_user->cross_project_id.$account->mail);  | 
                                                        |
| 342 | 342 | $account->boincuser_default_pref_set = $boinc_user->venue;  | 
                                                        
| 343 | 343 | $account->boincteam_id = $boinc_user->teamid;  | 
                                                        
| 344 | 344 | $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr;  | 
                                                        
@@ -507,7 +507,7 @@ discard block  | 
                                                    ||
| 507 | 507 | |
| 508 | 508 | // Set password hash appropriately  | 
                                                        
| 509 | 509 | $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];  | 
                                                        
| 510 | - $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT );  | 
                                                        |
| 510 | + $passwd_hash = password_hash(md5($passwd.$lower_email_addr), PASSWORD_DEFAULT);  | 
                                                        |
| 511 | 511 | // Algorithm for changing email and/or password  | 
                                                        
| 512 | 512 |              if ($changing_email) { | 
                                                        
| 513 | 513 | // locally store current email to set as previous email  | 
                                                        
@@ -595,8 +595,8 @@ discard block  | 
                                                    ||
| 595 | 595 | }  | 
                                                        
| 596 | 596 | |
| 597 | 597 | // Check if user has agreed to terms of use.  | 
                                                        
| 598 | - if ( (!empty($termsofuse)) and ($account->uid) and  | 
                                                        |
| 599 | -       (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { | 
                                                        |
| 598 | + if ((!empty($termsofuse)) and ($account->uid) and  | 
                                                        |
| 599 | +       (!boincuser_check_termsofuse($account)) and ($existinguser_tou)) { | 
                                                        |
| 600 | 600 | |
| 601 | 601 | // Admins are exempted.  | 
                                                        
| 602 | 602 |      $administrator_role = array_search('administrator', user_roles(true)); | 
                                                        
@@ -610,9 +610,9 @@ discard block  | 
                                                    ||
| 610 | 610 | $query_for_destination = '';  | 
                                                        
| 611 | 611 | $prevdest = $_REQUEST['destination'];  | 
                                                        
| 612 | 612 |        if ($prevdest) { | 
                                                        
| 613 | - $query_for_destination = '?destination=' . $prevdest;  | 
                                                        |
| 613 | + $query_for_destination = '?destination='.$prevdest;  | 
                                                        |
| 614 | 614 | }  | 
                                                        
| 615 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination;  | 
                                                        |
| 615 | + $_REQUEST['destination'] = $path_for_destination.$query_for_destination;  | 
                                                        |
| 616 | 616 | |
| 617 | 617 | }  | 
                                                        
| 618 | 618 | }  | 
                                                        
@@ -645,7 +645,7 @@ discard block  | 
                                                    ||
| 645 | 645 | // In Drupal 7, these operation cases will all exist as their own hooks,  | 
                                                        
| 646 | 646 | // so let's approximate that here so that this function can simply be removed  | 
                                                        
| 647 | 647 | // upon migration to 7  | 
                                                        
| 648 | -  switch($op) { | 
                                                        |
| 648 | +  switch ($op) { | 
                                                        |
| 649 | 649 | case 'update':  | 
                                                        
| 650 | 650 | boincuser_node_update($node);  | 
                                                        
| 651 | 651 | }  | 
                                                        
@@ -656,7 +656,7 @@ discard block  | 
                                                    ||
| 656 | 656 | * is updated (forward compatible to Drupal 7)  | 
                                                        
| 657 | 657 | */  | 
                                                        
| 658 | 658 |  function boincuser_node_update($node) { | 
                                                        
| 659 | -  switch($node->type) { | 
                                                        |
| 659 | +  switch ($node->type) { | 
                                                        |
| 660 | 660 | case 'profile':  | 
                                                        
| 661 | 661 | // Update the BOINC database directly  | 
                                                        
| 662 | 662 | $account = user_load($node->uid);  | 
                                                        
@@ -778,7 +778,7 @@ discard block  | 
                                                    ||
| 778 | 778 | }  | 
                                                        
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array(  | 
                                                        
| 781 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', | 
                                                        |
| 781 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest).'</li>', | 
                                                        |
| 782 | 782 | '#weight' => 1004,  | 
                                                        
| 783 | 783 | );  | 
                                                        
| 784 | 784 | $form['form control tabs suffix'] = array(  | 
                                                        
@@ -811,7 +811,7 @@ discard block  | 
                                                    ||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 813 | 813 | $form['buttons']['cancel'] = array(  | 
                                                        
| 814 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 814 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', | 
                                                        |
| 815 | 815 | '#weight' => 1005,  | 
                                                        
| 816 | 816 | );  | 
                                                        
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
@@ -843,7 +843,7 @@ discard block  | 
                                                    ||
| 843 | 843 | $form['actions']['submit']['#suffix'] = '</li>';  | 
                                                        
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002;  | 
                                                        
| 845 | 845 | $form['actions']['cancel'] = array(  | 
                                                        
| 846 | -        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 846 | +        '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', | 
                                                        |
| 847 | 847 | '#weight' => 1005,  | 
                                                        
| 848 | 848 | );  | 
                                                        
| 849 | 849 | $form['actions']['form control tabs suffix'] = array(  | 
                                                        
@@ -870,7 +870,7 @@ discard block  | 
                                                    ||
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>';  | 
                                                        
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003;  | 
                                                        
| 872 | 872 | $form['privatemsg']['cancel'] = array(  | 
                                                        
| 873 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 873 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', | 
                                                        |
| 874 | 874 | '#weight' => 1004,  | 
                                                        
| 875 | 875 | );  | 
                                                        
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array(  | 
                                                        
@@ -958,11 +958,11 @@ discard block  | 
                                                    ||
| 958 | 958 | // Set special message if user has not agreed to TOU  | 
                                                        
| 959 | 959 |      $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        
| 960 | 960 |      $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 961 | -    if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { | 
                                                        |
| 961 | +    if ((!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users'))) { | 
                                                        |
| 962 | 962 | drupal_set_message(  | 
                                                        
| 963 | 963 |          bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', | 
                                                        
| 964 | 964 | array(  | 
                                                        
| 965 | -          '@project' => variable_get('site_name','Drupal-BOINC'), | 
                                                        |
| 965 | +          '@project' => variable_get('site_name', 'Drupal-BOINC'), | 
                                                        |
| 966 | 966 | ), NULL, 'boinc:account-credentials-change')  | 
                                                        
| 967 | 967 | , 'info');  | 
                                                        
| 968 | 968 | }  | 
                                                        
@@ -1027,36 +1027,36 @@ discard block  | 
                                                    ||
| 1027 | 1027 | $form['account']['boincuser_id'] = array(  | 
                                                        
| 1028 | 1028 | '#value' => '  | 
                                                        
| 1029 | 1029 | <div class="form-item">  | 
                                                        
| 1030 | -          <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1031 | - <span>' . $account->boincuser_id . '</span>  | 
                                                        |
| 1030 | +          <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change').'</label> | 
                                                        |
| 1031 | + <span>' . $account->boincuser_id.'</span>  | 
                                                        |
| 1032 | 1032 | </div>',  | 
                                                        
| 1033 | 1033 | );  | 
                                                        
| 1034 | 1034 | $form['account']['user_id'] = array(  | 
                                                        
| 1035 | 1035 | '#value' => '  | 
                                                        
| 1036 | 1036 | <div class="form-item">  | 
                                                        
| 1037 | -          <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1038 | - <span>' . $account->uid . '</span>  | 
                                                        |
| 1037 | +          <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change').'</label> | 
                                                        |
| 1038 | + <span>' . $account->uid.'</span>  | 
                                                        |
| 1039 | 1039 | </div>',  | 
                                                        
| 1040 | 1040 | );  | 
                                                        
| 1041 | 1041 | $form['account']['account_key'] = array(  | 
                                                        
| 1042 | 1042 | '#value' => '  | 
                                                        
| 1043 | 1043 | <div class="form-item">  | 
                                                        
| 1044 | -          <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1045 | - <span>' . $account->boincuser_account_key . '</span>  | 
                                                        |
| 1044 | +          <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change').'</label> | 
                                                        |
| 1045 | + <span>' . $account->boincuser_account_key.'</span>  | 
                                                        |
| 1046 | 1046 | </div>',  | 
                                                        
| 1047 | 1047 | );  | 
                                                        
| 1048 | 1048 | $form['account']['weak_account_key'] = array(  | 
                                                        
| 1049 | 1049 | '#value' => '  | 
                                                        
| 1050 | 1050 | <div class="form-item">  | 
                                                        
| 1051 | -          <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1052 | -          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> | 
                                                        |
| 1051 | +          <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change').'</label> | 
                                                        |
| 1052 | +          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span> | 
                                                        |
| 1053 | 1053 | </div>',  | 
                                                        
| 1054 | 1054 | );  | 
                                                        
| 1055 | 1055 | $form['account']['cpid'] = array(  | 
                                                        
| 1056 | 1056 | '#value' => '  | 
                                                        
| 1057 | 1057 | <div class="form-item">  | 
                                                        
| 1058 | -          <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1059 | - <span>' . $account->boincuser_cpid . '</span>  | 
                                                        |
| 1058 | +          <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change').'</label> | 
                                                        |
| 1059 | + <span>' . $account->boincuser_cpid.'</span>  | 
                                                        |
| 1060 | 1060 | </div>',  | 
                                                        
| 1061 | 1061 | );  | 
                                                        
| 1062 | 1062 | |
@@ -1074,7 +1074,7 @@ discard block  | 
                                                    ||
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>';  | 
                                                        
| 1075 | 1075 | $form['submit']['#weight'] = 1002;  | 
                                                        
| 1076 | 1076 | $form['cancel'] = array(  | 
                                                        
| 1077 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1077 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', | 
                                                        |
| 1078 | 1078 | '#weight' => 1003,  | 
                                                        
| 1079 | 1079 | );  | 
                                                        
| 1080 | 1080 |      if (isset($form['delete']) AND is_array($form['delete'])) { | 
                                                        
@@ -1170,7 +1170,7 @@ discard block  | 
                                                    ||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 1172 | 1172 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1173 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1173 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', | 
                                                        |
| 1174 | 1174 | '#weight' => 1005,  | 
                                                        
| 1175 | 1175 | );  | 
                                                        
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
@@ -1219,11 +1219,11 @@ discard block  | 
                                                    ||
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation  | 
                                                        
| 1220 | 1220 | $form['name'] = array(  | 
                                                        
| 1221 | 1221 | '#type' => 'hidden',  | 
                                                        
| 1222 | - '#value' => rand() . '.' . time()  | 
                                                        |
| 1222 | + '#value' => rand().'.'.time()  | 
                                                        |
| 1223 | 1223 | );  | 
                                                        
| 1224 | 1224 | |
| 1225 | 1225 | // Add JS for submit button disabling  | 
                                                        
| 1226 | -    drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); | 
                                                        |
| 1226 | +    drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); | 
                                                        |
| 1227 | 1227 | |
| 1228 | 1228 | // Terms of use section  | 
                                                        
| 1229 | 1229 |      $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
@@ -1239,7 +1239,7 @@ discard block  | 
                                                    ||
| 1239 | 1239 | |
| 1240 | 1240 | $form['termsofuse']['title1'] = array(  | 
                                                        
| 1241 | 1241 | '#weight' => -12,  | 
                                                        
| 1242 | -        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', | 
                                                        |
| 1242 | +        '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register').'</h2>', | 
                                                        |
| 1243 | 1243 | '#prefix' => '<div id="register-title1">',  | 
                                                        
| 1244 | 1244 | '#suffix' => '</div>',  | 
                                                        
| 1245 | 1245 | );  | 
                                                        
@@ -1262,7 +1262,7 @@ discard block  | 
                                                    ||
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array(  | 
                                                        
| 1264 | 1264 | '#weight' => -6,  | 
                                                        
| 1265 | -      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', | 
                                                        |
| 1265 | +      '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register').'</h2>', | 
                                                        |
| 1266 | 1266 | '#prefix' => '<div id="register-title2">',  | 
                                                        
| 1267 | 1267 | '#suffix' => '</div>',  | 
                                                        
| 1268 | 1268 | );  | 
                                                        
@@ -1326,7 +1326,7 @@ discard block  | 
                                                    ||
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 1328 | 1328 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1329 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', | 
                                                        |
| 1329 | +      '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login').'</li>', | 
                                                        |
| 1330 | 1330 | '#weight' => 1005,  | 
                                                        
| 1331 | 1331 | );  | 
                                                        
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
@@ -1408,7 +1408,7 @@ discard block  | 
                                                    ||
| 1408 | 1408 | */  | 
                                                        
| 1409 | 1409 |  function boincuser_token_list($type = 'all') { | 
                                                        
| 1410 | 1410 |    if ($type == 'user' || $type == 'all') { | 
                                                        
| 1411 | -    $tokens['user']['display-name']      = t("The user's name that should be displayed"); | 
                                                        |
| 1411 | +    $tokens['user']['display-name'] = t("The user's name that should be displayed"); | 
                                                        |
| 1412 | 1412 | return $tokens;  | 
                                                        
| 1413 | 1413 | }  | 
                                                        
| 1414 | 1414 | }  | 
                                                        
@@ -1420,9 +1420,9 @@ discard block  | 
                                                    ||
| 1420 | 1420 |    if ($view->args) { | 
                                                        
| 1421 | 1421 | $account_id = $view->args[0];  | 
                                                        
| 1422 | 1422 | }  | 
                                                        
| 1423 | -  if ($view->name=="user_activity") { | 
                                                        |
| 1423 | +  if ($view->name == "user_activity") { | 
                                                        |
| 1424 | 1424 | // Run the following custom query for the user_activity view  | 
                                                        
| 1425 | - $view->build_info['query']= "  | 
                                                        |
| 1425 | + $view->build_info['query'] = "  | 
                                                        |
| 1426 | 1426 | SELECT node_revisions.vid AS vid,  | 
                                                        
| 1427 | 1427 | node.nid AS node_nid,  | 
                                                        
| 1428 | 1428 | node.uid AS users_node_uid,  | 
                                                        
@@ -1462,13 +1462,13 @@ discard block  | 
                                                    ||
| 1462 | 1462 | // Delete expired users in the BOINC database, user_delete table.  | 
                                                        
| 1463 | 1463 |    require_boinc('boinc_db'); | 
                                                        
| 1464 | 1464 | $num_deleted = BoincUserDeleted::delete_expired();  | 
                                                        
| 1465 | -  if ($num_deleted>0) { | 
                                                        |
| 1465 | +  if ($num_deleted > 0) { | 
                                                        |
| 1466 | 1466 |      watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); | 
                                                        
| 1467 | 1467 | }  | 
                                                        
| 1468 | 1468 | |
| 1469 | 1469 | // Delete expired tokens from token table  | 
                                                        
| 1470 | 1470 | $tokens_deleted = BoincToken::delete_expired();  | 
                                                        
| 1471 | -  if ($tokens_deleted>0) { | 
                                                        |
| 1471 | +  if ($tokens_deleted > 0) { | 
                                                        |
| 1472 | 1472 |      watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); | 
                                                        
| 1473 | 1473 | }  | 
                                                        
| 1474 | 1474 | }  | 
                                                        
@@ -1553,38 +1553,38 @@ discard block  | 
                                                    ||
| 1553 | 1553 | case 'boinc':  | 
                                                        
| 1554 | 1554 | $output .= '<ol>';  | 
                                                        
| 1555 | 1555 |      if ($registration_enabled) { | 
                                                        
| 1556 | -      $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1556 | +      $output .= '<li>'.bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1557 | 1557 | array(  | 
                                                        
| 1558 | 1558 |          '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        
| 1559 | 1559 | '@sitename' => $site_name,  | 
                                                        
| 1560 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1560 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1561 | 1561 | }  | 
                                                        
| 1562 | -    $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1563 | -    $output .= '  <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", | 
                                                        |
| 1562 | +    $output .= '  <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>'; | 
                                                        |
| 1563 | +    $output .= '  <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", | 
                                                        |
| 1564 | 1564 | array(  | 
                                                        
| 1565 | 1565 | '@sitename' => $site_name,  | 
                                                        
| 1566 | 1566 | '@siteurl' => $base_url,  | 
                                                        
| 1567 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1567 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1568 | 1568 |      if ($registration_enabled) { | 
                                                        
| 1569 | -      $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", | 
                                                        |
| 1569 | +      $output .= '<li>'.bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", | 
                                                        |
| 1570 | 1570 | array(  | 
                                                        
| 1571 | 1571 |            '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        
| 1572 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1572 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1573 | 1573 | }  | 
                                                        
| 1574 | 1574 |      else { | 
                                                        
| 1575 | -      $output .= '<li>' . bts("If you're running a command-line version of BOINC, | 
                                                        |
| 1575 | +      $output .= '<li>'.bts("If you're running a command-line version of BOINC, | 
                                                        |
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.",  | 
                                                        
| 1577 | 1577 | array(  | 
                                                        
| 1578 | 1578 |            '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        
| 1579 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1579 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1580 | 1580 | }  | 
                                                        
| 1581 | -    $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please | 
                                                        |
| 1581 | +    $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please | 
                                                        |
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account  | 
                                                        
| 1583 | 1583 | at @this_project.",  | 
                                                        
| 1584 | 1584 | array(  | 
                                                        
| 1585 | 1585 | '@this_project' => $site_name,  | 
                                                        
| 1586 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1587 | - $output .= '</ol>';  | 
                                                        |
| 1586 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1587 | + $output .= '</ol>';  | 
                                                        |
| 1588 | 1588 | break;  | 
                                                        
| 1589 | 1589 | case 'new':  | 
                                                        
| 1590 | 1590 | default:  | 
                                                        
@@ -1596,37 +1596,37 @@ discard block  | 
                                                    ||
| 1596 | 1596 |      //  $ruleslink = drupal_lookup_path('source', $ruleslinkB); | 
                                                        
| 1597 | 1597 | //}  | 
                                                        
| 1598 | 1598 | |
| 1599 | -    $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') ); | 
                                                        |
| 1599 | +    $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '')); | 
                                                        |
| 1600 | 1600 | |
| 1601 | 1601 | // Join page output  | 
                                                        
| 1602 | 1602 | $output .= '<ol>';  | 
                                                        
| 1603 | 1603 |      if ($registration_enabled) { | 
                                                        
| 1604 | -      $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1604 | +      $output .= '<li>'.bts('First !create_an_account here at @sitename.', | 
                                                        |
| 1605 | 1605 | array(  | 
                                                        
| 1606 | 1606 |          '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        
| 1607 | 1607 | '@sitename' => $site_name,  | 
                                                        
| 1608 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1608 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1609 | 1609 | }  | 
                                                        
| 1610 | -    else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { | 
                                                        |
| 1611 | -      $output .= '  <li>' . bts("Read our !rules_and_policies.", array( | 
                                                        |
| 1610 | +    else if (menu_valid_path(array('link_path' => $ruleslink))) { | 
                                                        |
| 1611 | +      $output .= '  <li>'.bts("Read our !rules_and_policies.", array( | 
                                                        |
| 1612 | 1612 |          '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), | 
                                                        
| 1613 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1613 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1614 | 1614 | }  | 
                                                        
| 1615 | -    $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); | 
                                                        |
| 1615 | +    $output .= '  <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); | 
                                                        |
| 1616 | 1616 | $output .= ' <p>';  | 
                                                        
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>';  | 
                                                        
| 1618 | 1618 | $output .= ' </p>';  | 
                                                        
| 1619 | -    $output .= '    ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( | 
                                                        |
| 1619 | +    $output .= '    '.bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( | 
                                                        |
| 1620 | 1620 | '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>',  | 
                                                        
| 1621 | 1621 | '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>',  | 
                                                        
| 1622 | 1622 | ), NULL, 'boinc:join-page');  | 
                                                        
| 1623 | 1623 | $output .= ' </li>';  | 
                                                        
| 1624 | -    $output .= '  <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1625 | -    $output .= '  <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( | 
                                                        |
| 1624 | +    $output .= '  <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>'; | 
                                                        |
| 1625 | +    $output .= '  <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array( | 
                                                        |
| 1626 | 1626 | '@sitename' => $site_name,  | 
                                                        
| 1627 | 1627 | '@siteurl' => $base_url,  | 
                                                        
| 1628 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1629 | - $output .= '</ol>';  | 
                                                        |
| 1628 | + ), NULL, 'boinc:join-page').'</li>';  | 
                                                        |
| 1629 | + $output .= '</ol>';  | 
                                                        |
| 1630 | 1630 | }  | 
                                                        
| 1631 | 1631 | $output .= '</div>';  | 
                                                        
| 1632 | 1632 | return $output;  | 
                                                        
@@ -1639,7 +1639,7 @@ discard block  | 
                                                    ||
| 1639 | 1639 | global $user;  | 
                                                        
| 1640 | 1640 |    $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        
| 1641 | 1641 | // get the front page message from database; this is set in the admin interface under BOINC Other  | 
                                                        
| 1642 | -  $site_message = variable_get('boinc_other_frontpage',''); | 
                                                        |
| 1642 | +  $site_message = variable_get('boinc_other_frontpage', ''); | 
                                                        |
| 1643 | 1643 | |
| 1644 | 1644 | // Determine the user of the day  | 
                                                        
| 1645 | 1645 |    $current_uotd = db_fetch_object(db_query(" | 
                                                        
@@ -1661,30 +1661,30 @@ discard block  | 
                                                    ||
| 1661 | 1661 |    $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); | 
                                                        
| 1662 | 1662 | $output .= '</h2>';  | 
                                                        
| 1663 | 1663 | $output .= '<div class="boinc-overview balance-height-front">';  | 
                                                        
| 1664 | -  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; | 
                                                        |
| 1664 | +  $output .= '  <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>'; | 
                                                        |
| 1665 | 1665 |    if ($user->uid) { | 
                                                        
| 1666 | -    $output .= '  <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1666 | +    $output .= '  <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>'; | 
                                                        |
| 1667 | 1667 | }  | 
                                                        
| 1668 | 1668 |    else { | 
                                                        
| 1669 | -    $output .= '  <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1669 | +    $output .= '  <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>'; | 
                                                        |
| 1670 | 1670 | }  | 
                                                        
| 1671 | 1671 | $output .= '</div>';  | 
                                                        
| 1672 | 1672 | $output .= '<div class="boinc-overview-details">';  | 
                                                        
| 1673 | 1673 | $output .= ' <div class="detail-container">';  | 
                                                        
| 1674 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">';  | 
                                                        |
| 1674 | + $output .= ' <a class="user-of-the-day" href="account/'.$uotd->uid.'">';  | 
                                                        |
| 1675 | 1675 | $output .= ' <div class="picture">';  | 
                                                        
| 1676 | 1676 |    $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], | 
                                                        
| 1677 | 1677 | $uotd_image['alt'], array(), FALSE);  | 
                                                        
| 1678 | 1678 | $output .= ' </div>';  | 
                                                        
| 1679 | -  $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1680 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>';  | 
                                                        |
| 1679 | +  $output .= '      <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>'; | 
                                                        |
| 1680 | + $output .= ' <div class="detail">'.$uotd->boincuser_name.'</div>';  | 
                                                        |
| 1681 | 1681 | $output .= ' </a>';  | 
                                                        
| 1682 | 1682 | $output .= ' <div class="volunteers">';  | 
                                                        
| 1683 | -  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1683 | +  $output .= '      <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>'; | 
                                                        |
| 1684 | 1684 | $output .= ' <div class="platforms">';  | 
                                                        
| 1685 | -  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1686 | -  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1687 | -  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1685 | +  $output .= '        <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>'; | 
                                                        |
| 1686 | +  $output .= '        <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>'; | 
                                                        |
| 1687 | +  $output .= '        <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>'; | 
                                                        |
| 1688 | 1688 | $output .= ' </div>';  | 
                                                        
| 1689 | 1689 | $output .= ' </div>';  | 
                                                        
| 1690 | 1690 | $output .= ' </div>';  | 
                                                        
@@ -1715,7 +1715,7 @@ discard block  | 
                                                    ||
| 1715 | 1715 |    $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); | 
                                                        
| 1716 | 1716 |    if (!$enablethisRPC) { | 
                                                        
| 1717 | 1717 |      $mess = bts('Account creation is done through our Web site. Please register at @url', array( | 
                                                        
| 1718 | - '@url' => $base_url . '/user/registration',  | 
                                                        |
| 1718 | + '@url' => $base_url.'/user/registration',  | 
                                                        |
| 1719 | 1719 | ),  | 
                                                        
| 1720 | 1720 | NULL, 'boinc:create_account');  | 
                                                        
| 1721 | 1721 | xml_error(-208, $mess);  | 
                                                        
@@ -1747,8 +1747,8 @@ discard block  | 
                                                    ||
| 1747 | 1747 | $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);  | 
                                                        
| 1748 | 1748 |    if ($boinc_user) { | 
                                                        
| 1749 | 1749 | // Return authenticator for existing users  | 
                                                        
| 1750 | - if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or  | 
                                                        |
| 1751 | -    password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { | 
                                                        |
| 1750 | + if (($params['passwd_hash'] == $boinc_user->passwd_hash) or  | 
                                                        |
| 1751 | +    password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) { | 
                                                        |
| 1752 | 1752 |        $output = array('authenticator' => $boinc_user->authenticator); | 
                                                        
| 1753 | 1753 | }  | 
                                                        
| 1754 | 1754 |      else { | 
                                                        
@@ -1804,7 +1804,7 @@ discard block  | 
                                                    ||
| 1804 | 1804 | // Ensure there is a authentication token before continuing  | 
                                                        
| 1805 | 1805 |    if (empty($authtoken)) { | 
                                                        
| 1806 | 1806 | drupal_not_found();  | 
                                                        
| 1807 | - return ;  | 
                                                        |
| 1807 | + return;  | 
                                                        |
| 1808 | 1808 | }  | 
                                                        
| 1809 | 1809 | |
| 1810 | 1810 |    if (strlen($authtoken) != 32) { | 
                                                        
@@ -1826,8 +1826,8 @@ discard block  | 
                                                    ||
| 1826 | 1826 | }  | 
                                                        
| 1827 | 1827 | |
| 1828 | 1828 | // Lookup path to custom account finish page  | 
                                                        
| 1829 | -  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); | 
                                                        |
| 1830 | -  if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { | 
                                                        |
| 1829 | +  $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '')); | 
                                                        |
| 1830 | +  if (menu_valid_path(array('link_path' => $customaccountfinishpath))) { | 
                                                        |
| 1831 | 1831 |      $node = menu_get_object('node', 1, $customaccountfinishpath); | 
                                                        
| 1832 | 1832 |      if ($node) { | 
                                                        
| 1833 | 1833 | return node_page_view($node);  | 
                                                        
@@ -1836,12 +1836,12 @@ discard block  | 
                                                    ||
| 1836 | 1836 | |
| 1837 | 1837 | // open links in new window  | 
                                                        
| 1838 | 1838 | $options = array(  | 
                                                        
| 1839 | - 'attributes' => array( 'target' => '_blank' ),  | 
                                                        |
| 1839 | +    'attributes' => array('target' => '_blank'), | 
                                                        |
| 1840 | 1840 | );  | 
                                                        
| 1841 | 1841 | |
| 1842 | 1842 | // Check moderation page exists  | 
                                                        
| 1843 | -  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); | 
                                                        |
| 1844 | -  if ( menu_valid_path(array('link_path' => $moderationpath)) ) { | 
                                                        |
| 1843 | +  $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '')); | 
                                                        |
| 1844 | +  if (menu_valid_path(array('link_path' => $moderationpath))) { | 
                                                        |
| 1845 | 1845 |      $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); | 
                                                        
| 1846 | 1846 |    } else { | 
                                                        
| 1847 | 1847 |      $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); | 
                                                        
@@ -1849,11 +1849,11 @@ discard block  | 
                                                    ||
| 1849 | 1849 | |
| 1850 | 1850 | $username = $user->boincuser_name;  | 
                                                        
| 1851 | 1851 |    $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        
| 1852 | -  $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', | 
                                                        |
| 1852 | +  $output = "<p>".bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', | 
                                                        |
| 1853 | 1853 | array(  | 
                                                        
| 1854 | 1854 | '@user_name' => $username,  | 
                                                        
| 1855 | 1855 | '@site_name' => $site_name,  | 
                                                        
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>";  | 
                                                        |
| 1856 | + ), NULL, 'boinc:account-finish')."</p>";  | 
                                                        |
| 1857 | 1857 | |
| 1858 | 1858 | $links = array(  | 
                                                        
| 1859 | 1859 | array(  | 
                                                        
@@ -1919,7 +1919,7 @@ discard block  | 
                                                    ||
| 1919 | 1919 | );  | 
                                                        
| 1920 | 1920 | |
| 1921 | 1921 | //List of links  | 
                                                        
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul');  | 
                                                        |
| 1922 | + $output .= theme_item_list($links, $title = NULL, $type = 'ul');  | 
                                                        |
| 1923 | 1923 | |
| 1924 | 1924 | return $output;  | 
                                                        
| 1925 | 1925 | }  | 
                                                        
@@ -2036,7 +2036,7 @@ discard block  | 
                                                    ||
| 2036 | 2036 | global $base_url;  | 
                                                        
| 2037 | 2037 | global $base_path;  | 
                                                        
| 2038 | 2038 |      $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        
| 2039 | - $site_url = $base_url . $base_path;  | 
                                                        |
| 2039 | + $site_url = $base_url.$base_path;  | 
                                                        |
| 2040 | 2040 | $moderator = user_load($user->uid);  | 
                                                        
| 2041 | 2041 | $profile->moderate = 0;  | 
                                                        
| 2042 | 2042 | $profile->status = 0;  | 
                                                        
@@ -2097,7 +2097,7 @@ discard block  | 
                                                    ||
| 2097 | 2097 | global $base_url;  | 
                                                        
| 2098 | 2098 | global $base_path;  | 
                                                        
| 2099 | 2099 |        $site_name = variable_get('site_name', 'Drupal-BOINC'); | 
                                                        
| 2100 | - $site_url = $base_url . $base_path;  | 
                                                        |
| 2100 | + $site_url = $base_url.$base_path;  | 
                                                        |
| 2101 | 2101 | $moderator = user_load($user->uid);  | 
                                                        
| 2102 | 2102 | $settings = array(  | 
                                                        
| 2103 | 2103 | 'from' => '',  | 
                                                        
@@ -2201,25 +2201,25 @@ discard block  | 
                                                    ||
| 2201 | 2201 |    if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); | 
                                                        
| 2202 | 2202 | |
| 2203 | 2203 | $output = '';  | 
                                                        
| 2204 | - $output .= '<table class="user-projects">' . "\n";  | 
                                                        |
| 2205 | - $output .= '<thead>' . "\n";  | 
                                                        |
| 2206 | - $output .= ' <tr>' . "\n";  | 
                                                        |
| 2207 | -  $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; | 
                                                        |
| 2208 | -  $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; | 
                                                        |
| 2209 | -  $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; | 
                                                        |
| 2210 | - $output .= ' </tr>' . "\n";  | 
                                                        |
| 2211 | - $output .= '</thead>' . "\n";  | 
                                                        |
| 2212 | - $output .= '<tbody>' . "\n";  | 
                                                        |
| 2204 | + $output .= '<table class="user-projects">'."\n";  | 
                                                        |
| 2205 | + $output .= '<thead>'."\n";  | 
                                                        |
| 2206 | + $output .= ' <tr>'."\n";  | 
                                                        |
| 2207 | +  $output .= '    <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n"; | 
                                                        |
| 2208 | +  $output .= '    <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n"; | 
                                                        |
| 2209 | +  $output .= '    <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n"; | 
                                                        |
| 2210 | + $output .= ' </tr>'."\n";  | 
                                                        |
| 2211 | + $output .= '</thead>'."\n";  | 
                                                        |
| 2212 | + $output .= '<tbody>'."\n";  | 
                                                        |
| 2213 | 2213 |    foreach ($projects AS $project) { | 
                                                        
| 2214 | - $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;  | 
                                                        |
| 2215 | - $output .= ' <tr>' . "\n";  | 
                                                        |
| 2216 | - $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n";  | 
                                                        |
| 2217 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n";  | 
                                                        |
| 2218 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";  | 
                                                        |
| 2219 | - $output .= ' </tr>' . "\n";  | 
                                                        |
| 2214 | + $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id;  | 
                                                        |
| 2215 | + $output .= ' <tr>'."\n";  | 
                                                        |
| 2216 | + $output .= ' <td>'.l($project->name, $url).'</td>'."\n";  | 
                                                        |
| 2217 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n";  | 
                                                        |
| 2218 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n";  | 
                                                        |
| 2219 | + $output .= ' </tr>'."\n";  | 
                                                        |
| 2220 | 2220 | }  | 
                                                        
| 2221 | - $output .= '</tbody>' . "\n";  | 
                                                        |
| 2222 | - $output .= '</table>' . "\n";  | 
                                                        |
| 2221 | + $output .= '</tbody>'."\n";  | 
                                                        |
| 2222 | + $output .= '</table>'."\n";  | 
                                                        |
| 2223 | 2223 |    $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; | 
                                                        
| 2224 | 2224 |    //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; | 
                                                        
| 2225 | 2225 | return $output;  | 
                                                        
@@ -2239,8 +2239,8 @@ discard block  | 
                                                    ||
| 2239 | 2239 | 'cpid' => $cpid  | 
                                                        
| 2240 | 2240 | );  | 
                                                        
| 2241 | 2241 | $args = array();  | 
                                                        
| 2242 | -  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); | 
                                                        |
| 2243 | -  $query = '?' . implode('&', $args); | 
                                                        |
| 2242 | +  foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value); | 
                                                        |
| 2243 | +  $query = '?'.implode('&', $args); | 
                                                        |
| 2244 | 2244 | |
| 2245 | 2245 | // Load XML from RPC  | 
                                                        
| 2246 | 2246 |    $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; | 
                                                        
@@ -2312,12 +2312,12 @@ discard block  | 
                                                    ||
| 2312 | 2312 | $output .= '<ul class="tab-list">';  | 
                                                        
| 2313 | 2313 | $count = 0;  | 
                                                        
| 2314 | 2314 |      foreach ($links as $key => $link) { | 
                                                        
| 2315 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';  | 
                                                        |
| 2315 | + $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">';  | 
                                                        |
| 2316 | 2316 |        $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); | 
                                                        
| 2317 | 2317 | $output .= '</li>';  | 
                                                        
| 2318 | 2318 | $count++;  | 
                                                        
| 2319 | 2319 | }  | 
                                                        
| 2320 | -    $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; | 
                                                        |
| 2320 | +    $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user_meta', $account->uid).'</li>'; | 
                                                        |
| 2321 | 2321 | $output .= '</ul>';  | 
                                                        
| 2322 | 2322 | }  | 
                                                        
| 2323 | 2323 | return $output;  | 
                                                        
@@ -2358,7 +2358,7 @@ discard block  | 
                                                    ||
| 2358 | 2358 |  function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { | 
                                                        
| 2359 | 2359 | |
| 2360 | 2360 |    foreach ($documents as $document) { | 
                                                        
| 2361 | -    if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { | 
                                                        |
| 2361 | +    if ($document->entity_type == 'node' AND $document->bundle == 'profile') { | 
                                                        |
| 2362 | 2362 | // Node information.  | 
                                                        
| 2363 | 2363 | $nid = $document->entity_id;  | 
                                                        
| 2364 | 2364 | $node = node_load($nid);  | 
                                                        
@@ -2408,11 +2408,11 @@ discard block  | 
                                                    ||
| 2408 | 2408 | // privatemsg module. We need to convert them back to spaces for the  | 
                                                        
| 2409 | 2409 | // check below.  | 
                                                        
| 2410 | 2410 |    $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); | 
                                                        
| 2411 | -  if ($drupalid>0) { | 
                                                        |
| 2411 | +  if ($drupalid > 0) { | 
                                                        |
| 2412 | 2412 |      if ($recipient = user_load(array('uid' => $drupalid))) { | 
                                                        
| 2413 | 2413 | // Double-check that the loaded user matches both boincuser_id  | 
                                                        
| 2414 | 2414 | // and boincuser_name.  | 
                                                        
| 2415 | -      if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { | 
                                                        |
| 2415 | +      if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) { | 
                                                        |
| 2416 | 2416 | return $recipient;  | 
                                                        
| 2417 | 2417 | }  | 
                                                        
| 2418 | 2418 | }  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | 'weight' => 5  | 
                                                        
| 84 | 84 | );  | 
                                                        
| 85 | 85 | $items['moderate/profile/%/reject'] = array(  | 
                                                        
| 86 | -    'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 86 | +    'title' => bts('Reject profile', array(), null, 'boinc:moderate-user'), | 
                                                        |
| 87 | 87 | 'description' => 'Reject profile content',  | 
                                                        
| 88 | 88 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 89 | 89 |      'page arguments' => array('boincuser_moderate_profile_reject_form', 2), | 
                                                        
@@ -92,7 +92,7 @@ discard block  | 
                                                    ||
| 92 | 92 | 'weight' => 5  | 
                                                        
| 93 | 93 | );  | 
                                                        
| 94 | 94 | $items['moderate/user/%/ban'] = array(  | 
                                                        
| 95 | -    'title' => bts('Ban user', array(), NULL, 'boinc:moderate-ban-user'), | 
                                                        |
| 95 | +    'title' => bts('Ban user', array(), null, 'boinc:moderate-ban-user'), | 
                                                        |
| 96 | 96 | 'description' => 'Ban a user from using community features',  | 
                                                        
| 97 | 97 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 98 | 98 |      'page arguments' => array('boincuser_moderate_user_ban_form', 2), | 
                                                        
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | 'weight' => 5  | 
                                                        
| 124 | 124 | );  | 
                                                        
| 125 | 125 | $items['user/login/auth'] = array(  | 
                                                        
| 126 | -    'title' => bts('Authenticator login', array(), NULL, 'boinc:authenticator-login-page'), | 
                                                        |
| 126 | +    'title' => bts('Authenticator login', array(), null, 'boinc:authenticator-login-page'), | 
                                                        |
| 127 | 127 | 'description' => 'Log in using a user authenticator',  | 
                                                        
| 128 | 128 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 129 | 129 |      'page arguments' => array('boincuser_authloginform'), | 
                                                        
@@ -131,7 +131,7 @@ discard block  | 
                                                    ||
| 131 | 131 | 'type' => MENU_CALLBACK,  | 
                                                        
| 132 | 132 | );  | 
                                                        
| 133 | 133 | $items['user/termsofuse'] = array(  | 
                                                        
| 134 | -    'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'), | 
                                                        |
| 134 | +    'title' => bts('Terms of Use', array(), null, 'boinc:termsofuse-form'), | 
                                                        |
| 135 | 135 | 'description' => 'A site\'s term of use.',  | 
                                                        
| 136 | 136 | 'page callback' => 'drupal_get_form',  | 
                                                        
| 137 | 137 |      'page arguments' => array('boincuser_termsofuse_form'), | 
                                                        
@@ -185,19 +185,19 @@ discard block  | 
                                                    ||
| 185 | 185 | 'title' => 'Create Account RPC',  | 
                                                        
| 186 | 186 | 'description' => 'RPC for creating user accounts.',  | 
                                                        
| 187 | 187 | 'page callback' => 'boincuser_create_account',  | 
                                                        
| 188 | - 'access callback' => TRUE,  | 
                                                        |
| 188 | + 'access callback' => true,  | 
                                                        |
| 189 | 189 | 'type' => MENU_CALLBACK  | 
                                                        
| 190 | 190 | );  | 
                                                        
| 191 | 191 | $items['account_finish.php'] = array(  | 
                                                        
| 192 | 192 |      'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), | 
                                                        
| 193 | 193 | 'description' => 'RPC for after a user has created an account.',  | 
                                                        
| 194 | 194 | 'page callback' => 'boincuser_account_finish',  | 
                                                        
| 195 | - 'access callback' => TRUE,  | 
                                                        |
| 195 | + 'access callback' => true,  | 
                                                        |
| 196 | 196 | 'type' => MENU_CALLBACK,  | 
                                                        
| 197 | 197 | );  | 
                                                        
| 198 | 198 | $items['boincuser/autocomplete'] = array(  | 
                                                        
| 199 | 199 | 'page callback' => '_boincuser_user_name_autocomplete',  | 
                                                        
| 200 | - 'access callback' => TRUE,  | 
                                                        |
| 200 | + 'access callback' => true,  | 
                                                        |
| 201 | 201 | 'type' => MENU_CALLBACK,  | 
                                                        
| 202 | 202 | );  | 
                                                        
| 203 | 203 | $items['user/%user/recoveremail/%'] = array(  | 
                                                        
@@ -212,7 +212,7 @@ discard block  | 
                                                    ||
| 212 | 212 |      'title' => t('Recover previous email'), | 
                                                        
| 213 | 213 |      'description' => t('redirect'), | 
                                                        
| 214 | 214 | 'page callback' => '_boincuser_redirect_recover_email',  | 
                                                        
| 215 | - 'access callback' => TRUE,  | 
                                                        |
| 215 | + 'access callback' => true,  | 
                                                        |
| 216 | 216 | 'type' => MENU_CALLBACK,  | 
                                                        
| 217 | 217 | );  | 
                                                        
| 218 | 218 | return $items;  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | // Check if user has agreed to the terms of use. If not, send the  | 
                                                        
| 248 | 248 | // user to the terms-of-use form. This is only makes sense if the  | 
                                                        
| 249 | 249 | // termsofuse is enabled, by having text in the termsofuse variable.  | 
                                                        
| 250 | -  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        |
| 250 | +  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); | 
                                                        |
| 251 | 251 |    $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 252 | 252 |    if ( (!empty($termsofuse)) and ($user->uid) ) { | 
                                                        
| 253 | 253 |      if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { | 
                                                        
@@ -296,7 +296,7 @@ discard block  | 
                                                    ||
| 296 | 296 | * Implementation of hook_user(); add custom actions to standard  | 
                                                        
| 297 | 297 | * Drupal user operations  | 
                                                        
| 298 | 298 | */  | 
                                                        
| 299 | -function boincuser_user($op, &$edit, &$account, $category = NULL) { | 
                                                        |
| 299 | +function boincuser_user($op, &$edit, &$account, $category = null) { | 
                                                        |
| 300 | 300 |    require_boinc('boinc_db'); | 
                                                        
| 301 | 301 |    require_boinc('user'); | 
                                                        
| 302 | 302 |    require_boinc('xml'); | 
                                                        
@@ -345,7 +345,7 @@ discard block  | 
                                                    ||
| 345 | 345 | $account->boincuser_email_addr_change_time = $boinc_user->email_addr_change_time;  | 
                                                        
| 346 | 346 |        db_set_active('default'); | 
                                                        
| 347 | 347 | // Set Drupal team ID  | 
                                                        
| 348 | - $account->team = NULL;  | 
                                                        |
| 348 | + $account->team = null;  | 
                                                        |
| 349 | 349 |        if ($account->boincteam_id) { | 
                                                        
| 350 | 350 |          $account->team = db_result(db_query(" | 
                                                        
| 351 | 351 |            SELECT nid FROM {boincteam} WHERE team_id = %d", | 
                                                        
@@ -453,7 +453,7 @@ discard block  | 
                                                    ||
| 453 | 453 | $boinc_user = boincuser_register_make_user($user_params);  | 
                                                        
| 454 | 454 |          if (!$boinc_user) { | 
                                                        
| 455 | 455 | // Account exists with this email addr  | 
                                                        
| 456 | -          form_set_error('email', bts('Error creating BOINC account.', array(), NULL, 'boinc:add-new-user')); | 
                                                        |
| 456 | +          form_set_error('email', bts('Error creating BOINC account.', array(), null, 'boinc:add-new-user')); | 
                                                        |
| 457 | 457 | return;  | 
                                                        
| 458 | 458 | }  | 
                                                        
| 459 | 459 | |
@@ -499,9 +499,9 @@ discard block  | 
                                                    ||
| 499 | 499 | case 'user_account':  | 
                                                        
| 500 | 500 | // Ensure that BOINC data is altered  | 
                                                        
| 501 | 501 | |
| 502 | - $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;  | 
                                                        |
| 502 | + $changing_email = ($edit['mail'] and $edit['mail'] != $boinc_user->email_addr) ? true : false;  | 
                                                        |
| 503 | 503 | $changing_pass = ($edit['pass']) ? true : false;  | 
                                                        
| 504 | -          if ($changing_email OR $changing_pass) { | 
                                                        |
| 504 | +          if ($changing_email or $changing_pass) { | 
                                                        |
| 505 | 505 | // set email address to lower-case  | 
                                                        
| 506 | 506 | $lower_email_addr = strtolower($edit['mail']);  | 
                                                        
| 507 | 507 | |
@@ -583,13 +583,13 @@ discard block  | 
                                                    ||
| 583 | 583 | *(forward compatible to Drupal 7).  | 
                                                        
| 584 | 584 | */  | 
                                                        
| 585 | 585 |  function boincuser_user_login(&$edit, $account) { | 
                                                        
| 586 | -  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        |
| 586 | +  $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); | 
                                                        |
| 587 | 587 |    $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 588 | 588 | |
| 589 | 589 | // Use the same code as boincuser_form_alter(), for case  | 
                                                        
| 590 | 590 | // 'user_profile_form', if the refering page is the user password  | 
                                                        
| 591 | 591 | // reset form, then do not check for terms of use.  | 
                                                        
| 592 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1;  | 
                                                        |
| 592 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === false) ? 0 : 1;  | 
                                                        |
| 593 | 593 |    if ($reset_pass) { | 
                                                        
| 594 | 594 | return;  | 
                                                        
| 595 | 595 | }  | 
                                                        
@@ -737,7 +737,7 @@ discard block  | 
                                                    ||
| 737 | 737 | |
| 738 | 738 | // General friend form overrides  | 
                                                        
| 739 | 739 | $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 740 | -      $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 740 | +      $form['flag_friend_submit']['#value'] = bts('Send request', array(), null, 'boinc:friends-page'); | 
                                                        |
| 741 | 741 | $form['flag_friend_submit']['#type'] = 'submit';  | 
                                                        
| 742 | 742 | $form['flag_friend_submit']['#suffix'] = '</li>';  | 
                                                        
| 743 | 743 | $form['flag_friend_submit']['#weight'] = 1002;  | 
                                                        
@@ -746,7 +746,7 @@ discard block  | 
                                                    ||
| 746 | 746 | case FLAG_FRIEND_BOTH:  | 
                                                        
| 747 | 747 | case FLAG_FRIEND_FLAGGED:  | 
                                                        
| 748 | 748 | unset($form['actions']);  | 
                                                        
| 749 | -        $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); | 
                                                        |
| 749 | +        $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), null, 'boinc:friends-remove'); | 
                                                        |
| 750 | 750 | // Add in our hack handler to fix the flag_friend module  | 
                                                        
| 751 | 751 | $final_handler = array_pop($form['#submit']);  | 
                                                        
| 752 | 752 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit';  | 
                                                        
@@ -754,21 +754,21 @@ discard block  | 
                                                    ||
| 754 | 754 | break;  | 
                                                        
| 755 | 755 | case FLAG_FRIEND_PENDING:  | 
                                                        
| 756 | 756 | unset($form['actions']);  | 
                                                        
| 757 | -        $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 757 | +        $form['flag_friend_submit']['#value'] = bts('Remove request', array(), null, 'boinc:friends-page'); | 
                                                        |
| 758 | 758 | break;  | 
                                                        
| 759 | 759 | case FLAG_FRIEND_APPROVAL:  | 
                                                        
| 760 | 760 |          if ($action == 'flag') { | 
                                                        
| 761 | -          $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 761 | +          $form['flag_friend_submit']['#value'] = bts('Approve request', array(), null, 'boinc:friends-page'); | 
                                                        |
| 762 | 762 | }  | 
                                                        
| 763 | 763 |          elseif ($action == 'unflag') { | 
                                                        
| 764 | 764 | unset($form['actions']);  | 
                                                        
| 765 | -          $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); | 
                                                        |
| 765 | +          $form['flag_friend_submit']['#value'] = bts('Deny request', array(), null, 'boinc:friends-page'); | 
                                                        |
| 766 | 766 | }  | 
                                                        
| 767 | 767 | break;  | 
                                                        
| 768 | 768 | case FLAG_FRIEND_UNFLAGGED:  | 
                                                        
| 769 | 769 | default:  | 
                                                        
| 770 | 770 | $user_links[] = array(  | 
                                                        
| 771 | -          'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), | 
                                                        |
| 771 | +          'title' => bts('Add as friend', array(), null, 'boinc:friends-add'), | 
                                                        |
| 772 | 772 |            'href' => "flag/confirm/flag/friend/{$account->uid}" | 
                                                        
| 773 | 773 | );  | 
                                                        
| 774 | 774 | }  | 
                                                        
@@ -778,7 +778,7 @@ discard block  | 
                                                    ||
| 778 | 778 | }  | 
                                                        
| 779 | 779 | |
| 780 | 780 | $form['cancel'] = array(  | 
                                                        
| 781 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', | 
                                                        |
| 781 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $cancel_dest) . '</li>', | 
                                                        |
| 782 | 782 | '#weight' => 1004,  | 
                                                        
| 783 | 783 | );  | 
                                                        
| 784 | 784 | $form['form control tabs suffix'] = array(  | 
                                                        
@@ -801,7 +801,7 @@ discard block  | 
                                                    ||
| 801 | 801 | '#weight' => 1001,  | 
                                                        
| 802 | 802 | );  | 
                                                        
| 803 | 803 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 804 | -    $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        |
| 804 | +    $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); | 
                                                        |
| 805 | 805 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 806 | 806 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 807 | 807 | $form['buttons']['preview']['#prefix'] = '<li class="tab">';  | 
                                                        
@@ -811,7 +811,7 @@ discard block  | 
                                                    ||
| 811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 813 | 813 | $form['buttons']['cancel'] = array(  | 
                                                        
| 814 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 814 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 815 | 815 | '#weight' => 1005,  | 
                                                        
| 816 | 816 | );  | 
                                                        
| 817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
@@ -839,11 +839,11 @@ discard block  | 
                                                    ||
| 839 | 839 | '#weight' => 1001,  | 
                                                        
| 840 | 840 | );  | 
                                                        
| 841 | 841 | $form['actions']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 842 | -    $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); | 
                                                        |
| 842 | +    $form['actions']['submit']['#value'] = bts('Delete', array(), null, 'boinc:form-delete'); | 
                                                        |
| 843 | 843 | $form['actions']['submit']['#suffix'] = '</li>';  | 
                                                        
| 844 | 844 | $form['actions']['submit']['#weight'] = 1002;  | 
                                                        
| 845 | 845 | $form['actions']['cancel'] = array(  | 
                                                        
| 846 | -        '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 846 | +        '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', | 
                                                        |
| 847 | 847 | '#weight' => 1005,  | 
                                                        
| 848 | 848 | );  | 
                                                        
| 849 | 849 | $form['actions']['form control tabs suffix'] = array(  | 
                                                        
@@ -863,14 +863,14 @@ discard block  | 
                                                    ||
| 863 | 863 | '#weight' => 1001,  | 
                                                        
| 864 | 864 | );  | 
                                                        
| 865 | 865 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 866 | -    $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); | 
                                                        |
| 866 | +    $form['privatemsg']['submit']['#value'] = bts('Send message', array(), null, 'boinc:private-message'); | 
                                                        |
| 867 | 867 | $form['privatemsg']['submit']['#suffix'] = '</li>';  | 
                                                        
| 868 | 868 | $form['privatemsg']['submit']['#weight'] = 1002;  | 
                                                        
| 869 | 869 | $form['privatemsg']['preview']['#prefix'] = '<li class="tab">';  | 
                                                        
| 870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>';  | 
                                                        
| 871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003;  | 
                                                        
| 872 | 872 | $form['privatemsg']['cancel'] = array(  | 
                                                        
| 873 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 873 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 874 | 874 | '#weight' => 1004,  | 
                                                        
| 875 | 875 | );  | 
                                                        
| 876 | 876 | $form['privatemsg']['form control tabs suffix'] = array(  | 
                                                        
@@ -885,18 +885,18 @@ discard block  | 
                                                    ||
| 885 | 885 | // Login form  | 
                                                        
| 886 | 886 | case 'user_login':  | 
                                                        
| 887 | 887 | case 'user_login_block':  | 
                                                        
| 888 | -      drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); | 
                                                        |
| 888 | +      drupal_set_title(bts('Login', array(), null, 'boinc:menu-link')); | 
                                                        |
| 889 | 889 | // Replace name with email in login form  | 
                                                        
| 890 | 890 | unset($form['name']);  | 
                                                        
| 891 | 891 | array_unshift($form, array(  | 
                                                        
| 892 | 892 | 'email' => array(  | 
                                                        
| 893 | 893 | '#type' => 'textfield',  | 
                                                        
| 894 | -        '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), | 
                                                        |
| 894 | +        '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), | 
                                                        |
| 895 | 895 | '#size' => ($form_id == 'user_login_block') ? 15 : 60,  | 
                                                        
| 896 | 896 | '#maxlength' => EMAIL_MAX_LENGTH,  | 
                                                        
| 897 | - '#required' => TRUE,  | 
                                                        |
| 897 | + '#required' => true,  | 
                                                        |
| 898 | 898 |          '#attributes' => array('tabindex' => '1'), | 
                                                        
| 899 | -        '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') | 
                                                        |
| 899 | +        '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:standard-login-page') | 
                                                        |
| 900 | 900 | ),  | 
                                                        
| 901 | 901 | 'validation_source' => array(  | 
                                                        
| 902 | 902 | '#type' => 'hidden',  | 
                                                        
@@ -912,7 +912,7 @@ discard block  | 
                                                    ||
| 912 | 912 | );  | 
                                                        
| 913 | 913 | $form['buttons']['submit'] = $form['submit'];  | 
                                                        
| 914 | 914 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 915 | -    $form['buttons']['submit']['#value'] = bts('Log in', array(), NULL, 'boinc:standard-login-page'); | 
                                                        |
| 915 | +    $form['buttons']['submit']['#value'] = bts('Log in', array(), null, 'boinc:standard-login-page'); | 
                                                        |
| 916 | 916 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 917 | 917 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 918 | 918 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
@@ -928,7 +928,7 @@ discard block  | 
                                                    ||
| 928 | 928 |      if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { | 
                                                        
| 929 | 929 | // Find the local validation function's entry so we can replace it.  | 
                                                        
| 930 | 930 |        $array_key = array_search('user_login_authenticate_validate', $form['#validate']); | 
                                                        
| 931 | -      if ($array_key === FALSE) { | 
                                                        |
| 931 | +      if ($array_key === false) { | 
                                                        |
| 932 | 932 | // Could not find it. Some other module must have run form_alter().  | 
                                                        
| 933 | 933 | // We will simply add our validation just before the final validator.  | 
                                                        
| 934 | 934 | $final_validator = array_pop($form['#validate']);  | 
                                                        
@@ -956,26 +956,26 @@ discard block  | 
                                                    ||
| 956 | 956 | }  | 
                                                        
| 957 | 957 | |
| 958 | 958 | // Set special message if user has not agreed to TOU  | 
                                                        
| 959 | -    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); | 
                                                        |
| 959 | +    $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); | 
                                                        |
| 960 | 960 |      $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); | 
                                                        
| 961 | 961 |      if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { | 
                                                        
| 962 | 962 | drupal_set_message(  | 
                                                        
| 963 | 963 |          bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', | 
                                                        
| 964 | 964 | array(  | 
                                                        
| 965 | 965 |            '@project' => variable_get('site_name','Drupal-BOINC'), | 
                                                        
| 966 | - ), NULL, 'boinc:account-credentials-change')  | 
                                                        |
| 966 | + ), null, 'boinc:account-credentials-change')  | 
                                                        |
| 967 | 967 | , 'info');  | 
                                                        
| 968 | 968 | }  | 
                                                        
| 969 | 969 | |
| 970 | 970 | // A bit hackish... but don't require the user to enter his password if  | 
                                                        
| 971 | 971 | // coming from the password reset function  | 
                                                        
| 972 | -    $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; | 
                                                        |
| 972 | +    $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === false) ? 0 : 1; | 
                                                        |
| 973 | 973 |      if ($reset_pass) { | 
                                                        
| 974 | 974 | $_SESSION['reset_pass'] = 1;  | 
                                                        
| 975 | 975 | }  | 
                                                        
| 976 | 976 | |
| 977 | 977 | // Adjust form elements already present  | 
                                                        
| 978 | -    $form['account']['name']['#title'] = bts('Drupal Username', array(), NULL, 'boinc:drupal-username'); | 
                                                        |
| 978 | +    $form['account']['name']['#title'] = bts('Drupal Username', array(), null, 'boinc:drupal-username'); | 
                                                        |
| 979 | 979 | $form['account']['name']['#size'] = 40;  | 
                                                        
| 980 | 980 | $form['account']['name']['#attributes']['autocomplete'] = 'off';  | 
                                                        
| 981 | 981 | $form['account']['name']['#description'] .= '<p>This is the drupal (internal) username. The title above shows the BOINC username, which is the display name used publicly that the user can change in Community Preferences.';  | 
                                                        
@@ -986,11 +986,11 @@ discard block  | 
                                                    ||
| 986 | 986 | // Add BOINC username (aka displayname)  | 
                                                        
| 987 | 987 | $form['account']['boincuser_name'] = array(  | 
                                                        
| 988 | 988 | '#type' => 'textfield',  | 
                                                        
| 989 | -        '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), | 
                                                        |
| 989 | +        '#title' => bts('BOINC Username', array(), null, 'boinc:user-or-team-name'), | 
                                                        |
| 990 | 990 | '#default_value' => $account->boincuser_name,  | 
                                                        
| 991 | 991 | '#maxlength' => USERNAME_MAX_LENGTH,  | 
                                                        
| 992 | - '#required' => TRUE,  | 
                                                        |
| 993 | -        '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), | 
                                                        |
| 992 | + '#required' => true,  | 
                                                        |
| 993 | +        '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), null, 'boinc:username-change'), | 
                                                        |
| 994 | 994 | '#size' => 40,  | 
                                                        
| 995 | 995 | );  | 
                                                        
| 996 | 996 | }  | 
                                                        
@@ -999,23 +999,23 @@ discard block  | 
                                                    ||
| 999 | 999 | // ago, it cannot be changed again.  | 
                                                        
| 1000 | 1000 | $duration = TOKEN_DURATION_ONE_WEEK;  | 
                                                        
| 1001 | 1001 |      if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { | 
                                                        
| 1002 | - $form['account']['mail']['#required'] = FALSE;  | 
                                                        |
| 1002 | + $form['account']['mail']['#required'] = false;  | 
                                                        |
| 1003 | 1003 | $form['account']['mailhelp'] = array(  | 
                                                        
| 1004 | 1004 |          '#value' => bts("You email address was changed within the past seven (7) days. Please look for an email to !prev_email if you need to revert this change. You may change your email address on !time.", | 
                                                        
| 1005 | 1005 | array(  | 
                                                        
| 1006 | 1006 | '!prev_email' => $account->boincuser_previous_email_addr,  | 
                                                        
| 1007 | 1007 |              '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), | 
                                                        
| 1008 | - ), NULL, 'boinc:account-credentials-change'),  | 
                                                        |
| 1008 | + ), null, 'boinc:account-credentials-change'),  | 
                                                        |
| 1009 | 1009 | );  | 
                                                        
| 1010 | 1010 | }  | 
                                                        
| 1011 | 1011 | |
| 1012 | -    if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { | 
                                                        |
| 1012 | +    if (!$reset_pass and ($user->uid == $account->uid or !user_access('administer users'))) { | 
                                                        |
| 1013 | 1013 | // Add a password authenticator, required to change email or pw  | 
                                                        
| 1014 | 1014 | $form['account']['current_pass'] = array(  | 
                                                        
| 1015 | 1015 | '#type' => 'password',  | 
                                                        
| 1016 | -        '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), | 
                                                        |
| 1016 | +        '#title' => bts('Enter your password to save changes', array(), null, 'boinc:account-credentials-change'), | 
                                                        |
| 1017 | 1017 |          '#description' => bts('Enter your current password if changing your email | 
                                                        
| 1018 | - address or password.', array(), NULL, 'boinc:account-credentials-change'),  | 
                                                        |
| 1018 | + address or password.', array(), null, 'boinc:account-credentials-change'),  | 
                                                        |
| 1019 | 1019 | '#size' => 17,  | 
                                                        
| 1020 | 1020 | '#attributes' => array(  | 
                                                        
| 1021 | 1021 | 'autocomplete' => 'off',  | 
                                                        
@@ -1027,35 +1027,35 @@ discard block  | 
                                                    ||
| 1027 | 1027 | $form['account']['boincuser_id'] = array(  | 
                                                        
| 1028 | 1028 | '#value' => '  | 
                                                        
| 1029 | 1029 | <div class="form-item">  | 
                                                        
| 1030 | -          <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1030 | +          <label>' . bts('BOINC user ID', array(), null, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1031 | 1031 | <span>' . $account->boincuser_id . '</span>  | 
                                                        
| 1032 | 1032 | </div>',  | 
                                                        
| 1033 | 1033 | );  | 
                                                        
| 1034 | 1034 | $form['account']['user_id'] = array(  | 
                                                        
| 1035 | 1035 | '#value' => '  | 
                                                        
| 1036 | 1036 | <div class="form-item">  | 
                                                        
| 1037 | -          <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1037 | +          <label>' . bts('Drupal user ID', array(), null, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1038 | 1038 | <span>' . $account->uid . '</span>  | 
                                                        
| 1039 | 1039 | </div>',  | 
                                                        
| 1040 | 1040 | );  | 
                                                        
| 1041 | 1041 | $form['account']['account_key'] = array(  | 
                                                        
| 1042 | 1042 | '#value' => '  | 
                                                        
| 1043 | 1043 | <div class="form-item">  | 
                                                        
| 1044 | -          <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1044 | +          <label>' . bts('Account key', array(), null, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1045 | 1045 | <span>' . $account->boincuser_account_key . '</span>  | 
                                                        
| 1046 | 1046 | </div>',  | 
                                                        
| 1047 | 1047 | );  | 
                                                        
| 1048 | 1048 | $form['account']['weak_account_key'] = array(  | 
                                                        
| 1049 | 1049 | '#value' => '  | 
                                                        
| 1050 | 1050 | <div class="form-item">  | 
                                                        
| 1051 | -          <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1051 | +          <label>' . bts('Weak account key', array(), null, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1052 | 1052 |            <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> | 
                                                        
| 1053 | 1053 | </div>',  | 
                                                        
| 1054 | 1054 | );  | 
                                                        
| 1055 | 1055 | $form['account']['cpid'] = array(  | 
                                                        
| 1056 | 1056 | '#value' => '  | 
                                                        
| 1057 | 1057 | <div class="form-item">  | 
                                                        
| 1058 | -          <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1058 | +          <label>' . bts('Cross-project ID', array(), null, 'boinc:account-credentials-change') . '</label> | 
                                                        |
| 1059 | 1059 | <span>' . $account->boincuser_cpid . '</span>  | 
                                                        
| 1060 | 1060 | </div>',  | 
                                                        
| 1061 | 1061 | );  | 
                                                        
@@ -1070,14 +1070,14 @@ discard block  | 
                                                    ||
| 1070 | 1070 | '#weight' => 1001,  | 
                                                        
| 1071 | 1071 | );  | 
                                                        
| 1072 | 1072 | $form['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 1073 | -    $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        |
| 1073 | +    $form['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); | 
                                                        |
| 1074 | 1074 | $form['submit']['#suffix'] = '</li>';  | 
                                                        
| 1075 | 1075 | $form['submit']['#weight'] = 1002;  | 
                                                        
| 1076 | 1076 | $form['cancel'] = array(  | 
                                                        
| 1077 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1077 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1078 | 1078 | '#weight' => 1003,  | 
                                                        
| 1079 | 1079 | );  | 
                                                        
| 1080 | -    if (isset($form['delete']) AND is_array($form['delete'])) { | 
                                                        |
| 1080 | +    if (isset($form['delete']) and is_array($form['delete'])) { | 
                                                        |
| 1081 | 1081 | $form['delete']['#prefix'] = '<li class="first alt tab">';  | 
                                                        
| 1082 | 1082 | $form['delete']['#suffix'] = '</li>';  | 
                                                        
| 1083 | 1083 | $form['delete']['#weight'] = 1004;  | 
                                                        
@@ -1139,7 +1139,7 @@ discard block  | 
                                                    ||
| 1139 | 1139 | |
| 1140 | 1140 | // Set form['title'], but hide it  | 
                                                        
| 1141 | 1141 | $form['title']['#default_value'] = $account->boincuser_name;  | 
                                                        
| 1142 | - $form['title']['#access'] = FALSE;  | 
                                                        |
| 1142 | + $form['title']['#access'] = false;  | 
                                                        |
| 1143 | 1143 | |
| 1144 | 1144 | $form['separator_bottom'] = array(  | 
                                                        
| 1145 | 1145 | '#value' => '<div class="separator buttons"></div>',  | 
                                                        
@@ -1160,7 +1160,7 @@ discard block  | 
                                                    ||
| 1160 | 1160 | '#weight' => 1001,  | 
                                                        
| 1161 | 1161 | );  | 
                                                        
| 1162 | 1162 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 1163 | -    $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); | 
                                                        |
| 1163 | +    $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); | 
                                                        |
| 1164 | 1164 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 1165 | 1165 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 1166 | 1166 | $form['buttons']['preview']['#prefix'] = '<li class="tab">';  | 
                                                        
@@ -1170,12 +1170,12 @@ discard block  | 
                                                    ||
| 1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>';  | 
                                                        
| 1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004;  | 
                                                        
| 1172 | 1172 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1173 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1173 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', | 
                                                        |
| 1174 | 1174 | '#weight' => 1005,  | 
                                                        
| 1175 | 1175 | );  | 
                                                        
| 1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">';  | 
                                                        
| 1177 | 1177 | $form['buttons']['delete']['#suffix'] = '</li>';  | 
                                                        
| 1178 | -    $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), NULL, 'boinc:form-save'); | 
                                                        |
| 1178 | +    $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), null, 'boinc:form-save'); | 
                                                        |
| 1179 | 1179 | $form['buttons']['delete']['#weight'] = 1006;  | 
                                                        
| 1180 | 1180 |      $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); | 
                                                        
| 1181 | 1181 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
@@ -1209,11 +1209,11 @@ discard block  | 
                                                    ||
| 1209 | 1209 | array_unshift($form, array(  | 
                                                        
| 1210 | 1210 | 'boincuser_name' => array(  | 
                                                        
| 1211 | 1211 | '#type' => 'textfield',  | 
                                                        
| 1212 | -        '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), | 
                                                        |
| 1212 | +        '#title' => bts('Name', array(), null, 'boinc:user-or-team-name'), | 
                                                        |
| 1213 | 1213 | '#default_value' => $edit['boincuser_name'],  | 
                                                        
| 1214 | 1214 | '#maxlength' => USERNAME_MAX_LENGTH,  | 
                                                        
| 1215 | -        '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), | 
                                                        |
| 1216 | - '#required' => TRUE  | 
                                                        |
| 1215 | +        '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), null, 'boinc:user-register'), | 
                                                        |
| 1216 | + '#required' => true  | 
                                                        |
| 1217 | 1217 | ),  | 
                                                        
| 1218 | 1218 | ));  | 
                                                        
| 1219 | 1219 | // Set name temporarily to dummy value to beat validation  | 
                                                        
@@ -1233,27 +1233,27 @@ discard block  | 
                                                    ||
| 1233 | 1233 | '#type' => 'fieldset',  | 
                                                        
| 1234 | 1234 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div.  | 
                                                        
| 1235 | 1235 | '#suffix' => '</div>',  | 
                                                        
| 1236 | - '#tree' => TRUE,  | 
                                                        |
| 1236 | + '#tree' => true,  | 
                                                        |
| 1237 | 1237 | '#weight' => -15,  | 
                                                        
| 1238 | 1238 | );  | 
                                                        
| 1239 | 1239 | |
| 1240 | 1240 | $form['termsofuse']['title1'] = array(  | 
                                                        
| 1241 | 1241 | '#weight' => -12,  | 
                                                        
| 1242 | -        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', | 
                                                        |
| 1242 | +        '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), null, 'project:user-register' ) . '</h2>', | 
                                                        |
| 1243 | 1243 | '#prefix' => '<div id="register-title1">',  | 
                                                        
| 1244 | 1244 | '#suffix' => '</div>',  | 
                                                        
| 1245 | 1245 | );  | 
                                                        
| 1246 | 1246 | |
| 1247 | 1247 | $form['termsofuse']['body'] = array(  | 
                                                        
| 1248 | 1248 | '#weight' => -10,  | 
                                                        
| 1249 | - '#value' => bts($termsofuse, array(), NULL, 'project:user-register'),  | 
                                                        |
| 1249 | + '#value' => bts($termsofuse, array(), null, 'project:user-register'),  | 
                                                        |
| 1250 | 1250 | '#prefix' => '<div id="register-termsofuse">',  | 
                                                        
| 1251 | 1251 | '#suffix' => '</div>',  | 
                                                        
| 1252 | 1252 | );  | 
                                                        
| 1253 | 1253 | |
| 1254 | 1254 | $form['termsofuse']['agreeTOU'] = array(  | 
                                                        
| 1255 | 1255 | '#type' => 'checkbox',  | 
                                                        
| 1256 | -        '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), | 
                                                        |
| 1256 | +        '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), null, 'project:user-register'), | 
                                                        |
| 1257 | 1257 | '#weight' => -8,  | 
                                                        
| 1258 | 1258 | '#prefix' => '<div id="register-checkbox">',  | 
                                                        
| 1259 | 1259 | '#suffix' => '</div>',  | 
                                                        
@@ -1262,7 +1262,7 @@ discard block  | 
                                                    ||
| 1262 | 1262 | |
| 1263 | 1263 | $form['title2'] = array(  | 
                                                        
| 1264 | 1264 | '#weight' => -6,  | 
                                                        
| 1265 | -      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', | 
                                                        |
| 1265 | +      '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), null, 'project:user-register') . '</h2>', | 
                                                        |
| 1266 | 1266 | '#prefix' => '<div id="register-title2">',  | 
                                                        
| 1267 | 1267 | '#suffix' => '</div>',  | 
                                                        
| 1268 | 1268 | );  | 
                                                        
@@ -1282,26 +1282,26 @@ discard block  | 
                                                    ||
| 1282 | 1282 | |
| 1283 | 1283 | // Request new password form  | 
                                                        
| 1284 | 1284 | case 'user_pass':  | 
                                                        
| 1285 | -    drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); | 
                                                        |
| 1285 | +    drupal_set_title(bts('Forgot password', array(), null, 'boinc:forgot-password')); | 
                                                        |
| 1286 | 1286 | // Replace name/email text box with email only; retain "name" label  | 
                                                        
| 1287 | 1287 | // for compatibility with standard Drupal submit function  | 
                                                        
| 1288 | 1288 | unset($form['name']);  | 
                                                        
| 1289 | 1289 | array_unshift($form, array(  | 
                                                        
| 1290 | 1290 | 'name' => array(  | 
                                                        
| 1291 | 1291 | '#type' => 'textfield',  | 
                                                        
| 1292 | -        '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), | 
                                                        |
| 1292 | +        '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), | 
                                                        |
| 1293 | 1293 | '#size' => 60,  | 
                                                        
| 1294 | 1294 | '#maxlength' => EMAIL_MAX_LENGTH,  | 
                                                        
| 1295 | - '#required' => TRUE,  | 
                                                        |
| 1295 | + '#required' => true,  | 
                                                        |
| 1296 | 1296 | '#description' => bts(  | 
                                                        
| 1297 | 1297 | 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',  | 
                                                        
| 1298 | 1298 | array(  | 
                                                        
| 1299 | 1299 | '!authenticator_login' => l(  | 
                                                        
| 1300 | -              bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), | 
                                                        |
| 1300 | +              bts('authenticator-based login', array(), null, 'boinc:forgot-password'), | 
                                                        |
| 1301 | 1301 | 'user/login/auth'  | 
                                                        
| 1302 | 1302 | )  | 
                                                        
| 1303 | 1303 | )  | 
                                                        
| 1304 | - , NULL, 'boinc:forgot-password'),  | 
                                                        |
| 1304 | + , null, 'boinc:forgot-password'),  | 
                                                        |
| 1305 | 1305 | ),  | 
                                                        
| 1306 | 1306 | ));  | 
                                                        
| 1307 | 1307 | |
@@ -1322,11 +1322,11 @@ discard block  | 
                                                    ||
| 1322 | 1322 | );  | 
                                                        
| 1323 | 1323 | $form['buttons']['submit'] = $form['submit'];  | 
                                                        
| 1324 | 1324 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">';  | 
                                                        
| 1325 | -    $form['buttons']['submit']['#value'] = bts('Send', array(), NULL, 'boinc:form-send'); | 
                                                        |
| 1325 | +    $form['buttons']['submit']['#value'] = bts('Send', array(), null, 'boinc:form-send'); | 
                                                        |
| 1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>';  | 
                                                        
| 1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002;  | 
                                                        
| 1328 | 1328 | $form['buttons']['cancel'] = array(  | 
                                                        
| 1329 | -      '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', | 
                                                        |
| 1329 | +      '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'user/login') . '</li>', | 
                                                        |
| 1330 | 1330 | '#weight' => 1005,  | 
                                                        
| 1331 | 1331 | );  | 
                                                        
| 1332 | 1332 | $form['buttons']['form control tabs suffix'] = array(  | 
                                                        
@@ -1343,7 +1343,7 @@ discard block  | 
                                                    ||
| 1343 | 1343 | break;  | 
                                                        
| 1344 | 1344 | |
| 1345 | 1345 | case 'views_exposed_form':  | 
                                                        
| 1346 | -      $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); | 
                                                        |
| 1346 | +      $form['submit']['#value'] = bts('Search', array(), null, 'boinc:search-user'); | 
                                                        |
| 1347 | 1347 | break;  | 
                                                        
| 1348 | 1348 | }  | 
                                                        
| 1349 | 1349 | }  | 
                                                        
@@ -1375,7 +1375,7 @@ discard block  | 
                                                    ||
| 1375 | 1375 |  function boincuser_process_password_confirm($element) { | 
                                                        
| 1376 | 1376 | // Check if parent element is "account".  | 
                                                        
| 1377 | 1377 |    if ($element['#array_parents'][0] == 'account') { | 
                                                        
| 1378 | -    $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); | 
                                                        |
| 1378 | +    $element['pass1']['#title'] = bts('Change password', array(), null, 'boinc:forgot-password'); | 
                                                        |
| 1379 | 1379 | }  | 
                                                        
| 1380 | 1380 | return $element;  | 
                                                        
| 1381 | 1381 | }  | 
                                                        
@@ -1395,7 +1395,7 @@ discard block  | 
                                                    ||
| 1395 | 1395 | /**  | 
                                                        
| 1396 | 1396 | * Implementation of hook_token_values  | 
                                                        
| 1397 | 1397 | */  | 
                                                        
| 1398 | -function boincuser_token_values($type, $object = NULL, $options = array()) { | 
                                                        |
| 1398 | +function boincuser_token_values($type, $object = null, $options = array()) { | 
                                                        |
| 1399 | 1399 |    if ($type == 'user') { | 
                                                        
| 1400 | 1400 | $account = user_load($object->uid);  | 
                                                        
| 1401 | 1401 | $tokens['display-name'] = $account->boincuser_name;  | 
                                                        
@@ -1463,13 +1463,13 @@ discard block  | 
                                                    ||
| 1463 | 1463 |    require_boinc('boinc_db'); | 
                                                        
| 1464 | 1464 | $num_deleted = BoincUserDeleted::delete_expired();  | 
                                                        
| 1465 | 1465 |    if ($num_deleted>0) { | 
                                                        
| 1466 | -    watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); | 
                                                        |
| 1466 | +    watchdog('boincuser', "deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); | 
                                                        |
| 1467 | 1467 | }  | 
                                                        
| 1468 | 1468 | |
| 1469 | 1469 | // Delete expired tokens from token table  | 
                                                        
| 1470 | 1470 | $tokens_deleted = BoincToken::delete_expired();  | 
                                                        
| 1471 | 1471 |    if ($tokens_deleted>0) { | 
                                                        
| 1472 | -    watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); | 
                                                        |
| 1472 | +    watchdog('boincuser', "deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); | 
                                                        |
| 1473 | 1473 | }  | 
                                                        
| 1474 | 1474 | }  | 
                                                        
| 1475 | 1475 | |
@@ -1511,8 +1511,8 @@ discard block  | 
                                                    ||
| 1511 | 1511 |    if (!isset($account->roles[$verified_contributor])) { | 
                                                        
| 1512 | 1512 | drupal_set_message(bts(  | 
                                                        
| 1513 | 1513 | 'You may only create or modify your user profile after earning @count credits.',  | 
                                                        
| 1514 | -        array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' | 
                                                        |
| 1515 | - ), 'warning', FALSE);  | 
                                                        |
| 1514 | +        array('@count' => $min_credit_to_post), null, 'boinc:view-profile' | 
                                                        |
| 1515 | + ), 'warning', false);  | 
                                                        |
| 1516 | 1516 | }  | 
                                                        
| 1517 | 1517 | |
| 1518 | 1518 | // For now, just call the user module profile view function  | 
                                                        
@@ -1555,35 +1555,35 @@ discard block  | 
                                                    ||
| 1555 | 1555 |      if ($registration_enabled) { | 
                                                        
| 1556 | 1556 |        $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        
| 1557 | 1557 | array(  | 
                                                        
| 1558 | -        '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        |
| 1558 | +        '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), | 
                                                        |
| 1559 | 1559 | '@sitename' => $site_name,  | 
                                                        
| 1560 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1560 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1561 | 1561 | }  | 
                                                        
| 1562 | -    $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1562 | +    $output .= '  <li>' . bts("Install BOINC on this device if not already present.", array(), null, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1563 | 1563 |      $output .= '  <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", | 
                                                        
| 1564 | 1564 | array(  | 
                                                        
| 1565 | 1565 | '@sitename' => $site_name,  | 
                                                        
| 1566 | 1566 | '@siteurl' => $base_url,  | 
                                                        
| 1567 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1567 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1568 | 1568 |      if ($registration_enabled) { | 
                                                        
| 1569 | 1569 |        $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", | 
                                                        
| 1570 | 1570 | array(  | 
                                                        
| 1571 | 1571 |            '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        
| 1572 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1572 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1573 | 1573 | }  | 
                                                        
| 1574 | 1574 |      else { | 
                                                        
| 1575 | 1575 |        $output .= '<li>' . bts("If you're running a command-line version of BOINC, | 
                                                        
| 1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.",  | 
                                                        
| 1577 | 1577 | array(  | 
                                                        
| 1578 | 1578 |            '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), | 
                                                        
| 1579 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1579 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1580 | 1580 | }  | 
                                                        
| 1581 | 1581 |      $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please | 
                                                        
| 1582 | 1582 | upgrade to a more recent version of BOINC to create an account  | 
                                                        
| 1583 | 1583 | at @this_project.",  | 
                                                        
| 1584 | 1584 | array(  | 
                                                        
| 1585 | 1585 | '@this_project' => $site_name,  | 
                                                        
| 1586 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1586 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1587 | 1587 | $output .= '</ol>';  | 
                                                        
| 1588 | 1588 | break;  | 
                                                        
| 1589 | 1589 | case 'new':  | 
                                                        
@@ -1603,29 +1603,29 @@ discard block  | 
                                                    ||
| 1603 | 1603 |      if ($registration_enabled) { | 
                                                        
| 1604 | 1604 |        $output .= '<li>' . bts('First !create_an_account here at @sitename.', | 
                                                        
| 1605 | 1605 | array(  | 
                                                        
| 1606 | -        '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), | 
                                                        |
| 1606 | +        '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), | 
                                                        |
| 1607 | 1607 | '@sitename' => $site_name,  | 
                                                        
| 1608 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1608 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1609 | 1609 | }  | 
                                                        
| 1610 | 1610 |      else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { | 
                                                        
| 1611 | 1611 |        $output .= '  <li>' . bts("Read our !rules_and_policies.", array( | 
                                                        
| 1612 | -        '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), | 
                                                        |
| 1613 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1612 | +        '!rules_and_policies' => l(bts('Rules and Policies', array(), null, 'boinc:join-page'), $ruleslink), | 
                                                        |
| 1613 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1614 | 1614 | }  | 
                                                        
| 1615 | -    $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); | 
                                                        |
| 1615 | +    $output .= '  <li>' . bts('Download the BOINC desktop software.', array(), null, 'boinc:join-page'); | 
                                                        |
| 1616 | 1616 | $output .= ' <p>';  | 
                                                        
| 1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>';  | 
                                                        
| 1618 | 1618 | $output .= ' </p>';  | 
                                                        
| 1619 | 1619 |      $output .= '    ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( | 
                                                        
| 1620 | 1620 | '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>',  | 
                                                        
| 1621 | 1621 | '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>',  | 
                                                        
| 1622 | - ), NULL, 'boinc:join-page');  | 
                                                        |
| 1622 | + ), null, 'boinc:join-page');  | 
                                                        |
| 1623 | 1623 | $output .= ' </li>';  | 
                                                        
| 1624 | -    $output .= '  <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1624 | +    $output .= '  <li>' . bts('Run the installer.', array(), null, 'boinc:join-page') . '</li>'; | 
                                                        |
| 1625 | 1625 |      $output .= '  <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( | 
                                                        
| 1626 | 1626 | '@sitename' => $site_name,  | 
                                                        
| 1627 | 1627 | '@siteurl' => $base_url,  | 
                                                        
| 1628 | - ), NULL, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1628 | + ), null, 'boinc:join-page') . '</li>';  | 
                                                        |
| 1629 | 1629 | $output .= '</ol>';  | 
                                                        
| 1630 | 1630 | }  | 
                                                        
| 1631 | 1631 | $output .= '</div>';  | 
                                                        
@@ -1656,17 +1656,17 @@ discard block  | 
                                                    ||
| 1656 | 1656 |    else { | 
                                                        
| 1657 | 1657 | $uotd = user_load($current_uotd->uid);  | 
                                                        
| 1658 | 1658 | }  | 
                                                        
| 1659 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);  | 
                                                        |
| 1659 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, false);  | 
                                                        |
| 1660 | 1660 | $output = '<h2 class="pane-title">';  | 
                                                        
| 1661 | -  $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); | 
                                                        |
| 1661 | +  $output .= ($user->uid) ? bts('Welcome back!', array(), null, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), null, 'boinc:front-page')); | 
                                                        |
| 1662 | 1662 | $output .= '</h2>';  | 
                                                        
| 1663 | 1663 | $output .= '<div class="boinc-overview balance-height-front">';  | 
                                                        
| 1664 | -  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; | 
                                                        |
| 1664 | +  $output .= '  <div>' . bts($site_message, array(), null, "project:front page") . ' ' . l(bts('Learn more', array(), null, 'boinc:front-page'), 'about') . '</div>'; | 
                                                        |
| 1665 | 1665 |    if ($user->uid) { | 
                                                        
| 1666 | -    $output .= '  <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1666 | +    $output .= '  <div>' . l(bts('View account', array(), null, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1667 | 1667 | }  | 
                                                        
| 1668 | 1668 |    else { | 
                                                        
| 1669 | -    $output .= '  <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1669 | +    $output .= '  <div>' . l(bts('Join now', array(), null, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; | 
                                                        |
| 1670 | 1670 | }  | 
                                                        
| 1671 | 1671 | $output .= '</div>';  | 
                                                        
| 1672 | 1672 | $output .= '<div class="boinc-overview-details">';  | 
                                                        
@@ -1674,17 +1674,17 @@ discard block  | 
                                                    ||
| 1674 | 1674 | $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">';  | 
                                                        
| 1675 | 1675 | $output .= ' <div class="picture">';  | 
                                                        
| 1676 | 1676 |    $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], | 
                                                        
| 1677 | - $uotd_image['alt'], array(), FALSE);  | 
                                                        |
| 1677 | + $uotd_image['alt'], array(), false);  | 
                                                        |
| 1678 | 1678 | $output .= ' </div>';  | 
                                                        
| 1679 | -  $output .= '      <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1679 | +  $output .= '      <div class="text">' . bts('User of the day', array(), null, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1680 | 1680 | $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>';  | 
                                                        
| 1681 | 1681 | $output .= ' </a>';  | 
                                                        
| 1682 | 1682 | $output .= ' <div class="volunteers">';  | 
                                                        
| 1683 | -  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1683 | +  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), null, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1684 | 1684 | $output .= ' <div class="platforms">';  | 
                                                        
| 1685 | -  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1686 | -  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1687 | -  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1685 | +  $output .= '        <div class="detail platform windows">' . bts('Windows', array(), null, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1686 | +  $output .= '        <div class="detail platform mac">' .  bts('Mac', array(), null, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1687 | +  $output .= '        <div class="detail platform linux">' . bts('Linux', array(), null, 'boinc:front-page') . '</div>'; | 
                                                        |
| 1688 | 1688 | $output .= ' </div>';  | 
                                                        
| 1689 | 1689 | $output .= ' </div>';  | 
                                                        
| 1690 | 1690 | $output .= ' </div>';  | 
                                                        
@@ -1712,12 +1712,12 @@ discard block  | 
                                                    ||
| 1712 | 1712 | xml_header();  | 
                                                        
| 1713 | 1713 | |
| 1714 | 1714 | // Account creation disabled  | 
                                                        
| 1715 | -  $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); | 
                                                        |
| 1715 | +  $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', true); | 
                                                        |
| 1716 | 1716 |    if (!$enablethisRPC) { | 
                                                        
| 1717 | 1717 |      $mess = bts('Account creation is done through our Web site. Please register at @url', array( | 
                                                        
| 1718 | 1718 | '@url' => $base_url . '/user/registration',  | 
                                                        
| 1719 | 1719 | ),  | 
                                                        
| 1720 | - NULL, 'boinc:create_account');  | 
                                                        |
| 1720 | + null, 'boinc:create_account');  | 
                                                        |
| 1721 | 1721 | xml_error(-208, $mess);  | 
                                                        
| 1722 | 1722 | }  | 
                                                        
| 1723 | 1723 | // Invalid invite code  | 
                                                        
@@ -1771,7 +1771,7 @@ discard block  | 
                                                    ||
| 1771 | 1771 | 'init' => $params['email_addr'],  | 
                                                        
| 1772 | 1772 | 'roles' => array($unrestricted_role => ''),  | 
                                                        
| 1773 | 1773 | 'boincuser_name' => $params['user_name'],  | 
                                                        
| 1774 | - 'boinchash_flag' => TRUE,  | 
                                                        |
| 1774 | + 'boinchash_flag' => true,  | 
                                                        |
| 1775 | 1775 | );  | 
                                                        
| 1776 | 1776 | |
| 1777 | 1777 | // Create the drupal user. If the drupal user cannot be created,  | 
                                                        
@@ -1808,20 +1808,20 @@ discard block  | 
                                                    ||
| 1808 | 1808 | }  | 
                                                        
| 1809 | 1809 | |
| 1810 | 1810 |    if (strlen($authtoken) != 32) { | 
                                                        
| 1811 | -    drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1811 | +    drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1812 | 1812 | drupal_goto();  | 
                                                        
| 1813 | 1813 | }  | 
                                                        
| 1814 | 1814 | |
| 1815 | 1815 |    require_boinc('boinc_db'); | 
                                                        
| 1816 | 1816 |    $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); | 
                                                        
| 1817 | 1817 |    if (!$boinc_user) { | 
                                                        
| 1818 | -    drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1818 | +    drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1819 | 1819 | drupal_goto();  | 
                                                        
| 1820 | 1820 | }  | 
                                                        
| 1821 | 1821 | $user = user_load(get_drupal_id($boinc_user->id));  | 
                                                        
| 1822 | 1822 | |
| 1823 | 1823 |    if (!$user) { | 
                                                        
| 1824 | -    drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), NULL, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1824 | +    drupal_set_message(bts('ERROR: There was a problem loading your account. Try logging in with your user name and password.', array(), null, 'boinc:account-finish'), 'error'); | 
                                                        |
| 1825 | 1825 | drupal_goto();  | 
                                                        
| 1826 | 1826 | }  | 
                                                        
| 1827 | 1827 | |
@@ -1842,9 +1842,9 @@ discard block  | 
                                                    ||
| 1842 | 1842 | // Check moderation page exists  | 
                                                        
| 1843 | 1843 |    $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); | 
                                                        
| 1844 | 1844 |    if ( menu_valid_path(array('link_path' => $moderationpath)) ) { | 
                                                        
| 1845 | -    $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); | 
                                                        |
| 1845 | +    $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), null, 'boinc:account-finish'), $moderationpath, $options)), null, 'boinc:account-finish'); | 
                                                        |
| 1846 | 1846 |    } else { | 
                                                        
| 1847 | -    $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); | 
                                                        |
| 1847 | +    $modsentence = bts('Please note: user profiles are subject to moderation.', array(), null, 'boinc:account-finish'); | 
                                                        |
| 1848 | 1848 | }  | 
                                                        
| 1849 | 1849 | |
| 1850 | 1850 | $username = $user->boincuser_name;  | 
                                                        
@@ -1853,73 +1853,73 @@ discard block  | 
                                                    ||
| 1853 | 1853 | array(  | 
                                                        
| 1854 | 1854 | '@user_name' => $username,  | 
                                                        
| 1855 | 1855 | '@site_name' => $site_name,  | 
                                                        
| 1856 | - ), NULL, 'boinc:account-finish') . "</p>";  | 
                                                        |
| 1856 | + ), null, 'boinc:account-finish') . "</p>";  | 
                                                        |
| 1857 | 1857 | |
| 1858 | 1858 | $links = array(  | 
                                                        
| 1859 | 1859 | array(  | 
                                                        
| 1860 | 1860 |        'data' => bts('Change your username at !community_preferences.', array( | 
                                                        
| 1861 | -        '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), | 
                                                        |
| 1862 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1861 | +        '!community_preferences' => l(bts('Community Preferences', array(), null, 'boinc:account-fininsh'), 'account/prefs/community', $options), | 
                                                        |
| 1862 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1863 | 1863 | 'children' => array(  | 
                                                        
| 1864 | -        bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), | 
                                                        |
| 1865 | -        bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), | 
                                                        |
| 1864 | +        bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), null, 'boinc:account-finish'), | 
                                                        |
| 1865 | +        bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), null, 'boinc:account-finish'), | 
                                                        |
| 1866 | 1866 | ),  | 
                                                        
| 1867 | 1867 | ),  | 
                                                        
| 1868 | 1868 | array(  | 
                                                        
| 1869 | 1869 |        'data' => bts('Change your !computing_preferences.', array( | 
                                                        
| 1870 | -        '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), | 
                                                        |
| 1871 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1870 | +        '!computing_preferences' => l(bts('Computing Preferences', array(), null, 'boinc:account-finish'), 'account/prefs', $options), | 
                                                        |
| 1871 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1872 | 1872 | 'children' => array(  | 
                                                        
| 1873 | -        bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), NULL, 'boinc:account-finish'), | 
                                                        |
| 1873 | +        bts('You may adjust how much CPU, RAM, and Disk space the BOINC client is allowed to use for tasks on your computer.', array(), null, 'boinc:account-finish'), | 
                                                        |
| 1874 | 1874 |          bts('By default, you will run @site_name tasks without any additional configuration.', array( | 
                                                        
| 1875 | 1875 | '@site_name' => $site_name,  | 
                                                        
| 1876 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1876 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1877 | 1877 |          bts('It is recommended new volunteers leave the default settings until they gain experience running some tasks. Ask questions in the !forums to get advice before making changes to a setting you don\'t understand.', array( | 
                                                        
| 1878 | -          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), | 
                                                        |
| 1879 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1878 | +          '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options), | 
                                                        |
| 1879 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1880 | 1880 | ),  | 
                                                        
| 1881 | 1881 | ),  | 
                                                        
| 1882 | 1882 | array(  | 
                                                        
| 1883 | 1883 |          'data' => bts('Create a !user_profile.', array( | 
                                                        
| 1884 | -          '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), | 
                                                        |
| 1885 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1884 | +          '!user_profile' => l(bts('User Profile', array(), null, 'boinc:account-finish'), '/account/profile/edit', $options), | 
                                                        |
| 1885 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1886 | 1886 | 'children' => array(  | 
                                                        
| 1887 | 1887 |          bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( | 
                                                        
| 1888 | 1888 | '@site_name' => $site_name,  | 
                                                        
| 1889 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1889 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1890 | 1890 | $modsentence,  | 
                                                        
| 1891 | 1891 | ),  | 
                                                        
| 1892 | 1892 | ),  | 
                                                        
| 1893 | 1893 | array(  | 
                                                        
| 1894 | 1894 |        'data' => bts('Join a !team.', array( | 
                                                        
| 1895 | -        '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), | 
                                                        |
| 1896 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1895 | +        '!team' => l(bts('Team', array(), null, 'boinc:account-finish'), '/community/teams', $options), | 
                                                        |
| 1896 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1897 | 1897 | 'children' => array(  | 
                                                        
| 1898 | -        bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), | 
                                                        |
| 1898 | +        bts('You may join a team, made up of other volunteers.', array(), null, 'boinc:account-finish'), | 
                                                        |
| 1899 | 1899 | ),  | 
                                                        
| 1900 | 1900 | ),  | 
                                                        
| 1901 | 1901 | array(  | 
                                                        
| 1902 | 1902 |        'data' => bts('Go to your !account_dashboard.', array( | 
                                                        
| 1903 | -        '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), | 
                                                        |
| 1904 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1903 | +        '!account_dashboard'=> l(bts('Account Dashboard', array(), null, 'boinc:account-finish'), 'account/dashboard', $options), | 
                                                        |
| 1904 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1905 | 1905 | 'children' => array(  | 
                                                        
| 1906 | -        bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), | 
                                                        |
| 1906 | +        bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), null, 'boinc:account-finish'), | 
                                                        |
| 1907 | 1907 | ),  | 
                                                        
| 1908 | 1908 | ),  | 
                                                        
| 1909 | 1909 | array(  | 
                                                        
| 1910 | 1910 |        'data' => bts('Visit our !help pages.', array( | 
                                                        
| 1911 | -        '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) | 
                                                        |
| 1912 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1911 | +        '!help' => l(bts('Help', array(), null, 'boinc:account-finish'), '/help', $options) | 
                                                        |
| 1912 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1913 | 1913 | 'children' => array(  | 
                                                        
| 1914 | 1914 |          bts('Ask for help in our community\'s !forums.', array( | 
                                                        
| 1915 | -          '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) | 
                                                        |
| 1916 | - ), NULL, 'boinc:account-finish'),  | 
                                                        |
| 1915 | +          '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options) | 
                                                        |
| 1916 | + ), null, 'boinc:account-finish'),  | 
                                                        |
| 1917 | 1917 | ),  | 
                                                        
| 1918 | 1918 | ),  | 
                                                        
| 1919 | 1919 | );  | 
                                                        
| 1920 | 1920 | |
| 1921 | 1921 | //List of links  | 
                                                        
| 1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul');  | 
                                                        |
| 1922 | + $output .= theme_item_list($links, $title = null, $type='ul');  | 
                                                        |
| 1923 | 1923 | |
| 1924 | 1924 | return $output;  | 
                                                        
| 1925 | 1925 | }  | 
                                                        
@@ -1929,20 +1929,20 @@ discard block  | 
                                                    ||
| 1929 | 1929 | */  | 
                                                        
| 1930 | 1930 |  function boincuser_moderate_community_access() { | 
                                                        
| 1931 | 1931 |    if (user_access('assign community member role') | 
                                                        
| 1932 | -  OR user_access('assign all roles')) { | 
                                                        |
| 1933 | - return TRUE;  | 
                                                        |
| 1932 | +  or user_access('assign all roles')) { | 
                                                        |
| 1933 | + return true;  | 
                                                        |
| 1934 | 1934 | }  | 
                                                        
| 1935 | - return FALSE;  | 
                                                        |
| 1935 | + return false;  | 
                                                        |
| 1936 | 1936 | }  | 
                                                        
| 1937 | 1937 | |
| 1938 | 1938 | /**  | 
                                                        
| 1939 | 1939 | * Get the count of items in the moderation queue  | 
                                                        
| 1940 | 1940 | */  | 
                                                        
| 1941 | 1941 |  function boincuser_moderation_queue_count($caller = 'user') { | 
                                                        
| 1942 | - $allowed = FALSE;  | 
                                                        |
| 1942 | + $allowed = false;  | 
                                                        |
| 1943 | 1943 |    switch ($caller) { | 
                                                        
| 1944 | 1944 | case 'cron':  | 
                                                        
| 1945 | - $allowed = TRUE;  | 
                                                        |
| 1945 | + $allowed = true;  | 
                                                        |
| 1946 | 1946 | break;  | 
                                                        
| 1947 | 1947 | case 'user':  | 
                                                        
| 1948 | 1948 | default:  | 
                                                        
@@ -1956,7 +1956,7 @@ discard block  | 
                                                    ||
| 1956 | 1956 | AND moderate = 1"  | 
                                                        
| 1957 | 1957 | ));  | 
                                                        
| 1958 | 1958 | }  | 
                                                        
| 1959 | - return NULL;  | 
                                                        |
| 1959 | + return null;  | 
                                                        |
| 1960 | 1960 | }  | 
                                                        
| 1961 | 1961 | |
| 1962 | 1962 | /**  | 
                                                        
@@ -1964,10 +1964,10 @@ discard block  | 
                                                    ||
| 1964 | 1964 | * Allow community membership status to be set for users by direct link rather  | 
                                                        
| 1965 | 1965 | * than through the user account info form.  | 
                                                        
| 1966 | 1966 | */  | 
                                                        
| 1967 | -function boincuser_control($uid = NULL, $action = NULL) { | 
                                                        |
| 1968 | -  if (!$uid OR !$account = user_load($uid)) { | 
                                                        |
| 1967 | +function boincuser_control($uid = null, $action = null) { | 
                                                        |
| 1968 | +  if (!$uid or !$account = user_load($uid)) { | 
                                                        |
| 1969 | 1969 | // What are you even doing here...  | 
                                                        
| 1970 | - return FALSE;  | 
                                                        |
| 1970 | + return false;  | 
                                                        |
| 1971 | 1971 | }  | 
                                                        
| 1972 | 1972 |    switch ($action) { | 
                                                        
| 1973 | 1973 | case 'ban':  | 
                                                        
@@ -2073,7 +2073,7 @@ discard block  | 
                                                    ||
| 2073 | 2073 | */  | 
                                                        
| 2074 | 2074 |  function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { | 
                                                        
| 2075 | 2075 |    if (user_access('assign community member role') | 
                                                        
| 2076 | -  OR user_access('assign all roles')) { | 
                                                        |
| 2076 | +  or user_access('assign all roles')) { | 
                                                        |
| 2077 | 2077 | $account = user_load($uid);  | 
                                                        
| 2078 | 2078 |      if ($account->uid) { | 
                                                        
| 2079 | 2079 |        module_load_include('inc', 'rules', 'modules/system.rules'); | 
                                                        
@@ -2153,7 +2153,7 @@ discard block  | 
                                                    ||
| 2153 | 2153 | * User profile image is managed by the content_profile module rather than core  | 
                                                        
| 2154 | 2154 | * Drupal User so must be inserted into comments, etc. (not so by default)  | 
                                                        
| 2155 | 2155 | */  | 
                                                        
| 2156 | -function boincuser_get_user_profile_image($uid, $avatar = TRUE) { | 
                                                        |
| 2156 | +function boincuser_get_user_profile_image($uid, $avatar = true) { | 
                                                        |
| 2157 | 2157 | // Though the function name implies otherwise, get the avatar by default  | 
                                                        
| 2158 | 2158 | $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';  | 
                                                        
| 2159 | 2159 |    $image_fid = db_result(db_query(" | 
                                                        
@@ -2166,7 +2166,7 @@ discard block  | 
                                                    ||
| 2166 | 2166 |    if (!$user_image['image']['filepath']) { | 
                                                        
| 2167 | 2167 | // Load the default image if one does not exist  | 
                                                        
| 2168 | 2168 | $account = user_load($uid);  | 
                                                        
| 2169 | -    if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { | 
                                                        |
| 2169 | +    if ($avatar and module_exists('gravatar') and user_access('use gravatar', $account) and $account->gravatar) { | 
                                                        |
| 2170 | 2170 | // Use a Gravatar rather than the system default image  | 
                                                        
| 2171 | 2171 | $options = array(  | 
                                                        
| 2172 | 2172 | 'size' => 100,  | 
                                                        
@@ -2194,23 +2194,23 @@ discard block  | 
                                                    ||
| 2194 | 2194 | * Generate a table of a user's projects  | 
                                                        
| 2195 | 2195 | */  | 
                                                        
| 2196 | 2196 |  function boincuser_get_projects_table($account = null) { | 
                                                        
| 2197 | -  if ($account AND is_numeric($account)) { | 
                                                        |
| 2197 | +  if ($account and is_numeric($account)) { | 
                                                        |
| 2198 | 2198 | $account = user_load($account);  | 
                                                        
| 2199 | 2199 | }  | 
                                                        
| 2200 | 2200 | $projects = boincuser_get_projects($account);  | 
                                                        
| 2201 | -  if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); | 
                                                        |
| 2201 | +  if (!$projects) return bts('no projects...', array(), null, 'boinc:account-dashboard'); | 
                                                        |
| 2202 | 2202 | |
| 2203 | 2203 | $output = '';  | 
                                                        
| 2204 | 2204 | $output .= '<table class="user-projects">' . "\n";  | 
                                                        
| 2205 | 2205 | $output .= '<thead>' . "\n";  | 
                                                        
| 2206 | 2206 | $output .= ' <tr>' . "\n";  | 
                                                        
| 2207 | -  $output .= '    <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; | 
                                                        |
| 2208 | -  $output .= '    <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; | 
                                                        |
| 2209 | -  $output .= '    <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; | 
                                                        |
| 2207 | +  $output .= '    <th>' . bts('Name', array(), null, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; | 
                                                        |
| 2208 | +  $output .= '    <th class="numeric">' . bts('Avg credit', array(), null, 'boinc:account-dashboard') . '</th>' . "\n"; | 
                                                        |
| 2209 | +  $output .= '    <th class="numeric">' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; | 
                                                        |
| 2210 | 2210 | $output .= ' </tr>' . "\n";  | 
                                                        
| 2211 | 2211 | $output .= '</thead>' . "\n";  | 
                                                        
| 2212 | 2212 | $output .= '<tbody>' . "\n";  | 
                                                        
| 2213 | -  foreach ($projects AS $project) { | 
                                                        |
| 2213 | +  foreach ($projects as $project) { | 
                                                        |
| 2214 | 2214 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;  | 
                                                        
| 2215 | 2215 | $output .= ' <tr>' . "\n";  | 
                                                        
| 2216 | 2216 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n";  | 
                                                        
@@ -2248,7 +2248,7 @@ discard block  | 
                                                    ||
| 2248 | 2248 |    if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { | 
                                                        
| 2249 | 2249 | return simplexml_load_string($result->data);  | 
                                                        
| 2250 | 2250 | }  | 
                                                        
| 2251 | - return NULL;  | 
                                                        |
| 2251 | + return null;  | 
                                                        |
| 2252 | 2252 | }  | 
                                                        
| 2253 | 2253 | |
| 2254 | 2254 | /**  | 
                                                        
@@ -2264,7 +2264,7 @@ discard block  | 
                                                    ||
| 2264 | 2264 | |
| 2265 | 2265 | $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);  | 
                                                        
| 2266 | 2266 | |
| 2267 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;  | 
                                                        |
| 2267 | + return ($account_stats and isset($account_stats->project)) ? $account_stats->project : null;  | 
                                                        |
| 2268 | 2268 | }  | 
                                                        
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2277,18 +2277,18 @@ discard block  | 
                                                    ||
| 2277 | 2277 |    $profile = content_profile_load('profile', $account->uid); | 
                                                        
| 2278 | 2278 | $output = '';  | 
                                                        
| 2279 | 2279 |    if ($profile) { | 
                                                        
| 2280 | - $profile_is_approved = ($profile->status AND !$profile->moderate);  | 
                                                        |
| 2280 | + $profile_is_approved = ($profile->status and !$profile->moderate);  | 
                                                        |
| 2281 | 2281 |      $user_is_moderator = user_access('edit any profile content'); | 
                                                        
| 2282 | 2282 | $is_own_profile = ($user->uid == $account->uid);  | 
                                                        
| 2283 | 2283 |      $profile_moderation_path = "moderate/profile/{$account->uid}"; | 
                                                        
| 2284 | 2284 | $links = array();  | 
                                                        
| 2285 | 2285 | |
| 2286 | -    if ($profile->moderate AND $user_is_moderator) { | 
                                                        |
| 2286 | +    if ($profile->moderate and $user_is_moderator) { | 
                                                        |
| 2287 | 2287 | $links['approve_profile'] = array(  | 
                                                        
| 2288 | -        'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2288 | +        'title' => bts('Approve profile', array(), null, 'boinc:moderate-user'), | 
                                                        |
| 2289 | 2289 |          'href' => "{$profile_moderation_path}/approve", | 
                                                        
| 2290 | 2290 | 'attributes' => array(  | 
                                                        
| 2291 | -          'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2291 | +          'title' => bts('Approve this profile content', array(), null, 'boinc:moderate-user'), | 
                                                        |
| 2292 | 2292 | 'class' => 'first primary tab',  | 
                                                        
| 2293 | 2293 | )  | 
                                                        
| 2294 | 2294 | );  | 
                                                        
@@ -2301,10 +2301,10 @@ discard block  | 
                                                    ||
| 2301 | 2301 | )  | 
                                                        
| 2302 | 2302 | );*/  | 
                                                        
| 2303 | 2303 | $links['reject_profile'] = array(  | 
                                                        
| 2304 | -        'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2304 | +        'title' => bts('Reject profile', array(), null, 'boinc:moderate-user'), | 
                                                        |
| 2305 | 2305 |          'href' => "{$profile_moderation_path}/reject", | 
                                                        
| 2306 | 2306 | 'attributes' => array(  | 
                                                        
| 2307 | -          'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), | 
                                                        |
| 2307 | +          'title' => bts('Reject this profile content', array(), null, 'boinc:moderate-user'), | 
                                                        |
| 2308 | 2308 | 'class' => 'tab',  | 
                                                        
| 2309 | 2309 | )  | 
                                                        
| 2310 | 2310 | );  | 
                                                        
@@ -2358,7 +2358,7 @@ discard block  | 
                                                    ||
| 2358 | 2358 |  function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { | 
                                                        
| 2359 | 2359 | |
| 2360 | 2360 |    foreach ($documents as $document) { | 
                                                        
| 2361 | -    if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { | 
                                                        |
| 2361 | +    if ( $document->entity_type=='node' and $document->bundle=='profile' ) { | 
                                                        |
| 2362 | 2362 | // Node information.  | 
                                                        
| 2363 | 2363 | $nid = $document->entity_id;  | 
                                                        
| 2364 | 2364 | $node = node_load($nid);  | 
                                                        
@@ -2412,7 +2412,7 @@ discard block  | 
                                                    ||
| 2412 | 2412 |      if ($recipient = user_load(array('uid' => $drupalid))) { | 
                                                        
| 2413 | 2413 | // Double-check that the loaded user matches both boincuser_id  | 
                                                        
| 2414 | 2414 | // and boincuser_name.  | 
                                                        
| 2415 | -      if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { | 
                                                        |
| 2415 | +      if ( ($boincid == $recipient->boincuser_id) and ($boincname == $recipient->boincuser_name) ) { | 
                                                        |
| 2416 | 2416 | return $recipient;  | 
                                                        
| 2417 | 2417 | }  | 
                                                        
| 2418 | 2418 | }  |