|
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
|
|
|
/** |
|
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
|
15
|
|
|
* @package |
|
16
|
|
|
* @since |
|
17
|
|
|
* @author XOOPS Development Team |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @param $category |
|
24
|
|
|
* @param $item_id |
|
25
|
|
|
* |
|
26
|
|
|
* @return null |
|
|
|
|
|
|
27
|
|
|
*/ |
|
28
|
|
|
function news_notify_iteminfo($category, $item_id) |
|
29
|
|
|
{ |
|
30
|
|
|
if ('global' === $category) { |
|
31
|
|
|
$item['name'] = ''; |
|
|
|
|
|
|
32
|
|
|
$item['url'] = ''; |
|
33
|
|
|
|
|
34
|
|
|
return $item; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
global $xoopsDB; |
|
|
|
|
|
|
38
|
|
|
|
|
39
|
|
View Code Duplication |
if ('story' === $category) { |
|
|
|
|
|
|
40
|
|
|
// Assume we have a valid story id |
|
41
|
|
|
$sql = 'SELECT title FROM ' . $xoopsDB->prefix('news_stories') . ' WHERE storyid = ' . (int)$item_id; |
|
42
|
|
|
$result = $xoopsDB->query($sql); |
|
43
|
|
|
if ($result) { |
|
44
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
|
45
|
|
|
$item['name'] = $result_array['title']; |
|
|
|
|
|
|
46
|
|
|
$item['url'] = XOOPS_URL . '/modules/news/article.php?storyid=' . (int)$item_id; |
|
47
|
|
|
|
|
48
|
|
|
return $item; |
|
49
|
|
|
} else { |
|
50
|
|
|
return null; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
// Added by Lankford on 2007/3/23 |
|
55
|
|
View Code Duplication |
if ('category' === $category) { |
|
|
|
|
|
|
56
|
|
|
$sql = 'SELECT title FROM ' . $xoopsDB->prefix('news_topics') . ' WHERE topic_id = ' . (int)$item_id; |
|
57
|
|
|
$result = $xoopsDB->query($sql); |
|
58
|
|
|
if ($result) { |
|
59
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
|
60
|
|
|
$item['name'] = $result_array['topic_id']; |
|
|
|
|
|
|
61
|
|
|
$item['url'] = XOOPS_URL . '/modules/news/index.php?storytopic=' . (int)$item_id; |
|
62
|
|
|
|
|
63
|
|
|
return $item; |
|
64
|
|
|
} else { |
|
65
|
|
|
return null; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return null; |
|
70
|
|
|
} |
|
71
|
|
|
|
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.