@@ -52,6 +52,9 @@ |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | +/** |
|
| 56 | + * @param string $n |
|
| 57 | + */ |
|
| 55 | 58 | function valuator($n) { |
| 56 | 59 | return array('valuator', $n); |
| 57 | 60 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | function select_cmp($a, $b) { |
| 20 | 20 | if ($a->value == $b->value) return 0; |
| 21 | - return ($a->value < $b->value)?1:-1; |
|
| 21 | + return ($a->value < $b->value) ? 1 : -1; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | class BoltSelect extends BoltSet { |
@@ -45,6 +45,9 @@ discard block |
||
| 45 | 45 | return "../bolt_snap/compare_snapshot_$x"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | +/** |
|
| 49 | + * @param null|integer $dur |
|
| 50 | + */ |
|
| 48 | 51 | function write_compare_snapshot($course_id, $select_name, $xset_name, $dur) { |
| 49 | 52 | $now = time(); |
| 50 | 53 | $start = $now - $dur*86400; |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | return "../bolt_snap/map_snapshot_".$course_id; |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | +/** |
|
| 134 | + * @param null|integer $dur |
|
| 135 | + */ |
|
| 130 | 136 | function write_map_snapshot($course_id, $dur) { |
| 131 | 137 | $now = time(); |
| 132 | 138 | $start = $now - $dur*86400; |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // get names of units of a given type |
| 25 | 25 | |
| 26 | +/** |
|
| 27 | + * @param string $type |
|
| 28 | + */ |
|
| 26 | 29 | function units_of_type($unit, $type) { |
| 27 | 30 | $names = array(); |
| 28 | 31 | if (get_class($unit) == $type) { |
@@ -118,6 +121,10 @@ discard block |
||
| 118 | 121 | |
| 119 | 122 | //////////// graph drawing |
| 120 | 123 | |
| 124 | +/** |
|
| 125 | + * @param integer $n |
|
| 126 | + * @param integer $width |
|
| 127 | + */ |
|
| 121 | 128 | function compare_bar($title, $n, $width, $lo, $hi) { |
| 122 | 129 | $x1 = $width*$lo; |
| 123 | 130 | $x2 = $width*($hi-$lo); |
@@ -137,6 +144,9 @@ discard block |
||
| 137 | 144 | "; |
| 138 | 145 | } |
| 139 | 146 | |
| 147 | +/** |
|
| 148 | + * @param integer $width |
|
| 149 | + */ |
|
| 140 | 150 | function compare_bar_insuff($title, $width) { |
| 141 | 151 | return " |
| 142 | 152 | <tr> |
@@ -150,6 +160,10 @@ discard block |
||
| 150 | 160 | "; |
| 151 | 161 | } |
| 152 | 162 | |
| 163 | +/** |
|
| 164 | + * @param integer[] $x |
|
| 165 | + * @param integer $width |
|
| 166 | + */ |
|
| 153 | 167 | function outcome_graph($x, $width) { |
| 154 | 168 | $n = $x[0]+$x[1]+$x[2]; |
| 155 | 169 | if (!$n) return empty_cell(); |
@@ -182,6 +196,9 @@ discard block |
||
| 182 | 196 | return $s; |
| 183 | 197 | } |
| 184 | 198 | |
| 199 | +/** |
|
| 200 | + * @param integer $w |
|
| 201 | + */ |
|
| 185 | 202 | function time_graph($t, $w) { |
| 186 | 203 | if ($t == 0) return "<td>---</td>"; |
| 187 | 204 | $x = (log10($t)+2)*$w/4; |
@@ -193,6 +210,10 @@ discard block |
||
| 193 | 210 | </td>"; |
| 194 | 211 | } |
| 195 | 212 | |
| 213 | +/** |
|
| 214 | + * @param integer $t |
|
| 215 | + * @param integer $w |
|
| 216 | + */ |
|
| 196 | 217 | function score_graph($t, $w) { |
| 197 | 218 | if ($t == 0) return "<td>---</td>"; |
| 198 | 219 | $x = $t*$w; |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $n++; |
| 90 | 90 | $delta = $x - $m; |
| 91 | 91 | $m += $delta/$n; |
| 92 | - $m2 += $delta*($x-$m); |
|
| 92 | + $m2 += $delta*($x - $m); |
|
| 93 | 93 | } |
| 94 | 94 | $mean = $m; |
| 95 | - $stdev = sqrt($m2/($n-1)); |
|
| 95 | + $stdev = sqrt($m2/($n - 1)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // approximate the 90% confidence interval for the mean of an array |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // I'm too lazy to compute the t distribution |
| 105 | 105 | $t_90 = 1.7; |
| 106 | - $d = $t_90 * $stdev / sqrt($n); |
|
| 106 | + $d = $t_90*$stdev/sqrt($n); |
|
| 107 | 107 | $lo = $mean - $d; |
| 108 | 108 | $hi = $mean + $d; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | function test_stats() { |
| 112 | - $a = array(1,1,1,1,0,1,1,1,3, 1, 1, 1, 1); |
|
| 112 | + $a = array(1, 1, 1, 1, 0, 1, 1, 1, 3, 1, 1, 1, 1); |
|
| 113 | 113 | mean_stdev($a, $mean, $stdev); |
| 114 | 114 | echo "mean: $mean stdev: $stdev\n"; |
| 115 | 115 | conf_int_90($a, $lo, $hi); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | function compare_bar($title, $n, $width, $lo, $hi) { |
| 122 | 122 | $x1 = $width*$lo; |
| 123 | - $x2 = $width*($hi-$lo); |
|
| 123 | + $x2 = $width*($hi - $lo); |
|
| 124 | 124 | $a1 = number_format($lo*100); |
| 125 | 125 | $a2 = number_format($hi*100); |
| 126 | 126 | return " |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | function outcome_graph($x, $width) { |
| 154 | - $n = $x[0]+$x[1]+$x[2]; |
|
| 154 | + $n = $x[0] + $x[1] + $x[2]; |
|
| 155 | 155 | if (!$n) return empty_cell(); |
| 156 | 156 | $x0 = $width*$x[1]/$n; |
| 157 | 157 | $x1 = $width*$x[0]/$n; |
| 158 | 158 | $x2 = $width*$x[2]/$n; |
| 159 | - if ($x[1]/$n>0.05) { |
|
| 159 | + if ($x[1]/$n > 0.05) { |
|
| 160 | 160 | $t0 = number_format(100*$x[1]/$n)."%"; |
| 161 | 161 | } else { |
| 162 | 162 | $t0 = ""; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | function time_graph($t, $w) { |
| 186 | 186 | if ($t == 0) return "<td>---</td>"; |
| 187 | - $x = (log10($t)+2)*$w/4; |
|
| 187 | + $x = (log10($t) + 2)*$w/4; |
|
| 188 | 188 | $t = number_format($t, 1); |
| 189 | 189 | return "<td> |
| 190 | 190 | <table class=bolt_bar><tr> |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | function score_graph($t, $w) { |
| 197 | 197 | if ($t == 0) return "<td>---</td>"; |
| 198 | 198 | $x = $t*$w; |
| 199 | - $y = (1-$t)*$w; |
|
| 199 | + $y = (1 - $t)*$w; |
|
| 200 | 200 | $t = number_format($t*100); |
| 201 | 201 | $s = "<td> |
| 202 | 202 | <table class=bolt_bar><tr> |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | public $weight; |
| 23 | 23 | public $callback; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param null|BoltRefresh $refresh |
|
| 27 | + */ |
|
| 25 | 28 | function __construct( |
| 26 | 29 | $name, $units, $number, $repeats, $refresh, $attrs, $callback, $weight |
| 27 | 30 | ) { |
@@ -156,10 +159,16 @@ discard block |
||
| 156 | 159 | define('REPEAT', 2); |
| 157 | 160 | define('NEXT', 4); |
| 158 | 161 | |
| 162 | +/** |
|
| 163 | + * @param integer $f |
|
| 164 | + */ |
|
| 159 | 165 | function repeat($s, $u, $f) { |
| 160 | 166 | return new BoltRepeat($s, $u, $f); |
| 161 | 167 | } |
| 162 | 168 | |
| 169 | +/** |
|
| 170 | + * @param integer[] $a |
|
| 171 | + */ |
|
| 163 | 172 | function refresh($a) { |
| 164 | 173 | return new BoltRefresh($a); |
| 165 | 174 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $nshown = $state_rec['nshown']; |
| 53 | 53 | $state_rec['scores'][$nshown] = $score; |
| 54 | 54 | $iter->state[$this->name] = $state_rec; |
| 55 | - $is_last = ($nshown+1 == $this->ntoshow); |
|
| 55 | + $is_last = ($nshown + 1 == $this->ntoshow); |
|
| 56 | 56 | if (!$is_last) { |
| 57 | 57 | return false; |
| 58 | 58 | } |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | // - optionally create or update bolt_refresh record |
| 63 | 63 | // |
| 64 | 64 | $total_score = 0; |
| 65 | - for ($i=0; $i<$nshown+1; $i++) { |
|
| 65 | + for ($i = 0; $i < $nshown + 1; $i++) { |
|
| 66 | 66 | $total_score += $state_rec['scores'][$i]; |
| 67 | 67 | } |
| 68 | - $avg_score = $total_score/($nshown+1); |
|
| 68 | + $avg_score = $total_score/($nshown + 1); |
|
| 69 | 69 | |
| 70 | 70 | $repeat = null; |
| 71 | 71 | $least = 2; |
| 72 | 72 | foreach ($this->repeats as $r) { |
| 73 | - if ($avg_score < $r->score && $r->score<$least) { |
|
| 73 | + if ($avg_score < $r->score && $r->score < $least) { |
|
| 74 | 74 | $repeat = $r; |
| 75 | 75 | $least = $r->score; |
| 76 | 76 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -class BoltRefresh{ |
|
| 137 | +class BoltRefresh { |
|
| 138 | 138 | public $intervals; |
| 139 | 139 | function __construct($i) { |
| 140 | 140 | $this->intervals = $i; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } else if (get_class($arg) == "BoltRepeat") { |
| 192 | 192 | $repeats[] = $arg; |
| 193 | 193 | } else if (get_class($arg) == "BoltRefresh") { |
| 194 | - $refresh= $arg; |
|
| 194 | + $refresh = $arg; |
|
| 195 | 195 | } else { |
| 196 | 196 | echo "Can't include object of type ".get_class($arg)." within an exercise set."; |
| 197 | 197 | } |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -class BoltRefresh{ |
|
| 137 | +class BoltRefresh { |
|
| 138 | 138 | public $intervals; |
| 139 | 139 | function __construct($i) { |
| 140 | 140 | $this->intervals = $i; |
@@ -38,6 +38,9 @@ |
||
| 38 | 38 | return $job->insert($clause); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | +/** |
|
| 42 | + * @param string $name |
|
| 43 | + */ |
|
| 41 | 44 | function bossa_batch_create($appid, $name, $calibration) { |
| 42 | 45 | $now = time(); |
| 43 | 46 | $c = $calibration?"1":"0"; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | function bossa_batch_create($appid, $name, $calibration) { |
| 42 | 42 | $now = time(); |
| 43 | - $c = $calibration?"1":"0"; |
|
| 43 | + $c = $calibration ? "1" : "0"; |
|
| 44 | 44 | return BossaBatch::insert("(create_time, app_id, name, calibration) values ($now, $appid, '$name', $c)"); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | return $path; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | +/** |
|
| 63 | + * @param string $dir |
|
| 64 | + */ |
|
| 62 | 65 | function disk_usage($dir) { |
| 63 | 66 | $usage=0; |
| 64 | 67 | if ($handle=@opendir($dir)) { |
@@ -76,6 +79,10 @@ discard block |
||
| 76 | 79 | return $usage; |
| 77 | 80 | } |
| 78 | 81 | |
| 82 | +/** |
|
| 83 | + * @param integer $max_age |
|
| 84 | + * @param string $dir |
|
| 85 | + */ |
|
| 79 | 86 | function clean_cache($max_age, $dir) { |
| 80 | 87 | $start_dir = getcwd(); |
| 81 | 88 | if (!chdir($dir)) { |
@@ -116,6 +123,9 @@ discard block |
||
| 116 | 123 | clean_cache($x, "../cache"); |
| 117 | 124 | } |
| 118 | 125 | |
| 126 | +/** |
|
| 127 | + * @param string $path |
|
| 128 | + */ |
|
| 119 | 129 | function cache_need_to_regenerate($path, $max_age){ |
| 120 | 130 | $regenerate = false; |
| 121 | 131 | $request = apache_request_headers(); |
@@ -139,6 +149,9 @@ discard block |
||
| 139 | 149 | } |
| 140 | 150 | |
| 141 | 151 | // Returns cached data or false if nothing was found |
| 152 | +/** |
|
| 153 | + * @param integer $max_age |
|
| 154 | + */ |
|
| 142 | 155 | function get_cached_data($max_age, $params=""){ |
| 143 | 156 | global $no_cache; |
| 144 | 157 | |
@@ -253,6 +266,10 @@ discard block |
||
| 253 | 266 | } |
| 254 | 267 | } |
| 255 | 268 | |
| 269 | +/** |
|
| 270 | + * @param integer $max_age |
|
| 271 | + * @param string $data |
|
| 272 | + */ |
|
| 256 | 273 | function set_cached_data($max_age, $data, $params=""){ |
| 257 | 274 | // for the benefit of hackers |
| 258 | 275 | if (strstr($params, "..")) { |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | - @closedir($handle); |
|
| 102 | + @closedir($handle); |
|
| 103 | 103 | } |
| 104 | 104 | chdir($start_dir); |
| 105 | 105 | } |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | mkdir("../cache", 0770); |
| 33 | 33 | chmod("../cache", 0770); |
| 34 | 34 | } |
| 35 | - for ($i=0;$i<256;$i++) { |
|
| 36 | - $j=sprintf("%02x",$i); |
|
| 35 | + for ($i = 0; $i < 256; $i++) { |
|
| 36 | + $j = sprintf("%02x", $i); |
|
| 37 | 37 | if (!@filemtime("../cache/$j")) { |
| 38 | 38 | mkdir("../cache/$j", 0770); |
| 39 | 39 | chmod("../cache/$j", 0770); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -function get_path($params, $phpfile=null) { |
|
| 44 | +function get_path($params, $phpfile = null) { |
|
| 45 | 45 | if (!@filemtime("../cache/00")) make_cache_dirs(); |
| 46 | 46 | if ($phpfile) { |
| 47 | 47 | $z = $phpfile; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // add a layer of subdirectories for reducing file lookup time |
| 54 | - $sz = substr(md5($z."_".urlencode($params)),1,2); |
|
| 54 | + $sz = substr(md5($z."_".urlencode($params)), 1, 2); |
|
| 55 | 55 | $path = "../cache/".$sz."/".$z; |
| 56 | 56 | if ($params) { |
| 57 | 57 | $path = $path."_".urlencode($params); |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | function disk_usage($dir) { |
| 63 | - $usage=0; |
|
| 64 | - if ($handle=@opendir($dir)) { |
|
| 65 | - while ($file=readdir($handle)) { |
|
| 63 | + $usage = 0; |
|
| 64 | + if ($handle = @opendir($dir)) { |
|
| 65 | + while ($file = readdir($handle)) { |
|
| 66 | 66 | if (($file != ".") && ($file != "..")) { |
| 67 | 67 | if (@is_dir($dir."/".$file)) { |
| 68 | - $usage+=disk_usage($dir."/".$file); |
|
| 68 | + $usage += disk_usage($dir."/".$file); |
|
| 69 | 69 | } else { |
| 70 | - $usage+=@filesize($dir."/".$file); |
|
| 70 | + $usage += @filesize($dir."/".$file); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | if (!chdir($dir)) { |
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | - if ($handle=@opendir(".")) { |
|
| 85 | - while ($file=readdir($handle)) { |
|
| 84 | + if ($handle = @opendir(".")) { |
|
| 85 | + while ($file = readdir($handle)) { |
|
| 86 | 86 | if ($file == ".") continue; |
| 87 | 87 | if ($file == "..") continue; |
| 88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if (@is_dir($file)) { |
| 94 | 94 | clean_cache($max_age, $file); |
| 95 | 95 | } else { |
| 96 | - if ((time()-@filemtime($file))>$max_age) { |
|
| 96 | + if ((time() - @filemtime($file)) > $max_age) { |
|
| 97 | 97 | //echo "unlinking ".getcwd()."/$file\n"; |
| 98 | 98 | @unlink($file); |
| 99 | 99 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // check cache size every once in a while, purge if too big |
| 109 | 109 | // |
| 110 | -function cache_check_diskspace(){ |
|
| 111 | - if ((rand() % CACHE_SIZE_CHECK_FREQ)) return; |
|
| 110 | +function cache_check_diskspace() { |
|
| 111 | + if ((rand()%CACHE_SIZE_CHECK_FREQ)) return; |
|
| 112 | 112 | if (disk_usage("../cache") < MAX_CACHE_USAGE) return; |
| 113 | 113 | $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL, |
| 114 | 114 | USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | clean_cache($x, "../cache"); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -function cache_need_to_regenerate($path, $max_age){ |
|
| 119 | +function cache_need_to_regenerate($path, $max_age) { |
|
| 120 | 120 | $regenerate = false; |
| 121 | 121 | $request = apache_request_headers(); |
| 122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | // and touch the cached copy so other processes |
| 129 | 129 | // don't regenerate at the same time |
| 130 | 130 | // |
| 131 | - if ($lastmodified<time()-$max_age) { |
|
| 131 | + if ($lastmodified < time() - $max_age) { |
|
| 132 | 132 | $regenerate = true; |
| 133 | 133 | @touch($path); |
| 134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Returns cached data or false if nothing was found |
| 142 | -function get_cached_data($max_age, $params=""){ |
|
| 142 | +function get_cached_data($max_age, $params = "") { |
|
| 143 | 143 | global $no_cache; |
| 144 | 144 | |
| 145 | 145 | if ($no_cache) return; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | } else { |
| 157 | 157 | cache_check_diskspace(); |
| 158 | - $regenerate=cache_need_to_regenerate($path, $max_age); |
|
| 158 | + $regenerate = cache_need_to_regenerate($path, $max_age); |
|
| 159 | 159 | if (!$regenerate) { |
| 160 | 160 | return file_get_contents($path); |
| 161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // DEPRECATED |
| 168 | -function start_cache($max_age, $params=""){ |
|
| 168 | +function start_cache($max_age, $params = "") { |
|
| 169 | 169 | global $no_cache, $caching, $memcache; |
| 170 | 170 | |
| 171 | 171 | if ($no_cache) return; |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | $regenerate = cache_need_to_regenerate($path, $max_age); |
| 189 | 189 | } |
| 190 | 190 | //Is the stored version too old, do we need to regenerate it? |
| 191 | - if ($regenerate){ |
|
| 191 | + if ($regenerate) { |
|
| 192 | 192 | // If cached version is too old (or non-existent) |
| 193 | 193 | // generate the page and write to cache |
| 194 | 194 | // |
| 195 | 195 | ob_start(); |
| 196 | 196 | ob_implicit_flush(0); |
| 197 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 198 | - Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT"); |
|
| 199 | - Header("Cache-Control: public, max-age=" . $max_age); |
|
| 197 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 198 | + Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT"); |
|
| 199 | + Header("Cache-Control: public, max-age=".$max_age); |
|
| 200 | 200 | |
| 201 | 201 | // allow the calling page to see cache period |
| 202 | 202 | // |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | if (strstr($params, "format=xml")) { |
| 209 | 209 | header('Content-type: text/xml'); |
| 210 | 210 | } |
| 211 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT"); |
|
| 212 | - Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT"); |
|
| 213 | - Header("Cache-Control: public, max-age=" . $max_age ); |
|
| 211 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT"); |
|
| 212 | + Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT"); |
|
| 213 | + Header("Cache-Control: public, max-age=".$max_age); |
|
| 214 | 214 | if ($cache && $cache->content) { |
| 215 | 215 | echo $cache->content; |
| 216 | 216 | exit; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | // write output buffer both to client and to cache |
| 230 | 230 | // DEPRECATED |
| 231 | -function end_cache($max_age,$params=""){ |
|
| 231 | +function end_cache($max_age, $params = "") { |
|
| 232 | 232 | global $no_cache; |
| 233 | 233 | if ($no_cache) return; |
| 234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | -function set_cached_data($max_age, $data, $params=""){ |
|
| 256 | +function set_cached_data($max_age, $data, $params = "") { |
|
| 257 | 257 | // for the benefit of hackers |
| 258 | 258 | if (strstr($params, "..")) { |
| 259 | 259 | return "bad params"; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | self::$instance->setOption(Memcached::OPT_PREFIX_KEY, MEMCACHE_PREFIX); |
| 295 | 295 | } |
| 296 | 296 | $servers = explode('|', MEMCACHE_SERVERS); |
| 297 | - foreach($servers as &$server) { |
|
| 297 | + foreach ($servers as &$server) { |
|
| 298 | 298 | list($ip, $port) = explode(':', $server); |
| 299 | 299 | if (!$port) { $port = 11211; } |
| 300 | 300 | $server = array($ip, $port); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // check cache size every once in a while, purge if too big |
| 109 | 109 | // |
| 110 | -function cache_check_diskspace(){ |
|
| 110 | +function cache_check_diskspace() { |
|
| 111 | 111 | if ((rand() % CACHE_SIZE_CHECK_FREQ)) return; |
| 112 | 112 | if (disk_usage("../cache") < MAX_CACHE_USAGE) return; |
| 113 | 113 | $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL, |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | clean_cache($x, "../cache"); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -function cache_need_to_regenerate($path, $max_age){ |
|
| 119 | +function cache_need_to_regenerate($path, $max_age) { |
|
| 120 | 120 | $regenerate = false; |
| 121 | 121 | $request = apache_request_headers(); |
| 122 | 122 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Returns cached data or false if nothing was found |
| 142 | -function get_cached_data($max_age, $params=""){ |
|
| 142 | +function get_cached_data($max_age, $params="") { |
|
| 143 | 143 | global $no_cache; |
| 144 | 144 | |
| 145 | 145 | if ($no_cache) return; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // DEPRECATED |
| 168 | -function start_cache($max_age, $params=""){ |
|
| 168 | +function start_cache($max_age, $params="") { |
|
| 169 | 169 | global $no_cache, $caching, $memcache; |
| 170 | 170 | |
| 171 | 171 | if ($no_cache) return; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $regenerate = cache_need_to_regenerate($path, $max_age); |
| 189 | 189 | } |
| 190 | 190 | //Is the stored version too old, do we need to regenerate it? |
| 191 | - if ($regenerate){ |
|
| 191 | + if ($regenerate) { |
|
| 192 | 192 | // If cached version is too old (or non-existent) |
| 193 | 193 | // generate the page and write to cache |
| 194 | 194 | // |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | // write output buffer both to client and to cache |
| 230 | 230 | // DEPRECATED |
| 231 | -function end_cache($max_age,$params=""){ |
|
| 231 | +function end_cache($max_age,$params="") { |
|
| 232 | 232 | global $no_cache; |
| 233 | 233 | if ($no_cache) return; |
| 234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | -function set_cached_data($max_age, $data, $params=""){ |
|
| 256 | +function set_cached_data($max_age, $data, $params="") { |
|
| 257 | 257 | // for the benefit of hackers |
| 258 | 258 | if (strstr($params, "..")) { |
| 259 | 259 | return "bad params"; |
@@ -37,6 +37,9 @@ |
||
| 37 | 37 | $ops = number_format($ops, 2); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | +/** |
|
| 41 | + * @param boolean $bolden |
|
| 42 | + */ |
|
| 40 | 43 | function credit_string($credit, $bolden) { |
| 41 | 44 | $cobbs = number_format($credit, 0); |
| 42 | 45 | |
@@ -43,10 +43,10 @@ |
||
| 43 | 43 | credit_to_ops($credit, $ops, $unit); |
| 44 | 44 | |
| 45 | 45 | if ($bolden) { |
| 46 | - $lbold="[["; |
|
| 47 | - $rbold="]]"; |
|
| 46 | + $lbold = "[["; |
|
| 47 | + $rbold = "]]"; |
|
| 48 | 48 | } else { |
| 49 | - $lbold=""; $rbold=""; |
|
| 49 | + $lbold = ""; $rbold = ""; |
|
| 50 | 50 | } |
| 51 | 51 | return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)"; |
| 52 | 52 | } |
@@ -69,6 +69,10 @@ discard block |
||
| 69 | 69 | function _mysql_fetch_row($r) { |
| 70 | 70 | return mysqli_fetch_row($r); |
| 71 | 71 | } |
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @param resource $r |
|
| 75 | + */ |
|
| 72 | 76 | function _mysql_fetch_assoc($r) { |
| 73 | 77 | return mysqli_fetch_assoc($r); |
| 74 | 78 | } |
@@ -132,6 +136,10 @@ discard block |
||
| 132 | 136 | function _mysql_fetch_row($r) { |
| 133 | 137 | return mysql_fetch_row($r); |
| 134 | 138 | } |
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @param resource $r |
|
| 142 | + */ |
|
| 135 | 143 | function _mysql_fetch_assoc($r) { |
| 136 | 144 | return mysql_fetch_assoc($r); |
| 137 | 145 | } |
@@ -86,14 +86,14 @@ |
||
| 86 | 86 | function _mysql_field_attrs($r, $i) { |
| 87 | 87 | $x = mysqli_fetch_field_direct($r, $i); |
| 88 | 88 | switch ($x->type) { |
| 89 | - case 1: $x->type = 'tinyint'; break; |
|
| 90 | - case 2: $x->type = 'smallint'; break; |
|
| 91 | - case 3: $x->type = 'int'; break; |
|
| 92 | - case 5: $x->type = 'double'; break; |
|
| 93 | - case 7: $x->type = 'timestamp'; break; |
|
| 94 | - case 252: $x->type = 'blob'; break; |
|
| 95 | - case 253: $x->type = 'varchar'; break; |
|
| 96 | - case 254: $x->type = 'char'; break; |
|
| 89 | + case 1: $x->type = 'tinyint'; break; |
|
| 90 | + case 2: $x->type = 'smallint'; break; |
|
| 91 | + case 3: $x->type = 'int'; break; |
|
| 92 | + case 5: $x->type = 'double'; break; |
|
| 93 | + case 7: $x->type = 'timestamp'; break; |
|
| 94 | + case 252: $x->type = 'blob'; break; |
|
| 95 | + case 253: $x->type = 'varchar'; break; |
|
| 96 | + case 254: $x->type = 'char'; break; |
|
| 97 | 97 | } |
| 98 | 98 | return $x; |
| 99 | 99 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | function _mysql_connect($host, $user, $pass, $dbname) { |
| 44 | 44 | global $mysqli; |
| 45 | 45 | $x = explode(":", $host); |
| 46 | - if (sizeof($x)>1) { |
|
| 46 | + if (sizeof($x) > 1) { |
|
| 47 | 47 | $host = $x[0]; |
| 48 | 48 | $port = $x[1]; |
| 49 | 49 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -function db_init_aux($try_replica=false) { |
|
| 165 | +function db_init_aux($try_replica = false) { |
|
| 166 | 166 | $config = get_config(); |
| 167 | 167 | $user = parse_config($config, "<db_user>"); |
| 168 | 168 | $pass = parse_config($config, "<db_passwd>"); |
@@ -103,6 +103,9 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // Function prints a description of $table |
| 105 | 105 | // |
| 106 | +/** |
|
| 107 | + * @param integer $which |
|
| 108 | + */ |
|
| 106 | 109 | function print_describe_table_onecol($table, $which, $columns) { |
| 107 | 110 | $db = BoincDb::get(true); |
| 108 | 111 | $result = $db->do_query("SELECT * from $table LIMIT 1"); |
@@ -262,6 +265,10 @@ discard block |
||
| 262 | 265 | $this->urlquery .= "&clauses=$clause"; |
| 263 | 266 | } |
| 264 | 267 | } |
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * @param string $name |
|
| 271 | + */ |
|
| 265 | 272 | function addeq($name) { |
| 266 | 273 | if (isset($_GET[$name])) { |
| 267 | 274 | $value = $_GET[$name]; |
@@ -273,6 +280,10 @@ discard block |
||
| 273 | 280 | $this->urlquery .= "&$name=".urlencode($value); |
| 274 | 281 | } |
| 275 | 282 | } |
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * @param string $name |
|
| 286 | + */ |
|
| 276 | 287 | function addeq_not_CHOOSE_ALL($name) { |
| 277 | 288 | if (isset($_GET[$name])) { |
| 278 | 289 | $value = $_GET[$name]; |
@@ -287,6 +298,10 @@ discard block |
||
| 287 | 298 | $this->urlquery .= "&$name=".urlencode($value); |
| 288 | 299 | } |
| 289 | 300 | } |
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * @param string $name |
|
| 304 | + */ |
|
| 290 | 305 | function addgt($name) { |
| 291 | 306 | if (isset($_GET[$name])) { |
| 292 | 307 | $value = $_GET[$name]; |
@@ -298,6 +313,11 @@ discard block |
||
| 298 | 313 | $this->urlquery .= "&$name=".urlencode($value); |
| 299 | 314 | } |
| 300 | 315 | } |
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * @param string $name |
|
| 319 | + * @param string $order |
|
| 320 | + */ |
|
| 301 | 321 | function addsort($name, $order) { |
| 302 | 322 | if (isset($_GET[$name])) { |
| 303 | 323 | $value = $_GET[$name]; |
@@ -375,6 +395,9 @@ discard block |
||
| 375 | 395 | } |
| 376 | 396 | |
| 377 | 397 | |
| 398 | +/** |
|
| 399 | + * @param string $mq |
|
| 400 | + */ |
|
| 378 | 401 | function link_results($n, $mq, $query, $clauses) { |
| 379 | 402 | if ($n == '0') { // intentional compare by string |
| 380 | 403 | return "0"; |
@@ -824,6 +847,9 @@ discard block |
||
| 824 | 847 | return number_format($x/86400, 2)." days"; |
| 825 | 848 | } |
| 826 | 849 | |
| 850 | +/** |
|
| 851 | + * @param integer $x |
|
| 852 | + */ |
|
| 827 | 853 | function resource_name($x) { |
| 828 | 854 | switch ($x) { |
| 829 | 855 | case 2: return "CPU"; |
@@ -96,7 +96,9 @@ discard block |
||
| 96 | 96 | if (!isset($types)) { |
| 97 | 97 | $types = array(); |
| 98 | 98 | $constants = get_defined_constants(true); |
| 99 | - foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
|
| 99 | + foreach ($constants['mysqli'] as $c => $n) { |
|
| 100 | + if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
|
| 101 | + } |
|
| 100 | 102 | } |
| 101 | 103 | return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown"; |
| 102 | 104 | } |
@@ -376,13 +378,13 @@ discard block |
||
| 376 | 378 | |
| 377 | 379 | |
| 378 | 380 | function link_results($n, $mq, $query, $clauses) { |
| 379 | - if ($n == '0') { // intentional compare by string |
|
| 381 | + if ($n == '0') { |
|
| 382 | +// intentional compare by string |
|
| 380 | 383 | return "0"; |
| 381 | 384 | } else { |
| 382 | 385 | if(strlen($clauses)) { |
| 383 | 386 | return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>"; |
| 384 | - } |
|
| 385 | - else { |
|
| 387 | + } else { |
|
| 386 | 388 | return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>"; |
| 387 | 389 | } |
| 388 | 390 | |
@@ -392,7 +394,7 @@ discard block |
||
| 392 | 394 | // Determines if in stderr_out is an error reported and prints as human readable String |
| 393 | 395 | // @return String A human readable string if error otherwise FALSE |
| 394 | 396 | // @param String $stderr_out the stderr_out value to parse |
| 395 | -function stderr_error_string($stderr_out){ |
|
| 397 | +function stderr_error_string($stderr_out) { |
|
| 396 | 398 | $y = parse_element($stderr_out, "<error_code>"); |
| 397 | 399 | $x = 0; |
| 398 | 400 | if ($y) { |
@@ -1146,7 +1148,7 @@ discard block |
||
| 1146 | 1148 | // result has not been received yet, so show report deadline either |
| 1147 | 1149 | // in green if in the future or in red if in the past. |
| 1148 | 1150 | $timenow=time(); |
| 1149 | - if ($result->report_deadline==0) { |
|
| 1151 | + if ($result->report_deadline==0) { |
|
| 1150 | 1152 | // not sent -- show create time in purple |
| 1151 | 1153 | $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
| 1152 | 1154 | } else if ($result->report_deadline>=$timenow) { |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $x = (int)$y; |
| 400 | 400 | } |
| 401 | 401 | if (0<=$x && $x<=9) { |
| 402 | - return FALSE; |
|
| 402 | + return false; |
|
| 403 | 403 | } else { |
| 404 | 404 | return "$x ".error_code_str($x); |
| 405 | 405 | } |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | row("Domain name", $host->domain_name); |
| 892 | 892 | $x = $host->timezone/3600; |
| 893 | 893 | if ($x >= 0) $x="+$x"; |
| 894 | - row("Local Standard Time", "UTC $x hours"); |
|
| 894 | + row("Local Standard Time", "utc $x hours"); |
|
| 895 | 895 | row("Number of CPUs", $host->p_ncpus); |
| 896 | 896 | row("CPU", "$host->p_vendor $host->p_model"); |
| 897 | 897 | row("GFLOPS", number_format($host->p_fpops/1e9, 2)); |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | $value=null; |
| 309 | 309 | } |
| 310 | 310 | if (isset($_GET[$order])) { |
| 311 | - $order = $_GET[$order]; |
|
| 311 | + $order = $_GET[$order]; |
|
| 312 | 312 | } else { |
| 313 | - $order = null; |
|
| 313 | + $order = null; |
|
| 314 | 314 | } |
| 315 | 315 | if (strlen($value)) { |
| 316 | 316 | if ($order == 'asc') { |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | $res = new StdClass; |
| 580 | 580 | $res->server_state = $ss; |
| 581 | 581 | row2(result_server_state_string($res), |
| 582 | - link_results("$server_state[$ss]", $urlquery,"server_state=$ss", '') |
|
| 582 | + link_results("$server_state[$ss]", $urlquery,"server_state=$ss", '') |
|
| 583 | 583 | ); |
| 584 | 584 | } |
| 585 | 585 | end_table(); |
@@ -1049,8 +1049,8 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | function validate_color($validate_state) { |
| 1051 | 1051 | switch ($validate_state) { |
| 1052 | - case 1: return '33cc33'; // valid, green |
|
| 1053 | - case 2: return 'ffa500'; // invalid result, orange |
|
| 1052 | + case 1: return '33cc33'; // valid, green |
|
| 1053 | + case 2: return 'ffa500'; // invalid result, orange |
|
| 1054 | 1054 | } |
| 1055 | 1055 | return ''; |
| 1056 | 1056 | } |
@@ -42,27 +42,27 @@ discard block |
||
| 42 | 42 | // @return String A user readable DateTime-String in UTC |
| 43 | 43 | // @param Integer $x The mysql-Timestamp to convert |
| 44 | 44 | function mysqltime_str($x) { |
| 45 | - if(strpos($x,"-")==4) { |
|
| 45 | + if (strpos($x, "-") == 4) { |
|
| 46 | 46 | // Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS |
| 47 | - $year = substr($x,0,4); |
|
| 48 | - $month = substr($x,5,2); |
|
| 49 | - $day = substr($x,8,2); |
|
| 50 | - $hour = substr($x,11,2); |
|
| 51 | - $minute = substr($x,14,2); |
|
| 52 | - $second = substr($x,17,2); |
|
| 47 | + $year = substr($x, 0, 4); |
|
| 48 | + $month = substr($x, 5, 2); |
|
| 49 | + $day = substr($x, 8, 2); |
|
| 50 | + $hour = substr($x, 11, 2); |
|
| 51 | + $minute = substr($x, 14, 2); |
|
| 52 | + $second = substr($x, 17, 2); |
|
| 53 | 53 | } else { |
| 54 | 54 | // Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS |
| 55 | - $year = substr($x,0,4); |
|
| 56 | - $month = substr($x,4,2); |
|
| 57 | - $day = substr($x,6,2); |
|
| 58 | - $hour = substr($x,8,2); |
|
| 59 | - $minute = substr($x,10,2); |
|
| 60 | - $second = substr($x,12,2); |
|
| 55 | + $year = substr($x, 0, 4); |
|
| 56 | + $month = substr($x, 4, 2); |
|
| 57 | + $day = substr($x, 6, 2); |
|
| 58 | + $hour = substr($x, 8, 2); |
|
| 59 | + $minute = substr($x, 10, 2); |
|
| 60 | + $second = substr($x, 12, 2); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | //make a Unix-Timestamp |
| 64 | 64 | // echo "Time string is " . "$x"; |
| 65 | - $time = mktime($hour,$minute,$second,$month,$day,$year); |
|
| 65 | + $time = mktime($hour, $minute, $second, $month, $day, $year); |
|
| 66 | 66 | return time_str($time); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $constants = get_defined_constants(true); |
| 101 | 101 | foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
| 102 | 102 | } |
| 103 | - return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown"; |
|
| 103 | + return array_key_exists($type_id, $types) ? strtolower($types[$type_id]) : "unknown"; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Function prints a description of $table |
@@ -110,38 +110,38 @@ discard block |
||
| 110 | 110 | $result = $db->do_query("SELECT * from $table LIMIT 1"); |
| 111 | 111 | $fields = $result->field_count; |
| 112 | 112 | |
| 113 | - $avgnum=(int)($fields/$columns); |
|
| 114 | - if ($avgnum*$columns<$fields) { |
|
| 113 | + $avgnum = (int)($fields/$columns); |
|
| 114 | + if ($avgnum*$columns < $fields) { |
|
| 115 | 115 | $avgnum++; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $actualcolumns=0; |
|
| 119 | - while ($avgnum*$actualcolumns<$fields) { |
|
| 118 | + $actualcolumns = 0; |
|
| 119 | + while ($avgnum*$actualcolumns < $fields) { |
|
| 120 | 120 | $actualcolumns++; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if ($which>$actualcolumns) { |
|
| 123 | + if ($which > $actualcolumns) { |
|
| 124 | 124 | return 0; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $bot=($which-1)*$avgnum; |
|
| 128 | - $top=$which*$avgnum; |
|
| 127 | + $bot = ($which - 1)*$avgnum; |
|
| 128 | + $top = $which*$avgnum; |
|
| 129 | 129 | |
| 130 | - $width=100.0/$actualcolumns; |
|
| 130 | + $width = 100.0/$actualcolumns; |
|
| 131 | 131 | |
| 132 | 132 | echo "<td>"; |
| 133 | 133 | start_table('table-striped'); |
| 134 | 134 | echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n"; |
| 135 | - for ($count=$bot; $count<$top; $count++) { |
|
| 136 | - if ($count<$fields) { |
|
| 135 | + for ($count = $bot; $count < $top; $count++) { |
|
| 136 | + if ($count < $fields) { |
|
| 137 | 137 | $x = $result->fetch_field_direct($count); |
| 138 | 138 | $name = $x->name; |
| 139 | 139 | $type = mysql_fieldtype_str($x->type); |
| 140 | 140 | $length = $x->length; |
| 141 | 141 | } else { |
| 142 | - $name="<br/> "; |
|
| 143 | - $type="<br/>"; |
|
| 144 | - $length="<br/>"; |
|
| 142 | + $name = "<br/> "; |
|
| 143 | + $type = "<br/>"; |
|
| 144 | + $length = "<br/>"; |
|
| 145 | 145 | } |
| 146 | 146 | echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n"; |
| 147 | 147 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | echo "<h2>Description of <b>$table</b> table fields:</h2>\n"; |
| 157 | 157 | start_table(); |
| 158 | 158 | echo "<tr>"; |
| 159 | - for ($i=1; $i<=$how_many_columns; $i++) { |
|
| 159 | + for ($i = 1; $i <= $how_many_columns; $i++) { |
|
| 160 | 160 | print_describe_table_onecol($table, $i, $how_many_columns); |
| 161 | 161 | } |
| 162 | 162 | echo "</tr>"; |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | function print_query_field() { |
| 178 | - $currenttime=time(); |
|
| 179 | - $hourago=$currenttime-3600; |
|
| 180 | - $dayago=$currenttime-24*3600; |
|
| 181 | - $weekago=$currenttime-7*24*3600; |
|
| 178 | + $currenttime = time(); |
|
| 179 | + $hourago = $currenttime - 3600; |
|
| 180 | + $dayago = $currenttime - 24*3600; |
|
| 181 | + $weekago = $currenttime - 7*24*3600; |
|
| 182 | 182 | echo " |
| 183 | 183 | <tr> |
| 184 | 184 | <td align=\"right\">Additional clauses</td> |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | -function append_sql_query($original,$addition,$first) { |
|
| 205 | +function append_sql_query($original, $addition, $first) { |
|
| 206 | 206 | if ($first == 1) { |
| 207 | - return $original . " where " . $addition; |
|
| 207 | + return $original." where ".$addition; |
|
| 208 | 208 | } else { |
| 209 | - return $original . " and " . $addition; |
|
| 209 | + return $original." and ".$addition; |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if (isset($_GET[$name])) { |
| 308 | 308 | $value = $_GET[$name]; |
| 309 | 309 | } else { |
| 310 | - $value=null; |
|
| 310 | + $value = null; |
|
| 311 | 311 | } |
| 312 | 312 | if (isset($_GET[$order])) { |
| 313 | 313 | $order = $_GET[$order]; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | function get_url($base = "db_action.php") { |
| 351 | - $s = $base . "?table=$this->table$this->urlquery"; |
|
| 351 | + $s = $base."?table=$this->table$this->urlquery"; |
|
| 352 | 352 | return $s; |
| 353 | 353 | } |
| 354 | 354 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $this->addeq('app_version_id'); |
| 364 | 364 | $this->addeq('exit_status'); |
| 365 | 365 | if (isset($_GET['nsecs'])) { |
| 366 | - $_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']); |
|
| 366 | + $_GET['mod_time'] = date("YmdHis", time() - $_GET['nsecs']); |
|
| 367 | 367 | } |
| 368 | 368 | $this->addgt('mod_time'); |
| 369 | 369 | $this->addeq_not_CHOOSE_ALL('server_state'); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | if ($n == '0') { // intentional compare by string |
| 385 | 385 | return "0"; |
| 386 | 386 | } else { |
| 387 | - if(strlen($clauses)) { |
|
| 387 | + if (strlen($clauses)) { |
|
| 388 | 388 | return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>"; |
| 389 | 389 | } |
| 390 | 390 | else { |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | // Determines if in stderr_out is an error reported and prints as human readable String |
| 398 | 398 | // @return String A human readable string if error otherwise FALSE |
| 399 | 399 | // @param String $stderr_out the stderr_out value to parse |
| 400 | -function stderr_error_string($stderr_out){ |
|
| 400 | +function stderr_error_string($stderr_out) { |
|
| 401 | 401 | $y = parse_element($stderr_out, "<error_code>"); |
| 402 | 402 | $x = 0; |
| 403 | 403 | if ($y) { |
| 404 | 404 | $x = (int)$y; |
| 405 | 405 | } |
| 406 | - if (0<=$x && $x<=9) { |
|
| 406 | + if (0 <= $x && $x <= 9) { |
|
| 407 | 407 | return FALSE; |
| 408 | 408 | } else { |
| 409 | 409 | return "$x ".error_code_str($x); |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | function admin_show_result_summary() { |
| 414 | - $ntotal =0; // TODO: how to count $result? |
|
| 415 | - $nvalid = 0; // for SUCCESS results |
|
| 414 | + $ntotal = 0; // TODO: how to count $result? |
|
| 415 | + $nvalid = 0; // for SUCCESS results |
|
| 416 | 416 | $ninvalid = 0; |
| 417 | 417 | $nfile_deleted = 0; |
| 418 | 418 | |
@@ -420,20 +420,20 @@ discard block |
||
| 420 | 420 | $outcome = array(); |
| 421 | 421 | $client_state = array(); |
| 422 | 422 | |
| 423 | - for ($ss=1; $ss<6; $ss++) { |
|
| 423 | + for ($ss = 1; $ss < 6; $ss++) { |
|
| 424 | 424 | $server_state[$ss] = 0; |
| 425 | 425 | } |
| 426 | - for ($ro=0; $ro<8; $ro++) { |
|
| 426 | + for ($ro = 0; $ro < 8; $ro++) { |
|
| 427 | 427 | $outcome[$ro] = 0; |
| 428 | 428 | } |
| 429 | - for ($cs=1; $cs<7; $cs++) { |
|
| 429 | + for ($cs = 1; $cs < 7; $cs++) { |
|
| 430 | 430 | $client_state[$cs] = 0; |
| 431 | 431 | } |
| 432 | - for ($fds=0; $fds<4; $fds++) { |
|
| 432 | + for ($fds = 0; $fds < 4; $fds++) { |
|
| 433 | 433 | $delete_state[$fds] = 0; |
| 434 | 434 | } |
| 435 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 436 | - $validate_state[$vs]=0; |
|
| 435 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 436 | + $validate_state[$vs] = 0; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $_GET['table'] = 'result'; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | // |
| 509 | 509 | $delay = parse_config(get_config(), "<delete_delay_hours>"); |
| 510 | 510 | if ($delay) { |
| 511 | - $start2 = $start - $delay*3600;; |
|
| 511 | + $start2 = $start - $delay*3600; ; |
|
| 512 | 512 | $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))"; |
| 513 | 513 | } else { |
| 514 | 514 | $main_query .= " and mod_time > FROM_UNIXTIME($start)"; |
@@ -567,20 +567,20 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | start_table(); |
| 569 | 569 | echo "<tr valign=\"top\">"; |
| 570 | - echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>"; |
|
| 571 | - echo "<td><h2>" . link_results("'Over' results", $urlquery, "server_state=5", '') . "</h2></td>"; |
|
| 572 | - echo "<td><h2>" . link_results("'Success' results", $urlquery, "outcome=1", '') . "</h2></td>"; |
|
| 573 | - echo "<td><h2>" . link_results("'Client error' results", $urlquery, "outcome=3", '') . "</h2></td>"; |
|
| 570 | + echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>"; |
|
| 571 | + echo "<td><h2>".link_results("'Over' results", $urlquery, "server_state=5", '')."</h2></td>"; |
|
| 572 | + echo "<td><h2>".link_results("'Success' results", $urlquery, "outcome=1", '')."</h2></td>"; |
|
| 573 | + echo "<td><h2>".link_results("'Client error' results", $urlquery, "outcome=3", '')."</h2></td>"; |
|
| 574 | 574 | echo "</tr>"; |
| 575 | 575 | echo "<tr valign=\"top\">"; |
| 576 | 576 | echo "<td>"; |
| 577 | 577 | start_table('table-striped'); |
| 578 | 578 | echo "<tr><th>Server state</th><th># results</th></tr>\n"; |
| 579 | - for ($ss=1; $ss<6; $ss++) { |
|
| 579 | + for ($ss = 1; $ss < 6; $ss++) { |
|
| 580 | 580 | $res = new StdClass; |
| 581 | 581 | $res->server_state = $ss; |
| 582 | 582 | row2(result_server_state_string($res), |
| 583 | - link_results("$server_state[$ss]", $urlquery,"server_state=$ss", '') |
|
| 583 | + link_results("$server_state[$ss]", $urlquery, "server_state=$ss", '') |
|
| 584 | 584 | ); |
| 585 | 585 | } |
| 586 | 586 | end_table(); |
@@ -590,11 +590,11 @@ discard block |
||
| 590 | 590 | start_table('table-striped'); |
| 591 | 591 | echo "<tr><th>Outcome</th><th># results</th></tr>\n"; |
| 592 | 592 | |
| 593 | - for ($ro=0; $ro<8; $ro++) { |
|
| 593 | + for ($ro = 0; $ro < 8; $ro++) { |
|
| 594 | 594 | $res = new StdClass; |
| 595 | 595 | $res->outcome = $ro; |
| 596 | 596 | $res->exit_status = 0; |
| 597 | - c_row2($outcome[$ro]?outcome_color($ro):'', result_outcome_string($res), |
|
| 597 | + c_row2($outcome[$ro] ?outcome_color($ro) : '', result_outcome_string($res), |
|
| 598 | 598 | link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '') |
| 599 | 599 | ); |
| 600 | 600 | } |
@@ -604,18 +604,18 @@ discard block |
||
| 604 | 604 | echo "<td>"; |
| 605 | 605 | start_table('table-striped'); |
| 606 | 606 | echo "<tr><th>Validate state</th><th># results</th></tr>\n"; |
| 607 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 607 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 608 | 608 | $res = new StdClass; |
| 609 | 609 | $res->validate_state = $vs; |
| 610 | 610 | $res->exit_status = 0; |
| 611 | - c_row2($validate_state[$vs]?validate_color($vs):'', validate_state_str($res), |
|
| 611 | + c_row2($validate_state[$vs] ?validate_color($vs) : '', validate_state_str($res), |
|
| 612 | 612 | link_results("$validate_state[$vs]", $urlquery, "validate_state=$vs", "outcome=1")); |
| 613 | 613 | } |
| 614 | 614 | end_table(); |
| 615 | 615 | start_table('table-striped'); |
| 616 | 616 | echo "<tr><th>File Delete state</th><th># results</th></tr>\n"; |
| 617 | 617 | |
| 618 | - for ($fds=0; $fds<4; $fds++) { |
|
| 618 | + for ($fds = 0; $fds < 4; $fds++) { |
|
| 619 | 619 | row2(file_delete_state_str($fds), |
| 620 | 620 | link_results("$file_delete[$fds]", $urlquery, "outcome=1", "file_delete_state=$fds")); |
| 621 | 621 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | echo "<td>"; |
| 628 | 628 | start_table('table-striped'); |
| 629 | 629 | echo "<tr><th>Client state</th><th># results</th></tr>\n"; |
| 630 | - for ($cs=1; $cs<7; $cs++) { |
|
| 630 | + for ($cs = 1; $cs < 7; $cs++) { |
|
| 631 | 631 | $res = new StdClass; |
| 632 | 632 | $res->client_state = $cs; |
| 633 | 633 | $res->exit_status = 0; |
@@ -646,9 +646,9 @@ discard block |
||
| 646 | 646 | <select name=\"server_state\"> |
| 647 | 647 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 648 | 648 | "; |
| 649 | - for ($i=1; $i<6; $i++) { |
|
| 649 | + for ($i = 1; $i < 6; $i++) { |
|
| 650 | 650 | $res = new StdClass; |
| 651 | - $res->server_state=$i; |
|
| 651 | + $res->server_state = $i; |
|
| 652 | 652 | echo "<option value=\"$i\"> "."[$i] ".' '.result_server_state_string($res)."</option>\n"; |
| 653 | 653 | } |
| 654 | 654 | echo "</select>\n"; |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | <select name=\"outcome\"> |
| 660 | 660 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 661 | 661 | "; |
| 662 | - for ($i=0; $i<8; $i++) { |
|
| 662 | + for ($i = 0; $i < 8; $i++) { |
|
| 663 | 663 | $res = new StdClass; |
| 664 | 664 | $res->outcome = $i; |
| 665 | 665 | $res->exit_status = 0; |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | <select name=\"validate_state\"> |
| 674 | 674 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 675 | 675 | "; |
| 676 | - for ($vs=0; $vs<NVALIDATE_STATES; $vs++) { |
|
| 676 | + for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) { |
|
| 677 | 677 | $res = new StdClass; |
| 678 | 678 | $res->validate_state = $vs; |
| 679 | 679 | $res->exit_status = 0; |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | <select name=\"client_state\"> |
| 688 | 688 | <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option> |
| 689 | 689 | "; |
| 690 | - for ($i=0; $i<7; $i++) { |
|
| 690 | + for ($i = 0; $i < 7; $i++) { |
|
| 691 | 691 | $res = new StdClass; |
| 692 | 692 | $res->client_state = $i; |
| 693 | 693 | $res->exit_status = 0; |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | function table_title($table) { |
| 727 | - switch($table) { |
|
| 727 | + switch ($table) { |
|
| 728 | 728 | case "platform": return "Platforms"; |
| 729 | 729 | case "app": return "Applications"; |
| 730 | 730 | case "app_version": return "Application Versions"; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | row("Created", time_str($platform->create_time)); |
| 745 | 745 | row("Name", $platform->name); |
| 746 | 746 | row("User friendly name", $platform->user_friendly_name); |
| 747 | - row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>"); |
|
| 747 | + row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>"); |
|
| 748 | 748 | end_table(); |
| 749 | 749 | } |
| 750 | 750 | |
@@ -756,8 +756,8 @@ discard block |
||
| 756 | 756 | row("User-friendly name", $app->user_friendly_name); |
| 757 | 757 | row("Deprecated", $app->deprecated); |
| 758 | 758 | row("Homogeneous redundancy", $app->homogeneous_redundancy); |
| 759 | - row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>"); |
|
| 760 | - row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>"); |
|
| 759 | + row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>"); |
|
| 760 | + row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>"); |
|
| 761 | 761 | end_table(); |
| 762 | 762 | } |
| 763 | 763 | |
@@ -765,9 +765,9 @@ discard block |
||
| 765 | 765 | start_table(); |
| 766 | 766 | row("ID", $app_version->id); |
| 767 | 767 | row("Created", time_str($app_version->create_time)); |
| 768 | - row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>"); |
|
| 768 | + row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>"); |
|
| 769 | 769 | row("Version num", $app_version->version_num); |
| 770 | - row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" ); |
|
| 770 | + row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>"); |
|
| 771 | 771 | row("Plan Class", $app_version->plan_class); |
| 772 | 772 | row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>"); |
| 773 | 773 | row("min_core_version", $app_version->min_core_version); |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | row("External IP address", "$host->external_ip_addr<br>"); |
| 903 | 903 | row("Domain name", $host->domain_name); |
| 904 | 904 | $x = $host->timezone/3600; |
| 905 | - if ($x >= 0) $x="+$x"; |
|
| 905 | + if ($x >= 0) $x = "+$x"; |
|
| 906 | 906 | row("Local Standard Time", "UTC $x hours"); |
| 907 | 907 | row("Number of CPUs", $host->p_ncpus); |
| 908 | 908 | row("CPU", "$host->p_vendor $host->p_model"); |
@@ -950,10 +950,10 @@ discard block |
||
| 950 | 950 | start_table(); |
| 951 | 951 | row("Created", time_str($wu->create_time)); |
| 952 | 952 | row("Transition Time", time_str($wu->transition_time)); |
| 953 | - row("Last time modified",mysqltime_str($wu->mod_time)); |
|
| 953 | + row("Last time modified", mysqltime_str($wu->mod_time)); |
|
| 954 | 954 | row("Name", $wu->name); |
| 955 | 955 | row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>"); |
| 956 | - row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>"); |
|
| 956 | + row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>"); |
|
| 957 | 957 | row("Batch", $wu->batch); |
| 958 | 958 | $x = number_format($wu->rsc_fpops_est/1e9, 2); |
| 959 | 959 | row("Estimated FP Operations", "$x GFLOPS"); |
@@ -965,12 +965,12 @@ discard block |
||
| 965 | 965 | $x = $wu->rsc_disk_bound/(1024*1024); |
| 966 | 966 | $y = number_format($x, 2); |
| 967 | 967 | row("Max Disk Usage", "$y MB"); |
| 968 | - row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]"); |
|
| 968 | + row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]"); |
|
| 969 | 969 | row("Canonical resultid", |
| 970 | 970 | "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>"); |
| 971 | 971 | row("Canonical credit", $wu->canonical_credit); |
| 972 | 972 | //row("Timeout check time", time_str($wu->timeout_check_time)); |
| 973 | - row("Delay bound", "$wu->delay_bound" . " = " . time_diff($wu->delay_bound) ); |
|
| 973 | + row("Delay bound", "$wu->delay_bound"." = ".time_diff($wu->delay_bound)); |
|
| 974 | 974 | row("Error mask", wu_error_mask_str($wu->error_mask)); |
| 975 | 975 | row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]"); |
| 976 | 976 | row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]"); |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | row("max error results", $wu->max_error_results); |
| 981 | 981 | row("max total results", $wu->max_total_results); |
| 982 | 982 | row("max success results", $wu->max_success_results); |
| 983 | - row("result template file",$wu->result_template_file); |
|
| 983 | + row("result template file", $wu->result_template_file); |
|
| 984 | 984 | row("hr_class", $wu->hr_class); |
| 985 | 985 | row("opaque", $wu->opaque); |
| 986 | 986 | row("Priority", $wu->priority); |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | function outcome_color($outcome) { |
| 1060 | - switch($outcome) { |
|
| 1060 | + switch ($outcome) { |
|
| 1061 | 1061 | case 0: return '9900cc'; // "Init", purple |
| 1062 | 1062 | case 1: return '33cc33'; // "Success", green |
| 1063 | 1063 | case 3: return 'ff3333'; // "Client error", red |
@@ -1084,18 +1084,18 @@ discard block |
||
| 1084 | 1084 | row("Sent", time_str($result->sent_time)); |
| 1085 | 1085 | row("Report deadline", time_str($result->report_deadline)); |
| 1086 | 1086 | row("Received", time_str($result->received_time)); |
| 1087 | - row("Last time modified",mysqltime_str($result->mod_time)); |
|
| 1087 | + row("Last time modified", mysqltime_str($result->mod_time)); |
|
| 1088 | 1088 | row("Name", $result->name); |
| 1089 | - row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" ); |
|
| 1089 | + row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]"); |
|
| 1090 | 1090 | row("Server state", result_server_state_string($result)." [$result->server_state]"); |
| 1091 | 1091 | row("Outcome", result_outcome_string($result)." [$result->outcome]"); |
| 1092 | 1092 | row("Client state", result_client_state_string($result)." [$result->client_state]"); |
| 1093 | 1093 | row("Exit status", exit_status_string($result->exit_status)); |
| 1094 | - row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]"); |
|
| 1095 | - row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]"); |
|
| 1094 | + row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]"); |
|
| 1095 | + row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]"); |
|
| 1096 | 1096 | row("CPU time", $result->cpu_time); |
| 1097 | 1097 | row("Elapsed time", $result->elapsed_time); |
| 1098 | - if($error=stderr_error_string($result->stderr_out)) { |
|
| 1098 | + if ($error = stderr_error_string($result->stderr_out)) { |
|
| 1099 | 1099 | row("error in stderr out", $error); |
| 1100 | 1100 | } |
| 1101 | 1101 | row("Batch", $result->batch); |
@@ -1112,16 +1112,16 @@ discard block |
||
| 1112 | 1112 | row("App version", $x1.app_version_string($result).$x2); |
| 1113 | 1113 | row("App version ID", $result->app_version_id); |
| 1114 | 1114 | row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2)); |
| 1115 | - row("Random",$result->random); |
|
| 1116 | - row("Opaque",$result->opaque); |
|
| 1117 | - row("Teamid",$result->teamid); |
|
| 1118 | - row("Priority",$result->priority); |
|
| 1115 | + row("Random", $result->random); |
|
| 1116 | + row("Opaque", $result->opaque); |
|
| 1117 | + row("Teamid", $result->teamid); |
|
| 1118 | + row("Priority", $result->priority); |
|
| 1119 | 1119 | row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>"); |
| 1120 | 1120 | row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>"); |
| 1121 | 1121 | row("stderr out", "<pre>" |
| 1122 | 1122 | .htmlspecialchars( |
| 1123 | 1123 | $result->stderr_out, |
| 1124 | - ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0), |
|
| 1124 | + ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0), |
|
| 1125 | 1125 | 'utf-8' |
| 1126 | 1126 | ) |
| 1127 | 1127 | ."</pre>" |
@@ -1169,23 +1169,23 @@ discard block |
||
| 1169 | 1169 | } else { |
| 1170 | 1170 | // result has not been received yet, so show report deadline either |
| 1171 | 1171 | // in green if in the future or in red if in the past. |
| 1172 | - $timenow=time(); |
|
| 1173 | - if ($result->report_deadline==0) { |
|
| 1172 | + $timenow = time(); |
|
| 1173 | + if ($result->report_deadline == 0) { |
|
| 1174 | 1174 | // not sent -- show create time in purple |
| 1175 | - $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
|
| 1176 | - } else if ($result->report_deadline>=$timenow) { |
|
| 1175 | + $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>"; |
|
| 1176 | + } else if ($result->report_deadline >= $timenow) { |
|
| 1177 | 1177 | // overdue -- show deadline in red |
| 1178 | - $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>"; |
|
| 1178 | + $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>"; |
|
| 1179 | 1179 | } else { |
| 1180 | 1180 | // in progress and not overdue -- show deadline in green |
| 1181 | - $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>"; |
|
| 1181 | + $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>"; |
|
| 1182 | 1182 | } |
| 1183 | 1183 | } |
| 1184 | 1184 | $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)"; |
| 1185 | 1185 | $outcome_color = outcome_color($result->outcome); |
| 1186 | 1186 | $validate_color = validate_color($result->validate_state); |
| 1187 | 1187 | $host_user = host_user_link($result->hostid); |
| 1188 | - $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600); |
|
| 1188 | + $cpu_hours = sprintf("%.1f", $result->cpu_time/3600); |
|
| 1189 | 1189 | $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>"; |
| 1190 | 1190 | $delete_state = file_delete_state_str($result->file_delete_state); |
| 1191 | 1191 | |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | row("ID", $user->id); |
| 1214 | 1214 | row("Created", time_str($user->create_time)); |
| 1215 | 1215 | row("Name", $user->name); |
| 1216 | - if(!in_rops()) { |
|
| 1216 | + if (!in_rops()) { |
|
| 1217 | 1217 | row("Authenticator", $user->authenticator); |
| 1218 | 1218 | } |
| 1219 | 1219 | row("Email address", $user->email_addr); |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | row("Default venue", $user->venue); |
| 1227 | 1227 | row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>"); |
| 1228 | 1228 | row("Cross project ID", $user->cross_project_id); |
| 1229 | - if(!in_rops()) { |
|
| 1229 | + if (!in_rops()) { |
|
| 1230 | 1230 | row("Password Hash", $user->passwd_hash); |
| 1231 | 1231 | } |
| 1232 | 1232 | row("Donated", $user->donated); |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | echo "</table></td>"; |
| 1278 | 1278 | echo "<td><table border=\"2\">\n"; |
| 1279 | 1279 | echo "<tr><th>User</th><th># posts</th></tr>\n"; |
| 1280 | - for ($p=1; $p<=10; $p++) { |
|
| 1280 | + for ($p = 1; $p <= 10; $p++) { |
|
| 1281 | 1281 | row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts); |
| 1282 | 1282 | } |
| 1283 | 1283 | echo "</table></td>"; |
@@ -1316,10 +1316,10 @@ discard block |
||
| 1316 | 1316 | function admin_show_team($team) { |
| 1317 | 1317 | start_table(); |
| 1318 | 1318 | row("ID", $team->id); |
| 1319 | - row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>"); |
|
| 1319 | + row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>"); |
|
| 1320 | 1320 | row("Name", $team->name); |
| 1321 | - row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" ); |
|
| 1322 | - row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>"); |
|
| 1321 | + row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>"); |
|
| 1322 | + row("Url", "<a href=\"http://$team->url\">".$team->url."</a>"); |
|
| 1323 | 1323 | row("Type", team_type_string($team->type)); |
| 1324 | 1324 | row("Description", $team->description); |
| 1325 | 1325 | row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>"); |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) { |
| 1363 | 1363 | return "(blank)"; |
| 1364 | 1364 | } else { |
| 1365 | - return $host->domain_name . " (" . $host->last_ip_addr . ")"; |
|
| 1365 | + return $host->domain_name." (".$host->last_ip_addr.")"; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | } |
| 1368 | 1368 | |