Passed
Push — master ( 8cb549...a2b61a )
by Vitalii
01:23 queued 21s
created
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.
html/ops/dbinfo.php 3 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
     function __construct($n, $d, $i, $t, $r, $s) {
16 16
         $this->name = $n;
17 17
         $this->data_size = $d;
18
-		$this->index_size = $i;
19
-		$this->total_size = $t;
20
-		$this->rows = $r;
21
-		$this->size_per_row = $s;
18
+        $this->index_size = $i;
19
+        $this->total_size = $t;
20
+        $this->rows = $r;
21
+        $this->size_per_row = $s;
22 22
     }
23 23
     function __destruct() {
24 24
     }
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 
43 43
 // returns formatted data size
44 44
 function size_format($size){
45
-	$retval = 0;
45
+    $retval = 0;
46 46
 
47
-	$KB = 1024;
47
+    $KB = 1024;
48 48
     $MB = 1024*1024;
49 49
     $GB = 1024*1024*1024;
50
-	$TB = 1024*1024*1024*1024;
50
+    $TB = 1024*1024*1024*1024;
51 51
 
52 52
     if ($size < $KB) {
53
-	    $retval = $size;
53
+        $retval = $size;
54 54
     } elseif (($size > $KB) && ($size < $MB)) {
55
-		$retval = sprintf("%.0fK", ($size / $KB));
55
+        $retval = sprintf("%.0fK", ($size / $KB));
56 56
     } elseif ( ($size >= $MB) && ($size < $GB)) {
57
-		$retval = sprintf("%.2fMB", ($size / $MB));
57
+        $retval = sprintf("%.2fMB", ($size / $MB));
58 58
     } elseif ( ($size >= $GB) && ($size < $TB)) {
59
-		$retval = sprintf("%.2fGB", ($size / $GB));
60
-	} elseif ( $size >= $TB ) {
61
-		$retval = sprintf("%.2fTB", ($size / $TB));
62
-	}
63
-	return $retval;
59
+        $retval = sprintf("%.2fGB", ($size / $GB));
60
+    } elseif ( $size >= $TB ) {
61
+        $retval = sprintf("%.2fTB", ($size / $TB));
62
+    }
63
+    return $retval;
64 64
 }
65 65
 
66 66
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     // SQL output
74 74
     // mysql> show table status from [table_name];
75 75
     // | Name | Engine | Version | Row_format | Rows
76
-	// | Avg_row_length | Data_length | Max_data_length
77
-	// | Index_length | Data_free  | Auto_increment | Create_time
78
-	// | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
76
+    // | Avg_row_length | Data_length | Max_data_length
77
+    // | Index_length | Data_free  | Auto_increment | Create_time
78
+    // | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
79 79
     //
80 80
 
81 81
     $gdata  = 0;
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
     $gtotal = 0;
84 84
     $grows  = 0;
85 85
 
86
-	$i = 0;
87
-	$db_rec = array();
88
-	while ($myarr = _mysql_fetch_assoc($result)) {
86
+    $i = 0;
87
+    $db_rec = array();
88
+    while ($myarr = _mysql_fetch_assoc($result)) {
89 89
         if ($myarr['Comment'] == 'VIEW') continue;
90 90
 
91
-		// sum grand totals
92
-		$total  =  $myarr["Data_length"] + $myarr["Index_length"];
93
-		$gindex += $myarr["Index_length"];
91
+        // sum grand totals
92
+        $total  =  $myarr["Data_length"] + $myarr["Index_length"];
93
+        $gindex += $myarr["Index_length"];
94 94
         $gdata  += $myarr["Data_length"];
95
-		$grows  += $myarr["Rows"];
96
-		$gtotal += $total;
95
+        $grows  += $myarr["Rows"];
96
+        $gtotal += $total;
97 97
 
98
-	    $db_rec[$i] = new DB_REC(
98
+        $db_rec[$i] = new DB_REC(
99 99
             $myarr["Name"],
100 100
             $myarr["Data_length"],
101 101
             $myarr["Index_length"],
@@ -103,131 +103,131 @@  discard block
 block discarded – undo
103 103
             $myarr["Rows"],
104 104
             $myarr["Avg_row_length"]
105 105
         );
106
-		$i++;
107
-	}
106
+        $i++;
107
+    }
108 108
     $db_rec[$i] = new DB_REC ("Total", $gdata, $gindex, $gtotal, $grows, "" );
109
-	return $db_rec;
109
+    return $db_rec;
110 110
 }
111 111
 
112 112
 // show the DB structure
113 113
 //
