Completed
Branch master (72d684)
by Christian
13:26
created
sched/transitioner_catchup.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@
 block discarded – undo
28 28
     while (1) {
29 29
         $now = time();
30 30
         $wus = BoincWorkunit::enum("transition_time<$now limit 1");
31
-        if (count($wus) == 0) break;
31
+        if (count($wus) == 0) {
32
+            break;
33
+        }
32 34
         echo "Some WUs need transition - running transitioner.\n";
33 35
         $ret = system("bin/transitioner --one_pass");
34 36
         echo "ret: $ret\n";
Please login to merge, or discard this patch.
doc/help_lang.php 1 patch
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,17 +45,29 @@
 block discarded – undo
45 45
         return "<font size=-2>(no ratings)</font>";
46 46
     }
47 47
     $x = $vol->rating_sum/$vol->nratings;
48
-    if ($x > 4.5) $img = "stars-5-0.gif";
49
-    else if ($x > 4.0) $img = "stars-4-5.gif";
50
-    else if ($x > 3.5) $img = "stars-4-0.gif";
51
-    else if ($x > 3.0) $img = "stars-3-5.gif";
52
-    else if ($x > 2.5) $img = "stars-3-0.gif";
53
-    else if ($x > 2.0) $img = "stars-2-5.gif";
54
-    else if ($x > 1.5) $img = "stars-2-0.gif";
55
-    else if ($x > 1.0) $img = "stars-1-5.gif";
56
-    else if ($x > 0.5) $img = "stars-1-0.gif";
57
-    else if ($x > 0.0) $img = "stars-0-5.gif";
58
-    else $img = "stars-0-0.gif";
48
+    if ($x > 4.5) {
49
+        $img = "stars-5-0.gif";
50
+    } else if ($x > 4.0) {
51
+        $img = "stars-4-5.gif";
52
+    } else if ($x > 3.5) {
53
+        $img = "stars-4-0.gif";
54
+    } else if ($x > 3.0) {
55
+        $img = "stars-3-5.gif";
56
+    } else if ($x > 2.5) {
57
+        $img = "stars-3-0.gif";
58
+    } else if ($x > 2.0) {
59
+        $img = "stars-2-5.gif";
60
+    } else if ($x > 1.5) {
61
+        $img = "stars-2-0.gif";
62
+    } else if ($x > 1.0) {
63
+        $img = "stars-1-5.gif";
64
+    } else if ($x > 0.5) {
65
+        $img = "stars-1-0.gif";
66
+    } else if ($x > 0.0) {
67
+        $img = "stars-0-5.gif";
68
+    } else {
69
+        $img = "stars-0-0.gif";
70
+    }
59 71
     return "
60 72
         <nobr><a href=help_ratings.php?volid=$vol->id>
61 73
         <img border=0 src=images/help/$img>
Please login to merge, or discard this patch.
doc/sim/sim_web.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,13 +30,21 @@  discard block
 block discarded – undo
30 30
 
