1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// ------------------------------------------------------------------------ // |
4
|
|
|
|
5
|
|
|
defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
6
|
|
|
|
7
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
8
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @param $category |
12
|
|
|
* @param $item_id |
13
|
|
|
* @return array|void |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
function lexikon_notify_iteminfo($category, $item_id) |
18
|
|
|
{ |
19
|
|
|
/*global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
20
|
|
|
|
21
|
|
|
if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'lexikon') { |
22
|
|
|
|
23
|
|
|
$moduleHandler = xoops_getHandler('module'); |
24
|
|
|
$module = $moduleHandler->getByDirname('lexikon'); |
25
|
|
|
$configHandler = xoops_getHandler('config'); |
26
|
|
|
$config = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
else { |
30
|
|
|
$module = $xoopsModule; |
31
|
|
|
$config = $xoopsModuleConfig; |
32
|
|
|
}*/ |
33
|
|
|
|
34
|
|
|
if (mb_strpos(__DIR__, '/') > 0) { |
35
|
|
|
$pathparts = explode('/', __DIR__); |
36
|
|
|
} else { |
37
|
|
|
$pathparts = explode('\\', __DIR__); |
38
|
|
|
} |
39
|
|
|
$moduleDirName = $pathparts[array_search('modules', $pathparts, true) + 1]; // checken |
|
|
|
|
40
|
|
|
|
41
|
|
|
if ('global' === $category) { |
42
|
|
|
$item['name'] = ''; |
|
|
|
|
43
|
|
|
$item['url'] = ''; |
44
|
|
|
|
45
|
|
|
return $item; |
46
|
|
|
} |
47
|
|
|
$item_id = (int)$item_id; |
48
|
|
|
|
49
|
|
|
global $xoopsDB; |
50
|
|
|
if ('category' === $category) { |
51
|
|
|
// Assume we have a valid category id |
52
|
|
|
$sql = 'SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . ' WHERE categoryID = ' . $item_id; |
53
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
|
|
|
|
54
|
|
|
redirect_header('index.php', 2, _ERRORS); |
55
|
|
|
} |
56
|
|
|
$result = $xoopsDB->query($sql); |
57
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
58
|
|
|
$item['name'] = $result_array['name']; |
59
|
|
|
$item['url'] = XOOPS_URL . '/modules/lexikon/category.php?categoryID=' . $item_id; |
60
|
|
|
|
61
|
|
|
return $item; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
if ('term' === $category) { |
65
|
|
|
// Assume we have a valid entry id |
66
|
|
|
$sql = 'SELECT entryID,term FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE entryID = ' . $item_id; |
67
|
|
|
if (!$result = $xoopsDB->query($sql)) { |
68
|
|
|
redirect_header('index.php', 2, _ERRORS); |
69
|
|
|
} |
70
|
|
|
$result = $xoopsDB->query($sql); |
71
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
72
|
|
|
$item['name'] = $result_array['term']; |
73
|
|
|
$item['url'] = XOOPS_URL . '/modules/lexikon/entry.php?entryID=' . $item_id; |
74
|
|
|
|
75
|
|
|
return $item; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|