114 114
 function show_db_info($db_name, $db_rec) {
115
-	echo "<table cols=6>";
116
-	echo "<tr>";
117
-	echo "<th colspan=6> Database $db_name </th>";
118
-	echo "</tr>";
119
-
120
-	echo "<tr>";
121
-	echo "<th>Table</th>";
122
-	echo "<th>Data Size</th>";
123
-	echo "<th>Index Size</th>";
124
-	echo "<th>Total Size</th>";
125
-	echo "<th>Total Rows</th>";
126
-	echo "<th>Avg. Size per Row</th>";
127
-	echo "</tr>";
128
-
129
-	for ($i = 0; $i < sizeof($db_rec)-1; $i++){
130
-		echo "<tr>";
131
-		echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>";
132
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size)  . "</td>";
133
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>";
134
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>";
115
+    echo "<table cols=6>";
116
+    echo "<tr>";
117
+    echo "<th colspan=6> Database $db_name </th>";
118
+    echo "</tr>";
119
+
120
+    echo "<tr>";
121
+    echo "<th>Table</th>";
122
+    echo "<th>Data Size</th>";
123
+    echo "<th>Index Size</th>";
124
+    echo "<th>Total Size</th>";
125
+    echo "<th>Total Rows</th>";
126
+    echo "<th>Avg. Size per Row</th>";
127
+    echo "</tr>";
128
+
129
+    for ($i = 0; $i < sizeof($db_rec)-1; $i++){
130
+        echo "<tr>";
131
+        echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>";
132
+        echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size)  . "</td>";
133
+        echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>";
134
+        echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>";
135 135
         echo "<td align=left valign=top class=fieldname>" . number_format($db_rec[$i]->rows)     . "</td>";
136 136
         echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->size_per_row) . "</td>";
137
-		echo "</tr>";
138
-	}
137
+        echo "</tr>";
138
+    }
139 139
 
140
-	// Last record is just a summary
141
-	$i = sizeof($db_rec)-1;
142
-	echo "<tr>";
140
+    // Last record is just a summary
141
+    $i = sizeof($db_rec)-1;
142
+    echo "<tr>";
143 143
     echo "<th align=left>" . $db_rec[$i]->name . "</th>";
144 144
     echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
145 145
     echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
146 146
     echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
147 147
     echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
148 148
     echo "<th align=left></th>";
149
-	echo "</tr>";
149
+    echo "</tr>";
150 150
     echo "</table>";
151 151
 }
152 152
 
153 153
 // same as show_db_info but with sortable columns
154 154
 //
