@@ -41,8 +41,7 @@ |
||
| 41 | 41 | function testquery($argstring) { |
| 42 | 42 | if (0) { |
| 43 | 43 | echo "WOULD DO: $argstring\n"; |
| 44 | - } |
|
| 45 | - else { |
|
| 44 | + } else { |
|
| 46 | 45 | _mysql_query($argstring); |
| 47 | 46 | } |
| 48 | 47 | return; |
@@ -63,7 +63,8 @@ |
||
| 63 | 63 | printf("mean: %e<br>stdev: %e<br>samples: %d", $mean, $stdev, $count); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -function show_stats_hist() { //deprecated |
|
| 66 | +function show_stats_hist() { |
|
| 67 | +//deprecated |
|
| 67 | 68 | global $hist; |
| 68 | 69 | global $quantum; |
| 69 | 70 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | set_time_limit(0); |
| 25 | 25 | |
| 26 | -function cache_check_diskspace2(){ |
|
| 26 | +function cache_check_diskspace2() { |
|
| 27 | 27 | $too_old = 86400; |
| 28 | 28 | while (1) { |
| 29 | 29 | $f = disk_free_space("../cache"); |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | * @copyright Copyright (c) 2010, Mewp |
| 45 | 45 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
| 46 | 46 | */ |
| 47 | -class LightOpenID |
|
| 48 | -{ |
|
| 47 | +class LightOpenID { |
|
| 49 | 48 | public $returnUrl |
| 50 | 49 | , $required = array() |
| 51 | 50 | , $optional = array() |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | 'pref/timezone' => 'timezone', |
| 68 | 67 | ); |
| 69 | 68 | |
| 70 | - function __construct() |
|
| 71 | - { |
|
| 69 | + function __construct() { |
|
| 72 | 70 | $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; |
| 73 | 71 | $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?'); |
| 74 | 72 | $this->returnUrl = $this->trustRoot . $uri; |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | } |
| 81 | 79 | } |
| 82 | 80 | |
| 83 | - function __set($name, $value) |
|
| 84 | - { |
|
| 81 | + function __set($name, $value) { |
|
| 85 | 82 | switch ($name) { |
| 86 | 83 | case 'identity': |
| 87 | 84 | if (strlen($value = trim((String) $value))) { |
@@ -102,8 +99,7 @@ discard block |
||
| 102 | 99 | } |
| 103 | 100 | } |
| 104 | 101 | |
| 105 | - function __get($name) |
|
| 106 | - { |
|
| 102 | + function __get($name) { |
|
| 107 | 103 | switch ($name) { |
| 108 | 104 | case 'identity': |
| 109 | 105 | # We return claimed_id instead of identity, |
@@ -124,8 +120,7 @@ discard block |
||
| 124 | 120 | * @param $url url to check |
| 125 | 121 | * @return true, if the server exists; false otherwise |
| 126 | 122 | */ |
| 127 | - function hostExists($url) |
|
| 128 | - { |
|
| 123 | + function hostExists($url) { |
|
| 129 | 124 | if (strpos($url, '/') === false) { |
| 130 | 125 | $server = $url; |
| 131 | 126 | } else { |
@@ -139,8 +134,7 @@ discard block |
||
| 139 | 134 | return !!gethostbynamel($server); |
| 140 | 135 | } |
| 141 | 136 | |
| 142 | - protected function request_curl($url, $method='GET', $params=array()) |
|
| 143 | - { |
|
| 137 | + protected function request_curl($url, $method='GET', $params=array()) { |
|
| 144 | 138 | $params = http_build_query($params, '', '&'); |
| 145 | 139 | $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : '')); |
| 146 | 140 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); |
@@ -195,8 +189,7 @@ discard block |
||
| 195 | 189 | return $response; |
| 196 | 190 | } |
| 197 | 191 | |
| 198 | - protected function request_streams($url, $method='GET', $params=array()) |
|
| 199 | - { |
|
| 192 | + protected function request_streams($url, $method='GET', $params=array()) { |
|
| 200 | 193 | if(!$this->hostExists($url)) { |
| 201 | 194 | throw new ErrorException('Invalid request.'); |
| 202 | 195 | } |
@@ -285,16 +278,14 @@ discard block |
||
| 285 | 278 | return file_get_contents($url, false, $context); |
| 286 | 279 | } |
| 287 | 280 | |
| 288 | - protected function request($url, $method='GET', $params=array()) |
|
| 289 | - { |
|
| 281 | + protected function request($url, $method='GET', $params=array()) { |
|
| 290 | 282 | if(function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) { |
| 291 | 283 | return $this->request_curl($url, $method, $params); |
| 292 | 284 | } |
| 293 | 285 | return $this->request_streams($url, $method, $params); |
| 294 | 286 | } |
| 295 | 287 | |
| 296 | - protected function build_url($url, $parts) |
|
| 297 | - { |
|
| 288 | + protected function build_url($url, $parts) { |
|
| 298 | 289 | if (isset($url['query'], $parts['query'])) { |
| 299 | 290 | $parts['query'] = $url['query'] . '&' . $parts['query']; |
| 300 | 291 | } |
@@ -316,8 +307,7 @@ discard block |
||
| 316 | 307 | * Helper function used to scan for <meta>/<link> tags and extract information |
| 317 | 308 | * from them |
| 318 | 309 | */ |
| 319 | - protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName) |
|
| 320 | - { |
|
| 310 | + protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName) { |
|
| 321 | 311 | preg_match_all("#<{$tag}[^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*$valueName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1); |
| 322 | 312 | preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2); |
| 323 | 313 | |
@@ -331,8 +321,7 @@ discard block |
||
| 331 | 321 | * @return String OP Endpoint (i.e. OpenID provider address). |
| 332 | 322 | * @throws ErrorException |
| 333 | 323 | */ |
| 334 | - function discover($url) |
|
| 335 | - { |
|
| 324 | + function discover($url) { |
|
| 336 | 325 | if (!$url) throw new ErrorException('No identity supplied.'); |
| 337 | 326 | # Use xri.net proxy to resolve i-name identities |
| 338 | 327 | if (!preg_match('#^https?:#', $url)) { |
@@ -465,8 +454,7 @@ discard block |
||
| 465 | 454 | throw new ErrorException('Endless redirection!'); |
| 466 | 455 | } |
| 467 | 456 | |
| 468 | - protected function sregParams() |
|
| 469 | - { |
|
| 457 | + protected function sregParams() { |
|
| 470 | 458 | $params = array(); |
| 471 | 459 | # We always use SREG 1.1, even if the server is advertising only support for 1.0. |
| 472 | 460 | # That's because it's fully backwards compatibile with 1.0, and some providers |
@@ -492,8 +480,7 @@ discard block |
||
| 492 | 480 | return $params; |
| 493 | 481 | } |
| 494 | 482 | |
| 495 | - protected function axParams() |
|
| 496 | - { |
|
| 483 | + protected function axParams() { |
|
| 497 | 484 | $params = array(); |
| 498 | 485 | if ($this->required || $this->optional) { |
| 499 | 486 | $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0'; |
@@ -531,8 +518,7 @@ discard block |
||
| 531 | 518 | return $params; |
| 532 | 519 | } |
| 533 | 520 | |
| 534 | - protected function authUrl_v1($immediate) |
|
| 535 | - { |
|
| 521 | + protected function authUrl_v1($immediate) { |
|
| 536 | 522 | $returnUrl = $this->returnUrl; |
| 537 | 523 | # If we have an openid.delegate that is different from our claimed id, |
| 538 | 524 | # we need to somehow preserve the claimed id between requests. |
@@ -552,8 +538,7 @@ discard block |
||
| 552 | 538 | , array('query' => http_build_query($params, '', '&'))); |
| 553 | 539 | } |
| 554 | 540 | |
| 555 | - protected function authUrl_v2($immediate) |
|
| 556 | - { |
|
| 541 | + protected function authUrl_v2($immediate) { |
|
| 557 | 542 | $params = array( |
| 558 | 543 | 'openid.ns' => 'http://specs.openid.net/auth/2.0', |
| 559 | 544 | 'openid.mode' => $immediate ? 'checkid_immediate' : 'checkid_setup', |
@@ -590,8 +575,7 @@ discard block |
||
| 590 | 575 | * @param String $select_identifier Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1. |
| 591 | 576 | * @throws ErrorException |
| 592 | 577 | */ |
| 593 | - function authUrl($immediate = false) |
|
| 594 | - { |
|
| 578 | + function authUrl($immediate = false) { |
|
| 595 | 579 | if ($this->setup_url && !$immediate) return $this->setup_url; |
| 596 | 580 | if (!$this->server) $this->discover($this->identity); |
| 597 | 581 | |
@@ -606,8 +590,7 @@ discard block |
||
| 606 | 590 | * @return Bool Whether the verification was successful. |
| 607 | 591 | * @throws ErrorException |
| 608 | 592 | */ |
| 609 | - function validate() |
|
| 610 | - { |
|
| 593 | + function validate() { |
|
| 611 | 594 | # If the request was using immediate mode, a failure may be reported |
| 612 | 595 | # by presenting user_setup_url (for 1.1) or reporting |
| 613 | 596 | # mode 'setup_needed' (for 2.0). Also catching all modes other than |
@@ -668,12 +651,12 @@ discard block |
||
| 668 | 651 | return preg_match('/is_valid\s*:\s*true/i', $response); |
| 669 | 652 | } |
| 670 | 653 | |
| 671 | - protected function getAxAttributes() |
|
| 672 | - { |
|
| 654 | + protected function getAxAttributes() { |
|
| 673 | 655 | $alias = null; |
| 674 | 656 | if (isset($this->data['openid_ns_ax']) |
| 675 | 657 | && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0' |
| 676 | - ) { # It's the most likely case, so we'll check it before |
|
| 658 | + ) { |
|
| 659 | +# It's the most likely case, so we'll check it before |
|
| 677 | 660 | $alias = 'ax'; |
| 678 | 661 | } else { |
| 679 | 662 | # 'ax' prefix is either undefined, or points to another extension, |
@@ -713,8 +696,7 @@ discard block |
||
| 713 | 696 | return $attributes; |
| 714 | 697 | } |
| 715 | 698 | |
| 716 | - protected function getSregAttributes() |
|
| 717 | - { |
|
| 699 | + protected function getSregAttributes() { |
|
| 718 | 700 | $attributes = array(); |
| 719 | 701 | $sreg_to_ax = array_flip(self::$ax_to_sreg); |
| 720 | 702 | foreach ($this->data as $key => $value) { |
@@ -741,11 +723,11 @@ discard block |
||
| 741 | 723 | * * @return Array Array of attributes with keys being the AX schema names, e.g. 'contact/email' |
| 742 | 724 | * @see http://www.axschema.org/types/ |
| 743 | 725 | */ |
| 744 | - function getAttributes() |
|
| 745 | - { |
|
| 726 | + function getAttributes() { |
|
| 746 | 727 | if (isset($this->data['openid_ns']) |
| 747 | 728 | && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0' |
| 748 | - ) { # OpenID 2.0 |
|
| 729 | + ) { |
|
| 730 | +# OpenID 2.0 |
|
| 749 | 731 | # We search for both AX and SREG attributes, with AX taking precedence. |
| 750 | 732 | return $this->getAxAttributes() + $this->getSregAttributes(); |
| 751 | 733 | } |
@@ -92,7 +92,8 @@ |
||
| 92 | 92 | |
| 93 | 93 | $navailable_users = 0; |
| 94 | 94 | foreach ($users as $user) { |
| 95 | - if ($user->id != $team->userid) { //don't show current founder |
|
| 95 | + if ($user->id != $team->userid) { |
|
| 96 | +//don't show current founder |
|
| 96 | 97 | $user_total_credit = format_credit($user->total_credit); |
| 97 | 98 | $user_expavg_credit = format_credit($user->expavg_credit); |
| 98 | 99 | $selected = ($user->id == $team->ping_user)?"selected":""; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // Do we have the data in cache? |
| 93 | 93 | // |
| 94 | - if ($cacheddata){ |
|
| 94 | + if ($cacheddata) { |
|
| 95 | 95 | $data = unserialize($cacheddata); // use the cached data |
| 96 | 96 | } else { |
| 97 | 97 | //if not do queries etc to generate new data |
@@ -122,7 +122,8 @@ discard block |
||
| 122 | 122 | echo "<a href=top_users.php?sort_by=$sort_by&offset=$new_offset>".tra("Previous %1", $users_per_page)."</a> · "; |
| 123 | 123 | |
| 124 | 124 | } |
| 125 | -if ($n==$users_per_page){ //If we aren't on the last page |
|
| 125 | +if ($n==$users_per_page) { |
|
| 126 | +//If we aren't on the last page |
|
| 126 | 127 | $new_offset = $offset + $users_per_page; |
| 127 | 128 | echo "<a href=top_users.php?sort_by=$sort_by&offset=$new_offset>".tra("Next %1", $users_per_page)."</a>"; |
| 128 | 129 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | $cache_args = "userid=$userid"; |
| 46 | 46 | $cacheddata = get_cached_data(USER_PROFILE_TTL, $cache_args); |
| 47 | -if ($cacheddata){ |
|
| 47 | +if ($cacheddata) { |
|
| 48 | 48 | // Already got a cached version of the information |
| 49 | 49 | $community_links_object = unserialize($cacheddata); |
| 50 | 50 | } else { |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | // Action part |
| 52 | 52 | // |
| 53 | 53 | $success_page=0; |
| 54 | -if (get_str("submit",true)){ |
|
| 54 | +if (get_str("submit",true)) { |
|
| 55 | 55 | check_tokens($user->authenticator); |
| 56 | 56 | $reason = get_str("reason"); |
| 57 | - if (send_report_post_email($user, $forum, $thread, $post, $reason)){ |
|
| 57 | + if (send_report_post_email($user, $forum, $thread, $post, $reason)) { |
|
| 58 | 58 | $success_page=1; |
| 59 | 59 | } else { |
| 60 | 60 | echo "send email failed"; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | .tra("A moderator will now look at your report and decide what will happen - this may take a little while, so please be patient"); |
| 73 | 73 | |
| 74 | 74 | echo "<p><a href=\"forum_thread.php?id=$thread->id&postid=$post->id\">".tra("Return to thread")."</a>"; |
| 75 | -} elseif ($success_page==0){ |
|
| 75 | +} elseif ($success_page==0) { |
|
| 76 | 76 | page_head(tra("Report a forum post")); |
| 77 | 77 | if (!$no_forum_rating) { |
| 78 | 78 | echo "<p>".tra("Before reporting this post, consider using the +/- rating system instead. If enough users rate a post negatively it will eventually be hidden.<br />You can find the rating system at the bottom of the post.")."</p> |
@@ -52,7 +52,8 @@ |
||
| 52 | 52 | echo "<teams>\n"; |
| 53 | 53 | $total = 0; |
| 54 | 54 | foreach ($team_id_array as $team_id) { |
| 55 | - if (is_numeric($team_id)) { //make sure only numbers get through |
|
| 55 | + if (is_numeric($team_id)) { |
|
| 56 | +//make sure only numbers get through |
|
| 56 | 57 | $team = BoincTeam::lookup_id($team_id); |
| 57 | 58 | if ($team) { |
| 58 | 59 | show_team_xml($team); |