Passed
Push — dpa_docker_wrapper12 ( e18bd7 )
by David
08:59
created
html/user/create_account_form.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     $team = BoincTeam::lookup_id($teamid);
58 58
     $user = BoincUser::lookup_id($team->userid);
59 59
     if (!$user) {
60
-        error_page("Team $team->name has no founder");
60
+        error_page("team $team->name has no founder");
61 61
         $teamid = 0;
62 62
     } else {
63 63
         echo "<b>".tra("This account will belong to the team %1 and will have the project preferences of its founder.", "<a href=\"team_display.php?teamid=$team->id\">$team->name</a>")."</b><p>";
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
 }
66 66
 
67
-form_start("create_account_action.php","post");
67
+form_start("create_account_action.php", "post");
68 68
 create_account_form($teamid, $next_url);
69 69
 if (recaptcha_public_key()) {
70 70
     form_general("", boinc_recaptcha_get_html(recaptcha_public_key()));
Please login to merge, or discard this patch.
html/user/submit_example.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     list($batch, $errmsg) = boinc_query_batch($req);
303 303
     if ($errmsg) error_page(htmlentities($errmsg));
304 304
 
305
-    page_head("Batch $req->batch_id");
305
+    page_head("batch $req->batch_id");
306 306
     start_table();
307 307
     row2("name", $batch->name);
308 308
     row2("application", $batch->app_name);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     list($reply, $errmsg) = boinc_query_job($req);
379 379
     if ($errmsg) error_page(htmlentities($errmsg));
380 380
 
381
-    page_head("Job $req->job_id");
381
+    page_head("job $req->job_id");
382 382
     echo "<a href=$project/workunit.php?wuid=$req->job_id>View workunit page on BOINC server</a>\n";
383 383
     echo "<h2>Instances</h2>\n";
384 384
     start_table();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     $user_submit = BoincUserSubmit::lookup_userid($user->id);
159 159
     if (!$user_submit) return null;
160 160
     $a = array();
161
-    foreach($apps as $app) {
161
+    foreach ($apps as $app) {
162 162
         if ($user_submit->submit_all) {
163 163
             $a[] = $app;
164 164
         } else {
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
     $input_url = get_str('input_url');
236 236
     if (!$input_url) error_page("missing input URL");
237 237
     $param_lo = (double)get_str('param_lo');
238
-    if ($param_lo<0 || $param_lo>60) error_page("param lo must be in 0..60");
238
+    if ($param_lo < 0 || $param_lo > 60) error_page("param lo must be in 0..60");
239 239
     $param_hi = (double)get_str('param_hi');
240
-    if ($param_hi<0 || $param_hi>60 || $param_hi <= $param_lo) {
240
+    if ($param_hi < 0 || $param_hi > 60 || $param_hi <= $param_lo) {
241 241
         error_page("param hi must be in 0..60 and > param lo");
242 242
     }
243 243
     $param_inc = (double)get_str('param_inc');
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     $f->source = $input_url;
255 255
     $f->mode = 'semilocal';
256 256
 
257
-    for ($x=$param_lo; $x<$param_hi; $x += $param_inc) {
257
+    for ($x = $param_lo; $x < $param_hi; $x += $param_inc) {
258 258
         $job = new StdClass;
259 259
         $job->rsc_fpops_est = $x*1e9;
260 260
         $job->command_line = "--t $x";
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         "status",
344 344
         "Canonical instance<br><p class=\"text-muted\">click to see result page on BOINC server</p>"
345 345
     );
346
-    foreach($batch->jobs as $job) {
346
+    foreach ($batch->jobs as $job) {
347 347
         $id = (int)$job->id;
348 348
         $resultid = (int)$job->canonical_instance_id;
349 349
         if ($resultid) {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         "Instance ID<br><p class=\"text-muted\">click for result page on BOINC server</p>",
387 387
         "State", "Output files"
388 388
     );
389
-    foreach($reply->instances as $inst) {
389
+    foreach ($reply->instances as $inst) {
390 390
         echo "<tr>
391 391
             <td><a href=result.php?resultid=$inst->id>$inst->id</a></td>
392 392
             <td>$inst->state</td>
Please login to merge, or discard this patch.
html/user/forum_edit.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         $now = time();
71 71
         $post->update("signature=$add_signature, content='$content', modified=$now");
72 72
     
73
-        if ($can_edit_title){
73
+        if ($can_edit_title) {
74 74
             $title = trim($title);
75 75
             $title = sanitize_tags($title);
76 76
             $title = BoincDb::escape_string($title);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 $post_owner = BoincUser::lookup_id($post->user);
44 44
 if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) {
45
-    error_page (tra("You are not authorized to edit this post."));
45
+    error_page(tra("You are not authorized to edit this post."));
46 46
 }
47 47
 
48 48
 $thread_owner = BoincUser::lookup_id($thread->owner);
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 // (ie. not a response to another post)
52 52
 // allow the user to modify the thread title
53 53
 //
54
-$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user));
54
+$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user));
55 55
 
56 56
 $content = post_str("content", true);
57 57
 $title = post_str("title", true);
58 58
 $preview = post_str("preview", true);
59 59
 
60
-if (post_str('submit',true) && (!$preview)) {
60
+if (post_str('submit', true) && (!$preview)) {
61 61
     if (POST_MAX_LINKS
62 62
         && link_count($content) > POST_MAX_LINKS
63 63
         && !is_moderator($logged_in_user, $forum)
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
     check_tokens($logged_in_user->authenticator);
68 68
 
69
-    $add_signature = (post_str('add_signature', true) == "1")?1:0;
69
+    $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0;
70 70
     $content = substr($content, 0, 64000);
71 71
     $content = trim($content);
72 72
     if (strlen($content)) {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $now = time();
75 75
         $post->update("signature=$add_signature, content='$content', modified=$now");
76 76
 
77
-        if ($can_edit_title){
77
+        if ($can_edit_title) {
78 78
             $title = trim($title);
79 79
             $title = sanitize_tags($title);
80 80
             $title = BoincDb::escape_string($title);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-page_head(tra("Edit post"),'','','', $bbcode_js);
90
+page_head(tra("Edit post"), '', '', '', $bbcode_js);
91 91
 
92 92
 switch ($forum->parent_type) {
93 93
 case 0:
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         sprintf(
123 123
             '<input type="text" size=%d name="title" value="%s">',
124 124
             80,
125
-            htmlspecialchars($preview?$title:$thread->title)
125
+            htmlspecialchars($preview ? $title : $thread->title)
126 126
         ),
127 127
         null, FORUM_LH_PCT
128 128
     );
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $bbcode_html,
140 140
         12,
141 141
         80,
142
-        htmlspecialchars($preview?$content:$post->content)
142
+        htmlspecialchars($preview ? $content : $post->content)
143 143
     ),
144 144
     null, FORUM_LH_PCT
145 145
 );
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         '<input id="add_signature" name="add_signature" value="1" type="checkbox" %s>
150 150
         <label for="add_signature">%s</label>
151 151
         ',
152
-        $post->signature?'checked="true"':'',
152
+        $post->signature ? 'checked="true"' : '',
153 153
         tra("Add my signature to this post")
154 154
     ),
155 155
     null, FORUM_LH_PCT
Please login to merge, or discard this patch.
html/inc/forum_email.inc 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 
114 114
 For assistance with ".PROJECT." go to ".$master_url;
115 115
 
116
-    $subject = "THREAD $action REPORT: $thread->title";
116
+    $subject = "thread $action REPORT: $thread->title";
117 117
     $success = mail_report_list($forum, $subject, $body);
118 118
     $success &= send_email($user, $subject, $body);
119 119
     pm_send_msg($user, $user, $subject, $body, false);
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 // There's a new post in the thread, which the user is subscribed to.
127 127
 // send them an email notifying them.
128 128
 //
129
-function send_thread_notification_email($thread, $user){
129
+function send_thread_notification_email($thread, $user) {
130 130
     $title = PROJECT . ": there is a new post in '". $thread->title ."'";
131 131
     $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132 132
     $body = "A " . PROJECT . " user has posted to the thread
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 // There's a new thread in the forum, which the user is subscribed to.
145 145
 // send them an email notifying them.
146 146
 //
147
-function send_forum_notification_email($forum, $user){
147
+function send_forum_notification_email($forum, $user) {
148 148
     $title = PROJECT . ": there is a new thread in '". $forum->title ."'";
149 149
     $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150 150
     $body = "A " . PROJECT . " user has added a thread to the forum
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132 132
     $body = "A " . PROJECT . " user has posted to the thread
133 133
 \"" . $thread->title . "\".\n"
134
-           ."To view the updated thread, visit:\n$link
134
+            ."To view the updated thread, visit:\n$link
135 135
 
136 136
 --------------------------
137 137
 To change email preferences, visit:
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150 150
     $body = "A " . PROJECT . " user has added a thread to the forum
151 151
 \"" . $thread->title . "\".\n"
152
-           ."To view the updated forum, visit:\n$link
152
+            ."To view the updated forum, visit:\n$link
153 153
 
154 154
 --------------------------
155 155
 To change email preferences, visit:
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 //////////////////// a user clicks the red "x" to report a post ///////////
163 163
 //
164 164
 function send_report_post_email($user, $forum, $thread,  $post, $message) {
165
-	$master_url = master_url();
165
+    $master_url = master_url();
166 166
 
167 167
     $body = "";
168 168
     $owner = BoincUser::lookup_id($post->user);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 //////////////////// a banishment vote has been started  ///////////
219 219
 //
220 220
 function send_banish_vote_email($user, $duration, $reason, $end_time) {
221
-	$master_url = master_url();
221
+    $master_url = master_url();
222 222
     $now=time();
223 223
     $subject = PROJECT." banishment vote underway";
224 224
     $vote_url = $master_url."forum_banishment_vote.php";
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
     pm_send_msg($user, $user, $subject, $body, false);
241 241
 
242 242
     $body .= "\n\n<a href=".$vote_url."?action=yes&userid="
243
-             .$user->id
244
-           .">[vote to banish author]</a>\n\n"
245
-           ."<a href=".$vote_url."?action=no&userid="
246
-             .$user->id
247
-           .">[vote not to banish author]</a>";
243
+                .$user->id
244
+            .">[vote to banish author]</a>\n\n"
245
+            ."<a href=".$vote_url."?action=no&userid="
246
+                .$user->id
247
+            .">[vote not to banish author]</a>";
248 248
 
249 249
     $forum = new BoincForum;
250 250
     $forum->parent_type = 0;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 // - project forums: everyone in POST_REPORT_EMAILS
25 25
 // - team message board: team founder and admins
26 26
 //
27
-function mail_report_list($forum, $subject, $body, $must_send=false) {
27
+function mail_report_list($forum, $subject, $body, $must_send = false) {
28 28
     $success = true;
29 29
     switch ($forum->parent_type) {
30 30
     case 0:
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 function send_moderation_email($forum, $post, $thread, $explanation, $action) {
66 66
     $master_url = master_url();
67 67
 
68
-    $moderator=get_logged_in_user();
68
+    $moderator = get_logged_in_user();
69 69
     $body = "";
70 70
     $user = BoincUser::lookup_id($post->user);
71 71
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 // There's a new post in the thread, which the user is subscribed to.
127 127
 // send them an email notifying them.
128 128
 //
129
-function send_thread_notification_email($thread, $user){
130
-    $title = PROJECT . ": there is a new post in '". $thread->title ."'";
131
-    $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132
-    $body = "A " . PROJECT . " user has posted to the thread
133
-\"" . $thread->title . "\".\n"
129
+function send_thread_notification_email($thread, $user) {
130
+    $title = PROJECT.": there is a new post in '".$thread->title."'";
131
+    $link = secure_url_base()."forum_thread.php?id=".$thread->id;
132
+    $body = "A ".PROJECT." user has posted to the thread
133
+\"" . $thread->title."\".\n"
134 134
            ."To view the updated thread, visit:\n$link
135 135
 
136 136
 --------------------------
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 // There's a new thread in the forum, which the user is subscribed to.
145 145
 // send them an email notifying them.
146 146
 //
147
-function send_forum_notification_email($forum, $user){
148
-    $title = PROJECT . ": there is a new thread in '". $forum->title ."'";
149
-    $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150
-    $body = "A " . PROJECT . " user has added a thread to the forum
151
-\"" . $thread->title . "\".\n"
147
+function send_forum_notification_email($forum, $user) {
148
+    $title = PROJECT.": there is a new thread in '".$forum->title."'";
149
+    $link = secure_url_base()."forum_forum.php?id=".$forum->id;
150
+    $body = "A ".PROJECT." user has added a thread to the forum
151
+\"" . $thread->title."\".\n"
152 152
            ."To view the updated forum, visit:\n$link
153 153
 
154 154
 --------------------------
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 //////////////////// a user clicks the red "x" to report a post ///////////
163 163
 //
164
-function send_report_post_email($user, $forum, $thread,  $post, $message) {
164
+function send_report_post_email($user, $forum, $thread, $post, $message) {
165 165
 	$master_url = master_url();
166 166
 
167 167
     $body = "";
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
 //
220 220
 function send_banish_vote_email($user, $duration, $reason, $end_time) {
221 221
 	$master_url = master_url();
222
-    $now=time();
222
+    $now = time();
223 223
     $subject = PROJECT." banishment vote underway";
224 224
     $vote_url = $master_url."forum_banishment_vote.php";
225 225
     $body = "
226 226
 A vote has been started to banish you
227 227
 from the ".PROJECT." message boards until ".date('M j,
228
-Y G:i', $duration+$now).",
228
+Y G:i', $duration + $now).",
229 229
 because your postings have not followed our guidelines.
230 230
 
231
-This vote will last until ".date('M j, Y G:i',$end_time)." or until a majority
231
+This vote will last until ".date('M j, Y G:i', $end_time)." or until a majority
232 232
 decision has been reached.  If the vote does not result in banishment, you will be
233 233
 able to resume posting at that time.
234 234
     ";
Please login to merge, or discard this patch.
html/inc/db_ops.inc 4 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         $x = (int)$y;
400 400
     }
401 401
     if (0<=$x && $x<=9) {
402
-        return FALSE;
402
+        return false;
403 403
     } else {
404 404
         return "$x ".error_code_str($x);
405 405
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     row("Domain name", $host->domain_name);
892 892
     $x = $host->timezone/3600;
893 893
     if ($x >= 0) $x="+$x";
894
-    row("Local Standard Time", "UTC $x hours");
894
+    row("Local Standard Time", "utc $x hours");
895 895
     row("Number of CPUs", $host->p_ncpus);
896 896
     row("CPU", "$host->p_vendor $host->p_model");
897 897
     row("GFLOPS", number_format($host->p_fpops/1e9, 2));
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
             $value=null;
309 309
         }
310 310
         if (isset($_GET[$order])) {
311
-             $order = $_GET[$order];
311
+                $order = $_GET[$order];
312 312
         } else {
313
-             $order = null;
313
+                $order = null;
314 314
         }
315 315
         if ($value) {
316 316
             if ($order == 'asc') {
@@ -1086,8 +1086,8 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 function validate_color($validate_state) {
1088 1088
     switch ($validate_state) {
1089
-   case 1: return '33cc33'; // valid, green
1090
-   case 2: return 'ffa500'; // invalid result, orange
1089
+    case 1: return '33cc33'; // valid, green
1090
+    case 2: return 'ffa500'; // invalid result, orange
1091 1091
     }
1092 1092
     return '';
1093 1093
 }
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 // Should fix at some point.
41 41
 //
42 42
 function mysqltime_str($x) {
43
-    if(strpos($x,"-")==4) {
43
+    if (strpos($x, "-") == 4) {
44 44
         // Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS
45
-        $year = substr($x,0,4);
46
-        $month = substr($x,5,2);
47
-        $day = substr($x,8,2);
48
-        $hour = substr($x,11,2);
49
-        $minute = substr($x,14,2);
50
-        $second = substr($x,17,2);
45
+        $year = substr($x, 0, 4);
46
+        $month = substr($x, 5, 2);
47
+        $day = substr($x, 8, 2);
48
+        $hour = substr($x, 11, 2);
49
+        $minute = substr($x, 14, 2);
50
+        $second = substr($x, 17, 2);
51 51
     } else {
52 52
         // Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS
53
-        $year = substr($x,0,4);
54
-        $month = substr($x,4,2);
55
-        $day = substr($x,6,2);
56
-        $hour = substr($x,8,2);
57
-        $minute = substr($x,10,2);
58
-        $second = substr($x,12,2);
53
+        $year = substr($x, 0, 4);
54
+        $month = substr($x, 4, 2);
55
+        $day = substr($x, 6, 2);
56
+        $hour = substr($x, 8, 2);
57
+        $minute = substr($x, 10, 2);
58
+        $second = substr($x, 12, 2);
59 59
 
60 60
     }
61 61
     $time = mktime($hour, $minute, $second, $month, $day, $year);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
99 99
         }
100 100
     }
101
-    return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
101
+    return array_key_exists($type_id, $types) ? strtolower($types[$type_id]) : "unknown";
102 102
 }
103 103
 
104 104
 // print a description of $table
@@ -108,38 +108,38 @@  discard block
 block discarded – undo
108 108
     $result = $db->do_query("SELECT * from $table LIMIT 1");
109 109
     $fields = $result->field_count;
110 110
 
111
-    $avgnum=(int)($fields/$columns);
112
-    if ($avgnum*$columns<$fields) {
111
+    $avgnum = (int)($fields/$columns);
112
+    if ($avgnum*$columns < $fields) {
113 113
         $avgnum++;
114 114
     }
115 115
 
116
-    $actualcolumns=0;
117
-    while ($avgnum*$actualcolumns<$fields) {
116
+    $actualcolumns = 0;
117
+    while ($avgnum*$actualcolumns < $fields) {
118 118
         $actualcolumns++;
119 119
     }
120 120
 
121
-    if ($which>$actualcolumns) {
121
+    if ($which > $actualcolumns) {
122 122
         return 0;
123 123
     }
124 124
 
125
-    $bot=($which-1)*$avgnum;
126
-    $top=$which*$avgnum;
125
+    $bot = ($which - 1)*$avgnum;
126
+    $top = $which*$avgnum;
127 127
 
128
-    $width=100.0/$actualcolumns;
128
+    $width = 100.0/$actualcolumns;
129 129
 
130 130
     echo "<td>";
131 131
     start_table('table-striped');
132 132
     echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n";
133
-    for ($count=$bot; $count<$top; $count++) {
134
-        if ($count<$fields) {
133
+    for ($count = $bot; $count < $top; $count++) {
134
+        if ($count < $fields) {
135 135
             $x = $result->fetch_field_direct($count);
136 136
             $name = $x->name;
137 137
             $type = mysql_fieldtype_str($x->type);
138 138
             $length = $x->length;
139 139
         } else {
140
-            $name="<br/> ";
141
-            $type="<br/>";
142
-            $length="<br/>";
140
+            $name = "<br/> ";
141
+            $type = "<br/>";
142
+            $length = "<br/>";
143 143
         }
144 144
         echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
145 145
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
155 155
     start_table();
156 156
     echo "<tr>";
157
-    for ($i=1; $i<=$how_many_columns; $i++) {
157
+    for ($i = 1; $i <= $how_many_columns; $i++) {
158 158
         print_describe_table_onecol($table, $i, $how_many_columns);
159 159
     }
160 160
     echo "</tr>";
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 }
174 174
 
175 175
 function print_query_field() {
176
-    $currenttime=time();
177
-    $hourago=$currenttime-3600;
178
-    $dayago=$currenttime-24*3600;
179
-    $weekago=$currenttime-7*24*3600;
176
+    $currenttime = time();
177
+    $hourago = $currenttime - 3600;
178
+    $dayago = $currenttime - 24*3600;
179
+    $weekago = $currenttime - 7*24*3600;
180 180
     echo "
181 181
         <tr>
182 182
         <td align=\"right\">Additional clauses</td>
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
     }
201 201
 }
202 202
 
203
-function append_sql_query($original,$addition,$first) {
203
+function append_sql_query($original, $addition, $first) {
204 204
     if ($first == 1) {
205
-        return $original . " where " . $addition;
205
+        return $original." where ".$addition;
206 206
     } else {
207
-        return $original . " and " . $addition;
207
+        return $original." and ".$addition;
208 208
     }
209 209
 }
210 210
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         if (isset($_GET[$name])) {
306 306
             $value = $_GET[$name];
307 307
         } else {
308
-            $value=null;
308
+            $value = null;
309 309
         }
310 310
         if (isset($_GET[$order])) {
311 311
              $order = $_GET[$order];
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     }
347 347
 
348 348
     function get_url($base = "db_action.php") {
349
-        $s = $base . "?table=$this->table$this->urlquery";
349
+        $s = $base."?table=$this->table$this->urlquery";
350 350
         return $s;
351 351
     }
352 352
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         $this->addeq('app_version_id');
362 362
         $this->addeq('exit_status');
363 363
         if (isset($_GET['nsecs'])) {
364
-            $_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']);
364
+            $_GET['mod_time'] = date("YmdHis", time() - $_GET['nsecs']);
365 365
         }
366 366
         $this->addgt('mod_time');
367 367
         $this->addeq_not_CHOOSE_ALL('server_state');
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     if ($n == '0') { // intentional compare by string
383 383
         return "0";
384 384
     } else {
385
-        if(strlen($clauses)) {
385
+        if (strlen($clauses)) {
386 386
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
387 387
         } else {
388 388
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 // @return String A human readable string if error otherwise FALSE
396 396
 // @param String $stderr_out the stderr_out value to parse
397 397
 //
398
-function stderr_error_string($stderr_out){
398
+function stderr_error_string($stderr_out) {
399 399
     $y = parse_element($stderr_out, "<error_code>");
400 400
     $x = 0;
401 401
     if ($y) {
402 402
         $x = (int)$y;
403 403
     }
404
-    if (0<=$x && $x<=9) {
404
+    if (0 <= $x && $x <= 9) {
405 405
         return FALSE;
406 406
     } else {
407 407
         return "$x ".error_code_str($x);
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 }
410 410
 
411 411
 function admin_show_result_summary() {
412
-    $ntotal =0;     // TODO: how to count $result?
413
-    $nvalid = 0;    // for SUCCESS results
412
+    $ntotal = 0; // TODO: how to count $result?
413
+    $nvalid = 0; // for SUCCESS results
414 414
     $ninvalid = 0;
415 415
     $nfile_deleted = 0;
416 416
 
@@ -418,20 +418,20 @@  discard block
 block discarded – undo
418 418
     $outcome = array();
419 419
     $client_state = array();
420 420
 
421
-    for ($ss=1; $ss<6; $ss++) {
421
+    for ($ss = 1; $ss < 6; $ss++) {
422 422
         $server_state[$ss] = 0;
423 423
     }
424
-    for ($ro=0; $ro<8; $ro++) {
424
+    for ($ro = 0; $ro < 8; $ro++) {
425 425
         $outcome[$ro] = 0;
426 426
     }
427
-    for ($cs=1; $cs<7; $cs++) {
427
+    for ($cs = 1; $cs < 7; $cs++) {
428 428
         $client_state[$cs] = 0;
429 429
     }
430
-    for ($fds=0; $fds<4; $fds++) {
430
+    for ($fds = 0; $fds < 4; $fds++) {
431 431
         $delete_state[$fds] = 0;
432 432
     }
433
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
434
-        $validate_state[$vs]=0;
433
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
434
+        $validate_state[$vs] = 0;
435 435
     }
436 436
 
437 437
     $_GET['table'] = 'result';
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         //
507 507
         $delay = parse_config(get_config(), "<delete_delay_hours>");
508 508
         if ($delay) {
509
-            $start2 = $start - $delay*3600;;
509
+            $start2 = $start - $delay*3600; ;
510 510
             $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))";
511 511
         } else {
512 512
             $main_query .= " and mod_time > FROM_UNIXTIME($start)";
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
 
566 566
     start_table();
567 567
     echo "<tr valign=\"top\">";
568
-    echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>";
569
-    echo "<td><h2>" . link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '') . "</h2></td>";
570
-    echo "<td><h2>" . link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '') . "</h2></td>";
571
-    echo "<td><h2>" . link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '') . "</h2></td>";
568
+    echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>";
569
+    echo "<td><h2>".link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '')."</h2></td>";
570
+    echo "<td><h2>".link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '')."</h2></td>";
571
+    echo "<td><h2>".link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '')."</h2></td>";
572 572
     echo "</tr>";
573 573
     echo "<tr valign=\"top\">";
574 574
     echo "<td>";
575 575
     start_table('table-striped');
576 576
     echo "<tr><th>Server state</th><th># results</th></tr>\n";
577
-    for ($ss=1; $ss<6; $ss++) {
577
+    for ($ss = 1; $ss < 6; $ss++) {
578 578
         $res = new StdClass;
579 579
         $res->server_state = $ss;
580 580
         row2(result_server_state_string($res),
581 581
             link_results(
582
-                "$server_state[$ss]",  $urlquery, "server_state=$ss", ''
582
+                "$server_state[$ss]", $urlquery, "server_state=$ss", ''
583 583
             )
584 584
         );
585 585
     }
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
     start_table('table-striped');
591 591
     echo "<tr><th>Outcome</th><th># results</th></tr>\n";
592 592
 
593
-    for ($ro=0; $ro<8; $ro++) {
593
+    for ($ro = 0; $ro < 8; $ro++) {
594 594
         $res = new StdClass;
595 595
         $res->outcome = $ro;
596 596
         $res->exit_status = 0;
597 597
         c_row2(
598
-            $outcome[$ro]?outcome_color($ro):'',
598
+            $outcome[$ro] ?outcome_color($ro) : '',
599 599
             result_outcome_string($res),
600 600
             link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '')
601 601
         );
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
     echo "<td>";
607 607
     start_table('table-striped');
608 608
     echo "<tr><th>Validate state</th><th># results</th></tr>\n";
609
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
609
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
610 610
         $res = new StdClass;
611 611
         $res->validate_state = $vs;
612 612
         $res->exit_status = 0;
613 613
         c_row2(
614
-            $validate_state[$vs]?validate_color($vs):'',
614
+            $validate_state[$vs] ?validate_color($vs) : '',
615 615
             validate_state_str($res),
616 616
             link_results(
617 617
                 "$validate_state[$vs]",
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
     start_table('table-striped');
626 626
     echo "<tr><th>File Delete state</th><th># results</th></tr>\n";
627 627
 
628
-    for ($fds=0; $fds<4; $fds++) {
628
+    for ($fds = 0; $fds < 4; $fds++) {
629 629
         row2(
630 630
             file_delete_state_str($fds),
631 631
             link_results(
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
     echo "<td>";
655 655
     start_table('table-striped');
656 656
     echo "<tr><th>Client state</th><th># results</th></tr>\n";
657
-    for ($cs=1; $cs<7; $cs++) {
657
+    for ($cs = 1; $cs < 7; $cs++) {
658 658
         $res = new StdClass;
659 659
         $res->client_state = $cs;
660 660
         $res->exit_status = 0;
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
         <select name=\"server_state\">
678 678
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
679 679
     ";
680
-    for ($i=1; $i<6; $i++) {
680
+    for ($i = 1; $i < 6; $i++) {
681 681
         $res = new StdClass;
682
-        $res->server_state=$i;
682
+        $res->server_state = $i;
683 683
         echo "<option value=\"$i\"> "."[$i]&nbsp;&nbsp;".'   '.result_server_state_string($res)."</option>\n";
684 684
     }
685 685
     echo "</select>\n";
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
         <select name=\"outcome\">
691 691
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
692 692
     ";
693
-    for ($i=0; $i<8; $i++) {
693
+    for ($i = 0; $i < 8; $i++) {
694 694
         $res = new StdClass;
695 695
         $res->outcome = $i;
696 696
         $res->exit_status = 0;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         <select name=\"validate_state\">
705 705
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
706 706
         ";
707
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
707
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
708 708
         $res = new StdClass;
709 709
         $res->validate_state = $vs;
710 710
         $res->exit_status = 0;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         <select name=\"client_state\">
719 719
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
720 720
     ";
721
-    for ($i=0; $i<7; $i++) {
721
+    for ($i = 0; $i < 7; $i++) {
722 722
         $res = new StdClass;
723 723
         $res->client_state = $i;
724 724
         $res->exit_status = 0;
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 }
756 756
 
757 757
 function table_title($table) {
758
-    switch($table) {
758
+    switch ($table) {
759 759
     case "platform": return "Platforms";
760 760
     case "app": return "Applications";
761 761
     case "app_version": return "Application Versions";
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     row("Created", time_str($platform->create_time));
776 776
     row("Name", $platform->name);
777 777
     row("User friendly name", $platform->user_friendly_name);
778
-    row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
778
+    row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
779 779
     end_table();
780 780
 }
781 781
 
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
     row("User-friendly name", $app->user_friendly_name);
788 788
     row("Deprecated", $app->deprecated);
789 789
     row("Homogeneous redundancy", $app->homogeneous_redundancy);
790
-    row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
791
-    row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
790
+    row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
791
+    row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
792 792
     end_table();
793 793
 }
794 794
 
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     start_table();
797 797
     row("ID", $app_version->id);
798 798
     row("Created", time_str($app_version->create_time));
799
-    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>");
799
+    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>");
800 800
     row("Version num", $app_version->version_num);
801
-    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" );
801
+    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>");
802 802
     row("Plan Class", $app_version->plan_class);
803 803
     row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>");
804 804
     row("min_core_version", $app_version->min_core_version);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
     row("External IP address", "$host->external_ip_addr<br>");
933 933
     row("Domain name", $host->domain_name);
934 934
     $x = $host->timezone/3600;
935
-    if ($x >= 0) $x="+$x";
935
+    if ($x >= 0) $x = "+$x";
936 936
     row("Local Standard Time", "UTC $x hours");
937 937
     row("Number of CPUs", $host->p_ncpus);
938 938
     row("CPU", "$host->p_vendor $host->p_model");
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     row("Last time modified", mysqltime_str($wu->mod_time));
988 988
     row("Name", $wu->name);
989 989
     row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
990
-    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>");
990
+    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>");
991 991
     row("Application version number", $wu->app_version_num);
992 992
     row("Batch", $wu->batch);
993 993
     $x = number_format($wu->rsc_fpops_est/1e9, 2);
@@ -1000,12 +1000,12 @@  discard block
 block discarded – undo
1000 1000
     $x = $wu->rsc_disk_bound/(1024*1024);
1001 1001
     $y = number_format($x, 2);
1002 1002
     row("Max Disk Usage", "$y MB");
1003
-    row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]");
1003
+    row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]");
1004 1004
     row("Canonical resultid",
1005 1005
             "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>");
1006 1006
     row("Canonical credit", $wu->canonical_credit);
1007 1007
     //row("Timeout check time", time_str($wu->timeout_check_time));
1008
-    row("Delay bound", "$wu->delay_bound" . " =  " . time_diff($wu->delay_bound) );
1008
+    row("Delay bound", "$wu->delay_bound"." =  ".time_diff($wu->delay_bound));
1009 1009
     row("Error mask", wu_error_mask_str($wu->error_mask, true));
1010 1010
     row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]");
1011 1011
     row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]");
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
     row("max error results", $wu->max_error_results);
1016 1016
     row("max total results", $wu->max_total_results);
1017 1017
     row("max success results", $wu->max_success_results);
1018
-    row("result template file",$wu->result_template_file);
1018
+    row("result template file", $wu->result_template_file);
1019 1019
     row("hr_class", $wu->hr_class);
1020 1020
     row("opaque", $wu->opaque);
1021 1021
     row("Priority", $wu->priority);
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 }
1094 1094
 
1095 1095
 function outcome_color($outcome) {
1096
-    switch($outcome) {
1096
+    switch ($outcome) {
1097 1097
     case 0: return '9900cc'; // "Init", purple
1098 1098
     case 1: return '33cc33'; // "Success", green
1099 1099
     case 3: return 'ff3333'; // "Client error", red
@@ -1122,16 +1122,16 @@  discard block
 block discarded – undo
1122 1122
     row("Received", time_str($result->received_time));
1123 1123
     row("Last time modified", mysqltime_str($result->mod_time));
1124 1124
     row("Name", $result->name);
1125
-    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" );
1125
+    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]");
1126 1126
     row("Server state", result_server_state_string($result)." [$result->server_state]");
1127 1127
     row("Outcome", result_outcome_string($result)." [$result->outcome]");
1128 1128
     row("Client state", result_client_state_string($result)." [$result->client_state]");
1129 1129
     row("Exit status", exit_status_string($result->exit_status));
1130
-    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]");
1131
-    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
1130
+    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]");
1131
+    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]");
1132 1132
     row("CPU time", $result->cpu_time);
1133 1133
     row("Elapsed time", $result->elapsed_time);
1134
-    if($error=stderr_error_string($result->stderr_out)) {
1134
+    if ($error = stderr_error_string($result->stderr_out)) {
1135 1135
         row("error in stderr out", $error);
1136 1136
     }
1137 1137
     row("Batch", $result->batch);
@@ -1148,16 +1148,16 @@  discard block
 block discarded – undo
1148 1148
     row("App version", $x1.app_version_string($result).$x2);
1149 1149
     row("App version ID", $result->app_version_id);
1150 1150
     row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2));
1151
-    row("Random",$result->random);
1152
-    row("Opaque",$result->opaque);
1153
-    row("Teamid",$result->teamid);
1154
-    row("Priority",$result->priority);
1151
+    row("Random", $result->random);
1152
+    row("Opaque", $result->opaque);
1153
+    row("Teamid", $result->teamid);
1154
+    row("Priority", $result->priority);
1155 1155
     row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
1156 1156
     row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
1157 1157
     row("stderr out", "<pre>"
1158 1158
         .htmlspecialchars(
1159 1159
             $result->stderr_out,
1160
-            ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0),
1160
+            ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0),
1161 1161
             'utf-8'
1162 1162
         )
1163 1163
         ."</pre>"
@@ -1205,23 +1205,23 @@  discard block
 block discarded – undo
1205 1205
     } else {
1206 1206
         // result has not been received yet, so show report deadline either
1207 1207
         // in green if in the future or in red if in the past.
1208
-        $timenow=time();
1209
-        if ($result->report_deadline==0)  {
1208
+        $timenow = time();
1209
+        if ($result->report_deadline == 0) {
1210 1210
             // not sent -- show create time in purple
1211
-            $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1212
-        } else if ($result->report_deadline>=$timenow) {
1211
+            $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>";
1212
+        } else if ($result->report_deadline >= $timenow) {
1213 1213
             // overdue -- show deadline in red
1214
-            $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>";
1214
+            $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>";
1215 1215
         } else {
1216 1216
             // in progress and not overdue -- show deadline in green
1217
-            $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>";
1217
+            $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>";
1218 1218
         }
1219 1219
     }
1220 1220
     $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)";
1221 1221
     $outcome_color = outcome_color($result->outcome);
1222 1222
     $validate_color = validate_color($result->validate_state);
1223 1223
     $host_user = host_user_link($result->hostid);
1224
-    $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
1224
+    $cpu_hours = sprintf("%.1f", $result->cpu_time/3600);
1225 1225
     $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>";
1226 1226
     $delete_state = file_delete_state_str($result->file_delete_state);
1227 1227
 
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
     row("ID", $user->id);
1250 1250
     row("Created", time_str($user->create_time));
1251 1251
     row("Name", $user->name);
1252
-    if(!in_rops()) {
1252
+    if (!in_rops()) {
1253 1253
         row("Authenticator", $user->authenticator);
1254 1254
     }
1255 1255
     row("Email address", $user->email_addr);
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
     row("Default venue", $user->venue);
1265 1265
     row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>");
1266 1266
     row("Cross project ID", $user->cross_project_id);
1267
-    if(!in_rops()) {
1267
+    if (!in_rops()) {
1268 1268
         row("Password Hash", $user->passwd_hash);
1269 1269
     }
1270 1270
     row("Donated", $user->donated);
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
     echo "</table></td>";
1316 1316
     echo "<td><table border=\"2\">\n";
1317 1317
     echo "<tr><th>User</th><th># posts</th></tr>\n";
1318
-    for ($p=1; $p<=10; $p++) {
1318
+    for ($p = 1; $p <= 10; $p++) {
1319 1319
         row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts);
1320 1320
     }
1321 1321
     echo "</table></td>";
@@ -1354,10 +1354,10 @@  discard block
 block discarded – undo
1354 1354
 function admin_show_team($team) {
1355 1355
     start_table();
1356 1356
     row("ID", $team->id);
1357
-    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>");
1357
+    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>");
1358 1358
     row("Name", $team->name);
1359
-    row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" );
1360
-    row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>");
1359
+    row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>");
1360
+    row("Url", "<a href=\"http://$team->url\">".$team->url."</a>");
1361 1361
     row("Type", team_type_string($team->type));
1362 1362
     row("Description", $team->description);
1363 1363
     row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>");
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
     if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) {
1401 1401
         return "(blank)";
1402 1402
     } else {
1403
-        return $host->domain_name . " (" . $host->last_ip_addr . ")";
1403
+        return $host->domain_name." (".$host->last_ip_addr.")";
1404 1404
     }
1405 1405
 }
1406 1406
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -379,7 +379,8 @@  discard block
 block discarded – undo
379 379
 
380 380
 
381 381
 function link_results($n, $mq, $query, $clauses) {
382
-    if ($n == '0') { // intentional compare by string
382
+    if ($n == '0') {
383
+// intentional compare by string
383 384
         return "0";
384 385
     } else {
385 386
         if(strlen($clauses)) {
@@ -395,7 +396,7 @@  discard block
 block discarded – undo
395 396
 // @return String A human readable string if error otherwise FALSE
396 397
 // @param String $stderr_out the stderr_out value to parse
397 398
 //
398
-function stderr_error_string($stderr_out){
399
+function stderr_error_string($stderr_out) {
399 400
     $y = parse_element($stderr_out, "<error_code>");
400 401
     $x = 0;
401 402
     if ($y) {
@@ -1206,7 +1207,7 @@  discard block
 block discarded – undo
1206 1207
         // result has not been received yet, so show report deadline either
1207 1208
         // in green if in the future or in red if in the past.
1208 1209
         $timenow=time();
1209
-        if ($result->report_deadline==0)  {
1210
+        if ($result->report_deadline==0) {
1210 1211
             // not sent -- show create time in purple
1211 1212
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1212 1213
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.
html/inc/text_transform.inc 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 // Do the actual transformation of the text.
63 63
 // TODO: Make this part of the above class.
64 64
 
65
-function output_transform($text, $options = NULL) {
65
+function output_transform($text, $options = null) {
66 66
     // Options is a output_options object, defined above
67 67
     if (!$options) {
68 68
         $options = new output_options; // Defaults in the class definition
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     $i=0;
296 296
     $linkpos=true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301 301
         $linkpos=strpos($text, "<a ", $i);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 require_once('../inc/sanitize_html.inc');
27 27
 
28 28
 class output_options {
29
-    var $bb2html;            // BBCode as HTML? (on)
30
-    var $images_as_links;    // Images as hyperlinks? (off)
31
-    var $link_popup;        // Links in new windows? (off)
32
-    var $nl2br;                // Convert newlines to <br>'s? (on)
33
-    var $htmlitems;            // Convert special chars to HTML entities? (on)
34
-    var $htmlscrub;            // Scrub "bad" HTML tags? (off)
35
-    var $highlight_terms;// Array of terms to be highlighted (off)
29
+    var $bb2html; // BBCode as HTML? (on)
30
+    var $images_as_links; // Images as hyperlinks? (off)
31
+    var $link_popup; // Links in new windows? (off)
32
+    var $nl2br; // Convert newlines to <br>'s? (on)
33
+    var $htmlitems; // Convert special chars to HTML entities? (on)
34
+    var $htmlscrub; // Scrub "bad" HTML tags? (off)
35
+    var $highlight_terms; // Array of terms to be highlighted (off)
36 36
 
37 37
     // Constructor - set the defaults.
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $options = new output_options; // Defaults in the class definition
69 69
     }
70 70
     if ($options->htmlitems) {
71
-        $text = htmlspecialchars($text, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE);
71
+        $text = htmlspecialchars($text, ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE);
72 72
     }
73 73
     if (is_array($options->highlight_terms)) {
74 74
         $text = highlight_terms($text, $options->highlight_terms);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 // If $export is true, don't use BOINC CSS
105 105
 
106 106
 function substr2($s, $n1, $n2) {
107
-    return substr($s, $n1, $n2-$n1);
107
+    return substr($s, $n1, $n2 - $n1);
108 108
 }
109 109
 
110 110
 // process non-nestable constructs: [pre] and [code]
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         // but not any hacker stuff like " alert(1)
181 181
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
182 182
     // List of allowable tags
183
-    $bbtags = array (
183
+    $bbtags = array(
184 184
         "@\[b\](.*?)\[/b\]@is",
185 185
         "@\[i\](.*?)\[/i\]@is",
186 186
         "@\[u\](.*?)\[/u\]@is",
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
     // What the above tags are turned in to
211 211
     if ($export) {
212
-        $htmltags = array (
212
+        $htmltags = array(
213 213
             "<b>\\1</b>",
214 214
             "<i>\\1</i>",
215 215
             "<u>\\1</u>",
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
237 237
         );
238 238
     } else {
239
-        $htmltags = array (
239
+        $htmltags = array(
240 240
             "<b>\\1</b>",
241 241
             "<i>\\1</i>",
242 242
             "<u>\\1</u>",
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     $lasttext = "";
269 269
     $i = 0;
270 270
     // $i<1000 to prevent DoS
271
-    while ($text != $lasttext && $i<1000) {
271
+    while ($text != $lasttext && $i < 1000) {
272 272
         $lasttext = $text;
273 273
         $text = preg_replace($bbtags, $htmltags, $text);
274 274
         $i = $i + 1;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     return $text;
279 279
 }
280 280
 
281
-function bb2html($text, $export=false) {
281
+function bb2html($text, $export = false) {
282 282
     $text = replace_pre_code($text, $export);
283 283
     return bb2html_aux($text, $export);
284 284
 }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 // for example inside <pre> containers
288 288
 // The original \n was retained after the br when it was added
289 289
 //
290
-function remove_br($text){
290
+function remove_br($text) {
291 291
     return str_replace("<br />", "", $text);
292 292
 }
293 293
 
@@ -295,19 +295,19 @@  discard block
 block discarded – undo
295 295
 //
296 296
 function externalize_links($text) {
297 297
     // TODO:  Convert this to PCRE
298
-    $i=0;
299
-    $linkpos=true;
298
+    $i = 0;
299
+    $linkpos = true;
300 300
     $out = "";
301
-    while (true){
301
+    while (true) {
302 302
         // Find a link
303 303
         //
304
-        $linkpos=strpos($text, "<a ", $i);
305
-        if ($linkpos===false) break;
304
+        $linkpos = strpos($text, "<a ", $i);
305
+        if ($linkpos === false) break;
306 306
 
307 307
         // Replace with target='_new'
308 308
         //
309
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
310
-        $i = $linkpos+3;
309
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
310
+        $i = $linkpos + 3;
311 311
     }
312 312
     $out .= substr($text, $i);
313 313
     return $out;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 // Converts image tags to links to the images.
317 317
 //
318
-function image_as_link($text){
318
+function image_as_link($text) {
319 319
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
320 320
     $replacement = '<a href=${2}>[Image link]</a>';
321 321
     return preg_replace($pattern, $replacement, $text);
Please login to merge, or discard this patch.
html/inc/ReCaptcha/ReCaptcha.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * reCAPTCHA client.
31 31
  */
32
-class ReCaptcha
33
-{
32
+class ReCaptcha {
34 33
     /**
35 34
      * Version of this client library.
36 35
      * @const string
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      * @param string $secret shared secret between site and reCAPTCHA server.
56 55
      * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
57 56
      */
58
-    public function __construct($secret, RequestMethod $requestMethod = null)
59
-    {
57
+    public function __construct($secret, RequestMethod $requestMethod = null) {
60 58
         if (empty($secret)) {
61 59
             throw new \RuntimeException('No secret provided');
62 60
         }
@@ -82,8 +80,7 @@  discard block
 block discarded – undo
82 80
      * @param string $remoteIp The end user's IP address.
83 81
      * @return Response Response from the service.
84 82
      */
85
-    public function verify($response, $remoteIp = null)
86
-    {
83
+    public function verify($response, $remoteIp = null) {
87 84
         // Discard empty solution submissions
88 85
         if (empty($response)) {
89 86
             $recaptchaResponse = new Response(false, array('missing-input-response'));
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
 /**
30 30
  * Method used to send the request to the service.
31 31
  */
32
-interface RequestMethod
33
-{
32
+interface RequestMethod {
34 33
 
35 34
     /**
36 35
      * Submit the request with the specified parameters.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/CurlPost.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * Note: this requires the cURL extension to be enabled in PHP
35 35
  * @see http://php.net/manual/en/book.curl.php
36 36
  */
37
-class CurlPost implements RequestMethod
38
-{
37
+class CurlPost implements RequestMethod {
39 38
     /**
40 39
      * URL to which requests are sent via cURL.
41 40
      * @const string
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      */
49 48
     private $curl;
50 49
 
51
-    public function __construct(Curl $curl = null)
52
-    {
50
+    public function __construct(Curl $curl = null) {
53 51
         if (!is_null($curl)) {
54 52
             $this->curl = $curl;
55 53
         } else {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param RequestParameters $params Request parameters
64 62
      * @return string Body of the reCAPTCHA response
65 63
      */
66
-    public function submit(RequestParameters $params)
67
-    {
64
+    public function submit(RequestParameters $params) {
68 65
         $handle = $this->curl->init(self::SITE_VERIFY_URL);
69 66
 
70 67
         $options = array(
Please login to merge, or discard this patch.