Ignore:
Timestamp:
Jan 1, 2013, 12:21:11 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Otvírací doby přepracovány na aplikační modul.
  • Upraveno: Předávání zobrazení stránek nyní pracuje se stromem registrovaných stránek.
File:
1 edited

Legend:

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

    r471 r473  
    22
    33include_once('Common/Global.php');
    4 
    5 class 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 }
    354
    365class PageIPTV extends Page
     
    409 
    4110  function Show()
     11  {   
     12    if(count($this->System->PathItems) > 1)
     13    {
     14      if($this->System->PathItems[1] == 'playlist.m3u') return($this->ShowPlayList());
     15        else return(PAGE_NOT_FOUND);
     16    } else return($this->ShowChannelList());
     17  }
     18 
     19  function ShowChannelList()
    4220  {
    4321    global $Channels;
     
    9674    return($Output);
    9775  }
     76
     77  function ShowPlayList()
     78  {
     79    $this->ClearPage = true;
     80       
     81    Header("Content-Type: audio/mpegurl");
     82    Header("Content-Disposition: attachment; filename=playlist.m3u");
     83
     84    echo('#EXTM3U'."\n");
     85    if(array_key_exists('id', $_GET))
     86    {
     87      $DbResult = $this->Database->select('TV', '*', ' (`Stream` <> "") AND (`ShortName`="'.addslashes($_GET['id']).'") ');
     88      if($DbResult->num_rows > 0)
     89      {
     90        $Channel = $DbResult->fetch_array();
     91        echo('#EXTINF:0,'.$Channel['Name']."\n");
     92        echo($Channel['Stream']."\n");
     93      }
     94    } else
     95    {
     96      $DbResult = $this->Database->select('TV', '*', ' (`Stream` <> "") ORDER BY `Name` ');
     97      while($Channel = $DbResult->fetch_array())
     98      {
     99        echo('#EXTINF:0,'.$Channel['Name']."\n");
     100        echo($Channel['Stream']."\n");
     101      }
     102    }
     103  } 
    98104}
    99105
     
    123129    parent::Start();
    124130    $this->System->RegisterPage('tv', 'PageIPTV');
    125     $this->System->RegisterPage('tv/playlist.m3u', 'PagePlayList');   
    126131  } 
    127132 
Note: See TracChangeset for help on using the changeset viewer.