mainStats()   F
last analyzed

Complexity

Conditions 63
Paths > 20000

Size

Total Lines 389
Code Lines 309

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 309
c 3
b 0
f 0
dl 0
loc 389
rs 0
cc 63
nc 54272
nop 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
 */
19
require_once dirname(dirname(__DIR__)) . '/mainfile.php';
20
$GLOBALS['xoopsOption']['template_main'] = 'statistics.tpl';
21
require_once XOOPS_ROOT_PATH . '/header.php';
22
23
function mainStats()
24
{
25
    global $xoopsDB, $xoopsTpl;
26
    $count  = 0;
0 ignored issues
show
Unused Code introduced by
The assignment to $count is dead and can be removed.
Loading history...
27
    $result = $xoopsDB->queryF('SELECT type, var, count FROM ' . $xoopsDB->prefix('counter') . " WHERE type='total' AND var='hits'");
28
    [$type, $var, $count] = $xoopsDB->fetchRow($result);
29
    $total = $count;
30
31
    $count  = 0;
32
    $result = $xoopsDB->queryF('SELECT type, var, count FROM ' . $xoopsDB->prefix('counter') . " WHERE type='totalblocked' AND var='hits'");
33
    [$type, $var, $count] = $xoopsDB->fetchRow($result);
34
    $totalblocked = $count;
35
36
    $result = $xoopsDB->queryF('SELECT type, var, count FROM ' . $xoopsDB->prefix('counter') . ' ORDER BY type DESC');
37
    while (list($type, $var, $count) = $xoopsDB->fetchRow($result)) {
38
        if ('browser' === $type) {
39
            if ('Netscape' === $var) {
40
                $netscape[] = $count;
41
                $percent    = (0 == $total ? 0 : $count / $total);
42
                $netscape[] = mb_substr(100 * $percent, 0, 5);
43
            } elseif ('MSIE' === $var) {
44
                $msie[]  = $count;
45
                $percent = (0 == $total ? 0 : $count / $total);
46
                $msie[]  = mb_substr(100 * $percent, 0, 5);
47
            } elseif ('Konqueror' === $var) {
48
                $konqueror[] = $count;
49
                $percent     = (0 == $total ? 0 : $count / $total);
50
                $konqueror[] = mb_substr(100 * $percent, 0, 5);
51
            } elseif ('Opera' === $var) {
52
                $opera[] = $count;
53
                $percent = (0 == $total ? 0 : $count / $total);
54
                $opera[] = mb_substr(100 * $percent, 0, 5);
55
            } elseif ('Lynx' === $var) {
56
                $lynx[]  = $count;
57
                $percent = (0 == $total ? 0 : $count / $total);
58
                $lynx[]  = mb_substr(100 * $percent, 0, 5);
59
            } elseif ('Bot' === $var) {
60
                $bot[]   = $count;
61
                $percent = (0 == $total ? 0 : $count / $total);
62
                $bot[]   = mb_substr(100 * $percent, 0, 5);
63
            } elseif ('AppleWeb' === $var) {
64
                $apple[] = $count;
65
                $percent = (0 == $total ? 0 : $count / $total);
66
                $apple[] = mb_substr(100 * $percent, 0, 5);
67
            } elseif ('Firefox' === $var) {
68
                $firefox[] = $count;
69
                $percent   = (0 == $total ? 0 : $count / $total);
70
                $firefox[] = mb_substr(100 * $percent, 0, 5);
71
            } elseif ('Mozilla' === $var) {
72
                $mozilla[] = $count;
73
                $percent   = (0 == $total ? 0 : $count / $total);
74
                $mozilla[] = mb_substr(100 * $percent, 0, 5);
75
            } elseif ('Deepnet' === $var) {
76
                $deepnet[] = $count;
77
                $percent   = (0 == $total ? 0 : $count / $total);
78
                $deepnet[] = mb_substr(100 * $percent, 0, 5);
79
            } elseif ('Avant' === $var) {
80
                $avant[] = $count;
81
                $percent = (0 == $total ? 0 : $count / $total);
82
                $avant[] = mb_substr(100 * $percent, 0, 5);
83
            } elseif ('Other' === $var) {
84
                $b_other[] = $count;
85
                $percent   = (0 == $total ? 0 : $count / $total);
86
                $b_other[] = mb_substr(100 * $percent, 0, 5);
87
            }
88
        } elseif ('os' === $type) {
89
            if ('Windows' === $var) {
90
                $windows[] = $count;
91
                $percent   = (0 == $total ? 0 : $count / $total);
92
                $windows[] = mb_substr(100 * $percent, 0, 5);
93
            } elseif ('Mac' === $var) {
94
                $mac[]   = $count;
95
                $percent = (0 == $total ? 0 : $count / $total);
96
                $mac[]   = mb_substr(100 * $percent, 0, 5);
97
            } elseif ('Linux' === $var) {
98
                $linux[] = $count;
99
                $percent = (0 == $total ? 0 : $count / $total);
100
                $linux[] = mb_substr(100 * $percent, 0, 5);
101
            } elseif ('FreeBSD' === $var) {
102
                $freebsd[] = $count;
103
                $percent   = (0 == $total ? 0 : $count / $total);
104
                $freebsd[] = mb_substr(100 * $percent, 0, 5);
105
            } elseif ('SunOS' === $var) {
106
                $sunos[] = $count;
107
                $percent = (0 == $total ? 0 : $count / $total);
108
                $sunos[] = mb_substr(100 * $percent, 0, 5);
109
            } elseif ('IRIX' === $var) {
110
                $irix[]  = $count;
111
                $percent = (0 == $total ? 0 : $count / $total);
112
                $irix[]  = mb_substr(100 * $percent, 0, 5);
113
            } elseif ('BeOS' === $var) {
114
                $beos[]  = $count;
115
                $percent = (0 == $total ? 0 : $count / $total);
116
                $beos[]  = mb_substr(100 * $percent, 0, 5);
117
            } elseif ('OS/2' === $var) {
118
                $os2[]   = $count;
119
                $percent = (0 == $total ? 0 : $count / $total);
120
                $os2[]   = mb_substr(100 * $percent, 0, 5);
121
            } elseif ('AIX' === $var) {
122
                $aix[]   = $count;
123
                $percent = (0 == $total ? 0 : $count / $total);
124
                $aix[]   = mb_substr(100 * $percent, 0, 5);
125
            } elseif ('Other' === $var) {
126
                $os_other[] = $count;
127
                $percent    = (0 == $total ? 0 : $count / $total);
128
                $os_other[] = mb_substr(100 * $percent, 0, 5);
129
            }
130
        } elseif ('blocked' === $type) {
131
            if ('bots' === $var) {
132
                $blockedbots[] = $count;
133
                $percent       = (0 == $totalblocked ? 0 : $count / $totalblocked);
134
                $blockedbots[] = mb_substr(100 * $percent, 0, 5);
135
            } elseif ('referers' === $var) {
136
                $blockedreferers[] = $count;
137
                $percent           = (0 == $totalblocked ? 0 : $count / $totalblocked);
138
                $blockedreferers[] = mb_substr(100 * $percent, 0, 5);
139
            }
140
        }
141
    }
142
143
    $l_size = getimagesize('assets/images/leftbar.gif');
144
    $m_size = getimagesize('assets/images/mainbar.gif');
145
    $r_size = getimagesize('assets/images/rightbar.gif');
146
147
    $xoopsTpl->assign('lang_stat_heading', STATS_HEADING);
148
149
    $result   = $xoopsDB->queryF('SELECT year, hits FROM ' . $xoopsDB->prefix('stats_year'));
150
    $yearhits = [];
151
    $i        = 0;
152
    while (list($year, $hits) = $xoopsDB->fetchRow($result)) {
153
        $yearhits[$i]['year'] = $year;
154
        $yearhits[$i]['hits'] = $hits;
155
        ++$i;
156
    }
157
    $xoopsTpl->assign('yearhits', $yearhits);
158
    $xoopsTpl->assign('lang_stats_yearhits', STATS_YEARHITS);
159
160
    $result    = $xoopsDB->queryF('SELECT year, hits FROM ' . $xoopsDB->prefix('stats_blockedyear'));
161
    $byearhits = [];
162
    $i         = 0;
163
    while (list($year, $hits) = $xoopsDB->fetchRow($result)) {
164
        $byearhits[$i]['year'] = $year;
165
        $byearhits[$i]['hits'] = $hits;
166
        ++$i;
167
    }
168
    $xoopsTpl->assign('byearhits', $byearhits);
169
    $xoopsTpl->assign('lang_stats_byearhits', STATS_BYEARHITS);
170
171
    $xoopsTpl->assign('lang_stat_browser', STATS_BROWSERS);
172
    $xoopsTpl->assign('lang_stat_thissite', $_SERVER['HTTP_HOST']);
173
    $xoopsTpl->assign('lang_stat_useragent', $_SERVER['HTTP_USER_AGENT']);
174
    $xoopsTpl->assign('lang_stat_uahead', STATS_USER_AGENT);
175
    $xoopsTpl->assign(
176
        'lang_stat_msie',
177
        "<tr><td><img src=\"assets/images/explorer.gif\" border=\"0\" alt=\"\">MSIE:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Internet Explorer\"><img src=\"assets/images/mainbar.gif\" Alt=\"Internet Explorer\" height=\"$m_size[1]\" width=\"$msie[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Internet Explorer\">$msie[1] % ($msie[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $msie does not seem to be defined for all execution paths leading up to this point.
Loading history...
178
    );
179
    $xoopsTpl->assign(
180
        'lang_stat_netscape',
181
        "<tr><td><img src=\"assets/images/netscape.gif\" border=\"0\" alt=\"\">Netscape:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Netscape\"><img src=\"assets/images/mainbar.gif\" Alt=\"Netscape\" height=\"$m_size[1]\" width=\"$netscape[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Netscape\"> $netscape[1] % ($netscape[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $netscape does not seem to be defined for all execution paths leading up to this point.
Loading history...
182
    );
183
    $xoopsTpl->assign(
184
        'lang_stat_opera',
185
        "<tr><td><img src=\"assets/images/opera.gif\" border=\"0\" alt=\"\">&nbsp;Opera: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Opera\"><img src=\"assets/images/mainbar.gif\" Alt=\"Opera\" height=\"$m_size[1]\" width=\"$opera[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Opera\"> $opera[1] % ($opera[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $opera does not seem to be defined for all execution paths leading up to this point.
Loading history...
186
    );
187
    $xoopsTpl->assign(
188
        'lang_stat_kon',
189
        "<tr><td><img src=\"assets/images/konqueror.gif\" border=\"0\" alt=\"\">&nbsp;Konqueror: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Konqueror\"><img src=\"assets/images/mainbar.gif\" Alt=\"Konqueror (KDE)\" height=\"$m_size[1]\" width=\"$konqueror[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Konqueror\"> $konqueror[1] % ($konqueror[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $konqueror does not seem to be defined for all execution paths leading up to this point.
Loading history...
190
    );
191
    $xoopsTpl->assign(
192
        'lang_stat_lynx',
193
        "<tr><td><img src=\"assets/images/lynx.gif\" border=\"0\" alt=\"\">&nbsp;Lynx: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Lynx\"><img src=\"assets/images/mainbar.gif\" Alt=\"Lynx\" height=\"$m_size[1]\" width=\"$lynx[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Lynx\"> $lynx[1] % ($lynx[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $lynx does not seem to be defined for all execution paths leading up to this point.
Loading history...
194
    );
195
    $xoopsTpl->assign(
196
        'lang_stat_apple',
197
        "<tr><td><img src=\"assets/images/apple.png\" border=\"0\" alt=\"\">&nbsp;AppleWebKit: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"AppleWebKit\"><img src=\"assets/images/mainbar.gif\" Alt=\"AppleWebKit\" height=\"$m_size[1]\" width=\"$apple[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"AppleWebKit\"> $apple[1] % ($apple[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $apple does not seem to be defined for all execution paths leading up to this point.
Loading history...
198
    );
199
    $xoopsTpl->assign(
200
        'lang_stat_firefox',
201
        "<tr><td><img src=\"assets/images/firefox.png\" border=\"0\" alt=\"\">&nbsp;Firefox: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Firefox\"><img src=\"assets/images/mainbar.gif\" Alt=\"Firefox\" height=\"$m_size[1]\" width=\"$firefox[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Firefox\"> $firefox[1] % ($firefox[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $firefox does not seem to be defined for all execution paths leading up to this point.
Loading history...
202
    );
203
    $xoopsTpl->assign(
204
        'lang_stat_mozilla',
205
        "<tr><td><img src=\"assets/images/mozilla.png\" border=\"0\" alt=\"\">&nbsp;Mozilla: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Mozilla\"><img src=\"assets/images/mainbar.gif\" Alt=\"Mozilla\" height=\"$m_size[1]\" width=\"$mozilla[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Mozilla\"> $mozilla[1] % ($mozilla[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $mozilla does not seem to be defined for all execution paths leading up to this point.
Loading history...
206
    );
207
    $xoopsTpl->assign(
208
        'lang_stat_deepnet',
209
        "<tr><td><img src=\"assets/images/deepnet.gif\" border=\"0\" alt=\"\">&nbsp;Deepnet: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Deepnet\"><img src=\"assets/images/mainbar.gif\" Alt=\"Deepnet\" height=\"$m_size[1]\" width=\"$deepnet[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Deepnet\"> $deepnet[1] % ($deepnet[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $deepnet does not seem to be defined for all execution paths leading up to this point.
Loading history...
210
    );
211
    $xoopsTpl->assign(
212
        'lang_stat_avant',
213
        "<tr><td><img src=\"assets/images/avant.gif\" border=\"0\" alt=\"\">&nbsp;Avant: </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Avant\"><img src=\"assets/images/mainbar.gif\" Alt=\"Avant\" height=\"$m_size[1]\" width=\"$avant[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Avant\"> $avant[1] % ($avant[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $avant does not seem to be defined for all execution paths leading up to this point.
Loading history...
214
    );
215
    $xoopsTpl->assign(
216
        'lang_stat_altavista',
217
        '<tr><td><img src="assets/images/altavista.gif" border="0" alt="">&nbsp;'
218
        . STATS_SEARCHENGINES
219
        . ": </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Robots - Spiders - Buscadores\"><img src=\"assets/images/mainbar.gif\" Alt=\"Robots - Spiders - Buscadores\" height=\"$m_size[1]\" width=\"$bot[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $bot does not seem to be defined for all execution paths leading up to this point.
Loading history...
220
        . STATS_BOTS
221
        . "\"> $bot[1] % ($bot[0])</td></tr>"
222
    );
223
    $xoopsTpl->assign(
224
        'lang_stat_question',
225
        '<tr><td><img src="assets/images/question.gif" border="0" alt="">&nbsp;'
226
        . STATS_UNKNOWN
227
        . ": </td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Otros - Desconocidos\"><img src=\"assets/images/mainbar.gif\" Alt=\"Otros - Desconocidos\" height=\"$m_size[1]\" width=\"$b_other[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $b_other does not seem to be defined for all execution paths leading up to this point.
Loading history...
228
        . STATS_OTHER
229
        . "\"> $b_other[1] % ($b_other[0])"
230
    );
231
232
    $xoopsTpl->assign('lang_stat_opersys', STATS_OPERATINGSYS);
233
    $xoopsTpl->assign(
234
        'lang_stat_windows',
235
        "<tr><td><img src=\"assets/images/windows.gif\" border=\"0\" alt=\"\">Windows:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Windows\"><img src=\"assets/images/mainbar.gif\" Alt=\"Windows\" height=\"$m_size[1]\" width=\"$windows[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Windows\"> $windows[1] % ($windows[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $windows does not seem to be defined for all execution paths leading up to this point.
Loading history...
236
    );
237
    $xoopsTpl->assign(
238
        'lang_stat_linux',
239
        "<tr><td><img src=\"assets/images/linux.gif\" border=\"0\" alt=\"\">Linux:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Linux\"><img src=\"assets/images/mainbar.gif\" Alt=\"Linux\" height=\"$m_size[1]\" width=\"$linux[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Linux\"> $linux[1] % ($linux[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $linux does not seem to be defined for all execution paths leading up to this point.
Loading history...
240
    );
241
    $xoopsTpl->assign(
242
        'lang_stat_mac',
243
        "<tr><td><img src=\"assets/images/mac.gif\" border=\"0\" alt=\"\">Mac/PPC:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Mac/PPC\"><img src=\"assets/images/mainbar.gif\" Alt=\"Mac - PPC\" height=\"$m_size[1]\" width=\"$mac[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Mac/PPC\"> $mac[1] % ($mac[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $mac does not seem to be defined for all execution paths leading up to this point.
Loading history...
244
    );
245
    $xoopsTpl->assign(
246
        'lang_stat_bsd',
247
        "<tr><td><img src=\"assets/images/bsd.gif\" border=\"0\" alt=\"\">FreeBSD:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"FreeBSD\"><img src=\"assets/images/mainbar.gif\" Alt=\"FreeBSD\" height=\"$m_size[1]\" width=\"$freebsd[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"FreeBSD\"> $freebsd[1] % ($freebsd[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $freebsd does not seem to be defined for all execution paths leading up to this point.
Loading history...
248
    );
249
    $xoopsTpl->assign(
250
        'lang_stat_sun',
251
        "<tr><td><img src=\"assets/images/sun.gif\" border=\"0\" alt=\"\">SunOS:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"SunOS\"><img src=\"assets/images/mainbar.gif\" Alt=\"SunOS\" height=\"$m_size[1]\" width=\"$sunos[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"SunOS\"> $sunos[1] % ($sunos[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $sunos does not seem to be defined for all execution paths leading up to this point.
Loading history...
252
    );
253
    $xoopsTpl->assign(
254
        'lang_stat_irix',
255
        "<tr><td><img src=\"assets/images/irix.gif\" border=\"0\" alt=\"\">IRIX:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"SGI Irix\"><img src=\"assets/images/mainbar.gif\" Alt=\"SGI Irix\" height=\"$m_size[1]\" width=\"$irix[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"SGI Irix\"> $irix[1] % ($irix[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $irix does not seem to be defined for all execution paths leading up to this point.
Loading history...
256
    );
257
    $xoopsTpl->assign(
258
        'lang_stat_be',
259
        "<tr><td><img src=\"assets/images/be.gif\" border=\"0\" alt=\"\">BeOS:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"BeOS\"><img src=\"assets/images/mainbar.gif\" Alt=\"BeOS\" height=\"$m_size[1]\" width=\"$beos[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"BeOS\"> $beos[1] % ($beos[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $beos does not seem to be defined for all execution paths leading up to this point.
Loading history...
260
    );
261
    $xoopsTpl->assign(
262
        'lang_stat_os2',
263
        "<tr><td><img src=\"assets/images/os2.gif\" border=\"0\" alt=\"\">OS/2:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"OS/2\"><img src=\"assets/images/mainbar.gif\" Alt=\"OS/2\" height=\"$m_size[1]\" width=\"$os2[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"OS/2\"> $os2[1] % ($os2[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $os2 does not seem to be defined for all execution paths leading up to this point.
Loading history...
264
    );
265
    $xoopsTpl->assign(
266
        'lang_stat_aix',
267
        "<tr><td><img src=\"assets/images/aix.gif\" border=\"0\" alt=\"\">&nbsp;AIX:</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"AIX\"><img src=\"assets/images/mainbar.gif\" Alt=\"AIX\" height=\"$m_size[1]\" width=\"$aix[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"AIX\"> $aix[1] % ($aix[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $aix does not seem to be defined for all execution paths leading up to this point.
Loading history...
268
    );
269
    $xoopsTpl->assign(
270
        'lang_stat_osquestion',
271
        '<tr><td><img src="assets/images/question.gif" border="0" alt="">&nbsp;'
272
        . STATS_UNKNOWN
273
        . ":</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Otros - Desconocidos\"><img src=\"assets/images/mainbar.gif\" ALt=\"Otros - Desconocidos\" height=\"$m_size[1]\" width=\"$os_other[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\""
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $os_other does not seem to be defined for all execution paths leading up to this point.
Loading history...
274
        . STATS_OTHER
275
        . "\"> $os_other[1] % ($os_other[0])"
276
    );
277
278
    $xoopsTpl->assign('lang_stat_blockedtype', STATS_BLOCKEDTYPE);
279
    $xoopsTpl->assign(
280
        'lang_stat_blockedbots',
281
        "<tr><td><img src=\"assets/images/altavista.gif\" border=\"0\" alt=\"\">Bots:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Bots\"><img src=\"assets/images/mainbar.gif\" Alt=\"Bots\" height=\"$m_size[1]\" width=\"$blockedbots[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Bots\"> $blockedbots[1] % ($blockedbots[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $blockedbots does not seem to be defined for all execution paths leading up to this point.
Loading history...
282
    );
283
    $xoopsTpl->assign(
284
        'lang_stat_blockedreferers',
285
        "<tr><td><img src=\"assets/images/explorer.gif\" border=\"0\" alt=\"\">Referers:&nbsp;</td><td><img src=\"assets/images/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" Alt=\"Referers\"><img src=\"assets/images/mainbar.gif\" Alt=\"Referers\" height=\"$m_size[1]\" width=\"$blockedreferers[1] * 2\"><img src=\"assets/images/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" Alt=\"Referers\"> $blockedreferers[1] % ($blockedreferers[0])</td></tr>"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $blockedreferers does not seem to be defined for all execution paths leading up to this point.
Loading history...
286
    );
287
288
    $xoopsTpl->assign('lang_misc_stats', STATS_MISC);
289
    $unum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('users')));
290
    $xoopsTpl->assign('lang_stats_regusers', STATS_REGUSERS);
291
    $xoopsTpl->assign('lang_stats_users', $unum);
292
293
    $usersonline = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('online')));
294
    $xoopsTpl->assign('lang_stats_usersonline', STATS_USERS_ONLINE);
295
    $xoopsTpl->assign('lang_stats_usersolcnt', $usersonline);
296
297
    $authorscnt = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('users') . ' WHERE posts>0'));
298
    $xoopsTpl->assign('lang_stats_auth', STATS_AUTHORS);
299
    $xoopsTpl->assign('lang_stats_authors', $authorscnt);
300
301
    $anum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('session')));
302
    $xoopsTpl->assign('lang_stats_ausers', STATS_ACTIVEUSERS);
303
    $xoopsTpl->assign('lang_stats_activeusers', $anum);
304
305
    $cnum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('xoopscomments')));
306
    $xoopsTpl->assign('lang_stats_commentsposted', STATS_COMMENTSPOSTED);
307
    $xoopsTpl->assign('lang_stats_comments', $cnum);
308
309
    $xoopsTpl->assign('lang_xoops_version', STATS_XOOPS_VERSION);
310
311
    // see if sections is active
312
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='sections' AND isactive='1'")) > 0) {
313
        $xoopsTpl->assign('sections_active', true);
