1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Module: Soapbox |
5
|
|
|
* Version: v 1.5 |
6
|
|
|
* Release Date: 23 August 2004 |
7
|
|
|
* Author: hsalazar |
8
|
|
|
* Licence: GNU |
9
|
|
|
* @param $category |
10
|
|
|
* @param $item_id |
11
|
|
|
* @param null $event |
|
|
|
|
12
|
|
|
* @return array |
13
|
|
|
*/ |
14
|
|
|
// defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15
|
|
|
function sb_notify_iteminfo($category, $item_id, $event = null) |
16
|
|
|
{ |
17
|
|
|
/* |
18
|
|
|
global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
19
|
|
|
|
20
|
|
|
if ( empty( $xoopsModule ) || $xoopsModule -> getVar( 'dirname' ) != 'soapbox' ) { |
21
|
|
|
$moduleHandler = xoops_getHandler( 'module' ); |
22
|
|
|
$module = $moduleHandler -> getByDirname( 'soapbox' ); |
23
|
|
|
$configHandler = xoops_getHandler( 'config' ); |
24
|
|
|
$config = $configHandler->getConfigsByCat( 0, $module -> getVar( 'mid' ) ); |
25
|
|
|
} else { |
26
|
|
|
$module = $xoopsModule; |
27
|
|
|
if ( empty( $xoopsModuleConfig ) ) { |
28
|
|
|
$configHandler = xoops_getHandler( 'config' ); |
29
|
|
|
$config = $configHandler->getConfigsByCat( 0, $module -> getVar( 'mid' ) ); |
30
|
|
|
} else { |
31
|
|
|
$config = $xoopsModuleConfig; |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
*/ |
35
|
|
|
// $moduleDirName = 'soapbox'; |
36
|
|
|
$pathparts = explode('/', __DIR__); |
37
|
|
|
$moduleDirName = $pathparts[array_search('modules', $pathparts, true) + 1]; |
38
|
|
|
$item_id = (int)$item_id; |
39
|
|
|
$item = []; |
40
|
|
|
if ('global' === $category) { |
41
|
|
|
$item['name'] = ''; |
42
|
|
|
$item['url'] = ''; |
43
|
|
|
|
44
|
|
|
return $item; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
global $xoopsDB; |
48
|
|
|
|
49
|
|
|
if ('column' === $category) { |
50
|
|
|
// Assume we have a valid category id |
51
|
|
|
|
52
|
|
|
$sql = 'SELECT name FROM ' . $xoopsDB->prefix('sbcolumns') . ' WHERE columnID = ' . $item_id; |
53
|
|
|
$result = $xoopsDB->query($sql); |
54
|
|
|
if (!$result) { |
55
|
|
|
return $item; |
56
|
|
|
} |
57
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
58
|
|
|
$item['name'] = $result_array['name']; |
59
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $moduleDirName . '/column.php?columnID=' . $item_id; |
60
|
|
|
|
61
|
|
|
return $item; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
if ('article' === $category) { |
65
|
|
|
// Assume we have a valid story id |
66
|
|
|
$sql = 'SELECT headline FROM ' . $xoopsDB->prefix('sbarticles') . ' WHERE articleID = ' . $item_id; |
67
|
|
|
$result = $xoopsDB->query($sql); |
68
|
|
|
if (!$result) { |
69
|
|
|
return $item; |
70
|
|
|
} |
71
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
72
|
|
|
$item['name'] = $result_array['headline']; |
73
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $moduleDirName . '/article.php?articleID=' . $item_id; |
74
|
|
|
|
75
|
|
|
return $item; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
return ''; |
79
|
|
|
} |
80
|
|
|
|