Skip to content

Commit f5435c4

Browse files
committed
code-cleanup
* removed unused ids in dom * removed unused css-definitions * fixed broken html * use html5-doctype
1 parent 7e0a287 commit f5435c4

23 files changed

+507
-735
lines changed

benchhistory.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
$csv_output .= "\015\012";
110110
$result = $db->sql_query("SELECT * FROM results$r ORDER BY testid DESC");
111111

112-
while($row = mysql_fetch_array($result)) {
112+
while(($row = mysql_fetch_array($result))) {
113113
$csv_output .= '"'.$row['testid'].'","'. date("m/d/y",$row['timestamp']).'","'.$row['cpu'].'","'.$row['uptime'].'","'.$row['memory'].'","'.$row['phpspeed_version'].'","'.$row['php_version'].'","'.$row['mysql_version'].'","'.$row['server_software'].'","'. $row['test_results'].'","'.$row['tests_run'].'","'.$row['iterations'].'","'.$row['total_time'].'","'.$row['score'].'","'.$row['site'].'"';
114114
$csv_output .= "\015\012";
115115
}
@@ -124,7 +124,7 @@
124124

125125
?>
126126

127-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
127+
<!DOCTYPE html>
128128

129129
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
130130

@@ -166,7 +166,7 @@
166166

167167
<table width="94%" cellpadding="9" cellspacing="1" align="center" class="forumline">
168168
<tr>
169-
<td align="left" class="row2"><font color="yellow"> Are you sure you want to delete all results for Test # <?php echo $r; ?> &nbsp;<a href="benchhistory.php?conf=1&bench=<?php echo $r; ?>"><b>YES</b></a></td>
169+
<td align="left" class="row2"><span style="color:yellow"> Are you sure you want to delete all results for Test # <?php echo $r; ?> &nbsp;<a href="benchhistory.php?conf=1&bench=<?php echo $r; ?>"><b>YES</b></a></span></td>
170170
</tr>
171171
</table><br />
172172

@@ -199,7 +199,7 @@
199199

200200
<table width="94%" cellpadding="9" cellspacing="1" align="center" class="forumline">
201201
<tr>
202-
<td align="left" class="row2"><font color="yellow">SUCCESS! All data has been deleted.</td>
202+
<td align="left" class="row2"><span style="color:yellow">SUCCESS! All data has been deleted.</span></td>
203203
</tr>
204204
</table><br />
205205
<?php
@@ -221,7 +221,7 @@
221221
<table width="94%" cellpadding="9" cellspacing="1" align="center" class="forumline">
222222
<tr><th align="center">Date</th><th align="center">PHPspeed</th><th align="center">PHP</th><th align="center">MySQL</th><th align="center">Tests</th><th align="center">Iterations</th><th align="center">Time</th><th align="center">Score</th></tr>
223223
<?php
224-
while ($row = mysql_fetch_assoc($result)) {
224+
while (($row = mysql_fetch_assoc($result))) {
225225
echo "<tr><td class=\"row1\">" . date("m/d/y", $row["timestamp"]) . "</td><td class=\"row1\">" . $row["phpspeed_version"] . "</td><td class=\"row1\">" . $row["php_version"] . "</td><td class=\"row1\">" . $row["mysql_version"] . "</td><td class=\"row1\" align=\"center\">" . $row["tests_run"] . "</td><td class=\"row1\" align=\"center\">" . $row["iterations"] . "</td><td class=\"row1\" align=\"center\">" . $row["total_time"] . "</td><td class=\"row1\" align=\"center\">" . $row["score"] . "</td></tr>";
226226
}
227227
?>

inc/Style.css

+2-29
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,12 @@ h2 { font-size: 18px; }
4040

4141
h6 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif }
4242

43-
.testoutput { margin: 5px 30px 30px 30px; color: #CCC; background-color: #333; border: 1px #ccc dashed; }
44-
45-
.testoutputtext { margin: 7px; color: #EFEFEF; }
46-
47-
.forumline { background-color: #979797; border: 0 #979797 solid; }
48-
49-
td.row1 { color: #D8D8D8; font-size: 12px; background-color: #434343; text-align: center; }
50-
51-
td.row2 { color: #D8D8D8; font-size: 12px; background-color: #434343; }
52-
5343
th { color: #D8D8D8; font-size: 11px; font-weight : bold; background: #000 url(images/bg.jpg) repeat; height: 12px; }
5444

55-
.gen { font-size : 12px; }
56-
57-
.genmed { font-size : 11px; }
58-
59-
.gensmall { font-size : 10px; }
60-
61-
.gen,.genmed,.gensmall { color : #FFF; }
62-
63-
.mainmenu { font-size : 12px; color : #FFF; }
64-
65-
a.mainmenu { text-decoration: none; color : #D8D8D8; }
66-
67-
a.mainmenu:hover { color : #FFF; }
45+
.gensmall { font-size : 10px; color : #FFF; }
6846

6947
input,textarea, select { color : #000; font: normal 11px Verdana, Arial, Helvetica, sans-serif; border-color : #FFF; }
7048

71-
input.post, textarea.post, select { background-color : #666; border: 1px solid #000; }
49+
select { background-color : #666; border: 1px solid #000; }
7250

7351
input { text-indent : 2px; }
74-
75-
input.button { background-color : #333333; color : #FFF; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #000; }
76-
77-
input.mainoption { background-color:#FAFAFA; font-weight : bold; }
78-

includes/class.Template.inc.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function set_file($handle, $filename = '')
9797
else
9898
{
9999
reset($handle);
100-
while(list($h, $f) = each($handle))
100+
foreach($handle as $h => $f)
101101
{
102102
$this->file[$h] = $this->filename($f);
103103
}
@@ -151,7 +151,7 @@ function set_var($varname, $value = '')
151151
else
152152
{
153153
reset($varname);
154-
while(list($k, $v) = each($varname))
154+
foreach($varname as $k => $v)
155155
{
156156
if (!empty($k))
157157
{
@@ -179,7 +179,7 @@ function subst($handle)
179179

180180
$str = $this->get_var($handle);
181181
reset($this->varkeys);
182-
while (list($k, $v) = each($this->varkeys))
182+
foreach($this->varkeys as $k => $v)
183183
{
184184
$str = str_replace($v, $this->varvals[$k], $str);
185185
}
@@ -272,7 +272,7 @@ function get_var($varname)
272272
else
273273
{
274274
reset($varname);
275-
while(list($k, $v) = each($varname))
275+
foreach($varname as $k => $v)
276276
{
277277
$result[$k] = $this->varvals[$k];
278278
}

index.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
?>
5656

57-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
57+
<!DOCTYPE html>
5858

5959
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6060

@@ -235,10 +235,10 @@
235235
<td class="row1">Last Test: <?php echo date("m/d/y", $ver['last_test']) ?></td>
236236
</tr>
237237
<tr>
238-
<td class="row1"><a href="http://www.phpspeed.com/phpbenchmark.php"><img src="inc/phpspeed.php" vspace="6" border="0" alt="php benchmark"></a></td>
239-
<td class="row1"><a href="http://www.phpspeed.com/mysqlbenchmark.php"><img src="inc/mysqlspeed.php" vspace="6" border="0" alt="mysql benchmark"></a></td>
240-
<td class="row1"> <a href="http://www.phpspeed.com/serverbenchmark.php"><img src="inc/serverspeed.php" vspace="6" border="0" alt="server benchmark"></a></td>
241-
<td class="row1"><a href="http://www.phpspeed.com/drivebenchmark.php"><img src="inc/drivespeed.php" vspace="6" border="0" alt="drive benchmark"></a></td>
238+
<td class="row1"><a href="http://www.phpspeed.com/phpbenchmark.php"><img src="inc/phpspeed.php" border="0" alt="php benchmark"></a></td>
239+
<td class="row1"><a href="http://www.phpspeed.com/mysqlbenchmark.php"><img src="inc/mysqlspeed.php" border="0" alt="mysql benchmark"></a></td>
240+
<td class="row1"> <a href="http://www.phpspeed.com/serverbenchmark.php"><img src="inc/serverspeed.php" border="0" alt="server benchmark"></a></td>
241+
<td class="row1"><a href="http://www.phpspeed.com/drivebenchmark.php"><img src="inc/drivespeed.php" border="0" alt="drive benchmark"></a></td>
242242
</tr>
243243
</table>
244244

info.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
163163
$plng = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
164164
if (count($plng) > 0) {
165-
while (list($k, $v) = each($plng)) {
165+
foreach($plng as $k => $v) {
166166
$k = explode(';', $v, 1);
167167
$k = explode('-', $k[0]);
168168
if (file_exists(APP_ROOT . '/includes/lang/' . $k[0] . '.php')) {

mysql.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
?>
6161

62-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
62+
<!DOCTYPE html>
6363

6464
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6565

@@ -128,7 +128,7 @@
128128

129129
$result = mysql_query('SHOW /*!50002 GLOBAL */ STATUS', $link);
130130
$p = 1;
131-
while ($row = mysql_fetch_assoc($result)) {
131+
while (($row = mysql_fetch_assoc($result))) {
132132
$p ++;
133133
if($p%2==0){
134134
echo '</tr><tr>';
@@ -154,7 +154,7 @@
154154

155155
$result = mysql_query('SHOW VARIABLES', $link);
156156
$p = 1;
157-
while ($row = mysql_fetch_assoc($result)) {
157+
while (($row = mysql_fetch_assoc($result))) {
158158
$p ++;
159159

160160
if($p%2==0){

phpinfo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
?>
8585

8686

87-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
87+
<!DOCTYPE html>
8888

8989
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
9090

results.php

+18-28
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
?>
3131

32-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
32+
<!DOCTYPE html>
3333

3434
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3535

@@ -39,27 +39,25 @@
3939
<meta http-equiv="content-language" content="en-us" />
4040
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
4141
<link rel="start" title="Home" href="http://www.phpspeed.com/" />
42-
<link rel="stylesheet" type="text/css" media="screen" href="inc/screen.css" />
43-
<!--[if lt ie 7]><link rel="stylesheet" type="text/css" media="screen" href="inc/ie-win.css" /><![endif]-->
4442

4543
</head>
4644

47-
<body id="babout">
45+
<body>
4846

49-
<div id="header">
47+
<header>
5048

5149
<h1>PHPspeed | <?php echo $_SERVER['HTTP_HOST']; ?> | DEMO</h1>
5250

53-
</div>
51+
</header>
5452

5553
<div id="navigation">
5654

5755
<ul>
58-
<li id="lhome"><a href="index.php">&raquo; Home</a></li>
59-
<li id="lhome"><a href="results.php">&raquo; View Results</a></li>
60-
<li id="lhome"><a href="phpinfo.php">&raquo; PHP Info</a></li>
61-
<li id="lhome"><a href="mysql.php">&raquo; MySQL Info</a></li>
62-
<li id="lhome"><a href="info.php">&raquo; System Info</a></li>
56+
<li><a href="index.php">&raquo; Home</a></li>
57+
<li><a href="results.php">&raquo; View Results</a></li>
58+
<li><a href="phpinfo.php">&raquo; PHP Info</a></li>
59+
<li><a href="mysql.php">&raquo; MySQL Info</a></li>
60+
<li><a href="info.php">&raquo; System Info</a></li>
6361
</ul>
6462

6563
</div>
@@ -71,8 +69,7 @@
7169
<div id="content">
7270

7371
<h2>Test Results | DEMO</h2>
74-
<dl>
75-
72+
7673
<h6>Synthetic PHP BenchMark:</h6>
7774
<table width="100%" cellpadding="5">
7875
<tr>
@@ -95,7 +92,7 @@
9592
<?php
9693
$line = "";
9794
$result = $db->sql_query("SELECT score FROM results1 ORDER BY testid DESC LIMIT 0,10");
98-
while ($row = mysql_fetch_assoc($result)) {
95+
while (($row = mysql_fetch_assoc($result))) {
9996
$line .= $row['score'] . ", ";
10097
}
10198
$done = rtrim ($line, ', ');
@@ -128,7 +125,7 @@
128125
<?php
129126
$line = "";
130127
$result = $db->sql_query("SELECT score FROM results2 ORDER BY testid DESC LIMIT 0,10");
131-
while ($row = mysql_fetch_assoc($result)) {
128+
while (($row = mysql_fetch_assoc($result))) {
132129
$line .= $row['score'] . ", ";
133130
}
134131
$done = rtrim ($line, ', ');
@@ -161,7 +158,7 @@
161158
<?php
162159
$line = "";
163160
$result = $db->sql_query("SELECT score FROM results3 ORDER BY testid DESC LIMIT 0,10");
164-
while ($row = mysql_fetch_assoc($result)) {
161+
while (($row = mysql_fetch_assoc($result))) {
165162
$line .= $row['score'] . ", ";
166163
}
167164
$done = rtrim ($line, ', ');
@@ -194,7 +191,7 @@
194191
<?php
195192
$line = "";
196193
$result = $db->sql_query("SELECT score FROM results4 ORDER BY testid DESC LIMIT 0,10");
197-
while ($row = mysql_fetch_assoc($result)) {
194+
while (($row = mysql_fetch_assoc($result))) {
198195
$line .= $row['score'] . ", ";
199196
}
200197
$done = rtrim ($line, ', ');
@@ -226,7 +223,7 @@
226223
<?php
227224
$line = "";
228225
$result = $db->sql_query("SELECT score FROM results5 ORDER BY testid DESC LIMIT 0,10");
229-
while ($row = mysql_fetch_assoc($result)) {
226+
while (($row = mysql_fetch_assoc($result))) {
230227
$line .= $row['score'] . ", ";
231228
}
232229
$done = rtrim ($line, ', ');
@@ -259,7 +256,7 @@
259256
<?php
260257
$line = "";
261258
$result = $db->sql_query("SELECT score FROM results6 ORDER BY testid DESC LIMIT 0,10");
262-
while ($row = mysql_fetch_assoc($result)) {
259+
while (($row = mysql_fetch_assoc($result))) {
263260
$line .= $row['score'] . ", ";
264261
}
265262
$done = rtrim ($line, ', ');
@@ -271,8 +268,6 @@
271268
</tr>
272269
</table>
273270

274-
</dl>
275-
276271
</div>
277272

278273
</div>
@@ -287,9 +282,6 @@
287282
<li><b>SERVER TIME:</b><br />
288283
<?php echo date("g:i a : l"); ?><br />
289284
<?php echo date("F d, Y"); ?></li>
290-
<?php echo $cpu2 ?></li>
291-
292-
293285
</ul>
294286

295287
<h3>Version Info</h3>
@@ -305,14 +297,12 @@
305297
</ul>
306298

307299
<h3>Dynamic Scorecard</h3>
308-
<ul>
309-
<center>
300+
<div style="text-align: center;">
310301
<a href="http://www.phpspeed.com/phpbenchmark.php"><img src="inc/phpspeed.php" vspace="6" border="0" alt="php benchmark"></a><br />
311302
<a href="http://www.phpspeed.com/mysqlbenchmark.php"><img src="inc/mysqlspeed.php" vspace="6" border="0" alt="mysql benchmark"></a><br />
312303
<a href="http://www.phpspeed.com/drivebenchmark.php"><img src="inc/drivespeed.php" vspace="6" border="0" alt="drive benchmark"></a><br />
313304
<a href="http://www.phpspeed.com/serverbenchmark.php"><img src="inc/serverspeed.php" vspace="6" border="0" alt="server benchmark"></a><br />
314-
</center>
315-
</ul>
305+
</div>
316306

317307
</div>
318308

runtests.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
?>
5555

56-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
56+
<!DOCTYPE html>
5757

5858
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5959

@@ -272,7 +272,7 @@ function export_csv($csv_file, &$results, &$percentile_times) {
272272

273273
function show_summary($base, &$results, $csv_file) {
274274
$total_time = 0.0;
275-
foreach ($results as $test => $time) {
275+
foreach ($results as $time) {
276276
$total_time += $time;
277277
}
278278
if ($total_time <= 0.0) {
@@ -285,12 +285,12 @@ function show_summary($base, &$results, $csv_file) {
285285
$score = (float) $base * 1.0 / $total_time;
286286

287287
//Insert into DB
288-
global $db, $dbhost, $dbuname, $dbpass, $dbname, $ver, $cpu_info, $uptime, $tot_mem, $percent_used, $new_tests;
288+
global $db, $ver, $cpu_info, $uptime, $tot_mem, $percent_used, $new_tests;
289289

290-
$result = $db->sql_query("INSERT INTO results1
290+
$db->sql_query("INSERT INTO results1
291291
VALUES ('','" . time() . "','$cpu_info','$uptime','" . round(($tot_mem/1024),2) . " GB - $percent_used % Used','{$ver['version']}','" . phpversion() . "','" . mysql_get_server_info() . "','" . $_SERVER['SERVER_SOFTWARE'] . "','" . serialize($results) . "','" . count($results) . "','$base','" . round($total_time) . "','" . round($score) . "','" . $_SERVER['HTTP_HOST'] . "')");
292292

293-
$result2 = $db->sql_query("UPDATE phpspeed_config SET tests_run ='$new_tests', last_test = " . time() . "");
293+
$db->sql_query("UPDATE phpspeed_config SET tests_run ='$new_tests', last_test = " . time() . "");
294294

295295
echo
296296
'<br /><br />Tests : ' . count($results) . "\n" .

0 commit comments

Comments
 (0)