Passed
Pull Request — master (#610)
by Richard
14:27
created
htdocs/modules/protector/language/japanese/admin.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,59 +1,59 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // mymenu
4
-define('_MD_A_MYMENU_MYTPLSADMIN','');
5
-define('_MD_A_MYMENU_MYBLOCKSADMIN','アクセス権限');
6
-define('_MD_A_MYMENU_MYPREFERENCES','一般設定');
4
+define('_MD_A_MYMENU_MYTPLSADMIN', '');
5
+define('_MD_A_MYMENU_MYBLOCKSADMIN', 'アクセス権限');
6
+define('_MD_A_MYMENU_MYPREFERENCES', '一般設定');
7 7
 
8 8
 // index.php
9
-define("_AM_TH_DATETIME","日時");
10
-define("_AM_TH_USER","ユーザ");
11
-define("_AM_TH_IP","IP");
12
-define("_AM_TH_AGENT","AGENT");
13
-define("_AM_TH_TYPE","種別");
14
-define("_AM_TH_DESCRIPTION","詳細");
15
-
16
-define("_AM_TH_BADIPS" , '拒否IPリスト<br /><br /><span style="font-weight:normal;">1行1IPアドレスで記述してください(前方一致)。空欄なら全許可。</span>' ) ;
17
-
18
-define("_AM_TH_GROUP1IPS" , '管理者グループ(1)の許可IP<br /><br /><span style="font-weight:normal;">1行1IPアドレスで記述してください(前方一致)。<br />192.168. とすれば、192.168.*からのみ管理者になれます。空欄なら全許可。</span>' ) ;
19
-
20
-define("_AM_LABEL_COMPACTLOG" , "ログをコンパクト化する" ) ;
21
-define("_AM_BUTTON_COMPACTLOG" , "コンパクト化実行" ) ;
22
-define("_AM_JS_COMPACTLOGCONFIRM" , "IPと種別の重複したレコードを削除します" ) ;
23
-define("_AM_LABEL_REMOVEALL" , "全レコードを削除する:" ) ;
24
-define("_AM_BUTTON_REMOVEALL" , "全削除実行" ) ;
25
-define("_AM_JS_REMOVEALLCONFIRM" , "ログを無条件で削除します。本当によろしいですか?" ) ;
26
-define("_AM_LABEL_REMOVE" , "チェックしたレコードを削除する:" ) ;
27
-define("_AM_BUTTON_REMOVE" , "削除実行" ) ;
28
-define("_AM_JS_REMOVECONFIRM" , "本当に削除してよろしいですか?" ) ;
29
-define("_AM_MSG_IPFILESUPDATED" , "IPリストファイルを書き換えました" ) ;
30
-define("_AM_MSG_BADIPSCANTOPEN" , "拒否IPリストファイルが開けません" ) ;
31
-define("_AM_MSG_GROUP1IPSCANTOPEN" , "管理者用IPリストファイルが開けません" ) ;
32
-define("_AM_MSG_REMOVED" , "削除しました" ) ;
9
+define("_AM_TH_DATETIME", "日時");
10
+define("_AM_TH_USER", "ユーザ");
11
+define("_AM_TH_IP", "IP");
12
+define("_AM_TH_AGENT", "AGENT");
13
+define("_AM_TH_TYPE", "種別");
14
+define("_AM_TH_DESCRIPTION", "詳細");
15
+
16
+define("_AM_TH_BADIPS", '拒否IPリスト<br /><br /><span style="font-weight:normal;">1行1IPアドレスで記述してください(前方一致)。空欄なら全許可。</span>');
17
+
18
+define("_AM_TH_GROUP1IPS", '管理者グループ(1)の許可IP<br /><br /><span style="font-weight:normal;">1行1IPアドレスで記述してください(前方一致)。<br />192.168. とすれば、192.168.*からのみ管理者になれます。空欄なら全許可。</span>');
19
+
20
+define("_AM_LABEL_COMPACTLOG", "ログをコンパクト化する");
21
+define("_AM_BUTTON_COMPACTLOG", "コンパクト化実行");
22
+define("_AM_JS_COMPACTLOGCONFIRM", "IPと種別の重複したレコードを削除します");
23
+define("_AM_LABEL_REMOVEALL", "全レコードを削除する:");
24
+define("_AM_BUTTON_REMOVEALL", "全削除実行");
25
+define("_AM_JS_REMOVEALLCONFIRM", "ログを無条件で削除します。本当によろしいですか?");
26
+define("_AM_LABEL_REMOVE", "チェックしたレコードを削除する:");
27
+define("_AM_BUTTON_REMOVE", "削除実行");
28
+define("_AM_JS_REMOVECONFIRM", "本当に削除してよろしいですか?");
29
+define("_AM_MSG_IPFILESUPDATED", "IPリストファイルを書き換えました");
30
+define("_AM_MSG_BADIPSCANTOPEN", "拒否IPリストファイルが開けません");
31
+define("_AM_MSG_GROUP1IPSCANTOPEN", "管理者用IPリストファイルが開けません");
32
+define("_AM_MSG_REMOVED", "削除しました");
33 33
 //define("_AM_FMT_CONFIGSNOTWRITABLE" , "configsディレクトリが書込許可されていません: %s" ) ;
34 34
 
35 35
 
36 36
 // prefix_manager.php
37
-define("_AM_H3_PREFIXMAN" , "PREFIX マネージャ" ) ;
38
-define("_AM_MSG_DBUPDATED" , "データベースが更新されました" ) ;
39
-define("_AM_CONFIRM_DELETE" , "全テーブルが削除されますがよろしいですか?" ) ;
40
-define("_AM_TXT_HOWTOCHANGEDB" , "prefixを変更する場合は、%s/mainfile.php 内の以下の部分を書き換えてください<br /><br />define('XOOPS_DB_PREFIX','<b>%s</b>');" ) ;
37
+define("_AM_H3_PREFIXMAN", "PREFIX マネージャ");
38
+define("_AM_MSG_DBUPDATED", "データベースが更新されました");
39
+define("_AM_CONFIRM_DELETE", "全テーブルが削除されますがよろしいですか?");
40
+define("_AM_TXT_HOWTOCHANGEDB", "prefixを変更する場合は、%s/mainfile.php 内の以下の部分を書き換えてください<br /><br />define('XOOPS_DB_PREFIX','<b>%s</b>');");
41 41
 
42 42
 
43 43
 // advisory.php
44
-define("_AM_ADV_NOTSECURE","非推奨");
45
-
46
-define("_AM_ADV_TRUSTPATHPUBLIC","上にNGという画像が表示されていたり、リンク先でエラーが出ないようならXOOPS_TRUST_PATHの設置方法に問題があります。XOOPS_TRUST_PATHはDocumentRoot外に設置するのが基本ですが、そうできない場合でもXOOPS_TRUST_PATH直下にDENY FROM ALLの一行を持つ.htaccessを追加するなどして、XOOPS_TRUST_PATH内に直接アクセスできないようにする必要があります。");
47
-define("_AM_ADV_TRUSTPATHPUBLICLINK","TRUST_PATH内のPHPファイルに直アクセスできないことの確認(リンク先が404,403,500エラーなら正常)");
48
-define("_AM_ADV_REGISTERGLOBALS","この設定は、様々な変数汚染攻撃を招きます<br />もし、.htaccessを置けるサーバであれば、XOOPSインストールディレクトリの.htaccessを作るか編集するかして下さい");
49
-define("_AM_ADV_ALLOWURLFOPEN","この設定だと、外部の任意のスクリプトを実行される危険性があります<br />この設定変更にはサーバの管理者権限が必要です<br />ご自身で管理しているサーバであれば、php.iniやhttpd.confを編集して下さい<br />そうでない場合は、サーバ管理者にお願いしてみて下さい");
50
-define("_AM_ADV_USETRANSSID","セッションIDが自動的にリンクに表示される設定となっています。<br />セッションハイジャックを防ぐためにも、XOOPSインストールディレクトリに.htaccessを作るか編集するかして下さい<br /><b>php_flag session.use_trans_sid off</b>");
51
-define("_AM_ADV_DBPREFIX","DB接頭辞がデフォルトのxoopsのままなので、SQL Injectionに弱い状態です<br />「孤立コメントの無害化」など、SQL Injection対策の設定をONにすることをお忘れなく");
52
-define("_AM_ADV_LINK_TO_PREFIXMAN","PREFIXマネージャへ");
53
-define("_AM_ADV_MAINUNPATCHED","READMEに記述された通りに、mainfile.php にパッチを当てて下さい");
54
-define("_AM_ADV_DBFACTORYPATCHED","データベースファクトリは対応済みです");
55
-define("_AM_ADV_DBFACTORYUNPATCHED","データベースファクトリクラスへのパッチが当たっていないのでDBレイヤートラップanti-SQL-Injectionは効きません");
56
-
57
-define("_AM_ADV_SUBTITLECHECK","Protectorの動作チェック");
58
-define("_AM_ADV_CHECKCONTAMI","変数汚染");
59
-define("_AM_ADV_CHECKISOCOM","孤立コメント");
44
+define("_AM_ADV_NOTSECURE", "非推奨");
45
+
46
+define("_AM_ADV_TRUSTPATHPUBLIC", "上にNGという画像が表示されていたり、リンク先でエラーが出ないようならXOOPS_TRUST_PATHの設置方法に問題があります。XOOPS_TRUST_PATHはDocumentRoot外に設置するのが基本ですが、そうできない場合でもXOOPS_TRUST_PATH直下にDENY FROM ALLの一行を持つ.htaccessを追加するなどして、XOOPS_TRUST_PATH内に直接アクセスできないようにする必要があります。");
47
+define("_AM_ADV_TRUSTPATHPUBLICLINK", "TRUST_PATH内のPHPファイルに直アクセスできないことの確認(リンク先が404,403,500エラーなら正常)");
48
+define("_AM_ADV_REGISTERGLOBALS", "この設定は、様々な変数汚染攻撃を招きます<br />もし、.htaccessを置けるサーバであれば、XOOPSインストールディレクトリの.htaccessを作るか編集するかして下さい");
49
+define("_AM_ADV_ALLOWURLFOPEN", "この設定だと、外部の任意のスクリプトを実行される危険性があります<br />この設定変更にはサーバの管理者権限が必要です<br />ご自身で管理しているサーバであれば、php.iniやhttpd.confを編集して下さい<br />そうでない場合は、サーバ管理者にお願いしてみて下さい");
50
+define("_AM_ADV_USETRANSSID", "セッションIDが自動的にリンクに表示される設定となっています。<br />セッションハイジャックを防ぐためにも、XOOPSインストールディレクトリに.htaccessを作るか編集するかして下さい<br /><b>php_flag session.use_trans_sid off</b>");
51
+define("_AM_ADV_DBPREFIX", "DB接頭辞がデフォルトのxoopsのままなので、SQL Injectionに弱い状態です<br />「孤立コメントの無害化」など、SQL Injection対策の設定をONにすることをお忘れなく");
52
+define("_AM_ADV_LINK_TO_PREFIXMAN", "PREFIXマネージャへ");
53
+define("_AM_ADV_MAINUNPATCHED", "READMEに記述された通りに、mainfile.php にパッチを当てて下さい");
54
+define("_AM_ADV_DBFACTORYPATCHED", "データベースファクトリは対応済みです");
55
+define("_AM_ADV_DBFACTORYUNPATCHED", "データベースファクトリクラスへのパッチが当たっていないのでDBレイヤートラップanti-SQL-Injectionは効きません");
56
+
57
+define("_AM_ADV_SUBTITLECHECK", "Protectorの動作チェック");
58
+define("_AM_ADV_CHECKCONTAMI", "変数汚染");
59
+define("_AM_ADV_CHECKISOCOM", "孤立コメント");
Please login to merge, or discard this patch.
htdocs/modules/protector/class/gtickets.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
             // language file
40 40
             if ($language && !strstr($language, '/')) {
41
-                if (XoopsLoad::fileExists(dirname(__DIR__) . '/language/' . $language . '/gticket_messages.phtml')) {
42
-                    include dirname(__DIR__) . '/language/' . $language . '/gticket_messages.phtml';
41
+                if (XoopsLoad::fileExists(dirname(__DIR__).'/language/'.$language.'/gticket_messages.phtml')) {
42
+                    include dirname(__DIR__).'/language/'.$language.'/gticket_messages.phtml';
43 43
                 }
44 44
             }
45 45
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // render form as plain html
59 59
         function getTicketHtml($salt = '', $timeout = 1800, $area = '')
60 60
         {
61
-            return '<input type="hidden" name="XOOPS_G_TICKET" value="' . $this->issue($salt, $timeout, $area) . '" />';
61
+            return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />';
62 62
         }
63 63
 
64 64
         // returns an object of XoopsFormHidden including the ticket
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         // return GET parameter string.
83 83
         function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '')
84 84
         {
85
-            return ($noamp ? '' : '&amp;') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area);
85
+            return ($noamp ? '' : '&amp;').'XOOPS_G_TICKET='.$this->issue($salt, $timeout, $area);
86 86
         }