314
        $secnum  = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('sections')));
315
        $secanum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('seccont')));
316
        $xoopsTpl->assign('lang_stat_section', STATS_SECTION);
317
        $xoopsTpl->assign('lang_stat_sectioncnt', $secnum);
318
        $xoopsTpl->assign('lang_stat_article', STATS_ARTICLE);
319
        $xoopsTpl->assign('lang_stat_articlecnt', $secanum);
320
    }
321
322
    // see if news is active
323
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='news' AND isactive='1'")) > 0) {
324
        $xoopsTpl->assign('news_active', true);
325
        $snum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('stories') . ' WHERE published!=0'));
326
        $xoopsTpl->assign('lang_stats_storiespublished', STATS_STORIESPUBLISHED);
327
        $xoopsTpl->assign('lang_stats_stories', $snum);
328
329
        $swait = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('stories') . ' WHERE published=0'));
330
        $xoopsTpl->assign('lang_stats_waitingstories', STATS_STORIESWAITING);
331
        $xoopsTpl->assign('lang_stats_waiting', $swait);
332
333
        $tnum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('topics')));
334
        $xoopsTpl->assign('lang_stats_topics', STATS_TOPICS);
335
        $xoopsTpl->assign('lang_stats_topicscnt', $tnum);
336
    }
