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
|
|
|
* @param $category |
13
|
|
|
* @param $item_id |
14
|
|
|
* @return bool|null |
15
|
|
|
* @category Module |
16
|
|
|
* @package Xoopstube |
17
|
|
|
* @author XOOPS Development Team |
18
|
|
|
* @copyright 2001-2016 XOOPS Project (https://xoops.org) |
19
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
20
|
|
|
* @link https://xoops.org/ |
21
|
|
|
* @since 1.0.6 |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
function xtubeNotifyIteminfo($category, $item_id) |
25
|
|
|
{ |
26
|
|
|
global $xoopsModule; |
27
|
|
|
|
28
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
29
|
|
|
// $modulePath = dirname(__DIR__); |
30
|
|
|
|
31
|
|
|
if (empty($xoopsModule) || 'xoopstube' !== $xoopsModule->getVar('dirname')) { |
32
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
33
|
|
|
$moduleHandler = xoops_getHandler('module'); |
34
|
|
|
$module = $moduleHandler->getByDirname($moduleDirName); |
35
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
36
|
|
|
$configHandler = xoops_getHandler('config'); |
37
|
|
|
$config = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
|
|
|
38
|
|
|
} else { |
39
|
|
|
$module = $xoopsModule; |
|
|
|
|
40
|
|
|
$config = $GLOBALS['xoopsModuleConfig']; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
if ('global' === $category) { |
44
|
|
|
$item['name'] = ''; |
45
|
|
|
$item['url'] = ''; |
46
|
|
|
|
47
|
|
|
return $item; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
if ('category' === $category) { |
51
|
|
|
// Assume we have a valid category id |
52
|
|
|
$sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $item_id; |
53
|
|
|
if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
54
|
|
|
return false; |
55
|
|
|
} |
56
|
|
|
$result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
57
|
|
|
$item['name'] = $result_array['title']; |
58
|
|
|
$item['url'] = XOOPS_URL . '/modules/xoopstube/viewcat.php?cid=' . $item_id; |
59
|
|
|
|
60
|
|
|
return $item; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
if ('video' === $category) { |
64
|
|
|
// Assume we have a valid file id |
65
|
|
|
$sql = 'SELECT cid,title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $item_id; |
66
|
|
|
if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
67
|
|
|
return false; |
68
|
|
|
} |
69
|
|
|
$result_array = $GLOBALS['xoopsDB']->fetchArray($result); |
70
|
|
|
$item['name'] = $result_array['title']; |
71
|
|
|
$item['url'] = XOOPS_URL . '/modules/xoopstube/singlevideo.php?cid=' . $result_array['cid'] . '&lid=' . $item_id; |
72
|
|
|
|
73
|
|
|
return $item; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
return null; |
77
|
|
|
} |
78
|
|
|
|