Passed
Pull Request — master (#5727)
by Vitalii
15:05 queued 06:01
created
html/user/get_output2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     if ($user->authenticator != $auth) die('bad auth');
52 52
 }
53 53
 
54
-function do_result_aux($result, $batch, $file_num=null) {
54
+function do_result_aux($result, $batch, $file_num = null) {
55 55
     $phys_names = get_outfile_names($result);
56 56
     $log_names = get_outfile_log_names($result);
57 57
     if ($file_num !== null) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $dir_path = "submit/$batch->id/$result->name";
72 72
         system("rm -r $dir_path");
73 73
         mkdir($dir_path);
74
-        for ($i=0; $i<count($phys_names); $i++) {
74
+        for ($i = 0; $i < count($phys_names); $i++) {
75 75
             $cmd = sprintf('ln -s %s %s/%s',
76 76
                 upload_path($phys_names[$i]),
77 77
                 $dir_path,
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     }
89 89
 }
90 90
 
91
-function do_result($result_id, $auth, $file_num=null) {
91
+function do_result($result_id, $auth, $file_num = null) {
92 92
     $result = BoincResult::lookup_id($result_id);
93 93
     if (!$result) die("no result $result_id");
94 94
     $workunit = BoincWorkunit::lookup_id($result->workunitid);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             system($cmd);
136 136
         } else {
137 137
             mkdir(sprintf('%s/%s', $dir_path, $result->name));
138
-            for ($i=0; $i<count($phys_names); $i++) {
138
+            for ($i = 0; $i < count($phys_names); $i++) {
139 139
                 $cmd = sprintf('ln -s %s %s/%s/%s',
140 140
                     upload_path($phys_names[$i]),
141 141
                     $dir_path,
Please login to merge, or discard this patch.
html/inc/cert.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
     credit_to_ops($credit, $ops, $unit);
44 44
 
45 45
     if ($bolden) {
46
-        $lbold="[[";
47
-        $rbold="]]";
46
+        $lbold = "[[";
47
+        $rbold = "]]";
48 48
     } else {
49
-        $lbold="";        $rbold="";
49
+        $lbold = ""; $rbold = "";
50 50
     }
51 51
     return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)";
52 52
 }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 //
87 87
 function show_share_buttons() {
88 88
     echo '<p>';
89
-    $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
89
+    $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
90 90
     $cert_url = urlencode($current_url);
91 91
 
92 92
     // Share on Facebook
Please login to merge, or discard this patch.
html/user/cert_team.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 if (DISABLE_TEAMS) error_page("Teams are disabled");
28 28
 
29 29
 $border = get_str("border", true);
30
-if ($border=="no") {
31
-    $border=0;
30
+if ($border == "no") {
31
+    $border = 0;
32 32
 } else {
33
-    $border=8;
33
+    $border = 8;
34 34
 }
35 35
 
36 36
 // Make sure user_id is in the URL so that share functions work
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 if (!$user_id) {
40 40
     $user = get_logged_in_user();
41 41
     Header(sprintf('Location: %s/cert_team.php?user_id=%d%s',
42
-        url_base(), $user->id, $border==0?'&border=no':''
42
+        url_base(), $user->id, $border == 0 ? '&border=no' : ''
43 43
     ));
44 44
     exit;
45 45
 }
Please login to merge, or discard this patch.
html/user/cert1.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 require_once("../inc/cert.inc");
25 25
 
26 26
 $border = get_str("border", true);
27
-if ($border=="no") {
28
-    $border=0;
27
+if ($border == "no") {
28
+    $border = 0;
29 29
 } else {
30
-    $border=8;
30
+    $border = 8;
31 31
 }
32 32
 
33 33
 // Make sure user_id is in the URL so that share functions work
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 if (!$user_id) {
37 37
     $user = get_logged_in_user();
38 38
     Header(sprintf('Location: %s/cert1.php?user_id=%d%s',
39
-        url_base(), $user->id, $border==0?'&border=no':''
39
+        url_base(), $user->id, $border == 0 ? '&border=no' : ''
40 40
     ));
41 41
     exit;
42 42
 }
Please login to merge, or discard this patch.
html/user/cert_all.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 require_once("../inc/user.inc");
26 26
 
27 27
 $border = get_str("border", true);
28
-if ($border=="no") {
29
-    $border=0;
28
+if ($border == "no") {
29
+    $border = 0;
30 30
 } else {
31
-    $border=8;
31
+    $border = 8;
32 32
 }
33 33
 
34 34
 // Make sure user_id is in the URL so that share functions work
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 if (!$user_id) {
38 38
     $user = get_logged_in_user();
39 39
     Header(sprintf('Location: %s/cert_all.php?user_id=%d%s',
40
-        url_base(), $user->id, $border==0?'&border=no':''
40
+        url_base(), $user->id, $border == 0 ? '&border=no' : ''
41 41
     ));
42 42
     exit;
43 43
 }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr>
92 92
 ";
93 93
 foreach ($user->projects as $p) {
94
-    if ($p->total_credit<100) continue;
94
+    if ($p->total_credit < 100) continue;
95 95
     show_proj($p);
96 96
 }
97 97
 echo "
Please login to merge, or discard this patch.
html/inc/delete_account.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 if (!defined("DELETE_DELAY")) define("DELETE_DELAY", 2);
43 43
 
44 44
 function is_delete_account_token_valid($userid, $token) {
45
-    if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) {
45
+    if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) {
46 46
         sleep(LOGIN_FAIL_SLEEP_SEC);
47 47
         return false;
48 48
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 //
127 127
 function is_over_but_not_validated($res) {
128 128
     if ($res->server_state == RESULT_SERVER_STATE_OVER && $res->outcome == RESULT_OUTCOME_SUCCESS &&
129
-            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE) ) {
129
+            ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE)) {
130 130
         return true;
131 131
     }
132 132
     return false;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 //
145 145
 function cancel_results_for_user($user) {
146 146
     $ress = BoincResult::enum("userid = $user->id");
147
-    $cancel_clause="server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
148
-    $set_id_clause="hostid=0, userid=0";
147
+    $cancel_clause = "server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID;
148
+    $set_id_clause = "hostid=0, userid=0";
149 149
     foreach ($ress as $res) {
150 150
         if (is_in_progress($res) || is_over_but_not_validated($res)) {
151 151
             $res->update($cancel_clause.", ".$set_id_clause);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
     // delete remote submit user
170 170
     //
171
-    delete_remote_submit_user($user);  // from submit_util.inc
171
+    delete_remote_submit_user($user); // from submit_util.inc
172 172
 
173 173
     // remove user's team records
174 174
     //
175
-    user_erase_team_owner($user);      // from team.inc
176
-    user_quit_team($user);        // from team.inc
175
+    user_erase_team_owner($user); // from team.inc
176
+    user_quit_team($user); // from team.inc
177 177
     user_erase_team_delta($user); // from team.inc
178 178
 
179 179
     // Items that do not have logic elsewhere
@@ -200,6 +200,6 @@  discard block
 block discarded – undo
200 200
     BoincTeamAdmin::delete("userid=$user->id");
201 201
 
202 202
     // final action
203
-    delete_user($user);  //from user_util.inc
203
+    delete_user($user); //from user_util.inc
204 204
     return 0;
205 205
 }
Please login to merge, or discard this patch.
html/user/edit_passwd_form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 echo "<p>";
29 29
 
30 30
 form_start(secure_url_base()."edit_passwd_action.php", "post");
31
-form_input_text(tra("New password"), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd"));
31
+form_input_text(tra("New password"), "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd"));
32 32
 form_submit(tra("Change password"));
33 33
 form_end();
34 34
 page_tail();
Please login to merge, or discard this patch.
html/user/weak_auth.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 //
30 30
 $idx = strpos($master_url, '://');
31 31
 if ($idx) {
32
-    $url = substr($master_url, $idx+strlen('://'));
32
+    $url = substr($master_url, $idx + strlen('://'));
33 33
 } else {
34 34
     $url = $master_url;
35 35
 }
36 36
 
37 37
 // convert invalid characters into underscores
38 38
 //
39
-for ($i=0; $i<strlen($url); $i++) {
39
+for ($i = 0; $i < strlen($url); $i++) {
40 40
     $c = $url[$i];
41 41
     if (!ctype_alnum($c) && $c != '.' && $c != '-' && $c != '_') {
42 42
         $url[$i] = '_';
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 //remove trailing underscore(s)
47 47
 //
48
-$account_file = "account_" . rtrim($url, '_') . ".xml";
48
+$account_file = "account_".rtrim($url, '_').".xml";
49 49
 
50 50
 page_head(tra("Account keys"));
51 51
 text_start();
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
     <p>",
58 58
     tra("This key can be used to:"),
59 59
     "<ul>
60
-    <li><a href=get_passwd.php>",tra("log in to your account on the web"),"</a>;
60
+    <li><a href=get_passwd.php>",tra("log in to your account on the web"), "</a>;
61 61
     <li>",
62 62
         tra("attach a computer to your account without using the BOINC Manager.
63 63
        To do so, install BOINC,
64 64
        create a file named %1 in the BOINC
65
-       data directory, and set its contents to:","<b>$account_file</b>"),"
65
+       data directory, and set its contents to:","<b>$account_file</b>"), "
66 66
     <p><pre>",
67 67
     htmlspecialchars(
68 68
 "<account>
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
     as described above, but cannot be used to log in to your account or change it in any way.
77 77
     If you want to attach untrusted or insecure computers to your account,
78 78
     do so using your weak account key.
79
-    Your weak account key is:"),"
79
+    Your weak account key is:"), "
80 80
     <p><pre>$weak_auth</pre><p>
81 81
     ",
82
-    tra("The key depends on your account's email address and password.  If you change either of these, the weak account key will change."),"
82
+    tra("The key depends on your account's email address and password.  If you change either of these, the weak account key will change."), "
83 83
     </td></tr></table>"
84 84
 ;
85 85
 text_end();
Please login to merge, or discard this patch.
html/inc/prefs_util.inc 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 abstract class PREF {
45
-    public $desc;       // short description
46
-    public $tooltip;    // longer description, shown as tooltip
47
-    public $tag;        // the pref's primary XML tag
45
+    public $desc; // short description
46
+    public $tooltip; // longer description, shown as tooltip
47
+    public $tag; // the pref's primary XML tag
48 48
     function __construct($desc, $tooltip, $tag) {
49 49
         $this->desc = $desc;
50 50
         $this->tooltip = $tooltip;
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 
123 123
 class PREF_BOOL extends PREF {
124 124
     public $default;
125
-    public $invert;     // show to user in opposite sense
126
-    function __construct($desc, $tooltip, $tag, $default, $invert=false) {
125
+    public $invert; // show to user in opposite sense
126
+    function __construct($desc, $tooltip, $tag, $default, $invert = false) {
127 127
         $this->default = $default;
128 128
         $this->invert = $invert;
129 129
         parent::__construct($desc, $tooltip, $tag);
130 130
     }
131 131
     function show_value($prefs) {
132 132
         $tag = $this->tag;
133
-        $v = $this->invert?!$prefs->$tag:$prefs->$tag;
133
+        $v = $this->invert ? !$prefs->$tag : $prefs->$tag;
134 134
         echo "<td>".readonly_checkbox($v)."</td>";
135 135
     }
136 136
     function show_form($prefs, $error) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         }
143 143
         echo "<td ".VALUE_ATTRS.">"
144 144
             ."<input type=checkbox name=$this->tag "
145
-            . ($checked?"checked":"")
145
+            . ($checked ? "checked" : "")
146 146
             ."></td>
147 147
         ";
148 148
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     function xml_string($prefs) {
156 156
         $tag = $this->tag;
157 157
         return "<$tag>"
158
-            .($prefs->$tag?"1":"0")
158
+            .($prefs->$tag ? "1" : "0")
159 159
             ."</$tag>\n";
160 160
     }
161 161
     function xml_parse(&$prefs, $name, $text) {
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
     public $consent_type_id; // the consent_type_id from the consent_type table
176 176
     public $consent_name; // the consent_name to configure
177 177
     public $default;
178
-    public $invert;     // show to user in opposite sense
178
+    public $invert; // show to user in opposite sense
179 179
 
180
-    function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert=false) {
180
+    function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert = false) {
181 181
         $this->consent_type_id = $consent_type_id;
182 182
         $this->consent_name = $consent_name;
183 183
         $this->default = $default;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         } else {
241 241
             $value = false;
242 242
         }
243
-        echo "<td>" . readonly_checkbox($value) . "</td>";
243
+        echo "<td>".readonly_checkbox($value)."</td>";
244 244
     }
245 245
     function show_form($user, $error) {
246 246
         $consent_type_id = $this->consent_type_id;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         }
258 258
         echo "<td ".VALUE_ATTRS.">"
259 259
             ."<input type=checkbox name=$this->tag "
260
-            . ($checked?"checked":"")
260
+            . ($checked ? "checked" : "")
261 261
             ."></td>
262 262
         ";
263 263
     }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
             "userid=$user->id AND consent_type_id='$consent_type_id$'"
277 277
         );
278 278
 
279
-        if ((($cr) and ($cr->consent_flag!=$flag)) or (!$cr)) {
279
+        if ((($cr) and ($cr->consent_flag != $flag)) or (!$cr)) {
280 280
             $rc = consent_to_a_policy(
281 281
                 $user, $consent_type_id, $flag, 0, 'Webform', time()
282 282
             );
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         // this is the value if they check the box
317 317
     public $scale;
318 318
 
319
-    function __construct($suffix, $min, $max, $default, $scale=1, $default2=0) {
319
+    function __construct($suffix, $min, $max, $default, $scale = 1, $default2 = 0) {
320 320
         $this->suffix = " $suffix";
321 321
         $this->min = $min;
322 322
         $this->max = $max;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         $v .= "$this->suffix ";
336 336
         return $v;
337 337
     }
338
-    function form_str($tag, $v, $had_error, $disabled=false, $id=null) {
338
+    function form_str($tag, $v, $had_error, $disabled = false, $id = null) {
339 339
         if (is_numeric($v)) {
340 340
             $v /= $this->scale;
341 341
             if (!$had_error && ($v < $this->min || $v > $this->max)) {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             }
344 344
         }
345 345
         if ($disabled) $v = "";
346
-        $i = $id?"id=\"$id\"":"";
346
+        $i = $id ? "id=\"$id\"" : "";
347 347
         return '<input type="text" size="5" class="form-control input-sm" name="'.$tag.'" value="'.$v."\" $disabled $i> &nbsp; $this->suffix ";
348 348
     }
349 349
     function form_convert($in, &$out, &$error) {
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
         $text_id = $this->tag;
467 467
         $default = $this->num_spec->get_default();
468 468
         $val = $prefs->$tag;
469
-        $c = $val?"checked":"";
470
-        $d = $val?"":"disabled";
469
+        $c = $val ? "checked" : "";
470
+        $d = $val ? "" : "disabled";
471 471
         echo "<td $attrs>"
472 472
             ."<input type=checkbox id=$checkbox_id onClick=\"checkbox_clicked('$checkbox_id', '$text_id', $default)\" $c> &nbsp;"
473 473
             .$this->num_spec->form_str($tag, $prefs->$tag, $had_error, $d, $text_id)
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 function hour_select($x, $name, $id, $d) {
581 581
     $s = "";
582 582
     $s .= "<select class=\"selectbox form-control input-sm\" name=$name id=$id $d>\n";
583
-    for ($i=0; $i<24; $i++) {
584
-        $sel = ($x == $i)?"selected":"";
583
+    for ($i = 0; $i < 24; $i++) {
584
+        $sel = ($x == $i) ? "selected" : "";
585 585
         $s .= "<option value=$i $sel> $i:00";
586 586
     }
587 587
     $s .= "</select>\n";
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 
683 683
 // row_defs - Display a value for all 4 venues in one row
684 684
 //
685
-function row_defs($pre, $item, $post, $type, $prefs, $tooltip=null) {
685
+function row_defs($pre, $item, $post, $type, $prefs, $tooltip = null) {
686 686
     $gen = $prefs->$item;
687 687
     $hom  = (isset($prefs->home) && isset($prefs->home->$item)) ? $prefs->home->$item : "--";
688 688
     $schl = (isset($prefs->school) && isset($prefs->school->$item)) ? $prefs->school->$item : "--";
@@ -694,10 +694,10 @@  discard block
 block discarded – undo
694 694
         echo "<tr>";
695 695
     }
696 696
     echo "<td ".NAME_ATTRS.">$pre</td>";
697
-    row_field($gen,  $type);
698
-    row_field($hom,  $type);
697
+    row_field($gen, $type);
698
+    row_field($hom, $type);
699 699
     row_field($schl, $type);
700
-    row_field($wrk,  $type);
700
+    row_field($wrk, $type);
701 701
     echo "<td align=left>$post</td></tr>\n";
702 702
 }
703 703
 
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
 function row_field($value, $type) {
708 708
     echo "<td>";
709 709
     $type = $value === "--" ? "--" : $type;
710
-    switch($type) {
710
+    switch ($type) {
711 711
     case "yesno":
712
-        echo $value ?tra("yes"):tra("no");
712
+        echo $value ?tra("yes") : tra("no");
713 713
         break;
714 714
     case "noyes":
715
-        echo $value ?tra("no"):tra("yes");
715
+        echo $value ?tra("no") : tra("yes");
716 716
         break;
717 717
     case "limit":
718 718
         $x = max_bytes_display_mode($value);
719
-        $y = "$x " . BYTE_ABBR;
719
+        $y = "$x ".BYTE_ABBR;
720 720
         echo $x ? "$y" : tra("no limit");
721 721
         break;
722 722
     case "minutes":
Please login to merge, or discard this patch.