@@ -418,11 +418,9 @@ discard block |
||
418 | 418 | |
419 | 419 | if ($edit['boincuser_name']) { |
420 | 420 | $myname = $edit['boincuser_name']; |
421 | - } |
|
422 | - else if ($edit['name']) { |
|
421 | + } else if ($edit['name']) { |
|
423 | 422 | $myname = $edit['name']; |
424 | - } |
|
425 | - else { |
|
423 | + } else { |
|
426 | 424 | $myname = 'noname'; |
427 | 425 | } |
428 | 426 | |
@@ -434,8 +432,7 @@ discard block |
||
434 | 432 | // If the 'pass' variable is already a hash, then don't hash it again. |
435 | 433 | if ($edit['boinchash_flag']) { |
436 | 434 | $user_params['passwd_hash'] = $edit['pass']; |
437 | - } |
|
438 | - else { |
|
435 | + } else { |
|
439 | 436 | // The passwd_hash here is only the md5() hash. This is |
440 | 437 | // because BOINC make_user(), called later, will run |
441 | 438 | // password_hash() on this md5 hash. |
@@ -506,8 +503,7 @@ discard block |
||
506 | 503 | $prev_email = $account->mail; |
507 | 504 | $mytime = (user_access('administer users')) ? $boinc_user->email_addr_change_time : time(); |
508 | 505 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}', previous_email_addr = '{$prev_email}', email_addr_change_time = $mytime"; |
509 | - } |
|
510 | - else { |
|
506 | + } else { |
|
511 | 507 | $querypart = "email_addr='{$lower_email_addr}', passwd_hash='{$passwd_hash}'"; |
512 | 508 | } |
513 | 509 | |
@@ -750,8 +746,7 @@ discard block |
||
750 | 746 | case FLAG_FRIEND_APPROVAL: |
751 | 747 | if ($action == 'flag') { |
752 | 748 | $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
753 | - } |
|
754 | - elseif ($action == 'unflag') { |
|
749 | + } elseif ($action == 'unflag') { |
|
755 | 750 | unset($form['actions']); |
756 | 751 | $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
757 | 752 | } |
@@ -1527,8 +1522,7 @@ discard block |
||
1527 | 1522 | array( |
1528 | 1523 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1529 | 1524 | ), NULL, 'boinc:join-page') . '</li>'; |
1530 | - } |
|
1531 | - else { |
|
1525 | + } else { |
|
1532 | 1526 | $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
1533 | 1527 | 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.", |
1534 | 1528 | array( |
@@ -1563,8 +1557,7 @@ discard block |
||
1563 | 1557 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1564 | 1558 | '@sitename' => $site_name, |
1565 | 1559 | ), NULL, 'boinc:join-page') . '</li>'; |
1566 | - } |
|
1567 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
1560 | + } else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
1568 | 1561 | $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
1569 | 1562 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
1570 | 1563 | ), NULL, 'boinc:join-page') . '</li>'; |
@@ -1606,8 +1599,7 @@ discard block |
||
1606 | 1599 | )); |
1607 | 1600 | if ($current_uotd->uotd_time < strtotime('today midnight')) { |
1608 | 1601 | $uotd = boincuser_select_user_of_the_day(); |
1609 | - } |
|
1610 | - else { |
|
1602 | + } else { |
|
1611 | 1603 | $uotd = user_load($current_uotd->uid); |
1612 | 1604 | } |
1613 | 1605 | $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
@@ -1618,8 +1610,7 @@ discard block |
||
1618 | 1610 | $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
1619 | 1611 | if ($user->uid) { |
1620 | 1612 | $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1621 | - } |
|
1622 | - else { |
|
1613 | + } else { |
|
1623 | 1614 | $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1624 | 1615 | } |
1625 | 1616 | $output .= '</div>'; |
@@ -1704,12 +1695,10 @@ discard block |
||
1704 | 1695 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
1705 | 1696 | password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
1706 | 1697 | $output = array('authenticator' => $boinc_user->authenticator); |
1707 | - } |
|
1708 | - else { |
|
1698 | + } else { |
|
1709 | 1699 | xml_error(-137); |
1710 | 1700 | } |
1711 | - } |
|
1712 | - else { |
|
1701 | + } else { |
|
1713 | 1702 | // Verify that there isn't somehow a Drupal user already (not possible with proper function) |
1714 | 1703 | if ($existing_user = user_load(array('mail' => $params['email_addr']))) { |
1715 | 1704 | xml_error(-137, 'account error'); |
@@ -2193,7 +2182,9 @@ discard block |
||
2193 | 2182 | 'cpid' => $cpid |
2194 | 2183 | ); |
2195 | 2184 | $args = array(); |
2196 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2185 | + foreach ($get as $arg => $value) { |
|
2186 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
2187 | + } |
|
2197 | 2188 | $query = '?' . implode('&', $args); |
2198 | 2189 | |
2199 | 2190 | // Load XML from RPC |
@@ -2324,8 +2315,7 @@ discard block |
||
2324 | 2315 | if ($node->uid == 0 || strlen($node->name) == 0) { |
2325 | 2316 | // @see user_validate_name(). !'0' === TRUE. |
2326 | 2317 | $document->ss_name = '0'; |
2327 | - } |
|
2328 | - else { |
|
2318 | + } else { |
|
2329 | 2319 | $document->ss_name = $account->boincuser_name; |
2330 | 2320 | // We want the name to be searchable for keywords. |
2331 | 2321 | $document->tos_name = $account->boincuser_name; |
@@ -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 | |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | *(forward compatible to Drupal 7). |
583 | 583 | */ |
584 | 584 | function boincuser_user_login(&$edit, $account) { |
585 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
585 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); |
|
586 | 586 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
587 | 587 | |
588 | 588 | // Use the same code as boincuser_form_alter(), for case |
589 | 589 | // 'user_profile_form', if the refering page is the user password |
590 | 590 | // reset form, then do not check for terms of use. |
591 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
591 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === false) ? 0 : 1; |
|
592 | 592 | if ($reset_pass) { |
593 | 593 | return; |
594 | 594 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | |
737 | 737 | // General friend form overrides |
738 | 738 | $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
739 | - $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
739 | + $form['flag_friend_submit']['#value'] = bts('Send request', array(), null, 'boinc:friends-page'); |
|
740 | 740 | $form['flag_friend_submit']['#type'] = 'submit'; |
741 | 741 | $form['flag_friend_submit']['#suffix'] = '</li>'; |
742 | 742 | $form['flag_friend_submit']['#weight'] = 1002; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | case FLAG_FRIEND_BOTH: |
746 | 746 | case FLAG_FRIEND_FLAGGED: |
747 | 747 | unset($form['actions']); |
748 | - $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); |
|
748 | + $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), null, 'boinc:friends-remove'); |
|
749 | 749 | // Add in our hack handler to fix the flag_friend module |
750 | 750 | $final_handler = array_pop($form['#submit']); |
751 | 751 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit'; |
@@ -753,21 +753,21 @@ discard block |
||
753 | 753 | break; |
754 | 754 | case FLAG_FRIEND_PENDING: |
755 | 755 | unset($form['actions']); |
756 | - $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); |
|
756 | + $form['flag_friend_submit']['#value'] = bts('Remove request', array(), null, 'boinc:friends-page'); |
|
757 | 757 | break; |
758 | 758 | case FLAG_FRIEND_APPROVAL: |
759 | 759 | if ($action == 'flag') { |
760 | - $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
760 | + $form['flag_friend_submit']['#value'] = bts('Approve request', array(), null, 'boinc:friends-page'); |
|
761 | 761 | } |
762 | 762 | elseif ($action == 'unflag') { |
763 | 763 | unset($form['actions']); |
764 | - $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
764 | + $form['flag_friend_submit']['#value'] = bts('Deny request', array(), null, 'boinc:friends-page'); |
|
765 | 765 | } |
766 | 766 | break; |
767 | 767 | case FLAG_FRIEND_UNFLAGGED: |
768 | 768 | default: |
769 | 769 | $user_links[] = array( |
770 | - 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
770 | + 'title' => bts('Add as friend', array(), null, 'boinc:friends-add'), |
|
771 | 771 | 'href' => "flag/confirm/flag/friend/{$account->uid}" |
772 | 772 | ); |
773 | 773 | } |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } |
778 | 778 | |
779 | 779 | $form['cancel'] = array( |
780 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
780 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
781 | 781 | '#weight' => 1004, |
782 | 782 | ); |
783 | 783 | $form['form control tabs suffix'] = array( |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | '#weight' => 1001, |
801 | 801 | ); |
802 | 802 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
803 | - $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
803 | + $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
804 | 804 | $form['buttons']['submit']['#suffix'] = '</li>'; |
805 | 805 | $form['buttons']['submit']['#weight'] = 1002; |
806 | 806 | $form['buttons']['preview']['#prefix'] = '<li class="tab">'; |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
811 | 811 | $form['buttons']['preview_changes']['#weight'] = 1004; |
812 | 812 | $form['buttons']['cancel'] = array( |
813 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
813 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
814 | 814 | '#weight' => 1005, |
815 | 815 | ); |
816 | 816 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | '#weight' => 1001, |
839 | 839 | ); |
840 | 840 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
841 | - $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); |
|
841 | + $form['actions']['submit']['#value'] = bts('Delete', array(), null, 'boinc:form-delete'); |
|
842 | 842 | $form['actions']['submit']['#suffix'] = '</li>'; |
843 | 843 | $form['actions']['submit']['#weight'] = 1002; |
844 | 844 | $form['actions']['cancel'] = array( |
845 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
845 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
846 | 846 | '#weight' => 1005, |
847 | 847 | ); |
848 | 848 | $form['actions']['form control tabs suffix'] = array( |
@@ -862,14 +862,14 @@ discard block |
||
862 | 862 | '#weight' => 1001, |
863 | 863 | ); |
864 | 864 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">'; |
865 | - $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); |
|
865 | + $form['privatemsg']['submit']['#value'] = bts('Send message', array(), null, 'boinc:private-message'); |
|
866 | 866 | $form['privatemsg']['submit']['#suffix'] = '</li>'; |
867 | 867 | $form['privatemsg']['submit']['#weight'] = 1002; |
868 | 868 | $form['privatemsg']['preview']['#prefix'] = '<li class="tab">'; |
869 | 869 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
870 | 870 | $form['privatemsg']['preview']['#weight'] = 1003; |
871 | 871 | $form['privatemsg']['cancel'] = array( |
872 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
872 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
873 | 873 | '#weight' => 1004, |
874 | 874 | ); |
875 | 875 | $form['privatemsg']['form control tabs suffix'] = array( |
@@ -884,18 +884,18 @@ discard block |
||
884 | 884 | // Login form |
885 | 885 | case 'user_login': |
886 | 886 | case 'user_login_block': |
887 | - drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); |
|
887 | + drupal_set_title(bts('Login', array(), null, 'boinc:menu-link')); |
|
888 | 888 | // Replace name with email in login form |
889 | 889 | unset($form['name']); |
890 | 890 | array_unshift($form, array( |
891 | 891 | 'email' => array( |
892 | 892 | '#type' => 'textfield', |
893 | - '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
|
893 | + '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), |
|
894 | 894 | '#size' => ($form_id == 'user_login_block') ? 15 : 60, |
895 | 895 | '#maxlength' => EMAIL_MAX_LENGTH, |
896 | - '#required' => TRUE, |
|
896 | + '#required' => true, |
|
897 | 897 | '#attributes' => array('tabindex' => '1'), |
898 | - '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') |
|
898 | + '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:standard-login-page') |
|
899 | 899 | ), |
900 | 900 | 'validation_source' => array( |
901 | 901 | '#type' => 'hidden', |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | ); |
912 | 912 | $form['buttons']['submit'] = $form['submit']; |
913 | 913 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
914 | - $form['buttons']['submit']['#value'] = bts('Log in', array(), NULL, 'boinc:standard-login-page'); |
|
914 | + $form['buttons']['submit']['#value'] = bts('Log in', array(), null, 'boinc:standard-login-page'); |
|
915 | 915 | $form['buttons']['submit']['#suffix'] = '</li>'; |
916 | 916 | $form['buttons']['submit']['#weight'] = 1002; |
917 | 917 | $form['buttons']['form control tabs suffix'] = array( |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { |
928 | 928 | // Find the local validation function's entry so we can replace it. |
929 | 929 | $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
930 | - if ($array_key === FALSE) { |
|
930 | + if ($array_key === false) { |
|
931 | 931 | // Could not find it. Some other module must have run form_alter(). |
932 | 932 | // We will simply add our validation just before the final validator. |
933 | 933 | $final_validator = array_pop($form['#validate']); |
@@ -955,26 +955,26 @@ discard block |
||
955 | 955 | } |
956 | 956 | |
957 | 957 | // Set special message if user has not agreed to TOU |
958 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
958 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', false); |
|
959 | 959 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
960 | 960 | if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
961 | 961 | drupal_set_message( |
962 | 962 | 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.', |
963 | 963 | array( |
964 | 964 | '@project' => variable_get('site_name','Drupal-BOINC'), |
965 | - ), NULL, 'boinc:account-credentials-change') |
|
965 | + ), null, 'boinc:account-credentials-change') |
|
966 | 966 | , 'info'); |
967 | 967 | } |
968 | 968 | |
969 | 969 | // A bit hackish... but don't require the user to enter his password if |
970 | 970 | // coming from the password reset function |
971 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; |
|
971 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === false) ? 0 : 1; |
|
972 | 972 | if ($reset_pass) { |
973 | 973 | $_SESSION['reset_pass'] = 1; |
974 | 974 | } |
975 | 975 | |
976 | 976 | // Adjust form elements already present |
977 | - $form['account']['name']['#title'] = bts('Drupal Username', array(), NULL, 'boinc:drupal-username'); |
|
977 | + $form['account']['name']['#title'] = bts('Drupal Username', array(), null, 'boinc:drupal-username'); |
|
978 | 978 | $form['account']['name']['#size'] = 40; |
979 | 979 | $form['account']['name']['#attributes']['autocomplete'] = 'off'; |
980 | 980 | $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.'; |
@@ -985,11 +985,11 @@ discard block |
||
985 | 985 | // Add BOINC username (aka displayname) |
986 | 986 | $form['account']['boincuser_name'] = array( |
987 | 987 | '#type' => 'textfield', |
988 | - '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), |
|
988 | + '#title' => bts('BOINC Username', array(), null, 'boinc:user-or-team-name'), |
|
989 | 989 | '#default_value' => $account->boincuser_name, |
990 | 990 | '#maxlength' => USERNAME_MAX_LENGTH, |
991 | - '#required' => TRUE, |
|
992 | - '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), |
|
991 | + '#required' => true, |
|
992 | + '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), null, 'boinc:username-change'), |
|
993 | 993 | '#size' => 40, |
994 | 994 | ); |
995 | 995 | } |
@@ -998,23 +998,23 @@ discard block |
||
998 | 998 | // ago, it cannot be changed again. |
999 | 999 | $duration = TOKEN_DURATION_ONE_WEEK; |
1000 | 1000 | if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { |
1001 | - $form['account']['mail']['#required'] = FALSE; |
|
1001 | + $form['account']['mail']['#required'] = false; |
|
1002 | 1002 | $form['account']['mailhelp'] = array( |
1003 | 1003 | '#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.", |
1004 | 1004 | array( |
1005 | 1005 | '!prev_email' => $account->boincuser_previous_email_addr, |
1006 | 1006 | '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), |
1007 | - ), NULL, 'boinc:account-credentials-change'), |
|
1007 | + ), null, 'boinc:account-credentials-change'), |
|
1008 | 1008 | ); |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { |
|
1011 | + if (!$reset_pass and ($user->uid == $account->uid or !user_access('administer users'))) { |
|
1012 | 1012 | // Add a password authenticator, required to change email or pw |
1013 | 1013 | $form['account']['current_pass'] = array( |
1014 | 1014 | '#type' => 'password', |
1015 | - '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), |
|
1015 | + '#title' => bts('Enter your password to save changes', array(), null, 'boinc:account-credentials-change'), |
|
1016 | 1016 | '#description' => bts('Enter your current password if changing your email |
1017 | - address or password.', array(), NULL, 'boinc:account-credentials-change'), |
|
1017 | + address or password.', array(), null, 'boinc:account-credentials-change'), |
|
1018 | 1018 | '#size' => 17, |
1019 | 1019 | '#attributes' => array( |
1020 | 1020 | 'autocomplete' => 'off', |
@@ -1026,35 +1026,35 @@ discard block |
||
1026 | 1026 | $form['account']['boincuser_id'] = array( |
1027 | 1027 | '#value' => ' |
1028 | 1028 | <div class="form-item"> |
1029 | - <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1029 | + <label>' . bts('BOINC user ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
1030 | 1030 | <span>' . $account->boincuser_id . '</span> |
1031 | 1031 | </div>', |
1032 | 1032 | ); |
1033 | 1033 | $form['account']['user_id'] = array( |
1034 | 1034 | '#value' => ' |
1035 | 1035 | <div class="form-item"> |
1036 | - <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1036 | + <label>' . bts('Drupal user ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
1037 | 1037 | <span>' . $account->uid . '</span> |
1038 | 1038 | </div>', |
1039 | 1039 | ); |
1040 | 1040 | $form['account']['account_key'] = array( |
1041 | 1041 | '#value' => ' |
1042 | 1042 | <div class="form-item"> |
1043 | - <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1043 | + <label>' . bts('Account key', array(), null, 'boinc:account-credentials-change') . '</label> |
|
1044 | 1044 | <span>' . $account->boincuser_account_key . '</span> |
1045 | 1045 | </div>', |
1046 | 1046 | ); |
1047 | 1047 | $form['account']['weak_account_key'] = array( |
1048 | 1048 | '#value' => ' |
1049 | 1049 | <div class="form-item"> |
1050 | - <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1050 | + <label>' . bts('Weak account key', array(), null, 'boinc:account-credentials-change') . '</label> |
|
1051 | 1051 | <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
1052 | 1052 | </div>', |
1053 | 1053 | ); |
1054 | 1054 | $form['account']['cpid'] = array( |
1055 | 1055 | '#value' => ' |
1056 | 1056 | <div class="form-item"> |
1057 | - <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1057 | + <label>' . bts('Cross-project ID', array(), null, 'boinc:account-credentials-change') . '</label> |
|
1058 | 1058 | <span>' . $account->boincuser_cpid . '</span> |
1059 | 1059 | </div>', |
1060 | 1060 | ); |
@@ -1069,14 +1069,14 @@ discard block |
||
1069 | 1069 | '#weight' => 1001, |
1070 | 1070 | ); |
1071 | 1071 | $form['submit']['#prefix'] = '<li class="first tab">'; |
1072 | - $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
1072 | + $form['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
1073 | 1073 | $form['submit']['#suffix'] = '</li>'; |
1074 | 1074 | $form['submit']['#weight'] = 1002; |
1075 | 1075 | $form['cancel'] = array( |
1076 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1076 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1077 | 1077 | '#weight' => 1003, |
1078 | 1078 | ); |
1079 | - if (isset($form['delete']) AND is_array($form['delete'])) { |
|
1079 | + if (isset($form['delete']) and is_array($form['delete'])) { |
|
1080 | 1080 | $form['delete']['#prefix'] = '<li class="first alt tab">'; |
1081 | 1081 | $form['delete']['#suffix'] = '</li>'; |
1082 | 1082 | $form['delete']['#weight'] = 1004; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | // Set form['title'], but hide it |
1140 | 1140 | $form['title']['#default_value'] = $account->boincuser_name; |
1141 | - $form['title']['#access'] = FALSE; |
|
1141 | + $form['title']['#access'] = false; |
|
1142 | 1142 | |
1143 | 1143 | $form['separator_bottom'] = array( |
1144 | 1144 | '#value' => '<div class="separator buttons"></div>', |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | '#weight' => 1001, |
1160 | 1160 | ); |
1161 | 1161 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
1162 | - $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
|
1162 | + $form['buttons']['submit']['#value'] = bts('Save changes', array(), null, 'boinc:form-save'); |
|
1163 | 1163 | $form['buttons']['submit']['#suffix'] = '</li>'; |
1164 | 1164 | $form['buttons']['submit']['#weight'] = 1002; |
1165 | 1165 | $form['buttons']['preview']['#prefix'] = '<li class="tab">'; |
@@ -1169,12 +1169,12 @@ discard block |
||
1169 | 1169 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
1170 | 1170 | $form['buttons']['preview_changes']['#weight'] = 1004; |
1171 | 1171 | $form['buttons']['cancel'] = array( |
1172 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1172 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1173 | 1173 | '#weight' => 1005, |
1174 | 1174 | ); |
1175 | 1175 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
1176 | 1176 | $form['buttons']['delete']['#suffix'] = '</li>'; |
1177 | - $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), NULL, 'boinc:form-save'); |
|
1177 | + $form['buttons']['delete']['#value'] = bts('Clear User Profile', array(), null, 'boinc:form-save'); |
|
1178 | 1178 | $form['buttons']['delete']['#weight'] = 1006; |
1179 | 1179 | $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); |
1180 | 1180 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1208,11 +1208,11 @@ discard block |
||
1208 | 1208 | array_unshift($form, array( |
1209 | 1209 | 'boincuser_name' => array( |
1210 | 1210 | '#type' => 'textfield', |
1211 | - '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
1211 | + '#title' => bts('Name', array(), null, 'boinc:user-or-team-name'), |
|
1212 | 1212 | '#default_value' => $edit['boincuser_name'], |
1213 | 1213 | '#maxlength' => USERNAME_MAX_LENGTH, |
1214 | - '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), |
|
1215 | - '#required' => TRUE |
|
1214 | + '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), null, 'boinc:user-register'), |
|
1215 | + '#required' => true |
|
1216 | 1216 | ), |
1217 | 1217 | )); |
1218 | 1218 | // Set name temporarily to dummy value to beat validation |
@@ -1232,27 +1232,27 @@ discard block |
||
1232 | 1232 | '#type' => 'fieldset', |
1233 | 1233 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
1234 | 1234 | '#suffix' => '</div>', |
1235 | - '#tree' => TRUE, |
|
1235 | + '#tree' => true, |
|
1236 | 1236 | '#weight' => -15, |
1237 | 1237 | ); |
1238 | 1238 | |
1239 | 1239 | $form['termsofuse']['title1'] = array( |
1240 | 1240 | '#weight' => -12, |
1241 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
|
1241 | + '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), null, 'project:user-register' ) . '</h2>', |
|
1242 | 1242 | '#prefix' => '<div id="register-title1">', |
1243 | 1243 | '#suffix' => '</div>', |
1244 | 1244 | ); |
1245 | 1245 | |
1246 | 1246 | $form['termsofuse']['body'] = array( |
1247 | 1247 | '#weight' => -10, |
1248 | - '#value' => bts($termsofuse, array(), NULL, 'project:user-register'), |
|
1248 | + '#value' => bts($termsofuse, array(), null, 'project:user-register'), |
|
1249 | 1249 | '#prefix' => '<div id="register-termsofuse">', |
1250 | 1250 | '#suffix' => '</div>', |
1251 | 1251 | ); |
1252 | 1252 | |
1253 | 1253 | $form['termsofuse']['agreeTOU'] = array( |
1254 | 1254 | '#type' => 'checkbox', |
1255 | - '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), |
|
1255 | + '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), null, 'project:user-register'), |
|
1256 | 1256 | '#weight' => -8, |
1257 | 1257 | '#prefix' => '<div id="register-checkbox">', |
1258 | 1258 | '#suffix' => '</div>', |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | |
1262 | 1262 | $form['title2'] = array( |
1263 | 1263 | '#weight' => -6, |
1264 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
1264 | + '#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 | 1265 | '#prefix' => '<div id="register-title2">', |
1266 | 1266 | '#suffix' => '</div>', |
1267 | 1267 | ); |
@@ -1281,26 +1281,26 @@ discard block |
||
1281 | 1281 | |
1282 | 1282 | // Request new password form |
1283 | 1283 | case 'user_pass': |
1284 | - drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); |
|
1284 | + drupal_set_title(bts('Forgot password', array(), null, 'boinc:forgot-password')); |
|
1285 | 1285 | // Replace name/email text box with email only; retain "name" label |
1286 | 1286 | // for compatibility with standard Drupal submit function |
1287 | 1287 | unset($form['name']); |
1288 | 1288 | array_unshift($form, array( |
1289 | 1289 | 'name' => array( |
1290 | 1290 | '#type' => 'textfield', |
1291 | - '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
|
1291 | + '#title' => bts('Email address', array(), null, 'boinc:email-address-to-login'), |
|
1292 | 1292 | '#size' => 60, |
1293 | 1293 | '#maxlength' => EMAIL_MAX_LENGTH, |
1294 | - '#required' => TRUE, |
|
1294 | + '#required' => true, |
|
1295 | 1295 | '#description' => bts( |
1296 | 1296 | 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
1297 | 1297 | array( |
1298 | 1298 | '!authenticator_login' => l( |
1299 | - bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
1299 | + bts('authenticator-based login', array(), null, 'boinc:forgot-password'), |
|
1300 | 1300 | 'user/login/auth' |
1301 | 1301 | ) |
1302 | 1302 | ) |
1303 | - , NULL, 'boinc:forgot-password'), |
|
1303 | + , null, 'boinc:forgot-password'), |
|
1304 | 1304 | ), |
1305 | 1305 | )); |
1306 | 1306 | |
@@ -1311,11 +1311,11 @@ discard block |
||
1311 | 1311 | ); |
1312 | 1312 | $form['buttons']['submit'] = $form['submit']; |
1313 | 1313 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
1314 | - $form['buttons']['submit']['#value'] = bts('Send', array(), NULL, 'boinc:form-send'); |
|
1314 | + $form['buttons']['submit']['#value'] = bts('Send', array(), null, 'boinc:form-send'); |
|
1315 | 1315 | $form['buttons']['submit']['#suffix'] = '</li>'; |
1316 | 1316 | $form['buttons']['submit']['#weight'] = 1002; |
1317 | 1317 | $form['buttons']['cancel'] = array( |
1318 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1318 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1319 | 1319 | '#weight' => 1005, |
1320 | 1320 | ); |
1321 | 1321 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | break; |
1333 | 1333 | |
1334 | 1334 | case 'views_exposed_form': |
1335 | - $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); |
|
1335 | + $form['submit']['#value'] = bts('Search', array(), null, 'boinc:search-user'); |
|
1336 | 1336 | break; |
1337 | 1337 | } |
1338 | 1338 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | function boincuser_process_password_confirm($element) { |
1365 | 1365 | // Check if parent element is "account". |
1366 | 1366 | if ($element['#array_parents'][0] == 'account') { |
1367 | - $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); |
|
1367 | + $element['pass1']['#title'] = bts('Change password', array(), null, 'boinc:forgot-password'); |
|
1368 | 1368 | } |
1369 | 1369 | return $element; |
1370 | 1370 | } |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | /** |
1385 | 1385 | * Implementation of hook_token_values |
1386 | 1386 | */ |
1387 | -function boincuser_token_values($type, $object = NULL, $options = array()) { |
|
1387 | +function boincuser_token_values($type, $object = null, $options = array()) { |
|
1388 | 1388 | if ($type == 'user') { |
1389 | 1389 | $account = user_load($object->uid); |
1390 | 1390 | $tokens['display-name'] = $account->boincuser_name; |
@@ -1450,13 +1450,13 @@ discard block |
||
1450 | 1450 | require_boinc('boinc_db'); |
1451 | 1451 | $num_deleted = BoincUserDeleted::delete_expired(); |
1452 | 1452 | if ($num_deleted>0) { |
1453 | - watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
|
1453 | + watchdog('boincuser', "deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
|
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | // Delete expired tokens from token table |
1457 | 1457 | $tokens_deleted = BoincToken::delete_expired(); |
1458 | 1458 | if ($tokens_deleted>0) { |
1459 | - watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
|
1459 | + watchdog('boincuser', "deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
|
1460 | 1460 | } |
1461 | 1461 | } |
1462 | 1462 | |
@@ -1498,8 +1498,8 @@ discard block |
||
1498 | 1498 | if (!isset($account->roles[$verified_contributor])) { |
1499 | 1499 | drupal_set_message(bts( |
1500 | 1500 | 'You may only create or modify your user profile after earning @count credits.', |
1501 | - array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' |
|
1502 | - ), 'warning', FALSE); |
|
1501 | + array('@count' => $min_credit_to_post), null, 'boinc:view-profile' |
|
1502 | + ), 'warning', false); |
|
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | // For now, just call the user module profile view function |
@@ -1542,35 +1542,35 @@ discard block |
||
1542 | 1542 | if ($registration_enabled) { |
1543 | 1543 | $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
1544 | 1544 | array( |
1545 | - '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
|
1545 | + '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), |
|
1546 | 1546 | '@sitename' => $site_name, |
1547 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1547 | + ), null, 'boinc:join-page') . '</li>'; |
|
1548 | 1548 | } |
1549 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
1549 | + $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), null, 'boinc:join-page') . '</li>'; |
|
1550 | 1550 | $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
1551 | 1551 | array( |
1552 | 1552 | '@sitename' => $site_name, |
1553 | 1553 | '@siteurl' => $base_url, |
1554 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1554 | + ), null, 'boinc:join-page') . '</li>'; |
|
1555 | 1555 | if ($registration_enabled) { |
1556 | 1556 | $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.", |
1557 | 1557 | array( |
1558 | 1558 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1559 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1559 | + ), null, 'boinc:join-page') . '</li>'; |
|
1560 | 1560 | } |
1561 | 1561 | else { |
1562 | 1562 | $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
1563 | 1563 | 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.", |
1564 | 1564 | array( |
1565 | 1565 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1566 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1566 | + ), null, 'boinc:join-page') . '</li>'; |
|
1567 | 1567 | } |
1568 | 1568 | $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
1569 | 1569 | upgrade to a more recent version of BOINC to create an account |
1570 | 1570 | at @this_project.", |
1571 | 1571 | array( |
1572 | 1572 | '@this_project' => $site_name, |
1573 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1573 | + ), null, 'boinc:join-page') . '</li>'; |
|
1574 | 1574 | $output .= '</ol>'; |
1575 | 1575 | break; |
1576 | 1576 | case 'new': |
@@ -1590,26 +1590,26 @@ discard block |
||
1590 | 1590 | if ($registration_enabled) { |
1591 | 1591 | $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
1592 | 1592 | array( |
1593 | - '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
|
1593 | + '!create_an_account' => l(bts('create an account', array(), null, 'boinc:join-page'), 'user/registration'), |
|
1594 | 1594 | '@sitename' => $site_name, |
1595 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1595 | + ), null, 'boinc:join-page') . '</li>'; |
|
1596 | 1596 | } |
1597 | 1597 | else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
1598 | 1598 | $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
1599 | - '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
|
1600 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1599 | + '!rules_and_policies' => l(bts('Rules and Policies', array(), null, 'boinc:join-page'), $ruleslink), |
|
1600 | + ), null, 'boinc:join-page') . '</li>'; |
|
1601 | 1601 | } |
1602 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1602 | + $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), null, 'boinc:join-page'); |
|
1603 | 1603 | $output .= ' <p>'; |
1604 | 1604 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
1605 | 1605 | $output .= ' </p>'; |
1606 | - $output .= ' ' . bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page'); |
|
1606 | + $output .= ' ' . bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), null, 'boinc:join-page'); |
|
1607 | 1607 | $output .= ' </li>'; |
1608 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
1608 | + $output .= ' <li>' . bts('Run the installer.', array(), null, 'boinc:join-page') . '</li>'; |
|
1609 | 1609 | $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
1610 | 1610 | '@sitename' => $site_name, |
1611 | 1611 | '@siteurl' => $base_url, |
1612 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1612 | + ), null, 'boinc:join-page') . '</li>'; |
|
1613 | 1613 | $output .= '</ol>'; |
1614 | 1614 | } |
1615 | 1615 | $output .= '</div>'; |
@@ -1640,17 +1640,17 @@ discard block |
||
1640 | 1640 | else { |
1641 | 1641 | $uotd = user_load($current_uotd->uid); |
1642 | 1642 | } |
1643 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
1643 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, false); |
|
1644 | 1644 | $output = '<h2 class="pane-title">'; |
1645 | - $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')); |
|
1645 | + $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')); |
|
1646 | 1646 | $output .= '</h2>'; |
1647 | 1647 | $output .= '<div class="boinc-overview balance-height-front">'; |
1648 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1648 | + $output .= ' <div>' . bts($site_message, array(), null, "project:front page") . ' ' . l(bts('Learn more', array(), null, 'boinc:front-page'), 'about') . '</div>'; |
|
1649 | 1649 | if ($user->uid) { |
1650 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1650 | + $output .= ' <div>' . l(bts('View account', array(), null, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1651 | 1651 | } |
1652 | 1652 | else { |
1653 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1653 | + $output .= ' <div>' . l(bts('Join now', array(), null, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1654 | 1654 | } |
1655 | 1655 | $output .= '</div>'; |
1656 | 1656 | $output .= '<div class="boinc-overview-details">'; |
@@ -1658,17 +1658,17 @@ discard block |
||
1658 | 1658 | $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
1659 | 1659 | $output .= ' <div class="picture">'; |
1660 | 1660 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
1661 | - $uotd_image['alt'], array(), FALSE); |
|
1661 | + $uotd_image['alt'], array(), false); |
|
1662 | 1662 | $output .= ' </div>'; |
1663 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1663 | + $output .= ' <div class="text">' . bts('User of the day', array(), null, 'boinc:front-page') . '</div>'; |
|
1664 | 1664 | $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
1665 | 1665 | $output .= ' </a>'; |
1666 | 1666 | $output .= ' <div class="volunteers">'; |
1667 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1667 | + $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), null, 'boinc:front-page') . '</div>'; |
|
1668 | 1668 | $output .= ' <div class="platforms">'; |
1669 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1670 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1671 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1669 | + $output .= ' <div class="detail platform windows">' . bts('Windows', array(), null, 'boinc:front-page') . '</div>'; |
|
1670 | + $output .= ' <div class="detail platform mac">' . bts('Mac', array(), null, 'boinc:front-page') . '</div>'; |
|
1671 | + $output .= ' <div class="detail platform linux">' . bts('Linux', array(), null, 'boinc:front-page') . '</div>'; |
|
1672 | 1672 | $output .= ' </div>'; |
1673 | 1673 | $output .= ' </div>'; |
1674 | 1674 | $output .= ' </div>'; |
@@ -1696,12 +1696,12 @@ discard block |
||
1696 | 1696 | xml_header(); |
1697 | 1697 | |
1698 | 1698 | // Account creation disabled |
1699 | - $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
1699 | + $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', true); |
|
1700 | 1700 | if (!$enablethisRPC) { |
1701 | 1701 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
1702 | 1702 | '@url' => $base_url . '/user/registration', |
1703 | 1703 | ), |
1704 | - NULL, 'boinc:create_account'); |
|
1704 | + null, 'boinc:create_account'); |
|
1705 | 1705 | xml_error(-208, $mess); |
1706 | 1706 | } |
1707 | 1707 | // Invalid invite code |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | 'init' => $params['email_addr'], |
1756 | 1756 | 'roles' => array($unrestricted_role => ''), |
1757 | 1757 | 'boincuser_name' => $params['user_name'], |
1758 | - 'boinchash_flag' => TRUE, |
|
1758 | + 'boinchash_flag' => true, |
|
1759 | 1759 | ); |
1760 | 1760 | |
1761 | 1761 | // Create the drupal user. If the drupal user cannot be created, |
@@ -1792,20 +1792,20 @@ discard block |
||
1792 | 1792 | } |
1793 | 1793 | |
1794 | 1794 | if (strlen($authtoken) != 32) { |
1795 | - drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
|
1795 | + drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); |
|
1796 | 1796 | drupal_goto(); |
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | require_boinc('boinc_db'); |
1800 | 1800 | $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
1801 | 1801 | if (!$boinc_user) { |
1802 | - drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
|
1802 | + drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), null, 'boinc:account-finish'), 'error'); |
|
1803 | 1803 | drupal_goto(); |
1804 | 1804 | } |
1805 | 1805 | $user = user_load(get_drupal_id($boinc_user->id)); |
1806 | 1806 | |
1807 | 1807 | if (!$user) { |
1808 | - 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'); |
|
1808 | + 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'); |
|
1809 | 1809 | drupal_goto(); |
1810 | 1810 | } |
1811 | 1811 | |
@@ -1826,9 +1826,9 @@ discard block |
||
1826 | 1826 | // Check moderation page exists |
1827 | 1827 | $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
1828 | 1828 | if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
1829 | - $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'); |
|
1829 | + $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'); |
|
1830 | 1830 | } else { |
1831 | - $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
|
1831 | + $modsentence = bts('Please note: user profiles are subject to moderation.', array(), null, 'boinc:account-finish'); |
|
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | $username = $user->boincuser_name; |
@@ -1837,73 +1837,73 @@ discard block |
||
1837 | 1837 | array( |
1838 | 1838 | '@user_name' => $username, |
1839 | 1839 | '@site_name' => $site_name, |
1840 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
1840 | + ), null, 'boinc:account-finish') . "</p>"; |
|
1841 | 1841 | |
1842 | 1842 | $links = array( |
1843 | 1843 | array( |
1844 | 1844 | 'data' => bts('Change your username at !community_preferences.', array( |
1845 | - '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
|
1846 | - ), NULL, 'boinc:account-finish'), |
|
1845 | + '!community_preferences' => l(bts('Community Preferences', array(), null, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
|
1846 | + ), null, 'boinc:account-finish'), |
|
1847 | 1847 | 'children' => array( |
1848 | - bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), |
|
1849 | - bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), |
|
1848 | + bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), null, 'boinc:account-finish'), |
|
1849 | + bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), null, 'boinc:account-finish'), |
|
1850 | 1850 | ), |
1851 | 1851 | ), |
1852 | 1852 | array( |
1853 | 1853 | 'data' => bts('Change your !computing_preferences.', array( |
1854 | - '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), |
|
1855 | - ), NULL, 'boinc:account-finish'), |
|
1854 | + '!computing_preferences' => l(bts('Computing Preferences', array(), null, 'boinc:account-finish'), 'account/prefs', $options), |
|
1855 | + ), null, 'boinc:account-finish'), |
|
1856 | 1856 | 'children' => array( |
1857 | - 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'), |
|
1857 | + 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'), |
|
1858 | 1858 | bts('By default, you will run @site_name tasks without any additional configuration.', array( |
1859 | 1859 | '@site_name' => $site_name, |
1860 | - ), NULL, 'boinc:account-finish'), |
|
1860 | + ), null, 'boinc:account-finish'), |
|
1861 | 1861 | 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( |
1862 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
1863 | - ), NULL, 'boinc:account-finish'), |
|
1862 | + '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options), |
|
1863 | + ), null, 'boinc:account-finish'), |
|
1864 | 1864 | ), |
1865 | 1865 | ), |
1866 | 1866 | array( |
1867 | 1867 | 'data' => bts('Create a !user_profile.', array( |
1868 | - '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
1869 | - ), NULL, 'boinc:account-finish'), |
|
1868 | + '!user_profile' => l(bts('User Profile', array(), null, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
1869 | + ), null, 'boinc:account-finish'), |
|
1870 | 1870 | 'children' => array( |
1871 | 1871 | bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( |
1872 | 1872 | '@site_name' => $site_name, |
1873 | - ), NULL, 'boinc:account-finish'), |
|
1873 | + ), null, 'boinc:account-finish'), |
|
1874 | 1874 | $modsentence, |
1875 | 1875 | ), |
1876 | 1876 | ), |
1877 | 1877 | array( |
1878 | 1878 | 'data' => bts('Join a !team.', array( |
1879 | - '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), |
|
1880 | - ), NULL, 'boinc:account-finish'), |
|
1879 | + '!team' => l(bts('Team', array(), null, 'boinc:account-finish'), '/community/teams', $options), |
|
1880 | + ), null, 'boinc:account-finish'), |
|
1881 | 1881 | 'children' => array( |
1882 | - bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), |
|
1882 | + bts('You may join a team, made up of other volunteers.', array(), null, 'boinc:account-finish'), |
|
1883 | 1883 | ), |
1884 | 1884 | ), |
1885 | 1885 | array( |
1886 | 1886 | 'data' => bts('Go to your !account_dashboard.', array( |
1887 | - '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), |
|
1888 | - ), NULL, 'boinc:account-finish'), |
|
1887 | + '!account_dashboard'=> l(bts('Account Dashboard', array(), null, 'boinc:account-finish'), 'account/dashboard', $options), |
|
1888 | + ), null, 'boinc:account-finish'), |
|
1889 | 1889 | 'children' => array( |
1890 | - bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), |
|
1890 | + bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), null, 'boinc:account-finish'), |
|
1891 | 1891 | ), |
1892 | 1892 | ), |
1893 | 1893 | array( |
1894 | 1894 | 'data' => bts('Visit our !help pages.', array( |
1895 | - '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) |
|
1896 | - ), NULL, 'boinc:account-finish'), |
|
1895 | + '!help' => l(bts('Help', array(), null, 'boinc:account-finish'), '/help', $options) |
|
1896 | + ), null, 'boinc:account-finish'), |
|
1897 | 1897 | 'children' => array( |
1898 | 1898 | bts('Ask for help in our community\'s !forums.', array( |
1899 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
1900 | - ), NULL, 'boinc:account-finish'), |
|
1899 | + '!forums' => l(bts('forums', array(), null, 'boinc:account-finish'), 'community/forum', $options) |
|
1900 | + ), null, 'boinc:account-finish'), |
|
1901 | 1901 | ), |
1902 | 1902 | ), |
1903 | 1903 | ); |
1904 | 1904 | |
1905 | 1905 | //List of links |
1906 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1906 | + $output .= theme_item_list($links, $title = null, $type='ul'); |
|
1907 | 1907 | |
1908 | 1908 | return $output; |
1909 | 1909 | } |
@@ -1913,20 +1913,20 @@ discard block |
||
1913 | 1913 | */ |
1914 | 1914 | function boincuser_moderate_community_access() { |
1915 | 1915 | if (user_access('assign community member role') |
1916 | - OR user_access('assign all roles')) { |
|
1917 | - return TRUE; |
|
1916 | + or user_access('assign all roles')) { |
|
1917 | + return true; |
|
1918 | 1918 | } |
1919 | - return FALSE; |
|
1919 | + return false; |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | 1922 | /** |
1923 | 1923 | * Get the count of items in the moderation queue |
1924 | 1924 | */ |
1925 | 1925 | function boincuser_moderation_queue_count($caller = 'user') { |
1926 | - $allowed = FALSE; |
|
1926 | + $allowed = false; |
|
1927 | 1927 | switch ($caller) { |
1928 | 1928 | case 'cron': |
1929 | - $allowed = TRUE; |
|
1929 | + $allowed = true; |
|
1930 | 1930 | break; |
1931 | 1931 | case 'user': |
1932 | 1932 | default: |
@@ -1940,7 +1940,7 @@ discard block |
||
1940 | 1940 | AND moderate = 1" |
1941 | 1941 | )); |
1942 | 1942 | } |
1943 | - return NULL; |
|
1943 | + return null; |
|
1944 | 1944 | } |
1945 | 1945 | |
1946 | 1946 | /** |
@@ -1948,10 +1948,10 @@ discard block |
||
1948 | 1948 | * Allow community membership status to be set for users by direct link rather |
1949 | 1949 | * than through the user account info form. |
1950 | 1950 | */ |
1951 | -function boincuser_control($uid = NULL, $action = NULL) { |
|
1952 | - if (!$uid OR !$account = user_load($uid)) { |
|
1951 | +function boincuser_control($uid = null, $action = null) { |
|
1952 | + if (!$uid or !$account = user_load($uid)) { |
|
1953 | 1953 | // What are you even doing here... |
1954 | - return FALSE; |
|
1954 | + return false; |
|
1955 | 1955 | } |
1956 | 1956 | switch ($action) { |
1957 | 1957 | case 'ban': |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | */ |
2058 | 2058 | function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { |
2059 | 2059 | if (user_access('assign community member role') |
2060 | - OR user_access('assign all roles')) { |
|
2060 | + or user_access('assign all roles')) { |
|
2061 | 2061 | $account = user_load($uid); |
2062 | 2062 | if ($account->uid) { |
2063 | 2063 | module_load_include('inc', 'rules', 'modules/system.rules'); |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | * User profile image is managed by the content_profile module rather than core |
2138 | 2138 | * Drupal User so must be inserted into comments, etc. (not so by default) |
2139 | 2139 | */ |
2140 | -function boincuser_get_user_profile_image($uid, $avatar = TRUE) { |
|
2140 | +function boincuser_get_user_profile_image($uid, $avatar = true) { |
|
2141 | 2141 | // Though the function name implies otherwise, get the avatar by default |
2142 | 2142 | $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
2143 | 2143 | $image_fid = db_result(db_query(" |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | if (!$user_image['image']['filepath']) { |
2151 | 2151 | // Load the default image if one does not exist |
2152 | 2152 | $account = user_load($uid); |
2153 | - if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { |
|
2153 | + if ($avatar and module_exists('gravatar') and user_access('use gravatar', $account) and $account->gravatar) { |
|
2154 | 2154 | // Use a Gravatar rather than the system default image |
2155 | 2155 | $options = array( |
2156 | 2156 | 'size' => 100, |
@@ -2178,23 +2178,23 @@ discard block |
||
2178 | 2178 | * Generate a table of a user's projects |
2179 | 2179 | */ |
2180 | 2180 | function boincuser_get_projects_table($account = null) { |
2181 | - if ($account AND is_numeric($account)) { |
|
2181 | + if ($account and is_numeric($account)) { |
|
2182 | 2182 | $account = user_load($account); |
2183 | 2183 | } |
2184 | 2184 | $projects = boincuser_get_projects($account); |
2185 | - if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
2185 | + if (!$projects) return bts('no projects...', array(), null, 'boinc:account-dashboard'); |
|
2186 | 2186 | |
2187 | 2187 | $output = ''; |
2188 | 2188 | $output .= '<table class="user-projects">' . "\n"; |
2189 | 2189 | $output .= '<thead>' . "\n"; |
2190 | 2190 | $output .= ' <tr>' . "\n"; |
2191 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2192 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2193 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2191 | + $output .= ' <th>' . bts('Name', array(), null, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2192 | + $output .= ' <th class="numeric">' . bts('Avg credit', array(), null, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2193 | + $output .= ' <th class="numeric">' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2194 | 2194 | $output .= ' </tr>' . "\n"; |
2195 | 2195 | $output .= '</thead>' . "\n"; |
2196 | 2196 | $output .= '<tbody>' . "\n"; |
2197 | - foreach ($projects AS $project) { |
|
2197 | + foreach ($projects as $project) { |
|
2198 | 2198 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
2199 | 2199 | $output .= ' <tr>' . "\n"; |
2200 | 2200 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
@@ -2232,7 +2232,7 @@ discard block |
||
2232 | 2232 | if (in_array($result->code, array(200, 304))) { |
2233 | 2233 | return simplexml_load_string($result->data); |
2234 | 2234 | } |
2235 | - return NULL; |
|
2235 | + return null; |
|
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | /** |
@@ -2248,7 +2248,7 @@ discard block |
||
2248 | 2248 | |
2249 | 2249 | $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
2250 | 2250 | |
2251 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
2251 | + return ($account_stats and isset($account_stats->project)) ? $account_stats->project : null; |
|
2252 | 2252 | } |
2253 | 2253 | |
2254 | 2254 | |
@@ -2261,18 +2261,18 @@ discard block |
||
2261 | 2261 | $profile = content_profile_load('profile', $account->uid); |
2262 | 2262 | $output = ''; |
2263 | 2263 | if ($profile) { |
2264 | - $profile_is_approved = ($profile->status AND !$profile->moderate); |
|
2264 | + $profile_is_approved = ($profile->status and !$profile->moderate); |
|
2265 | 2265 | $user_is_moderator = user_access('edit any profile content'); |
2266 | 2266 | $is_own_profile = ($user->uid == $account->uid); |
2267 | 2267 | $profile_moderation_path = "moderate/profile/{$account->uid}"; |
2268 | 2268 | $links = array(); |
2269 | 2269 | |
2270 | - if ($profile->moderate AND $user_is_moderator) { |
|
2270 | + if ($profile->moderate and $user_is_moderator) { |
|
2271 | 2271 | $links['approve_profile'] = array( |
2272 | - 'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), |
|
2272 | + 'title' => bts('Approve profile', array(), null, 'boinc:moderate-user'), |
|
2273 | 2273 | 'href' => "{$profile_moderation_path}/approve", |
2274 | 2274 | 'attributes' => array( |
2275 | - 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2275 | + 'title' => bts('Approve this profile content', array(), null, 'boinc:moderate-user'), |
|
2276 | 2276 | 'class' => 'first primary tab', |
2277 | 2277 | ) |
2278 | 2278 | ); |
@@ -2285,10 +2285,10 @@ discard block |
||
2285 | 2285 | ) |
2286 | 2286 | );*/ |
2287 | 2287 | $links['reject_profile'] = array( |
2288 | - 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
|
2288 | + 'title' => bts('Reject profile', array(), null, 'boinc:moderate-user'), |
|
2289 | 2289 | 'href' => "{$profile_moderation_path}/reject", |
2290 | 2290 | 'attributes' => array( |
2291 | - 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2291 | + 'title' => bts('Reject this profile content', array(), null, 'boinc:moderate-user'), |
|
2292 | 2292 | 'class' => 'tab', |
2293 | 2293 | ) |
2294 | 2294 | ); |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
2343 | 2343 | |
2344 | 2344 | foreach ($documents as $document) { |
2345 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
2345 | + if ( $document->entity_type=='node' and $document->bundle=='profile' ) { |
|
2346 | 2346 | // Node information. |
2347 | 2347 | $nid = $document->entity_id; |
2348 | 2348 | $node = node_load($nid); |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | if ($recipient = user_load(array('uid' => $drupalid))) { |
2397 | 2397 | // Double-check that the loaded user matches both boincuser_id |
2398 | 2398 | // and boincuser_name. |
2399 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2399 | + if ( ($boincid == $recipient->boincuser_id) and ($boincname == $recipient->boincuser_name) ) { |
|
2400 | 2400 | return $recipient; |
2401 | 2401 | } |
2402 | 2402 | } |
@@ -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 |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | } |
595 | 595 | |
596 | 596 | // Check if user has agreed to terms of use. |
597 | - if ( (!empty($termsofuse)) and ($account->uid) and |
|
598 | - (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { |
|
597 | + if ((!empty($termsofuse)) and ($account->uid) and |
|
598 | + (!boincuser_check_termsofuse($account)) and ($existinguser_tou)) { |
|
599 | 599 | |
600 | 600 | // Admins are exempted. |
601 | 601 | $administrator_role = array_search('administrator', user_roles(true)); |
@@ -609,9 +609,9 @@ discard block |
||
609 | 609 | $query_for_destination = ''; |
610 | 610 | $prevdest = $_REQUEST['destination']; |
611 | 611 | if ($prevdest) { |
612 | - $query_for_destination = '?destination=' . $prevdest; |
|
612 | + $query_for_destination = '?destination='.$prevdest; |
|
613 | 613 | } |
614 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
614 | + $_REQUEST['destination'] = $path_for_destination.$query_for_destination; |
|
615 | 615 | |
616 | 616 | } |
617 | 617 | } |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | // In Drupal 7, these operation cases will all exist as their own hooks, |
645 | 645 | // so let's approximate that here so that this function can simply be removed |
646 | 646 | // upon migration to 7 |
647 | - switch($op) { |
|
647 | + switch ($op) { |
|
648 | 648 | case 'update': |
649 | 649 | boincuser_node_update($node); |
650 | 650 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * is updated (forward compatible to Drupal 7) |
656 | 656 | */ |
657 | 657 | function boincuser_node_update($node) { |
658 | - switch($node->type) { |
|
658 | + switch ($node->type) { |
|
659 | 659 | case 'profile': |
660 | 660 | // Update the BOINC database directly |
661 | 661 | $account = user_load($node->uid); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } |
778 | 778 | |
779 | 779 | $form['cancel'] = array( |
780 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
780 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest).'</li>', |
|
781 | 781 | '#weight' => 1004, |
782 | 782 | ); |
783 | 783 | $form['form control tabs suffix'] = array( |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
811 | 811 | $form['buttons']['preview_changes']['#weight'] = 1004; |
812 | 812 | $form['buttons']['cancel'] = array( |
813 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
813 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
814 | 814 | '#weight' => 1005, |
815 | 815 | ); |
816 | 816 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | $form['actions']['submit']['#suffix'] = '</li>'; |
843 | 843 | $form['actions']['submit']['#weight'] = 1002; |
844 | 844 | $form['actions']['cancel'] = array( |
845 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
845 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
846 | 846 | '#weight' => 1005, |
847 | 847 | ); |
848 | 848 | $form['actions']['form control tabs suffix'] = array( |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
870 | 870 | $form['privatemsg']['preview']['#weight'] = 1003; |
871 | 871 | $form['privatemsg']['cancel'] = array( |
872 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
872 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
873 | 873 | '#weight' => 1004, |
874 | 874 | ); |
875 | 875 | $form['privatemsg']['form control tabs suffix'] = array( |
@@ -957,11 +957,11 @@ discard block |
||
957 | 957 | // Set special message if user has not agreed to TOU |
958 | 958 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
959 | 959 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
960 | - if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
|
960 | + if ((!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users'))) { |
|
961 | 961 | drupal_set_message( |
962 | 962 | 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.', |
963 | 963 | array( |
964 | - '@project' => variable_get('site_name','Drupal-BOINC'), |
|
964 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
965 | 965 | ), NULL, 'boinc:account-credentials-change') |
966 | 966 | , 'info'); |
967 | 967 | } |
@@ -1026,36 +1026,36 @@ discard block |
||
1026 | 1026 | $form['account']['boincuser_id'] = array( |
1027 | 1027 | '#value' => ' |
1028 | 1028 | <div class="form-item"> |
1029 | - <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1030 | - <span>' . $account->boincuser_id . '</span> |
|
1029 | + <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1030 | + <span>' . $account->boincuser_id.'</span> |
|
1031 | 1031 | </div>', |
1032 | 1032 | ); |
1033 | 1033 | $form['account']['user_id'] = array( |
1034 | 1034 | '#value' => ' |
1035 | 1035 | <div class="form-item"> |
1036 | - <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1037 | - <span>' . $account->uid . '</span> |
|
1036 | + <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1037 | + <span>' . $account->uid.'</span> |
|
1038 | 1038 | </div>', |
1039 | 1039 | ); |
1040 | 1040 | $form['account']['account_key'] = array( |
1041 | 1041 | '#value' => ' |
1042 | 1042 | <div class="form-item"> |
1043 | - <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1044 | - <span>' . $account->boincuser_account_key . '</span> |
|
1043 | + <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1044 | + <span>' . $account->boincuser_account_key.'</span> |
|
1045 | 1045 | </div>', |
1046 | 1046 | ); |
1047 | 1047 | $form['account']['weak_account_key'] = array( |
1048 | 1048 | '#value' => ' |
1049 | 1049 | <div class="form-item"> |
1050 | - <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1051 | - <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
|
1050 | + <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1051 | + <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span> |
|
1052 | 1052 | </div>', |
1053 | 1053 | ); |
1054 | 1054 | $form['account']['cpid'] = array( |
1055 | 1055 | '#value' => ' |
1056 | 1056 | <div class="form-item"> |
1057 | - <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1058 | - <span>' . $account->boincuser_cpid . '</span> |
|
1057 | + <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1058 | + <span>' . $account->boincuser_cpid.'</span> |
|
1059 | 1059 | </div>', |
1060 | 1060 | ); |
1061 | 1061 | |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | $form['submit']['#suffix'] = '</li>'; |
1074 | 1074 | $form['submit']['#weight'] = 1002; |
1075 | 1075 | $form['cancel'] = array( |
1076 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1076 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
1077 | 1077 | '#weight' => 1003, |
1078 | 1078 | ); |
1079 | 1079 | if (isset($form['delete']) AND is_array($form['delete'])) { |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
1170 | 1170 | $form['buttons']['preview_changes']['#weight'] = 1004; |
1171 | 1171 | $form['buttons']['cancel'] = array( |
1172 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1172 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
1173 | 1173 | '#weight' => 1005, |
1174 | 1174 | ); |
1175 | 1175 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -1218,11 +1218,11 @@ discard block |
||
1218 | 1218 | // Set name temporarily to dummy value to beat validation |
1219 | 1219 | $form['name'] = array( |
1220 | 1220 | '#type' => 'hidden', |
1221 | - '#value' => rand() . '.' . time() |
|
1221 | + '#value' => rand().'.'.time() |
|
1222 | 1222 | ); |
1223 | 1223 | |
1224 | 1224 | // Add JS for submit button disabling |
1225 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
1225 | + drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); |
|
1226 | 1226 | |
1227 | 1227 | // Terms of use section |
1228 | 1228 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | $form['termsofuse']['title1'] = array( |
1240 | 1240 | '#weight' => -12, |
1241 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
|
1241 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register').'</h2>', |
|
1242 | 1242 | '#prefix' => '<div id="register-title1">', |
1243 | 1243 | '#suffix' => '</div>', |
1244 | 1244 | ); |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | |
1262 | 1262 | $form['title2'] = array( |
1263 | 1263 | '#weight' => -6, |
1264 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
1264 | + '#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 | 1265 | '#prefix' => '<div id="register-title2">', |
1266 | 1266 | '#suffix' => '</div>', |
1267 | 1267 | ); |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | $form['buttons']['submit']['#suffix'] = '</li>'; |
1324 | 1324 | $form['buttons']['submit']['#weight'] = 1002; |
1325 | 1325 | $form['buttons']['cancel'] = array( |
1326 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1326 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login').'</li>', |
|
1327 | 1327 | '#weight' => 1005, |
1328 | 1328 | ); |
1329 | 1329 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | */ |
1406 | 1406 | function boincuser_token_list($type = 'all') { |
1407 | 1407 | if ($type == 'user' || $type == 'all') { |
1408 | - $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1408 | + $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1409 | 1409 | return $tokens; |
1410 | 1410 | } |
1411 | 1411 | } |
@@ -1417,9 +1417,9 @@ discard block |
||
1417 | 1417 | if ($view->args) { |
1418 | 1418 | $account_id = $view->args[0]; |
1419 | 1419 | } |
1420 | - if ($view->name=="user_activity") { |
|
1420 | + if ($view->name == "user_activity") { |
|
1421 | 1421 | // Run the following custom query for the user_activity view |
1422 | - $view->build_info['query']= " |
|
1422 | + $view->build_info['query'] = " |
|
1423 | 1423 | SELECT node_revisions.vid AS vid, |
1424 | 1424 | node.nid AS node_nid, |
1425 | 1425 | node.uid AS users_node_uid, |
@@ -1459,13 +1459,13 @@ discard block |
||
1459 | 1459 | // Delete expired users in the BOINC database, user_delete table. |
1460 | 1460 | require_boinc('boinc_db'); |
1461 | 1461 | $num_deleted = BoincUserDeleted::delete_expired(); |
1462 | - if ($num_deleted>0) { |
|
1462 | + if ($num_deleted > 0) { |
|
1463 | 1463 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | // Delete expired tokens from token table |
1467 | 1467 | $tokens_deleted = BoincToken::delete_expired(); |
1468 | - if ($tokens_deleted>0) { |
|
1468 | + if ($tokens_deleted > 0) { |
|
1469 | 1469 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
1470 | 1470 | } |
1471 | 1471 | } |
@@ -1550,38 +1550,38 @@ discard block |
||
1550 | 1550 | case 'boinc': |
1551 | 1551 | $output .= '<ol>'; |
1552 | 1552 | if ($registration_enabled) { |
1553 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1553 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1554 | 1554 | array( |
1555 | 1555 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1556 | 1556 | '@sitename' => $site_name, |
1557 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1557 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1558 | 1558 | } |
1559 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
1560 | - $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1559 | + $output .= ' <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>'; |
|
1560 | + $output .= ' <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1561 | 1561 | array( |
1562 | 1562 | '@sitename' => $site_name, |
1563 | 1563 | '@siteurl' => $base_url, |
1564 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1564 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1565 | 1565 | if ($registration_enabled) { |
1566 | - $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.", |
|
1566 | + $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.", |
|
1567 | 1567 | array( |
1568 | 1568 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1569 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1569 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1570 | 1570 | } |
1571 | 1571 | else { |
1572 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
1572 | + $output .= '<li>'.bts("If you're running a command-line version of BOINC, |
|
1573 | 1573 | 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.", |
1574 | 1574 | array( |
1575 | 1575 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1576 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1576 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1577 | 1577 | } |
1578 | - $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
|
1578 | + $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please |
|
1579 | 1579 | upgrade to a more recent version of BOINC to create an account |
1580 | 1580 | at @this_project.", |
1581 | 1581 | array( |
1582 | 1582 | '@this_project' => $site_name, |
1583 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1584 | - $output .= '</ol>'; |
|
1583 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1584 | + $output .= '</ol>'; |
|
1585 | 1585 | break; |
1586 | 1586 | case 'new': |
1587 | 1587 | default: |
@@ -1593,34 +1593,34 @@ discard block |
||
1593 | 1593 | // $ruleslink = drupal_lookup_path('source', $ruleslinkB); |
1594 | 1594 | //} |
1595 | 1595 | |
1596 | - $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') ); |
|
1596 | + $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '')); |
|
1597 | 1597 | |
1598 | 1598 | // Join page output |
1599 | 1599 | $output .= '<ol>'; |
1600 | 1600 | if ($registration_enabled) { |
1601 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1601 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1602 | 1602 | array( |
1603 | 1603 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1604 | 1604 | '@sitename' => $site_name, |
1605 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1605 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1606 | 1606 | } |
1607 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
1608 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
1607 | + else if (menu_valid_path(array('link_path' => $ruleslink))) { |
|
1608 | + $output .= ' <li>'.bts("Read our !rules_and_policies.", array( |
|
1609 | 1609 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
1610 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1610 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1611 | 1611 | } |
1612 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1612 | + $output .= ' <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1613 | 1613 | $output .= ' <p>'; |
1614 | 1614 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
1615 | 1615 | $output .= ' </p>'; |
1616 | - $output .= ' ' . bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page'); |
|
1616 | + $output .= ' '.bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page'); |
|
1617 | 1617 | $output .= ' </li>'; |
1618 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
1619 | - $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1618 | + $output .= ' <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>'; |
|
1619 | + $output .= ' <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1620 | 1620 | '@sitename' => $site_name, |
1621 | 1621 | '@siteurl' => $base_url, |
1622 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1623 | - $output .= '</ol>'; |
|
1622 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1623 | + $output .= '</ol>'; |
|
1624 | 1624 | } |
1625 | 1625 | $output .= '</div>'; |
1626 | 1626 | return $output; |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | global $user; |
1634 | 1634 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1635 | 1635 | // get the front page message from database; this is set in the admin interface under BOINC Other |
1636 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
1636 | + $site_message = variable_get('boinc_other_frontpage', ''); |
|
1637 | 1637 | |
1638 | 1638 | // Determine the user of the day |
1639 | 1639 | $current_uotd = db_fetch_object(db_query(" |
@@ -1655,30 +1655,30 @@ discard block |
||
1655 | 1655 | $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')); |
1656 | 1656 | $output .= '</h2>'; |
1657 | 1657 | $output .= '<div class="boinc-overview balance-height-front">'; |
1658 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1658 | + $output .= ' <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>'; |
|
1659 | 1659 | if ($user->uid) { |
1660 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1660 | + $output .= ' <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1661 | 1661 | } |
1662 | 1662 | else { |
1663 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1663 | + $output .= ' <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1664 | 1664 | } |
1665 | 1665 | $output .= '</div>'; |
1666 | 1666 | $output .= '<div class="boinc-overview-details">'; |
1667 | 1667 | $output .= ' <div class="detail-container">'; |
1668 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
1668 | + $output .= ' <a class="user-of-the-day" href="account/'.$uotd->uid.'">'; |
|
1669 | 1669 | $output .= ' <div class="picture">'; |
1670 | 1670 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
1671 | 1671 | $uotd_image['alt'], array(), FALSE); |
1672 | 1672 | $output .= ' </div>'; |
1673 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1674 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
1673 | + $output .= ' <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>'; |
|
1674 | + $output .= ' <div class="detail">'.$uotd->boincuser_name.'</div>'; |
|
1675 | 1675 | $output .= ' </a>'; |
1676 | 1676 | $output .= ' <div class="volunteers">'; |
1677 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1677 | + $output .= ' <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>'; |
|
1678 | 1678 | $output .= ' <div class="platforms">'; |
1679 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1680 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1681 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1679 | + $output .= ' <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>'; |
|
1680 | + $output .= ' <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>'; |
|
1681 | + $output .= ' <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>'; |
|
1682 | 1682 | $output .= ' </div>'; |
1683 | 1683 | $output .= ' </div>'; |
1684 | 1684 | $output .= ' </div>'; |
@@ -1709,7 +1709,7 @@ discard block |
||
1709 | 1709 | $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
1710 | 1710 | if (!$enablethisRPC) { |
1711 | 1711 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
1712 | - '@url' => $base_url . '/user/registration', |
|
1712 | + '@url' => $base_url.'/user/registration', |
|
1713 | 1713 | ), |
1714 | 1714 | NULL, 'boinc:create_account'); |
1715 | 1715 | xml_error(-208, $mess); |
@@ -1741,8 +1741,8 @@ discard block |
||
1741 | 1741 | $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
1742 | 1742 | if ($boinc_user) { |
1743 | 1743 | // Return authenticator for existing users |
1744 | - if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1745 | - password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
|
1744 | + if (($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1745 | + password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) { |
|
1746 | 1746 | $output = array('authenticator' => $boinc_user->authenticator); |
1747 | 1747 | } |
1748 | 1748 | else { |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | // Ensure there is a authentication token before continuing |
1799 | 1799 | if (empty($authtoken)) { |
1800 | 1800 | drupal_not_found(); |
1801 | - return ; |
|
1801 | + return; |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | if (strlen($authtoken) != 32) { |
@@ -1820,8 +1820,8 @@ discard block |
||
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | // Lookup path to custom account finish page |
1823 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
1824 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
1823 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '')); |
|
1824 | + if (menu_valid_path(array('link_path' => $customaccountfinishpath))) { |
|
1825 | 1825 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
1826 | 1826 | if ($node) { |
1827 | 1827 | return node_page_view($node); |
@@ -1830,12 +1830,12 @@ discard block |
||
1830 | 1830 | |
1831 | 1831 | // open links in new window |
1832 | 1832 | $options = array( |
1833 | - 'attributes' => array( 'target' => '_blank' ), |
|
1833 | + 'attributes' => array('target' => '_blank'), |
|
1834 | 1834 | ); |
1835 | 1835 | |
1836 | 1836 | // Check moderation page exists |
1837 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
1838 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
1837 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '')); |
|
1838 | + if (menu_valid_path(array('link_path' => $moderationpath))) { |
|
1839 | 1839 | $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'); |
1840 | 1840 | } else { |
1841 | 1841 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
@@ -1843,11 +1843,11 @@ discard block |
||
1843 | 1843 | |
1844 | 1844 | $username = $user->boincuser_name; |
1845 | 1845 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1846 | - $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.)', |
|
1846 | + $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.)', |
|
1847 | 1847 | array( |
1848 | 1848 | '@user_name' => $username, |
1849 | 1849 | '@site_name' => $site_name, |
1850 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
1850 | + ), NULL, 'boinc:account-finish')."</p>"; |
|
1851 | 1851 | |
1852 | 1852 | $links = array( |
1853 | 1853 | array( |
@@ -1913,7 +1913,7 @@ discard block |
||
1913 | 1913 | ); |
1914 | 1914 | |
1915 | 1915 | //List of links |
1916 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1916 | + $output .= theme_item_list($links, $title = NULL, $type = 'ul'); |
|
1917 | 1917 | |
1918 | 1918 | return $output; |
1919 | 1919 | } |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | global $base_url; |
2031 | 2031 | global $base_path; |
2032 | 2032 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2033 | - $site_url = $base_url . $base_path; |
|
2033 | + $site_url = $base_url.$base_path; |
|
2034 | 2034 | $moderator = user_load($user->uid); |
2035 | 2035 | $profile->moderate = 0; |
2036 | 2036 | $profile->status = 0; |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | global $base_url; |
2092 | 2092 | global $base_path; |
2093 | 2093 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2094 | - $site_url = $base_url . $base_path; |
|
2094 | + $site_url = $base_url.$base_path; |
|
2095 | 2095 | $moderator = user_load($user->uid); |
2096 | 2096 | $settings = array( |
2097 | 2097 | 'from' => '', |
@@ -2195,25 +2195,25 @@ discard block |
||
2195 | 2195 | if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
2196 | 2196 | |
2197 | 2197 | $output = ''; |
2198 | - $output .= '<table class="user-projects">' . "\n"; |
|
2199 | - $output .= '<thead>' . "\n"; |
|
2200 | - $output .= ' <tr>' . "\n"; |
|
2201 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2202 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2203 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2204 | - $output .= ' </tr>' . "\n"; |
|
2205 | - $output .= '</thead>' . "\n"; |
|
2206 | - $output .= '<tbody>' . "\n"; |
|
2198 | + $output .= '<table class="user-projects">'."\n"; |
|
2199 | + $output .= '<thead>'."\n"; |
|
2200 | + $output .= ' <tr>'."\n"; |
|
2201 | + $output .= ' <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n"; |
|
2202 | + $output .= ' <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n"; |
|
2203 | + $output .= ' <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n"; |
|
2204 | + $output .= ' </tr>'."\n"; |
|
2205 | + $output .= '</thead>'."\n"; |
|
2206 | + $output .= '<tbody>'."\n"; |
|
2207 | 2207 | foreach ($projects AS $project) { |
2208 | - $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
|
2209 | - $output .= ' <tr>' . "\n"; |
|
2210 | - $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
|
2211 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
|
2212 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
|
2213 | - $output .= ' </tr>' . "\n"; |
|
2208 | + $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id; |
|
2209 | + $output .= ' <tr>'."\n"; |
|
2210 | + $output .= ' <td>'.l($project->name, $url).'</td>'."\n"; |
|
2211 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; |
|
2212 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n"; |
|
2213 | + $output .= ' </tr>'."\n"; |
|
2214 | 2214 | } |
2215 | - $output .= '</tbody>' . "\n"; |
|
2216 | - $output .= '</table>' . "\n"; |
|
2215 | + $output .= '</tbody>'."\n"; |
|
2216 | + $output .= '</table>'."\n"; |
|
2217 | 2217 | $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
2218 | 2218 | //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
2219 | 2219 | return $output; |
@@ -2233,8 +2233,8 @@ discard block |
||
2233 | 2233 | 'cpid' => $cpid |
2234 | 2234 | ); |
2235 | 2235 | $args = array(); |
2236 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2237 | - $query = '?' . implode('&', $args); |
|
2236 | + foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value); |
|
2237 | + $query = '?'.implode('&', $args); |
|
2238 | 2238 | |
2239 | 2239 | // Load XML from RPC |
2240 | 2240 | $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
@@ -2306,12 +2306,12 @@ discard block |
||
2306 | 2306 | $output .= '<ul class="tab-list">'; |
2307 | 2307 | $count = 0; |
2308 | 2308 | foreach ($links as $key => $link) { |
2309 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
2309 | + $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">'; |
|
2310 | 2310 | $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
2311 | 2311 | $output .= '</li>'; |
2312 | 2312 | $count++; |
2313 | 2313 | } |
2314 | - $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; |
|
2314 | + $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user_meta', $account->uid).'</li>'; |
|
2315 | 2315 | $output .= '</ul>'; |
2316 | 2316 | } |
2317 | 2317 | return $output; |
@@ -2352,7 +2352,7 @@ discard block |
||
2352 | 2352 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
2353 | 2353 | |
2354 | 2354 | foreach ($documents as $document) { |
2355 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
2355 | + if ($document->entity_type == 'node' AND $document->bundle == 'profile') { |
|
2356 | 2356 | // Node information. |
2357 | 2357 | $nid = $document->entity_id; |
2358 | 2358 | $node = node_load($nid); |
@@ -2402,11 +2402,11 @@ discard block |
||
2402 | 2402 | // privatemsg module. We need to convert them back to spaces for the |
2403 | 2403 | // check below. |
2404 | 2404 | $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
2405 | - if ($drupalid>0) { |
|
2405 | + if ($drupalid > 0) { |
|
2406 | 2406 | if ($recipient = user_load(array('uid' => $drupalid))) { |
2407 | 2407 | // Double-check that the loaded user matches both boincuser_id |
2408 | 2408 | // and boincuser_name. |
2409 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2409 | + if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) { |
|
2410 | 2410 | return $recipient; |
2411 | 2411 | } |
2412 | 2412 | } |
@@ -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,70 +510,70 @@ 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 |
557 | 557 | // remove them before continuing to core Drupal routines |
558 | 558 | $edit['update_source'] = null; |
559 | 559 | $edit['boincuser_name'] = null; |
560 | - } |
|
561 | - break; |
|
560 | + } |
|
561 | + break; |
|
562 | 562 | |
563 | 563 | case 'login': |
564 | 564 | // Function is forward compatible to Drupal 7 |
565 | 565 | boincuser_user_login($edit, $account); |
566 | - break; |
|
566 | + break; |
|
567 | 567 | |
568 | 568 | case 'delete': |
569 | 569 | // Function is forward compatible to Drupal 7 |
570 | 570 | boincuser_user_delete($account); |
571 | - break; |
|
571 | + break; |
|
572 | 572 | |
573 | 573 | default: |
574 | 574 | |
575 | 575 | } |
576 | - } |
|
576 | + } |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
@@ -582,39 +582,39 @@ discard block |
||
582 | 582 | *(forward compatible to Drupal 7). |
583 | 583 | */ |
584 | 584 | function boincuser_user_login(&$edit, $account) { |
585 | - $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
586 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
587 | - |
|
588 | - // Use the same code as boincuser_form_alter(), for case |
|
589 | - // 'user_profile_form', if the refering page is the user password |
|
590 | - // reset form, then do not check for terms of use. |
|
591 | - $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
592 | - if ($reset_pass) { |
|
585 | + $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
|
586 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
587 | + |
|
588 | + // Use the same code as boincuser_form_alter(), for case |
|
589 | + // 'user_profile_form', if the refering page is the user password |
|
590 | + // reset form, then do not check for terms of use. |
|
591 | + $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/$account->uid") === FALSE) ? 0 : 1; |
|
592 | + if ($reset_pass) { |
|
593 | 593 | return; |
594 | - } |
|
594 | + } |
|
595 | 595 | |
596 | - // Check if user has agreed to terms of use. |
|
597 | - if ( (!empty($termsofuse)) and ($account->uid) and |
|
596 | + // Check if user has agreed to terms of use. |
|
597 | + if ( (!empty($termsofuse)) and ($account->uid) and |
|
598 | 598 | (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { |
599 | 599 | |
600 | 600 | // Admins are exempted. |
601 | 601 | $administrator_role = array_search('administrator', user_roles(true)); |
602 | 602 | if (!isset($account->roles[$administrator_role])) { |
603 | 603 | |
604 | - // Find and save the current destination and use as an parameter |
|
605 | - // to send the user back to here he/she came from. |
|
606 | - $np = ltrim('user/termsofuse', '/'); |
|
607 | - $path_for_destination = rawurlencode($np); |
|
604 | + // Find and save the current destination and use as an parameter |
|
605 | + // to send the user back to here he/she came from. |
|
606 | + $np = ltrim('user/termsofuse', '/'); |
|
607 | + $path_for_destination = rawurlencode($np); |
|
608 | 608 | |
609 | - $query_for_destination = ''; |
|
610 | - $prevdest = $_REQUEST['destination']; |
|
611 | - if ($prevdest) { |
|
609 | + $query_for_destination = ''; |
|
610 | + $prevdest = $_REQUEST['destination']; |
|
611 | + if ($prevdest) { |
|
612 | 612 | $query_for_destination = '?destination=' . $prevdest; |
613 | - } |
|
614 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
613 | + } |
|
614 | + $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
615 | 615 | |
616 | 616 | } |
617 | - } |
|
617 | + } |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /** |
@@ -623,16 +623,16 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function boincuser_user_delete($account) { |
625 | 625 | |
626 | - $boincid = $account->boincuser_id; |
|
627 | - // bug in comment module, remove user name from comments. Find all |
|
628 | - // comments with uid=0 and clear the field 'name'. |
|
629 | - $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); |
|
626 | + $boincid = $account->boincuser_id; |
|
627 | + // bug in comment module, remove user name from comments. Find all |
|
628 | + // comments with uid=0 and clear the field 'name'. |
|
629 | + $qrc1 = db_query("UPDATE {comments} SET comments.name='' WHERE comments.uid=0"); |
|
630 | 630 | |
631 | - // Delete entry in drupal boincuser table. |
|
632 | - $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); |
|
633 | - if (!$qrc2) { |
|
631 | + // Delete entry in drupal boincuser table. |
|
632 | + $qrc2 = db_query("DELETE FROM {boincuser} WHERE uid=%d", $account->uid); |
|
633 | + if (!$qrc2) { |
|
634 | 634 | watchdog('user', 'Error deleting user account, boincuser table UID: %uid.', array('%uid' => $account->uid), WATCHDOG_ERROR); |
635 | - } |
|
635 | + } |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -641,13 +641,13 @@ discard block |
||
641 | 641 | * Obsolete in Drupal 7... |
642 | 642 | */ |
643 | 643 | function boincuser_nodeapi(&$node, $op, $a3 = null, $a4 = null) { |
644 | - // In Drupal 7, these operation cases will all exist as their own hooks, |
|
645 | - // so let's approximate that here so that this function can simply be removed |
|
646 | - // upon migration to 7 |
|
647 | - switch($op) { |
|
648 | - case 'update': |
|
644 | + // In Drupal 7, these operation cases will all exist as their own hooks, |
|
645 | + // so let's approximate that here so that this function can simply be removed |
|
646 | + // upon migration to 7 |
|
647 | + switch($op) { |
|
648 | + case 'update': |
|
649 | 649 | boincuser_node_update($node); |
650 | - } |
|
650 | + } |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | * is updated (forward compatible to Drupal 7) |
656 | 656 | */ |
657 | 657 | function boincuser_node_update($node) { |
658 | - switch($node->type) { |
|
659 | - case 'profile': |
|
658 | + switch($node->type) { |
|
659 | + case 'profile': |
|
660 | 660 | // Update the BOINC database directly |
661 | 661 | $account = user_load($node->uid); |
662 | 662 | // Save user account data |
@@ -668,11 +668,11 @@ discard block |
||
668 | 668 | UPDATE user |
669 | 669 | SET country = '%s', postal_code = '%s', url = '%s', has_profile = 1 |
670 | 670 | WHERE id = %d", |
671 | - $country, $postal_code, $url, $account->boincuser_id |
|
671 | + $country, $postal_code, $url, $account->boincuser_id |
|
672 | 672 | ); |
673 | 673 | db_set_active('default'); |
674 | 674 | if (!$account_updated) { |
675 | - drupal_set_message(t('Error saving BOINC account info.'), 'error'); |
|
675 | + drupal_set_message(t('Error saving BOINC account info.'), 'error'); |
|
676 | 676 | } |
677 | 677 | // Save profile data |
678 | 678 | $response1 = $node->field_background[0]['value']; |
@@ -683,16 +683,16 @@ discard block |
||
683 | 683 | SET userid = %d, response1 = '%s', response2 = '%s' |
684 | 684 | ON DUPLICATE KEY UPDATE |
685 | 685 | response1 = '%s', response2 = '%s'", |
686 | - $account->boincuser_id, $response1, $response2, |
|
687 | - $response1, $response2 |
|
686 | + $account->boincuser_id, $response1, $response2, |
|
687 | + $response1, $response2 |
|
688 | 688 | ); |
689 | 689 | db_set_active('default'); |
690 | 690 | if (!$profile_updated) { |
691 | - drupal_set_message(t('Error saving BOINC profile.'), 'error'); |
|
691 | + drupal_set_message(t('Error saving BOINC profile.'), 'error'); |
|
692 | 692 | } |
693 | 693 | break; |
694 | 694 | |
695 | - default: |
|
695 | + default: |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | } |
@@ -701,21 +701,21 @@ discard block |
||
701 | 701 | * Implementation of hook_views_api() |
702 | 702 | */ |
703 | 703 | function boincuser_views_api() { |
704 | - return array( |
|
704 | + return array( |
|
705 | 705 | 'api' => 2.0, |
706 | 706 | 'path' => drupal_get_path('module', 'boincuser') |
707 | - ); |
|
707 | + ); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | /** |
711 | 711 | * Implementation of hook_form_alter() |
712 | 712 | */ |
713 | 713 | function boincuser_form_alter(&$form, $form_state, $form_id) { |
714 | - require_boinc('token'); |
|
714 | + require_boinc('token'); |
|
715 | 715 | |
716 | - global $user; |
|
717 | - switch ($form_id) { |
|
718 | - case 'flag_confirm': |
|
716 | + global $user; |
|
717 | + switch ($form_id) { |
|
718 | + case 'flag_confirm': |
|
719 | 719 | // The URL seems to be the only way to put any kind of context to this |
720 | 720 | // request! |
721 | 721 | $action = arg(2); |
@@ -724,25 +724,25 @@ discard block |
||
724 | 724 | |
725 | 725 | // Wrap action buttons for styling consistency |
726 | 726 | $form['form control tabs prefix'] = array( |
727 | - '#value' => '<ul class="form-control tab-list">', |
|
728 | - '#weight' => 1001, |
|
727 | + '#value' => '<ul class="form-control tab-list">', |
|
728 | + '#weight' => 1001, |
|
729 | 729 | ); |
730 | 730 | |
731 | 731 | switch ($flag_type) { |
732 | 732 | case 'friend': |
733 | 733 | $friend_id = $form['content_id']['#value']; |
734 | - $flag = flag_get_flag('friend'); |
|
735 | - $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid); |
|
734 | + $flag = flag_get_flag('friend'); |
|
735 | + $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid); |
|
736 | 736 | |
737 | - // General friend form overrides |
|
738 | - $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
|
739 | - $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
740 | - $form['flag_friend_submit']['#type'] = 'submit'; |
|
741 | - $form['flag_friend_submit']['#suffix'] = '</li>'; |
|
742 | - $form['flag_friend_submit']['#weight'] = 1002; |
|
737 | + // General friend form overrides |
|
738 | + $form['flag_friend_submit']['#prefix'] = '<li class="first tab">'; |
|
739 | + $form['flag_friend_submit']['#value'] = bts('Send request', array(), NULL, 'boinc:friends-page'); |
|
740 | + $form['flag_friend_submit']['#type'] = 'submit'; |
|
741 | + $form['flag_friend_submit']['#suffix'] = '</li>'; |
|
742 | + $form['flag_friend_submit']['#weight'] = 1002; |
|
743 | 743 | |
744 | - switch ($friend_status) { |
|
745 | - case FLAG_FRIEND_BOTH: |
|
744 | + switch ($friend_status) { |
|
745 | + case FLAG_FRIEND_BOTH: |
|
746 | 746 | case FLAG_FRIEND_FLAGGED: |
747 | 747 | unset($form['actions']); |
748 | 748 | $form['flag_friend_submit']['#value'] = bts('Remove friend', array(), NULL, 'boinc:friends-remove'); |
@@ -751,53 +751,53 @@ discard block |
||
751 | 751 | $form['#submit'][] = 'boincuser_fix_unfriend_form_submit'; |
752 | 752 | $form['#submit'][] = $final_handler; |
753 | 753 | break; |
754 | - case FLAG_FRIEND_PENDING: |
|
754 | + case FLAG_FRIEND_PENDING: |
|
755 | 755 | unset($form['actions']); |
756 | 756 | $form['flag_friend_submit']['#value'] = bts('Remove request', array(), NULL, 'boinc:friends-page'); |
757 | 757 | break; |
758 | - case FLAG_FRIEND_APPROVAL: |
|
758 | + case FLAG_FRIEND_APPROVAL: |
|
759 | 759 | if ($action == 'flag') { |
760 | - $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
760 | + $form['flag_friend_submit']['#value'] = bts('Approve request', array(), NULL, 'boinc:friends-page'); |
|
761 | 761 | } |
762 | 762 | elseif ($action == 'unflag') { |
763 | - unset($form['actions']); |
|
764 | - $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
763 | + unset($form['actions']); |
|
764 | + $form['flag_friend_submit']['#value'] = bts('Deny request', array(), NULL, 'boinc:friends-page'); |
|
765 | 765 | } |
766 | 766 | break; |
767 | - case FLAG_FRIEND_UNFLAGGED: |
|
767 | + case FLAG_FRIEND_UNFLAGGED: |
|
768 | 768 | default: |
769 | 769 | $user_links[] = array( |
770 | - 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
771 | - 'href' => "flag/confirm/flag/friend/{$account->uid}" |
|
770 | + 'title' => bts('Add as friend', array(), NULL, 'boinc:friends-add'), |
|
771 | + 'href' => "flag/confirm/flag/friend/{$account->uid}" |
|
772 | 772 | ); |
773 | - } |
|
774 | - break; |
|
773 | + } |
|
774 | + break; |
|
775 | 775 | |
776 | 776 | default: |
777 | 777 | } |
778 | 778 | |
779 | 779 | $form['cancel'] = array( |
780 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
781 | - '#weight' => 1004, |
|
780 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
781 | + '#weight' => 1004, |
|
782 | 782 | ); |
783 | 783 | $form['form control tabs suffix'] = array( |
784 | - '#value' => '</ul>', |
|
785 | - '#weight' => 1010, |
|
784 | + '#value' => '</ul>', |
|
785 | + '#weight' => 1010, |
|
786 | 786 | ); |
787 | 787 | |
788 | 788 | break; |
789 | 789 | |
790 | - // General node edit form |
|
791 | - case 'news_node_form': |
|
790 | + // General node edit form |
|
791 | + case 'news_node_form': |
|
792 | 792 | $form['separator_bottom'] = array( |
793 | - '#value' => '<div class="separator buttons"></div>', |
|
794 | - '#weight' => 999, |
|
793 | + '#value' => '<div class="separator buttons"></div>', |
|
794 | + '#weight' => 999, |
|
795 | 795 | ); |
796 | 796 | |
797 | 797 | // Wrap action buttons for styling consistency |
798 | 798 | $form['buttons']['form control tabs prefix'] = array( |
799 | - '#value' => '<ul class="form-control tab-list">', |
|
800 | - '#weight' => 1001, |
|
799 | + '#value' => '<ul class="form-control tab-list">', |
|
800 | + '#weight' => 1001, |
|
801 | 801 | ); |
802 | 802 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
803 | 803 | $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
@@ -810,15 +810,15 @@ discard block |
||
810 | 810 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
811 | 811 | $form['buttons']['preview_changes']['#weight'] = 1004; |
812 | 812 | $form['buttons']['cancel'] = array( |
813 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
814 | - '#weight' => 1005, |
|
813 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
814 | + '#weight' => 1005, |
|
815 | 815 | ); |
816 | 816 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
817 | 817 | $form['buttons']['delete']['#suffix'] = '</li>'; |
818 | 818 | $form['buttons']['delete']['#weight'] = 1006; |
819 | 819 | $form['buttons']['form control tabs suffix'] = array( |
820 | - '#value' => '</ul>', |
|
821 | - '#weight' => 1010, |
|
820 | + '#value' => '</ul>', |
|
821 | + '#weight' => 1010, |
|
822 | 822 | ); |
823 | 823 | |
824 | 824 | // Preview is ugly, unset until it works |
@@ -826,16 +826,16 @@ discard block |
||
826 | 826 | |
827 | 827 | break; |
828 | 828 | |
829 | - case 'node_delete_confirm': |
|
829 | + case 'node_delete_confirm': |
|
830 | 830 | $form['separator_bottom'] = array( |
831 | - '#value' => '<div class="separator buttons"></div>', |
|
832 | - '#weight' => 999, |
|
831 | + '#value' => '<div class="separator buttons"></div>', |
|
832 | + '#weight' => 999, |
|
833 | 833 | ); |
834 | 834 | |
835 | 835 | // Wrap action buttons for styling consistency |
836 | 836 | $form['actions']['form control tabs prefix'] = array( |
837 | - '#value' => '<ul class="form-control tab-list">', |
|
838 | - '#weight' => 1001, |
|
837 | + '#value' => '<ul class="form-control tab-list">', |
|
838 | + '#weight' => 1001, |
|
839 | 839 | ); |
840 | 840 | $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
841 | 841 | $form['actions']['submit']['#value'] = bts('Delete', array(), NULL, 'boinc:form-delete'); |
@@ -843,23 +843,23 @@ discard block |
||
843 | 843 | $form['actions']['submit']['#weight'] = 1002; |
844 | 844 | $form['actions']['cancel'] = array( |
845 | 845 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
846 | - '#weight' => 1005, |
|
846 | + '#weight' => 1005, |
|
847 | 847 | ); |
848 | 848 | $form['actions']['form control tabs suffix'] = array( |
849 | - '#value' => '</ul>', |
|
850 | - '#weight' => 1010, |
|
849 | + '#value' => '</ul>', |
|
850 | + '#weight' => 1010, |
|
851 | 851 | ); |
852 | 852 | $form['#redirect'] = 'account/profile'; |
853 | 853 | break; |
854 | 854 | |
855 | - case 'privatemsg_new': |
|
855 | + case 'privatemsg_new': |
|
856 | 856 | |
857 | 857 | $form['privatemsg']['body']['#title'] = ''; |
858 | 858 | |
859 | 859 | // Wrap action buttons for styling consistency |
860 | 860 | $form['privatemsg']['form control tabs prefix'] = array( |
861 | - '#value' => '<ul class="form-control tab-list">', |
|
862 | - '#weight' => 1001, |
|
861 | + '#value' => '<ul class="form-control tab-list">', |
|
862 | + '#weight' => 1001, |
|
863 | 863 | ); |
864 | 864 | $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">'; |
865 | 865 | $form['privatemsg']['submit']['#value'] = bts('Send message', array(), NULL, 'boinc:private-message'); |
@@ -869,26 +869,26 @@ discard block |
||
869 | 869 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
870 | 870 | $form['privatemsg']['preview']['#weight'] = 1003; |
871 | 871 | $form['privatemsg']['cancel'] = array( |
872 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
873 | - '#weight' => 1004, |
|
872 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
873 | + '#weight' => 1004, |
|
874 | 874 | ); |
875 | 875 | $form['privatemsg']['form control tabs suffix'] = array( |
876 | - '#value' => '</ul>', |
|
877 | - '#weight' => 1010, |
|
876 | + '#value' => '</ul>', |
|
877 | + '#weight' => 1010, |
|
878 | 878 | ); |
879 | 879 | |
880 | 880 | unset($form['privatemsg']['recipient_display']); |
881 | 881 | |
882 | 882 | break; |
883 | 883 | |
884 | - // Login form |
|
885 | - case 'user_login': |
|
884 | + // Login form |
|
885 | + case 'user_login': |
|
886 | 886 | case 'user_login_block': |
887 | 887 | drupal_set_title(bts('Login', array(), NULL, 'boinc:menu-link')); |
888 | 888 | // Replace name with email in login form |
889 | 889 | unset($form['name']); |
890 | 890 | array_unshift($form, array( |
891 | - 'email' => array( |
|
891 | + 'email' => array( |
|
892 | 892 | '#type' => 'textfield', |
893 | 893 | '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
894 | 894 | '#size' => ($form_id == 'user_login_block') ? 15 : 60, |
@@ -896,18 +896,18 @@ discard block |
||
896 | 896 | '#required' => TRUE, |
897 | 897 | '#attributes' => array('tabindex' => '1'), |
898 | 898 | '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:standard-login-page') |
899 | - ), |
|
900 | - 'validation_source' => array( |
|
899 | + ), |
|
900 | + 'validation_source' => array( |
|
901 | 901 | '#type' => 'hidden', |
902 | 902 | '#value' => 'user_login' |
903 | - ) |
|
903 | + ) |
|
904 | 904 | )); |
905 | 905 | $form['#redirect'] = 'home'; |
906 | 906 | |
907 | 907 | // Wrap action buttons for styling consistency |
908 | 908 | $form['buttons']['form control tabs prefix'] = array( |
909 | - '#value' => '<ul class="form-control tab-list">', |
|
910 | - '#weight' => 1001, |
|
909 | + '#value' => '<ul class="form-control tab-list">', |
|
910 | + '#weight' => 1001, |
|
911 | 911 | ); |
912 | 912 | $form['buttons']['submit'] = $form['submit']; |
913 | 913 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | $form['buttons']['submit']['#suffix'] = '</li>'; |
916 | 916 | $form['buttons']['submit']['#weight'] = 1002; |
917 | 917 | $form['buttons']['form control tabs suffix'] = array( |
918 | - '#value' => '</ul>', |
|
919 | - '#weight' => 1010, |
|
918 | + '#value' => '</ul>', |
|
919 | + '#weight' => 1010, |
|
920 | 920 | ); |
921 | 921 | unset($form['submit']); |
922 | 922 | |
@@ -925,23 +925,23 @@ discard block |
||
925 | 925 | isset($form['buttons']['submit']['#attributes']) ? array_push($form['buttons']['submit']['#attributes'], array('tabindex' => '3')) : $form['buttons']['submit']['#attributes'] = array('tabindex' => '3'); |
926 | 926 | // If the user login form is being submitted, use BOINC validation handler. |
927 | 927 | if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) { |
928 | - // Find the local validation function's entry so we can replace it. |
|
929 | - $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
|
930 | - if ($array_key === FALSE) { |
|
928 | + // Find the local validation function's entry so we can replace it. |
|
929 | + $array_key = array_search('user_login_authenticate_validate', $form['#validate']); |
|
930 | + if ($array_key === FALSE) { |
|
931 | 931 | // Could not find it. Some other module must have run form_alter(). |
932 | 932 | // We will simply add our validation just before the final validator. |
933 | 933 | $final_validator = array_pop($form['#validate']); |
934 | 934 | $form['#validate'][] = 'boincuser_login_validate'; |
935 | 935 | $form['#validate'][] = $final_validator; |
936 | - } else { |
|
936 | + } else { |
|
937 | 937 | // Replace the local validation function with BOINC validation |
938 | 938 | $form['#validate'][$array_key] = 'boincuser_login_validate'; |
939 | - } |
|
939 | + } |
|
940 | 940 | } |
941 | 941 | break; |
942 | 942 | |
943 | - // User credentials form |
|
944 | - case 'user_profile_form': |
|
943 | + // User credentials form |
|
944 | + case 'user_profile_form': |
|
945 | 945 | |
946 | 946 | // Use the displaly name as the title, not the username |
947 | 947 | $account = user_load($form['#uid']); |
@@ -949,28 +949,28 @@ discard block |
||
949 | 949 | |
950 | 950 | // Message for admins |
951 | 951 | if (user_access('administer users')) { |
952 | - drupal_set_message( |
|
952 | + drupal_set_message( |
|
953 | 953 | 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.') |
954 | - , 'warning'); |
|
954 | + , 'warning'); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | // Set special message if user has not agreed to TOU |
958 | 958 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
959 | 959 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
960 | 960 | if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
961 | - drupal_set_message( |
|
961 | + drupal_set_message( |
|
962 | 962 | 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.', |
963 | 963 | array( |
964 | - '@project' => variable_get('site_name','Drupal-BOINC'), |
|
964 | + '@project' => variable_get('site_name','Drupal-BOINC'), |
|
965 | 965 | ), NULL, 'boinc:account-credentials-change') |
966 | - , 'info'); |
|
966 | + , 'info'); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | // A bit hackish... but don't require the user to enter his password if |
970 | 970 | // coming from the password reset function |
971 | 971 | $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1; |
972 | 972 | if ($reset_pass) { |
973 | - $_SESSION['reset_pass'] = 1; |
|
973 | + $_SESSION['reset_pass'] = 1; |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | // Adjust form elements already present |
@@ -982,8 +982,8 @@ discard block |
||
982 | 982 | $form['account']['pass']['#size'] = 17; |
983 | 983 | |
984 | 984 | if (user_access('administer users')) { |
985 | - // Add BOINC username (aka displayname) |
|
986 | - $form['account']['boincuser_name'] = array( |
|
985 | + // Add BOINC username (aka displayname) |
|
986 | + $form['account']['boincuser_name'] = array( |
|
987 | 987 | '#type' => 'textfield', |
988 | 988 | '#title' => bts('BOINC Username', array(), NULL, 'boinc:user-or-team-name'), |
989 | 989 | '#default_value' => $account->boincuser_name, |
@@ -991,68 +991,68 @@ discard block |
||
991 | 991 | '#required' => TRUE, |
992 | 992 | '#description' => bts('This is the BOINC (external) username. This is the same setting as found in Account -> Preferences -> Community.', array(), NULL, 'boinc:username-change'), |
993 | 993 | '#size' => 40, |
994 | - ); |
|
994 | + ); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | // If email address was changed less than 7 days (7 * 86400 s) |
998 | 998 | // ago, it cannot be changed again. |
999 | 999 | $duration = TOKEN_DURATION_ONE_WEEK; |
1000 | 1000 | if (($account->boincuser_email_addr_change_time + $duration) > time() and (!user_access('administer users'))) { |
1001 | - $form['account']['mail']['#required'] = FALSE; |
|
1002 | - $form['account']['mailhelp'] = array( |
|
1001 | + $form['account']['mail']['#required'] = FALSE; |
|
1002 | + $form['account']['mailhelp'] = array( |
|
1003 | 1003 | '#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.", |
1004 | - array( |
|
1004 | + array( |
|
1005 | 1005 | '!prev_email' => $account->boincuser_previous_email_addr, |
1006 | 1006 | '!time' => date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration), |
1007 | - ), NULL, 'boinc:account-credentials-change'), |
|
1008 | - ); |
|
1007 | + ), NULL, 'boinc:account-credentials-change'), |
|
1008 | + ); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) { |
1012 | - // Add a password authenticator, required to change email or pw |
|
1013 | - $form['account']['current_pass'] = array( |
|
1012 | + // Add a password authenticator, required to change email or pw |
|
1013 | + $form['account']['current_pass'] = array( |
|
1014 | 1014 | '#type' => 'password', |
1015 | 1015 | '#title' => bts('Enter your password to save changes', array(), NULL, 'boinc:account-credentials-change'), |
1016 | 1016 | '#description' => bts('Enter your current password if changing your email |
1017 | 1017 | address or password.', array(), NULL, 'boinc:account-credentials-change'), |
1018 | 1018 | '#size' => 17, |
1019 | 1019 | '#attributes' => array( |
1020 | - 'autocomplete' => 'off', |
|
1020 | + 'autocomplete' => 'off', |
|
1021 | 1021 | ), |
1022 | - ); |
|
1022 | + ); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | // Add account keys, CPID, etc |
1026 | 1026 | $form['account']['boincuser_id'] = array( |
1027 | - '#value' => ' |
|
1027 | + '#value' => ' |
|
1028 | 1028 | <div class="form-item"> |
1029 | 1029 | <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
1030 | 1030 | <span>' . $account->boincuser_id . '</span> |
1031 | 1031 | </div>', |
1032 | 1032 | ); |
1033 | 1033 | $form['account']['user_id'] = array( |
1034 | - '#value' => ' |
|
1034 | + '#value' => ' |
|
1035 | 1035 | <div class="form-item"> |
1036 | 1036 | <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
1037 | 1037 | <span>' . $account->uid . '</span> |
1038 | 1038 | </div>', |
1039 | 1039 | ); |
1040 | 1040 | $form['account']['account_key'] = array( |
1041 | - '#value' => ' |
|
1041 | + '#value' => ' |
|
1042 | 1042 | <div class="form-item"> |
1043 | 1043 | <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
1044 | 1044 | <span>' . $account->boincuser_account_key . '</span> |
1045 | 1045 | </div>', |
1046 | 1046 | ); |
1047 | 1047 | $form['account']['weak_account_key'] = array( |
1048 | - '#value' => ' |
|
1048 | + '#value' => ' |
|
1049 | 1049 | <div class="form-item"> |
1050 | 1050 | <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
1051 | 1051 | <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
1052 | 1052 | </div>', |
1053 | 1053 | ); |
1054 | 1054 | $form['account']['cpid'] = array( |
1055 | - '#value' => ' |
|
1055 | + '#value' => ' |
|
1056 | 1056 | <div class="form-item"> |
1057 | 1057 | <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
1058 | 1058 | <span>' . $account->boincuser_cpid . '</span> |
@@ -1060,30 +1060,30 @@ discard block |
||
1060 | 1060 | ); |
1061 | 1061 | |
1062 | 1062 | $form['account']['separator_bottom'] = array( |
1063 | - '#value' => '<div class="separator buttons"></div>' |
|
1063 | + '#value' => '<div class="separator buttons"></div>' |
|
1064 | 1064 | ); |
1065 | 1065 | |
1066 | 1066 | // Wrap action buttons for styling consistency |
1067 | 1067 | $form['form control tabs prefix'] = array( |
1068 | - '#value' => '<ul class="form-control tab-list">', |
|
1069 | - '#weight' => 1001, |
|
1068 | + '#value' => '<ul class="form-control tab-list">', |
|
1069 | + '#weight' => 1001, |
|
1070 | 1070 | ); |
1071 | 1071 | $form['submit']['#prefix'] = '<li class="first tab">'; |
1072 | 1072 | $form['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
1073 | 1073 | $form['submit']['#suffix'] = '</li>'; |
1074 | 1074 | $form['submit']['#weight'] = 1002; |
1075 | 1075 | $form['cancel'] = array( |
1076 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1077 | - '#weight' => 1003, |
|
1076 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1077 | + '#weight' => 1003, |
|
1078 | 1078 | ); |
1079 | 1079 | if (isset($form['delete']) AND is_array($form['delete'])) { |
1080 | - $form['delete']['#prefix'] = '<li class="first alt tab">'; |
|
1081 | - $form['delete']['#suffix'] = '</li>'; |
|
1082 | - $form['delete']['#weight'] = 1004; |
|
1080 | + $form['delete']['#prefix'] = '<li class="first alt tab">'; |
|
1081 | + $form['delete']['#suffix'] = '</li>'; |
|
1082 | + $form['delete']['#weight'] = 1004; |
|
1083 | 1083 | } |
1084 | 1084 | $form['form control tabs suffix'] = array( |
1085 | - '#value' => '</ul>', |
|
1086 | - '#weight' => 1010, |
|
1085 | + '#value' => '</ul>', |
|
1086 | + '#weight' => 1010, |
|
1087 | 1087 | ); |
1088 | 1088 | |
1089 | 1089 | // Rearrange form elements |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | // Remove redundant / unnecessary form elements |
1104 | 1104 | unset($form['theme_select']); |
1105 | 1105 | if (!module_exists('boincuser_delete')) { |
1106 | - unset($form['delete']); |
|
1106 | + unset($form['delete']); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | // These are on the Community preferences form (boincwork module) |
@@ -1119,18 +1119,18 @@ discard block |
||
1119 | 1119 | |
1120 | 1120 | // Internal fields to indicate where these user changes are taking place |
1121 | 1121 | array_unshift($form, array( |
1122 | - 'validation_source' => array( |
|
1122 | + 'validation_source' => array( |
|
1123 | 1123 | '#type' => 'hidden', |
1124 | 1124 | '#value' => 'user_account' |
1125 | - ), |
|
1126 | - 'update_source' => array( |
|
1125 | + ), |
|
1126 | + 'update_source' => array( |
|
1127 | 1127 | '#type' => 'hidden', |
1128 | 1128 | '#value' => 'user_account' |
1129 | - ) |
|
1129 | + ) |
|
1130 | 1130 | )); |
1131 | 1131 | break; |
1132 | 1132 | |
1133 | - case 'profile_node_form': |
|
1133 | + case 'profile_node_form': |
|
1134 | 1134 | |
1135 | 1135 | // Use the display name as the title, not the username |
1136 | 1136 | $account = user_load($form['uid']['#value']); |
@@ -1141,22 +1141,22 @@ discard block |
||
1141 | 1141 | $form['title']['#access'] = FALSE; |
1142 | 1142 | |
1143 | 1143 | $form['separator_bottom'] = array( |
1144 | - '#value' => '<div class="separator buttons"></div>', |
|
1145 | - '#weight' => 999, |
|
1144 | + '#value' => '<div class="separator buttons"></div>', |
|
1145 | + '#weight' => 999, |
|
1146 | 1146 | ); |
1147 | 1147 | |
1148 | 1148 | if (module_exists('captcha')) { |
1149 | - // Add an optional captcha |
|
1150 | - $form['profile_captcha'] = array( |
|
1149 | + // Add an optional captcha |
|
1150 | + $form['profile_captcha'] = array( |
|
1151 | 1151 | '#type' => 'captcha', |
1152 | 1152 | '#weight' => 1000, |
1153 | - ); |
|
1153 | + ); |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | // Wrap action buttons for styling consistency |
1157 | 1157 | $form['buttons']['form control tabs prefix'] = array( |
1158 | - '#value' => '<ul class="form-control tab-list">', |
|
1159 | - '#weight' => 1001, |
|
1158 | + '#value' => '<ul class="form-control tab-list">', |
|
1159 | + '#weight' => 1001, |
|
1160 | 1160 | ); |
1161 | 1161 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
1162 | 1162 | $form['buttons']['submit']['#value'] = bts('Save changes', array(), NULL, 'boinc:form-save'); |
@@ -1169,8 +1169,8 @@ discard block |
||
1169 | 1169 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
1170 | 1170 | $form['buttons']['preview_changes']['#weight'] = 1004; |
1171 | 1171 | $form['buttons']['cancel'] = array( |
1172 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1173 | - '#weight' => 1005, |
|
1172 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1173 | + '#weight' => 1005, |
|
1174 | 1174 | ); |
1175 | 1175 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
1176 | 1176 | $form['buttons']['delete']['#suffix'] = '</li>'; |
@@ -1178,8 +1178,8 @@ discard block |
||
1178 | 1178 | $form['buttons']['delete']['#weight'] = 1006; |
1179 | 1179 | $form['buttons']['delete']['#submit'] = array('_boincuser_node_profile_delete_submit'); |
1180 | 1180 | $form['buttons']['form control tabs suffix'] = array( |
1181 | - '#value' => '</ul>', |
|
1182 | - '#weight' => 1010, |
|
1181 | + '#value' => '</ul>', |
|
1182 | + '#weight' => 1010, |
|
1183 | 1183 | ); |
1184 | 1184 | |
1185 | 1185 | $form['#after_build'][] = 'boincuser_profile_node_form_after_build'; |
@@ -1192,33 +1192,33 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | // Internal fields to indicate where these user changes are taking place |
1194 | 1194 | array_unshift($form, array( |
1195 | - 'validation_source' => array( |
|
1195 | + 'validation_source' => array( |
|
1196 | 1196 | '#type' => 'hidden', |
1197 | 1197 | '#value' => 'user_profile' |
1198 | - ), |
|
1199 | - 'update_source' => array( |
|
1198 | + ), |
|
1199 | + 'update_source' => array( |
|
1200 | 1200 | '#type' => 'hidden', |
1201 | 1201 | '#value' => 'user_profile' |
1202 | - ) |
|
1202 | + ) |
|
1203 | 1203 | )); |
1204 | 1204 | break; |
1205 | 1205 | |
1206 | - // Registration form |
|
1207 | - case 'user_register': |
|
1206 | + // Registration form |
|
1207 | + case 'user_register': |
|
1208 | 1208 | array_unshift($form, array( |
1209 | - 'boincuser_name' => array( |
|
1209 | + 'boincuser_name' => array( |
|
1210 | 1210 | '#type' => 'textfield', |
1211 | 1211 | '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
1212 | 1212 | '#default_value' => $edit['boincuser_name'], |
1213 | 1213 | '#maxlength' => USERNAME_MAX_LENGTH, |
1214 | 1214 | '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.', array(), NULL, 'boinc:user-register'), |
1215 | 1215 | '#required' => TRUE |
1216 | - ), |
|
1216 | + ), |
|
1217 | 1217 | )); |
1218 | 1218 | // Set name temporarily to dummy value to beat validation |
1219 | 1219 | $form['name'] = array( |
1220 | - '#type' => 'hidden', |
|
1221 | - '#value' => rand() . '.' . time() |
|
1220 | + '#type' => 'hidden', |
|
1221 | + '#value' => rand() . '.' . time() |
|
1222 | 1222 | ); |
1223 | 1223 | |
1224 | 1224 | // Add JS for submit button disabling |
@@ -1228,50 +1228,50 @@ discard block |
||
1228 | 1228 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
1229 | 1229 | if (!empty($termsofuse)) { |
1230 | 1230 | |
1231 | - $form['termsofuse'] = array( |
|
1231 | + $form['termsofuse'] = array( |
|
1232 | 1232 | '#type' => 'fieldset', |
1233 | 1233 | '#prefix' => '<div id="termsofuse-wrapper">', // This is our wrapper div. |
1234 | 1234 | '#suffix' => '</div>', |
1235 | 1235 | '#tree' => TRUE, |
1236 | 1236 | '#weight' => -15, |
1237 | - ); |
|
1237 | + ); |
|
1238 | 1238 | |
1239 | - $form['termsofuse']['title1'] = array( |
|
1239 | + $form['termsofuse']['title1'] = array( |
|
1240 | 1240 | '#weight' => -12, |
1241 | 1241 | '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
1242 | 1242 | '#prefix' => '<div id="register-title1">', |
1243 | 1243 | '#suffix' => '</div>', |
1244 | - ); |
|
1244 | + ); |
|
1245 | 1245 | |
1246 | - $form['termsofuse']['body'] = array( |
|
1246 | + $form['termsofuse']['body'] = array( |
|
1247 | 1247 | '#weight' => -10, |
1248 | 1248 | '#value' => bts($termsofuse, array(), NULL, 'project:user-register'), |
1249 | 1249 | '#prefix' => '<div id="register-termsofuse">', |
1250 | 1250 | '#suffix' => '</div>', |
1251 | - ); |
|
1251 | + ); |
|
1252 | 1252 | |
1253 | - $form['termsofuse']['agreeTOU'] = array( |
|
1253 | + $form['termsofuse']['agreeTOU'] = array( |
|
1254 | 1254 | '#type' => 'checkbox', |
1255 | 1255 | '#title' => bts(variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), array(), NULL, 'project:user-register'), |
1256 | 1256 | '#weight' => -8, |
1257 | 1257 | '#prefix' => '<div id="register-checkbox">', |
1258 | 1258 | '#suffix' => '</div>', |
1259 | - ); |
|
1259 | + ); |
|
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | $form['title2'] = array( |
1263 | - '#weight' => -6, |
|
1264 | - '#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 | - '#prefix' => '<div id="register-title2">', |
|
1266 | - '#suffix' => '</div>', |
|
1263 | + '#weight' => -6, |
|
1264 | + '#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 | + '#prefix' => '<div id="register-title2">', |
|
1266 | + '#suffix' => '</div>', |
|
1267 | 1267 | ); |
1268 | 1268 | |
1269 | 1269 | if (module_exists('captcha')) { |
1270 | - // Add an optional captcha |
|
1271 | - $form['register_captcha'] = array( |
|
1270 | + // Add an optional captcha |
|
1271 | + $form['register_captcha'] = array( |
|
1272 | 1272 | '#type' => 'captcha', |
1273 | 1273 | '#weight' => 1000, |
1274 | - ); |
|
1274 | + ); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | $form['#validate'][] = 'boincuser_register_validate'; |
@@ -1279,45 +1279,45 @@ discard block |
||
1279 | 1279 | $form['submit']['#weight'] = 1001; |
1280 | 1280 | break; |
1281 | 1281 | |
1282 | - // Request new password form |
|
1283 | - case 'user_pass': |
|
1282 | + // Request new password form |
|
1283 | + case 'user_pass': |
|
1284 | 1284 | drupal_set_title(bts('Forgot password', array(), NULL, 'boinc:forgot-password')); |
1285 | 1285 | // Replace name/email text box with email only; retain "name" label |
1286 | 1286 | // for compatibility with standard Drupal submit function |
1287 | 1287 | unset($form['name']); |
1288 | 1288 | array_unshift($form, array( |
1289 | - 'name' => array( |
|
1289 | + 'name' => array( |
|
1290 | 1290 | '#type' => 'textfield', |
1291 | 1291 | '#title' => bts('Email address', array(), NULL, 'boinc:email-address-to-login'), |
1292 | 1292 | '#size' => 60, |
1293 | 1293 | '#maxlength' => EMAIL_MAX_LENGTH, |
1294 | 1294 | '#required' => TRUE, |
1295 | 1295 | '#description' => bts( |
1296 | - 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
|
1297 | - array( |
|
1296 | + 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', |
|
1297 | + array( |
|
1298 | 1298 | '!authenticator_login' => l( |
1299 | - bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
1300 | - 'user/login/auth' |
|
1299 | + bts('authenticator-based login', array(), NULL, 'boinc:forgot-password'), |
|
1300 | + 'user/login/auth' |
|
1301 | + ) |
|
1301 | 1302 | ) |
1302 | - ) |
|
1303 | 1303 | , NULL, 'boinc:forgot-password'), |
1304 | - ), |
|
1304 | + ), |
|
1305 | 1305 | )); |
1306 | 1306 | |
1307 | 1307 | if (module_exists('captcha')) { |
1308 | - // Add an optional captcha |
|
1309 | - $form['register_captcha'] = array( |
|
1308 | + // Add an optional captcha |
|
1309 | + $form['register_captcha'] = array( |
|
1310 | 1310 | '#type' => 'captcha', |
1311 | 1311 | '#weight' => 0, |
1312 | 1312 | '#prefix' => '<div id="captcha-password-reset">', |
1313 | 1313 | '#suffix' => '</div>' |
1314 | - ); |
|
1314 | + ); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | // Wrap action buttons for styling consistency |
1318 | 1318 | $form['buttons']['form control tabs prefix'] = array( |
1319 | - '#value' => '<ul class="form-control tab-list">', |
|
1320 | - '#weight' => 1001, |
|
1319 | + '#value' => '<ul class="form-control tab-list">', |
|
1320 | + '#weight' => 1001, |
|
1321 | 1321 | ); |
1322 | 1322 | $form['buttons']['submit'] = $form['submit']; |
1323 | 1323 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
@@ -1325,26 +1325,26 @@ discard block |
||
1325 | 1325 | $form['buttons']['submit']['#suffix'] = '</li>'; |
1326 | 1326 | $form['buttons']['submit']['#weight'] = 1002; |
1327 | 1327 | $form['buttons']['cancel'] = array( |
1328 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1329 | - '#weight' => 1005, |
|
1328 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1329 | + '#weight' => 1005, |
|
1330 | 1330 | ); |
1331 | 1331 | $form['buttons']['form control tabs suffix'] = array( |
1332 | - '#value' => '</ul>', |
|
1333 | - '#weight' => 1010, |
|
1332 | + '#value' => '</ul>', |
|
1333 | + '#weight' => 1010, |
|
1334 | 1334 | ); |
1335 | 1335 | unset($form['submit']); |
1336 | 1336 | |
1337 | 1337 | // If the form is being submitted, use BOINC validation handler. |
1338 | 1338 | if (isset($form_state['post']['name'])) { |
1339 | - // Prepend the BOINC validation function to local validation |
|
1340 | - array_unshift($form['#validate'], 'boincuser_request_pass_validate'); |
|
1339 | + // Prepend the BOINC validation function to local validation |
|
1340 | + array_unshift($form['#validate'], 'boincuser_request_pass_validate'); |
|
1341 | 1341 | } |
1342 | 1342 | break; |
1343 | 1343 | |
1344 | - case 'views_exposed_form': |
|
1344 | + case 'views_exposed_form': |
|
1345 | 1345 | $form['submit']['#value'] = bts('Search', array(), NULL, 'boinc:search-user'); |
1346 | 1346 | break; |
1347 | - } |
|
1347 | + } |
|
1348 | 1348 | } |
1349 | 1349 | |
1350 | 1350 | /** |
@@ -1352,10 +1352,10 @@ discard block |
||
1352 | 1352 | * built; this is called from boincuser_form_alter() |
1353 | 1353 | */ |
1354 | 1354 | function boincuser_profile_node_form_after_build($form, &$form_state) { |
1355 | - // Move to community prefs form |
|
1356 | - $form_state['storage']['avatar'] = $form['field_image']; |
|
1357 | - unset($form['field_image']); |
|
1358 | - return $form; |
|
1355 | + // Move to community prefs form |
|
1356 | + $form_state['storage']['avatar'] = $form['field_image']; |
|
1357 | + unset($form['field_image']); |
|
1358 | + return $form; |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | /** |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6 |
1364 | 1364 | */ |
1365 | 1365 | function boincuser_elements() { |
1366 | - $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm'; |
|
1367 | - return $type; |
|
1366 | + $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm'; |
|
1367 | + return $type; |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | /** |
@@ -1372,11 +1372,11 @@ discard block |
||
1372 | 1372 | * profile form |
1373 | 1373 | */ |
1374 | 1374 | function boincuser_process_password_confirm($element) { |
1375 | - // Check if parent element is "account". |
|
1376 | - if ($element['#array_parents'][0] == 'account') { |
|
1375 | + // Check if parent element is "account". |
|
1376 | + if ($element['#array_parents'][0] == 'account') { |
|
1377 | 1377 | $element['pass1']['#title'] = bts('Change password', array(), NULL, 'boinc:forgot-password'); |
1378 | - } |
|
1379 | - return $element; |
|
1378 | + } |
|
1379 | + return $element; |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | /** |
@@ -1384,42 +1384,42 @@ discard block |
||
1384 | 1384 | * Register theme functions for use in this module. |
1385 | 1385 | */ |
1386 | 1386 | function boincuser_theme($existing, $type, $theme, $path) { |
1387 | - return array( |
|
1387 | + return array( |
|
1388 | 1388 | 'boincuser_user_pass' => array( |
1389 | - 'arguments' => array() |
|
1389 | + 'arguments' => array() |
|
1390 | 1390 | ) |
1391 | - ); |
|
1391 | + ); |
|
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | /** |
1395 | 1395 | * Implementation of hook_token_values |
1396 | 1396 | */ |
1397 | 1397 | function boincuser_token_values($type, $object = NULL, $options = array()) { |
1398 | - if ($type == 'user') { |
|
1398 | + if ($type == 'user') { |
|
1399 | 1399 | $account = user_load($object->uid); |
1400 | 1400 | $tokens['display-name'] = $account->boincuser_name; |
1401 | 1401 | return $tokens; |
1402 | - } |
|
1402 | + } |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | /** |
1406 | 1406 | * Implementation of hook_token_list |
1407 | 1407 | */ |
1408 | 1408 | function boincuser_token_list($type = 'all') { |
1409 | - if ($type == 'user' || $type == 'all') { |
|
1409 | + if ($type == 'user' || $type == 'all') { |
|
1410 | 1410 | $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
1411 | 1411 | return $tokens; |
1412 | - } |
|
1412 | + } |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | /** |
1416 | 1416 | * Implementation of hook_views_pre_execute() |
1417 | 1417 | */ |
1418 | 1418 | function boincuser_views_pre_execute(&$view) { |
1419 | - if ($view->args) { |
|
1419 | + if ($view->args) { |
|
1420 | 1420 | $account_id = $view->args[0]; |
1421 | - } |
|
1422 | - if ($view->name=="user_activity") { |
|
1421 | + } |
|
1422 | + if ($view->name=="user_activity") { |
|
1423 | 1423 | // Run the following custom query for the user_activity view |
1424 | 1424 | $view->build_info['query']= " |
1425 | 1425 | SELECT node_revisions.vid AS vid, |
@@ -1451,25 +1451,25 @@ discard block |
||
1451 | 1451 | |
1452 | 1452 | // count_query determines the pager. Do this so the right item count is returned. |
1453 | 1453 | $view->build_info['count_query'] = $view->build_info['query']; |
1454 | - } |
|
1454 | + } |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /** |
1458 | 1458 | * Implementation of hook_cron() |
1459 | 1459 | */ |
1460 | 1460 | function boincuser_cron() { |
1461 | - // Delete expired users in the BOINC database, user_delete table. |
|
1462 | - require_boinc('boinc_db'); |
|
1463 | - $num_deleted = BoincUserDeleted::delete_expired(); |
|
1464 | - if ($num_deleted>0) { |
|
1461 | + // Delete expired users in the BOINC database, user_delete table. |
|
1462 | + require_boinc('boinc_db'); |
|
1463 | + $num_deleted = BoincUserDeleted::delete_expired(); |
|
1464 | + if ($num_deleted>0) { |
|
1465 | 1465 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
1466 | - } |
|
1466 | + } |
|
1467 | 1467 | |
1468 | - // Delete expired tokens from token table |
|
1469 | - $tokens_deleted = BoincToken::delete_expired(); |
|
1470 | - if ($tokens_deleted>0) { |
|
1468 | + // Delete expired tokens from token table |
|
1469 | + $tokens_deleted = BoincToken::delete_expired(); |
|
1470 | + if ($tokens_deleted>0) { |
|
1471 | 1471 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
1472 | - } |
|
1472 | + } |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -1480,17 +1480,17 @@ discard block |
||
1480 | 1480 | * Page callback shortcut to recent posts for the logged in user |
1481 | 1481 | */ |
1482 | 1482 | function boincuser_goto_recent_posts() { |
1483 | - global $user; |
|
1484 | - drupal_goto("account/{$user->uid}/posts"); |
|
1483 | + global $user; |
|
1484 | + drupal_goto("account/{$user->uid}/posts"); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | /** |
1488 | 1488 | * Page callback shortcut to the team of the logged in user |
1489 | 1489 | */ |
1490 | 1490 | function boincuser_goto_team() { |
1491 | - global $user; |
|
1492 | - $account = user_load($user->uid); |
|
1493 | - drupal_goto("community/teams/{$account->team}"); |
|
1491 | + global $user; |
|
1492 | + $account = user_load($user->uid); |
|
1493 | + drupal_goto("community/teams/{$account->team}"); |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | /** |
@@ -1499,93 +1499,93 @@ discard block |
||
1499 | 1499 | * user profile pages, so use a wrapper for display |
1500 | 1500 | */ |
1501 | 1501 | function boincuser_view_profile($account = null) { |
1502 | - // Create the user profile page |
|
1503 | - if (!$account) { |
|
1502 | + // Create the user profile page |
|
1503 | + if (!$account) { |
|
1504 | 1504 | global $user; |
1505 | 1505 | $account = $user; |
1506 | - } |
|
1506 | + } |
|
1507 | 1507 | |
1508 | - $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
1509 | - $verified_contributor = array_search('verified contributor', user_roles(true)); |
|
1510 | - if (!isset($account->roles[$verified_contributor])) { |
|
1508 | + $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
1509 | + $verified_contributor = array_search('verified contributor', user_roles(true)); |
|
1510 | + if (!isset($account->roles[$verified_contributor])) { |
|
1511 | 1511 | drupal_set_message(bts( |
1512 | 1512 | 'You may only create or modify your user profile after earning @count credits.', |
1513 | 1513 | array('@count' => $min_credit_to_post), NULL, 'boinc:view-profile' |
1514 | 1514 | ), 'warning', FALSE); |
1515 | - } |
|
1515 | + } |
|
1516 | 1516 | |
1517 | - // For now, just call the user module profile view function |
|
1518 | - user_build_content($account); |
|
1519 | - return theme('user_profile', $account); |
|
1517 | + // For now, just call the user module profile view function |
|
1518 | + user_build_content($account); |
|
1519 | + return theme('user_profile', $account); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | /** |
1523 | 1523 | * Page callback for editing a user profile |
1524 | 1524 | */ |
1525 | 1525 | function boincuser_edit_profile($account = null) { |
1526 | - // Create the user profile form |
|
1527 | - if (!$account) { |
|
1526 | + // Create the user profile form |
|
1527 | + if (!$account) { |
|
1528 | 1528 | global $user; |
1529 | 1529 | $account = $user; |
1530 | - } |
|
1531 | - // Render the form |
|
1532 | - module_load_include('pages.inc', 'node', 'node'); |
|
1533 | - return content_profile_page_edit('profile', $account); |
|
1530 | + } |
|
1531 | + // Render the form |
|
1532 | + module_load_include('pages.inc', 'node', 'node'); |
|
1533 | + return content_profile_page_edit('profile', $account); |
|
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | /** |
1537 | - * Join page menu callback. |
|
1538 | - * Display instructions on joining for new or existing BOINC users |
|
1539 | - */ |
|
1537 | + * Join page menu callback. |
|
1538 | + * Display instructions on joining for new or existing BOINC users |
|
1539 | + */ |
|
1540 | 1540 | function join_page($type = null) { |
1541 | - global $base_url; |
|
1542 | - /* The paths/links to the rules-and-policies page is hardcoded |
|
1541 | + global $base_url; |
|
1542 | + /* The paths/links to the rules-and-policies page is hardcoded |
|
1543 | 1543 | * here. An improvement would be admin settings for the Join Page |
1544 | 1544 | * where this path could be set. |
1545 | 1545 | */ |
1546 | - $ruleslinkA = 'rules-and-policies'; |
|
1547 | - $ruleslinkB = 'content/rules-and-policies'; |
|
1548 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1549 | - $registration_enabled = variable_get('user_register', 0); |
|
1550 | - $output = '<div class="join">'; |
|
1551 | - switch ($type) { |
|
1552 | - case 'boinc': |
|
1546 | + $ruleslinkA = 'rules-and-policies'; |
|
1547 | + $ruleslinkB = 'content/rules-and-policies'; |
|
1548 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1549 | + $registration_enabled = variable_get('user_register', 0); |
|
1550 | + $output = '<div class="join">'; |
|
1551 | + switch ($type) { |
|
1552 | + case 'boinc': |
|
1553 | 1553 | $output .= '<ol>'; |
1554 | 1554 | if ($registration_enabled) { |
1555 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1556 | - array( |
|
1555 | + $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1556 | + array( |
|
1557 | 1557 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1558 | 1558 | '@sitename' => $site_name, |
1559 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1559 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
1560 | 1560 | } |
1561 | 1561 | $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
1562 | 1562 | $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
1563 | 1563 | array( |
1564 | - '@sitename' => $site_name, |
|
1565 | - '@siteurl' => $base_url, |
|
1564 | + '@sitename' => $site_name, |
|
1565 | + '@siteurl' => $base_url, |
|
1566 | 1566 | ), NULL, 'boinc:join-page') . '</li>'; |
1567 | 1567 | if ($registration_enabled) { |
1568 | - $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.", |
|
1568 | + $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 | 1569 | array( |
1570 | - '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
1570 | + '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
1571 | 1571 | ), NULL, 'boinc:join-page') . '</li>'; |
1572 | 1572 | } |
1573 | 1573 | else { |
1574 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
1574 | + $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
1575 | 1575 | 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.", |
1576 | 1576 | array( |
1577 | - '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
1577 | + '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
|
1578 | 1578 | ), NULL, 'boinc:join-page') . '</li>'; |
1579 | 1579 | } |
1580 | 1580 | $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
1581 | 1581 | upgrade to a more recent version of BOINC to create an account |
1582 | 1582 | at @this_project.", |
1583 | - array( |
|
1583 | + array( |
|
1584 | 1584 | '@this_project' => $site_name, |
1585 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1585 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
1586 | 1586 | $output .= '</ol>'; |
1587 | 1587 | break; |
1588 | - case 'new': |
|
1588 | + case 'new': |
|
1589 | 1589 | default: |
1590 | 1590 | // Determine if there is a link to rules-and-policies |
1591 | 1591 | //$ruleslink=''; |
@@ -1600,16 +1600,16 @@ discard block |
||
1600 | 1600 | // Join page output |
1601 | 1601 | $output .= '<ol>'; |
1602 | 1602 | if ($registration_enabled) { |
1603 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1604 | - array( |
|
1603 | + $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1604 | + array( |
|
1605 | 1605 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1606 | 1606 | '@sitename' => $site_name, |
1607 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1607 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
1608 | 1608 | } |
1609 | 1609 | else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
1610 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
1610 | + $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
1611 | 1611 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
1612 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1612 | + ), NULL, 'boinc:join-page') . '</li>'; |
|
1613 | 1613 | } |
1614 | 1614 | $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
1615 | 1615 | $output .= ' <p>'; |
@@ -1619,73 +1619,73 @@ discard block |
||
1619 | 1619 | $output .= ' </li>'; |
1620 | 1620 | $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
1621 | 1621 | $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
1622 | - '@sitename' => $site_name, |
|
1623 | - '@siteurl' => $base_url, |
|
1622 | + '@sitename' => $site_name, |
|
1623 | + '@siteurl' => $base_url, |
|
1624 | 1624 | ), NULL, 'boinc:join-page') . '</li>'; |
1625 | 1625 | $output .= '</ol>'; |
1626 | - } |
|
1627 | - $output .= '</div>'; |
|
1628 | - return $output; |
|
1626 | + } |
|
1627 | + $output .= '</div>'; |
|
1628 | + return $output; |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | /** |
1632 | - * Home page content for embedding in Panels page |
|
1633 | - */ |
|
1632 | + * Home page content for embedding in Panels page |
|
1633 | + */ |
|
1634 | 1634 | function boincuser_home_page() { |
1635 | - global $user; |
|
1636 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1637 | - // get the front page message from database; this is set in the admin interface under BOINC Other |
|
1638 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
1635 | + global $user; |
|
1636 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1637 | + // get the front page message from database; this is set in the admin interface under BOINC Other |
|
1638 | + $site_message = variable_get('boinc_other_frontpage',''); |
|
1639 | 1639 | |
1640 | - // Determine the user of the day |
|
1641 | - $current_uotd = db_fetch_object(db_query(" |
|
1640 | + // Determine the user of the day |
|
1641 | + $current_uotd = db_fetch_object(db_query(" |
|
1642 | 1642 | SELECT |
1643 | 1643 | uid, |
1644 | 1644 | uotd_time |
1645 | 1645 | FROM {boincuser} |
1646 | 1646 | ORDER BY uotd_time DESC |
1647 | 1647 | LIMIT 1" |
1648 | - )); |
|
1649 | - if ($current_uotd->uotd_time < strtotime('today midnight')) { |
|
1648 | + )); |
|
1649 | + if ($current_uotd->uotd_time < strtotime('today midnight')) { |
|
1650 | 1650 | $uotd = boincuser_select_user_of_the_day(); |
1651 | - } |
|
1652 | - else { |
|
1651 | + } |
|
1652 | + else { |
|
1653 | 1653 | $uotd = user_load($current_uotd->uid); |
1654 | - } |
|
1655 | - $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
1656 | - $output = '<h2 class="pane-title">'; |
|
1657 | - $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')); |
|
1658 | - $output .= '</h2>'; |
|
1659 | - $output .= '<div class="boinc-overview balance-height-front">'; |
|
1660 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1661 | - if ($user->uid) { |
|
1654 | + } |
|
1655 | + $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE); |
|
1656 | + $output = '<h2 class="pane-title">'; |
|
1657 | + $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')); |
|
1658 | + $output .= '</h2>'; |
|
1659 | + $output .= '<div class="boinc-overview balance-height-front">'; |
|
1660 | + $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1661 | + if ($user->uid) { |
|
1662 | 1662 | $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1663 | - } |
|
1664 | - else { |
|
1663 | + } |
|
1664 | + else { |
|
1665 | 1665 | $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
1666 | - } |
|
1667 | - $output .= '</div>'; |
|
1668 | - $output .= '<div class="boinc-overview-details">'; |
|
1669 | - $output .= ' <div class="detail-container">'; |
|
1670 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
1671 | - $output .= ' <div class="picture">'; |
|
1672 | - $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
|
1666 | + } |
|
1667 | + $output .= '</div>'; |
|
1668 | + $output .= '<div class="boinc-overview-details">'; |
|
1669 | + $output .= ' <div class="detail-container">'; |
|
1670 | + $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
1671 | + $output .= ' <div class="picture">'; |
|
1672 | + $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
|
1673 | 1673 | $uotd_image['alt'], array(), FALSE); |
1674 | - $output .= ' </div>'; |
|
1675 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1676 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
1677 | - $output .= ' </a>'; |
|
1678 | - $output .= ' <div class="volunteers">'; |
|
1679 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1680 | - $output .= ' <div class="platforms">'; |
|
1681 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1682 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1683 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1684 | - $output .= ' </div>'; |
|
1685 | - $output .= ' </div>'; |
|
1686 | - $output .= ' </div>'; |
|
1687 | - $output .= '</div>'; |
|
1688 | - return $output; |
|
1674 | + $output .= ' </div>'; |
|
1675 | + $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1676 | + $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
1677 | + $output .= ' </a>'; |
|
1678 | + $output .= ' <div class="volunteers">'; |
|
1679 | + $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1680 | + $output .= ' <div class="platforms">'; |
|
1681 | + $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1682 | + $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1683 | + $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1684 | + $output .= ' </div>'; |
|
1685 | + $output .= ' </div>'; |
|
1686 | + $output .= ' </div>'; |
|
1687 | + $output .= '</div>'; |
|
1688 | + return $output; |
|
1689 | 1689 | } |
1690 | 1690 | |
1691 | 1691 | /** |
@@ -1693,81 +1693,81 @@ discard block |
||
1693 | 1693 | * Create a new user account based on supplied parameters. |
1694 | 1694 | */ |
1695 | 1695 | function boincuser_create_account() { |
1696 | - global $base_url; |
|
1696 | + global $base_url; |
|
1697 | 1697 | |
1698 | - require_boinc('boinc_db'); |
|
1699 | - require_boinc('user_util'); |
|
1700 | - require_boinc('xml'); |
|
1701 | - $params = array( |
|
1698 | + require_boinc('boinc_db'); |
|
1699 | + require_boinc('user_util'); |
|
1700 | + require_boinc('xml'); |
|
1701 | + $params = array( |
|
1702 | 1702 | 'email_addr' => isset($_GET['email_addr']) ? $_GET['email_addr'] : '', |
1703 | 1703 | 'user_name' => isset($_GET['user_name']) ? $_GET['user_name'] : '', |
1704 | 1704 | 'passwd_hash' => isset($_GET['passwd_hash']) ? $_GET['passwd_hash'] : '' |
1705 | - ); |
|
1705 | + ); |
|
1706 | 1706 | |
1707 | - // Begin output |
|
1708 | - xml_header(); |
|
1707 | + // Begin output |
|
1708 | + xml_header(); |
|
1709 | 1709 | |
1710 | - // Account creation disabled |
|
1711 | - $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
1712 | - if (!$enablethisRPC) { |
|
1710 | + // Account creation disabled |
|
1711 | + $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
|
1712 | + if (!$enablethisRPC) { |
|
1713 | 1713 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
1714 | - '@url' => $base_url . '/user/registration', |
|
1714 | + '@url' => $base_url . '/user/registration', |
|
1715 | 1715 | ), |
1716 | 1716 | NULL, 'boinc:create_account'); |
1717 | 1717 | xml_error(-208, $mess); |
1718 | - } |
|
1719 | - // Invalid invite code |
|
1718 | + } |
|
1719 | + // Invalid invite code |
|
1720 | 1720 | |
1721 | - // Validate input |
|
1722 | - if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { |
|
1721 | + // Validate input |
|
1722 | + if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) { |
|
1723 | 1723 | xml_error(-205); |
1724 | - } |
|
1724 | + } |
|
1725 | 1725 | |
1726 | - // Make sure user_name is unique and cleaned |
|
1727 | - $unique_name = create_proper_drupalname($params['user_name']); |
|
1728 | - if ($error = user_validate_name($unique_name)) { |
|
1726 | + // Make sure user_name is unique and cleaned |
|
1727 | + $unique_name = create_proper_drupalname($params['user_name']); |
|
1728 | + if ($error = user_validate_name($unique_name)) { |
|
1729 | 1729 | xml_error(-188, $error); |
1730 | - } |
|
1731 | - if (strlen($params['passwd_hash']) != 32) { |
|
1730 | + } |
|
1731 | + if (strlen($params['passwd_hash']) != 32) { |
|
1732 | 1732 | xml_error(-1, 'password hash length not 32'); |
1733 | - } |
|
1733 | + } |
|
1734 | 1734 | |
1735 | - // Process input |
|
1736 | - // Check this email against previous email addresses. |
|
1737 | - $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']); |
|
1738 | - if ($tmpuser) { |
|
1735 | + // Process input |
|
1736 | + // Check this email against previous email addresses. |
|
1737 | + $tmpuser = BoincUser::lookup_prev_email_addr($params['email_addr']); |
|
1738 | + if ($tmpuser) { |
|
1739 | 1739 | xml_error(-137); |
1740 | - } |
|
1740 | + } |
|
1741 | 1741 | |
1742 | - // Check this email on current email addresses. |
|
1743 | - $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
|
1744 | - if ($boinc_user) { |
|
1742 | + // Check this email on current email addresses. |
|
1743 | + $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
|
1744 | + if ($boinc_user) { |
|
1745 | 1745 | // Return authenticator for existing users |
1746 | 1746 | if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
1747 | 1747 | password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
1748 | - $output = array('authenticator' => $boinc_user->authenticator); |
|
1748 | + $output = array('authenticator' => $boinc_user->authenticator); |
|
1749 | 1749 | } |
1750 | 1750 | else { |
1751 | - xml_error(-137); |
|
1751 | + xml_error(-137); |
|
1752 | 1752 | } |
1753 | - } |
|
1754 | - else { |
|
1753 | + } |
|
1754 | + else { |
|
1755 | 1755 | // Verify that there isn't somehow a Drupal user already (not possible with proper function) |
1756 | 1756 | if ($existing_user = user_load(array('mail' => $params['email_addr']))) { |
1757 | - xml_error(-137, 'account error'); |
|
1757 | + xml_error(-137, 'account error'); |
|
1758 | 1758 | } |
1759 | 1759 | // Create new account |
1760 | 1760 | $unrestricted_role = array_search('community member', user_roles(true)); |
1761 | 1761 | |
1762 | 1762 | $newUser = array( |
1763 | - 'name' => $unique_name, |
|
1764 | - '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 |
|
1765 | - 'mail' => $params['email_addr'], |
|
1766 | - 'status' => 1, |
|
1767 | - 'init' => $params['email_addr'], |
|
1768 | - 'roles' => array($unrestricted_role => ''), |
|
1769 | - 'boincuser_name' => $params['user_name'], |
|
1770 | - 'boinchash_flag' => TRUE, |
|
1763 | + 'name' => $unique_name, |
|
1764 | + '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 |
|
1765 | + 'mail' => $params['email_addr'], |
|
1766 | + 'status' => 1, |
|
1767 | + 'init' => $params['email_addr'], |
|
1768 | + 'roles' => array($unrestricted_role => ''), |
|
1769 | + 'boincuser_name' => $params['user_name'], |
|
1770 | + 'boinchash_flag' => TRUE, |
|
1771 | 1771 | ); |
1772 | 1772 | |
1773 | 1773 | // Create the drupal user. If the drupal user cannot be created, |
@@ -1775,17 +1775,17 @@ discard block |
||
1775 | 1775 | // The user is created in the 'insert' op in hook_user. |
1776 | 1776 | $user = user_save(null, $newUser); |
1777 | 1777 | if (!$user) { |
1778 | - watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); |
|
1779 | - xml_error(-137, 'error creating BOINC account'); |
|
1778 | + watchdog('boincuser', 'create_account: Failed to create Drupal user account for @email', array('@email' => $params['email_addr']), WATCHDOG_WARNING); |
|
1779 | + xml_error(-137, 'error creating BOINC account'); |
|
1780 | 1780 | }// if drupal user created. |
1781 | 1781 | |
1782 | 1782 | $output = array('authenticator' => $user->boincuser_account_key); |
1783 | - }// if existing user found. |
|
1783 | + }// if existing user found. |
|
1784 | 1784 | |
1785 | - // Output authenticator |
|
1786 | - echo " <account_out>\n"; |
|
1787 | - echo " <authenticator>{$output['authenticator']}</authenticator>\n"; |
|
1788 | - echo "</account_out>\n"; |
|
1785 | + // Output authenticator |
|
1786 | + echo " <account_out>\n"; |
|
1787 | + echo " <authenticator>{$output['authenticator']}</authenticator>\n"; |
|
1788 | + echo "</account_out>\n"; |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | /** |
@@ -1793,166 +1793,166 @@ discard block |
||
1793 | 1793 | * account is created using the BOINC clinet. |
1794 | 1794 | */ |
1795 | 1795 | function boincuser_account_finish() { |
1796 | - global $user; |
|
1796 | + global $user; |
|
1797 | 1797 | |
1798 | - $authtoken = isset($_GET['auth']) ? $_GET['auth'] : ''; |
|
1798 | + $authtoken = isset($_GET['auth']) ? $_GET['auth'] : ''; |
|
1799 | 1799 | |
1800 | - // Ensure there is a authentication token before continuing |
|
1801 | - if (empty($authtoken)) { |
|
1800 | + // Ensure there is a authentication token before continuing |
|
1801 | + if (empty($authtoken)) { |
|
1802 | 1802 | drupal_not_found(); |
1803 | 1803 | return ; |
1804 | - } |
|
1804 | + } |
|
1805 | 1805 | |
1806 | - if (strlen($authtoken) != 32) { |
|
1806 | + if (strlen($authtoken) != 32) { |
|
1807 | 1807 | drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
1808 | 1808 | drupal_goto(); |
1809 | - } |
|
1809 | + } |
|
1810 | 1810 | |
1811 | - require_boinc('boinc_db'); |
|
1812 | - $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
|
1813 | - if (!$boinc_user) { |
|
1811 | + require_boinc('boinc_db'); |
|
1812 | + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authtoken)."'"); |
|
1813 | + if (!$boinc_user) { |
|
1814 | 1814 | drupal_set_message(bts('ERROR: There is no account with that authenticator.', array(), NULL, 'boinc:account-finish'), 'error'); |
1815 | 1815 | drupal_goto(); |
1816 | - } |
|
1817 | - $user = user_load(get_drupal_id($boinc_user->id)); |
|
1816 | + } |
|
1817 | + $user = user_load(get_drupal_id($boinc_user->id)); |
|
1818 | 1818 | |
1819 | - if (!$user) { |
|
1819 | + if (!$user) { |
|
1820 | 1820 | 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'); |
1821 | 1821 | drupal_goto(); |
1822 | - } |
|
1822 | + } |
|
1823 | 1823 | |
1824 | - // Lookup path to custom account finish page |
|
1825 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
1826 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
1824 | + // Lookup path to custom account finish page |
|
1825 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
1826 | + if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
1827 | 1827 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
1828 | 1828 | if ($node) { |
1829 | - return node_page_view($node); |
|
1829 | + return node_page_view($node); |
|
1830 | + } |
|
1830 | 1831 | } |
1831 | - } |
|
1832 | 1832 | |
1833 | - // open links in new window |
|
1834 | - $options = array( |
|
1833 | + // open links in new window |
|
1834 | + $options = array( |
|
1835 | 1835 | 'attributes' => array( 'target' => '_blank' ), |
1836 | - ); |
|
1836 | + ); |
|
1837 | 1837 | |
1838 | - // Check moderation page exists |
|
1839 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
1840 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
1838 | + // Check moderation page exists |
|
1839 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
1840 | + if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
1841 | 1841 | $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'); |
1842 | - } else { |
|
1842 | + } else { |
|
1843 | 1843 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
1844 | - } |
|
1844 | + } |
|
1845 | 1845 | |
1846 | - $username = $user->boincuser_name; |
|
1847 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1848 | - $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.)', |
|
1849 | - array( |
|
1846 | + $username = $user->boincuser_name; |
|
1847 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1848 | + $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.)', |
|
1849 | + array( |
|
1850 | 1850 | '@user_name' => $username, |
1851 | 1851 | '@site_name' => $site_name, |
1852 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
1852 | + ), NULL, 'boinc:account-finish') . "</p>"; |
|
1853 | 1853 | |
1854 | - $links = array( |
|
1854 | + $links = array( |
|
1855 | 1855 | array( |
1856 | - 'data' => bts('Change your username at !community_preferences.', array( |
|
1856 | + 'data' => bts('Change your username at !community_preferences.', array( |
|
1857 | 1857 | '!community_preferences' => l(bts('Community Preferences', array(), NULL, 'boinc:account-fininsh'), 'account/prefs/community', $options), |
1858 | - ), NULL, 'boinc:account-finish'), |
|
1859 | - 'children' => array( |
|
1858 | + ), NULL, 'boinc:account-finish'), |
|
1859 | + 'children' => array( |
|
1860 | 1860 | bts('Your username is used to identify yourself to other volunteers on this Web site.', array(), NULL, 'boinc:account-finish'), |
1861 | 1861 | bts('In addition, you may set your account\'s default language and adjust notification settings.', array(), NULL, 'boinc:account-finish'), |
1862 | - ), |
|
1862 | + ), |
|
1863 | 1863 | ), |
1864 | 1864 | array( |
1865 | - 'data' => bts('Change your !computing_preferences.', array( |
|
1865 | + 'data' => bts('Change your !computing_preferences.', array( |
|
1866 | 1866 | '!computing_preferences' => l(bts('Computing Preferences', array(), NULL, 'boinc:account-finish'), 'account/prefs', $options), |
1867 | - ), NULL, 'boinc:account-finish'), |
|
1868 | - 'children' => array( |
|
1867 | + ), NULL, 'boinc:account-finish'), |
|
1868 | + 'children' => array( |
|
1869 | 1869 | 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'), |
1870 | 1870 | bts('By default, you will run @site_name tasks without any additional configuration.', array( |
1871 | - '@site_name' => $site_name, |
|
1871 | + '@site_name' => $site_name, |
|
1872 | 1872 | ), NULL, 'boinc:account-finish'), |
1873 | 1873 | 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( |
1874 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
1874 | + '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options), |
|
1875 | 1875 | ), NULL, 'boinc:account-finish'), |
1876 | - ), |
|
1876 | + ), |
|
1877 | 1877 | ), |
1878 | 1878 | array( |
1879 | 1879 | 'data' => bts('Create a !user_profile.', array( |
1880 | - '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
1880 | + '!user_profile' => l(bts('User Profile', array(), NULL, 'boinc:account-finish'), '/account/profile/edit', $options), |
|
1881 | 1881 | ), NULL, 'boinc:account-finish'), |
1882 | - 'children' => array( |
|
1882 | + 'children' => array( |
|
1883 | 1883 | bts('A user profile will inform other volunteers who you are and why you joined @site_name.', array( |
1884 | - '@site_name' => $site_name, |
|
1884 | + '@site_name' => $site_name, |
|
1885 | 1885 | ), NULL, 'boinc:account-finish'), |
1886 | 1886 | $modsentence, |
1887 | - ), |
|
1887 | + ), |
|
1888 | 1888 | ), |
1889 | 1889 | array( |
1890 | - 'data' => bts('Join a !team.', array( |
|
1890 | + 'data' => bts('Join a !team.', array( |
|
1891 | 1891 | '!team' => l(bts('Team', array(), NULL, 'boinc:account-finish'), '/community/teams', $options), |
1892 | - ), NULL, 'boinc:account-finish'), |
|
1893 | - 'children' => array( |
|
1892 | + ), NULL, 'boinc:account-finish'), |
|
1893 | + 'children' => array( |
|
1894 | 1894 | bts('You may join a team, made up of other volunteers.', array(), NULL, 'boinc:account-finish'), |
1895 | - ), |
|
1895 | + ), |
|
1896 | 1896 | ), |
1897 | 1897 | array( |
1898 | - 'data' => bts('Go to your !account_dashboard.', array( |
|
1898 | + 'data' => bts('Go to your !account_dashboard.', array( |
|
1899 | 1899 | '!account_dashboard'=> l(bts('Account Dashboard', array(), NULL, 'boinc:account-finish'), 'account/dashboard', $options), |
1900 | - ), NULL, 'boinc:account-finish'), |
|
1901 | - 'children' => array( |
|
1900 | + ), NULL, 'boinc:account-finish'), |
|
1901 | + 'children' => array( |
|
1902 | 1902 | bts('Your account dashboard has information and links about your computer(s) and task(s) assigned.', array(), NULL, 'boinc:account-finish'), |
1903 | - ), |
|
1903 | + ), |
|
1904 | 1904 | ), |
1905 | 1905 | array( |
1906 | - 'data' => bts('Visit our !help pages.', array( |
|
1906 | + 'data' => bts('Visit our !help pages.', array( |
|
1907 | 1907 | '!help' => l(bts('Help', array(), NULL, 'boinc:account-finish'), '/help', $options) |
1908 | - ), NULL, 'boinc:account-finish'), |
|
1909 | - 'children' => array( |
|
1908 | + ), NULL, 'boinc:account-finish'), |
|
1909 | + 'children' => array( |
|
1910 | 1910 | bts('Ask for help in our community\'s !forums.', array( |
1911 | - '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
1911 | + '!forums' => l(bts('forums', array(), NULL, 'boinc:account-finish'), 'community/forum', $options) |
|
1912 | 1912 | ), NULL, 'boinc:account-finish'), |
1913 | - ), |
|
1913 | + ), |
|
1914 | 1914 | ), |
1915 | - ); |
|
1915 | + ); |
|
1916 | 1916 | |
1917 | - //List of links |
|
1918 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1917 | + //List of links |
|
1918 | + $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1919 | 1919 | |
1920 | - return $output; |
|
1920 | + return $output; |
|
1921 | 1921 | } |
1922 | 1922 | |
1923 | 1923 | /** |
1924 | 1924 | * Determine if the user has permission to control community access |
1925 | 1925 | */ |
1926 | 1926 | function boincuser_moderate_community_access() { |
1927 | - if (user_access('assign community member role') |
|
1927 | + if (user_access('assign community member role') |
|
1928 | 1928 | OR user_access('assign all roles')) { |
1929 | 1929 | return TRUE; |
1930 | - } |
|
1931 | - return FALSE; |
|
1930 | + } |
|
1931 | + return FALSE; |
|
1932 | 1932 | } |
1933 | 1933 | |
1934 | 1934 | /** |
1935 | 1935 | * Get the count of items in the moderation queue |
1936 | 1936 | */ |
1937 | 1937 | function boincuser_moderation_queue_count($caller = 'user') { |
1938 | - $allowed = FALSE; |
|
1939 | - switch ($caller) { |
|
1940 | - case 'cron': |
|
1938 | + $allowed = FALSE; |
|
1939 | + switch ($caller) { |
|
1940 | + case 'cron': |
|
1941 | 1941 | $allowed = TRUE; |
1942 | 1942 | break; |
1943 | - case 'user': |
|
1943 | + case 'user': |
|
1944 | 1944 | default: |
1945 | 1945 | $allowed = user_access('edit any profile content'); |
1946 | - } |
|
1947 | - if ($allowed) { |
|
1946 | + } |
|
1947 | + if ($allowed) { |
|
1948 | 1948 | return db_result(db_query(" |
1949 | 1949 | SELECT COUNT(*) |
1950 | 1950 | FROM {node} |
1951 | 1951 | WHERE type = 'profile' |
1952 | 1952 | AND moderate = 1" |
1953 | 1953 | )); |
1954 | - } |
|
1955 | - return NULL; |
|
1954 | + } |
|
1955 | + return NULL; |
|
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | /** |
@@ -1961,43 +1961,43 @@ discard block |
||
1961 | 1961 | * than through the user account info form. |
1962 | 1962 | */ |
1963 | 1963 | function boincuser_control($uid = NULL, $action = NULL) { |
1964 | - if (!$uid OR !$account = user_load($uid)) { |
|
1964 | + if (!$uid OR !$account = user_load($uid)) { |
|
1965 | 1965 | // What are you even doing here... |
1966 | 1966 | return FALSE; |
1967 | - } |
|
1968 | - switch ($action) { |
|
1969 | - case 'ban': |
|
1967 | + } |
|
1968 | + switch ($action) { |
|
1969 | + case 'ban': |
|
1970 | 1970 | if (boincuser_moderate_community_access()) { |
1971 | - $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); |
|
1972 | - $boincuser_record = array( |
|
1971 | + $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60); |
|
1972 | + $boincuser_record = array( |
|
1973 | 1973 | 'uid' => $uid, |
1974 | 1974 | 'penalty_expiration' => time() + $penalty_period, |
1975 | - ); |
|
1976 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
1977 | - $community_role = array_search('community member', user_roles(true)); |
|
1978 | - if (isset($account->roles[$community_role])) { |
|
1975 | + ); |
|
1976 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
1977 | + $community_role = array_search('community member', user_roles(true)); |
|
1978 | + if (isset($account->roles[$community_role])) { |
|
1979 | 1979 | unset($account->roles[$community_role]); |
1980 | 1980 | user_save($account, array('roles' => $account->roles)); |
1981 | - } |
|
1981 | + } |
|
1982 | 1982 | } |
1983 | 1983 | break; |
1984 | - case 'lift-ban': |
|
1984 | + case 'lift-ban': |
|
1985 | 1985 | if (boincuser_moderate_community_access()) { |
1986 | - $boincuser_record = array( |
|
1986 | + $boincuser_record = array( |
|
1987 | 1987 | 'uid' => $uid, |
1988 | 1988 | 'penalty_expiration' => 0, |
1989 | - ); |
|
1990 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
1991 | - $community_role = array_search('community member', user_roles(true)); |
|
1992 | - if (!isset($account->roles[$community_role])) { |
|
1989 | + ); |
|
1990 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
1991 | + $community_role = array_search('community member', user_roles(true)); |
|
1992 | + if (!isset($account->roles[$community_role])) { |
|
1993 | 1993 | $account->roles[$community_role] = 'community member'; |
1994 | 1994 | user_save($account, array('roles' => $account->roles)); |
1995 | - } |
|
1995 | + } |
|
1996 | 1996 | } |
1997 | 1997 | break; |
1998 | - default: |
|
1998 | + default: |
|
1999 | 1999 | } |
2000 | - drupal_goto("account/{$account->uid}"); |
|
2000 | + drupal_goto("account/{$account->uid}"); |
|
2001 | 2001 | } |
2002 | 2002 | |
2003 | 2003 | /** |
@@ -2005,29 +2005,29 @@ discard block |
||
2005 | 2005 | * moderation flag. |
2006 | 2006 | */ |
2007 | 2007 | function boincuser_moderate_profile_approve($account) { |
2008 | - $node = new stdClass; |
|
2009 | - $node->type = 'profile'; |
|
2010 | - $node->language = ''; |
|
2011 | - $nid = content_profile_profile_exists($node, $account->uid); |
|
2012 | - $profile = node_load($nid); |
|
2013 | - $profile->moderate = 0; |
|
2014 | - $profile->status = 1; |
|
2015 | - node_save($profile); |
|
2016 | - drupal_set_message('This profile has been marked as approved.'); |
|
2017 | - drupal_goto(); |
|
2008 | + $node = new stdClass; |
|
2009 | + $node->type = 'profile'; |
|
2010 | + $node->language = ''; |
|
2011 | + $nid = content_profile_profile_exists($node, $account->uid); |
|
2012 | + $profile = node_load($nid); |
|
2013 | + $profile->moderate = 0; |
|
2014 | + $profile->status = 1; |
|
2015 | + node_save($profile); |
|
2016 | + drupal_set_message('This profile has been marked as approved.'); |
|
2017 | + drupal_goto(); |
|
2018 | 2018 | } |
2019 | 2019 | |
2020 | 2020 | /** |
2021 | 2021 | * Mark a user profile as rejected and notify the user of the reason. |
2022 | 2022 | */ |
2023 | 2023 | function boincuser_moderate_profile_reject($uid, $reason = '') { |
2024 | - $account = user_load($uid); |
|
2025 | - $node = new stdClass; |
|
2026 | - $node->type = 'profile'; |
|
2027 | - $node->language = ''; |
|
2028 | - $nid = content_profile_profile_exists($node, $uid); |
|
2029 | - $profile = node_load($nid); |
|
2030 | - if ($profile->nid) { |
|
2024 | + $account = user_load($uid); |
|
2025 | + $node = new stdClass; |
|
2026 | + $node->type = 'profile'; |
|
2027 | + $node->language = ''; |
|
2028 | + $nid = content_profile_profile_exists($node, $uid); |
|
2029 | + $profile = node_load($nid); |
|
2030 | + if ($profile->nid) { |
|
2031 | 2031 | global $user; |
2032 | 2032 | global $base_url; |
2033 | 2033 | global $base_path; |
@@ -2038,64 +2038,64 @@ discard block |
||
2038 | 2038 | $profile->status = 0; |
2039 | 2039 | node_save($profile); |
2040 | 2040 | $settings = array( |
2041 | - 'from' => '', |
|
2042 | - 'subject' => "Profile moderation at {$site_name}", |
|
2043 | - 'message' => '' |
|
2044 | - . "{$account->boincuser_name},\n" |
|
2045 | - . "\n" |
|
2046 | - . "{$moderator->boincuser_name} has rejected your profile at" |
|
2047 | - . " {$site_name} for the following reason: \n" |
|
2048 | - . "\n" |
|
2049 | - . "{$reason}\n" |
|
2050 | - . "\n" |
|
2051 | - . "\n" |
|
2052 | - . "Since it has not been approved, your profile is not visible to other" |
|
2053 | - . " {$site_name} users. Please make the needed changes here:\n" |
|
2054 | - . "\n" |
|
2055 | - . "{$site_url}account/profile \n" |
|
2056 | - . "\n" |
|
2057 | - . "Thanks, \n" |
|
2058 | - . "\n" |
|
2059 | - . "{$site_name} support team", |
|
2041 | + 'from' => '', |
|
2042 | + 'subject' => "Profile moderation at {$site_name}", |
|
2043 | + 'message' => '' |
|
2044 | + . "{$account->boincuser_name},\n" |
|
2045 | + . "\n" |
|
2046 | + . "{$moderator->boincuser_name} has rejected your profile at" |
|
2047 | + . " {$site_name} for the following reason: \n" |
|
2048 | + . "\n" |
|
2049 | + . "{$reason}\n" |
|
2050 | + . "\n" |
|
2051 | + . "\n" |
|
2052 | + . "Since it has not been approved, your profile is not visible to other" |
|
2053 | + . " {$site_name} users. Please make the needed changes here:\n" |
|
2054 | + . "\n" |
|
2055 | + . "{$site_url}account/profile \n" |
|
2056 | + . "\n" |
|
2057 | + . "Thanks, \n" |
|
2058 | + . "\n" |
|
2059 | + . "{$site_name} support team", |
|
2060 | 2060 | ); |
2061 | 2061 | rules_action_mail_to_user($account, $settings); |
2062 | 2062 | drupal_set_message('This profile has been marked as rejected.'); |
2063 | - } |
|
2064 | - drupal_goto(); |
|
2063 | + } |
|
2064 | + drupal_goto(); |
|
2065 | 2065 | } |
2066 | 2066 | |
2067 | 2067 | /** |
2068 | 2068 | * Ban a user and send a notification of the reason. |
2069 | 2069 | */ |
2070 | 2070 | function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') { |
2071 | - if (user_access('assign community member role') |
|
2071 | + if (user_access('assign community member role') |
|
2072 | 2072 | OR user_access('assign all roles')) { |
2073 | 2073 | $account = user_load($uid); |
2074 | 2074 | if ($account->uid) { |
2075 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
2076 | - if ($duration === '') { |
|
2075 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
2076 | + if ($duration === '') { |
|
2077 | 2077 | $duration = variable_get('boinc_penalty_period', 7*24*60*60); |
2078 | - } |
|
2079 | - $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295; |
|
2080 | - $boincuser_record = array( |
|
2078 | + } |
|
2079 | + $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295; |
|
2080 | + $boincuser_record = array( |
|
2081 | 2081 | 'uid' => $uid, |
2082 | 2082 | 'penalty_expiration' => $penalty_expiration, |
2083 | - ); |
|
2084 | - drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
2083 | + ); |
|
2084 | + drupal_write_record('boincuser', $boincuser_record, 'uid'); |
|
2085 | 2085 | |
2086 | - $community_role = array_search('community member', user_roles(true)); |
|
2087 | - if (isset($account->roles[$community_role])) { |
|
2086 | + $community_role = array_search('community member', user_roles(true)); |
|
2087 | + if (isset($account->roles[$community_role])) { |
|
2088 | 2088 | unset($account->roles[$community_role]); |
2089 | 2089 | user_save($account, array('roles' => $account->roles)); |
2090 | - } |
|
2090 | + } |
|
2091 | 2091 | |
2092 | - global $user; |
|
2093 | - global $base_url; |
|
2094 | - global $base_path; |
|
2095 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
2096 | - $site_url = $base_url . $base_path; |
|
2097 | - $moderator = user_load($user->uid); |
|
2098 | - $settings = array( |
|
2092 | + global $user; |
|
2093 | + global $base_url; |
|
2094 | + global $base_path; |
|
2095 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
2096 | + $site_url = $base_url . $base_path; |
|
2097 | + $moderator = user_load($user->uid); |
|
2098 | + $settings = array( |
|
2099 | 2099 | 'from' => '', |
2100 | 2100 | 'subject' => "User moderation at {$site_name}", |
2101 | 2101 | 'message' => '' |
@@ -2116,12 +2116,12 @@ discard block |
||
2116 | 2116 | . "Thanks, \n" |
2117 | 2117 | . "\n" |
2118 | 2118 | . "{$site_name} support team", |
2119 | - ); |
|
2120 | - rules_action_mail_to_user($account, $settings); |
|
2121 | - drupal_set_message('This user has been banned.'); |
|
2119 | + ); |
|
2120 | + rules_action_mail_to_user($account, $settings); |
|
2121 | + drupal_set_message('This user has been banned.'); |
|
2122 | 2122 | } |
2123 | - } |
|
2124 | - drupal_goto(); |
|
2123 | + } |
|
2124 | + drupal_goto(); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | 2127 | |
@@ -2133,15 +2133,15 @@ discard block |
||
2133 | 2133 | * |
2134 | 2134 | */ |
2135 | 2135 | function boincuser_get_weak_auth($boinc_id = null) { |
2136 | - if (!$boinc_id) { |
|
2136 | + if (!$boinc_id) { |
|
2137 | 2137 | global $user; |
2138 | 2138 | $account = user_load($user->uid); |
2139 | 2139 | $boinc_id = $account->boincuser_id; |
2140 | - } |
|
2140 | + } |
|
2141 | 2141 | |
2142 | - $boinc_user = boincuser_load($account->boincuser_id); |
|
2142 | + $boinc_user = boincuser_load($account->boincuser_id); |
|
2143 | 2143 | |
2144 | - return weak_auth($boinc_user); |
|
2144 | + return weak_auth($boinc_user); |
|
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | /** |
@@ -2150,75 +2150,75 @@ discard block |
||
2150 | 2150 | * Drupal User so must be inserted into comments, etc. (not so by default) |
2151 | 2151 | */ |
2152 | 2152 | function boincuser_get_user_profile_image($uid, $avatar = TRUE) { |
2153 | - // Though the function name implies otherwise, get the avatar by default |
|
2154 | - $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
|
2155 | - $image_fid = db_result(db_query(" |
|
2153 | + // Though the function name implies otherwise, get the avatar by default |
|
2154 | + $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid'; |
|
2155 | + $image_fid = db_result(db_query(" |
|
2156 | 2156 | SELECT ctp.%s |
2157 | 2157 | FROM {content_type_profile} ctp |
2158 | 2158 | INNER JOIN {node} n ON ctp.nid = n.nid |
2159 | 2159 | WHERE n.uid = %d AND n.type = '%s'", |
2160 | 2160 | $image_field, $uid, 'profile')); |
2161 | - $user_image['image'] = field_file_load($image_fid); |
|
2162 | - if (!$user_image['image']['filepath']) { |
|
2161 | + $user_image['image'] = field_file_load($image_fid); |
|
2162 | + if (!$user_image['image']['filepath']) { |
|
2163 | 2163 | // Load the default image if one does not exist |
2164 | 2164 | $account = user_load($uid); |
2165 | 2165 | if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) { |
2166 | - // Use a Gravatar rather than the system default image |
|
2167 | - $options = array( |
|
2166 | + // Use a Gravatar rather than the system default image |
|
2167 | + $options = array( |
|
2168 | 2168 | 'size' => 100, |
2169 | 2169 | 'rating' => 'G', |
2170 | - ); |
|
2171 | - // Get the Gravatar URL and see if the image exists |
|
2172 | - $url = gravatar_get_gravatar($account->mail, $options); |
|
2173 | - $headers = @get_headers($url); |
|
2174 | - if (preg_match("|200|", $headers[0])) { |
|
2170 | + ); |
|
2171 | + // Get the Gravatar URL and see if the image exists |
|
2172 | + $url = gravatar_get_gravatar($account->mail, $options); |
|
2173 | + $headers = @get_headers($url); |
|
2174 | + if (preg_match("|200|", $headers[0])) { |
|
2175 | 2175 | return $url; |
2176 | - } |
|
2176 | + } |
|
2177 | 2177 | } |
2178 | 2178 | // Get default image if nothing else works |
2179 | 2179 | $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'))); |
2180 | 2180 | $content_node_widget_settings = unserialize($content_node_widget_settings); |
2181 | 2181 | $user_image['image'] = $content_node_widget_settings['default_image']; |
2182 | - } |
|
2183 | - $user = user_load($uid); |
|
2184 | - // Use boinc username for image alt/title attributes |
|
2185 | - $user_image['alt'] = $user->boincuser_name; |
|
2186 | - return $user_image; |
|
2182 | + } |
|
2183 | + $user = user_load($uid); |
|
2184 | + // Use boinc username for image alt/title attributes |
|
2185 | + $user_image['alt'] = $user->boincuser_name; |
|
2186 | + return $user_image; |
|
2187 | 2187 | } |
2188 | 2188 | |
2189 | 2189 | /** |
2190 | 2190 | * Generate a table of a user's projects |
2191 | 2191 | */ |
2192 | 2192 | function boincuser_get_projects_table($account = null) { |
2193 | - if ($account AND is_numeric($account)) { |
|
2193 | + if ($account AND is_numeric($account)) { |
|
2194 | 2194 | $account = user_load($account); |
2195 | - } |
|
2196 | - $projects = boincuser_get_projects($account); |
|
2197 | - if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
2195 | + } |
|
2196 | + $projects = boincuser_get_projects($account); |
|
2197 | + if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
|
2198 | 2198 | |
2199 | - $output = ''; |
|
2200 | - $output .= '<table class="user-projects">' . "\n"; |
|
2201 | - $output .= '<thead>' . "\n"; |
|
2202 | - $output .= ' <tr>' . "\n"; |
|
2203 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2204 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2205 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2206 | - $output .= ' </tr>' . "\n"; |
|
2207 | - $output .= '</thead>' . "\n"; |
|
2208 | - $output .= '<tbody>' . "\n"; |
|
2209 | - foreach ($projects AS $project) { |
|
2199 | + $output = ''; |
|
2200 | + $output .= '<table class="user-projects">' . "\n"; |
|
2201 | + $output .= '<thead>' . "\n"; |
|
2202 | + $output .= ' <tr>' . "\n"; |
|
2203 | + $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2204 | + $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2205 | + $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2206 | + $output .= ' </tr>' . "\n"; |
|
2207 | + $output .= '</thead>' . "\n"; |
|
2208 | + $output .= '<tbody>' . "\n"; |
|
2209 | + foreach ($projects AS $project) { |
|
2210 | 2210 | $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
2211 | 2211 | $output .= ' <tr>' . "\n"; |
2212 | 2212 | $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
2213 | 2213 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
2214 | 2214 | $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
2215 | 2215 | $output .= ' </tr>' . "\n"; |
2216 | - } |
|
2217 | - $output .= '</tbody>' . "\n"; |
|
2218 | - $output .= '</table>' . "\n"; |
|
2219 | - $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
|
2220 | - //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
|
2221 | - return $output; |
|
2216 | + } |
|
2217 | + $output .= '</tbody>' . "\n"; |
|
2218 | + $output .= '</table>' . "\n"; |
|
2219 | + $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
|
2220 | + //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
|
2221 | + return $output; |
|
2222 | 2222 | } |
2223 | 2223 | |
2224 | 2224 | /** |
@@ -2226,25 +2226,25 @@ discard block |
||
2226 | 2226 | */ |
2227 | 2227 | function boincuser_get_stats_user_data($cpid = null) { |
2228 | 2228 | |
2229 | - // [TODO] Set this stuff in site config! |
|
2230 | - $stats_server = 'stats.gridrepublic.org'; |
|
2231 | - $stats_rpc = 'rpc/get_user.php'; |
|
2229 | + // [TODO] Set this stuff in site config! |
|
2230 | + $stats_server = 'stats.gridrepublic.org'; |
|
2231 | + $stats_rpc = 'rpc/get_user.php'; |
|
2232 | 2232 | |
2233 | - // Construct query string |
|
2234 | - $get = array( |
|
2233 | + // Construct query string |
|
2234 | + $get = array( |
|
2235 | 2235 | 'cpid' => $cpid |
2236 | - ); |
|
2237 | - $args = array(); |
|
2238 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2239 | - $query = '?' . implode('&', $args); |
|
2236 | + ); |
|
2237 | + $args = array(); |
|
2238 | + foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2239 | + $query = '?' . implode('&', $args); |
|
2240 | 2240 | |
2241 | - // Load XML from RPC |
|
2242 | - $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
2243 | - $result = drupal_http_request($target_url); |
|
2244 | - if (in_array($result->code, array(200, 304))) { |
|
2241 | + // Load XML from RPC |
|
2242 | + $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
2243 | + $result = drupal_http_request($target_url); |
|
2244 | + if (in_array($result->code, array(200, 304))) { |
|
2245 | 2245 | return simplexml_load_string($result->data); |
2246 | - } |
|
2247 | - return NULL; |
|
2246 | + } |
|
2247 | + return NULL; |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | /** |
@@ -2252,15 +2252,15 @@ discard block |
||
2252 | 2252 | */ |
2253 | 2253 | function boincuser_get_projects($account = null) { |
2254 | 2254 | |
2255 | - // Use the current user by default |
|
2256 | - if (!$account) { |
|
2255 | + // Use the current user by default |
|
2256 | + if (!$account) { |
|
2257 | 2257 | global $user; |
2258 | 2258 | $account = user_load($user->uid); |
2259 | - } |
|
2259 | + } |
|
2260 | 2260 | |
2261 | - $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
|
2261 | + $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid); |
|
2262 | 2262 | |
2263 | - return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
2263 | + return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null; |
|
2264 | 2264 | } |
2265 | 2265 | |
2266 | 2266 | |
@@ -2268,11 +2268,11 @@ discard block |
||
2268 | 2268 | * Get the links to display under the user profile |
2269 | 2269 | */ |
2270 | 2270 | function boincuser_get_profile_links($uid) { |
2271 | - global $user; |
|
2272 | - $account = user_load($uid); |
|
2273 | - $profile = content_profile_load('profile', $account->uid); |
|
2274 | - $output = ''; |
|
2275 | - if ($profile) { |
|
2271 | + global $user; |
|
2272 | + $account = user_load($uid); |
|
2273 | + $profile = content_profile_load('profile', $account->uid); |
|
2274 | + $output = ''; |
|
2275 | + if ($profile) { |
|
2276 | 2276 | $profile_is_approved = ($profile->status AND !$profile->moderate); |
2277 | 2277 | $user_is_moderator = user_access('edit any profile content'); |
2278 | 2278 | $is_own_profile = ($user->uid == $account->uid); |
@@ -2280,15 +2280,15 @@ discard block |
||
2280 | 2280 | $links = array(); |
2281 | 2281 | |
2282 | 2282 | if ($profile->moderate AND $user_is_moderator) { |
2283 | - $links['approve_profile'] = array( |
|
2283 | + $links['approve_profile'] = array( |
|
2284 | 2284 | 'title' => bts('Approve profile', array(), NULL, 'boinc:moderate-user'), |
2285 | 2285 | 'href' => "{$profile_moderation_path}/approve", |
2286 | 2286 | 'attributes' => array( |
2287 | - 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2288 | - 'class' => 'first primary tab', |
|
2287 | + 'title' => bts('Approve this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2288 | + 'class' => 'first primary tab', |
|
2289 | 2289 | ) |
2290 | - ); |
|
2291 | - /*$links['edit_profile'] = array( |
|
2290 | + ); |
|
2291 | + /*$links['edit_profile'] = array( |
|
2292 | 2292 | 'title' => bts('Edit profile', array(), NULL, 'boinc:moderate-user'), |
2293 | 2293 | 'href' => "{$profile_moderation_path}/edit", |
2294 | 2294 | 'attributes' => array( |
@@ -2296,27 +2296,27 @@ discard block |
||
2296 | 2296 | 'class' => 'tab', |
2297 | 2297 | ) |
2298 | 2298 | );*/ |
2299 | - $links['reject_profile'] = array( |
|
2299 | + $links['reject_profile'] = array( |
|
2300 | 2300 | 'title' => bts('Reject profile', array(), NULL, 'boinc:moderate-user'), |
2301 | 2301 | 'href' => "{$profile_moderation_path}/reject", |
2302 | 2302 | 'attributes' => array( |
2303 | - 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2304 | - 'class' => 'tab', |
|
2303 | + 'title' => bts('Reject this profile content', array(), NULL, 'boinc:moderate-user'), |
|
2304 | + 'class' => 'tab', |
|
2305 | 2305 | ) |
2306 | - ); |
|
2306 | + ); |
|
2307 | 2307 | } |
2308 | 2308 | $output .= '<ul class="tab-list">'; |
2309 | 2309 | $count = 0; |
2310 | 2310 | foreach ($links as $key => $link) { |
2311 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
2312 | - $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
|
2313 | - $output .= '</li>'; |
|
2314 | - $count++; |
|
2311 | + $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
2312 | + $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
|
2313 | + $output .= '</li>'; |
|
2314 | + $count++; |
|
2315 | 2315 | } |
2316 | 2316 | $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; |
2317 | 2317 | $output .= '</ul>'; |
2318 | - } |
|
2319 | - return $output; |
|
2318 | + } |
|
2319 | + return $output; |
|
2320 | 2320 | /* |
2321 | 2321 | <ul class="tab-list"> |
2322 | 2322 | <li class="primary first tab"> |
@@ -2353,36 +2353,36 @@ discard block |
||
2353 | 2353 | */ |
2354 | 2354 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
2355 | 2355 | |
2356 | - foreach ($documents as $document) { |
|
2356 | + foreach ($documents as $document) { |
|
2357 | 2357 | if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
2358 | - // Node information. |
|
2359 | - $nid = $document->entity_id; |
|
2360 | - $node = node_load($nid); |
|
2361 | - $account = user_load($node->uid); |
|
2362 | - |
|
2363 | - // Use boincuser name and not drupal user name |
|
2364 | - $document->label = apachesolr_clean_text($account->boincuser_name); |
|
2365 | - // Author information |
|
2366 | - if ($node->uid == 0 || strlen($node->name) == 0) { |
|
2358 | + // Node information. |
|
2359 | + $nid = $document->entity_id; |
|
2360 | + $node = node_load($nid); |
|
2361 | + $account = user_load($node->uid); |
|
2362 | + |
|
2363 | + // Use boincuser name and not drupal user name |
|
2364 | + $document->label = apachesolr_clean_text($account->boincuser_name); |
|
2365 | + // Author information |
|
2366 | + if ($node->uid == 0 || strlen($node->name) == 0) { |
|
2367 | 2367 | // @see user_validate_name(). !'0' === TRUE. |
2368 | 2368 | $document->ss_name = '0'; |
2369 | - } |
|
2370 | - else { |
|
2369 | + } |
|
2370 | + else { |
|
2371 | 2371 | $document->ss_name = $account->boincuser_name; |
2372 | 2372 | // We want the name to be searchable for keywords. |
2373 | 2373 | $document->tos_name = $account->boincuser_name; |
2374 | - } |
|
2374 | + } |
|
2375 | 2375 | |
2376 | - // Rename "Profle" to "User" |
|
2377 | - $document->bundle = "User"; |
|
2378 | - $document->bundle_name = "User"; |
|
2376 | + // Rename "Profle" to "User" |
|
2377 | + $document->bundle = "User"; |
|
2378 | + $document->bundle_name = "User"; |
|
2379 | 2379 | |
2380 | - // Replace the Solr document's created field with the date the user |
|
2381 | - // account was created. This replaces the node creation date typically |
|
2382 | - // used for indexing nodes. |
|
2383 | - $document->ds_created = apachesolr_date_iso($account->created); |
|
2380 | + // Replace the Solr document's created field with the date the user |
|
2381 | + // account was created. This replaces the node creation date typically |
|
2382 | + // used for indexing nodes. |
|
2383 | + $document->ds_created = apachesolr_date_iso($account->created); |
|
2384 | + } |
|
2384 | 2385 | } |
2385 | - } |
|
2386 | 2386 | |
2387 | 2387 | } |
2388 | 2388 | |
@@ -2394,23 +2394,23 @@ discard block |
||
2394 | 2394 | * Implementation of hook_privatemsg_name_lookup(); |
2395 | 2395 | */ |
2396 | 2396 | function boincuser_privatemsg_name_lookup($string) { |
2397 | - // Get the BOINC ID from the name string, and lookup the |
|
2398 | - // corresponding drupal user. |
|
2399 | - $boincname = substr($string, 0, strrpos($string, '_')); |
|
2400 | - $boincid = substr($string, strrpos($string, '_') + 1); |
|
2401 | - $drupalid = get_drupal_id($boincid); |
|
2402 | - |
|
2403 | - // Name has spaced replaced with special UTF-8 characters in |
|
2404 | - // privatemsg module. We need to convert them back to spaces for the |
|
2405 | - // check below. |
|
2406 | - $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
|
2407 | - if ($drupalid>0) { |
|
2397 | + // Get the BOINC ID from the name string, and lookup the |
|
2398 | + // corresponding drupal user. |
|
2399 | + $boincname = substr($string, 0, strrpos($string, '_')); |
|
2400 | + $boincid = substr($string, strrpos($string, '_') + 1); |
|
2401 | + $drupalid = get_drupal_id($boincid); |
|
2402 | + |
|
2403 | + // Name has spaced replaced with special UTF-8 characters in |
|
2404 | + // privatemsg module. We need to convert them back to spaces for the |
|
2405 | + // check below. |
|
2406 | + $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
|
2407 | + if ($drupalid>0) { |
|
2408 | 2408 | if ($recipient = user_load(array('uid' => $drupalid))) { |
2409 | - // Double-check that the loaded user matches both boincuser_id |
|
2410 | - // and boincuser_name. |
|
2411 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2409 | + // Double-check that the loaded user matches both boincuser_id |
|
2410 | + // and boincuser_name. |
|
2411 | + if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2412 | 2412 | return $recipient; |
2413 | - } |
|
2413 | + } |
|
2414 | + } |
|
2414 | 2415 | } |
2415 | - } |
|
2416 | 2416 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | if ($checkct) { |
60 | 60 | $rc1 = consent_to_a_policy($user, $ctid, 1, 0, 'Webform', time()); |
61 | 61 | if (!$rc1) { |
62 | - error_page("Database error when attempting to INSERT into table consent with ID=$user->id. " . BoincDb::error() . " Please contact site administrators."); |
|
62 | + error_page("Database error when attempting to INSERT into table consent with ID=$user->id. ".BoincDb::error()." Please contact site administrators."); |
|
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | error_page("Error: consent type for enrollment not found. Please contact site administrators."); |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | abstract class PREF { |
45 | - public $desc; // short description |
|
46 | - public $tooltip; // longer description, shown as tooltip |
|
47 | - public $tag; // the pref's primary XML tag |
|
45 | + public $desc; // short description |
|
46 | + public $tooltip; // longer description, shown as tooltip |
|
47 | + public $tag; // the pref's primary XML tag |
|
48 | 48 | function __construct($desc, $tooltip, $tag) { |
49 | 49 | $this->desc = $desc; |
50 | 50 | $this->tooltip = $tooltip; |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | |
123 | 123 | class PREF_BOOL extends PREF { |
124 | 124 | public $default; |
125 | - public $invert; // show to user in opposite sense |
|
126 | - function __construct($desc, $tooltip, $tag, $default, $invert=false) { |
|
125 | + public $invert; // show to user in opposite sense |
|
126 | + function __construct($desc, $tooltip, $tag, $default, $invert = false) { |
|
127 | 127 | $this->default = $default; |
128 | 128 | $this->invert = $invert; |
129 | 129 | parent::__construct($desc, $tooltip, $tag); |
130 | 130 | } |
131 | 131 | function show_value($prefs) { |
132 | 132 | $tag = $this->tag; |
133 | - $v = $this->invert?!$prefs->$tag:$prefs->$tag; |
|
133 | + $v = $this->invert ? !$prefs->$tag : $prefs->$tag; |
|
134 | 134 | echo "<td>".readonly_checkbox($v)."</td>"; |
135 | 135 | } |
136 | 136 | function show_form($prefs, $error) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | echo "<td ".VALUE_ATTRS.">" |
144 | 144 | ."<input type=checkbox name=$this->tag " |
145 | - . ($checked?"checked":"") |
|
145 | + . ($checked ? "checked" : "") |
|
146 | 146 | ."></td> |
147 | 147 | "; |
148 | 148 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | function xml_string($prefs) { |
156 | 156 | $tag = $this->tag; |
157 | 157 | return "<$tag>" |
158 | - .($prefs->$tag?"1":"0") |
|
158 | + .($prefs->$tag ? "1" : "0") |
|
159 | 159 | ."</$tag>\n"; |
160 | 160 | } |
161 | 161 | function xml_parse(&$prefs, $name, $text) { |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | public $consent_type_id; // the consent_type_id from the consent_type table |
176 | 176 | public $consent_name; // the consent_name to configure |
177 | 177 | public $default; |
178 | - public $invert; // show to user in opposite sense |
|
178 | + public $invert; // show to user in opposite sense |
|
179 | 179 | |
180 | - function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert=false) { |
|
180 | + function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert = false) { |
|
181 | 181 | $this->consent_type_id = $consent_type_id; |
182 | 182 | $this->consent_name = $consent_name; |
183 | 183 | $this->default = $default; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } else { |
232 | 232 | $value = false; |
233 | 233 | } |
234 | - echo "<td>" . readonly_checkbox($value) . "</td>"; |
|
234 | + echo "<td>".readonly_checkbox($value)."</td>"; |
|
235 | 235 | } |
236 | 236 | function show_form($user, $error) { |
237 | 237 | $consent_type_id = $this->consent_type_id; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | echo "<td ".VALUE_ATTRS.">" |
249 | 249 | ."<input type=checkbox name=$this->tag " |
250 | - . ($checked?"checked":"") |
|
250 | + . ($checked ? "checked" : "") |
|
251 | 251 | ."></td> |
252 | 252 | "; |
253 | 253 | } |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | // to this consent type. |
265 | 265 | $cr = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id='${consent_type_id}'"); |
266 | 266 | |
267 | - if ( (($cr) and ($cr->consent_flag!=$flag)) or |
|
268 | - (!$cr) ) { |
|
267 | + if ((($cr) and ($cr->consent_flag != $flag)) or |
|
268 | + (!$cr)) { |
|
269 | 269 | $rc = consent_to_a_policy($user, $consent_type_id, $flag, 0, 'Webform', time()); |
270 | 270 | if (!$rc) { |
271 | 271 | error_page(tra("Database error:").BoincDb::error()); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | // this is the value if they check the box |
302 | 302 | public $scale; |
303 | 303 | |
304 | - function __construct($suffix, $min, $max, $default, $scale=1, $default2=0) { |
|
304 | + function __construct($suffix, $min, $max, $default, $scale = 1, $default2 = 0) { |
|
305 | 305 | $this->suffix = " $suffix"; |
306 | 306 | $this->min = $min; |
307 | 307 | $this->max = $max; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $v .= "$this->suffix "; |
321 | 321 | return $v; |
322 | 322 | } |
323 | - function form_str($tag, $v, $had_error, $disabled=false, $id=null) { |
|
323 | + function form_str($tag, $v, $had_error, $disabled = false, $id = null) { |
|
324 | 324 | if (is_numeric($v)) { |
325 | 325 | $v /= $this->scale; |
326 | 326 | if (!$had_error && ($v < $this->min || $v > $this->max)) { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | if ($disabled) $v = ""; |
331 | - $i = $id?"id=\"$id\"":""; |
|
331 | + $i = $id ? "id=\"$id\"" : ""; |
|
332 | 332 | return '<input type="text" size="5" class="form-control input-sm" name="'.$tag.'" value="'.$v."\" $disabled $i> $this->suffix "; |
333 | 333 | } |
334 | 334 | function form_convert($in, &$out, &$error) { |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | $text_id = $this->tag; |
452 | 452 | $default = $this->num_spec->get_default(); |
453 | 453 | $val = $prefs->$tag; |
454 | - $c = $val?"checked":""; |
|
455 | - $d = $val?"":"disabled"; |
|
454 | + $c = $val ? "checked" : ""; |
|
455 | + $d = $val ? "" : "disabled"; |
|
456 | 456 | echo "<td $attrs>" |
457 | 457 | ."<input type=checkbox id=$checkbox_id onClick=\"checkbox_clicked('$checkbox_id', '$text_id', $default)\" $c> " |
458 | 458 | .$this->num_spec->form_str($tag, $prefs->$tag, $had_error, $d, $text_id) |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | function hour_select($x, $name, $id, $d) { |
566 | 566 | $s = ""; |
567 | 567 | $s .= "<select class=\"selectbox form-control input-sm\" name=$name id=$id $d>\n"; |
568 | - for ($i=0; $i<24; $i++) { |
|
569 | - $sel = ($x == $i)?"selected":""; |
|
568 | + for ($i = 0; $i < 24; $i++) { |
|
569 | + $sel = ($x == $i) ? "selected" : ""; |
|
570 | 570 | $s .= "<option value=$i $sel> $i:00"; |
571 | 571 | } |
572 | 572 | $s .= "</select>\n"; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | // row_defs - Display a value for all 4 venues in one row |
669 | 669 | // |
670 | -function row_defs($pre, $item, $post, $type, $prefs, $tooltip=null) { |
|
670 | +function row_defs($pre, $item, $post, $type, $prefs, $tooltip = null) { |
|
671 | 671 | $gen = $prefs->$item; |
672 | 672 | $hom = (isset($prefs->home) && isset($prefs->home->$item)) ? $prefs->home->$item : "--"; |
673 | 673 | $schl = (isset($prefs->school) && isset($prefs->school->$item)) ? $prefs->school->$item : "--"; |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | echo "<tr>"; |
680 | 680 | } |
681 | 681 | echo "<td ".NAME_ATTRS.">$pre</td>"; |
682 | - row_field($gen, $type); |
|
683 | - row_field($hom, $type); |
|
682 | + row_field($gen, $type); |
|
683 | + row_field($hom, $type); |
|
684 | 684 | row_field($schl, $type); |
685 | - row_field($wrk, $type); |
|
685 | + row_field($wrk, $type); |
|
686 | 686 | echo "<td align=left>$post</td></tr>\n"; |
687 | 687 | } |
688 | 688 | |
@@ -692,16 +692,16 @@ discard block |
||
692 | 692 | function row_field($value, $type) { |
693 | 693 | echo "<td>"; |
694 | 694 | $type = $value === "--" ? "--" : $type; |
695 | - switch($type) { |
|
695 | + switch ($type) { |
|
696 | 696 | case "yesno": |
697 | - echo $value ?tra("yes"):tra("no"); |
|
697 | + echo $value ?tra("yes") : tra("no"); |
|
698 | 698 | break; |
699 | 699 | case "noyes": |
700 | - echo $value ?tra("no"):tra("yes"); |
|
700 | + echo $value ?tra("no") : tra("yes"); |
|
701 | 701 | break; |
702 | 702 | case "limit": |
703 | 703 | $x = max_bytes_display_mode($value); |
704 | - $y = "$x " . BYTE_ABBR; |
|
704 | + $y = "$x ".BYTE_ABBR; |
|
705 | 705 | echo $x ? "$y" : tra("no limit"); |
706 | 706 | break; |
707 | 707 | case "minutes": |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | if ($checkct) { |
45 | 45 | $consent_result = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id=$ctid AND consent_flag=1"); |
46 | 46 | if ($consent_result) { |
47 | - return TRUE; |
|
47 | + return true; |
|
48 | 48 | } |
49 | 49 | } |
50 | - return FALSE; |
|
50 | + return false; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Checks to see if a particular consent_type name is in |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | // if checkenabled=TRUE, if the consent_type is enabled/available for |
57 | 57 | // use. The integer is the consent_type_id- the id from consent_type |
58 | 58 | // table. If the boolean is FALSE, the integer returned is -1. |
59 | -function check_consent_type($name, $checkenabled=TRUE) { |
|
59 | +function check_consent_type($name, $checkenabled=true) { |
|
60 | 60 | $ct = BoincConsentType::lookup("shortname = '{$name}'"); |
61 | 61 | if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
62 | - return array(TRUE, $ct->id); |
|
62 | + return array(true, $ct->id); |
|
63 | 63 | } |
64 | - return array(FALSE, -1); |
|
64 | + return array(false, -1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // When a user uses the Web site to login, this funtion checks the |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | require_once("../inc/boinc_db.inc"); |
22 | 22 | require_once("../inc/util.inc"); |
23 | 23 | |
24 | -define('CONSENT_TYPE_ENROLL','ENROLL'); |
|
24 | +define('CONSENT_TYPE_ENROLL', 'ENROLL'); |
|
25 | 25 | |
26 | 26 | // Utility function to check the terms of use. |
27 | 27 | function check_termsofuse() { |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | function consent_to_a_policy($user, $consent_type_id, $consent_flag, $consent_not_required, $source, $ctime = 0) { |
32 | 32 | $mys = BoincDb::escape_string($source); |
33 | - if ($ctime==0) { |
|
33 | + if ($ctime == 0) { |
|
34 | 34 | $mytime = $user->create_time; |
35 | 35 | } else { |
36 | 36 | $mytime = $ctime; |
37 | 37 | } |
38 | 38 | return BoincConsent::insert( |
39 | - "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) " . |
|
39 | + "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) ". |
|
40 | 40 | "values($user->id, $consent_type_id, $mytime, $consent_flag, $consent_not_required, '$mys')" |
41 | 41 | ); |
42 | 42 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | // if checkenabled=TRUE, if the consent_type is enabled/available for |
61 | 61 | // use. The integer is the consent_type_id- the id from consent_type |
62 | 62 | // table. If the boolean is FALSE, the integer returned is -1. |
63 | -function check_consent_type($name, $checkenabled=TRUE) { |
|
63 | +function check_consent_type($name, $checkenabled = TRUE) { |
|
64 | 64 | $ct = BoincConsentType::lookup("shortname = '{$name}'"); |
65 | - if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
|
65 | + if ($ct and (!$checkenabled or ($ct->enabled))) { |
|
66 | 66 | return array(TRUE, $ct->id); |
67 | 67 | } |
68 | 68 | return array(FALSE, -1); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | function intercept_login($user, $perm, $in_next_url = "") { |
75 | 75 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
76 | 76 | $config = get_config(); |
77 | - if ( parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) { |
|
77 | + if (parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) { |
|
78 | 78 | // sent user to terms-of-use Web form after login |
79 | 79 | $mytoken = create_token($user->id, TOKEN_TYPE_LOGIN_INTERCEPT, TOKEN_DURATION_TWO_HOURS); |
80 | 80 | send_cookie('logintoken', $mytoken, false); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $name = substr($name, 0, $name_limit)."..."; |
344 | 344 | } |
345 | 345 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
346 | - if (function_exists("project_user_links")){ |
|
346 | + if (function_exists("project_user_links")) { |
|
347 | 347 | $x .= project_user_links($user); |
348 | 348 | } |
349 | 349 | if ($badge_height) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | // Returns a cacheable community links data object |
465 | 465 | // @param user The user to produce a community links object for |
466 | 466 | |
467 | -function get_community_links_object($user){ |
|
467 | +function get_community_links_object($user) { |
|
468 | 468 | $cache_object = new StdClass; |
469 | 469 | $cache_object->post_count = total_posts($user); |
470 | 470 | $cache_object->user = $user; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | return $cache_object; |
481 | 481 | } |
482 | 482 | |
483 | -function community_links($clo, $logged_in_user){ |
|
483 | +function community_links($clo, $logged_in_user) { |
|
484 | 484 | $user = $clo->user; |
485 | 485 | $team = $clo->team; |
486 | 486 | $friends = $clo->friends; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // they've participated in |
34 | 34 | // |
35 | 35 | function get_other_projects($user) { |
36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
38 | 38 | |
39 | 39 | // Check the cache for that URL |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | if (!NO_STATS) { |
177 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
177 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
178 | 178 | $x = ""; |
179 | 179 | shuffle($cpid_stats_sites); |
180 | 180 | foreach ($cpid_stats_sites as $site) { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // if $badge_height is > 0, show badges |
329 | 329 | // if $name_limit, limit name to N chars |
330 | 330 | // |
331 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
331 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
332 | 332 | BoincForumPrefs::lookup($user); |
333 | 333 | if (is_banished($user)) { |
334 | 334 | return "(banished: ID $user->id)"; |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | $name = substr($name, 0, $name_limit)."..."; |
344 | 344 | } |
345 | 345 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
346 | - if (function_exists("project_user_links")){ |
|
346 | + if (function_exists("project_user_links")) { |
|
347 | 347 | $x .= project_user_links($user); |
348 | 348 | } |
349 | 349 | if ($badge_height) { |
350 | 350 | $x .= badges_string(true, $user, $badge_height); |
351 | 351 | } |
352 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
352 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | function show_community_private($user) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | // if there's a foundership request, notify the founder |
398 | 398 | // |
399 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
399 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
400 | 400 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
401 | 401 | } |
402 | 402 | row2(tra("Member of team"), $x); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
422 | 422 | $n = count($friends); |
423 | 423 | if ($n) { |
424 | - foreach($friends as $friend) { |
|
424 | + foreach ($friends as $friend) { |
|
425 | 425 | $fuser = BoincUser::lookup_id($friend->user_dest); |
426 | 426 | if (!$fuser) continue; |
427 | 427 | $x .= friend_links($fuser); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | // Returns a cacheable community links data object |
465 | 465 | // @param user The user to produce a community links object for |
466 | 466 | |
467 | -function get_community_links_object($user){ |
|
467 | +function get_community_links_object($user) { |
|
468 | 468 | $cache_object = new StdClass; |
469 | 469 | $cache_object->post_count = total_posts($user); |
470 | 470 | $cache_object->user = $user; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $cache_object->friends = array(); |
473 | 473 | |
474 | 474 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
475 | - foreach($friends as $friend) { |
|
475 | + foreach ($friends as $friend) { |
|
476 | 476 | $fuser = BoincUser::lookup_id($friend->user_dest); |
477 | 477 | if (!$fuser) continue; |
478 | 478 | $cache_object->friends[] = $fuser; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | return $cache_object; |
481 | 481 | } |
482 | 482 | |
483 | -function community_links($clo, $logged_in_user){ |
|
483 | +function community_links($clo, $logged_in_user) { |
|
484 | 484 | $user = $clo->user; |
485 | 485 | $team = $clo->team; |
486 | 486 | $friends = $clo->friends; |
@@ -506,15 +506,15 @@ discard block |
||
506 | 506 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
507 | 507 | ); |
508 | 508 | } else if ($friend) { |
509 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
509 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
510 | 510 | } else { |
511 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
511 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | 515 | if ($friends) { |
516 | 516 | $x = ""; |
517 | - foreach($friends as $friend) { |
|
517 | + foreach ($friends as $friend) { |
|
518 | 518 | $x .= friend_links($friend); |
519 | 519 | } |
520 | 520 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -558,6 +558,6 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | |
561 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
561 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
562 | 562 | |
563 | 563 | ?> |
@@ -286,11 +286,11 @@ |
||
286 | 286 | |
287 | 287 | require_once("../inc/account_ownership.inc"); |
288 | 288 | if (file_exists($account_ownership_private_key_file_path)) { |
289 | - // If the server has keys configured show the account ownership form |
|
290 | - row2( |
|
291 | - tra("Account Ownership"), |
|
292 | - "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | - ); |
|
289 | + // If the server has keys configured show the account ownership form |
|
290 | + row2( |
|
291 | + tra("Account Ownership"), |
|
292 | + "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | + ); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | WHERE n.type = 'profile' |
166 | 166 | AND n.status = 1 |
167 | 167 | AND n.moderate = 0 |
168 | - " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '') . " |
|
169 | - " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '') . " |
|
168 | + " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '')." |
|
169 | + " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '')." |
|
170 | 170 | ORDER BY RAND() |
171 | 171 | LIMIT 1" |
172 | 172 | )); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * this function is called, it may be called with optional parameters |
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | -function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
|
215 | +function _boincuser_send_emailchange($account, $new_email = NULL, $prev_email = NULL, $adminuser = FALSE) { |
|
216 | 216 | require_boinc('token'); |
217 | 217 | module_load_include('inc', 'rules', 'modules/system.rules'); |
218 | 218 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // Name is limited to 60 characters, but we want to leave space to add a |
304 | 304 | // tally if needed (for users with duplicate names); Limit to 56 chars and |
305 | 305 | // replace the middle of the string with "..." if too long |
306 | - $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length-56)+3); |
|
306 | + $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length - 56) + 3); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Determine if there are duplicate names, if so append a number to end. |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | // delimiters. Curly brace is not really allowed un URLs, but a |
374 | 374 | // more robust function would first check for these curly braces |
375 | 375 | // in the path_to_ignore patterms, just in case. |
376 | - if (preg_match('{' . $pi . '}', $path)) { |
|
376 | + if (preg_match('{'.$pi.'}', $path)) { |
|
377 | 377 | return TRUE; |
378 | 378 | } |
379 | 379 | } |
@@ -499,15 +499,15 @@ discard block |
||
499 | 499 | elseif (!in_array($_GET['q'], $page_blacklist)) { |
500 | 500 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
501 | 501 | configured. Please !verify for the settings to become effective.', |
502 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
503 | - t('and') . '</strong> ' . t('save the configuration'), |
|
502 | + array('!verify' => l(t('verify the default values').' <strong>'. |
|
503 | + t('and').'</strong> '.t('save the configuration'), |
|
504 | 504 | 'admin/boinc/scheduler', array('html' => TRUE)) |
505 | 505 | ), WATCHDOG_WARNING); |
506 | 506 | if (user_access('administer site configuration')) { |
507 | 507 | drupal_set_message(t('The BOINC scheduling server settings are not yet |
508 | 508 | configured. Please !verify for the settings to become effective', |
509 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
510 | - t('and') . '</strong> ' . t('save the configuration'), |
|
509 | + array('!verify' => l(t('verify the default values').' <strong>'. |
|
510 | + t('and').'</strong> '.t('save the configuration'), |
|
511 | 511 | 'admin/boinc/scheduler', array('html' => TRUE)) |
512 | 512 | )), 'warning', FALSE); |
513 | 513 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | function _boincuser_node_profile_delete_submit($form, &$form_state) { |
571 | 571 | $node = $form['#node']; |
572 | - $deleteurl = 'node/'. $node->nid .'/delete'; |
|
572 | + $deleteurl = 'node/'.$node->nid.'/delete'; |
|
573 | 573 | $afterq = 'destination=account'; |
574 | 574 | drupal_goto($deleteurl, $afterq); |
575 | 575 | } |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | $view = views_get_current_view(); |
600 | 600 | $account_id = $view->args[0]; |
601 | 601 | $friend_count = flag_friend_get_friend_count($account_id); |
602 | - return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
603 | - array('@count' => $friend_count)) . '</h2>'; |
|
602 | + return '<h2 class="pane-title">'.bts('Friends (@count)', |
|
603 | + array('@count' => $friend_count)).'</h2>'; |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
614 | 614 | db_set_active('default'); |
615 | 615 | while ($user = db_fetch_object($result)) { |
616 | - $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
616 | + $matches[$user->name.'_'.$user->id] = htmlentities($user->name)." (".$user->id.')'; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | drupal_json((object)$matches); |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
12 | 12 | |
13 | 13 | if (!function_exists('user_load_by_mail')) { |
14 | - /** |
|
15 | - * user_load_by_mail will be broken out of user_load |
|
16 | - */ |
|
17 | - function user_load_by_mail($mail) { |
|
14 | + /** |
|
15 | + * user_load_by_mail will be broken out of user_load |
|
16 | + */ |
|
17 | + function user_load_by_mail($mail) { |
|
18 | 18 | return user_load(array('mail' => $mail)); |
19 | - } |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | * Get an image object from a given file and cck field |
29 | 29 | */ |
30 | 30 | function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = FALSE) { |
31 | - $field = content_fields($field_name, $content_type); |
|
32 | - $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
|
33 | - if ($ignore_resolution) { |
|
31 | + $field = content_fields($field_name, $content_type); |
|
32 | + $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
|
33 | + if ($ignore_resolution) { |
|
34 | 34 | unset($validators['filefield_validate_image_resolution']); |
35 | - } |
|
36 | - $target_path = filefield_widget_file_path($field); |
|
37 | - // Create the image object |
|
38 | - return field_file_save_file($image_path, $validators, $target_path, FILE_EXISTS_REPLACE); |
|
35 | + } |
|
36 | + $target_path = filefield_widget_file_path($field); |
|
37 | + // Create the image object |
|
38 | + return field_file_save_file($image_path, $validators, $target_path, FILE_EXISTS_REPLACE); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -47,73 +47,73 @@ discard block |
||
47 | 47 | * |
48 | 48 | */ |
49 | 49 | function boincuser_check_credit_requirements() { |
50 | - global $user; |
|
51 | - if (!$user->uid) { |
|
50 | + global $user; |
|
51 | + if (!$user->uid) { |
|
52 | 52 | return FALSE; |
53 | - } |
|
54 | - $account = user_load($user->uid); |
|
55 | - $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
56 | - $community_role = array_search('community member', user_roles(true)); |
|
57 | - $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
53 | + } |
|
54 | + $account = user_load($user->uid); |
|
55 | + $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
56 | + $community_role = array_search('community member', user_roles(true)); |
|
57 | + $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
58 | 58 | |
59 | - // Set user roles based on current penalty status... |
|
60 | - if ($account->boincuser_penalty_expiration > time()) { |
|
59 | + // Set user roles based on current penalty status... |
|
60 | + if ($account->boincuser_penalty_expiration > time()) { |
|
61 | 61 | drupal_set_message(bts( |
62 | - 'You are banned from community participation until @date', |
|
63 | - array('@date' => format_date($account->boincuser_penalty_expiration)) |
|
62 | + 'You are banned from community participation until @date', |
|
63 | + array('@date' => format_date($account->boincuser_penalty_expiration)) |
|
64 | 64 | ), 'warning', FALSE); |
65 | 65 | if (isset($account->roles[$community_role])) { |
66 | - // Remove from the community role, if not already |
|
67 | - unset($account->roles[$community_role]); |
|
66 | + // Remove from the community role, if not already |
|
67 | + unset($account->roles[$community_role]); |
|
68 | 68 | } |
69 | 69 | if (isset($account->roles[$unrestricted_role])) { |
70 | - // Likewise, revoke extra privileges |
|
71 | - unset($account->roles[$unrestricted_role]); |
|
70 | + // Likewise, revoke extra privileges |
|
71 | + unset($account->roles[$unrestricted_role]); |
|
72 | 72 | } |
73 | 73 | user_save($account, array('roles' => $account->roles)); |
74 | - } |
|
75 | - else { |
|
74 | + } |
|
75 | + else { |
|
76 | 76 | if (!isset($account->roles[$community_role])) { |
77 | - // The user should be a 'community member' role. If the user was |
|
78 | - // previously banned, this will restore that role. |
|
79 | - $account->roles[$community_role] = 'community member'; |
|
80 | - user_save($account, array('roles' => $account->roles)); |
|
77 | + // The user should be a 'community member' role. If the user was |
|
78 | + // previously banned, this will restore that role. |
|
79 | + $account->roles[$community_role] = 'community member'; |
|
80 | + user_save($account, array('roles' => $account->roles)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // ... and total credit. |
84 | 84 | if ($account->boincuser_total_credit >= $min_credit_to_post) { |
85 | - if (!isset($account->roles[$unrestricted_role])) { |
|
85 | + if (!isset($account->roles[$unrestricted_role])) { |
|
86 | 86 | // This user is now above the credit threshold and is allowed full |
87 | 87 | // privileges |
88 | 88 | $account->roles[$unrestricted_role] = 'verified contributor'; |
89 | 89 | user_save($account, array('roles' => $account->roles)); |
90 | - } |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | else { |
93 | - drupal_set_message(bts( |
|
93 | + drupal_set_message(bts( |
|
94 | 94 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 95 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
96 | - ), 'warning', FALSE); |
|
97 | - if (isset($account->roles[$unrestricted_role])) { |
|
96 | + ), 'warning', FALSE); |
|
97 | + if (isset($account->roles[$unrestricted_role])) { |
|
98 | 98 | // Either the threshold has been raised or credits have been revoked; |
99 | 99 | // this user no longer qualifies for full privileges |
100 | 100 | unset($account->roles[$unrestricted_role]); |
101 | 101 | user_save($account, array('roles' => $account->roles)); |
102 | - } |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | - } |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Get the cid of the first comment the user has not seen on a given node |
110 | 110 | */ |
111 | 111 | function boincuser_get_first_unread_comment_id($nid, $uid = NULL) { |
112 | - if (!$uid) { |
|
112 | + if (!$uid) { |
|
113 | 113 | global $user; |
114 | 114 | $uid = $user->uid; |
115 | - } |
|
116 | - return db_result(db_query(" |
|
115 | + } |
|
116 | + return db_result(db_query(" |
|
117 | 117 | SELECT c.cid |
118 | 118 | FROM {node} n |
119 | 119 | INNER JOIN {comments} c ON c.nid = n.nid |
@@ -124,40 +124,40 @@ discard block |
||
124 | 124 | ORDER BY c.timestamp ASC |
125 | 125 | LIMIT 1", |
126 | 126 | $uid, $nid |
127 | - )); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Choose and set the user of the day |
132 | 132 | */ |
133 | 133 | function boincuser_select_user_of_the_day() { |
134 | - // First get a list of users with recent credit |
|
135 | - db_set_active('boinc_rw'); |
|
136 | - $users_with_credit = db_query(" |
|
134 | + // First get a list of users with recent credit |
|
135 | + db_set_active('boinc_rw'); |
|
136 | + $users_with_credit = db_query(" |
|
137 | 137 | SELECT |
138 | 138 | id |
139 | 139 | FROM {user} u |
140 | 140 | JOIN {profile} p ON p.userid = u.id |
141 | 141 | WHERE expavg_credit > 1 |
142 | 142 | ORDER BY uotd_time ASC, RAND()" |
143 | - ); |
|
144 | - db_set_active('default'); |
|
145 | - $active_users = array(); |
|
146 | - while ($user_with_credit = db_fetch_object($users_with_credit)) { |
|
143 | + ); |
|
144 | + db_set_active('default'); |
|
145 | + $active_users = array(); |
|
146 | + while ($user_with_credit = db_fetch_object($users_with_credit)) { |
|
147 | 147 | $active_users[] = $user_with_credit->id; |
148 | - } |
|
149 | - $active_users = implode(',', $active_users); |
|
150 | - // Limit to users who have never been user of the day, if there are any |
|
151 | - $never_been_picked = db_result(db_query(" |
|
148 | + } |
|
149 | + $active_users = implode(',', $active_users); |
|
150 | + // Limit to users who have never been user of the day, if there are any |
|
151 | + $never_been_picked = db_result(db_query(" |
|
152 | 152 | SELECT COUNT(*) |
153 | 153 | FROM {boincuser} bu |
154 | 154 | WHERE bu.uotd_time = 0 |
155 | 155 | " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '') |
156 | - )); |
|
157 | - $new_uotd_uid = 0; |
|
158 | - while (!$new_uotd_uid) { |
|
156 | + )); |
|
157 | + $new_uotd_uid = 0; |
|
158 | + while (!$new_uotd_uid) { |
|
159 | 159 | // Select a user of the day randomly from the pool |
160 | - $new_uotd_uid = db_result(db_query(" |
|
160 | + $new_uotd_uid = db_result(db_query(" |
|
161 | 161 | SELECT |
162 | 162 | n.uid |
163 | 163 | FROM {node} n |
@@ -171,31 +171,31 @@ discard block |
||
171 | 171 | LIMIT 1" |
172 | 172 | )); |
173 | 173 | if (!$new_uotd_uid) { |
174 | - // Can't find a user with a profile; remove constraints on the pool |
|
175 | - if ($never_been_picked) { |
|
174 | + // Can't find a user with a profile; remove constraints on the pool |
|
175 | + if ($never_been_picked) { |
|
176 | 176 | // Allow users who have been previously selected |
177 | 177 | $never_been_picked = FALSE; |
178 | - } |
|
179 | - elseif ($active_users) { |
|
178 | + } |
|
179 | + elseif ($active_users) { |
|
180 | 180 | // Allow users who are not even active (getting desperate) |
181 | 181 | $active_users = FALSE; |
182 | - } |
|
183 | - else { |
|
182 | + } |
|
183 | + else { |
|
184 | 184 | // Process failed... |
185 | 185 | return FALSE; |
186 | - } |
|
186 | + } |
|
187 | 187 | } |
188 | - } |
|
189 | - $uotd = user_load($new_uotd_uid); |
|
190 | - if ($uotd->uid) { |
|
188 | + } |
|
189 | + $uotd = user_load($new_uotd_uid); |
|
190 | + if ($uotd->uid) { |
|
191 | 191 | db_query(" |
192 | 192 | UPDATE {boincuser} |
193 | 193 | SET uotd_time = '%d' |
194 | 194 | WHERE uid = '%d'", |
195 | - time(), $uotd->uid |
|
195 | + time(), $uotd->uid |
|
196 | 196 | ); |
197 | - } |
|
198 | - return $uotd; |
|
197 | + } |
|
198 | + return $uotd; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -213,71 +213,71 @@ discard block |
||
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | 215 | function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
216 | - require_boinc('token'); |
|
217 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
216 | + require_boinc('token'); |
|
217 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
218 | 218 | |
219 | - global $base_url; |
|
220 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
219 | + global $base_url; |
|
220 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
221 | 221 | |
222 | - if (is_null($new_email)) { |
|
222 | + if (is_null($new_email)) { |
|
223 | 223 | $new_email = $account->mail; |
224 | - } |
|
225 | - if (is_null($prev_email)) { |
|
224 | + } |
|
225 | + if (is_null($prev_email)) { |
|
226 | 226 | $prev_email = $account->boincuser_previous_email_addr; |
227 | - } |
|
228 | - |
|
229 | - // @todo - set constant in drupal, or use BOINC contsants |
|
230 | - $duration = TOKEN_DURATION_ONE_WEEK; |
|
231 | - $changedate = date('F j, Y \a\t G:i T', time()); |
|
232 | - $newdate = date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration); |
|
233 | - $token = create_token($account->boincuser_id, TOKEN_TYPE_CHANGE_EMAIL, $duration); |
|
234 | - if ($adminuser) { |
|
227 | + } |
|
228 | + |
|
229 | + // @todo - set constant in drupal, or use BOINC contsants |
|
230 | + $duration = TOKEN_DURATION_ONE_WEEK; |
|
231 | + $changedate = date('F j, Y \a\t G:i T', time()); |
|
232 | + $newdate = date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration); |
|
233 | + $token = create_token($account->boincuser_id, TOKEN_TYPE_CHANGE_EMAIL, $duration); |
|
234 | + if ($adminuser) { |
|
235 | 235 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
236 | - . "on {$changedate}. If you need to reverse this change, please look for " |
|
237 | - . "an email send to the email address: {$prev_email}.\n"; |
|
238 | - } |
|
239 | - else { |
|
236 | + . "on {$changedate}. If you need to reverse this change, please look for " |
|
237 | + . "an email send to the email address: {$prev_email}.\n"; |
|
238 | + } |
|
239 | + else { |
|
240 | 240 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
241 | - . "on {$changedate}. You will not be able to change your email address " |
|
242 | - . "until {$newdate}. If you need to reverse this change, please look for " |
|
243 | - . "an email send to the email address: {$prev_email}.\n"; |
|
244 | - } |
|
245 | - |
|
246 | - // Send email #1 to current address |
|
247 | - $mysubject = "Notification of email change at {$site_name}"; |
|
248 | - $mymessage = '' |
|
249 | - . "{$account->boincuser_name},\n" |
|
250 | - . "\n" |
|
251 | - . $graf1 |
|
252 | - . "\n" |
|
253 | - . "Thanks, \n" |
|
254 | - . "{$site_name} support team\n"; |
|
255 | - |
|
256 | - $settings = array( |
|
241 | + . "on {$changedate}. You will not be able to change your email address " |
|
242 | + . "until {$newdate}. If you need to reverse this change, please look for " |
|
243 | + . "an email send to the email address: {$prev_email}.\n"; |
|
244 | + } |
|
245 | + |
|
246 | + // Send email #1 to current address |
|
247 | + $mysubject = "Notification of email change at {$site_name}"; |
|
248 | + $mymessage = '' |
|
249 | + . "{$account->boincuser_name},\n" |
|
250 | + . "\n" |
|
251 | + . $graf1 |
|
252 | + . "\n" |
|
253 | + . "Thanks, \n" |
|
254 | + . "{$site_name} support team\n"; |
|
255 | + |
|
256 | + $settings = array( |
|
257 | 257 | 'from' => '', |
258 | 258 | 'to' => $new_email, |
259 | 259 | 'subject' => $mysubject, |
260 | 260 | 'message' => $mymessage, |
261 | - ); |
|
262 | - rules_action_mail_to_user($account, $settings); |
|
263 | - |
|
264 | - // Send email #2 to previous address. |
|
265 | - $mymessage = '' |
|
266 | - . "Your email address has been changed. If you did not intend to take this action, then please click this link to reverse this change, or copy-and-paste the link into your browser location bar. You will need to change your password as well.\n" |
|
267 | - . "\n" |
|
268 | - . "{$base_url}/user/{$account->uid}/recoveremail/{$token}\n" |
|
269 | - . "\n" |
|
270 | - . "Thanks, \n" |
|
271 | - . "{$site_name} support team\n"; |
|
272 | - |
|
273 | - $settings = array( |
|
261 | + ); |
|
262 | + rules_action_mail_to_user($account, $settings); |
|
263 | + |
|
264 | + // Send email #2 to previous address. |
|
265 | + $mymessage = '' |
|
266 | + . "Your email address has been changed. If you did not intend to take this action, then please click this link to reverse this change, or copy-and-paste the link into your browser location bar. You will need to change your password as well.\n" |
|
267 | + . "\n" |
|
268 | + . "{$base_url}/user/{$account->uid}/recoveremail/{$token}\n" |
|
269 | + . "\n" |
|
270 | + . "Thanks, \n" |
|
271 | + . "{$site_name} support team\n"; |
|
272 | + |
|
273 | + $settings = array( |
|
274 | 274 | 'from' => '', |
275 | 275 | 'to' => $prev_email, |
276 | 276 | 'subject' => $mysubject, |
277 | 277 | 'message' => $mymessage, |
278 | - ); |
|
278 | + ); |
|
279 | 279 | |
280 | - rules_action_mail($settings); |
|
280 | + rules_action_mail($settings); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -287,32 +287,32 @@ discard block |
||
287 | 287 | * |
288 | 288 | */ |
289 | 289 | function create_proper_drupalname($requested_name) { |
290 | - if (!$requested_name) { |
|
290 | + if (!$requested_name) { |
|
291 | 291 | // If the name is empty, set it |
292 | 292 | $requested_name = 'anonymous'; |
293 | - } |
|
294 | - $same_name_tally = 1; |
|
295 | - |
|
296 | - // Remove extra spaces |
|
297 | - $name2 = preg_replace("/ {2,}/", " ", trim($requested_name)); |
|
298 | - // Remove any non-valid characters |
|
299 | - $cleaned_name = preg_replace('/[^a-zA-Z0-9_ \.-]/s', '_', $name2); |
|
300 | - // Truncate name |
|
301 | - $name_length = strlen($cleaned_name); |
|
302 | - if ($name_length > 56) { |
|
293 | + } |
|
294 | + $same_name_tally = 1; |
|
295 | + |
|
296 | + // Remove extra spaces |
|
297 | + $name2 = preg_replace("/ {2,}/", " ", trim($requested_name)); |
|
298 | + // Remove any non-valid characters |
|
299 | + $cleaned_name = preg_replace('/[^a-zA-Z0-9_ \.-]/s', '_', $name2); |
|
300 | + // Truncate name |
|
301 | + $name_length = strlen($cleaned_name); |
|
302 | + if ($name_length > 56) { |
|
303 | 303 | // Name is limited to 60 characters, but we want to leave space to add a |
304 | 304 | // tally if needed (for users with duplicate names); Limit to 56 chars and |
305 | 305 | // replace the middle of the string with "..." if too long |
306 | 306 | $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length-56)+3); |
307 | - } |
|
307 | + } |
|
308 | 308 | |
309 | - // Determine if there are duplicate names, if so append a number to end. |
|
310 | - $unique_name = $cleaned_name; |
|
311 | - while (db_result(db_query("SELECT uid FROM {users} WHERE name = '{$unique_name}' LIMIT 1"))) { |
|
309 | + // Determine if there are duplicate names, if so append a number to end. |
|
310 | + $unique_name = $cleaned_name; |
|
311 | + while (db_result(db_query("SELECT uid FROM {users} WHERE name = '{$unique_name}' LIMIT 1"))) { |
|
312 | 312 | $same_name_tally++; |
313 | 313 | $unique_name = "{$cleaned_name}_{$same_name_tally}"; |
314 | - } |
|
315 | - return $unique_name; |
|
314 | + } |
|
315 | + return $unique_name; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | * |
327 | 327 | */ |
328 | 328 | function boincuser_check_termsofuse($user) { |
329 | - require_boinc('consent'); |
|
330 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
331 | - return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
|
329 | + require_boinc('consent'); |
|
330 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
331 | + return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -339,33 +339,33 @@ discard block |
||
339 | 339 | * |
340 | 340 | */ |
341 | 341 | function boincuser_consentto_termsofuse($user) { |
342 | - require_boinc('consent'); |
|
343 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
342 | + require_boinc('consent'); |
|
343 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
344 | 344 | |
345 | - list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
|
346 | - if ($checkct) { |
|
345 | + list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
|
346 | + if ($checkct) { |
|
347 | 347 | $rc1 = consent_to_a_policy($boinc_user, $ctid, 1, 0, 'Webform', time()); |
348 | 348 | if (!$rc1) { |
349 | - drupal_set_message( |
|
349 | + drupal_set_message( |
|
350 | 350 | bts("ERROR: Database error when attempting to INSERT into table consent with ID=@id. The @project administrators have been notified.", |
351 | 351 | array( |
352 | - '@id' => $boinc_user->id, |
|
353 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
352 | + '@id' => $boinc_user->id, |
|
353 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
354 | 354 | ), |
355 | 355 | 'NULL', 'boinc:consent-termsofuse'), |
356 | - 'error'); |
|
357 | - rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
|
356 | + 'error'); |
|
357 | + rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
|
358 | 358 | } |
359 | 359 | return $rc1; |
360 | - } |
|
361 | - else { |
|
360 | + } |
|
361 | + else { |
|
362 | 362 | drupal_set_message( |
363 | - bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
|
363 | + bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
|
364 | 364 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
365 | 365 | 'error'); |
366 | 366 | rules_invoke_event('boincuser_general_consent_type_error', CONSENT_TYPE_ENROLL, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
367 | - } |
|
368 | - return FALSE; |
|
367 | + } |
|
368 | + return FALSE; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -374,16 +374,16 @@ discard block |
||
374 | 374 | */ |
375 | 375 | function _boincuser_ignore_paths($path, $paths_to_ignore) { |
376 | 376 | |
377 | - foreach ($paths_to_ignore as $pi) { |
|
377 | + foreach ($paths_to_ignore as $pi) { |
|
378 | 378 | // @todo Currently this function uses {} as PHP regexp |
379 | 379 | // delimiters. Curly brace is not really allowed un URLs, but a |
380 | 380 | // more robust function would first check for these curly braces |
381 | 381 | // in the path_to_ignore patterms, just in case. |
382 | 382 | if (preg_match('{' . $pi . '}', $path)) { |
383 | - return TRUE; |
|
383 | + return TRUE; |
|
384 | 384 | } |
385 | - } |
|
386 | - return FALSE; |
|
385 | + } |
|
386 | + return FALSE; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -391,20 +391,20 @@ discard block |
||
391 | 391 | * Drupal's recover email path. |
392 | 392 | */ |
393 | 393 | function _boincuser_redirect_recover_email() { |
394 | - $params = array( |
|
394 | + $params = array( |
|
395 | 395 | 'boincid' => isset($_GET['id']) ? $_GET['id'] : '', |
396 | 396 | 'token' => isset($_GET['token']) ? $_GET['token'] : '' |
397 | - ); |
|
397 | + ); |
|
398 | 398 | |
399 | - // If boincid or token is not present, then go to the home page. |
|
400 | - if (empty($params['boincid']) or empty($params['token'])) { |
|
399 | + // If boincid or token is not present, then go to the home page. |
|
400 | + if (empty($params['boincid']) or empty($params['token'])) { |
|
401 | 401 | $redirect = ''; |
402 | - } |
|
403 | - else { |
|
402 | + } |
|
403 | + else { |
|
404 | 404 | $uid = boincuser_lookup_uid($params['boincid']); |
405 | 405 | $redirect = "/user/${uid}/recoveremail/${params['token']}"; |
406 | - } |
|
407 | - drupal_goto($redirect); |
|
406 | + } |
|
407 | + drupal_goto($redirect); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -415,17 +415,17 @@ discard block |
||
415 | 415 | * Require BOINC library |
416 | 416 | */ |
417 | 417 | function require_boinc($libraries) { |
418 | - if ($include_dir = boinc_get_path('html_inc')) { |
|
418 | + if ($include_dir = boinc_get_path('html_inc')) { |
|
419 | 419 | $working_dir = getcwd(); |
420 | 420 | chdir($include_dir); |
421 | 421 | if (!is_array($libraries)) { |
422 | - $libraries = array($libraries); |
|
422 | + $libraries = array($libraries); |
|
423 | 423 | } |
424 | 424 | foreach ($libraries as $library) { |
425 | - require_once("{$library}.inc"); |
|
425 | + require_once("{$library}.inc"); |
|
426 | 426 | } |
427 | 427 | chdir($working_dir); |
428 | - } |
|
428 | + } |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * The path from the BOINC html root must be included (e.g. user/file.php) |
434 | 434 | */ |
435 | 435 | function include_boinc($file) { |
436 | - if ($include_dir = boinc_get_path()) { |
|
436 | + if ($include_dir = boinc_get_path()) { |
|
437 | 437 | $include_dir .= '/html'; |
438 | 438 | $workingDir = getcwd(); |
439 | 439 | $path = dirname($file); |
@@ -441,84 +441,84 @@ discard block |
||
441 | 441 | chdir("{$include_dir}/{$path}"); |
442 | 442 | include($file); |
443 | 443 | chdir($workingDir); |
444 | - } |
|
444 | + } |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Get the BOINC include path |
449 | 449 | */ |
450 | 450 | function boinc_get_path($type = 'root') { |
451 | - $dir = "boinc_{$type}_dir"; |
|
452 | - if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
|
451 | + $dir = "boinc_{$type}_dir"; |
|
452 | + if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
|
453 | 453 | return $include_dir; |
454 | - } |
|
455 | - else { |
|
454 | + } |
|
455 | + else { |
|
456 | 456 | // Don't show errors on blacklisted pages |
457 | 457 | $page_blacklist = array( |
458 | - 'admin/boinc/environment' |
|
458 | + 'admin/boinc/environment' |
|
459 | 459 | ); |
460 | 460 | if (!in_array($_GET['q'], $page_blacklist)) { |
461 | - watchdog('boincuser', 'The BOINC environment is not configured. Please |
|
461 | + watchdog('boincuser', 'The BOINC environment is not configured. Please |
|
462 | 462 | !configure_it', array('!configure_it' => l(t('configure it now'), |
463 | 463 | 'admin/boinc/environment')), WATCHDOG_WARNING); |
464 | - if (user_access('administer site configuration')) { |
|
464 | + if (user_access('administer site configuration')) { |
|
465 | 465 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 466 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | 467 | 'admin/boinc/environment'))), 'warning', FALSE); |
468 | - } |
|
469 | - else { |
|
468 | + } |
|
469 | + else { |
|
470 | 470 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | 471 | the system administrator.'), 'error', FALSE); |
472 | - } |
|
473 | - // Redirect home to display the error message and avoid fatal errors |
|
474 | - // (unless on a blacklisted page) |
|
475 | - $redirect_blacklist = array( |
|
472 | + } |
|
473 | + // Redirect home to display the error message and avoid fatal errors |
|
474 | + // (unless on a blacklisted page) |
|
475 | + $redirect_blacklist = array( |
|
476 | 476 | 'admin/settings/performance', |
477 | 477 | 'admin/boinc/environment', |
478 | 478 | 'home', |
479 | 479 | '' |
480 | - ); |
|
481 | - if (!in_array($_GET['q'], $redirect_blacklist)) { |
|
480 | + ); |
|
481 | + if (!in_array($_GET['q'], $redirect_blacklist)) { |
|
482 | 482 | drupal_goto(''); |
483 | - } |
|
483 | + } |
|
484 | 484 | } |
485 | 485 | else { |
486 | - // Clear the messages on the environment config page |
|
487 | - drupal_get_messages(); |
|
486 | + // Clear the messages on the environment config page |
|
487 | + drupal_get_messages(); |
|
488 | 488 | } |
489 | - } |
|
490 | - return FALSE; |
|
489 | + } |
|
490 | + return FALSE; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
494 | 494 | * Get the configured scheduler tags |
495 | 495 | */ |
496 | 496 | function boinc_get_scheduler_tags() { |
497 | - // Don't generate messages for blacklisted pages |
|
498 | - $page_blacklist = array( |
|
497 | + // Don't generate messages for blacklisted pages |
|
498 | + $page_blacklist = array( |
|
499 | 499 | 'admin/boinc/environment', |
500 | 500 | 'admin/boinc/scheduler' |
501 | - ); |
|
502 | - if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
|
501 | + ); |
|
502 | + if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
|
503 | 503 | return explode("\r\n", $url_config); |
504 | - } |
|
505 | - elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
504 | + } |
|
505 | + elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
506 | 506 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
507 | 507 | configured. Please !verify for the settings to become effective.', |
508 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
508 | + array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
509 | 509 | t('and') . '</strong> ' . t('save the configuration'), |
510 | 510 | 'admin/boinc/scheduler', array('html' => TRUE)) |
511 | - ), WATCHDOG_WARNING); |
|
511 | + ), WATCHDOG_WARNING); |
|
512 | 512 | if (user_access('administer site configuration')) { |
513 | - drupal_set_message(t('The BOINC scheduling server settings are not yet |
|
513 | + drupal_set_message(t('The BOINC scheduling server settings are not yet |
|
514 | 514 | configured. Please !verify for the settings to become effective', |
515 | 515 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
516 | - t('and') . '</strong> ' . t('save the configuration'), |
|
517 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
516 | + t('and') . '</strong> ' . t('save the configuration'), |
|
517 | + 'admin/boinc/scheduler', array('html' => TRUE)) |
|
518 | 518 | )), 'warning', FALSE); |
519 | 519 | } |
520 | - } |
|
521 | - return array(); |
|
520 | + } |
|
521 | + return array(); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -530,41 +530,41 @@ discard block |
||
530 | 530 | * Determine if a BOINC ID matches the logged in user |
531 | 531 | */ |
532 | 532 | function is_current_boinc_user($boinc_id) { |
533 | - global $user; |
|
534 | - if (!$user->uid) { |
|
533 | + global $user; |
|
534 | + if (!$user->uid) { |
|
535 | 535 | return FALSE; |
536 | - } |
|
537 | - // boincuser_id is not stored in the global user, so load a new instance |
|
538 | - $drupuser = user_load($user->uid); |
|
539 | - return ($boinc_id == $drupuser->boincuser_id); |
|
536 | + } |
|
537 | + // boincuser_id is not stored in the global user, so load a new instance |
|
538 | + $drupuser = user_load($user->uid); |
|
539 | + return ($boinc_id == $drupuser->boincuser_id); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
543 | 543 | * Convert a BOINC ID to a Drupal ID |
544 | 544 | */ |
545 | 545 | function boincuser_lookup_uid($boinc_id) { |
546 | - $drupal_id = db_result(db_query("SELECT uid FROM {boincuser} WHERE boinc_id='%d'", $boinc_id)); |
|
547 | - return $drupal_id; |
|
546 | + $drupal_id = db_result(db_query("SELECT uid FROM {boincuser} WHERE boinc_id='%d'", $boinc_id)); |
|
547 | + return $drupal_id; |
|
548 | 548 | } |
549 | 549 | function get_drupal_id($boinc_id) { |
550 | - return boincuser_lookup_uid($boinc_id); |
|
550 | + return boincuser_lookup_uid($boinc_id); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Get a BOINC user object |
555 | 555 | */ |
556 | 556 | function boincuser_load($user_id = NULL, $is_drupal_id = FALSE) { |
557 | - if (!$user_id) { |
|
557 | + if (!$user_id) { |
|
558 | 558 | global $user; |
559 | 559 | $user_id = $user->uid; |
560 | 560 | $is_drupal_id = TRUE; |
561 | - } |
|
562 | - if ($is_drupal_id) { |
|
561 | + } |
|
562 | + if ($is_drupal_id) { |
|
563 | 563 | $account = user_load($user_id); |
564 | 564 | $user_id = $account->boincuser_id; |
565 | - } |
|
566 | - require_boinc('boinc_db'); |
|
567 | - return BoincUser::lookup_id($user_id); |
|
565 | + } |
|
566 | + require_boinc('boinc_db'); |
|
567 | + return BoincUser::lookup_id($user_id); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -574,10 +574,10 @@ discard block |
||
574 | 574 | * page, delete button. |
575 | 575 | */ |
576 | 576 | function _boincuser_node_profile_delete_submit($form, &$form_state) { |
577 | - $node = $form['#node']; |
|
578 | - $deleteurl = 'node/'. $node->nid .'/delete'; |
|
579 | - $afterq = 'destination=account'; |
|
580 | - drupal_goto($deleteurl, $afterq); |
|
577 | + $node = $form['#node']; |
|
578 | + $deleteurl = 'node/'. $node->nid .'/delete'; |
|
579 | + $afterq = 'destination=account'; |
|
580 | + drupal_goto($deleteurl, $afterq); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | * Wrapper for boinc_version() function |
589 | 589 | */ |
590 | 590 | function get_boinc_version($x) { |
591 | - require_boinc('host'); |
|
592 | - return function_exists('boinc_version') ? boinc_version($x) : 'err!'; |
|
591 | + require_boinc('host'); |
|
592 | + return function_exists('boinc_version') ? boinc_version($x) : 'err!'; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -598,14 +598,14 @@ discard block |
||
598 | 598 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
599 | 599 | |
600 | 600 | /** |
601 | - * Generate the friend block header |
|
602 | - */ |
|
601 | + * Generate the friend block header |
|
602 | + */ |
|
603 | 603 | function boincuser_views_friends_block_header($context = null) { |
604 | - // Get the friend count for the user being viewed |
|
605 | - $view = views_get_current_view(); |
|
606 | - $account_id = $view->args[0]; |
|
607 | - $friend_count = flag_friend_get_friend_count($account_id); |
|
608 | - return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
604 | + // Get the friend count for the user being viewed |
|
605 | + $view = views_get_current_view(); |
|
606 | + $account_id = $view->args[0]; |
|
607 | + $friend_count = flag_friend_get_friend_count($account_id); |
|
608 | + return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
609 | 609 | array('@count' => $friend_count)) . '</h2>'; |
610 | 610 | } |
611 | 611 | |
@@ -614,13 +614,13 @@ discard block |
||
614 | 614 | * database. |
615 | 615 | */ |
616 | 616 | function _boincuser_user_name_autocomplete($string) { |
617 | - $matches = array(); |
|
618 | - db_set_active('boinc_ro'); |
|
619 | - $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
|
620 | - db_set_active('default'); |
|
621 | - while ($user = db_fetch_object($result)) { |
|
622 | - $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
623 | - } |
|
624 | - |
|
625 | - drupal_json((object)$matches); |
|
617 | + $matches = array(); |
|
618 | + db_set_active('boinc_ro'); |
|
619 | + $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
|
620 | + db_set_active('default'); |
|
621 | + while ($user = db_fetch_object($result)) { |
|
622 | + $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
623 | + } |
|
624 | + |
|
625 | + drupal_json((object)$matches); |
|
626 | 626 | } |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | unset($account->roles[$unrestricted_role]); |
72 | 72 | } |
73 | 73 | user_save($account, array('roles' => $account->roles)); |
74 | - } |
|
75 | - else { |
|
74 | + } else { |
|
76 | 75 | if (!isset($account->roles[$community_role])) { |
77 | 76 | // The user should be a 'community member' role. If the user was |
78 | 77 | // previously banned, this will restore that role. |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | $account->roles[$unrestricted_role] = 'verified contributor'; |
89 | 88 | user_save($account, array('roles' => $account->roles)); |
90 | 89 | } |
91 | - } |
|
92 | - else { |
|
90 | + } else { |
|
93 | 91 | drupal_set_message(bts( |
94 | 92 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 93 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
@@ -175,12 +173,10 @@ discard block |
||
175 | 173 | if ($never_been_picked) { |
176 | 174 | // Allow users who have been previously selected |
177 | 175 | $never_been_picked = FALSE; |
178 | - } |
|
179 | - elseif ($active_users) { |
|
176 | + } elseif ($active_users) { |
|
180 | 177 | // Allow users who are not even active (getting desperate) |
181 | 178 | $active_users = FALSE; |
182 | - } |
|
183 | - else { |
|
179 | + } else { |
|
184 | 180 | // Process failed... |
185 | 181 | return FALSE; |
186 | 182 | } |
@@ -235,8 +231,7 @@ discard block |
||
235 | 231 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
236 | 232 | . "on {$changedate}. If you need to reverse this change, please look for " |
237 | 233 | . "an email send to the email address: {$prev_email}.\n"; |
238 | - } |
|
239 | - else { |
|
234 | + } else { |
|
240 | 235 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
241 | 236 | . "on {$changedate}. You will not be able to change your email address " |
242 | 237 | . "until {$newdate}. If you need to reverse this change, please look for " |
@@ -357,8 +352,7 @@ discard block |
||
357 | 352 | rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
358 | 353 | } |
359 | 354 | return $rc1; |
360 | - } |
|
361 | - else { |
|
355 | + } else { |
|
362 | 356 | drupal_set_message( |
363 | 357 | bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
364 | 358 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
@@ -399,8 +393,7 @@ discard block |
||
399 | 393 | // If boincid or token is not present, then go to the home page. |
400 | 394 | if (empty($params['boincid']) or empty($params['token'])) { |
401 | 395 | $redirect = ''; |
402 | - } |
|
403 | - else { |
|
396 | + } else { |
|
404 | 397 | $uid = boincuser_lookup_uid($params['boincid']); |
405 | 398 | $redirect = "/user/${uid}/recoveremail/${params['token']}"; |
406 | 399 | } |
@@ -451,8 +444,7 @@ discard block |
||
451 | 444 | $dir = "boinc_{$type}_dir"; |
452 | 445 | if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
453 | 446 | return $include_dir; |
454 | - } |
|
455 | - else { |
|
447 | + } else { |
|
456 | 448 | // Don't show errors on blacklisted pages |
457 | 449 | $page_blacklist = array( |
458 | 450 | 'admin/boinc/environment' |
@@ -465,8 +457,7 @@ discard block |
||
465 | 457 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 458 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | 459 | 'admin/boinc/environment'))), 'warning', FALSE); |
468 | - } |
|
469 | - else { |
|
460 | + } else { |
|
470 | 461 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | 462 | the system administrator.'), 'error', FALSE); |
472 | 463 | } |
@@ -481,8 +472,7 @@ discard block |
||
481 | 472 | if (!in_array($_GET['q'], $redirect_blacklist)) { |
482 | 473 | drupal_goto(''); |
483 | 474 | } |
484 | - } |
|
485 | - else { |
|
475 | + } else { |
|
486 | 476 | // Clear the messages on the environment config page |
487 | 477 | drupal_get_messages(); |
488 | 478 | } |
@@ -501,8 +491,7 @@ discard block |
||
501 | 491 | ); |
502 | 492 | if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
503 | 493 | return explode("\r\n", $url_config); |
504 | - } |
|
505 | - elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
494 | + } elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
506 | 495 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
507 | 496 | configured. Please !verify for the settings to become effective.', |
508 | 497 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Get an image object from a given file and cck field |
29 | 29 | */ |
30 | -function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = FALSE) { |
|
30 | +function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = false) { |
|
31 | 31 | $field = content_fields($field_name, $content_type); |
32 | 32 | $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
33 | 33 | if ($ignore_resolution) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function boincuser_check_credit_requirements() { |
50 | 50 | global $user; |
51 | 51 | if (!$user->uid) { |
52 | - return FALSE; |
|
52 | + return false; |
|
53 | 53 | } |
54 | 54 | $account = user_load($user->uid); |
55 | 55 | $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | drupal_set_message(bts( |
62 | 62 | 'You are banned from community participation until @date', |
63 | 63 | array('@date' => format_date($account->boincuser_penalty_expiration)) |
64 | - ), 'warning', FALSE); |
|
64 | + ), 'warning', false); |
|
65 | 65 | if (isset($account->roles[$community_role])) { |
66 | 66 | // Remove from the community role, if not already |
67 | 67 | unset($account->roles[$community_role]); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | drupal_set_message(bts( |
94 | 94 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 95 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
96 | - ), 'warning', FALSE); |
|
96 | + ), 'warning', false); |
|
97 | 97 | if (isset($account->roles[$unrestricted_role])) { |
98 | 98 | // Either the threshold has been raised or credits have been revoked; |
99 | 99 | // this user no longer qualifies for full privileges |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Get the cid of the first comment the user has not seen on a given node |
110 | 110 | */ |
111 | -function boincuser_get_first_unread_comment_id($nid, $uid = NULL) { |
|
111 | +function boincuser_get_first_unread_comment_id($nid, $uid = null) { |
|
112 | 112 | if (!$uid) { |
113 | 113 | global $user; |
114 | 114 | $uid = $user->uid; |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | // Can't find a user with a profile; remove constraints on the pool |
175 | 175 | if ($never_been_picked) { |
176 | 176 | // Allow users who have been previously selected |
177 | - $never_been_picked = FALSE; |
|
177 | + $never_been_picked = false; |
|
178 | 178 | } |
179 | 179 | elseif ($active_users) { |
180 | 180 | // Allow users who are not even active (getting desperate) |
181 | - $active_users = FALSE; |
|
181 | + $active_users = false; |
|
182 | 182 | } |
183 | 183 | else { |
184 | 184 | // Process failed... |
185 | - return FALSE; |
|
185 | + return false; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * this function is called, it may be called with optional parameters |
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | -function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
|
215 | +function _boincuser_send_emailchange($account, $new_email=null, $prev_email=null, $adminuser=false) { |
|
216 | 216 | require_boinc('token'); |
217 | 217 | module_load_include('inc', 'rules', 'modules/system.rules'); |
218 | 218 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function boincuser_check_termsofuse($user) { |
329 | 329 | require_boinc('consent'); |
330 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
330 | + $boinc_user = boincuser_load($user->uid, true); |
|
331 | 331 | return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
332 | 332 | } |
333 | 333 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | function boincuser_consentto_termsofuse($user) { |
342 | 342 | require_boinc('consent'); |
343 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
343 | + $boinc_user = boincuser_load($user->uid, true); |
|
344 | 344 | |
345 | 345 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
346 | 346 | if ($checkct) { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | bts("ERROR: Database error when attempting to INSERT into table consent with ID=@id. The @project administrators have been notified.", |
351 | 351 | array( |
352 | 352 | '@id' => $boinc_user->id, |
353 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
353 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), null, 'boinc:add-new-user' |
|
354 | 354 | ), |
355 | 355 | 'NULL', 'boinc:consent-termsofuse'), |
356 | 356 | 'error'); |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | else { |
362 | 362 | drupal_set_message( |
363 | 363 | bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
364 | - array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
|
364 | + array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:consent-termsofuse'), |
|
365 | 365 | 'error'); |
366 | 366 | rules_invoke_event('boincuser_general_consent_type_error', CONSENT_TYPE_ENROLL, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
367 | 367 | } |
368 | - return FALSE; |
|
368 | + return false; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | // more robust function would first check for these curly braces |
381 | 381 | // in the path_to_ignore patterms, just in case. |
382 | 382 | if (preg_match('{' . $pi . '}', $path)) { |
383 | - return TRUE; |
|
383 | + return true; |
|
384 | 384 | } |
385 | 385 | } |
386 | - return FALSE; |
|
386 | + return false; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | if (user_access('administer site configuration')) { |
465 | 465 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 466 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | - 'admin/boinc/environment'))), 'warning', FALSE); |
|
467 | + 'admin/boinc/environment'))), 'warning', false); |
|
468 | 468 | } |
469 | 469 | else { |
470 | 470 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | - the system administrator.'), 'error', FALSE); |
|
471 | + the system administrator.'), 'error', false); |
|
472 | 472 | } |
473 | 473 | // Redirect home to display the error message and avoid fatal errors |
474 | 474 | // (unless on a blacklisted page) |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | drupal_get_messages(); |
488 | 488 | } |
489 | 489 | } |
490 | - return FALSE; |
|
490 | + return false; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -507,15 +507,15 @@ discard block |
||
507 | 507 | configured. Please !verify for the settings to become effective.', |
508 | 508 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
509 | 509 | t('and') . '</strong> ' . t('save the configuration'), |
510 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
510 | + 'admin/boinc/scheduler', array('html' => true)) |
|
511 | 511 | ), WATCHDOG_WARNING); |
512 | 512 | if (user_access('administer site configuration')) { |
513 | 513 | drupal_set_message(t('The BOINC scheduling server settings are not yet |
514 | 514 | configured. Please !verify for the settings to become effective', |
515 | 515 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
516 | 516 | t('and') . '</strong> ' . t('save the configuration'), |
517 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
518 | - )), 'warning', FALSE); |
|
517 | + 'admin/boinc/scheduler', array('html' => true)) |
|
518 | + )), 'warning', false); |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | return array(); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | function is_current_boinc_user($boinc_id) { |
533 | 533 | global $user; |
534 | 534 | if (!$user->uid) { |
535 | - return FALSE; |
|
535 | + return false; |
|
536 | 536 | } |
537 | 537 | // boincuser_id is not stored in the global user, so load a new instance |
538 | 538 | $drupuser = user_load($user->uid); |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | /** |
554 | 554 | * Get a BOINC user object |
555 | 555 | */ |
556 | -function boincuser_load($user_id = NULL, $is_drupal_id = FALSE) { |
|
556 | +function boincuser_load($user_id = null, $is_drupal_id = false) { |
|
557 | 557 | if (!$user_id) { |
558 | 558 | global $user; |
559 | 559 | $user_id = $user->uid; |
560 | - $is_drupal_id = TRUE; |
|
560 | + $is_drupal_id = true; |
|
561 | 561 | } |
562 | 562 | if ($is_drupal_id) { |
563 | 563 | $account = user_load($user_id); |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | -function xml_error($num, $msg=null, $file=null, $line=null) { |
|
49 | +function xml_error($num, $msg = null, $file = null, $line = null) { |
|
50 | 50 | global $xml_outer_tag; |
51 | 51 | if (!$msg) { |
52 | - switch($num) { |
|
52 | + switch ($num) { |
|
53 | 53 | case -112: $msg = "Invalid XML"; break; |
54 | 54 | case -136: $msg = "Not found"; break; |
55 | 55 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // If it's a single-tag element, and it's present, just return the tag |
96 | 96 | // |
97 | 97 | function parse_element($xml, $tag) { |
98 | - $closetag = "</" . substr($tag,1); |
|
98 | + $closetag = "</".substr($tag, 1); |
|
99 | 99 | $x = strstr($xml, $tag); |
100 | 100 | if ($x) { |
101 | 101 | if (strstr($tag, "/>")) return $tag; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | function parse_next_element($xml, $tag, &$cursor) { |
113 | 113 | $element = null; |
114 | - $closetag = "</" . substr($tag,1); |
|
115 | - $pos = substr($xml,$cursor); |
|
114 | + $closetag = "</".substr($tag, 1); |
|
115 | + $pos = substr($xml, $cursor); |
|
116 | 116 | $x = strstr($pos, $tag); |
117 | 117 | if ($x) { |
118 | 118 | if (strstr($tag, "/>")) return $tag; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $globals->batch = 1000; |
56 | 56 | $globals->lapsed_interval = 60*86400; |
57 | 57 | |
58 | -for ($i=1; $i<$argc; $i++) { |
|
58 | +for ($i = 1; $i < $argc; $i++) { |
|
59 | 59 | if ($argv[$i] == "--batch") { |
60 | 60 | $i++; |
61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | gmdate('d F Y', $user->create_time), |
170 | 170 | number_format($user->total_credit, 0), |
171 | 171 | opt_out_url($user), |
172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
172 | + floor((time() - $user->last_rpc_time)/86400), |
|
173 | 173 | ); |
174 | 174 | return preg_replace($pat, $rep, $template); |
175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | while ($user = _mysql_fetch_object($result)) { |
239 | 239 | handle_user($user); |
240 | 240 | $startid = $user->id; |
241 | - fputs($log, $user->id . "\n"); |
|
241 | + fputs($log, $user->id."\n"); |
|
242 | 242 | fflush($log); |
243 | 243 | } |
244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $user = _mysql_fetch_object($result); |
253 | 253 | if ($user) { |
254 | 254 | handle_user($user); |
255 | - fputs($log, $user->id . "\n"); |
|
255 | + fputs($log, $user->id."\n"); |
|
256 | 256 | fflush($log); |
257 | 257 | } |
258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } else { |
290 | 290 | $fid = fopen($id_file, 'r'); |
291 | 291 | if (!$fid) { |
292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
293 | 293 | exit(); |
294 | 294 | } |
295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | fclose($fid); |
302 | 302 | } |
303 | - echo 'All done!' . "\n"; |
|
303 | + echo 'All done!'."\n"; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $dh = opendir($langdir.$transdir); |
65 | 65 | if (!$dh) die("can't open translation dir"); |
66 | 66 | while (($file = readdir($dh)) !== false) { |
67 | - if ($file==".." || $file==".") { |
|
67 | + if ($file == ".." || $file == ".") { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file, -3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | function parse_po_file($file) { |
116 | 116 | $translation_file = file($file); |
117 | 117 | $first_entry = true; |
118 | - $current_token_text=""; |
|
119 | - $current_token =""; |
|
118 | + $current_token_text = ""; |
|
119 | + $current_token = ""; |
|
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i = 0; $i < $size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | - if (substr($entry, 0, 1)=="#") { |
|
127 | + if (substr($entry, 0, 1) == "#") { |
|
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | - $output[$current_token]=$current_token_text; |
|
132 | + $output[$current_token] = $current_token_text; |
|
133 | 133 | } |
134 | 134 | $current_token = get_po_line($entry, $file); |
135 | - $current_token_text=""; |
|
135 | + $current_token_text = ""; |
|
136 | 136 | $parsing_token = true; |
137 | 137 | $parsing_text = false; |
138 | - $first_entry=false; |
|
138 | + $first_entry = false; |
|
139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
140 | 140 | $current_token_text = get_po_line($entry, $file); |
141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
160 | 160 | // |
161 | 161 | function get_po_line($line, $file) { |
162 | - $start = strpos($line, '"')+1; |
|
162 | + $start = strpos($line, '"') + 1; |
|
163 | 163 | $stop = strrpos($line, '"'); |
164 | - $x = substr($line, $start, $stop-$start); |
|
164 | + $x = substr($line, $start, $stop - $start); |
|
165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
166 | 166 | if ($n) { |
167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language == "en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | return $text; |
211 | 211 | } |
212 | 212 | |
213 | -function language_log($message, $loglevel=0) { |
|
213 | +function language_log($message, $loglevel = 0) { |
|
214 | 214 | global $lang_log_level; |
215 | 215 | $msg = ""; |
216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
218 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | // Loop over languages that the client requests |
258 | 258 | // |
259 | 259 | $size = sizeof($client_languages); |
260 | -for ($i=0; $i<$size; $i++) { |
|
261 | - if ((strlen($client_languages[$i])>2) |
|
260 | +for ($i = 0; $i < $size; $i++) { |
|
261 | + if ((strlen($client_languages[$i]) > 2) |
|
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // if main language is english, look no further |
281 | 281 | // |
282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
307 | 307 | |
308 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
308 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
309 | 309 | ?> |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file,-3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i=0; $i<$size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | 127 | if (substr($entry, 0, 1)=="#") { |
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | 132 | $output[$current_token]=$current_token_text; |
133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language=="en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i=1; $i<func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | if ($loglevel==1) $msg = "[ Warning ]"; |
218 | 218 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | for ($i=0; $i<$size; $i++) { |
261 | 261 | if ((strlen($client_languages[$i])>2) |
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |