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 | */ |
||
19 | require_once __DIR__ . '/admin_header.php'; |
||
20 | xoops_cp_header(); |
||
21 | |||
22 | function TableExists($tablename) |
||
23 | { |
||
24 | global $xoopsDB; |
||
25 | $result = $xoopsDB->queryF("SHOW TABLES LIKE '$tablename'"); |
||
26 | |||
27 | return ($xoopsDB->getRowsNum($result) > 0); |
||
28 | } |
||
29 | |||
30 | function FieldExists($fieldname, $table) |
||
31 | { |
||
32 | global $xoopsDB; |
||
33 | $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
||
34 | |||
35 | return ($xoopsDB->getRowsNum($result) > 0); |
||
36 | } |
||
37 | |||
38 | function AddField($field, $table) |
||
39 | { |
||
40 | global $xoopsDB; |
||
41 | $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field;"); |
||
42 | |||
43 | return $result; |
||
44 | } |
||
45 | |||
46 | if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { |
||
47 | $errors = 0; |
||
48 | $warning = 0; |
||
49 | // 1) Create, if it does not exists |
||
50 | if (!TableExists($xoopsDB->prefix('stats_refer_blacklist'))) { |
||
51 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_refer_blacklist') . ' ( |
||
52 | `id` INT( 3 ) NOT NULL AUTO_INCREMENT , |
||
53 | `referer` VARCHAR( 255 ) NOT NULL, |
||
54 | PRIMARY KEY (id) |
||
55 | ) ENGINE=MyISAM'; |
||
56 | |||
57 | if (!$xoopsDB->queryF($sql)) { |
||
58 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED1; |
||
59 | ++$errors; |
||
60 | } |
||
61 | } else { |
||
62 | $sql = 'TRUNCATE TABLE ' . $xoopsDB->prefix('stats_refer_blacklist'); |
||
63 | |||
64 | if (!$xoopsDB->queryF($sql)) { |
||
65 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED10; |
||
66 | ++$errors; |
||
67 | } else { |
||
68 | $sql = 'INSERT INTO ' |
||
69 | . $xoopsDB->prefix('stats_refer_blacklist') |
||
70 | . " VALUES (1, 'a:101:{i:0;s:11:\"bergvall.nu\";i:1;" |
||
71 | . 's:15:"allnetgoods.com";i:2;s:23:"100-online-gambling.com";i:3;s:8:"amkf.com";i:4;s:18:"keytomarketing.com";i:5;s' |
||
72 | . ':18:"dental[A-Za-z0-9]*";i:6;s:9:"paint.com";i:7;s:6:"7h.com";i:8;s:7:"dad.com";i:9;s:8:"ds4a.com";i:10;s' |
||
73 | . ':7:"9cy.com";i:11;s:10:"palajo.com";i:12;s:9:"imals.com";i:13;s:15:"bigsitecity.com";i:14;s:8:"hamj.com";i:15;s' |
||
74 | . ':9:"iemkt.com";i:16;s:11:"sidelog.com";i:17;s:8:"zuvl.com";i:18;s:9:"dfing.com";i:19;s:10:"gasvac.com";i:20;s' |
||
75 | . ':10:"gasvac.net";i:21;s:9:"lojka.com";i:22;s:9:"aubek.com";i:23;s:12:"maclenet.com";i:24;s:15:"gay[A-Za-z0-9]*";i:25;s' |
||
76 | . ':9:"jsvan.com";i:26;s:11:"tellima.com";i:27;s:7:"jixx.de";i:28;s:17:"detox[A-Za-z0-9]*";i:29;s:16' |
||
77 | . ':"drug[A-Za-z0-9]*";i:30;s:15:"buy[A-Za-z0-9]*";i:31;s:15:"ass[A-Za-z0-9]*";i:32;s:7:"move.to";i:33;s:13' |
||
78 | . ':"fullspeed.com";i:34;s:18:"viagra[A-Za-z0-9]*";i:35;s:14:"givemepink.com";i:36;s:17:"sperm[A-Za-z0-9]*";i:37;s:16' |
||
79 | . ':"fuck[A-Za-z0-9]*";i:38;s:11:"shemale.com";i:39;s:16:"cock[A-Za-z0-9]*";i:40;s:7:"jixx.de";i:41;s:16' |
||
80 | . ':"plugherholes.com";i:42;s:18:"hentai[A-Za-z0-9]*";i:43;s:9:"pagina.de";i:44;s:19:"shemale[A-Za-z0-9]*";i:45;s:17' |
||
81 | . ':"bitch[A-Za-z0-9]*";i:46;s:19:"bondage[A-Za-z0-9]*";i:47;s:19:"blowjob[A-Za-z0-9]*";i:48;s:17:"semen[A-Za-z0-9]*";i:49;s:15' |
||
82 | . ':"cum[A-Za-z0-9]*";i:50;s:19:"bondage[A-Za-z0-9]*";i:51;s:7:"3333.ws";i:52;s:15:"ebony-white.com";i:53;s:19' |
||
83 | . ':"thebest[A-Za-z0-9]*";i:54;s:17:"nice-[A-Za-z0-9]*";i:55;s:15:"ime[A-Za-z0-9]*";i:56;s:14:"bjsandwich.com";i:57;s' |
||
84 | . ':16:"bdsm[A-Za-z0-9]*";i:58;s:17:"gooey[A-Za-z0-9]*";i:59;s:11:"21ebony.com";i:60;s:6:"olo.cc";i:61;s:18' |
||
85 | . ':"18inch[A-Za-z0-9]*";i:62;s:23:"allinternal[A-Za-z0-9]*";i:63;s:25:"furniturefind[A-Za-z0-9]*";i:64;s:17' |
||
86 | . ':"poker[A-Za-z0-9]*";i:65;s:7:"2rx.biz";i:66;s:7:"0me.com";i:67;s:15:"ads[A-Za-z0-9]*";i:68;s:16:"diet[A-Za-z0-9]*";i' |
||
87 | . ':69;s:20:"ringtone[A-Za-z0-9]*";i:70;s:8:"a1a1.com";i:71;s:8:"b1b1.com";i:72;s:16:"shit[A-Za-z0-9]*";i:73;s:15' |
||
88 | . ':"sex[A-Za-z0-9]*";i:74;s:16:"porn[A-Za-z0-9]*";i:75;s:18:"ambien[A-Za-z0-9]*";i:76;s:6:"get.to";i:77;s:17' |
||
89 | . ':"xanax[A-Za-z0-9]*";i:78;s:19:"vicodin[A-Za-z0-9]*";i:79;s:22:"alprazolam[A-Za-z0-9]*";i:80;s:5:"go.to";i:81;s:15' |
||
90 | . ':"circleofsex.net";i:82;s:20:"fioricet[A-Za-z0-9]*";i:83;s:23:"phentermine[A-Za-z0-9]*";i:84;s:7:"come.to";i:85;s' |
||
91 | . ':7:"drop.to";i:86;s:9:"mysite.de";i:87;s:23:"hydrocodone[A-Za-z0-9]*";i:88;s:6:"hey.to";i:89;s:18' |
||
92 | . ':"cialis[A-Za-z0-9]*";i:90;s:23:"bikinibabes[A-Za-z0-9]*";i:91;s:19:"wrongsideoftown.com";i:92;s:8:"babes.tv";i:93' |
||
93 | . ';s:6:"v3.com";i:94;s:16:"myphotoalbum.com";i:95;s:12:"hotgames.com";i:96;s:14:"myblogsite.com";i:97;s:15' |
||
94 | . ":\"fortunecity.com\";i:98;s:14:\"dreambabes.com\";i:99;s:6:\"lol.to\";i:100;s:8:\"blogs.it\";}')"; |
||
95 | |||
96 | if (!$xoopsDB->queryF($sql)) { |
||
97 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED11; |
||
98 | ++$errors; |
||
99 | } |
||
100 | } |
||
101 | } |
||
102 | |||
103 | if (!TableExists($xoopsDB->prefix('stats_userscreen'))) { |
||
104 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_userscreen') . ' ( |
||
105 | `id` INT( 1 ) NOT NULL, |
||
106 | `hits` INT( 5 ) NOT NULL, |
||
107 | PRIMARY KEY (id) |
||
108 | ) ENGINE=MyISAM'; |
||
109 | |||
110 | if (!$xoopsDB->queryF($sql)) { |
||
111 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED3; |
||
112 | ++$errors; |
||
113 | } else { |
||
114 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (1, 0)'); |
||
115 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (2, 0)'); |
||
116 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (3, 0)'); |
||
117 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (4, 0)'); |
||
118 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (5, 0)'); |
||
119 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (6, 0)'); |
||
120 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_userscreen') . ' VALUES (7, 0)'); |
||
121 | } |
||
122 | } |
||
123 | |||
124 | if (!TableExists($xoopsDB->prefix('stats_usercolor'))) { |
||
125 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_usercolor') . ' ( |
||
126 | `id` INT( 1 ) NOT NULL, |
||
127 | `hits` INT( 5 ) NOT NULL, |
||
128 | PRIMARY KEY (id) |
||
129 | ) ENGINE=MyISAM'; |
||
130 | |||
131 | if (!$xoopsDB->queryF($sql)) { |
||
132 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED4; |
||
133 | ++$errors; |
||
134 | } else { |
||
135 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_usercolor') . ' VALUES (1, 0)'); |
||
136 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_usercolor') . ' VALUES (2, 0)'); |
||
137 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_usercolor') . ' VALUES (3, 0)'); |
||
138 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_usercolor') . ' VALUES (4, 0)'); |
||
139 | $xoopsDB->queryF('INSERT INTO ' . $xoopsDB->prefix('stats_usercolor') . ' VALUES (5, 0)'); |
||
140 | } |
||
141 | } |
||
142 | |||
143 | if (!TableExists($xoopsDB->prefix('stats_blockedyear'))) { |
||
144 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_blockedyear') . " ( |
||
145 | `year` SMALLINT(6) NOT NULL DEFAULT '0', |
||
146 | `hits` BIGINT(20) NOT NULL DEFAULT '0' |
||
147 | ) ENGINE=MyISAM"; |
||
148 | |||
149 | if (!$xoopsDB->queryF($sql)) { |
||
150 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED6; |
||
151 | ++$errors; |
||
152 | } |
||
153 | } |
||
154 | |||
155 | if (!TableExists($xoopsDB->prefix('stats_blockedmonth'))) { |
||
156 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_blockedmonth') . " ( |
||
157 | `year` SMALLINT(6) NOT NULL DEFAULT '0', |
||
158 | `month` TINYINT(4) NOT NULL DEFAULT '0', |
||
159 | `hits` BIGINT(20) NOT NULL DEFAULT '0' |
||
160 | ) ENGINE=MyISAM"; |
||
161 | |||
162 | if (!$xoopsDB->queryF($sql)) { |
||
163 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED7; |
||
164 | ++$errors; |
||
165 | } |
||
166 | } |
||
167 | |||
168 | if (!TableExists($xoopsDB->prefix('stats_blockeddate'))) { |
||
169 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_blockeddate') . " ( |
||
170 | `year` SMALLINT(6) NOT NULL DEFAULT '0', |
||
171 | `month` TINYINT(4) NOT NULL DEFAULT '0', |
||
172 | `date` TINYINT(4) NOT NULL DEFAULT '0', |
||
173 | `hits` BIGINT(20) NOT NULL DEFAULT '0' |
||
174 | ) ENGINE=MyISAM"; |
||
175 | |||
176 | if (!$xoopsDB->queryF($sql)) { |
||
177 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED8; |
||
178 | ++$errors; |
||
179 | } |
||
180 | } |
||
181 | |||
182 | if (!TableExists($xoopsDB->prefix('stats_blockedhour'))) { |
||
183 | $sql = 'CREATE TABLE ' . $xoopsDB->prefix('stats_blockedhour') . " ( |
||
184 | `year` SMALLINT(6) NOT NULL DEFAULT '0', |
||
185 | `month` TINYINT(4) NOT NULL DEFAULT '0', |
||
186 | `date` TINYINT(4) NOT NULL DEFAULT '0', |
||
187 | `hour` TINYINT(4) NOT NULL DEFAULT '0', |
||
188 | `hits` INT(11) NOT NULL DEFAULT '0' |
||
189 | ) ENGINE=MyISAM"; |
||
190 | |||
191 | if (!$xoopsDB->queryF($sql)) { |
||
192 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED9; |
||
193 | ++$errors; |
||
194 | } |
||
195 | } |
||
196 | |||
197 | // 2) Change some fields |
||
198 | if (!FieldExists('referpath', $xoopsDB->prefix('stats_refer'))) { |
||
199 | $sql = 'ALTER TABLE ' . $xoopsDB->prefix('stats_refer') . ' ADD `referpath` VARCHAR(150) NOT NULL'; |
||
200 | $result = $xoopsDB->queryF($sql); |
||
201 | if (!$result) { |
||
202 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED2; |
||
203 | ++$warning; |
||
204 | } |
||
205 | } |
||
206 | |||
207 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('counter') . " VALUES ('browser', 'Deepnet', 0)"; |
||
208 | $result = $xoopsDB->queryF($sql); |
||
209 | if (!$result) { |
||
210 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED5; |
||
211 | ++$errors; |
||
212 | } |
||
213 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('counter') . " VALUES ('browser', 'Avant', 0)"; |
||
214 | $result = $xoopsDB->queryF($sql); |
||
215 | if (!$result) { |
||
216 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED5; |
||
217 | ++$errors; |
||
218 | } |
||
219 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('counter') . " VALUES ('totalblocked', 'hits', 0 )"; |
||
220 | $result = $xoopsDB->queryF($sql); |
||
221 | if (!$result) { |
||
222 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED5; |
||
223 | ++$errors; |
||
224 | } |
||
225 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('counter') . " VALUES ('blocked', 'bots', 0)"; |
||
226 | $result = $xoopsDB->queryF($sql); |
||
227 | if (!$result) { |
||
228 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED5; |
||
229 | ++$errors; |
||
230 | } |
||
231 | $sql = 'INSERT INTO ' . $xoopsDB->prefix('counter') . " VALUES ('blocked', 'referers', 0)"; |
||
232 | $result = $xoopsDB->queryF($sql); |
||
233 | if (!$result) { |
||
234 | echo '<br>' . _STATS_UPGRADEFAILED . ' ' . _STATS_UPGRADEFAILED5; |
||
235 | ++$errors; |
||
236 | } |
||
237 | |||
238 | if (!FieldExists('ip', $xoopsDB->prefix('stats_refer'))) { |
||
239 | AddField("'ip' VARCHAR(20) NOT NULL", $xoopsDB->prefix('stats_refer')); |
||
240 | } |
||
241 | |||
242 | // At the end, if there was errors, show them or redirect user to the module's upgrade page |
||
243 | if ($errors) { |
||
244 | echo '<H1>' . _STATS_UPGRADEFAILED . '</H1>'; |
||
245 | echo '<br>' . _STATS_UPGRADEFAILED0; |
||
246 | } elseif ($warning) { |
||
247 | echo '<H1>' . _STATS_UPGRADEFAILEDWWARN . '</H1>'; |
||
248 | echo '<br>' . _STATS_UPGRADECOMPLETEWITHWARN; |
||
249 | } else { |
||
250 | echo _STATS_UPGRADECOMPLETE . " - <a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=update&module=statistics'>" . _AM_NEWS_UPDATEMODULE . '</a>'; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
251 | } |
||
252 | } else { |
||
253 | printf("<H2>%s</H2>\n", _STATS_UPGR_ACCESS_ERROR); |
||
254 | } |
||
255 | xoops_cp_footer(); |
||
256 |