Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/SpeedTest/results.php

    r786 r873  
    1616
    1717## Save the results of this speedtest to the database, if enabled
    18 if($config->{'database'}->{'enable'}) {
     18if ($config->{'database'}->{'enable'}) {
    1919    $ip_matches = $config->{'database'}->{'ip_matches'};
    20     if( (! $ip_matches) || ($ip_matches && preg_match("/$ip_matches/",$_SERVER['REMOTE_ADDR'])) ) {
     20    if ( (! $ip_matches) || ($ip_matches && preg_match("/$ip_matches/",$_SERVER['REMOTE_ADDR'])) ) {
    2121        Debug("Saving to database");
    2222        $dbh = mysql_connect(
     
    5757
    5858<?php
    59 if(file_exists("header.html")) {
     59if (file_exists("header.html")) {
    6060    ## Include "header.html" for a custom header, if the file exists
    6161    include("header.html");
     
    7575    print "<h2>Download Speed: $clean_down</h2>\n";
    7676    ## Find the biggest value
    77     foreach($config->{'comparisons-download'} as $key=>$value) {
    78         if($value > $download_biggest) {
     77    foreach ($config->{'comparisons-download'} as $key=>$value) {
     78        if ($value > $download_biggest) {
    7979            $download_biggest = $value;
    8080        }
     
    8282    ## Print a pretty table with a graph of the results
    8383    print "<center><table>\n";
    84     foreach($config->{'comparisons-download'} as $key=>$value) {
     84    foreach ($config->{'comparisons-download'} as $key=>$value) {
    8585        $this_bar_width = $bar_width / $download_biggest * $value;
    8686        print "<tr><td>$key</td><td>".CleanSpeed($value)."</td><td width=\"400\">\n";
     
    9797
    9898    ## Don't display the upload stuff if we didn't get a speed to compare with
    99     if(isset($_GET['upspeed'])) {
     99    if (isset($_GET['upspeed'])) {
    100100        $clean_up = CleanSpeed($_GET['upspeed']);
    101101        $upload_biggest = $_GET['upspeed'];
    102102        print "<h2>Upload Speed: $clean_up</h2>\n";
    103         foreach($config->{'comparisons-upload'} as $key=>$value) {
    104             if($value > $upload_biggest) {
     103        foreach ($config->{'comparisons-upload'} as $key=>$value) {
     104            if ($value > $upload_biggest) {
    105105                $upload_biggest = $value;
    106106            }
    107107        }
    108108        print "<table>\n";
    109         foreach($config->{'comparisons-upload'} as $key=>$value) {
     109        foreach ($config->{'comparisons-upload'} as $key=>$value) {
    110110            $this_bar_width = $bar_width / $upload_biggest * $value;
    111111            print "<tr><td>$key</td><td>".CleanSpeed($value)."</td>\n";
     
    128128</div>
    129129
    130 <?php if(file_exists("footer.html")) { include("footer.html"); } ?>
     130<?php if (file_exists("footer.html")) { include("footer.html"); } ?>
    131131
    132132</body>
     
    136136## Convert the raw speed value to a nicer value
    137137function CleanSpeed($kbps) {
    138     if($kbps > 1024)   {
     138    if ($kbps > 1024)   {
    139139        $cleanspeed = round($kbps / 1024,2) . " Mbps";
    140140    } else {
Note: See TracChangeset for help on using the changeset viewer.