Completed
Push — master ( 8ca430...3024c9 )
by Michael
03:12
created

include/notification.inc.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Module: XoopsTube
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 *
9
 * PHP version 5
10
 *
11
 * @category        Module
12
 * @package         Xoopstube
13
 * @author          XOOPS Development Team
14
 * @copyright       2001-2013 The XOOPS Project
15
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @version         $Id$
17
 * @link            http://sourceforge.net/projects/xoops/
18
 * @since           1.0.6
19
 *
20
 * @param $category
21
 * @param $item_id
22
 *
23
 * @return null
24
 */
25
26
function xtubeNotifyIteminfo($category, $item_id)
27
{
28
    global $xoopsModule, $xoopsModuleConfig;
29
30
    $mydirname = basename(dirname(__DIR__));
31
//    $mydirpath = dirname(__DIR__);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
32
33
    if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'xoopstube') {
34
        $module_handler =& xoops_gethandler('module');
35
        $module         =& $module_handler->getByDirname($mydirname);
36
        $config_handler =& xoops_gethandler('config');
37
        $config         =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
38
    } else {
39
        $module =& $xoopsModule;
40
        $config =& $xoopsModuleConfig;
41
    }
42
43
    if ($category == 'global') {
44
        $item['name'] = '';
45
        $item['url']  = '';
46
47
        return $item;
48
    }
49
50
    global $xoopsDB;
51
    if ($category == 'category') {
52
        // Assume we have a valid category id
53
        $sql = "SELECT title FROM " . $xoopsDB->prefix('xoopstube_cat') . " WHERE cid=" . $item_id;
54
        if (!$result = $xoopsDB->query($sql)) {
55
            return false;
56
        }
57
        $result_array = $xoopsDB->fetchArray($result);
58
        $item['name'] = $result_array['title'];
59
        $item['url']  = XOOPS_URL . '/modules/xoopstube/viewcat.php?cid=' . $item_id;
60
61
        return $item;
62
    }
63
64
    if ($category == 'video') {
65
        // Assume we have a valid file id
66
        $sql = "SELECT cid,title FROM " . $xoopsDB->prefix('xoopstube_videos') . " WHERE lid=" . $item_id;
67
        if (!$result = $xoopsDB->query($sql)) {
68
            return false;
69
        }
70
        $result_array = $xoopsDB->fetchArray($result);
71
        $item['name'] = $result_array['title'];
72
        $item['url']
73
                      = XOOPS_URL . '/modules/xoopstube/singlevideo.php?cid=' . $result_array['cid'] . '&amp;lid=' . $item_id;
74
75
        return $item;
76
    }
77
78
    return null;
79
}
80