337
338
    // see if AMS is active
339
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='AMS' AND isactive='1'")) > 0) {
340
        $xoopsTpl->assign('amsnews_active', true);
341
        $snum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('ams_article') . ' WHERE published!=0'));
342
        $xoopsTpl->assign('lang_stats_amsstoriespublished', STATS_AMSARTICLE);
343
        $xoopsTpl->assign('lang_stats_amsstories', $snum);
344
345
        $swait = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('ams_article') . ' WHERE published=0'));
346
        $xoopsTpl->assign('lang_stats_amswaitingstories', STATS_AMSSTORIESWAITING);
347
        $xoopsTpl->assign('lang_stats_amswaiting', $swait);
348
349
        $tnum = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('ams_topics')));
350
        $xoopsTpl->assign('lang_stats_amstopics', STATS_AMSTOPICS);
351
        $xoopsTpl->assign('lang_stats_amstopicscnt', $tnum);
352
    }
353
354
    // see if mylinks is active
355
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='mylinks' AND isactive='1'")) > 0) {
356
        $xoopsTpl->assign('links_active', true);
357
        $links = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('mylinks_links')));
358
        $xoopsTpl->assign('lang_stats_links', STATS_LINKS);
359
        $xoopsTpl->assign('lang_stats_linkscnt', $links);
