@@ -8,38 +8,38 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * The BOINC stats configuration determines where statistics are sourced |
|
| 12 | - */ |
|
| 11 | + * The BOINC stats configuration determines where statistics are sourced |
|
| 12 | + */ |
|
| 13 | 13 | function boincstats_admin_stats_system(&$form_state) { |
| 14 | - $form = array(); |
|
| 15 | - $default = array( |
|
| 14 | + $form = array(); |
|
| 15 | + $default = array( |
|
| 16 | 16 | 'boinc_stats_server' => variable_get('boinc_stats_server', 'stats.gridrepublic.org'), |
| 17 | 17 | 'boinc_stats_project_list_rpc' => variable_get('boinc_stats_project_list_rpc', 'rpc/get_projects.php'), |
| 18 | 18 | 'boinc_stats_project_credit_history_rpc' => variable_get('boinc_stats_project_credit_history_rpc', 'rpc2/get_project_tc_history.php'), |
| 19 | 19 | 'boinc_stats_user_credit_history_rpc' => variable_get('boinc_stats_user_credit_history_rpc', 'rpc2/get_user_credit_history.php'), |
| 20 | 20 | 'boinc_stats_remote_project_id' => variable_get('boinc_stats_remote_project_id', ''), |
| 21 | - ); |
|
| 22 | - // Define the form |
|
| 23 | - $form['boinc_stats_server'] = array( |
|
| 21 | + ); |
|
| 22 | + // Define the form |
|
| 23 | + $form['boinc_stats_server'] = array( |
|
| 24 | 24 | '#type' => 'value', |
| 25 | 25 | '#value' => $default['boinc_stats_server'] |
| 26 | - ); |
|
| 27 | - $form['boinc_stats_project_list_rpc'] = array( |
|
| 26 | + ); |
|
| 27 | + $form['boinc_stats_project_list_rpc'] = array( |
|
| 28 | 28 | '#type' => 'value', |
| 29 | 29 | '#value' => $default['boinc_stats_project_list_rpc'] |
| 30 | - ); |
|
| 31 | - $form['boinc_stats_project_credit_history_rpc'] = array( |
|
| 30 | + ); |
|
| 31 | + $form['boinc_stats_project_credit_history_rpc'] = array( |
|
| 32 | 32 | '#type' => 'value', |
| 33 | 33 | '#value' => $default['boinc_stats_project_credit_history_rpc'] |
| 34 | - ); |
|
| 35 | - $form['boinc_stats_user_credit_history_rpc'] = array( |
|
| 34 | + ); |
|
| 35 | + $form['boinc_stats_user_credit_history_rpc'] = array( |
|
| 36 | 36 | '#type' => 'value', |
| 37 | 37 | '#value' => $default['boinc_stats_user_credit_history_rpc'] |
| 38 | - ); |
|
| 39 | - $form['boinc_stats_remote_project_id'] = array( |
|
| 38 | + ); |
|
| 39 | + $form['boinc_stats_remote_project_id'] = array( |
|
| 40 | 40 | '#type' => 'textfield', |
| 41 | 41 | '#title' => t('Stats ID for @project', array( |
| 42 | - '@project' => variable_get('site_name', 'Drupal-BOINC'))), |
|
| 42 | + '@project' => variable_get('site_name', 'Drupal-BOINC'))), |
|
| 43 | 43 | '#default_value' => $default['boinc_stats_remote_project_id'], |
| 44 | 44 | '#description' => t('This project must be registered with a stats system in |
| 45 | 45 | order for some statistics to be available. Currently only one system is |
@@ -47,26 +47,26 @@ discard block |
||
| 47 | 47 | '!find_project_id' => l(t('Find your project ID'), |
| 48 | 48 | "http://{$default['boinc_stats_server']}/{$default['boinc_stats_project_list_rpc']}", |
| 49 | 49 | array('attributes' => array('target' => 'external'))) |
| 50 | - ) |
|
| 50 | + ) |
|
| 51 | 51 | ) |
| 52 | - ); |
|
| 53 | - return system_settings_form($form); |
|
| 52 | + ); |
|
| 53 | + return system_settings_form($form); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Validate the BOINC stats form. |
|
| 58 | - */ |
|
| 57 | + * Validate the BOINC stats form. |
|
| 58 | + */ |
|
| 59 | 59 | function boincstats_admin_stats_system_validate($form, &$form_state) { |
| 60 | - $values = $form_state['values']; |
|
| 61 | - if (!$values['boinc_stats_remote_project_id']) { |
|
| 60 | + $values = $form_state['values']; |
|
| 61 | + if (!$values['boinc_stats_remote_project_id']) { |
|
| 62 | 62 | form_set_error('boinc_stats_remote_project_id', |
| 63 | - t('Stats may not work without a valid stats ID configured!')); |
|
| 64 | - } |
|
| 63 | + t('Stats may not work without a valid stats ID configured!')); |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Handle post-validation submission of BOINC stats form. |
|
| 69 | - */ |
|
| 68 | + * Handle post-validation submission of BOINC stats form. |
|
| 69 | + */ |
|
| 70 | 70 | function boincstats_admin_stats_system_submit($form, &$form_state) { |
| 71 | - drupal_set_message(t('Stats system configuration has been updated.')); |
|
| 71 | + drupal_set_message(t('Stats system configuration has been updated.')); |
|
| 72 | 72 | } |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | // Hackish... but there doesn't seem to be a non-hackish way to change the |
| 6 | 6 | // label on the search form!? Need a custom module to call hook_form_alter()... |
| 7 | 7 | function global_search_solr_form_alter(&$form, &$form_state, $form_id) { |
| 8 | - if ($form_id == 'apachesolr_search_custom_page_search_form') { |
|
| 8 | + if ($form_id == 'apachesolr_search_custom_page_search_form') { |
|
| 9 | 9 | $form['basic']['keys']['#title'] = t('Search'); |
| 10 | 10 | $form['basic']['keys']['#size'] = 40; |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | } |
@@ -42,15 +42,15 @@ |
||
| 42 | 42 | $start_id = 0; //Set this to something else if you like |
| 43 | 43 | $profiles = _mysql_query("select * from profile where userid>$start_id order by userid"); |
| 44 | 44 | echo _mysql_error(); |
| 45 | - $i=0; |
|
| 46 | - while ($profile = _mysql_fetch_object($profiles)){ |
|
| 45 | + $i = 0; |
|
| 46 | + while ($profile = _mysql_fetch_object($profiles)) { |
|
| 47 | 47 | $i++; |
| 48 | 48 | if ($i%100 == 0) { //For every 100 profiles |
| 49 | - echo $profile->userid.". "; flush(); // print out where we are |
|
| 49 | + echo $profile->userid.". "; flush(); // print out where we are |
|
| 50 | 50 | //usleep(200000); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ($profile->userid > $start_id){ |
|
| 53 | + if ($profile->userid > $start_id) { |
|
| 54 | 54 | fix_profile($profile); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -43,14 +43,15 @@ |
||
| 43 | 43 | $profiles = _mysql_query("select * from profile where userid>$start_id order by userid"); |
| 44 | 44 | echo _mysql_error(); |
| 45 | 45 | $i=0; |
| 46 | - while ($profile = _mysql_fetch_object($profiles)){ |
|
| 46 | + while ($profile = _mysql_fetch_object($profiles)) { |
|
| 47 | 47 | $i++; |
| 48 | - if ($i%100 == 0) { //For every 100 profiles |
|
| 48 | + if ($i%100 == 0) { |
|
| 49 | +//For every 100 profiles |
|
| 49 | 50 | echo $profile->userid.". "; flush(); // print out where we are |
| 50 | 51 | //usleep(200000); |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if ($profile->userid > $start_id){ |
|
| 54 | + if ($profile->userid > $start_id) { |
|
| 54 | 55 | fix_profile($profile); |
| 55 | 56 | } |
| 56 | 57 | } |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | admin_page_head("Account Ownership Keys"); |
| 24 | 24 | |
| 25 | 25 | if (!file_exists($account_ownership_private_key_file_path)) { |
| 26 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 26 | + echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 27 | 27 | } else { |
| 28 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
| 28 | + echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (!file_exists($account_ownership_public_key_file_path)) { |
| 32 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 32 | + echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 33 | 33 | } else { |
| 34 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
| 34 | + echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | echo "<p>For more info see the related wiki page: <a href=\"https://github.com/BOINC/boinc/wiki/ProofOfOwnership\">ProofOfOwnership</a></p>"; |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | admin_page_head("Account Ownership Keys"); |
| 24 | 24 | |
| 25 | 25 | if (!file_exists($account_ownership_private_key_file_path)) { |
| 26 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 26 | + echo "<p>The account ownership private key '".$account_ownership_private_key_file_name."' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 27 | 27 | } else { |
| 28 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
| 28 | + echo "<p>The account ownership private key '".$account_ownership_private_key_file_name."' exists.</p>"; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (!file_exists($account_ownership_public_key_file_path)) { |
| 32 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 32 | + echo "<p>The account ownership public key '".$account_ownership_public_key_file_name."' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
| 33 | 33 | } else { |
| 34 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
| 34 | + echo "<p>The account ownership public key '".$account_ownership_public_key_file_name."' exists.</p>"; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | echo "<p>For more info see the related wiki page: <a href=\"https://github.com/BOINC/boinc/wiki/ProofOfOwnership\">ProofOfOwnership</a></p>"; |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | credit_to_ops($credit, $ops, $unit); |
| 44 | 44 | |
| 45 | 45 | if ($bolden) { |
| 46 | - $lbold="[["; |
|
| 47 | - $rbold="]]"; |
|
| 46 | + $lbold = "[["; |
|
| 47 | + $rbold = "]]"; |
|
| 48 | 48 | } else { |
| 49 | - $lbold=""; $rbold=""; |
|
| 49 | + $lbold = ""; $rbold = ""; |
|
| 50 | 50 | } |
| 51 | 51 | return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)"; |
| 52 | 52 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | // |
| 87 | 87 | function show_share_buttons() { |
| 88 | 88 | echo '<p>'; |
| 89 | - $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
|
| 89 | + $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
|
| 90 | 90 | $cert_url = urlencode($current_url); |
| 91 | 91 | |
| 92 | 92 | // Share on Facebook |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | if (DISABLE_TEAMS) error_page("Teams are disabled"); |
| 28 | 28 | |
| 29 | 29 | $border = get_str("border", true); |
| 30 | -if ($border=="no") { |
|
| 31 | - $border=0; |
|
| 30 | +if ($border == "no") { |
|
| 31 | + $border = 0; |
|
| 32 | 32 | } else { |
| 33 | - $border=8; |
|
| 33 | + $border = 8; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Make sure user_id is in the URL so that share functions work |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if (!$user_id) { |
| 40 | 40 | $user = get_logged_in_user(); |
| 41 | 41 | Header(sprintf('Location: %s/cert_team.php?user_id=%d%s', |
| 42 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 42 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 43 | 43 | )); |
| 44 | 44 | exit; |
| 45 | 45 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | require_once("../inc/cert.inc"); |
| 25 | 25 | |
| 26 | 26 | $border = get_str("border", true); |
| 27 | -if ($border=="no") { |
|
| 28 | - $border=0; |
|
| 27 | +if ($border == "no") { |
|
| 28 | + $border = 0; |
|
| 29 | 29 | } else { |
| 30 | - $border=8; |
|
| 30 | + $border = 8; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // Make sure user_id is in the URL so that share functions work |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if (!$user_id) { |
| 37 | 37 | $user = get_logged_in_user(); |
| 38 | 38 | Header(sprintf('Location: %s/cert1.php?user_id=%d%s', |
| 39 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 39 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 40 | 40 | )); |
| 41 | 41 | exit; |
| 42 | 42 | } |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | require_once("../inc/user.inc"); |
| 26 | 26 | |
| 27 | 27 | $border = get_str("border", true); |
| 28 | -if ($border=="no") { |
|
| 29 | - $border=0; |
|
| 28 | +if ($border == "no") { |
|
| 29 | + $border = 0; |
|
| 30 | 30 | } else { |
| 31 | - $border=8; |
|
| 31 | + $border = 8; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Make sure user_id is in the URL so that share functions work |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | if (!$user_id) { |
| 38 | 38 | $user = get_logged_in_user(); |
| 39 | 39 | Header(sprintf('Location: %s/cert_all.php?user_id=%d%s', |
| 40 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 40 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 41 | 41 | )); |
| 42 | 42 | exit; |
| 43 | 43 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
| 92 | 92 | "; |
| 93 | 93 | foreach ($user->projects as $p) { |
| 94 | - if ($p->total_credit<100) continue; |
|
| 94 | + if ($p->total_credit < 100) continue; |
|
| 95 | 95 | show_proj($p); |
| 96 | 96 | } |
| 97 | 97 | echo " |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (!defined("DELETE_DELAY")) define("DELETE_DELAY", 2); |
| 43 | 43 | |
| 44 | 44 | function is_delete_account_token_valid($userid, $token) { |
| 45 | - if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
|
| 45 | + if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) { |
|
| 46 | 46 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 47 | 47 | return false; |
| 48 | 48 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // |
| 127 | 127 | function is_over_but_not_validated($res) { |
| 128 | 128 | if ($res->server_state == RESULT_SERVER_STATE_OVER && $res->outcome == RESULT_OUTCOME_SUCCESS && |
| 129 | - ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE) ) { |
|
| 129 | + ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE)) { |
|
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | return false; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | // |
| 145 | 145 | function cancel_results_for_user($user) { |
| 146 | 146 | $ress = BoincResult::enum("userid = $user->id"); |
| 147 | - $cancel_clause="server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID; |
|
| 148 | - $set_id_clause="hostid=0, userid=0"; |
|
| 147 | + $cancel_clause = "server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID; |
|
| 148 | + $set_id_clause = "hostid=0, userid=0"; |
|
| 149 | 149 | foreach ($ress as $res) { |
| 150 | 150 | if (is_in_progress($res) || is_over_but_not_validated($res)) { |
| 151 | 151 | $res->update($cancel_clause.", ".$set_id_clause); |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // delete remote submit user |
| 170 | 170 | // |
| 171 | - delete_remote_submit_user($user); // from submit_util.inc |
|
| 171 | + delete_remote_submit_user($user); // from submit_util.inc |
|
| 172 | 172 | |
| 173 | 173 | // remove user's team records |
| 174 | 174 | // |
| 175 | - user_erase_team_owner($user); // from team.inc |
|
| 176 | - user_quit_team($user); // from team.inc |
|
| 175 | + user_erase_team_owner($user); // from team.inc |
|
| 176 | + user_quit_team($user); // from team.inc |
|
| 177 | 177 | user_erase_team_delta($user); // from team.inc |
| 178 | 178 | |
| 179 | 179 | // Items that do not have logic elsewhere |
@@ -200,6 +200,6 @@ discard block |
||
| 200 | 200 | BoincTeamAdmin::delete("userid=$user->id"); |
| 201 | 201 | |
| 202 | 202 | // final action |
| 203 | - delete_user($user); //from user_util.inc |
|
| 203 | + delete_user($user); //from user_util.inc |
|
| 204 | 204 | return 0; |
| 205 | 205 | } |