|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Tag info |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright The XOOPS Project (https://xoops.org) |
|
7
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
|
8
|
|
|
* @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
|
9
|
|
|
* @package module::tag |
|
10
|
|
|
*/ |
|
11
|
|
|
defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
|
12
|
|
|
/** |
|
13
|
|
|
* Get item fields: |
|
14
|
|
|
* title |
|
15
|
|
|
* content |
|
16
|
|
|
* time |
|
17
|
|
|
* link |
|
18
|
|
|
* uid |
|
19
|
|
|
* uname |
|
20
|
|
|
* tags |
|
21
|
|
|
* |
|
22
|
|
|
* |
|
23
|
|
|
* @param mixed $items |
|
24
|
|
|
* @return bool |
|
25
|
|
|
*/ |
|
26
|
|
|
function lexikon_tag_iteminfo(&$items) |
|
27
|
|
|
{ |
|
28
|
|
|
if (empty($items) || !is_array($items)) { |
|
29
|
|
|
return false; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
global $xoopsDB; |
|
33
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
$items_id = []; |
|
36
|
|
|
|
|
37
|
|
|
foreach (array_keys($items) as $cat_id) { |
|
38
|
|
|
// Some handling here to build the link upon catid |
|
39
|
|
|
// If catid is not used, just skip it |
|
40
|
|
|
foreach (array_keys($items[$cat_id]) as $item_id) { |
|
41
|
|
|
// In article, the item_id is "art_id" |
|
42
|
|
|
$items_id[] = (int)$item_id; |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
foreach (array_keys($items) as $cat_id) { |
|
47
|
|
|
foreach (array_keys($items[$cat_id]) as $item_id) { |
|
48
|
|
|
$sql = 'SELECT l.entryID, l.categoryID, l.term AS ltitle, l.definition, l.uid, l.datesub, l.offline, c.name AS cname FROM ' |
|
49
|
|
|
. $xoopsDB->prefix('lxentries') |
|
50
|
|
|
. ' l, ' |
|
51
|
|
|
. $xoopsDB->prefix('lxcategories') |
|
52
|
|
|
. ' c WHERE l.entryID=' |
|
53
|
|
|
. $item_id |
|
54
|
|
|
. ' AND l.categoryID=c.categoryID AND l.offline=0 ORDER BY l.datesub DESC'; |
|
55
|
|
|
$result = $xoopsDB->query($sql); |
|
56
|
|
|
$row = $xoopsDB->fetchArray($result); |
|
57
|
|
|
$items[$cat_id][$item_id] = [ |
|
58
|
|
|
'title' => $row['ltitle'], |
|
59
|
|
|
'uid' => $row['uid'], |
|
60
|
|
|
'link' => "entry.php?entryID=$item_id", |
|
61
|
|
|
'time' => $row['datesub'], |
|
62
|
|
|
'content' => $row['definition'], |
|
63
|
|
|
]; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|