Passed
Pull Request — master (#5459)
by David
08:32
created
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.