@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | 'teaser' => $teaser, |
88 | 88 | 'uid' => boincuser_lookup_uid($boincteam->userid), |
89 | 89 | 'path' => null, |
90 | - 'status' => 1, // published or not - always publish |
|
90 | + 'status' => 1, // published or not - always publish |
|
91 | 91 | 'promote' => 0, |
92 | 92 | 'created' => $boincteam->create_time, |
93 | - 'comment' => 0, // comments disabled |
|
93 | + 'comment' => 0, // comments disabled |
|
94 | 94 | 'moderate' => 0, |
95 | 95 | 'sticky' => 0, |
96 | 96 | 'format' => $input_format |
97 | 97 | ); |
98 | - $node = (object) $node; // node_save requires an object form |
|
98 | + $node = (object)$node; // node_save requires an object form |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * flag send_email=1, meaning their notification privacy will be |
126 | 126 | * respected. This is useful the list of users are to be contacted. |
127 | 127 | */ |
128 | -function _boincteam_userids($boincteamid, $boincid=TRUE, $respectprivacy=TRUE) { |
|
128 | +function _boincteam_userids($boincteamid, $boincid = TRUE, $respectprivacy = TRUE) { |
|
129 | 129 | $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
130 | 130 | if ($respectprivacy) { |
131 | 131 | $sql .= ' AND user.send_email=1'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * flag send_email=1, meaning their notification privacy will be |
158 | 158 | * respected. This is useful the list of users are to be contacted. |
159 | 159 | */ |
160 | -function _boincteam_emails($boincteamid, $respectprivacy=TRUE) { |
|
160 | +function _boincteam_emails($boincteamid, $respectprivacy = TRUE) { |
|
161 | 161 | $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
162 | 162 | if ($respectprivacy) { |
163 | 163 | $sql .= ' AND user.send_email=1'; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | '#suffix' => '</li>', |
120 | 120 | ); |
121 | 121 | $form['form control tabs'] = array( |
122 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
122 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | return $form; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | // Create the team in the BOINC db |
165 | 165 | |
166 | - require_boinc(array('user','team')); |
|
166 | + require_boinc(array('user', 'team')); |
|
167 | 167 | $boinc_team = make_team( |
168 | 168 | $account->boincuser_id, |
169 | 169 | $values['name'], |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | 'teaser' => $teaser, |
200 | 200 | 'uid' => $user->uid, |
201 | 201 | 'path' => null, |
202 | - 'status' => 1, // published or not - always publish |
|
202 | + 'status' => 1, // published or not - always publish |
|
203 | 203 | 'promote' => 0, |
204 | 204 | 'created' => $created_time, |
205 | - 'comment' => 0, // comments disabled |
|
205 | + 'comment' => 0, // comments disabled |
|
206 | 206 | 'moderate' => 0, |
207 | 207 | 'sticky' => 0, |
208 | 208 | 'format' => $input_format |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $node['og_private'] = 0; |
230 | 230 | */ |
231 | 231 | |
232 | - $node = (object) $node; // node_save requires an object form |
|
232 | + $node = (object)$node; // node_save requires an object form |
|
233 | 233 | |
234 | 234 | /* |
235 | 235 | $node->field_description[]['value'] = $boincteam->description; |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | '#suffix' => '</li>', |
380 | 380 | ); |
381 | 381 | $form['form control tabs'] = array( |
382 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
382 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>' |
|
383 | 383 | ); |
384 | 384 | } |
385 | 385 | else { |
386 | 386 | $form['description'] = array( |
387 | - '#prefix' => '<div class="form-item"><label>' . bts('Description', array(), NULL, 'boinc:team-description') . ':</label></div><div class="form-item">', |
|
387 | + '#prefix' => '<div class="form-item"><label>'.bts('Description', array(), NULL, 'boinc:team-description').':</label></div><div class="form-item">', |
|
388 | 388 | '#value' => $default['description'], |
389 | 389 | '#suffix' => '</div>', |
390 | 390 | ); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | '#suffix' => '</li>', |
541 | 541 | ); |
542 | 542 | $form['form control tabs'] = array( |
543 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
|
543 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/edit', TRUE)).'</li>' |
|
544 | 544 | ); |
545 | 545 | |
546 | 546 | //$form['#redirect'] = "community/teams/{$team_id}"; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | drupal_set_title($mytitle); |
657 | 657 | |
658 | 658 | $form['emailteam']['header'] = array( |
659 | - '#value' => '<h1>' . $mytitle . '</h1>', |
|
659 | + '#value' => '<h1>'.$mytitle.'</h1>', |
|
660 | 660 | '#weight' => '-10', |
661 | 661 | '#prefix' => "<div id='sendmessageteammembers-header'>", |
662 | 662 | '#suffix' => "</div>", |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | } |
779 | 779 | |
780 | 780 | // Check body |
781 | - if ( ($message['body'] === NULL || $message['body'] === '') ) { |
|
781 | + if (($message['body'] === NULL || $message['body'] === '')) { |
|
782 | 782 | form_set_error('body', |
783 | 783 | bts('Not allowed to send an empty message.', array(), NULL, 'boinc:team-message-form') |
784 | 784 | ); |
@@ -803,8 +803,8 @@ discard block |
||
803 | 803 | global $base_path; |
804 | 804 | |
805 | 805 | $suid = $form_state['values']['_senderuid']; |
806 | - $account = user_load(array('uid' => $suid )); |
|
807 | - $site_url = $base_url . $base_path . "messages/new/" . $suid; |
|
806 | + $account = user_load(array('uid' => $suid)); |
|
807 | + $site_url = $base_url.$base_path."messages/new/".$suid; |
|
808 | 808 | |
809 | 809 | // Form is validated, now send to all team members. Lookup boinc |
810 | 810 | // id of all team members, and then use user_load() to load user |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | // emails removed. |
816 | 816 | $member_emails = _boincteam_emails($boinc_id); |
817 | 817 | // Remove sender's email address, unless selfsend is true. |
818 | - if ( !$form_state['values']['selfsend'] ) { |
|
818 | + if (!$form_state['values']['selfsend']) { |
|
819 | 819 | $pos = array_search($account->mail, $member_emails); |
820 | 820 | unset($member_emails[$pos]); |
821 | 821 | } |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | |
840 | 840 | $om = bts( |
841 | 841 | 'Sent your email message to !number team members.', |
842 | - array( '!number' => count($member_emails) ), |
|
842 | + array('!number' => count($member_emails)), |
|
843 | 843 | 'NULL', |
844 | 844 | 'boinc:team-message-sent' |
845 | 845 | ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // Call our custom authentication function to check for an existing BOINC user |
36 | 36 | if (!boincuser_login_authenticate($form_state['values'])) { |
37 | 37 | // Authentication failed; set an error accordingly |
38 | - form_set_error('name', bts('Sorry, unrecognized email address or password.', array(), NULL, 'boinc:forgot-password') . ' ' . l(bts('Have you forgotten your password?', array(), NULL, 'boinc:forgot-password'), 'user/password')); |
|
38 | + form_set_error('name', bts('Sorry, unrecognized email address or password.', array(), NULL, 'boinc:forgot-password').' '.l(bts('Have you forgotten your password?', array(), NULL, 'boinc:forgot-password'), 'user/password')); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } else { |
85 | 85 | // Create a Drupal user from the BOINC user |
86 | 86 | if ($user = boincuser_register_make_drupal_user($boinc_user)) { |
87 | - watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit')); |
|
87 | + watchdog('user', 'New external user: %email using module %module.', array('%email' => $email_addr, '%module' => $module), WATCHDOG_NOTICE, l(t('edit'), 'user/'.$user->uid.'/edit')); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | // set email address lower-case |
395 | 395 | $edit['mail'] = strtolower($edit['mail']); |
396 | 396 | |
397 | - $boinc_user_already_exists = ( BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail']) ); |
|
397 | + $boinc_user_already_exists = (BoincUser::lookup_email_addr($edit['mail']) || BoincUser::lookup_prev_email_addr($edit['mail'])); |
|
398 | 398 | if ($boinc_user_already_exists) { |
399 | 399 | form_set_error('mail', bts('A BOINC account already exists for @email.', array('@email' => $edit['mail']), NULL, 'boinc:add-new-user')); |
400 | 400 | } |
401 | 401 | |
402 | 402 | // Check email has not been changed in last X days (default X=7). |
403 | - $duration = 86400 * 7; |
|
404 | - if ( (($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users'))) ) { |
|
403 | + $duration = 86400*7; |
|
404 | + if ((($boinc_user->email_addr_change_time + $duration) > time()) and (!(user_access('administer users')))) { |
|
405 | 405 | form_set_error('email_addr_change_time', |
406 | 406 | bts('Your email address was changed within the past seven (7) days. You must wait until !futuredate to change your email again. If you need to reverse this change, please look for an email sent to !prev_email_addr.', |
407 | 407 | array( |
@@ -422,11 +422,11 @@ discard block |
||
422 | 422 | unset($_SESSION['reset_pass']); |
423 | 423 | } |
424 | 424 | else { |
425 | - $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
|
425 | + $given_hash = md5($edit['current_pass'].strtolower($account->mail)); |
|
426 | 426 | if (!$edit['current_pass']) { |
427 | 427 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
428 | 428 | } |
429 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
429 | + elseif ((!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash)) { |
|
430 | 430 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
431 | 431 | } |
432 | 432 | |
@@ -489,29 +489,29 @@ discard block |
||
489 | 489 | $project_domain = $headers['Host']; |
490 | 490 | $form['heading'] = array( |
491 | 491 | '#type' => 'markup', |
492 | - '#value' => '<h3>' . bts("If you forgot your account's email address, or you can't receive email there:", array(), NULL, 'boinc:authenticator-login-page') . '</h3>' |
|
492 | + '#value' => '<h3>'.bts("If you forgot your account's email address, or you can't receive email there:", array(), NULL, 'boinc:authenticator-login-page').'</h3>' |
|
493 | 493 | ); |
494 | 494 | $form['instructions'] = array( |
495 | 495 | '#type' => 'markup', |
496 | - '#value' => '' . |
|
497 | - '<p>' . bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page') . |
|
498 | - ' <ul>' . |
|
499 | - ' <li>' . bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation', array(), NULL, 'boinc:authenticator-login-page'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory')), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
500 | - ' <li>' . bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}"), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
501 | - ' <li>' . bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page') . |
|
502 | - ' <pre>' . |
|
503 | - '<account>' . "\n" . |
|
504 | - " <master_url>http://{$project_domain}/</master_url>" . "\n" . |
|
505 | - ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>' . "\n" . |
|
506 | - " <project_name>{$project_name}</project_name>" . "\n" . |
|
507 | - ' ...' . "\n" . |
|
508 | - '</account>' . |
|
509 | - ' </pre>' . |
|
510 | - ' </li>' . |
|
511 | - ' <li>' . bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b'), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
512 | - ' <li>' . bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
513 | - ' <li>' . bts('You will now be logged in to your account; update the email and password of your account.', array(), NULL, 'boinc:authenticator-login-page') . '</li>' . |
|
514 | - ' </ul>' . |
|
496 | + '#value' => ''. |
|
497 | + '<p>'.bts("If you have run BOINC under the account, you can still access it. Here's how:", array(), NULL, 'boinc:authenticator-login-page'). |
|
498 | + ' <ul>'. |
|
499 | + ' <li>'.bts('Go to the BOINC data directory on your computer (see !boinc_wiki for help finding this).', array('!boinc_wiki' => l(bts('BOINC documentation', array(), NULL, 'boinc:authenticator-login-page'), 'http://boinc.berkeley.edu/wiki/BOINC_Data_directory')), NULL, 'boinc:authenticator-login-page').'</li>'. |
|
500 | + ' <li>'.bts('Find your account file for this project; it will have a name like %file (where the project URL is %url).', array('%file' => "account_{$project_domain}.xml", '%url' => "http://{$project_domain}"), NULL, 'boinc:authenticator-login-page').'</li>'. |
|
501 | + ' <li>'.bts("Open the file in a text editor like Notepad. You'll see something like:", array(), NULL, 'boinc:authenticator-login-page'). |
|
502 | + ' <pre>'. |
|
503 | + '<account>'."\n". |
|
504 | + " <master_url>http://{$project_domain}/</master_url>"."\n". |
|
505 | + ' <authenticator>8b8496fdd26df7dc0423ecd43c09a56b</authenticator>'."\n". |
|
506 | + " <project_name>{$project_name}</project_name>"."\n". |
|
507 | + ' ...'."\n". |
|
508 | + '</account>'. |
|
509 | + ' </pre>'. |
|
510 | + ' </li>'. |
|
511 | + ' <li>'.bts('Select and Copy the string between <authenticator> and </authenticator> (%auth in the above example).', array('%auth' => '8b8496fdd26df7dc0423ecd43c09a56b'), NULL, 'boinc:authenticator-login-page').'</li>'. |
|
512 | + ' <li>'.bts('Paste the string into the field below, and click OK.', array(), NULL, 'boinc:authenticator-login-page').'</li>'. |
|
513 | + ' <li>'.bts('You will now be logged in to your account; update the email and password of your account.', array(), NULL, 'boinc:authenticator-login-page').'</li>'. |
|
514 | + ' </ul>'. |
|
515 | 515 | '</p>' |
516 | 516 | ); |
517 | 517 | $form['authenticator'] = array( |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | '#weight' => 1002, |
537 | 537 | ); |
538 | 538 | $form['form control tabs'] = array( |
539 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password') . '</li>', |
|
539 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/password').'</li>', |
|
540 | 540 | '#weight' => 1003, |
541 | 541 | ); |
542 | 542 | $form['form control tabs suffix'] = array( |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | '#weight' => 1002, |
600 | 600 | ); |
601 | 601 | $form['form control tabs'] = array( |
602 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
602 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}").'</li>', |
|
603 | 603 | '#weight' => 1003, |
604 | 604 | ); |
605 | 605 | $form['form control tabs suffix'] = array( |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | '#weight' => 1002, |
651 | 651 | ); |
652 | 652 | $form['form control tabs'] = array( |
653 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}") . '</li>', |
|
653 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "account/{$uid}").'</li>', |
|
654 | 654 | '#weight' => 1003, |
655 | 655 | ); |
656 | 656 | $form['form control tabs suffix'] = array( |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $uid = $form_state['storage']['ban_user_uid']; |
668 | 668 | $reason = $form_state['values']['reason']; |
669 | 669 | $duration = $form_state['values']['duration']; |
670 | - if ($duration) $duration = $duration * 24*60*60; |
|
670 | + if ($duration) $duration = $duration*24*60*60; |
|
671 | 671 | boincuser_moderate_user_ban($uid, $reason, $duration); |
672 | 672 | } |
673 | 673 | |
@@ -694,10 +694,10 @@ discard block |
||
694 | 694 | drupal_goto(); |
695 | 695 | } |
696 | 696 | |
697 | - drupal_set_message( bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning' ); |
|
697 | + drupal_set_message(bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning'); |
|
698 | 698 | |
699 | 699 | $form = array(); |
700 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
700 | + drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); |
|
701 | 701 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
702 | 702 | |
703 | 703 | // Fieldset to hold all of the form as a container |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | |
711 | 711 | $form['termsofuse']['title1'] = array( |
712 | 712 | '#weight' => -12, |
713 | - '#value' => '<h2>' . bts( variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form' ) . '</h2>', |
|
713 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:termsofuse-form').'</h2>', |
|
714 | 714 | '#prefix' => '<div id="register-title1">', |
715 | 715 | '#suffix' => '</div>', |
716 | 716 | ); |
@@ -745,12 +745,12 @@ discard block |
||
745 | 745 | '#suffix' => '</li>', |
746 | 746 | ); |
747 | 747 | $form['form control tabs'] = array( |
748 | - '#value' => '<li class="tab">' . l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout') . '</li>', |
|
748 | + '#value' => '<li class="tab">'.l(bts('NO - LOGOUT', array(), NULL, 'boinc:form-cancel'), '/logout').'</li>', |
|
749 | 749 | ); |
750 | 750 | if (module_exists('boincuser_delete')) { |
751 | - $deletelink = '/user/' . $user->uid . '/delete'; |
|
751 | + $deletelink = '/user/'.$user->uid.'/delete'; |
|
752 | 752 | $form['deleteaccount'] = array( |
753 | - '#value' => '<li class="tab">' . l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink) . '</li>', |
|
753 | + '#value' => '<li class="tab">'.l(bts('NO - DELETE ACCOUNT', array(), NULL, 'boinc:form-delete-user'), $deletelink).'</li>', |
|
754 | 754 | ); |
755 | 755 | } |
756 | 756 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $form['buttons']['submit']['#suffix'] = '</li>'; |
844 | 844 | $form['buttons']['submit']['#weight'] = 1002; |
845 | 845 | $form['buttons']['cancel'] = array( |
846 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit') . '</li>', |
|
846 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/info/edit').'</li>', |
|
847 | 847 | '#weight' => 1005, |
848 | 848 | ); |
849 | 849 | $form['buttons']['form control tabs suffix'] = array( |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | |
888 | 888 | // Set new password based on previous email address and entered |
889 | 889 | // password. |
890 | - $new_passwd_hash = password_hash( md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
890 | + $new_passwd_hash = password_hash(md5($form_state['values']['pass'].$pem), PASSWORD_DEFAULT); |
|
891 | 891 | |
892 | 892 | $boinc_user->update("email_addr='${pem}', previous_email_addr='', email_addr_change_time=0, passwd_hash='${new_passwd_hash}'"); |
893 | 893 |
@@ -27,73 +27,73 @@ |
||
27 | 27 | define('BATCH_STATE_RETIRED', 4); |
28 | 28 | |
29 | 29 | define('ANON_PLATFORM_UNKNOWN', -1); |
30 | -define('ANON_PLATFORM_CPU', -2); |
|
31 | -define('ANON_PLATFORM_NVIDIA', -3); |
|
32 | -define('ANON_PLATFORM_ATI', -4); |
|
33 | -define('ANON_PLATFORM_INTEL', -5); |
|
30 | +define('ANON_PLATFORM_CPU', -2); |
|
31 | +define('ANON_PLATFORM_NVIDIA', -3); |
|
32 | +define('ANON_PLATFORM_ATI', -4); |
|
33 | +define('ANON_PLATFORM_INTEL', -5); |
|
34 | 34 | |
35 | -define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
36 | -define('RESULT_SERVER_STATE_UNSENT', 2); |
|
37 | -define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
38 | -define('RESULT_SERVER_STATE_OVER', 5); |
|
35 | +define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
36 | +define('RESULT_SERVER_STATE_UNSENT', 2); |
|
37 | +define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
38 | +define('RESULT_SERVER_STATE_OVER', 5); |
|
39 | 39 | |
40 | -define('RESULT_OUTCOME_INIT', 0); |
|
41 | -define('RESULT_OUTCOME_SUCCESS', 1); |
|
42 | -define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
43 | -define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
44 | -define('RESULT_OUTCOME_NO_REPLY', 4); |
|
45 | -define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
46 | -define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
47 | -define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
40 | +define('RESULT_OUTCOME_INIT', 0); |
|
41 | +define('RESULT_OUTCOME_SUCCESS', 1); |
|
42 | +define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
43 | +define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
44 | +define('RESULT_OUTCOME_NO_REPLY', 4); |
|
45 | +define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
46 | +define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
47 | +define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
48 | 48 | |
49 | -define('VALIDATE_STATE_INIT', 0); |
|
50 | -define('VALIDATE_STATE_VALID', 1); |
|
51 | -define('VALIDATE_STATE_INVALID', 2); |
|
52 | -define('VALIDATE_STATE_NO_CHECK', 3); |
|
53 | -define('VALIDATE_STATE_INCONCLUSIVE',4); |
|
54 | -define('VALIDATE_STATE_TOO_LATE', 5); |
|
49 | +define('VALIDATE_STATE_INIT', 0); |
|
50 | +define('VALIDATE_STATE_VALID', 1); |
|
51 | +define('VALIDATE_STATE_INVALID', 2); |
|
52 | +define('VALIDATE_STATE_NO_CHECK', 3); |
|
53 | +define('VALIDATE_STATE_INCONCLUSIVE', 4); |
|
54 | +define('VALIDATE_STATE_TOO_LATE', 5); |
|
55 | 55 | |
56 | -define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
57 | -define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
58 | -define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
59 | -define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
60 | -define('WU_ERROR_CANCELLED', 16); |
|
61 | -define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
56 | +define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
57 | +define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
58 | +define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
59 | +define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
60 | +define('WU_ERROR_CANCELLED', 16); |
|
61 | +define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
62 | 62 | |
63 | -define('FILE_DELETE_INIT', 0); |
|
64 | -define('FILE_DELETE_READY', 1); |
|
65 | -define('FILE_DELETE_DONE', 2); |
|
66 | -define('FILE_DELETE_ERROR', 3); |
|
63 | +define('FILE_DELETE_INIT', 0); |
|
64 | +define('FILE_DELETE_READY', 1); |
|
65 | +define('FILE_DELETE_DONE', 2); |
|
66 | +define('FILE_DELETE_ERROR', 3); |
|
67 | 67 | |
68 | -define('ASSIMILATE_INIT', 0); |
|
69 | -define('ASSIMILATE_READY', 1); |
|
70 | -define('ASSIMILATE_DONE', 2); |
|
68 | +define('ASSIMILATE_INIT', 0); |
|
69 | +define('ASSIMILATE_READY', 1); |
|
70 | +define('ASSIMILATE_DONE', 2); |
|
71 | 71 | |
72 | 72 | // from lib/common_defs.h |
73 | 73 | // |
74 | -define('RESULT_NEW', 0); |
|
75 | -define('RESULT_FILES_DOWNLOADING', 1); |
|
76 | -define('RESULT_FILES_DOWNLOADED', 2); |
|
77 | -define('RESULT_COMPUTE_ERROR', 3); |
|
78 | -define('RESULT_FILES_UPLOADING', 4); |
|
79 | -define('RESULT_FILES_UPLOADED', 5); |
|
80 | -define('RESULT_ABORTED', 6); |
|
81 | -define('RESULT_UPLOAD_FAILED', 7); |
|
74 | +define('RESULT_NEW', 0); |
|
75 | +define('RESULT_FILES_DOWNLOADING', 1); |
|
76 | +define('RESULT_FILES_DOWNLOADED', 2); |
|
77 | +define('RESULT_COMPUTE_ERROR', 3); |
|
78 | +define('RESULT_FILES_UPLOADING', 4); |
|
79 | +define('RESULT_FILES_UPLOADED', 5); |
|
80 | +define('RESULT_ABORTED', 6); |
|
81 | +define('RESULT_UPLOAD_FAILED', 7); |
|
82 | 82 | |
83 | 83 | // from lib/error_numbers.h |
84 | 84 | // returned by some web RPCs |
85 | 85 | // |
86 | -define('ERR_XML_PARSE', -112); |
|
87 | -define('ERR_DB_NOT_FOUND', -136); |
|
88 | -define('ERR_DB_NOT_UNIQUE', -137); |
|
89 | -define('ERR_DB_CANT_CONNECT', -138); |
|
90 | -define('ERR_PROJECT_DOWN', -183); |
|
91 | -define('ERR_BAD_USER_NAME', -188); |
|
92 | -define('ERR_NO_OPTION', -191); |
|
93 | -define('ERR_BAD_EMAIL_ADDR', -205); |
|
94 | -define('ERR_BAD_PASSWD', -206); |
|
95 | -define('ERR_ACCT_CREATION_DISABLED', -208); |
|
96 | -define('ERR_ATTACH_FAIL_INIT', -209); |
|
97 | -define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
98 | -define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
86 | +define('ERR_XML_PARSE', -112); |
|
87 | +define('ERR_DB_NOT_FOUND', -136); |
|
88 | +define('ERR_DB_NOT_UNIQUE', -137); |
|
89 | +define('ERR_DB_CANT_CONNECT', -138); |
|
90 | +define('ERR_PROJECT_DOWN', -183); |
|
91 | +define('ERR_BAD_USER_NAME', -188); |
|
92 | +define('ERR_NO_OPTION', -191); |
|
93 | +define('ERR_BAD_EMAIL_ADDR', -205); |
|
94 | +define('ERR_BAD_PASSWD', -206); |
|
95 | +define('ERR_ACCT_CREATION_DISABLED', -208); |
|
96 | +define('ERR_ATTACH_FAIL_INIT', -209); |
|
97 | +define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
98 | +define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
99 | 99 | ?> |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | // RFC2616 mandates that the decimal part is no more than three digits, |
312 | 312 | // so we multiply the qvalue by 1000 to avoid floating point comparisons. |
313 | 313 | $langcode = strtolower($match[1]); |
314 | - $qvalue = isset($match[2]) ? (float) $match[2] : 1; |
|
315 | - $browser_langcodes[$langcode] = (int) ($qvalue * 1000); |
|
314 | + $qvalue = isset($match[2]) ? (float)$match[2] : 1; |
|
315 | + $browser_langcodes[$langcode] = (int)($qvalue*1000); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | global $base_url; |
378 | 378 | global $base_path; |
379 | 379 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
380 | - $site_url = $base_url . $base_path; |
|
380 | + $site_url = $base_url.$base_path; |
|
381 | 381 | $settings = array( |
382 | 382 | 'from' => '', |
383 | 383 | 'subject' => "Content at {$site_name} is awaiting moderation", |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
433 | 433 | } |
434 | 434 | elseif (is_string($user_image)) { |
435 | - $user_info .= '<img src="' . $user_image . '"/>'; |
|
435 | + $user_info .= '<img src="'.$user_image.'"/>'; |
|
436 | 436 | } |
437 | 437 | $user_info .= ' </div>'; |
438 | 438 | } |
439 | - $user_info .= ' <div class="name">' . theme('username', $account) . '</div>'; |
|
439 | + $user_info .= ' <div class="name">'.theme('username', $account).'</div>'; |
|
440 | 440 | if ($account->uid) { |
441 | 441 | //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
442 | 442 | //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $form['buttons']['preview']['#suffix'] = '</li>'; |
501 | 501 | $form['buttons']['preview']['#weight'] = 1003; |
502 | 502 | $form['buttons']['cancel'] = array( |
503 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
503 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url).'</li>', |
|
504 | 504 | '#weight' => 1004, |
505 | 505 | ); |
506 | 506 | $form['buttons']['form control tabs suffix'] = array( |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $node = node_load($form['nid']['#value']); |
521 | 521 | $community_role = array_search('community member', user_roles(true)); |
522 | 522 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
523 | - if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
|
523 | + if ((isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role]))) { |
|
524 | 524 | if ($node->type == 'forum') { |
525 | 525 | if (module_exists('captcha')) { |
526 | 526 | $form['comment_captcha'] = array( |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
566 | 566 | $form['buttons']['preview_changes']['#weight'] = 1004; |
567 | 567 | $form['buttons']['cancel'] = array( |
568 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
568 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}").'</li>', |
|
569 | 569 | '#weight' => 1005, |
570 | 570 | ); |
571 | 571 | $form['buttons']['form control tabs suffix'] = array( |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | // Add captcha for role='community member' |
577 | 577 | $community_role = array_search('community member', user_roles(true)); |
578 | 578 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
579 | - if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
|
579 | + if ((isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role]))) { |
|
580 | 580 | if (module_exists('captcha')) { |
581 | 581 | $form['comment_captcha'] = array( |
582 | 582 | '#type' => 'captcha', |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | function boinccore_link($type, $object, $teaser = FALSE) { |
669 | 669 | // Add custom links with this hook |
670 | 670 | |
671 | - if ($type=='node') { |
|
672 | - if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
|
671 | + if ($type == 'node') { |
|
672 | + if (($object->type == 'forum') OR ($object->type == 'team_forum')) { |
|
673 | 673 | // Add topic moderator controls |
674 | 674 | if (user_access('edit any forum topic')) { |
675 | 675 | $node_control = "node_control/{$object->nid}"; |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | }// if user_access('edit any forum topic') |
731 | 731 | } |
732 | 732 | } |
733 | - else if ($type=='comment') { |
|
733 | + else if ($type == 'comment') { |
|
734 | 734 | $node = node_load($object->nid); |
735 | 735 | $nid = $object->nid; |
736 | 736 | $cid = $object->cid; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | if (user_access('administer comments')) { |
753 | 753 | $comment_control = "comment_control/{$cid}"; |
754 | 754 | // Add link to convert comment into a new topic |
755 | - $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
755 | + $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid)); |
|
756 | 756 | if ($reply_count == 0) { |
757 | 757 | $links['convert'] = array( |
758 | 758 | 'title' => bts('Convert', array(), NULL, 'boinc:forum-convert-comment-to-topic'), |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | */ |
798 | 798 | $message['headers']['Content-Transfer-Encoding'] = 'Quoted-Printable'; |
799 | 799 | if (is_array($message['body'])) { |
800 | - $message['body'] = array_map( "quoted_printable_encode", $message['body'] ); |
|
800 | + $message['body'] = array_map("quoted_printable_encode", $message['body']); |
|
801 | 801 | } else { |
802 | 802 | $message['body'] = quoted_printable_encode($message['body']); |
803 | 803 | } |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | // If hiding a forum topic (node) and not an administrator, go to |
849 | 849 | // the forum page. Otherwise the user will reach an access-denied |
850 | 850 | // page. |
851 | - if (($action=="hide") and (!user_access('administer forums'))) { |
|
851 | + if (($action == "hide") and (!user_access('administer forums'))) { |
|
852 | 852 | drupal_goto("community/forum/{$node->tid}"); |
853 | 853 | } |
854 | 854 | drupal_goto("node/{$nid}"); |
@@ -890,8 +890,8 @@ discard block |
||
890 | 890 | $node->created = $comment->timestamp; |
891 | 891 | $node->changed = $node->created; |
892 | 892 | $node->promote = 0; // Display on front page? |
893 | - $node->sticky = 0; // Display top of page? |
|
894 | - $node->status = 1; // Published? |
|
893 | + $node->sticky = 0; // Display top of page? |
|
894 | + $node->status = 1; // Published? |
|
895 | 895 | $node->comment = 2; |
896 | 896 | //$node->language = 'en'; |
897 | 897 | $node->uid = $comment->uid; |
@@ -976,16 +976,16 @@ discard block |
||
976 | 976 | $xml->loadXML($global_prefs, LIBXML_NOBLANKS); |
977 | 977 | if ($errors = libxml_get_errors($xml)) { |
978 | 978 | $lines = explode("\r", $global_prefs); |
979 | - watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
980 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
979 | + watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
980 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
981 | 981 | } |
982 | 982 | } |
983 | 983 | elseif ($project_prefs) { |
984 | 984 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
985 | 985 | if ($errors = libxml_get_errors($xml)) { |
986 | 986 | $lines = explode("\r", $project_prefs); |
987 | - watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
988 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
987 | + watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
988 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
989 | 989 | } |
990 | 990 | } |
991 | 991 | if (!$errors) { |
@@ -1028,8 +1028,8 @@ discard block |
||
1028 | 1028 | $xml = array( |
1029 | 1029 | 'error' => array( |
1030 | 1030 | 'error_num' => -112, |
1031 | - 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}" . |
|
1032 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]) |
|
1031 | + 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}". |
|
1032 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]) |
|
1033 | 1033 | ), |
1034 | 1034 | ); |
1035 | 1035 | } |
@@ -1137,10 +1137,10 @@ discard block |
||
1137 | 1137 | 'teaser' => $teaser, |
1138 | 1138 | 'uid' => $team_owner_uid, |
1139 | 1139 | 'path' => null, |
1140 | - 'status' => 1, // published or not - always publish |
|
1140 | + 'status' => 1, // published or not - always publish |
|
1141 | 1141 | 'promote' => 0, |
1142 | 1142 | 'created' => $created_time, |
1143 | - 'comment' => 0, // comments disabled |
|
1143 | + 'comment' => 0, // comments disabled |
|
1144 | 1144 | 'moderate' => 0, |
1145 | 1145 | 'sticky' => 0, |
1146 | 1146 | 'format' => $input_format |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | module_load_include('inc', 'pathauto', 'pathauto'); |
1152 | 1152 | $node['path'] = pathauto_cleanstring($values['name']); |
1153 | 1153 | |
1154 | - $node = (object) $node; // node_save requires an object form |
|
1154 | + $node = (object)$node; // node_save requires an object form |
|
1155 | 1155 | $team_categories = taxonomy_get_term_by_name($values['type']); |
1156 | 1156 | $node->taxonomy[] = $team_categories[0]; |
1157 | 1157 | |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | while ($member = db_fetch_object($result)) { |
1311 | 1311 | $team_members[$member->boinc_id]['country'] = $member->field_country_value; |
1312 | 1312 | $team_members[$member->boinc_id]['url'] = $member->field_url_value; |
1313 | - $team_members[$member->boinc_id]['has_profile'] = isset($member->nid) ? 1: 0; |
|
1313 | + $team_members[$member->boinc_id]['has_profile'] = isset($member->nid) ? 1 : 0; |
|
1314 | 1314 | $xml['users']['user'][] = $team_members[$member->boinc_id]; |
1315 | 1315 | } |
1316 | 1316 | } // end if credit_only |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1361 | 1361 | $profile_node = node_load($profile_nid); |
1362 | 1362 | if ($profile_node) { |
1363 | - $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
|
1363 | + $avatar_image = get_cck_image_object(file_directory_path().'/'.$image_path, 'field_image', 'profile', TRUE); |
|
1364 | 1364 | if ($avatar_image) { |
1365 | 1365 | $profile_node->field_image[0] = $avatar_image; |
1366 | 1366 | node_save($profile_node); |
@@ -1474,7 +1474,7 @@ discard block |
||
1474 | 1474 | WHERE (n.status = 1) AND (c.uid = '%d') |
1475 | 1475 | ORDER BY timestamp DESC |
1476 | 1476 | LIMIT %d", |
1477 | - $uid, (int) $count |
|
1477 | + $uid, (int)$count |
|
1478 | 1478 | ); |
1479 | 1479 | $xml = array( |
1480 | 1480 | 'rpc_response' => array( |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | WHERE (n.status = 1) AND (n.uid = '%d') |
1518 | 1518 | ORDER BY changed DESC |
1519 | 1519 | LIMIT %d", |
1520 | - $uid, (int) $count |
|
1520 | + $uid, (int)$count |
|
1521 | 1521 | ); |
1522 | 1522 | $xml = array( |
1523 | 1523 | 'rpc_response' => array( |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | ); |
1681 | 1681 | } |
1682 | 1682 | // Determine which page to display in order to show the given comment |
1683 | - $page = floor($comment_offset / $comments_per_page); |
|
1683 | + $page = floor($comment_offset/$comments_per_page); |
|
1684 | 1684 | if ($page) { |
1685 | 1685 | $params = array('page' => $page); |
1686 | 1686 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
2036 | 2036 | * Overview of moderation queues |
2037 | 2037 | */ |
2038 | 2038 | function boinccore_moderation_overview_panel() { |
2039 | - $output = '<h2 class="pane-title">' . bts('Moderation', array(), NULL, 'boinc:moderate-profiles') . '</h2>'; |
|
2039 | + $output = '<h2 class="pane-title">'.bts('Moderation', array(), NULL, 'boinc:moderate-profiles').'</h2>'; |
|
2040 | 2040 | $output .= '<ul class="tab-list action-list">'; |
2041 | 2041 | if (module_exists('user_profiles')) { |
2042 | 2042 | $profile_count = db_result(db_query(" |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | $output .= '<li class="tab primary">'; |
2048 | 2048 | $output .= l(bts('Unvetted profiles', array(), NULL, 'boinc:moderate-profiles'), 'moderate/profiles'); |
2049 | 2049 | $output .= '<div class="item-count-wrapper">'; |
2050 | - $output .= '<span class="item-count">' . $profile_count . '</span>'; |
|
2050 | + $output .= '<span class="item-count">'.$profile_count.'</span>'; |
|
2051 | 2051 | $output .= '</div>'; |
2052 | 2052 | $output .= '</li>'; |
2053 | 2053 | } |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | require_boinc('boinc_db'); |
2066 | 2066 | |
2067 | 2067 | $num_deleted = BoincToken::delete_expired(); |
2068 | - if ($num_deleted>0) { |
|
2068 | + if ($num_deleted > 0) { |
|
2069 | 2069 | watchdog('boinccore', "Deleted ${num_deleted} tokens from table token", WATCHDOG_NOTICE); |
2070 | 2070 | } |
2071 | 2071 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | xml_error(ERR_ACCT_CREATION_DISABLED); |
41 | 41 | } |
42 | 42 | |
43 | -if(defined('INVITE_CODES')) { |
|
43 | +if (defined('INVITE_CODES')) { |
|
44 | 44 | $invite_code = get_str("invite_code"); |
45 | 45 | if (!preg_match(INVITE_CODES, $invite_code)) { |
46 | 46 | xml_error(ERR_ATTACH_FAIL_INIT); |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | if (parse_bool($config, "account_creation_rpc_require_consent")) { |
96 | 96 | // Consistency checks |
97 | 97 | if (!check_termsofuse()) { |
98 | - error_log("Project configuration error! " . |
|
98 | + error_log("Project configuration error! ". |
|
99 | 99 | "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!"); |
100 | 100 | } |
101 | 101 | if (!$checkct) { |
102 | - error_log("Project configuration error! " . |
|
102 | + error_log("Project configuration error! ". |
|
103 | 103 | "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!"); |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Check consent requirement |
107 | 107 | if (is_null($consent_flag) or !$source) { |
108 | - xml_error(ERR_ACCT_REQUIRE_CONSENT, "This project requires to consent to its terms of use. " . |
|
109 | - "Please update your BOINC software " . |
|
110 | - "or register via the project's website " . |
|
108 | + xml_error(ERR_ACCT_REQUIRE_CONSENT, "This project requires to consent to its terms of use. ". |
|
109 | + "Please update your BOINC software ". |
|
110 | + "or register via the project's website ". |
|
111 | 111 | "or contact your account manager's provider."); |
112 | 112 | } |
113 | 113 | } |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | // * not agree. |
142 | 142 | // -> no create account RPC at all |
143 | 143 | // |
144 | - if ( (!is_null($consent_flag)) and $source) { |
|
144 | + if ((!is_null($consent_flag)) and $source) { |
|
145 | 145 | // Record the user giving consent in database - if consent_flag is 0, |
146 | 146 | // this is an 'anonymous account' and consent_not_required is |
147 | 147 | // set to 1. |
148 | - if ($consent_flag==0) { |
|
148 | + if ($consent_flag == 0) { |
|
149 | 149 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
150 | - } else { |
|
150 | + } else { |
|
151 | 151 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
152 | 152 | } |
153 | 153 | if (!$rc) { |
@@ -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 | ); |
@@ -1315,7 +1315,7 @@ discard block |
||
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( |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | */ |
1398 | 1398 | function boincuser_token_list($type = 'all') { |
1399 | 1399 | if ($type == 'user' || $type == 'all') { |
1400 | - $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1400 | + $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1401 | 1401 | return $tokens; |
1402 | 1402 | } |
1403 | 1403 | } |
@@ -1409,9 +1409,9 @@ discard block |
||
1409 | 1409 | if ($view->args) { |
1410 | 1410 | $account_id = $view->args[0]; |
1411 | 1411 | } |
1412 | - if ($view->name=="user_activity") { |
|
1412 | + if ($view->name == "user_activity") { |
|
1413 | 1413 | // Run the following custom query for the user_activity view |
1414 | - $view->build_info['query']= " |
|
1414 | + $view->build_info['query'] = " |
|
1415 | 1415 | SELECT node_revisions.vid AS vid, |
1416 | 1416 | node.nid AS node_nid, |
1417 | 1417 | node.uid AS users_node_uid, |
@@ -1451,13 +1451,13 @@ discard block |
||
1451 | 1451 | // Delete expired users in the BOINC database, user_delete table. |
1452 | 1452 | require_boinc('boinc_db'); |
1453 | 1453 | $num_deleted = BoincUserDeleted::delete_expired(); |
1454 | - if ($num_deleted>0) { |
|
1454 | + if ($num_deleted > 0) { |
|
1455 | 1455 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
1456 | 1456 | } |
1457 | 1457 | |
1458 | 1458 | // Delete expired tokens from token table |
1459 | 1459 | $tokens_deleted = BoincToken::delete_expired(); |
1460 | - if ($tokens_deleted>0) { |
|
1460 | + if ($tokens_deleted > 0) { |
|
1461 | 1461 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
1462 | 1462 | } |
1463 | 1463 | } |
@@ -1542,38 +1542,38 @@ discard block |
||
1542 | 1542 | case 'boinc': |
1543 | 1543 | $output .= '<ol>'; |
1544 | 1544 | if ($registration_enabled) { |
1545 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1545 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1546 | 1546 | array( |
1547 | 1547 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1548 | 1548 | '@sitename' => $site_name, |
1549 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1549 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1550 | 1550 | } |
1551 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
1552 | - $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1551 | + $output .= ' <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>'; |
|
1552 | + $output .= ' <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1553 | 1553 | array( |
1554 | 1554 | '@sitename' => $site_name, |
1555 | 1555 | '@siteurl' => $base_url, |
1556 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1556 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1557 | 1557 | if ($registration_enabled) { |
1558 | - $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.", |
|
1558 | + $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.", |
|
1559 | 1559 | array( |
1560 | 1560 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1561 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1561 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1562 | 1562 | } |
1563 | 1563 | else { |
1564 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
1564 | + $output .= '<li>'.bts("If you're running a command-line version of BOINC, |
|
1565 | 1565 | 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.", |
1566 | 1566 | array( |
1567 | 1567 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1568 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1568 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1569 | 1569 | } |
1570 | - $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
|
1570 | + $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please |
|
1571 | 1571 | upgrade to a more recent version of BOINC to create an account |
1572 | 1572 | at @this_project.", |
1573 | 1573 | array( |
1574 | 1574 | '@this_project' => $site_name, |
1575 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1576 | - $output .= '</ol>'; |
|
1575 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1576 | + $output .= '</ol>'; |
|
1577 | 1577 | break; |
1578 | 1578 | case 'new': |
1579 | 1579 | default: |
@@ -1585,34 +1585,34 @@ discard block |
||
1585 | 1585 | // $ruleslink = drupal_lookup_path('source', $ruleslinkB); |
1586 | 1586 | //} |
1587 | 1587 | |
1588 | - $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') ); |
|
1588 | + $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '')); |
|
1589 | 1589 | |
1590 | 1590 | // Join page output |
1591 | 1591 | $output .= '<ol>'; |
1592 | 1592 | if ($registration_enabled) { |
1593 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1593 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1594 | 1594 | array( |
1595 | 1595 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1596 | 1596 | '@sitename' => $site_name, |
1597 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1597 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1598 | 1598 | } |
1599 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
1600 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
1599 | + else if (menu_valid_path(array('link_path' => $ruleslink))) { |
|
1600 | + $output .= ' <li>'.bts("Read our !rules_and_policies.", array( |
|
1601 | 1601 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
1602 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1602 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1603 | 1603 | } |
1604 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1604 | + $output .= ' <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1605 | 1605 | $output .= ' <p>'; |
1606 | 1606 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
1607 | 1607 | $output .= ' </p>'; |
1608 | - $output .= ' ' . bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page'); |
|
1608 | + $output .= ' '.bts("For Android devices, download BOINC from the Google Play Store or Amazon App Store.", array(), NULL, 'boinc:join-page'); |
|
1609 | 1609 | $output .= ' </li>'; |
1610 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
1611 | - $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1610 | + $output .= ' <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>'; |
|
1611 | + $output .= ' <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1612 | 1612 | '@sitename' => $site_name, |
1613 | 1613 | '@siteurl' => $base_url, |
1614 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1615 | - $output .= '</ol>'; |
|
1614 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1615 | + $output .= '</ol>'; |
|
1616 | 1616 | } |
1617 | 1617 | $output .= '</div>'; |
1618 | 1618 | return $output; |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | global $user; |
1626 | 1626 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1627 | 1627 | // get the front page message from database; this is set in the admin interface under BOINC Other |
1628 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
1628 | + $site_message = variable_get('boinc_other_frontpage', ''); |
|
1629 | 1629 | |
1630 | 1630 | // Determine the user of the day |
1631 | 1631 | $current_uotd = db_fetch_object(db_query(" |
@@ -1647,30 +1647,30 @@ discard block |
||
1647 | 1647 | $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')); |
1648 | 1648 | $output .= '</h2>'; |
1649 | 1649 | $output .= '<div class="boinc-overview balance-height-front">'; |
1650 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1650 | + $output .= ' <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>'; |
|
1651 | 1651 | if ($user->uid) { |
1652 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1652 | + $output .= ' <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1653 | 1653 | } |
1654 | 1654 | else { |
1655 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1655 | + $output .= ' <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1656 | 1656 | } |
1657 | 1657 | $output .= '</div>'; |
1658 | 1658 | $output .= '<div class="boinc-overview-details">'; |
1659 | 1659 | $output .= ' <div class="detail-container">'; |
1660 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
1660 | + $output .= ' <a class="user-of-the-day" href="account/'.$uotd->uid.'">'; |
|
1661 | 1661 | $output .= ' <div class="picture">'; |
1662 | 1662 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
1663 | 1663 | $uotd_image['alt'], array(), FALSE); |
1664 | 1664 | $output .= ' </div>'; |
1665 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1666 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
1665 | + $output .= ' <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>'; |
|
1666 | + $output .= ' <div class="detail">'.$uotd->boincuser_name.'</div>'; |
|
1667 | 1667 | $output .= ' </a>'; |
1668 | 1668 | $output .= ' <div class="volunteers">'; |
1669 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1669 | + $output .= ' <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>'; |
|
1670 | 1670 | $output .= ' <div class="platforms">'; |
1671 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1672 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1673 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1671 | + $output .= ' <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>'; |
|
1672 | + $output .= ' <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>'; |
|
1673 | + $output .= ' <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>'; |
|
1674 | 1674 | $output .= ' </div>'; |
1675 | 1675 | $output .= ' </div>'; |
1676 | 1676 | $output .= ' </div>'; |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
1702 | 1702 | if (!$enablethisRPC) { |
1703 | 1703 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
1704 | - '@url' => $base_url . '/user/registration', |
|
1704 | + '@url' => $base_url.'/user/registration', |
|
1705 | 1705 | ), |
1706 | 1706 | NULL, 'boinc:create_account'); |
1707 | 1707 | xml_error(-208, $mess); |
@@ -1733,8 +1733,8 @@ discard block |
||
1733 | 1733 | $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
1734 | 1734 | if ($boinc_user) { |
1735 | 1735 | // Return authenticator for existing users |
1736 | - if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1737 | - password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
|
1736 | + if (($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1737 | + password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) { |
|
1738 | 1738 | $output = array('authenticator' => $boinc_user->authenticator); |
1739 | 1739 | } |
1740 | 1740 | else { |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | // Ensure there is a authentication token before continuing |
1791 | 1791 | if (empty($authtoken)) { |
1792 | 1792 | drupal_not_found(); |
1793 | - return ; |
|
1793 | + return; |
|
1794 | 1794 | } |
1795 | 1795 | |
1796 | 1796 | if (strlen($authtoken) != 32) { |
@@ -1812,8 +1812,8 @@ discard block |
||
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | // Lookup path to custom account finish page |
1815 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
1816 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
1815 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '')); |
|
1816 | + if (menu_valid_path(array('link_path' => $customaccountfinishpath))) { |
|
1817 | 1817 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
1818 | 1818 | if ($node) { |
1819 | 1819 | return node_page_view($node); |
@@ -1822,12 +1822,12 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | // open links in new window |
1824 | 1824 | $options = array( |
1825 | - 'attributes' => array( 'target' => '_blank' ), |
|
1825 | + 'attributes' => array('target' => '_blank'), |
|
1826 | 1826 | ); |
1827 | 1827 | |
1828 | 1828 | // Check moderation page exists |
1829 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
1830 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
1829 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '')); |
|
1830 | + if (menu_valid_path(array('link_path' => $moderationpath))) { |
|
1831 | 1831 | $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'); |
1832 | 1832 | } else { |
1833 | 1833 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
@@ -1835,11 +1835,11 @@ discard block |
||
1835 | 1835 | |
1836 | 1836 | $username = $user->boincuser_name; |
1837 | 1837 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1838 | - $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.)', |
|
1838 | + $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.)', |
|
1839 | 1839 | array( |
1840 | 1840 | '@user_name' => $username, |
1841 | 1841 | '@site_name' => $site_name, |
1842 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
1842 | + ), NULL, 'boinc:account-finish')."</p>"; |
|
1843 | 1843 | |
1844 | 1844 | $links = array( |
1845 | 1845 | array( |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | ); |
1906 | 1906 | |
1907 | 1907 | //List of links |
1908 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1908 | + $output .= theme_item_list($links, $title = NULL, $type = 'ul'); |
|
1909 | 1909 | |
1910 | 1910 | return $output; |
1911 | 1911 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | global $base_url; |
2023 | 2023 | global $base_path; |
2024 | 2024 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2025 | - $site_url = $base_url . $base_path; |
|
2025 | + $site_url = $base_url.$base_path; |
|
2026 | 2026 | $moderator = user_load($user->uid); |
2027 | 2027 | $profile->moderate = 0; |
2028 | 2028 | $profile->status = 0; |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | global $base_url; |
2084 | 2084 | global $base_path; |
2085 | 2085 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2086 | - $site_url = $base_url . $base_path; |
|
2086 | + $site_url = $base_url.$base_path; |
|
2087 | 2087 | $moderator = user_load($user->uid); |
2088 | 2088 | $settings = array( |
2089 | 2089 | 'from' => '', |
@@ -2187,25 +2187,25 @@ discard block |
||
2187 | 2187 | if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
2188 | 2188 | |
2189 | 2189 | $output = ''; |
2190 | - $output .= '<table class="user-projects">' . "\n"; |
|
2191 | - $output .= '<thead>' . "\n"; |
|
2192 | - $output .= ' <tr>' . "\n"; |
|
2193 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2194 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2195 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2196 | - $output .= ' </tr>' . "\n"; |
|
2197 | - $output .= '</thead>' . "\n"; |
|
2198 | - $output .= '<tbody>' . "\n"; |
|
2190 | + $output .= '<table class="user-projects">'."\n"; |
|
2191 | + $output .= '<thead>'."\n"; |
|
2192 | + $output .= ' <tr>'."\n"; |
|
2193 | + $output .= ' <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n"; |
|
2194 | + $output .= ' <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n"; |
|
2195 | + $output .= ' <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n"; |
|
2196 | + $output .= ' </tr>'."\n"; |
|
2197 | + $output .= '</thead>'."\n"; |
|
2198 | + $output .= '<tbody>'."\n"; |
|
2199 | 2199 | foreach ($projects AS $project) { |
2200 | - $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
|
2201 | - $output .= ' <tr>' . "\n"; |
|
2202 | - $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
|
2203 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
|
2204 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
|
2205 | - $output .= ' </tr>' . "\n"; |
|
2200 | + $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id; |
|
2201 | + $output .= ' <tr>'."\n"; |
|
2202 | + $output .= ' <td>'.l($project->name, $url).'</td>'."\n"; |
|
2203 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; |
|
2204 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n"; |
|
2205 | + $output .= ' </tr>'."\n"; |
|
2206 | 2206 | } |
2207 | - $output .= '</tbody>' . "\n"; |
|
2208 | - $output .= '</table>' . "\n"; |
|
2207 | + $output .= '</tbody>'."\n"; |
|
2208 | + $output .= '</table>'."\n"; |
|
2209 | 2209 | $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
2210 | 2210 | //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
2211 | 2211 | return $output; |
@@ -2225,8 +2225,8 @@ discard block |
||
2225 | 2225 | 'cpid' => $cpid |
2226 | 2226 | ); |
2227 | 2227 | $args = array(); |
2228 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2229 | - $query = '?' . implode('&', $args); |
|
2228 | + foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value); |
|
2229 | + $query = '?'.implode('&', $args); |
|
2230 | 2230 | |
2231 | 2231 | // Load XML from RPC |
2232 | 2232 | $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
@@ -2298,12 +2298,12 @@ discard block |
||
2298 | 2298 | $output .= '<ul class="tab-list">'; |
2299 | 2299 | $count = 0; |
2300 | 2300 | foreach ($links as $key => $link) { |
2301 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
2301 | + $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">'; |
|
2302 | 2302 | $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
2303 | 2303 | $output .= '</li>'; |
2304 | 2304 | $count++; |
2305 | 2305 | } |
2306 | - $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user', $account->uid) . '</li>'; |
|
2306 | + $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user', $account->uid).'</li>'; |
|
2307 | 2307 | $output .= '</ul>'; |
2308 | 2308 | } |
2309 | 2309 | return $output; |
@@ -2344,7 +2344,7 @@ discard block |
||
2344 | 2344 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
2345 | 2345 | |
2346 | 2346 | foreach ($documents as $document) { |
2347 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
2347 | + if ($document->entity_type == 'node' AND $document->bundle == 'profile') { |
|
2348 | 2348 | // Node information. |
2349 | 2349 | $nid = $document->entity_id; |
2350 | 2350 | $node = node_load($nid); |
@@ -2394,11 +2394,11 @@ discard block |
||
2394 | 2394 | // privatemsg module. We need to convert them back to spaces for the |
2395 | 2395 | // check below. |
2396 | 2396 | $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
2397 | - if ($drupalid>0) { |
|
2397 | + if ($drupalid > 0) { |
|
2398 | 2398 | if ($recipient = user_load(array('uid' => $drupalid))) { |
2399 | 2399 | // Double-check that the loaded user matches both boincuser_id |
2400 | 2400 | // and boincuser_name. |
2401 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2401 | + if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) { |
|
2402 | 2402 | return $recipient; |
2403 | 2403 | } |
2404 | 2404 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function boinc_links__system_main_menu($links, $menu, $element) { |
84 | 84 | $html = ''; |
85 | - $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
85 | + $html .= '<ul id="'.$menu['id'].'" class="'.$menu['class'].'">'."\n"; |
|
86 | 86 | $item_count = count($links); |
87 | 87 | $i = 1; |
88 | 88 | foreach ($links as $key => $link) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (strpos($key, 'active-trail')) $classes[] = 'active'; |
91 | 91 | if ($i == 1) $classes[] = 'first'; |
92 | 92 | if ($i == $item_count) $classes[] = 'last'; |
93 | - $html .= '<li class="' . implode(' ', $classes) .'">'; |
|
93 | + $html .= '<li class="'.implode(' ', $classes).'">'; |
|
94 | 94 | if ($link['title'] == 'Home') { |
95 | 95 | $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link'); |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if ($link['href'] == 'dashboard') { |
100 | 100 | $item_count = privatemsg_unread_count(); |
101 | 101 | if ($item_count) { |
102 | - $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
102 | + $link['title'] .= '</a> <a href="'.url('messages').'" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>'; |
|
103 | 103 | $link['html'] = TRUE; |
104 | 104 | $link['attributes']['class'] = 'compound'; |
105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if ($link['href'] == 'moderate') { |
110 | 110 | $item_count = boincuser_moderation_queue_count(); |
111 | 111 | if ($item_count) { |
112 | - $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
112 | + $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">'.$item_count.'</span></div>'; |
|
113 | 113 | $link['html'] = TRUE; |
114 | 114 | } |
115 | 115 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $html .= '</li>'; |
118 | 118 | $i++; |
119 | 119 | } |
120 | - $html .= '</ul>' . "\n"; |
|
120 | + $html .= '</ul>'."\n"; |
|
121 | 121 | return $html; |
122 | 122 | } |
123 | 123 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return ''; |
133 | 133 | } |
134 | 134 | else { |
135 | - return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
|
135 | + return '<li '.($active ? 'class="active" ' : '').'>'.$link."</li>\n"; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | if (empty($locality)) { |
198 | 198 | $locality = "en"; |
199 | 199 | } |
200 | - $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
200 | + $vars['flag_path'] = base_path().path_to_theme()."/images/flags/{$locality}.png"; |
|
201 | 201 | |
202 | 202 | $server_status_url = variable_get('boinc_server_status_url', ''); |
203 | 203 | if (!$server_status_url) { |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | if (arg(0) == 'search') { |
220 | 220 | unset($vars['title']); |
221 | 221 | } |
222 | - else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
222 | + else if ((arg(0) == 'account') AND (is_numeric(arg(1))) AND (empty(arg(2)))) { |
|
223 | 223 | unset($vars['title']); |
224 | 224 | } |
225 | - else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
225 | + else if ((arg(0) == 'account') AND (arg(1) == 'profile')) { |
|
226 | 226 | unset($vars['title']); |
227 | 227 | } |
228 | - else if ( (arg(0)=='dashboard') ) { |
|
228 | + else if ((arg(0) == 'dashboard')) { |
|
229 | 229 | unset($vars['title']); |
230 | 230 | } |
231 | - else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
231 | + else if ((arg(0) == 'community') AND ((arg(1) == 'teams') OR (arg(1) == 'stats'))) { |
|
232 | 232 | unset($vars['title']); |
233 | 233 | } |
234 | 234 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $tab = str_replace('li class="', 'li class="first ', $tab); |
245 | 245 | } |
246 | 246 | if ($key == $last_key) { |
247 | - $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
247 | + $tab = str_replace('li class="', 'li class="last ', $tab).'</ul>'; |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | elseif (strpos($tab, 'li ')) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $tab = str_replace('li ', 'li class="first" ', $tab); |
253 | 253 | } |
254 | 254 | if ($key == $last_key) { |
255 | - $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
255 | + $tab = str_replace('li ', 'li class="last" ', $tab).'</ul>'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | // Optionally, run node-type-specific preprocess functions, like |
291 | 291 | // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
292 | - $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
292 | + $function = __FUNCTION__.'_'.$vars['node']->type; |
|
293 | 293 | if (function_exists($function)) { |
294 | 294 | $function($vars, $hook); |
295 | 295 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $vars['node']->comment = 0; |
341 | 341 | |
342 | 342 | $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
343 | - $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
343 | + $page_count = max(ceil($vars['comment_count']/$comments_per_page), 1); |
|
344 | 344 | $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
345 | 345 | |
346 | 346 | $links = $vars['links']; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | case 'boinc_host': |
453 | 453 | $view = views_get_current_view(); |
454 | 454 | if (!($view->result)) { |
455 | - $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>'; |
|
455 | + $vars['footer'] = '<h3>'.bts('Host not found in database.', array(), NULL, 'boinc:host-details').'</h3>'; |
|
456 | 456 | } |
457 | 457 | break; |
458 | 458 | case 'boinc_host_list': |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | |
472 | 472 | if ($result) { |
473 | 473 | // Display the stderr output in the footer |
474 | - $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>'; |
|
475 | - $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>'; |
|
474 | + $vars['footer'] = '<h3>'.bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog').'</h3>'; |
|
475 | + $vars['footer'] .= '<pre>'.htmlspecialchars($result->result_stderr_out).'</pre>'; |
|
476 | 476 | } else { |
477 | - $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>'; |
|
477 | + $vars['footer'] = '<h3>'.bts('Task not found in database.', array(), NULL, 'boinc:task-details').'</h3>'; |
|
478 | 478 | } |
479 | 479 | break; |
480 | 480 | case 'boinc_teams': |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | ob_start(); |
488 | 488 | // Get the workunit ID from the URL |
489 | 489 | $result_id = arg(1); |
490 | - require_boinc(array('util','boinc_db')); |
|
490 | + require_boinc(array('util', 'boinc_db')); |
|
491 | 491 | $wu = BoincWorkunit::lookup_id($result_id); |
492 | 492 | if ($wu) { |
493 | 493 | // Output from admin defined BOINC project-specific function |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | // Output of project_workunit() gets caught in the buffer |
496 | 496 | $vars['footer'] = ob_get_clean(); |
497 | 497 | } else { |
498 | - $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>'; |
|
498 | + $vars['footer'] = '<h3>'.bts('Workunit not found in database.', array(), NULL, 'boinc:workunit-details').'</h3>'; |
|
499 | 499 | } |
500 | 500 | default: |
501 | 501 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
518 | 518 | } |
519 | 519 | elseif (is_string($user_image)) { |
520 | - $author_picture .= '<img src="' . $user_image . '"/>'; |
|
520 | + $author_picture .= '<img src="'.$user_image.'"/>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | $author_picture .= '</div>'; |
@@ -556,14 +556,14 @@ discard block |
||
556 | 556 | case 'profile': |
557 | 557 | case 'user': |
558 | 558 | $node = $variables['result']['node']; |
559 | - $variables['url'] = url('account/' . $node->is_uid); |
|
559 | + $variables['url'] = url('account/'.$node->is_uid); |
|
560 | 560 | $variables['title'] = $node->tos_name; |
561 | 561 | $variables['user_image'] = boincuser_get_user_profile_image($node->is_uid); |
562 | 562 | $variables['account'] = user_load($node->is_uid); |
563 | 563 | break; |
564 | 564 | case 'team': |
565 | 565 | $node = $variables['result']['node']; |
566 | - $variables['url'] = url('/community/teams/' . $node->entity_id);; |
|
566 | + $variables['url'] = url('/community/teams/'.$node->entity_id); ; |
|
567 | 567 | break; |
568 | 568 | case 'forum': |
569 | 569 | $node = $variables['result']['node']; |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | // Parent forum topic title |
582 | 582 | $variables['parent_title'] = $drupalnode->title; |
583 | 583 | // Link to the parent forum topic |
584 | - $variables['parent_topic'] = l($drupalnode->title, drupal_get_path_alias('node/' . $nid) ); |
|
584 | + $variables['parent_topic'] = l($drupalnode->title, drupal_get_path_alias('node/'.$nid)); |
|
585 | 585 | // Get the taxonomy for the node, creates a link to the parent forum |
586 | 586 | $taxonomy = reset($drupalnode->taxonomy); |
587 | 587 | if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) { |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | if (!arg(2)) { |
600 | 600 | $message = ''; |
601 | 601 | } |
602 | - return '<p>' . $message . '</p>'; |
|
602 | + return '<p>'.$message.'</p>'; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | |
616 | 616 | // Shorten the name when it is too long or it will break many tables. |
617 | 617 | if (drupal_strlen($name) > 20) { |
618 | - $name = drupal_substr($name, 0, 15) . '...'; |
|
618 | + $name = drupal_substr($name, 0, 15).'...'; |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | if (user_access('access user profiles')) { |
622 | - $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
|
622 | + $output = l($name, 'account/'.$object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
|
623 | 623 | } |
624 | 624 | else { |
625 | 625 | $output = check_plain($name); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $output = check_plain($object->name); |
638 | 638 | } |
639 | 639 | |
640 | - $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')'; |
|
640 | + $output .= ' ('.bts('not verified', array(), NULL, 'boinc:user-not-found').')'; |
|
641 | 641 | } |
642 | 642 | else { |
643 | 643 | $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user'))); |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * Remove the link under text areas that reads: |
651 | 651 | * "More information about formatting options" |
652 | 652 | */ |
653 | -function boinc_filter_tips_more_info () { |
|
653 | +function boinc_filter_tips_more_info() { |
|
654 | 654 | return ''; |
655 | 655 | } |
656 | 656 | |
@@ -692,8 +692,8 @@ discard block |
||
692 | 692 | The !site team', array( |
693 | 693 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
694 | 694 | '!site' => variable_get('site_name', 'Drupal-BOINC'), |
695 | - '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
696 | - '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
|
695 | + '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message').': '.$flag->friend_message : '', |
|
696 | + '!link' => url('account/'.$sender->uid, array('absolute' => TRUE)), |
|
697 | 697 | ), array(), NULL, 'boinc:friend-request-email'); |
698 | 698 | break; |
699 | 699 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | The !site team', array( |
712 | 712 | '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name, |
713 | 713 | '!site' => variable_get('site_name', 'Drupal-BOINC'), |
714 | - '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
|
714 | + '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message').': '.$flag->friend_message : '', |
|
715 | 715 | '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
716 | 716 | ), |
717 | 717 | array(), NULL, 'boinc:friend-request-email'); |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | * Edit action links |
725 | 725 | */ |
726 | 726 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
727 | - if ($links){ |
|
727 | + if ($links) { |
|
728 | 728 | // Remove flag-subscriptions link. It will be placed elsewhere. |
729 | 729 | if (isset($links['flag-subscriptions'])) { |
730 | 730 | unset($links['flag-subscriptions']); |
731 | 731 | } |
732 | 732 | // Reorder the links however you need them. |
733 | - $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete')); |
|
733 | + $links = reorder_links($links, array('comment_edit', 'quote', 'comment_add', 'comment_reply', 'flag-abuse_comment', 'flag-abuse_node'), array('comment_delete')); |
|
734 | 734 | // Use the built-in theme_links() function to format the $links array. |
735 | 735 | return theme_links($links, $attributes); |
736 | 736 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | // are the class attribute for the <li> tags. |
814 | 814 | $dom = new DOMDocument; |
815 | 815 | $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
816 | - foreach($dom->getElementsByTagName('li') as $node) { |
|
816 | + foreach ($dom->getElementsByTagName('li') as $node) { |
|
817 | 817 | $key = $node->getAttribute("class"); |
818 | 818 | $alllinks[$key] = $dom->saveHTML($node); |
819 | 819 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | "hide", "unhide", |
827 | 827 | "comment_delete", |
828 | 828 | ); |
829 | - foreach(array_keys($alllinks) as $key1) { |
|
829 | + foreach (array_keys($alllinks) as $key1) { |
|
830 | 830 | // Select string up to first space, if present. |
831 | 831 | $class1 = strtok($key1, ' '); |
832 | 832 | if (in_array($class1, $selected_classes)) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8')); |
856 | 856 | |
857 | 857 | $myli = $dom->getElementsByTagName('li'); |
858 | - if ($myli->length>0) { |
|
858 | + if ($myli->length > 0) { |
|
859 | 859 | $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
860 | 860 | $myli[0]->setAttribute("class", $newclasses); |
861 | 861 | $alink = $dom->saveHTML($myli[0]); |
@@ -872,13 +872,13 @@ discard block |
||
872 | 872 | |
873 | 873 | $output = '<ul class="menu"><li class="first">'; |
874 | 874 | if ($user->uid) { |
875 | - $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>'; |
|
875 | + $output .= '<a href="'.url('logout').'">'.bts('Logout', array(), NULL, 'boinc:menu-link').'</a>'; |
|
876 | 876 | } else { |
877 | - $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>'; |
|
877 | + $output .= '<a href="'.url('user/login', array('query' => drupal_get_destination())).'">'.bts('Login', array(), NULL, 'boinc:menu-link').'</a>'; |
|
878 | 878 | } |
879 | 879 | $output .= '</li>'; |
880 | 880 | if (module_exists('global_search') OR module_exists('global_search_solr')) { |
881 | - $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>'; |
|
881 | + $output .= '<li class="last"> <a class="search" href="'.url('search/site').'">'.bts('search', array(), NULL, 'boinc:menu-link').'</a> </l1>'; |
|
882 | 882 | } |
883 | 883 | $output .= '</ul>'; |
884 | 884 | return $output; |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | if ($ignored[$object->uid] == 0) { |
906 | 906 | $links['ignore_user'] = array( |
907 | 907 | 'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
908 | - 'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid, |
|
909 | - 'query' => 'destination='. $_GET['q'], |
|
908 | + 'href' => 'account/prefs/privacy/ignore_user/add/'.$object->uid, |
|
909 | + 'query' => 'destination='.$_GET['q'], |
|
910 | 910 | 'attributes' => array( |
911 | 911 | 'class' => 'ignore-user', |
912 | 912 | 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
@@ -921,8 +921,8 @@ discard block |
||
921 | 921 | if ($ignored[$object->uid] == 0) { |
922 | 922 | $links['ignore_user'] = array( |
923 | 923 | 'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
924 | - 'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid, |
|
925 | - 'query' => 'destination='. $_GET['q'], |
|
924 | + 'href' => 'account/prefs/privacy/ignore_user/add/'.$object->uid, |
|
925 | + 'query' => 'destination='.$_GET['q'], |
|
926 | 926 | 'attributes' => array( |
927 | 927 | 'class' => 'ignore-user', |
928 | 928 | 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($template) { |
62 | 62 | $t = (double)$template->workunit->rsc_fpops_est; |
63 | 63 | } |
64 | - foreach($r->batch->job as $job) { |
|
64 | + foreach ($r->batch->job as $job) { |
|
65 | 65 | $y = (double)$job->rsc_fpops_est; |
66 | 66 | if ($y) { |
67 | 67 | $x += $y; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | function est_elapsed_time($r, $template) { |
88 | 88 | // crude estimate: batch FLOPs / project FLOPS |
89 | 89 | // |
90 | - return batch_flop_count($r, $template) / project_flops(); |
|
90 | + return batch_flop_count($r, $template)/project_flops(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // if batch-level input template filename was given, read it; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // |
98 | 98 | function read_input_template($app, $r) { |
99 | 99 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
100 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
100 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
101 | 101 | } else { |
102 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
102 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
103 | 103 | } |
104 | 104 | if (file_exists($path)) { |
105 | 105 | $x = simplexml_load_file($path); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | function validate_batch($jobs, $template) { |
145 | 145 | $i = 0; |
146 | 146 | $n = count($template->file_info); |
147 | - foreach($jobs as $job) { |
|
147 | + foreach ($jobs as $job) { |
|
148 | 148 | $m = count($job->input_files); |
149 | 149 | if ($n != $m) { |
150 | 150 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | // stage all the files |
206 | 206 | // |
207 | 207 | function stage_files(&$jobs) { |
208 | - foreach($jobs as $job) { |
|
208 | + foreach ($jobs as $job) { |
|
209 | 209 | foreach ($job->input_files as $file) { |
210 | 210 | if ($file->mode != "remote") { |
211 | 211 | $file->name = stage_file($file); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // |
219 | 219 | function submit_jobs( |
220 | 220 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
221 | - $input_template_filename, // batch-level; can also specify per job |
|
221 | + $input_template_filename, // batch-level; can also specify per job |
|
222 | 222 | $output_template_filename |
223 | 223 | ) { |
224 | 224 | global $input_templates, $output_templates; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // one line per job |
228 | 228 | // |
229 | 229 | $x = ""; |
230 | - foreach($jobs as $job) { |
|
230 | + foreach ($jobs as $job) { |
|
231 | 231 | if ($job->name) { |
232 | 232 | $x .= " --wu_name $job->name"; |
233 | 233 | } |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | $x .= "\n"; |
260 | 260 | } |
261 | 261 | |
262 | - $errfile = "/tmp/create_work_" . getmypid() . ".err"; |
|
263 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
262 | + $errfile = "/tmp/create_work_".getmypid().".err"; |
|
263 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
264 | 264 | if ($input_template_filename) { |
265 | 265 | $cmd .= " --wu_template templates/$input_template_filename"; |
266 | 266 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | // |
357 | 357 | function xml_get_jobs($r) { |
358 | 358 | $jobs = array(); |
359 | - foreach($r->batch->job as $j) { |
|
359 | + foreach ($r->batch->job as $j) { |
|
360 | 360 | $job = new StdClass; |
361 | 361 | $job->input_files = array(); |
362 | 362 | $job->command_line = (string)$j->command_line; |
@@ -438,16 +438,16 @@ discard block |
||
438 | 438 | // - use that for batch logical end time and job priority |
439 | 439 | // |
440 | 440 | $total_flops = 0; |
441 | - foreach($jobs as $job) { |
|
441 | + foreach ($jobs as $job) { |
|
442 | 442 | //print_r($job); |
443 | 443 | if ($job->rsc_fpops_est) { |
444 | 444 | $total_flops += $job->rsc_fpops_est; |
445 | 445 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
446 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
446 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
447 | 447 | } else if ($r->batch->job_params->rsc_fpops_est) { |
448 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
448 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
449 | 449 | } else { |
450 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
450 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
451 | 451 | if ($x) { |
452 | 452 | $total_flops += $x; |
453 | 453 | } else { |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | } |
457 | 457 | } |
458 | 458 | } |
459 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
459 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
460 | 460 | $x = exec($cmd); |
461 | 461 | if (!is_numeric($x) || (double)$x == 0) { |
462 | 462 | log_write("$cmd returned $x"); |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | } |
488 | 488 | |
489 | 489 | $job_params = new StdClass; |
490 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
491 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
492 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
493 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
494 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
490 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
491 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
492 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
493 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
494 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
495 | 495 | // could add quorum-related stuff |
496 | 496 | |
497 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
498 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
497 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
498 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
499 | 499 | // possibly empty |
500 | 500 | |
501 | 501 | submit_jobs( |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | function n_outfiles($wu) { |
586 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
586 | + $path = project_dir()."/$wu->output_template_filename"; |
|
587 | 587 | $r = simplexml_load_file($path); |
588 | 588 | return count($r->file_info); |
589 | 589 | } |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | "; |
791 | 791 | if ($result->server_state == 5) { // over? |
792 | 792 | $paths = get_outfile_paths($result); |
793 | - foreach($paths as $path) { |
|
793 | + foreach ($paths as $path) { |
|
794 | 794 | if (is_file($path)) { |
795 | 795 | $size = filesize($path); |
796 | 796 | echo " <outfile> |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | } else { |
835 | 835 | $results = BoincResult::enum("workunitid=$job_id"); |
836 | 836 | foreach ($results as $r) { |
837 | - switch($r->outcome) { |
|
837 | + switch ($r->outcome) { |
|
838 | 838 | case 1: |
839 | 839 | case 3: |
840 | 840 | case 6: |
@@ -949,8 +949,8 @@ discard block |
||
949 | 949 | } |
950 | 950 | |
951 | 951 | list($user, $user_submit) = authenticate_user($r, $app); |
952 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
953 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
952 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
953 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
954 | 954 | if ($in === false || $out === false) { |
955 | 955 | log_write("template file missing"); |
956 | 956 | xml_error(-1, "template file missing"); |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | |
963 | 963 | function ping($r) { |
964 | 964 | xml_start_tag("ping"); |
965 | - BoincDb::get(); // errors out if DB down or web disabled |
|
965 | + BoincDb::get(); // errors out if DB down or web disabled |
|
966 | 966 | echo "<success>1</success> |
967 | 967 | </ping> |
968 | 968 | "; |
@@ -1029,9 +1029,9 @@ discard block |
||
1029 | 1029 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1030 | 1030 | if ($request_log) { |
1031 | 1031 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1032 | - $request_log = $log_dir . "/" . $request_log; |
|
1032 | + $request_log = $log_dir."/".$request_log; |
|
1033 | 1033 | if ($file = fopen($request_log, "a")) { |
1034 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
1034 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
1035 | 1035 | fclose($file); |
1036 | 1036 | } |
1037 | 1037 | } |