|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/** |
|
3
|
|
|
* Module: XoopsTube |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* |
|
9
|
|
|
* PHP version 5 |
|
10
|
|
|
* |
|
11
|
|
|
* @category Module |
|
12
|
|
|
* @package Xoopstube |
|
13
|
|
|
* @author XOOPS Development Team |
|
14
|
|
|
* @copyright 2001-2013 The XOOPS Project |
|
15
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
16
|
|
|
* @version $Id$ |
|
17
|
|
|
* @link http://sourceforge.net/projects/xoops/ |
|
18
|
|
|
* @since 1.0.6 |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
// defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
include_once __DIR__ . '/common.php'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* xtubeGetHandler() |
|
27
|
|
|
* |
|
28
|
|
|
* @param $name |
|
29
|
|
|
* @param boolean $optional |
|
30
|
|
|
* |
|
31
|
|
|
* @return bool |
|
|
|
|
|
|
32
|
|
|
*/ |
|
33
|
|
|
function &xtubeGetHandler($name, $optional = false) |
|
|
|
|
|
|
34
|
|
|
{ |
|
35
|
|
|
global $handlers, $xoopsModule; |
|
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
$name = strtolower(trim($name)); |
|
38
|
|
|
if (!isset($handlers[$name])) { |
|
39
|
|
|
if (file_exists( |
|
40
|
|
|
$hnd_file |
|
41
|
|
|
= XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/class/class_' . $name . '.php' |
|
42
|
|
|
) |
|
43
|
|
|
) { |
|
44
|
|
|
require_once $hnd_file; |
|
45
|
|
|
} |
|
46
|
|
|
$class = 'xtube' . ucfirst($name) . 'Handler'; |
|
47
|
|
|
if (class_exists($class)) { |
|
48
|
|
|
$handlers[$name] = new $class($GLOBALS['xoopsDB']); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
if (!isset($handlers[$name]) && !$optional) { |
|
52
|
|
|
trigger_error( |
|
53
|
|
|
'<div>Class <span style="font-weight: bold;">' . $class . '</span> does not exist.</div><div>Handler Name: ' . $name, |
|
|
|
|
|
|
54
|
|
|
E_USER_ERROR |
|
55
|
|
|
) . '</div>'; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return isset($handlers[$name]) ? $handlers[$name] : false; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param int $cid |
|
63
|
|
|
* @param string $permType |
|
64
|
|
|
* @param bool $redirect |
|
65
|
|
|
* |
|
66
|
|
|
* @return bool |
|
|
|
|
|
|
67
|
|
|
*/ |
|
68
|
|
|
function xtubeCheckGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false) |
|
69
|
|
|
{ |
|
70
|
|
|
global $xoopsUser, $xoopsModule; |
|
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
73
|
|
|
$gperm_handler = & xoops_gethandler('groupperm'); |
|
74
|
|
|
if (!$gperm_handler->checkRight($permType, $cid, $groups, $xoopsModule->getVar('mid'))) { |
|
75
|
|
|
if ($redirect == false) { |
|
|
|
|
|
|
76
|
|
|
return false; |
|
77
|
|
|
} else { |
|
78
|
|
|
redirect_header('index.php', 3, _NOPERM); |
|
79
|
|
|
exit(); |
|
|
|
|
|
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
return true; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param int $lid |
|
88
|
|
|
* |
|
89
|
|
|
* @return bool |
|
90
|
|
|
*/ |
|
91
|
|
|
function xtubeGetVoteDetails($lid = 0) |
|
92
|
|
|
{ |
|
93
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
94
|
|
|
|
|
95
|
|
|
$sql |
|
96
|
|
|
= 'SELECT |
|
97
|
|
|
COUNT(rating) AS rate, |
|
98
|
|
|
MIN(rating) AS min_rate, |
|
99
|
|
|
MAX(rating) AS max_rate, |
|
100
|
|
|
AVG(rating) AS avg_rate, |
|
101
|
|
|
COUNT(ratinguser) AS rating_user, |
|
102
|
|
|
MAX(ratinguser) AS max_user, |
|
103
|
|
|
MAX(title) AS max_title, |
|
104
|
|
|
MIN(title) AS min_title, |
|
105
|
|
|
sum(ratinguser = 0) AS null_ratinguser |
|
106
|
|
|
FROM ' . $xoopsDB->prefix('xoopstube_votedata'); |
|
107
|
|
|
if ($lid > 0) { |
|
108
|
|
|
$sql .= ' WHERE lid=' . $lid; |
|
109
|
|
|
} |
|
110
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
|
111
|
|
|
return false; |
|
112
|
|
|
} |
|
113
|
|
|
$ret = $xoopsDB->fetchArray($result); |
|
114
|
|
|
|
|
115
|
|
|
return $ret; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @param int $sel_id |
|
120
|
|
|
* |
|
121
|
|
|
* @return array|bool |
|
122
|
|
|
*/ |
|
123
|
|
|
function xtubeCalculateVoteData($sel_id = 0) |
|
124
|
|
|
{ |
|
125
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
126
|
|
|
$ret = array(); |
|
127
|
|
|
$ret['useravgrating'] = 0; |
|
128
|
|
|
|
|
129
|
|
|
$sql = 'SELECT rating FROM ' . $xoopsDB->prefix('xoopstube_votedata'); |
|
130
|
|
|
if ($sel_id != 0) { |
|
131
|
|
|
$sql .= ' WHERE lid=' . $sel_id; |
|
132
|
|
|
} |
|
133
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
|
134
|
|
|
return false; |
|
135
|
|
|
} |
|
136
|
|
|
$ret['uservotes'] = $xoopsDB->getRowsNum($result); |
|
137
|
|
|
while (list($rating) = $xoopsDB->fetchRow($result)) { |
|
138
|
|
|
$ret['useravgrating'] += intval($rating); |
|
139
|
|
|
} |
|
140
|
|
|
if ($ret['useravgrating'] > 0) { |
|
141
|
|
|
$ret['useravgrating'] = number_format(($ret['useravgrating'] / $ret['uservotes']), 2); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
return $ret; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @param $array |
|
149
|
|
|
* @param null $name |
|
150
|
|
|
* @param null $def |
|
151
|
|
|
* @param bool $strict |
|
152
|
|
|
* @param int $lengthcheck |
|
153
|
|
|
* |
|
154
|
|
|
* @return array|int|null|string |
|
155
|
|
|
*/ |
|
156
|
|
|
function xtubeCleanRequestVars(&$array, $name = null, $def = null, $strict = false, $lengthcheck = 15) |
|
157
|
|
|
{ |
|
158
|
|
|
// Sanitise $_request for further use. This method gives more control and security. |
|
159
|
|
|
// Method is more for functionality rather than beauty at the moment, will correct later. |
|
160
|
|
|
unset($array['usercookie']); |
|
161
|
|
|
unset($array['PHPSESSID']); |
|
162
|
|
|
|
|
163
|
|
|
if (is_array($array) && $name == null) { |
|
164
|
|
|
$globals = array(); |
|
165
|
|
|
foreach (array_keys($array) as $k) { |
|
166
|
|
|
$value = strip_tags(trim($array[$k])); |
|
167
|
|
|
if (strlen($value >= $lengthcheck)) { |
|
168
|
|
|
return null; |
|
169
|
|
|
} |
|
170
|
|
View Code Duplication |
if (ctype_digit($value)) { |
|
|
|
|
|
|
171
|
|
|
$value = intval($value); |
|
172
|
|
|
} else { |
|
173
|
|
|
if ($strict == true) { |
|
|
|
|
|
|
174
|
|
|
$value = preg_replace('/\W/', '', trim($value)); |
|
175
|
|
|
} |
|
176
|
|
|
$value = strtolower(strval($value)); |
|
177
|
|
|
} |
|
178
|
|
|
$globals[$k] = $value; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
return $globals; |
|
182
|
|
|
} |
|
183
|
|
|
if (!isset($array[$name]) || !array_key_exists($name, $array)) { |
|
184
|
|
|
return $def; |
|
185
|
|
|
} else { |
|
186
|
|
|
$value = strip_tags(trim($array[$name])); |
|
187
|
|
|
} |
|
188
|
|
View Code Duplication |
if (ctype_digit($value)) { |
|
|
|
|
|
|
189
|
|
|
$value = intval($value); |
|
190
|
|
|
} else { |
|
191
|
|
|
if ($strict == true) { |
|
|
|
|
|
|
192
|
|
|
$value = preg_replace('/\W/', '', trim($value)); |
|
193
|
|
|
} |
|
194
|
|
|
$value = strtolower(strval($value)); |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
return $value; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* @param int $cid |
|
202
|
|
|
* |
|
203
|
|
|
* @return string |
|
204
|
|
|
*/ |
|
205
|
|
|
function xtubeRenderToolbar($cid = 0) |
|
206
|
|
|
{ |
|
207
|
|
|
$toolbar = '[ '; |
|
208
|
|
|
if (true == xtubeCheckGroups($cid, 'XTubeSubPerm')) { |
|
209
|
|
|
$toolbar .= '<a href="submit.php?cid=' . $cid . '">' . _MD_XOOPSTUBE_SUBMITVIDEO . '</a> | '; |
|
210
|
|
|
} |
|
211
|
|
|
$toolbar |
|
212
|
|
|
.= '<a href="newlist.php?newvideoshowdays=7">' . _MD_XOOPSTUBE_LATESTLIST . '</a> | <a href="topten.php?list=hit">' . _MD_XOOPSTUBE_POPULARITY . '</a> | <a href="topten.php?list=rate">' |
|
213
|
|
|
. _MD_XOOPSTUBE_TOPRATED . '</a> ]'; |
|
214
|
|
|
|
|
215
|
|
|
return $toolbar; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* |
|
220
|
|
|
*/ |
|
221
|
|
|
function xtubeGetServerStatistics() |
|
222
|
|
|
{ |
|
223
|
|
|
global $xoopsModule; |
|
|
|
|
|
|
224
|
|
|
echo '<fieldset style="border: #E8E8E8 1px solid;"> |
|
225
|
|
|
<legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_VIDEO_IMAGEINFO . '</legend> |
|
226
|
|
|
<div style="padding: 8px;"> |
|
227
|
|
|
<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/server.png" alt="" style="float: left; padding-right: 10px;" /> |
|
228
|
|
|
<div>' . _AM_XOOPSTUBE_VIDEO_SPHPINI . '</div>'; |
|
229
|
|
|
|
|
230
|
|
|
$safemode = (ini_get('safe_mode')) ? _AM_XOOPSTUBE_VIDEO_ON . _AM_XOOPSTUBE_VIDEO_SAFEMODEPROBLEMS : _AM_XOOPSTUBE_VIDEO_OFF; |
|
231
|
|
|
$registerglobals = (ini_get('register_globals') == '') ? _AM_XOOPSTUBE_VIDEO_OFF : _AM_XOOPSTUBE_VIDEO_ON; |
|
232
|
|
|
$videos = (ini_get('file_uploads')) ? _AM_XOOPSTUBE_VIDEO_ON : _AM_XOOPSTUBE_VIDEO_OFF; |
|
233
|
|
|
|
|
234
|
|
|
$gdlib = (function_exists('gd_info')) ? _AM_XOOPSTUBE_VIDEO_GDON : _AM_XOOPSTUBE_VIDEO_GDOFF; |
|
235
|
|
|
echo '<li>' . _AM_XOOPSTUBE_VIDEO_GDLIBSTATUS . $gdlib; |
|
236
|
|
|
if (function_exists('gd_info')) { |
|
237
|
|
|
if (true == $gdlib = gd_info()) { |
|
238
|
|
|
echo '<li>' . _AM_XOOPSTUBE_VIDEO_GDLIBVERSION . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
239
|
|
|
} |
|
240
|
|
|
} |
|
241
|
|
|
echo '<br /><br />'; |
|
242
|
|
|
echo '<li>' . _AM_XOOPSTUBE_VIDEO_SAFEMODESTATUS . $safemode; |
|
243
|
|
|
echo '<li>' . _AM_XOOPSTUBE_VIDEO_REGISTERGLOBALS . $registerglobals; |
|
244
|
|
|
echo '<li>' . _AM_XOOPSTUBE_VIDEO_SERVERUPLOADSTATUS . $videos; |
|
245
|
|
|
echo '</div>'; |
|
246
|
|
|
echo '</fieldset>'; |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
// xtubeDisplayIcons() |
|
250
|
|
|
// |
|
251
|
|
|
// @param $time |
|
252
|
|
|
// @param integer $status |
|
253
|
|
|
// @param integer $counter |
|
254
|
|
|
// @return |
|
255
|
|
|
/** |
|
256
|
|
|
* @param $time |
|
257
|
|
|
* @param int $status |
|
258
|
|
|
* @param int $counter |
|
259
|
|
|
* |
|
260
|
|
|
* @return string |
|
261
|
|
|
*/ |
|
262
|
|
|
function xtubeDisplayIcons($time, $status = 0, $counter = 0) |
|
263
|
|
|
{ |
|
264
|
|
|
global $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
|
|
265
|
|
|
|
|
266
|
|
|
$new = ''; |
|
267
|
|
|
$pop = ''; |
|
268
|
|
|
|
|
269
|
|
|
$newdate = (time() - (86400 * intval($xoopsModuleConfig['daysnew']))); |
|
270
|
|
|
$popdate = (time() - (86400 * intval($xoopsModuleConfig['daysupdated']))); |
|
271
|
|
|
|
|
272
|
|
|
if ($xoopsModuleConfig['displayicons'] != 3) { |
|
273
|
|
|
if ($newdate < $time) { |
|
274
|
|
|
if (intval($status) > 1) { |
|
275
|
|
|
if ($xoopsModuleConfig['displayicons'] == 1) { |
|
276
|
|
|
$new |
|
277
|
|
|
= ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar( |
|
278
|
|
|
'dirname' |
|
279
|
|
|
) . '/assets/images/icon/updated.gif" alt="" style="vertical-align: middle;" />'; |
|
280
|
|
|
} |
|
281
|
|
|
if ($xoopsModuleConfig['displayicons'] == 2) { |
|
282
|
|
|
$new = '<em>' . _MD_XOOPSTUBE_UPDATED . '</em>'; |
|
283
|
|
|
} |
|
284
|
|
View Code Duplication |
} else { |
|
|
|
|
|
|
285
|
|
|
if ($xoopsModuleConfig['displayicons'] == 1) { |
|
286
|
|
|
$new |
|
287
|
|
|
= ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar( |
|
288
|
|
|
'dirname' |
|
289
|
|
|
) . '/assets/images/icon/new.gif" alt="" style="vertical-align: middle;" />'; |
|
290
|
|
|
} |
|
291
|
|
|
if ($xoopsModuleConfig['displayicons'] == 2) { |
|
292
|
|
|
$new = '<em>' . _MD_XOOPSTUBE_NEW . '</em>'; |
|
293
|
|
|
} |
|
294
|
|
|
} |
|
295
|
|
|
} |
|
296
|
|
|
if ($popdate > $time) { |
|
297
|
|
View Code Duplication |
if ($counter >= $xoopsModuleConfig['popular']) { |
|
|
|
|
|
|
298
|
|
|
if ($xoopsModuleConfig['displayicons'] == 1) { |
|
299
|
|
|
$pop |
|
300
|
|
|
= ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar( |
|
301
|
|
|
'dirname' |
|
302
|
|
|
) . '/assets/images/icon/popular.png" alt="" style="vertical-align: middle;" />'; |
|
303
|
|
|
} |
|
304
|
|
|
if ($xoopsModuleConfig['displayicons'] == 2) { |
|
305
|
|
|
$pop = '<em>' . _MD_XOOPSTUBE_POPULAR . '!</em>'; |
|
306
|
|
|
} |
|
307
|
|
|
} |
|
308
|
|
|
} |
|
309
|
|
|
} |
|
310
|
|
|
$icons = $new . ' ' . $pop; |
|
311
|
|
|
|
|
312
|
|
|
return $icons; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
View Code Duplication |
if (!function_exists('xtubeConvertOrderByIn')) { |
|
|
|
|
|
|
316
|
|
|
// Reusable Link Sorting Functions |
|
317
|
|
|
// xtubeConvertOrderByIn() |
|
318
|
|
|
// @param $orderby |
|
319
|
|
|
// @return |
|
320
|
|
|
/** |
|
321
|
|
|
* @param $orderby |
|
322
|
|
|
* |
|
323
|
|
|
* @return string |
|
324
|
|
|
*/ |
|
325
|
|
|
function xtubeConvertOrderByIn($orderby) |
|
326
|
|
|
{ |
|
327
|
|
|
switch (trim($orderby)) { |
|
328
|
|
|
case 'titleA': |
|
329
|
|
|
$orderby = 'title ASC'; |
|
330
|
|
|
break; |
|
331
|
|
|
case 'dateA': |
|
332
|
|
|
$orderby = 'published ASC'; |
|
333
|
|
|
break; |
|
334
|
|
|
case 'hitsA': |
|
335
|
|
|
$orderby = 'hits ASC'; |
|
336
|
|
|
break; |
|
337
|
|
|
case 'ratingA': |
|
338
|
|
|
$orderby = 'rating ASC'; |
|
339
|
|
|
break; |
|
340
|
|
|
case 'countryA': |
|
341
|
|
|
$orderby = 'country ASC'; |
|
342
|
|
|
break; |
|
343
|
|
|
case 'titleD': |
|
344
|
|
|
$orderby = 'title DESC'; |
|
345
|
|
|
break; |
|
346
|
|
|
case 'hitsD': |
|
347
|
|
|
$orderby = 'hits DESC'; |
|
348
|
|
|
break; |
|
349
|
|
|
case 'ratingD': |
|
350
|
|
|
$orderby = 'rating DESC'; |
|
351
|
|
|
break; |
|
352
|
|
|
case'dateD': |
|
|
|
|
|
|
353
|
|
|
$orderby = 'published DESC'; |
|
354
|
|
|
break; |
|
355
|
|
|
case 'countryD': |
|
356
|
|
|
$orderby = 'country DESC'; |
|
357
|
|
|
break; |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
return $orderby; |
|
361
|
|
|
} |
|
362
|
|
|
} |
|
363
|
|
|
if (!function_exists('xtubeConvertOrderByTrans')) { |
|
364
|
|
|
/** |
|
365
|
|
|
* @param $orderby |
|
366
|
|
|
* |
|
367
|
|
|
* @return string |
|
368
|
|
|
*/ |
|
369
|
|
|
function xtubeConvertOrderByTrans($orderby) |
|
370
|
|
|
{ |
|
371
|
|
|
switch ($orderby) { |
|
372
|
|
|
case 'hits ASC': |
|
373
|
|
|
$orderByTrans = _MD_XOOPSTUBE_POPULARITYLTOM; |
|
374
|
|
|
break; |
|
375
|
|
|
case 'hits DESC': |
|
376
|
|
|
$orderByTrans = _MD_XOOPSTUBE_POPULARITYMTOL; |
|
377
|
|
|
break; |
|
378
|
|
|
case 'title ASC': |
|
379
|
|
|
$orderByTrans = _MD_XOOPSTUBE_TITLEATOZ; |
|
380
|
|
|
break; |
|
381
|
|
|
case 'title DESC': |
|
382
|
|
|
$orderByTrans = _MD_XOOPSTUBE_TITLEZTOA; |
|
383
|
|
|
break; |
|
384
|
|
|
case 'published ASC': |
|
385
|
|
|
$orderByTrans = _MD_XOOPSTUBE_DATEOLD; |
|
386
|
|
|
break; |
|
387
|
|
|
case 'published DESC': |
|
388
|
|
|
$orderByTrans = _MD_XOOPSTUBE_DATENEW; |
|
389
|
|
|
break; |
|
390
|
|
|
case 'rating ASC': |
|
391
|
|
|
$orderByTrans = _MD_XOOPSTUBE_RATINGLTOH; |
|
392
|
|
|
break; |
|
393
|
|
|
case 'rating DESC': |
|
394
|
|
|
$orderByTrans = _MD_XOOPSTUBE_RATINGHTOL; |
|
395
|
|
|
break; |
|
396
|
|
|
case'country ASC': |
|
|
|
|
|
|
397
|
|
|
$orderByTrans = _MD_XOOPSTUBE_COUNTRYLTOH; |
|
398
|
|
|
break; |
|
399
|
|
|
case 'country DESC': |
|
400
|
|
|
$orderByTrans = _MD_XOOPSTUBE_COUNTRYHTOL; |
|
401
|
|
|
break; |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
return $orderByTrans; |
|
|
|
|
|
|
405
|
|
|
} |
|
406
|
|
|
} |
|
407
|
|
View Code Duplication |
if (!function_exists('xtubeConvertOrderByOut')) { |
|
|
|
|
|
|
408
|
|
|
/** |
|
409
|
|
|
* @param $orderby |
|
410
|
|
|
* |
|
411
|
|
|
* @return string |
|
412
|
|
|
*/ |
|
413
|
|
|
function xtubeConvertOrderByOut($orderby) |
|
414
|
|
|
{ |
|
415
|
|
|
switch ($orderby) { |
|
416
|
|
|
case 'title ASC': |
|
417
|
|
|
$orderby = 'titleA'; |
|
418
|
|
|
break; |
|
419
|
|
|
case 'published ASC': |
|
420
|
|
|
$orderby = 'dateA'; |
|
421
|
|
|
break; |
|
422
|
|
|
case 'hits ASC': |
|
423
|
|
|
$orderby = 'hitsA'; |
|
424
|
|
|
break; |
|
425
|
|
|
case 'rating ASC': |
|
426
|
|
|
$orderby = 'ratingA'; |
|
427
|
|
|
break; |
|
428
|
|
|
case 'country ASC': |
|
429
|
|
|
$orderby = 'countryA'; |
|
430
|
|
|
break; |
|
431
|
|
|
case 'title DESC': |
|
432
|
|
|
$orderby = 'titleD'; |
|
433
|
|
|
break; |
|
434
|
|
|
case 'published DESC': |
|
435
|
|
|
$orderby = 'dateD'; |
|
436
|
|
|
break; |
|
437
|
|
|
case 'hits DESC': |
|
438
|
|
|
$orderby = 'hitsD'; |
|
439
|
|
|
break; |
|
440
|
|
|
case 'rating DESC': |
|
441
|
|
|
$orderby = 'ratingD'; |
|
442
|
|
|
break; |
|
443
|
|
|
case 'country DESC': |
|
444
|
|
|
$orderby = 'countryD'; |
|
445
|
|
|
break; |
|
446
|
|
|
} |
|
447
|
|
|
|
|
448
|
|
|
return $orderby; |
|
449
|
|
|
} |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
// updaterating() |
|
453
|
|
|
// @param $sel_id |
|
454
|
|
|
// @return updates rating data in itemtable for a given item |
|
455
|
|
|
/** |
|
456
|
|
|
* @param $sel_id |
|
457
|
|
|
*/ |
|
458
|
|
|
function xtubeUpdateRating($sel_id) |
|
459
|
|
|
{ |
|
460
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
461
|
|
|
$query = 'SELECT rating FROM ' . $xoopsDB->prefix('xoopstube_votedata') . ' WHERE lid=' . $sel_id; |
|
462
|
|
|
$voteresult = $xoopsDB->query($query); |
|
463
|
|
|
$votesDB = $xoopsDB->getRowsNum($voteresult); |
|
464
|
|
|
$totalrating = 0; |
|
465
|
|
|
while (list($rating) = $xoopsDB->fetchRow($voteresult)) { |
|
466
|
|
|
$totalrating += $rating; |
|
467
|
|
|
} |
|
468
|
|
|
$finalrating = $totalrating / $votesDB; |
|
469
|
|
|
$finalrating = number_format($finalrating, 4); |
|
470
|
|
|
$sql = sprintf( |
|
471
|
|
|
'UPDATE %s SET rating = %u, votes = %u WHERE lid = %u', |
|
472
|
|
|
$xoopsDB->prefix('xoopstube_videos'), |
|
473
|
|
|
$finalrating, |
|
474
|
|
|
$votesDB, |
|
475
|
|
|
$sel_id |
|
476
|
|
|
); |
|
477
|
|
|
$xoopsDB->query($sql); |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
// totalcategory() |
|
481
|
|
|
// @param integer $pid |
|
482
|
|
|
// @return |
|
483
|
|
|
/** |
|
484
|
|
|
* @param int $pid |
|
485
|
|
|
* |
|
486
|
|
|
* @return int |
|
487
|
|
|
*/ |
|
488
|
|
|
function xtubeGetTotalCategoryCount($pid = 0) |
|
489
|
|
|
{ |
|
490
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
491
|
|
|
|
|
492
|
|
|
$sql = 'SELECT cid FROM ' . $xoopsDB->prefix('xoopstube_cat'); |
|
493
|
|
|
if ($pid > 0) { |
|
494
|
|
|
$sql .= ' WHERE pid = 0'; |
|
495
|
|
|
} |
|
496
|
|
|
$result = $xoopsDB->query($sql); |
|
497
|
|
|
$catlisting = 0; |
|
498
|
|
|
while (list($cid) = $xoopsDB->fetchRow($result)) { |
|
499
|
|
|
if (xtubeCheckGroups($cid)) { |
|
500
|
|
|
++$catlisting; |
|
501
|
|
|
} |
|
502
|
|
|
} |
|
503
|
|
|
|
|
504
|
|
|
return $catlisting; |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
// xtubeGetTotalItems() |
|
508
|
|
|
// @param integer $sel_id |
|
509
|
|
|
// @param integer $get_child |
|
510
|
|
|
// @param integer $return_sql |
|
511
|
|
|
// @return |
|
512
|
|
|
/** |
|
513
|
|
|
* @param int $sel_id |
|
514
|
|
|
* @param int $get_child |
|
515
|
|
|
* @param int $return_sql |
|
516
|
|
|
* |
|
517
|
|
|
* @return string |
|
|
|
|
|
|
518
|
|
|
*/ |
|
519
|
|
|
function xtubeGetTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0) |
|
520
|
|
|
{ |
|
521
|
|
|
global $xoopsDB, $mytree, $_check_array; |
|
|
|
|
|
|
522
|
|
|
|
|
523
|
|
|
if ($sel_id > 0) { |
|
524
|
|
|
$sql = 'SELECT a.lid, a.cid, a.published FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid=a.lid' |
|
525
|
|
|
. ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > ' . time() . ') AND offline = 0 ' . ' AND (b.cid=a.cid OR (a.cid=' . $sel_id . ' OR b.cid=' |
|
526
|
|
|
. $sel_id . '))' . ' GROUP BY a.lid, a.cid, a.published'; |
|
527
|
|
|
} else { |
|
528
|
|
|
$sql |
|
529
|
|
|
= 'SELECT lid, cid, published FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' WHERE offline = 0 AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() |
|
530
|
|
|
. ')'; |
|
531
|
|
|
} |
|
532
|
|
|
if ($return_sql == 1) { |
|
533
|
|
|
return $sql; |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
$count = 0; |
|
537
|
|
|
$published_date = 0; |
|
538
|
|
|
|
|
539
|
|
|
$arr = array(); |
|
|
|
|
|
|
540
|
|
|
$result = $xoopsDB->query($sql); |
|
541
|
|
View Code Duplication |
while (list($lid, $cid, $published) = $xoopsDB->fetchRow($result)) { |
|
|
|
|
|
|
542
|
|
|
if (true == xtubeCheckGroups()) { |
|
543
|
|
|
++$count; |
|
544
|
|
|
$published_date = ($published > $published_date) ? $published : $published_date; |
|
545
|
|
|
} |
|
546
|
|
|
} |
|
547
|
|
|
|
|
548
|
|
|
$child_count = 0; |
|
549
|
|
|
if ($get_child == 1) { |
|
550
|
|
|
$arr = $mytree->getAllChildId($sel_id); |
|
551
|
|
|
$size = count($arr); |
|
|
|
|
|
|
552
|
|
|
for ($i = 0; $i < count($arr); ++$i) { |
|
|
|
|
|
|
553
|
|
|
$query2 = 'SELECT a.lid, a.published, a.cid FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid = a.lid' |
|
554
|
|
|
. ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > ' . time() . ') AND offline = 0' . ' AND (b.cid=a.cid OR (a.cid=' . $arr[$i] |
|
555
|
|
|
. ' OR b.cid=' . $arr[$i] . ')) GROUP BY a.lid, a.published, a.cid'; |
|
556
|
|
|
|
|
557
|
|
|
$result2 = $xoopsDB->query($query2); |
|
558
|
|
View Code Duplication |
while (list($lid, $published) = $xoopsDB->fetchRow($result2)) { |
|
|
|
|
|
|
559
|
|
|
if ($published == 0) { |
|
560
|
|
|
continue; |
|
561
|
|
|
} |
|
562
|
|
|
$published_date = ($published > $published_date) ? $published : $published_date; |
|
563
|
|
|
++$child_count; |
|
564
|
|
|
} |
|
565
|
|
|
} |
|
566
|
|
|
} |
|
567
|
|
|
$info['count'] = $count + $child_count; |
|
|
|
|
|
|
568
|
|
|
$info['published'] = $published_date; |
|
569
|
|
|
|
|
570
|
|
|
return $info; |
|
571
|
|
|
} |
|
572
|
|
|
|
|
573
|
|
|
/** |
|
574
|
|
|
* @param string $indeximage |
|
575
|
|
|
* @param string $indexheading |
|
576
|
|
|
* |
|
577
|
|
|
* @return string |
|
578
|
|
|
*/ |
|
579
|
|
|
function xtubeRenderImageHeader($indeximage = '', $indexheading = '') |
|
580
|
|
|
{ |
|
581
|
|
|
global $xoopsDB, $xoopsModuleConfig; |
|
|
|
|
|
|
582
|
|
|
if ($indeximage == '') { |
|
583
|
|
|
$result = $xoopsDB->query('SELECT indeximage, indexheading FROM ' . $xoopsDB->prefix('xoopstube_indexpage')); |
|
584
|
|
|
list($indeximage, $indexheading) = $xoopsDB->fetchrow($result); |
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
$image = ''; |
|
588
|
|
|
if (!empty($indeximage)) { |
|
589
|
|
|
$image = xtubeDisplayImage($indeximage, 'index.php', $xoopsModuleConfig['mainimagedir'], $indexheading); |
|
590
|
|
|
} |
|
591
|
|
|
|
|
592
|
|
|
return $image; |
|
593
|
|
|
} |
|
594
|
|
|
|
|
595
|
|
|
/** |
|
596
|
|
|
* @param string $image |
|
597
|
|
|
* @param string $path |
|
598
|
|
|
* @param string $imgsource |
|
599
|
|
|
* @param string $alttext |
|
600
|
|
|
* |
|
601
|
|
|
* @return string |
|
602
|
|
|
*/ |
|
603
|
|
|
function xtubeDisplayImage($image = '', $path = '', $imgsource = '', $alttext = '') |
|
604
|
|
|
{ |
|
605
|
|
|
global $xoopsConfig, $xoopsUser, $xoopsModule; |
|
|
|
|
|
|
606
|
|
|
|
|
607
|
|
|
$showimage = ''; |
|
608
|
|
|
// Check to see if link is given |
|
609
|
|
|
if ($path) { |
|
610
|
|
|
$showimage = '<a href="' . $path . '">'; |
|
611
|
|
|
} |
|
612
|
|
|
// checks to see if the file is valid else displays default blank image |
|
613
|
|
|
if (!is_dir(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}") && file_exists(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}") |
|
614
|
|
|
) { |
|
615
|
|
|
$showimage |
|
616
|
|
|
.= "<img src='" . XOOPS_URL . "/{$imgsource}/{$image}' border='0' title='" . $alttext . "' alt='" . $alttext . "' /></a>"; |
|
617
|
|
|
} else { |
|
618
|
|
|
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
|
619
|
|
|
$showimage .= '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/brokenimg.png" alt="' . _MD_XOOPSTUBE_ISADMINNOTICE . '" /></a>'; |
|
620
|
|
|
} else { |
|
621
|
|
|
$showimage |
|
622
|
|
|
.= '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/blank.png" alt="' . $alttext . '" /></a>'; |
|
623
|
|
|
} |
|
624
|
|
|
} |
|
625
|
|
|
clearstatcache(); |
|
626
|
|
|
|
|
627
|
|
|
return $showimage; |
|
628
|
|
|
} |
|
629
|
|
|
|
|
630
|
|
|
/** |
|
631
|
|
|
* @param $published |
|
632
|
|
|
* |
|
633
|
|
|
* @return mixed |
|
634
|
|
|
*/ |
|
635
|
|
|
function xtubeIsNewImage($published) |
|
636
|
|
|
{ |
|
637
|
|
|
global $xoopsModule, $xoopsDB; |
|
|
|
|
|
|
638
|
|
|
|
|
639
|
|
|
$oneday = (time() - (86400 * 1)); |
|
640
|
|
|
$threedays = (time() - (86400 * 3)); |
|
641
|
|
|
$week = (time() - (86400 * 7)); |
|
642
|
|
|
|
|
643
|
|
|
$path = 'modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon'; |
|
644
|
|
|
|
|
645
|
|
|
if ($published > 0 && $published < $week) { |
|
646
|
|
|
$indicator['image'] = "$path/linkload4.png"; |
|
|
|
|
|
|
647
|
|
|
$indicator['alttext'] = _MD_XOOPSTUBE_NEWLAST; |
|
648
|
|
|
} elseif ($published >= $week && $published < $threedays) { |
|
649
|
|
|
$indicator['image'] = "$path/linkload3.png"; |
|
|
|
|
|
|
650
|
|
|
$indicator['alttext'] = _MD_XOOPSTUBE_NEWTHIS; |
|
651
|
|
|
} elseif ($published >= $threedays && $published < $oneday) { |
|
652
|
|
|
$indicator['image'] = "$path/linkload2.png"; |
|
|
|
|
|
|
653
|
|
|
$indicator['alttext'] = _MD_XOOPSTUBE_THREE; |
|
654
|
|
|
} elseif ($published >= $oneday) { |
|
655
|
|
|
$indicator['image'] = "$path/linkload1.png"; |
|
|
|
|
|
|
656
|
|
|
$indicator['alttext'] = _MD_XOOPSTUBE_TODAY; |
|
657
|
|
|
} else { |
|
658
|
|
|
$indicator['image'] = "$path/linkload.png"; |
|
|
|
|
|
|
659
|
|
|
$indicator['alttext'] = _MD_XOOPSTUBE_NO_FILES; |
|
660
|
|
|
} |
|
661
|
|
|
|
|
662
|
|
|
return $indicator; |
|
663
|
|
|
} |
|
664
|
|
|
|
|
665
|
|
|
/** |
|
666
|
|
|
* @param $haystack |
|
667
|
|
|
* @param $needle |
|
668
|
|
|
* |
|
669
|
|
|
* @return string |
|
670
|
|
|
*/ |
|
671
|
|
|
function xtubeFindStringChar($haystack, $needle) |
|
672
|
|
|
{ |
|
673
|
|
|
return substr($haystack, 0, strpos($haystack, $needle) + 1); |
|
674
|
|
|
} |
|
675
|
|
|
|
|
676
|
|
|
/** |
|
677
|
|
|
* @param string $header |
|
678
|
|
|
* @param string $menu |
|
679
|
|
|
* @param string $extra |
|
680
|
|
|
* @param int $scount |
|
681
|
|
|
* |
|
682
|
|
|
* @return bool|null |
|
683
|
|
|
*/ |
|
684
|
|
|
function xtubeRenderAdminMenu($header = '', $menu = '', $extra = '', $scount = 4) |
|
|
|
|
|
|
685
|
|
|
{ |
|
686
|
|
|
global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
|
|
|
|
|
|
687
|
|
|
|
|
688
|
|
|
$_named_vidid = xoops_getenv('PHP_SELF'); |
|
689
|
|
|
if ($_named_vidid) { |
|
690
|
|
|
$thispage = basename($_named_vidid); |
|
691
|
|
|
} |
|
692
|
|
|
|
|
693
|
|
|
$op = (isset($_GET['op'])) ? $op = '?op=' . $_GET['op'] : ''; |
|
694
|
|
|
|
|
695
|
|
|
echo '<h4 style="color: #2F5376;">' . _AM_XOOPSTUBE_MODULE_NAME . '</h4>'; |
|
696
|
|
|
echo ' |
|
697
|
|
|
<div style="font-size: 10px; text-align: left; color: #2F5376; padding: 2px 6px; line-height: 18px;"> |
|
698
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
699
|
|
|
<a href="../admin/index.php">' . _AM_XOOPSTUBE_BINDEX . '</a> |
|
700
|
|
|
</span> |
|
701
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
702
|
|
|
<a href="../index.php">' . _AM_XOOPSTUBE_GOMODULE . '</a> |
|
703
|
|
|
</span> |
|
704
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
705
|
|
|
<a href="../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid') . '">' . _AM_XOOPSTUBE_PREFS . '</a> |
|
706
|
|
|
</span> |
|
707
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
708
|
|
|
<a href="../admin/permissions.php">' . _AM_XOOPSTUBE_BPERMISSIONS . '</a> |
|
709
|
|
|
</span> |
|
710
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
711
|
|
|
<a href="../admin/myblocksadmin.php">' . _AM_XOOPSTUBE_BLOCKADMIN . '</a> |
|
712
|
|
|
</span> |
|
713
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
714
|
|
|
<a href="../../system/admin.php?fct=modulesadmin&op=update&module=' . $xoopsModule->getVar('dirname') . '">' . _AM_XOOPSTUBE_BUPDATE . '</a> |
|
715
|
|
|
</span> |
|
716
|
|
|
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;"> |
|
717
|
|
|
<a href="../admin/about.php">' . _AM_XOOPSTUBE_ABOUT . '</a> |
|
718
|
|
|
</span> |
|
719
|
|
|
</div><br />'; |
|
720
|
|
|
|
|
721
|
|
|
if (empty($menu)) { |
|
722
|
|
|
// You can change this part to suit your own module. Defining this here will save you form having to do this each time. |
|
723
|
|
|
$menu = array( |
|
724
|
|
|
_AM_XOOPSTUBE_MVIDEOS => 'main.php?op=edit', |
|
725
|
|
|
_AM_XOOPSTUBE_MCATEGORY => 'category.php', |
|
726
|
|
|
_AM_XOOPSTUBE_INDEXPAGE => 'indexpage.php', |
|
727
|
|
|
// _AM_XOOPSTUBE_MXOOPSTUBE => 'main.php?op=edit', |
|
|
|
|
|
|
728
|
|
|
_AM_XOOPSTUBE_MUPLOADS => 'upload.php', |
|
729
|
|
|
_AM_XOOPSTUBE_VUPLOADS => 'vupload.php', |
|
730
|
|
|
_AM_XOOPSTUBE_MVOTEDATA => 'votedata.php', |
|
731
|
|
|
_AM_XOOPSTUBE_MCOMMENTS => '../../system/admin.php?module=' . $xoopsModule->getVar('mid') . '&status=0&limit=100&fct=comments&selsubmit=Go' |
|
732
|
|
|
); |
|
733
|
|
|
} |
|
734
|
|
|
|
|
735
|
|
|
if (!is_array($menu)) { |
|
736
|
|
|
echo '<table width="100%" cellpadding="2" cellspacing="1" class="outer">'; |
|
737
|
|
|
echo '<tr><td class="even" align="center"><b>' . _AM_XOOPSTUBE_NOMENUITEMS . '</b></td></tr></table><br />'; |
|
738
|
|
|
|
|
739
|
|
|
return false; |
|
740
|
|
|
} |
|
741
|
|
|
|
|
742
|
|
|
$oddnum = array( |
|
743
|
|
|
1 => '1', |
|
744
|
|
|
3 => '3', |
|
745
|
|
|
5 => '5', |
|
746
|
|
|
7 => '7', |
|
747
|
|
|
9 => '9', |
|
748
|
|
|
11 => '11', |
|
749
|
|
|
13 => '13' |
|
750
|
|
|
); |
|
751
|
|
|
// number of rows per menu |
|
752
|
|
|
$menurows = count($menu) / $scount; |
|
753
|
|
|
// total amount of rows to complete menu |
|
754
|
|
|
$menurow = ceil($menurows) * $scount; |
|
755
|
|
|
// actual number of menuitems per row |
|
756
|
|
|
$rowcount = $menurow / ceil($menurows); |
|
|
|
|
|
|
757
|
|
|
$count = 0; |
|
758
|
|
|
for ($i = count($menu); $i < $menurow; ++$i) { |
|
759
|
|
|
$tempArray = array(1 => null); |
|
760
|
|
|
$menu = array_merge($menu, $tempArray); |
|
761
|
|
|
++$count; |
|
762
|
|
|
} |
|
763
|
|
|
|
|
764
|
|
|
// Sets up the width of each menu cell |
|
765
|
|
|
$width = 100 / $scount; |
|
766
|
|
|
$width = ceil($width); |
|
767
|
|
|
|
|
768
|
|
|
$menucount = 0; |
|
769
|
|
|
$count = 0; |
|
770
|
|
|
// Menu table output |
|
771
|
|
|
echo '<table width="100%" cellpadding="2" cellspacing="1" class="outer" border="1"><tr>'; |
|
772
|
|
|
// Check to see if $menu is and array |
|
773
|
|
|
if (is_array($menu)) { |
|
774
|
|
|
$classcounts = 0; |
|
775
|
|
|
$classcol[0] = 'even'; |
|
|
|
|
|
|
776
|
|
|
|
|
777
|
|
|
for ($i = 1; $i < $menurow; ++$i) { |
|
778
|
|
|
++$classcounts; |
|
779
|
|
|
if ($classcounts >= $scount) { |
|
780
|
|
|
if ($classcol[$i - 1] == 'odd') { |
|
781
|
|
|
$classcol[$i] = ($classcol[$i - 1] == 'odd' && in_array($classcounts, $oddnum)) ? 'even' : 'odd'; |
|
782
|
|
|
} else { |
|
783
|
|
|
$classcol[$i] = ($classcol[$i - 1] == 'even' && in_array($classcounts, $oddnum)) ? 'odd' : 'even'; |
|
784
|
|
|
} |
|
785
|
|
|
$classcounts = 0; |
|
786
|
|
|
} else { |
|
787
|
|
|
$classcol[$i] = ($classcol[$i - 1] == 'even') ? 'odd' : 'even'; |
|
788
|
|
|
} |
|
789
|
|
|
} |
|
790
|
|
|
unset($classcounts); |
|
791
|
|
|
|
|
792
|
|
|
foreach ($menu as $menutitle => $menuvideo) { |
|
793
|
|
|
if ($thispage . $op == $menuvideo) { |
|
|
|
|
|
|
794
|
|
|
$classcol[$count] = 'outer'; |
|
795
|
|
|
} |
|
796
|
|
|
echo '<td class="' . $classcol[$count] . '" style="padding: 4px; text-align: center;" valign="middle" width="' . $width . '%">'; |
|
797
|
|
|
if (is_string($menuvideo)) { |
|
798
|
|
|
echo '<a href="' . $menuvideo . '"><span style="font-size: small;">' . $menutitle . '</span></a></td>'; |
|
799
|
|
|
} else { |
|
800
|
|
|
echo ' </td>'; |
|
801
|
|
|
} |
|
802
|
|
|
++$menucount; |
|
803
|
|
|
++$count; |
|
804
|
|
|
// Break menu cells to start a new row if $count > $scount |
|
805
|
|
|
if ($menucount >= $scount) { |
|
806
|
|
|
echo '</tr>'; |
|
807
|
|
|
$menucount = 0; |
|
808
|
|
|
} |
|
809
|
|
|
} |
|
810
|
|
|
echo '</table><br />'; |
|
811
|
|
|
unset($count); |
|
812
|
|
|
unset($menucount); |
|
813
|
|
|
} |
|
814
|
|
|
// ###### Output warn messages for security ###### |
|
815
|
|
|
if (is_dir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/')) { |
|
816
|
|
|
xoops_error( |
|
817
|
|
|
sprintf( |
|
818
|
|
|
_AM_XOOPSTUBE_WARNINSTALL1, |
|
819
|
|
|
XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/' |
|
820
|
|
|
) |
|
821
|
|
|
); |
|
822
|
|
|
echo '<br />'; |
|
823
|
|
|
} |
|
824
|
|
|
|
|
825
|
|
|
$_file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php'; |
|
826
|
|
|
if (file_exists($_file)) { |
|
827
|
|
|
xoops_error( |
|
828
|
|
|
sprintf( |
|
829
|
|
|
_AM_XOOPSTUBE_WARNINSTALL2, |
|
830
|
|
|
XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php' |
|
831
|
|
|
) |
|
832
|
|
|
); |
|
833
|
|
|
echo '<br />'; |
|
834
|
|
|
} |
|
835
|
|
|
|
|
836
|
|
|
$path1 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['mainimagedir']; |
|
837
|
|
|
if (!is_dir($path1)) { |
|
838
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path1)); |
|
839
|
|
|
echo '<br />'; |
|
840
|
|
|
} |
|
841
|
|
|
if (!is_writable($path1)) { |
|
842
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path1)); |
|
843
|
|
|
echo '<br />'; |
|
844
|
|
|
} |
|
845
|
|
|
|
|
846
|
|
|
$path1_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['mainimagedir'] . '/thumbs'; |
|
847
|
|
|
if (!is_dir($path1_t)) { |
|
848
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path1_t)); |
|
849
|
|
|
echo '<br />'; |
|
850
|
|
|
} |
|
851
|
|
|
if (!is_writable($path1_t)) { |
|
852
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path1_t)); |
|
853
|
|
|
echo '<br />'; |
|
854
|
|
|
} |
|
855
|
|
|
|
|
856
|
|
|
$path2 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['videoimgdir']; |
|
857
|
|
|
if (!is_dir($path2)) { |
|
858
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path2)); |
|
859
|
|
|
echo '<br />'; |
|
860
|
|
|
} |
|
861
|
|
|
if (!is_writable($path2)) { |
|
862
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path2)); |
|
863
|
|
|
echo '<br />'; |
|
864
|
|
|
} |
|
865
|
|
|
|
|
866
|
|
|
// $path2_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['videoimgdir'] . '/thumbs'; |
|
|
|
|
|
|
867
|
|
|
// if ( !is_dir( $path2_t ) || !is_writable( $path2_t ) ) { |
|
868
|
|
|
// xoops_error( sprintf( _AM_XOOPSTUBE_WARNINSTALL3, $path2_t ) ); |
|
869
|
|
|
// echo '<br />'; |
|
870
|
|
|
// } |
|
871
|
|
|
|
|
872
|
|
|
$path3 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage']; |
|
873
|
|
|
if (!is_dir($path3)) { |
|
874
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path3)); |
|
875
|
|
|
echo '<br />'; |
|
876
|
|
|
} |
|
877
|
|
|
if (!is_writable($path3)) { |
|
878
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path3)); |
|
879
|
|
|
echo '<br />'; |
|
880
|
|
|
} |
|
881
|
|
|
|
|
882
|
|
|
$path3_t = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage'] . '/thumbs'; |
|
883
|
|
|
if (!is_dir($path3_t)) { |
|
884
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path3_t)); |
|
885
|
|
|
echo '<br />'; |
|
886
|
|
|
} |
|
887
|
|
|
if (!is_writable($path3_t)) { |
|
888
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path3_t)); |
|
889
|
|
|
echo '<br />'; |
|
890
|
|
|
} |
|
891
|
|
|
|
|
892
|
|
|
$path4 = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['videodir']; |
|
893
|
|
|
if (!is_dir($path4)) { |
|
894
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL3, $path4)); |
|
895
|
|
|
echo '<br />'; |
|
896
|
|
|
} |
|
897
|
|
|
if (!is_writable($path4)) { |
|
898
|
|
|
xoops_error(sprintf(_AM_XOOPSTUBE_WARNINSTALL4, $path4)); |
|
899
|
|
|
echo '<br />'; |
|
900
|
|
|
} |
|
901
|
|
|
|
|
902
|
|
|
echo '<h4 style="color: #2F5376;">' . $header . '</h4>'; |
|
903
|
|
|
if ($extra) { |
|
904
|
|
|
echo '<div>' . $extra . '</div>'; |
|
905
|
|
|
} |
|
906
|
|
|
|
|
907
|
|
|
return null; |
|
908
|
|
|
} |
|
909
|
|
|
|
|
910
|
|
|
/** |
|
911
|
|
|
* @param $selected |
|
912
|
|
|
* @param $dirarray |
|
913
|
|
|
* @param $namearray |
|
914
|
|
|
*/ |
|
915
|
|
View Code Duplication |
function xtubeGetDirSelectOption($selected, $dirarray, $namearray) |
|
|
|
|
|
|
916
|
|
|
{ |
|
917
|
|
|
echo "<select size='1' name='workd' onchange='location.href=\"upload.php?rootpath=\"+this.options[this.selectedIndex].value'>"; |
|
918
|
|
|
echo "<option value=''>--------------------------------------</option>"; |
|
919
|
|
|
foreach ($namearray as $namearray => $workd) { |
|
920
|
|
|
if ($workd === $selected) { |
|
921
|
|
|
$opt_selected = 'selected'; |
|
|
|
|
|
|
922
|
|
|
} else { |
|
923
|
|
|
$opt_selected = ''; |
|
|
|
|
|
|
924
|
|
|
} |
|
925
|
|
|
echo '<option value="' . htmlspecialchars($namearray, ENT_QUOTES) . '" $opt_selected>' . $workd . '</option>'; |
|
926
|
|
|
} |
|
927
|
|
|
echo '</select>'; |
|
928
|
|
|
} |
|
929
|
|
|
|
|
930
|
|
|
/** |
|
931
|
|
|
* @param $selected |
|
932
|
|
|
* @param $dirarray |
|
933
|
|
|
* @param $namearray |
|
934
|
|
|
*/ |
|
935
|
|
View Code Duplication |
function xtubeVGetDirSelectOption($selected, $dirarray, $namearray) |
|
|
|
|
|
|
936
|
|
|
{ |
|
937
|
|
|
echo "<select size='1' name='workd' onchange='location.href=\"vupload.php?rootpath=\"+this.options[this.selectedIndex].value'>"; |
|
938
|
|
|
echo "<option value=''>--------------------------------------</option>"; |
|
939
|
|
|
foreach ($namearray as $namearray => $workd) { |
|
940
|
|
|
if ($workd === $selected) { |
|
941
|
|
|
$opt_selected = 'selected'; |
|
|
|
|
|
|
942
|
|
|
} else { |
|
943
|
|
|
$opt_selected = ''; |
|
|
|
|
|
|
944
|
|
|
} |
|
945
|
|
|
echo '<option value="' . htmlspecialchars($namearray, ENT_QUOTES) . '" $opt_selected>' . $workd . '</option>'; |
|
946
|
|
|
} |
|
947
|
|
|
echo '</select>'; |
|
948
|
|
|
} |
|
949
|
|
|
|
|
950
|
|
|
/** |
|
951
|
|
|
* @param $FILES |
|
952
|
|
|
* @param string $uploaddir |
|
953
|
|
|
* @param string $allowed_mimetypes |
|
954
|
|
|
* @param string $redirecturl |
|
955
|
|
|
* @param int $redirect |
|
956
|
|
|
* @param int $usertype |
|
957
|
|
|
* |
|
958
|
|
|
* @return array|null |
|
959
|
|
|
*/ |
|
960
|
|
|
function xtubeUploadFiles( |
|
|
|
|
|
|
961
|
|
|
$FILES, |
|
962
|
|
|
$uploaddir = 'uploads', |
|
963
|
|
|
$allowed_mimetypes = '', |
|
964
|
|
|
$redirecturl = 'index.php', |
|
965
|
|
|
// $num = 0, |
|
|
|
|
|
|
966
|
|
|
$redirect = 0, |
|
967
|
|
|
$usertype = 1 |
|
968
|
|
|
) { |
|
969
|
|
|
global $FILES, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
|
|
970
|
|
|
|
|
971
|
|
|
$down = array(); |
|
972
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/class/uploader.php'; |
|
973
|
|
|
if (empty($allowed_mimetypes)) { |
|
974
|
|
|
$allowed_mimetypes = xtube_retmime($FILES['userfile']['name'], $usertype); |
|
975
|
|
|
} |
|
976
|
|
|
$upload_dir = XOOPS_ROOT_PATH . '/' . $uploaddir . '/'; |
|
977
|
|
|
|
|
978
|
|
|
$maxfilesize = $xoopsModuleConfig['maxfilesize']; |
|
979
|
|
|
$maxfilewidth = $xoopsModuleConfig['maximgwidth']; |
|
980
|
|
|
$maxfileheight = $xoopsModuleConfig['maximgheight']; |
|
981
|
|
|
|
|
982
|
|
|
$uploader = new XoopsMediaUploader($upload_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); |
|
983
|
|
|
$uploader->noAdminSizeCheck(1); |
|
984
|
|
|
if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
985
|
|
|
if (!$uploader->upload()) { |
|
986
|
|
|
$errors = $uploader->getErrors(); |
|
987
|
|
|
redirect_header($redirecturl, 2, $errors); |
|
988
|
|
|
} else { |
|
989
|
|
|
if ($redirect) { |
|
990
|
|
|
redirect_header($redirecturl, 1, _AM_XOOPSTUBE_UPLOADFILE); |
|
991
|
|
|
} else { |
|
992
|
|
|
if (is_file($uploader->savedDestination)) { |
|
993
|
|
|
$down['url'] = XOOPS_URL . '/' . $uploaddir . '/' . strtolower($uploader->savedFileName); |
|
994
|
|
|
$down['size'] = filesize( |
|
995
|
|
|
XOOPS_ROOT_PATH . '/' . $uploaddir . '/' . strtolower($uploader->savedFileName) |
|
996
|
|
|
); |
|
997
|
|
|
} |
|
998
|
|
|
|
|
999
|
|
|
return $down; |
|
1000
|
|
|
} |
|
1001
|
|
|
} |
|
1002
|
|
|
} else { |
|
1003
|
|
|
$errors = $uploader->getErrors(); |
|
1004
|
|
|
redirect_header($redirecturl, 1, $errors); |
|
1005
|
|
|
} |
|
1006
|
|
|
|
|
1007
|
|
|
return null; |
|
1008
|
|
|
} |
|
1009
|
|
|
|
|
1010
|
|
|
/** |
|
1011
|
|
|
* @param $heading |
|
1012
|
|
|
*/ |
|
1013
|
|
View Code Duplication |
function xtubeRenderCategoryListHeader($heading) |
|
|
|
|
|
|
1014
|
|
|
{ |
|
1015
|
|
|
echo ' |
|
1016
|
|
|
<h4 style="font-weight: bold; color: #0A3760;">' . $heading . '</h4> |
|
1017
|
|
|
<table width="100%" cellspacing="1" class="outer" summary> |
|
1018
|
|
|
<tr> |
|
1019
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ID . '</th> |
|
1020
|
|
|
<th style=" font-size: smaller;"><b>' . _AM_XOOPSTUBE_FCATEGORY_TITLE . '</th> |
|
1021
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_FCATEGORY_WEIGHT . '</th> |
|
1022
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_FCATEGORY_CIMAGE . '</th> |
|
1023
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_CATSPONSOR . '</th> |
|
1024
|
|
|
<!-- <th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_PUBLISH . '</th> |
|
1025
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_EXPIRE . '</th> |
|
1026
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ONLINE . '</th> |
|
1027
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</th> --> |
|
1028
|
|
|
</tr> |
|
1029
|
|
|
'; |
|
1030
|
|
|
} |
|
1031
|
|
|
|
|
1032
|
|
|
/** |
|
1033
|
|
|
* @param $published |
|
1034
|
|
|
*/ |
|
1035
|
|
|
function xtubeRenderCategoryListBody($published) |
|
1036
|
|
|
{ |
|
1037
|
|
|
global $xtubemyts, $xtubeImageArray, $xoopsModuleConfig; |
|
|
|
|
|
|
1038
|
|
|
|
|
1039
|
|
|
$lid = $published['lid']; |
|
1040
|
|
|
$cid = $published['cid']; |
|
1041
|
|
|
|
|
1042
|
|
|
$title = '<a href="../singlevideo.php?cid=' . $published['cid'] . '&lid=' . $published['lid'] . '">' . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>'; |
|
1043
|
|
|
$maintitle = urlencode($xtubemyts->htmlSpecialChars(trim($published['title']))); |
|
|
|
|
|
|
1044
|
|
|
$cattitle |
|
1045
|
|
|
= '<a href="../viewcat.php?cid=' . $published['cid'] . '">' . xtubeGetCategoryTitle($published['cid']) . '</a>'; |
|
1046
|
|
|
$submitter = xtubeGetLinkedUserNameFromId($published['submitter']); |
|
1047
|
|
|
$returnsource = xtubeReturnSource($published['vidsource']); |
|
1048
|
|
|
$submitted = xtubeGetTimestamp(formatTimestamp($published['date'], $xoopsModuleConfig['dateformatadmin'])); |
|
|
|
|
|
|
1049
|
|
|
$publish = ($published['published'] > 0) ? xtubeGetTimestamp( |
|
1050
|
|
|
formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin']) |
|
1051
|
|
|
) : 'Not Published'; |
|
1052
|
|
|
$expires = $published['expired'] ? xtubeGetTimestamp( |
|
1053
|
|
|
formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin']) |
|
1054
|
|
|
) : _AM_XOOPSTUBE_MINDEX_NOTSET; |
|
1055
|
|
|
|
|
1056
|
|
|
if ((($published['expired'] && $published['expired'] > time()) OR $published['expired'] == 0) |
|
|
|
|
|
|
1057
|
|
|
&& ($published['published'] && $published['published'] < time()) |
|
1058
|
|
|
&& $published['offline'] == 0 |
|
1059
|
|
|
) { |
|
1060
|
|
|
$published_status = $xtubeImageArray['online']; |
|
1061
|
|
View Code Duplication |
} elseif (($published['expired'] && $published['expired'] < time()) && $published['offline'] == 0) { |
|
|
|
|
|
|
1062
|
|
|
$published_status = $xtubeImageArray['expired']; |
|
1063
|
|
|
} else { |
|
1064
|
|
|
$published_status = ($published['published'] == 0) ? '<a href="newvideos.php">' . $xtubeImageArray['offline'] . '</a>' : $xtubeImageArray['offline']; |
|
1065
|
|
|
} |
|
1066
|
|
|
|
|
1067
|
|
View Code Duplication |
if ($published['vidsource'] == 200) { |
|
|
|
|
|
|
1068
|
|
|
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_EDIT . '">' . $xtubeImageArray['editimg'] . '</a> '; |
|
1069
|
|
|
} else { |
|
1070
|
|
|
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_EDIT . '">' . $xtubeImageArray['editimg'] . '</a> '; |
|
1071
|
|
|
} |
|
1072
|
|
|
$icon .= '<a href="main.php?op=delete&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_DELETE . '">' . $xtubeImageArray['deleteimg'] . '</a> '; |
|
1073
|
|
|
$icon .= '<a href="altcat.php?op=main&cid=' . $cid . '&lid=' . $lid . '&title=' . $published['title'] . '" title="' . _AM_XOOPSTUBE_ALTCAT_CREATEF . '">' . $xtubeImageArray['altcat'] |
|
1074
|
|
|
. '</a>'; |
|
1075
|
|
|
|
|
1076
|
|
|
echo ' |
|
1077
|
|
|
<tr style="text-align: center; font-size: smaller;"> |
|
1078
|
|
|
<td class="head">' . $lid . '</span></td> |
|
1079
|
|
|
<td class="even" style="text-align: left;">' . $title . '</td> |
|
1080
|
|
|
<td class="even">' . $returnsource . '</td> |
|
1081
|
|
|
<td class="even">' . $cattitle . '</td> |
|
1082
|
|
|
<td class="even">' . $submitter . '</td> |
|
1083
|
|
|
<td class="even">' . $publish . '</td> |
|
1084
|
|
|
<td class="even">' . $expires . '</td> |
|
1085
|
|
|
<td class="even" style="width: 4%;">' . $published_status . '</td> |
|
1086
|
|
|
<td class="even" style="text-align: center; width: 6%; white-space: nowrap;">' . $icon . '</td> |
|
1087
|
|
|
</tr>'; |
|
1088
|
|
|
unset($published); |
|
1089
|
|
|
} |
|
1090
|
|
|
|
|
1091
|
|
|
/** |
|
1092
|
|
|
* @param $pubrowamount |
|
1093
|
|
|
* @param $start |
|
1094
|
|
|
* @param string $art |
|
1095
|
|
|
* @param string $_this |
|
1096
|
|
|
* @param $align |
|
1097
|
|
|
* |
|
1098
|
|
|
* @return bool|null |
|
1099
|
|
|
*/ |
|
1100
|
|
View Code Duplication |
function xtubeSetPageNavigationCategoryList($pubrowamount, $start, $art = 'art', $_this = '', $align) |
|
|
|
|
|
|
1101
|
|
|
{ |
|
1102
|
|
|
global $xoopsModuleConfig; |
|
|
|
|
|
|
1103
|
|
|
|
|
1104
|
|
|
if (($pubrowamount < $xoopsModuleConfig['admin_perpage'])) { |
|
1105
|
|
|
return false; |
|
1106
|
|
|
} |
|
1107
|
|
|
// Display Page Nav if published is > total display pages amount. |
|
1108
|
|
|
include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
1109
|
|
|
$pagenav = new XoopsPageNav($pubrowamount, $xoopsModuleConfig['admin_perpage'], $start, 'st' . $art, $_this); |
|
1110
|
|
|
echo '<div style="text-align: ' . $align . '; padding: 8px;">' . $pagenav->renderNav() . '</div>'; |
|
1111
|
|
|
|
|
1112
|
|
|
return null; |
|
1113
|
|
|
} |
|
1114
|
|
|
|
|
1115
|
|
|
/** |
|
1116
|
|
|
* |
|
1117
|
|
|
*/ |
|
1118
|
|
|
function xtubeRenderCategoryListFooter() |
|
1119
|
|
|
{ |
|
1120
|
|
|
echo '<tr style="text-align: center;"> |
|
1121
|
|
|
<td class="head" colspan="7">' . _AM_XOOPSTUBE_MINDEX_NOVIDEOSFOUND . '</td> |
|
1122
|
|
|
</tr>'; |
|
1123
|
|
|
} |
|
1124
|
|
|
|
|
1125
|
|
|
/** |
|
1126
|
|
|
* @param $heading |
|
1127
|
|
|
*/ |
|
1128
|
|
View Code Duplication |
function xtubeRenderVideoListHeader($heading) |
|
|
|
|
|
|
1129
|
|
|
{ |
|
1130
|
|
|
echo ' |
|
1131
|
|
|
<h4 style="font-weight: bold; color: #0A3760;">' . $heading . '</h4> |
|
1132
|
|
|
<table width="100%" cellspacing="1" class="outer" summary> |
|
1133
|
|
|
<tr> |
|
1134
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ID . '</th> |
|
1135
|
|
|
<th style=" font-size: smaller;"><b>' . _AM_XOOPSTUBE_MINDEX_TITLE . '</th> |
|
1136
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_VIDSOURCE2 . '</th> |
|
1137
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_CATTITLE . '</th> |
|
1138
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_POSTER . '</th> |
|
1139
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_PUBLISH . '</th> |
|
1140
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_EXPIRE . '</th> |
|
1141
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ONLINE . '</th> |
|
1142
|
|
|
<th style="text-align: center; font-size: smaller;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</th> |
|
1143
|
|
|
</tr> |
|
1144
|
|
|
'; |
|
1145
|
|
|
} |
|
1146
|
|
|
|
|
1147
|
|
|
/** |
|
1148
|
|
|
* @param $published |
|
1149
|
|
|
*/ |
|
1150
|
|
|
function xtubeRenderVideoListBody($published) |
|
1151
|
|
|
{ |
|
1152
|
|
|
global $xtubemyts, $xtubeImageArray, $xoopsModuleConfig, $pathIcon16; |
|
|
|
|
|
|
1153
|
|
|
|
|
1154
|
|
|
$lid = $published['lid']; |
|
1155
|
|
|
$cid = $published['cid']; |
|
1156
|
|
|
|
|
1157
|
|
|
$title = '<a href="../singlevideo.php?cid=' . $published['cid'] . '&lid=' . $published['lid'] . '">' . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>'; |
|
1158
|
|
|
$maintitle = urlencode($xtubemyts->htmlSpecialChars(trim($published['title']))); |
|
|
|
|
|
|
1159
|
|
|
$cattitle |
|
1160
|
|
|
= '<a href="../viewcat.php?cid=' . $published['cid'] . '">' . xtubeGetCategoryTitle($published['cid']) . '</a>'; |
|
1161
|
|
|
$submitter = xtubeGetLinkedUserNameFromId($published['submitter']); |
|
1162
|
|
|
$returnsource = xtubeReturnSource($published['vidsource']); |
|
1163
|
|
|
$submitted = xtubeGetTimestamp(formatTimestamp($published['date'], $xoopsModuleConfig['dateformatadmin'])); |
|
|
|
|
|
|
1164
|
|
|
$publish = ($published['published'] > 0) ? xtubeGetTimestamp( |
|
1165
|
|
|
formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin']) |
|
1166
|
|
|
) : 'Not Published'; |
|
1167
|
|
|
$expires = $published['expired'] ? xtubeGetTimestamp( |
|
1168
|
|
|
formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin']) |
|
1169
|
|
|
) : _AM_XOOPSTUBE_MINDEX_NOTSET; |
|
1170
|
|
|
|
|
1171
|
|
|
if ((($published['expired'] && $published['expired'] > time()) OR $published['expired'] == 0) |
|
|
|
|
|
|
1172
|
|
|
&& ($published['published'] && $published['published'] < time()) |
|
1173
|
|
|
&& $published['offline'] == 0 |
|
1174
|
|
|
) { |
|
1175
|
|
|
// $published_status = $xtubeImageArray['online']; |
|
|
|
|
|
|
1176
|
|
|
$published_status = '<a href="main.php?op=toggle&lid=' . $lid . '&offline=' . $published['offline'] . '"><img src="' . $pathIcon16 . '/1.png' . '" /></a>'; |
|
1177
|
|
|
|
|
1178
|
|
View Code Duplication |
} elseif (($published['expired'] && $published['expired'] < time()) && $published['offline'] == 0) { |
|
|
|
|
|
|
1179
|
|
|
$published_status = $xtubeImageArray['expired']; |
|
1180
|
|
|
} else { |
|
1181
|
|
|
$published_status = ($published['published'] == 0) ? '<a href="newvideos.php">' . $xtubeImageArray['offline'] . '</a>' |
|
1182
|
|
|
: '<a href="main.php?op=toggle&lid=' . $lid . '&offline=' . $published['offline'] . '"><img src="' . $pathIcon16 . '/0.png' . '" /></a>'; |
|
1183
|
|
|
} |
|
1184
|
|
|
|
|
1185
|
|
View Code Duplication |
if ($published['vidsource'] == 200) { |
|
|
|
|
|
|
1186
|
|
|
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_EDIT . '">' . $xtubeImageArray['editimg'] . '</a> '; |
|
1187
|
|
|
} else { |
|
1188
|
|
|
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_EDIT . '">' . $xtubeImageArray['editimg'] . '</a> '; |
|
1189
|
|
|
} |
|
1190
|
|
|
$icon .= '<a href="main.php?op=delete&lid=' . $lid . '" title="' . _AM_XOOPSTUBE_ICO_DELETE . '">' . $xtubeImageArray['deleteimg'] . '</a> '; |
|
1191
|
|
|
$icon .= '<a href="altcat.php?op=main&cid=' . $cid . '&lid=' . $lid . '&title=' . $published['title'] . '" title="' . _AM_XOOPSTUBE_ALTCAT_CREATEF . '">' . $xtubeImageArray['altcat'] |
|
1192
|
|
|
. '</a>'; |
|
1193
|
|
|
|
|
1194
|
|
|
echo ' |
|
1195
|
|
|
<tr style="text-align: center; font-size: smaller;"> |
|
1196
|
|
|
<td class="head">' . $lid . '</span></td> |
|
1197
|
|
|
<td class="even" style="text-align: left;">' . $title . '</td> |
|
1198
|
|
|
<td class="even">' . $returnsource . '</td> |
|
1199
|
|
|
<td class="even">' . $cattitle . '</td> |
|
1200
|
|
|
<td class="even">' . $submitter . '</td> |
|
1201
|
|
|
<td class="even">' . $publish . '</td> |
|
1202
|
|
|
<td class="even">' . $expires . '</td> |
|
1203
|
|
|
<td class="even" style="width: 4%;">' . $published_status . '</td> |
|
1204
|
|
|
<td class="even" style="text-align: center; width: 6%; white-space: nowrap;">' . $icon . '</td> |
|
1205
|
|
|
</tr>'; |
|
1206
|
|
|
unset($published); |
|
1207
|
|
|
} |
|
1208
|
|
|
|
|
1209
|
|
|
/** |
|
1210
|
|
|
* @param $catt |
|
1211
|
|
|
* |
|
1212
|
|
|
* @return mixed |
|
1213
|
|
|
*/ |
|
1214
|
|
|
function xtubeGetCategoryTitle($catt) |
|
1215
|
|
|
{ |
|
1216
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
1217
|
|
|
$sql = 'SELECT title FROM ' . $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' . $catt; |
|
1218
|
|
|
$result = $xoopsDB->query($sql); |
|
1219
|
|
|
$result = $xoopsDB->fetchArray($result); |
|
1220
|
|
|
|
|
1221
|
|
|
return $result['title']; |
|
1222
|
|
|
} |
|
1223
|
|
|
|
|
1224
|
|
|
/** |
|
1225
|
|
|
* |
|
1226
|
|
|
*/ |
|
1227
|
|
|
function xtubeRenderVideoListFooter() |
|
1228
|
|
|
{ |
|
1229
|
|
|
echo '<tr style="text-align: center;"> |
|
1230
|
|
|
<td class="head" colspan="7">' . _AM_XOOPSTUBE_MINDEX_NOVIDEOSFOUND . '</td> |
|
1231
|
|
|
</tr>'; |
|
1232
|
|
|
} |
|
1233
|
|
|
|
|
1234
|
|
|
/** |
|
1235
|
|
|
* @param $pubrowamount |
|
1236
|
|
|
* @param $start |
|
1237
|
|
|
* @param string $art |
|
1238
|
|
|
* @param string $_this |
|
1239
|
|
|
* @param $align |
|
1240
|
|
|
* |
|
1241
|
|
|
* @return bool|null |
|
1242
|
|
|
*/ |
|
1243
|
|
View Code Duplication |
function xtubeSetPageNavigationVideoList($pubrowamount, $start, $art = 'art', $_this = '', $align) |
|
|
|
|
|
|
1244
|
|
|
{ |
|
1245
|
|
|
global $xoopsModuleConfig; |
|
|
|
|
|
|
1246
|
|
|
|
|
1247
|
|
|
if (($pubrowamount < $xoopsModuleConfig['admin_perpage'])) { |
|
1248
|
|
|
return false; |
|
1249
|
|
|
} |
|
1250
|
|
|
// Display Page Nav if published is > total display pages amount. |
|
1251
|
|
|
include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
1252
|
|
|
$pagenav = new XoopsPageNav($pubrowamount, $xoopsModuleConfig['admin_perpage'], $start, 'st' . $art, $_this); |
|
1253
|
|
|
echo '<div style="text-align: ' . $align . '; padding: 8px;">' . $pagenav->renderNav() . '</div>'; |
|
1254
|
|
|
|
|
1255
|
|
|
return null; |
|
1256
|
|
|
} |
|
1257
|
|
|
|
|
1258
|
|
|
/** |
|
1259
|
|
|
* @param $document |
|
1260
|
|
|
* |
|
1261
|
|
|
* @return mixed |
|
1262
|
|
|
*/ |
|
1263
|
|
|
function xtubeConvertHtml2Text($document) |
|
1264
|
|
|
{ |
|
1265
|
|
|
// PHP Manual:: function preg_replace |
|
1266
|
|
|
// $document should contain an HTML document. |
|
1267
|
|
|
// This will remove HTML tags, javascript sections |
|
1268
|
|
|
// and white space. It will also convert some |
|
1269
|
|
|
// common HTML entities to their text equivalent. |
|
1270
|
|
|
// Credits : newbb2 |
|
1271
|
|
|
$search = array( |
|
1272
|
|
|
"'<script[^>]*?>.*?</script>'si", // Strip out javascript |
|
1273
|
|
|
"'<img.*?/>'si", // Strip out img tags |
|
1274
|
|
|
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags |
|
1275
|
|
|
"'([\r\n])[\s]+'", // Strip out white space |
|
1276
|
|
|
"'&(quot|#34);'i", // Replace HTML entities |
|
1277
|
|
|
"'&(amp|#38);'i", |
|
1278
|
|
|
"'&(lt|#60);'i", |
|
1279
|
|
|
"'&(gt|#62);'i", |
|
1280
|
|
|
"'&(nbsp|#160);'i", |
|
1281
|
|
|
"'&(iexcl|#161);'i", |
|
1282
|
|
|
"'&(cent|#162);'i", |
|
1283
|
|
|
"'&(pound|#163);'i", |
|
1284
|
|
|
"'&(copy|#169);'i", |
|
1285
|
|
|
); // evaluate as php |
|
1286
|
|
|
|
|
1287
|
|
|
$replace = array( |
|
1288
|
|
|
"", |
|
1289
|
|
|
"", |
|
1290
|
|
|
"", |
|
1291
|
|
|
"\\1", |
|
1292
|
|
|
"\"", |
|
1293
|
|
|
"&", |
|
1294
|
|
|
"<", |
|
1295
|
|
|
">", |
|
1296
|
|
|
" ", |
|
1297
|
|
|
chr(161), |
|
1298
|
|
|
chr(162), |
|
1299
|
|
|
chr(163), |
|
1300
|
|
|
chr(169), |
|
1301
|
|
|
); |
|
1302
|
|
|
|
|
1303
|
|
|
$text = preg_replace($search, $replace, $document); |
|
1304
|
|
|
|
|
1305
|
|
|
return $text; |
|
1306
|
|
|
} |
|
1307
|
|
|
|
|
1308
|
|
|
// Check if Tag module is installed |
|
1309
|
|
|
/** |
|
1310
|
|
|
* @return bool |
|
|
|
|
|
|
1311
|
|
|
*/ |
|
1312
|
|
|
function xtubeIsModuleTagInstalled() |
|
1313
|
|
|
{ |
|
1314
|
|
|
static $isModuleTagInstalled; |
|
1315
|
|
|
if (!isset($isModuleTagInstalled)) { |
|
1316
|
|
|
$modules_handler = xoops_gethandler('module'); |
|
1317
|
|
|
$tag_mod = $modules_handler->getByDirName('tag'); |
|
1318
|
|
|
if (!$tag_mod) { |
|
1319
|
|
|
$tag_mod = false; |
|
|
|
|
|
|
1320
|
|
|
} else { |
|
1321
|
|
|
$isModuleTagInstalled = $tag_mod->getVar('isactive') == 1; |
|
1322
|
|
|
} |
|
1323
|
|
|
} |
|
1324
|
|
|
|
|
1325
|
|
|
return $isModuleTagInstalled; |
|
1326
|
|
|
} |
|
1327
|
|
|
|
|
1328
|
|
|
// Add item_tag to Tag-module |
|
1329
|
|
|
/** |
|
1330
|
|
|
* @param $lid |
|
1331
|
|
|
* @param $item_tag |
|
1332
|
|
|
*/ |
|
1333
|
|
|
function xtubeUpdateTag($lid, $item_tag) |
|
1334
|
|
|
{ |
|
1335
|
|
|
global $xoopsModule; |
|
|
|
|
|
|
1336
|
|
|
if (xtubeIsModuleTagInstalled()) { |
|
1337
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
1338
|
|
|
$tag_handler = xoops_getmodulehandler('tag', 'tag'); |
|
1339
|
|
|
$tag_handler->updateByItem($item_tag, $lid, $xoopsModule->getVar('dirname'), 0); |
|
1340
|
|
|
} |
|
1341
|
|
|
} |
|
1342
|
|
|
|
|
1343
|
|
|
/** |
|
1344
|
|
|
* @param $lid |
|
1345
|
|
|
*/ |
|
1346
|
|
|
function xtubeUpdateCounter($lid) |
|
1347
|
|
|
{ |
|
1348
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
1349
|
|
|
$sql = 'UPDATE ' . $xoopsDB->prefix('xoopstube_videos') . ' SET hits=hits+1 WHERE lid=' . intval($lid); |
|
1350
|
|
|
$result = $xoopsDB->queryF($sql); |
|
|
|
|
|
|
1351
|
|
|
} |
|
1352
|
|
|
|
|
1353
|
|
|
/** |
|
1354
|
|
|
* @param $banner_id |
|
1355
|
|
|
* |
|
1356
|
|
|
* @return null|string |
|
1357
|
|
|
*/ |
|
1358
|
|
View Code Duplication |
function xtubeGetBannerFromBannerId($banner_id) |
|
|
|
|
|
|
1359
|
|
|
{ |
|
1360
|
|
|
###### Hack by www.stefanosilvestrini.com ###### |
|
1361
|
|
|
global $xoopsConfig; |
|
|
|
|
|
|
1362
|
|
|
$db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
1363
|
|
|
$bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id); |
|
1364
|
|
|
list ($numrows) = $db->fetchRow($bresult); |
|
1365
|
|
|
if ($numrows > 1) { |
|
1366
|
|
|
$numrows = $numrows - 1; |
|
1367
|
|
|
mt_srand((double)microtime() * 1000000); |
|
1368
|
|
|
$bannum = mt_rand(0, $numrows); |
|
1369
|
|
|
} else { |
|
1370
|
|
|
$bannum = 0; |
|
1371
|
|
|
} |
|
1372
|
|
|
if ($numrows > 0) { |
|
1373
|
|
|
$bresult = $db->query('SELECT * FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id, 1, $bannum); |
|
1374
|
|
|
list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow( |
|
|
|
|
|
|
1375
|
|
|
$bresult |
|
1376
|
|
|
); |
|
1377
|
|
|
if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { |
|
|
|
|
|
|
1378
|
|
|
// EMPTY |
|
1379
|
|
|
} else { |
|
1380
|
|
|
$db->queryF(sprintf('UPDATE %s SET impmade = impmade+1 WHERE bid = %u', $db->prefix('banner'), $bid)); |
|
1381
|
|
|
} |
|
1382
|
|
|
/* Check if this impression is the last one and print the banner */ |
|
1383
|
|
|
if ($imptotal == $impmade) { |
|
1384
|
|
|
$newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq'); |
|
1385
|
|
|
$sql = sprintf( |
|
1386
|
|
|
'INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', |
|
1387
|
|
|
$db->prefix('bannerfinish'), |
|
1388
|
|
|
$newid, |
|
1389
|
|
|
$cid, |
|
1390
|
|
|
$impmade, |
|
1391
|
|
|
$clicks, |
|
1392
|
|
|
$date, |
|
1393
|
|
|
time() |
|
1394
|
|
|
); |
|
1395
|
|
|
$db->queryF($sql); |
|
1396
|
|
|
$db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid)); |
|
1397
|
|
|
} |
|
1398
|
|
|
if ($htmlbanner) { |
|
1399
|
|
|
$bannerobject = $htmlcode; |
|
1400
|
|
|
} else { |
|
1401
|
|
|
$bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">'; |
|
1402
|
|
|
if (stristr($imageurl, '.swf')) { |
|
1403
|
|
|
$bannerobject = $bannerobject |
|
1404
|
|
|
. '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">' |
|
1405
|
|
|
. '<param name="movie" value="' . $imageurl . '"></param>' . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl |
|
1406
|
|
|
. '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">' |
|
1407
|
|
|
. '</embed>' . '</object>'; |
|
1408
|
|
|
} else { |
|
1409
|
|
|
$bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="" />'; |
|
1410
|
|
|
} |
|
1411
|
|
|
$bannerobject = $bannerobject . '</a></div>'; |
|
1412
|
|
|
} |
|
1413
|
|
|
|
|
1414
|
|
|
return $bannerobject; |
|
1415
|
|
|
} |
|
1416
|
|
|
|
|
1417
|
|
|
return null; |
|
1418
|
|
|
} |
|
1419
|
|
|
|
|
1420
|
|
|
/** |
|
1421
|
|
|
* @param $client_id |
|
1422
|
|
|
* |
|
1423
|
|
|
* @return null|string |
|
1424
|
|
|
*/ |
|
1425
|
|
View Code Duplication |
function xtubeGetBannerFromClientId($client_id) |
|
|
|
|
|
|
1426
|
|
|
{ |
|
1427
|
|
|
###### Hack by www.stefanosilvestrini.com ###### |
|
1428
|
|
|
global $xoopsConfig; |
|
|
|
|
|
|
1429
|
|
|
$db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
1430
|
|
|
$bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id); |
|
1431
|
|
|
list ($numrows) = $db->fetchRow($bresult); |
|
1432
|
|
|
if ($numrows > 1) { |
|
1433
|
|
|
$numrows = $numrows - 1; |
|
1434
|
|
|
mt_srand((double)microtime() * 1000000); |
|
1435
|
|
|
$bannum = mt_rand(0, $numrows); |
|
1436
|
|
|
} else { |
|
1437
|
|
|
$bannum = 0; |
|
1438
|
|
|
} |
|
1439
|
|
|
if ($numrows > 0) { |
|
1440
|
|
|
$bresult = $db->query( |
|
1441
|
|
|
'SELECT * FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id . ' ORDER BY rand()', |
|
1442
|
|
|
1, |
|
1443
|
|
|
$bannum |
|
1444
|
|
|
); |
|
1445
|
|
|
list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow( |
|
|
|
|
|
|
1446
|
|
|
$bresult |
|
1447
|
|
|
); |
|
1448
|
|
|
if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { |
|
|
|
|
|
|
1449
|
|
|
// EMPTY |
|
1450
|
|
|
} else { |
|
1451
|
|
|
$db->queryF(sprintf('UPDATE %s SET impmade = impmade+1 WHERE bid = %u', $db->prefix('banner'), $bid)); |
|
1452
|
|
|
} |
|
1453
|
|
|
/* Check if this impression is the last one and print the banner */ |
|
1454
|
|
|
if ($imptotal == $impmade) { |
|
1455
|
|
|
$newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq'); |
|
1456
|
|
|
$sql = sprintf( |
|
1457
|
|
|
'INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', |
|
1458
|
|
|
$db->prefix('bannerfinish'), |
|
1459
|
|
|
$newid, |
|
1460
|
|
|
$cid, |
|
1461
|
|
|
$impmade, |
|
1462
|
|
|
$clicks, |
|
1463
|
|
|
$date, |
|
1464
|
|
|
time() |
|
1465
|
|
|
); |
|
1466
|
|
|
$db->queryF($sql); |
|
1467
|
|
|
$db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid)); |
|
1468
|
|
|
} |
|
1469
|
|
|
if ($htmlbanner) { |
|
1470
|
|
|
$bannerobject = $htmlcode; |
|
1471
|
|
|
} else { |
|
1472
|
|
|
$bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">'; |
|
1473
|
|
|
if (stristr($imageurl, '.swf')) { |
|
1474
|
|
|
$bannerobject = $bannerobject |
|
1475
|
|
|
. '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">' |
|
1476
|
|
|
. '<param name="movie" value="' . $imageurl . '"></param>' . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl |
|
1477
|
|
|
. '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">' |
|
1478
|
|
|
. '</embed>' . '</object>'; |
|
1479
|
|
|
} else { |
|
1480
|
|
|
$bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="" />'; |
|
1481
|
|
|
} |
|
1482
|
|
|
$bannerobject = $bannerobject . '</a></div>'; |
|
1483
|
|
|
} |
|
1484
|
|
|
|
|
1485
|
|
|
return $bannerobject; |
|
1486
|
|
|
} |
|
1487
|
|
|
|
|
1488
|
|
|
return null; |
|
1489
|
|
|
} |
|
1490
|
|
|
|
|
1491
|
|
|
/** |
|
1492
|
|
|
* |
|
1493
|
|
|
*/ |
|
1494
|
|
|
function xtubeSetNoIndexNoFollow() |
|
1495
|
|
|
{ |
|
1496
|
|
|
global $xoTheme, $xoopsTpl; |
|
|
|
|
|
|
1497
|
|
|
if (is_object($xoTheme)) { |
|
1498
|
|
|
$xoTheme->addMeta('meta', 'robots', 'noindex,nofollow'); |
|
1499
|
|
|
} else { |
|
1500
|
|
|
$xoopsTpl->assign('xoops_meta_robots', 'noindex,nofollow'); |
|
1501
|
|
|
} |
|
1502
|
|
|
} |
|
1503
|
|
|
|
|
1504
|
|
|
/** |
|
1505
|
|
|
* @param $userid |
|
1506
|
|
|
* |
|
1507
|
|
|
* @return string |
|
1508
|
|
|
*/ |
|
1509
|
|
|
function xtubeGetLinkedUserNameFromId($userid) |
|
|
|
|
|
|
1510
|
|
|
{ |
|
1511
|
|
|
$userid = intval($userid); |
|
1512
|
|
|
if ($userid > 0) { |
|
1513
|
|
|
$member_handler =& xoops_gethandler('member'); |
|
1514
|
|
|
$user =& $member_handler->getUser($userid); |
|
1515
|
|
|
if (is_object($user)) { |
|
1516
|
|
|
$linkeduser |
|
1517
|
|
|
= '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $userid . '">' . $user->getVar('uname') . '</a>'; |
|
1518
|
|
|
|
|
1519
|
|
|
return $linkeduser; |
|
1520
|
|
|
} |
|
1521
|
|
|
} |
|
1522
|
|
|
|
|
1523
|
|
|
return $GLOBALS['xoopsConfig']['anonymous']; |
|
1524
|
|
|
} |
|
1525
|
|
|
|
|
1526
|
|
|
/** |
|
1527
|
|
|
* @param $time |
|
1528
|
|
|
* |
|
1529
|
|
|
* @return string |
|
1530
|
|
|
*/ |
|
1531
|
|
|
function xtubeGetTimestamp($time) |
|
1532
|
|
|
{ |
|
1533
|
|
|
global $xoopsConfig, $xoopsModuleConfig; |
|
|
|
|
|
|
1534
|
|
|
$mydirname = basename(dirname(__DIR__)); |
|
1535
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $xoopsConfig['language'] . '/local.php'; |
|
1536
|
|
|
|
|
1537
|
|
|
$trans = array( |
|
1538
|
|
|
'Monday' => _XOOPSTUBE_MONDAY, |
|
1539
|
|
|
'Tuesday' => _XOOPSTUBE_TUESDAY, |
|
1540
|
|
|
'Wednesday' => _XOOPSTUBE_WEDNESDAY, |
|
1541
|
|
|
'Thursday' => _XOOPSTUBE_THURSDAY, |
|
1542
|
|
|
'Friday' => _XOOPSTUBE_FRIDAY, |
|
1543
|
|
|
'Saturday' => _XOOPSTUBE_SATURDAY, |
|
1544
|
|
|
'Sunday' => _XOOPSTUBE_SUNDAY, |
|
1545
|
|
|
'Mon' => _XOOPSTUBE_MON, |
|
1546
|
|
|
'Tue' => _XOOPSTUBE_TUE, |
|
1547
|
|
|
'Wed' => _XOOPSTUBE_WED, |
|
1548
|
|
|
'Thu' => _XOOPSTUBE_THU, |
|
1549
|
|
|
'Fri' => _XOOPSTUBE_FRI, |
|
1550
|
|
|
'Sat' => _XOOPSTUBE_SAT, |
|
1551
|
|
|
'Sun' => _XOOPSTUBE_SUN, |
|
1552
|
|
|
'January' => _XOOPSTUBE_JANUARI, |
|
1553
|
|
|
'February' => _XOOPSTUBE_FEBRUARI, |
|
1554
|
|
|
'March' => _XOOPSTUBE_MARCH, |
|
1555
|
|
|
'April' => _XOOPSTUBE_APRIL, |
|
1556
|
|
|
'May' => _XOOPSTUBE_MAY, |
|
1557
|
|
|
'June' => _XOOPSTUBE_JUNE, |
|
1558
|
|
|
'July' => _XOOPSTUBE_JULY, |
|
1559
|
|
|
'August' => _XOOPSTUBE_AUGUST, |
|
1560
|
|
|
'September' => _XOOPSTUBE_SEPTEMBER, |
|
1561
|
|
|
'October' => _XOOPSTUBE_OCTOBER, |
|
1562
|
|
|
'November' => _XOOPSTUBE_NOVEMBER, |
|
1563
|
|
|
'December' => _XOOPSTUBE_DECEMBER, |
|
1564
|
|
|
'Jan' => _XOOPSTUBE_JAN, |
|
1565
|
|
|
'Feb' => _XOOPSTUBE_FEB, |
|
1566
|
|
|
'Mar' => _XOOPSTUBE_MAR, |
|
1567
|
|
|
'Apr' => _XOOPSTUBE_APR, |
|
1568
|
|
|
// 'May' => _XOOPSTUBE_MAY2, |
|
|
|
|
|
|
1569
|
|
|
'Jun' => _XOOPSTUBE_JUN, |
|
1570
|
|
|
'Jul' => _XOOPSTUBE_JUL, |
|
1571
|
|
|
'Aug' => _XOOPSTUBE_AUG, |
|
1572
|
|
|
'Sep' => _XOOPSTUBE_SEP, |
|
1573
|
|
|
'Oct' => _XOOPSTUBE_OCT, |
|
1574
|
|
|
'Nov' => _XOOPSTUBE_NOV, |
|
1575
|
|
|
'Dec' => _XOOPSTUBE_DEC |
|
1576
|
|
|
); |
|
1577
|
|
|
$timestamp = strtr($time, $trans); |
|
1578
|
|
|
|
|
1579
|
|
|
return $timestamp; |
|
1580
|
|
|
} |
|
1581
|
|
|
|
|
1582
|
|
|
/** |
|
1583
|
|
|
* Do some basic file checks and stuff. |
|
1584
|
|
|
* Author: Andrew Mills Email: [email protected] |
|
1585
|
|
|
* from amReviews module |
|
1586
|
|
|
*/ |
|
1587
|
|
|
function xtubeFileChecks() |
|
1588
|
|
|
{ |
|
1589
|
|
|
global $xoopsModule, $xoopsModuleConfig; |
|
|
|
|
|
|
1590
|
|
|
|
|
1591
|
|
|
echo "<fieldset>"; |
|
1592
|
|
|
echo "<legend style=\"color: #990000; font-weight: bold;\">" . _AM_XOOPSTUBE_FILECHECKS . "</legend>"; |
|
1593
|
|
|
|
|
1594
|
|
|
$dirPhotos = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['catimage']; |
|
1595
|
|
|
$dirVideos = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['videodir']; |
|
1596
|
|
|
$dirScreenshots = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['videoimgdir']; |
|
1597
|
|
|
|
|
1598
|
|
View Code Duplication |
if (file_exists($dirPhotos)) { |
|
|
|
|
|
|
1599
|
|
|
if (!is_writable($dirPhotos)) { |
|
1600
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">Warning:</span> " . _AM_XOOPSTUBE_UNABLE_TO_WRITE . $dirPhotos . "<br />"; |
|
1601
|
|
|
} else { |
|
1602
|
|
|
echo "<span style=\" color: green; font-weight: bold;\">OK:</span> " . $dirPhotos . "<br />"; |
|
1603
|
|
|
} |
|
1604
|
|
|
} else { |
|
1605
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">" . _AM_XOOPSTUBE_WARNING . "</span> " . $dirPhotos . " <span style=\" color: red; \">" . _AM_XOOPSTUBE_NOT_EXISTS . "</span> <br />"; |
|
1606
|
|
|
} |
|
1607
|
|
|
// photothumbdir |
|
1608
|
|
View Code Duplication |
if (file_exists($dirVideos)) { |
|
|
|
|
|
|
1609
|
|
|
if (!is_writable($dirVideos)) { |
|
1610
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">" . _AM_XOOPSTUBE_WARNING . "</span> " . _AM_XOOPSTUBE_UNABLE_TO_WRITE . $dirVideos . "<br />"; |
|
1611
|
|
|
} else { |
|
1612
|
|
|
echo "<span style=\" color: green; font-weight: bold;\">OK:</span> " . $dirVideos . "<br />"; |
|
1613
|
|
|
} |
|
1614
|
|
|
} else { |
|
1615
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">" . _AM_XOOPSTUBE_WARNING . "</span> " . $dirVideos . " <span style=\" color: red; \">" . _AM_XOOPSTUBE_NOT_EXISTS . "</span> <br />"; |
|
1616
|
|
|
} |
|
1617
|
|
|
// photohighdir |
|
1618
|
|
View Code Duplication |
if (file_exists($dirScreenshots)) { |
|
|
|
|
|
|
1619
|
|
|
if (!is_writable($dirScreenshots)) { |
|
1620
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">Warning:</span> " . _AM_XOOPSTUBE_UNABLE_TO_WRITE . $dirScreenshots . "<br />"; |
|
1621
|
|
|
} else { |
|
1622
|
|
|
echo "<span style=\" color: green; font-weight: bold;\">OK:</span> " . $dirScreenshots . "<br />"; |
|
1623
|
|
|
} |
|
1624
|
|
|
} else { |
|
1625
|
|
|
echo "<span style=\" color: red; font-weight: bold;\">" . _AM_XOOPSTUBE_WARNING . "</span> " . $dirScreenshots . " <span style=\" color: red; \">" . _AM_XOOPSTUBE_NOT_EXISTS |
|
1626
|
|
|
. "</span> <br />"; |
|
1627
|
|
|
} |
|
1628
|
|
|
|
|
1629
|
|
|
/** |
|
1630
|
|
|
* Some info. |
|
1631
|
|
|
*/ |
|
1632
|
|
|
$uploads = (ini_get('file_uploads')) ? _AM_XOOPSTUBE_UPLOAD_ON : _AM_XOOPSTUBE_UPLOAD_OFF; |
|
1633
|
|
|
echo "<br />"; |
|
1634
|
|
|
echo "<ul>"; |
|
1635
|
|
|
echo "<li>" . _AM_XOOPSTUBE_UPLOADMAX . "<b>" . ini_get('upload_max_filesize') . "</b></li>"; |
|
1636
|
|
|
echo "<li>" . _AM_XOOPSTUBE_POSTMAX . "<b>" . ini_get('post_max_size') . "</b></li>"; |
|
1637
|
|
|
echo "<li>" . _AM_XOOPSTUBE_UPLOADS . "<b>" . $uploads . "</b></li>"; |
|
1638
|
|
|
|
|
1639
|
|
|
$gdinfo = gd_info(); |
|
1640
|
|
|
if (function_exists('gd_info')) { |
|
1641
|
|
|
echo "<li>" . _AM_XOOPSTUBE_GDIMGSPPRT . "<b>" . _AM_XOOPSTUBE_GDIMGON . "</b></li>"; |
|
1642
|
|
|
echo "<li>" . _AM_XOOPSTUBE_GDIMGVRSN . "<b>" . $gdinfo['GD Version'] . "</b></li>"; |
|
1643
|
|
|
} else { |
|
1644
|
|
|
echo "<li>" . _AM_XOOPSTUBE_GDIMGSPPRT . "<b>" . _AM_XOOPSTUBE_GDIMGOFF . "</b></li>"; |
|
1645
|
|
|
} |
|
1646
|
|
|
echo "</ul>"; |
|
1647
|
|
|
|
|
1648
|
|
|
//$inithingy = ini_get_all(); |
|
|
|
|
|
|
1649
|
|
|
//print_r($inithingy); |
|
1650
|
|
|
|
|
1651
|
|
|
echo "</fieldset>"; |
|
1652
|
|
|
|
|
1653
|
|
|
} |
|
1654
|
|
|
|
|
1655
|
|
|
/** |
|
1656
|
|
|
* @param $path |
|
1657
|
|
|
* @param int $mode |
|
1658
|
|
|
* @param $fileSource |
|
1659
|
|
|
* @param null $fileTarget |
|
1660
|
|
|
*/ |
|
1661
|
|
|
function createDirectory($path, $mode = 0777, $fileSource, $fileTarget = null) |
|
1662
|
|
|
{ |
|
1663
|
|
|
if (!is_dir($path)) { |
|
1664
|
|
|
mkdir($path, $mode); |
|
1665
|
|
|
file_put_contents($path . '/index.html', '<script>history.go(-1);</script>'); |
|
1666
|
|
|
if (!empty($fileSource) && !empty($fileTarget)) { |
|
1667
|
|
|
@copy($fileSource, $fileTarget); |
|
|
|
|
|
|
1668
|
|
|
} |
|
1669
|
|
|
} |
|
1670
|
|
|
chmod($path, $mode); |
|
1671
|
|
|
} |
|
1672
|
|
|
|
|
1673
|
|
|
/** |
|
1674
|
|
|
* @return string |
|
1675
|
|
|
*/ |
|
1676
|
|
|
function xtubeGetLetters() |
|
1677
|
|
|
{ |
|
1678
|
|
|
global $xoopsModule, $xoopsDB; |
|
|
|
|
|
|
1679
|
|
|
|
|
1680
|
|
|
$letterchoice = '<div>' . _MD_XOOPSTUBE_BROWSETOTOPIC . '</div>'; |
|
1681
|
|
|
$alphabet = getXtubeAlphabet(); |
|
1682
|
|
|
$num = count($alphabet) - 1; |
|
1683
|
|
|
$counter = 0; |
|
1684
|
|
|
$distinctDbLetters_arr = array(); |
|
1685
|
|
|
$sql = 'SELECT DISTINCT (UPPER(LEFT(title, 1))) AS letter FROM ' . $xoopsDB->prefix( |
|
1686
|
|
|
'xoopstube_videos WHERE expired = 0 AND offline = 0' |
|
1687
|
|
|
); |
|
1688
|
|
|
if ($result = $xoopsDB->query($sql)) { |
|
1689
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
|
1690
|
|
|
$distinctDbLetters_arr[] = $row['letter']; |
|
1691
|
|
|
} |
|
1692
|
|
|
} |
|
1693
|
|
|
unset($sql); |
|
1694
|
|
|
|
|
1695
|
|
|
while (list(, $ltr) = each($alphabet)) { |
|
1696
|
|
|
|
|
1697
|
|
|
if (in_array($ltr, $distinctDbLetters_arr)) { |
|
1698
|
|
|
$letterchoice |
|
1699
|
|
|
.= '<a class="xoopstube_letters xoopstube_letters_green" href="'; |
|
1700
|
|
|
} else { |
|
1701
|
|
|
$letterchoice |
|
1702
|
|
|
.= '<a class="xoopstube_letters" href="'; |
|
1703
|
|
|
} |
|
1704
|
|
|
$letterchoice .= XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?list=' . $ltr . '">' . $ltr . '</a>'; |
|
1705
|
|
|
if ($counter == round($num / 2)) { |
|
1706
|
|
|
$letterchoice .= '<br />'; |
|
1707
|
|
|
} elseif ($counter != $num) { |
|
1708
|
|
|
$letterchoice .= ' '; |
|
1709
|
|
|
} |
|
1710
|
|
|
++$counter; |
|
1711
|
|
|
} |
|
1712
|
|
|
|
|
1713
|
|
|
return $letterchoice; |
|
1714
|
|
|
} |
|
1715
|
|
|
|
|
1716
|
|
|
/** |
|
1717
|
|
|
* @return mixed|string |
|
1718
|
|
|
*/ |
|
1719
|
|
|
function xtubeLettersChoice() |
|
|
|
|
|
|
1720
|
|
|
{ |
|
1721
|
|
|
global $xoopsModule; |
|
|
|
|
|
|
1722
|
|
|
|
|
1723
|
|
|
$mydirname = $xoopsModule->getVar('dirname'); |
|
1724
|
|
|
include_once XOOPS_ROOT_PATH . "/modules/$mydirname/class/$mydirname.php"; |
|
1725
|
|
|
$xoopstube = XoopstubeXoopstube::getInstance(); |
|
1726
|
|
|
|
|
1727
|
|
|
$a = $xoopstube->getHandler('xoopstube'); |
|
1728
|
|
|
$b = $a->getActiveCriteria(); |
|
|
|
|
|
|
1729
|
|
|
$mydirname = basename(dirname(__DIR__)); |
|
1730
|
|
|
|
|
1731
|
|
|
$criteria = $xoopstube->getHandler('xoopstube')->getActiveCriteria(); |
|
1732
|
|
|
$criteria->setGroupby('UPPER(LEFT(title,1))'); |
|
1733
|
|
|
$countsByLetters = $xoopstube->getHandler($mydirname)->getCounts($criteria); |
|
1734
|
|
|
// Fill alphabet array |
|
1735
|
|
|
$alphabet = getXtubeAlphabet(); |
|
1736
|
|
|
$alphabet_array = array(); |
|
1737
|
|
|
foreach ($alphabet as $letter) { |
|
1738
|
|
|
$letter_array = array(); |
|
1739
|
|
|
if (isset($countsByLetters[$letter])) { |
|
1740
|
|
|
$letter_array['letter'] = $letter; |
|
1741
|
|
|
$letter_array['count'] = $countsByLetters[$letter]; |
|
1742
|
|
|
$letter_array['url'] = "" . XOOPS_URL . "/modules/$mydirname/viewcat.php?list={$letter}"; |
|
1743
|
|
|
} else { |
|
1744
|
|
|
$letter_array['letter'] = $letter; |
|
1745
|
|
|
$letter_array['count'] = 0; |
|
1746
|
|
|
$letter_array['url'] = ""; |
|
1747
|
|
|
} |
|
1748
|
|
|
$alphabet_array[$letter] = $letter_array; |
|
1749
|
|
|
unset($letter_array); |
|
1750
|
|
|
} |
|
1751
|
|
|
// Render output |
|
1752
|
|
|
if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
1753
|
|
|
include_once $GLOBALS['xoops']->path("/class/theme.php"); |
|
1754
|
|
|
$GLOBALS['xoTheme'] = new xos_opal_Theme(); |
|
1755
|
|
|
} |
|
1756
|
|
|
require_once $GLOBALS['xoops']->path('class/template.php'); |
|
1757
|
|
|
$letterschoiceTpl = new XoopsTpl(); |
|
1758
|
|
|
$letterschoiceTpl->caching = false; // Disable cache |
|
1759
|
|
|
$letterschoiceTpl->assign('alphabet', $alphabet_array); |
|
1760
|
|
|
$html = $letterschoiceTpl->fetch("db:" . $xoopstube->getModule()->dirname() . "_common_letterschoice.tpl"); |
|
1761
|
|
|
unset($letterschoiceTpl); |
|
1762
|
|
|
|
|
1763
|
|
|
return $html; |
|
1764
|
|
|
} |
|
1765
|
|
|
|
|
1766
|
|
|
//=============== from WF-Downloads ====================================== |
|
1767
|
|
|
|
|
1768
|
|
|
/** |
|
1769
|
|
|
* @return bool |
|
1770
|
|
|
*/ |
|
1771
|
|
|
function xtubeUserIsAdmin() |
|
1772
|
|
|
{ |
|
1773
|
|
|
global $xoopsUser; |
|
|
|
|
|
|
1774
|
|
|
$xoopstube = XoopstubeXoopstube::getInstance(); |
|
1775
|
|
|
|
|
1776
|
|
|
static $xtubeIsAdmin; |
|
1777
|
|
|
|
|
1778
|
|
|
if (isset($xtubeIsAdmin)) { |
|
1779
|
|
|
return $xtubeIsAdmin; |
|
1780
|
|
|
} |
|
1781
|
|
|
|
|
1782
|
|
|
if (!$xoopsUser) { |
|
1783
|
|
|
$xtubeIsAdmin = false; |
|
1784
|
|
|
} else { |
|
1785
|
|
|
$xtubeIsAdmin = $xoopsUser->isAdmin($xoopstube->getModule()->getVar('mid')); |
|
1786
|
|
|
} |
|
1787
|
|
|
|
|
1788
|
|
|
return $xtubeIsAdmin; |
|
1789
|
|
|
} |
|
1790
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.