@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); |
| 35 | 35 | define( |
| 36 | 36 | 'PHP_VERSION_ID', |
| 37 | - $RandomCompatversion[0] * 10000 |
|
| 38 | - + $RandomCompatversion[1] * 100 |
|
| 37 | + $RandomCompatversion[0]*10000 |
|
| 38 | + + $RandomCompatversion[1]*100 |
|
| 39 | 39 | + $RandomCompatversion[2] |
| 40 | 40 | ); |
| 41 | 41 | $RandomCompatversion = null; |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $RandomCompatDIR = dirname(__FILE__); |
| 56 | 56 | |
| 57 | -require_once $RandomCompatDIR . '/byte_safe_strings.inc'; |
|
| 58 | -require_once $RandomCompatDIR . '/cast_to_int.inc'; |
|
| 59 | -require_once $RandomCompatDIR . '/error_polyfill.inc'; |
|
| 57 | +require_once $RandomCompatDIR.'/byte_safe_strings.inc'; |
|
| 58 | +require_once $RandomCompatDIR.'/cast_to_int.inc'; |
|
| 59 | +require_once $RandomCompatDIR.'/error_polyfill.inc'; |
|
| 60 | 60 | |
| 61 | 61 | if (!is_callable('random_bytes')) { |
| 62 | 62 | /** |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | if (extension_loaded('libsodium')) { |
| 77 | 77 | // See random_bytes_libsodium.php |
| 78 | 78 | if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { |
| 79 | - require_once $RandomCompatDIR . '/random_bytes_libsodium.inc'; |
|
| 79 | + require_once $RandomCompatDIR.'/random_bytes_libsodium.inc'; |
|
| 80 | 80 | } elseif (method_exists('Sodium', 'randombytes_buf')) { |
| 81 | - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.inc'; |
|
| 81 | + require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.inc'; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // place, that is not helpful to us here. |
| 118 | 118 | |
| 119 | 119 | // See random_bytes_dev_urandom.php |
| 120 | - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.inc'; |
|
| 120 | + require_once $RandomCompatDIR.'/random_bytes_dev_urandom.inc'; |
|
| 121 | 121 | } |
| 122 | 122 | // Unset variables after use |
| 123 | 123 | $RandomCompat_basedir = null; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | extension_loaded('mcrypt') |
| 160 | 160 | ) { |
| 161 | 161 | // See random_bytes_mcrypt.php |
| 162 | - require_once $RandomCompatDIR . '/random_bytes_mcrypt.inc'; |
|
| 162 | + require_once $RandomCompatDIR.'/random_bytes_mcrypt.inc'; |
|
| 163 | 163 | } |
| 164 | 164 | $RandomCompatUrandom = null; |
| 165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); |
| 185 | 185 | if (method_exists($RandomCompatCOMtest, 'GetRandom')) { |
| 186 | 186 | // See random_bytes_com_dotnet.php |
| 187 | - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.inc'; |
|
| 187 | + require_once $RandomCompatDIR.'/random_bytes_com_dotnet.inc'; |
|
| 188 | 188 | } |
| 189 | 189 | } catch (com_exception $e) { |
| 190 | 190 | // Don't try to use it. |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (!is_callable('random_int')) { |
| 222 | - require_once $RandomCompatDIR . '/random_int.inc'; |
|
| 222 | + require_once $RandomCompatDIR.'/random_int.inc'; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $RandomCompatDIR = null; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if (!is_callable('RandomCompat_strlen')) { |
| 30 | 30 | if ( |
| 31 | 31 | defined('MB_OVERLOAD_STRING') && |
| 32 | - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING |
|
| 32 | + ini_get('mbstring.func_overload')&MB_OVERLOAD_STRING |
|
| 33 | 33 | ) { |
| 34 | 34 | /** |
| 35 | 35 | * strlen() implementation that isn't brittle to mbstring.func_overload |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return (int) mb_strlen($binary_string, '8bit'); |
|
| 54 | + return (int)mb_strlen($binary_string, '8bit'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'RandomCompat_strlen() expects a string' |
| 74 | 74 | ); |
| 75 | 75 | } |
| 76 | - return (int) strlen($binary_string); |
|
| 76 | + return (int)strlen($binary_string); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | if ( |
| 84 | 84 | defined('MB_OVERLOAD_STRING') |
| 85 | 85 | && |
| 86 | - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING |
|
| 86 | + ini_get('mbstring.func_overload')&MB_OVERLOAD_STRING |
|
| 87 | 87 | ) { |
| 88 | 88 | /** |
| 89 | 89 | * substr() implementation that isn't brittle to mbstring.func_overload |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return ''; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - return (string) mb_substr($binary_string, $start, $length, '8bit'); |
|
| 136 | + return (string)mb_substr($binary_string, $start, $length, '8bit'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | } else { |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - return (string) substr($binary_string, $start, $length); |
|
| 175 | + return (string)substr($binary_string, $start, $length); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - return (string) substr($binary_string, $start); |
|
| 178 | + return (string)substr($binary_string, $start); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $expiration = $now + $duration; |
| 32 | 32 | $type = BoincDb::escape_string($type); |
| 33 | 33 | $ret = BoincToken::insert("(token,userid,type,create_time,expire_time) values ('$token', $userid, '$type', $now, $expiration)"); |
| 34 | - if ( !$ret ) { |
|
| 34 | + if (!$ret) { |
|
| 35 | 35 | return null; |
| 36 | 36 | } |
| 37 | 37 | return $token; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | function is_valid_token($userid, $token, $type) { |
| 41 | 41 | $boincToken = BoincToken::lookup_valid_token($userid, $token, $type); |
| 42 | - if ( $boincToken == null ) { |
|
| 42 | + if ($boincToken == null) { |
|
| 43 | 43 | return false; |
| 44 | 44 | } |
| 45 | 45 | return true; |
@@ -26,5 +26,5 @@ |
||
| 26 | 26 | admin_show_result_summary(); |
| 27 | 27 | |
| 28 | 28 | admin_page_tail(); |
| 29 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 29 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 30 | 30 | ?> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | row2('<b>'.tra('Search criteria (use one or more)').'</b>', ''); |
| 41 | 41 | row2( |
| 42 | 42 | tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>', |
| 43 | - '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">'); |
|
| 43 | + '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">'); |
|
| 44 | 44 | row2_init(tra('Country'), ''); |
| 45 | 45 | echo '<select class="form-control" name="country"><option value="" selected>---</option>'; |
| 46 | 46 | $country = $params->country; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | echo country_select_options($country); |
| 49 | 49 | echo "</select></td></tr>\n"; |
| 50 | 50 | row2(tra('Type of team'), team_type_select($params->type, true)); |
| 51 | - $checked = $params->active?"checked":""; |
|
| 51 | + $checked = $params->active ? "checked" : ""; |
|
| 52 | 52 | row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>"); |
| 53 | 53 | row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">"); |
| 54 | 54 | end_table(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | row2("Created", date_str($team->create_time)); |
| 97 | 97 | if (defined("SHOW_NONVALIDATED_TEAMS")) { |
| 98 | 98 | $founder = $team->founder; |
| 99 | - row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)"); |
|
| 99 | + row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)"); |
|
| 100 | 100 | } |
| 101 | 101 | if (strlen($team->url)) {; |
| 102 | 102 | if (strstr($team->url, "http://")) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | row1(tra('Members')); |
| 171 | 171 | row2(tra('Founder'), |
| 172 | - $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---" |
|
| 172 | + $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---" |
|
| 173 | 173 | ); |
| 174 | 174 | if (count($team->admins)) { |
| 175 | 175 | $first = true; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | foreach ($deltas as $delta) { |
| 354 | 354 | $u = BoincUser::lookup_id($delta->userid); |
| 355 | 355 | if ($u->teamid == $teamid) { |
| 356 | - $new_members[] = $u; // they might have later quit |
|
| 356 | + $new_members[] = $u; // they might have later quit |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | if (!$user->teamid) return; |
| 437 | 437 | $user->update("teamid=0"); |
| 438 | 438 | $team = BoincTeam::lookup_id($user->teamid); |
| 439 | - if ($team && $team->ping_user==$user->id) { |
|
| 439 | + if ($team && $team->ping_user == $user->id) { |
|
| 440 | 440 | $team->update("ping_user=-ping_user"); |
| 441 | 441 | } |
| 442 | 442 | BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id"); |
@@ -475,34 +475,34 @@ discard block |
||
| 475 | 475 | start_table(); |
| 476 | 476 | row2(tra('Team name, text version').' |
| 477 | 477 | <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>', |
| 478 | - '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">' |
|
| 478 | + '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">' |
|
| 479 | 479 | ); |
| 480 | 480 | row2(tra('Team name, HTML version').' |
| 481 | 481 | <br><p class=\"text-muted\"> |
| 482 | 482 | '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').' |
| 483 | 483 | '.tra('If you don\'t know HTML, leave this box blank.').'</p>', |
| 484 | - '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">' |
|
| 484 | + '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">' |
|
| 485 | 485 | ); |
| 486 | 486 | row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').') |
| 487 | 487 | '.tra('This URL will be linked to from the team\'s page on this site.'), |
| 488 | - '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">' |
|
| 488 | + '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">' |
|
| 489 | 489 | ); |
| 490 | 490 | row2(tra('Description of team').': |
| 491 | 491 | <br><p class=\"text-muted\"> |
| 492 | 492 | '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').' |
| 493 | 493 | </p>', |
| 494 | - '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>' |
|
| 494 | + '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>' |
|
| 495 | 495 | ); |
| 496 | 496 | |
| 497 | - row2(tra('Type of team').':', team_type_select($team?$team->type:null)); |
|
| 497 | + row2(tra('Type of team').':', team_type_select($team ? $team->type : null)); |
|
| 498 | 498 | |
| 499 | 499 | row2_init(tra('Country'), |
| 500 | 500 | '<select class="form-control" name="country">' |
| 501 | 501 | ); |
| 502 | - echo country_select_options($team?$team->country:null); |
|
| 502 | + echo country_select_options($team ? $team->country : null); |
|
| 503 | 503 | |
| 504 | 504 | echo "</select></td></tr>\n"; |
| 505 | - $x = (!$team || $team->joinable)?"checked":""; |
|
| 505 | + $x = (!$team || $team->joinable) ? "checked" : ""; |
|
| 506 | 506 | row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>"); |
| 507 | 507 | // Check if we're using reCaptcha to prevent spam accounts |
| 508 | 508 | // |
@@ -566,12 +566,12 @@ discard block |
||
| 566 | 566 | // |
| 567 | 567 | function new_transfer_request_ok($team, $now) { |
| 568 | 568 | if ($team->ping_user <= 0) { |
| 569 | - if ($team->ping_time < $now - 60 * 86400) { |
|
| 569 | + if ($team->ping_time < $now - 60*86400) { |
|
| 570 | 570 | return true; |
| 571 | 571 | } |
| 572 | 572 | return false; |
| 573 | 573 | } |
| 574 | - if ($team->ping_time < $now - 90 * 86400) { |
|
| 574 | + if ($team->ping_time < $now - 90*86400) { |
|
| 575 | 575 | return true; |
| 576 | 576 | } |
| 577 | 577 | return false; |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | if (!is_valid_country($country)) { |
| 607 | 607 | $country = tra('None'); |
| 608 | 608 | } |
| 609 | - $country = BoincDb::escape_string($country); // for Cote d'Ivoire |
|
| 609 | + $country = BoincDb::escape_string($country); // for Cote d'Ivoire |
|
| 610 | 610 | |
| 611 | 611 | $clause = sprintf( |
| 612 | 612 | "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())", |
@@ -629,6 +629,6 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 632 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 633 | 633 | |
| 634 | 634 | ?> |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | echo tra("Invalid password."); |
| 63 | 63 | } else { |
| 64 | 64 | $passwd_hash = md5($passwd.$email_addr); |
| 65 | - $database_passwd_hash = password_hash($passwd_hash , PASSWORD_DEFAULT); |
|
| 65 | + $database_passwd_hash = password_hash($passwd_hash, PASSWORD_DEFAULT); |
|
| 66 | 66 | $email_addr = BoincDb::escape_string($email_addr); |
| 67 | 67 | $user->email_addr_change_time = time(); |
| 68 | 68 | $result = $user->update( |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } else { |
| 51 | 51 | echo tra("Email address has been reverted.")."<br /><br />".tra("You need to reset your password: ")."<a href=\"".secure_url_base()."get_passwd.php\">".secure_url_base()."get_passwd.php</a>"; |
| 52 | 52 | |
| 53 | - $database_passwd_hash = password_hash(random_string() , PASSWORD_DEFAULT); |
|
| 53 | + $database_passwd_hash = password_hash(random_string(), PASSWORD_DEFAULT); |
|
| 54 | 54 | //Change previous_email |
| 55 | 55 | $result = $tmpuser->update( |
| 56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |
@@ -11,39 +11,39 @@ |
||
| 11 | 11 | BoincToken::insert("(token,userid,type,create_time, expire_time) values ('$token', 0, 'T', $now, $now+3600)"); |
| 12 | 12 | |
| 13 | 13 | $boincTokens = BoincToken::enum("userid=0"); |
| 14 | -foreach($boincTokens as $boincToken) { |
|
| 15 | - echo $boincToken->token . "\n"; |
|
| 16 | - echo $boincToken->userid . "\n"; |
|
| 17 | - echo $boincToken->type . "\n"; |
|
| 18 | - echo $boincToken->create_time . "\n"; |
|
| 19 | - echo $boincToken->expire_time . "\n"; |
|
| 14 | +foreach ($boincTokens as $boincToken) { |
|
| 15 | + echo $boincToken->token."\n"; |
|
| 16 | + echo $boincToken->userid."\n"; |
|
| 17 | + echo $boincToken->type."\n"; |
|
| 18 | + echo $boincToken->create_time."\n"; |
|
| 19 | + echo $boincToken->expire_time."\n"; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | echo "---------------\n"; |
| 23 | 23 | $boincToken = BoincToken::lookup("userid=0"); |
| 24 | -echo $boincToken->token . "\n"; |
|
| 25 | -echo $boincToken->userid . "\n"; |
|
| 26 | -echo $boincToken->type . "\n"; |
|
| 27 | -echo $boincToken->create_time . "\n"; |
|
| 28 | -echo $boincToken->expire_time . "\n"; |
|
| 24 | +echo $boincToken->token."\n"; |
|
| 25 | +echo $boincToken->userid."\n"; |
|
| 26 | +echo $boincToken->type."\n"; |
|
| 27 | +echo $boincToken->create_time."\n"; |
|
| 28 | +echo $boincToken->expire_time."\n"; |
|
| 29 | 29 | |
| 30 | 30 | echo "---------------\n"; |
| 31 | 31 | $boincToken = BoincToken::lookup_valid_token(0, $token, 'T'); |
| 32 | -if ( $boincToken != null ) { |
|
| 32 | +if ($boincToken != null) { |
|
| 33 | 33 | echo "Found valid token\n"; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | echo "---------------\n"; |
| 37 | 37 | $boincToken = BoincToken::lookup_valid_token(0, 'notrealtoken', 'T'); |
| 38 | -if ( $boincToken == null ) { |
|
| 38 | +if ($boincToken == null) { |
|
| 39 | 39 | echo "Successfully didn't find invalid token\n"; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | echo "---------------\n"; |
| 43 | 43 | $user = new BoincUser(); |
| 44 | -$user->id=0; |
|
| 44 | +$user->id = 0; |
|
| 45 | 45 | $token = create_token($user->id, TOKEN_TYPE_DELETE_ACCOUNT, TOKEN_DURATION_ONE_DAY); |
| 46 | -if ( is_valid_token($user->id, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
|
| 46 | +if (is_valid_token($user->id, $token, TOKEN_TYPE_DELETE_ACCOUNT)) { |
|
| 47 | 47 | echo "Successfully created and validated delete account token"; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | function check_passwd_ui($user, $passwd) { |
| 58 | 58 | $passwd_hash = md5($passwd.$user->email_addr); |
| 59 | - if(!check_passwd_hash($user, $passwd_hash)) { |
|
| 59 | + if (!check_passwd_hash($user, $passwd_hash)) { |
|
| 60 | 60 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 61 | 61 | page_head("Password incorrect"); |
| 62 | 62 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | function is_banned_email_addr($email_addr) { |
| 69 | 69 | global $banned_email_domains; |
| 70 | 70 | if (isset($banned_email_domains)) { |
| 71 | - foreach($banned_email_domains as $d) { |
|
| 71 | + foreach ($banned_email_domains as $d) { |
|
| 72 | 72 | $x = strstr($email_addr, $d); |
| 73 | 73 | if ($x == $d) return true; |
| 74 | 74 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // |
| 97 | 97 | function make_user( |
| 98 | 98 | $email_addr, $name, $passwd_hash, |
| 99 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
| 99 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
| 100 | 100 | ) { |
| 101 | 101 | if (!is_valid_email_addr($email_addr)) return null; |
| 102 | 102 | if (is_banned_email_addr($email_addr)) return null; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | show_error(tra("Passwords may only include ASCII characters.")); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if (strlen($passwd)<$min_passwd_length) { |
|
| 231 | + if (strlen($passwd) < $min_passwd_length) { |
|
| 232 | 232 | show_error( |
| 233 | 233 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
| 234 | 234 | ); |