@@ -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('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.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 |
@@ -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,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief Counter add-on |
11 | 11 | */ |
12 | 12 | // Execute if called_position is before_display_content |
13 | -if($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
13 | +if ($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
14 | 14 | { |
15 | 15 | $oCounterController = getController('counter'); |
16 | 16 | $oCounterController->counterExecute(); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file counter.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief admin log |
11 | 11 | */ |
12 | 12 | $logged_info = Context::get('logged_info'); |
13 | -if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
13 | +if ($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
14 | 14 | { |
15 | 15 | $oAdminloggingController = getController('adminlogging'); |
16 | 16 | $oAdminloggingController->insertLog($this->module, $this->act); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file adminlogging.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * Display point level icon before user name when point system is enabled. |
13 | 13 | * */ |
14 | 14 | // return unless before_display_content |
15 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
15 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
16 | 16 | { |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | -require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php'); |
|
20 | +require_once(_XE_PATH_.'addons/point_level_icon/point_level_icon.lib.php'); |
|
21 | 21 | |
22 | 22 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); |
23 | -if($temp_output) |
|
23 | +if ($temp_output) |
|
24 | 24 | { |
25 | 25 | $output = $temp_output; |
26 | 26 | } |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
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.xehub.io> */ |
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.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 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
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.xehub.io> */ |
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.xehub.io> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | { |
6 | 6 | exit(); |
7 | 7 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Just before displaying, change image name/ image mark |
19 | 19 | */ |
20 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
20 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
21 | 21 | { |
22 | 22 | return; |
23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once('./addons/member_extra_info/member_extra_info.lib.php'); |
26 | 26 | // 1. Find a part <div class="member_MemberSerialNumber"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName() |
27 | 27 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output); |
28 | -if($temp_output) |
|
28 | +if ($temp_output) |
|
29 | 29 | { |
30 | 30 | $output = $temp_output; |
31 | 31 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xehub.io> */ |
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); |