@@ -31,6 +31,9 @@ |
||
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | |
34 | +/** |
|
35 | + * @param string $pname |
|
36 | + */ |
|
34 | 37 | function get_download_url($pname, $need_vbox) { |
35 | 38 | global $platforms; |
36 | 39 | global $url_base; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | function url_to_download() { |
53 | 53 | $client_info = $_SERVER['HTTP_USER_AGENT']; |
54 | 54 | if (strstr($client_info, 'Windows')) { |
55 | - if (strstr($client_info, 'Win64')||strstr($client_info, 'WOW64')) { |
|
55 | + if (strstr($client_info, 'Win64') || strstr($client_info, 'WOW64')) { |
|
56 | 56 | return get_download_url('winx64'); |
57 | 57 | } else { |
58 | 58 | return get_download_url('win'); |
@@ -92,10 +92,18 @@ |
||
92 | 92 | } |
93 | 93 | $master_url = urldecode($master_url); |
94 | 94 | $project_name = urldecode($project_name); |
95 | -if ($auth) $auth = urldecode($auth); |
|
96 | -if ($user_name) $user_name = urldecode($user_name); |
|
97 | -if ($project_desc) $project_desc = urldecode($project_desc); |
|
98 | -if ($project_inst) $project_inst = urldecode($project_inst); |
|
95 | +if ($auth) { |
|
96 | + $auth = urldecode($auth); |
|
97 | +} |
|
98 | +if ($user_name) { |
|
99 | + $user_name = urldecode($user_name); |
|
100 | +} |
|
101 | +if ($project_desc) { |
|
102 | + $project_desc = urldecode($project_desc); |
|
103 | +} |
|
104 | +if ($project_inst) { |
|
105 | + $project_inst = urldecode($project_inst); |
|
106 | +} |
|
99 | 107 | |
100 | 108 | if ($download) { |
101 | 109 | $download_url = url_to_download(); |
@@ -151,6 +151,9 @@ discard block |
||
151 | 151 | echo " </tr>\n"; |
152 | 152 | } |
153 | 153 | |
154 | +/** |
|
155 | + * @param string[] $x |
|
156 | + */ |
|
154 | 157 | function list_heading_array($x) { |
155 | 158 | echo "<tr>"; |
156 | 159 | foreach ($x as $h) { |
@@ -197,6 +200,9 @@ discard block |
||
197 | 200 | echo "</table><p>\n"; |
198 | 201 | } |
199 | 202 | |
203 | +/** |
|
204 | + * @param string $x |
|
205 | + */ |
|
200 | 206 | function boinc_error_page($x) { |
201 | 207 | page_head("Error"); |
202 | 208 | echo $x; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | function html_tag() { |
32 | 32 | global $language_in_use; |
33 | - echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> |
|
33 | + echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> |
|
34 | 34 | "; |
35 | 35 | |
36 | 36 | // if language is arabic, go right to left |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | -function page_head($title, $extra="") { |
|
45 | +function page_head($title, $extra = "") { |
|
46 | 46 | global $book; |
47 | 47 | global $chap_num; |
48 | 48 | if ($book) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | "; |
88 | 88 | } |
89 | 89 | |
90 | -function page_tail($translatable=false, $is_main=false) { |
|
90 | +function page_tail($translatable = false, $is_main = false) { |
|
91 | 91 | global $book; |
92 | 92 | if ($book) { |
93 | 93 | return; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | echo "<p><table $attrs border=0 cellpadding=6>\n"; |
140 | 140 | } |
141 | 141 | |
142 | -function list_heading($x, $y, $z=null) { |
|
142 | +function list_heading($x, $y, $z = null) { |
|
143 | 143 | echo " |
144 | 144 | <tr> |
145 | 145 | <th valign=top><b>$x</b></th> |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | echo "</tr>\n"; |
160 | 160 | } |
161 | 161 | |
162 | -function list_item($x, $y, $z=null) { |
|
162 | +function list_item($x, $y, $z = null) { |
|
163 | 163 | if (!$x) $x = "<br>"; |
164 | 164 | echo " |
165 | 165 | <tr> |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | list_item(html_text($x), $y); |
185 | 185 | } |
186 | 186 | |
187 | -function list_bar($x, $note="") { |
|
187 | +function list_bar($x, $note = "") { |
|
188 | 188 | if ($note) { |
189 | 189 | $note = "<br><span class=note>$note</span>"; |
190 | 190 | } |
@@ -160,7 +160,9 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | function list_item($x, $y, $z=null) { |
163 | - if (!$x) $x = "<br>"; |
|
163 | + if (!$x) { |
|
164 | + $x = "<br>"; |
|
165 | + } |
|
164 | 166 | echo " |
165 | 167 | <tr> |
166 | 168 | <td class=fieldname valign=top><b>$x</b></td> |
@@ -28,6 +28,9 @@ |
||
28 | 28 | if ($dev === null) $dev=1; |
29 | 29 | } |
30 | 30 | |
31 | +/** |
|
32 | + * @param string $x |
|
33 | + */ |
|
31 | 34 | function dl_item($x, $y) { |
32 | 35 | echo "<tr><td valign=top align=right width=\"30%\">$x</td> |
33 | 36 | <td>$y</td></tr> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // if not XML, dev defaults to 1 |
26 | 26 | // |
27 | 27 | if (!$xml) { |
28 | - if ($dev === null) $dev=1; |
|
28 | + if ($dev === null) $dev = 1; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | function dl_item($x, $y) { |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | $long_name = $p["name"]; |
168 | 168 | $va = $p["versions"]; |
169 | 169 | foreach ($va as $v) { |
170 | - if ($v['num'] == $version && $type_name==$v['type']) { |
|
170 | + if ($v['num'] == $version && $type_name == $v['type']) { |
|
171 | 171 | page_head("BOINC version $version for $long_name"); |
172 | 172 | show_detail($v); |
173 | 173 | page_tail(); |
174 | 174 | exit(); |
175 | 175 | } |
176 | 176 | } |
177 | - boinc_error_page( "version not found\n"); |
|
177 | + boinc_error_page("version not found\n"); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($xml) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <versions> |
184 | 184 | "; |
185 | 185 | if (FALSE === strpos($client_info, '6.8.')) { |
186 | - foreach($platforms as $short_name=>$p) { |
|
186 | + foreach ($platforms as $short_name=>$p) { |
|
187 | 187 | show_platform_xml($short_name, $p, $dev); |
188 | 188 | } |
189 | 189 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | echo " |
204 | 204 | <table width=\"100%\" cellpadding=4 > |
205 | 205 | "; |
206 | - foreach($platforms as $short_name=>$p) { |
|
206 | + foreach ($platforms as $short_name=>$p) { |
|
207 | 207 | show_platform($short_name, $p, $dev); |
208 | 208 | } |
209 | 209 | list_end(); |
@@ -25,8 +25,10 @@ discard block |
||
25 | 25 | // if not XML, dev defaults to 1 |
26 | 26 | // |
27 | 27 | if (!$xml) { |
28 | - if ($dev === null) $dev=1; |
|
29 | -} |
|
28 | + if ($dev === null) { |
|
29 | + $dev=1; |
|
30 | + } |
|
31 | + } |
|
30 | 32 | |
31 | 33 | function dl_item($x, $y) { |
32 | 34 | echo "<tr><td valign=top align=right width=\"30%\">$x</td> |
@@ -91,7 +93,9 @@ discard block |
||
91 | 93 | } |
92 | 94 | |
93 | 95 | function show_version($pname, $i, $v) { |
94 | - if (!$v) return; |
|
96 | + if (!$v) { |
|
97 | + return; |
|
98 | + } |
|
95 | 99 | $num = $v["num"]; |
96 | 100 | $file = $v["file"]; |
97 | 101 | $status = $v["status"]; |
@@ -139,20 +143,30 @@ discard block |
||
139 | 143 | } |
140 | 144 | list_bar($long_name, $description); |
141 | 145 | foreach ($p["versions"] as $i=>$v) { |
142 | - if ($min_version && version_compare($v['num'], $min_version, "<")) continue; |
|
143 | - if ($max_version && version_compare($v['num'], $max_version, ">")) continue; |
|
144 | - if (!$dev && is_dev($v)) continue; |
|
146 | + if ($min_version && version_compare($v['num'], $min_version, "<")) { |
|
147 | + continue; |
|
148 | + } |
|
149 | + if ($max_version && version_compare($v['num'], $max_version, ">")) { |
|
150 | + continue; |
|
151 | + } |
|
152 | + if (!$dev && is_dev($v)) { |
|
153 | + continue; |
|
154 | + } |
|
145 | 155 | show_version($short_name, $i, $v); |
146 | 156 | } |
147 | 157 | } |
148 | 158 | |
149 | 159 | function show_platform_xml($short_name, $p, $dev) { |
150 | 160 | foreach ($p["versions"] as $i=>$v) { |
151 | - if (!$dev && is_dev($v)) continue; |
|
161 | + if (!$dev && is_dev($v)) { |
|
162 | + continue; |
|
163 | + } |
|
152 | 164 | // show only those builds that have been around for over three days. |
153 | 165 | // Gives us time to address any showstoppers |
154 | 166 | // found by the early adopters |
155 | - if (!$dev && ((time() - strtotime($v["date"])) <= 86400*3)) continue; |
|
167 | + if (!$dev && ((time() - strtotime($v["date"])) <= 86400*3)) { |
|
168 | + continue; |
|
169 | + } |
|
156 | 170 | show_version_xml($v, $p); |
157 | 171 | } |
158 | 172 | } |
@@ -88,6 +88,9 @@ discard block |
||
88 | 88 | return $x; |
89 | 89 | } |
90 | 90 | |
91 | +/** |
|
92 | + * @param stdClass $f |
|
93 | + */ |
|
91 | 94 | function platform_icons($f) { |
92 | 95 | $x = ""; |
93 | 96 | $ht = 40; |
@@ -125,6 +128,11 @@ discard block |
||
125 | 128 | return $x; |
126 | 129 | } |
127 | 130 | |
131 | +/** |
|
132 | + * @param string $pc |
|
133 | + * |
|
134 | + * @return string |
|
135 | + */ |
|
128 | 136 | function canonical_plan_class($pc) { |
129 | 137 | if (strstr($pc, "atiOpenCL")) return "opencl_ati"; |
130 | 138 | if (strstr($pc, "nvidiaOpenCL")) return "opencl_nvidia"; |
@@ -134,6 +142,10 @@ discard block |
||
134 | 142 | |
135 | 143 | // some specific cases where we know the project doesn't have jobs |
136 | 144 | // |
145 | +/** |
|
146 | + * @param string $url |
|
147 | + * @param string $plat |
|
148 | + */ |
|
137 | 149 | function valid($url, $plat) { |
138 | 150 | if (strstr($url, "gpugrid.net")) { |
139 | 151 | if (strstr($plat, "android")) return false; |
@@ -249,6 +261,9 @@ discard block |
||
249 | 261 | // convert an array of platform names into a comma-separated |
250 | 262 | // list of human-readable names |
251 | 263 | // |
264 | +/** |
|
265 | + * @param boolean $comma |
|
266 | + */ |
|
252 | 267 | function make_friendly_string($l, $comma) { |
253 | 268 | if (!count($l)) return "Unknown"; |
254 | 269 | $fn = array(); |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | function canonical_plan_class($pc) { |
129 | - if (strstr($pc, "atiOpenCL")) return "opencl_ati"; |
|
130 | - if (strstr($pc, "nvidiaOpenCL")) return "opencl_nvidia"; |
|
131 | - if (strstr($pc, "intelOpenCL")) return "opencl_intel_gpu"; |
|
129 | + if (strstr($pc, "atiOpenCL")) return "opencl_ati"; |
|
130 | + if (strstr($pc, "nvidiaOpenCL")) return "opencl_nvidia"; |
|
131 | + if (strstr($pc, "intelOpenCL")) return "opencl_intel_gpu"; |
|
132 | 132 | return $pc; |
133 | 133 | } |
134 | 134 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $u = urlencode($url); |
282 | 282 | $fname = "/home/boincadm/boinc/doc/platforms/$u"; |
283 | 283 | $t = @filemtime($fname); |
284 | - if (strstr($url, "gpugrid") || ($t && $t > time() - 604800)) { |
|
284 | + if (strstr($url, "gpugrid") || ($t && $t > time() - 604800)) { |
|
285 | 285 | return json_decode(file_get_contents($fname)); |
286 | 286 | } |
287 | 287 | $l = get_platforms($url); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | libxml_use_internal_errors(true); |
229 | 229 | $s = simplexml_load_string($x); |
230 | 230 | $list = null; |
231 | - foreach($s->application as $a) { |
|
231 | + foreach ($s->application as $a) { |
|
232 | 232 | foreach ($a->version as $v) { |
233 | 233 | if (!array_key_exists('platform_short', $v)) continue; |
234 | 234 | $p = $v->platform_short[0]; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | function make_friendly_string($l, $comma) { |
253 | 253 | if (!count($l)) return "Unknown"; |
254 | 254 | $fn = array(); |
255 | - foreach($l as $p) { |
|
255 | + foreach ($l as $p) { |
|
256 | 256 | $p = friendly_name($p); |
257 | 257 | if (!$p) continue; |
258 | 258 | $fn[] = $p; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $fn = array_unique($fn); |
261 | 261 | $x = ""; |
262 | 262 | $first = true; |
263 | - foreach($fn as $p) { |
|
263 | + foreach ($fn as $p) { |
|
264 | 264 | if ($first) { |
265 | 265 | $x .= "$p"; |
266 | 266 | $first = false; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | // return platforms as a human-readable string |
305 | 305 | // |
306 | -function get_platforms_string($url, $comma=true) { |
|
306 | +function get_platforms_string($url, $comma = true) { |
|
307 | 307 | $l = get_platforms_cached($url); |
308 | 308 | return make_friendly_string($l, $comma); |
309 | 309 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | // |
335 | 335 | function wfPlatforms() { |
336 | 336 | global $wgParser; |
337 | - $wgParser->setHook( "platforms", "get_platforms_string" ); |
|
337 | + $wgParser->setHook("platforms", "get_platforms_string"); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | $wgExtensionFunctions[] = "wfPlatforms"; |
@@ -13,8 +13,12 @@ discard block |
||
13 | 13 | $pc = substr($x[1], 0, -1); |
14 | 14 | } |
15 | 15 | |
16 | - if (strstr($p, "fubar")) return null; |
|
17 | - if ($p == 'x86_64-unknown-linux-gnu') return null; |
|
16 | + if (strstr($p, "fubar")) { |
|
17 | + return null; |
|
18 | + } |
|
19 | + if ($p == 'x86_64-unknown-linux-gnu') { |
|
20 | + return null; |
|
21 | + } |
|
18 | 22 | $q = $p; |
19 | 23 | switch ($p) { |
20 | 24 | case 'i686-pc-linux-gnu': $q = 'Linux/x86'; break; |
@@ -39,13 +43,21 @@ discard block |
||
39 | 43 | case 'arm-unknown-linux-gnueabihf': $q = 'Linux on ARM (e.g., Raspberry Pi)'; |
40 | 44 | } |
41 | 45 | if (strlen($pc)) { |
42 | - if (strstr($pc, 'cuda')) $q .= " (NVIDIA GPU)"; |
|
43 | - else if (strstr($pc, 'nvidia')) $q .= " (NVIDIA GPU)"; |
|
44 | - else if (strstr($pc, 'ati')) $q .= " (AMD/ATI GPU)"; |
|
45 | - else if (strstr($pc, 'intel_gpu')) $q .= " (Intel GPU)"; |
|
46 | - else if (strstr($pc, 'mt')) $q .= " (multicore)"; |
|
47 | - else if (strstr($pc, 'vbox32')) $q .= " (VirtualBox 32-bit)"; |
|
48 | - else if (strstr($pc, 'vbox64')) $q .= " (VirtualBox 64-bit)"; |
|
46 | + if (strstr($pc, 'cuda')) { |
|
47 | + $q .= " (NVIDIA GPU)"; |
|
48 | + } else if (strstr($pc, 'nvidia')) { |
|
49 | + $q .= " (NVIDIA GPU)"; |
|
50 | + } else if (strstr($pc, 'ati')) { |
|
51 | + $q .= " (AMD/ATI GPU)"; |
|
52 | + } else if (strstr($pc, 'intel_gpu')) { |
|
53 | + $q .= " (Intel GPU)"; |
|
54 | + } else if (strstr($pc, 'mt')) { |
|
55 | + $q .= " (multicore)"; |
|
56 | + } else if (strstr($pc, 'vbox32')) { |
|
57 | + $q .= " (VirtualBox 32-bit)"; |
|
58 | + } else if (strstr($pc, 'vbox64')) { |
|
59 | + $q .= " (VirtualBox 64-bit)"; |
|
60 | + } |
|
49 | 61 | } |
50 | 62 | return $q; |
51 | 63 | } |
@@ -71,19 +83,45 @@ discard block |
||
71 | 83 | $p = $y[0]; |
72 | 84 | $pc = substr($y[1], 0, -1); |
73 | 85 | } |
74 | - if (strstr($p, "windows")) $x->windows = true; |
|
75 | - if (strstr($p, "darwin")) $x->mac = true; |
|
76 | - if (strstr($p, "linux")) $x->linux = true; |
|
77 | - if (strstr($p, "android")) $x->android = true; |
|
78 | - if (strstr($p, "freebsd")) $x->freebsd = true; |
|
79 | - if (strstr($p, "arm-unknown-linux-gnueabihf")) $x->rasp_pi = true; |
|
80 | - if (strstr($p, "armv5")) $x->rasp_pi = true; |
|
81 | - if (strstr($p, "armv6")) $x->rasp_pi = true; |
|
82 | - if (strstr($pc, "ati")) $x->amd_gpu = true; |
|
83 | - if (strstr($pc, "cuda")) $x->nvidia_gpu = true; |
|
84 | - if (strstr($pc, "nvidia")) $x->nvidia_gpu = true; |
|
85 | - if (strstr($pc, "intel_gpu")) $x->intel_gpu = true; |
|
86 | - if (strstr($pc, "vbox")) $x->vbox = true; |
|
86 | + if (strstr($p, "windows")) { |
|
87 | + $x->windows = true; |
|
88 | + } |
|
89 | + if (strstr($p, "darwin")) { |
|
90 | + $x->mac = true; |
|
91 | + } |
|
92 | + if (strstr($p, "linux")) { |
|
93 | + $x->linux = true; |
|
94 | + } |
|
95 | + if (strstr($p, "android")) { |
|
96 | + $x->android = true; |
|
97 | + } |
|
98 | + if (strstr($p, "freebsd")) { |
|
99 | + $x->freebsd = true; |
|
100 | + } |
|
101 | + if (strstr($p, "arm-unknown-linux-gnueabihf")) { |
|
102 | + $x->rasp_pi = true; |
|
103 | + } |
|
104 | + if (strstr($p, "armv5")) { |
|
105 | + $x->rasp_pi = true; |
|
106 | + } |
|
107 | + if (strstr($p, "armv6")) { |
|
108 | + $x->rasp_pi = true; |
|
109 | + } |
|
110 | + if (strstr($pc, "ati")) { |
|
111 | + $x->amd_gpu = true; |
|
112 | + } |
|
113 | + if (strstr($pc, "cuda")) { |
|
114 | + $x->nvidia_gpu = true; |
|
115 | + } |
|
116 | + if (strstr($pc, "nvidia")) { |
|
117 | + $x->nvidia_gpu = true; |
|
118 | + } |
|
119 | + if (strstr($pc, "intel_gpu")) { |
|
120 | + $x->intel_gpu = true; |
|
121 | + } |
|
122 | + if (strstr($pc, "vbox")) { |
|
123 | + $x->vbox = true; |
|
124 | + } |
|
87 | 125 | } |
88 | 126 | return $x; |
89 | 127 | } |
@@ -126,9 +164,15 @@ discard block |
||
126 | 164 | } |
127 | 165 | |
128 | 166 | function canonical_plan_class($pc) { |
129 | - if (strstr($pc, "atiOpenCL")) return "opencl_ati"; |
|
130 | - if (strstr($pc, "nvidiaOpenCL")) return "opencl_nvidia"; |
|
131 | - if (strstr($pc, "intelOpenCL")) return "opencl_intel_gpu"; |
|
167 | + if (strstr($pc, "atiOpenCL")) { |
|
168 | + return "opencl_ati"; |
|
169 | + } |
|
170 | + if (strstr($pc, "nvidiaOpenCL")) { |
|
171 | + return "opencl_nvidia"; |
|
172 | + } |
|
173 | + if (strstr($pc, "intelOpenCL")) { |
|
174 | + return "opencl_intel_gpu"; |
|
175 | + } |
|
132 | 176 | return $pc; |
133 | 177 | } |
134 | 178 | |
@@ -136,10 +180,16 @@ discard block |
||
136 | 180 | // |
137 | 181 | function valid($url, $plat) { |
138 | 182 | if (strstr($url, "gpugrid.net")) { |
139 | - if (strstr($plat, "android")) return false; |
|
140 | - if (strstr($plat, "vbox")) return false; |
|
183 | + if (strstr($plat, "android")) { |
|
184 | + return false; |
|
185 | + } |
|
186 | + if (strstr($plat, "vbox")) { |
|
187 | + return false; |
|
188 | + } |
|
141 | 189 | } else if (strstr($url, "csgrid")) { |
142 | - if (strstr($plat, "android")) return false; |
|
190 | + if (strstr($plat, "android")) { |
|
191 | + return false; |
|
192 | + } |
|
143 | 193 | } |
144 | 194 | return true; |
145 | 195 | } |
@@ -165,7 +215,9 @@ discard block |
||
165 | 215 | // ... |
166 | 216 | // |
167 | 217 | function get_platforms($url) { |
168 | - if (strstr($url, "radioactive")) return null; |
|
218 | + if (strstr($url, "radioactive")) { |
|
219 | + return null; |
|
220 | + } |
|
169 | 221 | $url .= 'get_project_config.php'; |
170 | 222 | $x = @file_get_contents($url); |
171 | 223 | if (!$x) { |
@@ -230,7 +282,9 @@ discard block |
||
230 | 282 | $list = null; |
231 | 283 | foreach($s->application as $a) { |
232 | 284 | foreach ($a->version as $v) { |
233 | - if (!array_key_exists('platform_short', $v)) continue; |
|
285 | + if (!array_key_exists('platform_short', $v)) { |
|
286 | + continue; |
|
287 | + } |
|
234 | 288 | $p = $v->platform_short[0]; |
235 | 289 | $pc = ""; |
236 | 290 | if (array_key_exists('plan_class', $v)) { |
@@ -250,11 +304,15 @@ discard block |
||
250 | 304 | // list of human-readable names |
251 | 305 | // |
252 | 306 | function make_friendly_string($l, $comma) { |
253 | - if (!count($l)) return "Unknown"; |
|
307 | + if (!count($l)) { |
|
308 | + return "Unknown"; |
|
309 | + } |
|
254 | 310 | $fn = array(); |
255 | 311 | foreach($l as $p) { |
256 | 312 | $p = friendly_name($p); |
257 | - if (!$p) continue; |
|
313 | + if (!$p) { |
|
314 | + continue; |
|
315 | + } |
|
258 | 316 | $fn[] = $p; |
259 | 317 | } |
260 | 318 | $fn = array_unique($fn); |
@@ -77,14 +77,23 @@ discard block |
||
77 | 77 | "; |
78 | 78 | } |
79 | 79 | |
80 | +/** |
|
81 | + * @param string $name |
|
82 | + */ |
|
80 | 83 | function input($name, $val) { |
81 | 84 | return "<input name=$name size=40 value=\"$val\">"; |
82 | 85 | } |
83 | 86 | |
87 | +/** |
|
88 | + * @param string $name |
|
89 | + */ |
|
84 | 90 | function password($name, $val) { |
85 | 91 | return "<input type=password name=$name value=\"$val\">"; |
86 | 92 | } |
87 | 93 | |
94 | +/** |
|
95 | + * @param string $name |
|
96 | + */ |
|
88 | 97 | function textarea($name, $val) { |
89 | 98 | return "<textarea rows=4 cols=40 name=$name>$val</textarea>\n"; |
90 | 99 | } |
@@ -97,6 +106,9 @@ discard block |
||
97 | 106 | } |
98 | 107 | } |
99 | 108 | |
109 | +/** |
|
110 | + * @param string $name |
|
111 | + */ |
|
100 | 112 | function yesno($name, $val) { |
101 | 113 | if ($val) { |
102 | 114 | return " |
@@ -111,6 +123,9 @@ discard block |
||
111 | 123 | } |
112 | 124 | } |
113 | 125 | |
126 | +/** |
|
127 | + * @param string $name |
|
128 | + */ |
|
114 | 129 | function star_select($name, $val) { |
115 | 130 | $x = ""; |
116 | 131 | for ($i=5; $i>=0; $i--) { |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | function button_image($status) { |
15 | - if ($status==1) return "offline.png"; |
|
16 | - if ($status==2) return "online.png"; |
|
17 | - if ($status==7) return "skypeme.png"; |
|
18 | - if ($status==3) return "away.png"; |
|
19 | - if ($status==4) return "notavailable.png"; |
|
20 | - if ($status==5) return "donotdisturb.png"; |
|
21 | - if ($status==6) return "offline.png"; |
|
15 | + if ($status == 1) return "offline.png"; |
|
16 | + if ($status == 2) return "online.png"; |
|
17 | + if ($status == 7) return "skypeme.png"; |
|
18 | + if ($status == 3) return "away.png"; |
|
19 | + if ($status == 4) return "notavailable.png"; |
|
20 | + if ($status == 5) return "donotdisturb.png"; |
|
21 | + if ($status == 6) return "offline.png"; |
|
22 | 22 | return "offline.png"; |
23 | 23 | } |
24 | 24 | |
25 | 25 | function status_string($status) { |
26 | - if ($status==1) return "Offline"; |
|
27 | - if ($status==2) return "<font color=00aa00><b>Online</b></font>"; |
|
28 | - if ($status==7) return "<font color=00aa00><b>Skype Me!</b></font>"; |
|
29 | - if ($status==3) return "Away"; |
|
30 | - if ($status==4) return "Not available"; |
|
31 | - if ($status==5) return "Do not disturb"; |
|
32 | - if ($status==6) return "Offline"; |
|
26 | + if ($status == 1) return "Offline"; |
|
27 | + if ($status == 2) return "<font color=00aa00><b>Online</b></font>"; |
|
28 | + if ($status == 7) return "<font color=00aa00><b>Skype Me!</b></font>"; |
|
29 | + if ($status == 3) return "Away"; |
|
30 | + if ($status == 4) return "Not available"; |
|
31 | + if ($status == 5) return "Do not disturb"; |
|
32 | + if ($status == 6) return "Offline"; |
|
33 | 33 | return "Unknown"; |
34 | 34 | } |
35 | 35 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | |
114 | 114 | function star_select($name, $val) { |
115 | 115 | $x = ""; |
116 | - for ($i=5; $i>=0; $i--) { |
|
116 | + for ($i = 5; $i >= 0; $i--) { |
|
117 | 117 | $text = ""; |
118 | - if ($i==0) $text="No"; |
|
119 | - if ($i==5) $text="Yes"; |
|
118 | + if ($i == 0) $text = "No"; |
|
119 | + if ($i == 5) $text = "Yes"; |
|
120 | 120 | |
121 | - $checked = ($val==$i)?"checked":""; |
|
121 | + $checked = ($val == $i) ? "checked" : ""; |
|
122 | 122 | $x .= " |
123 | 123 | <br><input name=$name value=$i type=radio $checked> |
124 | 124 | <img src=images/help/stars-$i-0.gif> $text |
@@ -12,30 +12,62 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | function button_image($status) { |
15 | - if ($status==1) return "offline.png"; |
|
16 | - if ($status==2) return "online.png"; |
|
17 | - if ($status==7) return "skypeme.png"; |
|
18 | - if ($status==3) return "away.png"; |
|
19 | - if ($status==4) return "notavailable.png"; |
|
20 | - if ($status==5) return "donotdisturb.png"; |
|
21 | - if ($status==6) return "offline.png"; |
|
15 | + if ($status==1) { |
|
16 | + return "offline.png"; |
|
17 | + } |
|
18 | + if ($status==2) { |
|
19 | + return "online.png"; |
|
20 | + } |
|
21 | + if ($status==7) { |
|
22 | + return "skypeme.png"; |
|
23 | + } |
|
24 | + if ($status==3) { |
|
25 | + return "away.png"; |
|
26 | + } |
|
27 | + if ($status==4) { |
|
28 | + return "notavailable.png"; |
|
29 | + } |
|
30 | + if ($status==5) { |
|
31 | + return "donotdisturb.png"; |
|
32 | + } |
|
33 | + if ($status==6) { |
|
34 | + return "offline.png"; |
|
35 | + } |
|
22 | 36 | return "offline.png"; |
23 | 37 | } |
24 | 38 | |
25 | 39 | function status_string($status) { |
26 | - if ($status==1) return "Offline"; |
|
27 | - if ($status==2) return "<font color=00aa00><b>Online</b></font>"; |
|
28 | - if ($status==7) return "<font color=00aa00><b>Skype Me!</b></font>"; |
|
29 | - if ($status==3) return "Away"; |
|
30 | - if ($status==4) return "Not available"; |
|
31 | - if ($status==5) return "Do not disturb"; |
|
32 | - if ($status==6) return "Offline"; |
|
40 | + if ($status==1) { |
|
41 | + return "Offline"; |
|
42 | + } |
|
43 | + if ($status==2) { |
|
44 | + return "<font color=00aa00><b>Online</b></font>"; |
|
45 | + } |
|
46 | + if ($status==7) { |
|
47 | + return "<font color=00aa00><b>Skype Me!</b></font>"; |
|
48 | + } |
|
49 | + if ($status==3) { |
|
50 | + return "Away"; |
|
51 | + } |
|
52 | + if ($status==4) { |
|
53 | + return "Not available"; |
|
54 | + } |
|
55 | + if ($status==5) { |
|
56 | + return "Do not disturb"; |
|
57 | + } |
|
58 | + if ($status==6) { |
|
59 | + return "Offline"; |
|
60 | + } |
|
33 | 61 | return "Unknown"; |
34 | 62 | } |
35 | 63 | |
36 | 64 | function online($status) { |
37 | - if ($status == 2) return true; |
|
38 | - if ($status == 7) return true; |
|
65 | + if ($status == 2) { |
|
66 | + return true; |
|
67 | + } |
|
68 | + if ($status == 7) { |
|
69 | + return true; |
|
70 | + } |
|
39 | 71 | return false; |
40 | 72 | } |
41 | 73 | |
@@ -115,8 +147,12 @@ discard block |
||
115 | 147 | $x = ""; |
116 | 148 | for ($i=5; $i>=0; $i--) { |
117 | 149 | $text = ""; |
118 | - if ($i==0) $text="No"; |
|
119 | - if ($i==5) $text="Yes"; |
|
150 | + if ($i==0) { |
|
151 | + $text="No"; |
|
152 | + } |
|
153 | + if ($i==5) { |
|
154 | + $text="Yes"; |
|
155 | + } |
|
120 | 156 | |
121 | 157 | $checked = ($val==$i)?"checked":""; |
122 | 158 | $x .= " |
@@ -24,6 +24,10 @@ discard block |
||
24 | 24 | |
25 | 25 | define('MODERATORS_CAN_BANISH', '1'); |
26 | 26 | |
27 | +/** |
|
28 | + * @param string $prefix |
|
29 | + * @param boolean $fixed |
|
30 | + */ |
|
27 | 31 | function navbar($prefix, $user, $fixed) { |
28 | 32 | $brand = '<a href="http://boinc.berkeley.edu"><img height="50" src="https://boinc.berkeley.edu/logo/boinc_logo.png"></a> '; |
29 | 33 | navbar_start($brand, $fixed, false); |
@@ -48,6 +52,10 @@ discard block |
||
48 | 52 | navbar_end(true); |
49 | 53 | } |
50 | 54 | |
55 | +/** |
|
56 | + * @param string $prefix |
|
57 | + * @param boolean $is_main |
|
58 | + */ |
|
51 | 59 | function project_banner($title, $prefix, $is_main) { |
52 | 60 | if ($is_main) { |
53 | 61 | echo ' |
@@ -89,6 +97,11 @@ discard block |
||
89 | 97 | "; |
90 | 98 | } |
91 | 99 | |
100 | +/** |
|
101 | + * @param boolean $show_return |
|
102 | + * @param boolean $show_date |
|
103 | + * @param string $prefix |
|
104 | + */ |
|
92 | 105 | function project_footer($show_return, $show_date, $prefix) { |
93 | 106 | $y = date("Y "); |
94 | 107 | echo " |
@@ -115,30 +115,30 @@ |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | function show_profile_heading2() { |
118 | - return "Your opinions about " . PROJECT; |
|
118 | + return "Your opinions about ".PROJECT; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | function show_profile_question2() { |
122 | 122 | return " |
123 | - Tell us your thoughts about " . PROJECT . "<ol> |
|
124 | - <li>Why do you run " . PROJECT . "? |
|
123 | + Tell us your thoughts about " . PROJECT."<ol> |
|
124 | + <li>Why do you run " . PROJECT."? |
|
125 | 125 | <li>What are your views about the project? |
126 | 126 | <li>Any suggestions? |
127 | 127 | </ol> |
128 | 128 | "; |
129 | 129 | } |
130 | 130 | |
131 | -function project_workunit($wu){ |
|
131 | +function project_workunit($wu) { |
|
132 | 132 | echo "This is displayed on the workunit page"; |
133 | 133 | } |
134 | 134 | |
135 | -function project_user_summary($user){ |
|
135 | +function project_user_summary($user) { |
|
136 | 136 | } |
137 | 137 | |
138 | -function project_user_page_private($user){ |
|
138 | +function project_user_page_private($user) { |
|
139 | 139 | } |
140 | 140 | |
141 | -function project_user_credit($user){ |
|
141 | +function project_user_credit($user) { |
|
142 | 142 | if ($user->seti_nresults) { |
143 | 143 | row2( |
144 | 144 | "SETI@home classic workunits |
@@ -157,7 +157,9 @@ |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | function project_forum_post_info($forum) { |
160 | - if (!$forum || $forum->title != "Questions and problems") return ""; |
|
160 | + if (!$forum || $forum->title != "Questions and problems") { |
|
161 | + return ""; |
|
162 | + } |
|
161 | 163 | return " |
162 | 164 | <b>When reporting a problem, please include</b>: |
163 | 165 | <ul> |
@@ -9,6 +9,9 @@ discard block |
||
9 | 9 | public $include_empty_projects; |
10 | 10 | public $server_uses_workload; |
11 | 11 | |
12 | + /** |
|
13 | + * @param string $name |
|
14 | + */ |
|
12 | 15 | function __construct($name) { |
13 | 16 | $this->name = $name; |
14 | 17 | $this->duration = 86400; |
@@ -182,6 +185,9 @@ discard block |
||
182 | 185 | system("gnuplot < $gp_fname > $png_fname"); |
183 | 186 | } |
184 | 187 | |
188 | +/** |
|
189 | + * @param integer $col |
|
190 | + */ |
|
185 | 191 | function graph_n_results2( |
186 | 192 | $title, $xlabel, $lab1, $lab2, $dir, $results1, $results2, $col |
187 | 193 | ) { |
@@ -205,6 +211,9 @@ discard block |
||
205 | 211 | |
206 | 212 | // create output dir, do a simulation, accumulate results |
207 | 213 | // |
214 | +/** |
|
215 | + * @param string $pname |
|
216 | + */ |
|
208 | 217 | function do_sim_aux($out_dir, $scenario, $policy, $pname, $sum) { |
209 | 218 | $sim_out_dir = $out_dir."/".$pname."_".$scenario; |
210 | 219 | @mkdir($sim_out_dir); |
@@ -232,6 +241,9 @@ discard block |
||
232 | 241 | |
233 | 242 | // do a sim with a policy parameter |
234 | 243 | // |
244 | +/** |
|
245 | + * @param RESULT $sum |
|
246 | + */ |
|
235 | 247 | function do_sim_policy_param($out_dir, $scenario, $policy, $param, $sum) { |
236 | 248 | $sim_out_dir = $out_dir."/".$scenario."_".$policy->name."_".$param; |
237 | 249 | @mkdir($sim_out_dir); |
@@ -185,10 +185,10 @@ |
||
185 | 185 | function graph_n_results2( |
186 | 186 | $title, $xlabel, $lab1, $lab2, $dir, $results1, $results2, $col |
187 | 187 | ) { |
188 | - for ($i=0; $i<2; $i++) { |
|
188 | + for ($i = 0; $i < 2; $i++) { |
|
189 | 189 | $data_fname = "$dir/cr_$i.dat"; |
190 | 190 | $f = fopen($data_fname, "w"); |
191 | - $rr = $i?$results2:$results1; |
|
191 | + $rr = $i ? $results2 : $results1; |
|
192 | 192 | foreach ($rr as $r) { |
193 | 193 | $r->write($f); |
194 | 194 | } |
@@ -76,10 +76,18 @@ discard block |
||
76 | 76 | // |
77 | 77 | function do_sim($in, $out, $policy) { |
78 | 78 | $args = ""; |
79 | - if ($policy->existing_jobs_only) $args .= " --existing_jobs_only"; |
|
80 | - if ($policy->cpu_sched_rr_only) $args .= " --cpu_sched_rr_only"; |
|
81 | - if ($policy->include_empty_projects) $args .= " --include_empty_projects"; |
|
82 | - if ($policy->server_uses_workload) $args .= " --server_uses_workload"; |
|
79 | + if ($policy->existing_jobs_only) { |
|
80 | + $args .= " --existing_jobs_only"; |
|
81 | + } |
|
82 | + if ($policy->cpu_sched_rr_only) { |
|
83 | + $args .= " --cpu_sched_rr_only"; |
|
84 | + } |
|
85 | + if ($policy->include_empty_projects) { |
|
86 | + $args .= " --include_empty_projects"; |
|
87 | + } |
|
88 | + if ($policy->server_uses_workload) { |
|
89 | + $args .= " --server_uses_workload"; |
|
90 | + } |
|
83 | 91 | $args .= " --duration $policy->duration"; |
84 | 92 | $args .= " --delta $policy->delta"; |
85 | 93 | $args .= " --rec_half_life $policy->rec_half_life"; |
@@ -221,7 +229,9 @@ discard block |
||
221 | 229 | $cs_template_fname = "$scenario/client_state_template.xml"; |
222 | 230 | $cs_fname = "$scenario/client_state.xml"; |
223 | 231 | $cs = file_get_contents($cs_template_fname); |
224 | - if (!$cs) die("no file $cs_template_fname"); |
|
232 | + if (!$cs) { |
|
233 | + die("no file $cs_template_fname"); |
|
234 | + } |
|
225 | 235 | $cs = str_replace("PARAM", $param, $cs); |
226 | 236 | file_put_contents($cs_fname, $cs); |
227 | 237 | do_sim($scenario, $sim_out_dir, $policy); |
@@ -59,12 +59,18 @@ |
||
59 | 59 | 'Yoruba', |
60 | 60 | ); |
61 | 61 | |
62 | +/** |
|
63 | + * @param string $lang |
|
64 | + */ |
|
62 | 65 | function is_spoken_language($lang) { |
63 | 66 | global $spoken_languages; |
64 | 67 | if (!$lang) return true; |
65 | 68 | return in_array($lang, $spoken_languages); |
66 | 69 | } |
67 | 70 | |
71 | +/** |
|
72 | + * @param string $name |
|
73 | + */ |
|
68 | 74 | function spoken_language_list($name, $val) { |
69 | 75 | global $spoken_languages; |
70 | 76 | $x = "<select name=$name>\n"; |
@@ -61,7 +61,9 @@ |
||
61 | 61 | |
62 | 62 | function is_spoken_language($lang) { |
63 | 63 | global $spoken_languages; |
64 | - if (!$lang) return true; |
|
64 | + if (!$lang) { |
|
65 | + return true; |
|
66 | + } |
|
65 | 67 | return in_array($lang, $spoken_languages); |
66 | 68 | } |
67 | 69 |
@@ -200,7 +200,7 @@ |
||
200 | 200 | * Connect to a POP3 server. |
201 | 201 | * @access public |
202 | 202 | * @param string $host |
203 | - * @param integer|boolean $port |
|
203 | + * @param integer $port |
|
204 | 204 | * @param integer $tval |
205 | 205 | * @return boolean |
206 | 206 | */ |
@@ -276,11 +276,11 @@ |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | // Send the Username |
279 | - $this->sendString("USER $username" . self::CRLF); |
|
279 | + $this->sendString("USER $username".self::CRLF); |
|
280 | 280 | $pop3_response = $this->getResponse(); |
281 | 281 | if ($this->checkResponse($pop3_response)) { |
282 | 282 | // Send the Password |
283 | - $this->sendString("PASS $password" . self::CRLF); |
|
283 | + $this->sendString("PASS $password".self::CRLF); |
|
284 | 284 | $pop3_response = $this->getResponse(); |
285 | 285 | if ($this->checkResponse($pop3_response)) { |
286 | 286 | return true; |