360
361
        $cat = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('mylinks_cat')));
362
        $xoopsTpl->assign('lang_stats_linkcat', STATS_LINKCAT);
363
        $xoopsTpl->assign('lang_stats_linkcatcnt', $cat);
364
    }
365
366
    // see if xoopsgallery is active
367
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='xoopsgallery' AND isactive='1'")) > 0) {
368
        $xoopsTpl->assign('xoopsgallery_active', true);
369
        $links = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('xoopsgallery_image')));
370
        $xoopsTpl->assign('lang_stats_gimages', STATS_GALLERY_IMAGES);
371
        $xoopsTpl->assign('lang_stats_gimagescnt', $links);
372
373
        $cat = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT DISTINCT image_albumdir FROM ' . $xoopsDB->prefix('xoopsgallery_image')));
374
        $xoopsTpl->assign('lang_stats_galbums', STATS_GALLERY_ALBUMS);
375
        $xoopsTpl->assign('lang_stats_galbumscnt', $cat);
376
    }
377
378
    // see if tinycontent is active
379
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='tinycontent' AND isactive='1'")) > 0) {
380
        $xoopsTpl->assign('tinycontent_active', true);
381
        $links = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('tinycontent')));
382
        $xoopsTpl->assign('lang_stats_tinycontent', STATS_TCONTENT_AVAIL);
