1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
/** |
12
|
|
|
* presenter module for xoops |
13
|
|
|
* |
14
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
15
|
|
|
* @license GPL 2.0 or later |
16
|
|
|
* @package presenter |
17
|
|
|
* @since 2.5.5 |
18
|
|
|
* @author XOOPS Development Team <[email protected]> - <http://xoops.org> |
19
|
|
|
* @version $Id: 1.0 notification.inc.php 11532 Wed 2013/08/28 4:00:27Z XOOPS Development Team $ |
20
|
|
|
* @param $category |
21
|
|
|
* @param $item_id |
22
|
|
|
* @return string |
23
|
|
|
*/ |
24
|
|
|
// comment callback functions |
25
|
|
|
function presenter_notify_iteminfo($category, $item_id) |
26
|
|
|
{ |
27
|
|
|
global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
|
|
|
|
28
|
|
|
|
29
|
|
|
if (empty($xoopsModule) || $xoopsModule->getVar('dirname') !== 'presenter') { |
30
|
|
|
$module_handler =& xoops_gethandler('module'); |
31
|
|
|
$module =& $module_handler->getByDirname('presenter'); |
32
|
|
|
$config_handler =& xoops_gethandler('config'); |
33
|
|
|
$config =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
34
|
|
|
} else { |
35
|
|
|
$module =& $xoopsModule; |
36
|
|
|
$config =& $xoopsModuleConfig; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
xoops_loadLanguage('main', 'presenter'); |
40
|
|
|
|
41
|
|
|
if ($category === 'global') { |
42
|
|
|
$item['name'] = ''; |
|
|
|
|
43
|
|
|
$item['url'] = ''; |
44
|
|
|
|
45
|
|
|
return $item; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
global $xoopsDB; |
|
|
|
|
49
|
|
|
if ($category === 'category') { |
50
|
|
|
// Assume we have a valid category id |
51
|
|
|
$sql = 'SELECT slides_cid FROM ' . $xoopsDB->prefix('presenter_slides') . ' WHERE slides_cid = ' . $item_id; |
52
|
|
|
$result = $xoopsDB->query($sql); // TODO: error check |
53
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
54
|
|
|
$item['name'] = $result_array['slides_cid']; |
|
|
|
|
55
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/slides.php?slides_cid=' . $item_id; |
56
|
|
|
|
57
|
|
|
return $item; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
if ($category === 'slides') { |
61
|
|
|
// Assume we have a valid link id |
62
|
|
|
$sql = 'SELECT slides_cid, slides_cid FROM ' . $xoopsDB->prefix('slides') . ' WHERE slides_id = ' . $item_id; |
63
|
|
|
$result = $xoopsDB->query($sql); // TODO: error check |
64
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
65
|
|
|
$item['name'] = $result_array['title']; |
|
|
|
|
66
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/slides.php?slides_cid=' . $result_array['slides_cid'] . '&slides_id=' . $item_id; |
67
|
|
|
|
68
|
|
|
return $item; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return ''; |
72
|
|
|
} |
73
|
|
|
|
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state