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/download.php

    r738 r873  
    1919$disallow = $config->{'general'}->{'disallow'};
    2020$allow = $config->{'general'}->{'allow'};
    21 if( $allow && (! preg_match("/$allow/",$remote_addr)) ) {
     21if ( $allow && (! preg_match("/$allow/",$remote_addr)) ) {
    2222    include("unallowed.html");
    2323    exit;
    24 } elseif( $disallow && preg_match("/$disallow/", $remote_addr) ) {
     24} elseif ( $disallow && preg_match("/$disallow/", $remote_addr) ) {
    2525    include("unallowed.html");
    2626    exit;
     
    3333## on initial results
    3434$config_auto_size = $config->{'general'}->{'auto_size'};
    35 if($config_auto_size) {
     35if ($config_auto_size) {
    3636    ## We're using the auto_size functionality
    37     if( isset($_GET['auto_size']) && $_GET['auto_size']) {
     37    if ( isset($_GET['auto_size']) && $_GET['auto_size']) {
    3838        ## Intial test is done.  Set down/upload sizes to the same as
    3939        ## our initial measured speeds.   That way the test should take
     
    5555
    5656## Make sure sizes are below our configured limits
    57 if($down_kbytes > $config->{'download'}->{'max_kbytes'}) {
     57if ($down_kbytes > $config->{'download'}->{'max_kbytes'}) {
    5858    $down_kbytes = $config->{'download'}->{'max_kbytes'};
    5959}
    60 if($up_kbytes > $config->{'upload'}->{'max_kbytes'}) {
     60if ($up_kbytes > $config->{'upload'}->{'max_kbytes'}) {
    6161    $up_kbytes = $config->{'upload'}->{'max_kbytes'};
    6262}
    6363
    64 if($config->{'upload'}->{'skip_upload'}) {
     64if ($config->{'upload'}->{'skip_upload'}) {
    6565    $up_kbytes = 0;
    6666}
     
    9292
    9393<?php
    94 if(file_exists("header.html")) {
     94if (file_exists("header.html")) {
    9595    ## Include "header.html" for a custom header, if the file exists
    9696    include("header.html");
     
    103103
    104104<?php
    105 if( ($config_auto_size) && (! isset($_GET['auto_size'])) ) {
     105if ( ($config_auto_size) && (! isset($_GET['auto_size'])) ) {
    106106    ## auto_size is performing the initial, small test
    107107    print "<div>Calculating appropriate file sizes for testing</div>\n";
     
    137137</div>
    138138
    139 <?php if(file_exists("footer.html")) { include("footer.html"); } ?>
     139<?php if (file_exists("footer.html")) { include("footer.html"); } ?>
    140140
    141141<?php /* Begin JavaScript functions that we'll need */ ?>
     
    144144function StartUpload() {
    145145    uploadDiv = document.getElementById('upload_message');
    146     if(uploadDiv) {
     146    if (uploadDiv) {
    147147        uploadDiv.style.visibility='visible';
    148148        uploadDiv.style.display='block';
    149         <?php if($pretty_version) { ?>
     149        <?php if ($pretty_version) { ?>
    150150        setInterval("IncrementUploadBar()",200);
    151151        <?php } ?>
     
    158158function IncrementDownloadBar() {
    159159    download_barElement = document.getElementById('download_bar');
    160     if(download_barElement) {
     160    if (download_barElement) {
    161161        download_bar_current_width += <?php echo $download_progress_bar_increment; ?>;
    162         if(download_bar_current_width <= <?php echo $progress_bar_width; ?>) {
     162        if (download_bar_current_width <= <?php echo $progress_bar_width; ?>) {
    163163            download_barElement.style.width = download_bar_current_width +"px";
    164164        }
     
    176176function IncrementUploadBar() {
    177177    upload_barElement = document.getElementById('upload_bar');
    178     if(upload_barElement) {
     178    if (upload_barElement) {
    179179        upload_bar_current_width += <?php echo $upload_progress_bar_increment; ?>;
    180         if(upload_bar_current_width < <?php echo $progress_bar_width; ?>) {
     180        if (upload_bar_current_width < <?php echo $progress_bar_width; ?>) {
    181181            upload_barElement.style.width = upload_bar_current_width +"px";
    182182        }
     
    186186function CompleteDownloadBar() {
    187187    download_barElement = document.getElementById('download_bar');
    188     if(download_barElement) {
     188    if (download_barElement) {
    189189        download_barElement.style.width = "100%";
    190190    }
     
    209209<?php
    210210
    211 if($pretty_version) {
     211if ($pretty_version) {
    212212print "
    213213//-->
     
    225225    $extra_down_kbytes = $down_kbytes - $up_kbytes;
    226226    $total_kbytes = 0;
    227     while($total_kbytes <= $extra_down_kbytes) {
    228         if($pretty_version) {
     227    while ($total_kbytes <= $extra_down_kbytes) {
     228        if ($pretty_version) {
    229229        print "
    230230<script language=\"javascript\">
     
    240240        $total_kbytes += $each_chunk;
    241241    }
    242     if(!$pretty_version) {
     242    if (!$pretty_version) {
    243243        print "dataElement.value=\"$data\";";
    244244        print "CompleteDownloadBar();\n";
     
    254254    ## Now, download the remaining bytes ($up_kbytes)  and save it into a
    255255    ## form variable that we will post back to test the upload speed
    256     while($total_kbytes <= $down_kbytes) {
    257         if($pretty_version) {
     256    while ($total_kbytes <= $down_kbytes) {
     257        if ($pretty_version) {
    258258        print "
    259259<script language=\"javascript\">
     
    270270    }
    271271
    272     if(!$pretty_version) {
     272    if (!$pretty_version) {
    273273        #print "\";";
    274274    } else {
     
    288288      downloadtime = (endtime - starttime)/1000;
    289289  }
    290     <?php if(! $config->{'upload'}->{'skip_upload'}){ ?> StartUpload(); <?php } ?>
     290    <?php if (! $config->{'upload'}->{'skip_upload'}){ ?> StartUpload(); <?php } ?>
    291291
    292292  down_size = <?php echo $total_kbytes; ?>;
     
    297297
    298298<?php
    299 if($config_auto_size && (! isset($_GET['auto_size'])) ) {
     299if ($config_auto_size && (! isset($_GET['auto_size'])) ) {
    300300    $params_auto_size = "&auto_size=1";
    301301} else {
    302302    $params_auto_size = "";
    303303}
    304 if($config->{'upload'}->{'skip_upload'} && (! $params_auto_size)) {
     304if ($config->{'upload'}->{'skip_upload'} && (! $params_auto_size)) {
    305305    $next_url = $config->{'general'}->{'base_url'}."results.php";
    306306} else {
Note: See TracChangeset for help on using the changeset viewer.