87 87
 
88 88
         // issue a ticket
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             // create a token
94 94
             list($usec, $sec) = explode(" ", microtime());
95 95
             $appendix_salt = empty($_SERVER['PATH']) ? \XoopsBaseConfig::get('db-name') : $_SERVER['PATH'];
96
-            $token = crypt($salt . $usec . $appendix_salt . $sec);
96
+            $token = crypt($salt.$usec.$appendix_salt.$sec);
97 97
             $this->_latest_token = $token;
98 98
 
99 99
             if (empty($_SESSION['XOOPS_G_STUBS'])) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             );
120 120
 
121 121
             // paid md5ed token as a ticket
122
-            return md5($token . \XoopsBaseConfig::get('db-prefix'));
122
+            return md5($token.\XoopsBaseConfig::get('db-prefix'));
123 123
         }
124 124
 
125 125
         // check a ticket
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
             foreach ($stubs_tmp as $stub) {
149 149
                 // default lifetime 30min
150 150
                 if ($stub['expire'] >= time()) {
151
-                    if (md5($stub['token'] . \XoopsBaseConfig::get('db-prefix')) === $ticket) {
151
+                    if (md5($stub['token'].\XoopsBaseConfig::get('db-prefix')) === $ticket) {
152 152
                         $found_stub = $stub;
153 153
                     } else {
154 154
                         // store the other valid stubs into session
155 155
                         $_SESSION['XOOPS_G_STUBS'][] = $stub;
156 156
                     }
157 157
                 } else {
158
-                    if (md5($stub['token'] . \XoopsBaseConfig::get('db-prefix')) === $ticket) {
158
+                    if (md5($stub['token'].\XoopsBaseConfig::get('db-prefix')) === $ticket) {
159 159
                         // not CSRF but Time-Out
160 160
                         $timeout_flag = true;
161 161
                     }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             }
225 225
 
226 226
             $table = '<table>';
227
-            $form = '<form action="?' . htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES) . '" method="post" >';
227
+            $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >';
228 228
             foreach ($_POST as $key => $val) {
229 229
                 if ($key === 'XOOPS_G_TICKET') {
230 230
                     continue;
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
                     if (get_magic_quotes_gpc()) {
241 241
                         $val = stripslashes($val);
242 242
                     }
243
-                    $table .= '<tr><th>' . htmlspecialchars($key, ENT_QUOTES) . '</th><td>' . htmlspecialchars($val, ENT_QUOTES) . '</td></tr>' . "\n";
244
-                    $form .= '<input type="hidden" name="' . htmlspecialchars($key, ENT_QUOTES) . '" value="' . htmlspecialchars($val, ENT_QUOTES) . '" />' . "\n";
243
+                    $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n";
244
+                    $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n";
245 245
                 }
246 246
             }
247 247
             $table .= '</table>';
248
-            $form .= $this->getTicketHtml(__LINE__, 300, $area) . '<input type="submit" value="' . $this->messages['btn_repost'] . '" /></form>';
248
+            $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>';
249 249
 
250
-            echo '<html><head><title>' . $this->messages['err_general'] . '</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>' . sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()) . $table . $form . '</body></html>';
250
+            echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>'.sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()).$table.$form.'</body></html>';
251 251
         }
252 252
 
253 253
         /**
@@ -262,15 +262,15 @@  discard block
 block discarded – undo
262 262
                     $key = stripslashes($key);
263 263
                 }
264 264
                 if (is_array($val)) {
265
-                    list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name . '[' . htmlspecialchars($key, ENT_QUOTES) . ']', $val);
265
+                    list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val);
266 266
                     $table .= $tmp_table;
267 267
                     $form .= $tmp_form;
268 268
                 } else {
269 269
                     if (get_magic_quotes_gpc()) {
270 270
                         $val = stripslashes($val);
271 271
                     }
272
-                    $table .= '<tr><th>' . $key_name . '[' . htmlspecialchars($key, ENT_QUOTES) . ']</th><td>' . htmlspecialchars($val, ENT_QUOTES) . '</td></tr>' . "\n";
273
-                    $form .= '<input type="hidden" name="' . $key_name . '[' . htmlspecialchars($key, ENT_QUOTES) . ']" value="' . htmlspecialchars($val, ENT_QUOTES) . '" />' . "\n";
272
+                    $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n";
273
+                    $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n";
274 274
                 }
275 275
             }
276 276
             return array($table, $form);
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 
312 312
         function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine)
313 313
         {
314
-            if (preg_match('?' . preg_quote(\XoopsBaseConfig::get('root-path')) . '([^:]+)\:(\d+)?', $errStr, $regs)) {
315
-                echo "Irregular output! check the file " . htmlspecialchars($regs[1]) . " line " . htmlspecialchars($regs[2]);
314
+            if (preg_match('?'.preg_quote(\XoopsBaseConfig::get('root-path')).'([^:]+)\:(\d+)?', $errStr, $regs)) {
315
+                echo "Irregular output! check the file ".htmlspecialchars($regs[1])." line ".htmlspecialchars($regs[2]);
316 316
             } else {
317 317
                 echo "Irregular output! check language files etc.";
318 318
             }
Please login to merge, or discard this patch.
htdocs/modules/protector/class/protector.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                     $this->_safe_contami = false;
139 139
                     $this->last_error_type = 'CONTAMI';
140 140
                 }
141
-                $this->_initial_recursive($subval, $key . '_' . base64_encode($subkey));
141
+                $this->_initial_recursive($subval, $key.'_'.base64_encode($subkey));
142 142
             }
143 143
         } else {
144 144
             // check nullbyte attack
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             return false;
173 173
         }
174 174
 
175
-        $result = @mysqli_query("SELECT conf_name,conf_value FROM " . \XoopsBaseConfig::get('db-prefix') . "_config WHERE conf_title like '" . "_MI_PROTECTOR%'", $this->_conn);
175
+        $result = @mysqli_query("SELECT conf_name,conf_value FROM ".\XoopsBaseConfig::get('db-prefix')."_config WHERE conf_title like '"."_MI_PROTECTOR%'", $this->_conn);
176 176
         if (!$result || mysql_num_rows($result) < 5) {
177 177
             return false;
178 178
         }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         }
232 232
 
233 233
         if ($redirect_to_top) {
234
-            header('Location: ' . \XoopsBaseConfig::get('url') . '/');
234
+            header('Location: '.\XoopsBaseConfig::get('url').'/');
235 235
             exit;
236 236
         } else {
237 237
             $ret = $this->call_filter('prepurge_exit');
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $agent = @$_SERVER['HTTP_USER_AGENT'];
266 266
 
267 267
         if ($unique_check) {
268
-            $result = mysqli_query('SELECT ip,type FROM ' . \XoopsBaseConfig::get('db-prefix') . '_' . $this->mydirname . '_log ORDER BY timestamp DESC LIMIT 1', $this->_conn);
268
+            $result = mysqli_query('SELECT ip,type FROM '.\XoopsBaseConfig::get('db-prefix').'_'.$this->mydirname.'_log ORDER BY timestamp DESC LIMIT 1', $this->_conn);
269 269
             list($last_ip, $last_type) = mysql_fetch_row($result);
270 270
             if ($last_ip == $ip && $last_type == $type) {
271 271
                 $this->_logged = true;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             }
274 274
         }
275 275
 
276
-        mysqli_query("INSERT INTO " . XOOPS_DB_PREFIX . "_" . $this->mydirname . "_log SET ip='" . addslashes($ip) . "',agent='" . addslashes($agent) . "',type='" . addslashes($type) . "',description='" . addslashes($this->message) . "',uid='" . (int)($uid) . "',timestamp=NOW()", $this->_conn);
276
+        mysqli_query("INSERT INTO ".XOOPS_DB_PREFIX."_".$this->mydirname."_log SET ip='".addslashes($ip)."',agent='".addslashes($agent)."',type='".addslashes($type)."',description='".addslashes($this->message)."',uid='".(int)($uid)."',timestamp=NOW()", $this->_conn);
277 277
         $this->_logged = true;
278 278
         return true;
279 279
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $fp = @fopen($this->get_filepath4bwlimit(), 'w');
289 289
         if ($fp) {
290 290
             @flock($fp, LOCK_EX);
291
-            fwrite($fp, $expire . "\n");
291
+            fwrite($fp, $expire."\n");
292 292
             @flock($fp, LOCK_UN);
293 293
             fclose($fp);
294 294
             return true;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
     function get_filepath4bwlimit()
309 309
     {
310
-        return \XoopsBaseConfig::get('trust-path') . '/modules/protector/configs/bwlimit' . substr(md5(\XoopsBaseConfig::get('root-path') . \XoopsBaseConfig::get('db-user') . \XoopsBaseConfig::get('db-prefix')), 0, 6);
310
+        return \XoopsBaseConfig::get('trust-path').'/modules/protector/configs/bwlimit'.substr(md5(\XoopsBaseConfig::get('root-path').\XoopsBaseConfig::get('db-user').\XoopsBaseConfig::get('db-prefix')), 0, 6);
311 311
     }
312 312
 
313 313
     function write_file_badips($bad_ips)
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         $fp = @fopen($this->get_filepath4badips(), 'w');
318 318
         if ($fp) {
319 319
             @flock($fp, LOCK_EX);
320
-            fwrite($fp, serialize($bad_ips) . "\n");
320
+            fwrite($fp, serialize($bad_ips)."\n");
321 321
             @flock($fp, LOCK_UN);
322 322
             fclose($fp);
323 323
             return true;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
     function get_filepath4badips()
370 370
     {
371
-        return \XoopsBaseConfig::get('root-path') . '/modules/protector/configs/badips' . substr(md5(\XoopsBaseConfig::get('root-path') . \XoopsBaseConfig::get('db-user') . \XoopsBaseConfig::get('db-prefix')), 0, 6);
371
+        return \XoopsBaseConfig::get('root-path').'/modules/protector/configs/badips'.substr(md5(\XoopsBaseConfig::get('root-path').\XoopsBaseConfig::get('db-user').\XoopsBaseConfig::get('db-prefix')), 0, 6);
372 372
     }
373 373
 
374 374
     function get_group1_ips($with_info = false)
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
 
389 389
     function get_filepath4group1ips()
390 390
     {
391
-        return \XoopsBaseConfig::get('var-path') . '/configs/protector_group1ips_' . substr(md5(\XoopsBaseConfig::get('root-path') . \XoopsBaseConfig::get('db-user') . \XoopsBaseConfig::get('db-prefix')), 0, 6);
391
+        return \XoopsBaseConfig::get('var-path').'/configs/protector_group1ips_'.substr(md5(\XoopsBaseConfig::get('root-path').\XoopsBaseConfig::get('db-user').\XoopsBaseConfig::get('db-prefix')), 0, 6);
392 392
     }
393 393
 
394 394
     function get_filepath4confighcache()
395 395
     {
396
-        return XOOPS_VAR_PATH . '/configs/protector_configcache_' . substr(md5(XOOPS_ROOT_PATH . XOOPS_DB_USER . XOOPS_DB_PREFIX), 0, 6);
396
+        return XOOPS_VAR_PATH.'/configs/protector_configcache_'.substr(md5(XOOPS_ROOT_PATH.XOOPS_DB_USER.XOOPS_DB_PREFIX), 0, 6);
397 397
     }
398 398
 
399 399
     function ip_match($ips)
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
             return false;
451 451
         }
452 452
 
453
-        $target_htaccess = \XoopsBaseConfig::get('root-path') . '/.htaccess';
454
-        $backup_htaccess = \XoopsBaseConfig::get('root-path') . '/uploads/.htaccess.bak';
453
+        $target_htaccess = \XoopsBaseConfig::get('root-path').'/.htaccess';
454
+        $backup_htaccess = \XoopsBaseConfig::get('root-path').'/uploads/.htaccess.bak';
455 455
 
456 456
         $ht_body = file_get_contents($target_htaccess);
457 457
 
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
             if (substr($regs[2], -strlen($ip)) == $ip) {
477 477
                 return true;
478 478
             }
479
-            $new_ht_body = $regs[1] . "#PROTECTOR#\n" . $regs[2] . " $ip\n#PROTECTOR#\n" . $regs[3];
479
+            $new_ht_body = $regs[1]."#PROTECTOR#\n".$regs[2]." $ip\n#PROTECTOR#\n".$regs[3];
480 480
         } else {
481
-            $new_ht_body = "#PROTECTOR#\nDENY FROM $ip\n#PROTECTOR#\n" . $ht_body;
481
+            $new_ht_body = "#PROTECTOR#\nDENY FROM $ip\n#PROTECTOR#\n".$ht_body;
482 482
         }
483 483
 
484 484
         // error_log( "$new_ht_body\n" , 3 , "/tmp/error_log" ) ;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 
533 533
         if (!empty($this->_dblayertrap_doubtfuls) || $force_override) {
534 534
             @define('XOOPS_DB_ALTERNATIVE', 'ProtectorMysqlDatabase');
535
-            require_once dirname(__DIR__) . '/class/ProtectorMysqlDatabase.class.php';
535
+            require_once dirname(__DIR__).'/class/ProtectorMysqlDatabase.class.php';
536 536
         }
537 537
     }
538 538
 
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
             if (!is_array($current)) {
695 695
                 return false;
696 696
             }
697
-            $current =& $current[$index];
697
+            $current = & $current[$index];
698 698
         }
699 699
         return $current;
700 700
     }
@@ -709,16 +709,16 @@  discard block
 block discarded – undo
709 709
 
710 710
         switch ($base_array) {
711 711
             case 'G' :
712
-                $main_ref =& $this->get_ref_from_base64index($_GET, $indexes);
713
-                $legacy_ref =& $this->get_ref_from_base64index($HTTP_GET_VARS, $indexes);
712
+                $main_ref = & $this->get_ref_from_base64index($_GET, $indexes);
713
+                $legacy_ref = & $this->get_ref_from_base64index($HTTP_GET_VARS, $indexes);
714 714
                 break;
715 715
             case 'P' :
716
-                $main_ref =& $this->get_ref_from_base64index($_POST, $indexes);
717
-                $legacy_ref =& $this->get_ref_from_base64index($HTTP_POST_VARS, $indexes);
716
+                $main_ref = & $this->get_ref_from_base64index($_POST, $indexes);
717
+                $legacy_ref = & $this->get_ref_from_base64index($HTTP_POST_VARS, $indexes);
718 718
                 break;
719 719
             case 'C' :
720
-                $main_ref =& $this->get_ref_from_base64index($_COOKIE, $indexes);
721
-                $legacy_ref =& $this->get_ref_from_base64index($HTTP_COOKIE_VARS, $indexes);
720
+                $main_ref = & $this->get_ref_from_base64index($_COOKIE, $indexes);
721
+                $legacy_ref = & $this->get_ref_from_base64index($HTTP_COOKIE_VARS, $indexes);
722 722
                 break;
723 723
             default :
724 724
                 exit;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
         if (!isset($main_ref)) {
727 727
             exit;
728 728
         }
729
-        $request_ref =& $this->get_ref_from_base64index($_REQUEST, $indexes);
729
+        $request_ref = & $this->get_ref_from_base64index($_REQUEST, $indexes);
730 730
         if ($request_ref !== false && $main_ref == $request_ref) {
731 731
             $request_ref = $val;
732 732
         }
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
                     $image_attributes = @getimagesize($_file['tmp_name']);
784 784
                     if ($image_attributes === false && is_uploaded_file($_file['tmp_name'])) {
785 785
                         // open_basedir restriction
786
-                        $temp_file = \XoopsBaseConfig::get('root-path') . '/uploads/protector_upload_temporary' . md5(time());
786
+                        $temp_file = \XoopsBaseConfig::get('root-path').'/uploads/protector_upload_temporary'.md5(time());
787 787
                         move_uploaded_file($_file['tmp_name'], $temp_file);
788 788
                         $image_attributes = @getimagesize($temp_file);
789 789
                         @unlink($temp_file);
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
                 if ($str === false) {
833 833
                     $this->message .= "Isolated comment-in found. ($val)\n";
834 834
                     if ($sanitize) {
835
-                        $this->replace_doubtful($key, $val . '*/');
835
+                        $this->replace_doubtful($key, $val.'*/');
836 836
                     }
