@@ -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 | |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | function url_base() { |
156 | - return is_https()?secure_url_base():URL_BASE; |
|
156 | + return is_https() ?secure_url_base() : URL_BASE; |
|
157 | 157 | } |
158 | 158 | |
159 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
159 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
160 | 160 | global $master_url; |
161 | 161 | |
162 | 162 | // the following allows independent login for projects on the same server |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | $path = substr($path, 0, -1); |
168 | 168 | $path .= "_ops/"; |
169 | 169 | } |
170 | - $expire = $permanent?time()+3600*24*365:0; |
|
170 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
171 | 171 | setcookie($name, $value, $expire, $path, |
172 | 172 | '', |
173 | - is_https(), // if this page is secure, make cookie secure |
|
173 | + is_https(), // if this page is secure, make cookie secure |
|
174 | 174 | true // httponly; no JS access |
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | -function clear_cookie($name, $ops=false) { |
|
178 | +function clear_cookie($name, $ops = false) { |
|
179 | 179 | global $master_url; |
180 | 180 | $url = parse_url($master_url); |
181 | 181 | $path = $url['path']; |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | $path = substr($path, 0, -1); |
184 | 184 | $path .= "_ops/"; |
185 | 185 | } |
186 | - setcookie($name, '', time()-3600, $path); |
|
186 | + setcookie($name, '', time() - 3600, $path); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $g_logged_in_user = null; |
190 | 190 | $got_logged_in_user = false; |
191 | 191 | |
192 | -function get_logged_in_user($must_be_logged_in=true) { |
|
192 | +function get_logged_in_user($must_be_logged_in = true) { |
|
193 | 193 | global $g_logged_in_user, $got_logged_in_user; |
194 | 194 | if ($got_logged_in_user) { |
195 | 195 | // this could have been called earlier with $must_be_logged_in false |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $next_url = $_SERVER['REQUEST_URI']; |
216 | 216 | $n = strrpos($next_url, "/"); |
217 | 217 | if ($n) { |
218 | - $next_url = substr($next_url, $n+1); |
|
218 | + $next_url = substr($next_url, $n + 1); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | $next_url = urlencode($next_url); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $g_logged_in_user; |
227 | 227 | } |
228 | 228 | |
229 | -function show_login_info($prefix="") { |
|
229 | +function show_login_info($prefix = "") { |
|
230 | 230 | $user = get_logged_in_user(false); |
231 | 231 | if ($user) { |
232 | 232 | $url_tokens = url_tokens($user->authenticator); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | -$cache_control_extra=""; |
|
239 | +$cache_control_extra = ""; |
|
240 | 240 | $is_login_page = false; |
241 | 241 | |
242 | 242 | // Call this to start pages. |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | // with an existing web framework can more easily do so. |
249 | 249 | // To do so, define page_head() in html/project/project.inc |
250 | 250 | // |
251 | -if (!function_exists("page_head")){ |
|
251 | +if (!function_exists("page_head")) { |
|
252 | 252 | function page_head( |
253 | 253 | $title, |
254 | 254 | // page title. Put in <title>, used as title for browser tab. |
255 | - $body_attrs=null, |
|
255 | + $body_attrs = null, |
|
256 | 256 | // <body XXXX> |
257 | 257 | // e.g. Javascript to put focus in an input field |
258 | 258 | // (onload="document.form.foo.focus()") |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | // if set, include schedulers.txt. |
262 | 262 | // also pass to project_banner() in case you want a different |
263 | 263 | // header for your main page. |
264 | - $url_prefix="", |
|
264 | + $url_prefix = "", |
|
265 | 265 | // prepend this to links. |
266 | 266 | // Use for web pages not in the top directory |
267 | - $head_extra=null |
|
267 | + $head_extra = null |
|
268 | 268 | // extra stuff to put in <head>. E.g.: |
269 | 269 | // reCAPTCHA code (create_profile.php) |
270 | 270 | // bbcode javascript (forums) |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | header("Content-type: text/html; charset=utf-8"); |
287 | 287 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
288 | 288 | // Date in the past |
289 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
289 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
290 | 290 | // always modified |
291 | 291 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
292 | 292 | // for HTTP/1.1 |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | if ($head_extra) { |
310 | 310 | echo "\n$head_extra\n"; |
311 | 311 | } |
312 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
312 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
313 | 313 | readfile("schedulers.txt"); |
314 | 314 | } |
315 | 315 | |
316 | - $t = $title?$title:PROJECT; |
|
316 | + $t = $title ? $title : PROJECT; |
|
317 | 317 | echo "<title>$t</title>\n"; |
318 | 318 | echo ' |
319 | 319 | <meta charset="utf-8"> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | echo '<div class="container-fluid"> |
370 | 370 | '; |
371 | 371 | |
372 | - switch($title) { //kludge |
|
372 | + switch ($title) { //kludge |
|
373 | 373 | case tra("Log in"): |
374 | 374 | case tra("Create an account"): |
375 | 375 | case tra("Server status page"): |
@@ -384,13 +384,13 @@ discard block |
||
384 | 384 | |
385 | 385 | // See the comments for page_head() |
386 | 386 | // |
387 | -if (!function_exists("page_tail")){ |
|
387 | +if (!function_exists("page_tail")) { |
|
388 | 388 | function page_tail( |
389 | - $show_date=false, |
|
389 | + $show_date = false, |
|
390 | 390 | // true for pages that are generated periodically rather than on the fly |
391 | - $url_prefix="", |
|
391 | + $url_prefix = "", |
|
392 | 392 | // use for pages not at top level |
393 | - $is_main=false |
|
393 | + $is_main = false |
|
394 | 394 | // passed to project_footer; |
395 | 395 | ) { |
396 | 396 | echo "<br>\n"; |
@@ -424,24 +424,24 @@ discard block |
||
424 | 424 | // convert time interval in seconds to a string of the form |
425 | 425 | // 'D days h hours m min s sec'. |
426 | 426 | |
427 | -function time_diff($x, $res=3) { |
|
427 | +function time_diff($x, $res = 3) { |
|
428 | 428 | $x = (int)$x; |
429 | 429 | $days = (int)($x/86400); |
430 | - $hours = (int)(($x-$days*86400)/3600); |
|
431 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
432 | - $seconds = $x % 60; |
|
430 | + $hours = (int)(($x - $days*86400)/3600); |
|
431 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
432 | + $seconds = $x%60; |
|
433 | 433 | |
434 | 434 | $s = ""; |
435 | 435 | if ($days) { |
436 | 436 | $s .= "$days ".tra("days")." "; |
437 | 437 | } |
438 | - if ($res>0 && ($hours || strlen($s))) { |
|
438 | + if ($res > 0 && ($hours || strlen($s))) { |
|
439 | 439 | $s .= "$hours ".tra("hours")." "; |
440 | 440 | } |
441 | - if ($res>1 && ($minutes || strlen($s))) { |
|
441 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
442 | 442 | $s .= "$minutes ".tra("min")." "; |
443 | 443 | } |
444 | - if ($res>2) { |
|
444 | + if ($res > 2) { |
|
445 | 445 | $s .= "$seconds ".tra("sec")." "; |
446 | 446 | } |
447 | 447 | return $s; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | function time_str($x) { |
457 | 457 | if ($x == 0) return "---"; |
458 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
458 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | function local_time_str($x) { |
@@ -467,14 +467,14 @@ discard block |
||
467 | 467 | return time_str($x); |
468 | 468 | } |
469 | 469 | |
470 | -function start_table_str($class="", $style="") { |
|
471 | - $s = $style?'style="'.$style.'"':''; |
|
470 | +function start_table_str($class = "", $style = "") { |
|
471 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
472 | 472 | return '<div class="table"> |
473 | 473 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
474 | 474 | '; |
475 | 475 | } |
476 | 476 | |
477 | -function start_table($class="", $style="") { |
|
477 | +function start_table($class = "", $style = "") { |
|
478 | 478 | echo start_table_str($class, $style); |
479 | 479 | } |
480 | 480 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | echo "</tr>\n"; |
520 | 520 | } |
521 | 521 | |
522 | -function row1($x, $ncols=2, $class="heading") { |
|
522 | +function row1($x, $ncols = 2, $class = "heading") { |
|
523 | 523 | if ($class == "heading") { |
524 | 524 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
525 | 525 | } else { |
@@ -533,10 +533,10 @@ discard block |
||
533 | 533 | |
534 | 534 | // a table row with 2 columns, with the left on right-aligned |
535 | 535 | |
536 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
537 | - if ($x==="") $x="<br>"; |
|
538 | - if ($y==="") $y="<br>"; |
|
539 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
536 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
537 | + if ($x === "") $x = "<br>"; |
|
538 | + if ($y === "") $y = "<br>"; |
|
539 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
540 | 540 | echo "<tr> |
541 | 541 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
542 | 542 | <td $attrs >$y</td> |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // output the first part of row2(); |
548 | 548 | // then write the content, followed by </td></tr> |
549 | 549 | |
550 | -function row2_init($x, $lwidth='40%') { |
|
550 | +function row2_init($x, $lwidth = '40%') { |
|
551 | 551 | echo sprintf('<tr> |
552 | 552 | <td width="%s" %s>%s</td> |
553 | 553 | <td %s>', |
@@ -563,31 +563,31 @@ discard block |
||
563 | 563 | echo "<tr><td>$string</td></tr>"; |
564 | 564 | } |
565 | 565 | |
566 | -function row_array($x, $attrs=null) { |
|
566 | +function row_array($x, $attrs = null) { |
|
567 | 567 | echo "<tr>\n"; |
568 | 568 | $i = 0; |
569 | 569 | foreach ($x as $h) { |
570 | - $a = $attrs?$attrs[$i]:""; |
|
570 | + $a = $attrs ? $attrs[$i] : ""; |
|
571 | 571 | echo "<td $a>$h</td>\n"; |
572 | 572 | $i++; |
573 | 573 | } |
574 | 574 | echo "</tr>\n"; |
575 | 575 | } |
576 | 576 | |
577 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
577 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
578 | 578 | |
579 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
579 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
580 | 580 | echo "<tr>"; |
581 | 581 | $i = 0; |
582 | 582 | foreach ($x as $h) { |
583 | - $a = $attrs?$attrs[$i]:""; |
|
583 | + $a = $attrs ? $attrs[$i] : ""; |
|
584 | 584 | echo "<th $a class=\"$class\">$h</th>"; |
585 | 585 | $i++; |
586 | 586 | } |
587 | 587 | echo "</tr>\n"; |
588 | 588 | } |
589 | 589 | |
590 | -function row_heading($x, $class='bg-primary') { |
|
590 | +function row_heading($x, $class = 'bg-primary') { |
|
591 | 591 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
592 | 592 | ', $class, $x |
593 | 593 | ); |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
648 | 648 | // is cut short. |
649 | 649 | |
650 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
650 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
651 | 651 | $words = explode($delimiter, $sentence); |
652 | 652 | $total_chars = 0; |
653 | 653 | $trunc = false; |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | |
731 | 731 | // returns null if the arg is optional and missing |
732 | 732 | // |
733 | -function get_int($name, $optional=false) { |
|
734 | - $x=null; |
|
733 | +function get_int($name, $optional = false) { |
|
734 | + $x = null; |
|
735 | 735 | if (isset($_GET[$name])) $x = $_GET[$name]; |
736 | 736 | if (!is_numeric($x)) { |
737 | 737 | if ($optional) { |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | |
751 | 751 | // returns null if the arg is optional and missing |
752 | 752 | // |
753 | -function post_num($name, $optional=false) { |
|
753 | +function post_num($name, $optional = false) { |
|
754 | 754 | $x = null; |
755 | 755 | if (isset($_POST[$name])) $x = $_POST[$name]; |
756 | 756 | if (!is_numeric($x)) { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | |
766 | 766 | // returns null if the arg is optional and missing |
767 | 767 | // |
768 | -function post_int($name, $optional=false) { |
|
768 | +function post_int($name, $optional = false) { |
|
769 | 769 | $x = post_num($name, $optional); |
770 | 770 | if (is_null($x)) return null; |
771 | 771 | $y = (int)$x; |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | } |
784 | 784 | } |
785 | 785 | |
786 | -function get_str($name, $optional=false) { |
|
786 | +function get_str($name, $optional = false) { |
|
787 | 787 | if (isset($_GET[$name])) { |
788 | 788 | $x = $_GET[$name]; |
789 | 789 | } else { |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | return undo_magic_quotes($x); |
796 | 796 | } |
797 | 797 | |
798 | -function post_str($name, $optional=false) { |
|
798 | +function post_str($name, $optional = false) { |
|
799 | 799 | if (isset($_POST[$name])) { |
800 | 800 | $x = $_POST[$name]; |
801 | 801 | } else { |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | return undo_magic_quotes($x); |
808 | 808 | } |
809 | 809 | |
810 | -function post_arr($name, $optional=false) { |
|
810 | +function post_arr($name, $optional = false) { |
|
811 | 811 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
812 | 812 | $x = $_POST[$name]; |
813 | 813 | } else { |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | // the mb_* functions are not included by default |
824 | 824 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
825 | 825 | |
826 | - for ($i=0; $i<strlen($str); $i++) { |
|
826 | + for ($i = 0; $i < strlen($str); $i++) { |
|
827 | 827 | $c = ord(substr($str, $i)); |
828 | 828 | if ($c < 32 || $c > 127) return false; |
829 | 829 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
848 | 848 | // if no value was entered and this is ok |
849 | 849 | // |
850 | - if ($number=='' && !$low) return true; |
|
850 | + if ($number == '' && !$low) return true; |
|
851 | 851 | |
852 | 852 | // the supplied value contains alphabetic characters |
853 | 853 | // |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | |
865 | 865 | // Generate a "select" element from an array of values |
866 | 866 | // |
867 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
867 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
868 | 868 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
869 | 869 | |
870 | 870 | foreach ($array as $key => $value) { |
@@ -889,12 +889,12 @@ discard block |
||
889 | 889 | return $str; |
890 | 890 | } |
891 | 891 | |
892 | -function strip_bbcode($string){ |
|
893 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
892 | +function strip_bbcode($string) { |
|
893 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | function current_url() { |
897 | - $url = is_https()?'https':'http'; |
|
897 | + $url = is_https() ? 'https' : 'http'; |
|
898 | 898 | $url .= "://"; |
899 | 899 | $url .= $_SERVER['SERVER_NAME']; |
900 | 900 | $url .= ":".$_SERVER['SERVER_PORT']; |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | // the colors for bootstrap's btn-success are almost illegible; |
913 | 913 | // the green is too light. Use a darker green. |
914 | 914 | // |
915 | -function button_style($color='green', $font_size=null) { |
|
915 | +function button_style($color = 'green', $font_size = null) { |
|
916 | 916 | $fs = ''; |
917 | 917 | if ($font_size) { |
918 | 918 | $fs = sprintf('; font-size:%dpx', $font_size); |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | // class: class of the button, e.g. btn |
932 | 932 | // extra: Additional text in href tag |
933 | 933 | // |
934 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
934 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
935 | 935 | if (!$desc) { |
936 | 936 | $desc = $text; |
937 | 937 | } |
@@ -946,23 +946,23 @@ discard block |
||
946 | 946 | ); |
947 | 947 | } |
948 | 948 | |
949 | -function button_text_small($url, $text, $desc=null) { |
|
949 | +function button_text_small($url, $text, $desc = null) { |
|
950 | 950 | return button_text($url, $text, $desc, "btn btn-xs", button_style()); |
951 | 951 | } |
952 | 952 | |
953 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
953 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
954 | 954 | echo button_text($url, $text, $desc, $class, $extra); |
955 | 955 | } |
956 | 956 | |
957 | 957 | // for places with a bunch of buttons, like forum posts |
958 | 958 | // |
959 | -function show_button_small($url, $text, $desc=null) { |
|
959 | +function show_button_small($url, $text, $desc = null) { |
|
960 | 960 | echo button_text_small($url, $text, $desc); |
961 | 961 | } |
962 | 962 | |
963 | 963 | // used for showing icons |
964 | 964 | // |
965 | -function show_image($src, $title, $alt, $height=null) { |
|
965 | +function show_image($src, $title, $alt, $height = null) { |
|
966 | 966 | $h = ""; |
967 | 967 | if ($height) { |
968 | 968 | $h = "height=\"$height\""; |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | // tries instead to connect to <replica_db_host> if tag exists. |
1000 | 1000 | // DEPRECATED - use boinc_db.inc |
1001 | 1001 | // |
1002 | -function db_init($try_replica=false) { |
|
1002 | +function db_init($try_replica = false) { |
|
1003 | 1003 | check_web_stopped(); |
1004 | 1004 | $retval = db_init_aux($try_replica); |
1005 | 1005 | if ($retval == 1) { |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | // Check this to avoid XSS vulnerability |
1076 | 1076 | // |
1077 | 1077 | function sanitize_sort_by($x) { |
1078 | - switch($x) { |
|
1078 | + switch ($x) { |
|
1079 | 1079 | case 'expavg_credit': |
1080 | 1080 | case 'total_credit': |
1081 | 1081 | return; |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | function do_download($path) { |
1096 | - $name=basename($path); |
|
1096 | + $name = basename($path); |
|
1097 | 1097 | header('Content-Description: File Transfer'); |
1098 | 1098 | header('Content-Type: application/octet-stream'); |
1099 | 1099 | header('Content-Disposition: attachment; filename='.$name); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | header('Expires: 0'); |
1102 | 1102 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
1103 | 1103 | header('Pragma: public'); |
1104 | - header('Content-Length: ' . filesize($path)); |
|
1104 | + header('Content-Length: '.filesize($path)); |
|
1105 | 1105 | flush(); |
1106 | 1106 | readfile($path); |
1107 | 1107 | } |
@@ -1150,10 +1150,10 @@ discard block |
||
1150 | 1150 | // Otherwise return 0. |
1151 | 1151 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1152 | 1152 | // |
1153 | -function boinc_client_version(){ |
|
1153 | +function boinc_client_version() { |
|
1154 | 1154 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1155 | 1155 | $x = $_SERVER['HTTP_USER_AGENT']; |
1156 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1156 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1157 | 1157 | if (preg_match($e, $x, $matches)) { |
1158 | 1158 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
1159 | 1159 | } |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $rem_name = $name."_remaining"; |
1183 | 1183 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
1184 | 1184 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
1185 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1185 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1186 | 1186 | ; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | // use the following around text with long lines, |
1213 | 1213 | // to limit the width and make it more readable. |
1214 | 1214 | // |
1215 | -function text_start($width=640) { |
|
1215 | +function text_start($width = 640) { |
|
1216 | 1216 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
1217 | 1217 | } |
1218 | 1218 | function text_end() { |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | function cert_filename() { |
1241 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
1241 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // if user hasn't validated their email addr, tell them to |