These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * XoopsTube - a multicategory video management module |
||
4 | * |
||
5 | * Based upon WF-Links |
||
6 | * |
||
7 | * File: blocks/xoopstube_banner.php |
||
8 | * |
||
9 | * @copyright http://xoops.org/ XOOPS Project |
||
10 | * @copyright XOOPS_copyrights.txt |
||
11 | * @copyright http://www.impresscms.org/ The ImpressCMS Project |
||
12 | * @license GNU General Public License (GPL) |
||
13 | * a copy of the GNU license is enclosed. |
||
14 | * ---------------------------------------------------------------------------------------------------------- |
||
15 | * @package XoopsTube |
||
16 | * @since 1.00 |
||
17 | * @author McDonald |
||
18 | * |
||
19 | * @param $options |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | |||
24 | function xtubeShowBannerB($options) |
||
25 | { |
||
26 | $moduleDirName = basename(dirname(__DIR__)); |
||
27 | |||
28 | $block = array(); |
||
29 | $time = time(); |
||
0 ignored issues
–
show
|
|||
30 | /** @var XoopsModuleHandler $moduleHandler */ |
||
31 | $moduleHandler = xoops_getHandler('module'); |
||
32 | $xoopstubeModule = $moduleHandler->getByDirname($moduleDirName); |
||
33 | $configHandler = xoops_getHandler('config'); |
||
34 | $xoopstubeModuleConfig = $configHandler->getConfigsByCat(0, $xoopstubeModule->getVar('mid')); |
||
35 | |||
36 | $result = $GLOBALS['xoopsDB']->query('SELECT a.cid AS acid, a.title, a.client_id, a.banner_id, b.bid, b.cid, b.imptotal, b.impmade, b.clicks FROM ' |
||
37 | . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') |
||
38 | . ' a, ' |
||
39 | . $GLOBALS['xoopsDB']->prefix('banner') |
||
40 | . ' b WHERE (b.cid = a.client_id) OR (b.bid = a.banner_id) ORDER BY b.cid, b.bid, a.title ASC'); |
||
41 | |||
42 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
43 | $impmade = $myrow['impmade']; |
||
44 | $clicks = $myrow['clicks']; |
||
45 | $imptotal = $myrow['imptotal']; |
||
46 | $bannerload = array(); |
||
47 | $result2 = $GLOBALS['xoopsDB']->query('SELECT name FROM ' . $GLOBALS['xoopsDB']->prefix('bannerclient') . ' WHERE cid=' . (int)$myrow['cid']); |
||
48 | $myclient = $GLOBALS['xoopsDB']->fetchArray($result2); |
||
49 | if ($impmade == 0) { |
||
50 | $percent = 0; |
||
51 | } else { |
||
52 | $percent = substr(100 * $clicks / $impmade, 0, 5); |
||
53 | } |
||
54 | if ($imptotal == 0) { |
||
55 | $left = 'Unlimited'; |
||
56 | } else { |
||
57 | $left = (int)$imptotal - (int)$impmade; |
||
58 | } |
||
59 | $bannerload['cat'] = (int)$myrow['acid']; |
||
60 | $bannerload['bid'] = (int)$myrow['bid']; |
||
61 | $bannerload['cid'] = (int)$myrow['cid']; |
||
62 | $bannerload['imptotal'] = (int)$myrow['imptotal']; |
||
63 | $bannerload['impmade'] = (int)$myrow['impmade']; |
||
64 | $bannerload['impleft'] = $left; |
||
65 | $bannerload['clicks'] = (int)$myrow['clicks']; |
||
66 | $bannerload['client'] = $myclient['name']; |
||
67 | $bannerload['percent'] = $percent; |
||
68 | $bannerload['cattitle'] = $myrow['title']; |
||
69 | $bannerload['dirname'] = $xoopstubeModule->getVar('dirname'); |
||
70 | $block['banners'][] = $bannerload; |
||
71 | } |
||
72 | unset($_block_check_array); |
||
73 | |||
74 | return $block; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param $options |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | function xtubeEditBannerB($options) |
||
83 | { |
||
84 | $form = ''; |
||
85 | |||
86 | return $form; |
||
87 | } |
||
88 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.