837 837
                     $this->_safe_isocom = false;
838 838
                     $this->last_error_type = 'ISOCOM';
@@ -875,10 +875,10 @@  discard block
 block discarded – undo
875 875
             return false;
876 876
         }
877 877
 
878
-        $query = "f=serial&ip=" . $_SERVER['REMOTE_ADDR'];
879
-        $query .= isset($_POST['email']) ? "&email=" . $_POST['email'] : '';
880
-        $query .= isset($_POST['uname']) ? "&username=" . $_POST['uname'] : '';
881
-        $url = "http://www.stopforumspam.com/api?" . $query;
878
+        $query = "f=serial&ip=".$_SERVER['REMOTE_ADDR'];
879
+        $query .= isset($_POST['email']) ? "&email=".$_POST['email'] : '';
880
+        $query .= isset($_POST['uname']) ? "&username=".$_POST['uname'] : '';
881
+        $url = "http://www.stopforumspam.com/api?".$query;
882 882
         $ch = curl_init();
883 883
         curl_setopt($ch, CURLOPT_URL, $url);
884 884
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -912,16 +912,16 @@  discard block
 block discarded – undo
912 912
                 break;
913 913
             case 'san' :
914 914
                 $_POST = array();
915
-                $this->message .= "POST deleted for IP:" . $_SERVER['REMOTE_ADDR'];
915
+                $this->message .= "POST deleted for IP:".$_SERVER['REMOTE_ADDR'];
916 916
                 break;
