@@ -188,14 +188,14 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | // Check if consent to terms of use has been given. |
| 190 | 190 | // |
| 191 | - $myconsent = FALSE; |
|
| 191 | + $myconsent = false; |
|
| 192 | 192 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
| 193 | 193 | if ($checkct and check_termsofuse()) { |
| 194 | 194 | $agree = post_str("agree_to_terms_of_use", true); |
| 195 | 195 | if (!$agree) { |
| 196 | 196 | error_page(tra("You have not agreeed to our terms of use. Please agree to the terms of use by navigating back to the previous page, in order to create your account")); |
| 197 | 197 | } |
| 198 | - $myconsent = TRUE; |
|
| 198 | + $myconsent = true; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // see whether the new account should be pre-enrolled in a team, |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $team = BoincTeam::lookup_id($teamid); |
| 207 | 207 | $clone_user = BoincUser::lookup_id($team->userid); |
| 208 | 208 | if (!$clone_user) { |
| 209 | - error_page("User $userid not found"); |
|
| 209 | + error_page("user $userid not found"); |
|
| 210 | 210 | } |
| 211 | 211 | $project_prefs = $clone_user->project_prefs; |
| 212 | 212 | } else { |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | // |
| 39 | 39 | $config = get_config(); |
| 40 | 40 | global $master_url; |
| 41 | -$master_url = parse_config($config , "<master_url>"); |
|
| 41 | +$master_url = parse_config($config, "<master_url>"); |
|
| 42 | 42 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
| 43 | 43 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
| 44 | 44 | |
| 45 | 45 | // the following default to on |
| 46 | 46 | // |
| 47 | 47 | $x = parse_config($config, "<user_country>"); |
| 48 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
| 48 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
| 49 | 49 | |
| 50 | 50 | $x = parse_config($config, "<user_url>"); |
| 51 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
| 51 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
| 52 | 52 | |
| 53 | 53 | // don't allow /... at the end of URL |
| 54 | 54 | // |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | function url_base() { |
| 138 | - return is_https()?secure_url_base():URL_BASE; |
|
| 138 | + return is_https() ?secure_url_base() : URL_BASE; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
| 141 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
| 142 | 142 | global $master_url; |
| 143 | 143 | |
| 144 | 144 | // the following allows independent login for projects on the same server |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | $path = substr($path, 0, -1); |
| 150 | 150 | $path .= "_ops/"; |
| 151 | 151 | } |
| 152 | - $expire = $permanent?time()+3600*24*365:0; |
|
| 152 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
| 153 | 153 | setcookie($name, $value, $expire, $path); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | -function clear_cookie($name, $ops=false) { |
|
| 156 | +function clear_cookie($name, $ops = false) { |
|
| 157 | 157 | global $master_url; |
| 158 | 158 | $url = parse_url($master_url); |
| 159 | 159 | $path = $url['path']; |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | $path = substr($path, 0, -1); |
| 162 | 162 | $path .= "_ops/"; |
| 163 | 163 | } |
| 164 | - setcookie($name, '', time()-3600, $path); |
|
| 164 | + setcookie($name, '', time() - 3600, $path); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $g_logged_in_user = null; |
| 168 | 168 | $got_logged_in_user = false; |
| 169 | 169 | |
| 170 | -function get_logged_in_user($must_be_logged_in=true) { |
|
| 170 | +function get_logged_in_user($must_be_logged_in = true) { |
|
| 171 | 171 | global $g_logged_in_user, $got_logged_in_user; |
| 172 | 172 | if ($got_logged_in_user) return $g_logged_in_user; |
| 173 | 173 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $next_url = $_SERVER['REQUEST_URI']; |
| 187 | 187 | $n = strrpos($next_url, "/"); |
| 188 | 188 | if ($n) { |
| 189 | - $next_url = substr($next_url, $n+1); |
|
| 189 | + $next_url = substr($next_url, $n + 1); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | $next_url = urlencode($next_url); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | return $g_logged_in_user; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -function show_login_info($prefix="") { |
|
| 200 | +function show_login_info($prefix = "") { |
|
| 201 | 201 | $user = get_logged_in_user(false); |
| 202 | 202 | if ($user) { |
| 203 | 203 | $url_tokens = url_tokens($user->authenticator); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | -$cache_control_extra=""; |
|
| 210 | +$cache_control_extra = ""; |
|
| 211 | 211 | $is_login_page = false; |
| 212 | 212 | |
| 213 | 213 | // Call this to start pages. |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | // with an existing web framework can more easily do so. |
| 220 | 220 | // To do so, define page_head() in the project include file. |
| 221 | 221 | // |
| 222 | -if (!function_exists("page_head")){ |
|
| 222 | +if (!function_exists("page_head")) { |
|
| 223 | 223 | function page_head( |
| 224 | 224 | $title, |
| 225 | 225 | // page title. Put in <title>, used as title for browser tab. |
| 226 | - $body_attrs=null, |
|
| 226 | + $body_attrs = null, |
|
| 227 | 227 | // <body XXXX> |
| 228 | 228 | // e.g. Javascript to put focus in an input field |
| 229 | 229 | // (onload="document.form.foo.focus()") |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | // if set, include schedulers.txt. |
| 233 | 233 | // also pass to project_banner() in case you want a different |
| 234 | 234 | // header for your main page. |
| 235 | - $url_prefix="", |
|
| 235 | + $url_prefix = "", |
|
| 236 | 236 | // prepend this to links. |
| 237 | 237 | // Use for web pages not in the top directory |
| 238 | - $head_extra=null |
|
| 238 | + $head_extra = null |
|
| 239 | 239 | // extra stuff to put in <head>. E.g.: |
| 240 | 240 | // reCAPTCHA code (create_profile.php) |
| 241 | 241 | // bbcode javascript (forums) |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | if (!$caching) { |
| 253 | 253 | header("Content-type: text/html; charset=utf-8"); |
| 254 | - header ("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); // Date in the past |
|
| 255 | - header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); // always modified |
|
| 256 | - header ("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); // HTTP/1.1 |
|
| 257 | - header ("Pragma: no-cache"); // HTTP/1.0 |
|
| 254 | + header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); // Date in the past |
|
| 255 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); // always modified |
|
| 256 | + header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); // HTTP/1.1 |
|
| 257 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | echo '<!DOCTYPE html> |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | if ($head_extra) { |
| 266 | 266 | echo "\n$head_extra\n"; |
| 267 | 267 | } |
| 268 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
| 268 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
| 269 | 269 | readfile("schedulers.txt"); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - $t = $title?$title:PROJECT; |
|
| 272 | + $t = $title ? $title : PROJECT; |
|
| 273 | 273 | echo "<title>$t</title>\n"; |
| 274 | 274 | echo ' |
| 275 | 275 | <meta charset="utf-8"> |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | echo '<div class="container-fluid"> |
| 306 | 306 | '; |
| 307 | 307 | |
| 308 | - switch($title) { //kludge |
|
| 308 | + switch ($title) { //kludge |
|
| 309 | 309 | case tra("Log in"): |
| 310 | 310 | case tra("Create an account"): |
| 311 | 311 | case tra("Server status page"): |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | // See the comments for page_head() |
| 322 | 322 | // |
| 323 | -if (!function_exists("page_tail")){ |
|
| 323 | +if (!function_exists("page_tail")) { |
|
| 324 | 324 | function page_tail( |
| 325 | - $show_date=false, |
|
| 325 | + $show_date = false, |
|
| 326 | 326 | // true for pages that are generated periodically rather than on the fly |
| 327 | - $url_prefix="", |
|
| 327 | + $url_prefix = "", |
|
| 328 | 328 | // use for pages not at top level |
| 329 | - $is_main=false |
|
| 329 | + $is_main = false |
|
| 330 | 330 | // passed to project_footer; |
| 331 | 331 | ) { |
| 332 | 332 | echo "<br>\n"; |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | -function display_cvs_versions(){ |
|
| 344 | +function display_cvs_versions() { |
|
| 345 | 345 | global $cvs_version_tracker; |
| 346 | 346 | echo "\n<!-- SVN VERSIONS -->\n"; |
| 347 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
| 347 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
| 348 | 348 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
| 349 | 349 | } |
| 350 | 350 | } |
@@ -369,23 +369,23 @@ discard block |
||
| 369 | 369 | // takes argument in second and returns a human formatted time string |
| 370 | 370 | // in the form D days + h Hours + m Min + s sec. |
| 371 | 371 | |
| 372 | -function time_diff($x, $res=3) { |
|
| 372 | +function time_diff($x, $res = 3) { |
|
| 373 | 373 | $days = (int)($x/86400); |
| 374 | - $hours = (int)(($x-$days*86400)/3600); |
|
| 375 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
| 376 | - $seconds = (int)($x % 60); |
|
| 374 | + $hours = (int)(($x - $days*86400)/3600); |
|
| 375 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
| 376 | + $seconds = (int)($x%60); |
|
| 377 | 377 | |
| 378 | 378 | $datestring = ""; |
| 379 | 379 | if ($days) { |
| 380 | 380 | $datestring .= "$days ".tra("days")." "; |
| 381 | 381 | } |
| 382 | - if ($res>0 && ($hours || strlen($datestring))) { |
|
| 382 | + if ($res > 0 && ($hours || strlen($datestring))) { |
|
| 383 | 383 | $datestring .= "$hours ".tra("hours")." "; |
| 384 | 384 | } |
| 385 | - if ($res>1 && ($minutes || strlen($datestring))) { |
|
| 385 | + if ($res > 1 && ($minutes || strlen($datestring))) { |
|
| 386 | 386 | $datestring .= "$minutes ".tra("min")." "; |
| 387 | 387 | } |
| 388 | - if ($res>2 && ($seconds)) { |
|
| 388 | + if ($res > 2 && ($seconds)) { |
|
| 389 | 389 | $datestring .= "$seconds ".tra("sec")." "; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | function time_str($x) { |
| 402 | 402 | if ($x == 0) return "---"; |
| 403 | - return gmdate('j M Y, G:i:s', $x) . " UTC"; |
|
| 403 | + return gmdate('j M Y, G:i:s', $x)." UTC"; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | function local_time_str($x) { |
@@ -412,14 +412,14 @@ discard block |
||
| 412 | 412 | return time_str($x); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | -function start_table_str($class="", $style="") { |
|
| 416 | - $s = $style?'style="'.$style.'"':''; |
|
| 415 | +function start_table_str($class = "", $style = "") { |
|
| 416 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
| 417 | 417 | return '<div class="table"> |
| 418 | 418 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
| 419 | 419 | '; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | -function start_table($class="", $style="") { |
|
| 422 | +function start_table($class = "", $style = "") { |
|
| 423 | 423 | echo start_table_str($class, $style); |
| 424 | 424 | } |
| 425 | 425 | |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | echo "</tr>\n"; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | -function row1($x, $ncols=2, $class="heading") { |
|
| 467 | +function row1($x, $ncols = 2, $class = "heading") { |
|
| 468 | 468 | if ($class == "heading") { |
| 469 | 469 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
| 470 | 470 | } else { |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | define('VALUE_ATTRS', 'style="padding-left:12px"'); |
| 477 | 477 | define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"'); |
| 478 | 478 | |
| 479 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
| 480 | - if ($x==="") $x="<br>"; |
|
| 481 | - if ($y==="") $y="<br>"; |
|
| 482 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 479 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
| 480 | + if ($x === "") $x = "<br>"; |
|
| 481 | + if ($y === "") $y = "<br>"; |
|
| 482 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 483 | 483 | echo "<tr> |
| 484 | 484 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
| 485 | 485 | <td $attrs >$y</td> |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | "; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -function row2_init($x, $y, $lwidth='40%') { |
|
| 490 | +function row2_init($x, $y, $lwidth = '40%') { |
|
| 491 | 491 | echo '<tr> |
| 492 | 492 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
| 493 | 493 | <td '.VALUE_ATTRS.'>'.$y.' |
@@ -510,20 +510,20 @@ discard block |
||
| 510 | 510 | echo "</tr>\n"; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 513 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 514 | 514 | |
| 515 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
| 515 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
| 516 | 516 | echo "<tr>"; |
| 517 | 517 | $i = 0; |
| 518 | 518 | foreach ($x as $h) { |
| 519 | - $a = $attrs?$attrs[$i]:""; |
|
| 519 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 520 | 520 | echo "<th $a class=\"$class\">$h</th>"; |
| 521 | 521 | $i++; |
| 522 | 522 | } |
| 523 | 523 | echo "</tr>\n"; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | -function row_heading($x, $class='bg-primary') { |
|
| 526 | +function row_heading($x, $class = 'bg-primary') { |
|
| 527 | 527 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
| 528 | 528 | ', $class, $x |
| 529 | 529 | ); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
| 580 | 580 | // is cut short. |
| 581 | 581 | |
| 582 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
| 582 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
| 583 | 583 | $words = explode($delimiter, $sentence); |
| 584 | 584 | $total_chars = 0; |
| 585 | 585 | $trunc = false; |
@@ -662,8 +662,8 @@ discard block |
||
| 662 | 662 | |
| 663 | 663 | // returns null if the arg is optional and missing |
| 664 | 664 | // |
| 665 | -function get_int($name, $optional=false) { |
|
| 666 | - $x=null; |
|
| 665 | +function get_int($name, $optional = false) { |
|
| 666 | + $x = null; |
|
| 667 | 667 | if (isset($_GET[$name])) $x = $_GET[$name]; |
| 668 | 668 | if (!is_numeric($x)) { |
| 669 | 669 | if ($optional) { |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | // returns null if the arg is optional and missing |
| 684 | 684 | // |
| 685 | -function post_num($name, $optional=false) { |
|
| 685 | +function post_num($name, $optional = false) { |
|
| 686 | 686 | $x = null; |
| 687 | 687 | if (isset($_POST[$name])) $x = $_POST[$name]; |
| 688 | 688 | if (!is_numeric($x)) { |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | // returns null if the arg is optional and missing |
| 699 | 699 | // |
| 700 | -function post_int($name, $optional=false) { |
|
| 700 | +function post_int($name, $optional = false) { |
|
| 701 | 701 | $x = post_num($name, $optional); |
| 702 | 702 | if (is_null($x)) return null; |
| 703 | 703 | $y = (int)$x; |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | } |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | -function get_str($name, $optional=false) { |
|
| 718 | +function get_str($name, $optional = false) { |
|
| 719 | 719 | if (isset($_GET[$name])) { |
| 720 | 720 | $x = $_GET[$name]; |
| 721 | 721 | } else { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | return undo_magic_quotes($x); |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | -function post_str($name, $optional=false) { |
|
| 730 | +function post_str($name, $optional = false) { |
|
| 731 | 731 | if (isset($_POST[$name])) { |
| 732 | 732 | $x = $_POST[$name]; |
| 733 | 733 | } else { |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | return undo_magic_quotes($x); |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | -function post_arr($name, $optional=false) { |
|
| 742 | +function post_arr($name, $optional = false) { |
|
| 743 | 743 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
| 744 | 744 | $x = $_POST[$name]; |
| 745 | 745 | } else { |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | // the mb_* functions are not included by default |
| 756 | 756 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
| 757 | 757 | |
| 758 | - for ($i=0; $i<strlen($str); $i++) { |
|
| 758 | + for ($i = 0; $i < strlen($str); $i++) { |
|
| 759 | 759 | $c = ord(substr($str, $i)); |
| 760 | 760 | if ($c < 32 || $c > 127) return false; |
| 761 | 761 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
| 780 | 780 | // if no value was entered and this is ok |
| 781 | 781 | // |
| 782 | - if ($number=='' && !$low) return true; |
|
| 782 | + if ($number == '' && !$low) return true; |
|
| 783 | 783 | |
| 784 | 784 | // the supplied value contains alphabetic characters |
| 785 | 785 | // |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | // Generate a "select" element from an array of values |
| 798 | 798 | // |
| 799 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
| 799 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
| 800 | 800 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
| 801 | 801 | |
| 802 | 802 | foreach ($array as $key => $value) { |
@@ -821,8 +821,8 @@ discard block |
||
| 821 | 821 | return $str; |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | -function strip_bbcode($string){ |
|
| 825 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
| 824 | +function strip_bbcode($string) { |
|
| 825 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | function current_url() { |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | // @param class The optional CSS class of the button. Defaults to a standard button |
| 851 | 851 | // |
| 852 | 852 | |
| 853 | -function button_text($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
| 853 | +function button_text($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
| 854 | 854 | if (!$desc) { |
| 855 | 855 | $desc = $text; |
| 856 | 856 | } |
@@ -859,19 +859,19 @@ discard block |
||
| 859 | 859 | ); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | -function show_button($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
| 863 | - echo button_text($url, $text, $desc=null, $class); |
|
| 862 | +function show_button($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
| 863 | + echo button_text($url, $text, $desc = null, $class); |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // for places with a bunch of buttons, like forum posts |
| 867 | 867 | // |
| 868 | -function show_button_small($url, $text, $desc=null) { |
|
| 868 | +function show_button_small($url, $text, $desc = null) { |
|
| 869 | 869 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | // used for showing icons |
| 873 | 873 | // |
| 874 | -function show_image($src, $title, $alt, $height=null) { |
|
| 874 | +function show_image($src, $title, $alt, $height = null) { |
|
| 875 | 875 | $h = ""; |
| 876 | 876 | if ($height) { |
| 877 | 877 | $h = "height=\"$height\""; |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | // tries instead to connect to <replica_db_host> if tag exists. |
| 909 | 909 | // DEPRECATED - use boinc_db.inc |
| 910 | 910 | // |
| 911 | -function db_init($try_replica=false) { |
|
| 911 | +function db_init($try_replica = false) { |
|
| 912 | 912 | check_web_stopped(); |
| 913 | 913 | $retval = db_init_aux($try_replica); |
| 914 | 914 | if ($retval == 1) { |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | function sanitize_numeric($x) { |
| 980 | 980 | if (is_numeric($x)) { |
| 981 | 981 | return $x; |
| 982 | - } else if (trim($x) == '' ) { |
|
| 982 | + } else if (trim($x) == '') { |
|
| 983 | 983 | return ''; |
| 984 | 984 | } else { |
| 985 | 985 | return "not numeric"; |
@@ -1002,9 +1002,9 @@ discard block |
||
| 1002 | 1002 | return $c/(200/24); |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | -function do_download($path,$name="") { |
|
| 1006 | - if (strcmp($name,"") == 0) { |
|
| 1007 | - $name=basename($path); |
|
| 1005 | +function do_download($path, $name = "") { |
|
| 1006 | + if (strcmp($name, "") == 0) { |
|
| 1007 | + $name = basename($path); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | header('Content-Description: File Transfer'); |
| 1010 | 1010 | header('Content-Type: application/octet-stream'); |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | header('Expires: 0'); |
| 1014 | 1014 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 1015 | 1015 | header('Pragma: public'); |
| 1016 | - header('Content-Length: ' . filesize($path)); |
|
| 1016 | + header('Content-Length: '.filesize($path)); |
|
| 1017 | 1017 | flush(); |
| 1018 | 1018 | readfile($path); |
| 1019 | 1019 | } |
@@ -1062,10 +1062,10 @@ discard block |
||
| 1062 | 1062 | // Otherwise return 0. |
| 1063 | 1063 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1064 | 1064 | // |
| 1065 | -function boinc_client_version(){ |
|
| 1065 | +function boinc_client_version() { |
|
| 1066 | 1066 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1067 | 1067 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1068 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1068 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1069 | 1069 | if (preg_match($e, $x, $matches)) { |
| 1070 | 1070 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
| 1071 | 1071 | } |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | $rem_name = $name."_remaining"; |
| 1095 | 1095 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
| 1096 | 1096 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
| 1097 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1097 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1098 | 1098 | ; |
| 1099 | 1099 | } |
| 1100 | 1100 | |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | // use the following around text with long lines, |
| 1125 | 1125 | // to limit the width and make it more readable. |
| 1126 | 1126 | // |
| 1127 | -function text_start($width=640) { |
|
| 1127 | +function text_start($width = 640) { |
|
| 1128 | 1128 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
| 1129 | 1129 | } |
| 1130 | 1130 | function text_end() { |
@@ -1137,9 +1137,9 @@ discard block |
||
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | function cert_filename() { |
| 1140 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
| 1140 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 1143 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 1144 | 1144 | |
| 1145 | 1145 | ?> |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | tra("Must be at least %1 characters", $min_passwd_length), |
| 101 | 101 | tra("Password") |
| 102 | 102 | ), |
| 103 | - "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd") |
|
| 103 | + "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd") |
|
| 104 | 104 | ); |
| 105 | 105 | if (USER_COUNTRY) { |
| 106 | 106 | form_select( |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | } else { |
| 146 | 146 | $x = tra("Email address:"); |
| 147 | 147 | } |
| 148 | - form_input_text($x, "email_addr", '', 'text', $attrs='autofocus tabindex="1"'); |
|
| 148 | + form_input_text($x, "email_addr", '', 'text', $attrs = 'autofocus tabindex="1"'); |
|
| 149 | 149 | form_input_text( |
| 150 | - tra("Password:").'<br><small><a href="get_passwd.php">' . tra("forgot password?") . "</a></small>", |
|
| 150 | + tra("Password:").'<br><small><a href="get_passwd.php">'.tra("forgot password?")."</a></small>", |
|
| 151 | 151 | "passwd", |
| 152 | 152 | "", |
| 153 | 153 | "password", |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | "; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -function xml_error($num, $msg=null, $file=null, $line=null) { |
|
| 49 | +function xml_error($num, $msg = null, $file = null, $line = null) { |
|
| 50 | 50 | global $xml_outer_tag; |
| 51 | 51 | if (!$msg) { |
| 52 | - switch($num) { |
|
| 52 | + switch ($num) { |
|
| 53 | 53 | case -112: $msg = "Invalid XML"; break; |
| 54 | 54 | case -136: $msg = "Not found"; break; |
| 55 | 55 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // If it's a single-tag element, and it's present, just return the tag |
| 96 | 96 | // |
| 97 | 97 | function parse_element($xml, $tag) { |
| 98 | - $closetag = "</" . substr($tag,1); |
|
| 98 | + $closetag = "</".substr($tag, 1); |
|
| 99 | 99 | $x = strstr($xml, $tag); |
| 100 | 100 | if ($x) { |
| 101 | 101 | if (strstr($tag, "/>")) return $tag; |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | function parse_next_element($xml, $tag, &$cursor) { |
| 113 | 113 | $element = null; |
| 114 | - $closetag = "</" . substr($tag,1); |
|
| 115 | - $pos = substr($xml,$cursor); |
|
| 114 | + $closetag = "</".substr($tag, 1); |
|
| 115 | + $pos = substr($xml, $cursor); |
|
| 116 | 116 | $x = strstr($pos, $tag); |
| 117 | 117 | if ($x) { |
| 118 | 118 | if (strstr($tag, "/>")) return $tag; |