@@ -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 | |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | function url_base() { |
| 139 | - return is_https()?secure_url_base():URL_BASE; |
|
| 139 | + return is_https() ?secure_url_base() : URL_BASE; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
| 142 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
| 143 | 143 | global $master_url; |
| 144 | 144 | |
| 145 | 145 | // the following allows independent login for projects on the same server |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | $path = substr($path, 0, -1); |
| 151 | 151 | $path .= "_ops/"; |
| 152 | 152 | } |
| 153 | - $expire = $permanent?time()+3600*24*365:0; |
|
| 153 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
| 154 | 154 | setcookie($name, $value, $expire, $path); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -function clear_cookie($name, $ops=false) { |
|
| 157 | +function clear_cookie($name, $ops = false) { |
|
| 158 | 158 | global $master_url; |
| 159 | 159 | $url = parse_url($master_url); |
| 160 | 160 | $path = $url['path']; |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | $path = substr($path, 0, -1); |
| 163 | 163 | $path .= "_ops/"; |
| 164 | 164 | } |
| 165 | - setcookie($name, '', time()-3600, $path); |
|
| 165 | + setcookie($name, '', time() - 3600, $path); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $g_logged_in_user = null; |
| 169 | 169 | $got_logged_in_user = false; |
| 170 | 170 | |
| 171 | -function get_logged_in_user($must_be_logged_in=true) { |
|
| 171 | +function get_logged_in_user($must_be_logged_in = true) { |
|
| 172 | 172 | global $g_logged_in_user, $got_logged_in_user; |
| 173 | 173 | if ($got_logged_in_user) { |
| 174 | 174 | // this could have been called earlier with $must_be_logged_in false |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $next_url = $_SERVER['REQUEST_URI']; |
| 195 | 195 | $n = strrpos($next_url, "/"); |
| 196 | 196 | if ($n) { |
| 197 | - $next_url = substr($next_url, $n+1); |
|
| 197 | + $next_url = substr($next_url, $n + 1); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | $next_url = urlencode($next_url); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | return $g_logged_in_user; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | -function show_login_info($prefix="") { |
|
| 208 | +function show_login_info($prefix = "") { |
|
| 209 | 209 | $user = get_logged_in_user(false); |
| 210 | 210 | if ($user) { |
| 211 | 211 | $url_tokens = url_tokens($user->authenticator); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -$cache_control_extra=""; |
|
| 218 | +$cache_control_extra = ""; |
|
| 219 | 219 | $is_login_page = false; |
| 220 | 220 | |
| 221 | 221 | // Call this to start pages. |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | // with an existing web framework can more easily do so. |
| 228 | 228 | // To do so, define page_head() in the project include file. |
| 229 | 229 | // |
| 230 | -if (!function_exists("page_head")){ |
|
| 230 | +if (!function_exists("page_head")) { |
|
| 231 | 231 | function page_head( |
| 232 | 232 | $title, |
| 233 | 233 | // page title. Put in <title>, used as title for browser tab. |
| 234 | - $body_attrs=null, |
|
| 234 | + $body_attrs = null, |
|
| 235 | 235 | // <body XXXX> |
| 236 | 236 | // e.g. Javascript to put focus in an input field |
| 237 | 237 | // (onload="document.form.foo.focus()") |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | // if set, include schedulers.txt. |
| 241 | 241 | // also pass to project_banner() in case you want a different |
| 242 | 242 | // header for your main page. |
| 243 | - $url_prefix="", |
|
| 243 | + $url_prefix = "", |
|
| 244 | 244 | // prepend this to links. |
| 245 | 245 | // Use for web pages not in the top directory |
| 246 | - $head_extra=null |
|
| 246 | + $head_extra = null |
|
| 247 | 247 | // extra stuff to put in <head>. E.g.: |
| 248 | 248 | // reCAPTCHA code (create_profile.php) |
| 249 | 249 | // bbcode javascript (forums) |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | header("Content-type: text/html; charset=utf-8"); |
| 266 | 266 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
| 267 | 267 | // Date in the past |
| 268 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
| 268 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
| 269 | 269 | // always modified |
| 270 | 270 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
| 271 | 271 | // for HTTP/1.1 |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | if ($head_extra) { |
| 287 | 287 | echo "\n$head_extra\n"; |
| 288 | 288 | } |
| 289 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
| 289 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
| 290 | 290 | readfile("schedulers.txt"); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - $t = $title?$title:PROJECT; |
|
| 293 | + $t = $title ? $title : PROJECT; |
|
| 294 | 294 | echo "<title>$t</title>\n"; |
| 295 | 295 | echo ' |
| 296 | 296 | <meta charset="utf-8"> |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | echo '<div class="container-fluid"> |
| 348 | 348 | '; |
| 349 | 349 | |
| 350 | - switch($title) { //kludge |
|
| 350 | + switch ($title) { //kludge |
|
| 351 | 351 | case tra("Log in"): |
| 352 | 352 | case tra("Create an account"): |
| 353 | 353 | case tra("Server status page"): |
@@ -362,13 +362,13 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | // See the comments for page_head() |
| 364 | 364 | // |
| 365 | -if (!function_exists("page_tail")){ |
|
| 365 | +if (!function_exists("page_tail")) { |
|
| 366 | 366 | function page_tail( |
| 367 | - $show_date=false, |
|
| 367 | + $show_date = false, |
|
| 368 | 368 | // true for pages that are generated periodically rather than on the fly |
| 369 | - $url_prefix="", |
|
| 369 | + $url_prefix = "", |
|
| 370 | 370 | // use for pages not at top level |
| 371 | - $is_main=false |
|
| 371 | + $is_main = false |
|
| 372 | 372 | // passed to project_footer; |
| 373 | 373 | ) { |
| 374 | 374 | echo "<br>\n"; |
@@ -383,10 +383,10 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | -function display_cvs_versions(){ |
|
| 386 | +function display_cvs_versions() { |
|
| 387 | 387 | global $cvs_version_tracker; |
| 388 | 388 | echo "\n<!-- SVN VERSIONS -->\n"; |
| 389 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
| 389 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
| 390 | 390 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
| 391 | 391 | } |
| 392 | 392 | } |
@@ -411,24 +411,24 @@ discard block |
||
| 411 | 411 | // convert time interval in seconds to a string of the form |
| 412 | 412 | // 'D days h hours m min s sec'. |
| 413 | 413 | |
| 414 | -function time_diff($x, $res=3) { |
|
| 414 | +function time_diff($x, $res = 3) { |
|
| 415 | 415 | $x = (int)$x; |
| 416 | 416 | $days = (int)($x/86400); |
| 417 | - $hours = (int)(($x-$days*86400)/3600); |
|
| 418 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
| 419 | - $seconds = $x % 60; |
|
| 417 | + $hours = (int)(($x - $days*86400)/3600); |
|
| 418 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
| 419 | + $seconds = $x%60; |
|
| 420 | 420 | |
| 421 | 421 | $s = ""; |
| 422 | 422 | if ($days) { |
| 423 | 423 | $s .= "$days ".tra("days")." "; |
| 424 | 424 | } |
| 425 | - if ($res>0 && ($hours || strlen($s))) { |
|
| 425 | + if ($res > 0 && ($hours || strlen($s))) { |
|
| 426 | 426 | $s .= "$hours ".tra("hours")." "; |
| 427 | 427 | } |
| 428 | - if ($res>1 && ($minutes || strlen($s))) { |
|
| 428 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
| 429 | 429 | $s .= "$minutes ".tra("min")." "; |
| 430 | 430 | } |
| 431 | - if ($res>2) { |
|
| 431 | + if ($res > 2) { |
|
| 432 | 432 | $s .= "$seconds ".tra("sec")." "; |
| 433 | 433 | } |
| 434 | 434 | return $s; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | function time_str($x) { |
| 444 | 444 | if ($x == 0) return "---"; |
| 445 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
| 445 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | function local_time_str($x) { |
@@ -454,14 +454,14 @@ discard block |
||
| 454 | 454 | return time_str($x); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | -function start_table_str($class="", $style="") { |
|
| 458 | - $s = $style?'style="'.$style.'"':''; |
|
| 457 | +function start_table_str($class = "", $style = "") { |
|
| 458 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
| 459 | 459 | return '<div class="table"> |
| 460 | 460 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
| 461 | 461 | '; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | -function start_table($class="", $style="") { |
|
| 464 | +function start_table($class = "", $style = "") { |
|
| 465 | 465 | echo start_table_str($class, $style); |
| 466 | 466 | } |
| 467 | 467 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | echo "</tr>\n"; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | -function row1($x, $ncols=2, $class="heading") { |
|
| 509 | +function row1($x, $ncols = 2, $class = "heading") { |
|
| 510 | 510 | if ($class == "heading") { |
| 511 | 511 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
| 512 | 512 | } else { |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | define('VALUE_ATTRS', 'style="padding-left:12px"'); |
| 519 | 519 | define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"'); |
| 520 | 520 | |
| 521 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
| 522 | - if ($x==="") $x="<br>"; |
|
| 523 | - if ($y==="") $y="<br>"; |
|
| 524 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 521 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
| 522 | + if ($x === "") $x = "<br>"; |
|
| 523 | + if ($y === "") $y = "<br>"; |
|
| 524 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
| 525 | 525 | echo "<tr> |
| 526 | 526 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
| 527 | 527 | <td $attrs >$y</td> |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | "; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | -function row2_init($x, $y, $lwidth='40%') { |
|
| 532 | +function row2_init($x, $y, $lwidth = '40%') { |
|
| 533 | 533 | echo '<tr> |
| 534 | 534 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
| 535 | 535 | <td '.VALUE_ATTRS.'>'.$y.' |
@@ -552,20 +552,20 @@ discard block |
||
| 552 | 552 | echo "</tr>\n"; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 555 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
| 556 | 556 | |
| 557 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
| 557 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
| 558 | 558 | echo "<tr>"; |
| 559 | 559 | $i = 0; |
| 560 | 560 | foreach ($x as $h) { |
| 561 | - $a = $attrs?$attrs[$i]:""; |
|
| 561 | + $a = $attrs ? $attrs[$i] : ""; |
|
| 562 | 562 | echo "<th $a class=\"$class\">$h</th>"; |
| 563 | 563 | $i++; |
| 564 | 564 | } |
| 565 | 565 | echo "</tr>\n"; |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | -function row_heading($x, $class='bg-primary') { |
|
| 568 | +function row_heading($x, $class = 'bg-primary') { |
|
| 569 | 569 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
| 570 | 570 | ', $class, $x |
| 571 | 571 | ); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
| 626 | 626 | // is cut short. |
| 627 | 627 | |
| 628 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
| 628 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
| 629 | 629 | $words = explode($delimiter, $sentence); |
| 630 | 630 | $total_chars = 0; |
| 631 | 631 | $trunc = false; |
@@ -708,8 +708,8 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | // returns null if the arg is optional and missing |
| 710 | 710 | // |
| 711 | -function get_int($name, $optional=false) { |
|
| 712 | - $x=null; |
|
| 711 | +function get_int($name, $optional = false) { |
|
| 712 | + $x = null; |
|
| 713 | 713 | if (isset($_GET[$name])) $x = $_GET[$name]; |
| 714 | 714 | if (!is_numeric($x)) { |
| 715 | 715 | if ($optional) { |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | |
| 729 | 729 | // returns null if the arg is optional and missing |
| 730 | 730 | // |
| 731 | -function post_num($name, $optional=false) { |
|
| 731 | +function post_num($name, $optional = false) { |
|
| 732 | 732 | $x = null; |
| 733 | 733 | if (isset($_POST[$name])) $x = $_POST[$name]; |
| 734 | 734 | if (!is_numeric($x)) { |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | // returns null if the arg is optional and missing |
| 745 | 745 | // |
| 746 | -function post_int($name, $optional=false) { |
|
| 746 | +function post_int($name, $optional = false) { |
|
| 747 | 747 | $x = post_num($name, $optional); |
| 748 | 748 | if (is_null($x)) return null; |
| 749 | 749 | $y = (int)$x; |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | -function get_str($name, $optional=false) { |
|
| 764 | +function get_str($name, $optional = false) { |
|
| 765 | 765 | if (isset($_GET[$name])) { |
| 766 | 766 | $x = $_GET[$name]; |
| 767 | 767 | } else { |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | return undo_magic_quotes($x); |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | -function post_str($name, $optional=false) { |
|
| 776 | +function post_str($name, $optional = false) { |
|
| 777 | 777 | if (isset($_POST[$name])) { |
| 778 | 778 | $x = $_POST[$name]; |
| 779 | 779 | } else { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | return undo_magic_quotes($x); |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | -function post_arr($name, $optional=false) { |
|
| 788 | +function post_arr($name, $optional = false) { |
|
| 789 | 789 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
| 790 | 790 | $x = $_POST[$name]; |
| 791 | 791 | } else { |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | // the mb_* functions are not included by default |
| 802 | 802 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
| 803 | 803 | |
| 804 | - for ($i=0; $i<strlen($str); $i++) { |
|
| 804 | + for ($i = 0; $i < strlen($str); $i++) { |
|
| 805 | 805 | $c = ord(substr($str, $i)); |
| 806 | 806 | if ($c < 32 || $c > 127) return false; |
| 807 | 807 | } |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
| 826 | 826 | // if no value was entered and this is ok |
| 827 | 827 | // |
| 828 | - if ($number=='' && !$low) return true; |
|
| 828 | + if ($number == '' && !$low) return true; |
|
| 829 | 829 | |
| 830 | 830 | // the supplied value contains alphabetic characters |
| 831 | 831 | // |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | |
| 843 | 843 | // Generate a "select" element from an array of values |
| 844 | 844 | // |
| 845 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
| 845 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
| 846 | 846 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
| 847 | 847 | |
| 848 | 848 | foreach ($array as $key => $value) { |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | return $str; |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | -function strip_bbcode($string){ |
|
| 871 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
| 870 | +function strip_bbcode($string) { |
|
| 871 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | function current_url() { |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | // @params extra Additional text in href tag |
| 898 | 898 | // |
| 899 | 899 | |
| 900 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
| 900 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
| 901 | 901 | if (!$desc) { |
| 902 | 902 | $desc = $text; |
| 903 | 903 | } |
@@ -909,19 +909,19 @@ discard block |
||
| 909 | 909 | ); |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
| 912 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
| 913 | 913 | echo button_text($url, $text, $desc, $class, $extra); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // for places with a bunch of buttons, like forum posts |
| 917 | 917 | // |
| 918 | -function show_button_small($url, $text, $desc=null) { |
|
| 918 | +function show_button_small($url, $text, $desc = null) { |
|
| 919 | 919 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | // used for showing icons |
| 923 | 923 | // |
| 924 | -function show_image($src, $title, $alt, $height=null) { |
|
| 924 | +function show_image($src, $title, $alt, $height = null) { |
|
| 925 | 925 | $h = ""; |
| 926 | 926 | if ($height) { |
| 927 | 927 | $h = "height=\"$height\""; |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | // tries instead to connect to <replica_db_host> if tag exists. |
| 959 | 959 | // DEPRECATED - use boinc_db.inc |
| 960 | 960 | // |
| 961 | -function db_init($try_replica=false) { |
|
| 961 | +function db_init($try_replica = false) { |
|
| 962 | 962 | check_web_stopped(); |
| 963 | 963 | $retval = db_init_aux($try_replica); |
| 964 | 964 | if ($retval == 1) { |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | // Check this to avoid XSS vulnerability |
| 1050 | 1050 | // |
| 1051 | 1051 | function sanitize_sort_by($x) { |
| 1052 | - switch($x) { |
|
| 1052 | + switch ($x) { |
|
| 1053 | 1053 | case 'expavg_credit': |
| 1054 | 1054 | case 'total_credit': |
| 1055 | 1055 | return; |
@@ -1066,9 +1066,9 @@ discard block |
||
| 1066 | 1066 | return $c/(200/24); |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | -function do_download($path,$name="") { |
|
| 1070 | - if (strcmp($name,"") == 0) { |
|
| 1071 | - $name=basename($path); |
|
| 1069 | +function do_download($path, $name = "") { |
|
| 1070 | + if (strcmp($name, "") == 0) { |
|
| 1071 | + $name = basename($path); |
|
| 1072 | 1072 | } |
| 1073 | 1073 | header('Content-Description: File Transfer'); |
| 1074 | 1074 | header('Content-Type: application/octet-stream'); |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | header('Expires: 0'); |
| 1078 | 1078 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 1079 | 1079 | header('Pragma: public'); |
| 1080 | - header('Content-Length: ' . filesize($path)); |
|
| 1080 | + header('Content-Length: '.filesize($path)); |
|
| 1081 | 1081 | flush(); |
| 1082 | 1082 | readfile($path); |
| 1083 | 1083 | } |
@@ -1126,10 +1126,10 @@ discard block |
||
| 1126 | 1126 | // Otherwise return 0. |
| 1127 | 1127 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1128 | 1128 | // |
| 1129 | -function boinc_client_version(){ |
|
| 1129 | +function boinc_client_version() { |
|
| 1130 | 1130 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1131 | 1131 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1132 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1132 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
| 1133 | 1133 | if (preg_match($e, $x, $matches)) { |
| 1134 | 1134 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
| 1135 | 1135 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | $rem_name = $name."_remaining"; |
| 1159 | 1159 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
| 1160 | 1160 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
| 1161 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1161 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
| 1162 | 1162 | ; |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | // use the following around text with long lines, |
| 1189 | 1189 | // to limit the width and make it more readable. |
| 1190 | 1190 | // |
| 1191 | -function text_start($width=640) { |
|
| 1191 | +function text_start($width = 640) { |
|
| 1192 | 1192 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
| 1193 | 1193 | } |
| 1194 | 1194 | function text_end() { |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | 1216 | function cert_filename() { |
| 1217 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
| 1217 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | // if user hasn't validated their email addr, tell them to |
@@ -1231,6 +1231,6 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 1234 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 1235 | 1235 | |
| 1236 | 1236 | ?> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | display_errors(); |
| 19 | 19 | |
| 20 | -$debug=0; |
|
| 20 | +$debug = 0; |
|
| 21 | 21 | |
| 22 | 22 | // test a LAMMPS job |
| 23 | 23 | // |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | // output: success flag, CPU time per step, est. disk usage per job |
| 31 | 31 | // |
| 32 | 32 | function terminate_job($p) { |
| 33 | - $pstatus=proc_get_status($p); |
|
| 34 | - $ppid=$pstatus['pid']; |
|
| 35 | - $ret=`ps -o pid --no-heading --ppid $ppid`; |
|
| 33 | + $pstatus = proc_get_status($p); |
|
| 34 | + $ppid = $pstatus['pid']; |
|
| 35 | + $ret = `ps -o pid --no-heading --ppid $ppid`; |
|
| 36 | 36 | //echo "parent pid is $ppid\nterninate it\n"; |
| 37 | 37 | proc_terminate($p); |
| 38 | 38 | // echo "child process is $ret\n"; |
| 39 | - $pids=preg_split('/\s+/',$ret); |
|
| 40 | - foreach($pids as $pid){ |
|
| 41 | - if(is_numeric($pid)){ |
|
| 42 | - if($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 43 | - posix_kill($pid,9); |
|
| 39 | + $pids = preg_split('/\s+/', $ret); |
|
| 40 | + foreach ($pids as $pid) { |
|
| 41 | + if (is_numeric($pid)) { |
|
| 42 | + if ($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 43 | + posix_kill($pid, 9); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | $descs = array(); |
| 52 | 52 | $pipes = array(); |
| 53 | 53 | $options = file("cmd_variables"); |
| 54 | - $options[0] = chop($options[0],"\n"); |
|
| 54 | + $options[0] = chop($options[0], "\n"); |
|
| 55 | 55 | $cmd = "../lmp_linux ".$options[0]."&>output"; |
| 56 | 56 | if ($GLOBALS["debug"]) echo $cmd."<br>"; |
| 57 | 57 | system("unzip pot_files >/dev/null"); |
| 58 | 58 | $stime = time(); |
| 59 | 59 | $p = proc_open("$cmd", $descs, $pipes); |
| 60 | 60 | while (1) { |
| 61 | - $ctime=time(); |
|
| 62 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 63 | - if($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 61 | + $ctime = time(); |
|
| 62 | + if ($ctime - $stime >= 2 and !file_exists("log.1")) { |
|
| 63 | + if ($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 64 | 64 | terminate_job($p); |
| 65 | 65 | break; |
| 66 | 66 | } |
| 67 | 67 | if (file_exists("log.1")) { |
| 68 | 68 | list($avg_cpu, $test_steps) = calc_step_cpu("log.1"); |
| 69 | 69 | if ($avg_cpu != 0) { |
| 70 | - if($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 70 | + if ($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 71 | 71 | terminate_job($p); |
| 72 | 72 | $test_result = 1; |
| 73 | 73 | break; |
@@ -86,32 +86,32 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | function get_total_steps($cmd_file) { |
| 89 | - $fd = fopen($cmd_file,"r"); |
|
| 89 | + $fd = fopen($cmd_file, "r"); |
|
| 90 | 90 | if (!$fd) { |
| 91 | 91 | echo "can not open file $cmd_file\n"; |
| 92 | 92 | exit(-1); |
| 93 | 93 | } |
| 94 | 94 | $this_loopno = 1; |
| 95 | 95 | $this_looprun = 1; |
| 96 | - $total_steps=1; |
|
| 96 | + $total_steps = 1; |
|
| 97 | 97 | while (!feof($fd)) { |
| 98 | - $line = fgets($fd,4096); |
|
| 98 | + $line = fgets($fd, 4096); |
|
| 99 | 99 | if (preg_match("/loopnumber\s+\d+/", $line, $matches) |
| 100 | 100 | && preg_match("/\d+/", $matches[0], $no) |
| 101 | 101 | ) { |
| 102 | - $this_loopno=$no[0]; |
|
| 102 | + $this_loopno = $no[0]; |
|
| 103 | 103 | } |
| 104 | 104 | if (preg_match("/looprun\s+\d+/", $line, $matches) |
| 105 | 105 | and preg_match("/\d+/", $matches[0], $no) |
| 106 | 106 | ) { |
| 107 | - $this_looprun=$no[0]; |
|
| 108 | - if($this_loopno*$this_looprun>$total_steps)$total_steps=$this_loopno*$this_looprun; |
|
| 107 | + $this_looprun = $no[0]; |
|
| 108 | + if ($this_loopno*$this_looprun > $total_steps)$total_steps = $this_loopno*$this_looprun; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | fclose($fd); |
| 113 | 113 | //$total_steps = $loopno*$looprun; |
| 114 | - if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 114 | + if ($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 115 | 115 | return $total_steps; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $count = 0; |
| 131 | 131 | while (!feof($fd)) { |
| 132 | - $line = fgets($fd,4096); |
|
| 133 | - if (preg_match('/^Step\s+CPU/',$line)) { |
|
| 132 | + $line = fgets($fd, 4096); |
|
| 133 | + if (preg_match('/^Step\s+CPU/', $line)) { |
|
| 134 | 134 | //echo $line."\n"; |
| 135 | 135 | $start = 1; |
| 136 | 136 | continue; |
@@ -139,24 +139,24 @@ discard block |
||
| 139 | 139 | $arr = preg_split("/\s+/", $line); |
| 140 | 140 | //print_r($arr); |
| 141 | 141 | |
| 142 | - if (count($arr) <=6 || !is_numeric($arr[1])) { |
|
| 142 | + if (count($arr) <= 6 || !is_numeric($arr[1])) { |
|
| 143 | 143 | continue; |
| 144 | 144 | } |
| 145 | 145 | $step = (int)$arr[1]; |
| 146 | 146 | $cpu = (float)$arr[2]; |
| 147 | 147 | //echo "step=".$step." cpu=".$cpu."\n"; |
| 148 | - if ($cpu==0) { |
|
| 149 | - $count=0; |
|
| 148 | + if ($cpu == 0) { |
|
| 149 | + $count = 0; |
|
| 150 | 150 | $start_step = $step; |
| 151 | 151 | } else { |
| 152 | - $count+=1; |
|
| 153 | - if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 154 | - if($count >= 10) { |
|
| 152 | + $count += 1; |
|
| 153 | + if ($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 154 | + if ($count >= 10) { |
|
| 155 | 155 | $end_step = $step; |
| 156 | - $steps = $end_step-$start_step; |
|
| 156 | + $steps = $end_step - $start_step; |
|
| 157 | 157 | $avg_cpu = $cpu/$steps; |
| 158 | 158 | #$avg_cpu = $cpu/$count; |
| 159 | - if ($GLOBALS["debug"]){ |
|
| 159 | + if ($GLOBALS["debug"]) { |
|
| 160 | 160 | echo "test steps is ".$steps."<br>"; |
| 161 | 161 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 162 | 162 | } |
@@ -165,56 +165,56 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | - return array($avg_cpu,$test_steps); |
|
| 168 | + return array($avg_cpu, $test_steps); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 171 | +function calc_est_size($lammps_script, $structure_file, $cmd_file, $test_steps) { |
|
| 172 | 172 | $dump_types = 0; |
| 173 | - $fd = fopen($lammps_script,"r"); |
|
| 174 | - if (!$fd){ |
|
| 173 | + $fd = fopen($lammps_script, "r"); |
|
| 174 | + if (!$fd) { |
|
| 175 | 175 | echo "can not open file $lammps_script\n"; |
| 176 | 176 | exit(-1); |
| 177 | 177 | } |
| 178 | - while (!feof($fd)){ |
|
| 178 | + while (!feof($fd)) { |
|
| 179 | 179 | $line = fgets($fd, 4096); |
| 180 | 180 | //if (preg_match("/^\s*dump/", $line) |
| 181 | 181 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 182 | 182 | |
| 183 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 183 | + if (preg_match("/^\s*dump\s+(\d)\s+/", $line, $matches)) |
|
| 184 | 184 | { |
| 185 | - if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
|
| 185 | + if ($GLOBALS["debug"]) {print "matches="; print_r($matches); } |
|
| 186 | 186 | |
| 187 | - $dump_types=(int)$matches[1]; |
|
| 187 | + $dump_types = (int)$matches[1]; |
|
| 188 | 188 | break; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | fclose($fd); |
| 192 | - if($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 192 | + if ($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 193 | 193 | |
| 194 | 194 | $structure_file_size = filesize($structure_file); |
| 195 | - $fd = fopen($cmd_file,"r"); |
|
| 196 | - if (!$fd){ |
|
| 195 | + $fd = fopen($cmd_file, "r"); |
|
| 196 | + if (!$fd) { |
|
| 197 | 197 | echo "can not open file $cmd_file\n"; |
| 198 | 198 | exit(-1); |
| 199 | 199 | } |
| 200 | - if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | - |
|
| 202 | - $loopno=1; |
|
| 203 | - $looprun=1; |
|
| 204 | - while (!feof($fd)){ |
|
| 205 | - $line = fgets($fd,4096); |
|
| 206 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 207 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 200 | + if ($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | + |
|
| 202 | + $loopno = 1; |
|
| 203 | + $looprun = 1; |
|
| 204 | + while (!feof($fd)) { |
|
| 205 | + $line = fgets($fd, 4096); |
|
| 206 | + if (preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 207 | + if (preg_match("/\d+/", $matches[0], $no)) { |
|
| 208 | 208 | //$loopno=$no[0]; |
| 209 | - if($no[0]>$loopno)$loopno=$no[0]; |
|
| 209 | + if ($no[0] > $loopno)$loopno = $no[0]; |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | if (preg_match("/looprun\s+\d+/", $line, $matches) and preg_match("/\d+/", $matches[0], $no)) { |
| 213 | - if($no[0]>$looprun)$looprun=$no[0]; |
|
| 213 | + if ($no[0] > $looprun)$looprun = $no[0]; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | fclose($fd); |
| 217 | - if($GLOBALS["debug"]){ |
|
| 217 | + if ($GLOBALS["debug"]) { |
|
| 218 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 219 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 220 | 220 | } |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | $dump_files = glob("dump1*"); |
| 226 | 226 | $test_dump_file = $dump_files[0]; |
| 227 | 227 | $test_dump_size = filesize($test_dump_file); |
| 228 | - $dump_size1 = $test_dump_size+0.5*$test_dump_size*ceil(($looprun-$test_steps)/$test_steps); |
|
| 228 | + $dump_size1 = $test_dump_size + 0.5*$test_dump_size*ceil(($looprun - $test_steps)/$test_steps); |
|
| 229 | 229 | $dump_size = $loopno*$dump_size1*$dump_types; |
| 230 | 230 | $app_fixed_size = 5e7; |
| 231 | - $est_size = $log_size+$dump_size+$app_fixed_size; |
|
| 231 | + $est_size = $log_size + $dump_size + $app_fixed_size; |
|
| 232 | 232 | |
| 233 | - if($GLOBALS["debug"]){ |
|
| 233 | + if ($GLOBALS["debug"]) { |
|
| 234 | 234 | print "test_steps=".$test_steps."<br>"; |
| 235 | 235 | print "test_log_size=".$test_log_size."<br>"; |
| 236 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | if ($njobs < $nhosts) { |
| 322 | 322 | return $flops_per_job/$median_flops; |
| 323 | 323 | } else { |
| 324 | - $k = (int)(($njobs+$nhosts-1)/$nhosts); |
|
| 324 | + $k = (int)(($njobs + $nhosts - 1)/$nhosts); |
|
| 325 | 325 | return $k*$flops_per_job/$median_flops; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -361,27 +361,27 @@ discard block |
||
| 361 | 361 | if ($GLOBALS["debug"]) { |
| 362 | 362 | print "est_cpu_time is ".$est_cpu_time."<br>"; |
| 363 | 363 | } |
| 364 | - if ($error==0) { |
|
| 365 | - $err_msgs=file("output"); |
|
| 366 | - $err="Your test job <strong>failed</strong> |
|
| 364 | + if ($error == 0) { |
|
| 365 | + $err_msgs = file("output"); |
|
| 366 | + $err = "Your test job <strong>failed</strong> |
|
| 367 | 367 | <br>Please refer to the following Error Message:<br><p> |
| 368 | 368 | "; |
| 369 | - foreach($err_msgs as $line){ |
|
| 370 | - $err=$err.$line."<br>"; |
|
| 369 | + foreach ($err_msgs as $line) { |
|
| 370 | + $err = $err.$line."<br>"; |
|
| 371 | 371 | } |
| 372 | - $err=$err." <p> |
|
| 372 | + $err = $err." <p> |
|
| 373 | 373 | <a href=sandbox.php><strong> File_Sandbox </strong></a> |
| 374 | 374 | "; |
| 375 | 375 | error_page($err); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | system("rm *"); |
| 379 | - $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
|
| 380 | - $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
|
| 379 | + $info->rsc_fpops_est = $est_cpu_time*1.5e9; |
|
| 380 | + $info->rsc_fpops_bound = $info->rsc_fpops_est*20; |
|
| 381 | 381 | |
| 382 | - if ($disk==0){ |
|
| 383 | - $info->rsc_disk_bound=1000000; |
|
| 384 | - } else{ |
|
| 382 | + if ($disk == 0) { |
|
| 383 | + $info->rsc_disk_bound = 1000000; |
|
| 384 | + } else { |
|
| 385 | 385 | $info->rsc_disk_bound = $disk; |
| 386 | 386 | } |
| 387 | 387 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | // |
| 393 | 393 | $njobs = count(file($cmdline_file_path)); |
| 394 | 394 | $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est); |
| 395 | - if($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 395 | + if ($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 396 | 396 | //assume the server's flops is 1.5G and the average client's flops is 1G |
| 397 | 397 | $hrs_est = number_format($secs_est*1.5/60, 2); |
| 398 | 398 | //$hrs_est = number_format($secs_est, 2); |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | function submit_job($app, $batch_id, $info, $cmdline, $i) { |
| 419 | - $client_disk=$info->rsc_disk_bound*2; |
|
| 420 | - if($client_disk<500000000) $client_disk=500000000; |
|
| 419 | + $client_disk = $info->rsc_disk_bound*2; |
|
| 420 | + if ($client_disk < 500000000) $client_disk = 500000000; |
|
| 421 | 421 | $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est --rsc_fpops_bound $info->rsc_fpops_bound --rsc_disk_bound $client_disk"; |
| 422 | 422 | if ($cmdline) { |
| 423 | 423 | $cmd .= " --command_line \"$cmdline\""; |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | $x = file_get_contents("$tmpfile"); |
| 442 | 442 | $info = unserialize($x); |
| 443 | 443 | |
| 444 | - $njobs=0; |
|
| 444 | + $njobs = 0; |
|
| 445 | 445 | $cmdlines = file($info->cmdline_file_path); |
| 446 | - foreach ($cmdlines as $cmdline){ |
|
| 446 | + foreach ($cmdlines as $cmdline) { |
|
| 447 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 448 | 448 | $njobs++; |
| 449 | 449 | } |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | $i = 0; |
| 461 | 461 | foreach ($cmdlines as $cmdline) { |
| 462 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 463 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 464 | 464 | $i++; |
| 465 | 465 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | display_errors(); |
| 19 | 19 | |
| 20 | 20 | $app_name = "treeThreader"; |
| 21 | -$log = fopen("/tmp/tt_job.log","a+"); |
|
| 21 | +$log = fopen("/tmp/tt_job.log", "a+"); |
|
| 22 | 22 | |
| 23 | 23 | function error($s) { |
| 24 | 24 | echo "<error>\n<message>$s</message>\n</error>\n"; |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | function handle_submit($r, $user, $app) { |
| 29 | - global $app_name,$log; |
|
| 29 | + global $app_name, $log; |
|
| 30 | 30 | |
| 31 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 31 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 32 | 32 | // read the list of template filenames |
| 33 | 33 | // |
| 34 | 34 | $files = file("../../tree_threader_template_files"); |
| 35 | 35 | if ($files === false) { |
| 36 | - fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 36 | + fwrite($log, "$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 37 | 37 | error("no templates file"); |
| 38 | 38 | |
| 39 | 39 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // |
| 91 | 91 | function handle_get_output($r, $batch) { |
| 92 | 92 | global $log; |
| 93 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 93 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 94 | 94 | $wus = BoincWorkUnit::enum("batch=$batch->id"); |
| 95 | 95 | $outdir = "/tmp/treeThreader_result_".$batch->id; |
| 96 | 96 | @mkdir($outdir); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | error("can't zip output files"); |
| 130 | 130 | } |
| 131 | 131 | $fname = "treeThreader_result_".$batch->id.".zip"; |
| 132 | - $treeThreader_dir="treeThreaderResult"; |
|
| 133 | - if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 132 | + $treeThreader_dir = "treeThreaderResult"; |
|
| 133 | + if (!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 134 | 134 | @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
| 135 | 135 | system("rm -fr $outdir"); |
| 136 | 136 | $config = simplexml_load_string(file_get_contents("../../config.xml")); |
| 137 | 137 | $download_url = trim((string)$config->config->download_url); |
| 138 | 138 | echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
| 139 | - $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 139 | + $log_msg = "$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 140 | 140 | fwrite($log, $log_msg); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | // they've participated in |
| 34 | 34 | // |
| 35 | 35 | function get_other_projects($user) { |
| 36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
| 36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
| 37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
| 38 | 38 | |
| 39 | 39 | // Check the cache for that URL |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (!NO_STATS) { |
| 174 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
| 174 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
| 175 | 175 | $x = ""; |
| 176 | 176 | shuffle($cpid_stats_sites); |
| 177 | 177 | foreach ($cpid_stats_sites as $site) { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $u = normalize_user_url($user->url); |
| 256 | 256 | row2( |
| 257 | 257 | tra("URL"), |
| 258 | - $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL') |
|
| 258 | + $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL') |
|
| 259 | 259 | ); |
| 260 | 260 | } |
| 261 | 261 | if (USER_COUNTRY) { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | // if $badge_height is > 0, show badges |
| 352 | 352 | // if $name_limit, limit name to N chars |
| 353 | 353 | // |
| 354 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
| 354 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
| 355 | 355 | BoincForumPrefs::lookup($user); |
| 356 | 356 | if (is_banished($user)) { |
| 357 | 357 | return "(banished: ID $user->id)"; |
@@ -366,13 +366,13 @@ discard block |
||
| 366 | 366 | $name = substr($name, 0, $name_limit)."..."; |
| 367 | 367 | } |
| 368 | 368 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
| 369 | - if (function_exists("project_user_links")){ |
|
| 369 | + if (function_exists("project_user_links")) { |
|
| 370 | 370 | $x .= project_user_links($user); |
| 371 | 371 | } |
| 372 | 372 | if ($badge_height) { |
| 373 | 373 | $x .= badges_string(true, $user, $badge_height); |
| 374 | 374 | } |
| 375 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
| 375 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | function show_community_private($user) { |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | // if there's a foundership request, notify the founder |
| 421 | 421 | // |
| 422 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
| 422 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
| 423 | 423 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
| 424 | 424 | } |
| 425 | 425 | row2(tra("Member of team"), $x); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
| 445 | 445 | $n = count($friends); |
| 446 | 446 | if ($n) { |
| 447 | - foreach($friends as $friend) { |
|
| 447 | + foreach ($friends as $friend) { |
|
| 448 | 448 | $fuser = BoincUser::lookup_id($friend->user_dest); |
| 449 | 449 | if (!$fuser) continue; |
| 450 | 450 | $x .= friend_links($fuser); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | // Returns a cacheable community links data object |
| 490 | 490 | // @param user The user to produce a community links object for |
| 491 | 491 | |
| 492 | -function get_community_links_object($user){ |
|
| 492 | +function get_community_links_object($user) { |
|
| 493 | 493 | $cache_object = new StdClass; |
| 494 | 494 | $cache_object->post_count = total_posts($user); |
| 495 | 495 | $cache_object->user = $user; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | $cache_object->friends = array(); |
| 498 | 498 | |
| 499 | 499 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
| 500 | - foreach($friends as $friend) { |
|
| 500 | + foreach ($friends as $friend) { |
|
| 501 | 501 | $fuser = BoincUser::lookup_id($friend->user_dest); |
| 502 | 502 | if (!$fuser) continue; |
| 503 | 503 | $cache_object->friends[] = $fuser; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | return $cache_object; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | -function community_links($clo, $logged_in_user){ |
|
| 508 | +function community_links($clo, $logged_in_user) { |
|
| 509 | 509 | $user = $clo->user; |
| 510 | 510 | $team = $clo->team; |
| 511 | 511 | $friends = $clo->friends; |
@@ -531,15 +531,15 @@ discard block |
||
| 531 | 531 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
| 532 | 532 | ); |
| 533 | 533 | } else if ($friend) { |
| 534 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
| 534 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
| 535 | 535 | } else { |
| 536 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
| 536 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | if ($friends) { |
| 541 | 541 | $x = ""; |
| 542 | - foreach($friends as $friend) { |
|
| 542 | + foreach ($friends as $friend) { |
|
| 543 | 543 | $x .= friend_links($friend); |
| 544 | 544 | } |
| 545 | 545 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -583,6 +583,6 @@ discard block |
||
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | |
| 586 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 586 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 587 | 587 | |
| 588 | 588 | ?> |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if ($app_types->cpu) { |
| 72 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 72 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 73 | 73 | tra("Use CPU"), |
| 74 | 74 | "Request CPU-only tasks from this project.", |
| 75 | 75 | "no_cpu", |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | if ($app_types->ati) { |
| 81 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 81 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 82 | 82 | tra("Use AMD GPU"), |
| 83 | 83 | "Request AMD GPU tasks from this project.", |
| 84 | 84 | "no_ati", |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | if ($app_types->cuda) { |
| 90 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 90 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 91 | 91 | tra("Use NVIDIA GPU"), |
| 92 | 92 | "Request NVIDIA GPU tasks from this project.", |
| 93 | 93 | "no_cuda", |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | if ($app_types->intel_gpu) { |
| 99 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 99 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 100 | 100 | tra("Use Intel GPU"), |
| 101 | 101 | "Request Intel GPU tasks from this project.", |
| 102 | 102 | "no_intel_gpu", |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ); |
| 106 | 106 | } |
| 107 | 107 | if ($app_types->apple_gpu) { |
| 108 | - $project_pref_descs[] = new PREF_BOOL ( |
|
| 108 | + $project_pref_descs[] = new PREF_BOOL( |
|
| 109 | 109 | tra("Use Apple GPU"), |
| 110 | 110 | "Request Apple GPU tasks from this project.", |
| 111 | 111 | "no_apple_gpu", |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $x = ""; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | -$privacy_pref_descs = array ( |
|
| 133 | +$privacy_pref_descs = array( |
|
| 134 | 134 | new PREF_BOOL( |
| 135 | 135 | tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x, |
| 136 | 136 | "", |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | global $in_project_specific; |
| 179 | 179 | global $venue_name; |
| 180 | 180 | |
| 181 | - switch($name) { |
|
| 181 | + switch ($name) { |
|
| 182 | 182 | case "venue": |
| 183 | 183 | $venue_name = $attrs["name"]; |
| 184 | 184 | $top_parse_result = $parse_result; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | break; |
| 191 | 191 | default: |
| 192 | 192 | if ($in_project_specific) { |
| 193 | - $text= $text."<$name>"; |
|
| 193 | + $text = $text."<$name>"; |
|
| 194 | 194 | } else { |
| 195 | 195 | $text = ""; |
| 196 | 196 | } |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | global $venue_name; |
| 206 | 206 | global $project_pref_descs; |
| 207 | 207 | |
| 208 | - foreach($project_pref_descs as $p) { |
|
| 208 | + foreach ($project_pref_descs as $p) { |
|
| 209 | 209 | if ($p->xml_parse($parse_result, $name, $text)) { |
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | - switch($name) { |
|
| 213 | + switch ($name) { |
|
| 214 | 214 | case "venue": |
| 215 | 215 | $top_parse_result->$venue_name = $parse_result; |
| 216 | 216 | $parse_result = $top_parse_result; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | return $parse_result; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | -function prefs_show_project($prefs, $columns=false) { |
|
| 257 | +function prefs_show_project($prefs, $columns = false) { |
|
| 258 | 258 | global $project_pref_descs; |
| 259 | 259 | if ($columns) { |
| 260 | 260 | foreach ($project_pref_descs as $p) { |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -function prefs_show_project_specific($prefs, $columns=false) { |
|
| 296 | +function prefs_show_project_specific($prefs, $columns = false) { |
|
| 297 | 297 | if ($columns) { |
| 298 | 298 | $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific); |
| 299 | 299 | $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : ""; |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | project_specific_prefs_show($project_specific_prefs, $columns); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | -function print_prefs_display_project($user, $columns=false) { |
|
| 308 | +function print_prefs_display_project($user, $columns = false) { |
|
| 309 | 309 | $project_prefs = prefs_parse_project($user->project_prefs); |
| 310 | 310 | |
| 311 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>"; |
|
| 311 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>"; |
|
| 312 | 312 | if ($columns) { |
| 313 | 313 | start_table(); |
| 314 | 314 | row_heading(tra("Combined preferences").$switch_link); |
@@ -359,14 +359,14 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | -function prefs_form_project($prefs, $error=false) { |
|
| 362 | +function prefs_form_project($prefs, $error = false) { |
|
| 363 | 363 | global $project_pref_descs; |
| 364 | 364 | foreach ($project_pref_descs as $p) { |
| 365 | 365 | $p->show_form_row($prefs, $error); |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | -function prefs_form_project_specific($prefs_xml, $error=false) { |
|
| 369 | +function prefs_form_project_specific($prefs_xml, $error = false) { |
|
| 370 | 370 | $prefs = project_specific_prefs_parse($prefs_xml); |
| 371 | 371 | project_specific_prefs_edit($prefs, $error); |
| 372 | 372 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | // given a prefs structure, return the corresponding XML string |
| 416 | 416 | // |
| 417 | -function project_prefs_make_xml($prefs, $primary=true) { |
|
| 417 | +function project_prefs_make_xml($prefs, $primary = true) { |
|
| 418 | 418 | global $project_pref_descs; |
| 419 | 419 | $xml = ""; |
| 420 | 420 | if ($primary) { |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | // |
| 450 | 450 | function project_prefs_update(&$user, $prefs) { |
| 451 | 451 | $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs)); |
| 452 | - $send_email = $user->send_email?1:0; |
|
| 453 | - $show_hosts = $user->show_hosts?1:0; |
|
| 452 | + $send_email = $user->send_email ? 1 : 0; |
|
| 453 | + $show_hosts = $user->show_hosts ? 1 : 0; |
|
| 454 | 454 | $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts"); |
| 455 | 455 | if (!$retval) { |
| 456 | 456 | return 1; |
@@ -27,74 +27,74 @@ |
||
| 27 | 27 | define('BATCH_STATE_RETIRED', 4); |
| 28 | 28 | |
| 29 | 29 | define('ANON_PLATFORM_UNKNOWN', -1); |
| 30 | -define('ANON_PLATFORM_CPU', -2); |
|
| 31 | -define('ANON_PLATFORM_NVIDIA', -3); |
|
| 32 | -define('ANON_PLATFORM_ATI', -4); |
|
| 33 | -define('ANON_PLATFORM_INTEL_GPU', -5); |
|
| 34 | -define('ANON_PLATFORM_APPLE_GPU', -6); |
|
| 30 | +define('ANON_PLATFORM_CPU', -2); |
|
| 31 | +define('ANON_PLATFORM_NVIDIA', -3); |
|
| 32 | +define('ANON_PLATFORM_ATI', -4); |
|
| 33 | +define('ANON_PLATFORM_INTEL_GPU', -5); |
|
| 34 | +define('ANON_PLATFORM_APPLE_GPU', -6); |
|
| 35 | 35 | |
| 36 | -define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
| 37 | -define('RESULT_SERVER_STATE_UNSENT', 2); |
|
| 38 | -define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
| 39 | -define('RESULT_SERVER_STATE_OVER', 5); |
|
| 36 | +define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
| 37 | +define('RESULT_SERVER_STATE_UNSENT', 2); |
|
| 38 | +define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
| 39 | +define('RESULT_SERVER_STATE_OVER', 5); |
|
| 40 | 40 | |
| 41 | -define('RESULT_OUTCOME_INIT', 0); |
|
| 42 | -define('RESULT_OUTCOME_SUCCESS', 1); |
|
| 43 | -define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
| 44 | -define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
| 45 | -define('RESULT_OUTCOME_NO_REPLY', 4); |
|
| 46 | -define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
| 47 | -define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
| 48 | -define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
| 41 | +define('RESULT_OUTCOME_INIT', 0); |
|
| 42 | +define('RESULT_OUTCOME_SUCCESS', 1); |
|
| 43 | +define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
| 44 | +define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
| 45 | +define('RESULT_OUTCOME_NO_REPLY', 4); |
|
| 46 | +define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
| 47 | +define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
| 48 | +define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
| 49 | 49 | |
| 50 | -define('VALIDATE_STATE_INIT', 0); |
|
| 51 | -define('VALIDATE_STATE_VALID', 1); |
|
| 52 | -define('VALIDATE_STATE_INVALID', 2); |
|
| 53 | -define('VALIDATE_STATE_NO_CHECK', 3); |
|
| 54 | -define('VALIDATE_STATE_INCONCLUSIVE',4); |
|
| 55 | -define('VALIDATE_STATE_TOO_LATE', 5); |
|
| 50 | +define('VALIDATE_STATE_INIT', 0); |
|
| 51 | +define('VALIDATE_STATE_VALID', 1); |
|
| 52 | +define('VALIDATE_STATE_INVALID', 2); |
|
| 53 | +define('VALIDATE_STATE_NO_CHECK', 3); |
|
| 54 | +define('VALIDATE_STATE_INCONCLUSIVE', 4); |
|
| 55 | +define('VALIDATE_STATE_TOO_LATE', 5); |
|
| 56 | 56 | |
| 57 | -define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
| 58 | -define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
| 59 | -define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
| 60 | -define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
| 61 | -define('WU_ERROR_CANCELLED', 16); |
|
| 62 | -define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
| 57 | +define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
| 58 | +define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
| 59 | +define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
| 60 | +define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
| 61 | +define('WU_ERROR_CANCELLED', 16); |
|
| 62 | +define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
| 63 | 63 | |
| 64 | -define('FILE_DELETE_INIT', 0); |
|
| 65 | -define('FILE_DELETE_READY', 1); |
|
| 66 | -define('FILE_DELETE_DONE', 2); |
|
| 67 | -define('FILE_DELETE_ERROR', 3); |
|
| 64 | +define('FILE_DELETE_INIT', 0); |
|
| 65 | +define('FILE_DELETE_READY', 1); |
|
| 66 | +define('FILE_DELETE_DONE', 2); |
|
| 67 | +define('FILE_DELETE_ERROR', 3); |
|
| 68 | 68 | |
| 69 | -define('ASSIMILATE_INIT', 0); |
|
| 70 | -define('ASSIMILATE_READY', 1); |
|
| 71 | -define('ASSIMILATE_DONE', 2); |
|
| 69 | +define('ASSIMILATE_INIT', 0); |
|
| 70 | +define('ASSIMILATE_READY', 1); |
|
| 71 | +define('ASSIMILATE_DONE', 2); |
|
| 72 | 72 | |
| 73 | 73 | // from lib/common_defs.h |
| 74 | 74 | // |
| 75 | -define('RESULT_NEW', 0); |
|
| 76 | -define('RESULT_FILES_DOWNLOADING', 1); |
|
| 77 | -define('RESULT_FILES_DOWNLOADED', 2); |
|
| 78 | -define('RESULT_COMPUTE_ERROR', 3); |
|
| 79 | -define('RESULT_FILES_UPLOADING', 4); |
|
| 80 | -define('RESULT_FILES_UPLOADED', 5); |
|
| 81 | -define('RESULT_ABORTED', 6); |
|
| 82 | -define('RESULT_UPLOAD_FAILED', 7); |
|
| 75 | +define('RESULT_NEW', 0); |
|
| 76 | +define('RESULT_FILES_DOWNLOADING', 1); |
|
| 77 | +define('RESULT_FILES_DOWNLOADED', 2); |
|
| 78 | +define('RESULT_COMPUTE_ERROR', 3); |
|
| 79 | +define('RESULT_FILES_UPLOADING', 4); |
|
| 80 | +define('RESULT_FILES_UPLOADED', 5); |
|
| 81 | +define('RESULT_ABORTED', 6); |
|
| 82 | +define('RESULT_UPLOAD_FAILED', 7); |
|
| 83 | 83 | |
| 84 | 84 | // from lib/error_numbers.h |
| 85 | 85 | // returned by some web RPCs |
| 86 | 86 | // |
| 87 | -define('ERR_XML_PARSE', -112); |
|
| 88 | -define('ERR_DB_NOT_FOUND', -136); |
|
| 89 | -define('ERR_DB_NOT_UNIQUE', -137); |
|
| 90 | -define('ERR_DB_CANT_CONNECT', -138); |
|
| 91 | -define('ERR_PROJECT_DOWN', -183); |
|
| 92 | -define('ERR_BAD_USER_NAME', -188); |
|
| 93 | -define('ERR_NO_OPTION', -191); |
|
| 94 | -define('ERR_BAD_EMAIL_ADDR', -205); |
|
| 95 | -define('ERR_BAD_PASSWD', -206); |
|
| 96 | -define('ERR_ACCT_CREATION_DISABLED', -208); |
|
| 97 | -define('ERR_ATTACH_FAIL_INIT', -209); |
|
| 98 | -define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
| 99 | -define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
| 87 | +define('ERR_XML_PARSE', -112); |
|
| 88 | +define('ERR_DB_NOT_FOUND', -136); |
|
| 89 | +define('ERR_DB_NOT_UNIQUE', -137); |
|
| 90 | +define('ERR_DB_CANT_CONNECT', -138); |
|
| 91 | +define('ERR_PROJECT_DOWN', -183); |
|
| 92 | +define('ERR_BAD_USER_NAME', -188); |
|
| 93 | +define('ERR_NO_OPTION', -191); |
|
| 94 | +define('ERR_BAD_EMAIL_ADDR', -205); |
|
| 95 | +define('ERR_BAD_PASSWD', -206); |
|
| 96 | +define('ERR_ACCT_CREATION_DISABLED', -208); |
|
| 97 | +define('ERR_ATTACH_FAIL_INIT', -209); |
|
| 98 | +define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
| 99 | +define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
| 100 | 100 | ?> |
@@ -34,26 +34,26 @@ |
||
| 34 | 34 | $intel_gpu_credit_sum = 0; |
| 35 | 35 | $apple_gpu_scale_sum = 0; |
| 36 | 36 | $apple_gpu_credit_sum = 0; |
| 37 | -$total_credit_sum= 0; |
|
| 37 | +$total_credit_sum = 0; |
|
| 38 | 38 | |
| 39 | 39 | $apps = BoincApp::enum("deprecated=0"); |
| 40 | 40 | foreach ($apps as $app) { |
| 41 | 41 | $avs = BoincAppVersion::enum("appid=$app->id and deprecated=0"); |
| 42 | 42 | foreach ($avs as $av) { |
| 43 | 43 | if (strstr($av->plan_class, "ati")) { |
| 44 | - $ati_scale_sum += $av->pfc_scale * $av->expavg_credit; |
|
| 44 | + $ati_scale_sum += $av->pfc_scale*$av->expavg_credit; |
|
| 45 | 45 | $ati_credit_sum += $av->expavg_credit; |
| 46 | 46 | } else if (strstr($av->plan_class, "nvidia") || strstr($av->plan_class, "cuda")) { |
| 47 | - $nvidia_scale_sum += $av->pfc_scale * $av->expavg_credit; |
|
| 47 | + $nvidia_scale_sum += $av->pfc_scale*$av->expavg_credit; |
|
| 48 | 48 | $nvidia_credit_sum += $av->expavg_credit; |
| 49 | 49 | } else if (strstr($av->plan_class, "intel_gpu")) { |
| 50 | - $intel_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit; |
|
| 50 | + $intel_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit; |
|
| 51 | 51 | $intel_gpu_credit_sum += $av->expavg_credit; |
| 52 | 52 | } else if (strstr($av->plan_class, "apple_gpu")) { |
| 53 | - $apple_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit; |
|
| 53 | + $apple_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit; |
|
| 54 | 54 | $apple_gpu_credit_sum += $av->expavg_credit; |
| 55 | 55 | } else { |
| 56 | - $cpu_scale_sum += $av->pfc_scale * $av->expavg_credit; |
|
| 56 | + $cpu_scale_sum += $av->pfc_scale*$av->expavg_credit; |
|
| 57 | 57 | $cpu_credit_sum += $av->expavg_credit; |
| 58 | 58 | } |
| 59 | 59 | $total_credit_sum += $av->expavg_credit; |