917 917
             case 'biptime0' :
918 918
                 $_POST = array();
919
-                $this->message .= "BAN and POST deleted for IP:" . $_SERVER['REMOTE_ADDR'];
919
+                $this->message .= "BAN and POST deleted for IP:".$_SERVER['REMOTE_ADDR'];
920 920
                 $this->_should_be_banned_time0 = true;
921 921
                 break;
922 922
             case 'bip' :
923 923
                 $_POST = array();
924
-                $this->message .= "Ban and POST deleted for IP:" . $_SERVER['REMOTE_ADDR'];
924
+                $this->message .= "Ban and POST deleted for IP:".$_SERVER['REMOTE_ADDR'];
925 925
                 $this->_should_be_banned = true;
926 926
                 break;
927 927
         }
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
         }
952 952
 
953 953
         // gargage collection
954
-        $result = $db->queryF("DELETE FROM " . $db->prefix($this->mydirname . "_access") . " WHERE expire < UNIX_TIMESTAMP()");
954
+        $result = $db->queryF("DELETE FROM ".$db->prefix($this->mydirname."_access")." WHERE expire < UNIX_TIMESTAMP()");
955 955
 
956 956
         // for older versions before updating this module
957 957
         if ($result === false) {
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
         }
961 961
 
962 962
         // sql for recording access log (INSERT should be placed after SELECT)
963
-        $sql4insertlog = "INSERT INTO " . $db->prefix($this->mydirname . "_access") . " SET ip='$ip4sql',request_uri='$uri4sql',expire=UNIX_TIMESTAMP()+'" . (int)($this->_conf['dos_expire']) . "'";
963
+        $sql4insertlog = "INSERT INTO ".$db->prefix($this->mydirname."_access")." SET ip='$ip4sql',request_uri='$uri4sql',expire=UNIX_TIMESTAMP()+'".(int)($this->_conf['dos_expire'])."'";
964 964
 
965 965
         // bandwidth limitation
966 966
         if (@$this->_conf['bwlimit_count'] >= 10) {
967
-            $result = $db->query("SELECT COUNT(*) FROM " . $db->prefix($this->mydirname . "_access"));
967
+            $result = $db->query("SELECT COUNT(*) FROM ".$db->prefix($this->mydirname."_access"));
968 968
             list($bw_count) = $db->fetchRow($result);
969 969
             if ($bw_count > $this->_conf['bwlimit_count']) {
970 970
                 $this->write_file_bwlimit(time() + $this->_conf['dos_expire']);
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
         }
973 973
 
974 974
         // F5 attack check (High load & same URI)
975
-        $result = $db->query("SELECT COUNT(*) FROM " . $db->prefix($this->mydirname . "_access") . " WHERE ip='$ip4sql' AND request_uri='$uri4sql'");
975
+        $result = $db->query("SELECT COUNT(*) FROM ".$db->prefix($this->mydirname."_access")." WHERE ip='$ip4sql' AND request_uri='$uri4sql'");
976 976
         list($f5_count) = $db->fetchRow($result);
977 977
         if ($f5_count > $this->_conf['dos_f5count']) {
978 978
 
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         }
1027 1027
 
1028 1028
         // Crawler check (High load & different URI)
1029
-        $result = $db->query("SELECT COUNT(*) FROM " . $db->prefix($this->mydirname . "_access") . " WHERE ip='$ip4sql'");
1029
+        $result = $db->query("SELECT COUNT(*) FROM ".$db->prefix($this->mydirname."_access")." WHERE ip='$ip4sql'");
1030 1030
         list($crawler_count) = $db->fetchRow($result);
1031 1031
 
1032 1032
         // delayed insert
@@ -1095,18 +1095,18 @@  discard block
 block discarded – undo
1095 1095
         $mal4sql = addslashes("BRUTE FORCE: $victim_uname");
1096 1096
 
1097 1097
         // gargage collection
1098
-        $result = $xoopsDB->queryF("DELETE FROM " . $xoopsDB->prefix($this->mydirname . "_access") . " WHERE expire < UNIX_TIMESTAMP()");
1098
+        $result = $xoopsDB->queryF("DELETE FROM ".$xoopsDB->prefix($this->mydirname."_access")." WHERE expire < UNIX_TIMESTAMP()");
1099 1099
 
1100 1100
         // sql for recording access log (INSERT should be placed after SELECT)
1101
-        $sql4insertlog = "INSERT INTO " . $xoopsDB->prefix($this->mydirname . "_access") . " SET ip='$ip4sql',request_uri='$uri4sql',malicious_actions='$mal4sql',expire=UNIX_TIMESTAMP()+600";
1101
+        $sql4insertlog = "INSERT INTO ".$xoopsDB->prefix($this->mydirname."_access")." SET ip='$ip4sql',request_uri='$uri4sql',malicious_actions='$mal4sql',expire=UNIX_TIMESTAMP()+600";
1102 1102
 
1103 1103
         // count check
1104
-        $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix($this->mydirname . "_access") . " WHERE ip='$ip4sql' AND malicious_actions like 'BRUTE FORCE:%'");
1104
+        $result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix($this->mydirname."_access")." WHERE ip='$ip4sql' AND malicious_actions like 'BRUTE FORCE:%'");
1105 1105
         list($bf_count) = $xoopsDB->fetchRow($result);
1106 1106
         if ($bf_count > $this->_conf['bf_count']) {
1107 1107
             $this->register_bad_ips(time() + $this->_conf['banip_time0']);
1108 1108
             $this->last_error_type = 'BruteForce';
1109
-            $this->message .= "Trying to login as '" . addslashes($victim_uname) . "' found.\n";
1109
+            $this->message .= "Trying to login as '".addslashes($victim_uname)."' found.\n";
1110 1110
             $this->output_log('BRUTE FORCE', 0, true, 1);
1111 1111
             $ret = $this->call_filter('bruteforce_overrun');
1112 1112
             if ($ret == false) {
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
             }
1141 1141
 
1142 1142
             // count BBCode likd [url=www....] up (without [url=http://...])
1143
-            $this->_spamcount_uri += count(preg_split('/\[url=(?!http|\\"http|\\\'http|' . $http_host . ')/i', $val)) - 1;
1143
+            $this->_spamcount_uri += count(preg_split('/\[url=(?!http|\\"http|\\\'http|'.$http_host.')/i', $val)) - 1;
1144 1144
         }
1145 1145
     }
1146 1146
 
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
         $this->_spam_check_point_recursive($_POST);
1154 1154
 
