@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $config = get_config(); |
36 | 36 | |
37 | 37 | global $master_url; |
38 | -$master_url = parse_config($config , "<master_url>"); |
|
38 | +$master_url = parse_config($config, "<master_url>"); |
|
39 | 39 | |
40 | 40 | // the above 'globals' are solely for Drupal; see |
41 | 41 | // https://stackoverflow.com/questions/29216392/scope-of-a-global-variable-in-drupal-module |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | // Set parameters to defaults if not defined in config.xml |
47 | 47 | |
48 | 48 | $x = parse_config($config, "<user_country>"); |
49 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
49 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
50 | 50 | |
51 | 51 | $x = parse_config($config, "<user_url>"); |
52 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
52 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
53 | 53 | |
54 | 54 | // Set parameters to defaults if not defined in project.inc |
55 | 55 | |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | function url_base() { |
162 | - return is_https()?secure_url_base():URL_BASE; |
|
162 | + return is_https() ?secure_url_base() : URL_BASE; |
|
163 | 163 | } |
164 | 164 | |
165 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
165 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
166 | 166 | global $master_url; |
167 | 167 | |
168 | 168 | // the following allows independent login for projects on the same server |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | $path = substr($path, 0, -1); |
174 | 174 | $path .= "_ops/"; |
175 | 175 | } |
176 | - $expire = $permanent?time()+3600*24*365:0; |
|
176 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
177 | 177 | setcookie($name, $value, $expire, $path, |
178 | 178 | '', |
179 | - is_https(), // if this page is secure, make cookie secure |
|
179 | + is_https(), // if this page is secure, make cookie secure |
|
180 | 180 | true // httponly; no JS access |
181 | 181 | ); |
182 | 182 | } |
183 | 183 | |
184 | -function clear_cookie($name, $ops=false) { |
|
184 | +function clear_cookie($name, $ops = false) { |
|
185 | 185 | global $master_url; |
186 | 186 | $url = parse_url($master_url); |
187 | 187 | $path = $url['path']; |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | $path = substr($path, 0, -1); |
190 | 190 | $path .= "_ops/"; |
191 | 191 | } |
192 | - setcookie($name, '', time()-3600, $path); |
|
192 | + setcookie($name, '', time() - 3600, $path); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | $g_logged_in_user = null; |
196 | 196 | $got_logged_in_user = false; |
197 | 197 | |
198 | -function get_logged_in_user($must_be_logged_in=true) { |
|
198 | +function get_logged_in_user($must_be_logged_in = true) { |
|
199 | 199 | global $g_logged_in_user, $got_logged_in_user; |
200 | 200 | if ($got_logged_in_user) { |
201 | 201 | // this could have been called earlier with $must_be_logged_in false |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $next_url = $_SERVER['REQUEST_URI']; |
222 | 222 | $n = strrpos($next_url, "/"); |
223 | 223 | if ($n) { |
224 | - $next_url = substr($next_url, $n+1); |
|
224 | + $next_url = substr($next_url, $n + 1); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | $next_url = urlencode($next_url); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return $g_logged_in_user; |
233 | 233 | } |
234 | 234 | |
235 | -function show_login_info($prefix="") { |
|
235 | +function show_login_info($prefix = "") { |
|
236 | 236 | $user = get_logged_in_user(false); |
237 | 237 | if ($user) { |
238 | 238 | $url_tokens = url_tokens($user->authenticator); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | -$cache_control_extra=""; |
|
245 | +$cache_control_extra = ""; |
|
246 | 246 | $is_login_page = false; |
247 | 247 | |
248 | 248 | // Call this to start pages. |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | // with an existing web framework can more easily do so. |
255 | 255 | // To do so, define page_head() in the project include file. |
256 | 256 | // |
257 | -if (!function_exists("page_head")){ |
|
257 | +if (!function_exists("page_head")) { |
|
258 | 258 | function page_head( |
259 | 259 | $title, |
260 | 260 | // page title. Put in <title>, used as title for browser tab. |
261 | - $body_attrs=null, |
|
261 | + $body_attrs = null, |
|
262 | 262 | // <body XXXX> |
263 | 263 | // e.g. Javascript to put focus in an input field |
264 | 264 | // (onload="document.form.foo.focus()") |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | // if set, include schedulers.txt. |
268 | 268 | // also pass to project_banner() in case you want a different |
269 | 269 | // header for your main page. |
270 | - $url_prefix="", |
|
270 | + $url_prefix = "", |
|
271 | 271 | // prepend this to links. |
272 | 272 | // Use for web pages not in the top directory |
273 | - $head_extra=null |
|
273 | + $head_extra = null |
|
274 | 274 | // extra stuff to put in <head>. E.g.: |
275 | 275 | // reCAPTCHA code (create_profile.php) |
276 | 276 | // bbcode javascript (forums) |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | header("Content-type: text/html; charset=utf-8"); |
293 | 293 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
294 | 294 | // Date in the past |
295 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
295 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
296 | 296 | // always modified |
297 | 297 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
298 | 298 | // for HTTP/1.1 |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | if ($head_extra) { |
314 | 314 | echo "\n$head_extra\n"; |
315 | 315 | } |
316 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
316 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
317 | 317 | readfile("schedulers.txt"); |
318 | 318 | } |
319 | 319 | |
320 | - $t = $title?$title:PROJECT; |
|
320 | + $t = $title ? $title : PROJECT; |
|
321 | 321 | echo "<title>$t</title>\n"; |
322 | 322 | echo ' |
323 | 323 | <meta charset="utf-8"> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | echo '<div class="container-fluid"> |
374 | 374 | '; |
375 | 375 | |
376 | - switch($title) { //kludge |
|
376 | + switch ($title) { //kludge |
|
377 | 377 | case tra("Log in"): |
378 | 378 | case tra("Create an account"): |
379 | 379 | case tra("Server status page"): |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | |
389 | 389 | // See the comments for page_head() |
390 | 390 | // |
391 | -if (!function_exists("page_tail")){ |
|
391 | +if (!function_exists("page_tail")) { |
|
392 | 392 | function page_tail( |
393 | - $show_date=false, |
|
393 | + $show_date = false, |
|
394 | 394 | // true for pages that are generated periodically rather than on the fly |
395 | - $url_prefix="", |
|
395 | + $url_prefix = "", |
|
396 | 396 | // use for pages not at top level |
397 | - $is_main=false |
|
397 | + $is_main = false |
|
398 | 398 | // passed to project_footer; |
399 | 399 | ) { |
400 | 400 | echo "<br>\n"; |
@@ -429,24 +429,24 @@ discard block |
||
429 | 429 | // convert time interval in seconds to a string of the form |
430 | 430 | // 'D days h hours m min s sec'. |
431 | 431 | |
432 | -function time_diff($x, $res=3) { |
|
432 | +function time_diff($x, $res = 3) { |
|
433 | 433 | $x = (int)$x; |
434 | 434 | $days = (int)($x/86400); |
435 | - $hours = (int)(($x-$days*86400)/3600); |
|
436 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
437 | - $seconds = $x % 60; |
|
435 | + $hours = (int)(($x - $days*86400)/3600); |
|
436 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
437 | + $seconds = $x%60; |
|
438 | 438 | |
439 | 439 | $s = ""; |
440 | 440 | if ($days) { |
441 | 441 | $s .= "$days ".tra("days")." "; |
442 | 442 | } |
443 | - if ($res>0 && ($hours || strlen($s))) { |
|
443 | + if ($res > 0 && ($hours || strlen($s))) { |
|
444 | 444 | $s .= "$hours ".tra("hours")." "; |
445 | 445 | } |
446 | - if ($res>1 && ($minutes || strlen($s))) { |
|
446 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
447 | 447 | $s .= "$minutes ".tra("min")." "; |
448 | 448 | } |
449 | - if ($res>2) { |
|
449 | + if ($res > 2) { |
|
450 | 450 | $s .= "$seconds ".tra("sec")." "; |
451 | 451 | } |
452 | 452 | return $s; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | function time_str($x) { |
462 | 462 | if ($x == 0) return "---"; |
463 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
463 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | function local_time_str($x) { |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | return time_str($x); |
473 | 473 | } |
474 | 474 | |
475 | -function start_table_str($class="", $style="") { |
|
476 | - $s = $style?'style="'.$style.'"':''; |
|
475 | +function start_table_str($class = "", $style = "") { |
|
476 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
477 | 477 | return '<div class="table"> |
478 | 478 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
479 | 479 | '; |
480 | 480 | } |
481 | 481 | |
482 | -function start_table($class="", $style="") { |
|
482 | +function start_table($class = "", $style = "") { |
|
483 | 483 | echo start_table_str($class, $style); |
484 | 484 | } |
485 | 485 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | echo "</tr>\n"; |
525 | 525 | } |
526 | 526 | |
527 | -function row1($x, $ncols=2, $class="heading") { |
|
527 | +function row1($x, $ncols = 2, $class = "heading") { |
|
528 | 528 | if ($class == "heading") { |
529 | 529 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
530 | 530 | } else { |
@@ -538,10 +538,10 @@ discard block |
||
538 | 538 | |
539 | 539 | // a table row with 2 columns, with the left on right-aligned |
540 | 540 | |
541 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
542 | - if ($x==="") $x="<br>"; |
|
543 | - if ($y==="") $y="<br>"; |
|
544 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
541 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
542 | + if ($x === "") $x = "<br>"; |
|
543 | + if ($y === "") $y = "<br>"; |
|
544 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
545 | 545 | echo "<tr> |
546 | 546 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
547 | 547 | <td $attrs >$y</td> |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // output the first part of row2(); |
553 | 553 | // then write the content, followed by </td></tr> |
554 | 554 | |
555 | -function row2_init($x, $lwidth='40%') { |
|
555 | +function row2_init($x, $lwidth = '40%') { |
|
556 | 556 | echo sprintf('<tr> |
557 | 557 | <td width="%s" %s>%s</td> |
558 | 558 | <td %s>', |
@@ -568,31 +568,31 @@ discard block |
||
568 | 568 | echo "<tr><td>$string</td></tr>"; |
569 | 569 | } |
570 | 570 | |
571 | -function row_array($x, $attrs=null) { |
|
571 | +function row_array($x, $attrs = null) { |
|
572 | 572 | echo "<tr>\n"; |
573 | 573 | $i = 0; |
574 | 574 | foreach ($x as $h) { |
575 | - $a = $attrs?$attrs[$i]:""; |
|
575 | + $a = $attrs ? $attrs[$i] : ""; |
|
576 | 576 | echo "<td $a>$h</td>\n"; |
577 | 577 | $i++; |
578 | 578 | } |
579 | 579 | echo "</tr>\n"; |
580 | 580 | } |
581 | 581 | |
582 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
582 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
583 | 583 | |
584 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
584 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
585 | 585 | echo "<tr>"; |
586 | 586 | $i = 0; |
587 | 587 | foreach ($x as $h) { |
588 | - $a = $attrs?$attrs[$i]:""; |
|
588 | + $a = $attrs ? $attrs[$i] : ""; |
|
589 | 589 | echo "<th $a class=\"$class\">$h</th>"; |
590 | 590 | $i++; |
591 | 591 | } |
592 | 592 | echo "</tr>\n"; |
593 | 593 | } |
594 | 594 | |
595 | -function row_heading($x, $class='bg-primary') { |
|
595 | +function row_heading($x, $class = 'bg-primary') { |
|
596 | 596 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
597 | 597 | ', $class, $x |
598 | 598 | ); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
653 | 653 | // is cut short. |
654 | 654 | |
655 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
655 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
656 | 656 | $words = explode($delimiter, $sentence); |
657 | 657 | $total_chars = 0; |
658 | 658 | $trunc = false; |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | |
736 | 736 | // returns null if the arg is optional and missing |
737 | 737 | // |
738 | -function get_int($name, $optional=false) { |
|
739 | - $x=null; |
|
738 | +function get_int($name, $optional = false) { |
|
739 | + $x = null; |
|
740 | 740 | if (isset($_GET[$name])) $x = $_GET[$name]; |
741 | 741 | if (!is_numeric($x)) { |
742 | 742 | if ($optional) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | |
756 | 756 | // returns null if the arg is optional and missing |
757 | 757 | // |
758 | -function post_num($name, $optional=false) { |
|
758 | +function post_num($name, $optional = false) { |
|
759 | 759 | $x = null; |
760 | 760 | if (isset($_POST[$name])) $x = $_POST[$name]; |
761 | 761 | if (!is_numeric($x)) { |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | // returns null if the arg is optional and missing |
772 | 772 | // |
773 | -function post_int($name, $optional=false) { |
|
773 | +function post_int($name, $optional = false) { |
|
774 | 774 | $x = post_num($name, $optional); |
775 | 775 | if (is_null($x)) return null; |
776 | 776 | $y = (int)$x; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | } |
789 | 789 | } |
790 | 790 | |
791 | -function get_str($name, $optional=false) { |
|
791 | +function get_str($name, $optional = false) { |
|
792 | 792 | if (isset($_GET[$name])) { |
793 | 793 | $x = $_GET[$name]; |
794 | 794 | } else { |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | return undo_magic_quotes($x); |
801 | 801 | } |
802 | 802 | |
803 | -function post_str($name, $optional=false) { |
|
803 | +function post_str($name, $optional = false) { |
|
804 | 804 | if (isset($_POST[$name])) { |
805 | 805 | $x = $_POST[$name]; |
806 | 806 | } else { |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | return undo_magic_quotes($x); |
813 | 813 | } |
814 | 814 | |
815 | -function post_arr($name, $optional=false) { |
|
815 | +function post_arr($name, $optional = false) { |
|
816 | 816 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
817 | 817 | $x = $_POST[$name]; |
818 | 818 | } else { |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | // the mb_* functions are not included by default |
829 | 829 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
830 | 830 | |
831 | - for ($i=0; $i<strlen($str); $i++) { |
|
831 | + for ($i = 0; $i < strlen($str); $i++) { |
|
832 | 832 | $c = ord(substr($str, $i)); |
833 | 833 | if ($c < 32 || $c > 127) return false; |
834 | 834 | } |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
853 | 853 | // if no value was entered and this is ok |
854 | 854 | // |
855 | - if ($number=='' && !$low) return true; |
|
855 | + if ($number == '' && !$low) return true; |
|
856 | 856 | |
857 | 857 | // the supplied value contains alphabetic characters |
858 | 858 | // |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | |
870 | 870 | // Generate a "select" element from an array of values |
871 | 871 | // |
872 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
872 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
873 | 873 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
874 | 874 | |
875 | 875 | foreach ($array as $key => $value) { |
@@ -894,12 +894,12 @@ discard block |
||
894 | 894 | return $str; |
895 | 895 | } |
896 | 896 | |
897 | -function strip_bbcode($string){ |
|
898 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
897 | +function strip_bbcode($string) { |
|
898 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | function current_url() { |
902 | - $url = is_https()?'https':'http'; |
|
902 | + $url = is_https() ? 'https' : 'http'; |
|
903 | 903 | $url .= "://"; |
904 | 904 | $url .= $_SERVER['SERVER_NAME']; |
905 | 905 | $url .= ":".$_SERVER['SERVER_PORT']; |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | // the colors for bootstrap's btn-success are almost illegible; |
918 | 918 | // the green is too light. Use a darker green. |
919 | 919 | // |
920 | -function button_style($color='green', $font_size=null) { |
|
920 | +function button_style($color = 'green', $font_size = null) { |
|
921 | 921 | $fs = ''; |
922 | 922 | if ($font_size) { |
923 | 923 | $fs = sprintf('; font-size:%dpx', $font_size); |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | // class: class of the button, e.g. btn |
937 | 937 | // extra: Additional text in href tag |
938 | 938 | // |
939 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
939 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
940 | 940 | if (!$desc) { |
941 | 941 | $desc = $text; |
942 | 942 | } |
@@ -951,23 +951,23 @@ discard block |
||
951 | 951 | ); |
952 | 952 | } |
953 | 953 | |
954 | -function button_text_small($url, $text, $desc=null) { |
|
954 | +function button_text_small($url, $text, $desc = null) { |
|
955 | 955 | return button_text($url, $text, $desc, "btn btn-xs", button_style()); |
956 | 956 | } |
957 | 957 | |
958 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
958 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
959 | 959 | echo button_text($url, $text, $desc, $class, $extra); |
960 | 960 | } |
961 | 961 | |
962 | 962 | // for places with a bunch of buttons, like forum posts |
963 | 963 | // |
964 | -function show_button_small($url, $text, $desc=null) { |
|
964 | +function show_button_small($url, $text, $desc = null) { |
|
965 | 965 | echo button_text_small($url, $text, $desc); |
966 | 966 | } |
967 | 967 | |
968 | 968 | // used for showing icons |
969 | 969 | // |
970 | -function show_image($src, $title, $alt, $height=null) { |
|
970 | +function show_image($src, $title, $alt, $height = null) { |
|
971 | 971 | $h = ""; |
972 | 972 | if ($height) { |
973 | 973 | $h = "height=\"$height\""; |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | // tries instead to connect to <replica_db_host> if tag exists. |
1005 | 1005 | // DEPRECATED - use boinc_db.inc |
1006 | 1006 | // |
1007 | -function db_init($try_replica=false) { |
|
1007 | +function db_init($try_replica = false) { |
|
1008 | 1008 | check_web_stopped(); |
1009 | 1009 | $retval = db_init_aux($try_replica); |
1010 | 1010 | if ($retval == 1) { |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | // Check this to avoid XSS vulnerability |
1081 | 1081 | // |
1082 | 1082 | function sanitize_sort_by($x) { |
1083 | - switch($x) { |
|
1083 | + switch ($x) { |
|
1084 | 1084 | case 'expavg_credit': |
1085 | 1085 | case 'total_credit': |
1086 | 1086 | return; |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | function do_download($path) { |
1101 | - $name=basename($path); |
|
1101 | + $name = basename($path); |
|
1102 | 1102 | header('Content-Description: File Transfer'); |
1103 | 1103 | header('Content-Type: application/octet-stream'); |
1104 | 1104 | header('Content-Disposition: attachment; filename='.$name); |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | header('Expires: 0'); |
1107 | 1107 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
1108 | 1108 | header('Pragma: public'); |
1109 | - header('Content-Length: ' . filesize($path)); |
|
1109 | + header('Content-Length: '.filesize($path)); |
|
1110 | 1110 | flush(); |
1111 | 1111 | readfile($path); |
1112 | 1112 | } |
@@ -1155,10 +1155,10 @@ discard block |
||
1155 | 1155 | // Otherwise return 0. |
1156 | 1156 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1157 | 1157 | // |
1158 | -function boinc_client_version(){ |
|
1158 | +function boinc_client_version() { |
|
1159 | 1159 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1160 | 1160 | $x = $_SERVER['HTTP_USER_AGENT']; |
1161 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1161 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1162 | 1162 | if (preg_match($e, $x, $matches)) { |
1163 | 1163 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
1164 | 1164 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | $rem_name = $name."_remaining"; |
1188 | 1188 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
1189 | 1189 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
1190 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1190 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1191 | 1191 | ; |
1192 | 1192 | } |
1193 | 1193 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | // use the following around text with long lines, |
1218 | 1218 | // to limit the width and make it more readable. |
1219 | 1219 | // |
1220 | -function text_start($width=640) { |
|
1220 | +function text_start($width = 640) { |
|
1221 | 1221 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
1222 | 1222 | } |
1223 | 1223 | function text_end() { |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | function cert_filename() { |
1246 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
1246 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | // if user hasn't validated their email addr, tell them to |