@@ -45,14 +45,15 @@ |
||
45 | 45 | $posts = _mysql_query("select * from post where id>$start_id order by id"); |
46 | 46 | echo _mysql_error(); |
47 | 47 | $i=0; |
48 | - while ($post = _mysql_fetch_object($posts)){ |
|
48 | + while ($post = _mysql_fetch_object($posts)) { |
|
49 | 49 | $i++; |
50 | - if ($i%100 == 0) { //For every 100 posts |
|
50 | + if ($i%100 == 0) { |
|
51 | +//For every 100 posts |
|
51 | 52 | echo $post->id.". "; flush(); // print out where we are |
52 | 53 | //usleep(200000); |
53 | 54 | } |
54 | 55 | |
55 | - if ($post->id > $start_id){ |
|
56 | + if ($post->id > $start_id) { |
|
56 | 57 | fix_post($post); |
57 | 58 | } |
58 | 59 | } |
@@ -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; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | start_table(); |
59 | 59 | table_header("ID", "Name", "Email", "Team", "Country", "Joined"); |
60 | 60 | |
61 | -while ($row = _mysql_fetch_object($result)) { |
|
61 | +while ($row = _mysql_fetch_object($result)) { |
|
62 | 62 | $id = $row->id; |
63 | 63 | $name = $row->name; |
64 | 64 | $email = $row->email_addr; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $email_validated = $row->email_validated; |
68 | 68 | |
69 | 69 | $team_name=""; |
70 | - if($row->teamid > 0){ |
|
70 | + if($row->teamid > 0) { |
|
71 | 71 | $team = BoincTeam::lookup_id($row->teamid); |
72 | 72 | $team_name = $team->name; |
73 | 73 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if ($special_bits != "0") { |
81 | 81 | for ($i = 0; $i < 7; $i++) { |
82 | 82 | $bit = substr($special_bits, $i, 1); |
83 | - if ($bit == '1'){ |
|
83 | + if ($bit == '1') { |
|
84 | 84 | if (!empty($roles)) { |
85 | 85 | $roles .= ", "; |
86 | 86 | } |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | $dt = $user->banished_until - time(); |
98 | 98 | if( $dt > 0 ) { |
99 | 99 | $x = "<span style=\"color: #ff0000\">Currently banished</span>"; |
100 | - } |
|
101 | - else { |
|
100 | + } else { |
|
102 | 101 | $x = "<span style=\"color: #ff9900\">Previously banished</span>"; |
103 | 102 | } |
104 | 103 | $roles .= $x; |
@@ -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"); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | } |
40 | 40 | $format = get_str("format", true); |
41 | 41 | |
42 | -if ($format=="xml"){ |
|
42 | +if ($format=="xml") { |
|
43 | 43 | // don't do caching for XML |
44 | 44 | xml_header(); |
45 | 45 | $retval = db_init_xml(); |
46 | 46 | if ($retval) xml_error($retval); |
47 | - if ($auth){ |
|
47 | + if ($auth) { |
|
48 | 48 | $user = BoincUser::lookup_auth($auth); |
49 | 49 | $show_hosts = true; |
50 | 50 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // |
61 | 61 | $cache_args="userid=".$id; |
62 | 62 | $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args); |
63 | - if ($cached_data){ |
|
63 | + if ($cached_data) { |
|
64 | 64 | // We found some old but non-stale data, let's use it |
65 | 65 | $data = unserialize($cached_data); |
66 | 66 | $user = $data->user; |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $preview = post_str("preview", true); |
54 | 54 | $warning = null; |
55 | 55 | |
56 | -if ($content && $title && (!$preview)){ |
|
57 | - if (post_str('add_signature', true) == "add_it"){ |
|
56 | +if ($content && $title && (!$preview)) { |
|
57 | + if (post_str('add_signature', true) == "add_it") { |
|
58 | 58 | $add_signature = true; // set a flag and concatenate later |
59 | - } else { |
|
59 | + } else { |
|
60 | 60 | $add_signature = false; |
61 | 61 | } |
62 | 62 | check_tokens($logged_in_user->authenticator); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
112 | 112 | } |
113 | 113 | |
114 | -if ($force_title && $title){ |
|
114 | +if ($force_title && $title) { |
|
115 | 115 | row2(tra("Title"), htmlspecialchars($title)."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($title)."\">"); |
116 | 116 | } else { |
117 | 117 | row2(tra("Title").$submit_help, |
@@ -34,7 +34,7 @@ |
||
34 | 34 | // read the list of template filenames |
35 | 35 | // |
36 | 36 | $files = file("../../tree_threader_template_files"); |
37 | - if ($files === false) { |
|
37 | + if ($files === false) { |
|
38 | 38 | fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
39 | 39 | error("no templates file"); |
40 | 40 |
@@ -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 | } |