1155 1155
         if ($this->_spamcount_uri >= $points4deny) {
1156
-            $this->message .= @$_SERVER['REQUEST_URI'] . " SPAM POINT: $this->_spamcount_uri\n";
1156
+            $this->message .= @$_SERVER['REQUEST_URI']." SPAM POINT: $this->_spamcount_uri\n";
1157 1157
             $this->output_log('URI SPAM', $uid, false, 128);
1158 1158
             $ret = $this->call_filter('spamcheck_overrun');
1159 1159
             if ($ret == false) {
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
             // preview CSRF zx 2004/12/14
1229 1229
             // news submit.php
1230
-            if (substr(@$_SERVER['SCRIPT_NAME'], -23) === 'modules/news/submit.php' && isset($_POST['preview']) && strpos(@$_SERVER['HTTP_REFERER'], \XoopsBaseConfig::get('url') . '/modules/news/submit.php') !== 0) {
1230
+            if (substr(@$_SERVER['SCRIPT_NAME'], -23) === 'modules/news/submit.php' && isset($_POST['preview']) && strpos(@$_SERVER['HTTP_REFERER'], \XoopsBaseConfig::get('url').'/modules/news/submit.php') !== 0) {
1231 1231
                 $HTTP_POST_VARS['nohtml'] = $_POST['nohtml'] = 1;
1232 1232
             }
1233 1233
             // news admin/index.php
1234
-            if (substr(@$_SERVER['SCRIPT_NAME'], -28) === 'modules/news/admin/index.php' && ($_POST['op'] === 'preview' || $_GET['op'] === 'preview') && strpos(@$_SERVER['HTTP_REFERER'], \XoopsBaseConfig::get('url') . '/modules/news/admin/index.php') !== 0) {
1234
+            if (substr(@$_SERVER['SCRIPT_NAME'], -28) === 'modules/news/admin/index.php' && ($_POST['op'] === 'preview' || $_GET['op'] === 'preview') && strpos(@$_SERVER['HTTP_REFERER'], \XoopsBaseConfig::get('url').'/modules/news/admin/index.php') !== 0) {
1235 1235
                 $HTTP_POST_VARS['nohtml'] = $_POST['nohtml'] = 1;
1236 1236
             }
1237 1237
             // comment comment_post.php
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
      */
1260 1260
     function call_filter($type, $dying_message = '')
1261 1261
     {
1262
-        require_once __DIR__ . '/ProtectorFilter.php';
1262
+        require_once __DIR__.'/ProtectorFilter.php';
1263 1263
         $filter_handler = ProtectorFilterHandler::getInstance();
1264 1264
         $ret = $filter_handler->execute($type);
1265 1265
         if ($ret == false && $dying_message) {
Please login to merge, or discard this patch.
htdocs/modules/protector/class/ProtectorFilter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
         $xoops = Xoops::getInstance();
32 32
         $language = $xoops->getConfig('language');
33 33
         $this->protector = Protector::getInstance();
34
-        $lang = !$language  ? @$this->protector->_conf['default_lang'] : $language;
35
-        @include_once dirname(__DIR__) . '/language/' . $lang . '/main.php';
34
+        $lang = !$language ? @$this->protector->_conf['default_lang'] : $language;
35
+        @include_once dirname(__DIR__).'/language/'.$lang.'/main.php';
36 36
         if (!defined('_MD_PROTECTOR_YOUAREBADIP')) {
37
-            include_once dirname(__DIR__) . '/language/english/main.php';
37
+            include_once dirname(__DIR__).'/language/english/main.php';
38 38
         }
39 39
     }
40 40
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     function ProtectorFilterHandler()
66 66
     {
67 67
         $this->protector = Protector::getInstance();
68
-        $this->filters_base = dirname(__DIR__) . '/filters_enabled';
68
+        $this->filters_base = dirname(__DIR__).'/filters_enabled';
69 69
     }
70 70
 
71 71
     static function getInstance()
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
         $dh = opendir($this->filters_base);
86 86
         while (($file = readdir($dh)) !== false) {
87
-            if (strncmp($file, $type . '_', strlen($type) + 1) === 0) {
88
-                include_once $this->filters_base . '/' . $file;
89
-                $plugin_name = 'protector_' . substr($file, 0, -4);
87
+            if (strncmp($file, $type.'_', strlen($type) + 1) === 0) {
88
+                include_once $this->filters_base.'/'.$file;
89
+                $plugin_name = 'protector_'.substr($file, 0, -4);
90 90
                 if (function_exists($plugin_name)) {
91 91
                     // old way
92 92
                     $ret |= call_user_func($plugin_name);
Please login to merge, or discard this patch.
htdocs/modules/protector/class/form/center.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@
 block discarded – undo
38 38
         global $xoopsDB;
39 39
         $db = $xoopsDB;
40 40
         $protector = Protector::getInstance($db->conn);
41
-        require_once dirname(__DIR__) . '/gtickets.php';
41
+        require_once dirname(__DIR__).'/gtickets.php';
42 42
 
43 43
         parent::__construct('', "form_prefip", "center.php", 'post', true);
44 44
 
45 45
         $bad_ips = new Xoops\Form\TextArea(_AM_TH_BADIPS, 'bad_ips', $bad_ips4disp, 3, 90);
46
-        $bad_ips->setDescription('<br />' . htmlspecialchars($protector->get_filepath4badips()));
46
+        $bad_ips->setDescription('<br />'.htmlspecialchars($protector->get_filepath4badips()));
47 47
         $bad_ips->setClass('span3');
48 48
         $this->addElement($bad_ips);
49 49
 
50 50
         $group1_ips = new Xoops\Form\TextArea(_AM_TH_GROUP1IPS, 'group1_ips', $group1_ips4disp, 3, 90);
51
-        $group1_ips->setDescription('<br />' . htmlspecialchars($protector->get_filepath4group1ips()));
51
+        $group1_ips->setDescription('<br />'.htmlspecialchars($protector->get_filepath4group1ips()));
52 52
         $group1_ips->setClass('span3');
53 53
         $this->addElement($group1_ips);
54 54
         $formTicket = new xoopsGTicket;
Please login to merge, or discard this patch.
htdocs/modules/protector/class/ProtectorMysqlDatabase.class.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -22,103 +22,103 @@  discard block
 block discarded – undo
22 22
 $root_path = \XoopsBaseConfig::get('root-path');
23 23
 $db_type = \XoopsBaseConfig::get('db-type');
24 24
 
25
-if( XoopsLoad::fileExists( $root_path.'/class/database/drivers/'.$db_type.'/database.php' ) ) {
25
+if (XoopsLoad::fileExists($root_path.'/class/database/drivers/'.$db_type.'/database.php')) {
26 26
     require_once $root_path.'/class/database/drivers/'.$db_type.'/database.php';
27 27
 } else {
28 28
     require_once $root_path.'/class/database/'.$db_type.'database.php';
29 29
 }
30 30
 
31
-require_once $root_path.'/class/database/database.php' ;
31
+require_once $root_path.'/class/database/database.php';
32 32
 
33 33
 class ProtectorMySQLDatabase extends XoopsMySQLDatabaseProxy
34 34
 {
35 35
 
36
-var $doubtful_requests = array() ;
36
+var $doubtful_requests = array();
37 37
 var $doubtful_needles = array(
38 38
     // 'order by' ,
39
-    'concat' ,
40
-    'information_schema' ,
41
-    'select' ,
42
-    'union' ,
43
-    '/*' , /**/
44
-    '--' ,
45
-    '#' ,
46
-) ;
39
+    'concat',
40
+    'information_schema',
41
+    'select',
42
+    'union',
43
+    '/*', /**/
44
+    '--',
45
+    '#',
46
+);
47 47
 
48 48
 
49 49
 function ProtectorMySQLDatabase()
50 50
 {
51
-    $protector = Protector::getInstance() ;
52
-    $this->doubtful_requests = $protector->getDblayertrapDoubtfuls() ;
53
-    $this->doubtful_needles = array_merge( $this->doubtful_needles , $this->doubtful_requests ) ;
51
+    $protector = Protector::getInstance();
52
+    $this->doubtful_requests = $protector->getDblayertrapDoubtfuls();
53
+    $this->doubtful_needles = array_merge($this->doubtful_needles, $this->doubtful_requests);
54 54
 }
55 55
 
56 56
 
57
-function injectionFound( $sql )
57
+function injectionFound($sql)
58 58
 {
59
-    $protector = Protector::getInstance() ;
59
+    $protector = Protector::getInstance();
60 60
 
61
-    $protector->last_error_type = 'SQL Injection' ;
62
-    $protector->message .= $sql ;
63
-    $protector->output_log( $protector->last_error_type ) ;
64
-    die( 'SQL Injection found' ) ;
61
+    $protector->last_error_type = 'SQL Injection';
62
+    $protector->message .= $sql;
63
+    $protector->output_log($protector->last_error_type);
64
+    die('SQL Injection found');
65 65
 }
66 66
 
67 67
 
68
-function separateStringsInSQL( $sql )
68
+function separateStringsInSQL($sql)
69 69
 {
70
-    $sql = trim( $sql ) ;
71
-    $sql_len = strlen( $sql ) ;
72
-    $char = '' ;
73
-    $string_start = '' ;
70
+    $sql = trim($sql);
71
+    $sql_len = strlen($sql);
72
+    $char = '';
73
+    $string_start = '';
74 74
     $in_string = false;
75
-    $sql_wo_string = '' ;
76
-    $strings = array() ;
77
-    $current_string = '' ;
78
-
79
-    for( $i = 0 ; $i < $sql_len ; ++$i ) {
80
-        $char = $sql[$i] ;
81
-        if( $in_string ) {
82
-            while( 1 ) {
83
-                $new_i = strpos( $sql , $string_start , $i ) ;
84
-                $current_string .= substr( $sql , $i , $new_i - $i + 1 ) ;
85
-                $i = $new_i ;
86
-                if( $i === false ) {
87
-                    break 2 ;
88
-                } else if( /* $string_start == '`' || */ $sql[$i-1] !== '\\' ) {
89
-                    $string_start = '' ;
90
-                    $in_string = false ;
91
-                    $strings[] = $current_string ;
92
-                    break ;
75
+    $sql_wo_string = '';
76
+    $strings = array();
77
+    $current_string = '';
78
+
79
+    for ($i = 0; $i < $sql_len; ++$i) {
80
+        $char = $sql[$i];
81
+        if ($in_string) {
82
+            while (1) {
83
+                $new_i = strpos($sql, $string_start, $i);
84
+                $current_string .= substr($sql, $i, $new_i - $i + 1);
85
+                $i = $new_i;
86
+                if ($i === false) {
87
+                    break 2;
88
+                } else if ( /* $string_start == '`' || */ $sql[$i - 1] !== '\\' ) {
89
+                    $string_start = '';
90
+                    $in_string = false;
91
+                    $strings[] = $current_string;
92
+                    break;
93 93
                 } else {
94
-                    $j = 2 ;
95
-                    $escaped_backslash = false ;
96
-                    while( $i - $j > 0 && $sql[$i-$j] === '\\' ) {
97
-                        $escaped_backslash = ! $escaped_backslash ;
94
+                    $j = 2;
95
+                    $escaped_backslash = false;
96
+                    while ($i - $j > 0 && $sql[$i - $j] === '\\') {
97
+                        $escaped_backslash = !$escaped_backslash;
98 98
                         ++$j;
99 99
                     }
100 100
                     if ($escaped_backslash) {
101
-                        $string_start = '' ;
102
-                        $in_string = false ;
103
-                        $strings[] = $current_string ;
104
-                        break ;
101
+                        $string_start = '';
102
+                        $in_string = false;
103
+                        $strings[] = $current_string;
104
+                        break;
105 105
                     } else {
106 106
                         ++$i;
107 107
                     }
108 108
                 }
109 109
             }
110
-        } else if( $char === '"' || $char === "'" ) { // dare to ignore ``
111
-            $in_string = true ;
112
-            $string_start = $char ;
113
-            $current_string = $char ;
110
+        } else if ($char === '"' || $char === "'") { // dare to ignore ``
111
+            $in_string = true;
112
+            $string_start = $char;
113
+            $current_string = $char;
114 114
         } else {
115
-            $sql_wo_string .= $char ;
115
+            $sql_wo_string .= $char;
116 116
         }
117 117
         // dare to ignore comment
118 118
         // because unescaped ' or " have been already checked in stage1
119 119
     }
120 120
 
121
-    return array( $sql_wo_string , $strings ) ;
121
+    return array($sql_wo_string, $strings);
122 122
 }
123 123
 
124 124
 
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 /**
127 127
  * @param string $sql
128 128
  */
129
-function checkSql( $sql )
129
+function checkSql($sql)
130 130
 {
131
-    list( $sql_wo_strings , $strings ) = $this->separateStringsInSQL( $sql ) ;
131
+    list($sql_wo_strings, $strings) = $this->separateStringsInSQL($sql);
132 132
 
133 133
     // stage1: addslashes() processed or not
134
-    foreach( $this->doubtful_requests as $request ) {
135
-        if( addslashes( $request ) != $request ) {
136
-            if( stristr( $sql , trim( $request ) ) ) {
134
+    foreach ($this->doubtful_requests as $request) {
135
+        if (addslashes($request) != $request) {
136
+            if (stristr($sql, trim($request))) {
137 137
                 // check the request stayed inside of strings as whole
138
-                $ok_flag = false ;
139
-                foreach( $strings as $string ) {
140
-                    if( strstr( $string , $request ) ) {
141
-                        $ok_flag = true ;
142
-                        break ;
138
+                $ok_flag = false;
139
+                foreach ($strings as $string) {
140
+                    if (strstr($string, $request)) {
141
+                        $ok_flag = true;
142
+                        break;
143 143
                     }
144 144
                 }
145
-                if( ! $ok_flag ) {
146
-                    $this->injectionFound( $sql ) ;
145
+                if (!$ok_flag) {
146
+                    $this->injectionFound($sql);
147 147
                 }
148 148
             }
149 149
         }
@@ -155,39 +155,39 @@  discard block
 block discarded – undo
155 155
     // OK: select a from b where c='$d_escaped'
156 156
     // $_GET['d'] = '(select ... FROM)'
157 157
     // NG: select a from b where c=(select ... from)
158
-    foreach( $this->doubtful_requests as $request ) {
159
-        if( strstr( $sql_wo_strings , trim( $request ) ) ) {
160
-            $this->injectionFound( $sql ) ;
158
+    foreach ($this->doubtful_requests as $request) {
159
+        if (strstr($sql_wo_strings, trim($request))) {
160
+            $this->injectionFound($sql);
161 161
         }
162 162
     }
163 163
 
164 164
     // stage3: comment exists or not without quoted strings (too sensitive?)
165
-    if( preg_match( '/(\/\*|\-\-|\#)/' , $sql_wo_strings , $regs ) ) {
166
-        foreach( $this->doubtful_requests as $request ) {
167
-            if( strstr( $request , $regs[1] ) ) {
168
-                $this->injectionFound( $sql ) ;
165
+    if (preg_match('/(\/\*|\-\-|\#)/', $sql_wo_strings, $regs)) {
166
+        foreach ($this->doubtful_requests as $request) {
167
+            if (strstr($request, $regs[1])) {
168
+                $this->injectionFound($sql);
169 169
             }
170 170
         }
171 171
     }
172 172
 }
173 173
 
174 174
 
175
-function query( $sql , $limit = 0 , $start = 0 )
175
+function query($sql, $limit = 0, $start = 0)
176 176
 {
177
-    $sql4check = substr( $sql , 7 ) ;
178
-    foreach( $this->doubtful_needles as $needle ) {
179
-        if( stristr( $sql4check , $needle ) ) {
180
-            $this->checkSql( $sql ) ;
181
-            break ;
177
+    $sql4check = substr($sql, 7);
178
+    foreach ($this->doubtful_needles as $needle) {
179
+        if (stristr($sql4check, $needle)) {
180
+            $this->checkSql($sql);
181
+            break;
182 182
         }
183 183
     }
184 184
 
185
-    if( ! defined( 'XOOPS_DB_PROXY' ) ) {
186
-        $ret = parent::queryF( $sql , $limit , $start ) ;
185
+    if (!defined('XOOPS_DB_PROXY')) {
186
+        $ret = parent::queryF($sql, $limit, $start);
187 187
     } else {
188
-        $ret = parent::query( $sql , $limit , $start ) ;
188
+        $ret = parent::query($sql, $limit, $start);
189 189
     }
190
-    return $ret ;
190
+    return $ret;
191 191
 }
192 192
 
193 193
 }
Please login to merge, or discard this patch.
htdocs/modules/menus/admin/admin_menus.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @version         $Id$
21 21
  */
22 22
 
23
-include_once __DIR__ . '/header.php';
23
+include_once __DIR__.'/header.php';
24 24
 
25 25
 $xoops = Xoops::getInstance();
26 26
 $helper = Menus::getInstance();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $xoops->theme()->addStylesheet('modules/system/css/admin.css');
33 33
 
34 34
 // Get $_GET, $_POST, ...
35
-$op =Request::getCmd('op', 'list');
35
+$op = Request::getCmd('op', 'list');
36 36
 $id = Request::getInt('id', 0);
37 37
 $limit = Request::getInt('limit', 15);
38 38
 $start = Request::getInt('start', 0);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $msg[] = _AM_MENUS_SAVE;
67 67
 
68 68
         $id = Request::getInt('id', 0);
69
-        if (isset($id) && $id !=0) {
69
+        if (isset($id) && $id != 0) {
70 70
             $obj = $helper->getHandlerMenus()->get($id);
71 71
         } else {
72 72
             $obj = $helper->getHandlerMenus()->create();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             echo $xoops->confirm(
103 103
                 array('ok' => 1, 'id' => $id, 'op' => 'del'),
104 104
                 $helper->url('admin/admin_menus.php'),
105
-                _AM_MENUS_MSG_SUREDEL . '<br /><strong>' . $obj->getVar('title') . '</strong>'
105
+                _AM_MENUS_MSG_SUREDEL.'<br /><strong>'.$obj->getVar('title').'</strong>'
106 106
             );
107 107
         }
108 108
         break;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
         $criteria = new CriteriaCompo();
123 123
         if ($query != '') {
124
-            $crit = new CriteriaCompo(new Criteria('title', $query . '%', 'LIKE'));
124
+            $crit = new CriteriaCompo(new Criteria('title', $query.'%', 'LIKE'));
125 125
             $criteria->add($crit);
126 126
         }
127 127
 
Please login to merge, or discard this patch.
htdocs/modules/menus/admin/admin_menu.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
             $menusArray = $builder->render();
192 192
             $xoops->tpl()->assign('menus', $menusArray);
193 193
         } else {
194
-             $xoops->tpl()->assign('error_message', _AM_MENUS_MSG_NOTFOUND);
194
+                $xoops->tpl()->assign('error_message', _AM_MENUS_MSG_NOTFOUND);
195 195
         }
196 196
         break;
197 197
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @version         $Id$
21 21
  */
22 22
 
23
-include_once __DIR__ . '/header.php';
23
+include_once __DIR__.'/header.php';
24 24
 
25 25
 $xoops = Xoops::getInstance();
26 26
 $helper = Menus::getInstance();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $msg[] = _AM_MENUS_SAVE;
95 95
 
96 96
         $id = Request::getInt('id', 0);
97
-        if (isset($id) && $id !=0) {
97
+        if (isset($id) && $id != 0) {
98 98
             $obj = $helper->getHandlerMenu()->get($id);
99 99
         } else {
100 100
             $obj = $helper->getHandlerMenu()->create();
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         if ($helper->getHandlerMenu()->insert($obj)) {
121 121
             $this_handler->update_weights($obj);
122
-            $xoops->redirect('admin_menu.php?op=list&amp;menu_id=' . $obj->getVar('mid'), 2, implode('<br />', $msg));
122
+            $xoops->redirect('admin_menu.php?op=list&amp;menu_id='.$obj->getVar('mid'), 2, implode('<br />', $msg));
123 123
         }
124 124
         echo $xoops->alert('error', $obj->getHtmlErrors());
125 125
         $form = $helper->getForm($obj, 'menus_menu');
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 $xoops->redirect('admin_menu.php', 3, implode(',', $xoops->security()->getErrors()));
136 136
             }
137 137
             if ($helper->getHandlerMenu()->delete($obj)) {
138
-                $xoops->redirect('admin_menu.php?menu_id=' . $menu_id, 2, _AM_MENUS_MSG_SUCCESS);
138
+                $xoops->redirect('admin_menu.php?menu_id='.$menu_id, 2, _AM_MENUS_MSG_SUCCESS);
139 139
             } else {
140 140
                 echo $xoops->alert('error', $obj->getHtmlErrors());
141 141
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             echo $xoops->confirm(
144 144
                 array('ok' => 1, 'id' => $id, 'op' => 'del', 'menu_id' => $menu_id),
145 145
                 $helper->url('admin/admin_menu.php'),
146
-                _AM_MENUS_MSG_SUREDEL . '<br /><strong>' . $obj->getVar('title') . '</strong>'
146
+                _AM_MENUS_MSG_SUREDEL.'<br /><strong>'.$obj->getVar('title').'</strong>'
147 147
             );
148 148
         }
149 149
         break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $obj->setVar('weight', $weight);
155 155
         $this_handler->insert($obj);
156 156
         $this_handler->update_weights($obj);
157
-        $xoops->redirect('admin_menu.php?op=list&amp;menu_id=' . $obj->getVar('mid'), 2, _AM_MENUS_SAVE);
157
+        $xoops->redirect('admin_menu.php?op=list&amp;menu_id='.$obj->getVar('mid'), 2, _AM_MENUS_SAVE);
158 158
         break;
159 159
 
160 160
     case 'toggle':
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
         $obj = $this_handler->get($id);
164 164
         $obj->setVar('visible', $visible);
165 165
         $this_handler->insert($obj);
166
-        $xoops->redirect('admin_menu.php?op=list&amp;menu_id=' . $obj->getVar('mid'), 2, _AM_MENUS_SAVE);
166
+        $xoops->redirect('admin_menu.php?op=list&amp;menu_id='.$obj->getVar('mid'), 2, _AM_MENUS_SAVE);
167 167
         break;
168 168
 
169 169
     case 'list':
170 170
     default:
171
-        $admin_page->addItemButton(_AM_MENUS_ADD_MENUS, 'admin_menu.php?op=add&amp;menu_id=' . $menu_id, 'add');
171
+        $admin_page->addItemButton(_AM_MENUS_ADD_MENUS, 'admin_menu.php?op=add&amp;menu_id='.$menu_id, 'add');
172 172
         $admin_page->renderButton();
173 173
 
174 174
         $this_handler = $helper->getHandlerMenu();
Please login to merge, or discard this patch.
htdocs/modules/menus/admin/header.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  * @version         $Id$
19 19
  */
20 20
 
21
-require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
21
+require_once dirname(dirname(dirname(__DIR__))).'/include/cp_header.php';
22 22
 
23 23
 $xoops = Xoops::getInstance();
24 24
 $helper = Xoops\Module\Helper::getHelper('menus');
Please login to merge, or discard this patch.