Test Failed
Pull Request — master (#589)
by Richard
08:35
created
htdocs/class/captcha/config.recaptcha2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
 
24 24
 return $config = array(
25 25
     'website_key' => 'YourWebsiteKey', //https://www.google.com/recaptcha/intro/index.html YourWebsiteKey
26
-    'secret_key'  => 'YourSecretKey',  //https://www.google.com/recaptcha/intro/index.html YourSecretKey
26
+    'secret_key'  => 'YourSecretKey', //https://www.google.com/recaptcha/intro/index.html YourSecretKey
27 27
 );
Please login to merge, or discard this patch.
htdocs/class/captcha/config.text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,5 +20,5 @@
 block discarded – undo
20 20
 defined('XOOPS_ROOT_PATH') || exit('Restricted access');
21 21
 
22 22
 return $config = array(
23
-    'num_chars' => 6,  // Maximum characters
23
+    'num_chars' => 6, // Maximum characters
24 24
 );
Please login to merge, or discard this patch.
htdocs/class/captcha/image.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 'imageftbbox');
47 47
             foreach ($required_functions as $func) {
48 48
                 if (!function_exists($func)) {
49
-                    trigger_error('Function ' . $func . ' is not defined', E_USER_WARNING);
49
+                    trigger_error('Function '.$func.' is not defined', E_USER_WARNING);
50 50
 
51 51
                     return false;
52 52
                 }
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function render()
65 65
     {
66
-        $js    = "<script type='text/javascript'>
66
+        $js = "<script type='text/javascript'>
67 67
                 function xoops_captcha_refresh(imgId)
68 68
                 {
69
-                    xoopsGetElementById(imgId).src = '" . XOOPS_URL . "/class/captcha/image/scripts/image.php?refresh='+Math.random();
69
+                    xoopsGetElementById(imgId).src = '" . XOOPS_URL."/class/captcha/image/scripts/image.php?refresh='+Math.random();
70 70
                 }
71 71
                 </script>";
72 72
         $image = $this->loadImage();
73
-        $image .= "<br><a href=\"javascript: xoops_captcha_refresh('" . $this->config['name'] . "')\">" . _CAPTCHA_REFRESH . '</a>';
74
-        $input = '<input type="text" name="' . $this->config['name'] . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] . '" maxlength="' . $this->config['num_chars'] . '" value="" />';
73
+        $image .= "<br><a href=\"javascript: xoops_captcha_refresh('".$this->config['name']."')\">"._CAPTCHA_REFRESH.'</a>';
74
+        $input = '<input type="text" name="'.$this->config['name'].'" id="'.$this->config['name'].'" size="'.$this->config['num_chars'].'" maxlength="'.$this->config['num_chars'].'" value="" />';
75 75
         $rule  = _CAPTCHA_RULE_IMAGE;
76
-        $rule .= '<br>' . (empty($this->config['casesensitive']) ? _CAPTCHA_RULE_CASEINSENSITIVE : _CAPTCHA_RULE_CASESENSITIVE);
76
+        $rule .= '<br>'.(empty($this->config['casesensitive']) ? _CAPTCHA_RULE_CASEINSENSITIVE : _CAPTCHA_RULE_CASESENSITIVE);
77 77
         if (!empty($this->config['maxattempts'])) {
78
-            $rule .= '<br>' . sprintf(_CAPTCHA_MAXATTEMPTS, $this->config['maxattempts']);
78
+            $rule .= '<br>'.sprintf(_CAPTCHA_MAXATTEMPTS, $this->config['maxattempts']);
79 79
         }
80 80
 
81
-        return $js . $image . '<br><br>' . $input . '<br>' . $rule;
81
+        return $js.$image.'<br><br>'.$input.'<br>'.$rule;
82 82
     }
83 83
 
84 84
     /**
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function loadImage()
90 90
     {
91
-        return '<img id="' . $this->config['name'] . '" src="' . XOOPS_URL . '/class/captcha/image/scripts/image.php" onclick=\'this.src="' . XOOPS_URL . '/class/captcha/image/scripts/image.php?refresh="+Math.random()' . '\' style="cursor: pointer; vertical-align: middle;" alt="" />';
91
+        return '<img id="'.$this->config['name'].'" src="'.XOOPS_URL.'/class/captcha/image/scripts/image.php" onclick=\'this.src="'.XOOPS_URL.'/class/captcha/image/scripts/image.php?refresh="+Math.random()'.'\' style="cursor: pointer; vertical-align: middle;" alt="" />';
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
htdocs/class/captcha/image/scripts/image.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @subpackage          CAPTCHA
18 18
  */
