-
Notifications
You must be signed in to change notification settings - Fork 5
/
video.php
executable file
·55 lines (45 loc) · 1.93 KB
/
video.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
<?php
/*
* This file is part of izap-videos plugin for Elgg.
*
* izap-videos for Elgg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* izap-videos for Elgg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with izap-videos for Elgg. If not, see <http://www.gnu.org/licenses/>.
*/
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$guid = (int) get_input('file_guid', 0);
$entity = get_entity($guid);
$izapqueue_obj = new izapQueue();
$get_converted_video = $izapqueue_obj->get_converted_video($guid);
if (!elgg_instanceof($entity, 'object', 'izap_video')) {
exit;
}
if ($get_converted_video) {
$get_video_name = end(explode('/', $get_converted_video[0]['main_file']));
$izapvideo_obj = new IzapVideo;
$set_video_name = $izapvideo_obj->getTmpPath($get_video_name);
$set_video_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', $set_video_name) . '_c.flv';
$elggfile_obj = new ElggFile;
$elggfile_obj->owner_guid = $entity->owner_guid;
$elggfile_obj->setFilename($set_video_name);
if (file_exists($elggfile_obj->getFilenameOnFilestore())) {// echo $elggfile_obj->getFilenameOnFilestore(); exit;
$contents = $elggfile_obj->grabFile();
}
$content_type = 'video/x-flv';
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+10 days")), true);
header("Pragma: public", true);
header("Cache-Control: public", true);
header("Content-Length: " . strlen($contents));
header("Content-type: {$content_type}", true);
echo $contents;
exit;
}