1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Tag info |
4
|
|
|
* |
5
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
6
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
7
|
|
|
* @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
8
|
|
|
* @since 1.00 |
9
|
|
|
* @package module::tag |
10
|
|
|
*/ |
11
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Get item fields: |
14
|
|
|
* title |
15
|
|
|
* content |
16
|
|
|
* time |
17
|
|
|
* link |
18
|
|
|
* uid |
19
|
|
|
* uname |
20
|
|
|
* tags |
21
|
|
|
* |
22
|
|
|
* @var array $items associative array of items: [modid][catid][itemid] |
23
|
|
|
* |
24
|
|
|
* @return boolean |
25
|
|
|
* |
|
|
|
|
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
View Code Duplication |
function lexikon_tag_iteminfo(&$items) |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
if (empty($items) || !is_array($items)) { |
31
|
|
|
return false; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
global $xoopsDB; |
|
|
|
|
35
|
|
|
$myts = MyTextSanitizer::getInstance(); |
|
|
|
|
36
|
|
|
|
37
|
|
|
$items_id = array(); |
38
|
|
|
|
39
|
|
|
foreach (array_keys($items) as $cat_id) { |
40
|
|
|
// Some handling here to build the link upon catid |
41
|
|
|
// If catid is not used, just skip it |
42
|
|
|
foreach (array_keys($items[$cat_id]) as $item_id) { |
43
|
|
|
// In article, the item_id is "art_id" |
44
|
|
|
$items_id[] = (int)$item_id; |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
foreach (array_keys($items) as $cat_id) { |
49
|
|
|
foreach (array_keys($items[$cat_id]) as $item_id) { |
50
|
|
|
$sql = 'SELECT l.entryID, l.categoryID, l.term AS ltitle, l.definition, l.uid, l.datesub, l.offline, c.name AS cname FROM ' |
51
|
|
|
. $xoopsDB->prefix('lxentries') |
52
|
|
|
. ' l, ' |
53
|
|
|
. $xoopsDB->prefix('lxcategories') |
54
|
|
|
. ' c WHERE l.entryID=' |
55
|
|
|
. $item_id |
56
|
|
|
. ' AND l.categoryID=c.categoryID AND l.offline=0 ORDER BY l.datesub DESC'; |
57
|
|
|
//$sql = "SELECT l.entryID, l.categoryID, l.term as ltitle, l.definition, l.uid, l.datesub, l.offline,l.item_tag, c.name as cname FROM ".$xoopsDB->prefix('lxentries')." l, ".$xoopsDB->prefix('lxcategories')." c WHERE l.entryID=".$item_id." AND l.categoryID=c.categoryID AND l.offline=0 ORDER BY l.datesub DESC"; |
|
|
|
|
58
|
|
|
$result = $xoopsDB->query($sql); |
59
|
|
|
$row = $xoopsDB->fetchArray($result); |
60
|
|
|
$items[$cat_id][$item_id] = array( |
61
|
|
|
'title' => $row['ltitle'], |
62
|
|
|
'uid' => $row['uid'], |
63
|
|
|
'link' => "entry.php?entryID=$item_id", |
64
|
|
|
'time' => $row['datesub'], |
65
|
|
|
//"tags" => $row['item_tag'], // optional |
|
|
|
|
66
|
|
|
//"content" => $myts->displayTarea( $row['definition'], 0 ), |
|
|
|
|
67
|
|
|
'content' => $row['definition'] |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.