19 19
 
20
-include __DIR__  . '/../../../../mainfile.php';
20
+include __DIR__.'/../../../../mainfile.php';
21 21
 
22 22
 error_reporting(0);
23 23
 $xoopsLogger->activated = false;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         xoops_load('XoopsCaptcha');
55 55
         $this->captchaHandler = XoopsCaptcha::getInstance();
56
-        $this->config          = $this->captchaHandler->loadConfig('image');
56
+        $this->config = $this->captchaHandler->loadConfig('image');
57 57
     }
58 58
 
59 59
     public function loadImage()
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         if ($this->invalid) {
100 100
             header('Content-type: image/gif');
101
-            readfile(XOOPS_ROOT_PATH . '/images/subject/icon2.gif');
101
+            readfile(XOOPS_ROOT_PATH.'/images/subject/icon2.gif');
102 102
 
103 103
             return null;
104 104
         }
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
             return $items;
125 125
         }
126 126
 
127
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
128
-        $file_path = XOOPS_ROOT_PATH . "/class/captcha/image/{$name}";
127
+        require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
128
+        $file_path = XOOPS_ROOT_PATH."/class/captcha/image/{$name}";
129 129
         $files     = XoopsLists::getFileListAsArray($file_path);
130 130
         foreach ($files as $item) {
131 131
             if (empty($extension) || preg_match("/(\.{$extension})$/i", $item)) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function loadFont()
199 199
     {
200 200
         $fonts      = $this->getList('fonts', 'ttf');
201
-        $this->font = XOOPS_ROOT_PATH . '/class/captcha/image/fonts/' . $fonts[array_rand($fonts)];
201
+        $this->font = XOOPS_ROOT_PATH.'/class/captcha/image/fonts/'.$fonts[array_rand($fonts)];
202 202
     }
203 203
 
204 204
     public function setImageSize()
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $RandBackground = null;
239 239
         if ($backgrounds = $this->getList('backgrounds', '(gif|jpg|png)')) {
240
-            $RandBackground = XOOPS_ROOT_PATH . '/class/captcha/image/backgrounds/' . $backgrounds[array_rand($backgrounds)];
240
+            $RandBackground = XOOPS_ROOT_PATH.'/class/captcha/image/backgrounds/'.$backgrounds[array_rand($backgrounds)];
241 241
         }
242 242
 
243 243
         return $RandBackground;
Please login to merge, or discard this patch.
htdocs/class/captcha/recaptcha.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
     public function render()
46 46
     {
47 47
         trigger_error("recaptcha is outdated , use recaptcha_2 in \class\captcha\config.php", E_USER_WARNING);
48
-        require_once __DIR__ . '/recaptcha/recaptchalib.php';
48
+        require_once __DIR__.'/recaptcha/recaptchalib.php';
49 49
         $form = "<script type=\"text/javascript\">
50 50
             var RecaptchaOptions = {
51
-            theme : '" . $this->config['theme'] . "',
52
-            lang : '" . $this->config['lang'] . "'
51
+            theme : '" . $this->config['theme']."',
52
+            lang : '" . $this->config['lang']."'
53 53
             };
54 54
             </script>";
55 55
         $form .= recaptcha_get_html($this->config['public_key']);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function verify($sessionName = null)
68 68
     {
69 69
         $is_valid = false;
70
-        require_once __DIR__ . '/recaptcha/recaptchalib.php';
70
+        require_once __DIR__.'/recaptcha/recaptchalib.php';
71 71
         if (!empty(Request::getString('recaptcha_response_field', '', 'POST'))) {
72 72
             $resp = recaptcha_check_answer($this->config['private_key'], $_SERVER['REMOTE_ADDR'], Request::getString('recaptcha_challenge_field', '', 'POST'), Request::getString('recaptcha_response_field', '', 'POST'));
73 73
             if (!$resp->is_valid) {
Please login to merge, or discard this patch.
htdocs/class/captcha/text.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function render()
46 46
     {
47
-        $form = $this->loadText() . '&nbsp;&nbsp; <input type="text" name="' . $this->config['name'] . '" id="' . $this->config['name'] . '" size="' . $this->config['num_chars'] . '" maxlength="' . $this->config['num_chars'] . '" value="" />';
48
-        $form .= '<br>' . _CAPTCHA_RULE_TEXT;
47
+        $form = $this->loadText().'&nbsp;&nbsp; <input type="text" name="'.$this->config['name'].'" id="'.$this->config['name'].'" size="'.$this->config['num_chars'].'" maxlength="'.$this->config['num_chars'].'" value="" />';
48
+        $form .= '<br>'._CAPTCHA_RULE_TEXT;
49 49
         if (!empty($this->config['maxattempts'])) {
50
-            $form .= '<br>' . sprintf(_CAPTCHA_MAXATTEMPTS, $this->config['maxattempts']);
50
+            $form .= '<br>'.sprintf(_CAPTCHA_MAXATTEMPTS, $this->config['maxattempts']);
51 51
         }
52 52
 
53 53
         return $form;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function loadText()
62 62
     {
63
-        return '<span style="font-style: normal; font-weight: bold; font-size: 100%; color: #333; border: 1px solid #333; padding: 1px 5px;">' . $this->outputText . '</span>';
63
+        return '<span style="font-style: normal; font-weight: bold; font-size: 100%; color: #333; border: 1px solid #333; padding: 1px 5px;">'.$this->outputText.'</span>';
64 64
     }
65 65
 
66 66
     protected function buildQuestion()
Please login to merge, or discard this patch.
htdocs/class/preload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         if ($modules_list = XoopsCache::read('system_modules_active')) {
85 85
             $i = 0;
86 86
             foreach ($modules_list as $module) {
87
-                if (is_dir($dir = XOOPS_ROOT_PATH . "/modules/{$module}/preloads/")) {
87
+                if (is_dir($dir = XOOPS_ROOT_PATH."/modules/{$module}/preloads/")) {
88 88
                     $file_list = XoopsLists::getFileListAsArray($dir);
89 89
                     foreach ($file_list as $file) {
90 90
                         if (preg_match('/(\.php)$/i', $file)) {
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     public function setEvents()
108 108
     {
109 109
         foreach ($this->_preloads as $preload) {
110
-            include_once XOOPS_ROOT_PATH . '/modules/' . $preload['module'] . '/preloads/' . $preload['file'] . '.php';
111
-            $class_name = ucfirst($preload['module']) . ucfirst($preload['file']) . 'Preload';
110
+            include_once XOOPS_ROOT_PATH.'/modules/'.$preload['module'].'/preloads/'.$preload['file'].'.php';
111
+            $class_name = ucfirst($preload['module']).ucfirst($preload['file']).'Preload';
112 112
             if (!class_exists($class_name)) {
113 113
                 continue;
114 114
             }
Please login to merge, or discard this patch.
htdocs/class/xoopssecurity.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -181,32 +181,32 @@
 block discarded – undo
181 181
     public function checkSuperglobals()
182 182
     {
183 183
         foreach (array(
184
-                     'GLOBALS',
185
-                     '_SESSION',
186
-                     'HTTP_SESSION_VARS',
187
-                     '_GET',
188
-                     'HTTP_GET_VARS',
189
-                     '_POST',
190
-                     'HTTP_POST_VARS',
191
-                     '_COOKIE',
192
-                     'HTTP_COOKIE_VARS',
193
-                     '_REQUEST',
194
-                     '_SERVER',
195
-                     'HTTP_SERVER_VARS',
196
-                     '_ENV',
197
-                     'HTTP_ENV_VARS',
198
-                     '_FILES',
199
-                     'HTTP_POST_FILES',
200
-                     'xoopsDB',
201
-                     'xoopsUser',
202
-                     'xoopsUserId',
203
-                     'xoopsUserGroups',
204
-                     'xoopsUserIsAdmin',
205
-                     'xoopsConfig',
206
-                     'xoopsOption',
207
-                     'xoopsModule',
208
-                     'xoopsModuleConfig',
209
-                     'xoopsRequestUri') as $bad_global) {
184
+                        'GLOBALS',
185
+                        '_SESSION',
186
+                        'HTTP_SESSION_VARS',
187
+                        '_GET',
188
+                        'HTTP_GET_VARS',
189
+                        '_POST',
190
+                        'HTTP_POST_VARS',
191
+                        '_COOKIE',
192
+                        'HTTP_COOKIE_VARS',
193
+                        '_REQUEST',
194
+                        '_SERVER',
195
+                        'HTTP_SERVER_VARS',
196
+                        '_ENV',
197
+                        'HTTP_ENV_VARS',
198
+                        '_FILES',
199
+                        'HTTP_POST_FILES',
200
+                        'xoopsDB',
201
+                        'xoopsUser',
202
+                        'xoopsUserId',
203
+                        'xoopsUserGroups',
204
+                        'xoopsUserIsAdmin',
205
+                        'xoopsConfig',
206
+                        'xoopsOption',
207
+                        'xoopsModule',
208
+                        'xoopsModuleConfig',
209
+                        'xoopsRequestUri') as $bad_global) {
210 210
             if (isset($_REQUEST[$bad_global])) {
211 211
                 header('Location: ' . XOOPS_URL . '/');
212 212
                 exit();
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
         }
59 59
         $token_id = md5(uniqid(mt_rand(), true));
60 60
         // save token data on the server
61
-        if (!isset($_SESSION[$name . '_SESSION'])) {
62
-            $_SESSION[$name . '_SESSION'] = array();
61
+        if (!isset($_SESSION[$name.'_SESSION'])) {
62
+            $_SESSION[$name.'_SESSION'] = array();
63 63
         }
64 64
         $token_data = array(
65 65
             'id'     => $token_id,
66 66
             'expire' => time() + (int)$timeout);
67
-        $_SESSION[$name . '_SESSION'][] = $token_data;
67
+        $_SESSION[$name.'_SESSION'][] = $token_data;
68 68
 
69
-        return md5($token_id . $_SERVER['HTTP_USER_AGENT'] . XOOPS_DB_PREFIX);
69
+        return md5($token_id.$_SERVER['HTTP_USER_AGENT'].XOOPS_DB_PREFIX);
70 70
     }
71 71
 
72 72
     /**
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
     public function validateToken($token = false, $clearIfValid = true, $name = 'XOOPS_TOKEN')
82 82
     {
83 83
         global $xoopsLogger;
84
-        $token = ($token !== false) ? $token : (isset($_REQUEST[$name . '_REQUEST']) ? $_REQUEST[$name . '_REQUEST'] : '');
85
-        if (empty($token) || empty($_SESSION[$name . '_SESSION'])) {
84
+        $token = ($token !== false) ? $token : (isset($_REQUEST[$name.'_REQUEST']) ? $_REQUEST[$name.'_REQUEST'] : '');
85
+        if (empty($token) || empty($_SESSION[$name.'_SESSION'])) {
86 86
             $xoopsLogger->addExtra('Token Validation', 'No valid token found in request/session');
87 87
 
88 88
             return false;
89 89
         }
90 90
         $validFound = false;
91
-        $token_data = &$_SESSION[$name . '_SESSION'];
91
+        $token_data = &$_SESSION[$name.'_SESSION'];
92 92
         foreach (array_keys($token_data) as $i) {
93
-            if ($token === md5($token_data[$i]['id'] . $_SERVER['HTTP_USER_AGENT'] . XOOPS_DB_PREFIX)) {
93
+            if ($token === md5($token_data[$i]['id'].$_SERVER['HTTP_USER_AGENT'].XOOPS_DB_PREFIX)) {
94 94
                 if ($this->filterToken($token_data[$i])) {
95 95
                     if ($clearIfValid) {
96 96
                         // token should be valid once, so clear it once validated
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function clearTokens($name = 'XOOPS_TOKEN')
126 126
     {
127
-        $_SESSION[$name . '_SESSION'] = array();
127
+        $_SESSION[$name.'_SESSION'] = array();
128 128
     }
129 129
 
130 130
     /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function garbageCollection($name = 'XOOPS_TOKEN')
150 150
     {
151
-        $sessionName = $name . '_SESSION';
151
+        $sessionName = $name.'_SESSION';
152 152
         if (!empty($_SESSION[$sessionName]) && is_array($_SESSION[$sessionName])) {
153 153
             $_SESSION[$sessionName] = array_filter($_SESSION[$sessionName], array($this, 'filterToken'));
154 154
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                      'xoopsModuleConfig',
209 209
                      'xoopsRequestUri') as $bad_global) {
210 210
             if (isset($_REQUEST[$bad_global])) {
211
-                header('Location: ' . XOOPS_URL . '/');
211
+                header('Location: '.XOOPS_URL.'/');
212 212
                 exit();
213 213
             }
214 214
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         global $xoopsConfig;
226 226
         if ($xoopsConfig['enable_badips'] == 1 && isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '') {
227 227
             foreach ($xoopsConfig['bad_ips'] as $bi) {
228
-                if (!empty($bi) && preg_match('/' . $bi . '/', $_SERVER['REMOTE_ADDR'])) {
228
+                if (!empty($bi) && preg_match('/'.$bi.'/', $_SERVER['REMOTE_ADDR'])) {
229 229
                     exit();
230 230
                 }
231 231
             }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      */
243 243
     public function getTokenHTML($name = 'XOOPS_TOKEN')
244 244
     {
245
-        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
245
+        require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
246 246
         $token = new XoopsFormHiddenToken($name);
247 247
 
248 248
         return $token->render();
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             $ret = '';
276 276
             if (count($this->errors) > 0) {
277 277
                 foreach ($this->errors as $error) {
278
-                    $ret .= $error . '<br>';
278
+                    $ret .= $error.'<br>';
279 279
                 }
280 280
             }
281 281
 
Please login to merge, or discard this patch.
htdocs/class/class.zipfile.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -161,10 +161,10 @@
 block discarded – undo
161 161
         $ctrldir = implode('', $this->ctrl_dir);
162 162
 
163 163
         return $data . $ctrldir . $this->eof_ctrl_dir . pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk"
164
-               pack('v', count($this->ctrl_dir)) . // total # of entries overall
165
-               pack('V', strlen($ctrldir)) . // size of central dir
166
-               pack('V', strlen($data)) . // offset to start of central dir
167
-               "\x00\x00"; // .zip file comment length
164
+                pack('v', count($this->ctrl_dir)) . // total # of entries overall
165
+                pack('V', strlen($ctrldir)) . // size of central dir
166
+                pack('V', strlen($data)) . // offset to start of central dir
167
+                "\x00\x00"; // .zip file comment length
168 168
     } // end of the 'file()' method
169 169
 } // end of the 'zipfile' class
170 170
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         $name = str_replace('\\', '/', $name);
96 96
 
97 97
         $dtime    = dechex($this->unix2DosTime($time));
98
-        $hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1];
99
-        eval('$hexdtime = "' . $hexdtime . '";');
98
+        $hexdtime = '\x'.$dtime[6].$dtime[7].'\x'.$dtime[4].$dtime[5].'\x'.$dtime[2].$dtime[3].'\x'.$dtime[0].$dtime[1];
99
+        eval('$hexdtime = "'.$hexdtime.'";');
100 100
 
101 101
         $fr = "\x50\x4b\x03\x04";
102 102
         $fr .= "\x14\x00"; // ver needed to extract
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
         $data    = implode('', $this->datasec);
161 161
         $ctrldir = implode('', $this->ctrl_dir);
162 162
 
163
-        return $data . $ctrldir . $this->eof_ctrl_dir . pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk"
164
-               pack('v', count($this->ctrl_dir)) . // total # of entries overall
165
-               pack('V', strlen($ctrldir)) . // size of central dir
166
-               pack('V', strlen($data)) . // offset to start of central dir
163
+        return $data.$ctrldir.$this->eof_ctrl_dir.pack('v', count($this->ctrl_dir)).// total # of entries "on this disk"
164
+               pack('v', count($this->ctrl_dir)).// total # of entries overall
165
+               pack('V', strlen($ctrldir)).// size of central dir
166
+               pack('V', strlen($data)).// offset to start of central dir
167 167
                "\x00\x00"; // .zip file comment length
168 168
     } // end of the 'file()' method
169 169
 } // end of the 'zipfile' class
Please login to merge, or discard this patch.