@@ -20,5 +20,5 @@ |
||
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 | ); |
@@ -46,7 +46,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -45,11 +45,11 @@ discard block |
||
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 |
||
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) { |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function render() |
46 | 46 | { |
47 | - $form = $this->loadText() . ' <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().' <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 |
||
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() |
@@ -84,7 +84,7 @@ discard block |
||
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 |
||
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 | } |
@@ -181,32 +181,32 @@ |
||
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(); |
@@ -58,15 +58,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -161,10 +161,10 @@ |
||
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 |
@@ -95,8 +95,8 @@ discard block |
||
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 |
||
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 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | $GLOBALS['xoopsConfig']['theme_set'] = $options['folderName']; |
74 | 74 | } |
75 | - $options['path'] = XOOPS_THEME_PATH . '/' . $options['folderName']; |
|
75 | + $options['path'] = XOOPS_THEME_PATH.'/'.$options['folderName']; |
|
76 | 76 | $inst = null; |
77 | 77 | $inst = new xos_opal_Theme(); |
78 | 78 | foreach ($options as $k => $v) { |
@@ -117,17 +117,17 @@ discard block |
||
117 | 117 | $options['plugins'] = array(); |
118 | 118 | $options['renderBanner'] = false; |
119 | 119 | $inst = parent::createInstance($options, $initArgs); |
120 | - $inst->path = XOOPS_ADMINTHEME_PATH . '/' . $inst->folderName; |
|
121 | - $inst->url = XOOPS_ADMINTHEME_URL . '/' . $inst->folderName; |
|
120 | + $inst->path = XOOPS_ADMINTHEME_PATH.'/'.$inst->folderName; |
|
121 | + $inst->url = XOOPS_ADMINTHEME_URL.'/'.$inst->folderName; |
|
122 | 122 | $inst->template->assign(array( |
123 | 123 | 'theme_path' => $inst->path, |
124 | - 'theme_tpl' => $inst->path . '/xotpl', |
|
124 | + 'theme_tpl' => $inst->path.'/xotpl', |
|
125 | 125 | 'theme_url' => $inst->url, |
126 | - 'theme_img' => $inst->url . '/img', |
|
127 | - 'theme_icons' => $inst->url . '/icons', |
|
128 | - 'theme_css' => $inst->url . '/css', |
|
129 | - 'theme_js' => $inst->url . '/js', |
|
130 | - 'theme_lang' => $inst->url . '/language')); |
|
126 | + 'theme_img' => $inst->url.'/img', |
|
127 | + 'theme_icons' => $inst->url.'/icons', |
|
128 | + 'theme_css' => $inst->url.'/css', |
|
129 | + 'theme_js' => $inst->url.'/js', |
|
130 | + 'theme_lang' => $inst->url.'/language')); |
|
131 | 131 | |
132 | 132 | return $inst; |
133 | 133 | } |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | /** @var XoopsConfigHandler $configHandler */ |
269 | 269 | $configHandler = xoops_getHandler('config'); |
270 | 270 | |
271 | - $this->path = XOOPS_THEME_PATH . '/' . $this->folderName; |
|
272 | - $this->url = XOOPS_THEME_URL . '/' . $this->folderName; |
|
271 | + $this->path = XOOPS_THEME_PATH.'/'.$this->folderName; |
|
272 | + $this->url = XOOPS_THEME_URL.'/'.$this->folderName; |
|
273 | 273 | $this->template = null; |
274 | 274 | $this->template = new XoopsTpl(); |
275 | 275 | $this->template->currentTheme = $this; |
276 | 276 | $this->template->assign_by_ref('xoTheme', $this); |
277 | 277 | $GLOBALS['xoTheme'] = $this; |
278 | 278 | $GLOBALS['xoopsTpl'] = $this->template; |
279 | - $tempPath = str_replace('\\', '/', realpath(XOOPS_ROOT_PATH) . '/'); |
|
280 | - $tempName = str_replace('\\', '/', realpath($_SERVER['SCRIPT_FILENAME'])); |
|
279 | + $tempPath = str_replace('\\', '/', realpath(XOOPS_ROOT_PATH).'/'); |
|
280 | + $tempName = str_replace('\\', '/', realpath($_SERVER['SCRIPT_FILENAME'])); |
|
281 | 281 | $xoops_page = str_replace($tempPath, '', $tempName); |
282 | 282 | if (strpos($xoops_page, 'modules') !== false) { |
283 | 283 | $xoops_page = str_replace('modules/', '', $xoops_page); |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | $xoops_startpage = 'system'; |
293 | 293 | } |
294 | 294 | // call the theme_autorun.php if the theme has one |
295 | - if (file_exists($this->path . "/theme_autorun.php")) { |
|
296 | - include_once($this->path . "/theme_autorun.php"); |
|
295 | + if (file_exists($this->path."/theme_autorun.php")) { |
|
296 | + include_once($this->path."/theme_autorun.php"); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | $searchConfig = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH); |
300 | - $xoops_search = (bool) (isset($searchConfig['enable_search']) && $searchConfig['enable_search'] === 1); |
|
300 | + $xoops_search = (bool)(isset($searchConfig['enable_search']) && $searchConfig['enable_search'] === 1); |
|
301 | 301 | $this->template->assign(array( |
302 | 302 | 'xoops_theme' => $GLOBALS['xoopsConfig']['theme_set'], |
303 | - 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $GLOBALS['xoopsConfig']['theme_set'] . '/', |
|
303 | + 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$GLOBALS['xoopsConfig']['theme_set'].'/', |
|
304 | 304 | 'xoops_themecss' => xoops_getcss($GLOBALS['xoopsConfig']['theme_set']), |
305 | 305 | 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), |
306 | 306 | 'xoops_sitename' => htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES), |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | if (isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser'])) { |
320 | 320 | $this->template->assign(array( |
321 | 321 | 'xoops_isuser' => true, |
322 | - 'xoops_avatar' => XOOPS_UPLOAD_URL . '/' . $GLOBALS['xoopsUser']->getVar('user_avatar'), |
|
322 | + 'xoops_avatar' => XOOPS_UPLOAD_URL.'/'.$GLOBALS['xoopsUser']->getVar('user_avatar'), |
|
323 | 323 | 'xoops_userid' => $GLOBALS['xoopsUser']->getVar('uid'), |
324 | 324 | 'xoops_uname' => $GLOBALS['xoopsUser']->getVar('uname'), |
325 | 325 | 'xoops_name' => $GLOBALS['xoopsUser']->getVar('name'), |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // Meta tags |
338 | - $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); |
|
338 | + $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); |
|
339 | 339 | $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER)); |
340 | 340 | $config = $configHandler->getConfigs($criteria, true); |
341 | 341 | foreach (array_keys($config) as $i) { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | if (!is_object($bundleId)) { |
361 | 361 | $this->plugins[$bundleId] = null; |
362 | 362 | $this->plugins[$bundleId] = new $bundleId(); |
363 | - $this->plugins[$bundleId]->theme =& $this; |
|
363 | + $this->plugins[$bundleId]->theme = & $this; |
|
364 | 364 | $this->plugins[$bundleId]->xoInit(); |
365 | 365 | unset($this->plugins[$k]); |
366 | 366 | } |
@@ -391,18 +391,18 @@ discard block |
||
391 | 391 | $extra_string = $GLOBALS['xoopsConfig']['language']; |
392 | 392 | // Generate group section |
393 | 393 | if (!isset($GLOBALS['xoopsUser']) || !is_object($GLOBALS['xoopsUser'])) { |
394 | - $extra_string .= '-' . XOOPS_GROUP_ANONYMOUS; |
|
394 | + $extra_string .= '-'.XOOPS_GROUP_ANONYMOUS; |
|
395 | 395 | } else { |
396 | 396 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
397 | 397 | sort($groups); |
398 | 398 | // Generate group string for non-anonymous groups, |
399 | 399 | // XOOPS_DB_PASS and XOOPS_DB_NAME (before we find better variables) are used to protect group sensitive contents |
400 | - $extra_string .= '-' . substr(md5(implode('-', $groups)), 0, 8) . '-' . substr(md5(XOOPS_DB_PASS . XOOPS_DB_NAME . XOOPS_DB_USER), 0, 8); |
|
400 | + $extra_string .= '-'.substr(md5(implode('-', $groups)), 0, 8).'-'.substr(md5(XOOPS_DB_PASS.XOOPS_DB_NAME.XOOPS_DB_USER), 0, 8); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | $extraString = $extra_string; |
404 | 404 | } |
405 | - $cache_id .= '-' . $extraString; |
|
405 | + $cache_id .= '-'.$extraString; |
|
406 | 406 | |
407 | 407 | return $cache_id; |
408 | 408 | } |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | $uri = str_replace(XOOPS_URL, '', $_SERVER['REQUEST_URI']); |
422 | 422 | // Clean uri by removing session id |
423 | 423 | if (defined('SID') && SID && strpos($uri, SID)) { |
424 | - $uri = preg_replace("/([\?&])(" . SID . "$|" . SID . '&)/', "\\1", $uri); |
|
424 | + $uri = preg_replace("/([\?&])(".SID."$|".SID.'&)/', "\\1", $uri); |
|
425 | 425 | } |
426 | - $this->contentCacheId = $this->generateCacheId('page_' . substr(md5($uri), 0, 8)); |
|
426 | + $this->contentCacheId = $this->generateCacheId('page_'.substr(md5($uri), 0, 8)); |
|
427 | 427 | if ($this->template->is_cached($template, $this->contentCacheId)) { |
428 | 428 | $xoopsLogger = XoopsLogger::getInstance(); |
429 | 429 | $xoopsLogger->addExtra($template, sprintf('Cached (regenerates every %d seconds)', $this->contentCacheLifetime)); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) { |
484 | 484 | $content['htmlHeadStrings'] = $this->htmlHeadStrings; |
485 | 485 | $content['metas'] = $this->metas; |
486 | - $content['xoops_pagetitle'] =& $this->template->get_template_vars('xoops_pagetitle'); |
|
486 | + $content['xoops_pagetitle'] = & $this->template->get_template_vars('xoops_pagetitle'); |
|
487 | 487 | $content['header'] = $header; |
488 | 488 | $cache->write($this->contentCacheId, $content); |
489 | 489 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ? |
507 | - $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header); |
|
507 | + $this->template->assign('xoops_module_header', $this->renderMetas(null, true)."\n".$header); |
|
508 | 508 | |
509 | 509 | if ($canvasTpl) { |
510 | 510 | $this->canvasTemplate = $canvasTpl; |
@@ -527,10 +527,10 @@ discard block |
||
527 | 527 | |
528 | 528 | // Do not cache the main (theme.html) template output |
529 | 529 | $this->template->caching = 0; |
530 | - if (file_exists($this->path . '/' . $this->canvasTemplate)) { |
|
531 | - $this->template->display($this->path . '/' . $this->canvasTemplate); |
|
530 | + if (file_exists($this->path.'/'.$this->canvasTemplate)) { |
|
531 | + $this->template->display($this->path.'/'.$this->canvasTemplate); |
|
532 | 532 | } else { |
533 | - $this->template->display($this->path . '/theme.html'); |
|
533 | + $this->template->display($this->path.'/theme.html'); |
|
534 | 534 | } |
535 | 535 | $this->renderCount++; |
536 | 536 | $xoopsLogger->stopTime('Page rendering'); |
@@ -554,16 +554,16 @@ discard block |
||
554 | 554 | { |
555 | 555 | $language = $GLOBALS['xoopsConfig']['language']; |
556 | 556 | // Load global localization stylesheet if available |
557 | - if (file_exists($GLOBALS['xoops']->path('language/' . $language . '/style.css'))) { |
|
558 | - $this->addStylesheet($GLOBALS['xoops']->url('language/' . $language . '/style.css')); |
|
557 | + if (file_exists($GLOBALS['xoops']->path('language/'.$language.'/style.css'))) { |
|
558 | + $this->addStylesheet($GLOBALS['xoops']->url('language/'.$language.'/style.css')); |
|
559 | 559 | } |
560 | 560 | $this->addLanguage($type, $language); |
561 | 561 | // Load theme localization stylesheet and scripts if available |
562 | - if (file_exists($this->path . '/language/' . $language . '/script.js')) { |
|
563 | - $this->addScript($this->url . '/language/' . $language . '/script.js'); |
|
562 | + if (file_exists($this->path.'/language/'.$language.'/script.js')) { |
|
563 | + $this->addScript($this->url.'/language/'.$language.'/script.js'); |
|
564 | 564 | } |
565 | - if (file_exists($this->path . '/language/' . $language . '/style.css')) { |
|
566 | - $this->addStylesheet($this->url . '/language/' . $language . '/style.css'); |
|
565 | + if (file_exists($this->path.'/language/'.$language.'/style.css')) { |
|
566 | + $this->addStylesheet($this->url.'/language/'.$language.'/style.css'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | return true; |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | public function addLanguage($type = 'main', $language = null) |
581 | 581 | { |
582 | 582 | $language = (null === $language) ? $GLOBALS['xoopsConfig']['language'] : $language; |
583 | - if (!file_exists($fileinc = $this->path . "/language/{$language}/{$type}.php")) { |
|
584 | - if (!file_exists($fileinc = $this->path . "/language/english/{$type}.php")) { |
|
583 | + if (!file_exists($fileinc = $this->path."/language/{$language}/{$type}.php")) { |
|
584 | + if (!file_exists($fileinc = $this->path."/language/english/{$type}.php")) { |
|
585 | 585 | return false; |
586 | 586 | } |
587 | 587 | } |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | switch ($type) { |
769 | 769 | case 'script': |
770 | 770 | foreach ($this->metas[$type] as $attrs) { |
771 | - $str .= '<script' . $this->renderAttributes($attrs) . '>'; |
|
771 | + $str .= '<script'.$this->renderAttributes($attrs).'>'; |
|
772 | 772 | if (@$attrs['_']) { |
773 | - $str .= "\n//<![CDATA[\n" . $attrs['_'] . "\n//]]>"; |
|
773 | + $str .= "\n//<![CDATA[\n".$attrs['_']."\n//]]>"; |
|
774 | 774 | } |
775 | 775 | $str .= "</script>\n"; |
776 | 776 | } |
@@ -779,26 +779,26 @@ discard block |
||
779 | 779 | foreach ($this->metas[$type] as $attrs) { |
780 | 780 | $rel = $attrs['rel']; |
781 | 781 | unset($attrs['rel']); |
782 | - $str .= '<link rel="' . $rel . '"' . $this->renderAttributes($attrs) . " />\n"; |
|
782 | + $str .= '<link rel="'.$rel.'"'.$this->renderAttributes($attrs)." />\n"; |
|
783 | 783 | } |
784 | 784 | break; |
785 | 785 | case 'stylesheet': |
786 | 786 | foreach ($this->metas[$type] as $attrs) { |
787 | 787 | if (@$attrs['_']) { |
788 | - $str .= '<style' . $this->renderAttributes($attrs) . ">\n/* <![CDATA[ */\n" . $attrs['_'] . "\n/* //]]> */\n</style>"; |
|
788 | + $str .= '<style'.$this->renderAttributes($attrs).">\n/* <![CDATA[ */\n".$attrs['_']."\n/* //]]> */\n</style>"; |
|
789 | 789 | } else { |
790 | - $str .= '<link rel="stylesheet"' . $this->renderAttributes($attrs) . " />\n"; |
|
790 | + $str .= '<link rel="stylesheet"'.$this->renderAttributes($attrs)." />\n"; |
|
791 | 791 | } |
792 | 792 | } |
793 | 793 | break; |
794 | 794 | case 'http': |
795 | 795 | foreach ($this->metas[$type] as $name => $content) { |
796 | - $str .= '<meta http-equiv="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($content, ENT_QUOTES) . "\" />\n"; |
|
796 | + $str .= '<meta http-equiv="'.htmlspecialchars($name, ENT_QUOTES).'" content="'.htmlspecialchars($content, ENT_QUOTES)."\" />\n"; |
|
797 | 797 | } |
798 | 798 | break; |
799 | 799 | default: |
800 | 800 | foreach ($this->metas[$type] as $name => $content) { |
801 | - $str .= '<meta name="' . htmlspecialchars($name, ENT_QUOTES) . '" content="' . htmlspecialchars($content, ENT_QUOTES) . "\" />\n"; |
|
801 | + $str .= '<meta name="'.htmlspecialchars($name, ENT_QUOTES).'" content="'.htmlspecialchars($content, ENT_QUOTES)."\" />\n"; |
|
802 | 802 | } |
803 | 803 | break; |
804 | 804 | } |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $cache[$tagName] = 1; |
825 | 825 | } |
826 | 826 | |
827 | - return $tagName . '-' . $cache[$tagName]++; |
|
827 | + return $tagName.'-'.$cache[$tagName]++; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | /** |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | $str = ''; |
839 | 839 | foreach ($coll as $name => $val) { |
840 | 840 | if ($name !== '_') { |
841 | - $str .= ' ' . $name . '="' . htmlspecialchars($val, ENT_QUOTES) . '"'; |
|
841 | + $str .= ' '.$name.'="'.htmlspecialchars($val, ENT_QUOTES).'"'; |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | $path = substr($path, 1); |
858 | 858 | } |
859 | 859 | |
860 | - if (file_exists(XOOPS_ROOT_PATH . "/{$this->themesPath}/{$this->folderName}/{$path}")) { |
|
860 | + if (file_exists(XOOPS_ROOT_PATH."/{$this->themesPath}/{$this->folderName}/{$path}")) { |
|
861 | 861 | return "{$this->themesPath}/{$this->folderName}/{$path}"; |
862 | 862 | } |
863 | 863 | |
864 | - if (file_exists(XOOPS_ROOT_PATH . "/themes/{$this->folderName}/{$path}")) { |
|
864 | + if (file_exists(XOOPS_ROOT_PATH."/themes/{$this->folderName}/{$path}")) { |
|
865 | 865 | return "themes/{$this->folderName}/{$path}"; |
866 | 866 | } |
867 | 867 |