383
        $xoopsTpl->assign('lang_stats_tccnt', $links);
384
385
        $cat = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('tinycontent') . " WHERE visible='1'"));
386
        $xoopsTpl->assign('lang_stats_tcvisible', STATS_TCONTENT_VISIBLE);
387
        $xoopsTpl->assign('lang_stats_tcvcnt', $cat);
388
    }
389
390
    // see if mydownloads is active
391
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='downloads' AND isactive='1'")) > 0) {
392
        $xoopsTpl->assign('dl_active', true);
393
        $dlcat = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('mydownloads_cat')));
394
        $xoopsTpl->assign('lang_stats_dlcat', STATS_DLCAT);
395
        $xoopsTpl->assign('lang_stats_dlcatcnt', $dlcat);
396
397
        $dlfiles = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('mydownloads_downloads')));
398
        $xoopsTpl->assign('lang_stats_dlfiles', STATS_DLFILES);
399
        $xoopsTpl->assign('lang_stats_dlfilescnt', $dlfiles);
400
    }
401
402
    // see if wfdownloads is active
403
    if ($xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='wfdownloads' AND isactive='1'")) > 0) {
404
        $xoopsTpl->assign('wfdl_active', true);
405
        $wfdlcat = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('wfdownloads_cat')));
406
        $xoopsTpl->assign('lang_stats_wfdlcat', STATS_WFDLCAT);
407
        $xoopsTpl->assign('lang_stats_wfdlcatcnt', $wfdlcat);
408
409
        $wfdlfiles = $xoopsDB->getRowsNum($xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('wfdownloads_downloads')));
410
        $xoopsTpl->assign('lang_stats_wfdlfiles', STATS_WFDLFILES);
411
        $xoopsTpl->assign('lang_stats_wfdlfilescnt', $wfdlfiles);
412
    }
413
}
414
415
mainStats();
416
417
require_once XOOPS_ROOT_PATH . '/footer.php';
418