This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||
15 | * @package |
||
16 | * @since |
||
17 | * @author XOOPS Development Team |
||
18 | * @param mixed $options |
||
19 | */ |
||
20 | |||
21 | /****************************************************************************** |
||
22 | * Function: b_hitcounter_show |
||
23 | * Output : Returns the graphical output of site hits |
||
24 | ***************************************************************************** |
||
25 | * @param $options |
||
26 | * @return array |
||
27 | */ |
||
28 | function b_hitcounter_show($options) |
||
29 | { |
||
30 | global $xoopsDB; |
||
31 | $block = []; |
||
32 | $myts = \MyTextSanitizer::getInstance(); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
33 | $result = $xoopsDB->queryF('SELECT year, hits FROM ' . $xoopsDB->prefix('stats_year')); |
||
34 | $counter = 0; |
||
35 | $yearhits = []; |
||
36 | $cnt = 0; |
||
37 | while (list($year, $hits) = $xoopsDB->fetchRow($result)) { |
||
38 | $counter += $hits; // figure out total hits |
||
39 | |||
40 | $yearhits[$cnt]['year'] = $year; |
||
41 | $yearhits[$cnt]['counter'] = ''; |
||
42 | if (mb_strlen($hits) < 5) { |
||
43 | $hits = sprintf('%05d', $hits); |
||
44 | } |
||
45 | for ($i = 0, $iMax = mb_strlen($hits); $i < $iMax; ++$i) { |
||
46 | //the <img src> tag |
||
47 | $imgsrc = mb_substr($hits, $i, 1); |
||
48 | $yearhits[$cnt]['counter'] .= '<img src="' . XOOPS_URL . '/modules/statistics/assets/images/' . $imgsrc . '.gif" border = "0">'; |
||
49 | } |
||
50 | |||
51 | ++$cnt; |
||
52 | } |
||
53 | |||
54 | //number images are stored in the images directory |
||
55 | //and are numbered from 0.gif to 9.gif |
||
56 | //loop through the values of $counter and |
||
57 | //use the strlen function to check the length of $counter |
||
58 | $cnt_graphic = ''; |
||
59 | if (mb_strlen($counter) < 5) { |
||
60 | $counter = sprintf('%05d', $counter); |
||
61 | } |
||
62 | for ($i = 0, $iMax = mb_strlen($counter); $i < $iMax; ++$i) { |
||
63 | //the <img src> tag |
||
64 | $imgsrc = mb_substr($counter, $i, 1); |
||
65 | $cnt_graphic .= '<img src="' . XOOPS_URL . '/modules/statistics/assets/images/' . $imgsrc . '.gif" border = "0">'; |
||
66 | } |
||
67 | |||
68 | if ('1' == $options[1]) { // check to see if we should show the blocked hits |
||
69 | $result = $xoopsDB->queryF('SELECT year, hits FROM ' . $xoopsDB->prefix('stats_blockedyear')); |
||
70 | $bcounter = 0; |
||
71 | $byearhits = []; |
||
72 | $cnt = 0; |
||
73 | while (list($year, $hits) = $xoopsDB->fetchRow($result)) { |
||
74 | $bcounter += $hits; // figure out total hits |
||
75 | |||
76 | $byearhits[$cnt]['year'] = $year; |
||
77 | $byearhits[$cnt]['counter'] = ''; |
||
78 | if (mb_strlen($hits) < 5) { |
||
79 | $hits = sprintf('%05d', $hits); |
||
80 | } |
||
81 | for ($i = 0, $iMax = mb_strlen($hits); $i < $iMax; ++$i) { |
||
82 | //the <img src> tag |
||
83 | $imgsrc = mb_substr($hits, $i, 1); |
||
84 | $byearhits[$cnt]['counter'] .= '<img src="' . XOOPS_URL . '/modules/statistics/assets/images/' . $imgsrc . '.gif" border = "0">'; |
||
85 | } |
||
86 | |||
87 | ++$cnt; |
||
88 | } |
||
89 | |||
90 | //number images are stored in the images directory |
||
91 | //and are numbered from 0.gif to 9.gif |
||
92 | //loop through the values of $counter and |
||
93 | //use the strlen function to check the length of $counter |
||
94 | $bcnt_graphic = ''; |
||
95 | if (mb_strlen($bcounter) < 5) { |
||
96 | $bcounter = sprintf('%05d', $bcounter); |
||
97 | } |
||
98 | for ($i = 0, $iMax = mb_strlen($bcounter); $i < $iMax; ++$i) { |
||
99 | //the <img src> tag |
||
100 | $imgsrc = mb_substr($bcounter, $i, 1); |
||
101 | $bcnt_graphic .= '<img src="' . XOOPS_URL . '/modules/statistics/assets/images/' . $imgsrc . '.gif" border = "0">'; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | $block['display'] = $options[0]; |
||
106 | $block['displayblockedhits'] = $options[1]; |
||
107 | $block['counterhead'] = B_STATS_CNTHEAD; |
||
108 | $block['bcounterhead'] = B_STATS_BLOCKED_CNTHEAD; |
||
109 | $block['yearhead'] = B_STATS_YRHEAD; |
||
110 | $block['byearhead'] = B_STATS_BLOCKED_YRHEAD; |
||
111 | $block['counter'] = $cnt_graphic; |
||
112 | $block['bcounter'] = $bcnt_graphic; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
113 | $block['yearhits'] = $yearhits; |
||
114 | $block['byearhits'] = $byearhits; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
115 | |||
116 | return $block; |
||
117 | } |
||
118 | |||
119 | function b_hitcounter_edit($options) |
||
120 | { |
||
121 | $form = '' . B_STATS_HITDISPLAY . " <select name='options[0]'>"; |
||
122 | $form .= "<option value='site'"; |
||
123 | if ('site' === $options[0]) { |
||
124 | $form .= ' selected'; |
||
125 | } |
||
126 | $form .= '>' . B_SITE . "</option>\n"; |
||
127 | $form .= "<option value='all'"; |
||
128 | if ('all' === $options[0]) { |
||
129 | $form .= ' selected'; |
||
130 | } |
||
131 | $form .= '>' . B_SITEALL . "</option>\n"; |
||
132 | $form .= "</select>\n"; |
||
133 | $form .= "<hr>\n"; |
||
134 | $form .= '' . B_STATS_BLOCKEDHITDISPLAY . ' '; |
||
135 | $form .= "<input type='radio' id='options[1]' name='options[1]' value='1'"; |
||
136 | if (1 == $options[1]) { |
||
137 | $form .= ' checked'; |
||
138 | } |
||
139 | $form .= '> ' . _YES . "<br><input type='radio' id='options[1]' name='options[1]' value='0'"; |
||
140 | if (0 == $options[1]) { |
||
141 | $form .= ' checked'; |
||
142 | } |
||
143 | $form .= '> ' . _NO; |
||
144 | |||
145 | return $form; |
||
146 | } |
||
147 |