155 155
 function sort_db_info($db_name, $db_rec) {
156
-	$file_list = array();
156
+    $file_list = array();
157 157
     $file_sort = array();
158 158
 
159
-	$sort =  get_str("sort", true);
160
-	$r = get_str("r", true);
161
-
162
-	if (empty($sort)) $sort = "name";
163
-	// check for allowed keys
164
-	if ((strcmp($sort, "name")!=0) &&
165
-		(strcmp($sort, "data_size")!=0) &&
166
-		(strcmp($sort, "index_size")!=0) &&
167
-		(strcmp($sort, "total_size")!=0)  &&
168
-		(strcmp($sort, "rows")!=0) &&
169
-		(strcmp($sort, "size_per_row")!=0)
159
+    $sort =  get_str("sort", true);
160
+    $r = get_str("r", true);
161
+
162
+    if (empty($sort)) $sort = "name";
163
+    // check for allowed keys
164
+    if ((strcmp($sort, "name")!=0) &&
165
+        (strcmp($sort, "data_size")!=0) &&
166
+        (strcmp($sort, "index_size")!=0) &&
167
+        (strcmp($sort, "total_size")!=0)  &&
168
+        (strcmp($sort, "rows")!=0) &&
169
+        (strcmp($sort, "size_per_row")!=0)
170 170
     ) {
171
-		$sort = "name";
171
+        $sort = "name";
172 172
     }
173
-	if (empty($r)) $r=0;
174
-
175
-	for ($i=0; $i < sizeof($db_rec)-1; $i++){
176
-		$file_details["name"]         = $db_rec[$i]->name;
177
-		$file_details["data_size"]    = $db_rec[$i]->data_size;
178
-		$file_details["index_size"]   = $db_rec[$i]->index_size;
179
-		$file_details["total_size"]   = $db_rec[$i]->total_size;
180
-	    $file_details["rows"]         = $db_rec[$i]->rows;
181
-		$file_details["size_per_row"] = $db_rec[$i]->size_per_row;
182
-
183
-		$file_list[$i] = $file_details;
184
-		$key = strtolower($file_details[$sort]);
185
-		$file_sort[$i] = $key;
186
-	}
187
-
188
-	if ($r) {
173
+    if (empty($r)) $r=0;
174
+
175
+    for ($i=0; $i < sizeof($db_rec)-1; $i++){
176
+        $file_details["name"]         = $db_rec[$i]->name;
177
+        $file_details["data_size"]    = $db_rec[$i]->data_size;
178
+        $file_details["index_size"]   = $db_rec[$i]->index_size;
179
+        $file_details["total_size"]   = $db_rec[$i]->total_size;
180
+        $file_details["rows"]         = $db_rec[$i]->rows;
181
+        $file_details["size_per_row"] = $db_rec[$i]->size_per_row;
182
+
183
+        $file_list[$i] = $file_details;
184
+        $key = strtolower($file_details[$sort]);
185
+        $file_sort[$i] = $key;
186
+    }
187
+
188
+    if ($r) {
189 189
         arsort($file_sort);
190 190
     } else {
191 191
         asort($file_sort);
192 192
     }
193 193
 
194
-	echo "<table cols=6>";
195
-	echo "<tr>";
196
-	echo "<th colspan=6> Database $db_name </th>";
197
-	echo "</tr>";
194
+    echo "<table cols=6>";
195
+    echo "<tr>";
196
+    echo "<th colspan=6> Database $db_name </th>";
197
+    echo "</tr>";
198 198
 
199
-	echo "<tr>";
200
-	echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>";
201
-	echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>";
202
-	echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>";
203
-	echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>";
204
-	echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>";
205
-	echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>";
206
-	echo "</tr>";
199
+    echo "<tr>";
200
+    echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>";
201
+    echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>";
202
+    echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>";
203
+    echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>";
204
+    echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>";
205
+    echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>";
206
+    echo "</tr>";
207 207
 
208 208
     foreach ($file_sort as $key=>$value) {
209
-		$value = $file_list[$key];
209
+        $value = $file_list[$key];
210 210
 
211
-		echo "<tr>";
212
-		echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>";
213
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"])  . "</td>";
214
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>";
215
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>";
211
+        echo "<tr>";
212
+        echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>";
213
+        echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"])  . "</td>";
214
+        echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>";
215
+        echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>";
216 216
         echo "<td align=left valign=top class=fieldname>" . number_format($value["rows"])     . "</td>";
217 217
         echo "<td align=left valign=top class=fieldname>" . size_format($value["size_per_row"]) . "</td>";
218
-		echo "</tr>";
219
-	}
218
+        echo "</tr>";
219
+    }
220 220
 
221
-	// Last record is a summary
222
-	$i = sizeof($db_rec)-1;
223
-	echo "<tr>";
221
+    // Last record is a summary
222
+    $i = sizeof($db_rec)-1;
223
+    echo "<tr>";
224 224
     echo "<th align=left>" . $db_rec[$i]->name . "</th>";
225 225
     echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
226 226
     echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
227 227
     echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
228 228
     echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
229 229
     echo "<th align=left></th>";
230
-	echo "</tr>";
230
+    echo "</tr>";
231 231
 
232 232
     echo "</table>";
233 233
 }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 // returns formatted data size
44
-function size_format($size){
44
+function size_format($size) {
45 45
 	$retval = 0;
46 46
 
47 47
 	$KB = 1024;
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
     if ($size < $KB) {
53 53
 	    $retval = $size;
54 54
     } elseif (($size > $KB) && ($size < $MB)) {
55
-		$retval = sprintf("%.0fK", ($size / $KB));
56
-    } elseif ( ($size >= $MB) && ($size < $GB)) {
57
-		$retval = sprintf("%.2fMB", ($size / $MB));
58
-    } elseif ( ($size >= $GB) && ($size < $TB)) {
59
-		$retval = sprintf("%.2fGB", ($size / $GB));
60
-	} elseif ( $size >= $TB ) {
61
-		$retval = sprintf("%.2fTB", ($size / $TB));
55
+		$retval = sprintf("%.0fK", ($size/$KB));
56
+    } elseif (($size >= $MB) && ($size < $GB)) {
57
+		$retval = sprintf("%.2fMB", ($size/$MB));
58
+    } elseif (($size >= $GB) && ($size < $TB)) {
59
+		$retval = sprintf("%.2fGB", ($size/$GB));
60
+	} elseif ($size >= $TB) {
61
+		$retval = sprintf("%.2fTB", ($size/$TB));
62 62
 	}
63 63
 	return $retval;
64 64
 }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
         if ($myarr['Comment'] == 'VIEW') continue;
90 90
 
91 91
 		// sum grand totals
92
-		$total  =  $myarr["Data_length"] + $myarr["Index_length"];
92
+		$total = $myarr["Data_length"] + $myarr["Index_length"];
93 93
 		$gindex += $myarr["Index_length"];
94
-        $gdata  += $myarr["Data_length"];
94
+        $gdata += $myarr["Data_length"];
95 95
 		$grows  += $myarr["Rows"];
96 96
 		$gtotal += $total;
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         );
106 106
 		$i++;
107 107
 	}
108
-    $db_rec[$i] = new DB_REC ("Total", $gdata, $gindex, $gtotal, $grows, "" );
108
+    $db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, "");
109 109
 	return $db_rec;
110 110
 }
111 111
 
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
 	echo "<th>Avg. Size per Row</th>";
127 127
 	echo "</tr>";
128 128
 
129
-	for ($i = 0; $i < sizeof($db_rec)-1; $i++){
129
+	for ($i = 0; $i < sizeof($db_rec) - 1; $i++) {
130 130
 		echo "<tr>";
131
-		echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>";
132
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size)  . "</td>";
133
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>";
134
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>";
135
-        echo "<td align=left valign=top class=fieldname>" . number_format($db_rec[$i]->rows)     . "</td>";
136
-        echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->size_per_row) . "</td>";
131
+		echo "<td align=left valign=top class=fieldname>".$db_rec[$i]->name."</td>";
132
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->data_size)."</td>";
133
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->index_size)."</td>";
134
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->total_size)."</td>";
135
+        echo "<td align=left valign=top class=fieldname>".number_format($db_rec[$i]->rows)."</td>";
136
+        echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->size_per_row)."</td>";
137 137
 		echo "</tr>";
