|
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 mixed $items |
|
13
|
|
|
* @package Xoopstube |
|
14
|
|
|
* @author XOOPS Development Team |
|
15
|
|
|
* @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
|
16
|
|
|
* @copyright 2001-2013 The XOOPS Project |
|
17
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
18
|
|
|
* @link https://sourceforge.net/projects/xoops/ |
|
19
|
|
|
* @since 1.0.6 |
|
20
|
|
|
* @category Module |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Get item fields: |
|
25
|
|
|
* title |
|
26
|
|
|
* content |
|
27
|
|
|
* time |
|
28
|
|
|
* link |
|
29
|
|
|
* uid |
|
30
|
|
|
* uname |
|
31
|
|
|
* tags |
|
32
|
|
|
* |
|
33
|
|
|
* @return bool |
|
34
|
|
|
* @var array $items associative array of items: [modid][catid][itemid] |
|
35
|
|
|
* |
|
36
|
|
|
*/ |
|
37
|
|
|
function xoopstube_tag_iteminfo(&$items) |
|
38
|
|
|
{ |
|
39
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
|
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
if (empty($items) || !is_array($items)) { |
|
42
|
|
|
return false; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
global $xoopsDB; |
|
46
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
$items_id = []; |
|
49
|
|
|
|
|
50
|
|
|
foreach (array_keys($items) as $catId) { |
|
51
|
|
|
// Some handling here to build the link upon catid |
|
52
|
|
|
// If catid is not used, just skip it |
|
53
|
|
|
foreach (array_keys($items[$catId]) as $item_id) { |
|
54
|
|
|
// In article, the item_id is "art_id" |
|
55
|
|
|
$items_id[] = (int)$item_id; |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
foreach (array_keys($items) as $catId) { |
|
60
|
|
|
foreach (array_keys($items[$catId]) as $item_id) { |
|
61
|
|
|
$sql = 'SELECT l.lid, l.cid AS lcid, l.title AS ltitle, l.published, l.cid, l.submitter, l.description, l.item_tag, c.title AS ctitle FROM ' |
|
62
|
|
|
. $xoopsDB->prefix('xoopstube_videos') |
|
63
|
|
|
. ' l, ' |
|
64
|
|
|
. $xoopsDB->prefix('xoopstube_cat') |
|
65
|
|
|
. ' c WHERE l.lid=' |
|
66
|
|
|
. $item_id |
|
67
|
|
|
. ' AND l.cid=c.cid AND l.status>0 ORDER BY l.published DESC'; |
|
68
|
|
|
$result = $xoopsDB->query($sql); |
|
69
|
|
|
$row = $xoopsDB->fetchArray($result); |
|
70
|
|
|
$lcid = $row['lcid']; |
|
71
|
|
|
$items[$catId][$item_id] = [ |
|
72
|
|
|
'title' => $row['ltitle'], |
|
73
|
|
|
'uid' => $row['submitter'], |
|
74
|
|
|
'link' => "singlevideo.php?cid=$lcid&lid=$item_id", |
|
75
|
|
|
'time' => $row['published'], |
|
76
|
|
|
'tags' => $row['item_tag'], |
|
77
|
|
|
'content' => $row['description'], |
|
78
|
|
|
]; |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
return null; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** Remove orphan tag-item links * |
|
86
|
|
|
* |
|
87
|
|
|
* @param $mid |
|
88
|
|
|
*/ |
|
89
|
|
|
function xoopstube_tag_synchronization($mid) |
|
|
|
|
|
|
90
|
|
|
{ |
|
91
|
|
|
// Optional |
|
92
|
|
|
} |
|
93
|
|
|
|