forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.php
58 lines (53 loc) · 1.99 KB
/
info.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
<?php
header('Content-Type: application/json');
$cachedFile = '../videos/cache/version.cache';
if (empty($_GET['modified']) && file_exists($cachedFile)) {
$content = file_get_contents($cachedFile);
$json = json_decode($content);
if (!empty($json)) {
$json->cache = filectime($cachedFile);
echo json_encode($json);
exit;
}
}
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/video.php';
$obj = new stdClass();
$obj->title = $config->getWebSiteTitle();
$obj->url = $global['webSiteRootURL'];
$obj->language = $config->getLanguage();
$obj->version = $config->getVersion();
$obj->date = date("Y-m-d H:i:s");
$obj->MySQLDate = getMySQLDate();
$obj->version = $config->getVersion();
$obj->plugins = Plugin::getAvailablePluginsBasic();
if (empty($_GET['version'])) {
$obj->videos = [];
//$_GET['modified'] = "2018-03-13 15:46:57";
$_REQUEST['rowCount'] = 100;
$videos = Video::getAllVideos('', false, true, [], false, true, true, false, null);
foreach ($videos as $key => $value) {
$vid = new stdClass();
$vid->id = $value['id'];
$vid->title = $value['title'];
$vid->clean_title = $value['clean_title'];
$vid->views_count = $value['views_count'];
$vid->category_name = $value['category'];
$vid->likes = $value['likes'];
$vid->dislikes = $value['dislikes'];
$vid->modified = $value['videoModified'];
$vid->duration = $value['duration'];
//$vid->description = $value['description'];
$vid->description = '';
$vid->type = $value['type'];
$vid->image_url = Video::getImageFromFilename($value['filename']);
$obj->videos[] = $vid;
}
}
$obj->totalVideosResponse = is_array($obj->videos)?count($obj->videos):0;
$json = json_encode($obj);
file_put_contents($cachedFile, $json);
echo $json;