@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | // |
| 38 | 38 | $config = get_config(); |
| 39 | 39 | global $master_url; |
| 40 | -$master_url = parse_config($config , "<master_url>"); |
|
| 40 | +$master_url = parse_config($config, "<master_url>"); |
|
| 41 | 41 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
| 42 | 42 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
| 43 | 43 | |
| 44 | 44 | // the following default to on |
| 45 | 45 | // |
| 46 | 46 | $x = parse_config($config, "<user_country>"); |
| 47 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
| 47 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
| 48 | 48 | |
| 49 | 49 | $x = parse_config($config, "<user_url>"); |
| 50 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
| 50 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
| 51 | 51 | |
| 52 | 52 | // don't allow /... at the end of URL |
| 53 | 53 | // |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | function url_base() { |
| 144 | - return is_https()?secure_url_base():URL_BASE; |
|
| 144 | + return is_https() ?secure_url_base() : URL_BASE; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
| 147 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
| 148 | 148 | global $master_url; |
| 149 | 149 | |
| 150 | 150 | // the following allows independent login for projects on the same server |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | $path = substr($path, 0, -1); |
| 156 | 156 | $path .= "_ops/"; |
| 157 | 157 | } |
| 158 | - $expire = $permanent?time()+3600*24*365:0; |
|
| 158 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
| 159 | 159 | setcookie($name, $value, $expire, $path); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -function clear_cookie($name, $ops=false) { |
|
| 162 | +function clear_cookie($name, $ops = false) { |
|
| 163 | 163 | global $master_url; |
| 164 | 164 | $url = parse_url($master_url); |
| 165 | 165 | $path = $url['path']; |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | $path = substr($path, 0, -1); |
| 168 | 168 | $path .= "_ops/"; |
| 169 | 169 | } |
| 170 | - setcookie($name, '', time()-3600, $path); |
|
| 170 | + setcookie($name, '', time() - 3600, $path); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $g_logged_in_user = null; |
| 174 | 174 | $got_logged_in_user = false; |
| 175 | 175 | |
| 176 | -function get_logged_in_user($must_be_logged_in=true) { |
|
| 176 | +function get_logged_in_user($must_be_logged_in = true) { |
|
| 177 | 177 | global $g_logged_in_user, $got_logged_in_user; |
| 178 | 178 | if ($got_logged_in_user) return $g_logged_in_user; |
| 179 | 179 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $next_url = $_SERVER['REQUEST_URI']; |
| 193 | 193 | $n = strrpos($next_url, "/"); |
| 194 | 194 | if ($n) { |
| 195 | - $next_url = substr($next_url, $n+1); |
|
| 195 | + $next_url = substr($next_url, $n + 1); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | $next_url = urlencode($next_url); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | return $g_logged_in_user; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | -function show_login_info($prefix="") { |
|
| 206 | +function show_login_info($prefix = "") { |
|
| 207 | 207 | $user = get_logged_in_user(false); |
| 208 | 208 | if ($user) { |
| 209 | 209 | $url_tokens = url_tokens($user->authenticator); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | -$cache_control_extra=""; |
|
| 216 | +$cache_control_extra = ""; |
|
| 217 | 217 | $is_login_page = false; |
| 218 | 218 | |
| 219 | 219 | // Call this to start pages. |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | // with an existing web framework can more easily do so. |
| 226 | 226 | // To do so, define page_head() in the project include file. |
| 227 | 227 | // |
| 228 | -if (!function_exists("page_head")){ |
|
| 228 | +if (!function_exists("page_head")) { |
|
| 229 | 229 | function page_head( |
| 230 | 230 | $title, |
| 231 | 231 | // page title. Put in <title>, used as title for browser tab. |
| 232 | - $body_attrs=null, |
|
| 232 | + $body_attrs = null, |
|
| 233 | 233 | // <body XXXX> |
| 234 | 234 | // e.g. Javascript to put focus in an input field |
| 235 | 235 | // (onload="document.form.foo.focus()") |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | // if set, include schedulers.txt. |
| 239 | 239 | // also pass to project_banner() in case you want a different |
| 240 | 240 | // header for your main page. |
| 241 | - $url_prefix="", |
|
| 241 | + $url_prefix = "", |
|
| 242 | 242 | // prepend this to links. |
| 243 | 243 | // Use for web pages not in the top directory |
| 244 | - $head_extra=null |
|
| 244 | + $head_extra = null |
|
| 245 | 245 | // extra stuff to put in <head>. E.g.: |
| 246 | 246 | // reCAPTCHA code (create_profile.php) |
| 247 | 247 | // bbcode javascript (forums) |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | header("Content-type: text/html; charset=utf-8"); |
| 264 | 264 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
| 265 | 265 | // Date in the past |
| 266 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
| 266 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
| 267 | 267 | // always modified |
| 268 | 268 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
| 269 | 269 | // for HTTP/1.1 |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | if ($head_extra) { |
| 285 | 285 | echo "\n$head_extra\n"; |
| 286 | 286 | } |
| 287 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
| 287 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
| 288 | 288 | readfile("schedulers.txt"); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $t = $title?$title:PROJECT; |
|
| 291 | + $t = $title ? $title : PROJECT; |
|
| 292 | 292 | echo "<title>$t</title>\n"; |
| 293 | 293 | echo ' |
| 294 | 294 | <meta charset="utf-8"> |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | echo '<div class="container-fluid"> |
| 346 | 346 | '; |
| 347 | 347 | |
| 348 | - switch($title) { //kludge |
|
| 348 | + switch ($title) { //kludge |
|
| 349 | 349 | case tra("Log in"): |
| 350 | 350 | case tra("Create an account"): |
| 351 | 351 | case tra("Server status page"): |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | // See the comments for page_head() |
| 362 | 362 | // |
| 363 | -if (!function_exists("page_tail")){ |
|
| 363 | +if (!function_exists("page_tail")) { |
|
| 364 | 364 | function page_tail( |
| 365 | - $show_date=false, |
|
| 365 | + $show_date = false, |
|
| 366 | 366 | // true for pages that are generated periodically rather than on the fly |
| 367 | - $url_prefix="", |
|
| 367 | + $url_prefix = "", |
|
| 368 | 368 | // use for pages not at top level |
| 369 | - $is_main=false |
|
| 369 | + $is_main = false |
|
| 370 | 370 | // passed to project_footer; |
| 371 | 371 | ) { |
| 372 | 372 | echo "<br>\n"; |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | -function display_cvs_versions(){ |
|
| 384 | +function display_cvs_versions() { |
|
| 385 | 385 | global $cvs_version_tracker; |
| 386 | 386 | echo "\n<!-- SVN VERSIONS -->\n"; |
| 387 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
| 387 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
| 388 | 388 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
| 389 | 389 | } |
| 390 | 390 | } |
@@ -409,23 +409,23 @@ discard block |
||
| 409 | 409 | // takes argument in second and returns a human formatted time string |
| 410 | 410 | // in the form D days + h Hours + m Min + s sec. |
| 411 | 411 | |
| 412 | -function time_diff($x, $res=3) { |
|
| 412 | +function time_diff($x, $res = 3) { |
|
| 413 | 413 | $days = (int)($x/86400); |
| 414 | - $hours = (int)(($x-$days*86400)/3600); |
|
| 415 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
| 416 | - $seconds = (int)($x % 60); |
|
| 414 | + $hours = (int)(($x - $days*86400)/3600); |
|
| 415 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
| 416 | + $seconds = (int)($x%60); |
|
| 417 | 417 | |
| 418 | 418 | $datestring = ""; |
| 419 | 419 | if ($days) { |
| 420 | 420 | $datestring .= "$days ".tra("days")." "; |
| 421 | 421 | } |
| 422 | - if ($res>0 && ($hours || strlen($datestring))) { |
|
| 422 | + if ($res > 0 && ($hours || strlen($datestring))) { |
|
| 423 | 423 | $datestring .= "$hours ".tra("hours")." "; |
| 424 | 424 | } |
| 425 | - if ($res>1 && ($minutes || strlen($datestring))) { |
|
| 425 | + if ($res > 1 && ($minutes || strlen($datestring))) { |
|
| 426 | 426 | $datestring .= "$minutes ".tra("min")." "; |
| 427 | 427 | } |
| 428 | - if ($res>2 && ($seconds)) { |
|
| 428 | + if ($res > 2 && ($seconds)) { |
|
| 429 | 429 | $datestring .= "$seconds ".tra("sec")." "; |
| 430 | 430 | } |
| 431 | 431 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | function time_str($x) { |
| 442 | 442 | if ($x == 0) return "---"; |
| 443 | - return gmdate('j M Y, G:i:s', $x) . " UTC"; |
|
| 443 | + return gmdate('j M Y, G:i:s', $x)." UTC"; |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | function local_time_str($x) { |
@@ -452,14 +452,14 @@ discard block |
||
| 452 | 452 | return time_str($x); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | -function start_table_str($class="", $style="") { |
|
| 456 | - $s = $style?'style="'.$style.'"':''; |
|
| 455 | +function start_table_str($class = "", $style = "") { |
|
| 456 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
| 457 | 457 | return '<div class="table"> |
| 458 | 458 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
| 459 | 459 | '; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | -function start_table($class="", $style="") { |
|
| 462 | +function start_table($class = "", $style = "") { |
|
| 463 | 463 | echo start_table_str($class, $style); |
| 464 | 464 | } |
| 465 | 465 | |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | echo "</tr>\n"; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | -function row1($x, $ncols=2, $class="heading") { |
|
| 507 | +function row1($x, $ncols = 2, $class = "heading") { |
|
| 508 | 508 | if ($class == "heading") { |
| 509 | 509 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
| 510 | 510 | } else { |
@@ -516,10 +516,10 @@ discard block |
||
| 516 | 516 | define('VALUE_ATTRS', 'style="padding-left:12px"'); |
| 517 | 517 | define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"'); |
| 518 | 518 | |
| 519 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
| 520 | - if ($x==="") $x="<br>"; |
|
| 521 | - if ($y==="") $y="<br>"; |
|
| 522 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 519 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
| 520 | + if ($x === "") $x = "<br>"; |
|
| 521 | + if ($y === "") $y = "<br>"; |
|
| 522 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 523 | 523 | echo "<tr> |
| 524 | 524 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
| 525 | 525 | <td $attrs >$y</td> |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | "; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | -function row2_init($x, $y, $lwidth='40%') { |
|
| 530 | +function row2_init($x, $y, $lwidth = '40%') { |
|
| 531 | 531 | echo '<tr> |
| 532 | 532 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
| 533 | 533 | <td '.VALUE_ATTRS.'>'.$y.' |
@@ -550,20 +550,20 @@ discard block |
||
| 550 | 550 | echo "</tr>\n"; |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 553 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 554 | 554 | |
| 555 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
| 555 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
| 556 | 556 | echo "<tr>"; |
| 557 | 557 | $i = 0; |
| 558 | 558 | foreach ($x as $h) { |
| 559 | - $a = $attrs?$attrs[$i]:""; |
|
| 559 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 560 | 560 | echo "<th $a class=\"$class\">$h</th>"; |
| 561 | 561 | $i++; |
| 562 | 562 | } |
| 563 | 563 | echo "</tr>\n"; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | -function row_heading($x, $class='bg-primary') { |
|
| 566 | +function row_heading($x, $class = 'bg-primary') { |
|
| 567 | 567 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
| 568 | 568 | ', $class, $x |
| 569 | 569 | ); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
| 624 | 624 | // is cut short. |
| 625 | 625 | |
| 626 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
| 626 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
| 627 | 627 | $words = explode($delimiter, $sentence); |
| 628 | 628 | $total_chars = 0; |
| 629 | 629 | $trunc = false; |
@@ -706,8 +706,8 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | // returns null if the arg is optional and missing |
| 708 | 708 | // |
| 709 | -function get_int($name, $optional=false) { |
|
| 710 | - $x=null; |
|
| 709 | +function get_int($name, $optional = false) { |
|
| 710 | + $x = null; |
|
| 711 | 711 | if (isset($_GET[$name])) $x = $_GET[$name]; |
| 712 | 712 | if (!is_numeric($x)) { |
| 713 | 713 | if ($optional) { |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | // returns null if the arg is optional and missing |
| 728 | 728 | // |
| 729 | -function post_num($name, $optional=false) { |
|
| 729 | +function post_num($name, $optional = false) { |
|
| 730 | 730 | $x = null; |
| 731 | 731 | if (isset($_POST[$name])) $x = $_POST[$name]; |
| 732 | 732 | if (!is_numeric($x)) { |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | // returns null if the arg is optional and missing |
| 743 | 743 | // |
| 744 | -function post_int($name, $optional=false) { |
|
| 744 | +function post_int($name, $optional = false) { |
|
| 745 | 745 | $x = post_num($name, $optional); |
| 746 | 746 | if (is_null($x)) return null; |
| 747 | 747 | $y = (int)$x; |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | -function get_str($name, $optional=false) { |
|
| 762 | +function get_str($name, $optional = false) { |
|
| 763 | 763 | if (isset($_GET[$name])) { |
| 764 | 764 | $x = $_GET[$name]; |
| 765 | 765 | } else { |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | return undo_magic_quotes($x); |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | -function post_str($name, $optional=false) { |
|
| 774 | +function post_str($name, $optional = false) { |
|
| 775 | 775 | if (isset($_POST[$name])) { |
| 776 | 776 | $x = $_POST[$name]; |
| 777 | 777 | } else { |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | return undo_magic_quotes($x); |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | -function post_arr($name, $optional=false) { |
|
| 786 | +function post_arr($name, $optional = false) { |
|
| 787 | 787 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
| 788 | 788 | $x = $_POST[$name]; |
| 789 | 789 | } else { |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | // the mb_* functions are not included by default |
| 800 | 800 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
| 801 | 801 | |
| 802 | - for ($i=0; $i<strlen($str); $i++) { |
|
| 802 | + for ($i = 0; $i < strlen($str); $i++) { |
|
| 803 | 803 | $c = ord(substr($str, $i)); |
| 804 | 804 | if ($c < 32 || $c > 127) return false; |
| 805 | 805 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
| 824 | 824 | // if no value was entered and this is ok |
| 825 | 825 | // |
| 826 | - if ($number=='' && !$low) return true; |
|
| 826 | + if ($number == '' && !$low) return true; |
|
| 827 | 827 | |
| 828 | 828 | // the supplied value contains alphabetic characters |
| 829 | 829 | // |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | |
| 841 | 841 | // Generate a "select" element from an array of values |
| 842 | 842 | // |
| 843 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
| 843 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
| 844 | 844 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
| 845 | 845 | |
| 846 | 846 | foreach ($array as $key => $value) { |
@@ -865,8 +865,8 @@ discard block |
||
| 865 | 865 | return $str; |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | -function strip_bbcode($string){ |
|
| 869 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
| 868 | +function strip_bbcode($string) { |
|
| 869 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | function current_url() { |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | // @param class The optional CSS class of the button. Defaults to a standard button |
| 895 | 895 | // |
| 896 | 896 | |
| 897 | -function button_text($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
| 897 | +function button_text($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
| 898 | 898 | if (!$desc) { |
| 899 | 899 | $desc = $text; |
| 900 | 900 | } |
@@ -903,19 +903,19 @@ discard block |
||
| 903 | 903 | ); |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | -function show_button($url, $text, $desc=null, $class="btn-success btn-sm") { |
|
| 907 | - echo button_text($url, $text, $desc=null, $class); |
|
| 906 | +function show_button($url, $text, $desc = null, $class = "btn-success btn-sm") { |
|
| 907 | + echo button_text($url, $text, $desc = null, $class); |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | // for places with a bunch of buttons, like forum posts |
| 911 | 911 | // |
| 912 | -function show_button_small($url, $text, $desc=null) { |
|
| 912 | +function show_button_small($url, $text, $desc = null) { |
|
| 913 | 913 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // used for showing icons |
| 917 | 917 | // |
| 918 | -function show_image($src, $title, $alt, $height=null) { |
|
| 918 | +function show_image($src, $title, $alt, $height = null) { |
|
| 919 | 919 | $h = ""; |
| 920 | 920 | if ($height) { |
| 921 | 921 | $h = "height=\"$height\""; |
@@ -952,7 +952,7 @@ discard block |
||
| 952 | 952 | // tries instead to connect to <replica_db_host> if tag exists. |
| 953 | 953 | // DEPRECATED - use boinc_db.inc |
| 954 | 954 | // |
| 955 | -function db_init($try_replica=false) { |
|
| 955 | +function db_init($try_replica = false) { |
|
| 956 | 956 | check_web_stopped(); |
| 957 | 957 | $retval = db_init_aux($try_replica); |
| 958 | 958 | if ($retval == 1) { |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | function sanitize_numeric($x) { |
| 1024 | 1024 | if (is_numeric($x)) { |
| 1025 | 1025 | return $x; |
| 1026 | - } else if (trim($x) == '' ) { |
|
| 1026 | + } else if (trim($x) == '') { |
|
| 1027 | 1027 | return ''; |
| 1028 | 1028 | } else { |
| 1029 | 1029 | return "not numeric"; |
@@ -1046,9 +1046,9 @@ discard block |
||
| 1046 | 1046 | return $c/(200/24); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | -function do_download($path,$name="") { |
|
| 1050 | - if (strcmp($name,"") == 0) { |
|
| 1051 | - $name=basename($path); |
|
| 1049 | +function do_download($path, $name = "") { |
|
| 1050 | + if (strcmp($name, "") == 0) { |
|
| 1051 | + $name = basename($path); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | header('Content-Description: File Transfer'); |
| 1054 | 1054 | header('Content-Type: application/octet-stream'); |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | header('Expires: 0'); |
| 1058 | 1058 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 1059 | 1059 | header('Pragma: public'); |
| 1060 | - header('Content-Length: ' . filesize($path)); |
|
| 1060 | + header('Content-Length: '.filesize($path)); |
|
| 1061 | 1061 | flush(); |
| 1062 | 1062 | readfile($path); |
| 1063 | 1063 | } |
@@ -1106,10 +1106,10 @@ discard block |
||
| 1106 | 1106 | // Otherwise return 0. |
| 1107 | 1107 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1108 | 1108 | // |
| 1109 | -function boinc_client_version(){ |
|
| 1109 | +function boinc_client_version() { |
|
| 1110 | 1110 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1111 | 1111 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1112 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1112 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1113 | 1113 | if (preg_match($e, $x, $matches)) { |
| 1114 | 1114 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
| 1115 | 1115 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | $rem_name = $name."_remaining"; |
| 1139 | 1139 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
| 1140 | 1140 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
| 1141 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1141 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1142 | 1142 | ; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | // use the following around text with long lines, |
| 1169 | 1169 | // to limit the width and make it more readable. |
| 1170 | 1170 | // |
| 1171 | -function text_start($width=640) { |
|
| 1171 | +function text_start($width = 640) { |
|
| 1172 | 1172 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
| 1173 | 1173 | } |
| 1174 | 1174 | function text_end() { |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | function cert_filename() { |
| 1188 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
| 1188 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 | // if user hasn't validated their email addr, tell them to |
@@ -1202,6 +1202,6 @@ discard block |
||
| 1202 | 1202 | } |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 1205 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 1206 | 1206 | |
| 1207 | 1207 | ?> |