@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | // |
| 34 | 34 | $config = get_config(); |
| 35 | 35 | global $master_url; |
| 36 | -$master_url = parse_config($config , "<master_url>"); |
|
| 36 | +$master_url = parse_config($config, "<master_url>"); |
|
| 37 | 37 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
| 38 | 38 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
| 39 | 39 | |
| 40 | 40 | // Set parameters to defaults if not defined in config.xml |
| 41 | 41 | |
| 42 | 42 | $x = parse_config($config, "<user_country>"); |
| 43 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
| 43 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
| 44 | 44 | |
| 45 | 45 | $x = parse_config($config, "<user_url>"); |
| 46 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
| 46 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
| 47 | 47 | |
| 48 | 48 | // Set parameters to defaults if not defined in project.inc |
| 49 | 49 | |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | function url_base() { |
| 142 | - return is_https()?secure_url_base():URL_BASE; |
|
| 142 | + return is_https() ?secure_url_base() : URL_BASE; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
| 145 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
| 146 | 146 | global $master_url; |
| 147 | 147 | |
| 148 | 148 | // the following allows independent login for projects on the same server |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | $path = substr($path, 0, -1); |
| 154 | 154 | $path .= "_ops/"; |
| 155 | 155 | } |
| 156 | - $expire = $permanent?time()+3600*24*365:0; |
|
| 156 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
| 157 | 157 | setcookie($name, $value, $expire, $path); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | -function clear_cookie($name, $ops=false) { |
|
| 160 | +function clear_cookie($name, $ops = false) { |
|
| 161 | 161 | global $master_url; |
| 162 | 162 | $url = parse_url($master_url); |
| 163 | 163 | $path = $url['path']; |
@@ -165,13 +165,13 @@ discard block |
||
| 165 | 165 | $path = substr($path, 0, -1); |
| 166 | 166 | $path .= "_ops/"; |
| 167 | 167 | } |
| 168 | - setcookie($name, '', time()-3600, $path); |
|
| 168 | + setcookie($name, '', time() - 3600, $path); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $g_logged_in_user = null; |
| 172 | 172 | $got_logged_in_user = false; |
| 173 | 173 | |
| 174 | -function get_logged_in_user($must_be_logged_in=true) { |
|
| 174 | +function get_logged_in_user($must_be_logged_in = true) { |
|
| 175 | 175 | global $g_logged_in_user, $got_logged_in_user; |
| 176 | 176 | if ($got_logged_in_user) { |
| 177 | 177 | // this could have been called earlier with $must_be_logged_in false |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $next_url = $_SERVER['REQUEST_URI']; |
| 198 | 198 | $n = strrpos($next_url, "/"); |
| 199 | 199 | if ($n) { |
| 200 | - $next_url = substr($next_url, $n+1); |
|
| 200 | + $next_url = substr($next_url, $n + 1); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | $next_url = urlencode($next_url); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | return $g_logged_in_user; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | -function show_login_info($prefix="") { |
|
| 211 | +function show_login_info($prefix = "") { |
|
| 212 | 212 | $user = get_logged_in_user(false); |
| 213 | 213 | if ($user) { |
| 214 | 214 | $url_tokens = url_tokens($user->authenticator); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | -$cache_control_extra=""; |
|
| 221 | +$cache_control_extra = ""; |
|
| 222 | 222 | $is_login_page = false; |
| 223 | 223 | |
| 224 | 224 | // Call this to start pages. |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | // with an existing web framework can more easily do so. |
| 231 | 231 | // To do so, define page_head() in the project include file. |
| 232 | 232 | // |
| 233 | -if (!function_exists("page_head")){ |
|
| 233 | +if (!function_exists("page_head")) { |
|
| 234 | 234 | function page_head( |
| 235 | 235 | $title, |
| 236 | 236 | // page title. Put in <title>, used as title for browser tab. |
| 237 | - $body_attrs=null, |
|
| 237 | + $body_attrs = null, |
|
| 238 | 238 | // <body XXXX> |
| 239 | 239 | // e.g. Javascript to put focus in an input field |
| 240 | 240 | // (onload="document.form.foo.focus()") |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | // if set, include schedulers.txt. |
| 244 | 244 | // also pass to project_banner() in case you want a different |
| 245 | 245 | // header for your main page. |
| 246 | - $url_prefix="", |
|
| 246 | + $url_prefix = "", |
|
| 247 | 247 | // prepend this to links. |
| 248 | 248 | // Use for web pages not in the top directory |
| 249 | - $head_extra=null |
|
| 249 | + $head_extra = null |
|
| 250 | 250 | // extra stuff to put in <head>. E.g.: |
| 251 | 251 | // reCAPTCHA code (create_profile.php) |
| 252 | 252 | // bbcode javascript (forums) |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | header("Content-type: text/html; charset=utf-8"); |
| 269 | 269 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
| 270 | 270 | // Date in the past |
| 271 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
| 271 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
| 272 | 272 | // always modified |
| 273 | 273 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
| 274 | 274 | // for HTTP/1.1 |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | if ($head_extra) { |
| 290 | 290 | echo "\n$head_extra\n"; |
| 291 | 291 | } |
| 292 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
| 292 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
| 293 | 293 | readfile("schedulers.txt"); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $t = $title?$title:PROJECT; |
|
| 296 | + $t = $title ? $title : PROJECT; |
|
| 297 | 297 | echo "<title>$t</title>\n"; |
| 298 | 298 | echo ' |
| 299 | 299 | <meta charset="utf-8"> |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | echo '<div class="container-fluid"> |
| 351 | 351 | '; |
| 352 | 352 | |
| 353 | - switch($title) { //kludge |
|
| 353 | + switch ($title) { //kludge |
|
| 354 | 354 | case tra("Log in"): |
| 355 | 355 | case tra("Create an account"): |
| 356 | 356 | case tra("Server status page"): |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // See the comments for page_head() |
| 367 | 367 | // |
| 368 | -if (!function_exists("page_tail")){ |
|
| 368 | +if (!function_exists("page_tail")) { |
|
| 369 | 369 | function page_tail( |
| 370 | - $show_date=false, |
|
| 370 | + $show_date = false, |
|
| 371 | 371 | // true for pages that are generated periodically rather than on the fly |
| 372 | - $url_prefix="", |
|
| 372 | + $url_prefix = "", |
|
| 373 | 373 | // use for pages not at top level |
| 374 | - $is_main=false |
|
| 374 | + $is_main = false |
|
| 375 | 375 | // passed to project_footer; |
| 376 | 376 | ) { |
| 377 | 377 | echo "<br>\n"; |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | -function display_cvs_versions(){ |
|
| 389 | +function display_cvs_versions() { |
|
| 390 | 390 | global $cvs_version_tracker; |
| 391 | 391 | echo "\n<!-- SVN VERSIONS -->\n"; |
| 392 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
| 392 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
| 393 | 393 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -414,24 +414,24 @@ discard block |
||
| 414 | 414 | // convert time interval in seconds to a string of the form |
| 415 | 415 | // 'D days h hours m min s sec'. |
| 416 | 416 | |
| 417 | -function time_diff($x, $res=3) { |
|
| 417 | +function time_diff($x, $res = 3) { |
|
| 418 | 418 | $x = (int)$x; |
| 419 | 419 | $days = (int)($x/86400); |
| 420 | - $hours = (int)(($x-$days*86400)/3600); |
|
| 421 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
| 422 | - $seconds = $x % 60; |
|
| 420 | + $hours = (int)(($x - $days*86400)/3600); |
|
| 421 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
| 422 | + $seconds = $x%60; |
|
| 423 | 423 | |
| 424 | 424 | $s = ""; |
| 425 | 425 | if ($days) { |
| 426 | 426 | $s .= "$days ".tra("days")." "; |
| 427 | 427 | } |
| 428 | - if ($res>0 && ($hours || strlen($s))) { |
|
| 428 | + if ($res > 0 && ($hours || strlen($s))) { |
|
| 429 | 429 | $s .= "$hours ".tra("hours")." "; |
| 430 | 430 | } |
| 431 | - if ($res>1 && ($minutes || strlen($s))) { |
|
| 431 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
| 432 | 432 | $s .= "$minutes ".tra("min")." "; |
| 433 | 433 | } |
| 434 | - if ($res>2) { |
|
| 434 | + if ($res > 2) { |
|
| 435 | 435 | $s .= "$seconds ".tra("sec")." "; |
| 436 | 436 | } |
| 437 | 437 | return $s; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | function time_str($x) { |
| 447 | 447 | if ($x == 0) return "---"; |
| 448 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
| 448 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | function local_time_str($x) { |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | return time_str($x); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | -function start_table_str($class="", $style="") { |
|
| 461 | - $s = $style?'style="'.$style.'"':''; |
|
| 460 | +function start_table_str($class = "", $style = "") { |
|
| 461 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
| 462 | 462 | return '<div class="table"> |
| 463 | 463 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
| 464 | 464 | '; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -function start_table($class="", $style="") { |
|
| 467 | +function start_table($class = "", $style = "") { |
|
| 468 | 468 | echo start_table_str($class, $style); |
| 469 | 469 | } |
| 470 | 470 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | echo "</tr>\n"; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | -function row1($x, $ncols=2, $class="heading") { |
|
| 512 | +function row1($x, $ncols = 2, $class = "heading") { |
|
| 513 | 513 | if ($class == "heading") { |
| 514 | 514 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
| 515 | 515 | } else { |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | // a table row with 2 columns, with the left on right-aligned |
| 525 | 525 | |
| 526 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
| 527 | - if ($x==="") $x="<br>"; |
|
| 528 | - if ($y==="") $y="<br>"; |
|
| 529 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 526 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
| 527 | + if ($x === "") $x = "<br>"; |
|
| 528 | + if ($y === "") $y = "<br>"; |
|
| 529 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 530 | 530 | echo "<tr> |
| 531 | 531 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
| 532 | 532 | <td $attrs >$y</td> |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | // output the first part of row2(); |
| 538 | 538 | // then write the content, followed by </td></tr> |
| 539 | 539 | |
| 540 | -function row2_init($x, $lwidth='40%') { |
|
| 540 | +function row2_init($x, $lwidth = '40%') { |
|
| 541 | 541 | echo sprintf('<tr> |
| 542 | 542 | <td width="%s" %s>%s</td> |
| 543 | 543 | <td %s>', |
@@ -557,27 +557,27 @@ discard block |
||
| 557 | 557 | echo "<tr>\n"; |
| 558 | 558 | $i = 0; |
| 559 | 559 | foreach ($x as $h) { |
| 560 | - $a = $attrs?$attrs[$i]:""; |
|
| 560 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 561 | 561 | echo "<td $a>$h</td>\n"; |
| 562 | 562 | $i++; |
| 563 | 563 | } |
| 564 | 564 | echo "</tr>\n"; |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 567 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 568 | 568 | |
| 569 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
| 569 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
| 570 | 570 | echo "<tr>"; |
| 571 | 571 | $i = 0; |
| 572 | 572 | foreach ($x as $h) { |
| 573 | - $a = $attrs?$attrs[$i]:""; |
|
| 573 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 574 | 574 | echo "<th $a class=\"$class\">$h</th>"; |
| 575 | 575 | $i++; |
| 576 | 576 | } |
| 577 | 577 | echo "</tr>\n"; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | -function row_heading($x, $class='bg-primary') { |
|
| 580 | +function row_heading($x, $class = 'bg-primary') { |
|
| 581 | 581 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
| 582 | 582 | ', $class, $x |
| 583 | 583 | ); |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
| 638 | 638 | // is cut short. |
| 639 | 639 | |
| 640 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
| 640 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
| 641 | 641 | $words = explode($delimiter, $sentence); |
| 642 | 642 | $total_chars = 0; |
| 643 | 643 | $trunc = false; |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | |
| 721 | 721 | // returns null if the arg is optional and missing |
| 722 | 722 | // |
| 723 | -function get_int($name, $optional=false) { |
|
| 724 | - $x=null; |
|
| 723 | +function get_int($name, $optional = false) { |
|
| 724 | + $x = null; |
|
| 725 | 725 | if (isset($_GET[$name])) $x = $_GET[$name]; |
| 726 | 726 | if (!is_numeric($x)) { |
| 727 | 727 | if ($optional) { |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | // returns null if the arg is optional and missing |
| 742 | 742 | // |
| 743 | -function post_num($name, $optional=false) { |
|
| 743 | +function post_num($name, $optional = false) { |
|
| 744 | 744 | $x = null; |
| 745 | 745 | if (isset($_POST[$name])) $x = $_POST[$name]; |
| 746 | 746 | if (!is_numeric($x)) { |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | // returns null if the arg is optional and missing |
| 757 | 757 | // |
| 758 | -function post_int($name, $optional=false) { |
|
| 758 | +function post_int($name, $optional = false) { |
|
| 759 | 759 | $x = post_num($name, $optional); |
| 760 | 760 | if (is_null($x)) return null; |
| 761 | 761 | $y = (int)$x; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | -function get_str($name, $optional=false) { |
|
| 776 | +function get_str($name, $optional = false) { |
|
| 777 | 777 | if (isset($_GET[$name])) { |
| 778 | 778 | $x = $_GET[$name]; |
| 779 | 779 | } else { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | return undo_magic_quotes($x); |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | -function post_str($name, $optional=false) { |
|
| 788 | +function post_str($name, $optional = false) { |
|
| 789 | 789 | if (isset($_POST[$name])) { |
| 790 | 790 | $x = $_POST[$name]; |
| 791 | 791 | } else { |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | return undo_magic_quotes($x); |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | -function post_arr($name, $optional=false) { |
|
| 800 | +function post_arr($name, $optional = false) { |
|
| 801 | 801 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
| 802 | 802 | $x = $_POST[$name]; |
| 803 | 803 | } else { |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | // the mb_* functions are not included by default |
| 814 | 814 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
| 815 | 815 | |
| 816 | - for ($i=0; $i<strlen($str); $i++) { |
|
| 816 | + for ($i = 0; $i < strlen($str); $i++) { |
|
| 817 | 817 | $c = ord(substr($str, $i)); |
| 818 | 818 | if ($c < 32 || $c > 127) return false; |
| 819 | 819 | } |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
| 838 | 838 | // if no value was entered and this is ok |
| 839 | 839 | // |
| 840 | - if ($number=='' && !$low) return true; |
|
| 840 | + if ($number == '' && !$low) return true; |
|
| 841 | 841 | |
| 842 | 842 | // the supplied value contains alphabetic characters |
| 843 | 843 | // |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // Generate a "select" element from an array of values |
| 856 | 856 | // |
| 857 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
| 857 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
| 858 | 858 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
| 859 | 859 | |
| 860 | 860 | foreach ($array as $key => $value) { |
@@ -879,8 +879,8 @@ discard block |
||
| 879 | 879 | return $str; |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | -function strip_bbcode($string){ |
|
| 883 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
| 882 | +function strip_bbcode($string) { |
|
| 883 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | function current_url() { |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | // @params extra Additional text in href tag |
| 910 | 910 | // |
| 911 | 911 | |
| 912 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
| 912 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
| 913 | 913 | if (!$desc) { |
| 914 | 914 | $desc = $text; |
| 915 | 915 | } |
@@ -921,19 +921,19 @@ discard block |
||
| 921 | 921 | ); |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
| 924 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
| 925 | 925 | echo button_text($url, $text, $desc, $class, $extra); |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | // for places with a bunch of buttons, like forum posts |
| 929 | 929 | // |
| 930 | -function show_button_small($url, $text, $desc=null) { |
|
| 930 | +function show_button_small($url, $text, $desc = null) { |
|
| 931 | 931 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | // used for showing icons |
| 935 | 935 | // |
| 936 | -function show_image($src, $title, $alt, $height=null) { |
|
| 936 | +function show_image($src, $title, $alt, $height = null) { |
|
| 937 | 937 | $h = ""; |
| 938 | 938 | if ($height) { |
| 939 | 939 | $h = "height=\"$height\""; |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | // tries instead to connect to <replica_db_host> if tag exists. |
| 971 | 971 | // DEPRECATED - use boinc_db.inc |
| 972 | 972 | // |
| 973 | -function db_init($try_replica=false) { |
|
| 973 | +function db_init($try_replica = false) { |
|
| 974 | 974 | check_web_stopped(); |
| 975 | 975 | $retval = db_init_aux($try_replica); |
| 976 | 976 | if ($retval == 1) { |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | // Check this to avoid XSS vulnerability |
| 1087 | 1087 | // |
| 1088 | 1088 | function sanitize_sort_by($x) { |
| 1089 | - switch($x) { |
|
| 1089 | + switch ($x) { |
|
| 1090 | 1090 | case 'expavg_credit': |
| 1091 | 1091 | case 'total_credit': |
| 1092 | 1092 | return; |
@@ -1103,9 +1103,9 @@ discard block |
||
| 1103 | 1103 | return $c/(200/24); |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | -function do_download($path,$name="") { |
|
| 1107 | - if (strcmp($name,"") == 0) { |
|
| 1108 | - $name=basename($path); |
|
| 1106 | +function do_download($path, $name = "") { |
|
| 1107 | + if (strcmp($name, "") == 0) { |
|
| 1108 | + $name = basename($path); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | header('Content-Description: File Transfer'); |
| 1111 | 1111 | header('Content-Type: application/octet-stream'); |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | header('Expires: 0'); |
| 1115 | 1115 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 1116 | 1116 | header('Pragma: public'); |
| 1117 | - header('Content-Length: ' . filesize($path)); |
|
| 1117 | + header('Content-Length: '.filesize($path)); |
|
| 1118 | 1118 | flush(); |
| 1119 | 1119 | readfile($path); |
| 1120 | 1120 | } |
@@ -1163,10 +1163,10 @@ discard block |
||
| 1163 | 1163 | // Otherwise return 0. |
| 1164 | 1164 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1165 | 1165 | // |
| 1166 | -function boinc_client_version(){ |
|
| 1166 | +function boinc_client_version() { |
|
| 1167 | 1167 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1168 | 1168 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1169 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1169 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1170 | 1170 | if (preg_match($e, $x, $matches)) { |
| 1171 | 1171 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
| 1172 | 1172 | } |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | $rem_name = $name."_remaining"; |
| 1196 | 1196 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
| 1197 | 1197 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
| 1198 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1198 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1199 | 1199 | ; |
| 1200 | 1200 | } |
| 1201 | 1201 | |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | // use the following around text with long lines, |
| 1226 | 1226 | // to limit the width and make it more readable. |
| 1227 | 1227 | // |
| 1228 | -function text_start($width=640) { |
|
| 1228 | +function text_start($width = 640) { |
|
| 1229 | 1229 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
| 1230 | 1230 | } |
| 1231 | 1231 | function text_end() { |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | function cert_filename() { |
| 1254 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
| 1254 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | // if user hasn't validated their email addr, tell them to |
@@ -1268,6 +1268,6 @@ discard block |
||
| 1268 | 1268 | } |
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 1271 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 1272 | 1272 | |
| 1273 | 1273 | ?> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | function check_passwd_ui($user, $passwd) { |
| 59 | 59 | $passwd_hash = md5($passwd.$user->email_addr); |
| 60 | - if(!check_passwd_hash($user, $passwd_hash)) { |
|
| 60 | + if (!check_passwd_hash($user, $passwd_hash)) { |
|
| 61 | 61 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 62 | 62 | page_head("Password incorrect"); |
| 63 | 63 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | function is_banned_email_addr($email_addr) { |
| 70 | 70 | global $banned_email_domains; |
| 71 | 71 | if (isset($banned_email_domains)) { |
| 72 | - foreach($banned_email_domains as $d) { |
|
| 72 | + foreach ($banned_email_domains as $d) { |
|
| 73 | 73 | $x = strstr($email_addr, $d); |
| 74 | 74 | if ($x == $d) return true; |
| 75 | 75 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | // |
| 109 | 109 | function make_user( |
| 110 | 110 | $email_addr, $name, $passwd_hash, |
| 111 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
| 111 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
| 112 | 112 | ) { |
| 113 | 113 | if (!is_valid_email_addr($email_addr)) return null; |
| 114 | 114 | if (is_banned_email_addr($email_addr)) return null; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $users = BoincUser::enum( |
| 243 | 243 | sprintf("name like '%s%%'", $new_name) |
| 244 | 244 | ); |
| 245 | - foreach ($users as $u){ |
|
| 245 | + foreach ($users as $u) { |
|
| 246 | 246 | echo "<p>$u->name\n"; |
| 247 | 247 | } |
| 248 | 248 | page_tail(); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | show_error(tra("Passwords may only include ASCII characters.")); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if (strlen($passwd)<$min_passwd_length) { |
|
| 275 | + if (strlen($passwd) < $min_passwd_length) { |
|
| 276 | 276 | show_error( |
| 277 | 277 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
| 278 | 278 | ); |
@@ -242,7 +242,7 @@ |
||
| 242 | 242 | $users = BoincUser::enum( |
| 243 | 243 | sprintf("name like '%s%%'", $new_name) |
| 244 | 244 | ); |
| 245 | - foreach ($users as $u){ |
|
| 245 | + foreach ($users as $u) { |
|
| 246 | 246 | echo "<p>$u->name\n"; |
| 247 | 247 | } |
| 248 | 248 | page_tail(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | BoincForumPrefs::lookup($user); |
| 31 | 31 | |
| 32 | -if (post_str("action", true)=="reset_confirm"){ |
|
| 32 | +if (post_str("action", true) == "reset_confirm") { |
|
| 33 | 33 | page_head(tra("Confirm reset")); |
| 34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
| 35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // If the user has requested a reset of preferences; |
| 46 | 46 | // preserve a few fields. |
| 47 | 47 | // |
| 48 | -if (post_str("action", true)=="reset"){ |
|
| 48 | +if (post_str("action", true) == "reset") { |
|
| 49 | 49 | $posts = $user->prefs->posts; |
| 50 | 50 | $last_post = $user->prefs->last_post; |
| 51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -67,30 +67,30 @@ discard block |
||
| 67 | 67 | if (!DISABLE_FORUMS) { |
| 68 | 68 | |
| 69 | 69 | $avatar_type = post_int("avatar_select"); |
| 70 | -$newfile=IMAGE_PATH.$user->id."_avatar.jpg"; |
|
| 70 | +$newfile = IMAGE_PATH.$user->id."_avatar.jpg"; |
|
| 71 | 71 | |
| 72 | 72 | // Update the user avatar |
| 73 | -if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
|
| 74 | -if ($avatar_type==0){ |
|
| 75 | - if (file_exists($newfile)){ |
|
| 73 | +if ($avatar_type < 0 or $avatar_type > 3) $avatar_type = 0; |
|
| 74 | +if ($avatar_type == 0) { |
|
| 75 | + if (file_exists($newfile)) { |
|
| 76 | 76 | // Delete the file on the server if the user |
| 77 | 77 | // decides not to use an avatar |
| 78 | 78 | // |
| 79 | 79 | unlink($newfile); |
| 80 | 80 | } |
| 81 | - $avatar_url=""; |
|
| 81 | + $avatar_url = ""; |
|
| 82 | 82 | } elseif ($avatar_type == 1) { |
| 83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
| 84 | -} elseif ($avatar_type==2){ |
|
| 85 | - if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
|
| 86 | - if ($_FILES['picture']['tmp_name']!="") { |
|
| 84 | +} elseif ($avatar_type == 2) { |
|
| 85 | + if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name'] != "")) { |
|
| 86 | + if ($_FILES['picture']['tmp_name'] != "") { |
|
| 87 | 87 | $file = $_FILES['picture']['tmp_name']; |
| 88 | 88 | } else { |
| 89 | 89 | // Remote image. Download and store locally |
| 90 | 90 | $file = post_str("avatar_url"); |
| 91 | 91 | } |
| 92 | 92 | $size = getImageSize($file); |
| 93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
| 93 | + if ($size[2] != 2 and $size[2] != 3) { |
|
| 94 | 94 | //Not the right kind of file |
| 95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
| 96 | 96 | } |
@@ -99,30 +99,30 @@ discard block |
||
| 99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
| 100 | 100 | ImageJPEG($image2, $newfile); |
| 101 | 101 | } |
| 102 | - if (file_exists($newfile)){ |
|
| 103 | - $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
|
| 102 | + if (file_exists($newfile)) { |
|
| 103 | + $avatar_url = IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
|
| 104 | 104 | } else { |
| 105 | 105 | //User didn't upload a compatible file or it went lost on the server |
| 106 | - $avatar_url=""; |
|
| 106 | + $avatar_url = ""; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"]!="")?1:0; |
|
| 111 | -$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"]!="")?1:0; |
|
| 112 | -$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"]!="")?1:0; |
|
| 113 | -$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"]!="")?1:0; |
|
| 114 | -$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"]!="")?1:0; |
|
| 115 | -$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"]!="")?1:0; |
|
| 116 | -$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"]!="")?1:0; |
|
| 117 | -$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"]!="")?0:1; |
|
| 110 | +$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"] != "") ? 1 : 0; |
|
| 111 | +$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"] != "") ? 1 : 0; |
|
| 112 | +$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"] != "") ? 1 : 0; |
|
| 113 | +$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"] != "") ? 1 : 0; |
|
| 114 | +$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"] != "") ? 1 : 0; |
|
| 115 | +$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"] != "") ? 1 : 0; |
|
| 116 | +$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"] != "") ? 1 : 0; |
|
| 117 | +$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"] != "") ? 0 : 1; |
|
| 118 | 118 | $signature = post_str("signature", true); |
| 119 | -if (strlen($signature)>250) { |
|
| 119 | +if (strlen($signature) > 250) { |
|
| 120 | 120 | error_page(tra("Your signature was too long, please keep it less than 250 characters.")); |
| 121 | 121 | } |
| 122 | 122 | $forum_sort = post_int("forum_sort"); |
| 123 | 123 | $thread_sort = post_int("thread_sort"); |
| 124 | 124 | $display_wrap_postcount = post_int("forum_display_wrap_postcount"); |
| 125 | -if ($display_wrap_postcount<1) $display_wrap_postcount=1; |
|
| 125 | +if ($display_wrap_postcount < 1) $display_wrap_postcount = 1; |
|
| 126 | 126 | |
| 127 | 127 | $signature = BoincDb::escape_string($signature); |
| 128 | 128 | |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | } else { |
| 143 | 143 | // todo: clean up the following |
| 144 | - $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
|
| 145 | - if ($add_user_to_filter){ |
|
| 144 | + $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"] != ""); |
|
| 145 | + if ($add_user_to_filter) { |
|
| 146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
| 147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
| 147 | + if ($user_to_add != "" and $user_to_add == strval(intval($user_to_add))) { |
|
| 148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
| 149 | 149 | if (!$other_user) { |
| 150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | // |
| 160 | 160 | $ignored_users = get_ignored_list($user); |
| 161 | 161 | // todo: use foreach |
| 162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
| 162 | +for ($i = 0; $i < sizeof($ignored_users); $i++) { |
|
| 163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
| 164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
| 164 | + if (isset($_POST[$remove]) && $_POST[$remove] != "") { |
|
| 165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
| 166 | 166 | if (!$other_user) { |
| 167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | BoincForumPrefs::lookup($user); |
| 31 | 31 | |
| 32 | -if (post_str("action", true)=="reset_confirm"){ |
|
| 32 | +if (post_str("action", true)=="reset_confirm") { |
|
| 33 | 33 | page_head(tra("Confirm reset")); |
| 34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
| 35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // If the user has requested a reset of preferences; |
| 46 | 46 | // preserve a few fields. |
| 47 | 47 | // |
| 48 | -if (post_str("action", true)=="reset"){ |
|
| 48 | +if (post_str("action", true)=="reset") { |
|
| 49 | 49 | $posts = $user->prefs->posts; |
| 50 | 50 | $last_post = $user->prefs->last_post; |
| 51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // Update the user avatar |
| 73 | 73 | if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
| 74 | -if ($avatar_type==0){ |
|
| 75 | - if (file_exists($newfile)){ |
|
| 74 | +if ($avatar_type==0) { |
|
| 75 | + if (file_exists($newfile)) { |
|
| 76 | 76 | // Delete the file on the server if the user |
| 77 | 77 | // decides not to use an avatar |
| 78 | 78 | // |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $avatar_url=""; |
| 82 | 82 | } elseif ($avatar_type == 1) { |
| 83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
| 84 | -} elseif ($avatar_type==2){ |
|
| 84 | +} elseif ($avatar_type==2) { |
|
| 85 | 85 | if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
| 86 | 86 | if ($_FILES['picture']['tmp_name']!="") { |
| 87 | 87 | $file = $_FILES['picture']['tmp_name']; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $file = post_str("avatar_url"); |
| 91 | 91 | } |
| 92 | 92 | $size = getImageSize($file); |
| 93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
| 93 | + if ($size[2]!=2 and $size[2]!=3) { |
|
| 94 | 94 | //Not the right kind of file |
| 95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
| 100 | 100 | ImageJPEG($image2, $newfile); |
| 101 | 101 | } |
| 102 | - if (file_exists($newfile)){ |
|
| 102 | + if (file_exists($newfile)) { |
|
| 103 | 103 | $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
| 104 | 104 | } else { |
| 105 | 105 | //User didn't upload a compatible file or it went lost on the server |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | } else { |
| 143 | 143 | // todo: clean up the following |
| 144 | 144 | $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
| 145 | - if ($add_user_to_filter){ |
|
| 145 | + if ($add_user_to_filter) { |
|
| 146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
| 147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
| 147 | + if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) { |
|
| 148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
| 149 | 149 | if (!$other_user) { |
| 150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | // |
| 160 | 160 | $ignored_users = get_ignored_list($user); |
| 161 | 161 | // todo: use foreach |
| 162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
| 162 | +for ($i=0;$i<sizeof($ignored_users);$i++) { |
|
| 163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
| 164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
| 164 | + if (isset($_POST[$remove]) && $_POST[$remove]!="") { |
|
| 165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
| 166 | 166 | if (!$other_user) { |
| 167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | // ------------ Notification ----------- |
| 39 | 39 | |
| 40 | 40 | row1(tra("Notifications")); |
| 41 | -$ch0 = $user->prefs->pm_notification==0?"checked":""; |
|
| 42 | -$ch1 = $user->prefs->pm_notification==1?"checked":""; |
|
| 43 | -$ch2 = $user->prefs->pm_notification==2?"checked":""; |
|
| 41 | +$ch0 = $user->prefs->pm_notification == 0 ? "checked" : ""; |
|
| 42 | +$ch1 = $user->prefs->pm_notification == 1 ? "checked" : ""; |
|
| 43 | +$ch2 = $user->prefs->pm_notification == 2 ? "checked" : ""; |
|
| 44 | 44 | row2( |
| 45 | 45 | tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"), |
| 46 | 46 | "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")." |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | // ------------ Forum identity ----------- |
| 54 | 54 | |
| 55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
| 56 | -if (strlen($user->prefs->avatar)){ |
|
| 57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
| 56 | +if (strlen($user->prefs->avatar)) { |
|
| 57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar |
|
| 58 | 58 | $select_1 = "checked=\"true\""; |
| 59 | 59 | } else { |
| 60 | 60 | $select_2 = "checked=\"true\""; |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
| 74 | 74 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
| 75 | 75 | ); |
| 76 | -if (strlen($user->prefs->avatar)){ |
|
| 76 | +if (strlen($user->prefs->avatar)) { |
|
| 77 | 77 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
| 78 | 78 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":""; |
|
| 81 | +$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : ""; |
|
| 82 | 82 | |
| 83 | -$signature=$user->prefs->signature; |
|
| 84 | -$maxlen=250; |
|
| 83 | +$signature = $user->prefs->signature; |
|
| 84 | +$maxlen = 250; |
|
| 85 | 85 | row2( |
| 86 | 86 | tra("Signature for message board posts") |
| 87 | 87 | .bbcode_info() |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | textarea_with_counter("signature", 250, $signature) |
| 93 | 93 | ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default") |
| 94 | 94 | ); |
| 95 | -if ($user->prefs->signature!=""){ |
|
| 95 | +if ($user->prefs->signature != "") { |
|
| 96 | 96 | row2(tra("Signature preview"). |
| 97 | 97 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
| 98 | 98 | output_transform($user->prefs->signature) |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // ------------ Message display ----------- |
| 103 | 103 | |
| 104 | -$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":""; |
|
| 105 | -$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":""; |
|
| 106 | -$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":""; |
|
| 107 | -$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":""; |
|
| 108 | -$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":""; |
|
| 109 | -$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":""; |
|
| 110 | -$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":""; |
|
| 104 | +$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : ""; |
|
| 105 | +$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : ""; |
|
| 106 | +$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : ""; |
|
| 107 | +$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : ""; |
|
| 108 | +$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : ""; |
|
| 109 | +$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : ""; |
|
| 110 | +$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : ""; |
|
| 111 | 111 | |
| 112 | 112 | $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount); |
| 113 | 113 | $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | // |
| 141 | 141 | $filtered_userlist = get_ignored_list($user); |
| 142 | 142 | $forum_filtered_userlist = ""; |
| 143 | -for ($i=0; $i<sizeof($filtered_userlist); $i++){ |
|
| 143 | +for ($i = 0; $i < sizeof($filtered_userlist); $i++) { |
|
| 144 | 144 | $id = (int)$filtered_userlist[$i]; |
| 145 | 145 | if ($id) { |
| 146 | 146 | $filtered_user = BoincUser::lookup_id($id); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | <input class="btn btn-default" type="submit" name="remove%d" value="%s"> |
| 155 | 155 | <br> |
| 156 | 156 | ', |
| 157 | - UNIQUE_USER_NAME?'':"$filtered_user->id -", |
|
| 157 | + UNIQUE_USER_NAME ? '' : "$filtered_user->id -", |
|
| 158 | 158 | user_links($filtered_user), |
| 159 | 159 | $filtered_user->id, |
| 160 | 160 | tra("Unblock") |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | <input type="text" name="forum_filter_user" size=12> |
| 179 | 179 | <input class="btn btn-default" type="submit" name="add_user_to_filter" value="%s"> |
| 180 | 180 | ', |
| 181 | - UNIQUE_USER_NAME?tra('User name'):tra('User ID (For instance: 123456789)'), |
|
| 181 | + UNIQUE_USER_NAME ?tra('User name') : tra('User ID (For instance: 123456789)'), |
|
| 182 | 182 | tra("Block") |
| 183 | 183 | ) |
| 184 | 184 | ); |
@@ -193,5 +193,5 @@ discard block |
||
| 193 | 193 | end_table(); |
| 194 | 194 | page_tail(); |
| 195 | 195 | |
| 196 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 196 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 197 | 197 | ?> |
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | // ------------ Forum identity ----------- |
| 54 | 54 | |
| 55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
| 56 | -if (strlen($user->prefs->avatar)){ |
|
| 57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
| 56 | +if (strlen($user->prefs->avatar)) { |
|
| 57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { |
|
| 58 | +// Gravatar |
|
| 58 | 59 | $select_1 = "checked=\"true\""; |
| 59 | 60 | } else { |
| 60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
| 73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
| 74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
| 75 | 76 | ); |
| 76 | -if (strlen($user->prefs->avatar)){ |
|
| 77 | +if (strlen($user->prefs->avatar)) { |
|
| 77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
| 78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
| 79 | 80 | } |
@@ -92,7 +93,7 @@ discard block |
||
| 92 | 93 | textarea_with_counter("signature", 250, $signature) |
| 93 | 94 | ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default") |
| 94 | 95 | ); |
| 95 | -if ($user->prefs->signature!=""){ |
|
| 96 | +if ($user->prefs->signature!="") { |
|
| 96 | 97 | row2(tra("Signature preview"). |
| 97 | 98 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
| 98 | 99 | output_transform($user->prefs->signature) |
@@ -140,7 +141,7 @@ discard block |
||
| 140 | 141 | // |
| 141 | 142 | $filtered_userlist = get_ignored_list($user); |
| 142 | 143 | $forum_filtered_userlist = ""; |
| 143 | -for ($i=0; $i<sizeof($filtered_userlist); $i++){ |
|
| 144 | +for ($i=0; $i<sizeof($filtered_userlist); $i++) { |
|
| 144 | 145 | $id = (int)$filtered_userlist[$i]; |
| 145 | 146 | if ($id) { |
| 146 | 147 | $filtered_user = BoincUser::lookup_id($id); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $y = []; |
| 27 | 27 | $x[] = sprintf('%s%s', |
| 28 | 28 | user_links($user, BADGE_HEIGHT_MEDIUM), |
| 29 | - UNIQUE_USER_NAME?'':" (ID $user->id)" |
|
| 29 | + UNIQUE_USER_NAME ? '' : " (ID $user->id)" |
|
| 30 | 30 | ); |
| 31 | 31 | $y[] = null; |
| 32 | 32 | if (!DISABLE_TEAMS) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $where = "true"; |
| 105 | 105 | $search_string = get_str('search_string'); |
| 106 | 106 | if (strlen($search_string)) { |
| 107 | - if (strlen($search_string)<3) { |
|
| 107 | + if (strlen($search_string) < 3) { |
|
| 108 | 108 | error_page(tra("search string must be at least 3 characters")); |
| 109 | 109 | } |
| 110 | 110 | $s = BoincDb::escape_string($search_string); |
@@ -136,17 +136,17 @@ discard block |
||
| 136 | 136 | $search_type = get_str('search_type', true); |
| 137 | 137 | $order_clause = "id desc"; |
| 138 | 138 | if ($search_type == 'rac') { |
| 139 | - $order_clause ="expavg_credit desc"; |
|
| 139 | + $order_clause = "expavg_credit desc"; |
|
| 140 | 140 | } else if ($search_type == 'total') { |
| 141 | - $order_clause ="total_credit desc"; |
|
| 141 | + $order_clause = "total_credit desc"; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated"; |
| 145 | 145 | $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100"); |
| 146 | 146 | page_head(tra("User search results")); |
| 147 | - $n=0; |
|
| 147 | + $n = 0; |
|
| 148 | 148 | foreach ($users as $user) { |
| 149 | - if ($n==0) { |
|
| 149 | + if ($n == 0) { |
|
| 150 | 150 | start_table('table-striped'); |
| 151 | 151 | $x = ['Name']; |
| 152 | 152 | $y = [null]; |
@@ -183,5 +183,5 @@ discard block |
||
| 183 | 183 | user_search_form(); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | -$cvs_version_tracker[]="\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit |
|
| 186 | +$cvs_version_tracker[] = "\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit |
|
| 187 | 187 | ?> |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | define('UNIQUE_USER_NAME', true); |
| 51 | 51 | define("FORUM_QA_MERGED_MODE", true); |
| 52 | 52 | // Set to true to merge Message boards and Q&A section |
| 53 | -define ("DISABLE_PROFILES", true); |
|
| 53 | +define("DISABLE_PROFILES", true); |
|
| 54 | 54 | // enable profiles only after enabling reCAPTCHA |
| 55 | 55 | // https://github.com/BOINC/boinc/wiki/ProtectionFromSpam |
| 56 | 56 | define("USE_STOPFORUMSPAM", true); |
@@ -191,15 +191,15 @@ discard block |
||
| 191 | 191 | </ol>", PROJECT); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | -function project_workunit($wu){ |
|
| 194 | +function project_workunit($wu) { |
|
| 195 | 195 | // shown in the workunit page |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | -function project_user_summary($user){ |
|
| 198 | +function project_user_summary($user) { |
|
| 199 | 199 | // shown in the user summary page |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | -function project_user_page_private($user){ |
|
| 202 | +function project_user_page_private($user) { |
|
| 203 | 203 | // shown in the private account page |
| 204 | 204 | } |
| 205 | 205 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | -function project_user_credit($user){ |
|
| 285 | +function project_user_credit($user) { |
|
| 286 | 286 | global $sub_projects; |
| 287 | 287 | foreach ($sub_projects as $sp) { |
| 288 | 288 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | // they've participated in |
| 34 | 34 | // |
| 35 | 35 | function get_other_projects($user) { |
| 36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
| 36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
| 37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
| 38 | 38 | |
| 39 | 39 | // Check the cache for that URL |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (!NO_STATS) { |
| 174 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
| 174 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
| 175 | 175 | $x = ""; |
| 176 | 176 | shuffle($cpid_stats_sites); |
| 177 | 177 | foreach ($cpid_stats_sites as $site) { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $u = normalize_user_url($user->url); |
| 256 | 256 | row2( |
| 257 | 257 | tra("URL"), |
| 258 | - $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL') |
|
| 258 | + $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL') |
|
| 259 | 259 | ); |
| 260 | 260 | } |
| 261 | 261 | if (USER_COUNTRY) { |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | // if $badge_height is > 0, show badges |
| 354 | 354 | // if $name_limit, limit name to N chars |
| 355 | 355 | // |
| 356 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
| 356 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
| 357 | 357 | BoincForumPrefs::lookup($user); |
| 358 | 358 | if (is_banished($user)) { |
| 359 | 359 | return "(banished: ID $user->id)"; |
@@ -377,17 +377,17 @@ discard block |
||
| 377 | 377 | $x .= sprintf( |
| 378 | 378 | '<a href="%s%s?userid=%d">%s</a>', |
| 379 | 379 | url_base(), |
| 380 | - defined('SHOW_USER_FILENAME')?SHOW_USER_FILENAME:'show_user.php', |
|
| 380 | + defined('SHOW_USER_FILENAME') ?SHOW_USER_FILENAME:'show_user.php', |
|
| 381 | 381 | $user->id, |
| 382 | 382 | $name |
| 383 | 383 | ); |
| 384 | - if (function_exists("project_user_links")){ |
|
| 384 | + if (function_exists("project_user_links")) { |
|
| 385 | 385 | $x .= project_user_links($user); |
| 386 | 386 | } |
| 387 | 387 | if ($badge_height) { |
| 388 | 388 | $x .= badges_string(true, $user, $badge_height); |
| 389 | 389 | } |
| 390 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
| 390 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | function show_community_private($user) { |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | // if there's a foundership request, notify the founder |
| 436 | 436 | // |
| 437 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
| 437 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
| 438 | 438 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
| 439 | 439 | } |
| 440 | 440 | row2(tra("Member of team"), $x); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
| 460 | 460 | $n = count($friends); |
| 461 | 461 | if ($n) { |
| 462 | - foreach($friends as $friend) { |
|
| 462 | + foreach ($friends as $friend) { |
|
| 463 | 463 | $fuser = BoincUser::lookup_id($friend->user_dest); |
| 464 | 464 | if (!$fuser) continue; |
| 465 | 465 | $x .= friend_links($fuser); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | // Returns a cacheable community links data object |
| 507 | 507 | // @param user The user to produce a community links object for |
| 508 | 508 | |
| 509 | -function get_community_links_object($user){ |
|
| 509 | +function get_community_links_object($user) { |
|
| 510 | 510 | $cache_object = new StdClass; |
| 511 | 511 | $cache_object->post_count = total_posts($user); |
| 512 | 512 | $cache_object->user = $user; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $cache_object->friends = array(); |
| 515 | 515 | |
| 516 | 516 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
| 517 | - foreach($friends as $friend) { |
|
| 517 | + foreach ($friends as $friend) { |
|
| 518 | 518 | $fuser = BoincUser::lookup_id($friend->user_dest); |
| 519 | 519 | if (!$fuser) continue; |
| 520 | 520 | $cache_object->friends[] = $fuser; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | return $cache_object; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | -function community_links($clo, $logged_in_user){ |
|
| 525 | +function community_links($clo, $logged_in_user) { |
|
| 526 | 526 | $user = $clo->user; |
| 527 | 527 | $team = $clo->team; |
| 528 | 528 | $friends = $clo->friends; |
@@ -548,15 +548,15 @@ discard block |
||
| 548 | 548 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
| 549 | 549 | ); |
| 550 | 550 | } else if ($friend) { |
| 551 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
| 551 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
| 552 | 552 | } else { |
| 553 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
| 553 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | if ($friends) { |
| 558 | 558 | $x = ""; |
| 559 | - foreach($friends as $friend) { |
|
| 559 | + foreach ($friends as $friend) { |
|
| 560 | 560 | $x .= friend_links($friend); |
| 561 | 561 | } |
| 562 | 562 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -600,6 +600,6 @@ discard block |
||
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
| 603 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 603 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 604 | 604 | |
| 605 | 605 | ?> |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $user->id, |
| 382 | 382 | $name |
| 383 | 383 | ); |
| 384 | - if (function_exists("project_user_links")){ |
|
| 384 | + if (function_exists("project_user_links")) { |
|
| 385 | 385 | $x .= project_user_links($user); |
| 386 | 386 | } |
| 387 | 387 | if ($badge_height) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | // Returns a cacheable community links data object |
| 507 | 507 | // @param user The user to produce a community links object for |
| 508 | 508 | |
| 509 | -function get_community_links_object($user){ |
|
| 509 | +function get_community_links_object($user) { |
|
| 510 | 510 | $cache_object = new StdClass; |
| 511 | 511 | $cache_object->post_count = total_posts($user); |
| 512 | 512 | $cache_object->user = $user; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | return $cache_object; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | -function community_links($clo, $logged_in_user){ |
|
| 525 | +function community_links($clo, $logged_in_user) { |
|
| 526 | 526 | $user = $clo->user; |
| 527 | 527 | $team = $clo->team; |
| 528 | 528 | $friends = $clo->friends; |