31 31
 function get_comments($dir) {
32 32
     $d = "$dir/comments";
33
-    if (!is_dir($d)) return null;
33
+    if (!is_dir($d)) {
34
+        return null;
35
+    }
34 36
     $dd = opendir($d);
35 37
     $x = "";
36 38
     while (false !== ($f = readdir($dd))) {
37
-        if ($f == ".") continue;
38
-        if ($f == "..") continue;
39
-        if (strlen($x)) $x .= "<hr>\n";
39
+        if ($f == ".") {
40
+            continue;
41
+        }
42
+        if ($f == "..") {
43
+            continue;
44
+        }
45
+        if (strlen($x)) {
46
+            $x .= "<hr>\n";
47
+        }
40 48
         $userid = (int)file_get_contents("$d/$f/userid");
41 49
         $user = BoincUser::lookup_id($userid);
42 50
         $comment = file_get_contents("$d/$f/comment");
@@ -50,8 +58,12 @@  discard block
 block discarded – undo
50 58
     $d = opendir("scenarios/$scen/simulations");
51 59
     $n = 0;
52 60
     while (false !== ($f = readdir($d))) {
53
-        if ($f == ".") continue;
54
-        if ($f == "..") continue;
61
+        if ($f == ".") {
62
+            continue;
63
+        }
64
+        if ($f == "..") {
65
+            continue;
66
+        }
55 67
         $n++;
56 68
     }
57 69
     return $n;
@@ -174,8 +186,12 @@  discard block
 block discarded – undo
174 186
     $d = opendir("scenarios");
175 187
     $dirs = array();
176 188
     while (false !== ($f = readdir($d))) {
177
-        if ($f === ".") continue;
178
-        if ($f === "..") continue;
189
+        if ($f === ".") {
190
+            continue;
191
+        }
192
+        if ($f === "..") {
193
+            continue;
194
+        }
179 195
         $dirs[] = $f;
180 196
     }
181 197
     rsort($dirs);
@@ -338,7 +354,9 @@  discard block
 block discarded – undo
338 354
     $dirs = array();
339 355
     $s = opendir("$d/simulations");
340 356
     while (false !== ($f = readdir($s))) {
341
-        if (!is_numeric($f)) continue;
357
+        if (!is_numeric($f)) {
358
+            continue;
359
+        }
342 360
         $dirs[] = $f;
343 361
     }
344 362
     rsort($dirs);
@@ -515,7 +533,9 @@  discard block
 block discarded – undo
515 533
 }
516 534
 
517 535
 $action = get_str("action", true);
518
-if (!$action) $action = post_str("action", true);
536
+if (!$action) {
537
+    $action = post_str("action", true);
538
+}
519 539
 
520 540
 switch ($action) {
521 541
 case "create_scenario_form":
Please login to merge, or discard this patch.
doc/sim/sim_util.inc 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,10 +76,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
doc/help_db.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,9 @@  discard block
 block discarded – undo
111 111
 
112 112
 function vol_lookup($id) {
113 113
     $result = mysql_query("select * from volunteer where id=$id");
114
-    if (!$result) return null;
114
+    if (!$result) {
115
+        return null;
116
+    }
115 117
     $vol = mysql_fetch_object($result);
116 118
     mysql_free_result($result);
117 119
     return $vol;
@@ -120,7 +122,9 @@  discard block
 block discarded – undo
120 122
 function vol_lookup_email($email) {
121 123
     $email = mysql_real_escape_string($email);
122 124
     $result = mysql_query("select * from volunteer where email_addr='$email'");
123
-    if (!$result) return null;
125
+    if (!$result) {
126
+        return null;
127
+    }
124 128
     $vol = mysql_fetch_object($result);
125 129
     mysql_free_result($result);
126 130
     return $vol;
@@ -129,7 +133,9 @@  discard block
 block discarded – undo
129 133
 function vol_lookup_name($name) {
130 134
     $name = mysql_real_escape_string($name);
131 135
     $result = mysql_query("select * from volunteer where name='$name'");
132
-    if (!$result) return null;
136
+    if (!$result) {
137
+        return null;
138
+    }
133 139
     $vol = mysql_fetch_object($result);
134 140
     mysql_free_result($result);
135 141
     return $vol;
Please login to merge, or discard this patch.
doc/get_platforms.inc 1 patch
Braces   +90 added lines, -32 removed lines patch added patch discarded remove patch
@@ -13,8 +13,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
doc/projects.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@
 block discarded – undo
60 60
     shuffle($areas);
61 61
     foreach ($areas as $area) {
62 62
         $title = $area[0];
63
-        if (sizeof($area)==3) $title .= $area[2];
63
+        if (sizeof($area)==3) {
64
+            $title .= $area[2];
65
+        }
64 66
         list_bar($title);
65 67
         $projects = $area[1];
66 68
         shuffle($projects);
Please login to merge, or discard this patch.
doc/help_vol_edit.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -79,27 +79,51 @@
 block discarded – undo
79 79
 
80 80
 function get_form_data() {
81 81
     $vol->name = stripslashes($_GET['volname']);
82
-    if (!$vol->name) boinc_error_page("Name must not be blank");
83
-    if (strstr($vol->name, "<")) boinc_error_page("No &lt; allowed");
82
+    if (!$vol->name) {
83
+        boinc_error_page("Name must not be blank");
84
+    }
85
+    if (strstr($vol->name, "<")) {
86
+        boinc_error_page("No &lt; allowed");
87
+    }
84 88
     $vol->password = stripslashes($_GET['password']);
85
-    if (!$vol->password) boinc_error_page("Password must not be blank");
89
+    if (!$vol->password) {
90
+        boinc_error_page("Password must not be blank");
91
+    }
86 92
     $vol->email_addr = stripslashes($_GET['email_addr']);
87
-    if (!$vol->email_addr) boinc_error_page("Email address must not be blank");
93
+    if (!$vol->email_addr) {
94
+        boinc_error_page("Email address must not be blank");
95
+    }
88 96
     $vol->skypeid = stripslashes($_GET['skypeid']);
89
-    if (!$vol->skypeid) boinc_error_page("Skype ID must not be blank");
97
+    if (!$vol->skypeid) {
98
+        boinc_error_page("Skype ID must not be blank");
99
+    }
90 100
     $vol->lang1 = stripslashes($_GET['lang1']);
91
-    if (!$vol->lang1) boinc_error_page("Primary language must not be blank");
92
-    if (!is_spoken_language($vol->lang1)) boinc_error_page("Not a language");
101
+    if (!$vol->lang1) {
102
+        boinc_error_page("Primary language must not be blank");
103
+    }
104
+    if (!is_spoken_language($vol->lang1)) {
105
+        boinc_error_page("Not a language");
106
+    }
93 107
     $vol->lang2 = stripslashes($_GET['lang2']);
94
-    if (!is_spoken_language($vol->lang2)) boinc_error_page("Not a language");
108
+    if (!is_spoken_language($vol->lang2)) {
109
+        boinc_error_page("Not a language");
110
+    }
95 111
     $vol->country = stripslashes($_GET['country']);
96
-    if (!is_valid_country($vol->country)) boinc_error_page("Bad country");
112
+    if (!is_valid_country($vol->country)) {
113
+        boinc_error_page("Bad country");
114
+    }
97 115
     $vol->specialties = stripslashes($_GET['specialties']);
98
-    if (strstr($vol->specialties, "<")) boinc_error_page("No &lt; allowed");
116
+    if (strstr($vol->specialties, "<")) {
117
+        boinc_error_page("No &lt; allowed");
118
+    }
99 119
     $vol->projects = stripslashes($_GET['projects']);
100
-    if (strstr($vol->projects, "<")) boinc_error_page("No &lt; allowed");
120
+    if (strstr($vol->projects, "<")) {
121
+        boinc_error_page("No &lt; allowed");
122
+    }
101 123
     $vol->availability = stripslashes($_GET['availability']);
102
-    if (strstr($vol->availability, "<")) boinc_error_page("No &lt; allowed");
124
+    if (strstr($vol->availability, "<")) {
125
+        boinc_error_page("No &lt; allowed");
126
+    }
103 127
     $vol->voice_ok = $_GET['voice_ok']?1:0;
104 128
     $vol->text_ok = $_GET['text_ok']?1:0;
105 129
     $vol->hide = $_GET['hide']?1:0;
Please login to merge, or discard this patch.
doc/docutil.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.