138 138
 	}
139 139
 
140 140
 	// Last record is just a summary
141
-	$i = sizeof($db_rec)-1;
141
+	$i = sizeof($db_rec) - 1;
142 142
 	echo "<tr>";
143
-    echo "<th align=left>" . $db_rec[$i]->name . "</th>";
144
-    echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
145
-    echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
146
-    echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
147
-    echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
143
+    echo "<th align=left>".$db_rec[$i]->name."</th>";
144
+    echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>";
145
+    echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>";
146
+    echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>";
147
+    echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>";
148 148
     echo "<th align=left></th>";
149 149
 	echo "</tr>";
150 150
     echo "</table>";
@@ -156,28 +156,28 @@  discard block
 block discarded – undo
156 156
 	$file_list = array();
157 157
     $file_sort = array();
158 158
 
159
-	$sort =  get_str("sort", true);
159
+	$sort = get_str("sort", true);
160 160
 	$r = get_str("r", true);
161 161
 
162 162
 	if (empty($sort)) $sort = "name";
163 163
 	// check for allowed keys
164
-	if ((strcmp($sort, "name")!=0) &&
165
-		(strcmp($sort, "data_size")!=0) &&
166
-		(strcmp($sort, "index_size")!=0) &&
167
-		(strcmp($sort, "total_size")!=0)  &&
168
-		(strcmp($sort, "rows")!=0) &&
169
-		(strcmp($sort, "size_per_row")!=0)
164
+	if ((strcmp($sort, "name") != 0) &&
165
+		(strcmp($sort, "data_size") != 0) &&
166
+		(strcmp($sort, "index_size") != 0) &&
167
+		(strcmp($sort, "total_size") != 0) &&
168
+		(strcmp($sort, "rows") != 0) &&
169
+		(strcmp($sort, "size_per_row") != 0)
170 170
     ) {
171 171
 		$sort = "name";
172 172
     }
173
-	if (empty($r)) $r=0;
173
+	if (empty($r)) $r = 0;
174 174
 
175
-	for ($i=0; $i < sizeof($db_rec)-1; $i++){
175
+	for ($i = 0; $i < sizeof($db_rec) - 1; $i++) {
176 176
 		$file_details["name"]         = $db_rec[$i]->name;
177 177
 		$file_details["data_size"]    = $db_rec[$i]->data_size;
178 178
 		$file_details["index_size"]   = $db_rec[$i]->index_size;
179 179
 		$file_details["total_size"]   = $db_rec[$i]->total_size;
180
-	    $file_details["rows"]         = $db_rec[$i]->rows;
180
+	    $file_details["rows"] = $db_rec[$i]->rows;
181 181
 		$file_details["size_per_row"] = $db_rec[$i]->size_per_row;
182 182
 
183 183
 		$file_list[$i] = $file_details;
@@ -197,35 +197,35 @@  discard block
 block discarded – undo
197 197
 	echo "</tr>";
198 198
 
199 199
 	echo "<tr>";
200
-	echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>";
201
-	echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>";
202
-	echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>";
203
-	echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>";
204
-	echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>";
205
-	echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>";
200
+	echo "<th><a href='dbinfo.php?sort=name&r=".(!$r)."'>Table </a></th>";
201
+	echo "<th><a href='dbinfo.php?sort=data_size&r=".(!$r)."'>Data Size</a></th>";
202
+	echo "<th><a href='dbinfo.php?sort=index_size&r=".(!$r)."'>Index Size</a></th>";
203
+	echo "<th><a href='dbinfo.php?sort=total_size&r=".(!$r)."'>Total Size</a></th>";
204
+	echo "<th><a href='dbinfo.php?sort=rows&r=".(!$r)."'>Total Rows</a></th>";
205
+	echo "<th><a href='dbinfo.php?sort=size_per_row&r=".(!$r)."'>Avg. Size per Row</a></th>";
206 206
 	echo "</tr>";
207 207
 
208 208
     foreach ($file_sort as $key=>$value) {
209 209
 		$value = $file_list[$key];
210 210
 
211 211
 		echo "<tr>";
212
-		echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>";
213
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"])  . "</td>";
214
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>";
215
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>";
216
-        echo "<td align=left valign=top class=fieldname>" . number_format($value["rows"])     . "</td>";
217
-        echo "<td align=left valign=top class=fieldname>" . size_format($value["size_per_row"]) . "</td>";
212
+		echo "<td align=left valign=top class=fieldname>".$value["name"]."</td>";
213
+		echo "<td align=left valign=top class=fieldname>".size_format($value["data_size"])."</td>";
214
+		echo "<td align=left valign=top class=fieldname>".size_format($value["index_size"])."</td>";
215
+		echo "<td align=left valign=top class=fieldname>".size_format($value["total_size"])."</td>";
216
+        echo "<td align=left valign=top class=fieldname>".number_format($value["rows"])."</td>";
217
+        echo "<td align=left valign=top class=fieldname>".size_format($value["size_per_row"])."</td>";
218 218
 		echo "</tr>";
219 219
 	}
220 220
 
221 221
 	// Last record is a summary
222
-	$i = sizeof($db_rec)-1;
222
+	$i = sizeof($db_rec) - 1;
223 223
 	echo "<tr>";
224
-    echo "<th align=left>" . $db_rec[$i]->name . "</th>";
225
-    echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
226
-    echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
227
-    echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
228
-    echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
224
+    echo "<th align=left>".$db_rec[$i]->name."</th>";
225
+    echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>";
226
+    echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>";
227
+    echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>";
228
+    echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>";
229 229
     echo "<th align=left></th>";
230 230
 	echo "</tr>";
231 231
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 // returns formatted data size
44
-function size_format($size){
44
+function size_format($size) {
45 45
 	$retval = 0;
46 46
 
47 47
 	$KB = 1024;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	echo "<th>Avg. Size per Row</th>";
127 127
 	echo "</tr>";
128 128
 
129
-	for ($i = 0; $i < sizeof($db_rec)-1; $i++){
129
+	for ($i = 0; $i < sizeof($db_rec)-1; $i++) {
130 130
 		echo "<tr>";
131 131
 		echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>";
132 132
 		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size)  . "</td>";
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     }
173 173
 	if (empty($r)) $r=0;
174 174
 
175
-	for ($i=0; $i < sizeof($db_rec)-1; $i++){
175
+	for ($i=0; $i < sizeof($db_rec)-1; $i++) {
176 176
 		$file_details["name"]         = $db_rec[$i]->name;
177 177
 		$file_details["data_size"]    = $db_rec[$i]->data_size;
178 178
 		$file_details["index_size"]   = $db_rec[$i]->index_size;
Please login to merge, or discard this patch.
html/inc/prefs_project.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 if ($app_types->cpu) {
72
-    $project_pref_descs[] = new PREF_BOOL (
72
+    $project_pref_descs[] = new PREF_BOOL(
73 73
         tra("Use CPU"),
74 74
         "Request CPU-only tasks from this project.",
75 75
         "no_cpu",
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     );
79 79
 }
80 80
 if ($app_types->ati) {
81
-    $project_pref_descs[] = new PREF_BOOL (
81
+    $project_pref_descs[] = new PREF_BOOL(
82 82
         tra("Use AMD GPU"),
83 83
         "Request AMD GPU tasks from this project.",
84 84
         "no_ati",
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     );
88 88
 }
89 89
 if ($app_types->cuda) {
90
-    $project_pref_descs[] = new PREF_BOOL (
90
+    $project_pref_descs[] = new PREF_BOOL(
91 91
         tra("Use NVIDIA GPU"),
92 92
         "Request NVIDIA GPU tasks from this project.",
93 93
         "no_cuda",
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     );
97 97
 }
98 98
 if ($app_types->intel_gpu) {
99
-    $project_pref_descs[] = new PREF_BOOL (
99
+    $project_pref_descs[] = new PREF_BOOL(
100 100
         tra("Use Intel GPU"),
101 101
         "Request Intel GPU tasks from this project.",
102 102
         "no_intel_gpu",
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     );
106 106
 }
107 107
 if ($app_types->apple_gpu) {
108
-    $project_pref_descs[] = new PREF_BOOL (
108
+    $project_pref_descs[] = new PREF_BOOL(
109 109
         tra("Use Apple GPU"),
110 110
         "Request Apple GPU tasks from this project.",
111 111
         "no_apple_gpu",
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $x = "";
131 131
 }
132 132
 
133
-$privacy_pref_descs = array (
133
+$privacy_pref_descs = array(
134 134
     new PREF_BOOL(
135 135
         tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x,
136 136
         "",
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     global $in_project_specific;
179 179
     global $venue_name;
180 180
 
181
-    switch($name) {
181
+    switch ($name) {
182 182
     case "venue":
183 183
         $venue_name = $attrs["name"];
184 184
         $top_parse_result = $parse_result;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         break;
191 191
     default:
192 192
         if ($in_project_specific) {
193
-            $text= $text."<$name>";
193
+            $text = $text."<$name>";
194 194
         } else {
195 195
             $text = "";
196 196
         }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
     global $venue_name;
206 206
     global $project_pref_descs;
207 207
 
208
-    foreach($project_pref_descs as $p) {
208
+    foreach ($project_pref_descs as $p) {
209 209
         if ($p->xml_parse($parse_result, $name, $text)) {
210 210
             return;
211 211
         }
212 212
     }
213
-    switch($name) {
213
+    switch ($name) {
214 214
     case "venue":
215 215
         $top_parse_result->$venue_name = $parse_result;
216 216
         $parse_result = $top_parse_result;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     return $parse_result;
255 255
 }
256 256
 
257
-function prefs_show_project($prefs, $columns=false) {
257
+function prefs_show_project($prefs, $columns = false) {
258 258
     global $project_pref_descs;
259 259
     if ($columns) {
260 260
         foreach ($project_pref_descs as $p) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-function prefs_show_project_specific($prefs, $columns=false) {
296
+function prefs_show_project_specific($prefs, $columns = false) {
297 297
     if ($columns) {
298 298
         $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific);
299 299
         $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : "";
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
     project_specific_prefs_show($project_specific_prefs, $columns);
306 306
 }
307 307
 
308
-function print_prefs_display_project($user, $columns=false) {
308
+function print_prefs_display_project($user, $columns = false) {
309 309
     $project_prefs = prefs_parse_project($user->project_prefs);
310 310
 
311
-    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
311
+    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>";
312 312
     if ($columns) {
313 313
         start_table();
314 314
         row_heading(tra("Combined preferences").$switch_link);
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
     }
360 360
 }
361 361
 
362
-function prefs_form_project($prefs, $error=false) {
362
+function prefs_form_project($prefs, $error = false) {
363 363
     global $project_pref_descs;
364 364
     foreach ($project_pref_descs as $p) {
365 365
         $p->show_form_row($prefs, $error);
366 366
     }
367 367
 }
368 368
 
369
-function prefs_form_project_specific($prefs_xml, $error=false) {
369
+function prefs_form_project_specific($prefs_xml, $error = false) {
370 370
     $prefs = project_specific_prefs_parse($prefs_xml);
371 371
     project_specific_prefs_edit($prefs, $error);
372 372
 }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 // given a prefs structure, return the corresponding XML string
416 416
 //
417
-function project_prefs_make_xml($prefs, $primary=true) {
417
+function project_prefs_make_xml($prefs, $primary = true) {
418 418
     global $project_pref_descs;
419 419
     $xml = "";
420 420
     if ($primary) {
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 //
450 450
 function project_prefs_update(&$user, $prefs) {
451 451
     $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs));
452
-    $send_email = $user->send_email?1:0;
453
-    $show_hosts = $user->show_hosts?1:0;
452
+    $send_email = $user->send_email ? 1 : 0;
453
+    $show_hosts = $user->show_hosts ? 1 : 0;
454 454
     $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts");
455 455
     if (!$retval) {
456 456
         return 1;
Please login to merge, or discard this patch.
html/inc/common_defs.inc 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -27,74 +27,74 @@
 block discarded – undo
27 27
 define('BATCH_STATE_RETIRED', 4);
28 28
 
29 29
 define('ANON_PLATFORM_UNKNOWN', -1);
30
-define('ANON_PLATFORM_CPU',     -2);
31
-define('ANON_PLATFORM_NVIDIA',  -3);
32
-define('ANON_PLATFORM_ATI',     -4);
33
-define('ANON_PLATFORM_INTEL_GPU',   -5);
34
-define('ANON_PLATFORM_APPLE_GPU',   -6);
30
+define('ANON_PLATFORM_CPU', -2);
31
+define('ANON_PLATFORM_NVIDIA', -3);
32
+define('ANON_PLATFORM_ATI', -4);
33
+define('ANON_PLATFORM_INTEL_GPU', -5);
34
+define('ANON_PLATFORM_APPLE_GPU', -6);
35 35
 
36
-define('RESULT_SERVER_STATE_INACTIVE',       1);
37
-define('RESULT_SERVER_STATE_UNSENT',         2);
38
-define('RESULT_SERVER_STATE_IN_PROGRESS',    4);
39
-define('RESULT_SERVER_STATE_OVER',           5);
36
+define('RESULT_SERVER_STATE_INACTIVE', 1);
37
+define('RESULT_SERVER_STATE_UNSENT', 2);
38
+define('RESULT_SERVER_STATE_IN_PROGRESS', 4);
39
+define('RESULT_SERVER_STATE_OVER', 5);
40 40
 
41
-define('RESULT_OUTCOME_INIT',             0);
42
-define('RESULT_OUTCOME_SUCCESS',          1);
43
-define('RESULT_OUTCOME_COULDNT_SEND',     2);
44
-define('RESULT_OUTCOME_CLIENT_ERROR',     3);
45
-define('RESULT_OUTCOME_NO_REPLY',         4);
46
-define('RESULT_OUTCOME_DIDNT_NEED',       5);
47
-define('RESULT_OUTCOME_VALIDATE_ERROR',   6);
48
-define('RESULT_OUTCOME_CLIENT_DETACHED',  7);
41
+define('RESULT_OUTCOME_INIT', 0);
42
+define('RESULT_OUTCOME_SUCCESS', 1);
43
+define('RESULT_OUTCOME_COULDNT_SEND', 2);
44
+define('RESULT_OUTCOME_CLIENT_ERROR', 3);
45
+define('RESULT_OUTCOME_NO_REPLY', 4);
46
+define('RESULT_OUTCOME_DIDNT_NEED', 5);
47
+define('RESULT_OUTCOME_VALIDATE_ERROR', 6);
48
+define('RESULT_OUTCOME_CLIENT_DETACHED', 7);
49 49
 
50
-define('VALIDATE_STATE_INIT',        0);
51
-define('VALIDATE_STATE_VALID',       1);
52
-define('VALIDATE_STATE_INVALID',     2);
53
-define('VALIDATE_STATE_NO_CHECK',    3);
54
-define('VALIDATE_STATE_INCONCLUSIVE',4);
55
-define('VALIDATE_STATE_TOO_LATE',    5);
50
+define('VALIDATE_STATE_INIT', 0);
51
+define('VALIDATE_STATE_VALID', 1);
52
+define('VALIDATE_STATE_INVALID', 2);
53
+define('VALIDATE_STATE_NO_CHECK', 3);
54
+define('VALIDATE_STATE_INCONCLUSIVE', 4);
55
+define('VALIDATE_STATE_TOO_LATE', 5);
56 56
 
57
-define('WU_ERROR_COULDNT_SEND_RESULT',           1);
58
-define('WU_ERROR_TOO_MANY_ERROR_RESULTS',        2);
59
-define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS',      4);
60
-define('WU_ERROR_TOO_MANY_TOTAL_RESULTS',        8);
61
-define('WU_ERROR_CANCELLED',                     16);
62
-define('WU_ERROR_NO_CANONICAL_RESULT',           32);
57
+define('WU_ERROR_COULDNT_SEND_RESULT', 1);
58
+define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2);
59
+define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4);
60
+define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8);
61
+define('WU_ERROR_CANCELLED', 16);
62
+define('WU_ERROR_NO_CANONICAL_RESULT', 32);
63 63
 
64
-define('FILE_DELETE_INIT',       0);
65
-define('FILE_DELETE_READY',      1);
66
-define('FILE_DELETE_DONE',       2);
67
-define('FILE_DELETE_ERROR',      3);
64
+define('FILE_DELETE_INIT', 0);
65
+define('FILE_DELETE_READY', 1);
66
+define('FILE_DELETE_DONE', 2);
67
+define('FILE_DELETE_ERROR', 3);
68 68
 
69
-define('ASSIMILATE_INIT',       0);
70
-define('ASSIMILATE_READY',      1);
71
-define('ASSIMILATE_DONE',       2);
69
+define('ASSIMILATE_INIT', 0);
70
+define('ASSIMILATE_READY', 1);
71
+define('ASSIMILATE_DONE', 2);
72 72
 
73 73
 // from lib/common_defs.h
74 74
 //
75
-define('RESULT_NEW',                 0);
76
-define('RESULT_FILES_DOWNLOADING',   1);
77
-define('RESULT_FILES_DOWNLOADED',    2);
78
-define('RESULT_COMPUTE_ERROR',       3);
79
-define('RESULT_FILES_UPLOADING',     4);
80
-define('RESULT_FILES_UPLOADED',      5);
81
-define('RESULT_ABORTED',             6);
82
-define('RESULT_UPLOAD_FAILED',       7);
75
+define('RESULT_NEW', 0);
76
+define('RESULT_FILES_DOWNLOADING', 1);
77
+define('RESULT_FILES_DOWNLOADED', 2);
78
+define('RESULT_COMPUTE_ERROR', 3);
79
+define('RESULT_FILES_UPLOADING', 4);
80
+define('RESULT_FILES_UPLOADED', 5);
81
+define('RESULT_ABORTED', 6);
82
+define('RESULT_UPLOAD_FAILED', 7);
83 83
 
84 84
 // from lib/error_numbers.h
85 85
 // returned by some web RPCs
86 86
 //
87
-define('ERR_XML_PARSE',               -112);
88
-define('ERR_DB_NOT_FOUND',            -136);
89
-define('ERR_DB_NOT_UNIQUE',           -137);
90
-define('ERR_DB_CANT_CONNECT',         -138);
91
-define('ERR_PROJECT_DOWN',            -183);
92
-define('ERR_BAD_USER_NAME',           -188);
93
-define('ERR_NO_OPTION',               -191);
94
-define('ERR_BAD_EMAIL_ADDR',          -205);
95
-define('ERR_BAD_PASSWD',              -206);
96
-define('ERR_ACCT_CREATION_DISABLED',  -208);
97
-define('ERR_ATTACH_FAIL_INIT',        -209);
98
-define('ERR_ATTACH_FAIL_DOWNLOAD',    -210);
99
-define('ERR_ACCT_REQUIRE_CONSENT',    -242);
87
+define('ERR_XML_PARSE', -112);
88
+define('ERR_DB_NOT_FOUND', -136);
89
+define('ERR_DB_NOT_UNIQUE', -137);
90
+define('ERR_DB_CANT_CONNECT', -138);
91
+define('ERR_PROJECT_DOWN', -183);
92
+define('ERR_BAD_USER_NAME', -188);
93
+define('ERR_NO_OPTION', -191);
94
+define('ERR_BAD_EMAIL_ADDR', -205);
95
+define('ERR_BAD_PASSWD', -206);
96
+define('ERR_ACCT_CREATION_DISABLED', -208);
97
+define('ERR_ATTACH_FAIL_INIT', -209);
98
+define('ERR_ATTACH_FAIL_DOWNLOAD', -210);
99
+define('ERR_ACCT_REQUIRE_CONSENT', -242);
100 100
 ?>
Please login to merge, or discard this patch.
html/user/gpu_ratios.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,26 +34,26 @@
 block discarded – undo
34 34
 $intel_gpu_credit_sum = 0;
35 35
 $apple_gpu_scale_sum = 0;
36 36
 $apple_gpu_credit_sum = 0;
37
-$total_credit_sum= 0;
37
+$total_credit_sum = 0;
38 38
 
39 39
 $apps = BoincApp::enum("deprecated=0");
40 40
 foreach ($apps as $app) {
41 41
     $avs = BoincAppVersion::enum("appid=$app->id and deprecated=0");
42 42
     foreach ($avs as $av) {
43 43
         if (strstr($av->plan_class, "ati")) {
44
-            $ati_scale_sum += $av->pfc_scale * $av->expavg_credit;
44
+            $ati_scale_sum += $av->pfc_scale*$av->expavg_credit;
45 45
             $ati_credit_sum += $av->expavg_credit;
46 46
         } else if (strstr($av->plan_class, "nvidia") || strstr($av->plan_class, "cuda")) {
47
-            $nvidia_scale_sum += $av->pfc_scale * $av->expavg_credit;
47
+            $nvidia_scale_sum += $av->pfc_scale*$av->expavg_credit;
48 48
             $nvidia_credit_sum += $av->expavg_credit;
49 49
         } else if (strstr($av->plan_class, "intel_gpu")) {
50
-            $intel_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
50
+            $intel_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
51 51
             $intel_gpu_credit_sum += $av->expavg_credit;
52 52
         } else if (strstr($av->plan_class, "apple_gpu")) {
53
-            $apple_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
53
+            $apple_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
54 54
             $apple_gpu_credit_sum += $av->expavg_credit;
55 55
         } else {
56
-            $cpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
56
+            $cpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
57 57
             $cpu_credit_sum += $av->expavg_credit;
58 58
         }
59 59
         $total_credit_sum += $av->expavg_credit;
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'));
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     row2("Created", date_str($team->create_time));
97 97
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
         $founder = $team->founder;
99
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
99
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
100 100
     }
101 101
     if (strlen($team->url)) {;
102 102
         if (strstr($team->url, "http://")) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     row1(tra('Members'));
171 171
     row2(tra('Founder'),
172
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
172
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
173 173
     );
174 174
     if (count($team->admins)) {
175 175
         $first = true;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     foreach ($deltas as $delta) {
357 357
         $u = BoincUser::lookup_id($delta->userid);
358 358
         if ($u->teamid == $teamid) {
359
-            $new_members[] = $u->id;  // they might have later quit
359
+            $new_members[] = $u->id; // they might have later quit
360 360
         }
361 361
     }
362 362
     return array_unique($new_members);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     if (!$user->teamid) return;
440 440
     $user->update("teamid=0");
441 441
     $team = BoincTeam::lookup_id($user->teamid);
442
-    if ($team && $team->ping_user==$user->id) {
442
+    if ($team && $team->ping_user == $user->id) {
443 443
         $team->update("ping_user=-ping_user");
444 444
     }
445 445
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
     start_table();
479 479
     row2(tra('Team name, text version').'
480 480
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
481
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
481
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
482 482
     );
483 483
     row2(tra('Team name, HTML version').'
484 484
         <br><p class=\"text-muted\">
485 485
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
486 486
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
487
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
487
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
488 488
     );
489 489
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
490 490
         '.tra('This URL will be linked to from the team\'s page on this site.'),
491
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
491
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
492 492
     );
493 493
     row2(tra('Description of team').':
494 494
         <br><p class=\"text-muted\">
495 495
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
496 496
         </p>',
497
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
497
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
498 498
     );
499 499
 
500
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
500
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
501 501
 
502 502
     row2_init(tra('Country'));
503 503
     echo '<select class="form-control" name="country">';
504
-    echo country_select_options($team?$team->country:null);
504
+    echo country_select_options($team ? $team->country : null);
505 505
     echo "</select></td></tr>\n";
506 506
 
507
-    $x = (!$team || $team->joinable)?"checked":"";
507
+    $x = (!$team || $team->joinable) ? "checked" : "";
508 508
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
509 509
     // Check if we're using reCaptcha to prevent spam accounts
510 510
     //
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 //
569 569
 function new_transfer_request_ok($team, $now) {
570 570
     if ($team->ping_user <= 0) {
571
-        if ($team->ping_time < $now - 60 * 86400) {
571
+        if ($team->ping_time < $now - 60*86400) {
572 572
             return true;
573 573
         }
574 574
         return false;
575 575
     }
576
-    if ($team->ping_time < $now - 90 * 86400) {
576
+    if ($team->ping_time < $now - 90*86400) {
577 577
         return true;
578 578
     }
579 579
     return false;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     if (!is_valid_country($country)) {
609 609
         $country = tra('None');
610 610
     }
611
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
611
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
612 612
 
613 613
     $clause = sprintf(
614 614
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
@@ -631,6 +631,6 @@  discard block
 block discarded – undo
631 631
     }
632 632
 }
633 633
 
634
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
634
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
635 635
 
636 636
 ?>
Please login to merge, or discard this patch.