@@ -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'); |
@@ -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; |
@@ -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 | } |
@@ -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(); |
@@ -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(); |
@@ -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"; |
@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -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"; |
@@ -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; |