@@ -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 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $config = get_config(); |
35 | 35 | $disable_acct = parse_bool($config, "disable_account_creation"); |
36 | - page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
36 | + page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
37 | 37 | echo "<h3>Create an account</h3>"; |
38 | 38 | form_start("create_account_action.php", "post"); |
39 | 39 | create_account_form(0, "download_software.php"); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | require_once("../inc/util.inc"); |
34 | 34 | require_once("../inc/account_ownership.inc"); |
35 | 35 | |
36 | -if ( !function_exists('openssl_pkey_new') ) { |
|
36 | +if (!function_exists('openssl_pkey_new')) { |
|
37 | 37 | echo "WARNING: OpenSSL functions not available. Not generating account ownership keys.\n"; |
38 | 38 | exit(1); |
39 | 39 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | throw new Exception('Failed to generate account ownership keypair.'); |
74 | 74 | } |
75 | 75 | } catch (Exception $e) { |
76 | - echo 'Caught exception during account ownership key generation: ', $e->getMessage(), "\n"; |
|
76 | + echo 'Caught exception during account ownership key generation: ', $e->getMessage(), "\n"; |
|
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | echo "The private and public keys already exist. Repeat the command with the 'overwrite' parameter to replace the existing ownership keys. \n"; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | function flag_abuse_reason_views_api() { |
31 | 31 | return array( |
32 | 32 | 'api' => 2.0, |
33 | - 'path' => drupal_get_path('module', 'flag_abuse_reason') . '/includes', |
|
33 | + 'path' => drupal_get_path('module', 'flag_abuse_reason').'/includes', |
|
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * Here we change our flag event/action to 'reset'. |
48 | 48 | */ |
49 | 49 | function flag_abuse_reason_preprocess_flag(&$vars) { |
50 | - drupal_add_js(drupal_get_path('module', 'flag_abuse_reason') . "/includes/flag_abuse_reason.js"); |
|
51 | - drupal_add_css(drupal_get_path('module', 'flag_abuse_reason') . "/css/flag_abuse_reason.css"); |
|
50 | + drupal_add_js(drupal_get_path('module', 'flag_abuse_reason')."/includes/flag_abuse_reason.js"); |
|
51 | + drupal_add_css(drupal_get_path('module', 'flag_abuse_reason')."/css/flag_abuse_reason.css"); |
|
52 | 52 | $myuser = $vars['user']; |
53 | 53 | $metaflags = array('abuse_node_meta', 'abuse_comment_meta', 'abuse_user_meta'); |
54 | 54 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // If there are flags on this content, clear the flags and |
81 | 81 | // lock the content. |
82 | 82 | if (user_access('reset abuse flags', $myuser)) { |
83 | - if ($count>0) { |
|
83 | + if ($count > 0) { |
|
84 | 84 | $vars['action'] = 'reset'; |
85 | 85 | $vars['link_text'] = t('Clear Reports and Lock'); |
86 | 86 | $vars['link_title'] = t('Remove all flags on this content and prevent any new flagging.'); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Normal users may cancel their all their reported flags on this |
153 | 153 | // content. |
154 | 154 | else { |
155 | - if ( ($event=='unflag') && (in_array($flag->name, $metaflags)) ) { |
|
155 | + if (($event == 'unflag') && (in_array($flag->name, $metaflags))) { |
|
156 | 156 | $allflags = flag_get_user_flags($flag->content_type, $content_id, $account->uid); |
157 | 157 | foreach ($allflags as $subflag) { |
158 | 158 | $myflag = flag_get_flag(NULL, $subflag->fid); |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | // Consistency checks |
101 | 101 | // |
102 | 102 | if (!check_termsofuse()) { |
103 | - error_log("Project configuration error! " . |
|
103 | + error_log("Project configuration error! ". |
|
104 | 104 | "Terms of use undefined while 'account_creation_rpc_require_consent' enabled!" |
105 | 105 | ); |
106 | 106 | } |
107 | 107 | if (!$checkct) { |
108 | - error_log("Project configuration error! " . |
|
108 | + error_log("Project configuration error! ". |
|
109 | 109 | "'CONSENT_TYPE_ENROLL' disabled while 'account_creation_rpc_require_consent' enabled!" |
110 | 110 | ); |
111 | 111 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | // |
115 | 115 | if (is_null($consent_flag) or !$source) { |
116 | 116 | xml_error(ERR_ACCT_REQUIRE_CONSENT, |
117 | - "This project requires you to consent to its terms of use. " . |
|
118 | - "Please update your BOINC software " . |
|
119 | - "or register via the project's website " . |
|
117 | + "This project requires you to consent to its terms of use. ". |
|
118 | + "Please update your BOINC software ". |
|
119 | + "or register via the project's website ". |
|
120 | 120 | "or contact your account manager's provider." |
121 | 121 | ); |
122 | 122 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | // * not agree. |
153 | 153 | // -> no create account RPC at all |
154 | 154 | // |
155 | - if ( (!is_null($consent_flag)) and $source) { |
|
155 | + if ((!is_null($consent_flag)) and $source) { |
|
156 | 156 | // Record the user giving consent in database - if consent_flag is 0, |
157 | 157 | // this is an 'anonymous account' and consent_not_required is |
158 | 158 | // set to 1. |
159 | - if ($consent_flag==0) { |
|
159 | + if ($consent_flag == 0) { |
|
160 | 160 | $rc = consent_to_a_policy($user, $ctid, 0, 1, $source); |
161 | - } else { |
|
161 | + } else { |
|
162 | 162 | $rc = consent_to_a_policy($user, $ctid, 1, 0, $source); |
163 | 163 | } |
164 | 164 | if (!$rc) { |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $f->mode = "local_staged"; |
42 | 42 | $f->source = "input"; |
43 | 43 | |
44 | - for ($i=10; $i<20; $i++) { |
|
44 | + for ($i = 10; $i < 20; $i++) { |
|
45 | 45 | $job = new StdClass; |
46 | 46 | $job->input_files = array($f); |
47 | 47 | $job->rsc_fpops_est = $i*1e9; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | global $language_names; |
64 | 64 | $supported_languages = get_supported_languages(); |
65 | 65 | $supported_languages[] = "en"; |
66 | - $sel = $cur_lang_name?"":"selected"; |
|
66 | + $sel = $cur_lang_name ? "" : "selected"; |
|
67 | 67 | echo " |
68 | 68 | <option $sel value=auto>Language: default |
69 | 69 | "; |
70 | 70 | foreach ($language_names as $lang) { |
71 | 71 | if (!in_array($lang[0], $supported_languages)) continue; |
72 | - $sel = ($cur_lang_name == $lang[0])?"selected":""; |
|
72 | + $sel = ($cur_lang_name == $lang[0]) ? "selected" : ""; |
|
73 | 73 | if ($lang[0] == "en") { |
74 | 74 | echo "<option $sel value=".$lang[0].">".$lang[1]; |
75 | 75 | } else { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | // show a menu of supported languages |
83 | 83 | // |
84 | -function language_form($cur_lang_name=null) { |
|
84 | +function language_form($cur_lang_name = null) { |
|
85 | 85 | echo ' |
86 | 86 | <form name="language" method="get" action="set_language.php"> |
87 | 87 | <select class="selectbox form-control" name="lang" onchange="javascript: submit()"> |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | |
70 | 70 | function __construct() |
71 | 71 | { |
72 | - $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; |
|
72 | + $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST']; |
|
73 | 73 | $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?'); |
74 | - $this->returnUrl = $this->trustRoot . $uri; |
|
74 | + $this->returnUrl = $this->trustRoot.$uri; |
|
75 | 75 | |
76 | 76 | $this->data = $_POST + $_GET; # OPs may send data as POST or GET. |
77 | 77 | |
78 | - if(!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) { |
|
78 | + if (!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) { |
|
79 | 79 | throw new ErrorException('You must have either https wrappers or curl enabled.'); |
80 | 80 | } |
81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | switch ($name) { |
86 | 86 | case 'identity': |
87 | - if (strlen($value = trim((String) $value))) { |
|
87 | + if (strlen($value = trim((String)$value))) { |
|
88 | 88 | if (preg_match('#^xri:/*#i', $value, $m)) { |
89 | 89 | $value = substr($value, strlen($m[0])); |
90 | 90 | } elseif (!preg_match('/^(?:[=@+\$!\(]|https?:)/i', $value)) { |
@@ -139,23 +139,23 @@ discard block |
||
139 | 139 | return !!gethostbynamel($server); |
140 | 140 | } |
141 | 141 | |
142 | - protected function request_curl($url, $method='GET', $params=array()) |
|
142 | + protected function request_curl($url, $method = 'GET', $params = array()) |
|
143 | 143 | { |
144 | 144 | $params = http_build_query($params, '', '&'); |
145 | - $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : '')); |
|
145 | + $curl = curl_init($url.($method == 'GET' && $params ? '?'.$params : '')); |
|
146 | 146 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); |
147 | 147 | curl_setopt($curl, CURLOPT_HEADER, false); |
148 | 148 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
149 | 149 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
150 | 150 | curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*')); |
151 | 151 | |
152 | - if($this->verify_peer !== null) { |
|
152 | + if ($this->verify_peer !== null) { |
|
153 | 153 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verify_peer); |
154 | - if($this->capath) { |
|
154 | + if ($this->capath) { |
|
155 | 155 | curl_setopt($curl, CURLOPT_CAPATH, $this->capath); |
156 | 156 | } |
157 | 157 | |
158 | - if($this->cainfo) { |
|
158 | + if ($this->cainfo) { |
|
159 | 159 | curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo); |
160 | 160 | } |
161 | 161 | } |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | } |
172 | 172 | $response = curl_exec($curl); |
173 | 173 | |
174 | - if($method == 'HEAD') { |
|
174 | + if ($method == 'HEAD') { |
|
175 | 175 | $headers = array(); |
176 | - foreach(explode("\n", $response) as $header) { |
|
177 | - $pos = strpos($header,':'); |
|
176 | + foreach (explode("\n", $response) as $header) { |
|
177 | + $pos = strpos($header, ':'); |
|
178 | 178 | $name = strtolower(trim(substr($header, 0, $pos))); |
179 | - $headers[$name] = trim(substr($header, $pos+1)); |
|
179 | + $headers[$name] = trim(substr($header, $pos + 1)); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | # Updating claimed_id in case of redirections. |
183 | 183 | $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); |
184 | - if($effective_url != $url) { |
|
184 | + if ($effective_url != $url) { |
|
185 | 185 | $this->identity = $this->claimed_id = $effective_url; |
186 | 186 | } |
187 | 187 | |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | return $response; |
196 | 196 | } |
197 | 197 | |
198 | - protected function request_streams($url, $method='GET', $params=array()) |
|
198 | + protected function request_streams($url, $method = 'GET', $params = array()) |
|
199 | 199 | { |
200 | - if(!$this->hostExists($url)) { |
|
200 | + if (!$this->hostExists($url)) { |
|
201 | 201 | throw new ErrorException('Invalid request.'); |
202 | 202 | } |
203 | 203 | |
204 | 204 | $params = http_build_query($params, '', '&'); |
205 | - switch($method) { |
|
205 | + switch ($method) { |
|
206 | 206 | case 'GET': |
207 | 207 | $opts = array( |
208 | 208 | 'http' => array( |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 'ignore_errors' => true, |
212 | 212 | ) |
213 | 213 | ); |
214 | - $url = $url . ($params ? '?' . $params : ''); |
|
214 | + $url = $url.($params ? '?'.$params : ''); |
|
215 | 215 | break; |
216 | 216 | case 'POST': |
217 | 217 | $opts = array( |
@@ -236,31 +236,31 @@ discard block |
||
236 | 236 | )) |
237 | 237 | ); |
238 | 238 | |
239 | - $url = $url . ($params ? '?' . $params : ''); |
|
240 | - $headers_tmp = get_headers ($url); |
|
241 | - if(!$headers_tmp) { |
|
239 | + $url = $url.($params ? '?'.$params : ''); |
|
240 | + $headers_tmp = get_headers($url); |
|
241 | + if (!$headers_tmp) { |
|
242 | 242 | return array(); |
243 | 243 | } |
244 | 244 | |
245 | 245 | # Parsing headers. |
246 | 246 | $headers = array(); |
247 | - foreach($headers_tmp as $header) { |
|
248 | - $pos = strpos($header,':'); |
|
247 | + foreach ($headers_tmp as $header) { |
|
248 | + $pos = strpos($header, ':'); |
|
249 | 249 | $name = strtolower(trim(substr($header, 0, $pos))); |
250 | - $headers[$name] = trim(substr($header, $pos+1)); |
|
250 | + $headers[$name] = trim(substr($header, $pos + 1)); |
|
251 | 251 | |
252 | 252 | # Following possible redirections. The point is just to have |
253 | 253 | # claimed_id change with them, because get_headers() will |
254 | 254 | # follow redirections automatically. |
255 | 255 | # We ignore redirections with relative paths. |
256 | 256 | # If any known provider uses them, file a bug report. |
257 | - if($name == 'location') { |
|
258 | - if(strpos($headers[$name], 'http') === 0) { |
|
257 | + if ($name == 'location') { |
|
258 | + if (strpos($headers[$name], 'http') === 0) { |
|
259 | 259 | $this->identity = $this->claimed_id = $headers[$name]; |
260 | - } elseif($headers[$name][0] == '/') { |
|
260 | + } elseif ($headers[$name][0] == '/') { |
|
261 | 261 | $parsed_url = parse_url($this->claimed_id); |
262 | 262 | $this->identity = |
263 | - $this->claimed_id = $parsed_url['scheme'] . '://' |
|
263 | + $this->claimed_id = $parsed_url['scheme'].'://' |
|
264 | 264 | . $parsed_url['host'] |
265 | 265 | . $headers[$name]; |
266 | 266 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | return $headers; |
273 | 273 | } |
274 | 274 | |
275 | - if($this->verify_peer) { |
|
275 | + if ($this->verify_peer) { |
|
276 | 276 | $opts += array('ssl' => array( |
277 | 277 | 'verify_peer' => true, |
278 | 278 | 'capath' => $this->capath, |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | )); |
281 | 281 | } |
282 | 282 | |
283 | - $context = stream_context_create ($opts); |
|
283 | + $context = stream_context_create($opts); |
|
284 | 284 | |
285 | 285 | return file_get_contents($url, false, $context); |
286 | 286 | } |
287 | 287 | |
288 | - protected function request($url, $method='GET', $params=array()) |
|
288 | + protected function request($url, $method = 'GET', $params = array()) |
|
289 | 289 | { |
290 | - if(function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) { |
|
290 | + if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) { |
|
291 | 291 | return $this->request_curl($url, $method, $params); |
292 | 292 | } |
293 | 293 | return $this->request_streams($url, $method, $params); |
@@ -296,19 +296,19 @@ discard block |
||
296 | 296 | protected function build_url($url, $parts) |
297 | 297 | { |
298 | 298 | if (isset($url['query'], $parts['query'])) { |
299 | - $parts['query'] = $url['query'] . '&' . $parts['query']; |
|
299 | + $parts['query'] = $url['query'].'&'.$parts['query']; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | $url = $parts + $url; |
303 | - $url = $url['scheme'] . '://' |
|
304 | - . (empty($url['username'])?'' |
|
305 | - :(empty($url['password'])? "{$url['username']}@" |
|
303 | + $url = $url['scheme'].'://' |
|
304 | + . (empty($url['username']) ? '' |
|
305 | + :(empty($url['password']) ? "{$url['username']}@" |
|
306 | 306 | :"{$url['username']}:{$url['password']}@")) |
307 | 307 | . $url['host'] |
308 | - . (empty($url['port'])?'':":{$url['port']}") |
|
309 | - . (empty($url['path'])?'':$url['path']) |
|
310 | - . (empty($url['query'])?'':"?{$url['query']}") |
|
311 | - . (empty($url['fragment'])?'':"#{$url['fragment']}"); |
|
308 | + . (empty($url['port']) ? '' : ":{$url['port']}") |
|
309 | + . (empty($url['path']) ? '' : $url['path']) |
|
310 | + . (empty($url['query']) ? '' : "?{$url['query']}") |
|
311 | + . (empty($url['fragment']) ? '' : "#{$url['fragment']}"); |
|
312 | 312 | return $url; |
313 | 313 | } |
314 | 314 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2); |
323 | 323 | |
324 | 324 | $result = array_merge($matches1[1], $matches2[1]); |
325 | - return empty($result)?false:$result[0]; |
|
325 | + return empty($result) ?false:$result[0]; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $yadis = true; |
349 | 349 | |
350 | 350 | # We'll jump a maximum of 5 times, to avoid endless redirections. |
351 | - for ($i = 0; $i < 5; $i ++) { |
|
351 | + for ($i = 0; $i < 5; $i++) { |
|
352 | 352 | if ($yadis) { |
353 | 353 | $headers = $this->request($url, 'HEAD'); |
354 | 354 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | $content = $this->request($url, 'GET'); |
371 | 371 | |
372 | 372 | preg_match_all('#<Service.*?>(.*?)</Service>#s', $content, $m); |
373 | - foreach($m[1] as $content) { |
|
374 | - $content = ' ' . $content; # The space is added, so that strpos doesn't return 0. |
|
373 | + foreach ($m[1] as $content) { |
|
374 | + $content = ' '.$content; # The space is added, so that strpos doesn't return 0. |
|
375 | 375 | |
376 | 376 | # OpenID 2 |
377 | 377 | $ns = preg_quote('http://specs.openid.net/auth/2.0/'); |
378 | - if(preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) { |
|
378 | + if (preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) { |
|
379 | 379 | if ($type[1] == 'server') $this->identifier_select = true; |
380 | 380 | |
381 | 381 | preg_match('#<URI.*?>(.*)</URI>#', $content, $server); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | return false; |
385 | 385 | } |
386 | 386 | # Does the server advertise support for either AX or SREG? |
387 | - $this->ax = (bool) strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>'); |
|
387 | + $this->ax = (bool)strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>'); |
|
388 | 388 | $this->sreg = strpos($content, '<Type>http://openid.net/sreg/1.0</Type>') |
389 | 389 | || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>'); |
390 | 390 | |
@@ -498,33 +498,33 @@ discard block |
||
498 | 498 | if ($this->required || $this->optional) { |
499 | 499 | $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0'; |
500 | 500 | $params['openid.ax.mode'] = 'fetch_request'; |
501 | - $this->aliases = array(); |
|
501 | + $this->aliases = array(); |
|
502 | 502 | $counts = array(); |
503 | 503 | $required = array(); |
504 | 504 | $optional = array(); |
505 | - foreach (array('required','optional') as $type) { |
|
505 | + foreach (array('required', 'optional') as $type) { |
|
506 | 506 | foreach ($this->$type as $alias => $field) { |
507 | 507 | if (is_int($alias)) $alias = strtr($field, '/', '_'); |
508 | - $this->aliases[$alias] = 'http://axschema.org/' . $field; |
|
508 | + $this->aliases[$alias] = 'http://axschema.org/'.$field; |
|
509 | 509 | if (empty($counts[$alias])) $counts[$alias] = 0; |
510 | 510 | $counts[$alias] += 1; |
511 | 511 | ${$type}[] = $alias; |
512 | 512 | } |
513 | 513 | } |
514 | 514 | foreach ($this->aliases as $alias => $ns) { |
515 | - $params['openid.ax.type.' . $alias] = $ns; |
|
515 | + $params['openid.ax.type.'.$alias] = $ns; |
|
516 | 516 | } |
517 | 517 | foreach ($counts as $alias => $count) { |
518 | 518 | if ($count == 1) continue; |
519 | - $params['openid.ax.count.' . $alias] = $count; |
|
519 | + $params['openid.ax.count.'.$alias] = $count; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | # Don't send empty ax.requied and ax.if_available. |
523 | 523 | # Google and possibly other providers refuse to support ax when one of these is empty. |
524 | - if($required) { |
|
524 | + if ($required) { |
|
525 | 525 | $params['openid.ax.required'] = implode(',', $required); |
526 | 526 | } |
527 | - if($optional) { |
|
527 | + if ($optional) { |
|
528 | 528 | $params['openid.ax.if_available'] = implode(',', $optional); |
529 | 529 | } |
530 | 530 | } |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | # If we have an openid.delegate that is different from our claimed id, |
538 | 538 | # we need to somehow preserve the claimed id between requests. |
539 | 539 | # The simplest way is to just send it along with the return_to url. |
540 | - if($this->identity != $this->claimed_id) { |
|
541 | - $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id; |
|
540 | + if ($this->identity != $this->claimed_id) { |
|
541 | + $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?').'openid.claimed_id='.$this->claimed_id; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | $params = array( |
@@ -612,15 +612,15 @@ discard block |
||
612 | 612 | # by presenting user_setup_url (for 1.1) or reporting |
613 | 613 | # mode 'setup_needed' (for 2.0). Also catching all modes other than |
614 | 614 | # id_res, in order to avoid throwing errors. |
615 | - if(isset($this->data['openid_user_setup_url'])) { |
|
615 | + if (isset($this->data['openid_user_setup_url'])) { |
|
616 | 616 | $this->setup_url = $this->data['openid_user_setup_url']; |
617 | 617 | return false; |
618 | 618 | } |
619 | - if($this->mode != 'id_res') { |
|
619 | + if ($this->mode != 'id_res') { |
|
620 | 620 | return false; |
621 | 621 | } |
622 | 622 | |
623 | - $this->claimed_id = isset($this->data['openid_claimed_id'])?$this->data['openid_claimed_id']:$this->data['openid_identity']; |
|
623 | + $this->claimed_id = isset($this->data['openid_claimed_id']) ? $this->data['openid_claimed_id'] : $this->data['openid_identity']; |
|
624 | 624 | $params = array( |
625 | 625 | 'openid.assoc_handle' => $this->data['openid_assoc_handle'], |
626 | 626 | 'openid.signed' => $this->data['openid_signed'], |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | # If it's an OpenID 1 provider, and we've got claimed_id, |
639 | 639 | # we have to append it to the returnUrl, like authUrl_v1 does. |
640 | 640 | $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?') |
641 | - . 'openid.claimed_id=' . $this->claimed_id; |
|
641 | + . 'openid.claimed_id='.$this->claimed_id; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | if ($this->data['openid_return_to'] != $this->returnUrl) { |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | # In such case, validation would fail, since we'd send different data than OP |
657 | 657 | # wants to verify. stripslashes() should solve that problem, but we can't |
658 | 658 | # use it when magic_quotes is off. |
659 | - $value = $this->data['openid_' . str_replace('.','_',$item)]; |
|
660 | - $params['openid.' . $item] = (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) ? stripslashes($value) : $value; |
|
659 | + $value = $this->data['openid_'.str_replace('.', '_', $item)]; |
|
660 | + $params['openid.'.$item] = (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) ? stripslashes($value) : $value; |
|
661 | 661 | |
662 | 662 | } |
663 | 663 | |
@@ -695,18 +695,18 @@ discard block |
||
695 | 695 | |
696 | 696 | $attributes = array(); |
697 | 697 | foreach ($this->data as $key => $value) { |
698 | - $keyMatch = 'openid_' . $alias . '_value_'; |
|
698 | + $keyMatch = 'openid_'.$alias.'_value_'; |
|
699 | 699 | if (substr($key, 0, strlen($keyMatch)) != $keyMatch) { |
700 | 700 | continue; |
701 | 701 | } |
702 | 702 | $key = substr($key, strlen($keyMatch)); |
703 | - if (!isset($this->data['openid_' . $alias . '_type_' . $key])) { |
|
703 | + if (!isset($this->data['openid_'.$alias.'_type_'.$key])) { |
|
704 | 704 | # OP is breaking the spec by returning a field without |
705 | 705 | # associated ns. This shouldn't happen, but it's better |
706 | 706 | # to check, than cause an E_NOTICE. |
707 | 707 | continue; |
708 | 708 | } |
709 | - $key = substr($this->data['openid_' . $alias . '_type_' . $key], |
|
709 | + $key = substr($this->data['openid_'.$alias.'_type_'.$key], |
|
710 | 710 | strlen('http://axschema.org/')); |
711 | 711 | $attributes[$key] = $value; |
712 | 712 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // |
65 | 65 | function get_platform($user_agent) { |
66 | 66 | if (strstr($user_agent, 'Windows')) { |
67 | - if (strstr($user_agent, 'Win64')||strstr($user_agent, 'WOW64')) { |
|
67 | + if (strstr($user_agent, 'Win64') || strstr($user_agent, 'WOW64')) { |
|
68 | 68 | return 'windows_x86_64'; |
69 | 69 | } else { |
70 | 70 | return 'windows_intelx86'; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $token, |
139 | 139 | $user->id, |
140 | 140 | (string)$v->filename, |
141 | - $green?"btn-success":"btn-info", |
|
141 | + $green ? "btn-success" : "btn-info", |
|
142 | 142 | (string)$v->platform, |
143 | 143 | (string)$v->size_mb, |
144 | 144 | (string)$v->version_num |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | function download_button_vbox($v, $project_id, $token, $user) { |
149 | 149 | // if no vbox version exists for platform, don't show vbox button |
150 | - if(!$v->vbox_filename) { |
|
150 | + if (!$v->vbox_filename) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | return sprintf( |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | handle_get_info(); |
437 | 437 | } else { |
438 | 438 | $dev = get_str("dev", true); |
439 | - $user_agent = get_str("user_agent", true); // for debugging |
|
439 | + $user_agent = get_str("user_agent", true); // for debugging |
|
440 | 440 | if (!$user_agent) { |
441 | 441 | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
442 | 442 | } |