@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // set the template path |
20 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
20 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | function dispCounterAdminIndex() |
29 | 29 | { |
30 | 30 | // set today's if no date is given |
31 | - $selected_date = (int)Context::get('selected_date'); |
|
31 | + $selected_date = (int) Context::get('selected_date'); |
|
32 | 32 | |
33 | - if(!$selected_date) |
|
33 | + if (!$selected_date) |
|
34 | 34 | { |
35 | 35 | $selected_date = date("Ymd"); |
36 | 36 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // get data by time, day, month, and year |
51 | 51 | $type = Context::get('type'); |
52 | 52 | |
53 | - if(!$type) |
|
53 | + if (!$type) |
|
54 | 54 | { |
55 | 55 | $type = 'day'; |
56 | 56 | Context::set('type', $type); |
@@ -275,6 +275,9 @@ |
||
275 | 275 | exit(); |
276 | 276 | } |
277 | 277 | |
278 | + /** |
|
279 | + * @param string $string |
|
280 | + */ |
|
278 | 281 | function createCaptchaAudio($string) |
279 | 282 | { |
280 | 283 | $data = ''; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if (!defined("__XE__")) exit(); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @file captcha.addon.php |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @brief Captcha for a particular action |
10 | 10 | * English alphabets and voice verification added |
11 | 11 | * */ |
12 | -if(!class_exists('AddonMemberCaptcha', false)) |
|
12 | +if (!class_exists('AddonMemberCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | class AddonMemberCaptcha |
15 | 15 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function before_module_init(&$ModuleHandler) |
33 | 33 | { |
34 | 34 | $logged_info = Context::get('logged_info'); |
35 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
35 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
36 | 36 | { |
37 | 37 | return false; |
38 | 38 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | // { |
41 | 41 | // return false; |
42 | 42 | // } |
43 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
43 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
44 | 44 | { |
45 | 45 | $_SESSION['member_captcha_authed'] = false; |
46 | 46 | } |
47 | - if($_SESSION['member_captcha_authed']) |
|
47 | + if ($_SESSION['member_captcha_authed']) |
|
48 | 48 | { |
49 | 49 | return false; |
50 | 50 | } |
@@ -52,26 +52,26 @@ discard block |
||
52 | 52 | $type = Context::get('captchaType'); |
53 | 53 | |
54 | 54 | $this->target_acts = array(); |
55 | - if($this->addon_info->apply_find_account == 'apply') |
|
55 | + if ($this->addon_info->apply_find_account == 'apply') |
|
56 | 56 | { |
57 | 57 | $this->target_acts[] = 'procMemberFindAccount'; |
58 | 58 | } |
59 | - if($this->addon_info->apply_resend_auth_mail == 'apply') |
|
59 | + if ($this->addon_info->apply_resend_auth_mail == 'apply') |
|
60 | 60 | { |
61 | 61 | $this->target_acts[] = 'procMemberResendAuthMail'; |
62 | 62 | } |
63 | - if($this->addon_info->apply_signup == 'apply') |
|
63 | + if ($this->addon_info->apply_signup == 'apply') |
|
64 | 64 | { |
65 | 65 | $this->target_acts[] = 'procMemberInsert'; |
66 | 66 | } |
67 | 67 | |
68 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
68 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
69 | 69 | { |
70 | - if($type == 'inline') |
|
70 | + if ($type == 'inline') |
|
71 | 71 | { |
72 | - if(!$this->compareCaptcha()) |
|
72 | + if (!$this->compareCaptcha()) |
|
73 | 73 | { |
74 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
74 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
75 | 75 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
76 | 76 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
77 | 77 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | { |
84 | 84 | Context::addHtmlHeader('<script> |
85 | 85 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
86 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
86 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
87 | 87 | </script>'); |
88 | 88 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
93 | - if(!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
93 | + if (!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
94 | 94 | { |
95 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
95 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
96 | 96 | $ModuleHandler->error = "captcha_denied"; |
97 | 97 | } |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | function createKeyword() |
103 | 103 | { |
104 | 104 | $type = Context::get('captchaType'); |
105 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
105 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
106 | 106 | { |
107 | 107 | return; |
108 | 108 | } |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | |
116 | 116 | function before_module_init_setCaptchaSession() |
117 | 117 | { |
118 | - if($_SESSION['member_captcha_authed']) |
|
118 | + if ($_SESSION['member_captcha_authed']) |
|
119 | 119 | { |
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | // Load language files |
123 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
123 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
124 | 124 | // Generate keywords |
125 | 125 | $this->createKeyword(); |
126 | 126 | |
127 | 127 | $target = Context::getLang('target_captcha'); |
128 | 128 | header("Content-Type: text/xml; charset=UTF-8"); |
129 | 129 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
130 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
130 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
131 | 131 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
132 | 132 | header("Cache-Control: post-check=0, pre-check=0", false); |
133 | 133 | header("Pragma: no-cache"); |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | |
145 | 145 | function before_module_init_captchaImage() |
146 | 146 | { |
147 | - if($_SESSION['member_captcha_authed']) |
|
147 | + if ($_SESSION['member_captcha_authed']) |
|
148 | 148 | { |
149 | 149 | return false; |
150 | 150 | } |
151 | - if(Context::get('renew')) |
|
151 | + if (Context::get('renew')) |
|
152 | 152 | { |
153 | 153 | $this->createKeyword(); |
154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function createCaptchaImage($string) |
171 | 171 | { |
172 | 172 | $arr = array(); |
173 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
173 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
174 | 174 | { |
175 | 175 | $arr[] = $string{$i}; |
176 | 176 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | shuffle($deg); |
193 | 193 | |
194 | 194 | // Create an image for each letter |
195 | - foreach($arr as $i => $str) |
|
195 | + foreach ($arr as $i => $str) |
|
196 | 196 | { |
197 | 197 | $im[$i + 1] = @imagecreate($w, $h); |
198 | 198 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $ran = range(1, 20); |
203 | 203 | shuffle($ran); |
204 | 204 | |
205 | - if(function_exists('imagerotate')) |
|
205 | + if (function_exists('imagerotate')) |
|
206 | 206 | { |
207 | 207 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
208 | 208 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // Combine images of each character |
220 | - for($i = 1; $i < count($im); $i++) |
|
220 | + for ($i = 1; $i < count($im); $i++) |
|
221 | 221 | { |
222 | 222 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
223 | 223 | imagedestroy($im[$i]); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
230 | 230 | imagedestroy($im[0]); |
231 | 231 | |
232 | - if(function_exists('imageantialias')) |
|
232 | + if (function_exists('imageantialias')) |
|
233 | 233 | { |
234 | 234 | imageantialias($big, true); |
235 | 235 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $h = $h * $big_count; |
242 | 242 | $d = array_pop($deg); |
243 | 243 | |
244 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
244 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
245 | 245 | { |
246 | 246 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $x = range(0, ($w - 10)); |
250 | 250 | shuffle($x); |
251 | 251 | |
252 | - for($i = 0; $i < 200; $i++) |
|
252 | + for ($i = 0; $i < 200; $i++) |
|
253 | 253 | { |
254 | 254 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
255 | 255 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | function before_module_init_captchaAudio() |
261 | 261 | { |
262 | - if($_SESSION['member_captcha_authed']) |
|
262 | + if ($_SESSION['member_captcha_authed']) |
|
263 | 263 | { |
264 | 264 | return false; |
265 | 265 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
272 | 272 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
273 | 273 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
274 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
275 | - header('Content-Length: ' . strlen($data)); |
|
274 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
275 | + header('Content-Length: '.strlen($data)); |
|
276 | 276 | |
277 | 277 | echo $data; |
278 | 278 | Context::close(); |
@@ -283,17 +283,17 @@ discard block |
||
283 | 283 | { |
284 | 284 | $data = ''; |
285 | 285 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
286 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
286 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
287 | 287 | { |
288 | 288 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
289 | 289 | |
290 | 290 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
291 | 291 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
292 | 292 | |
293 | - for($j = $start; $j < $datalen; $j+=64) |
|
293 | + for ($j = $start; $j < $datalen; $j += 64) |
|
294 | 294 | { |
295 | 295 | $ch = ord($_data{$j}); |
296 | - if($ch < 9 || $ch > 119) |
|
296 | + if ($ch < 9 || $ch > 119) |
|
297 | 297 | { |
298 | 298 | continue; |
299 | 299 | } |
@@ -308,14 +308,14 @@ discard block |
||
308 | 308 | |
309 | 309 | function compareCaptcha() |
310 | 310 | { |
311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
311 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
312 | 312 | |
313 | - if($_SESSION['member_captcha_authed']) |
|
313 | + if ($_SESSION['member_captcha_authed']) |
|
314 | 314 | { |
315 | 315 | return true; |
316 | 316 | } |
317 | 317 | |
318 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
318 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
319 | 319 | { |
320 | 320 | $_SESSION['member_captcha_authed'] = true; |
321 | 321 | return true; |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | |
329 | 329 | function before_module_init_captchaCompare() |
330 | 330 | { |
331 | - if(!$this->compareCaptcha()) |
|
331 | + if (!$this->compareCaptcha()) |
|
332 | 332 | { |
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | |
336 | 336 | header("Content-Type: text/xml; charset=UTF-8"); |
337 | 337 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
338 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
338 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
339 | 339 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
340 | 340 | header("Cache-Control: post-check=0, pre-check=0", false); |
341 | 341 | header("Pragma: no-cache"); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | unset($_SESSION['member_captcha_authed']); |
351 | 351 | $this->createKeyword(); |
352 | 352 | |
353 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
353 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
354 | 354 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
355 | 355 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
356 | 356 | |
@@ -388,18 +388,18 @@ discard block |
||
388 | 388 | |
389 | 389 | $oAddonMemberCaptcha = &$GLOBALS['__AddonMemberCaptcha__']; |
390 | 390 | |
391 | -if(method_exists($oAddonMemberCaptcha, $called_position)) |
|
391 | +if (method_exists($oAddonMemberCaptcha, $called_position)) |
|
392 | 392 | { |
393 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
393 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
394 | 394 | { |
395 | 395 | return false; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | 399 | $addon_act = Context::get('captcha_action'); |
400 | -if($addon_act && method_exists($oAddonMemberCaptcha, $called_position . '_' . $addon_act)) |
|
400 | +if ($addon_act && method_exists($oAddonMemberCaptcha, $called_position.'_'.$addon_act)) |
|
401 | 401 | { |
402 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
402 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
403 | 403 | { |
404 | 404 | return false; |
405 | 405 | } |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -78,8 +80,7 @@ discard block |
||
78 | 80 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
79 | 81 | $ModuleHandler->_setInputValueToSession(); |
80 | 82 | } |
81 | - } |
|
82 | - else |
|
83 | + } else |
|
83 | 84 | { |
84 | 85 | Context::addHtmlHeader('<script> |
85 | 86 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -209,8 +210,7 @@ discard block |
||
209 | 210 | |
210 | 211 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
211 | 212 | imagecolortransparent($im[$i + 1], $background_color); |
212 | - } |
|
213 | - else |
|
213 | + } else |
|
214 | 214 | { |
215 | 215 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
216 | 216 | } |
@@ -308,7 +308,9 @@ discard block |
||
308 | 308 | |
309 | 309 | function compareCaptcha() |
310 | 310 | { |
311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
311 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
312 | + return true; |
|
313 | + } |
|
312 | 314 | |
313 | 315 | if($_SESSION['member_captcha_authed']) |
314 | 316 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // get a list by using comment->getCommentList. |
53 | 53 | $oCommentModel = getModel('comment'); |
54 | 54 | $secretNameList = $oCommentModel->getSecretNameList(); |
55 | - $columnList = array('comment_srl', 'document_srl','module_srl','is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count'); |
|
55 | + $columnList = array('comment_srl', 'document_srl', 'module_srl', 'is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count'); |
|
56 | 56 | $output = $oCommentModel->getTotalCommentList($args, $columnList); |
57 | 57 | |
58 | 58 | // $modules = $oCommentModel->getDistinctModules(); |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | $oModuleModel = getModel('module'); |
71 | 71 | $module_list = array(); |
72 | 72 | $mod_srls = array(); |
73 | - foreach($output->data as $val) |
|
73 | + foreach ($output->data as $val) |
|
74 | 74 | { |
75 | 75 | $mod_srls[] = $val->module_srl; |
76 | 76 | } |
77 | 77 | $mod_srls = array_unique($mod_srls); |
78 | 78 | // Module List |
79 | 79 | $mod_srls_count = count($mod_srls); |
80 | - if($mod_srls_count) |
|
80 | + if ($mod_srls_count) |
|
81 | 81 | { |
82 | 82 | $columnList = array('module_srl', 'mid', 'browser_title'); |
83 | 83 | $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList); |
84 | - if($module_output && is_array($module_output)) |
|
84 | + if ($module_output && is_array($module_output)) |
|
85 | 85 | { |
86 | - foreach($module_output as $module) |
|
86 | + foreach ($module_output as $module) |
|
87 | 87 | { |
88 | 88 | $module_list[$module->module_srl] = $module; |
89 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $security->encodeHTML('search_target', 'search_keyword'); |
96 | 96 | |
97 | 97 | // set the template |
98 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
98 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
99 | 99 | $this->setTemplateFile('comment_list'); |
100 | 100 | } |
101 | 101 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | $declared_output = executeQuery('comment.getDeclaredList', $args); |
118 | 118 | $oCommentModel = getModel('comment'); |
119 | 119 | |
120 | - if($declared_output->data && count($declared_output->data)) |
|
120 | + if ($declared_output->data && count($declared_output->data)) |
|
121 | 121 | { |
122 | 122 | $comment_list = array(); |
123 | 123 | |
124 | - foreach($declared_output->data as $key => $comment) |
|
124 | + foreach ($declared_output->data as $key => $comment) |
|
125 | 125 | { |
126 | 126 | $comment_list[$key] = new commentItem(); |
127 | 127 | $comment_list[$key]->setAttribute($comment); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | Context::set('page_navigation', $declared_output->page_navigation); |
140 | 140 | Context::set('secret_name_list', $secretNameList); |
141 | 141 | // set the template |
142 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
142 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
143 | 143 | $this->setTemplateFile('declared_list'); |
144 | 144 | } |
145 | 145 |
@@ -18,28 +18,28 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | public function getResponseCode() { |
21 | - if($this->response) |
|
21 | + if ($this->response) |
|
22 | 22 | { |
23 | 23 | return $this->response->getStatus(); |
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getResponseHeader() { |
28 | - if($this->response) |
|
28 | + if ($this->response) |
|
29 | 29 | { |
30 | 30 | return $this->response->getHeader(); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getResponseBody() { |
35 | - if($this->response) |
|
35 | + if ($this->response) |
|
36 | 36 | { |
37 | 37 | return $this->response->getBody(); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getResponseCookies() { |
42 | - if($this->response) |
|
42 | + if ($this->response) |
|
43 | 43 | { |
44 | 44 | return $this->response->getCookies(); |
45 | 45 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | |
22 | 22 | function read($session_key) |
23 | 23 | { |
24 | - if(!$session_key || !$this->session_started) return; |
|
24 | + if (!$session_key || !$this->session_started) return; |
|
25 | 25 | |
26 | 26 | $args = new stdClass(); |
27 | 27 | $args->session_key = $session_key; |
28 | 28 | $columnList = array('session_key', 'cur_mid', 'val'); |
29 | 29 | $output = executeQuery('session.getSession', $args, $columnList); |
30 | 30 | |
31 | - if(!$output->data) |
|
31 | + if (!$output->data) |
|
32 | 32 | { |
33 | 33 | return ''; |
34 | 34 | } |
@@ -46,47 +46,47 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function getLoggedMembers($args) |
48 | 48 | { |
49 | - if(!$args->site_srl) |
|
49 | + if (!$args->site_srl) |
|
50 | 50 | { |
51 | 51 | $site_module_info = Context::get('site_module_info'); |
52 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
52 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
53 | 53 | } |
54 | - if(!$args->list_count) $args->list_count = 20; |
|
55 | - if(!$args->page) $args->page = 1; |
|
56 | - if(!$args->period_time) $args->period_time = 3; |
|
57 | - $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60); |
|
54 | + if (!$args->list_count) $args->list_count = 20; |
|
55 | + if (!$args->page) $args->page = 1; |
|
56 | + if (!$args->period_time) $args->period_time = 3; |
|
57 | + $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time * 60); |
|
58 | 58 | |
59 | 59 | $output = executeQueryArray('session.getLoggedMembers', $args); |
60 | - if(!$output->toBool()) return $output; |
|
60 | + if (!$output->toBool()) return $output; |
|
61 | 61 | |
62 | 62 | $member_srls = array(); |
63 | 63 | $member_keys = array(); |
64 | - if(count($output->data)) |
|
64 | + if (count($output->data)) |
|
65 | 65 | { |
66 | - foreach($output->data as $key => $val) |
|
66 | + foreach ($output->data as $key => $val) |
|
67 | 67 | { |
68 | 68 | $member_srls[$key] = $val->member_srl; |
69 | 69 | $member_keys[$val->member_srl] = $key; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if(Context::get('is_logged')) |
|
73 | + if (Context::get('is_logged')) |
|
74 | 74 | { |
75 | 75 | $logged_info = Context::get('logged_info'); |
76 | - if(!in_array($logged_info->member_srl, $member_srls)) |
|
76 | + if (!in_array($logged_info->member_srl, $member_srls)) |
|
77 | 77 | { |
78 | 78 | $member_srls[0] = $logged_info->member_srl; |
79 | 79 | $member_keys[$logged_info->member_srl] = 0; |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - if(!count($member_srls)) return $output; |
|
83 | + if (!count($member_srls)) return $output; |
|
84 | 84 | |
85 | - $member_args->member_srl = implode(',',$member_srls); |
|
85 | + $member_args->member_srl = implode(',', $member_srls); |
|
86 | 86 | $member_output = executeQueryArray('member.getMembers', $member_args); |
87 | - if($member_output->data) |
|
87 | + if ($member_output->data) |
|
88 | 88 | { |
89 | - foreach($member_output->data as $key => $val) |
|
89 | + foreach ($member_output->data as $key => $val) |
|
90 | 90 | { |
91 | 91 | $output->data[$member_keys[$val->member_srl]] = $val; |
92 | 92 | } |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | function read($session_key) |
23 | 23 | { |
24 | - if(!$session_key || !$this->session_started) return; |
|
24 | + if(!$session_key || !$this->session_started) { |
|
25 | + return; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $args = new stdClass(); |
27 | 29 | $args->session_key = $session_key; |
@@ -51,13 +53,21 @@ discard block |
||
51 | 53 | $site_module_info = Context::get('site_module_info'); |
52 | 54 | $args->site_srl = (int)$site_module_info->site_srl; |
53 | 55 | } |
54 | - if(!$args->list_count) $args->list_count = 20; |
|
55 | - if(!$args->page) $args->page = 1; |
|
56 | - if(!$args->period_time) $args->period_time = 3; |
|
56 | + if(!$args->list_count) { |
|
57 | + $args->list_count = 20; |
|
58 | + } |
|
59 | + if(!$args->page) { |
|
60 | + $args->page = 1; |
|
61 | + } |
|
62 | + if(!$args->period_time) { |
|
63 | + $args->period_time = 3; |
|
64 | + } |
|
57 | 65 | $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60); |
58 | 66 | |
59 | 67 | $output = executeQueryArray('session.getLoggedMembers', $args); |
60 | - if(!$output->toBool()) return $output; |
|
68 | + if(!$output->toBool()) { |
|
69 | + return $output; |
|
70 | + } |
|
61 | 71 | |
62 | 72 | $member_srls = array(); |
63 | 73 | $member_keys = array(); |
@@ -80,7 +90,9 @@ discard block |
||
80 | 90 | } |
81 | 91 | } |
82 | 92 | |
83 | - if(!count($member_srls)) return $output; |
|
93 | + if(!count($member_srls)) { |
|
94 | + return $output; |
|
95 | + } |
|
84 | 96 | |
85 | 97 | $member_args->member_srl = implode(',',$member_srls); |
86 | 98 | $member_output = executeQueryArray('member.getMembers', $member_args); |
@@ -24,28 +24,28 @@ discard block |
||
24 | 24 | $member_srl = abs($member_srl); |
25 | 25 | |
26 | 26 | // Get from instance memory |
27 | - if($this->pointList[$member_srl]) return true; |
|
27 | + if ($this->pointList[$member_srl]) return true; |
|
28 | 28 | |
29 | 29 | // Get from file cache |
30 | - $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s',getNumberingPath($member_srl)); |
|
30 | + $path = sprintf(_XE_PATH_.'files/member_extra_info/point/%s', getNumberingPath($member_srl)); |
|
31 | 31 | $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl); |
32 | - if(file_exists($cache_filename)) |
|
32 | + if (file_exists($cache_filename)) |
|
33 | 33 | { |
34 | - if(!$this->pointList[$member_srl]) |
|
34 | + if (!$this->pointList[$member_srl]) |
|
35 | 35 | $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | |
39 | - $args =new stdClass(); |
|
39 | + $args = new stdClass(); |
|
40 | 40 | $args->member_srl = $member_srl; |
41 | 41 | $output = executeQuery('point.getPoint', $args); |
42 | - if($output->data->member_srl == $member_srl) |
|
42 | + if ($output->data->member_srl == $member_srl) |
|
43 | 43 | { |
44 | - if(!$this->pointList[$member_srl]) |
|
44 | + if (!$this->pointList[$member_srl]) |
|
45 | 45 | { |
46 | - $this->pointList[$member_srl] = (int)$output->data->point; |
|
46 | + $this->pointList[$member_srl] = (int) $output->data->point; |
|
47 | 47 | FileHandler::makeDir($path); |
48 | - FileHandler::writeFile($cache_filename, (int)$output->data->point); |
|
48 | + FileHandler::writeFile($cache_filename, (int) $output->data->point); |
|
49 | 49 | } |
50 | 50 | return true; |
51 | 51 | } |
@@ -60,25 +60,25 @@ discard block |
||
60 | 60 | $member_srl = abs($member_srl); |
61 | 61 | |
62 | 62 | // Get from instance memory |
63 | - if(!$from_db && $this->pointList[$member_srl]) return $this->pointList[$member_srl]; |
|
63 | + if (!$from_db && $this->pointList[$member_srl]) return $this->pointList[$member_srl]; |
|
64 | 64 | |
65 | 65 | // Get from file cache |
66 | - $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s',getNumberingPath($member_srl)); |
|
66 | + $path = sprintf(_XE_PATH_.'files/member_extra_info/point/%s', getNumberingPath($member_srl)); |
|
67 | 67 | $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl); |
68 | 68 | |
69 | - if(!$from_db && file_exists($cache_filename)) |
|
69 | + if (!$from_db && file_exists($cache_filename)) |
|
70 | 70 | return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
71 | 71 | |
72 | 72 | // Get from the DB |
73 | - $args =new stdClass(); |
|
73 | + $args = new stdClass(); |
|
74 | 74 | $args->member_srl = $member_srl; |
75 | 75 | $output = executeQuery('point.getPoint', $args); |
76 | 76 | |
77 | - if(isset($output->data->member_srl)) |
|
77 | + if (isset($output->data->member_srl)) |
|
78 | 78 | { |
79 | - $point = (int)$output->data->point; |
|
79 | + $point = (int) $output->data->point; |
|
80 | 80 | $this->pointList[$member_srl] = $point; |
81 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
81 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
82 | 82 | FileHandler::writeFile($cache_filename, $point); |
83 | 83 | return $point; |
84 | 84 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | function getLevel($point, $level_step) |
92 | 92 | { |
93 | 93 | $level_count = count($level_step); |
94 | - for($level=0;$level<=$level_count;$level++) if($point < $level_step[$level]) break; |
|
95 | - $level --; |
|
94 | + for ($level = 0; $level <= $level_count; $level++) if ($point < $level_step[$level]) break; |
|
95 | + $level--; |
|
96 | 96 | return $level; |
97 | 97 | } |
98 | 98 | |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | { |
104 | 104 | $member_srls = Context::get('member_srls'); |
105 | 105 | $member_srls = array_unique(explode(',', $member_srls)); |
106 | - if(!count($member_srls)) |
|
106 | + if (!count($member_srls)) |
|
107 | 107 | { |
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | 111 | $logged_info = Context::get('logged_info'); |
112 | - if(!$logged_info->member_srl) |
|
112 | + if (!$logged_info->member_srl) |
|
113 | 113 | { |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if(!getModel('module')->isSiteAdmin($logged_info)) |
|
117 | + if (!getModel('module')->isSiteAdmin($logged_info)) |
|
118 | 118 | { |
119 | - if(in_array($logged_info->member_srl, $member_srls)) |
|
119 | + if (in_array($logged_info->member_srl, $member_srls)) |
|
120 | 120 | { |
121 | 121 | $member_srls = array($logged_info->member_srl); |
122 | 122 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $config = $oModuleModel->getModuleConfig('point'); |
131 | 131 | |
132 | 132 | $info = array(); |
133 | - foreach($member_srls as $v) |
|
133 | + foreach ($member_srls as $v) |
|
134 | 134 | { |
135 | 135 | $obj = new stdClass; |
136 | 136 | $obj->point = $this->getPoint($v); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $info[] = $obj; |
140 | 140 | } |
141 | 141 | |
142 | - $this->add('point_info',$info); |
|
142 | + $this->add('point_info', $info); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -149,37 +149,37 @@ discard block |
||
149 | 149 | function getMemberList($args = null, $columnList = array()) |
150 | 150 | { |
151 | 151 | // Arrange the search options |
152 | - $args->is_admin = Context::get('is_admin')=='Y'?'Y':''; |
|
153 | - $args->is_denied = Context::get('is_denied')=='Y'?'Y':''; |
|
152 | + $args->is_admin = Context::get('is_admin') == 'Y' ? 'Y' : ''; |
|
153 | + $args->is_denied = Context::get('is_denied') == 'Y' ? 'Y' : ''; |
|
154 | 154 | $args->selected_group_srl = Context::get('selected_group_srl'); |
155 | 155 | |
156 | 156 | $search_target = trim(Context::get('search_target')); |
157 | 157 | $search_keyword = trim(Context::get('search_keyword')); |
158 | 158 | |
159 | 159 | // if search keyword is emtpy, show all list |
160 | - if(!$search_keyword) |
|
160 | + if (!$search_keyword) |
|
161 | 161 | { |
162 | 162 | unset($args->is_admin, $args->is_denied, $args->selected_group_srl, $search_target); |
163 | 163 | } |
164 | 164 | |
165 | - if($search_target && $search_keyword) |
|
165 | + if ($search_target && $search_keyword) |
|
166 | 166 | { |
167 | - switch($search_target) |
|
167 | + switch ($search_target) |
|
168 | 168 | { |
169 | 169 | case 'user_id' : |
170 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
170 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
171 | 171 | $args->s_user_id = $search_keyword; |
172 | 172 | break; |
173 | 173 | case 'user_name' : |
174 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
174 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
175 | 175 | $args->s_user_name = $search_keyword; |
176 | 176 | break; |
177 | 177 | case 'nick_name' : |
178 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
178 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
179 | 179 | $args->s_nick_name = $search_keyword; |
180 | 180 | break; |
181 | 181 | case 'email_address' : |
182 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
182 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
183 | 183 | $args->s_email_address = $search_keyword; |
184 | 184 | break; |
185 | 185 | case 'regdate' : |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | } |
196 | 196 | // If there is a selected_group_srl, change the "query id" (for table join) |
197 | - if($args->selected_group_srl) |
|
197 | + if ($args->selected_group_srl) |
|
198 | 198 | { |
199 | 199 | $query_id = 'point.getMemberListWithinGroup'; |
200 | 200 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | |
206 | 206 | $output = executeQuery($query_id, $args, $columnList); |
207 | 207 | |
208 | - if($output->total_count) |
|
208 | + if ($output->total_count) |
|
209 | 209 | { |
210 | 210 | $oModuleModel = getModel('module'); |
211 | 211 | $config = $oModuleModel->getModuleConfig('point'); |
212 | 212 | |
213 | - foreach($output->data as $key => $val) |
|
213 | + foreach ($output->data as $key => $val) |
|
214 | 214 | { |
215 | 215 | $output->data[$key]->level = $this->getLevel($val->point, $config->level_step); |
216 | 216 | } |
@@ -24,15 +24,18 @@ discard block |
||
24 | 24 | $member_srl = abs($member_srl); |
25 | 25 | |
26 | 26 | // Get from instance memory |
27 | - if($this->pointList[$member_srl]) return true; |
|
27 | + if($this->pointList[$member_srl]) { |
|
28 | + return true; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | // Get from file cache |
30 | 32 | $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s',getNumberingPath($member_srl)); |
31 | 33 | $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl); |
32 | 34 | if(file_exists($cache_filename)) |
33 | 35 | { |
34 | - if(!$this->pointList[$member_srl]) |
|
35 | - $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
|
36 | + if(!$this->pointList[$member_srl]) { |
|
37 | + $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
|
38 | + } |
|
36 | 39 | return true; |
37 | 40 | } |
38 | 41 | |
@@ -60,14 +63,17 @@ discard block |
||
60 | 63 | $member_srl = abs($member_srl); |
61 | 64 | |
62 | 65 | // Get from instance memory |
63 | - if(!$from_db && $this->pointList[$member_srl]) return $this->pointList[$member_srl]; |
|
66 | + if(!$from_db && $this->pointList[$member_srl]) { |
|
67 | + return $this->pointList[$member_srl]; |
|
68 | + } |
|
64 | 69 | |
65 | 70 | // Get from file cache |
66 | 71 | $path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s',getNumberingPath($member_srl)); |
67 | 72 | $cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl); |
68 | 73 | |
69 | - if(!$from_db && file_exists($cache_filename)) |
|
70 | - return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
|
74 | + if(!$from_db && file_exists($cache_filename)) { |
|
75 | + return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename)); |
|
76 | + } |
|
71 | 77 | |
72 | 78 | // Get from the DB |
73 | 79 | $args =new stdClass(); |
@@ -78,7 +84,9 @@ discard block |
||
78 | 84 | { |
79 | 85 | $point = (int)$output->data->point; |
80 | 86 | $this->pointList[$member_srl] = $point; |
81 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
87 | + if(!is_dir($path)) { |
|
88 | + FileHandler::makeDir($path); |
|
89 | + } |
|
82 | 90 | FileHandler::writeFile($cache_filename, $point); |
83 | 91 | return $point; |
84 | 92 | } |
@@ -91,7 +99,9 @@ discard block |
||
91 | 99 | function getLevel($point, $level_step) |
92 | 100 | { |
93 | 101 | $level_count = count($level_step); |
94 | - for($level=0;$level<=$level_count;$level++) if($point < $level_step[$level]) break; |
|
102 | + for($level=0;$level<=$level_count;$level++) { |
|
103 | + if($point < $level_step[$level]) break; |
|
104 | + } |
|
95 | 105 | $level --; |
96 | 106 | return $level; |
97 | 107 | } |
@@ -119,8 +129,7 @@ discard block |
||
119 | 129 | if(in_array($logged_info->member_srl, $member_srls)) |
120 | 130 | { |
121 | 131 | $member_srls = array($logged_info->member_srl); |
122 | - } |
|
123 | - else |
|
132 | + } else |
|
124 | 133 | { |
125 | 134 | return; |
126 | 135 | } |
@@ -167,19 +176,27 @@ discard block |
||
167 | 176 | switch($search_target) |
168 | 177 | { |
169 | 178 | case 'user_id' : |
170 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
179 | + if($search_keyword) { |
|
180 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
181 | + } |
|
171 | 182 | $args->s_user_id = $search_keyword; |
172 | 183 | break; |
173 | 184 | case 'user_name' : |
174 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
185 | + if($search_keyword) { |
|
186 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
187 | + } |
|
175 | 188 | $args->s_user_name = $search_keyword; |
176 | 189 | break; |
177 | 190 | case 'nick_name' : |
178 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
191 | + if($search_keyword) { |
|
192 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
193 | + } |
|
179 | 194 | $args->s_nick_name = $search_keyword; |
180 | 195 | break; |
181 | 196 | case 'email_address' : |
182 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
197 | + if($search_keyword) { |
|
198 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
199 | + } |
|
183 | 200 | $args->s_email_address = $search_keyword; |
184 | 201 | break; |
185 | 202 | case 'regdate' : |
@@ -197,8 +214,7 @@ discard block |
||
197 | 214 | if($args->selected_group_srl) |
198 | 215 | { |
199 | 216 | $query_id = 'point.getMemberListWithinGroup'; |
200 | - } |
|
201 | - else |
|
217 | + } else |
|
202 | 218 | { |
203 | 219 | $query_id = 'point.getMemberList'; |
204 | 220 | } |
@@ -31,25 +31,25 @@ |
||
31 | 31 | */ |
32 | 32 | function _makeXmlDoc($obj) |
33 | 33 | { |
34 | - if(!count($obj)) |
|
34 | + if (!count($obj)) |
|
35 | 35 | { |
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $xmlDoc = ''; |
40 | 40 | |
41 | - foreach($obj as $key => $val) |
|
41 | + foreach ($obj as $key => $val) |
|
42 | 42 | { |
43 | - if(is_numeric($key)) |
|
43 | + if (is_numeric($key)) |
|
44 | 44 | { |
45 | 45 | $key = 'item'; |
46 | 46 | } |
47 | 47 | |
48 | - if(is_string($val)) |
|
48 | + if (is_string($val)) |
|
49 | 49 | { |
50 | 50 | $xmlDoc .= sprintf('<%s>%s</%s>%s', $key, htmlspecialchars($val, ENT_COMPAT, 'UTF-8', true), $key, "\n"); |
51 | 51 | } |
52 | - else if(!is_array($val) && !is_object($val)) |
|
52 | + else if (!is_array($val) && !is_object($val)) |
|
53 | 53 | { |
54 | 54 | $xmlDoc .= sprintf('<%s>%s</%s>%s', $key, $val, $key, "\n"); |
55 | 55 | } |
@@ -48,12 +48,10 @@ |
||
48 | 48 | if(is_string($val)) |
49 | 49 | { |
50 | 50 | $xmlDoc .= sprintf('<%s>%s</%s>%s', $key, htmlspecialchars($val, ENT_COMPAT, 'UTF-8', true), $key, "\n"); |
51 | - } |
|
52 | - else if(!is_array($val) && !is_object($val)) |
|
51 | + } else if(!is_array($val) && !is_object($val)) |
|
53 | 52 | { |
54 | 53 | $xmlDoc .= sprintf('<%s>%s</%s>%s', $key, $val, $key, "\n"); |
55 | - } |
|
56 | - else |
|
54 | + } else |
|
57 | 55 | { |
58 | 56 | $xmlDoc .= sprintf('<%s>%s%s</%s>%s', $key, "\n", $this->_makeXmlDoc($val), $key, "\n"); |
59 | 57 | } |
@@ -17,35 +17,35 @@ |
||
17 | 17 | $request_url = Context::getRequestUri(); |
18 | 18 | $output = new stdClass(); |
19 | 19 | |
20 | - if(substr_compare($request_url, '/', -1) !== 0) |
|
20 | + if (substr_compare($request_url, '/', -1) !== 0) |
|
21 | 21 | { |
22 | 22 | $request_url .= '/'; |
23 | 23 | } |
24 | 24 | |
25 | - if($error === 0) |
|
25 | + if ($error === 0) |
|
26 | 26 | { |
27 | - if($message != 'success') $output->message = $message; |
|
27 | + if ($message != 'success') $output->message = $message; |
|
28 | 28 | |
29 | 29 | $output->url = ($redirect_url) ? $redirect_url : $request_uri; |
30 | 30 | } |
31 | 31 | else |
32 | 32 | { |
33 | - if($message != 'fail') $output->message = $message; |
|
33 | + if ($message != 'fail') $output->message = $message; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $html = array(); |
37 | 37 | $html[] = '<!DOCTYPE html><html><head><title>Moved...</title><meta charset="utf-8" /><script>'; |
38 | 38 | |
39 | - if($output->message) |
|
39 | + if ($output->message) |
|
40 | 40 | { |
41 | - $html[] = 'alert(' . json_encode($output->message, JSON_UNESCAPED_SLASHES) . ');'; |
|
41 | + $html[] = 'alert('.json_encode($output->message, JSON_UNESCAPED_SLASHES).');'; |
|
42 | 42 | } |
43 | 43 | |
44 | - if($output->url) |
|
44 | + if ($output->url) |
|
45 | 45 | { |
46 | 46 | $url = json_encode(preg_replace('/#(.+)$/i', '', $output->url), JSON_UNESCAPED_SLASHES); |
47 | 47 | $html[] = 'var win = (window.opener) ? window.opener : window.parent;'; |
48 | - $html[] = 'win.location.href = ' . $url; |
|
48 | + $html[] = 'win.location.href = '.$url; |
|
49 | 49 | $html[] = 'if(window.opener) self.close();'; |
50 | 50 | } |
51 | 51 |
@@ -24,13 +24,16 @@ |
||
24 | 24 | |
25 | 25 | if($error === 0) |
26 | 26 | { |
27 | - if($message != 'success') $output->message = $message; |
|
27 | + if($message != 'success') { |
|
28 | + $output->message = $message; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | $output->url = ($redirect_url) ? $redirect_url : $request_uri; |
30 | - } |
|
31 | - else |
|
32 | + } else |
|
32 | 33 | { |
33 | - if($message != 'fail') $output->message = $message; |
|
34 | + if($message != 'fail') { |
|
35 | + $output->message = $message; |
|
36 | + } |
|
34 | 37 | } |
35 | 38 | |
36 | 39 | $html = array(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function &getInstance() |
24 | 24 | { |
25 | 25 | static $theInstance; |
26 | - if(!isset($theInstance)) |
|
26 | + if (!isset($theInstance)) |
|
27 | 27 | { |
28 | 28 | $theInstance = new Mobile(); |
29 | 29 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function _isFromMobilePhone() |
50 | 50 | { |
51 | - if($this->ismobile !== NULL) |
|
51 | + if ($this->ismobile !== NULL) |
|
52 | 52 | { |
53 | 53 | return $this->ismobile; |
54 | 54 | } |
55 | - if(Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"]) |
|
55 | + if (Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"]) |
|
56 | 56 | { |
57 | 57 | return ($this->ismobile = false); |
58 | 58 | } |
@@ -63,22 +63,22 @@ discard block |
||
63 | 63 | $this->ismobile = FALSE; |
64 | 64 | |
65 | 65 | $m = Context::get('m'); |
66 | - if(strlen($m) == 1) |
|
66 | + if (strlen($m) == 1) |
|
67 | 67 | { |
68 | - if($m == "1") |
|
68 | + if ($m == "1") |
|
69 | 69 | { |
70 | 70 | $this->ismobile = TRUE; |
71 | 71 | } |
72 | - elseif($m == "0") |
|
72 | + elseif ($m == "0") |
|
73 | 73 | { |
74 | 74 | $this->ismobile = FALSE; |
75 | 75 | } |
76 | 76 | } |
77 | - elseif(isset($_COOKIE['mobile'])) |
|
77 | + elseif (isset($_COOKIE['mobile'])) |
|
78 | 78 | { |
79 | - if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT'])) |
|
79 | + if ($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT'])) |
|
80 | 80 | { |
81 | - if($_COOKIE['mobile'] == 'true') |
|
81 | + if ($_COOKIE['mobile'] == 'true') |
|
82 | 82 | { |
83 | 83 | $this->ismobile = TRUE; |
84 | 84 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->ismobile = FALSE; |
93 | 93 | setcookie("mobile", FALSE); |
94 | 94 | setcookie("user-agent", FALSE); |
95 | - if(!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent()) |
|
95 | + if (!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent()) |
|
96 | 96 | { |
97 | 97 | $this->ismobile = TRUE; |
98 | 98 | } |
@@ -100,36 +100,36 @@ discard block |
||
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | - if($this->isMobilePadCheckByAgent()) |
|
103 | + if ($this->isMobilePadCheckByAgent()) |
|
104 | 104 | { |
105 | 105 | $this->ismobile = FALSE; |
106 | 106 | } |
107 | 107 | else |
108 | 108 | { |
109 | - if($this->isMobileCheckByAgent()) |
|
109 | + if ($this->isMobileCheckByAgent()) |
|
110 | 110 | { |
111 | 111 | $this->ismobile = TRUE; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - if($this->ismobile !== NULL) |
|
116 | + if ($this->ismobile !== NULL) |
|
117 | 117 | { |
118 | - if($this->ismobile == TRUE) |
|
118 | + if ($this->ismobile == TRUE) |
|
119 | 119 | { |
120 | - if($_COOKIE['mobile'] != 'true') |
|
120 | + if ($_COOKIE['mobile'] != 'true') |
|
121 | 121 | { |
122 | 122 | $_COOKIE['mobile'] = 'true'; |
123 | 123 | setcookie("mobile", 'true'); |
124 | 124 | } |
125 | 125 | } |
126 | - elseif($_COOKIE['mobile'] != 'false') |
|
126 | + elseif ($_COOKIE['mobile'] != 'false') |
|
127 | 127 | { |
128 | 128 | $_COOKIE['mobile'] = 'false'; |
129 | 129 | setcookie("mobile", 'false'); |
130 | 130 | } |
131 | 131 | |
132 | - if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT'])) |
|
132 | + if ($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT'])) |
|
133 | 133 | { |
134 | 134 | setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT'])); |
135 | 135 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function isMobileCheckByAgent() |
147 | 147 | { |
148 | 148 | static $UACheck; |
149 | - if(isset($UACheck)) |
|
149 | + if (isset($UACheck)) |
|
150 | 150 | { |
151 | 151 | return $UACheck; |
152 | 152 | } |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | $oMobile = Mobile::getInstance(); |
155 | 155 | $mobileAgent = array('iPod', 'iPhone', 'Android', 'BlackBerry', 'SymbianOS', 'Bada', 'Tizen', 'Kindle', 'Wii', 'SCH-', 'SPH-', 'CANU-', 'Windows Phone', 'Windows CE', 'POLARIS', 'Palm', 'Dorothy Browser', 'Mobile', 'Opera Mobi', 'Opera Mini', 'Minimo', 'AvantGo', 'NetFront', 'Nokia', 'LGPlayer', 'SonyEricsson', 'HTC'); |
156 | 156 | |
157 | - if($oMobile->isMobilePadCheckByAgent()) |
|
157 | + if ($oMobile->isMobilePadCheckByAgent()) |
|
158 | 158 | { |
159 | 159 | $UACheck = TRUE; |
160 | 160 | return TRUE; |
161 | 161 | } |
162 | 162 | |
163 | - foreach($mobileAgent as $agent) |
|
163 | + foreach ($mobileAgent as $agent) |
|
164 | 164 | { |
165 | - if(stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) |
|
165 | + if (stripos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) |
|
166 | 166 | { |
167 | 167 | $UACheck = TRUE; |
168 | 168 | return TRUE; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | function isMobilePadCheckByAgent() |
181 | 181 | { |
182 | 182 | static $UACheck; |
183 | - if(isset($UACheck)) |
|
183 | + if (isset($UACheck)) |
|
184 | 184 | { |
185 | 185 | return $UACheck; |
186 | 186 | } |
@@ -190,21 +190,21 @@ discard block |
||
190 | 190 | // $exceptionAgent[0] contains exception agents for all exceptions. |
191 | 191 | $exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile'); |
192 | 192 | |
193 | - foreach($padAgent as $agent) |
|
193 | + foreach ($padAgent as $agent) |
|
194 | 194 | { |
195 | - if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) |
|
195 | + if (strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) |
|
196 | 196 | { |
197 | - if(!isset($exceptionAgent[$agent])) |
|
197 | + if (!isset($exceptionAgent[$agent])) |
|
198 | 198 | { |
199 | 199 | $UACheck = TRUE; |
200 | 200 | return TRUE; |
201 | 201 | } |
202 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) |
|
202 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) |
|
203 | 203 | { |
204 | 204 | // If the agent is the Android, that can be either tablet and mobile phone. |
205 | - foreach($exceptionAgent[0] as $val) |
|
205 | + foreach ($exceptionAgent[0] as $val) |
|
206 | 206 | { |
207 | - if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE) |
|
207 | + if (strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE) |
|
208 | 208 | { |
209 | 209 | $UACheck = FALSE; |
210 | 210 | return FALSE; |
@@ -68,26 +68,22 @@ discard block |
||
68 | 68 | if($m == "1") |
69 | 69 | { |
70 | 70 | $this->ismobile = TRUE; |
71 | - } |
|
72 | - elseif($m == "0") |
|
71 | + } elseif($m == "0") |
|
73 | 72 | { |
74 | 73 | $this->ismobile = FALSE; |
75 | 74 | } |
76 | - } |
|
77 | - elseif(isset($_COOKIE['mobile'])) |
|
75 | + } elseif(isset($_COOKIE['mobile'])) |
|
78 | 76 | { |
79 | 77 | if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT'])) |
80 | 78 | { |
81 | 79 | if($_COOKIE['mobile'] == 'true') |
82 | 80 | { |
83 | 81 | $this->ismobile = TRUE; |
84 | - } |
|
85 | - else |
|
82 | + } else |
|
86 | 83 | { |
87 | 84 | $this->ismobile = FALSE; |
88 | 85 | } |
89 | - } |
|
90 | - else |
|
86 | + } else |
|
91 | 87 | { |
92 | 88 | $this->ismobile = FALSE; |
93 | 89 | setcookie("mobile", FALSE); |
@@ -97,14 +93,12 @@ discard block |
||
97 | 93 | $this->ismobile = TRUE; |
98 | 94 | } |
99 | 95 | } |
100 | - } |
|
101 | - else |
|
96 | + } else |
|
102 | 97 | { |
103 | 98 | if($this->isMobilePadCheckByAgent()) |
104 | 99 | { |
105 | 100 | $this->ismobile = FALSE; |
106 | - } |
|
107 | - else |
|
101 | + } else |
|
108 | 102 | { |
109 | 103 | if($this->isMobileCheckByAgent()) |
110 | 104 | { |
@@ -122,8 +116,7 @@ discard block |
||
122 | 116 | $_COOKIE['mobile'] = 'true'; |
123 | 117 | setcookie("mobile", 'true'); |
124 | 118 | } |
125 | - } |
|
126 | - elseif($_COOKIE['mobile'] != 'false') |
|
119 | + } elseif($_COOKIE['mobile'] != 'false') |
|
127 | 120 | { |
128 | 121 | $_COOKIE['mobile'] = 'false'; |
129 | 122 | setcookie("mobile", 'false'); |
@@ -198,8 +191,7 @@ discard block |
||
198 | 191 | { |
199 | 192 | $UACheck = TRUE; |
200 | 193 | return TRUE; |
201 | - } |
|
202 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) |
|
194 | + } elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) |
|
203 | 195 | { |
204 | 196 | // If the agent is the Android, that can be either tablet and mobile phone. |
205 | 197 | foreach($exceptionAgent[0] as $val) |