@@ -15,10 +15,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -41,7 +41,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -41,7 +41,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -27,74 +27,74 @@ |
||
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 | ?> |
@@ -34,26 +34,26 @@ |
||
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; |
@@ -242,7 +242,7 @@ |
||
242 | 242 | $users = BoincUser::enum( |
243 | 243 | sprintf("name like '%s%%'", $new_name) |
244 | 244 | ); |
245 | - foreach ($users as $u){ |
|
245 | + foreach ($users as $u) { |
|
246 | 246 | echo "<p>$u->name\n"; |
247 | 247 | } |
248 | 248 | page_tail(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | function check_passwd_ui($user, $passwd) { |
59 | 59 | $passwd_hash = md5($passwd.$user->email_addr); |
60 | - if(!check_passwd_hash($user, $passwd_hash)) { |
|
60 | + if (!check_passwd_hash($user, $passwd_hash)) { |
|
61 | 61 | sleep(LOGIN_FAIL_SLEEP_SEC); |
62 | 62 | page_head("Password incorrect"); |
63 | 63 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | function is_banned_email_addr($email_addr) { |
70 | 70 | global $banned_email_domains; |
71 | 71 | if (isset($banned_email_domains)) { |
72 | - foreach($banned_email_domains as $d) { |
|
72 | + foreach ($banned_email_domains as $d) { |
|
73 | 73 | $x = strstr($email_addr, $d); |
74 | 74 | if ($x == $d) return true; |
75 | 75 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // |
109 | 109 | function make_user( |
110 | 110 | $email_addr, $name, $passwd_hash, |
111 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
111 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
112 | 112 | ) { |
113 | 113 | if (!is_valid_email_syntax($email_addr)) return null; |
114 | 114 | // caller generally has already checked |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $users = BoincUser::enum( |
244 | 244 | sprintf("name like '%s%%'", $new_name) |
245 | 245 | ); |
246 | - foreach ($users as $u){ |
|
246 | + foreach ($users as $u) { |
|
247 | 247 | echo "<p>$u->name\n"; |
248 | 248 | } |
249 | 249 | page_tail(); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | show_error(tra("Passwords may only include ASCII characters.")); |
279 | 279 | } |
280 | 280 | |
281 | - if (strlen($passwd)<$min_passwd_length) { |
|
281 | + if (strlen($passwd) < $min_passwd_length) { |
|
282 | 282 | show_error( |
283 | 283 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
284 | 284 | ); |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | |
194 | 194 | // Check if consent to terms of use has been given. |
195 | 195 | // |
196 | - $myconsent = FALSE; |
|
196 | + $myconsent = false; |
|
197 | 197 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
198 | 198 | if ($checkct and check_termsofuse()) { |
199 | 199 | $agree = post_str("agree_to_terms_of_use", true); |
200 | 200 | if (!$agree) { |
201 | 201 | error_page(tra("You have not agreed to our terms of use. Please agree to the terms of use by navigating back to the previous page, in order to create your account")); |
202 | 202 | } |
203 | - $myconsent = TRUE; |
|
203 | + $myconsent = true; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | // see whether the new account should be pre-enrolled in a team, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $team = BoincTeam::lookup_id($teamid); |
212 | 212 | $clone_user = BoincUser::lookup_id($team->userid); |
213 | 213 | if (!$clone_user) { |
214 | - error_page("User $team->userid not found"); |
|
214 | + error_page("user $team->userid not found"); |
|
215 | 215 | } |
216 | 216 | $project_prefs = $clone_user->project_prefs; |
217 | 217 | } else { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | BoincForumPrefs::lookup($user); |
31 | 31 | |
32 | -if (post_str("action", true)=="reset_confirm"){ |
|
32 | +if (post_str("action", true) == "reset_confirm") { |
|
33 | 33 | page_head(tra("Confirm reset")); |
34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // If the user has requested a reset of preferences; |
46 | 46 | // preserve a few fields. |
47 | 47 | // |
48 | -if (post_str("action", true)=="reset"){ |
|
48 | +if (post_str("action", true) == "reset") { |
|
49 | 49 | $posts = $user->prefs->posts; |
50 | 50 | $last_post = $user->prefs->last_post; |
51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -67,30 +67,30 @@ discard block |
||
67 | 67 | if (!DISABLE_FORUMS) { |
68 | 68 | |
69 | 69 | $avatar_type = post_int("avatar_select"); |
70 | -$newfile=IMAGE_PATH.$user->id."_avatar.jpg"; |
|
70 | +$newfile = IMAGE_PATH.$user->id."_avatar.jpg"; |
|
71 | 71 | |
72 | 72 | // Update the user avatar |
73 | -if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
|
74 | -if ($avatar_type==0){ |
|
75 | - if (file_exists($newfile)){ |
|
73 | +if ($avatar_type < 0 or $avatar_type > 3) $avatar_type = 0; |
|
74 | +if ($avatar_type == 0) { |
|
75 | + if (file_exists($newfile)) { |
|
76 | 76 | // Delete the file on the server if the user |
77 | 77 | // decides not to use an avatar |
78 | 78 | // |
79 | 79 | unlink($newfile); |
80 | 80 | } |
81 | - $avatar_url=""; |
|
81 | + $avatar_url = ""; |
|
82 | 82 | } elseif ($avatar_type == 1) { |
83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
84 | -} elseif ($avatar_type==2){ |
|
85 | - if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
|
86 | - if ($_FILES['picture']['tmp_name']!="") { |
|
84 | +} elseif ($avatar_type == 2) { |
|
85 | + if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name'] != "")) { |
|
86 | + if ($_FILES['picture']['tmp_name'] != "") { |
|
87 | 87 | $file = $_FILES['picture']['tmp_name']; |
88 | 88 | } else { |
89 | 89 | // Remote image. Download and store locally |
90 | 90 | $file = post_str("avatar_url"); |
91 | 91 | } |
92 | 92 | $size = getImageSize($file); |
93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
93 | + if ($size[2] != 2 and $size[2] != 3) { |
|
94 | 94 | //Not the right kind of file |
95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
96 | 96 | } |
@@ -99,30 +99,30 @@ discard block |
||
99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
100 | 100 | ImageJPEG($image2, $newfile); |
101 | 101 | } |
102 | - if (file_exists($newfile)){ |
|
103 | - $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
|
102 | + if (file_exists($newfile)) { |
|
103 | + $avatar_url = IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
|
104 | 104 | } else { |
105 | 105 | //User didn't upload a compatible file or it went lost on the server |
106 | - $avatar_url=""; |
|
106 | + $avatar_url = ""; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"]!="")?1:0; |
|
111 | -$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"]!="")?1:0; |
|
112 | -$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"]!="")?1:0; |
|
113 | -$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"]!="")?1:0; |
|
114 | -$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"]!="")?1:0; |
|
115 | -$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"]!="")?1:0; |
|
116 | -$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"]!="")?1:0; |
|
117 | -$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"]!="")?0:1; |
|
110 | +$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"] != "") ? 1 : 0; |
|
111 | +$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"] != "") ? 1 : 0; |
|
112 | +$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"] != "") ? 1 : 0; |
|
113 | +$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"] != "") ? 1 : 0; |
|
114 | +$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"] != "") ? 1 : 0; |
|
115 | +$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"] != "") ? 1 : 0; |
|
116 | +$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"] != "") ? 1 : 0; |
|
117 | +$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"] != "") ? 0 : 1; |
|
118 | 118 | $signature = post_str("signature", true); |
119 | -if (strlen($signature)>250) { |
|
119 | +if (strlen($signature) > 250) { |
|
120 | 120 | error_page(tra("Your signature was too long, please keep it less than 250 characters.")); |
121 | 121 | } |
122 | 122 | $forum_sort = post_int("forum_sort"); |
123 | 123 | $thread_sort = post_int("thread_sort"); |
124 | 124 | $display_wrap_postcount = post_int("forum_display_wrap_postcount"); |
125 | -if ($display_wrap_postcount<1) $display_wrap_postcount=1; |
|
125 | +if ($display_wrap_postcount < 1) $display_wrap_postcount = 1; |
|
126 | 126 | |
127 | 127 | $signature = BoincDb::escape_string($signature); |
128 | 128 | |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | } |
142 | 142 | } else { |
143 | 143 | // todo: clean up the following |
144 | - $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
|
145 | - if ($add_user_to_filter){ |
|
144 | + $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"] != ""); |
|
145 | + if ($add_user_to_filter) { |
|
146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
147 | + if ($user_to_add != "" and $user_to_add == strval(intval($user_to_add))) { |
|
148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
149 | 149 | if (!$other_user) { |
150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // |
160 | 160 | $ignored_users = get_ignored_list($user); |
161 | 161 | // todo: use foreach |
162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
162 | +for ($i = 0; $i < sizeof($ignored_users); $i++) { |
|
163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
164 | + if (isset($_POST[$remove]) && $_POST[$remove] != "") { |
|
165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
166 | 166 | if (!$other_user) { |
167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | BoincForumPrefs::lookup($user); |
31 | 31 | |
32 | -if (post_str("action", true)=="reset_confirm"){ |
|
32 | +if (post_str("action", true)=="reset_confirm") { |
|
33 | 33 | page_head(tra("Confirm reset")); |
34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // If the user has requested a reset of preferences; |
46 | 46 | // preserve a few fields. |
47 | 47 | // |
48 | -if (post_str("action", true)=="reset"){ |
|
48 | +if (post_str("action", true)=="reset") { |
|
49 | 49 | $posts = $user->prefs->posts; |
50 | 50 | $last_post = $user->prefs->last_post; |
51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | |
72 | 72 | // Update the user avatar |
73 | 73 | if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
74 | -if ($avatar_type==0){ |
|
75 | - if (file_exists($newfile)){ |
|
74 | +if ($avatar_type==0) { |
|
75 | + if (file_exists($newfile)) { |
|
76 | 76 | // Delete the file on the server if the user |
77 | 77 | // decides not to use an avatar |
78 | 78 | // |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $avatar_url=""; |
82 | 82 | } elseif ($avatar_type == 1) { |
83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
84 | -} elseif ($avatar_type==2){ |
|
84 | +} elseif ($avatar_type==2) { |
|
85 | 85 | if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
86 | 86 | if ($_FILES['picture']['tmp_name']!="") { |
87 | 87 | $file = $_FILES['picture']['tmp_name']; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $file = post_str("avatar_url"); |
91 | 91 | } |
92 | 92 | $size = getImageSize($file); |
93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
93 | + if ($size[2]!=2 and $size[2]!=3) { |
|
94 | 94 | //Not the right kind of file |
95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
100 | 100 | ImageJPEG($image2, $newfile); |
101 | 101 | } |
102 | - if (file_exists($newfile)){ |
|
102 | + if (file_exists($newfile)) { |
|
103 | 103 | $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
104 | 104 | } else { |
105 | 105 | //User didn't upload a compatible file or it went lost on the server |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | } else { |
143 | 143 | // todo: clean up the following |
144 | 144 | $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
145 | - if ($add_user_to_filter){ |
|
145 | + if ($add_user_to_filter) { |
|
146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
147 | + if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) { |
|
148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
149 | 149 | if (!$other_user) { |
150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // |
160 | 160 | $ignored_users = get_ignored_list($user); |
161 | 161 | // todo: use foreach |
162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
162 | +for ($i=0;$i<sizeof($ignored_users);$i++) { |
|
163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
164 | + if (isset($_POST[$remove]) && $_POST[$remove]!="") { |
|
165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
166 | 166 | if (!$other_user) { |
167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -53,8 +53,9 @@ discard block |
||
53 | 53 | // ------------ Forum identity ----------- |
54 | 54 | |
55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
56 | -if (strlen($user->prefs->avatar)){ |
|
57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
56 | +if (strlen($user->prefs->avatar)) { |
|
57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { |
|
58 | +// Gravatar |
|
58 | 59 | $select_1 = "checked=\"true\""; |
59 | 60 | } else { |
60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 76 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
77 | +if (strlen($user->prefs->avatar)) { |
|
77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 80 | } |
@@ -103,7 +104,7 @@ discard block |
||
103 | 104 | tra("Attach signature by default") |
104 | 105 | ) |
105 | 106 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
107 | +if ($user->prefs->signature!="") { |
|
107 | 108 | row2(tra("Signature preview"). |
108 | 109 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 110 | output_transform($user->prefs->signature) |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | // ------------ Notification ----------- |
39 | 39 | |
40 | 40 | row1(tra("Notifications")); |
41 | -$ch0 = $user->prefs->pm_notification==0?"checked":""; |
|
42 | -$ch1 = $user->prefs->pm_notification==1?"checked":""; |
|
43 | -$ch2 = $user->prefs->pm_notification==2?"checked":""; |
|
41 | +$ch0 = $user->prefs->pm_notification == 0 ? "checked" : ""; |
|
42 | +$ch1 = $user->prefs->pm_notification == 1 ? "checked" : ""; |
|
43 | +$ch2 = $user->prefs->pm_notification == 2 ? "checked" : ""; |
|
44 | 44 | row2( |
45 | 45 | tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"), |
46 | 46 | "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")." |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // ------------ Forum identity ----------- |
54 | 54 | |
55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
56 | -if (strlen($user->prefs->avatar)){ |
|
57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
56 | +if (strlen($user->prefs->avatar)) { |
|
57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar |
|
58 | 58 | $select_1 = "checked=\"true\""; |
59 | 59 | } else { |
60 | 60 | $select_2 = "checked=\"true\""; |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 74 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 75 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
76 | +if (strlen($user->prefs->avatar)) { |
|
77 | 77 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 78 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 79 | } |
80 | 80 | |
81 | -$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":""; |
|
81 | +$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : ""; |
|
82 | 82 | |
83 | -$signature=$user->prefs->signature; |
|
84 | -$maxlen=250; |
|
83 | +$signature = $user->prefs->signature; |
|
84 | +$maxlen = 250; |
|
85 | 85 | $x = ''; |
86 | 86 | if (!NO_COMPUTING) { |
87 | 87 | $x = tra( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | tra("Attach signature by default") |
104 | 104 | ) |
105 | 105 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
106 | +if ($user->prefs->signature != "") { |
|
107 | 107 | row2(tra("Signature preview"). |
108 | 108 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 109 | output_transform($user->prefs->signature) |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | // ------------ Message display ----------- |
114 | 114 | |
115 | -$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":""; |
|
116 | -$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":""; |
|
117 | -$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":""; |
|
118 | -$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":""; |
|
119 | -$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":""; |
|
120 | -$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":""; |
|
121 | -$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":""; |
|
115 | +$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : ""; |
|
116 | +$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : ""; |
|
117 | +$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : ""; |
|
118 | +$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : ""; |
|
119 | +$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : ""; |
|
120 | +$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : ""; |
|
121 | +$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : ""; |
|
122 | 122 | |
123 | 123 | $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount); |
124 | 124 | $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | <input class="btn btn-default" type="submit" name="remove%d" value="%s"> |
165 | 165 | <br> |
166 | 166 | ', |
167 | - UNIQUE_USER_NAME?'':"$blocked_user->id -", |
|
167 | + UNIQUE_USER_NAME ? '' : "$blocked_user->id -", |
|
168 | 168 | user_links($blocked_user), |
169 | 169 | $blocked_user->id, |
170 | 170 | tra("Unblock") |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | tra("Blocked users"), |
179 | 179 | tra('Ignore message board posts and private messages from these users.') |
180 | 180 | ), |
181 | - $blocked_str?$blocked_str:'---' |
|
181 | + $blocked_str ? $blocked_str : '---' |
|
182 | 182 | ); |
183 | 183 | row2( |
184 | 184 | tra('Block user'), |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | <input type="text" name="forum_filter_user" size=12> |
189 | 189 | <input class="btn btn-default" type="submit" name="add_user_to_filter" value="%s"> |
190 | 190 | ', |
191 | - UNIQUE_USER_NAME?tra('User name'):tra('User ID (For instance: 123456789)'), |
|
191 | + UNIQUE_USER_NAME ?tra('User name') : tra('User ID (For instance: 123456789)'), |
|
192 | 192 | tra("Block") |
193 | 193 | ) |
194 | 194 | ); |
@@ -285,7 +285,8 @@ discard block |
||
285 | 285 | // (PM reply fills in the latter) |
286 | 286 | // |
287 | 287 | $x = explode(' ', $username); |
288 | - if (is_numeric($x[0])) { // user ID |
|
288 | + if (is_numeric($x[0])) { |
|
289 | +// user ID |
|
289 | 290 | $userid = (int)$x[0]; |
290 | 291 | $user = BoincUser::lookup_id($userid); |
291 | 292 | if ($user == null) { |
@@ -303,7 +304,8 @@ discard block |
||
303 | 304 | tra("Could not find user with username %1", $username) |
304 | 305 | ); |
305 | 306 | return; |
306 | - } elseif (count($users) > 1) { // Non-unique username |
|
307 | + } elseif (count($users) > 1) { |
|
308 | +// Non-unique username |
|
307 | 309 | pm_form_page( |
308 | 310 | $replyto, $userid, |
309 | 311 | tra("%1 is not a unique username; you will have to use user ID", $username) |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | if ($offset === false) $offset = 0; |
85 | 85 | if ($offset >= $nmsgs) $offset = 0; |
86 | 86 | echo sprintf('Showing messages %d to %d of %d', |
87 | - $offset+1, |
|
88 | - min($offset+$nshow, $nmsgs), |
|
87 | + $offset + 1, |
|
88 | + min($offset + $nshow, $nmsgs), |
|
89 | 89 | $nmsgs |
90 | 90 | ); |
91 | 91 | if ($offset) { |
92 | 92 | echo sprintf( |
93 | 93 | ' · <a href=pm.php?action=inbox&offset=%d>Previous %d</a>', |
94 | - max(0, $offset-$nshow), $nshow |
|
94 | + max(0, $offset - $nshow), $nshow |
|
95 | 95 | ); |
96 | 96 | } |
97 | - if ($offset+$nshow < $nmsgs) { |
|
97 | + if ($offset + $nshow < $nmsgs) { |
|
98 | 98 | echo sprintf( |
99 | 99 | ' · <a href=pm.php?action=inbox&offset=%d>Next %d</a>', |
100 | - $offset+$nshow, $nshow |
|
100 | + $offset + $nshow, $nshow |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | array('style="width: 12em;"', 'style="width: 10em;"', "") |
113 | 113 | ); |
114 | 114 | $i = 0; |
115 | - foreach($msgs as $msg) { |
|
116 | - if ($i<$offset) { |
|
115 | + foreach ($msgs as $msg) { |
|
116 | + if ($i < $offset) { |
|
117 | 117 | $i++; |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($i>=$offset+$nshow) break; |
|
120 | + if ($i >= $offset + $nshow) break; |
|
121 | 121 | $i++; |
122 | 122 | $sender = BoincUser::lookup_id($msg->senderid); |
123 | 123 | if (!$sender) { |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $msgs = BoincPrivateMessage::enum( |
392 | 392 | "userid=$logged_in_user->id" |
393 | 393 | ); |
394 | - foreach($msgs as $msg) { |
|
394 | + foreach ($msgs as $msg) { |
|
395 | 395 | $x = "pm_select_$msg->id"; |
396 | 396 | if (post_str($x, true)) { |
397 | 397 | $msg = BoincPrivateMessage::lookup_id($msg->id); |
@@ -46,14 +46,14 @@ |
||
46 | 46 | |
47 | 47 | if (!$sort_style) { |
48 | 48 | // get the sort style either from the logged in user or a cookie |
49 | - if ($user){ |
|
49 | + if ($user) { |
|
50 | 50 | $sort_style = $user->prefs->forum_sorting; |
51 | 51 | } else { |
52 | 52 | list($sort_style, $thread_style) = parse_forum_cookie(); |
53 | 53 | } |
54 | 54 | } else { |
55 | 55 | // set the sort style |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $user->prefs->forum_sorting = $sort_style; |
58 | 58 | $user->prefs->update("forum_sorting=$sort_style"); |
59 | 59 | } else { |
@@ -70,7 +70,7 @@ |
||
70 | 70 | page_head(sprintf("%s '%s'", tra("Forum"), $forum->title)); |
71 | 71 | if ($msg) echo "<p>$msg</p>\n"; |
72 | 72 | show_forum_header($user); |
73 | - echo forum_title($category, $forum, NULL); |
|
73 | + echo forum_title($category, $forum, null); |
|
74 | 74 | break; |
75 | 75 | case 1: |
76 | 76 | $team = BoincTeam::lookup_id($forum->category); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // show a forum. |
27 | 27 | // $user is null if not logged in |
28 | 28 | // |
29 | -function forum_page($forum, $user, $msg=null) { |
|
29 | +function forum_page($forum, $user, $msg = null) { |
|
30 | 30 | global $forum_sort_styles; |
31 | 31 | |
32 | 32 | if (DISABLE_FORUMS) { |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | |
54 | 54 | if (!$sort_style) { |
55 | 55 | // get the sort style either from the logged in user or a cookie |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $sort_style = $user->prefs->forum_sorting; |
58 | 58 | } else { |
59 | 59 | list($sort_style, $thread_style) = parse_forum_cookie(); |
60 | 60 | } |
61 | 61 | } else { |
62 | 62 | // set the sort style |
63 | - if ($user){ |
|
63 | + if ($user) { |
|
64 | 64 | $user->prefs->forum_sorting = $sort_style; |
65 | 65 | $user->prefs->update("forum_sorting=$sort_style"); |
66 | 66 | } else { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | echo "<td><a href=\"forum_thread.php?id=$thread->id\">$title</a><br></td>"; |
249 | 249 | |
250 | 250 | echo ' |
251 | - <td>'.($thread->replies+1).'</td> |
|
251 | + <td>'.($thread->replies + 1).'</td> |
|
252 | 252 | <td>'.user_links($owner, BADGE_HEIGHT_SMALL).'</td> |
253 | 253 | <td>'.$thread->views.'</td> |
254 | 254 | <td>'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | flush(); |
258 | 258 | } |
259 | 259 | end_table(); |
260 | - echo "<br>$page_nav"; // show page links |
|
260 | + echo "<br>$page_nav"; // show page links |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $id = get_int("id"); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | die("Delete this line first\n"); |
29 | 29 | |
30 | 30 | if (is_numeric($argv[1])) { |
31 | - $user = BoincUser::lookup_id((int) $argv[1]); |
|
31 | + $user = BoincUser::lookup_id((int)$argv[1]); |
|
32 | 32 | if (!$user) die("no such user\n"); |
33 | 33 | $retval = delete_account($user); |
34 | 34 | if ($retval) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | if ($retval) { |
44 | 44 | echo "Failed to delete user: $retval\n"; |
45 | 45 | } else { |
46 | - echo "User $user->id deleted\n"; |
|
46 | + echo "user $user->id deleted\n"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |