Changeset 473 for trunk/Modules/TV/TV.php
- Timestamp:
- Jan 1, 2013, 12:21:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/TV/TV.php
r471 r473 2 2 3 3 include_once('Common/Global.php'); 4 5 class PagePlayList extends Page6 {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 } else25 {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 4 36 5 class PageIPTV extends Page … … 40 9 41 10 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() 42 20 { 43 21 global $Channels; … … 96 74 return($Output); 97 75 } 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 } 98 104 } 99 105 … … 123 129 parent::Start(); 124 130 $this->System->RegisterPage('tv', 'PageIPTV'); 125 $this->System->RegisterPage('tv/playlist.m3u', 'PagePlayList');126 131 } 127 132
Note:
See TracChangeset
for help on using the changeset viewer.