1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Module: XoopsTube |
5
|
|
|
* |
6
|
|
|
* You may not change or alter any portion of this comment or credits |
7
|
|
|
* of supporting developers from this source code or any supporting source code |
8
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
* |
10
|
|
|
* PHP version 5 |
11
|
|
|
* |
12
|
|
|
* @category Module |
13
|
|
|
* @package Xoopstube |
14
|
|
|
* @author XOOPS Development Team |
15
|
|
|
* @copyright 2001-2016 XOOPS Project (https://xoops.org) |
16
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
17
|
|
|
* @since 1.0.6 |
18
|
|
|
* @link https://xoops.org/ |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Xmf\Request; |
22
|
|
|
use XoopsModules\Xoopstube\{ |
23
|
|
|
Utility, |
24
|
|
|
Tree |
25
|
|
|
}; |
26
|
|
|
|
27
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'xoopstube_newlistindex.tpl'; |
28
|
|
|
require_once __DIR__ . '/header.php'; |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
//require_once XOOPS_ROOT_PATH . '/header.php'; |
32
|
|
|
$xoTheme->addStylesheet('modules/' . $moduleDirName . '/assets/css/xtubestyle.css'); |
33
|
|
|
|
34
|
|
|
global $xoopsModule; |
35
|
|
|
|
36
|
|
|
$catarray['imageheader'] = Utility::renderImageHeader(); |
37
|
|
|
$xoopsTpl->assign('catarray', $catarray); |
38
|
|
|
if (!isset($_GET['newvideoshowdays'])) { |
39
|
|
|
redirect_header('newlist.php?newvideoshowdays=7', 1, ''); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
if (Request::hasVar('newvideoshowdays', 'GET')) { |
43
|
|
|
$newvideoshowdays = Request::getInt('newvideoshowdays', 7, 'GET'); |
44
|
|
|
if (7 !== $newvideoshowdays) { |
45
|
|
|
if (14 !== $newvideoshowdays) { |
46
|
|
|
if (30 !== $newvideoshowdays) { |
47
|
|
|
redirect_header('newlist.php?newvideoshowdays=7', 5, _MD_XOOPSTUBE_STOPIT . '<br><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/security.png">'); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
$currentTime = time(); |
52
|
|
|
$timestamp30daysAgo = ($currentTime - (86400 * 30)); |
53
|
|
|
$timestamp7daysAgo = ($currentTime - (86400 * 7)); |
54
|
|
|
$allmonthvideos = 0; |
55
|
|
|
$allweekvideos = 0; |
56
|
|
|
$result = $GLOBALS['xoopsDB']->query( |
57
|
|
|
'SELECT lid, cid, published, updated FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE (published >= ' . $timestamp30daysAgo . ' AND published <= ' . $currentTime . ') OR updated >= ' . $timestamp30daysAgo . ' AND (expired = 0 OR expired > ' . $currentTime . ') AND offline = 0' |
58
|
|
|
); |
59
|
|
|
|
60
|
|
|
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
61
|
|
|
$published = ($myrow['updated'] > 0) ? $myrow['updated'] : $myrow['published']; |
62
|
|
|
++$allmonthvideos; |
63
|
|
|
if ($published > $timestamp7daysAgo) { |
64
|
|
|
++$allweekvideos; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
$xoopsTpl->assign('allweekvideos', $allweekvideos); |
68
|
|
|
$xoopsTpl->assign('allmonthvideos', $allmonthvideos); |
69
|
|
|
|
70
|
|
|
// List Last VARIABLE Days of videos |
71
|
|
|
// $newvideoshowdays = cleanRequestVars($_REQUEST, 'newvideoshowdays', 7 ); |
72
|
|
|
$newvideoshowdays = (int)Request::getInt('newvideoshowdays', 7, 'GET'); |
73
|
|
|
$xoopsTpl->assign('newvideoshowdays', $newvideoshowdays); |
74
|
|
|
|
75
|
|
|
$dailyvideos = []; |
76
|
|
|
for ($i = 0; $i < $newvideoshowdays; ++$i) { |
77
|
|
|
$key = $newvideoshowdays - $i - 1; |
78
|
|
|
$time = $currentTime - (86400 * $key); |
79
|
|
|
$dailyvideos[$key]['newvideodayRaw'] = $time; |
80
|
|
|
$dailyvideos[$key]['newvideoView'] = Utility::getTimestamp(formatTimestamp($time, $GLOBALS['xoopsModuleConfig']['dateformat'])); |
81
|
|
|
$dailyvideos[$key]['totalvideos'] = 0; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
$timestamp30daysAgo = ($currentTime - (86400 * ($newvideoshowdays - 1))); |
86
|
|
|
$sql = 'SELECT lid, cid, published, updated FROM ' |
87
|
|
|
. $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
88
|
|
|
. ' WHERE (published > ' |
89
|
|
|
. $timestamp30daysAgo |
90
|
|
|
. ' AND published <= ' |
91
|
|
|
. $currentTime |
92
|
|
|
. ') OR (updated >= ' |
93
|
|
|
. $timestamp30daysAgo |
94
|
|
|
. ' AND updated <= ' |
95
|
|
|
. $currentTime |
96
|
|
|
. ') AND (expired = 0 OR expired > ' |
97
|
|
|
. $currentTime |
98
|
|
|
. ') AND offline = 0'; |
99
|
|
|
|
100
|
|
|
$result = $GLOBALS['xoopsDB']->query($sql); |
101
|
|
|
|
102
|
|
|
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
103
|
|
|
// $published = ($myrow['updated'] > 0) ? date($GLOBALS['xoopsModuleConfig']['dateformat'], $myrow['updated']) : date($GLOBALS['xoopsModuleConfig']['dateformat'], $myrow['published']); |
104
|
|
|
$published = ($myrow['updated'] > 0) ? $myrow['updated'] : $myrow['published']; |
105
|
|
|
$d = date('j', $published); |
106
|
|
|
$m = date('m', $published); |
107
|
|
|
$y = date('Y', $published); |
108
|
|
|
$key = (int)($currentTime - mktime(0, 0, 0, $m, $d, $y) / 86400); |
|
|
|
|
109
|
|
|
|
110
|
|
|
$key2 = $published; //mb |
111
|
|
|
|
112
|
|
|
if (isset($dailyvideos[$key])) { |
113
|
|
|
$dailyvideos[$key]['totalvideos']++; |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
ksort($dailyvideos); |
117
|
|
|
reset($dailyvideos); |
118
|
|
|
$xoopsTpl->assign('dailyvideos', $dailyvideos); |
119
|
|
|
|
120
|
|
|
$xoopsTpl->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
121
|
|
|
|
122
|
|
|
unset($dailyvideos); |
123
|
|
|
|
124
|
|
|
$mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
125
|
|
|
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos'); |
126
|
|
|
$sql .= ' WHERE (published > 0 AND published <= ' . $currentTime . ') |
127
|
|
|
OR (updated > 0 AND updated <= ' . $currentTime . ') |
128
|
|
|
AND (expired = 0 OR expired > ' . $currentTime . ') |
129
|
|
|
AND offline = 0 |
130
|
|
|
ORDER BY ' . $GLOBALS['xoopsModuleConfig']['linkxorder']; |
131
|
|
|
$result = $GLOBALS['xoopsDB']->query($sql, 10, 0); |
132
|
|
|
while (false !== ($videoArray = $GLOBALS['xoopsDB']->fetchArray($result))) { |
133
|
|
|
require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
$xoopsTpl->assign('back', '<a href="javascript:history.go(-1)"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/back.png"></a>'); |
137
|
|
|
$xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
138
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
139
|
|
|
|