forked from grimelinse/FOS-Streaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getfile.php
63 lines (53 loc) · 2.38 KB
/
getfile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
include('config.php');
logincheck();
if(!isset($_GET['id'])) {
die();
}
$id = $_GET['id'];
$user = User::find($id);
$setting = Setting::first();
if(isset($_GET['e2'])) {
unlink('/tmp/userbouquet.favourites.tv');
file_put_contents('/tmp/userbouquet.favourites.tv',"#NAME FOS-Streaming \r\n", FILE_APPEND);
foreach($user->categories as $category) {
foreach($category->streams as $stream) {
if($stream->running == 1) {
file_put_contents('/tmp/userbouquet.favourites.tv',"#SERVICE 1:0:1:0:0:0:0:0:0:0:http%3A//".$setting->webip."%3A".$setting->webport."/".$user->username."/".$user->password."/".$stream->id ."\r\n", FILE_APPEND);
file_put_contents('/tmp/userbouquet.favourites.tv',"#DESCRIPTION " . $stream->name ."\r\n", FILE_APPEND);
}
}
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="userbouquet.favourites.tv"');
readfile("/tmp/userbouquet.favourites.tv");
}
if(isset($_GET['m3u'])) {
unlink('/tmp/tv_user.m3u');
file_put_contents('/tmp/tv_user.m3u',"#EXTM3U \r\n", FILE_APPEND);
foreach($user->categories as $category) {
foreach($category->streams as $stream) {
if($stream->running == 1) {
file_put_contents('/tmp/tv_user.m3u', "#EXTINF:0," . $stream->name . "\r\n", FILE_APPEND);
file_put_contents('/tmp/tv_user.m3u', "http://" . $setting->webip . ":" . $setting->webport . "/" . $user->username . "/" . $user->password . "/" . $stream->id . "\r\n", FILE_APPEND);
}
}
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="tv_user.m3u"');
readfile("/tmp/tv_user.m3u");
}
if(isset($_GET['tv'])) {
unlink('/tmp/Channels.txt');
file_put_contents('/tmp/tv_user.m3u',"", FILE_APPEND);
foreach($user->categories as $category) {
foreach($category->streams as $stream) {
if($stream->running == 1) {
file_put_contents('/tmp/Channels.txt',"ext,$stream->name,http://".$setting->webip.":".$setting->webport."/".$user->username."/".$user->password."/".$stream->name."\r\n", FILE_APPEND);
}
}
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="Channels.txt"');
readfile("/tmp/Channels.txt");
}