Changeset 471


Ignore:
Timestamp:
Dec 30, 2012, 10:09:08 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Vytvořen modul Network a přesunuto do něj zobrazení topologie a seznamu zařízení.
Location:
trunk
Files:
3 deleted
3 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r470 r471  
    3131include_once(dirname(__FILE__).'/../Modules/IS/IS.php');
    3232include_once(dirname(__FILE__).'/../Modules/Network/Network.php');
     33include_once(dirname(__FILE__).'/../Modules/TV/TV.php');
    3334
    3435$PrefixMultipliers = array
     
    281282  $System->ModuleManager->RegisterModule(new IS($System));
    282283  $System->ModuleManager->RegisterModule(new Network($System));
     284  $System->ModuleManager->RegisterModule(new TV($System));
    283285  $System->ModuleManager->StartAll();
    284286}
  • trunk/Common/Page.php

    r453 r471  
    66  var $FormatHTML = false;
    77  var $ShowRuntimeInfo = false;
     8  var $ClearPage = false;
    89  var $PathTree = array('Rozcestník',
    910    'index.php' => '',
     
    178179  {
    179180    $Output = $this->Show();
    180     $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
    181     $Output .= $this->ShowFooter();
    182     if($this->FormatHTML == true) echo($this->FormatOutput($Output));
    183     else echo($Output);
     181    if($this->ClearPage == false)
     182    {
     183      $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
     184      $Output .= $this->ShowFooter();
     185      if($this->FormatHTML == true) echo($this->FormatOutput($Output));
     186    }
     187    echo($Output);
    184188  }
    185189
  • trunk/Modules/Network/Network.php

    r470 r471  
    22
    33include_once('HostList.php');
     4
     5class PageNetworkInformation extends Page
     6{
     7  var $FullTitle = 'Technické informace o síti';
     8  var $ShortTitle = 'Technické informace';
     9
     10  function Show()
     11  {
     12    $Output = '';
     13    if(!array_key_exists('section', $_GET)) $_GET['section'] = '';
     14    switch($_GET['section'])
     15    {
     16      case 'obsazeni_wifi_kanalu':
     17        // http://en.wikipedia.org/wiki/List_of_WLAN_channels
     18        //$ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5200 => 40, 5205 => 41, 5210 => 42, 5215 => 43, 5220 => 44, 5225 => 45, 5230 => 46, 5235 => 47, 5240 => 48, 5245 => 49, 5250 => 50, 5255 => 51, 5260 => 52, 5265 => 53, 5270 => 54, 5275 => 55, 5280 => 56, 5285 => 57, 5290 => 58, 5295 => 59, 5300 => 60, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144);
     19        $Output .= '<div align="center">'.
     20        '<a href="?section=obsazeni_wifi_kanalu&range=a">Pásmo 2,4 GHz (a)</a> '.
     21        '<a href="?section=obsazeni_wifi_kanalu&amp;range=bc">Pásmo 5 GHz dolní (b, c)</a> '.
     22        '<a href="?section=obsazeni_wifi_kanalu&amp;range=d">Pásmo 5 GHz horní (d)</a> '.
     23        '<a href="http://www.ctu.cz/1/download/Opatreni%20obecne%20povahy/VO_R_12_08_2005_34.pdf">VO_R_12_08_2005_34</a><br/>'.
     24        '<strong>Seznam známých AP a obsazení kmitočtových pásem:</strong></div>'.
     25        '<table class="WideTable">'.
     26        '<tr><th/><br/>SSID<br/><br/></th>'; 
     27        $ChannelList = array();
     28        if(!array_key_exists('range', $_GET)) $_GET['range'] = 'a';
     29        if($_GET['range'] == 'a')       
     30        {
     31          $Where = '(Frequency < 5000)';
     32          for($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     33        }
     34        if($_GET['range'] == 'bc')       
     35        {
     36          $Where = '(Frequency >= 5000) AND (Frequency <= 5350)';
     37          for($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     38        }
     39        if($_GET['range'] == 'd')       
     40        {
     41          $Where = '(Frequency >= 5470)';
     42          for($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq;
     43        }
     44         
     45        foreach($ChannelList as $Frequency)       
     46        {
     47          $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>';
     48        }
     49        $Output .= '</tr>';
     50        $DbResult = $this->Database->query('SELECT Frequency FROM NetworkAP WHERE '.$Where.' GROUP BY Frequency');
     51        while($DbRow = $DbResult->fetch_assoc())
     52        {
     53          $DbResult2 = $this->Database->query('SELECT * FROM NetworkAP WHERE Frequency='.$DbRow['Frequency'].' AND '.$Where);
     54          while($DbRow2 = $DbResult2->fetch_assoc())
     55          {
     56            $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2;
     57            $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2;
     58            $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>';
     59            foreach($ChannelList as $Frequency)       
     60            {
     61              if(($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080';
     62                else if(($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0';
     63                else $Color = '#ffffff';
     64              $Output .= '<td style="background-color: '.$Color.';">&nbsp;</td>';
     65            }
     66
     67            $Output .= '</tr>'; 
     68          }         
     69        }
     70        $Output .= '</table>';
     71        break;
     72      default:
     73        $Output .= '<a href="?section=obsazeni_wifi_kanalu">Obsazení Wi-Fi kanálů</a><br />';
     74        $Output .= '<a href="network/dostupnost.php">Měření dostupnosti zařízení</a><br />';
     75        $Output .= '<a href="network/subnet.php">Výpis registrovaných podsítí</a><br />';
     76        //$Output .= '<a href="tkr.php">Kanály kabelové televize</a>';
     77    }
     78    return($Output);
     79  }
     80}
    481
    582class Network extends AppModule
     
    28105    parent::Start();
    29106    $this->System->RegisterPage('hostlist.php', 'PageHostList');
     107    $this->System->RegisterPage('network.php', 'PageNetworkInformation');   
    30108  } 
    31109 
  • trunk/Modules/TV/TV.php

    r470 r471  
    11<?php
    22
    3 include_once('../Common/Global.php');
     3include_once('Common/Global.php');
    44
    5 class IPTVPage extends Page
     5class PagePlayList extends Page
     6{
     7  function Show()
     8  {
     9    $this->ClearPage = true;
     10       
     11    Header("Content-Type: audio/mpegurl");
     12    Header("Content-Disposition: attachment; filename=playlist.m3u");
     13
     14    echo('#EXTM3U'."\n");
     15    if(array_key_exists('id', $_GET))
     16    {
     17      $DbResult = $this->Database->select('TV', '*', ' (`Stream` <> "") AND (`ShortName`="'.addslashes($_GET['id']).'") ');
     18      if($DbResult->num_rows > 0)
     19      {
     20        $Channel = $DbResult->fetch_array();
     21        echo('#EXTINF:0,'.$Channel['Name']."\n");
     22        echo($Channel['Stream']."\n");
     23      }
     24    } else
     25    {
     26      $DbResult = $this->Database->select('TV', '*', ' (`Stream` <> "") ORDER BY `Name` ');
     27      while($Channel = $DbResult->fetch_array())
     28      {
     29        echo('#EXTINF:0,'.$Channel['Name']."\n");
     30        echo($Channel['Stream']."\n");
     31      }
     32    }
     33  }
     34}
     35
     36class PageIPTV extends Page
    637{
    738  var $FullTitle = 'Síťová televize';
     
    1344   
    1445    $Output = 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>'.
    15     'Seznam všech kanálů do přehrávače: <a href="playlist.php">Playlist</a><br/>'.
     46    'Seznam všech kanálů do přehrávače: <a href="playlist.m3u">Playlist</a><br/>'.
    1647    'Zobrazení playlistu ve VLC lze provést pomocí menu <strong>View - Playlist</strong> nebo klávesové zkratky CTRL+L<br/>'.
    1748    '<br/>'.
     
    4374    while($Line = $DbResult->fetch_assoc())
    4475    {
    45       if($Line['Stream'] <> '') $Line['Show'] = '<a href="playlist.php?id='.$Line['ShortName'].'">Naladit</a>';
     76      if($Line['Stream'] <> '') $Line['Show'] = '<a href="playlist.m3u?id='.$Line['ShortName'].'">Naladit</a>';
    4677      else
    4778      if($Line['StreamWeb'] <> '') $Line['Show'] = '<a href="'.$Line['StreamWeb'].'">Naladit</a>';
     
    6798}
    6899
    69 $System->AddModule(new IPTVPage());
    70 $System->Modules['IPTVPage']->GetOutput();
     100class TV extends AppModule
     101{
     102  function __construct($System)
     103  {
     104    parent::__construct($System);
     105    $this->Name = 'TV';
     106    $this->Version = '1.0';
     107    $this->Creator = 'Chronos';
     108    $this->License = 'GNU/GPLv3';
     109    $this->Description = 'Television channels management';
     110    $this->Dependencies = array();
     111  } 
     112
     113  function Install()
     114  {
     115  }
     116 
     117  function Uninstall()
     118  {     
     119  }
     120 
     121  function Start()
     122  {
     123    parent::Start();
     124    $this->System->RegisterPage('tv', 'PageIPTV');
     125    $this->System->RegisterPage('tv/playlist.m3u', 'PagePlayList');   
     126  } 
     127 
     128  function Stop()
     129  {
     130  }
     131}
    71132
    72133?>
Note: See TracChangeset for help on using the changeset viewer.