@@ -21,6 +21,9 @@ discard block |
||
21 | 21 | // my PHP currently doesn't support file_get_contents(https://...) |
22 | 22 | // so do it with Curl |
23 | 23 | // |
24 | +/** |
|
25 | + * @param string $url |
|
26 | + */ |
|
24 | 27 | function fetch_url($url) { |
25 | 28 | if (0) { |
26 | 29 | return file_get_contents($url); |
@@ -35,6 +38,11 @@ discard block |
||
35 | 38 | } |
36 | 39 | } |
37 | 40 | |
41 | +/** |
|
42 | + * @param string $project_url |
|
43 | + * @param string $email_addr |
|
44 | + * @param string $passwd_hash |
|
45 | + */ |
|
38 | 46 | function lookup_account( |
39 | 47 | $project_url, |
40 | 48 | $email_addr, |
@@ -57,6 +65,12 @@ discard block |
||
57 | 65 | |
58 | 66 | // return (authenticator, errmsg) |
59 | 67 | // |
68 | +/** |
|
69 | + * @param string $project_url |
|
70 | + * @param string $email_addr |
|
71 | + * @param string $passwd_hash |
|
72 | + * @param string $user_name |
|
73 | + */ |
|
60 | 74 | function create_account( |
61 | 75 | $project_url, |
62 | 76 | $email_addr, |
@@ -57,6 +57,9 @@ |
||
57 | 57 | |
58 | 58 | $xml_outer_tag = ""; |
59 | 59 | |
60 | +/** |
|
61 | + * @param string $tag |
|
62 | + */ |
|
60 | 63 | function xml_start_tag($tag) { |
61 | 64 | global $xml_outer_tag; |
62 | 65 | echo "<$tag>\n"; |
@@ -72,6 +72,9 @@ discard block |
||
72 | 72 | // badge_name_prefix should be user or team |
73 | 73 | // sub_project is an array with name and short_name as in $sub_projects |
74 | 74 | // |
75 | +/** |
|
76 | + * @param string $badge_name_prefix |
|
77 | + */ |
|
75 | 78 | function get_badges( |
76 | 79 | $badge_name_prefix, $badge_level_names, $badge_images, $sub_project |
77 | 80 | ) { |
@@ -105,6 +108,9 @@ discard block |
||
105 | 108 | // decide which subproject badge to assign, if any. |
106 | 109 | // Unassign other badges. |
107 | 110 | // |
111 | +/** |
|
112 | + * @param string $where_clause |
|
113 | + */ |
|
108 | 114 | function assign_sub_badge($is_user, $item, $levels, $badges, $where_clause) { |
109 | 115 | if ($is_user) { |
110 | 116 | $sub_total = BoincCreditUser::sum('total', "where userid=".$item->id." and ($where_clause)"); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) { |
78 | 78 | $badges = array(); |
79 | 79 | $limit = count($badge_level_names); |
80 | - for ($i=0; $i < $limit; $i++) { |
|
80 | + for ($i = 0; $i < $limit; $i++) { |
|
81 | 81 | $badges[$i] = get_badge($badge_name_prefix."_".$sub_project["short_name"]."_".$i, "$badge_level_names[$i] in ".$sub_project["name"]." credit", $sub_project["short_name"].$badge_images[$i]); |
82 | 82 | } |
83 | 83 | return $badges; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | // count from highest to lowest level, so the user get's assigned the |
91 | 91 | // highest possible level and the lower levels get removed |
92 | 92 | // |
93 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
93 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
94 | 94 | if ($item->total_credit >= $levels[$i]) { |
95 | 95 | assign_badge($is_user, $item, $badges[$i]); |
96 | 96 | unassign_badges($is_user, $item, $badges, $i); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // count from highest to lowest level, so the user get's assigned the |
115 | 115 | // highest possible level and the lower levels get removed |
116 | 116 | // |
117 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
117 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
118 | 118 | if ($sub_total >= $levels[$i]) { |
119 | 119 | assign_badge($is_user, $item, $badges[$i]); |
120 | 120 | unassign_badges($is_user, $item, $badges, $i); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $is_user, $badge_levels, $badge_level_names, $badge_images, |
135 | 135 | $subprojects_list |
136 | 136 | ) { |
137 | - $kind = $is_user?"user":"team"; |
|
137 | + $kind = $is_user ? "user" : "team"; |
|
138 | 138 | |
139 | 139 | // get badges for all subprojects including total |
140 | 140 | // |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $n = 0; |
146 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
146 | + $maxid = $is_user ?BoincUser::max("id") : BoincTeam::max("id"); |
|
147 | 147 | while ($n <= $maxid) { |
148 | 148 | $m = $n + 1000; |
149 | 149 | if ($is_user) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | assign_tot_badge($is_user, $item, $badge_levels, $badges["total"]); |
162 | 162 | } else { |
163 | 163 | // appids come from project/project.inc |
164 | - $where_clause = "appid in (". implode(',', $sp["appids"]) .")"; |
|
164 | + $where_clause = "appid in (".implode(',', $sp["appids"]).")"; |
|
165 | 165 | assign_sub_badge( |
166 | 166 | $is_user, $item, $badge_levels, $badges[$sp["short_name"]], |
167 | 167 | $where_clause |
@@ -173,6 +173,9 @@ discard block |
||
173 | 173 | return $x; |
174 | 174 | } |
175 | 175 | |
176 | +/** |
|
177 | + * @param integer $mode |
|
178 | + */ |
|
176 | 179 | function get_nquestions($unit, $mode) { |
177 | 180 | global $snap; |
178 | 181 | |
@@ -187,6 +190,9 @@ discard block |
||
187 | 190 | return 0; |
188 | 191 | } |
189 | 192 | |
193 | +/** |
|
194 | + * @param integer $mode |
|
195 | + */ |
|
190 | 196 | function get_views($unit, $mode) { |
191 | 197 | global $snap; |
192 | 198 | |
@@ -231,6 +237,10 @@ discard block |
||
231 | 237 | |
232 | 238 | $rownum = 0; |
233 | 239 | |
240 | +/** |
|
241 | + * @param string $class |
|
242 | + * @param boolean $is_answer |
|
243 | + */ |
|
234 | 244 | function show_unit_row($unit, $class, $level, $is_answer) { |
235 | 245 | global $breakdown, $breakdown_cat; |
236 | 246 | global $rownum, $course_id; |
@@ -319,6 +329,9 @@ discard block |
||
319 | 329 | echo "</tr>\n"; |
320 | 330 | } |
321 | 331 | |
332 | +/** |
|
333 | + * @param string $class |
|
334 | + */ |
|
322 | 335 | function breakdown_class($class) { |
323 | 336 | switch ($class) { |
324 | 337 | case "BoltLesson": |
@@ -356,6 +369,9 @@ discard block |
||
356 | 369 | } |
357 | 370 | } |
358 | 371 | |
372 | +/** |
|
373 | + * @param integer $level |
|
374 | + */ |
|
359 | 375 | function show_unit_recurse($unit, $level) { |
360 | 376 | show_unit($unit, $level); |
361 | 377 | if ($unit->is_item) return; |
@@ -243,7 +243,7 @@ |
||
243 | 243 | <td><br></td> |
244 | 244 | <td><br></td> |
245 | 245 | "; |
246 | - } else { |
|
246 | + } else { |
|
247 | 247 | $c = class_name($class); |
248 | 248 | echo " |
249 | 249 | <td><b>".spaces($level)."$unit->name</b></td> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | function spaces($level) { |
105 | 105 | $x = ""; |
106 | - for ($i=0; $i<$level; $i++) { |
|
106 | + for ($i = 0; $i < $level; $i++) { |
|
107 | 107 | $x .= " "; |
108 | 108 | } |
109 | 109 | return $x; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function avg_score($array) { |
137 | 137 | $sum = 0; |
138 | 138 | $n = count($array); |
139 | - if ($n ==0) return 0; |
|
139 | + if ($n == 0) return 0; |
|
140 | 140 | foreach ($array as $a) { |
141 | 141 | $sum += $a->score; |
142 | 142 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $n++; |
153 | 153 | } |
154 | 154 | } |
155 | - if ($n ==0) return 0; |
|
155 | + if ($n == 0) return 0; |
|
156 | 156 | return $sum/$n; |
157 | 157 | } |
158 | 158 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | global $breakdown, $breakdown_cat; |
236 | 236 | global $rownum, $course_id; |
237 | 237 | |
238 | - $a = $is_answer?" (answer)":""; |
|
238 | + $a = $is_answer ? " (answer)" : ""; |
|
239 | 239 | $j = ($rownum++)%2; |
240 | 240 | echo "<tr class=row$j>"; |
241 | 241 | if ($breakdown && $breakdown_cat) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | <td><br></td> |
244 | 244 | <td><br></td> |
245 | 245 | "; |
246 | - } else { |
|
246 | + } else { |
|
247 | 247 | $c = class_name($class); |
248 | 248 | echo " |
249 | 249 | <td><b>".spaces($level)."$unit->name</b></td> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | echo time_graph($t, 200); |
278 | 278 | break; |
279 | 279 | case "BoltExercise": |
280 | - $mode = $is_answer?BOLT_MODE_ANSWER:BOLT_MODE_SHOW; |
|
280 | + $mode = $is_answer ?BOLT_MODE_ANSWER:BOLT_MODE_SHOW; |
|
281 | 281 | $views = get_views($unit, $mode); |
282 | 282 | $n = count($views); |
283 | 283 | $out = outcomes($views); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | show_unit($unit, $level); |
361 | 361 | if ($unit->is_item) return; |
362 | 362 | foreach ($unit->units as $u) { |
363 | - show_unit_recurse($u, $level+1); |
|
363 | + show_unit_recurse($u, $level + 1); |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | <input type=hidden name=course_id value=$course_id> |
403 | 403 | <table width=600><tr><td valign=top> |
404 | 404 | "; |
405 | - filter_form($filter?$filter->name():"", $filter_cat); |
|
405 | + filter_form($filter ? $filter->name() : "", $filter_cat); |
|
406 | 406 | echo "</td><td valign=top>"; |
407 | - breakdown_form($breakdown?$breakdown->name():""); |
|
407 | + breakdown_form($breakdown ? $breakdown->name() : ""); |
|
408 | 408 | echo " |
409 | 409 | </td></tr></table> |
410 | 410 | <p> |
@@ -34,6 +34,9 @@ |
||
34 | 34 | require_once($file); |
35 | 35 | } |
36 | 36 | |
37 | +/** |
|
38 | + * @param integer $i |
|
39 | + */ |
|
37 | 40 | function show_bossa_app($app, $i) { |
38 | 41 | $j = $i%2; |
39 | 42 | echo "<tr class=row$j> |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | "; |
102 | 102 | start_table(); |
103 | 103 | row1("User settings"); |
104 | - $x = ($flags&BOLT_FLAGS_SHOW_ALL)?"checked":""; |
|
104 | + $x = ($flags&BOLT_FLAGS_SHOW_ALL) ? "checked" : ""; |
|
105 | 105 | row2("Show hidden apps?", "<input type=checkbox name=show_all $x>"); |
106 | - $x = ($flags&BOLT_FLAGS_DEBUG)?"checked":""; |
|
106 | + $x = ($flags&BOLT_FLAGS_DEBUG) ? "checked" : ""; |
|
107 | 107 | row2("Show debugging output?", "<input type=checkbox name=debug $x>"); |
108 | 108 | row2("", "<input class=\"btn btn-default\" type=submit value=\"Update user\">"); |
109 | 109 | end_table(); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | foreach ($jobs as $job) { |
172 | 172 | $t = time_str($job->create_time); |
173 | 173 | $s = job_state_string($job->state); |
174 | - $j = $i++ % 2; |
|
174 | + $j = $i++%2; |
|
175 | 175 | echo "<tr class=row$j> |
176 | 176 | <td> |
177 | 177 | $job->id <a href=bossa_admin.php?action=job_show_insts&job_id=$job->id>(details)</a><br> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | table_row( |
204 | 204 | "$batch->id | <a href=bossa_admin.php?action=show_batch&batch_id=$batch->id>show jobs</a> | <a href=bossa_admin.php?action=clear_batch_confirm&batch_id=$batch->id>delete instances</a>", |
205 | 205 | "$batch->name", |
206 | - $batch->calibration?"yes":"no", |
|
206 | + $batch->calibration ? "yes" : "no", |
|
207 | 207 | time_str($batch->create_time), |
208 | 208 | BossaJob::count("batch_id=$batch->id"), |
209 | 209 | BossaJob::count("batch_id=$batch->id and state=2") |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if (!$time_estimate) $time_estimate = 60; |
334 | 334 | $time_limit = get_str('time_limit'); |
335 | 335 | if (!$time_limit) $time_limit = 3600; |
336 | - $calibration_frac = get_str('calibration_frac' , true); |
|
336 | + $calibration_frac = get_str('calibration_frac', true); |
|
337 | 337 | if (!$calibration_frac) $calibration_frac = 0; |
338 | 338 | $now = time(); |
339 | 339 | $app_id = BossaApp::insert("(create_time, name, short_name, description, bolt_course_id, time_estimate, time_limit, calibration_frac) values ($now, '$name', '$short_name', '$description', $courseid, $time_estimate, $time_limit, $calibration_frac)"); |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | require_once("../inc/util_basic.inc"); |
29 | 29 | require_once("../inc/util_ops.inc"); |
30 | 30 | |
31 | +/** |
|
32 | + * @param integer $range |
|
33 | + */ |
|
31 | 34 | function rand_color($im, $range) { |
32 | 35 | $mid = 200; |
33 | 36 | $lo = $mid - $range; |
@@ -35,12 +38,18 @@ discard block |
||
35 | 38 | return imagecolorallocate($im, rand($lo,$hi), rand($lo,$hi), rand($lo,$hi)); |
36 | 39 | } |
37 | 40 | |
41 | +/** |
|
42 | + * @param resource $im |
|
43 | + */ |
|
38 | 44 | function add_ellipse($im, $case) { |
39 | 45 | imagefilledellipse( |
40 | 46 | $im, $case->cx, $case->cy, $case->w, $case->h, rand_color($im, 50) |
41 | 47 | ); |
42 | 48 | } |
43 | 49 | |
50 | +/** |
|
51 | + * @param resource $im |
|
52 | + */ |
|
44 | 53 | function add_rect($im) { |
45 | 54 | $cx = rand(-100, 600); |
46 | 55 | $cy = rand(-100, 400); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $mid = 200; |
33 | 33 | $lo = $mid - $range; |
34 | 34 | $hi = $mid + $range; |
35 | - return imagecolorallocate($im, rand($lo,$hi), rand($lo,$hi), rand($lo,$hi)); |
|
35 | + return imagecolorallocate($im, rand($lo, $hi), rand($lo, $hi), rand($lo, $hi)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function add_ellipse($im, $case) { |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | $cy = rand(-100, 400); |
47 | 47 | $w = rand(50, 100); |
48 | 48 | $h = rand(50, 100); |
49 | - imagefilledrectangle($im, $cx, $cy, $cx+$w, $cy+$h, rand_color($im, 50)); |
|
49 | + imagefilledrectangle($im, $cx, $cy, $cx + $w, $cy + $h, rand_color($im, 50)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | function make_image($case) { |
54 | 54 | $im = imagecreatetruecolor(600, 400); |
55 | 55 | imagefill($im, 0, 0, imagecolorallocate($im, 255, 255, 255)); |
56 | - for ($i=0; $i<400; $i++) { |
|
56 | + for ($i = 0; $i < 400; $i++) { |
|
57 | 57 | add_rect($im); |
58 | 58 | } |
59 | 59 | $im2 = imagecreatetruecolor(600, 400); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $nfiles = 0; |
86 | 86 | $dir = null; |
87 | 87 | $ellipse_frac = 0.5; |
88 | -for ($i=1; $i<$argc; $i++) { |
|
88 | +for ($i = 1; $i < $argc; $i++) { |
|
89 | 89 | if ($argv[$i] == '--nfiles') $nfiles = $argv[++$i]; |
90 | 90 | elseif ($argv[$i] == '--dir') $dir = $argv[++$i]; |
91 | 91 | elseif ($argv[$i] == '--ellipse_frac') $ellipse_frac = $argv[++$i]; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | exit("$dir is not a directory\n"); |
100 | 100 | } |
101 | 101 | |
102 | -for ($i=0; $i<$nfiles; $i++) { |
|
102 | +for ($i = 0; $i < $nfiles; $i++) { |
|
103 | 103 | $path = "$dir/$i.png"; |
104 | 104 | $anspath = "$dir/$i.ans"; |
105 | 105 | $case = make_test_case($ellipse_frac); |
@@ -66,6 +66,9 @@ |
||
66 | 66 | // $x is an array of result/host objects; |
67 | 67 | // return the variance among claimed credits given an FP weight |
68 | 68 | // |
69 | +/** |
|
70 | + * @param double $fpw |
|
71 | + */ |
|
69 | 72 | function fpw_var($results, $fpw) { |
70 | 73 | $cc = array(); |
71 | 74 | foreach ($results as $r) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function mean($x) { |
33 | 33 | $sum = 0; |
34 | 34 | $n = count($x); |
35 | - for ($i=0; $i<$n; $i++) { |
|
35 | + for ($i = 0; $i < $n; $i++) { |
|
36 | 36 | $sum += $x[$i]; |
37 | 37 | } |
38 | 38 | return $sum/$n; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $sum = 0; |
43 | 43 | $n = count($x); |
44 | 44 | $m = mean($x); |
45 | - for ($i=0; $i<$n; $i++) { |
|
45 | + for ($i = 0; $i < $n; $i++) { |
|
46 | 46 | $d = $x[$i] - $m; |
47 | 47 | $sum += $d*$d; |
48 | 48 | //echo "$x[$i] "; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | // returns the claimed credit for a given result/host and FP weight |
57 | 57 | // |
58 | 58 | function cc($x, $fpw) { |
59 | - $cps = $x->p_fpops*$fpw + $x->p_iops*(1-$fpw); |
|
59 | + $cps = $x->p_fpops*$fpw + $x->p_iops*(1 - $fpw); |
|
60 | 60 | $cps /= 1e9; |
61 | 61 | $cps /= 864; |
62 | - $cc = $x->cpu_time * $cps; |
|
62 | + $cc = $x->cpu_time*$cps; |
|
63 | 63 | return $cc; |
64 | 64 | } |
65 | 65 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $nwus = 4000; |
85 | 85 | |
86 | 86 | $sum = array(); |
87 | - for ($i=0; $i<=10; $i++) { |
|
87 | + for ($i = 0; $i <= 10; $i++) { |
|
88 | 88 | $sum[] = 0; |
89 | 89 | } |
90 | 90 | $r1 = _mysql_query( |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $r2 = _mysql_query("select * from result where workunitid=$wu->id"); |
97 | 97 | $found_zero = false; |
98 | 98 | while ($result = _mysql_fetch_object($r2)) { |
99 | - if ($result->granted_credit==0) continue; // skip invalid |
|
99 | + if ($result->granted_credit == 0) continue; // skip invalid |
|
100 | 100 | $host = BoincHost::lookup_id($result->hostid); |
101 | 101 | $r = new StdClass; |
102 | 102 | $r->cpu_time = $result->cpu_time; |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | $results[] = $r; |
106 | 106 | } |
107 | 107 | //echo "Wu $wu->id -------------\n"; |
108 | - if (count($results)<2) continue; |
|
109 | - for ($i=0; $i<=10; $i++) { |
|
108 | + if (count($results) < 2) continue; |
|
109 | + for ($i = 0; $i <= 10; $i++) { |
|
110 | 110 | $fpw = $i/10.; |
111 | 111 | $sum[$i] += fpw_var($results, $fpw); |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | Number of workunits analyzed: $n |
121 | 121 | |
122 | 122 | "; |
123 | - for ($i=0; $i<=10; $i++) { |
|
123 | + for ($i = 0; $i <= 10; $i++) { |
|
124 | 124 | $fpw = $i/10.; |
125 | 125 | $r = $sum[$i]/$n; |
126 | 126 | echo "FP weight $fpw: variance is $r\n"; |
@@ -65,6 +65,9 @@ |
||
65 | 65 | return $running; |
66 | 66 | } |
67 | 67 | |
68 | +/** |
|
69 | + * @param boolean $running |
|
70 | + */ |
|
68 | 71 | function show_status($host, $function, $running) { |
69 | 72 | echo "<tr><td>$function</td><td>$host</td>"; |
70 | 73 | if ($running) { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | - $x = _mysql_fetch_object($result); |
|
46 | - return $x->create_time; |
|
44 | + $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | + $x = _mysql_fetch_object($result); |
|
46 | + return $x->create_time; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function daemon_status($host, $pidname) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
44 | + $result = _mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | 45 | $x = _mysql_fetch_object($result); |
46 | 46 | return $x->create_time; |
47 | 47 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | -$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
91 | +$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
92 | 92 | |
93 | -page_head(PROJECT . " - Server Status"); |
|
93 | +page_head(PROJECT." - Server Status"); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Date stamp |
97 | 97 | |
98 | 98 | |
99 | -echo "<br ALIGN=RIGHT> ".PROJECT. " server status as of ". |
|
100 | - date("g:i A T"). " on ". date("l, j F Y ") . |
|
99 | +echo "<br ALIGN=RIGHT> ".PROJECT." server status as of ". |
|
100 | + date("g:i A T")." on ".date("l, j F Y "). |
|
101 | 101 | " (updated every $Nmin minutes).\n"; |
102 | 102 | |
103 | -$proc_uptime=exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
103 | +$proc_uptime = exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
104 | 104 | $days = (int)($proc_uptime/86400); |
105 | -$hours=(int)($proc_uptime/3600); |
|
106 | -$hours=$hours % 24; |
|
107 | -$minutes=(int)($proc_uptime/60); |
|
108 | -$minutes=$minutes % 60; |
|
109 | -echo "<br ALIGN=RIGHT>The ".PROJECT. " main server has been continuously up for ". "$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
105 | +$hours = (int)($proc_uptime/3600); |
|
106 | +$hours = $hours%24; |
|
107 | +$minutes = (int)($proc_uptime/60); |
|
108 | +$minutes = $minutes%60; |
|
109 | +echo "<br ALIGN=RIGHT>The ".PROJECT." main server has been continuously up for "."$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
110 | 110 | |
111 | 111 | // tables side by side |
112 | 112 | echo "<TABLE><TR><TD align=center> \n"; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | if ($dbrc) { |
153 | 153 | echo "The database server is not accessable"; |
154 | 154 | } else { |
155 | - $now=time(0); |
|
156 | - $s_day=24*3600; |
|
157 | - $d_ago=$now-$s_day; |
|
158 | - $s_week=7*$s_day; |
|
159 | - $w_ago=$now-$s_week; |
|
155 | + $now = time(0); |
|
156 | + $s_day = 24*3600; |
|
157 | + $d_ago = $now - $s_day; |
|
158 | + $s_week = 7*$s_day; |
|
159 | + $w_ago = $now - $s_week; |
|
160 | 160 | |
161 | 161 | echo " |
162 | 162 | <table border=2 cellpadding=6> |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | <tr><td>invalid</td><td>".number_format($n)."</td></tr> |
277 | 277 | "; |
278 | 278 | |
279 | - $n = time(0)-find_oldest(); |
|
279 | + $n = time(0) - find_oldest(); |
|
280 | 280 | $days = (int)($n/86400); |
281 | - $hours=(int)($n/3600); |
|
282 | - $hours=$hours % 24; |
|
283 | - $minutes=(int)($n/60); |
|
284 | - $minutes=$minutes % 60; |
|
281 | + $hours = (int)($n/3600); |
|
282 | + $hours = $hours%24; |
|
283 | + $minutes = (int)($n/60); |
|
284 | + $minutes = $minutes%60; |
|
285 | 285 | echo " |
286 | 286 | <tr><td>Oldest Unsent Result</td><td>".$days." d ".$hours." h ".$minutes." m</td></tr> |
287 | 287 | "; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | // Display cgi-bin restriction status |
299 | 299 | |
300 | -if ( file_exists("../../cgi-bin/.htaccess") ) { |
|
300 | +if (file_exists("../../cgi-bin/.htaccess")) { |
|
301 | 301 | echo "<P><font color=RED> |
302 | 302 | <b>The ".PROJECT." scheduler is currently restricted |
303 | 303 | to uwm.edu and a few other domains. |
@@ -12,6 +12,9 @@ |
||
12 | 12 | // insert "\n</venue>\n" before "</global_preferences>" |
13 | 13 | // This fixes an XML error introduced at some point in the past |
14 | 14 | // |
15 | +/** |
|
16 | + * @return string |
|
17 | + */ |
|
15 | 18 | function repair_prefs($prefs) { |
16 | 19 | if (strstr($prefs, '\"')) { |
17 | 20 | return str_replace('\"', '"', $prefs); |