@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ; |
| 59 | 59 | $admins = BoincTeamAdmin::enum("teamid=$teamid"); |
| 60 | 60 | start_table(); |
| 61 | - if (count($admins)==0) { |
|
| 61 | + if (count($admins) == 0) { |
|
| 62 | 62 | row1(tra("There are currently no Team Admins")); |
| 63 | 63 | } else { |
| 64 | 64 | row1(tra("Current Team Admins"), 3); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | function add_admin($team) { |
| 98 | 98 | $email_addr = get_str('email_addr'); |
| 99 | - $email_addr = BoincDb::escape_string($email_addr); |
|
| 99 | + $email_addr = BoincDb::escape_string($email_addr); |
|
| 100 | 100 | $user = BoincUser::lookup("email_addr='$email_addr'"); |
| 101 | 101 | if (!$user) error_page(tra("no such user")); |
| 102 | 102 | if ($user->teamid != $team->id) error_page(tra("User is not member of team")); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | require_founder_login($user, $team); |
| 116 | 116 | |
| 117 | 117 | $action = get_str('action', true); |
| 118 | -switch($action) { |
|
| 118 | +switch ($action) { |
|
| 119 | 119 | case 'remove': |
| 120 | 120 | check_tokens($user->authenticator); |
| 121 | 121 | remove_admin($team); |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | echo $x; |
| 93 | 93 | break; |
| 94 | 94 | } |
| 95 | - echo "</td><td align=right>".format_credit_large($y->credit),"</td><td align=right>$y->nresults</td></tr>\n"; |
|
| 95 | + echo "</td><td align=right>".format_credit_large($y->credit), "</td><td align=right>$y->nresults</td></tr>\n"; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $mode = get_str('mode', true); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | $auth = post_str("auth"); |
| 24 | 24 | $name = post_str("name"); |
| 25 | 25 | |
| 26 | -if (strlen($name)==0) { |
|
| 26 | +if (strlen($name) == 0) { |
|
| 27 | 27 | error_page(tra("You must supply a name for your account")); |
| 28 | 28 | } |
| 29 | 29 | if ($name != sanitize_tags($name)) { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | class LightOpenID |
| 48 | 48 | { |
| 49 | 49 | public $returnUrl |
| 50 | - , $required = array() |
|
| 51 | - , $optional = array() |
|
| 52 | - , $verify_peer = null |
|
| 53 | - , $capath = null |
|
| 54 | - , $cainfo = null; |
|
| 50 | + , $required = array() |
|
| 51 | + , $optional = array() |
|
| 52 | + , $verify_peer = null |
|
| 53 | + , $capath = null |
|
| 54 | + , $cainfo = null; |
|
| 55 | 55 | private $identity, $claimed_id; |
| 56 | 56 | protected $server, $version, $trustRoot, $aliases, $identifier_select = false |
| 57 | 57 | , $ax = false, $sreg = false, $data, $setup_url = null; |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $parsed_url = parse_url($this->claimed_id); |
| 262 | 262 | $this->identity = |
| 263 | 263 | $this->claimed_id = $parsed_url['scheme'] . '://' |
| 264 | - . $parsed_url['host'] |
|
| 265 | - . $headers[$name]; |
|
| 264 | + . $parsed_url['host'] |
|
| 265 | + . $headers[$name]; |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $url = $parts + $url; |
| 303 | 303 | $url = $url['scheme'] . '://' |
| 304 | - . (empty($url['username'])?'' |
|
| 304 | + . (empty($url['username'])?'' |
|
| 305 | 305 | :(empty($url['password'])? "{$url['username']}@" |
| 306 | 306 | :"{$url['username']}:{$url['password']}@")) |
| 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']}"); |
|
| 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']}"); |
|
| 312 | 312 | return $url; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | protected function authUrl_v1($immediate) |
| 535 | 535 | { |
| 536 | - $returnUrl = $this->returnUrl; |
|
| 536 | + $returnUrl = $this->returnUrl; |
|
| 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. |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | ) + $this->sregParams(); |
| 550 | 550 | |
| 551 | 551 | return $this->build_url(parse_url($this->server) |
| 552 | - , array('query' => http_build_query($params, '', '&'))); |
|
| 552 | + , array('query' => http_build_query($params, '', '&'))); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | protected function authUrl_v2($immediate) |
@@ -574,14 +574,14 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | if ($this->identifier_select) { |
| 576 | 576 | $params['openid.identity'] = $params['openid.claimed_id'] |
| 577 | - = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
| 577 | + = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
| 578 | 578 | } else { |
| 579 | 579 | $params['openid.identity'] = $this->identity; |
| 580 | 580 | $params['openid.claimed_id'] = $this->claimed_id; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | return $this->build_url(parse_url($this->server) |
| 584 | - , array('query' => http_build_query($params, '', '&'))); |
|
| 584 | + , array('query' => http_build_query($params, '', '&'))); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -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) { |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | continue; |
| 708 | 708 | } |
| 709 | 709 | $key = substr($this->data['openid_' . $alias . '_type_' . $key], |
| 710 | - strlen('http://axschema.org/')); |
|
| 710 | + strlen('http://axschema.org/')); |
|
| 711 | 711 | $attributes[$key] = $value; |
| 712 | 712 | } |
| 713 | 713 | return $attributes; |
@@ -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 | } |
@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | echo " <beta/>\n"; |
| 49 | 49 | } |
| 50 | 50 | } else { |
| 51 | - $b = $app->beta?" (beta test)":""; |
|
| 51 | + $b = $app->beta ? " (beta test)" : ""; |
|
| 52 | 52 | echo " |
| 53 | 53 | <tr><th class=\"bg-primary\" colspan=4>$app->user_friendly_name$b</th></tr> |
| 54 | 54 | <tr> |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | foreach ($platforms as $platform) { |
| 63 | 63 | $avs = latest_avs_app_platform($app->id, $platform->id); |
| 64 | - foreach($avs as $av) { |
|
| 64 | + foreach ($avs as $av) { |
|
| 65 | 65 | $create_time_f = pretty_time_str($av->create_time); |
| 66 | 66 | if ($xml) { |
| 67 | 67 | echo " <version>\n"; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $gf = $av->expavg_credit/200; |
| 84 | 84 | $total_gf += $gf; |
| 85 | 85 | $gf = number_format($gf, 0); |
| 86 | - $b = $av->beta?" (beta test)":""; |
|
| 86 | + $b = $av->beta ? " (beta test)" : ""; |
|
| 87 | 87 | echo "<tr> |
| 88 | 88 | <td>$platform->user_friendly_name</td> |
| 89 | 89 | <td>$version_num_f$b</td> |
@@ -36,12 +36,12 @@ |
||
| 36 | 36 | |
| 37 | 37 | function hide_explanation() { |
| 38 | 38 | switch (post_int("category", true)) { |
| 39 | - case 1: $c = "Obscene"; break; |
|
| 40 | - case 2: $c = "Flame/Hate mail"; break; |
|
| 41 | - case 3: $c = "Commercial spam"; break; |
|
| 42 | - case 4: $c = "Double post"; break; |
|
| 43 | - case 5: $c = "User Request"; break; |
|
| 44 | - default: $c = "Other"; break; |
|
| 39 | + case 1: $c = "Obscene"; break; |
|
| 40 | + case 2: $c = "Flame/Hate mail"; break; |
|
| 41 | + case 3: $c = "Commercial spam"; break; |
|
| 42 | + case 4: $c = "Double post"; break; |
|
| 43 | + case 5: $c = "User Request"; break; |
|
| 44 | + default: $c = "Other"; break; |
|
| 45 | 45 | } |
| 46 | 46 | $x = "\nYour post was categorized as ".$c; |
| 47 | 47 | $x .= mod_comment(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | function mod_comment() { |
| 28 | 28 | $x = ""; |
| 29 | 29 | $reason = post_str('reason', true); |
| 30 | - if ($reason){ |
|
| 30 | + if ($reason) { |
|
| 31 | 31 | $x .= "\nModerator comment: $reason |
| 32 | 32 | "; |
| 33 | 33 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // See if "action" is provided - either through post or get |
| 64 | 64 | if (!post_str('action', true)) { |
| 65 | - if (!get_str('action', true)){ |
|
| 65 | + if (!get_str('action', true)) { |
|
| 66 | 66 | error_page(tra("You must specify an action...")); |
| 67 | 67 | } else { |
| 68 | 68 | $action = get_str('action'); |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $explanation = null; |
| 75 | -if ($action=="hide"){ |
|
| 75 | +if ($action=="hide") { |
|
| 76 | 76 | $result = hide_post($post, $thread, $forum); |
| 77 | 77 | $action_name = "hidden"; |
| 78 | 78 | $explanation = hide_explanation(); |
| 79 | -} elseif ($action=="unhide"){ |
|
| 79 | +} elseif ($action=="unhide") { |
|
| 80 | 80 | $result = unhide_post($post, $thread, $forum); |
| 81 | 81 | $action_name = "unhidden"; |
| 82 | -} elseif ($action=="delete"){ |
|
| 82 | +} elseif ($action=="delete") { |
|
| 83 | 83 | $result = delete_post($post, $thread, $forum); |
| 84 | 84 | if (!$result) error_page("Can't delete post"); |
| 85 | 85 | page_head("Post deleted"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | page_tail(); |
| 98 | 98 | exit; |
| 99 | -} elseif ($action=="move"){ |
|
| 99 | +} elseif ($action=="move") { |
|
| 100 | 100 | $destid = post_int('threadid'); |
| 101 | 101 | $new_thread = BoincThread::lookup_id($destid); |
| 102 | 102 | if (!$new_thread) error_page("No such thread"); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | "; |
| 118 | 118 | $explanation .= mod_comment(); |
| 119 | 119 | $action_name = "moved to another thread"; |
| 120 | -} elseif ($action=="banish_user"){ |
|
| 120 | +} elseif ($action=="banish_user") { |
|
| 121 | 121 | $auth = false; |
| 122 | 122 | if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) { |
| 123 | 123 | $auth = true; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | function mod_comment() { |
| 28 | 28 | $x = ""; |
| 29 | 29 | $reason = post_str('reason', true); |
| 30 | - if ($reason){ |
|
| 30 | + if ($reason) { |
|
| 31 | 31 | $x .= "\nModerator comment: $reason |
| 32 | 32 | "; |
| 33 | 33 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // See if "action" is provided - either through post or get |
| 64 | 64 | if (!post_str('action', true)) { |
| 65 | - if (!get_str('action', true)){ |
|
| 65 | + if (!get_str('action', true)) { |
|
| 66 | 66 | error_page(tra("You must specify an action...")); |
| 67 | 67 | } else { |
| 68 | 68 | $action = get_str('action'); |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $explanation = null; |
| 75 | -if ($action=="hide"){ |
|
| 75 | +if ($action == "hide") { |
|
| 76 | 76 | $result = hide_post($post, $thread, $forum); |
| 77 | 77 | $action_name = "hidden"; |
| 78 | 78 | $explanation = hide_explanation(); |
| 79 | -} elseif ($action=="unhide"){ |
|
| 79 | +} elseif ($action == "unhide") { |
|
| 80 | 80 | $result = unhide_post($post, $thread, $forum); |
| 81 | 81 | $action_name = "unhidden"; |
| 82 | -} elseif ($action=="delete"){ |
|
| 82 | +} elseif ($action == "delete") { |
|
| 83 | 83 | $result = delete_post($post, $thread, $forum); |
| 84 | 84 | if (!$result) error_page("Can't delete post"); |
| 85 | 85 | page_head("Post deleted"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | page_tail(); |
| 98 | 98 | exit; |
| 99 | -} elseif ($action=="move"){ |
|
| 99 | +} elseif ($action == "move") { |
|
| 100 | 100 | $destid = post_int('threadid'); |
| 101 | 101 | $new_thread = BoincThread::lookup_id($destid); |
| 102 | 102 | if (!$new_thread) error_page("No such thread"); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | "; |
| 118 | 118 | $explanation .= mod_comment(); |
| 119 | 119 | $action_name = "moved to another thread"; |
| 120 | -} elseif ($action=="banish_user"){ |
|
| 120 | +} elseif ($action == "banish_user") { |
|
| 121 | 121 | $auth = false; |
| 122 | 122 | if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) { |
| 123 | 123 | $auth = true; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if (!hosts_compatible($host, $host2, $detail)) continue; |
| 51 | 51 | $hosts[] = $host2; |
| 52 | 52 | $nhosts++; |
| 53 | - if ($nhosts==500) break; |
|
| 53 | + if ($nhosts == 500) break; |
|
| 54 | 54 | } |
| 55 | 55 | if ($nhosts == 1) { |
| 56 | 56 | echo "<br>".tra("No hosts are eligible for merging with this one."); |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | <script> |
| 91 | 91 | function set_all() { |
| 92 | 92 | "; |
| 93 | -for ($i=1; $i<$nhosts; $i++) { |
|
| 93 | +for ($i = 1; $i < $nhosts; $i++) { |
|
| 94 | 94 | echo "document.host_list.id_$i.checked=1;\n"; |
| 95 | 95 | } |
| 96 | 96 | echo " |
| 97 | 97 | } |
| 98 | 98 | function clear_all() { |
| 99 | 99 | "; |
| 100 | -for ($i=1; $i<$nhosts; $i++) { |
|
| 100 | +for ($i = 1; $i < $nhosts; $i++) { |
|
| 101 | 101 | echo "document.host_list.id_$i.checked=0;\n"; |
| 102 | 102 | } |
| 103 | 103 | echo " |
@@ -220,7 +220,7 @@ |
||
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | if ($detail == "low" || $table == "profile") { |
| 223 | - end_table(); |
|
| 223 | + end_table(); |
|
| 224 | 224 | } |
| 225 | 225 | _mysql_free_result($result); |
| 226 | 226 | } else { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | // For display, convert query string characters < and > into 'html form' so |
| 65 | 65 | // that they will be displayed. |
| 66 | 66 | // |
| 67 | -$html_text=str_replace('<', '<', str_replace('>', '>', $main_query)); |
|
| 67 | +$html_text = str_replace('<', '<', str_replace('>', '>', $main_query)); |
|
| 68 | 68 | |
| 69 | 69 | echo "<p>Query: <b>$html_text</b><p>\n"; |
| 70 | 70 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | if ($result) { |
| 160 | 160 | if ($detail == "low") { |
| 161 | 161 | start_table('table-striped'); |
| 162 | - switch($table) { |
|
| 162 | + switch ($table) { |
|
| 163 | 163 | case "result": |
| 164 | 164 | result_short_header(); |
| 165 | 165 | break; |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // TODO: document; use new DB interface |
| 22 | 22 | |
| 23 | -include_once( "../inc/db.inc" ); |
|
| 24 | -include_once( "../inc/util.inc" ); |
|
| 25 | -include_once( "../inc/db_ops.inc" ); |
|
| 26 | -include_once( "../inc/util_ops.inc" ); |
|
| 27 | -include_once( "../inc/prefs.inc" ); |
|
| 23 | +include_once("../inc/db.inc"); |
|
| 24 | +include_once("../inc/util.inc"); |
|
| 25 | +include_once("../inc/db_ops.inc"); |
|
| 26 | +include_once("../inc/util_ops.inc"); |
|
| 27 | +include_once("../inc/prefs.inc"); |
|
| 28 | 28 | |
| 29 | 29 | db_init(); |
| 30 | 30 | |
| 31 | 31 | if (get_int('hostid')) { |
| 32 | - $hostid = get_int( 'hostid' ); |
|
| 32 | + $hostid = get_int('hostid'); |
|
| 33 | 33 | } else { |
| 34 | 34 | error_page("no hostid"); |
| 35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | admin_page_head($title); |
| 41 | 41 | |
| 42 | -if($hostid > 0) { |
|
| 42 | +if ($hostid > 0) { |
|
| 43 | 43 | $result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=".$hostid); |
| 44 | 44 | } |
| 45 | 45 | |