Ignore:
Timestamp:
Aug 9, 2013, 10:29:25 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Speedtest předělán na aplikační modul. Aktuálně nefunkční a je potřeba celý modul přepracovat.
Location:
trunk/Modules/SpeedTest
Files:
1 copied
1 moved

Legend:

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

    r559 r560  
    11<?php
     2
    23###############################################################################
    34## Fancy Speed Test - Easily measure your upload and download speeds
     
    78## Version:     1.1
    89## Date:        2006-02-06
    9 ## Purpose:     Display a welcome page, or redirect straight to the 
     10## Purpose:     Display a welcome page, or redirect straight to the
    1011##              download test if auto_start is enabled
    1112###############################################################################
    1213
    13 require("common.php");
    14 ReadConfig("speedtest.cfg");
     14class ModuleSpeedTest extends AppModule
     15{
     16  function __construct($System)
     17  {
     18    parent::__construct($System);
     19    $this->Name = 'SpeedTest';
     20    $this->Version = '1.0';
     21    $this->Creator = 'Chronos';
     22    $this->License = 'GNU/GPL';
     23    $this->Description = 'Testing of download and upload bandwidth';
     24    $this->Dependencies = array();
     25  }
     26 
     27  function Start()
     28  {
     29    parent::Start();
     30    $this->System->Pages['speedtest'] = 'PageSpeedTest';
     31   
     32  } 
     33}
    1534
     35class PageSpeedTest extends Page
     36{
     37  var $FullTitle = 'Test rychlosti připojení';
     38  var $ShortTitle = 'Test rychlosti';
     39  var $ParentClass = 'PagePortal';
     40 
     41  function Show()
     42  {
     43    if(count($this->System->PathItems) > 1)
     44    {
     45      if($this->System->PathItems[1] == 'download.php') return($this->ShowDownload());
     46      //else if($this->System->PathItems[1] == 'rss') return($this->ShowRSS());
     47      else return(PAGE_NOT_FOUND);
     48    } else return($this->ShowMain());
     49  }
     50 
     51  function ShowDownload()
     52  {
     53    global $config;
     54    require_once(dirname(__FILE__)."/download.php");
     55   
     56  }
     57 
     58  function ShowMain()
     59  {   
     60    global $config;
     61   
     62    require_once(dirname(__FILE__)."/common.php");
     63    ReadConfig(dirname(__FILE__)."/speedtest.cfg");
     64   
    1665## Redirect immediately to download.php if auto_start = 1
    1766if($config->{'general'}->{'auto_start'}) {
    18     Header("Location: ".$config->{'general'}->{'base_url'}."/download.php");
     67    Header("Location: ".$config['general']['base_url']."/download.php");
    1968    exit;
    2069}
    2170
    22 ?>
    23 <html>
     71$Output = '<html>
    2472<head>
    25 <title><?php print $config->{'general'}->{'page_title'}; ?> - Fancy Speed Test</title>
     73<title>'.$config->{'general'}->{'page_title'}.' - Fancy Speed Test</title>
    2674<meta http-equiv="Expires" CONTENT="Fri, Jan 1 1980 00:00:00 GMT" />
    2775<meta http-equiv="Pragma" CONTENT="no-cache" />
     
    2977<link rel="stylesheet" href="style.css" />
    3078</head>
    31 <body>
     79<body>';
    3280
    33 <?php
    3481if(file_exists("header.html")) {
    3582    ## Include "header.html" for a custom header, if the file exists
     
    3986    print "<center>\n";
    4087}
    41 ?>
    42 <div id="speedtest_content">
     88$Output .= '<div id="speedtest_content">';
    4389
    44 
    45 <?php
    4690if(file_exists("welcome.html")) {
    4791    ## Include "welcome.html" for a custom welcome page, if the file exists
     
    4993} else {
    5094    ## Else print a standard welcome message
    51 ?>
    52 <center>
    53 <h2>Fancy  Speed Test</h2>
     95
     96$Output .= '<center>
    5497<div style="width: 400px;">
    5598Welcome to our speedtest.  This test will measure your connection speed to and
     
    57100back to the server.  The test should take approximately 30 seconds to complete.
    58101</div>
    59 </center>
    60 <?php } ?>
     102</center>';
     103}
    61104
    62 <center><h2><a class="start_test" title="Begin Speed Test" href="<?php echo $config->{'general'}->{'base_url'}; ?>/download.php">Start Test</a></h2></center>
     105$Output .= '<center><h2><a class="start_test" title="Begin Speed Test" href="'.$config->{'general'}->{'base_url'}.'/download.php">Start Test</a></h2></center>
    63106<div id="speedtest_credits">
    64107    Powered by <a title="Brandon Checketts Fancy Source Speedtest" href="http://www.brandonchecketts.com/speedtest/" target="_new">Fancy Speed Test</a>
    65108</div>
    66 </div>
    67 <?php
     109</div>';
     110
    68111if(file_exists("footer.html")) {
    69112    ## Include "footer.html" for a custom footer, if the file exists
     
    73116    print "</center>\n";
    74117}
    75 ?>
     118    return($Output);
     119  }
     120}
    76121
    77    
    78 
    79 
    80 
    81 </body>
    82 </html>
    83 
Note: See TracChangeset for help on using the changeset viewer.