@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | // Stop if non-logged-in user is |
17 | 17 | $logged_info = Context::get('logged_info'); |
18 | -if(!$logged_info|| isCrawler()) |
|
18 | +if (!$logged_info || isCrawler()) |
|
19 | 19 | { |
20 | 20 | return; |
21 | 21 | } |
@@ -23,35 +23,35 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received |
25 | 25 | * */ |
26 | -if($this->module != 'member' && $called_position == 'before_module_init') |
|
26 | +if ($this->module != 'member' && $called_position == 'before_module_init') |
|
27 | 27 | { |
28 | 28 | // Load a language file from the communication module |
29 | - Context::loadLang(_XE_PATH_ . 'modules/communication/lang'); |
|
29 | + Context::loadLang(_XE_PATH_.'modules/communication/lang'); |
|
30 | 30 | // Add menus on the member login information |
31 | 31 | $oMemberController = getController('member'); |
32 | 32 | $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); |
33 | 33 | $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); |
34 | 34 | |
35 | - $flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl; |
|
36 | - if($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
35 | + $flag_file = _XE_PATH_.'files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl).$logged_info->member_srl; |
|
36 | + if ($addon_info->use_alarm != 'N' && file_exists($flag_file)) |
|
37 | 37 | { |
38 | 38 | // Pop-up to display messages if a flag on new message is set |
39 | 39 | $new_message_count = (int) trim(FileHandler::readFile($flag_file)); |
40 | 40 | FileHandler::removeFile($flag_file); |
41 | - Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang'); |
|
41 | + Context::loadLang(_XE_PATH_.'addons/member_communication/lang'); |
|
42 | 42 | Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); |
43 | 43 | |
44 | 44 | $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); |
45 | 45 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
46 | 46 | } |
47 | 47 | } |
48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
48 | +elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
49 | 49 | { |
50 | 50 | $member_srl = Context::get('target_srl'); |
51 | 51 | $oCommunicationModel = getModel('communication'); |
52 | 52 | |
53 | 53 | // Add a feature to display own message box. |
54 | - if($logged_info->member_srl == $member_srl) |
|
54 | + if ($logged_info->member_srl == $member_srl) |
|
55 | 55 | { |
56 | 56 | $mid = Context::get('cur_mid'); |
57 | 57 | $oMemberController = getController('member'); |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | // Get member information |
67 | 67 | $oMemberModel = getModel('member'); |
68 | 68 | $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
69 | - if(!$target_member_info->member_srl) |
|
69 | + if (!$target_member_info->member_srl) |
|
70 | 70 | { |
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $oMemberController = getController('member'); |
75 | 75 | // Add a menu for sending message |
76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
76 | + if ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
77 | 77 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
78 | 78 | // Add a menu for listing friends (if a friend is new) |
79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
79 | + if (!$oCommunicationModel->isAddedFriend($member_srl)) |
|
80 | 80 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
81 | 81 | } |
82 | 82 | } |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file member_communication.addon.php |
@@ -44,8 +45,7 @@ discard block |
||
44 | 45 | $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); |
45 | 46 | Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>"); |
46 | 47 | } |
47 | -} |
|
48 | -elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
48 | +} elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc') |
|
49 | 49 | { |
50 | 50 | $member_srl = Context::get('target_srl'); |
51 | 51 | $oCommunicationModel = getModel('communication'); |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | // Display a list of friends |
61 | 61 | $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); |
62 | 62 | // If not, Add menus to send message and to add friends |
63 | - } |
|
64 | - else |
|
63 | + } else |
|
65 | 64 | { |
66 | 65 | // Get member information |
67 | 66 | $oMemberModel = getModel('member'); |
@@ -73,11 +72,13 @@ discard block |
||
73 | 72 | |
74 | 73 | $oMemberController = getController('member'); |
75 | 74 | // Add a menu for sending message |
76 | - if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) |
|
77 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
75 | + if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) { |
|
76 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); |
|
77 | + } |
|
78 | 78 | // Add a menu for listing friends (if a friend is new) |
79 | - if(!$oCommunicationModel->isAddedFriend($member_srl)) |
|
80 | - $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
79 | + if(!$oCommunicationModel->isAddedFriend($member_srl)) { |
|
80 | + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); |
|
81 | + } |
|
81 | 82 | } |
82 | 83 | } |
83 | 84 | /* End of file member_communication.addon.php */ |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author XEHub ([email protected]) |
10 | 10 | * @brief Automatic link add-on |
11 | 11 | */ |
12 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
12 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML") |
|
13 | 13 | { |
14 | 14 | Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true); |
15 | 15 | } |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file autolink.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | { |
6 | 6 | exit(); |
7 | 7 | } |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | * @author XEHub ([email protected]) |
12 | 12 | * @brief Add-on to resize images in the body |
13 | 13 | */ |
14 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler()) |
|
14 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML" && !isCrawler()) |
|
15 | 15 | { |
16 | - if(Mobile::isFromMobilePhone()) |
|
16 | + if (Mobile::isFromMobilePhone()) |
|
17 | 17 | { |
18 | 18 | Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true); |
19 | 19 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
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('AddonCaptcha', false)) |
|
12 | +if (!class_exists('AddonCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | class AddonCaptcha |
15 | 15 | { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function before_module_proc() |
26 | 26 | { |
27 | - if($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
27 | + if ($this->addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) |
|
28 | 28 | { |
29 | 29 | unset($_SESSION['captcha_authed']); |
30 | 30 | } |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | function before_module_init(&$ModuleHandler) |
34 | 34 | { |
35 | 35 | $logged_info = Context::get('logged_info'); |
36 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
36 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
37 | 37 | { |
38 | 38 | return false; |
39 | 39 | } |
40 | - if($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
40 | + if ($this->addon_info->target != 'all' && Context::get('is_logged')) |
|
41 | 41 | { |
42 | 42 | return false; |
43 | 43 | } |
44 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
44 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
45 | 45 | { |
46 | 46 | $_SESSION['captcha_authed'] = false; |
47 | 47 | } |
48 | - if($_SESSION['captcha_authed']) |
|
48 | + if ($_SESSION['captcha_authed']) |
|
49 | 49 | { |
50 | 50 | return false; |
51 | 51 | } |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); |
56 | 56 | |
57 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
57 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
58 | 58 | { |
59 | - if($type == 'inline') |
|
59 | + if ($type == 'inline') |
|
60 | 60 | { |
61 | - if(!$this->compareCaptcha()) |
|
61 | + if (!$this->compareCaptcha()) |
|
62 | 62 | { |
63 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
63 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
64 | 64 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
65 | 65 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
66 | 66 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | Context::addHtmlHeader('<script> |
74 | 74 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
75 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
75 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
76 | 76 | </script>'); |
77 | 77 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | 81 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
82 | - if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
82 | + if (!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
83 | 83 | { |
84 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
84 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
85 | 85 | $ModuleHandler->error = "captcha_denied"; |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | function createKeyword() |
92 | 92 | { |
93 | 93 | $type = Context::get('captchaType'); |
94 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
94 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
95 | 95 | { |
96 | 96 | return; |
97 | 97 | } |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | |
105 | 105 | function before_module_init_setCaptchaSession() |
106 | 106 | { |
107 | - if($_SESSION['captcha_authed']) |
|
107 | + if ($_SESSION['captcha_authed']) |
|
108 | 108 | { |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | // Load language files |
112 | - Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); |
|
112 | + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); |
|
113 | 113 | // Generate keywords |
114 | 114 | $this->createKeyword(); |
115 | 115 | |
116 | 116 | $target = Context::getLang('target_captcha'); |
117 | 117 | header("Content-Type: text/xml; charset=UTF-8"); |
118 | 118 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
119 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
119 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
120 | 120 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
121 | 121 | header("Cache-Control: post-check=0, pre-check=0", false); |
122 | 122 | header("Pragma: no-cache"); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | function before_module_init_captchaImage() |
135 | 135 | { |
136 | - if($_SESSION['captcha_authed']) |
|
136 | + if ($_SESSION['captcha_authed']) |
|
137 | 137 | { |
138 | 138 | return false; |
139 | 139 | } |
140 | - if(Context::get('renew')) |
|
140 | + if (Context::get('renew')) |
|
141 | 141 | { |
142 | 142 | $this->createKeyword(); |
143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | function createCaptchaImage($string) |
160 | 160 | { |
161 | 161 | $arr = array(); |
162 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
162 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
163 | 163 | { |
164 | 164 | $arr[] = $string{$i}; |
165 | 165 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | shuffle($deg); |
182 | 182 | |
183 | 183 | // Create an image for each letter |
184 | - foreach($arr as $i => $str) |
|
184 | + foreach ($arr as $i => $str) |
|
185 | 185 | { |
186 | 186 | $im[$i + 1] = @imagecreate($w, $h); |
187 | 187 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $ran = range(1, 20); |
192 | 192 | shuffle($ran); |
193 | 193 | |
194 | - if(function_exists('imagerotate')) |
|
194 | + if (function_exists('imagerotate')) |
|
195 | 195 | { |
196 | 196 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
197 | 197 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // Combine images of each character |
209 | - for($i = 1, $c = count($im); $i<$c; $i++) |
|
209 | + for ($i = 1, $c = count($im); $i < $c; $i++) |
|
210 | 210 | { |
211 | 211 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
212 | 212 | imagedestroy($im[$i]); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
219 | 219 | imagedestroy($im[0]); |
220 | 220 | |
221 | - if(function_exists('imageantialias')) |
|
221 | + if (function_exists('imageantialias')) |
|
222 | 222 | { |
223 | 223 | imageantialias($big, true); |
224 | 224 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $h = $h * $big_count; |
231 | 231 | $d = array_pop($deg); |
232 | 232 | |
233 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
233 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
234 | 234 | { |
235 | 235 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
236 | 236 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $x = range(0, ($w - 10)); |
239 | 239 | shuffle($x); |
240 | 240 | |
241 | - for($i = 0; $i < 200; $i++) |
|
241 | + for ($i = 0; $i < 200; $i++) |
|
242 | 242 | { |
243 | 243 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
244 | 244 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | function before_module_init_captchaAudio() |
250 | 250 | { |
251 | - if($_SESSION['captcha_authed']) |
|
251 | + if ($_SESSION['captcha_authed']) |
|
252 | 252 | { |
253 | 253 | return false; |
254 | 254 | } |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
261 | 261 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
262 | 262 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
263 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
264 | - header('Content-Length: ' . strlen($data)); |
|
263 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
264 | + header('Content-Length: '.strlen($data)); |
|
265 | 265 | |
266 | 266 | echo $data; |
267 | 267 | Context::close(); |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | { |
273 | 273 | $data = ''; |
274 | 274 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
275 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
275 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
276 | 276 | { |
277 | 277 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
278 | 278 | |
279 | 279 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
280 | 280 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
281 | 281 | |
282 | - for($j = $start; $j < $datalen; $j+=64) |
|
282 | + for ($j = $start; $j < $datalen; $j += 64) |
|
283 | 283 | { |
284 | 284 | $ch = ord($_data{$j}); |
285 | - if($ch < 9 || $ch > 119) |
|
285 | + if ($ch < 9 || $ch > 119) |
|
286 | 286 | { |
287 | 287 | continue; |
288 | 288 | } |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | |
298 | 298 | function compareCaptcha() |
299 | 299 | { |
300 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
300 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
301 | 301 | |
302 | - if($_SESSION['captcha_authed']) |
|
302 | + if ($_SESSION['captcha_authed']) |
|
303 | 303 | { |
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
307 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
308 | 308 | { |
309 | 309 | $_SESSION['captcha_authed'] = true; |
310 | 310 | return true; |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | |
318 | 318 | function before_module_init_captchaCompare() |
319 | 319 | { |
320 | - if(!$this->compareCaptcha()) |
|
320 | + if (!$this->compareCaptcha()) |
|
321 | 321 | { |
322 | 322 | return false; |
323 | 323 | } |
324 | 324 | |
325 | 325 | header("Content-Type: text/xml; charset=UTF-8"); |
326 | 326 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
327 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
327 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
328 | 328 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
329 | 329 | header("Cache-Control: post-check=0, pre-check=0", false); |
330 | 330 | header("Pragma: no-cache"); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | unset($_SESSION['captcha_authed']); |
340 | 340 | $this->createKeyword(); |
341 | 341 | |
342 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
342 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
343 | 343 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
344 | 344 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
345 | 345 | |
@@ -377,18 +377,18 @@ discard block |
||
377 | 377 | |
378 | 378 | $oAddonCaptcha = &$GLOBALS['__AddonCaptcha__']; |
379 | 379 | |
380 | -if(method_exists($oAddonCaptcha, $called_position)) |
|
380 | +if (method_exists($oAddonCaptcha, $called_position)) |
|
381 | 381 | { |
382 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
382 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position), array(&$this))) |
|
383 | 383 | { |
384 | 384 | return false; |
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | 388 | $addon_act = Context::get('captcha_action'); |
389 | -if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) |
|
389 | +if ($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act)) |
|
390 | 390 | { |
391 | - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
391 | + if (!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
392 | 392 | { |
393 | 393 | return false; |
394 | 394 | } |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -67,8 +69,7 @@ discard block |
||
67 | 69 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
68 | 70 | $ModuleHandler->_setInputValueToSession(); |
69 | 71 | } |
70 | - } |
|
71 | - else |
|
72 | + } else |
|
72 | 73 | { |
73 | 74 | Context::addHtmlHeader('<script> |
74 | 75 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -198,8 +199,7 @@ discard block |
||
198 | 199 | |
199 | 200 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
200 | 201 | imagecolortransparent($im[$i + 1], $background_color); |
201 | - } |
|
202 | - else |
|
202 | + } else |
|
203 | 203 | { |
204 | 204 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
205 | 205 | } |
@@ -297,7 +297,9 @@ discard block |
||
297 | 297 | |
298 | 298 | function compareCaptcha() |
299 | 299 | { |
300 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
300 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
301 | + return true; |
|
302 | + } |
|
301 | 303 | |
302 | 304 | if($_SESSION['captcha_authed']) |
303 | 305 | { |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | { |
6 | 6 | exit(); |
7 | 7 | } |
8 | 8 | |
9 | -if($called_position == 'after_module_proc' && Context::getResponseMethod() == 'HTML') |
|
9 | +if ($called_position == 'after_module_proc' && Context::getResponseMethod() == 'HTML') |
|
10 | 10 | { |
11 | 11 | Context::loadFile('./addons/oembed/jquery.oembed.css'); |
12 | 12 | Context::loadFile(array('./addons/oembed/jquery.oembed.js', 'body', '', null), true); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @file config/config.inc.php |
8 | 8 | * @author XEHub ([email protected]) |
9 | 9 | */ |
10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
11 | 11 | { |
12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
17 | 17 | } |
18 | 18 | |
19 | -if(!defined('__XE__')) |
|
19 | +if (!defined('__XE__')) |
|
20 | 20 | { |
21 | 21 | exit(); |
22 | 22 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | // Set can use other method instead cookie to store session id(for file upload) |
53 | 53 | ini_set('session.use_only_cookies', 0); |
54 | 54 | |
55 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
55 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
56 | 56 | { |
57 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
57 | + require _XE_PATH_.'config/package.inc.php'; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
97 | 97 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
98 | 98 | */ |
99 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
99 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
100 | 100 | { |
101 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
101 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
102 | 102 | } |
103 | 103 | |
104 | -if(!defined('__DEBUG__')) |
|
104 | +if (!defined('__DEBUG__')) |
|
105 | 105 | { |
106 | 106 | /** |
107 | 107 | * output debug message(bit value) |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | define('__DEBUG__', 0); |
117 | 117 | } |
118 | 118 | |
119 | -if(!defined('__DEBUG_OUTPUT__')) |
|
119 | +if (!defined('__DEBUG_OUTPUT__')) |
|
120 | 120 | { |
121 | 121 | /** |
122 | 122 | * output location of debug message |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | define('__DEBUG_OUTPUT__', 0); |
131 | 131 | } |
132 | 132 | |
133 | -if(!defined('__DEBUG_PROTECT__')) |
|
133 | +if (!defined('__DEBUG_PROTECT__')) |
|
134 | 134 | { |
135 | 135 | /** |
136 | 136 | * output comments of the firePHP console and browser |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | define('__DEBUG_PROTECT__', 1); |
144 | 144 | } |
145 | 145 | |
146 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
146 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
147 | 147 | { |
148 | 148 | /** |
149 | 149 | * Set a ip address to allow debug |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
152 | 152 | } |
153 | 153 | |
154 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
154 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
155 | 155 | { |
156 | 156 | /** |
157 | 157 | * DB error message definition |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | define('__DEBUG_DB_OUTPUT__', 0); |
165 | 165 | } |
166 | 166 | |
167 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
167 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
168 | 168 | { |
169 | 169 | /** |
170 | 170 | * Query log for only timeout query among DB queries |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | define('__LOG_SLOW_QUERY__', 0); |
179 | 179 | } |
180 | 180 | |
181 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
181 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
182 | 182 | { |
183 | 183 | /** |
184 | 184 | * Trigger excute time log |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | define('__LOG_SLOW_TRIGGER__', 0); |
193 | 193 | } |
194 | 194 | |
195 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
195 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
196 | 196 | { |
197 | 197 | /** |
198 | 198 | * Addon excute time log |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | define('__LOG_SLOW_ADDON__', 0); |
207 | 207 | } |
208 | 208 | |
209 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
209 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
210 | 210 | { |
211 | 211 | /** |
212 | 212 | * Widget excute time log |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | define('__LOG_SLOW_WIDGET__', 0); |
221 | 221 | } |
222 | 222 | |
223 | -if(!defined('__DEBUG_QUERY__')) |
|
223 | +if (!defined('__DEBUG_QUERY__')) |
|
224 | 224 | { |
225 | 225 | /** |
226 | 226 | * Leave DB query information |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | define('__DEBUG_QUERY__', 0); |
234 | 234 | } |
235 | 235 | |
236 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
236 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
237 | 237 | { |
238 | 238 | /** |
239 | 239 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | define('__OB_GZHANDLER_ENABLE__', 1); |
248 | 248 | } |
249 | 249 | |
250 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
250 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
251 | 251 | { |
252 | 252 | /** |
253 | 253 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | define('__ENABLE_PHPUNIT_TEST__', 0); |
261 | 261 | } |
262 | 262 | |
263 | -if(!defined('__PROXY_SERVER__')) |
|
263 | +if (!defined('__PROXY_SERVER__')) |
|
264 | 264 | { |
265 | 265 | /** |
266 | 266 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | define('__PROXY_SERVER__', NULL); |
270 | 270 | } |
271 | 271 | |
272 | -if(!defined('__ERROR_LOG__')) |
|
272 | +if (!defined('__ERROR_LOG__')) |
|
273 | 273 | { |
274 | 274 | /** |
275 | 275 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | define('__ERROR_LOG__', 0); |
281 | 281 | } |
282 | 282 | |
283 | -if(!defined('__DISABLE_DEFAULT_CSS__')) |
|
283 | +if (!defined('__DISABLE_DEFAULT_CSS__')) |
|
284 | 284 | { |
285 | 285 | /** |
286 | 286 | * XE의 기본 CSS 스타일을 로드하지 않도록 합니다. |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | define('__DISABLE_DEFAULT_CSS__', 0); |
296 | 296 | } |
297 | 297 | |
298 | -if(!defined('__AUTO_OPCACHE_INVALIDATE__')) |
|
298 | +if (!defined('__AUTO_OPCACHE_INVALIDATE__')) |
|
299 | 299 | { |
300 | 300 | /** |
301 | 301 | * 업데이트 시 주요 파일의 OPcache를 자동 초기화 옵션 |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | // Require specific files when using Firebug console output |
313 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
313 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
314 | 314 | { |
315 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
315 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | // Set Timezone as server time |
319 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
319 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
320 | 320 | { |
321 | 321 | date_default_timezone_set(@date_default_timezone_get()); |
322 | 322 | } |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | * Invalidates a cached script of OPcache when version is changed. |
423 | 423 | * @see https://github.com/xpressengine/xe-core/issues/2189 |
424 | 424 | **/ |
425 | -$cache_path = _XE_PATH_ . 'files/cache/store/' . __XE_VERSION__; |
|
426 | -if( |
|
425 | +$cache_path = _XE_PATH_.'files/cache/store/'.__XE_VERSION__; |
|
426 | +if ( |
|
427 | 427 | __AUTO_OPCACHE_INVALIDATE__ === 1 |
428 | 428 | && !is_dir($cache_path) |
429 | 429 | && function_exists('opcache_get_status') |
@@ -433,62 +433,62 @@ discard block |
||
433 | 433 | @mkdir($cache_path, 0755, TRUE); |
434 | 434 | @chmod($cache_path, 0755); |
435 | 435 | |
436 | - foreach($GLOBALS['__xe_autoload_file_map'] as $script) { |
|
437 | - opcache_invalidate(_XE_PATH_ . $script, true); |
|
436 | + foreach ($GLOBALS['__xe_autoload_file_map'] as $script) { |
|
437 | + opcache_invalidate(_XE_PATH_.$script, true); |
|
438 | 438 | } |
439 | - opcache_invalidate(_XE_PATH_ . 'config/func.inc.php', true); |
|
439 | + opcache_invalidate(_XE_PATH_.'config/func.inc.php', true); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // Require a function-defined-file for simple use |
443 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
443 | +require(_XE_PATH_.'config/func.inc.php'); |
|
444 | 444 | |
445 | -if(__DEBUG__) { |
|
445 | +if (__DEBUG__) { |
|
446 | 446 | define('__StartTime__', getMicroTime()); |
447 | 447 | } |
448 | 448 | |
449 | -if(__DEBUG__) { |
|
449 | +if (__DEBUG__) { |
|
450 | 450 | $GLOBALS['__elapsed_class_load__'] = 0; |
451 | 451 | } |
452 | 452 | |
453 | 453 | function __xe_autoload($class_name) |
454 | 454 | { |
455 | - if(__DEBUG__) { |
|
455 | + if (__DEBUG__) { |
|
456 | 456 | $time_at = getMicroTime(); |
457 | 457 | } |
458 | 458 | |
459 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
459 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
460 | 460 | { |
461 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
461 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
462 | 462 | } |
463 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
463 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
464 | 464 | { |
465 | 465 | $candidate_filename = array(); |
466 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
467 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
466 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
467 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
468 | 468 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
469 | 469 | $candidate_filename[] = 'php'; |
470 | 470 | |
471 | 471 | $candidate_filename = implode('.', $candidate_filename); |
472 | 472 | |
473 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
473 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
474 | 474 | { |
475 | - require _XE_PATH_ . $candidate_filename; |
|
475 | + require _XE_PATH_.$candidate_filename; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | - if(__DEBUG__) { |
|
479 | + if (__DEBUG__) { |
|
480 | 480 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
481 | 481 | } |
482 | 482 | } |
483 | 483 | spl_autoload_register('__xe_autoload'); |
484 | 484 | |
485 | -if(version_compare(PHP_VERSION, '7.2', '<')) |
|
485 | +if (version_compare(PHP_VERSION, '7.2', '<')) |
|
486 | 486 | { |
487 | 487 | class_alias('BaseObject', 'Object', true); |
488 | 488 | } |
489 | 489 | |
490 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
491 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
490 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
491 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
492 | 492 | } |
493 | 493 | /* End of file config.inc.php */ |
494 | 494 | /* Location: ./config/config.inc.php */ |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author XEHub ([email protected]) |
8 | 8 | */ |
9 | -if(!defined('__XE__')) |
|
9 | +if (!defined('__XE__')) |
|
10 | 10 | { |
11 | 11 | exit(); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
15 | -if(!function_exists('iconv')) |
|
15 | +if (!function_exists('iconv')) |
|
16 | 16 | { |
17 | 17 | eval(' |
18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $oDB = DB::getInstance(); |
222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
224 | 224 | { |
225 | 225 | $output->data = array($output->data); |
226 | 226 | } |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | function setUserSequence($seq) |
251 | 251 | { |
252 | 252 | $arr_seq = array(); |
253 | - if(isset($_SESSION['seq'])) |
|
253 | + if (isset($_SESSION['seq'])) |
|
254 | 254 | { |
255 | - if(!is_array($_SESSION['seq'])) { |
|
255 | + if (!is_array($_SESSION['seq'])) { |
|
256 | 256 | $_SESSION['seq'] = array($_SESSION['seq']); |
257 | 257 | } |
258 | 258 | $arr_seq = $_SESSION['seq']; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function checkUserSequence($seq) |
271 | 271 | { |
272 | - if(!isset($_SESSION['seq'])) |
|
272 | + if (!isset($_SESSION['seq'])) |
|
273 | 273 | { |
274 | 274 | return false; |
275 | 275 | } |
276 | - if(!in_array($seq, $_SESSION['seq'])) |
|
276 | + if (!in_array($seq, $_SESSION['seq'])) |
|
277 | 277 | { |
278 | 278 | return false; |
279 | 279 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $num_args = func_num_args(); |
300 | 300 | $args_list = func_get_args(); |
301 | 301 | |
302 | - if($num_args) |
|
302 | + if ($num_args) |
|
303 | 303 | $url = Context::getUrl($num_args, $args_list); |
304 | 304 | else |
305 | 305 | $url = Context::getRequestUri(); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $num_args = func_num_args(); |
319 | 319 | $args_list = func_get_args(); |
320 | 320 | |
321 | - if($num_args) |
|
321 | + if ($num_args) |
|
322 | 322 | { |
323 | 323 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
324 | 324 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $num_args = func_num_args(); |
342 | 342 | $args_list = func_get_args(); |
343 | 343 | |
344 | - if($num_args) |
|
344 | + if ($num_args) |
|
345 | 345 | { |
346 | 346 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
363 | 363 | $num_args = func_num_args(); |
364 | 364 | $args_list = func_get_args(); |
365 | 365 | $request_uri = Context::getRequestUri(); |
366 | - if(!$num_args) |
|
366 | + if (!$num_args) |
|
367 | 367 | { |
368 | 368 | return $request_uri; |
369 | 369 | } |
370 | 370 | |
371 | 371 | $url = Context::getUrl($num_args, $args_list); |
372 | - if(strncasecmp('http', $url, 4) !== 0) |
|
372 | + if (strncasecmp('http', $url, 4) !== 0) |
|
373 | 373 | { |
374 | 374 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
375 | - return substr($match[0], 0, -1) . $url; |
|
375 | + return substr($match[0], 0, -1).$url; |
|
376 | 376 | } |
377 | 377 | return $url; |
378 | 378 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | $num_args = func_num_args(); |
388 | 388 | $args_list = func_get_args(); |
389 | 389 | $request_uri = Context::getRequestUri(); |
390 | - if(!$num_args) |
|
390 | + if (!$num_args) |
|
391 | 391 | { |
392 | 392 | return $request_uri; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
396 | - if(strncasecmp('http', $url, 4) !== 0) |
|
396 | + if (strncasecmp('http', $url, 4) !== 0) |
|
397 | 397 | { |
398 | 398 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
399 | 399 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
400 | - return substr($match[0], 0, -1) . $url; |
|
400 | + return substr($match[0], 0, -1).$url; |
|
401 | 401 | } |
402 | 402 | return $url; |
403 | 403 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $num_args = func_num_args(); |
414 | 414 | $args_list = func_get_args(); |
415 | 415 | |
416 | - if(!$num_args) |
|
416 | + if (!$num_args) |
|
417 | 417 | { |
418 | 418 | return Context::getRequestUri(); |
419 | 419 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $num_args = func_num_args(); |
436 | 436 | $args_list = func_get_args(); |
437 | 437 | |
438 | - if(!$num_args) |
|
438 | + if (!$num_args) |
|
439 | 439 | { |
440 | 440 | return Context::getRequestUri(); |
441 | 441 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $args_list = func_get_args(); |
458 | 458 | |
459 | 459 | $request_uri = Context::getRequestUri(); |
460 | - if(!$num_args) |
|
460 | + if (!$num_args) |
|
461 | 461 | { |
462 | 462 | return $request_uri; |
463 | 463 | } |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $num_args = count($args_list); |
467 | 467 | |
468 | 468 | $url = Context::getUrl($num_args, $args_list, $domain); |
469 | - if(strncasecmp('http', $url, 4) !== 0) |
|
469 | + if (strncasecmp('http', $url, 4) !== 0) |
|
470 | 470 | { |
471 | 471 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
472 | - return substr($match[0], 0, -1) . $url; |
|
472 | + return substr($match[0], 0, -1).$url; |
|
473 | 473 | } |
474 | 474 | return $url; |
475 | 475 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | function getCurrentPageUrl() |
483 | 483 | { |
484 | 484 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
485 | - $url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
485 | + $url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
486 | 486 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
487 | 487 | } |
488 | 488 | |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function cut_str($string, $cut_size = 0, $tail = '...') |
509 | 509 | { |
510 | - if($cut_size < 1 || !$string) |
|
510 | + if ($cut_size < 1 || !$string) |
|
511 | 511 | { |
512 | 512 | return $string; |
513 | 513 | } |
514 | 514 | |
515 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
515 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
516 | 516 | { |
517 | 517 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
518 | 518 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -526,16 +526,16 @@ discard block |
||
526 | 526 | $char_count = 0; |
527 | 527 | |
528 | 528 | $idx = 0; |
529 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
529 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
530 | 530 | { |
531 | 531 | $c = ord(substr($string, $idx, 1)); |
532 | 532 | $char_count++; |
533 | - if($c < 128) |
|
533 | + if ($c < 128) |
|
534 | 534 | { |
535 | 535 | $char_width += (int) $chars[$c - 32]; |
536 | 536 | $idx++; |
537 | 537 | } |
538 | - else if(191 < $c && $c < 224) |
|
538 | + else if (191 < $c && $c < 224) |
|
539 | 539 | { |
540 | 540 | $char_width += $chars[4]; |
541 | 541 | $idx += 2; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | $output = substr($string, 0, $idx); |
551 | - if(strlen($output) < $string_length) |
|
551 | + if (strlen($output) < $string_length) |
|
552 | 552 | { |
553 | 553 | $output .= $tail; |
554 | 554 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | function zgap() |
565 | 565 | { |
566 | 566 | $time_zone = $GLOBALS['_time_zone']; |
567 | - if($time_zone < 0) |
|
567 | + if ($time_zone < 0) |
|
568 | 568 | { |
569 | 569 | $to = -1; |
570 | 570 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $t_min = substr($time_zone, 3, 2) * $to; |
578 | 578 | |
579 | 579 | $server_time_zone = date("O"); |
580 | - if($server_time_zone < 0) |
|
580 | + if ($server_time_zone < 0) |
|
581 | 581 | { |
582 | 582 | $so = -1; |
583 | 583 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | function ztime($str) |
606 | 606 | { |
607 | - if(!$str) |
|
607 | + if (!$str) |
|
608 | 608 | { |
609 | 609 | return; |
610 | 610 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $year = (int) substr($str, 0, 4); |
620 | 620 | $month = (int) substr($str, 4, 2); |
621 | 621 | $day = (int) substr($str, 6, 2); |
622 | - if(strlen($str) <= 8) |
|
622 | + if (strlen($str) <= 8) |
|
623 | 623 | { |
624 | 624 | $gap = 0; |
625 | 625 | } |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
644 | 644 | |
645 | 645 | $lang_time_gap = Context::getLang('time_gap'); |
646 | - if($gap < 60) |
|
646 | + if ($gap < 60) |
|
647 | 647 | { |
648 | 648 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
649 | 649 | } |
650 | - elseif($gap < 60 * 60) |
|
650 | + elseif ($gap < 60 * 60) |
|
651 | 651 | { |
652 | 652 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
653 | 653 | } |
654 | - elseif($gap < 60 * 60 * 2) |
|
654 | + elseif ($gap < 60 * 60 * 2) |
|
655 | 655 | { |
656 | 656 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
657 | 657 | } |
658 | - elseif($gap < 60 * 60 * 24) |
|
658 | + elseif ($gap < 60 * 60 * 24) |
|
659 | 659 | { |
660 | 660 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
661 | 661 | } |
@@ -692,40 +692,40 @@ discard block |
||
692 | 692 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
693 | 693 | { |
694 | 694 | // return null if no target time is specified |
695 | - if(!$str) |
|
695 | + if (!$str) |
|
696 | 696 | { |
697 | 697 | return; |
698 | 698 | } |
699 | 699 | // convert the date format according to the language |
700 | - if($conversion == TRUE) |
|
700 | + if ($conversion == TRUE) |
|
701 | 701 | { |
702 | - switch(Context::getLangType()) |
|
702 | + switch (Context::getLangType()) |
|
703 | 703 | { |
704 | 704 | case 'en' : |
705 | 705 | case 'es' : |
706 | - if($format == 'Y-m-d') |
|
706 | + if ($format == 'Y-m-d') |
|
707 | 707 | { |
708 | 708 | $format = 'M d, Y'; |
709 | 709 | } |
710 | - elseif($format == 'Y-m-d H:i:s') |
|
710 | + elseif ($format == 'Y-m-d H:i:s') |
|
711 | 711 | { |
712 | 712 | $format = 'M d, Y H:i:s'; |
713 | 713 | } |
714 | - elseif($format == 'Y-m-d H:i') |
|
714 | + elseif ($format == 'Y-m-d H:i') |
|
715 | 715 | { |
716 | 716 | $format = 'M d, Y H:i'; |
717 | 717 | } |
718 | 718 | break; |
719 | 719 | case 'vi' : |
720 | - if($format == 'Y-m-d') |
|
720 | + if ($format == 'Y-m-d') |
|
721 | 721 | { |
722 | 722 | $format = 'd-m-Y'; |
723 | 723 | } |
724 | - elseif($format == 'Y-m-d H:i:s') |
|
724 | + elseif ($format == 'Y-m-d H:i:s') |
|
725 | 725 | { |
726 | 726 | $format = 'H:i:s d-m-Y'; |
727 | 727 | } |
728 | - elseif($format == 'Y-m-d H:i') |
|
728 | + elseif ($format == 'Y-m-d H:i') |
|
729 | 729 | { |
730 | 730 | $format = 'H:i d-m-Y'; |
731 | 731 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | |
736 | 736 | // If year value is less than 1970, handle it separately. |
737 | - if((int) substr($str, 0, 4) < 1970) |
|
737 | + if ((int) substr($str, 0, 4) < 1970) |
|
738 | 738 | { |
739 | 739 | $hour = (int) substr($str, 8, 2); |
740 | 740 | $min = (int) substr($str, 10, 2); |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | function getEncodeEmailAddress($email) |
785 | 785 | { |
786 | 786 | $return = ''; |
787 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
787 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
788 | 788 | { |
789 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
789 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
790 | 790 | } |
791 | 791 | return $return; |
792 | 792 | } |
@@ -806,25 +806,25 @@ discard block |
||
806 | 806 | { |
807 | 807 | static $debug_file; |
808 | 808 | |
809 | - if(!(__DEBUG__ & 1)) |
|
809 | + if (!(__DEBUG__ & 1)) |
|
810 | 810 | { |
811 | 811 | return; |
812 | 812 | } |
813 | 813 | |
814 | 814 | static $firephp; |
815 | 815 | $bt = debug_backtrace(); |
816 | - if(is_array($bt)) |
|
816 | + if (is_array($bt)) |
|
817 | 817 | { |
818 | 818 | $bt_debug_print = array_shift($bt); |
819 | 819 | $bt_called_function = array_shift($bt); |
820 | 820 | } |
821 | 821 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
822 | 822 | $line_num = $bt_debug_print['line']; |
823 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
823 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
824 | 824 | |
825 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
825 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
826 | 826 | { |
827 | - if(!isset($firephp)) |
|
827 | + if (!isset($firephp)) |
|
828 | 828 | { |
829 | 829 | $firephp = FirePHP::getInstance(TRUE); |
830 | 830 | } |
@@ -833,16 +833,16 @@ discard block |
||
833 | 833 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
834 | 834 | |
835 | 835 | // Check a FirePHP option |
836 | - if($display_option === 'TABLE') |
|
836 | + if ($display_option === 'TABLE') |
|
837 | 837 | { |
838 | 838 | $label = $display_option; |
839 | 839 | } |
840 | - if($display_option === 'ERROR') |
|
840 | + if ($display_option === 'ERROR') |
|
841 | 841 | { |
842 | 842 | $type = $display_option; |
843 | 843 | } |
844 | 844 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
845 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
845 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
846 | 846 | { |
847 | 847 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
848 | 848 | $label = NULL; |
@@ -852,52 +852,52 @@ discard block |
||
852 | 852 | } |
853 | 853 | else |
854 | 854 | { |
855 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
855 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
856 | 856 | { |
857 | 857 | return; |
858 | 858 | } |
859 | 859 | |
860 | 860 | $print = array(); |
861 | - if(!$debug_file) |
|
861 | + if (!$debug_file) |
|
862 | 862 | { |
863 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
863 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
864 | 864 | } |
865 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
865 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
866 | 866 | |
867 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
867 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
868 | 868 | { |
869 | - $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; |
|
869 | + $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; |
|
870 | 870 | $print[] = str_repeat('=', 80); |
871 | 871 | } |
872 | 872 | $type = gettype($debug_output); |
873 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
873 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
874 | 874 | { |
875 | - if($display_option === 'ERROR') |
|
875 | + if ($display_option === 'ERROR') |
|
876 | 876 | { |
877 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
877 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
878 | 878 | } |
879 | 879 | else |
880 | 880 | { |
881 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
881 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | else |
885 | 885 | { |
886 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
886 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
887 | 887 | } |
888 | 888 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
889 | 889 | $backtrace = debug_backtrace($backtrace_args); |
890 | 890 | |
891 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
891 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
892 | 892 | { |
893 | 893 | array_shift($backtrace); |
894 | 894 | } |
895 | - foreach($backtrace as $val) |
|
895 | + foreach ($backtrace as $val) |
|
896 | 896 | { |
897 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
897 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
898 | 898 | } |
899 | 899 | $print[] = PHP_EOL; |
900 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
900 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | */ |
909 | 909 | function writeSlowlog($type, $elapsed_time, $obj) |
910 | 910 | { |
911 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
911 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
912 | 912 | |
913 | 913 | static $log_filename = array( |
914 | 914 | 'query' => 'files/_slowlog_query.php', |
@@ -918,47 +918,47 @@ discard block |
||
918 | 918 | ); |
919 | 919 | $write_file = true; |
920 | 920 | |
921 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
921 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
922 | 922 | |
923 | 923 | $buff = array(); |
924 | 924 | $buff[] = '<?php exit(); ?>'; |
925 | 925 | $buff[] = date('c'); |
926 | 926 | |
927 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
927 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
928 | 928 | { |
929 | - $buff[] = "\tCaller : " . $obj->caller; |
|
930 | - $buff[] = "\tCalled : " . $obj->called; |
|
929 | + $buff[] = "\tCaller : ".$obj->caller; |
|
930 | + $buff[] = "\tCalled : ".$obj->called; |
|
931 | 931 | } |
932 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
932 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
933 | 933 | { |
934 | - $buff[] = "\tAddon : " . $obj->called; |
|
935 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
934 | + $buff[] = "\tAddon : ".$obj->called; |
|
935 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
936 | 936 | } |
937 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
937 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
938 | 938 | { |
939 | - $buff[] = "\tWidget : " . $obj->called; |
|
939 | + $buff[] = "\tWidget : ".$obj->called; |
|
940 | 940 | } |
941 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
941 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
942 | 942 | { |
943 | 943 | |
944 | 944 | $buff[] = $obj->query; |
945 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
946 | - $buff[] = "\tCaller : " . $obj->caller; |
|
947 | - $buff[] = "\tConnection : " . $obj->connection; |
|
945 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
946 | + $buff[] = "\tCaller : ".$obj->caller; |
|
947 | + $buff[] = "\tConnection : ".$obj->connection; |
|
948 | 948 | } |
949 | 949 | else |
950 | 950 | { |
951 | 951 | $write_file = false; |
952 | 952 | } |
953 | 953 | |
954 | - if($write_file) |
|
954 | + if ($write_file) |
|
955 | 955 | { |
956 | 956 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
957 | - $buff[] = PHP_EOL . PHP_EOL; |
|
957 | + $buff[] = PHP_EOL.PHP_EOL; |
|
958 | 958 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
959 | 959 | } |
960 | 960 | |
961 | - if($type != 'query') |
|
961 | + if ($type != 'query') |
|
962 | 962 | { |
963 | 963 | $trigger_args = $obj; |
964 | 964 | $trigger_args->_log_type = $type; |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | */ |
999 | 999 | function delObjectVars($target_obj, $del_obj) |
1000 | 1000 | { |
1001 | - if(!is_object($target_obj)) |
|
1001 | + if (!is_object($target_obj)) |
|
1002 | 1002 | { |
1003 | 1003 | return; |
1004 | 1004 | } |
1005 | - if(!is_object($del_obj)) |
|
1005 | + if (!is_object($del_obj)) |
|
1006 | 1006 | { |
1007 | 1007 | return; |
1008 | 1008 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | $target = array_keys($target_vars); |
1014 | 1014 | $del = array_keys($del_vars); |
1015 | - if(!count($target) || !count($del)) |
|
1015 | + if (!count($target) || !count($del)) |
|
1016 | 1016 | { |
1017 | 1017 | return $target_obj; |
1018 | 1018 | } |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | $return_obj = new stdClass(); |
1021 | 1021 | |
1022 | 1022 | $target_count = count($target); |
1023 | - for($i = 0; $i < $target_count; $i++) |
|
1023 | + for ($i = 0; $i < $target_count; $i++) |
|
1024 | 1024 | { |
1025 | 1025 | $target_key = $target[$i]; |
1026 | - if(!in_array($target_key, $del)) |
|
1026 | + if (!in_array($target_key, $del)) |
|
1027 | 1027 | { |
1028 | 1028 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
1029 | 1029 | } |
@@ -1036,10 +1036,10 @@ discard block |
||
1036 | 1036 | { |
1037 | 1037 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
1038 | 1038 | |
1039 | - foreach($del_vars as $var) |
|
1039 | + foreach ($del_vars as $var) |
|
1040 | 1040 | { |
1041 | - if(is_array($vars)) unset($vars[$var]); |
|
1042 | - else if(is_object($vars)) unset($vars->$var); |
|
1041 | + if (is_array($vars)) unset($vars[$var]); |
|
1042 | + else if (is_object($vars)) unset($vars->$var); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | return $vars; |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | */ |
1057 | 1057 | function handleError($errno, $errstr, $file, $line) |
1058 | 1058 | { |
1059 | - if(!__DEBUG__) |
|
1059 | + if (!__DEBUG__) |
|
1060 | 1060 | { |
1061 | 1061 | return; |
1062 | 1062 | } |
1063 | 1063 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
1064 | - if(!in_array($errno, $errors)) |
|
1064 | + if (!in_array($errno, $errors)) |
|
1065 | 1065 | { |
1066 | 1066 | return; |
1067 | 1067 | } |
@@ -1081,8 +1081,8 @@ discard block |
||
1081 | 1081 | function getNumberingPath($no, $size = 3) |
1082 | 1082 | { |
1083 | 1083 | $mod = pow(10, $size); |
1084 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
1085 | - if($no >= $mod) |
|
1084 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
1085 | + if ($no >= $mod) |
|
1086 | 1086 | { |
1087 | 1087 | $output .= getNumberingPath((int) $no / $mod, $size); |
1088 | 1088 | } |
@@ -1102,12 +1102,12 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | function purifierHtml(&$content) |
1104 | 1104 | { |
1105 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
1105 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
1106 | 1106 | $oPurifier = Purifier::getInstance(); |
1107 | 1107 | |
1108 | 1108 | // @see https://github.com/xpressengine/xe-core/issues/2278 |
1109 | 1109 | $logged_info = Context::get('logged_info'); |
1110 | - if($logged_info->is_admin !== 'Y') { |
|
1110 | + if ($logged_info->is_admin !== 'Y') { |
|
1111 | 1111 | $oPurifier->setConfig('HTML.Nofollow', true); |
1112 | 1112 | } |
1113 | 1113 | |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | function removeHackTag($content) |
1124 | 1124 | { |
1125 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
1125 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
1126 | 1126 | $oEmbedFilter = EmbedFilter::getInstance(); |
1127 | 1127 | $oEmbedFilter->check($content); |
1128 | 1128 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | function checkUploadedFile($file, $filename = null) |
1166 | 1166 | { |
1167 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
1167 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
1168 | 1168 | return UploadFileFilter::check($file, $filename); |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,13 +1178,13 @@ discard block |
||
1178 | 1178 | { |
1179 | 1179 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
1180 | 1180 | |
1181 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1181 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1182 | 1182 | { |
1183 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1183 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1184 | 1184 | { |
1185 | 1185 | $content .= '</xmp>'; |
1186 | 1186 | } |
1187 | - else if($close_xmp < $start_xmp) |
|
1187 | + else if ($close_xmp < $start_xmp) |
|
1188 | 1188 | { |
1189 | 1189 | $content .= '</xmp>'; |
1190 | 1190 | } |
@@ -1204,33 +1204,33 @@ discard block |
||
1204 | 1204 | $tag = strtolower($match[2]); |
1205 | 1205 | |
1206 | 1206 | // xmp tag ?뺣━ |
1207 | - if($tag == 'xmp') |
|
1207 | + if ($tag == 'xmp') |
|
1208 | 1208 | { |
1209 | 1209 | return "<{$match[1]}xmp>"; |
1210 | 1210 | } |
1211 | - if($match[1]) |
|
1211 | + if ($match[1]) |
|
1212 | 1212 | { |
1213 | 1213 | return $match[0]; |
1214 | 1214 | } |
1215 | - if($match[4]) |
|
1215 | + if ($match[4]) |
|
1216 | 1216 | { |
1217 | - $match[4] = ' ' . $match[4]; |
|
1217 | + $match[4] = ' '.$match[4]; |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | $attrs = array(); |
1221 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1221 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1222 | 1222 | { |
1223 | - foreach($m[1] as $idx => $name) |
|
1223 | + foreach ($m[1] as $idx => $name) |
|
1224 | 1224 | { |
1225 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1225 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1226 | 1226 | { |
1227 | 1227 | continue; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
1230 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
1231 | 1231 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
1232 | 1232 | |
1233 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
1233 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
1234 | 1234 | { |
1235 | 1235 | continue; |
1236 | 1236 | } |
@@ -1241,60 +1241,60 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | $filter_arrts = array('style', 'src', 'href'); |
1243 | 1243 | |
1244 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1245 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1244 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
1245 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
1246 | 1246 | |
1247 | - foreach($filter_arrts as $attr) |
|
1247 | + foreach ($filter_arrts as $attr) |
|
1248 | 1248 | { |
1249 | - if(!isset($attrs[$attr])) continue; |
|
1249 | + if (!isset($attrs[$attr])) continue; |
|
1250 | 1250 | |
1251 | 1251 | $attr_value = rawurldecode($attrs[$attr]); |
1252 | 1252 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
1253 | 1253 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
1254 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1254 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1255 | 1255 | { |
1256 | 1256 | unset($attrs[$attr]); |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1260 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1261 | 1261 | { |
1262 | 1262 | unset($attrs['style']); |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | $attr = array(); |
1266 | - foreach($attrs as $name => $val) |
|
1266 | + foreach ($attrs as $name => $val) |
|
1267 | 1267 | { |
1268 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1268 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1269 | 1269 | { |
1270 | 1270 | $attribute = strtolower(trim($name)); |
1271 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1271 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1272 | 1272 | { |
1273 | - if(stripos($val, 'data:') === 0) |
|
1273 | + if (stripos($val, 'data:') === 0) |
|
1274 | 1274 | { |
1275 | 1275 | continue; |
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | |
1280 | - if($tag == 'img') |
|
1280 | + if ($tag == 'img') |
|
1281 | 1281 | { |
1282 | 1282 | $attribute = strtolower(trim($name)); |
1283 | - if(stripos($val, 'data:') === 0) |
|
1283 | + if (stripos($val, 'data:') === 0) |
|
1284 | 1284 | { |
1285 | 1285 | continue; |
1286 | 1286 | } |
1287 | 1287 | } |
1288 | 1288 | $val = str_replace('"', '"', $val); |
1289 | - $attr[] = $name . "=\"{$val}\""; |
|
1289 | + $attr[] = $name."=\"{$val}\""; |
|
1290 | 1290 | } |
1291 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
1291 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
1292 | 1292 | |
1293 | 1293 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | // convert hexa value to RGB |
1297 | -if(!function_exists('hexrgb')) |
|
1297 | +if (!function_exists('hexrgb')) |
|
1298 | 1298 | { |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1330,9 +1330,9 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | settype($password, "string"); |
1332 | 1332 | |
1333 | - for($i = 0; $i < strlen($password); $i++) |
|
1333 | + for ($i = 0; $i < strlen($password); $i++) |
|
1334 | 1334 | { |
1335 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
1335 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
1336 | 1336 | { |
1337 | 1337 | continue; |
1338 | 1338 | } |
@@ -1344,11 +1344,11 @@ discard block |
||
1344 | 1344 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
1345 | 1345 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
1346 | 1346 | |
1347 | - if($result1 == '80000000') |
|
1347 | + if ($result1 == '80000000') |
|
1348 | 1348 | { |
1349 | 1349 | $nr += 0x80000000; |
1350 | 1350 | } |
1351 | - if($result2 == '80000000') |
|
1351 | + if ($result2 == '80000000') |
|
1352 | 1352 | { |
1353 | 1353 | $nr2 += 0x80000000; |
1354 | 1354 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | function getScriptPath() |
1365 | 1365 | { |
1366 | 1366 | static $url = NULL; |
1367 | - if($url == NULL) |
|
1367 | + if ($url == NULL) |
|
1368 | 1368 | { |
1369 | 1369 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
1370 | 1370 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1395,14 +1395,14 @@ discard block |
||
1395 | 1395 | $decodedStr = ''; |
1396 | 1396 | $pos = 0; |
1397 | 1397 | $len = strlen($source); |
1398 | - while($pos < $len) |
|
1398 | + while ($pos < $len) |
|
1399 | 1399 | { |
1400 | 1400 | $charAt = substr($source, $pos, 1); |
1401 | - if($charAt == '%') |
|
1401 | + if ($charAt == '%') |
|
1402 | 1402 | { |
1403 | 1403 | $pos++; |
1404 | 1404 | $charAt = substr($source, $pos, 1); |
1405 | - if($charAt == 'u') |
|
1405 | + if ($charAt == 'u') |
|
1406 | 1406 | { |
1407 | 1407 | // we got a unicode character |
1408 | 1408 | $pos++; |
@@ -1436,21 +1436,21 @@ discard block |
||
1436 | 1436 | */ |
1437 | 1437 | function _code2utf($num) |
1438 | 1438 | { |
1439 | - if($num < 128) |
|
1439 | + if ($num < 128) |
|
1440 | 1440 | { |
1441 | 1441 | return chr($num); |
1442 | 1442 | } |
1443 | - if($num < 2048) |
|
1443 | + if ($num < 2048) |
|
1444 | 1444 | { |
1445 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1445 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
1446 | 1446 | } |
1447 | - if($num < 65536) |
|
1447 | + if ($num < 65536) |
|
1448 | 1448 | { |
1449 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1449 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1450 | 1450 | } |
1451 | - if($num < 2097152) |
|
1451 | + if ($num < 2097152) |
|
1452 | 1452 | { |
1453 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1453 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1454 | 1454 | } |
1455 | 1455 | return ''; |
1456 | 1456 | } |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | */ |
1466 | 1466 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
1467 | 1467 | { |
1468 | - if($urldecode) |
|
1468 | + if ($urldecode) |
|
1469 | 1469 | { |
1470 | 1470 | $string = urldecode($string); |
1471 | 1471 | } |
@@ -1473,12 +1473,12 @@ discard block |
||
1473 | 1473 | $sample = iconv('utf-8', 'utf-8', $string); |
1474 | 1474 | $is_utf8 = (md5($sample) === md5($string)); |
1475 | 1475 | |
1476 | - if(!$urldecode) |
|
1476 | + if (!$urldecode) |
|
1477 | 1477 | { |
1478 | 1478 | $string = urldecode($string); |
1479 | 1479 | } |
1480 | 1480 | |
1481 | - if($return_convert) |
|
1481 | + if ($return_convert) |
|
1482 | 1482 | { |
1483 | 1483 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
1484 | 1484 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | function json_encode2($data) |
1496 | 1496 | { |
1497 | - switch(gettype($data)) |
|
1497 | + switch (gettype($data)) |
|
1498 | 1498 | { |
1499 | 1499 | case 'boolean': |
1500 | 1500 | return $data ? 'true' : 'false'; |
@@ -1502,15 +1502,15 @@ discard block |
||
1502 | 1502 | case 'double': |
1503 | 1503 | return $data; |
1504 | 1504 | case 'string': |
1505 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
1505 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
1506 | 1506 | case 'object': |
1507 | 1507 | $data = get_object_vars($data); |
1508 | 1508 | case 'array': |
1509 | 1509 | $rel = FALSE; // relative array? |
1510 | 1510 | $key = array_keys($data); |
1511 | - foreach($key as $v) |
|
1511 | + foreach ($key as $v) |
|
1512 | 1512 | { |
1513 | - if(!is_int($v)) |
|
1513 | + if (!is_int($v)) |
|
1514 | 1514 | { |
1515 | 1515 | $rel = TRUE; |
1516 | 1516 | break; |
@@ -1518,12 +1518,12 @@ discard block |
||
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | $arr = array(); |
1521 | - foreach($data as $k => $v) |
|
1521 | + foreach ($data as $k => $v) |
|
1522 | 1522 | { |
1523 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
1523 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
1526 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
1527 | 1527 | default: |
1528 | 1528 | return '""'; |
1529 | 1529 | } |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | */ |
1538 | 1538 | function isCrawler($agent = NULL) |
1539 | 1539 | { |
1540 | - if(!$agent) |
|
1540 | + if (!$agent) |
|
1541 | 1541 | { |
1542 | 1542 | $agent = $_SERVER['HTTP_USER_AGENT']; |
1543 | 1543 | } |
@@ -1547,9 +1547,9 @@ discard block |
||
1547 | 1547 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
1548 | 1548 | ); |
1549 | 1549 | |
1550 | - foreach($check_agent as $str) |
|
1550 | + foreach ($check_agent as $str) |
|
1551 | 1551 | { |
1552 | - if(stristr($agent, $str) != FALSE) |
|
1552 | + if (stristr($agent, $str) != FALSE) |
|
1553 | 1553 | { |
1554 | 1554 | return TRUE; |
1555 | 1555 | } |
@@ -1567,7 +1567,7 @@ discard block |
||
1567 | 1567 | */ |
1568 | 1568 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
1569 | 1569 | { |
1570 | - if(!Context::get('is_logged')) |
|
1570 | + if (!Context::get('is_logged')) |
|
1571 | 1571 | { |
1572 | 1572 | return; |
1573 | 1573 | } |
@@ -1575,18 +1575,18 @@ discard block |
||
1575 | 1575 | $oModuleModel = getModel('module'); |
1576 | 1576 | $logged_info = Context::get('logged_info'); |
1577 | 1577 | |
1578 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1578 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1579 | 1579 | { |
1580 | - if($writer_member_srl) |
|
1580 | + if ($writer_member_srl) |
|
1581 | 1581 | { |
1582 | 1582 | $oMemberModel = getModel('member'); |
1583 | 1583 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
1584 | - if($member_info->is_admin == "Y") |
|
1584 | + if ($member_info->is_admin == "Y") |
|
1585 | 1585 | { |
1586 | 1586 | return; |
1587 | 1587 | } |
1588 | 1588 | } |
1589 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
1589 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
1590 | 1590 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
1591 | 1591 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
1592 | 1592 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1603,18 +1603,18 @@ discard block |
||
1603 | 1603 | function requirePear() |
1604 | 1604 | { |
1605 | 1605 | static $required = false; |
1606 | - if($required) |
|
1606 | + if ($required) |
|
1607 | 1607 | { |
1608 | 1608 | return; |
1609 | 1609 | } |
1610 | 1610 | |
1611 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1611 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1612 | 1612 | { |
1613 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
1613 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
1614 | 1614 | } |
1615 | 1615 | else |
1616 | 1616 | { |
1617 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
1617 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | $required = true; |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | function checkCSRF() |
1624 | 1624 | { |
1625 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1625 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1626 | 1626 | { |
1627 | 1627 | return FALSE; |
1628 | 1628 | } |
@@ -1630,9 +1630,9 @@ discard block |
||
1630 | 1630 | $default_url = Context::getDefaultUrl(); |
1631 | 1631 | $referer = $_SERVER["HTTP_REFERER"]; |
1632 | 1632 | |
1633 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1633 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1634 | 1634 | { |
1635 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1635 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1636 | 1636 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1637 | 1637 | $referer = $IDN->encode($referer); |
1638 | 1638 | } |
@@ -1643,9 +1643,9 @@ discard block |
||
1643 | 1643 | $oModuleModel = getModel('module'); |
1644 | 1644 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
1645 | 1645 | |
1646 | - if($siteModuleInfo->site_srl == 0) |
|
1646 | + if ($siteModuleInfo->site_srl == 0) |
|
1647 | 1647 | { |
1648 | - if($default_url['host'] !== $referer['host']) |
|
1648 | + if ($default_url['host'] !== $referer['host']) |
|
1649 | 1649 | { |
1650 | 1650 | return FALSE; |
1651 | 1651 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | else |
1654 | 1654 | { |
1655 | 1655 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1656 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1656 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1657 | 1657 | { |
1658 | 1658 | return FALSE; |
1659 | 1659 | } |
@@ -1669,15 +1669,15 @@ discard block |
||
1669 | 1669 | */ |
1670 | 1670 | function recurciveExposureCheck(&$menu) |
1671 | 1671 | { |
1672 | - if(is_array($menu)) |
|
1672 | + if (is_array($menu)) |
|
1673 | 1673 | { |
1674 | - foreach($menu AS $key=>$value) |
|
1674 | + foreach ($menu AS $key=>$value) |
|
1675 | 1675 | { |
1676 | - if(!$value['isShow']) |
|
1676 | + if (!$value['isShow']) |
|
1677 | 1677 | { |
1678 | 1678 | unset($menu[$key]); |
1679 | 1679 | } |
1680 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
1680 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
1681 | 1681 | { |
1682 | 1682 | recurciveExposureCheck($menu[$key]['list']); |
1683 | 1683 | } |
@@ -1687,14 +1687,14 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1689 | 1689 | { |
1690 | - if($requestKey != $dbKey) |
|
1690 | + if ($requestKey != $dbKey) |
|
1691 | 1691 | { |
1692 | 1692 | $arrayUrl = parse_url(Context::get('success_return_url')); |
1693 | - if($arrayUrl['query']) |
|
1693 | + if ($arrayUrl['query']) |
|
1694 | 1694 | { |
1695 | 1695 | parse_str($arrayUrl['query'], $parsedStr); |
1696 | 1696 | |
1697 | - if(isset($parsedStr[$key])) |
|
1697 | + if (isset($parsedStr[$key])) |
|
1698 | 1698 | { |
1699 | 1699 | $parsedStr[$key] = $requestKey; |
1700 | 1700 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1737,14 +1737,14 @@ discard block |
||
1737 | 1737 | */ |
1738 | 1738 | function alertScript($msg) |
1739 | 1739 | { |
1740 | - if(!$msg) |
|
1740 | + if (!$msg) |
|
1741 | 1741 | { |
1742 | 1742 | return; |
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | echo '<script type="text/javascript"> |
1746 | 1746 | //<![CDATA[ |
1747 | -alert("' . $msg . '"); |
|
1747 | +alert("' . $msg.'"); |
|
1748 | 1748 | //]]> |
1749 | 1749 | </script>'; |
1750 | 1750 | } |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | |
1776 | 1776 | echo '<script type="text/javascript"> |
1777 | 1777 | //<![CDATA[ |
1778 | -' . $reloadScript . ' |
|
1778 | +' . $reloadScript.' |
|
1779 | 1779 | //]]> |
1780 | 1780 | </script>'; |
1781 | 1781 | } |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | */ |
1799 | 1799 | function escape($str, $double_escape = true, $escape_defined_lang_code = false) |
1800 | 1800 | { |
1801 | - if(!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1801 | + if (!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1802 | 1802 | |
1803 | 1803 | $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
1804 | 1804 | return htmlspecialchars($str, $flags, 'UTF-8', $double_escape); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | function escape_js($str) |
1831 | 1831 | { |
1832 | 1832 | $flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE; |
1833 | - $str = json_encode((string)$str, $flags); |
|
1833 | + $str = json_encode((string) $str, $flags); |
|
1834 | 1834 | return substr($str, 1, strlen($str) - 2); |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1882,12 +1882,12 @@ discard block |
||
1882 | 1882 | { |
1883 | 1883 | if ($limit < 1) $limit = null; |
1884 | 1884 | $result = array(); |
1885 | - $split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); |
|
1885 | + $split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit); |
|
1886 | 1886 | foreach ($split as $piece) |
1887 | 1887 | { |
1888 | 1888 | if (trim($piece) !== '') |
1889 | 1889 | { |
1890 | - $result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece)); |
|
1890 | + $result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece)); |
|
1891 | 1891 | } |
1892 | 1892 | } |
1893 | 1893 | return $result; |