@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // Error occurs if already installed |
20 | - if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
20 | + if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
21 | 21 | { |
22 | 22 | $this->stop('msg_already_installed'); |
23 | 23 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function _procDBSetting() |
87 | 87 | { |
88 | 88 | // Get DB-related variables |
89 | - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); |
|
89 | + $con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); |
|
90 | 90 | |
91 | 91 | $db_info = new stdClass(); |
92 | 92 | $db_info->master_db = get_object_vars($con_string); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if (!$output->toBool()) return $output; |
|
105 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
106 | 106 | |
107 | 107 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
108 | + if (!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
109 | 109 | |
110 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
110 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
111 | 111 | { |
112 | 112 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); |
113 | 113 | header('location:'.$returnUrl); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | function procConfigSetting() |
122 | 122 | { |
123 | 123 | // Get variables |
124 | - $config_info = Context::gets('use_rewrite','time_zone'); |
|
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
124 | + $config_info = Context::gets('use_rewrite', 'time_zone'); |
|
125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N'; |
|
126 | 126 | |
127 | 127 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
128 | + if (!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
129 | 129 | |
130 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
130 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
131 | 131 | { |
132 | 132 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); |
133 | 133 | header('location:'.$returnUrl); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | function procInstall() |
142 | 142 | { |
143 | 143 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
144 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
145 | 145 | |
146 | 146 | Context::loadLang('modules/member/lang'); |
147 | 147 | $oMemberModel = getModel('Member'); |
148 | 148 | $vars = Context::getRequestVars(); |
149 | 149 | |
150 | - if(!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
150 | + if (!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
151 | 151 | { |
152 | 152 | Context::loadLang('modules/member/lang'); |
153 | 153 | $message = Context::getLang('about_password_strength'); |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | Context::set('logged_info', $logged_info); |
161 | 161 | |
162 | 162 | // check install config |
163 | - if(Context::get('install_config')) |
|
163 | + if (Context::get('install_config')) |
|
164 | 164 | { |
165 | 165 | $db_info = $this->_makeDbInfoByInstallConfig(); |
166 | 166 | } |
167 | 167 | // install by default XE UI |
168 | 168 | else |
169 | 169 | { |
170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
170 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
171 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Set DB type and information |
@@ -176,30 +176,30 @@ discard block |
||
176 | 176 | // Create DB Instance |
177 | 177 | $oDB = &DB::getInstance(); |
178 | 178 | // Check if available to connect to the DB |
179 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
179 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
180 | 180 | |
181 | 181 | // Install all the modules |
182 | 182 | try { |
183 | 183 | $oDB->begin(); |
184 | 184 | $this->installDownloadedModule(); |
185 | 185 | $oDB->commit(); |
186 | - } catch(Exception $e) { |
|
186 | + } catch (Exception $e) { |
|
187 | 187 | $oDB->rollback(); |
188 | 188 | return new Object(-1, $e->getMessage()); |
189 | 189 | } |
190 | 190 | |
191 | 191 | // Create a config file |
192 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
192 | + if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
193 | 193 | |
194 | 194 | // load script |
195 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
|
196 | - if(count($scripts)>0) |
|
195 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/'); |
|
196 | + if (count($scripts) > 0) |
|
197 | 197 | { |
198 | 198 | sort($scripts); |
199 | - foreach($scripts as $script) |
|
199 | + foreach ($scripts as $script) |
|
200 | 200 | { |
201 | 201 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
202 | - $output = include($script_path . $script); |
|
202 | + $output = include($script_path.$script); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | unset($_SESSION['use_rewrite']); |
214 | 214 | |
215 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
215 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
216 | 216 | { |
217 | 217 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
218 | 218 | header('location:'.$returnUrl); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $db_info->use_rewrite = Context::get('use_rewrite'); |
243 | 243 | $db_info->time_zone = Context::get('time_zone'); |
244 | 244 | |
245 | - if($_SERVER['HTTPS'] == 'on') |
|
245 | + if ($_SERVER['HTTPS'] == 'on') |
|
246 | 246 | { |
247 | 247 | $https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; |
248 | 248 | $https_port = (!$https_port != 443) ? $https_port : null; |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | $http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; |
253 | 253 | $http_port = (!$http_port != 80) ? $http_port : null; |
254 | 254 | } |
255 | - if($http_port) $db_info->http_port = $http_port; |
|
256 | - if($https_port) $db_info->https_port = $https_port; |
|
255 | + if ($http_port) $db_info->http_port = $http_port; |
|
256 | + if ($https_port) $db_info->https_port = $https_port; |
|
257 | 257 | |
258 | 258 | return $db_info; |
259 | 259 | } |
@@ -263,57 +263,57 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function procInstallFTP() |
265 | 265 | { |
266 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
267 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
268 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
269 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
270 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
271 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
266 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
267 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
268 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
269 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
270 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
271 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
272 | 272 | |
273 | 273 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
274 | 274 | $buff[] = "\$ftp_info = new stdClass();"; |
275 | - foreach($ftp_info as $key => $val) |
|
275 | + foreach ($ftp_info as $key => $val) |
|
276 | 276 | { |
277 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
277 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // If safe_mode |
281 | - if(ini_get('safe_mode')) |
|
281 | + if (ini_get('safe_mode')) |
|
282 | 282 | { |
283 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
283 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
284 | 284 | |
285 | 285 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
286 | 286 | $oFtp = new ftp(); |
287 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
287 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
288 | 288 | |
289 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
290 | 290 | { |
291 | 291 | $oFtp->ftp_quit(); |
292 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
292 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
293 | 293 | } |
294 | 294 | |
295 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
295 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
296 | 296 | { |
297 | 297 | $oFtp->ftp_quit(); |
298 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
298 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
299 | 299 | } |
300 | 300 | |
301 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
301 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
302 | 302 | { |
303 | 303 | $oFtp->ftp_quit(); |
304 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
304 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
305 | 305 | } |
306 | 306 | |
307 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
307 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
308 | 308 | { |
309 | 309 | $oFtp->ftp_quit(); |
310 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
310 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
311 | 311 | } |
312 | 312 | |
313 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
313 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
314 | 314 | { |
315 | 315 | $oFtp->ftp_quit(); |
316 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
316 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | $oFtp->ftp_quit(); |
@@ -324,31 +324,31 @@ discard block |
||
324 | 324 | |
325 | 325 | function procInstallCheckFtp() |
326 | 326 | { |
327 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
328 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
329 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
330 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
327 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
328 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
329 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
330 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
331 | 331 | |
332 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
332 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
333 | 333 | |
334 | - if($ftp_info->sftp == 'Y') |
|
334 | + if ($ftp_info->sftp == 'Y') |
|
335 | 335 | { |
336 | 336 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
337 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
337 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
338 | 338 | { |
339 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
339 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | else |
343 | 343 | { |
344 | 344 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
345 | 345 | $oFtp = new ftp(); |
346 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
346 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
347 | 347 | |
348 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
348 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
349 | 349 | { |
350 | 350 | $oFtp->ftp_quit(); |
351 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
351 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
352 | 352 | } |
353 | 353 | $oFtp->ftp_quit(); |
354 | 354 | } |
@@ -365,36 +365,36 @@ discard block |
||
365 | 365 | $checklist = array(); |
366 | 366 | // 0. check your version of php (5.2.4 or higher) |
367 | 367 | $checklist['php_version'] = true; |
368 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
368 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
369 | 369 | { |
370 | 370 | $checklist['php_version'] = false; |
371 | 371 | } |
372 | 372 | |
373 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
373 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
374 | 374 | { |
375 | 375 | Context::set('phpversion_warning', true); |
376 | 376 | } |
377 | 377 | |
378 | 378 | // 1. Check permission |
379 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
379 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
380 | 380 | else $checklist['permission'] = false; |
381 | 381 | // 2. Check if xml_parser_create exists |
382 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
382 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
383 | 383 | else $checklist['xml'] = false; |
384 | 384 | // 3. Check if ini_get (session.auto_start) == 1 |
385 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
385 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
386 | 386 | else $checklist['session'] = false; |
387 | 387 | // 4. Check if iconv exists |
388 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
388 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
389 | 389 | else $checklist['iconv'] = false; |
390 | 390 | // 5. Check gd(imagecreatefromgif function) |
391 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
391 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
392 | 392 | else $checklist['gd'] = false; |
393 | 393 | // 6. Check DB |
394 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
394 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
395 | 395 | else $checklist['db'] = false; |
396 | 396 | |
397 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
397 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
398 | 398 | else $install_enable = true; |
399 | 399 | |
400 | 400 | // Save the checked result to the Context |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
416 | 416 | |
417 | - if($license_agreement) |
|
417 | + if ($license_agreement) |
|
418 | 418 | { |
419 | 419 | $currentTime = $_SERVER['REQUEST_TIME']; |
420 | 420 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | return new Object(-1, 'msg_must_accept_license_agreement'); |
426 | 426 | } |
427 | 427 | |
428 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
428 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
429 | 429 | { |
430 | 430 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
431 | 431 | $this->setRedirectUrl($returnUrl); |
@@ -448,25 +448,25 @@ discard block |
||
448 | 448 | $hostname = $_SERVER['SERVER_NAME']; |
449 | 449 | $port = $_SERVER['SERVER_PORT']; |
450 | 450 | $str_port = ''; |
451 | - if($port) |
|
451 | + if ($port) |
|
452 | 452 | { |
453 | - $str_port = ':' . $port; |
|
453 | + $str_port = ':'.$port; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
457 | 457 | |
458 | 458 | //if DIRECTORY_SEPARATOR is not /(IIS) |
459 | - if(DIRECTORY_SEPARATOR !== '/') |
|
459 | + if (DIRECTORY_SEPARATOR !== '/') |
|
460 | 460 | { |
461 | 461 | //change to slash for compare |
462 | 462 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
463 | 463 | } |
464 | 464 | |
465 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
|
465 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath; |
|
466 | 466 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
467 | - if($currentPath != "") |
|
467 | + if ($currentPath != "") |
|
468 | 468 | { |
469 | - $query = $currentPath . $query; |
|
469 | + $query = $currentPath.$query; |
|
470 | 470 | } |
471 | 471 | $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); |
472 | 472 | $requestConfig = array(); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | './files/cache/template_compiled', |
492 | 492 | ); |
493 | 493 | |
494 | - foreach($directory_list as $dir) |
|
494 | + foreach ($directory_list as $dir) |
|
495 | 495 | { |
496 | 496 | FileHandler::makeDir($dir); |
497 | 497 | } |
@@ -507,57 +507,57 @@ discard block |
||
507 | 507 | $oModuleModel = getModel('module'); |
508 | 508 | // Create a table ny finding schemas/*.xml file in each module |
509 | 509 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
510 | - foreach($module_list as $module_path) |
|
510 | + foreach ($module_list as $module_path) |
|
511 | 511 | { |
512 | 512 | // Get module name |
513 | - $tmp_arr = explode('/',$module_path); |
|
514 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
513 | + $tmp_arr = explode('/', $module_path); |
|
514 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
515 | 515 | |
516 | 516 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
517 | - if(!$xml_info) continue; |
|
517 | + if (!$xml_info) continue; |
|
518 | 518 | $modules[$xml_info->category][] = $module; |
519 | 519 | } |
520 | 520 | // Install "module" module in advance |
521 | - $this->installModule('module','./modules/module'); |
|
521 | + $this->installModule('module', './modules/module'); |
|
522 | 522 | $oModule = getClass('module'); |
523 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
523 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
524 | 524 | // Determine the order of module installation depending on category |
525 | - $install_step = array('system','content','member'); |
|
525 | + $install_step = array('system', 'content', 'member'); |
|
526 | 526 | // Install all the remaining modules |
527 | - foreach($install_step as $category) |
|
527 | + foreach ($install_step as $category) |
|
528 | 528 | { |
529 | - if(count($modules[$category])) |
|
529 | + if (count($modules[$category])) |
|
530 | 530 | { |
531 | - foreach($modules[$category] as $module) |
|
531 | + foreach ($modules[$category] as $module) |
|
532 | 532 | { |
533 | - if($module == 'module') continue; |
|
533 | + if ($module == 'module') continue; |
|
534 | 534 | $this->installModule($module, sprintf('./modules/%s', $module)); |
535 | 535 | |
536 | 536 | $oModule = getClass($module); |
537 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
537 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
538 | 538 | { |
539 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
539 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | unset($modules[$category]); |
543 | 543 | } |
544 | 544 | } |
545 | 545 | // Install all the remaining modules |
546 | - if(count($modules)) |
|
546 | + if (count($modules)) |
|
547 | 547 | { |
548 | - foreach($modules as $category => $module_list) |
|
548 | + foreach ($modules as $category => $module_list) |
|
549 | 549 | { |
550 | - if(count($module_list)) |
|
550 | + if (count($module_list)) |
|
551 | 551 | { |
552 | - foreach($module_list as $module) |
|
552 | + foreach ($module_list as $module) |
|
553 | 553 | { |
554 | - if($module == 'module') continue; |
|
554 | + if ($module == 'module') continue; |
|
555 | 555 | $this->installModule($module, sprintf('./modules/%s', $module)); |
556 | 556 | |
557 | 557 | $oModule = getClass($module); |
558 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
558 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
559 | 559 | { |
560 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
560 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
580 | 580 | |
581 | 581 | $file_cnt = count($schema_files); |
582 | - for($i=0;$i<$file_cnt;$i++) |
|
582 | + for ($i = 0; $i < $file_cnt; $i++) |
|
583 | 583 | { |
584 | 584 | $file = trim($schema_files[$i]); |
585 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
585 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
586 | 586 | $output = $oDB->createTableByXmlFile($file); |
587 | - if($output === false) |
|
587 | + if ($output === false) |
|
588 | 588 | throw new Exception('msg_create_table_failed'); |
589 | 589 | } |
590 | 590 | // Create a table and module instance and then execute install() method |
591 | 591 | unset($oModule); |
592 | 592 | $oModule = getClass($module); |
593 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
593 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
594 | 594 | return new Object(); |
595 | 595 | } |
596 | 596 | |
597 | 597 | function _getDBConfigFileContents($db_info) |
598 | 598 | { |
599 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
599 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
600 | 600 | { |
601 | 601 | $db_info->master_db['db_table_prefix'] .= '_'; |
602 | 602 | } |
603 | 603 | |
604 | - foreach($db_info->slave_db as &$slave) |
|
604 | + foreach ($db_info->slave_db as &$slave) |
|
605 | 605 | { |
606 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
606 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
607 | 607 | { |
608 | 608 | $slave['db_table_prefix'] .= '_'; |
609 | 609 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | $buff = array(); |
613 | 613 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
614 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';'; |
|
614 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';'; |
|
615 | 615 | |
616 | 616 | return implode(PHP_EOL, $buff); |
617 | 617 | } |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | $db_tmp_config_file = $this->db_tmp_config_file; |
626 | 626 | |
627 | 627 | $db_info = Context::getDBInfo(); |
628 | - if(!$db_info) return; |
|
628 | + if (!$db_info) return; |
|
629 | 629 | |
630 | 630 | $buff = $this->_getDBConfigFileContents($db_info); |
631 | 631 | |
632 | 632 | FileHandler::writeFile($db_tmp_config_file, $buff); |
633 | 633 | |
634 | - if(@file_exists($db_tmp_config_file)) return true; |
|
634 | + if (@file_exists($db_tmp_config_file)) return true; |
|
635 | 635 | return false; |
636 | 636 | } |
637 | 637 | |
@@ -644,14 +644,14 @@ discard block |
||
644 | 644 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
645 | 645 | |
646 | 646 | $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
647 | - foreach($config_info as $key => $val) |
|
647 | + foreach ($config_info as $key => $val) |
|
648 | 648 | { |
649 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
649 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
653 | 653 | |
654 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
654 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
655 | 655 | return false; |
656 | 656 | } |
657 | 657 | |
@@ -666,13 +666,13 @@ discard block |
||
666 | 666 | //if(file_exists($config_file)) return; |
667 | 667 | |
668 | 668 | $db_info = Context::getDBInfo(); |
669 | - if(!$db_info) return; |
|
669 | + if (!$db_info) return; |
|
670 | 670 | |
671 | 671 | $buff = $this->_getDBConfigFileContents($db_info); |
672 | 672 | |
673 | 673 | FileHandler::writeFile($config_file, $buff); |
674 | 674 | |
675 | - if(@file_exists($config_file)) |
|
675 | + if (@file_exists($config_file)) |
|
676 | 676 | { |
677 | 677 | FileHandler::removeFile($this->db_tmp_config_file); |
678 | 678 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | function installByConfig($install_config_file) |
688 | 688 | { |
689 | 689 | include $install_config_file; |
690 | - if(!is_array($auto_config)) return false; |
|
690 | + if (!is_array($auto_config)) return false; |
|
691 | 691 | |
692 | 692 | $auto_config['module'] = 'install'; |
693 | 693 | $auto_config['act'] = 'procInstall'; |
@@ -695,22 +695,22 @@ discard block |
||
695 | 695 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
696 | 696 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; |
697 | 697 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
698 | - foreach($auto_config as $k => $v) |
|
698 | + foreach ($auto_config as $k => $v) |
|
699 | 699 | { |
700 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
700 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
701 | 701 | } |
702 | 702 | $body .= "</params>\r\n</methodCall>"; |
703 | 703 | |
704 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
704 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
705 | 705 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
706 | 706 | |
707 | - if($fp) |
|
707 | + if ($fp) |
|
708 | 708 | { |
709 | 709 | fputs($fp, $header); |
710 | - while(!feof($fp)) |
|
710 | + while (!feof($fp)) |
|
711 | 711 | { |
712 | 712 | $line = trim(fgets($fp, 4096)); |
713 | - if(strncmp('<error>', $line, 7) === 0) |
|
713 | + if (strncmp('<error>', $line, 7) === 0) |
|
714 | 714 | { |
715 | 715 | fclose($fp); |
716 | 716 | return false; |
@@ -101,11 +101,17 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if(!$output->toBool()) { |
|
105 | + return $output; |
|
106 | + } |
|
107 | + if(!$oDB->isConnected()) { |
|
108 | + return $oDB->getError(); |
|
109 | + } |
|
106 | 110 | |
107 | 111 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
112 | + if(!$this->makeDBConfigFile()) { |
|
113 | + return new Object(-1, 'msg_install_failed'); |
|
114 | + } |
|
109 | 115 | |
110 | 116 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
111 | 117 | { |
@@ -122,10 +128,14 @@ discard block |
||
122 | 128 | { |
123 | 129 | // Get variables |
124 | 130 | $config_info = Context::gets('use_rewrite','time_zone'); |
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
131 | + if($config_info->use_rewrite!='Y') { |
|
132 | + $config_info->use_rewrite = 'N'; |
|
133 | + } |
|
126 | 134 | |
127 | 135 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
136 | + if(!$this->makeEtcConfigFile($config_info)) { |
|
137 | + return new Object(-1, 'msg_install_failed'); |
|
138 | + } |
|
129 | 139 | |
130 | 140 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
131 | 141 | { |
@@ -141,7 +151,9 @@ discard block |
||
141 | 151 | function procInstall() |
142 | 152 | { |
143 | 153 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
154 | + if(Context::isInstalled()) { |
|
155 | + return new Object(-1, 'msg_already_installed'); |
|
156 | + } |
|
145 | 157 | |
146 | 158 | Context::loadLang('modules/member/lang'); |
147 | 159 | $oMemberModel = getModel('Member'); |
@@ -167,8 +179,12 @@ discard block |
||
167 | 179 | // install by default XE UI |
168 | 180 | else |
169 | 181 | { |
170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
182 | + if(FileHandler::exists($this->db_tmp_config_file)) { |
|
183 | + include $this->db_tmp_config_file; |
|
184 | + } |
|
185 | + if(FileHandler::exists($this->etc_tmp_config_file)) { |
|
186 | + include $this->etc_tmp_config_file; |
|
187 | + } |
|
172 | 188 | } |
173 | 189 | |
174 | 190 | // Set DB type and information |
@@ -176,7 +192,9 @@ discard block |
||
176 | 192 | // Create DB Instance |
177 | 193 | $oDB = &DB::getInstance(); |
178 | 194 | // Check if available to connect to the DB |
179 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
195 | + if(!$oDB->isConnected()) { |
|
196 | + return $oDB->getError(); |
|
197 | + } |
|
180 | 198 | |
181 | 199 | // Install all the modules |
182 | 200 | try { |
@@ -189,7 +207,9 @@ discard block |
||
189 | 207 | } |
190 | 208 | |
191 | 209 | // Create a config file |
192 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
210 | + if(!$this->makeConfigFile()) { |
|
211 | + return new Object(-1, 'msg_install_failed'); |
|
212 | + } |
|
193 | 213 | |
194 | 214 | // load script |
195 | 215 | $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
@@ -246,14 +266,17 @@ discard block |
||
246 | 266 | { |
247 | 267 | $https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; |
248 | 268 | $https_port = (!$https_port != 443) ? $https_port : null; |
249 | - } |
|
250 | - else |
|
269 | + } else |
|
251 | 270 | { |
252 | 271 | $http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; |
253 | 272 | $http_port = (!$http_port != 80) ? $http_port : null; |
254 | 273 | } |
255 | - if($http_port) $db_info->http_port = $http_port; |
|
256 | - if($https_port) $db_info->https_port = $https_port; |
|
274 | + if($http_port) { |
|
275 | + $db_info->http_port = $http_port; |
|
276 | + } |
|
277 | + if($https_port) { |
|
278 | + $db_info->https_port = $https_port; |
|
279 | + } |
|
257 | 280 | |
258 | 281 | return $db_info; |
259 | 282 | } |
@@ -263,12 +286,20 @@ discard block |
||
263 | 286 | */ |
264 | 287 | function procInstallFTP() |
265 | 288 | { |
266 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
289 | + if(Context::isInstalled()) { |
|
290 | + return new Object(-1, 'msg_already_installed'); |
|
291 | + } |
|
267 | 292 | $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
268 | 293 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
269 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
270 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
271 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
294 | + if(!$ftp_info->ftp_port) { |
|
295 | + $ftp_info->ftp_port = 21; |
|
296 | + } |
|
297 | + if(!$ftp_info->ftp_host) { |
|
298 | + $ftp_info->ftp_host = '127.0.0.1'; |
|
299 | + } |
|
300 | + if(!$ftp_info->ftp_root_path) { |
|
301 | + $ftp_info->ftp_root_path = '/'; |
|
302 | + } |
|
272 | 303 | |
273 | 304 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
274 | 305 | $buff[] = "\$ftp_info = new stdClass();"; |
@@ -280,11 +311,15 @@ discard block |
||
280 | 311 | // If safe_mode |
281 | 312 | if(ini_get('safe_mode')) |
282 | 313 | { |
283 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
314 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
315 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
316 | + } |
|
284 | 317 | |
285 | 318 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
286 | 319 | $oFtp = new ftp(); |
287 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
320 | + if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { |
|
321 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
322 | + } |
|
288 | 323 | |
289 | 324 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
290 | 325 | { |
@@ -326,10 +361,16 @@ discard block |
||
326 | 361 | { |
327 | 362 | $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
328 | 363 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
329 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
330 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
364 | + if(!$ftp_info->ftp_port) { |
|
365 | + $ftp_info->ftp_port = 21; |
|
366 | + } |
|
367 | + if(!$ftp_info->sftp) { |
|
368 | + $ftp_info->sftp = 'N'; |
|
369 | + } |
|
331 | 370 | |
332 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
371 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
372 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
373 | + } |
|
333 | 374 | |
334 | 375 | if($ftp_info->sftp == 'Y') |
335 | 376 | { |
@@ -338,12 +379,13 @@ discard block |
||
338 | 379 | { |
339 | 380 | return new Object(-1,'msg_ftp_invalid_auth_info'); |
340 | 381 | } |
341 | - } |
|
342 | - else |
|
382 | + } else |
|
343 | 383 | { |
344 | 384 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
345 | 385 | $oFtp = new ftp(); |
346 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
386 | + if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) { |
|
387 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
388 | + } |
|
347 | 389 | |
348 | 390 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
349 | 391 | { |
@@ -376,26 +418,47 @@ discard block |
||
376 | 418 | } |
377 | 419 | |
378 | 420 | // 1. Check permission |
379 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
380 | - else $checklist['permission'] = false; |
|
421 | + if(is_writable('./')||is_writable('./files')) { |
|
422 | + $checklist['permission'] = true; |
|
423 | + } else { |
|
424 | + $checklist['permission'] = false; |
|
425 | + } |
|
381 | 426 | // 2. Check if xml_parser_create exists |
382 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
383 | - else $checklist['xml'] = false; |
|
427 | + if(function_exists('xml_parser_create')) { |
|
428 | + $checklist['xml'] = true; |
|
429 | + } else { |
|
430 | + $checklist['xml'] = false; |
|
431 | + } |
|
384 | 432 | // 3. Check if ini_get (session.auto_start) == 1 |
385 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
386 | - else $checklist['session'] = false; |
|
433 | + if(ini_get('session.auto_start')!=1) { |
|
434 | + $checklist['session'] = true; |
|
435 | + } else { |
|
436 | + $checklist['session'] = false; |
|
437 | + } |
|
387 | 438 | // 4. Check if iconv exists |
388 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
389 | - else $checklist['iconv'] = false; |
|
439 | + if(function_exists('iconv')) { |
|
440 | + $checklist['iconv'] = true; |
|
441 | + } else { |
|
442 | + $checklist['iconv'] = false; |
|
443 | + } |
|
390 | 444 | // 5. Check gd(imagecreatefromgif function) |
391 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
392 | - else $checklist['gd'] = false; |
|
445 | + if(function_exists('imagecreatefromgif')) { |
|
446 | + $checklist['gd'] = true; |
|
447 | + } else { |
|
448 | + $checklist['gd'] = false; |
|
449 | + } |
|
393 | 450 | // 6. Check DB |
394 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
395 | - else $checklist['db'] = false; |
|
451 | + if(DB::getEnableList()) { |
|
452 | + $checklist['db'] = true; |
|
453 | + } else { |
|
454 | + $checklist['db'] = false; |
|
455 | + } |
|
396 | 456 | |
397 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
398 | - else $install_enable = true; |
|
457 | + if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) { |
|
458 | + $install_enable = false; |
|
459 | + } else { |
|
460 | + $install_enable = true; |
|
461 | + } |
|
399 | 462 | |
400 | 463 | // Save the checked result to the Context |
401 | 464 | Context::set('checklist', $checklist); |
@@ -418,8 +481,7 @@ discard block |
||
418 | 481 | { |
419 | 482 | $currentTime = $_SERVER['REQUEST_TIME']; |
420 | 483 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
421 | - } |
|
422 | - else |
|
484 | + } else |
|
423 | 485 | { |
424 | 486 | FileHandler::removeFile($this->flagLicenseAgreement); |
425 | 487 | return new Object(-1, 'msg_must_accept_license_agreement'); |
@@ -514,13 +576,17 @@ discard block |
||
514 | 576 | $module = $tmp_arr[count($tmp_arr)-1]; |
515 | 577 | |
516 | 578 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
517 | - if(!$xml_info) continue; |
|
579 | + if(!$xml_info) { |
|
580 | + continue; |
|
581 | + } |
|
518 | 582 | $modules[$xml_info->category][] = $module; |
519 | 583 | } |
520 | 584 | // Install "module" module in advance |
521 | 585 | $this->installModule('module','./modules/module'); |
522 | 586 | $oModule = getClass('module'); |
523 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
587 | + if($oModule->checkUpdate()) { |
|
588 | + $oModule->moduleUpdate(); |
|
589 | + } |
|
524 | 590 | // Determine the order of module installation depending on category |
525 | 591 | $install_step = array('system','content','member'); |
526 | 592 | // Install all the remaining modules |
@@ -530,13 +596,17 @@ discard block |
||
530 | 596 | { |
531 | 597 | foreach($modules[$category] as $module) |
532 | 598 | { |
533 | - if($module == 'module') continue; |
|
599 | + if($module == 'module') { |
|
600 | + continue; |
|
601 | + } |
|
534 | 602 | $this->installModule($module, sprintf('./modules/%s', $module)); |
535 | 603 | |
536 | 604 | $oModule = getClass($module); |
537 | 605 | if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
538 | 606 | { |
539 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
607 | + if($oModule->checkUpdate()) { |
|
608 | + $oModule->moduleUpdate(); |
|
609 | + } |
|
540 | 610 | } |
541 | 611 | } |
542 | 612 | unset($modules[$category]); |
@@ -551,13 +621,17 @@ discard block |
||
551 | 621 | { |
552 | 622 | foreach($module_list as $module) |
553 | 623 | { |
554 | - if($module == 'module') continue; |
|
624 | + if($module == 'module') { |
|
625 | + continue; |
|
626 | + } |
|
555 | 627 | $this->installModule($module, sprintf('./modules/%s', $module)); |
556 | 628 | |
557 | 629 | $oModule = getClass($module); |
558 | 630 | if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
559 | 631 | { |
560 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
632 | + if($oModule->checkUpdate()) { |
|
633 | + $oModule->moduleUpdate(); |
|
634 | + } |
|
561 | 635 | } |
562 | 636 | } |
563 | 637 | } |
@@ -582,15 +656,20 @@ discard block |
||
582 | 656 | for($i=0;$i<$file_cnt;$i++) |
583 | 657 | { |
584 | 658 | $file = trim($schema_files[$i]); |
585 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
659 | + if(!$file || substr($file,-4)!='.xml') { |
|
660 | + continue; |
|
661 | + } |
|
586 | 662 | $output = $oDB->createTableByXmlFile($file); |
587 | - if($output === false) |
|
588 | - throw new Exception('msg_create_table_failed'); |
|
663 | + if($output === false) { |
|
664 | + throw new Exception('msg_create_table_failed'); |
|
665 | + } |
|
589 | 666 | } |
590 | 667 | // Create a table and module instance and then execute install() method |
591 | 668 | unset($oModule); |
592 | 669 | $oModule = getClass($module); |
593 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
670 | + if(method_exists($oModule, 'moduleInstall')) { |
|
671 | + $oModule->moduleInstall(); |
|
672 | + } |
|
594 | 673 | return new Object(); |
595 | 674 | } |
596 | 675 | |
@@ -625,13 +704,17 @@ discard block |
||
625 | 704 | $db_tmp_config_file = $this->db_tmp_config_file; |
626 | 705 | |
627 | 706 | $db_info = Context::getDBInfo(); |
628 | - if(!$db_info) return; |
|
707 | + if(!$db_info) { |
|
708 | + return; |
|
709 | + } |
|
629 | 710 | |
630 | 711 | $buff = $this->_getDBConfigFileContents($db_info); |
631 | 712 | |
632 | 713 | FileHandler::writeFile($db_tmp_config_file, $buff); |
633 | 714 | |
634 | - if(@file_exists($db_tmp_config_file)) return true; |
|
715 | + if(@file_exists($db_tmp_config_file)) { |
|
716 | + return true; |
|
717 | + } |
|
635 | 718 | return false; |
636 | 719 | } |
637 | 720 | |
@@ -651,7 +734,9 @@ discard block |
||
651 | 734 | |
652 | 735 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
653 | 736 | |
654 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
737 | + if(@file_exists($etc_tmp_config_file)) { |
|
738 | + return true; |
|
739 | + } |
|
655 | 740 | return false; |
656 | 741 | } |
657 | 742 | |
@@ -666,7 +751,9 @@ discard block |
||
666 | 751 | //if(file_exists($config_file)) return; |
667 | 752 | |
668 | 753 | $db_info = Context::getDBInfo(); |
669 | - if(!$db_info) return; |
|
754 | + if(!$db_info) { |
|
755 | + return; |
|
756 | + } |
|
670 | 757 | |
671 | 758 | $buff = $this->_getDBConfigFileContents($db_info); |
672 | 759 | |
@@ -687,7 +774,9 @@ discard block |
||
687 | 774 | function installByConfig($install_config_file) |
688 | 775 | { |
689 | 776 | include $install_config_file; |
690 | - if(!is_array($auto_config)) return false; |
|
777 | + if(!is_array($auto_config)) { |
|
778 | + return false; |
|
779 | + } |
|
691 | 780 | |
692 | 781 | $auto_config['module'] = 'install'; |
693 | 782 | $auto_config['act'] = 'procInstall'; |
@@ -697,7 +786,9 @@ discard block |
||
697 | 786 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
698 | 787 | foreach($auto_config as $k => $v) |
699 | 788 | { |
700 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
789 | + if(!in_array($k,array('host','port','path'))) { |
|
790 | + $body .= sprintf($fstr,$k,$v,$k); |
|
791 | + } |
|
701 | 792 | } |
702 | 793 | $body .= "</params>\r\n</methodCall>"; |
703 | 794 |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true; |
|
23 | 23 | // directory and rss/atom/api reserved checking, etc. |
24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 25 | $dirs[] = 'rss'; |
26 | 26 | $dirs[] = 'atom'; |
27 | 27 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
28 | + if (in_array($id, $dirs)) return true; |
|
29 | 29 | // mid test |
30 | 30 | $args = new stdClass(); |
31 | 31 | $args->mid = $id; |
32 | 32 | $args->site_srl = $site_srl; |
33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
34 | + if ($output->data->count) return true; |
|
35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_args = new stdClass(); |
39 | 39 | $site_args->domain = $id; |
40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
41 | + if ($output->data->count) return true; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | function getDefaultMid() |
83 | 83 | { |
84 | 84 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
86 | 86 | |
87 | 87 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
89 | 89 | |
90 | 90 | $default_url_parse = parse_url($default_url); |
91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | // Set up |
96 | 96 | $domain = ''; |
97 | 97 | $site_info = NULL; |
98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
99 | 99 | { |
100 | 100 | $hostname = $request_url_parse['host']; |
101 | 101 | $path = $request_url_parse['path']; |
102 | 102 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
104 | 104 | |
105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
106 | 106 | } |
107 | 107 | |
108 | - if($domain === '') |
|
108 | + if ($domain === '') |
|
109 | 109 | { |
110 | - if(!$vid) $vid = $mid; |
|
111 | - if($vid) |
|
110 | + if (!$vid) $vid = $mid; |
|
111 | + if ($vid) |
|
112 | 112 | { |
113 | 113 | $domain = $vid; |
114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
116 | 116 | |
117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
118 | 118 | // If domain is set, look for subsite |
119 | - if($domain !== '') |
|
119 | + if ($domain !== '') |
|
120 | 120 | { |
121 | 121 | $site_info = false; |
122 | - if($oCacheHandler->isSupport()) |
|
122 | + if ($oCacheHandler->isSupport()) |
|
123 | 123 | { |
124 | - $object_key = 'site_info:' . md5($domain); |
|
124 | + $object_key = 'site_info:'.md5($domain); |
|
125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
127 | 127 | } |
128 | 128 | |
129 | - if($site_info === false) |
|
129 | + if ($site_info === false) |
|
130 | 130 | { |
131 | 131 | $args = new stdClass(); |
132 | 132 | $args->domain = $domain; |
133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 134 | $site_info = $output->data; |
135 | 135 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
137 | 137 | } |
138 | 138 | |
139 | - if($site_info && $vid) |
|
139 | + if ($site_info && $vid) |
|
140 | 140 | { |
141 | 141 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
143 | 143 | } |
144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // If no virtual website was found, get default website |
148 | - if($domain === '') |
|
148 | + if ($domain === '') |
|
149 | 149 | { |
150 | 150 | $site_info = false; |
151 | - if($oCacheHandler->isSupport()) |
|
151 | + if ($oCacheHandler->isSupport()) |
|
152 | 152 | { |
153 | 153 | $object_key = 'default_site'; |
154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
156 | 156 | } |
157 | 157 | |
158 | - if($site_info === false) |
|
158 | + if ($site_info === false) |
|
159 | 159 | { |
160 | 160 | $args = new stdClass(); |
161 | 161 | $args->site_srl = 0; |
162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
163 | 163 | // Update the related informaion if there is no default site info |
164 | - if(!$output->data) |
|
164 | + if (!$output->data) |
|
165 | 165 | { |
166 | 166 | // Create a table if sites table doesn't exist |
167 | 167 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | + if (!$oDB->isTableExists('sites')) return; |
|
170 | 170 | |
171 | 171 | // Get mid, language |
172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
173 | 173 | $db_info = Context::getDBInfo(); |
174 | 174 | $domain = Context::getDefaultUrl(); |
175 | 175 | $url_info = parse_url($domain); |
176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
177 | 177 | |
178 | 178 | $site_args = new stdClass; |
179 | 179 | $site_args->site_srl = 0; |
180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
181 | 181 | $site_args->domain = $domain; |
182 | 182 | $site_args->default_language = $db_info->lang_type; |
183 | 183 | |
184 | - if($output->data && !$output->data->index_module_srl) |
|
184 | + if ($output->data && !$output->data->index_module_srl) |
|
185 | 185 | { |
186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
187 | 187 | } |
188 | 188 | else |
189 | 189 | { |
190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
191 | + if (!$output->toBool()) return $output; |
|
192 | 192 | } |
193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 194 | } |
195 | 195 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
200 | + if (!$site_info->module_srl) return $site_info; |
|
201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
202 | 202 | return $this->addModuleExtraVars($site_info); |
203 | 203 | } |
204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
207 | 207 | */ |
208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
209 | 209 | { |
210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
211 | 211 | { |
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $args = new stdClass(); |
216 | 216 | $args->mid = $mid; |
217 | - $args->site_srl = (int)$site_srl; |
|
217 | + $args->site_srl = (int) $site_srl; |
|
218 | 218 | |
219 | 219 | $module_srl = false; |
220 | 220 | $module_info = false; |
221 | 221 | |
222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
223 | - if($oCacheHandler->isSupport()) |
|
223 | + if ($oCacheHandler->isSupport()) |
|
224 | 224 | { |
225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
228 | - if($module_srl) |
|
228 | + if ($module_srl) |
|
229 | 229 | { |
230 | - $object_key = 'mid_info:' . $module_srl; |
|
230 | + $object_key = 'mid_info:'.$module_srl; |
|
231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if($module_info === false) |
|
236 | + if ($module_info === false) |
|
237 | 237 | { |
238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
239 | 239 | $module_info = $output->data; |
240 | - if($oCacheHandler->isSupport()) |
|
240 | + if ($oCacheHandler->isSupport()) |
|
241 | 241 | { |
242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
243 | 243 | |
244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
252 | 252 | return $this->addModuleExtraVars($module_info); |
253 | 253 | } |
254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
266 | 266 | |
267 | - if(!$menuItemSrl) |
|
267 | + if (!$menuItemSrl) |
|
268 | 268 | { |
269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $args = new stdClass(); |
274 | 274 | $args->menu_item_srl = $menuItemSrl; |
275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
276 | - if(!$output->toBool()) |
|
276 | + if (!$output->toBool()) |
|
277 | 277 | { |
278 | 278 | return $output; |
279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
300 | - if(!$skinInfoPc) |
|
300 | + if (!$skinInfoPc) |
|
301 | 301 | { |
302 | 302 | $skinInfoPc = new stdClass(); |
303 | 303 | $skinInfoPc->title = $skinNamePc; |
304 | 304 | } |
305 | - if(!$skinInfoMobile) |
|
305 | + if (!$skinInfoMobile) |
|
306 | 306 | { |
307 | 307 | $skinInfoMobile = new stdClass(); |
308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
321 | 321 | $mid_info = false; |
322 | 322 | |
323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
324 | - if($oCacheHandler->isSupport()) |
|
324 | + if ($oCacheHandler->isSupport()) |
|
325 | 325 | { |
326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
329 | - if($module_srl) |
|
329 | + if ($module_srl) |
|
330 | 330 | { |
331 | - $object_key = 'mid_info:' . $module_srl; |
|
331 | + $object_key = 'mid_info:'.$module_srl; |
|
332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
334 | 334 | } |
335 | 335 | |
336 | - if($mid_info === false) |
|
336 | + if ($mid_info === false) |
|
337 | 337 | { |
338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
339 | 339 | |
340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
352 | 352 | |
353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
354 | 354 | { |
355 | 355 | unset($moduleInfo->skin); |
356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
369 | 369 | $mid_info = false; |
370 | 370 | |
371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
372 | - if($oCacheHandler->isSupport()) |
|
372 | + if ($oCacheHandler->isSupport()) |
|
373 | 373 | { |
374 | - $object_key = 'mid_info:' . $module_srl; |
|
374 | + $object_key = 'mid_info:'.$module_srl; |
|
375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
377 | 377 | } |
378 | 378 | |
379 | - if($mid_info === false) |
|
379 | + if ($mid_info === false) |
|
380 | 380 | { |
381 | 381 | // Get data |
382 | 382 | $args = new stdClass(); |
383 | 383 | $args->module_srl = $module_srl; |
384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
385 | + if (!$output->toBool()) return; |
|
386 | 386 | |
387 | 387 | $mid_info = $output->data; |
388 | 388 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
390 | 390 | } |
391 | 391 | |
392 | - if($mid_info && count($columnList)) |
|
392 | + if ($mid_info && count($columnList)) |
|
393 | 393 | { |
394 | 394 | $module_info = new stdClass(); |
395 | - foreach($mid_info as $key => $item) |
|
395 | + foreach ($mid_info as $key => $item) |
|
396 | 396 | { |
397 | - if(in_array($key, $columnList)) |
|
397 | + if (in_array($key, $columnList)) |
|
398 | 398 | { |
399 | 399 | $module_info->$key = $item; |
400 | 400 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | else $module_info = $mid_info; |
404 | 404 | |
405 | 405 | $oModuleController = getController('module'); |
406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
406 | + if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
407 | 407 | |
408 | 408 | $this->applyDefaultSkin($module_info); |
409 | 409 | return $this->addModuleExtraVars($module_info); |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | */ |
417 | 417 | private function applyDefaultSkin(&$moduleInfo) |
418 | 418 | { |
419 | - if($moduleInfo->is_skin_fix == 'N') |
|
419 | + if ($moduleInfo->is_skin_fix == 'N') |
|
420 | 420 | { |
421 | 421 | $moduleInfo->skin = '/USE_DEFAULT/'; |
422 | 422 | } |
423 | 423 | |
424 | - if($moduleInfo->is_mskin_fix == 'N') |
|
424 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
425 | 425 | { |
426 | 426 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $count = count($output->data); |
440 | 440 | |
441 | 441 | $modules = array(); |
442 | - for($i=0;$i<$count;$i++) |
|
442 | + for ($i = 0; $i < $count; $i++) |
|
443 | 443 | { |
444 | 444 | $modules[] = $output->data[$i]; |
445 | 445 | } |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | */ |
452 | 452 | function getModulesInfo($module_srls, $columnList = array()) |
453 | 453 | { |
454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
454 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
455 | 455 | $args = new stdClass(); |
456 | 456 | $args->module_srls = $module_srls; |
457 | 457 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
458 | - if(!$output->toBool()) return; |
|
458 | + if (!$output->toBool()) return; |
|
459 | 459 | return $this->addModuleExtraVars($output->data); |
460 | 460 | } |
461 | 461 | |
@@ -465,31 +465,31 @@ discard block |
||
465 | 465 | function addModuleExtraVars($module_info) |
466 | 466 | { |
467 | 467 | // Process although one or more module informaion is requested |
468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
469 | 469 | else $target_module_info = $module_info; |
470 | 470 | // Get module_srl |
471 | 471 | $module_srls = array(); |
472 | - foreach($target_module_info as $key => $val) |
|
472 | + foreach ($target_module_info as $key => $val) |
|
473 | 473 | { |
474 | 474 | $module_srl = $val->module_srl; |
475 | - if(!$module_srl) continue; |
|
475 | + if (!$module_srl) continue; |
|
476 | 476 | $module_srls[] = $val->module_srl; |
477 | 477 | } |
478 | 478 | // Extract extra information of the module and skin |
479 | 479 | $extra_vars = $this->getModuleExtraVars($module_srls); |
480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
480 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
481 | 481 | |
482 | - foreach($target_module_info as $key => $val) |
|
482 | + foreach ($target_module_info as $key => $val) |
|
483 | 483 | { |
484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
485 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
484 | + if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
485 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
486 | 486 | { |
487 | - if($target_module_info[$key]->{$k}) continue; |
|
487 | + if ($target_module_info[$key]->{$k}) continue; |
|
488 | 488 | $target_module_info[$key]->{$k} = $v; |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | - if(is_array($module_info)) return $target_module_info; |
|
492 | + if (is_array($module_info)) return $target_module_info; |
|
493 | 493 | return $target_module_info[0]; |
494 | 494 | } |
495 | 495 | |
@@ -500,37 +500,37 @@ discard block |
||
500 | 500 | { |
501 | 501 | $list = false; |
502 | 502 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
503 | - if($oCacheHandler->isSupport()) |
|
503 | + if ($oCacheHandler->isSupport()) |
|
504 | 504 | { |
505 | - if(count($args) === 1 && isset($args->site_srl)) |
|
505 | + if (count($args) === 1 && isset($args->site_srl)) |
|
506 | 506 | { |
507 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
507 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
508 | 508 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
509 | 509 | $list = $oCacheHandler->get($cache_key); |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - if($list === false) |
|
513 | + if ($list === false) |
|
514 | 514 | { |
515 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
515 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
516 | 516 | { |
517 | 517 | $columnList = array(); |
518 | 518 | } |
519 | 519 | |
520 | 520 | $output = executeQuery('module.getMidList', $args, $columnList); |
521 | - if(!$output->toBool()) return $output; |
|
521 | + if (!$output->toBool()) return $output; |
|
522 | 522 | $list = $output->data; |
523 | 523 | |
524 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
524 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
525 | 525 | { |
526 | 526 | $oCacheHandler->put($cache_key, $list); |
527 | 527 | } |
528 | 528 | } |
529 | - if(!$list) return; |
|
529 | + if (!$list) return; |
|
530 | 530 | |
531 | - if(!is_array($list)) $list = array($list); |
|
531 | + if (!is_array($list)) $list = array($list); |
|
532 | 532 | |
533 | - foreach($list as $val) |
|
533 | + foreach ($list as $val) |
|
534 | 534 | { |
535 | 535 | $mid_list[$val->mid] = $val; |
536 | 536 | } |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | function getModuleSrlList($args = null, $columnList = array()) |
545 | 545 | { |
546 | 546 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
547 | - if(!$output->toBool()) return $output; |
|
547 | + if (!$output->toBool()) return $output; |
|
548 | 548 | |
549 | 549 | $list = $output->data; |
550 | - if(!$list) return; |
|
550 | + if (!$list) return; |
|
551 | 551 | |
552 | 552 | return $list; |
553 | 553 | } |
@@ -557,22 +557,22 @@ discard block |
||
557 | 557 | */ |
558 | 558 | function getModuleSrlByMid($mid) |
559 | 559 | { |
560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
560 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
561 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
562 | 562 | |
563 | 563 | $site_module_info = Context::get('site_module_info'); |
564 | 564 | |
565 | 565 | $args = new stdClass; |
566 | 566 | $args->mid = $mid; |
567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
567 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
568 | 568 | $output = executeQuery('module.getModuleSrlByMid', $args); |
569 | - if(!$output->toBool()) return $output; |
|
569 | + if (!$output->toBool()) return $output; |
|
570 | 570 | |
571 | 571 | $list = $output->data; |
572 | - if(!$list) return; |
|
573 | - if(!is_array($list)) $list = array($list); |
|
572 | + if (!$list) return; |
|
573 | + if (!is_array($list)) $list = array($list); |
|
574 | 574 | |
575 | - foreach($list as $key => $val) |
|
575 | + foreach ($list as $key => $val) |
|
576 | 576 | { |
577 | 577 | $module_srl_list[] = $val->module_srl; |
578 | 578 | } |
@@ -588,33 +588,33 @@ discard block |
||
588 | 588 | $action_forward = false; |
589 | 589 | // cache controll |
590 | 590 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
591 | - if($oCacheHandler->isSupport()) |
|
591 | + if ($oCacheHandler->isSupport()) |
|
592 | 592 | { |
593 | 593 | $cache_key = 'action_forward'; |
594 | 594 | $action_forward = $oCacheHandler->get($cache_key); |
595 | 595 | } |
596 | 596 | |
597 | 597 | // retrieve and caching all registered action_forward |
598 | - if($action_forward === false) |
|
598 | + if ($action_forward === false) |
|
599 | 599 | { |
600 | 600 | $args = new stdClass(); |
601 | - $output = executeQueryArray('module.getActionForward',$args); |
|
602 | - if(!$output->toBool()) return new stdClass; |
|
603 | - if(!$output->data) $output->data = array(); |
|
601 | + $output = executeQueryArray('module.getActionForward', $args); |
|
602 | + if (!$output->toBool()) return new stdClass; |
|
603 | + if (!$output->data) $output->data = array(); |
|
604 | 604 | |
605 | 605 | $action_forward = array(); |
606 | - foreach($output->data as $item) |
|
606 | + foreach ($output->data as $item) |
|
607 | 607 | { |
608 | 608 | $action_forward[$item->act] = $item; |
609 | 609 | } |
610 | 610 | |
611 | - if($oCacheHandler->isSupport()) |
|
611 | + if ($oCacheHandler->isSupport()) |
|
612 | 612 | { |
613 | 613 | $oCacheHandler->put($cache_key, $action_forward); |
614 | 614 | } |
615 | 615 | } |
616 | 616 | |
617 | - if($action_forward[$act]) |
|
617 | + if ($action_forward[$act]) |
|
618 | 618 | { |
619 | 619 | return $action_forward[$act]; |
620 | 620 | } |
@@ -629,25 +629,25 @@ discard block |
||
629 | 629 | */ |
630 | 630 | function getTriggers($trigger_name, $called_position) |
631 | 631 | { |
632 | - if(is_null($GLOBALS['__triggers__'])) |
|
632 | + if (is_null($GLOBALS['__triggers__'])) |
|
633 | 633 | { |
634 | 634 | $triggers = FALSE; |
635 | 635 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
636 | - if($oCacheHandler->isSupport()) |
|
636 | + if ($oCacheHandler->isSupport()) |
|
637 | 637 | { |
638 | 638 | $cache_key = 'triggers'; |
639 | 639 | $triggers = $oCacheHandler->get($cache_key); |
640 | 640 | } |
641 | - if($triggers === FALSE) |
|
641 | + if ($triggers === FALSE) |
|
642 | 642 | { |
643 | 643 | $output = executeQueryArray('module.getTriggers'); |
644 | 644 | $triggers = $output->data; |
645 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
645 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
646 | 646 | { |
647 | 647 | $oCacheHandler->put($cache_key, $triggers); |
648 | 648 | } |
649 | 649 | } |
650 | - foreach($triggers as $item) |
|
650 | + foreach ($triggers as $item) |
|
651 | 651 | { |
652 | 652 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
653 | 653 | } |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | { |
664 | 664 | $triggers = $this->getTriggers($trigger_name, $called_position); |
665 | 665 | |
666 | - if($triggers && is_array($triggers)) |
|
666 | + if ($triggers && is_array($triggers)) |
|
667 | 667 | { |
668 | - foreach($triggers as $item) |
|
668 | + foreach ($triggers as $item) |
|
669 | 669 | { |
670 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
670 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
671 | 671 | { |
672 | 672 | return $item; |
673 | 673 | } |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | /** |
681 | 681 | * @brief Get module extend |
682 | 682 | */ |
683 | - function getModuleExtend($parent_module, $type, $kind='') |
|
683 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
684 | 684 | { |
685 | 685 | $key = $parent_module.'.'.$kind.'.'.$type; |
686 | 686 | |
687 | 687 | $module_extend_info = $this->loadModuleExtends(); |
688 | - if(array_key_exists($key, $module_extend_info)) |
|
688 | + if (array_key_exists($key, $module_extend_info)) |
|
689 | 689 | { |
690 | 690 | return $module_extend_info[$key]; |
691 | 691 | } |
@@ -701,29 +701,29 @@ discard block |
||
701 | 701 | $cache_file = './files/config/module_extend.php'; |
702 | 702 | $cache_file = FileHandler::getRealPath($cache_file); |
703 | 703 | |
704 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
704 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
705 | 705 | { |
706 | 706 | // check pre install |
707 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
707 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
708 | 708 | { |
709 | 709 | $arr = array(); |
710 | 710 | $output = executeQueryArray('module.getModuleExtend'); |
711 | - if($output->data) |
|
711 | + if ($output->data) |
|
712 | 712 | { |
713 | - foreach($output->data as $v) |
|
713 | + foreach ($output->data as $v) |
|
714 | 714 | { |
715 | 715 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
716 | 716 | } |
717 | 717 | } |
718 | 718 | |
719 | 719 | $str = '<?PHP return array(%s); ?>'; |
720 | - $str = sprintf($str, join(',',$arr)); |
|
720 | + $str = sprintf($str, join(',', $arr)); |
|
721 | 721 | |
722 | 722 | FileHandler::writeFile($cache_file, $str); |
723 | 723 | } |
724 | 724 | |
725 | 725 | |
726 | - if(file_exists($cache_file)) |
|
726 | + if (file_exists($cache_file)) |
|
727 | 727 | { |
728 | 728 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
729 | 729 | } |
@@ -743,20 +743,20 @@ discard block |
||
743 | 743 | { |
744 | 744 | // Get a path of the requested module. Return if not exists. |
745 | 745 | $module_path = ModuleHandler::getModulePath($module); |
746 | - if(!$module_path) return; |
|
746 | + if (!$module_path) return; |
|
747 | 747 | // Read the xml file for module skin information |
748 | 748 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
749 | - if(!file_exists($xml_file)) return; |
|
749 | + if (!file_exists($xml_file)) return; |
|
750 | 750 | |
751 | 751 | $oXmlParser = new XmlParser(); |
752 | 752 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
753 | 753 | $xml_obj = $tmp_xml_obj->module; |
754 | 754 | |
755 | - if(!$xml_obj) return; |
|
755 | + if (!$xml_obj) return; |
|
756 | 756 | |
757 | 757 | // Module Information |
758 | 758 | $module_info = new stdClass(); |
759 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
759 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
760 | 760 | { |
761 | 761 | // module format 0.2 |
762 | 762 | $module_info->title = $xml_obj->title->body; |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | $module_info->version = $xml_obj->version->body; |
765 | 765 | $module_info->homepage = $xml_obj->link->body; |
766 | 766 | $module_info->category = $xml_obj->category->body; |
767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
767 | + if (!$module_info->category) $module_info->category = 'service'; |
|
768 | 768 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 769 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
770 | 770 | $module_info->license = $xml_obj->license->body; |
771 | 771 | $module_info->license_link = $xml_obj->license->attrs->link; |
772 | 772 | |
773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
774 | 774 | else $author_list = $xml_obj->author; |
775 | 775 | |
776 | - foreach($author_list as $author) |
|
776 | + foreach ($author_list as $author) |
|
777 | 777 | { |
778 | 778 | $author_obj = new stdClass(); |
779 | 779 | $author_obj->name = $author->name->body; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $module_info->description = $xml_obj->author->description->body; |
790 | 790 | $module_info->version = $xml_obj->attrs->version; |
791 | 791 | $module_info->category = $xml_obj->attrs->category; |
792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
792 | + if (!$module_info->category) $module_info->category = 'service'; |
|
793 | 793 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 794 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
795 | 795 | $author_obj = new stdClass(); |
@@ -818,17 +818,17 @@ discard block |
||
818 | 818 | { |
819 | 819 | // Get a path of the requested module. Return if not exists. |
820 | 820 | $class_path = ModuleHandler::getModulePath($module); |
821 | - if(!$class_path) return; |
|
821 | + if (!$class_path) return; |
|
822 | 822 | |
823 | 823 | // Check if module.xml exists in the path. Return if not exist |
824 | 824 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
825 | - if(!file_exists($xml_file)) return; |
|
825 | + if (!file_exists($xml_file)) return; |
|
826 | 826 | |
827 | 827 | // Check if cached file exists |
828 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
828 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
829 | 829 | |
830 | 830 | // Update if no cache file exists or it is older than xml file |
831 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
831 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
832 | 832 | { |
833 | 833 | $info = new stdClass(); |
834 | 834 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | |
842 | 842 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
843 | 843 | |
844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
844 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
845 | 845 | |
846 | 846 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
847 | 847 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -851,17 +851,17 @@ discard block |
||
851 | 851 | $default_index = $admin_index = ''; |
852 | 852 | |
853 | 853 | // Arrange permission information |
854 | - if($grants) |
|
854 | + if ($grants) |
|
855 | 855 | { |
856 | - if(is_array($grants)) $grant_list = $grants; |
|
856 | + if (is_array($grants)) $grant_list = $grants; |
|
857 | 857 | else $grant_list[] = $grants; |
858 | 858 | |
859 | 859 | $info->grant = new stdClass(); |
860 | 860 | $buff[] = '$info->grant = new stdClass;'; |
861 | - foreach($grant_list as $grant) |
|
861 | + foreach ($grant_list as $grant) |
|
862 | 862 | { |
863 | 863 | $name = $grant->attrs->name; |
864 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
864 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
865 | 865 | $title = $grant->title->body; |
866 | 866 | |
867 | 867 | $info->grant->{$name} = new stdClass(); |
@@ -874,15 +874,15 @@ discard block |
||
874 | 874 | } |
875 | 875 | } |
876 | 876 | // Permissions to grant |
877 | - if($permissions) |
|
877 | + if ($permissions) |
|
878 | 878 | { |
879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
879 | + if (is_array($permissions)) $permission_list = $permissions; |
|
880 | 880 | else $permission_list[] = $permissions; |
881 | 881 | |
882 | 882 | $buff[] = '$info->permission = new stdClass;'; |
883 | 883 | |
884 | 884 | $info->permission = new stdClass(); |
885 | - foreach($permission_list as $permission) |
|
885 | + foreach ($permission_list as $permission) |
|
886 | 886 | { |
887 | 887 | $action = $permission->attrs->action; |
888 | 888 | $target = $permission->attrs->target; |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | } |
894 | 894 | } |
895 | 895 | // for admin menus |
896 | - if($menus) |
|
896 | + if ($menus) |
|
897 | 897 | { |
898 | - if(is_array($menus)) $menu_list = $menus; |
|
898 | + if (is_array($menus)) $menu_list = $menus; |
|
899 | 899 | else $menu_list[] = $menus; |
900 | 900 | |
901 | 901 | $buff[] = '$info->menu = new stdClass;'; |
902 | 902 | $info->menu = new stdClass(); |
903 | - foreach($menu_list as $menu) |
|
903 | + foreach ($menu_list as $menu) |
|
904 | 904 | { |
905 | 905 | $menu_name = $menu->attrs->name; |
906 | 906 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -918,23 +918,23 @@ discard block |
||
918 | 918 | } |
919 | 919 | |
920 | 920 | // actions |
921 | - if($actions) |
|
921 | + if ($actions) |
|
922 | 922 | { |
923 | - if(is_array($actions)) $action_list = $actions; |
|
923 | + if (is_array($actions)) $action_list = $actions; |
|
924 | 924 | else $action_list[] = $actions; |
925 | 925 | |
926 | 926 | $buff[] = '$info->action = new stdClass;'; |
927 | 927 | $info->action = new stdClass(); |
928 | - foreach($action_list as $action) |
|
928 | + foreach ($action_list as $action) |
|
929 | 929 | { |
930 | 930 | $name = $action->attrs->name; |
931 | 931 | |
932 | 932 | $type = $action->attrs->type; |
933 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
934 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
935 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
936 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
937 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
933 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
934 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
935 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
936 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
937 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
938 | 938 | |
939 | 939 | $index = $action->attrs->index; |
940 | 940 | $admin_index = $action->attrs->admin_index; |
@@ -949,14 +949,14 @@ discard block |
||
949 | 949 | $info->action->{$name}->ruleset = $ruleset; |
950 | 950 | $info->action->{$name}->method = $method; |
951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
952 | - if($action->attrs->menu_name) |
|
952 | + if ($action->attrs->menu_name) |
|
953 | 953 | { |
954 | - if($menu_index == 'true') |
|
954 | + if ($menu_index == 'true') |
|
955 | 955 | { |
956 | 956 | $info->menu->{$action->attrs->menu_name}->index = $name; |
957 | 957 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
958 | 958 | } |
959 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
959 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
960 | 960 | { |
961 | 961 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
962 | 962 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -974,22 +974,22 @@ discard block |
||
974 | 974 | $buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method); |
975 | 975 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
976 | 976 | |
977 | - if($index=='true') |
|
977 | + if ($index == 'true') |
|
978 | 978 | { |
979 | 979 | $default_index_act = $name; |
980 | 980 | $info->default_index_act = $name; |
981 | 981 | } |
982 | - if($admin_index=='true') |
|
982 | + if ($admin_index == 'true') |
|
983 | 983 | { |
984 | 984 | $admin_index_act = $name; |
985 | 985 | $info->admin_index_act = $name; |
986 | 986 | } |
987 | - if($setup_index=='true') |
|
987 | + if ($setup_index == 'true') |
|
988 | 988 | { |
989 | 989 | $setup_index_act = $name; |
990 | 990 | $info->setup_index_act = $name; |
991 | 991 | } |
992 | - if($simple_setup_index=='true') |
|
992 | + if ($simple_setup_index == 'true') |
|
993 | 993 | { |
994 | 994 | $simple_setup_index_act = $name; |
995 | 995 | $info->simple_setup_index_act = $name; |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | return $info; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
1013 | + if (file_exists($cache_file)) return include($cache_file); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | { |
1022 | 1022 | $module = Context::get('module_type'); |
1023 | 1023 | |
1024 | - if($module == 'ARTICLE') |
|
1024 | + if ($module == 'ARTICLE') |
|
1025 | 1025 | { |
1026 | 1026 | $module = 'page'; |
1027 | 1027 | } |
@@ -1041,26 +1041,26 @@ discard block |
||
1041 | 1041 | */ |
1042 | 1042 | function getSkins($path, $dir = 'skins') |
1043 | 1043 | { |
1044 | - if(substr($path, -1) == '/') |
|
1044 | + if (substr($path, -1) == '/') |
|
1045 | 1045 | { |
1046 | 1046 | $path = substr($path, 0, -1); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1050 | 1050 | $list = FileHandler::readDir($skin_path); |
1051 | - if(!count($list)) return; |
|
1051 | + if (!count($list)) return; |
|
1052 | 1052 | |
1053 | 1053 | natcasesort($list); |
1054 | 1054 | |
1055 | - foreach($list as $skin_name) |
|
1055 | + foreach ($list as $skin_name) |
|
1056 | 1056 | { |
1057 | - if(!is_dir($skin_path . $skin_name)) |
|
1057 | + if (!is_dir($skin_path.$skin_name)) |
|
1058 | 1058 | { |
1059 | 1059 | continue; |
1060 | 1060 | } |
1061 | 1061 | unset($skin_info); |
1062 | 1062 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
1063 | - if(!$skin_info) |
|
1063 | + if (!$skin_info) |
|
1064 | 1064 | { |
1065 | 1065 | $skin_info = new stdClass(); |
1066 | 1066 | $skin_info->title = $skin_name; |
@@ -1073,15 +1073,15 @@ discard block |
||
1073 | 1073 | $tmpPath = trim($tmpPath); |
1074 | 1074 | $module = array_pop(explode(' ', $tmpPath)); |
1075 | 1075 | |
1076 | - if($dir == 'skins') |
|
1076 | + if ($dir == 'skins') |
|
1077 | 1077 | { |
1078 | 1078 | $oAdminModel = getAdminModel('admin'); |
1079 | 1079 | $themesInfo = $oAdminModel->getThemeList(); |
1080 | 1080 | |
1081 | - foreach($themesInfo as $themeName => $info) |
|
1081 | + foreach ($themesInfo as $themeName => $info) |
|
1082 | 1082 | { |
1083 | 1083 | $skinInfos = $info->skin_infos; |
1084 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1084 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1085 | 1085 | { |
1086 | 1086 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
1087 | 1087 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1093,13 +1093,13 @@ discard block |
||
1093 | 1093 | $oMenuAdminModel = getAdminModel('menu'); |
1094 | 1094 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
1095 | 1095 | $moduleName = $module; |
1096 | - if($moduleName === 'page') |
|
1096 | + if ($moduleName === 'page') |
|
1097 | 1097 | { |
1098 | 1098 | $moduleName = 'ARTICLE'; |
1099 | 1099 | } |
1100 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
1100 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
1101 | 1101 | { |
1102 | - if($dir == 'skins') |
|
1102 | + if ($dir == 'skins') |
|
1103 | 1103 | { |
1104 | 1104 | $type = 'P'; |
1105 | 1105 | } |
@@ -1109,12 +1109,12 @@ discard block |
||
1109 | 1109 | } |
1110 | 1110 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
1111 | 1111 | |
1112 | - if(isset($defaultSkinName)) |
|
1112 | + if (isset($defaultSkinName)) |
|
1113 | 1113 | { |
1114 | 1114 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
1115 | 1115 | |
1116 | 1116 | $useDefault = new stdClass(); |
1117 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
1117 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
1118 | 1118 | |
1119 | 1119 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
1120 | 1120 | |
@@ -1131,20 +1131,20 @@ discard block |
||
1131 | 1131 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1132 | 1132 | { |
1133 | 1133 | // Read xml file having skin information |
1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1134 | + if (substr($path, -1) != '/') $path .= '/'; |
|
1135 | 1135 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1136 | - if(!file_exists($skin_xml_file)) return; |
|
1136 | + if (!file_exists($skin_xml_file)) return; |
|
1137 | 1137 | // Create XmlParser object |
1138 | 1138 | $oXmlParser = new XmlParser(); |
1139 | 1139 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1140 | 1140 | // Return if no skin information is |
1141 | - if(!$_xml_obj->skin) return; |
|
1141 | + if (!$_xml_obj->skin) return; |
|
1142 | 1142 | $xml_obj = $_xml_obj->skin; |
1143 | 1143 | // Skin Name |
1144 | 1144 | $skin_info = new stdClass(); |
1145 | 1145 | $skin_info->title = $xml_obj->title->body; |
1146 | 1146 | // Author information |
1147 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1147 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1148 | 1148 | { |
1149 | 1149 | // skin format v0.2 |
1150 | 1150 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1155,10 +1155,10 @@ discard block |
||
1155 | 1155 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1156 | 1156 | $skin_info->description = $xml_obj->description->body; |
1157 | 1157 | |
1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1158 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1159 | 1159 | else $author_list = $xml_obj->author; |
1160 | 1160 | |
1161 | - foreach($author_list as $author) |
|
1161 | + foreach ($author_list as $author) |
|
1162 | 1162 | { |
1163 | 1163 | $author_obj = new stdClass(); |
1164 | 1164 | $author_obj->name = $author->name->body; |
@@ -1167,25 +1167,25 @@ discard block |
||
1167 | 1167 | $skin_info->author[] = $author_obj; |
1168 | 1168 | } |
1169 | 1169 | // List extra vars |
1170 | - if($xml_obj->extra_vars) |
|
1170 | + if ($xml_obj->extra_vars) |
|
1171 | 1171 | { |
1172 | 1172 | $extra_var_groups = $xml_obj->extra_vars->group; |
1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1173 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1174 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1175 | 1175 | |
1176 | - foreach($extra_var_groups as $group) |
|
1176 | + foreach ($extra_var_groups as $group) |
|
1177 | 1177 | { |
1178 | 1178 | $extra_vars = $group->var; |
1179 | - if(!$extra_vars) |
|
1179 | + if (!$extra_vars) |
|
1180 | 1180 | { |
1181 | 1181 | continue; |
1182 | 1182 | } |
1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1183 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
1184 | 1184 | |
1185 | - foreach($extra_vars as $key => $val) |
|
1185 | + foreach ($extra_vars as $key => $val) |
|
1186 | 1186 | { |
1187 | 1187 | $obj = new stdClass(); |
1188 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1188 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1189 | 1189 | |
1190 | 1190 | $obj->group = $group->title->body; |
1191 | 1191 | $obj->name = $val->attrs->name; |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | $obj->description = $val->description->body; |
1195 | 1195 | $obj->value = $extra_vals->{$obj->name}; |
1196 | 1196 | $obj->default = $val->attrs->default; |
1197 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1198 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1197 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1198 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1199 | 1199 | // Get an option list from 'select'type |
1200 | - if(is_array($val->options)) |
|
1200 | + if (is_array($val->options)) |
|
1201 | 1201 | { |
1202 | 1202 | $option_count = count($val->options); |
1203 | 1203 | |
1204 | - for($i = 0; $i < $option_count; $i++) |
|
1204 | + for ($i = 0; $i < $option_count; $i++) |
|
1205 | 1205 | { |
1206 | 1206 | $obj->options[$i] = new stdClass(); |
1207 | 1207 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1238,18 +1238,18 @@ discard block |
||
1238 | 1238 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1239 | 1239 | // Variables used in the skin |
1240 | 1240 | $extra_var_groups = $xml_obj->extra_vars->group; |
1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1241 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1242 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1243 | 1243 | |
1244 | - foreach($extra_var_groups as $group) |
|
1244 | + foreach ($extra_var_groups as $group) |
|
1245 | 1245 | { |
1246 | 1246 | $extra_vars = $group->var; |
1247 | 1247 | |
1248 | - if($extra_vars) |
|
1248 | + if ($extra_vars) |
|
1249 | 1249 | { |
1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1250 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1251 | 1251 | |
1252 | - foreach($extra_vars as $var) |
|
1252 | + foreach ($extra_vars as $var) |
|
1253 | 1253 | { |
1254 | 1254 | unset($obj); |
1255 | 1255 | unset($options); |
@@ -1260,11 +1260,11 @@ discard block |
||
1260 | 1260 | $title = $var->title->body; |
1261 | 1261 | $description = $var->description->body; |
1262 | 1262 | // Get an option list from 'select'type. |
1263 | - if(is_array($var->default)) |
|
1263 | + if (is_array($var->default)) |
|
1264 | 1264 | { |
1265 | 1265 | $option_count = count($var->default); |
1266 | 1266 | |
1267 | - for($i = 0; $i < $option_count; $i++) |
|
1267 | + for ($i = 0; $i < $option_count; $i++) |
|
1268 | 1268 | { |
1269 | 1269 | $options[$i]->title = $var->default[$i]->body; |
1270 | 1270 | $options[$i]->value = $var->default[$i]->body; |
@@ -1298,19 +1298,19 @@ discard block |
||
1298 | 1298 | |
1299 | 1299 | // colorset |
1300 | 1300 | $colorset = $xml_obj->colorset->color; |
1301 | - if($colorset) |
|
1301 | + if ($colorset) |
|
1302 | 1302 | { |
1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1303 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
1304 | 1304 | |
1305 | - foreach($colorset as $color) |
|
1305 | + foreach ($colorset as $color) |
|
1306 | 1306 | { |
1307 | 1307 | $name = $color->attrs->name; |
1308 | 1308 | $title = $color->title->body; |
1309 | 1309 | $screenshot = $color->attrs->src; |
1310 | - if($screenshot) |
|
1310 | + if ($screenshot) |
|
1311 | 1311 | { |
1312 | 1312 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1313 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
1314 | 1314 | } |
1315 | 1315 | else $screenshot = ""; |
1316 | 1316 | |
@@ -1322,19 +1322,19 @@ discard block |
||
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | // Menu type (settings for layout) |
1325 | - if($xml_obj->menus->menu) |
|
1325 | + if ($xml_obj->menus->menu) |
|
1326 | 1326 | { |
1327 | 1327 | $menus = $xml_obj->menus->menu; |
1328 | - if(!is_array($menus)) $menus = array($menus); |
|
1328 | + if (!is_array($menus)) $menus = array($menus); |
|
1329 | 1329 | |
1330 | 1330 | $menu_count = count($menus); |
1331 | 1331 | $skin_info->menu_count = $menu_count; |
1332 | - for($i=0;$i<$menu_count;$i++) |
|
1332 | + for ($i = 0; $i < $menu_count; $i++) |
|
1333 | 1333 | { |
1334 | 1334 | unset($obj); |
1335 | 1335 | |
1336 | 1336 | $obj->name = $menus[$i]->attrs->name; |
1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1337 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1338 | 1338 | $obj->title = $menus[$i]->title->body; |
1339 | 1339 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1340 | 1340 | |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
1346 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
1346 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
1347 | 1347 | return $skin_info; |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | { |
1355 | 1355 | $args = new stdClass; |
1356 | 1356 | $args->site_srl = $site_srl; |
1357 | - if(!is_null($module)) $args->module = $module; |
|
1357 | + if (!is_null($module)) $args->module = $module; |
|
1358 | 1358 | $output = executeQuery('module.getModuleCount', $args); |
1359 | 1359 | return $output->data->count; |
1360 | 1360 | } |
@@ -1368,26 +1368,26 @@ discard block |
||
1368 | 1368 | $config = false; |
1369 | 1369 | // cache controll |
1370 | 1370 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1371 | - if($oCacheHandler->isSupport()) |
|
1371 | + if ($oCacheHandler->isSupport()) |
|
1372 | 1372 | { |
1373 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
1373 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
1374 | 1374 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1375 | 1375 | $config = $oCacheHandler->get($cache_key); |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - if($config === false) |
|
1378 | + if ($config === false) |
|
1379 | 1379 | { |
1380 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1380 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1381 | 1381 | { |
1382 | 1382 | $args = new stdClass(); |
1383 | 1383 | $args->module = $module; |
1384 | 1384 | $args->site_srl = $site_srl; |
1385 | 1385 | $output = executeQuery('module.getModuleConfig', $args); |
1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1386 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1387 | 1387 | else $config = null; |
1388 | 1388 | |
1389 | 1389 | //insert in cache |
1390 | - if($oCacheHandler->isSupport()) |
|
1390 | + if ($oCacheHandler->isSupport()) |
|
1391 | 1391 | { |
1392 | 1392 | $oCacheHandler->put($cache_key, $config); |
1393 | 1393 | } |
@@ -1408,26 +1408,26 @@ discard block |
||
1408 | 1408 | $config = false; |
1409 | 1409 | // cache controll |
1410 | 1410 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1411 | - if($oCacheHandler->isSupport()) |
|
1411 | + if ($oCacheHandler->isSupport()) |
|
1412 | 1412 | { |
1413 | 1413 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
1414 | 1414 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1415 | 1415 | $config = $oCacheHandler->get($cache_key); |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - if($config === false) |
|
1418 | + if ($config === false) |
|
1419 | 1419 | { |
1420 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1420 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1421 | 1421 | { |
1422 | 1422 | $args = new stdClass(); |
1423 | 1423 | $args->module = $module; |
1424 | 1424 | $args->module_srl = $module_srl; |
1425 | 1425 | $output = executeQuery('module.getModulePartConfig', $args); |
1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1426 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1427 | 1427 | else $config = null; |
1428 | 1428 | |
1429 | 1429 | //insert in cache |
1430 | - if($oCacheHandler->isSupport()) |
|
1430 | + if ($oCacheHandler->isSupport()) |
|
1431 | 1431 | { |
1432 | 1432 | $oCacheHandler->put($cache_key, $config); |
1433 | 1433 | } |
@@ -1446,11 +1446,11 @@ discard block |
||
1446 | 1446 | { |
1447 | 1447 | $args = new stdClass(); |
1448 | 1448 | $args->module = $module; |
1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
1449 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1450 | 1450 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
1451 | + if (!$output->toBool() || !$output->data) return array(); |
|
1452 | 1452 | |
1453 | - foreach($output->data as $key => $val) |
|
1453 | + foreach ($output->data as $key => $val) |
|
1454 | 1454 | { |
1455 | 1455 | $result[$val->module_srl] = unserialize($val->config); |
1456 | 1456 | } |
@@ -1466,12 +1466,12 @@ discard block |
||
1466 | 1466 | $args->moduleCategorySrl = $moduleCategorySrl; |
1467 | 1467 | // Get data from the DB |
1468 | 1468 | $output = executeQuery('module.getModuleCategories', $args); |
1469 | - if(!$output->toBool()) return $output; |
|
1469 | + if (!$output->toBool()) return $output; |
|
1470 | 1470 | $list = $output->data; |
1471 | - if(!$list) return; |
|
1472 | - if(!is_array($list)) $list = array($list); |
|
1471 | + if (!$list) return; |
|
1472 | + if (!is_array($list)) $list = array($list); |
|
1473 | 1473 | |
1474 | - foreach($list as $val) |
|
1474 | + foreach ($list as $val) |
|
1475 | 1475 | { |
1476 | 1476 | $category_list[$val->module_category_srl] = $val; |
1477 | 1477 | } |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | $args = new stdClass; |
1488 | 1488 | $args->module_category_srl = $module_category_srl; |
1489 | 1489 | $output = executeQuery('module.getModuleCategory', $args); |
1490 | - if(!$output->toBool()) return $output; |
|
1490 | + if (!$output->toBool()) return $output; |
|
1491 | 1491 | return $output->data; |
1492 | 1492 | } |
1493 | 1493 | |
@@ -1499,10 +1499,10 @@ discard block |
||
1499 | 1499 | // Get a list of downloaded and installed modules |
1500 | 1500 | $searched_list = FileHandler::readDir('./modules'); |
1501 | 1501 | $searched_count = count($searched_list); |
1502 | - if(!$searched_count) return; |
|
1502 | + if (!$searched_count) return; |
|
1503 | 1503 | sort($searched_list); |
1504 | 1504 | |
1505 | - for($i=0;$i<$searched_count;$i++) |
|
1505 | + for ($i = 0; $i < $searched_count; $i++) |
|
1506 | 1506 | { |
1507 | 1507 | // Module name |
1508 | 1508 | $module_name = $searched_list[$i]; |
@@ -1512,7 +1512,7 @@ discard block |
||
1512 | 1512 | $info = $this->getModuleInfoXml($module_name); |
1513 | 1513 | unset($obj); |
1514 | 1514 | |
1515 | - if(!isset($info)) continue; |
|
1515 | + if (!isset($info)) continue; |
|
1516 | 1516 | $info->module = $module_name; |
1517 | 1517 | $info->created_table_count = $created_table_count; |
1518 | 1518 | $info->table_count = $table_count; |
@@ -1529,19 +1529,19 @@ discard block |
||
1529 | 1529 | $info = null; |
1530 | 1530 | |
1531 | 1531 | $moduledir = ModuleHandler::getModulePath($module_name); |
1532 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1532 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1533 | 1533 | { |
1534 | 1534 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
1535 | 1535 | $table_count = count($tmp_files); |
1536 | 1536 | // Check if the table is created |
1537 | 1537 | $created_table_count = 0; |
1538 | - for($j=0;$j<count($tmp_files);$j++) |
|
1538 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
1539 | 1539 | { |
1540 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1540 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
1541 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1542 | 1542 | } |
1543 | 1543 | // Check if DB is installed |
1544 | - if($table_count > $created_table_count) return true; |
|
1544 | + if ($table_count > $created_table_count) return true; |
|
1545 | 1545 | else return false; |
1546 | 1546 | } |
1547 | 1547 | return false; |
@@ -1551,7 +1551,7 @@ discard block |
||
1551 | 1551 | { |
1552 | 1552 | // Check if it is upgraded to module.class.php on each module |
1553 | 1553 | $oDummy = getModule($module_name, 'class'); |
1554 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1554 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1555 | 1555 | { |
1556 | 1556 | return $oDummy->checkUpdate(); |
1557 | 1557 | } |
@@ -1570,31 +1570,31 @@ discard block |
||
1570 | 1570 | sort($searched_list); |
1571 | 1571 | |
1572 | 1572 | $searched_count = count($searched_list); |
1573 | - if(!$searched_count) return; |
|
1573 | + if (!$searched_count) return; |
|
1574 | 1574 | |
1575 | - for($i=0;$i<$searched_count;$i++) |
|
1575 | + for ($i = 0; $i < $searched_count; $i++) |
|
1576 | 1576 | { |
1577 | 1577 | // module name |
1578 | 1578 | $module_name = $searched_list[$i]; |
1579 | 1579 | |
1580 | 1580 | $path = ModuleHandler::getModulePath($module_name); |
1581 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1581 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
1582 | 1582 | |
1583 | 1583 | // Get the number of xml files to create a table in schemas |
1584 | 1584 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
1585 | 1585 | $table_count = count($tmp_files); |
1586 | 1586 | // Check if the table is created |
1587 | 1587 | $created_table_count = 0; |
1588 | - for($j=0;$j<$table_count;$j++) |
|
1588 | + for ($j = 0; $j < $table_count; $j++) |
|
1589 | 1589 | { |
1590 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
1591 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1590 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
1591 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1592 | 1592 | } |
1593 | 1593 | // Get information of the module |
1594 | 1594 | $info = NULL; |
1595 | 1595 | $info = $this->getModuleInfoXml($module_name); |
1596 | 1596 | |
1597 | - if(!$info) continue; |
|
1597 | + if (!$info) continue; |
|
1598 | 1598 | |
1599 | 1599 | $info->module = $module_name; |
1600 | 1600 | $info->category = $info->category; |
@@ -1603,12 +1603,12 @@ discard block |
||
1603 | 1603 | $info->path = $path; |
1604 | 1604 | $info->admin_index_act = $info->admin_index_act; |
1605 | 1605 | // Check if DB is installed |
1606 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1606 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
1607 | 1607 | else $info->need_install = false; |
1608 | 1608 | // Check if it is upgraded to module.class.php on each module |
1609 | 1609 | $oDummy = null; |
1610 | 1610 | $oDummy = getModule($module_name, 'class'); |
1611 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1611 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1612 | 1612 | { |
1613 | 1613 | $info->need_update = $oDummy->checkUpdate(); |
1614 | 1614 | } |
@@ -1629,15 +1629,15 @@ discard block |
||
1629 | 1629 | */ |
1630 | 1630 | function syncModuleToSite(&$data) |
1631 | 1631 | { |
1632 | - if(!$data) return; |
|
1632 | + if (!$data) return; |
|
1633 | 1633 | |
1634 | - if(is_array($data)) |
|
1634 | + if (is_array($data)) |
|
1635 | 1635 | { |
1636 | - foreach($data as $key => $val) |
|
1636 | + foreach ($data as $key => $val) |
|
1637 | 1637 | { |
1638 | 1638 | $module_srls[] = $val->module_srl; |
1639 | 1639 | } |
1640 | - if(!count($module_srls)) return; |
|
1640 | + if (!count($module_srls)) return; |
|
1641 | 1641 | } |
1642 | 1642 | else |
1643 | 1643 | { |
@@ -1645,17 +1645,17 @@ discard block |
||
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | $args = new stdClass(); |
1648 | - $args->module_srls = implode(',',$module_srls); |
|
1648 | + $args->module_srls = implode(',', $module_srls); |
|
1649 | 1649 | $output = executeQueryArray('module.getModuleSites', $args); |
1650 | - if(!$output->data) return array(); |
|
1651 | - foreach($output->data as $key => $val) |
|
1650 | + if (!$output->data) return array(); |
|
1651 | + foreach ($output->data as $key => $val) |
|
1652 | 1652 | { |
1653 | 1653 | $modules[$val->module_srl] = $val; |
1654 | 1654 | } |
1655 | 1655 | |
1656 | - if(is_array($data)) |
|
1656 | + if (is_array($data)) |
|
1657 | 1657 | { |
1658 | - foreach($data as $key => $val) |
|
1658 | + foreach ($data as $key => $val) |
|
1659 | 1659 | { |
1660 | 1660 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1661 | 1661 | } |
@@ -1671,14 +1671,14 @@ discard block |
||
1671 | 1671 | */ |
1672 | 1672 | function isSiteAdmin($member_info, $site_srl = null) |
1673 | 1673 | { |
1674 | - if(!$member_info->member_srl) return false; |
|
1675 | - if($member_info->is_admin == 'Y') return true; |
|
1674 | + if (!$member_info->member_srl) return false; |
|
1675 | + if ($member_info->is_admin == 'Y') return true; |
|
1676 | 1676 | |
1677 | 1677 | $args = new stdClass(); |
1678 | - if(!isset($site_srl)) |
|
1678 | + if (!isset($site_srl)) |
|
1679 | 1679 | { |
1680 | 1680 | $site_module_info = Context::get('site_module_info'); |
1681 | - if(!$site_module_info) return; |
|
1681 | + if (!$site_module_info) return; |
|
1682 | 1682 | $args->site_srl = $site_module_info->site_srl; |
1683 | 1683 | } |
1684 | 1684 | else |
@@ -1688,7 +1688,7 @@ discard block |
||
1688 | 1688 | |
1689 | 1689 | $args->member_srl = $member_info->member_srl; |
1690 | 1690 | $output = executeQuery('module.isSiteAdmin', $args); |
1691 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1691 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
1692 | 1692 | return false; |
1693 | 1693 | } |
1694 | 1694 | |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $obj = new stdClass(); |
1712 | 1712 | $obj->module_srl = $module_srl; |
1713 | 1713 | $output = executeQueryArray('module.getAdminID', $obj); |
1714 | - if(!$output->toBool() || !$output->data) return; |
|
1714 | + if (!$output->toBool() || !$output->data) return; |
|
1715 | 1715 | |
1716 | 1716 | return $output->data; |
1717 | 1717 | } |
@@ -1724,20 +1724,20 @@ discard block |
||
1724 | 1724 | { |
1725 | 1725 | $extra_vars = array(); |
1726 | 1726 | $get_module_srls = array(); |
1727 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1727 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1728 | 1728 | |
1729 | 1729 | $vars = false; |
1730 | 1730 | // cache controll |
1731 | 1731 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1732 | - if($oCacheHandler->isSupport()) |
|
1732 | + if ($oCacheHandler->isSupport()) |
|
1733 | 1733 | { |
1734 | - foreach($list_module_srl as $module_srl) |
|
1734 | + foreach ($list_module_srl as $module_srl) |
|
1735 | 1735 | { |
1736 | 1736 | $object_key = 'module_extra_vars:'.$module_srl; |
1737 | 1737 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1738 | 1738 | $vars = $oCacheHandler->get($cache_key); |
1739 | 1739 | |
1740 | - if($vars) |
|
1740 | + if ($vars) |
|
1741 | 1741 | { |
1742 | 1742 | $extra_vars[$module_srl] = $vars; |
1743 | 1743 | } |
@@ -1752,35 +1752,35 @@ discard block |
||
1752 | 1752 | $get_module_srls = $list_module_srl; |
1753 | 1753 | } |
1754 | 1754 | |
1755 | - if(count($get_module_srls) > 0) |
|
1755 | + if (count($get_module_srls) > 0) |
|
1756 | 1756 | { |
1757 | 1757 | $args = new stdClass(); |
1758 | 1758 | $args->module_srl = implode(',', $get_module_srls); |
1759 | 1759 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
1760 | 1760 | |
1761 | - if(!$output->toBool()) |
|
1761 | + if (!$output->toBool()) |
|
1762 | 1762 | { |
1763 | 1763 | return; |
1764 | 1764 | } |
1765 | 1765 | |
1766 | - if(!$output->data) |
|
1766 | + if (!$output->data) |
|
1767 | 1767 | { |
1768 | - foreach($get_module_srls as $module_srl) |
|
1768 | + foreach ($get_module_srls as $module_srl) |
|
1769 | 1769 | { |
1770 | 1770 | $extra_vars[$module_srl] = new stdClass; |
1771 | 1771 | } |
1772 | 1772 | } |
1773 | - foreach($output->data as $key => $val) |
|
1773 | + foreach ($output->data as $key => $val) |
|
1774 | 1774 | { |
1775 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1775 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
1776 | 1776 | |
1777 | - if(!isset($extra_vars[$val->module_srl])) |
|
1777 | + if (!isset($extra_vars[$val->module_srl])) |
|
1778 | 1778 | { |
1779 | 1779 | $extra_vars[$val->module_srl] = new stdClass(); |
1780 | 1780 | } |
1781 | 1781 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
1782 | 1782 | |
1783 | - if($oCacheHandler->isSupport()) |
|
1783 | + if ($oCacheHandler->isSupport()) |
|
1784 | 1784 | { |
1785 | 1785 | $object_key = 'module_extra_vars:'.$val->module_srl; |
1786 | 1786 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1799,27 +1799,27 @@ discard block |
||
1799 | 1799 | { |
1800 | 1800 | $skin_vars = false; |
1801 | 1801 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1802 | - if($oCacheHandler->isSupport()) |
|
1802 | + if ($oCacheHandler->isSupport()) |
|
1803 | 1803 | { |
1804 | 1804 | $object_key = 'module_skin_vars:'.$module_srl; |
1805 | 1805 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1806 | 1806 | $skin_vars = $oCacheHandler->get($cache_key); |
1807 | 1807 | } |
1808 | 1808 | |
1809 | - if($skin_vars === false) |
|
1809 | + if ($skin_vars === false) |
|
1810 | 1810 | { |
1811 | 1811 | $args = new stdClass(); |
1812 | 1812 | $args->module_srl = $module_srl; |
1813 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
1814 | - if(!$output->toBool()) return; |
|
1813 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
1814 | + if (!$output->toBool()) return; |
|
1815 | 1815 | |
1816 | 1816 | $skin_vars = array(); |
1817 | - foreach($output->data as $vars) |
|
1817 | + foreach ($output->data as $vars) |
|
1818 | 1818 | { |
1819 | 1819 | $skin_vars[$vars->name] = $vars; |
1820 | 1820 | } |
1821 | 1821 | |
1822 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1822 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1823 | 1823 | } |
1824 | 1824 | |
1825 | 1825 | return $skin_vars; |
@@ -1831,32 +1831,32 @@ discard block |
||
1831 | 1831 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1832 | 1832 | { |
1833 | 1833 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1834 | - if(!$site_srl) $site_srl = 0; |
|
1834 | + if (!$site_srl) $site_srl = 0; |
|
1835 | 1835 | |
1836 | 1836 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1837 | - if(is_readable($designInfoFile)) |
|
1837 | + if (is_readable($designInfoFile)) |
|
1838 | 1838 | { |
1839 | 1839 | include($designInfoFile); |
1840 | 1840 | |
1841 | 1841 | $skinName = $designInfo->module->{$module_name}->{$target}; |
1842 | 1842 | } |
1843 | - if(!$skinName) |
|
1843 | + if (!$skinName) |
|
1844 | 1844 | { |
1845 | 1845 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
1846 | 1846 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
1847 | 1847 | |
1848 | - if(is_dir($moduleSkinPath.'default')) |
|
1848 | + if (is_dir($moduleSkinPath.'default')) |
|
1849 | 1849 | { |
1850 | 1850 | $skinName = 'default'; |
1851 | 1851 | } |
1852 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
1852 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
1853 | 1853 | { |
1854 | 1854 | $skinName = 'xe_default'; |
1855 | 1855 | } |
1856 | 1856 | else |
1857 | 1857 | { |
1858 | 1858 | $skins = FileHandler::readDir($moduleSkinPath); |
1859 | - if(count($skins) > 0) |
|
1859 | + if (count($skins) > 0) |
|
1860 | 1860 | { |
1861 | 1861 | $skinName = $skins[0]; |
1862 | 1862 | } |
@@ -1866,9 +1866,9 @@ discard block |
||
1866 | 1866 | } |
1867 | 1867 | } |
1868 | 1868 | |
1869 | - if($updateCache && $skinName) |
|
1869 | + if ($updateCache && $skinName) |
|
1870 | 1870 | { |
1871 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1871 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1872 | 1872 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1873 | 1873 | |
1874 | 1874 | $oAdminController = getAdminController('admin'); |
@@ -1884,10 +1884,10 @@ discard block |
||
1884 | 1884 | */ |
1885 | 1885 | function syncSkinInfoToModuleInfo(&$module_info) |
1886 | 1886 | { |
1887 | - if(!$module_info->module_srl) return; |
|
1887 | + if (!$module_info->module_srl) return; |
|
1888 | 1888 | |
1889 | 1889 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1890 | - if(Mobile::isFromMobilePhone()) |
|
1890 | + if (Mobile::isFromMobilePhone()) |
|
1891 | 1891 | { |
1892 | 1892 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1893 | 1893 | } |
@@ -1896,11 +1896,11 @@ discard block |
||
1896 | 1896 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1897 | 1897 | } |
1898 | 1898 | |
1899 | - if(!$skin_vars) return; |
|
1899 | + if (!$skin_vars) return; |
|
1900 | 1900 | |
1901 | - foreach($skin_vars as $name => $val) |
|
1901 | + foreach ($skin_vars as $name => $val) |
|
1902 | 1902 | { |
1903 | - if(isset($module_info->{$name})) continue; |
|
1903 | + if (isset($module_info->{$name})) continue; |
|
1904 | 1904 | $module_info->{$name} = $val->value; |
1905 | 1905 | } |
1906 | 1906 | } |
@@ -1914,27 +1914,27 @@ discard block |
||
1914 | 1914 | { |
1915 | 1915 | $skin_vars = false; |
1916 | 1916 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1917 | - if($oCacheHandler->isSupport()) |
|
1917 | + if ($oCacheHandler->isSupport()) |
|
1918 | 1918 | { |
1919 | 1919 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1920 | 1920 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1921 | 1921 | $skin_vars = $oCacheHandler->get($cache_key); |
1922 | 1922 | } |
1923 | 1923 | |
1924 | - if($skin_vars === false) |
|
1924 | + if ($skin_vars === false) |
|
1925 | 1925 | { |
1926 | 1926 | $args = new stdClass(); |
1927 | 1927 | $args->module_srl = $module_srl; |
1928 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1929 | - if(!$output->toBool() || !$output->data) return; |
|
1928 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1929 | + if (!$output->toBool() || !$output->data) return; |
|
1930 | 1930 | |
1931 | 1931 | $skin_vars = array(); |
1932 | - foreach($output->data as $vars) |
|
1932 | + foreach ($output->data as $vars) |
|
1933 | 1933 | { |
1934 | 1934 | $skin_vars[$vars->name] = $vars; |
1935 | 1935 | } |
1936 | 1936 | |
1937 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1937 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1938 | 1938 | } |
1939 | 1939 | |
1940 | 1940 | return $skin_vars; |
@@ -1946,32 +1946,32 @@ discard block |
||
1946 | 1946 | */ |
1947 | 1947 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1948 | 1948 | { |
1949 | - if(!$module_info->module_srl) return; |
|
1949 | + if (!$module_info->module_srl) return; |
|
1950 | 1950 | $skin_vars = false; |
1951 | 1951 | // cache controll |
1952 | 1952 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1953 | - if($oCacheHandler->isSupport()) |
|
1953 | + if ($oCacheHandler->isSupport()) |
|
1954 | 1954 | { |
1955 | 1955 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
1956 | 1956 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1957 | 1957 | $skin_vars = $oCacheHandler->get($cache_key); |
1958 | 1958 | } |
1959 | - if($skin_vars === false) |
|
1959 | + if ($skin_vars === false) |
|
1960 | 1960 | { |
1961 | 1961 | $args = new stdClass; |
1962 | 1962 | $args->module_srl = $module_info->module_srl; |
1963 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1964 | - if(!$output->toBool()) return; |
|
1963 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1964 | + if (!$output->toBool()) return; |
|
1965 | 1965 | $skin_vars = $output->data; |
1966 | 1966 | |
1967 | 1967 | //insert in cache |
1968 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1968 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1969 | 1969 | } |
1970 | - if(!$skin_vars) return; |
|
1970 | + if (!$skin_vars) return; |
|
1971 | 1971 | |
1972 | - foreach($output->data as $val) |
|
1972 | + foreach ($output->data as $val) |
|
1973 | 1973 | { |
1974 | - if(isset($module_info->{$val->name})) continue; |
|
1974 | + if (isset($module_info->{$val->name})) continue; |
|
1975 | 1975 | $module_info->{$val->name} = $val->value; |
1976 | 1976 | } |
1977 | 1977 | } |
@@ -1983,7 +1983,7 @@ discard block |
||
1983 | 1983 | { |
1984 | 1984 | $grant = new stdClass(); |
1985 | 1985 | |
1986 | - if(!$xml_info) |
|
1986 | + if (!$xml_info) |
|
1987 | 1987 | { |
1988 | 1988 | $module = $module_info->module; |
1989 | 1989 | $xml_info = $this->getModuleActionXml($module); |
@@ -1991,9 +1991,9 @@ discard block |
||
1991 | 1991 | // Set variables to grant group permission |
1992 | 1992 | $module_srl = $module_info->module_srl; |
1993 | 1993 | $grant_info = $xml_info->grant; |
1994 | - if($member_info->member_srl) |
|
1994 | + if ($member_info->member_srl) |
|
1995 | 1995 | { |
1996 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1996 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1997 | 1997 | else $group_list = array(); |
1998 | 1998 | } |
1999 | 1999 | else |
@@ -2001,10 +2001,10 @@ discard block |
||
2001 | 2001 | $group_list = array(); |
2002 | 2002 | } |
2003 | 2003 | // If module_srl doesn't exist(if unable to set permissions) |
2004 | - if(!$module_srl) |
|
2004 | + if (!$module_srl) |
|
2005 | 2005 | { |
2006 | 2006 | $grant->access = true; |
2007 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2007 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2008 | 2008 | { |
2009 | 2009 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
2010 | 2010 | } |
@@ -2015,23 +2015,23 @@ discard block |
||
2015 | 2015 | { |
2016 | 2016 | // If module_srl exists |
2017 | 2017 | // Get a type of granted permission |
2018 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
2018 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false; |
|
2019 | 2019 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
2020 | 2020 | // If a just logged-in member is, check if the member is a module administrator |
2021 | - if(!$grant->manager && $member_info->member_srl) |
|
2021 | + if (!$grant->manager && $member_info->member_srl) |
|
2022 | 2022 | { |
2023 | 2023 | $args = new stdClass(); |
2024 | 2024 | $args->module_srl = $module_srl; |
2025 | 2025 | $args->member_srl = $member_info->member_srl; |
2026 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
2027 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2026 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
2027 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2028 | 2028 | } |
2029 | 2029 | // If not an administrator, get information from the DB and grant manager privilege. |
2030 | - if(!$grant->manager) |
|
2030 | + if (!$grant->manager) |
|
2031 | 2031 | { |
2032 | 2032 | $args = new stdClass(); |
2033 | 2033 | // If planet, get permission settings from the planet home |
2034 | - if($module_info->module == 'planet') |
|
2034 | + if ($module_info->module == 'planet') |
|
2035 | 2035 | { |
2036 | 2036 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2037 | 2037 | } |
@@ -2044,42 +2044,42 @@ discard block |
||
2044 | 2044 | |
2045 | 2045 | $grant_exists = $granted = array(); |
2046 | 2046 | |
2047 | - if($output->data) |
|
2047 | + if ($output->data) |
|
2048 | 2048 | { |
2049 | 2049 | // Arrange names and groups who has privileges |
2050 | - foreach($output->data as $val) |
|
2050 | + foreach ($output->data as $val) |
|
2051 | 2051 | { |
2052 | 2052 | $grant_exists[$val->name] = true; |
2053 | - if($granted[$val->name]) continue; |
|
2053 | + if ($granted[$val->name]) continue; |
|
2054 | 2054 | // Log-in member only |
2055 | - if($val->group_srl == -1) |
|
2055 | + if ($val->group_srl == -1) |
|
2056 | 2056 | { |
2057 | 2057 | $granted[$val->name] = true; |
2058 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2058 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
2059 | 2059 | // Site-joined member only |
2060 | 2060 | } |
2061 | - elseif($val->group_srl == -2) |
|
2061 | + elseif ($val->group_srl == -2) |
|
2062 | 2062 | { |
2063 | 2063 | $granted[$val->name] = true; |
2064 | 2064 | // Do not grant any permission for non-logged member |
2065 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2065 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
2066 | 2066 | // Log-in member |
2067 | 2067 | else |
2068 | 2068 | { |
2069 | 2069 | $site_module_info = Context::get('site_module_info'); |
2070 | 2070 | // Permission granted if no information of the currently connected site exists |
2071 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2071 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2072 | 2072 | // Permission is not granted if information of the currently connected site exists |
2073 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2073 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
2074 | 2074 | } |
2075 | 2075 | // All of non-logged members |
2076 | 2076 | } |
2077 | - elseif($val->group_srl == -3) |
|
2077 | + elseif ($val->group_srl == -3) |
|
2078 | 2078 | { |
2079 | 2079 | $granted[$val->name] = true; |
2080 | 2080 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2081 | 2081 | } |
2082 | - elseif($val->group_srl == 0) |
|
2082 | + elseif ($val->group_srl == 0) |
|
2083 | 2083 | { |
2084 | 2084 | $granted[$val->name] = true; |
2085 | 2085 | $grant->{$val->name} = true; |
@@ -2087,7 +2087,7 @@ discard block |
||
2087 | 2087 | } |
2088 | 2088 | else |
2089 | 2089 | { |
2090 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2090 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2091 | 2091 | { |
2092 | 2092 | $grant->{$val->name} = true; |
2093 | 2093 | $granted[$val->name] = true; |
@@ -2096,29 +2096,29 @@ discard block |
||
2096 | 2096 | } |
2097 | 2097 | } |
2098 | 2098 | // Separate processing for the virtual group access |
2099 | - if(!$grant_exists['access']) $grant->access = true; |
|
2100 | - if(count($grant_info)) |
|
2099 | + if (!$grant_exists['access']) $grant->access = true; |
|
2100 | + if (count($grant_info)) |
|
2101 | 2101 | { |
2102 | - foreach($grant_info as $grant_name => $grant_item) |
|
2102 | + foreach ($grant_info as $grant_name => $grant_item) |
|
2103 | 2103 | { |
2104 | - if($grant_exists[$grant_name]) continue; |
|
2105 | - switch($grant_item->default) |
|
2104 | + if ($grant_exists[$grant_name]) continue; |
|
2105 | + switch ($grant_item->default) |
|
2106 | 2106 | { |
2107 | 2107 | case 'guest' : |
2108 | 2108 | $grant->{$grant_name} = true; |
2109 | 2109 | break; |
2110 | 2110 | case 'member' : |
2111 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2111 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
2112 | 2112 | else $grant->{$grant_name} = false; |
2113 | 2113 | break; |
2114 | 2114 | case 'site' : |
2115 | 2115 | $site_module_info = Context::get('site_module_info'); |
2116 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2116 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2117 | 2117 | else $grant->{$grant_name} = false; |
2118 | 2118 | break; |
2119 | 2119 | case 'manager' : |
2120 | 2120 | case 'root' : |
2121 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2121 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2122 | 2122 | else $grant->{$grant_name} = false; |
2123 | 2123 | break; |
2124 | 2124 | } |
@@ -2126,12 +2126,12 @@ discard block |
||
2126 | 2126 | } |
2127 | 2127 | } |
2128 | 2128 | // Set true to grant all privileges if an administrator is |
2129 | - if($grant->manager) |
|
2129 | + if ($grant->manager) |
|
2130 | 2130 | { |
2131 | 2131 | $grant->access = true; |
2132 | - if(count($grant_info)) |
|
2132 | + if (count($grant_info)) |
|
2133 | 2133 | { |
2134 | - foreach($grant_info as $key => $val) |
|
2134 | + foreach ($grant_info as $key => $val) |
|
2135 | 2135 | { |
2136 | 2136 | $grant->{$key} = true; |
2137 | 2137 | } |
@@ -2163,27 +2163,27 @@ discard block |
||
2163 | 2163 | |
2164 | 2164 | function unserializeAttributes($module_filebox_list) |
2165 | 2165 | { |
2166 | - if(is_array($module_filebox_list->data)) |
|
2166 | + if (is_array($module_filebox_list->data)) |
|
2167 | 2167 | { |
2168 | - foreach($module_filebox_list->data as &$item) |
|
2168 | + foreach ($module_filebox_list->data as &$item) |
|
2169 | 2169 | { |
2170 | - if(empty($item->comment)) |
|
2170 | + if (empty($item->comment)) |
|
2171 | 2171 | { |
2172 | 2172 | continue; |
2173 | 2173 | } |
2174 | 2174 | |
2175 | 2175 | $attributes = explode(';', $item->comment); |
2176 | - foreach($attributes as $attribute) |
|
2176 | + foreach ($attributes as $attribute) |
|
2177 | 2177 | { |
2178 | 2178 | $values = explode(':', $attribute); |
2179 | - if((count($values) % 2) ==1) |
|
2179 | + if ((count($values) % 2) == 1) |
|
2180 | 2180 | { |
2181 | - for($i=2;$i<count($values);$i++) |
|
2181 | + for ($i = 2; $i < count($values); $i++) |
|
2182 | 2182 | { |
2183 | - $values[1].=":".$values[$i]; |
|
2183 | + $values[1] .= ":".$values[$i]; |
|
2184 | 2184 | } |
2185 | 2185 | } |
2186 | - $atts[$values[0]]=$values[1]; |
|
2186 | + $atts[$values[0]] = $values[1]; |
|
2187 | 2187 | } |
2188 | 2188 | $item->attributes = $atts; |
2189 | 2189 | unset($atts); |
@@ -2195,16 +2195,16 @@ discard block |
||
2195 | 2195 | function getFileBoxListHtml() |
2196 | 2196 | { |
2197 | 2197 | $logged_info = Context::get('logged_info'); |
2198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2198 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2199 | 2199 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2200 | - $link_params = explode('&',$link['query']); |
|
2200 | + $link_params = explode('&', $link['query']); |
|
2201 | 2201 | foreach ($link_params as $param) |
2202 | 2202 | { |
2203 | - $param = explode("=",$param); |
|
2204 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2203 | + $param = explode("=", $param); |
|
2204 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2205 | 2205 | } |
2206 | 2206 | $oWidgetModel = getModel('widget'); |
2207 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2207 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2208 | 2208 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2209 | 2209 | |
2210 | 2210 | $oModuleModel = getModel('module'); |
@@ -2220,24 +2220,24 @@ discard block |
||
2220 | 2220 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
2221 | 2221 | |
2222 | 2222 | $oTemplate = &TemplateHandler::getInstance(); |
2223 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
2223 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
2224 | 2224 | |
2225 | 2225 | $this->add('html', $html); |
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | function getModuleFileBoxPath($module_filebox_srl) |
2229 | 2229 | { |
2230 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
2230 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | /** |
2234 | 2234 | * @brief Return ruleset cache file path |
2235 | 2235 | * @param module, act |
2236 | 2236 | */ |
2237 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
2237 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
2238 | 2238 | { |
2239 | 2239 | // load dynamic ruleset xml file |
2240 | - if(strpos($ruleset, '@') !== false) |
|
2240 | + if (strpos($ruleset, '@') !== false) |
|
2241 | 2241 | { |
2242 | 2242 | $rulsetFile = str_replace('@', '', $ruleset); |
2243 | 2243 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2247,20 +2247,20 @@ discard block |
||
2247 | 2247 | { |
2248 | 2248 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2249 | 2249 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2250 | - if(is_readable($xml_file)) |
|
2250 | + if (is_readable($xml_file)) |
|
2251 | 2251 | return FileHandler::getRealPath($xml_file); |
2252 | - else{ |
|
2252 | + else { |
|
2253 | 2253 | $ruleset = str_replace('#', '', $ruleset); |
2254 | 2254 | } |
2255 | 2255 | |
2256 | 2256 | } |
2257 | 2257 | // Get a path of the requested module. Return if not exists. |
2258 | 2258 | $class_path = ModuleHandler::getModulePath($module); |
2259 | - if(!$class_path) return; |
|
2259 | + if (!$class_path) return; |
|
2260 | 2260 | |
2261 | 2261 | // Check if module.xml exists in the path. Return if not exist |
2262 | 2262 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2263 | - if(!file_exists($xml_file)) return; |
|
2263 | + if (!file_exists($xml_file)) return; |
|
2264 | 2264 | |
2265 | 2265 | return $xml_file; |
2266 | 2266 | } |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | $requestVars = Context::getRequestVars(); |
2273 | 2273 | |
2274 | 2274 | $args = new stdClass; |
2275 | - $args->site_srl = (int)$requestVars->site_srl; |
|
2275 | + $args->site_srl = (int) $requestVars->site_srl; |
|
2276 | 2276 | $args->page = 1; // /< Page |
2277 | 2277 | $args->list_count = 100; // /< the number of posts to display on a single page |
2278 | 2278 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2284,9 +2284,9 @@ discard block |
||
2284 | 2284 | |
2285 | 2285 | $list = array(); |
2286 | 2286 | |
2287 | - if($output->toBool()) |
|
2287 | + if ($output->toBool()) |
|
2288 | 2288 | { |
2289 | - foreach((array)$output->data as $code_info) |
|
2289 | + foreach ((array) $output->data as $code_info) |
|
2290 | 2290 | { |
2291 | 2291 | unset($codeInfo); |
2292 | 2292 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -19,26 +19,34 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
23 | + return true; |
|
24 | + } |
|
23 | 25 | // directory and rss/atom/api reserved checking, etc. |
24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 27 | $dirs[] = 'rss'; |
26 | 28 | $dirs[] = 'atom'; |
27 | 29 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
30 | + if(in_array($id, $dirs)) { |
|
31 | + return true; |
|
32 | + } |
|
29 | 33 | // mid test |
30 | 34 | $args = new stdClass(); |
31 | 35 | $args->mid = $id; |
32 | 36 | $args->site_srl = $site_srl; |
33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
38 | + if($output->data->count) { |
|
39 | + return true; |
|
40 | + } |
|
35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | 42 | if(!$site_srl) |
37 | 43 | { |
38 | 44 | $site_args = new stdClass(); |
39 | 45 | $site_args->domain = $id; |
40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
47 | + if($output->data->count) { |
|
48 | + return true; |
|
49 | + } |
|
42 | 50 | } |
43 | 51 | |
44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
82 | 90 | function getDefaultMid() |
83 | 91 | { |
84 | 92 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
94 | + $default_url = substr($default_url, 0, -1); |
|
95 | + } |
|
86 | 96 | |
87 | 97 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
99 | + $request_url = substr($request_url, 0, -1); |
|
100 | + } |
|
89 | 101 | |
90 | 102 | $default_url_parse = parse_url($default_url); |
91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
100 | 112 | $hostname = $request_url_parse['host']; |
101 | 113 | $path = $request_url_parse['path']; |
102 | 114 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
116 | + $path = substr($path, 0, -1); |
|
117 | + } |
|
104 | 118 | |
105 | 119 | $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
106 | 120 | } |
107 | 121 | |
108 | 122 | if($domain === '') |
109 | 123 | { |
110 | - if(!$vid) $vid = $mid; |
|
124 | + if(!$vid) { |
|
125 | + $vid = $mid; |
|
126 | + } |
|
111 | 127 | if($vid) |
112 | 128 | { |
113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 150 | $site_info = $output->data; |
135 | 151 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
152 | + if($oCacheHandler->isSupport()) { |
|
153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
154 | + } |
|
137 | 155 | } |
138 | 156 | |
139 | 157 | if($site_info && $vid) |
140 | 158 | { |
141 | 159 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
161 | + Context::set('mid', $site_info->mid,true); |
|
162 | + } |
|
143 | 163 | } |
144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
165 | 185 | { |
166 | 186 | // Create a table if sites table doesn't exist |
167 | 187 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
188 | + if(!$oDB->isTableExists('sites')) { |
|
189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
190 | + } |
|
191 | + if(!$oDB->isTableExists('sites')) { |
|
192 | + return; |
|
193 | + } |
|
170 | 194 | |
171 | 195 | // Get mid, language |
172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
184 | 208 | if($output->data && !$output->data->index_module_srl) |
185 | 209 | { |
186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
187 | - } |
|
188 | - else |
|
211 | + } else |
|
189 | 212 | { |
190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
214 | + if(!$output->toBool()) { |
|
215 | + return $output; |
|
216 | + } |
|
192 | 217 | } |
193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 219 | } |
195 | 220 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
221 | + if($oCacheHandler->isSupport()) { |
|
222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
223 | + } |
|
197 | 224 | } |
198 | 225 | } |
199 | 226 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
227 | + if(!$site_info->module_srl) { |
|
228 | + return $site_info; |
|
229 | + } |
|
230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
231 | + $site_info = $site_info[0]; |
|
232 | + } |
|
202 | 233 | return $this->addModuleExtraVars($site_info); |
203 | 234 | } |
204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
248 | 279 | } |
249 | 280 | |
250 | 281 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
283 | + $module_info = $module_info->data[0]; |
|
284 | + } |
|
252 | 285 | return $this->addModuleExtraVars($module_info); |
253 | 286 | } |
254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | - } |
|
344 | - else |
|
376 | + } else |
|
345 | 377 | { |
346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
382 | 414 | $args = new stdClass(); |
383 | 415 | $args->module_srl = $module_srl; |
384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
417 | + if(!$output->toBool()) { |
|
418 | + return; |
|
419 | + } |
|
386 | 420 | |
387 | 421 | $mid_info = $output->data; |
388 | 422 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
423 | + if($oCacheHandler->isSupport()) { |
|
424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
425 | + } |
|
390 | 426 | } |
391 | 427 | |
392 | 428 | if($mid_info && count($columnList)) |
@@ -399,11 +435,14 @@ discard block |
||
399 | 435 | $module_info->$key = $item; |
400 | 436 | } |
401 | 437 | } |
438 | + } else { |
|
439 | + $module_info = $mid_info; |
|
402 | 440 | } |
403 | - else $module_info = $mid_info; |
|
404 | 441 | |
405 | 442 | $oModuleController = getController('module'); |
406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
443 | + if(isset($module_info->browser_title)) { |
|
444 | + $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
445 | + } |
|
407 | 446 | |
408 | 447 | $this->applyDefaultSkin($module_info); |
409 | 448 | return $this->addModuleExtraVars($module_info); |
@@ -451,11 +490,15 @@ discard block |
||
451 | 490 | */ |
452 | 491 | function getModulesInfo($module_srls, $columnList = array()) |
453 | 492 | { |
454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
493 | + if(is_array($module_srls)) { |
|
494 | + $module_srls = implode(',',$module_srls); |
|
495 | + } |
|
455 | 496 | $args = new stdClass(); |
456 | 497 | $args->module_srls = $module_srls; |
457 | 498 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
458 | - if(!$output->toBool()) return; |
|
499 | + if(!$output->toBool()) { |
|
500 | + return; |
|
501 | + } |
|
459 | 502 | return $this->addModuleExtraVars($output->data); |
460 | 503 | } |
461 | 504 | |
@@ -465,31 +508,44 @@ discard block |
||
465 | 508 | function addModuleExtraVars($module_info) |
466 | 509 | { |
467 | 510 | // Process although one or more module informaion is requested |
468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
469 | - else $target_module_info = $module_info; |
|
511 | + if(!is_array($module_info)) { |
|
512 | + $target_module_info = array($module_info); |
|
513 | + } else { |
|
514 | + $target_module_info = $module_info; |
|
515 | + } |
|
470 | 516 | // Get module_srl |
471 | 517 | $module_srls = array(); |
472 | 518 | foreach($target_module_info as $key => $val) |
473 | 519 | { |
474 | 520 | $module_srl = $val->module_srl; |
475 | - if(!$module_srl) continue; |
|
521 | + if(!$module_srl) { |
|
522 | + continue; |
|
523 | + } |
|
476 | 524 | $module_srls[] = $val->module_srl; |
477 | 525 | } |
478 | 526 | // Extract extra information of the module and skin |
479 | 527 | $extra_vars = $this->getModuleExtraVars($module_srls); |
480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
528 | + if(!count($module_srls) || !count($extra_vars)) { |
|
529 | + return $module_info; |
|
530 | + } |
|
481 | 531 | |
482 | 532 | foreach($target_module_info as $key => $val) |
483 | 533 | { |
484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
534 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
535 | + continue; |
|
536 | + } |
|
485 | 537 | foreach($extra_vars[$val->module_srl] as $k => $v) |
486 | 538 | { |
487 | - if($target_module_info[$key]->{$k}) continue; |
|
539 | + if($target_module_info[$key]->{$k}) { |
|
540 | + continue; |
|
541 | + } |
|
488 | 542 | $target_module_info[$key]->{$k} = $v; |
489 | 543 | } |
490 | 544 | } |
491 | 545 | |
492 | - if(is_array($module_info)) return $target_module_info; |
|
546 | + if(is_array($module_info)) { |
|
547 | + return $target_module_info; |
|
548 | + } |
|
493 | 549 | return $target_module_info[0]; |
494 | 550 | } |
495 | 551 | |
@@ -518,7 +574,9 @@ discard block |
||
518 | 574 | } |
519 | 575 | |
520 | 576 | $output = executeQuery('module.getMidList', $args, $columnList); |
521 | - if(!$output->toBool()) return $output; |
|
577 | + if(!$output->toBool()) { |
|
578 | + return $output; |
|
579 | + } |
|
522 | 580 | $list = $output->data; |
523 | 581 | |
524 | 582 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -526,9 +584,13 @@ discard block |
||
526 | 584 | $oCacheHandler->put($cache_key, $list); |
527 | 585 | } |
528 | 586 | } |
529 | - if(!$list) return; |
|
587 | + if(!$list) { |
|
588 | + return; |
|
589 | + } |
|
530 | 590 | |
531 | - if(!is_array($list)) $list = array($list); |
|
591 | + if(!is_array($list)) { |
|
592 | + $list = array($list); |
|
593 | + } |
|
532 | 594 | |
533 | 595 | foreach($list as $val) |
534 | 596 | { |
@@ -544,10 +606,14 @@ discard block |
||
544 | 606 | function getModuleSrlList($args = null, $columnList = array()) |
545 | 607 | { |
546 | 608 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
547 | - if(!$output->toBool()) return $output; |
|
609 | + if(!$output->toBool()) { |
|
610 | + return $output; |
|
611 | + } |
|
548 | 612 | |
549 | 613 | $list = $output->data; |
550 | - if(!$list) return; |
|
614 | + if(!$list) { |
|
615 | + return; |
|
616 | + } |
|
551 | 617 | |
552 | 618 | return $list; |
553 | 619 | } |
@@ -557,20 +623,32 @@ discard block |
||
557 | 623 | */ |
558 | 624 | function getModuleSrlByMid($mid) |
559 | 625 | { |
560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
626 | + if($mid && !is_array($mid)) { |
|
627 | + $mid = explode(',',$mid); |
|
628 | + } |
|
629 | + if(is_array($mid)) { |
|
630 | + $mid = "'".implode("','",$mid)."'"; |
|
631 | + } |
|
562 | 632 | |
563 | 633 | $site_module_info = Context::get('site_module_info'); |
564 | 634 | |
565 | 635 | $args = new stdClass; |
566 | 636 | $args->mid = $mid; |
567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
637 | + if($site_module_info) { |
|
638 | + $args->site_srl = $site_module_info->site_srl; |
|
639 | + } |
|
568 | 640 | $output = executeQuery('module.getModuleSrlByMid', $args); |
569 | - if(!$output->toBool()) return $output; |
|
641 | + if(!$output->toBool()) { |
|
642 | + return $output; |
|
643 | + } |
|
570 | 644 | |
571 | 645 | $list = $output->data; |
572 | - if(!$list) return; |
|
573 | - if(!is_array($list)) $list = array($list); |
|
646 | + if(!$list) { |
|
647 | + return; |
|
648 | + } |
|
649 | + if(!is_array($list)) { |
|
650 | + $list = array($list); |
|
651 | + } |
|
574 | 652 | |
575 | 653 | foreach($list as $key => $val) |
576 | 654 | { |
@@ -599,8 +677,12 @@ discard block |
||
599 | 677 | { |
600 | 678 | $args = new stdClass(); |
601 | 679 | $output = executeQueryArray('module.getActionForward',$args); |
602 | - if(!$output->toBool()) return new stdClass; |
|
603 | - if(!$output->data) $output->data = array(); |
|
680 | + if(!$output->toBool()) { |
|
681 | + return new stdClass; |
|
682 | + } |
|
683 | + if(!$output->data) { |
|
684 | + $output->data = array(); |
|
685 | + } |
|
604 | 686 | |
605 | 687 | $action_forward = array(); |
606 | 688 | foreach($output->data as $item) |
@@ -617,8 +699,7 @@ discard block |
||
617 | 699 | if($action_forward[$act]) |
618 | 700 | { |
619 | 701 | return $action_forward[$act]; |
620 | - } |
|
621 | - else |
|
702 | + } else |
|
622 | 703 | { |
623 | 704 | return new stdClass(); |
624 | 705 | } |
@@ -726,8 +807,7 @@ discard block |
||
726 | 807 | if(file_exists($cache_file)) |
727 | 808 | { |
728 | 809 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
729 | - } |
|
730 | - else |
|
810 | + } else |
|
731 | 811 | { |
732 | 812 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
733 | 813 | } |
@@ -743,16 +823,22 @@ discard block |
||
743 | 823 | { |
744 | 824 | // Get a path of the requested module. Return if not exists. |
745 | 825 | $module_path = ModuleHandler::getModulePath($module); |
746 | - if(!$module_path) return; |
|
826 | + if(!$module_path) { |
|
827 | + return; |
|
828 | + } |
|
747 | 829 | // Read the xml file for module skin information |
748 | 830 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
749 | - if(!file_exists($xml_file)) return; |
|
831 | + if(!file_exists($xml_file)) { |
|
832 | + return; |
|
833 | + } |
|
750 | 834 | |
751 | 835 | $oXmlParser = new XmlParser(); |
752 | 836 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
753 | 837 | $xml_obj = $tmp_xml_obj->module; |
754 | 838 | |
755 | - if(!$xml_obj) return; |
|
839 | + if(!$xml_obj) { |
|
840 | + return; |
|
841 | + } |
|
756 | 842 | |
757 | 843 | // Module Information |
758 | 844 | $module_info = new stdClass(); |
@@ -764,14 +850,19 @@ discard block |
||
764 | 850 | $module_info->version = $xml_obj->version->body; |
765 | 851 | $module_info->homepage = $xml_obj->link->body; |
766 | 852 | $module_info->category = $xml_obj->category->body; |
767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
853 | + if(!$module_info->category) { |
|
854 | + $module_info->category = 'service'; |
|
855 | + } |
|
768 | 856 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 857 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
770 | 858 | $module_info->license = $xml_obj->license->body; |
771 | 859 | $module_info->license_link = $xml_obj->license->attrs->link; |
772 | 860 | |
773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
774 | - else $author_list = $xml_obj->author; |
|
861 | + if(!is_array($xml_obj->author)) { |
|
862 | + $author_list[] = $xml_obj->author; |
|
863 | + } else { |
|
864 | + $author_list = $xml_obj->author; |
|
865 | + } |
|
775 | 866 | |
776 | 867 | foreach($author_list as $author) |
777 | 868 | { |
@@ -781,15 +872,16 @@ discard block |
||
781 | 872 | $author_obj->homepage = $author->attrs->link; |
782 | 873 | $module_info->author[] = $author_obj; |
783 | 874 | } |
784 | - } |
|
785 | - else |
|
875 | + } else |
|
786 | 876 | { |
787 | 877 | // module format 0.1 |
788 | 878 | $module_info->title = $xml_obj->title->body; |
789 | 879 | $module_info->description = $xml_obj->author->description->body; |
790 | 880 | $module_info->version = $xml_obj->attrs->version; |
791 | 881 | $module_info->category = $xml_obj->attrs->category; |
792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
882 | + if(!$module_info->category) { |
|
883 | + $module_info->category = 'service'; |
|
884 | + } |
|
793 | 885 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 886 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
795 | 887 | $author_obj = new stdClass(); |
@@ -818,11 +910,15 @@ discard block |
||
818 | 910 | { |
819 | 911 | // Get a path of the requested module. Return if not exists. |
820 | 912 | $class_path = ModuleHandler::getModulePath($module); |
821 | - if(!$class_path) return; |
|
913 | + if(!$class_path) { |
|
914 | + return; |
|
915 | + } |
|
822 | 916 | |
823 | 917 | // Check if module.xml exists in the path. Return if not exist |
824 | 918 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
825 | - if(!file_exists($xml_file)) return; |
|
919 | + if(!file_exists($xml_file)) { |
|
920 | + return; |
|
921 | + } |
|
826 | 922 | |
827 | 923 | // Check if cached file exists |
828 | 924 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -841,7 +937,10 @@ discard block |
||
841 | 937 | |
842 | 938 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
843 | 939 | |
844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
940 | + if(!count($xml_obj->module)) { |
|
941 | + return; |
|
942 | + } |
|
943 | + // /< Error occurs if module tag doesn't included in the xml |
|
845 | 944 | |
846 | 945 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
847 | 946 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -853,8 +952,11 @@ discard block |
||
853 | 952 | // Arrange permission information |
854 | 953 | if($grants) |
855 | 954 | { |
856 | - if(is_array($grants)) $grant_list = $grants; |
|
857 | - else $grant_list[] = $grants; |
|
955 | + if(is_array($grants)) { |
|
956 | + $grant_list = $grants; |
|
957 | + } else { |
|
958 | + $grant_list[] = $grants; |
|
959 | + } |
|
858 | 960 | |
859 | 961 | $info->grant = new stdClass(); |
860 | 962 | $buff[] = '$info->grant = new stdClass;'; |
@@ -876,8 +978,11 @@ discard block |
||
876 | 978 | // Permissions to grant |
877 | 979 | if($permissions) |
878 | 980 | { |
879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
880 | - else $permission_list[] = $permissions; |
|
981 | + if(is_array($permissions)) { |
|
982 | + $permission_list = $permissions; |
|
983 | + } else { |
|
984 | + $permission_list[] = $permissions; |
|
985 | + } |
|
881 | 986 | |
882 | 987 | $buff[] = '$info->permission = new stdClass;'; |
883 | 988 | |
@@ -895,8 +1000,11 @@ discard block |
||
895 | 1000 | // for admin menus |
896 | 1001 | if($menus) |
897 | 1002 | { |
898 | - if(is_array($menus)) $menu_list = $menus; |
|
899 | - else $menu_list[] = $menus; |
|
1003 | + if(is_array($menus)) { |
|
1004 | + $menu_list = $menus; |
|
1005 | + } else { |
|
1006 | + $menu_list[] = $menus; |
|
1007 | + } |
|
900 | 1008 | |
901 | 1009 | $buff[] = '$info->menu = new stdClass;'; |
902 | 1010 | $info->menu = new stdClass(); |
@@ -920,8 +1028,11 @@ discard block |
||
920 | 1028 | // actions |
921 | 1029 | if($actions) |
922 | 1030 | { |
923 | - if(is_array($actions)) $action_list = $actions; |
|
924 | - else $action_list[] = $actions; |
|
1031 | + if(is_array($actions)) { |
|
1032 | + $action_list = $actions; |
|
1033 | + } else { |
|
1034 | + $action_list[] = $actions; |
|
1035 | + } |
|
925 | 1036 | |
926 | 1037 | $buff[] = '$info->action = new stdClass;'; |
927 | 1038 | $info->action = new stdClass(); |
@@ -1010,7 +1121,9 @@ discard block |
||
1010 | 1121 | return $info; |
1011 | 1122 | } |
1012 | 1123 | |
1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
1124 | + if(file_exists($cache_file)) { |
|
1125 | + return include($cache_file); |
|
1126 | + } |
|
1014 | 1127 | } |
1015 | 1128 | |
1016 | 1129 | /** |
@@ -1048,7 +1161,9 @@ discard block |
||
1048 | 1161 | |
1049 | 1162 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1050 | 1163 | $list = FileHandler::readDir($skin_path); |
1051 | - if(!count($list)) return; |
|
1164 | + if(!count($list)) { |
|
1165 | + return; |
|
1166 | + } |
|
1052 | 1167 | |
1053 | 1168 | natcasesort($list); |
1054 | 1169 | |
@@ -1102,8 +1217,7 @@ discard block |
||
1102 | 1217 | if($dir == 'skins') |
1103 | 1218 | { |
1104 | 1219 | $type = 'P'; |
1105 | - } |
|
1106 | - else |
|
1220 | + } else |
|
1107 | 1221 | { |
1108 | 1222 | $type = 'M'; |
1109 | 1223 | } |
@@ -1131,14 +1245,20 @@ discard block |
||
1131 | 1245 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1132 | 1246 | { |
1133 | 1247 | // Read xml file having skin information |
1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1248 | + if(substr($path,-1)!='/') { |
|
1249 | + $path .= '/'; |
|
1250 | + } |
|
1135 | 1251 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1136 | - if(!file_exists($skin_xml_file)) return; |
|
1252 | + if(!file_exists($skin_xml_file)) { |
|
1253 | + return; |
|
1254 | + } |
|
1137 | 1255 | // Create XmlParser object |
1138 | 1256 | $oXmlParser = new XmlParser(); |
1139 | 1257 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1140 | 1258 | // Return if no skin information is |
1141 | - if(!$_xml_obj->skin) return; |
|
1259 | + if(!$_xml_obj->skin) { |
|
1260 | + return; |
|
1261 | + } |
|
1142 | 1262 | $xml_obj = $_xml_obj->skin; |
1143 | 1263 | // Skin Name |
1144 | 1264 | $skin_info = new stdClass(); |
@@ -1155,8 +1275,11 @@ discard block |
||
1155 | 1275 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1156 | 1276 | $skin_info->description = $xml_obj->description->body; |
1157 | 1277 | |
1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1159 | - else $author_list = $xml_obj->author; |
|
1278 | + if(!is_array($xml_obj->author)) { |
|
1279 | + $author_list[] = $xml_obj->author; |
|
1280 | + } else { |
|
1281 | + $author_list = $xml_obj->author; |
|
1282 | + } |
|
1160 | 1283 | |
1161 | 1284 | foreach($author_list as $author) |
1162 | 1285 | { |
@@ -1170,8 +1293,12 @@ discard block |
||
1170 | 1293 | if($xml_obj->extra_vars) |
1171 | 1294 | { |
1172 | 1295 | $extra_var_groups = $xml_obj->extra_vars->group; |
1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1296 | + if(!$extra_var_groups) { |
|
1297 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1298 | + } |
|
1299 | + if(!is_array($extra_var_groups)) { |
|
1300 | + $extra_var_groups = array($extra_var_groups); |
|
1301 | + } |
|
1175 | 1302 | |
1176 | 1303 | foreach($extra_var_groups as $group) |
1177 | 1304 | { |
@@ -1180,7 +1307,9 @@ discard block |
||
1180 | 1307 | { |
1181 | 1308 | continue; |
1182 | 1309 | } |
1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1310 | + if(!is_array($group->var)) { |
|
1311 | + $extra_vars = array($group->var); |
|
1312 | + } |
|
1184 | 1313 | |
1185 | 1314 | foreach($extra_vars as $key => $val) |
1186 | 1315 | { |
@@ -1207,8 +1336,7 @@ discard block |
||
1207 | 1336 | $obj->options[$i]->title = $val->options[$i]->title->body; |
1208 | 1337 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
1209 | 1338 | } |
1210 | - } |
|
1211 | - else |
|
1339 | + } else |
|
1212 | 1340 | { |
1213 | 1341 | $obj->options[0] = new stdClass(); |
1214 | 1342 | $obj->options[0]->title = $val->options->title->body; |
@@ -1219,8 +1347,7 @@ discard block |
||
1219 | 1347 | } |
1220 | 1348 | } |
1221 | 1349 | } |
1222 | - } |
|
1223 | - else |
|
1350 | + } else |
|
1224 | 1351 | { |
1225 | 1352 | // skin format v0.1 |
1226 | 1353 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1238,8 +1365,12 @@ discard block |
||
1238 | 1365 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1239 | 1366 | // Variables used in the skin |
1240 | 1367 | $extra_var_groups = $xml_obj->extra_vars->group; |
1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1368 | + if(!$extra_var_groups) { |
|
1369 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1370 | + } |
|
1371 | + if(!is_array($extra_var_groups)) { |
|
1372 | + $extra_var_groups = array($extra_var_groups); |
|
1373 | + } |
|
1243 | 1374 | |
1244 | 1375 | foreach($extra_var_groups as $group) |
1245 | 1376 | { |
@@ -1247,7 +1378,9 @@ discard block |
||
1247 | 1378 | |
1248 | 1379 | if($extra_vars) |
1249 | 1380 | { |
1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1381 | + if(!is_array($extra_vars)) { |
|
1382 | + $extra_vars = array($extra_vars); |
|
1383 | + } |
|
1251 | 1384 | |
1252 | 1385 | foreach($extra_vars as $var) |
1253 | 1386 | { |
@@ -1269,8 +1402,7 @@ discard block |
||
1269 | 1402 | $options[$i]->title = $var->default[$i]->body; |
1270 | 1403 | $options[$i]->value = $var->default[$i]->body; |
1271 | 1404 | } |
1272 | - } |
|
1273 | - else |
|
1405 | + } else |
|
1274 | 1406 | { |
1275 | 1407 | $options[0]->title = $var->default->body; |
1276 | 1408 | $options[0]->value = $var->default->body; |
@@ -1300,7 +1432,9 @@ discard block |
||
1300 | 1432 | $colorset = $xml_obj->colorset->color; |
1301 | 1433 | if($colorset) |
1302 | 1434 | { |
1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1435 | + if(!is_array($colorset)) { |
|
1436 | + $colorset = array($colorset); |
|
1437 | + } |
|
1304 | 1438 | |
1305 | 1439 | foreach($colorset as $color) |
1306 | 1440 | { |
@@ -1310,9 +1444,12 @@ discard block |
||
1310 | 1444 | if($screenshot) |
1311 | 1445 | { |
1312 | 1446 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1447 | + if(!file_exists($screenshot)) { |
|
1448 | + $screenshot = ""; |
|
1449 | + } |
|
1450 | + } else { |
|
1451 | + $screenshot = ""; |
|
1314 | 1452 | } |
1315 | - else $screenshot = ""; |
|
1316 | 1453 | |
1317 | 1454 | $obj = new stdClass(); |
1318 | 1455 | $obj->name = $name; |
@@ -1325,7 +1462,9 @@ discard block |
||
1325 | 1462 | if($xml_obj->menus->menu) |
1326 | 1463 | { |
1327 | 1464 | $menus = $xml_obj->menus->menu; |
1328 | - if(!is_array($menus)) $menus = array($menus); |
|
1465 | + if(!is_array($menus)) { |
|
1466 | + $menus = array($menus); |
|
1467 | + } |
|
1329 | 1468 | |
1330 | 1469 | $menu_count = count($menus); |
1331 | 1470 | $skin_info->menu_count = $menu_count; |
@@ -1334,7 +1473,9 @@ discard block |
||
1334 | 1473 | unset($obj); |
1335 | 1474 | |
1336 | 1475 | $obj->name = $menus[$i]->attrs->name; |
1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1476 | + if($menus[$i]->attrs->default == "true") { |
|
1477 | + $obj->default = true; |
|
1478 | + } |
|
1338 | 1479 | $obj->title = $menus[$i]->title->body; |
1339 | 1480 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1340 | 1481 | |
@@ -1354,7 +1495,9 @@ discard block |
||
1354 | 1495 | { |
1355 | 1496 | $args = new stdClass; |
1356 | 1497 | $args->site_srl = $site_srl; |
1357 | - if(!is_null($module)) $args->module = $module; |
|
1498 | + if(!is_null($module)) { |
|
1499 | + $args->module = $module; |
|
1500 | + } |
|
1358 | 1501 | $output = executeQuery('module.getModuleCount', $args); |
1359 | 1502 | return $output->data->count; |
1360 | 1503 | } |
@@ -1383,8 +1526,11 @@ discard block |
||
1383 | 1526 | $args->module = $module; |
1384 | 1527 | $args->site_srl = $site_srl; |
1385 | 1528 | $output = executeQuery('module.getModuleConfig', $args); |
1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1387 | - else $config = null; |
|
1529 | + if($output->data->config) { |
|
1530 | + $config = unserialize($output->data->config); |
|
1531 | + } else { |
|
1532 | + $config = null; |
|
1533 | + } |
|
1388 | 1534 | |
1389 | 1535 | //insert in cache |
1390 | 1536 | if($oCacheHandler->isSupport()) |
@@ -1423,8 +1569,11 @@ discard block |
||
1423 | 1569 | $args->module = $module; |
1424 | 1570 | $args->module_srl = $module_srl; |
1425 | 1571 | $output = executeQuery('module.getModulePartConfig', $args); |
1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1427 | - else $config = null; |
|
1572 | + if($output->data->config) { |
|
1573 | + $config = unserialize($output->data->config); |
|
1574 | + } else { |
|
1575 | + $config = null; |
|
1576 | + } |
|
1428 | 1577 | |
1429 | 1578 | //insert in cache |
1430 | 1579 | if($oCacheHandler->isSupport()) |
@@ -1446,9 +1595,13 @@ discard block |
||
1446 | 1595 | { |
1447 | 1596 | $args = new stdClass(); |
1448 | 1597 | $args->module = $module; |
1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
1598 | + if($site_srl) { |
|
1599 | + $args->site_srl = $site_srl; |
|
1600 | + } |
|
1450 | 1601 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
1602 | + if(!$output->toBool() || !$output->data) { |
|
1603 | + return array(); |
|
1604 | + } |
|
1452 | 1605 | |
1453 | 1606 | foreach($output->data as $key => $val) |
1454 | 1607 | { |
@@ -1466,10 +1619,16 @@ discard block |
||
1466 | 1619 | $args->moduleCategorySrl = $moduleCategorySrl; |
1467 | 1620 | // Get data from the DB |
1468 | 1621 | $output = executeQuery('module.getModuleCategories', $args); |
1469 | - if(!$output->toBool()) return $output; |
|
1622 | + if(!$output->toBool()) { |
|
1623 | + return $output; |
|
1624 | + } |
|
1470 | 1625 | $list = $output->data; |
1471 | - if(!$list) return; |
|
1472 | - if(!is_array($list)) $list = array($list); |
|
1626 | + if(!$list) { |
|
1627 | + return; |
|
1628 | + } |
|
1629 | + if(!is_array($list)) { |
|
1630 | + $list = array($list); |
|
1631 | + } |
|
1473 | 1632 | |
1474 | 1633 | foreach($list as $val) |
1475 | 1634 | { |
@@ -1487,7 +1646,9 @@ discard block |
||
1487 | 1646 | $args = new stdClass; |
1488 | 1647 | $args->module_category_srl = $module_category_srl; |
1489 | 1648 | $output = executeQuery('module.getModuleCategory', $args); |
1490 | - if(!$output->toBool()) return $output; |
|
1649 | + if(!$output->toBool()) { |
|
1650 | + return $output; |
|
1651 | + } |
|
1491 | 1652 | return $output->data; |
1492 | 1653 | } |
1493 | 1654 | |
@@ -1499,7 +1660,9 @@ discard block |
||
1499 | 1660 | // Get a list of downloaded and installed modules |
1500 | 1661 | $searched_list = FileHandler::readDir('./modules'); |
1501 | 1662 | $searched_count = count($searched_list); |
1502 | - if(!$searched_count) return; |
|
1663 | + if(!$searched_count) { |
|
1664 | + return; |
|
1665 | + } |
|
1503 | 1666 | sort($searched_list); |
1504 | 1667 | |
1505 | 1668 | for($i=0;$i<$searched_count;$i++) |
@@ -1512,7 +1675,9 @@ discard block |
||
1512 | 1675 | $info = $this->getModuleInfoXml($module_name); |
1513 | 1676 | unset($obj); |
1514 | 1677 | |
1515 | - if(!isset($info)) continue; |
|
1678 | + if(!isset($info)) { |
|
1679 | + continue; |
|
1680 | + } |
|
1516 | 1681 | $info->module = $module_name; |
1517 | 1682 | $info->created_table_count = $created_table_count; |
1518 | 1683 | $info->table_count = $table_count; |
@@ -1538,11 +1703,16 @@ discard block |
||
1538 | 1703 | for($j=0;$j<count($tmp_files);$j++) |
1539 | 1704 | { |
1540 | 1705 | list($table_name) = explode(".",$tmp_files[$j]); |
1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1706 | + if($oDB->isTableExists($table_name)) { |
|
1707 | + $created_table_count ++; |
|
1708 | + } |
|
1542 | 1709 | } |
1543 | 1710 | // Check if DB is installed |
1544 | - if($table_count > $created_table_count) return true; |
|
1545 | - else return false; |
|
1711 | + if($table_count > $created_table_count) { |
|
1712 | + return true; |
|
1713 | + } else { |
|
1714 | + return false; |
|
1715 | + } |
|
1546 | 1716 | } |
1547 | 1717 | return false; |
1548 | 1718 | } |
@@ -1570,7 +1740,9 @@ discard block |
||
1570 | 1740 | sort($searched_list); |
1571 | 1741 | |
1572 | 1742 | $searched_count = count($searched_list); |
1573 | - if(!$searched_count) return; |
|
1743 | + if(!$searched_count) { |
|
1744 | + return; |
|
1745 | + } |
|
1574 | 1746 | |
1575 | 1747 | for($i=0;$i<$searched_count;$i++) |
1576 | 1748 | { |
@@ -1578,7 +1750,9 @@ discard block |
||
1578 | 1750 | $module_name = $searched_list[$i]; |
1579 | 1751 | |
1580 | 1752 | $path = ModuleHandler::getModulePath($module_name); |
1581 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1753 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
1754 | + continue; |
|
1755 | + } |
|
1582 | 1756 | |
1583 | 1757 | // Get the number of xml files to create a table in schemas |
1584 | 1758 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1588,13 +1762,17 @@ discard block |
||
1588 | 1762 | for($j=0;$j<$table_count;$j++) |
1589 | 1763 | { |
1590 | 1764 | list($table_name) = explode('.',$tmp_files[$j]); |
1591 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1765 | + if($oDB->isTableExists($table_name)) { |
|
1766 | + $created_table_count ++; |
|
1767 | + } |
|
1592 | 1768 | } |
1593 | 1769 | // Get information of the module |
1594 | 1770 | $info = NULL; |
1595 | 1771 | $info = $this->getModuleInfoXml($module_name); |
1596 | 1772 | |
1597 | - if(!$info) continue; |
|
1773 | + if(!$info) { |
|
1774 | + continue; |
|
1775 | + } |
|
1598 | 1776 | |
1599 | 1777 | $info->module = $module_name; |
1600 | 1778 | $info->category = $info->category; |
@@ -1603,16 +1781,18 @@ discard block |
||
1603 | 1781 | $info->path = $path; |
1604 | 1782 | $info->admin_index_act = $info->admin_index_act; |
1605 | 1783 | // Check if DB is installed |
1606 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1607 | - else $info->need_install = false; |
|
1784 | + if($table_count > $created_table_count) { |
|
1785 | + $info->need_install = true; |
|
1786 | + } else { |
|
1787 | + $info->need_install = false; |
|
1788 | + } |
|
1608 | 1789 | // Check if it is upgraded to module.class.php on each module |
1609 | 1790 | $oDummy = null; |
1610 | 1791 | $oDummy = getModule($module_name, 'class'); |
1611 | 1792 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
1612 | 1793 | { |
1613 | 1794 | $info->need_update = $oDummy->checkUpdate(); |
1614 | - } |
|
1615 | - else |
|
1795 | + } else |
|
1616 | 1796 | { |
1617 | 1797 | continue; |
1618 | 1798 | } |
@@ -1629,7 +1809,9 @@ discard block |
||
1629 | 1809 | */ |
1630 | 1810 | function syncModuleToSite(&$data) |
1631 | 1811 | { |
1632 | - if(!$data) return; |
|
1812 | + if(!$data) { |
|
1813 | + return; |
|
1814 | + } |
|
1633 | 1815 | |
1634 | 1816 | if(is_array($data)) |
1635 | 1817 | { |
@@ -1637,9 +1819,10 @@ discard block |
||
1637 | 1819 | { |
1638 | 1820 | $module_srls[] = $val->module_srl; |
1639 | 1821 | } |
1640 | - if(!count($module_srls)) return; |
|
1641 | - } |
|
1642 | - else |
|
1822 | + if(!count($module_srls)) { |
|
1823 | + return; |
|
1824 | + } |
|
1825 | + } else |
|
1643 | 1826 | { |
1644 | 1827 | $module_srls[] = $data->module_srl; |
1645 | 1828 | } |
@@ -1647,7 +1830,9 @@ discard block |
||
1647 | 1830 | $args = new stdClass(); |
1648 | 1831 | $args->module_srls = implode(',',$module_srls); |
1649 | 1832 | $output = executeQueryArray('module.getModuleSites', $args); |
1650 | - if(!$output->data) return array(); |
|
1833 | + if(!$output->data) { |
|
1834 | + return array(); |
|
1835 | + } |
|
1651 | 1836 | foreach($output->data as $key => $val) |
1652 | 1837 | { |
1653 | 1838 | $modules[$val->module_srl] = $val; |
@@ -1659,8 +1844,7 @@ discard block |
||
1659 | 1844 | { |
1660 | 1845 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1661 | 1846 | } |
1662 | - } |
|
1663 | - else |
|
1847 | + } else |
|
1664 | 1848 | { |
1665 | 1849 | $data->domain = $modules[$data->module_srl]->domain; |
1666 | 1850 | } |
@@ -1671,24 +1855,31 @@ discard block |
||
1671 | 1855 | */ |
1672 | 1856 | function isSiteAdmin($member_info, $site_srl = null) |
1673 | 1857 | { |
1674 | - if(!$member_info->member_srl) return false; |
|
1675 | - if($member_info->is_admin == 'Y') return true; |
|
1858 | + if(!$member_info->member_srl) { |
|
1859 | + return false; |
|
1860 | + } |
|
1861 | + if($member_info->is_admin == 'Y') { |
|
1862 | + return true; |
|
1863 | + } |
|
1676 | 1864 | |
1677 | 1865 | $args = new stdClass(); |
1678 | 1866 | if(!isset($site_srl)) |
1679 | 1867 | { |
1680 | 1868 | $site_module_info = Context::get('site_module_info'); |
1681 | - if(!$site_module_info) return; |
|
1869 | + if(!$site_module_info) { |
|
1870 | + return; |
|
1871 | + } |
|
1682 | 1872 | $args->site_srl = $site_module_info->site_srl; |
1683 | - } |
|
1684 | - else |
|
1873 | + } else |
|
1685 | 1874 | { |
1686 | 1875 | $args->site_srl = $site_srl; |
1687 | 1876 | } |
1688 | 1877 | |
1689 | 1878 | $args->member_srl = $member_info->member_srl; |
1690 | 1879 | $output = executeQuery('module.isSiteAdmin', $args); |
1691 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1880 | + if($output->data->member_srl == $args->member_srl) { |
|
1881 | + return true; |
|
1882 | + } |
|
1692 | 1883 | return false; |
1693 | 1884 | } |
1694 | 1885 | |
@@ -1711,7 +1902,9 @@ discard block |
||
1711 | 1902 | $obj = new stdClass(); |
1712 | 1903 | $obj->module_srl = $module_srl; |
1713 | 1904 | $output = executeQueryArray('module.getAdminID', $obj); |
1714 | - if(!$output->toBool() || !$output->data) return; |
|
1905 | + if(!$output->toBool() || !$output->data) { |
|
1906 | + return; |
|
1907 | + } |
|
1715 | 1908 | |
1716 | 1909 | return $output->data; |
1717 | 1910 | } |
@@ -1724,7 +1917,9 @@ discard block |
||
1724 | 1917 | { |
1725 | 1918 | $extra_vars = array(); |
1726 | 1919 | $get_module_srls = array(); |
1727 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1920 | + if(!is_array($list_module_srl)) { |
|
1921 | + $list_module_srl = array($list_module_srl); |
|
1922 | + } |
|
1728 | 1923 | |
1729 | 1924 | $vars = false; |
1730 | 1925 | // cache controll |
@@ -1740,14 +1935,12 @@ discard block |
||
1740 | 1935 | if($vars) |
1741 | 1936 | { |
1742 | 1937 | $extra_vars[$module_srl] = $vars; |
1743 | - } |
|
1744 | - else |
|
1938 | + } else |
|
1745 | 1939 | { |
1746 | 1940 | $get_module_srls[] = $module_srl; |
1747 | 1941 | } |
1748 | 1942 | } |
1749 | - } |
|
1750 | - else |
|
1943 | + } else |
|
1751 | 1944 | { |
1752 | 1945 | $get_module_srls = $list_module_srl; |
1753 | 1946 | } |
@@ -1772,7 +1965,9 @@ discard block |
||
1772 | 1965 | } |
1773 | 1966 | foreach($output->data as $key => $val) |
1774 | 1967 | { |
1775 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1968 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
1969 | + continue; |
|
1970 | + } |
|
1776 | 1971 | |
1777 | 1972 | if(!isset($extra_vars[$val->module_srl])) |
1778 | 1973 | { |
@@ -1811,7 +2006,9 @@ discard block |
||
1811 | 2006 | $args = new stdClass(); |
1812 | 2007 | $args->module_srl = $module_srl; |
1813 | 2008 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
1814 | - if(!$output->toBool()) return; |
|
2009 | + if(!$output->toBool()) { |
|
2010 | + return; |
|
2011 | + } |
|
1815 | 2012 | |
1816 | 2013 | $skin_vars = array(); |
1817 | 2014 | foreach($output->data as $vars) |
@@ -1819,7 +2016,9 @@ discard block |
||
1819 | 2016 | $skin_vars[$vars->name] = $vars; |
1820 | 2017 | } |
1821 | 2018 | |
1822 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2019 | + if($oCacheHandler->isSupport()) { |
|
2020 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2021 | + } |
|
1823 | 2022 | } |
1824 | 2023 | |
1825 | 2024 | return $skin_vars; |
@@ -1831,7 +2030,9 @@ discard block |
||
1831 | 2030 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1832 | 2031 | { |
1833 | 2032 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1834 | - if(!$site_srl) $site_srl = 0; |
|
2033 | + if(!$site_srl) { |
|
2034 | + $site_srl = 0; |
|
2035 | + } |
|
1835 | 2036 | |
1836 | 2037 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1837 | 2038 | if(is_readable($designInfoFile)) |
@@ -1848,19 +2049,16 @@ discard block |
||
1848 | 2049 | if(is_dir($moduleSkinPath.'default')) |
1849 | 2050 | { |
1850 | 2051 | $skinName = 'default'; |
1851 | - } |
|
1852 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
2052 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
1853 | 2053 | { |
1854 | 2054 | $skinName = 'xe_default'; |
1855 | - } |
|
1856 | - else |
|
2055 | + } else |
|
1857 | 2056 | { |
1858 | 2057 | $skins = FileHandler::readDir($moduleSkinPath); |
1859 | 2058 | if(count($skins) > 0) |
1860 | 2059 | { |
1861 | 2060 | $skinName = $skins[0]; |
1862 | - } |
|
1863 | - else |
|
2061 | + } else |
|
1864 | 2062 | { |
1865 | 2063 | $skinName = NULL; |
1866 | 2064 | } |
@@ -1868,7 +2066,9 @@ discard block |
||
1868 | 2066 | |
1869 | 2067 | if($updateCache && $skinName) |
1870 | 2068 | { |
1871 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
2069 | + if(!isset($designInfo->module->{$module_name})) { |
|
2070 | + $designInfo->module->{$module_name} = new stdClass(); |
|
2071 | + } |
|
1872 | 2072 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1873 | 2073 | |
1874 | 2074 | $oAdminController = getAdminController('admin'); |
@@ -1884,23 +2084,28 @@ discard block |
||
1884 | 2084 | */ |
1885 | 2085 | function syncSkinInfoToModuleInfo(&$module_info) |
1886 | 2086 | { |
1887 | - if(!$module_info->module_srl) return; |
|
2087 | + if(!$module_info->module_srl) { |
|
2088 | + return; |
|
2089 | + } |
|
1888 | 2090 | |
1889 | 2091 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1890 | 2092 | if(Mobile::isFromMobilePhone()) |
1891 | 2093 | { |
1892 | 2094 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1893 | - } |
|
1894 | - else |
|
2095 | + } else |
|
1895 | 2096 | { |
1896 | 2097 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1897 | 2098 | } |
1898 | 2099 | |
1899 | - if(!$skin_vars) return; |
|
2100 | + if(!$skin_vars) { |
|
2101 | + return; |
|
2102 | + } |
|
1900 | 2103 | |
1901 | 2104 | foreach($skin_vars as $name => $val) |
1902 | 2105 | { |
1903 | - if(isset($module_info->{$name})) continue; |
|
2106 | + if(isset($module_info->{$name})) { |
|
2107 | + continue; |
|
2108 | + } |
|
1904 | 2109 | $module_info->{$name} = $val->value; |
1905 | 2110 | } |
1906 | 2111 | } |
@@ -1926,7 +2131,9 @@ discard block |
||
1926 | 2131 | $args = new stdClass(); |
1927 | 2132 | $args->module_srl = $module_srl; |
1928 | 2133 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1929 | - if(!$output->toBool() || !$output->data) return; |
|
2134 | + if(!$output->toBool() || !$output->data) { |
|
2135 | + return; |
|
2136 | + } |
|
1930 | 2137 | |
1931 | 2138 | $skin_vars = array(); |
1932 | 2139 | foreach($output->data as $vars) |
@@ -1934,7 +2141,9 @@ discard block |
||
1934 | 2141 | $skin_vars[$vars->name] = $vars; |
1935 | 2142 | } |
1936 | 2143 | |
1937 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2144 | + if($oCacheHandler->isSupport()) { |
|
2145 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2146 | + } |
|
1938 | 2147 | } |
1939 | 2148 | |
1940 | 2149 | return $skin_vars; |
@@ -1946,7 +2155,9 @@ discard block |
||
1946 | 2155 | */ |
1947 | 2156 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1948 | 2157 | { |
1949 | - if(!$module_info->module_srl) return; |
|
2158 | + if(!$module_info->module_srl) { |
|
2159 | + return; |
|
2160 | + } |
|
1950 | 2161 | $skin_vars = false; |
1951 | 2162 | // cache controll |
1952 | 2163 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1961,17 +2172,25 @@ discard block |
||
1961 | 2172 | $args = new stdClass; |
1962 | 2173 | $args->module_srl = $module_info->module_srl; |
1963 | 2174 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1964 | - if(!$output->toBool()) return; |
|
2175 | + if(!$output->toBool()) { |
|
2176 | + return; |
|
2177 | + } |
|
1965 | 2178 | $skin_vars = $output->data; |
1966 | 2179 | |
1967 | 2180 | //insert in cache |
1968 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2181 | + if($oCacheHandler->isSupport()) { |
|
2182 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2183 | + } |
|
2184 | + } |
|
2185 | + if(!$skin_vars) { |
|
2186 | + return; |
|
1969 | 2187 | } |
1970 | - if(!$skin_vars) return; |
|
1971 | 2188 | |
1972 | 2189 | foreach($output->data as $val) |
1973 | 2190 | { |
1974 | - if(isset($module_info->{$val->name})) continue; |
|
2191 | + if(isset($module_info->{$val->name})) { |
|
2192 | + continue; |
|
2193 | + } |
|
1975 | 2194 | $module_info->{$val->name} = $val->value; |
1976 | 2195 | } |
1977 | 2196 | } |
@@ -1993,10 +2212,12 @@ discard block |
||
1993 | 2212 | $grant_info = $xml_info->grant; |
1994 | 2213 | if($member_info->member_srl) |
1995 | 2214 | { |
1996 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1997 | - else $group_list = array(); |
|
1998 | - } |
|
1999 | - else |
|
2215 | + if(is_array($member_info->group_list)) { |
|
2216 | + $group_list = array_keys($member_info->group_list); |
|
2217 | + } else { |
|
2218 | + $group_list = array(); |
|
2219 | + } |
|
2220 | + } else |
|
2000 | 2221 | { |
2001 | 2222 | $group_list = array(); |
2002 | 2223 | } |
@@ -2010,8 +2231,7 @@ discard block |
||
2010 | 2231 | } |
2011 | 2232 | |
2012 | 2233 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
2013 | - } |
|
2014 | - else |
|
2234 | + } else |
|
2015 | 2235 | { |
2016 | 2236 | // If module_srl exists |
2017 | 2237 | // Get a type of granted permission |
@@ -2024,7 +2244,9 @@ discard block |
||
2024 | 2244 | $args->module_srl = $module_srl; |
2025 | 2245 | $args->member_srl = $member_info->member_srl; |
2026 | 2246 | $output = executeQuery('module.getModuleAdmin',$args); |
2027 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2247 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
2248 | + $grant->manager = true; |
|
2249 | + } |
|
2028 | 2250 | } |
2029 | 2251 | // If not an administrator, get information from the DB and grant manager privilege. |
2030 | 2252 | if(!$grant->manager) |
@@ -2034,8 +2256,7 @@ discard block |
||
2034 | 2256 | if($module_info->module == 'planet') |
2035 | 2257 | { |
2036 | 2258 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2037 | - } |
|
2038 | - else |
|
2259 | + } else |
|
2039 | 2260 | { |
2040 | 2261 | $args = new stdClass; |
2041 | 2262 | $args->module_srl = $module_srl; |
@@ -2050,42 +2271,48 @@ discard block |
||
2050 | 2271 | foreach($output->data as $val) |
2051 | 2272 | { |
2052 | 2273 | $grant_exists[$val->name] = true; |
2053 | - if($granted[$val->name]) continue; |
|
2274 | + if($granted[$val->name]) { |
|
2275 | + continue; |
|
2276 | + } |
|
2054 | 2277 | // Log-in member only |
2055 | 2278 | if($val->group_srl == -1) |
2056 | 2279 | { |
2057 | 2280 | $granted[$val->name] = true; |
2058 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2281 | + if($member_info->member_srl) { |
|
2282 | + $grant->{$val->name} = true; |
|
2283 | + } |
|
2059 | 2284 | // Site-joined member only |
2060 | - } |
|
2061 | - elseif($val->group_srl == -2) |
|
2285 | + } elseif($val->group_srl == -2) |
|
2062 | 2286 | { |
2063 | 2287 | $granted[$val->name] = true; |
2064 | 2288 | // Do not grant any permission for non-logged member |
2065 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2289 | + if(!$member_info->member_srl) { |
|
2290 | + $grant->{$val->name} = false; |
|
2291 | + } |
|
2066 | 2292 | // Log-in member |
2067 | 2293 | else |
2068 | 2294 | { |
2069 | 2295 | $site_module_info = Context::get('site_module_info'); |
2070 | 2296 | // Permission granted if no information of the currently connected site exists |
2071 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2297 | + if(!$site_module_info->site_srl) { |
|
2298 | + $grant->{$val->name} = true; |
|
2299 | + } |
|
2072 | 2300 | // Permission is not granted if information of the currently connected site exists |
2073 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2301 | + elseif(count($group_list)) { |
|
2302 | + $grant->{$val->name} = true; |
|
2303 | + } |
|
2074 | 2304 | } |
2075 | 2305 | // All of non-logged members |
2076 | - } |
|
2077 | - elseif($val->group_srl == -3) |
|
2306 | + } elseif($val->group_srl == -3) |
|
2078 | 2307 | { |
2079 | 2308 | $granted[$val->name] = true; |
2080 | 2309 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2081 | - } |
|
2082 | - elseif($val->group_srl == 0) |
|
2310 | + } elseif($val->group_srl == 0) |
|
2083 | 2311 | { |
2084 | 2312 | $granted[$val->name] = true; |
2085 | 2313 | $grant->{$val->name} = true; |
2086 | 2314 | // If a target is a group |
2087 | - } |
|
2088 | - else |
|
2315 | + } else |
|
2089 | 2316 | { |
2090 | 2317 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
2091 | 2318 | { |
@@ -2096,30 +2323,43 @@ discard block |
||
2096 | 2323 | } |
2097 | 2324 | } |
2098 | 2325 | // Separate processing for the virtual group access |
2099 | - if(!$grant_exists['access']) $grant->access = true; |
|
2326 | + if(!$grant_exists['access']) { |
|
2327 | + $grant->access = true; |
|
2328 | + } |
|
2100 | 2329 | if(count($grant_info)) |
2101 | 2330 | { |
2102 | 2331 | foreach($grant_info as $grant_name => $grant_item) |
2103 | 2332 | { |
2104 | - if($grant_exists[$grant_name]) continue; |
|
2333 | + if($grant_exists[$grant_name]) { |
|
2334 | + continue; |
|
2335 | + } |
|
2105 | 2336 | switch($grant_item->default) |
2106 | 2337 | { |
2107 | 2338 | case 'guest' : |
2108 | 2339 | $grant->{$grant_name} = true; |
2109 | 2340 | break; |
2110 | 2341 | case 'member' : |
2111 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2112 | - else $grant->{$grant_name} = false; |
|
2342 | + if($member_info->member_srl) { |
|
2343 | + $grant->{$grant_name} = true; |
|
2344 | + } else { |
|
2345 | + $grant->{$grant_name} = false; |
|
2346 | + } |
|
2113 | 2347 | break; |
2114 | 2348 | case 'site' : |
2115 | 2349 | $site_module_info = Context::get('site_module_info'); |
2116 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2117 | - else $grant->{$grant_name} = false; |
|
2350 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
2351 | + $grant->{$grant_name} = true; |
|
2352 | + } else { |
|
2353 | + $grant->{$grant_name} = false; |
|
2354 | + } |
|
2118 | 2355 | break; |
2119 | 2356 | case 'manager' : |
2120 | 2357 | case 'root' : |
2121 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2122 | - else $grant->{$grant_name} = false; |
|
2358 | + if($member_info->is_admin == 'Y') { |
|
2359 | + $grant->{$grant_name} = true; |
|
2360 | + } else { |
|
2361 | + $grant->{$grant_name} = false; |
|
2362 | + } |
|
2123 | 2363 | break; |
2124 | 2364 | } |
2125 | 2365 | } |
@@ -2195,16 +2435,22 @@ discard block |
||
2195 | 2435 | function getFileBoxListHtml() |
2196 | 2436 | { |
2197 | 2437 | $logged_info = Context::get('logged_info'); |
2198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2438 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
2439 | + return new Object(-1, 'msg_not_permitted'); |
|
2440 | + } |
|
2199 | 2441 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2200 | 2442 | $link_params = explode('&',$link['query']); |
2201 | 2443 | foreach ($link_params as $param) |
2202 | 2444 | { |
2203 | 2445 | $param = explode("=",$param); |
2204 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2446 | + if($param[0] == 'selected_widget') { |
|
2447 | + $selected_widget = $param[1]; |
|
2448 | + } |
|
2205 | 2449 | } |
2206 | 2450 | $oWidgetModel = getModel('widget'); |
2207 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2451 | + if($selected_widget) { |
|
2452 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2453 | + } |
|
2208 | 2454 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2209 | 2455 | |
2210 | 2456 | $oModuleModel = getModel('module'); |
@@ -2212,7 +2458,9 @@ discard block |
||
2212 | 2458 | Context::set('filebox_list', $output->data); |
2213 | 2459 | |
2214 | 2460 | $page = Context::get('page'); |
2215 | - if (!$page) $page = 1; |
|
2461 | + if (!$page) { |
|
2462 | + $page = 1; |
|
2463 | + } |
|
2216 | 2464 | Context::set('page', $page); |
2217 | 2465 | Context::set('page_navigation', $output->page_navigation); |
2218 | 2466 | |
@@ -2242,25 +2490,28 @@ discard block |
||
2242 | 2490 | $rulsetFile = str_replace('@', '', $ruleset); |
2243 | 2491 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2244 | 2492 | return FileHandler::getRealPath($xml_file); |
2245 | - } |
|
2246 | - else if (strpos($ruleset, '#') !== false) |
|
2493 | + } else if (strpos($ruleset, '#') !== false) |
|
2247 | 2494 | { |
2248 | 2495 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2249 | 2496 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2250 | - if(is_readable($xml_file)) |
|
2251 | - return FileHandler::getRealPath($xml_file); |
|
2252 | - else{ |
|
2497 | + if(is_readable($xml_file)) { |
|
2498 | + return FileHandler::getRealPath($xml_file); |
|
2499 | + } else{ |
|
2253 | 2500 | $ruleset = str_replace('#', '', $ruleset); |
2254 | 2501 | } |
2255 | 2502 | |
2256 | 2503 | } |
2257 | 2504 | // Get a path of the requested module. Return if not exists. |
2258 | 2505 | $class_path = ModuleHandler::getModulePath($module); |
2259 | - if(!$class_path) return; |
|
2506 | + if(!$class_path) { |
|
2507 | + return; |
|
2508 | + } |
|
2260 | 2509 | |
2261 | 2510 | // Check if module.xml exists in the path. Return if not exist |
2262 | 2511 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2263 | - if(!file_exists($xml_file)) return; |
|
2512 | + if(!file_exists($xml_file)) { |
|
2513 | + return; |
|
2514 | + } |
|
2264 | 2515 | |
2265 | 2516 | return $xml_file; |
2266 | 2517 | } |
@@ -2310,7 +2561,9 @@ discard block |
||
2310 | 2561 | function getLangByLangcode() |
2311 | 2562 | { |
2312 | 2563 | $langCode = Context::get('langCode'); |
2313 | - if (!$langCode) return; |
|
2564 | + if (!$langCode) { |
|
2565 | + return; |
|
2566 | + } |
|
2314 | 2567 | |
2315 | 2568 | $oModuleController = getController('module'); |
2316 | 2569 | $oModuleController->replaceDefinedLangCode($langCode); |
@@ -34,25 +34,25 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function procMemberLogin($user_id = null, $password = null, $keep_signed = null) |
36 | 36 | { |
37 | - if(!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
37 | + if (!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
38 | 38 | { |
39 | 39 | $this->setRedirectUrl(getNotEncodedUrl('')); |
40 | 40 | return new Object(-1, 'null_user_id'); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Variables |
44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
44 | + if (!$user_id) $user_id = Context::get('user_id'); |
|
45 | 45 | $user_id = trim($user_id); |
46 | 46 | |
47 | - if(!$password) $password = Context::get('password'); |
|
47 | + if (!$password) $password = Context::get('password'); |
|
48 | 48 | $password = trim($password); |
49 | 49 | |
50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
50 | + if (!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
51 | 51 | // Return an error when id and password doesn't exist |
52 | - if(!$user_id) return new Object(-1,'null_user_id'); |
|
53 | - if(!$password) return new Object(-1,'null_password'); |
|
52 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
53 | + if (!$password) return new Object(-1, 'null_password'); |
|
54 | 54 | |
55 | - $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
|
55 | + $output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ? true : false); |
|
56 | 56 | if (!$output->toBool()) return $output; |
57 | 57 | |
58 | 58 | $oModuleModel = getModel('module'); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $limit_date = $config->change_password_date; |
63 | 63 | |
64 | 64 | // Check if change_password_date is set |
65 | - if($limit_date > 0) |
|
65 | + if ($limit_date > 0) |
|
66 | 66 | { |
67 | 67 | $oMemberModel = getModel('member'); |
68 | - if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day'))) |
|
68 | + if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day'))) |
|
69 | 69 | { |
70 | 70 | $msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date); |
71 | - return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg)); |
|
71 | + return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new Object(-1, $msg)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $args->member_srl = $this->memberInfo->member_srl; |
78 | 78 | executeQuery('member.deleteAuthMail', $args); |
79 | 79 | |
80 | - if(!$config->after_login_url) |
|
80 | + if (!$config->after_login_url) |
|
81 | 81 | { |
82 | 82 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
83 | 83 | } |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | // Call a trigger before log-out (before) |
99 | 99 | $logged_info = Context::get('logged_info'); |
100 | 100 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
101 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
102 | 102 | // Destroy session information |
103 | 103 | $this->destroySessionInfo(); |
104 | 104 | // Call a trigger after log-out (after) |
105 | 105 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
106 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
107 | 107 | |
108 | 108 | $output = new Object(); |
109 | 109 | |
110 | 110 | $oModuleModel = getModel('module'); |
111 | 111 | $config = $oModuleModel->getModuleConfig('member'); |
112 | - if($config->after_logout_url) |
|
112 | + if ($config->after_logout_url) |
|
113 | 113 | $output->redirect_url = $config->after_logout_url; |
114 | 114 | |
115 | 115 | $this->_clearMemberCache($logged_info->member_srl); |
@@ -127,18 +127,18 @@ discard block |
||
127 | 127 | $oModuleModel = &getModel('module'); |
128 | 128 | |
129 | 129 | // Check login information |
130 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
130 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
131 | 131 | $logged_info = Context::get('logged_info'); |
132 | 132 | |
133 | - $document_srl = (int)Context::get('document_srl'); |
|
134 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
135 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
133 | + $document_srl = (int) Context::get('document_srl'); |
|
134 | + if (!$document_srl) $document_srl = (int) Context::get('target_srl'); |
|
135 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
136 | 136 | |
137 | 137 | // Get document |
138 | 138 | $oDocumentModel = getModel('document'); |
139 | 139 | $oDocument = $oDocumentModel->getDocument($document_srl); |
140 | 140 | |
141 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
141 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
142 | 142 | { |
143 | 143 | return new Object(-1, 'msg_is_secret'); |
144 | 144 | } |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')); |
148 | 148 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
149 | 149 | |
150 | - if(!$grant->access) |
|
150 | + if (!$grant->access) |
|
151 | 151 | { |
152 | 152 | return new Object(-1, 'msg_not_permitted'); |
153 | 153 | } |
154 | 154 | |
155 | 155 | // 게시판 모듈에서 글 목록 보기 권한이 없으면 스크랩 제한 |
156 | - if($module_info->module === 'board' && isset($grant->list) && !$grant->list) |
|
156 | + if ($module_info->module === 'board' && isset($grant->list) && !$grant->list) |
|
157 | 157 | { |
158 | 158 | return new Object(-1, 'msg_not_permitted'); |
159 | 159 | } |
160 | 160 | |
161 | 161 | // 게시판 모듈에서 상담 기능 사용 시 권한이 없는 게시물(타인의 게시물) 스크랩 제한 |
162 | - if($module_info->module === 'board' && |
|
162 | + if ($module_info->module === 'board' && |
|
163 | 163 | $module_info->consultation === 'Y' && |
164 | 164 | isset($grant->consultation_read) && |
165 | 165 | !$grant->consultation_read && !$oDocument->isGranted() |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Check if already scrapped |
182 | 182 | $output = executeQuery('member.getScrapDocument', $args); |
183 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
183 | + if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
184 | 184 | |
185 | 185 | // Insert |
186 | 186 | $output = executeQuery('member.addScrapDocument', $args); |
187 | - if(!$output->toBool()) return $output; |
|
187 | + if (!$output->toBool()) return $output; |
|
188 | 188 | |
189 | 189 | $this->setError(-1); |
190 | 190 | $this->setMessage('success_registed'); |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | function procMemberDeleteScrap() |
199 | 199 | { |
200 | 200 | // Check login information |
201 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
201 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
202 | 202 | $logged_info = Context::get('logged_info'); |
203 | 203 | |
204 | - $document_srl = (int)Context::get('document_srl'); |
|
205 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
204 | + $document_srl = (int) Context::get('document_srl'); |
|
205 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
206 | 206 | // Variables |
207 | 207 | $args = new stdClass; |
208 | 208 | $args->member_srl = $logged_info->member_srl; |
@@ -228,23 +228,23 @@ discard block |
||
228 | 228 | function procMemberDeleteSavedDocument() |
229 | 229 | { |
230 | 230 | // Check login information |
231 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
231 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
232 | 232 | $logged_info = Context::get('logged_info'); |
233 | 233 | |
234 | - $document_srl = (int)Context::get('document_srl'); |
|
235 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
234 | + $document_srl = (int) Context::get('document_srl'); |
|
235 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
236 | 236 | |
237 | 237 | $oDocumentModel = getModel('document'); |
238 | 238 | $oDocument = $oDocumentModel->getDocument($document_srl); |
239 | 239 | if ($oDocument->get('member_srl') != $logged_info->member_srl) |
240 | 240 | { |
241 | - return new Object(-1,'msg_invalid_request'); |
|
241 | + return new Object(-1, 'msg_invalid_request'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $configStatusList = $oDocumentModel->getStatusList(); |
245 | 245 | if ($oDocument->get('status') != $configStatusList['temp']) |
246 | 246 | { |
247 | - return new Object(-1,'msg_invalid_request'); |
|
247 | + return new Object(-1, 'msg_invalid_request'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | $oDocumentController = getController('document'); |
@@ -260,37 +260,37 @@ discard block |
||
260 | 260 | { |
261 | 261 | $name = Context::get('name'); |
262 | 262 | $value = Context::get('value'); |
263 | - if(!$value) return; |
|
263 | + if (!$value) return; |
|
264 | 264 | |
265 | 265 | $oMemberModel = getModel('member'); |
266 | 266 | // Check if logged-in |
267 | 267 | $logged_info = Context::get('logged_info'); |
268 | 268 | |
269 | 269 | |
270 | - switch($name) |
|
270 | + switch ($name) |
|
271 | 271 | { |
272 | 272 | case 'user_id' : |
273 | 273 | // Check denied ID |
274 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
274 | + if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id'); |
|
275 | 275 | // Check if duplicated |
276 | 276 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
277 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
277 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id'); |
|
278 | 278 | break; |
279 | 279 | case 'nick_name' : |
280 | 280 | // Check denied ID |
281 | - if($oMemberModel->isDeniedNickName($value)) |
|
281 | + if ($oMemberModel->isDeniedNickName($value)) |
|
282 | 282 | { |
283 | - return new Object(0,'denied_nick_name'); |
|
283 | + return new Object(0, 'denied_nick_name'); |
|
284 | 284 | } |
285 | 285 | // Check if duplicated |
286 | 286 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
287 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
287 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name'); |
|
288 | 288 | |
289 | 289 | break; |
290 | 290 | case 'email_address' : |
291 | 291 | // Check if duplicated |
292 | 292 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
293 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
293 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address'); |
|
294 | 294 | break; |
295 | 295 | } |
296 | 296 | } |
@@ -302,25 +302,25 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function procMemberInsert() |
304 | 304 | { |
305 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
306 | - $oMemberModel = &getModel ('member'); |
|
305 | + if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); |
|
306 | + $oMemberModel = &getModel('member'); |
|
307 | 307 | $config = $oMemberModel->getMemberConfig(); |
308 | 308 | |
309 | 309 | // call a trigger (before) |
310 | - $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
|
311 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
310 | + $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); |
|
311 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
312 | 312 | // Check if an administrator allows a membership |
313 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
313 | + if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
314 | 314 | // Check if the user accept the license terms (only if terms exist) |
315 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
315 | + if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement'); |
|
316 | 316 | |
317 | 317 | // Extract the necessary information in advance |
318 | 318 | $getVars = array(); |
319 | - if($config->signupForm) |
|
319 | + if ($config->signupForm) |
|
320 | 320 | { |
321 | - foreach($config->signupForm as $formInfo) |
|
321 | + foreach ($config->signupForm as $formInfo) |
|
322 | 322 | { |
323 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
323 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
324 | 324 | { |
325 | 325 | $getVars[] = $formInfo->name; |
326 | 326 | } |
@@ -328,22 +328,22 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $args = new stdClass; |
331 | - foreach($getVars as $val) |
|
331 | + foreach ($getVars as $val) |
|
332 | 332 | { |
333 | 333 | $args->{$val} = Context::get($val); |
334 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
334 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
335 | 335 | } |
336 | 336 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
337 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
337 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
338 | 338 | |
339 | 339 | $args->find_account_answer = Context::get('find_account_answer'); |
340 | 340 | $args->allow_mailing = Context::get('allow_mailing'); |
341 | 341 | $args->allow_message = Context::get('allow_message'); |
342 | 342 | |
343 | - if($args->password1) $args->password = $args->password1; |
|
343 | + if ($args->password1) $args->password = $args->password1; |
|
344 | 344 | |
345 | 345 | // check password strength |
346 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
346 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
347 | 347 | { |
348 | 348 | $message = Context::getLang('about_password_strength'); |
349 | 349 | return new Object(-1, $message[$config->password_strength]); |
@@ -369,58 +369,58 @@ discard block |
||
369 | 369 | unset($all_args->secret_text); |
370 | 370 | |
371 | 371 | // Set the user state as "denied" when using mail authentication |
372 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
372 | + if ($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
373 | 373 | // Add extra vars after excluding necessary information from all the requested arguments |
374 | 374 | $extra_vars = delObjectVars($all_args, $args); |
375 | 375 | $args->extra_vars = serialize($extra_vars); |
376 | 376 | |
377 | 377 | // remove whitespace |
378 | 378 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
379 | - foreach($checkInfos as $val) |
|
379 | + foreach ($checkInfos as $val) |
|
380 | 380 | { |
381 | - if(isset($args->{$val})) |
|
381 | + if (isset($args->{$val})) |
|
382 | 382 | { |
383 | 383 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
384 | 384 | } |
385 | 385 | } |
386 | 386 | $output = $this->insertMember($args); |
387 | - if(!$output->toBool()) return $output; |
|
387 | + if (!$output->toBool()) return $output; |
|
388 | 388 | |
389 | 389 | // insert ProfileImage, ImageName, ImageMark |
390 | 390 | $profile_image = $_FILES['profile_image']; |
391 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
391 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
392 | 392 | { |
393 | 393 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
394 | 394 | } |
395 | 395 | |
396 | 396 | $image_mark = $_FILES['image_mark']; |
397 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
397 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
398 | 398 | { |
399 | 399 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
400 | 400 | } |
401 | 401 | |
402 | 402 | $image_name = $_FILES['image_name']; |
403 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
403 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
404 | 404 | { |
405 | 405 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
406 | 406 | } |
407 | 407 | |
408 | 408 | // If a virtual site, join the site |
409 | 409 | $site_module_info = Context::get('site_module_info'); |
410 | - if($site_module_info->site_srl > 0) |
|
410 | + if ($site_module_info->site_srl > 0) |
|
411 | 411 | { |
412 | 412 | $columnList = array('site_srl', 'group_srl'); |
413 | 413 | $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList); |
414 | - if($default_group->group_srl) |
|
414 | + if ($default_group->group_srl) |
|
415 | 415 | { |
416 | 416 | $this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl); |
417 | 417 | } |
418 | 418 | |
419 | 419 | } |
420 | 420 | // Log-in |
421 | - if($config->enable_confirm != 'Y') |
|
421 | + if ($config->enable_confirm != 'Y') |
|
422 | 422 | { |
423 | - if($config->identifier == 'email_address') |
|
423 | + if ($config->identifier == 'email_address') |
|
424 | 424 | { |
425 | 425 | $output = $this->doLogin($args->email_address); |
426 | 426 | } |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | { |
429 | 429 | $output = $this->doLogin($args->user_id); |
430 | 430 | } |
431 | - if(!$output->toBool()) { |
|
432 | - if($output->error == -9) |
|
431 | + if (!$output->toBool()) { |
|
432 | + if ($output->error == -9) |
|
433 | 433 | $output->error = -11; |
434 | 434 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
435 | 435 | } |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | |
438 | 438 | // Results |
439 | 439 | $this->add('member_srl', $args->member_srl); |
440 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
441 | - if($config->enable_confirm == 'Y') |
|
440 | + if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
441 | + if ($config->enable_confirm == 'Y') |
|
442 | 442 | { |
443 | 443 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
444 | 444 | $this->setMessage($msg); |
@@ -447,19 +447,19 @@ discard block |
||
447 | 447 | else $this->setMessage('success_registed'); |
448 | 448 | // Call a trigger (after) |
449 | 449 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
450 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
450 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
451 | 451 | |
452 | - if($config->redirect_url) |
|
452 | + if ($config->redirect_url) |
|
453 | 453 | { |
454 | 454 | $returnUrl = $config->redirect_url; |
455 | 455 | } |
456 | 456 | else |
457 | 457 | { |
458 | - if(Context::get('success_return_url')) |
|
458 | + if (Context::get('success_return_url')) |
|
459 | 459 | { |
460 | 460 | $returnUrl = Context::get('success_return_url'); |
461 | 461 | } |
462 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
462 | + else if ($_COOKIE['XE_REDIRECT_URL']) |
|
463 | 463 | { |
464 | 464 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
465 | 465 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -473,26 +473,26 @@ discard block |
||
473 | 473 | |
474 | 474 | function procMemberModifyInfoBefore() |
475 | 475 | { |
476 | - if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
476 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
477 | 477 | { |
478 | 478 | return $this->stop('msg_invalid_request'); |
479 | 479 | } |
480 | 480 | |
481 | - if(!Context::get('is_logged')) |
|
481 | + if (!Context::get('is_logged')) |
|
482 | 482 | { |
483 | 483 | return $this->stop('msg_not_logged'); |
484 | 484 | } |
485 | 485 | |
486 | 486 | $password = Context::get('password'); |
487 | 487 | |
488 | - if(!$password) |
|
488 | + if (!$password) |
|
489 | 489 | { |
490 | 490 | return $this->stop('msg_invalid_request'); |
491 | 491 | } |
492 | 492 | |
493 | 493 | $oMemberModel = getModel('member'); |
494 | 494 | |
495 | - if(!$this->memberInfo->password) |
|
495 | + if (!$this->memberInfo->password) |
|
496 | 496 | { |
497 | 497 | // Get information of logged-in user |
498 | 498 | $logged_info = Context::get('logged_info'); |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | $this->memberInfo->password = $memberInfo->password; |
504 | 504 | } |
505 | 505 | // Verify the current password |
506 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
506 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
507 | 507 | { |
508 | 508 | return new Object(-1, 'invalid_password'); |
509 | 509 | } |
510 | 510 | |
511 | 511 | $_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD'; |
512 | 512 | |
513 | - if(Context::get('success_return_url')) |
|
513 | + if (Context::get('success_return_url')) |
|
514 | 514 | { |
515 | 515 | $redirectUrl = Context::get('success_return_url'); |
516 | 516 | } |
@@ -528,12 +528,12 @@ discard block |
||
528 | 528 | */ |
529 | 529 | function procMemberModifyInfo() |
530 | 530 | { |
531 | - if(!Context::get('is_logged')) |
|
531 | + if (!Context::get('is_logged')) |
|
532 | 532 | { |
533 | 533 | return $this->stop('msg_not_logged'); |
534 | 534 | } |
535 | 535 | |
536 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
536 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
537 | 537 | { |
538 | 538 | return $this->stop('msg_invalid_request'); |
539 | 539 | } |
@@ -541,13 +541,13 @@ discard block |
||
541 | 541 | |
542 | 542 | // Extract the necessary information in advance |
543 | 543 | $oMemberModel = getModel('member'); |
544 | - $config = $oMemberModel->getMemberConfig (); |
|
545 | - $getVars = array('find_account_answer','allow_mailing','allow_message'); |
|
546 | - if($config->signupForm) |
|
544 | + $config = $oMemberModel->getMemberConfig(); |
|
545 | + $getVars = array('find_account_answer', 'allow_mailing', 'allow_message'); |
|
546 | + if ($config->signupForm) |
|
547 | 547 | { |
548 | - foreach($config->signupForm as $formInfo) |
|
548 | + foreach ($config->signupForm as $formInfo) |
|
549 | 549 | { |
550 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
550 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
551 | 551 | { |
552 | 552 | $getVars[] = $formInfo->name; |
553 | 553 | } |
@@ -555,16 +555,16 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | $args = new stdClass; |
558 | - foreach($getVars as $val) |
|
558 | + foreach ($getVars as $val) |
|
559 | 559 | { |
560 | 560 | $args->{$val} = Context::get($val); |
561 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
561 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
562 | 562 | } |
563 | 563 | // Login Information |
564 | 564 | $logged_info = Context::get('logged_info'); |
565 | 565 | $args->member_srl = $logged_info->member_srl; |
566 | 566 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
567 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
567 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
568 | 568 | // Remove some unnecessary variables from all the vars |
569 | 569 | $all_args = Context::getRequestVars(); |
570 | 570 | unset($all_args->module); |
@@ -588,9 +588,9 @@ discard block |
||
588 | 588 | |
589 | 589 | // remove whitespace |
590 | 590 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
591 | - foreach($checkInfos as $val) |
|
591 | + foreach ($checkInfos as $val) |
|
592 | 592 | { |
593 | - if(isset($args->{$val})) |
|
593 | + if (isset($args->{$val})) |
|
594 | 594 | { |
595 | 595 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
596 | 596 | } |
@@ -598,22 +598,22 @@ discard block |
||
598 | 598 | |
599 | 599 | // Execute insert or update depending on the value of member_srl |
600 | 600 | $output = $this->updateMember($args); |
601 | - if(!$output->toBool()) return $output; |
|
601 | + if (!$output->toBool()) return $output; |
|
602 | 602 | |
603 | 603 | $profile_image = $_FILES['profile_image']; |
604 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
604 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
605 | 605 | { |
606 | 606 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
607 | 607 | } |
608 | 608 | |
609 | 609 | $image_mark = $_FILES['image_mark']; |
610 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
610 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
611 | 611 | { |
612 | 612 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
613 | 613 | } |
614 | 614 | |
615 | 615 | $image_name = $_FILES['image_name']; |
616 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
616 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
617 | 617 | { |
618 | 618 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
619 | 619 | } |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | // Call a trigger after successfully log-in (after) |
630 | 630 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
631 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
631 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
632 | 632 | |
633 | 633 | $this->setSessionInfo(); |
634 | 634 | // Return result |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | */ |
650 | 650 | function procMemberModifyPassword() |
651 | 651 | { |
652 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
652 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
653 | 653 | // Extract the necessary information in advance |
654 | 654 | $current_password = trim(Context::get('current_password')); |
655 | 655 | $password = trim(Context::get('password1')); |
@@ -663,17 +663,17 @@ discard block |
||
663 | 663 | |
664 | 664 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
665 | 665 | // Verify the cuttent password |
666 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
666 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
667 | 667 | |
668 | 668 | // Check if a new password is as same as the previous password |
669 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
669 | + if ($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
670 | 670 | |
671 | 671 | // Execute insert or update depending on the value of member_srl |
672 | 672 | $args = new stdClass; |
673 | 673 | $args->member_srl = $member_srl; |
674 | 674 | $args->password = $password; |
675 | 675 | $output = $this->updateMemberPassword($args); |
676 | - if(!$output->toBool()) return $output; |
|
676 | + if (!$output->toBool()) return $output; |
|
677 | 677 | |
678 | 678 | $this->add('member_srl', $args->member_srl); |
679 | 679 | $this->setMessage('success_updated'); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | function procMemberLeave() |
691 | 691 | { |
692 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
692 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
693 | 693 | // Extract the necessary information in advance |
694 | 694 | $password = trim(Context::get('password')); |
695 | 695 | // Get information of logged-in user |
@@ -698,17 +698,17 @@ discard block |
||
698 | 698 | // Create a member model object |
699 | 699 | $oMemberModel = getModel('member'); |
700 | 700 | // Get information of member_srl |
701 | - if(!$this->memberInfo->password) |
|
701 | + if (!$this->memberInfo->password) |
|
702 | 702 | { |
703 | 703 | $columnList = array('member_srl', 'password'); |
704 | 704 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
705 | 705 | $this->memberInfo->password = $memberInfo->password; |
706 | 706 | } |
707 | 707 | // Verify the cuttent password |
708 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
708 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
709 | 709 | |
710 | 710 | $output = $this->deleteMember($member_srl); |
711 | - if(!$output->toBool()) return $output; |
|
711 | + if (!$output->toBool()) return $output; |
|
712 | 712 | // Destroy all session information |
713 | 713 | $this->destroySessionInfo(); |
714 | 714 | // Return success message |
@@ -727,17 +727,17 @@ discard block |
||
727 | 727 | { |
728 | 728 | // Check if the file is successfully uploaded |
729 | 729 | $file = $_FILES['profile_image']; |
730 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
730 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
731 | 731 | // Ignore if member_srl is invalid or doesn't exist. |
732 | 732 | $member_srl = Context::get('member_srl'); |
733 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
733 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
734 | 734 | |
735 | 735 | $logged_info = Context::get('logged_info'); |
736 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
736 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
737 | 737 | // Return if member module is set not to use an image name or the user is not an administrator ; |
738 | 738 | $oModuleModel = getModel('module'); |
739 | 739 | $config = $oModuleModel->getModuleConfig('member'); |
740 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
740 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
741 | 741 | |
742 | 742 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
743 | 743 | // Page refresh |
@@ -759,25 +759,25 @@ discard block |
||
759 | 759 | { |
760 | 760 | |
761 | 761 | // Check uploaded file |
762 | - if(!checkUploadedFile($target_file)) return; |
|
762 | + if (!checkUploadedFile($target_file)) return; |
|
763 | 763 | |
764 | 764 | $oMemberModel = getModel('member'); |
765 | 765 | $config = $oMemberModel->getMemberConfig(); |
766 | 766 | |
767 | 767 | // Get an image size |
768 | 768 | $max_width = $config->profile_image_max_width; |
769 | - if(!$max_width) $max_width = "90"; |
|
769 | + if (!$max_width) $max_width = "90"; |
|
770 | 770 | $max_height = $config->profile_image_max_height; |
771 | - if(!$max_height) $max_height = "90"; |
|
771 | + if (!$max_height) $max_height = "90"; |
|
772 | 772 | // Get a target path to save |
773 | 773 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
774 | 774 | FileHandler::makeDir($target_path); |
775 | 775 | |
776 | 776 | // Get file information |
777 | 777 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
778 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
779 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
780 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
778 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
779 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
780 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
781 | 781 | else |
782 | 782 | { |
783 | 783 | return; |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | |
788 | 788 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
789 | 789 | // Convert if the image size is larger than a given size or if the format is not a gif |
790 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
790 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
791 | 791 | { |
792 | 792 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
793 | 793 | } |
@@ -806,17 +806,17 @@ discard block |
||
806 | 806 | { |
807 | 807 | // Check if the file is successfully uploaded |
808 | 808 | $file = $_FILES['image_name']; |
809 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
809 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
810 | 810 | // Ignore if member_srl is invalid or doesn't exist. |
811 | 811 | $member_srl = Context::get('member_srl'); |
812 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
812 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
813 | 813 | |
814 | 814 | $logged_info = Context::get('logged_info'); |
815 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
815 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
816 | 816 | // Return if member module is set not to use an image name or the user is not an administrator ; |
817 | 817 | $oModuleModel = getModel('module'); |
818 | 818 | $config = $oModuleModel->getModuleConfig('member'); |
819 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
819 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
820 | 820 | |
821 | 821 | $this->insertImageName($member_srl, $file['tmp_name']); |
822 | 822 | // Page refresh |
@@ -837,15 +837,15 @@ discard block |
||
837 | 837 | function insertImageName($member_srl, $target_file) |
838 | 838 | { |
839 | 839 | // Check uploaded file |
840 | - if(!checkUploadedFile($target_file)) return; |
|
840 | + if (!checkUploadedFile($target_file)) return; |
|
841 | 841 | |
842 | 842 | $oModuleModel = getModel('module'); |
843 | 843 | $config = $oModuleModel->getModuleConfig('member'); |
844 | 844 | // Get an image size |
845 | 845 | $max_width = $config->image_name_max_width; |
846 | - if(!$max_width) $max_width = "90"; |
|
846 | + if (!$max_width) $max_width = "90"; |
|
847 | 847 | $max_height = $config->image_name_max_height; |
848 | - if(!$max_height) $max_height = "20"; |
|
848 | + if (!$max_height) $max_height = "20"; |
|
849 | 849 | // Get a target path to save |
850 | 850 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
851 | 851 | FileHandler::makeDir($target_path); |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | // Get file information |
855 | 855 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
856 | 856 | // Convert if the image size is larger than a given size or if the format is not a gif |
857 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
857 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
858 | 858 | else @copy($target_file, $target_filename); |
859 | 859 | } |
860 | 860 | |
@@ -866,20 +866,20 @@ discard block |
||
866 | 866 | function procMemberDeleteProfileImage($_memberSrl = 0) |
867 | 867 | { |
868 | 868 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
869 | - if(!$member_srl) |
|
869 | + if (!$member_srl) |
|
870 | 870 | { |
871 | - return new Object(0,'success'); |
|
871 | + return new Object(0, 'success'); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | $logged_info = Context::get('logged_info'); |
875 | 875 | |
876 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
876 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
877 | 877 | { |
878 | 878 | $oMemberModel = getModel('member'); |
879 | 879 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
880 | 880 | FileHandler::removeFile($profile_image->file); |
881 | 881 | } |
882 | - return new Object(0,'success'); |
|
882 | + return new Object(0, 'success'); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | /** |
@@ -890,20 +890,20 @@ discard block |
||
890 | 890 | function procMemberDeleteImageName($_memberSrl = 0) |
891 | 891 | { |
892 | 892 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
893 | - if(!$member_srl) |
|
893 | + if (!$member_srl) |
|
894 | 894 | { |
895 | - return new Object(0,'success'); |
|
895 | + return new Object(0, 'success'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | $logged_info = Context::get('logged_info'); |
899 | 899 | |
900 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
900 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
901 | 901 | { |
902 | 902 | $oMemberModel = getModel('member'); |
903 | 903 | $image_name = $oMemberModel->getImageName($member_srl); |
904 | 904 | FileHandler::removeFile($image_name->file); |
905 | 905 | } |
906 | - return new Object(0,'success'); |
|
906 | + return new Object(0, 'success'); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | /** |
@@ -915,17 +915,17 @@ discard block |
||
915 | 915 | { |
916 | 916 | // Check if the file is successfully uploaded |
917 | 917 | $file = $_FILES['image_mark']; |
918 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
918 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
919 | 919 | // Ignore if member_srl is invalid or doesn't exist. |
920 | 920 | $member_srl = Context::get('member_srl'); |
921 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
921 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
922 | 922 | |
923 | 923 | $logged_info = Context::get('logged_info'); |
924 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
924 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
925 | 925 | // Membership in the images mark the module using the ban was set by an administrator or return; |
926 | 926 | $oModuleModel = getModel('module'); |
927 | 927 | $config = $oModuleModel->getModuleConfig('member'); |
928 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
928 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
929 | 929 | |
930 | 930 | $this->insertImageMark($member_srl, $file['tmp_name']); |
931 | 931 | // Page refresh |
@@ -946,15 +946,15 @@ discard block |
||
946 | 946 | function insertImageMark($member_srl, $target_file) |
947 | 947 | { |
948 | 948 | // Check uploaded file |
949 | - if(!checkUploadedFile($target_file)) return; |
|
949 | + if (!checkUploadedFile($target_file)) return; |
|
950 | 950 | |
951 | 951 | $oModuleModel = getModel('module'); |
952 | 952 | $config = $oModuleModel->getModuleConfig('member'); |
953 | 953 | // Get an image size |
954 | 954 | $max_width = $config->image_mark_max_width; |
955 | - if(!$max_width) $max_width = "20"; |
|
955 | + if (!$max_width) $max_width = "20"; |
|
956 | 956 | $max_height = $config->image_mark_max_height; |
957 | - if(!$max_height) $max_height = "20"; |
|
957 | + if (!$max_height) $max_height = "20"; |
|
958 | 958 | |
959 | 959 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
960 | 960 | FileHandler::makeDir($target_path); |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | // Get file information |
964 | 964 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
965 | 965 | |
966 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
966 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
967 | 967 | else @copy($target_file, $target_filename); |
968 | 968 | } |
969 | 969 | |
@@ -975,20 +975,20 @@ discard block |
||
975 | 975 | function procMemberDeleteImageMark($_memberSrl = 0) |
976 | 976 | { |
977 | 977 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
978 | - if(!$member_srl) |
|
978 | + if (!$member_srl) |
|
979 | 979 | { |
980 | - return new Object(0,'success'); |
|
980 | + return new Object(0, 'success'); |
|
981 | 981 | } |
982 | 982 | |
983 | 983 | $logged_info = Context::get('logged_info'); |
984 | 984 | |
985 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
985 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
986 | 986 | { |
987 | 987 | $oMemberModel = getModel('member'); |
988 | 988 | $image_mark = $oMemberModel->getImageMark($member_srl); |
989 | 989 | FileHandler::removeFile($image_mark->file); |
990 | 990 | } |
991 | - return new Object(0,'success'); |
|
991 | + return new Object(0, 'success'); |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | /** |
@@ -999,26 +999,26 @@ discard block |
||
999 | 999 | function procMemberFindAccount() |
1000 | 1000 | { |
1001 | 1001 | $email_address = Context::get('email_address'); |
1002 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1002 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1003 | 1003 | |
1004 | 1004 | $oMemberModel = getModel('member'); |
1005 | 1005 | $oModuleModel = getModel('module'); |
1006 | 1006 | |
1007 | 1007 | // Check if a member having the same email address exists |
1008 | 1008 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1009 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1009 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1010 | 1010 | |
1011 | 1011 | // Get information of the member |
1012 | 1012 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
1013 | 1013 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
1014 | 1014 | |
1015 | 1015 | // Check if possible to find member's ID and password |
1016 | - if($member_info->denied == 'Y') |
|
1016 | + if ($member_info->denied == 'Y') |
|
1017 | 1017 | { |
1018 | 1018 | $chk_args = new stdClass; |
1019 | 1019 | $chk_args->member_srl = $member_info->member_srl; |
1020 | 1020 | $output = executeQuery('member.chkAuthMail', $chk_args); |
1021 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
1021 | + if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | // Insert data into the authentication DB |
@@ -1031,19 +1031,19 @@ discard block |
||
1031 | 1031 | $args->is_register = 'N'; |
1032 | 1032 | |
1033 | 1033 | $output = executeQuery('member.insertAuthMail', $args); |
1034 | - if(!$output->toBool()) return $output; |
|
1034 | + if (!$output->toBool()) return $output; |
|
1035 | 1035 | // Get content of the email to send a member |
1036 | 1036 | Context::set('auth_args', $args); |
1037 | 1037 | |
1038 | 1038 | $member_config = $oModuleModel->getModuleConfig('member'); |
1039 | 1039 | $memberInfo = array(); |
1040 | 1040 | global $lang; |
1041 | - if(is_array($member_config->signupForm)) |
|
1041 | + if (is_array($member_config->signupForm)) |
|
1042 | 1042 | { |
1043 | - $exceptForm=array('password', 'find_account_question'); |
|
1044 | - foreach($member_config->signupForm as $form) |
|
1043 | + $exceptForm = array('password', 'find_account_question'); |
|
1044 | + foreach ($member_config->signupForm as $form) |
|
1045 | 1045 | { |
1046 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1046 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1047 | 1047 | { |
1048 | 1048 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1049 | 1049 | } |
@@ -1058,15 +1058,15 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | Context::set('memberInfo', $memberInfo); |
1060 | 1060 | |
1061 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1062 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1061 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1062 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1063 | 1063 | |
1064 | 1064 | Context::set('member_config', $member_config); |
1065 | 1065 | |
1066 | 1066 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1067 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1067 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1068 | 1068 | |
1069 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
1069 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
1070 | 1070 | Context::set('find_url', $find_url); |
1071 | 1071 | |
1072 | 1072 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1076,19 +1076,19 @@ discard block |
||
1076 | 1076 | $member_config = $oModuleModel->getModuleConfig('member'); |
1077 | 1077 | // Send a mail |
1078 | 1078 | $oMail = new Mail(); |
1079 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
1079 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
1080 | 1080 | $oMail->setContent($content); |
1081 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1082 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
1081 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1082 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
1083 | 1083 | $oMail->send(); |
1084 | 1084 | // Return message |
1085 | 1085 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
1086 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
1086 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
1087 | 1087 | { |
1088 | 1088 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
1089 | 1089 | $this->setRedirectUrl($returnUrl); |
1090 | 1090 | } |
1091 | - return new Object(0,$msg); |
|
1091 | + return new Object(0, $msg); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | /** |
@@ -1106,28 +1106,28 @@ discard block |
||
1106 | 1106 | $find_account_question = trim(Context::get('find_account_question')); |
1107 | 1107 | $find_account_answer = trim(Context::get('find_account_answer')); |
1108 | 1108 | |
1109 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
1109 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
1110 | 1110 | |
1111 | 1111 | $oModuleModel = getModel('module'); |
1112 | 1112 | // Check if a member having the same email address exists |
1113 | 1113 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1114 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1114 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1115 | 1115 | // Get information of the member |
1116 | 1116 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
1117 | 1117 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
1118 | 1118 | |
1119 | 1119 | // Display a message if no answer is entered |
1120 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
1120 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
1121 | 1121 | |
1122 | - if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
1122 | + if (trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
1123 | 1123 | |
1124 | - if($config->identifier == 'email_address') |
|
1124 | + if ($config->identifier == 'email_address') |
|
1125 | 1125 | { |
1126 | 1126 | $user_id = $email_address; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | // Update to a temporary password and set change_password_date to 1 |
1130 | - $oPassword = new Password(); |
|
1130 | + $oPassword = new Password(); |
|
1131 | 1131 | $temp_password = $oPassword->createTemporaryPassword(8); |
1132 | 1132 | |
1133 | 1133 | $args = new stdClass(); |
@@ -1135,11 +1135,11 @@ discard block |
||
1135 | 1135 | $args->password = $temp_password; |
1136 | 1136 | $args->change_password_date = '1'; |
1137 | 1137 | $output = $this->updateMemberPassword($args); |
1138 | - if(!$output->toBool()) return $output; |
|
1138 | + if (!$output->toBool()) return $output; |
|
1139 | 1139 | |
1140 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
1140 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
1141 | 1141 | |
1142 | - $this->add('user_id',$user_id); |
|
1142 | + $this->add('user_id', $user_id); |
|
1143 | 1143 | |
1144 | 1144 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
1145 | 1145 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | $member_srl = Context::get('member_srl'); |
1160 | 1160 | $auth_key = Context::get('auth_key'); |
1161 | 1161 | |
1162 | - if(!$member_srl || !$auth_key) |
|
1162 | + if (!$member_srl || !$auth_key) |
|
1163 | 1163 | { |
1164 | 1164 | return $this->stop('msg_invalid_request'); |
1165 | 1165 | } |
@@ -1170,9 +1170,9 @@ discard block |
||
1170 | 1170 | $args->auth_key = $auth_key; |
1171 | 1171 | $output = executeQuery('member.getAuthMail', $args); |
1172 | 1172 | |
1173 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
1173 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
1174 | 1174 | { |
1175 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
1175 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
1176 | 1176 | { |
1177 | 1177 | executeQuery('member.deleteAuthMail', $args); |
1178 | 1178 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | return $this->stop('msg_invalid_auth_key'); |
1181 | 1181 | } |
1182 | 1182 | |
1183 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
1183 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
1184 | 1184 | { |
1185 | 1185 | executeQuery('member.deleteAuthMail', $args); |
1186 | 1186 | return $this->stop('msg_invalid_auth_key'); |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $args->password = $output->data->new_password; |
1190 | 1190 | |
1191 | 1191 | // If credentials are correct, change the password to a new one |
1192 | - if($output->data->is_register == 'Y') |
|
1192 | + if ($output->data->is_register == 'Y') |
|
1193 | 1193 | { |
1194 | 1194 | $args->denied = 'N'; |
1195 | 1195 | } |
@@ -1202,13 +1202,13 @@ discard block |
||
1202 | 1202 | $is_register = $output->data->is_register; |
1203 | 1203 | |
1204 | 1204 | $output = executeQuery('member.updateMemberPassword', $args); |
1205 | - if(!$output->toBool()) |
|
1205 | + if (!$output->toBool()) |
|
1206 | 1206 | { |
1207 | 1207 | return $this->stop($output->getMessage()); |
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | // Remove all values having the member_srl from authentication table |
1211 | - executeQuery('member.deleteAuthMail',$args); |
|
1211 | + executeQuery('member.deleteAuthMail', $args); |
|
1212 | 1212 | |
1213 | 1213 | $this->_clearMemberCache($args->member_srl); |
1214 | 1214 | |
@@ -1227,33 +1227,33 @@ discard block |
||
1227 | 1227 | { |
1228 | 1228 | // Get an email_address |
1229 | 1229 | $email_address = Context::get('email_address'); |
1230 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1230 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1231 | 1231 | // Log test by using email_address |
1232 | 1232 | $oMemberModel = getModel('member'); |
1233 | 1233 | |
1234 | 1234 | $args = new stdClass; |
1235 | 1235 | $args->email_address = $email_address; |
1236 | 1236 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1237 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
1237 | + if (!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
1238 | 1238 | |
1239 | 1239 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
1240 | 1240 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
1241 | 1241 | |
1242 | 1242 | $oModuleModel = getModel('module'); |
1243 | 1243 | $member_config = $oModuleModel->getModuleConfig('member'); |
1244 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1245 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1244 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1245 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1246 | 1246 | |
1247 | 1247 | // Check if a authentication mail has been sent previously |
1248 | 1248 | $chk_args = new stdClass; |
1249 | 1249 | $chk_args->member_srl = $member_info->member_srl; |
1250 | 1250 | $output = executeQuery('member.chkAuthMail', $chk_args); |
1251 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
1251 | + if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
1252 | 1252 | |
1253 | 1253 | $auth_args = new stdClass; |
1254 | 1254 | $auth_args->member_srl = $member_info->member_srl; |
1255 | 1255 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
1256 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
1256 | + if (!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
1257 | 1257 | $auth_info = $output->data[0]; |
1258 | 1258 | |
1259 | 1259 | // Update the regdate of authmail entry |
@@ -1264,12 +1264,12 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | $memberInfo = array(); |
1266 | 1266 | global $lang; |
1267 | - if(is_array($member_config->signupForm)) |
|
1267 | + if (is_array($member_config->signupForm)) |
|
1268 | 1268 | { |
1269 | - $exceptForm=array('password', 'find_account_question'); |
|
1270 | - foreach($member_config->signupForm as $form) |
|
1269 | + $exceptForm = array('password', 'find_account_question'); |
|
1270 | + foreach ($member_config->signupForm as $form) |
|
1271 | 1271 | { |
1272 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1272 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1273 | 1273 | { |
1274 | 1274 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1275 | 1275 | } |
@@ -1288,19 +1288,19 @@ discard block |
||
1288 | 1288 | Context::set('member_config', $member_config); |
1289 | 1289 | |
1290 | 1290 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1291 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1291 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1292 | 1292 | |
1293 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
1293 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
1294 | 1294 | Context::set('auth_url', $auth_url); |
1295 | 1295 | |
1296 | 1296 | $oTemplate = &TemplateHandler::getInstance(); |
1297 | 1297 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
1298 | 1298 | // Send a mail |
1299 | 1299 | $oMail = new Mail(); |
1300 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
1300 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
1301 | 1301 | $oMail->setContent($content); |
1302 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1303 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
1302 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1303 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
1304 | 1304 | $oMail->send(); |
1305 | 1305 | |
1306 | 1306 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1315,23 +1315,23 @@ discard block |
||
1315 | 1315 | $memberInfo = $_SESSION['auth_member_info']; |
1316 | 1316 | unset($_SESSION['auth_member_info']); |
1317 | 1317 | |
1318 | - if(!$memberInfo) |
|
1318 | + if (!$memberInfo) |
|
1319 | 1319 | { |
1320 | 1320 | return $this->stop('msg_invalid_request'); |
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | $newEmail = Context::get('email_address'); |
1324 | 1324 | |
1325 | - if(!$newEmail) |
|
1325 | + if (!$newEmail) |
|
1326 | 1326 | { |
1327 | 1327 | return $this->stop('msg_invalid_request'); |
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | $oMemberModel = getModel('member'); |
1331 | 1331 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
1332 | - if($member_srl) |
|
1332 | + if ($member_srl) |
|
1333 | 1333 | { |
1334 | - return new Object(-1,'msg_exists_email_address'); |
|
1334 | + return new Object(-1, 'msg_exists_email_address'); |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | // remove all key by member_srl |
@@ -1339,7 +1339,7 @@ discard block |
||
1339 | 1339 | $args->member_srl = $memberInfo->member_srl; |
1340 | 1340 | $output = executeQuery('member.deleteAuthMail', $args); |
1341 | 1341 | |
1342 | - if(!$output->toBool()) |
|
1342 | + if (!$output->toBool()) |
|
1343 | 1343 | { |
1344 | 1344 | return $output; |
1345 | 1345 | } |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
1350 | 1350 | |
1351 | 1351 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
1352 | - if(!$output->toBool()) |
|
1352 | + if (!$output->toBool()) |
|
1353 | 1353 | { |
1354 | 1354 | return $this->stop($output->getMessage()); |
1355 | 1355 | } |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | $auth_args->is_register = 'Y'; |
1367 | 1367 | |
1368 | 1368 | $output = executeQuery('member.insertAuthMail', $auth_args); |
1369 | - if(!$output->toBool()) return $output; |
|
1369 | + if (!$output->toBool()) return $output; |
|
1370 | 1370 | |
1371 | 1371 | $memberInfo->email_address = $newEmail; |
1372 | 1372 | |
@@ -1390,12 +1390,12 @@ discard block |
||
1390 | 1390 | $memberInfo = array(); |
1391 | 1391 | |
1392 | 1392 | global $lang; |
1393 | - if(is_array($member_config->signupForm)) |
|
1393 | + if (is_array($member_config->signupForm)) |
|
1394 | 1394 | { |
1395 | - $exceptForm=array('password', 'find_account_question'); |
|
1396 | - foreach($member_config->signupForm as $form) |
|
1395 | + $exceptForm = array('password', 'find_account_question'); |
|
1396 | + foreach ($member_config->signupForm as $form) |
|
1397 | 1397 | { |
1398 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1398 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1399 | 1399 | { |
1400 | 1400 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1401 | 1401 | } |
@@ -1410,25 +1410,25 @@ discard block |
||
1410 | 1410 | } |
1411 | 1411 | Context::set('memberInfo', $memberInfo); |
1412 | 1412 | |
1413 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1414 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1413 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1414 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1415 | 1415 | |
1416 | 1416 | Context::set('member_config', $member_config); |
1417 | 1417 | |
1418 | 1418 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1419 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1419 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1420 | 1420 | |
1421 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
1421 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
1422 | 1422 | Context::set('auth_url', $auth_url); |
1423 | 1423 | |
1424 | 1424 | $oTemplate = &TemplateHandler::getInstance(); |
1425 | 1425 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
1426 | 1426 | // Send a mail |
1427 | 1427 | $oMail = new Mail(); |
1428 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
1428 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
1429 | 1429 | $oMail->setContent($content); |
1430 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1431 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
1430 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1431 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
1432 | 1432 | $oMail->send(); |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | $site_module_info = Context::get('site_module_info'); |
1443 | 1443 | $logged_info = Context::get('logged_info'); |
1444 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1444 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
1445 | 1445 | |
1446 | 1446 | $oMemberModel = getModel('member'); |
1447 | 1447 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1460,13 +1460,13 @@ discard block |
||
1460 | 1460 | { |
1461 | 1461 | $site_module_info = Context::get('site_module_info'); |
1462 | 1462 | $logged_info = Context::get('logged_info'); |
1463 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1463 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
1464 | 1464 | |
1465 | 1465 | $args = new stdClass; |
1466 | - $args->site_srl= $site_module_info->site_srl; |
|
1466 | + $args->site_srl = $site_module_info->site_srl; |
|
1467 | 1467 | $args->member_srl = $logged_info->member_srl; |
1468 | 1468 | $output = executeQuery('member.deleteMembersGroup', $args); |
1469 | - if(!$output->toBool()) return $output; |
|
1469 | + if (!$output->toBool()) return $output; |
|
1470 | 1470 | $this->setMessage('success_deleted'); |
1471 | 1471 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
1472 | 1472 | } |
@@ -1480,25 +1480,25 @@ discard block |
||
1480 | 1480 | */ |
1481 | 1481 | function setMemberConfig($args) |
1482 | 1482 | { |
1483 | - if(!$args->skin) $args->skin = "default"; |
|
1484 | - if(!$args->colorset) $args->colorset = "white"; |
|
1485 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
1486 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
1487 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
1488 | - $args->enable_openid= 'N'; |
|
1489 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
1490 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
1491 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
1492 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
1493 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
1494 | - $args->limit_day = (int)$args->limit_day; |
|
1483 | + if (!$args->skin) $args->skin = "default"; |
|
1484 | + if (!$args->colorset) $args->colorset = "white"; |
|
1485 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
1486 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
1487 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
1488 | + $args->enable_openid = 'N'; |
|
1489 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
1490 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
1491 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
1492 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
1493 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
1494 | + $args->limit_day = (int) $args->limit_day; |
|
1495 | 1495 | |
1496 | 1496 | $agreement = trim($args->agreement); |
1497 | 1497 | unset($args->agreement); |
1498 | 1498 | |
1499 | 1499 | $oModuleController = getController('module'); |
1500 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
1501 | - if(!$output->toBool()) return $output; |
|
1500 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
1501 | + if (!$output->toBool()) return $output; |
|
1502 | 1502 | |
1503 | 1503 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
1504 | 1504 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1519,11 +1519,11 @@ discard block |
||
1519 | 1519 | $signature = trim(removeHackTag($signature)); |
1520 | 1520 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
1521 | 1521 | |
1522 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
1522 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
1523 | 1523 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
1524 | 1524 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
1525 | 1525 | |
1526 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
1526 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
1527 | 1527 | |
1528 | 1528 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
1529 | 1529 | FileHandler::makeDir($path); |
@@ -1552,15 +1552,15 @@ discard block |
||
1552 | 1552 | * |
1553 | 1553 | * @return Object |
1554 | 1554 | */ |
1555 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
1555 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
1556 | 1556 | { |
1557 | 1557 | $args = new stdClass(); |
1558 | 1558 | $args->member_srl = $member_srl; |
1559 | 1559 | $args->group_srl = $group_srl; |
1560 | - if($site_srl) $args->site_srl = $site_srl; |
|
1560 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1561 | 1561 | |
1562 | 1562 | // Add |
1563 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
1563 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
1564 | 1564 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
1565 | 1565 | |
1566 | 1566 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1580,18 +1580,18 @@ discard block |
||
1580 | 1580 | { |
1581 | 1581 | $obj = new stdClass; |
1582 | 1582 | $obj->site_srl = $args->site_srl; |
1583 | - $obj->member_srl = implode(',',$args->member_srl); |
|
1583 | + $obj->member_srl = implode(',', $args->member_srl); |
|
1584 | 1584 | |
1585 | 1585 | $output = executeQueryArray('member.getMembersGroup', $obj); |
1586 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1586 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1587 | 1587 | |
1588 | 1588 | $output = executeQuery('member.deleteMembersGroup', $obj); |
1589 | - if(!$output->toBool()) return $output; |
|
1589 | + if (!$output->toBool()) return $output; |
|
1590 | 1590 | |
1591 | 1591 | $inserted_members = array(); |
1592 | - foreach($args->member_srl as $key => $val) |
|
1592 | + foreach ($args->member_srl as $key => $val) |
|
1593 | 1593 | { |
1594 | - if($inserted_members[$val]) continue; |
|
1594 | + if ($inserted_members[$val]) continue; |
|
1595 | 1595 | $inserted_members[$val] = true; |
1596 | 1596 | |
1597 | 1597 | unset($obj); |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | $obj->site_srl = $args->site_srl; |
1602 | 1602 | $obj->regdate = $date[$obj->member_srl]; |
1603 | 1603 | $output = executeQuery('member.addMemberToGroup', $obj); |
1604 | - if(!$output->toBool()) return $output; |
|
1604 | + if (!$output->toBool()) return $output; |
|
1605 | 1605 | |
1606 | 1606 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
1607 | 1607 | } |
@@ -1623,9 +1623,9 @@ discard block |
||
1623 | 1623 | // Get information of the key |
1624 | 1624 | $output = executeQuery('member.getAutologin', $args); |
1625 | 1625 | // If no information exists, delete a cookie |
1626 | - if(!$output->toBool() || !$output->data) |
|
1626 | + if (!$output->toBool() || !$output->data) |
|
1627 | 1627 | { |
1628 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1628 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1629 | 1629 | return; |
1630 | 1630 | } |
1631 | 1631 | |
@@ -1635,9 +1635,9 @@ discard block |
||
1635 | 1635 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
1636 | 1636 | $password = $output->data->password; |
1637 | 1637 | |
1638 | - if(!$user_id || !$password) |
|
1638 | + if (!$user_id || !$password) |
|
1639 | 1639 | { |
1640 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1640 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1641 | 1641 | return; |
1642 | 1642 | } |
1643 | 1643 | |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
1648 | 1648 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
1649 | 1649 | |
1650 | - if($check_key === substr($args->autologin_key, 32)) |
|
1650 | + if ($check_key === substr($args->autologin_key, 32)) |
|
1651 | 1651 | { |
1652 | 1652 | // Check change_password_date |
1653 | 1653 | $oModuleModel = getModel('module'); |
@@ -1655,12 +1655,12 @@ discard block |
||
1655 | 1655 | $limit_date = $member_config->change_password_date; |
1656 | 1656 | |
1657 | 1657 | // Check if change_password_date is set |
1658 | - if($limit_date > 0) |
|
1658 | + if ($limit_date > 0) |
|
1659 | 1659 | { |
1660 | 1660 | $oMemberModel = getModel('member'); |
1661 | 1661 | $columnList = array('member_srl', 'change_password_date'); |
1662 | 1662 | |
1663 | - if($config->identifier == 'user_id') |
|
1663 | + if ($config->identifier == 'user_id') |
|
1664 | 1664 | { |
1665 | 1665 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
1666 | 1666 | } |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
1670 | 1670 | } |
1671 | 1671 | |
1672 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
1672 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
1673 | 1673 | $do_auto_login = true; |
1674 | 1674 | } |
1675 | 1675 | |
@@ -1680,14 +1680,14 @@ discard block |
||
1680 | 1680 | } |
1681 | 1681 | } |
1682 | 1682 | |
1683 | - if($do_auto_login) |
|
1683 | + if ($do_auto_login) |
|
1684 | 1684 | { |
1685 | 1685 | $output = $this->doLogin($user_id); |
1686 | 1686 | } |
1687 | 1687 | else |
1688 | 1688 | { |
1689 | 1689 | executeQuery('member.deleteAutologin', $args); |
1690 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1690 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1691 | 1691 | } |
1692 | 1692 | } |
1693 | 1693 | |
@@ -1703,13 +1703,13 @@ discard block |
||
1703 | 1703 | function doLogin($user_id, $password = '', $keep_signed = false) |
1704 | 1704 | { |
1705 | 1705 | $user_id = strtolower($user_id); |
1706 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
1706 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
1707 | 1707 | // Call a trigger before log-in (before) |
1708 | 1708 | $trigger_obj = new stdClass(); |
1709 | 1709 | $trigger_obj->user_id = $user_id; |
1710 | 1710 | $trigger_obj->password = $password; |
1711 | 1711 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
1712 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
1712 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
1713 | 1713 | // Create a member model object |
1714 | 1714 | $oMemberModel = getModel('member'); |
1715 | 1715 | |
@@ -1719,12 +1719,12 @@ discard block |
||
1719 | 1719 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
1720 | 1720 | |
1721 | 1721 | // check identifier |
1722 | - if($config->identifier == 'email_address') |
|
1722 | + if ($config->identifier == 'email_address') |
|
1723 | 1723 | { |
1724 | 1724 | // Get user_id information |
1725 | 1725 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
1726 | 1726 | // Set an invalid user if no value returned |
1727 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1727 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1728 | 1728 | |
1729 | 1729 | } |
1730 | 1730 | else |
@@ -1732,24 +1732,24 @@ discard block |
||
1732 | 1732 | // Get user_id information |
1733 | 1733 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
1734 | 1734 | // Set an invalid user if no value returned |
1735 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1735 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | $output = executeQuery('member.getLoginCountByIp', $args); |
1739 | 1739 | $errorCount = $output->data->count; |
1740 | - if($errorCount >= $config->max_error_count) |
|
1740 | + if ($errorCount >= $config->max_error_count) |
|
1741 | 1741 | { |
1742 | 1742 | $last_update = strtotime($output->data->last_update); |
1743 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
1744 | - if($term < $config->max_error_count_time) |
|
1743 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
1744 | + if ($term < $config->max_error_count_time) |
|
1745 | 1745 | { |
1746 | 1746 | $term = $config->max_error_count_time - $term; |
1747 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
1748 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
1749 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
1750 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
1747 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
1748 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
1749 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
1750 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
1751 | 1751 | |
1752 | - return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
1752 | + return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
1753 | 1753 | } |
1754 | 1754 | else |
1755 | 1755 | { |
@@ -1759,13 +1759,13 @@ discard block |
||
1759 | 1759 | } |
1760 | 1760 | |
1761 | 1761 | // Password Check |
1762 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
1762 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
1763 | 1763 | { |
1764 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
1764 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
1765 | 1765 | } |
1766 | 1766 | |
1767 | 1767 | // If denied == 'Y', notify |
1768 | - if($this->memberInfo->denied == 'Y') |
|
1768 | + if ($this->memberInfo->denied == 'Y') |
|
1769 | 1769 | { |
1770 | 1770 | $args->member_srl = $this->memberInfo->member_srl; |
1771 | 1771 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1773,12 +1773,12 @@ discard block |
||
1773 | 1773 | { |
1774 | 1774 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
1775 | 1775 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
1776 | - return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed')); |
|
1776 | + return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed')); |
|
1777 | 1777 | } |
1778 | - return new Object(-1,'msg_user_denied'); |
|
1778 | + return new Object(-1, 'msg_user_denied'); |
|
1779 | 1779 | } |
1780 | 1780 | // Notify if denied_date is less than the current time |
1781 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
1781 | + if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new Object(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d"))); |
|
1782 | 1782 | // Update the latest login time |
1783 | 1783 | $args->member_srl = $this->memberInfo->member_srl; |
1784 | 1784 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1788,36 +1788,36 @@ discard block |
||
1788 | 1788 | |
1789 | 1789 | // Check if there is recoding table. |
1790 | 1790 | $oDB = &DB::getInstance(); |
1791 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
1791 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
1792 | 1792 | { |
1793 | 1793 | // check if there is login fail records. |
1794 | 1794 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
1795 | - if($output->data && $output->data->content) |
|
1795 | + if ($output->data && $output->data->content) |
|
1796 | 1796 | { |
1797 | 1797 | $title = Context::getLang('login_fail_report'); |
1798 | 1798 | $message = '<ul>'; |
1799 | 1799 | $content = unserialize($output->data->content); |
1800 | - if(count($content) > $config->max_error_count) |
|
1800 | + if (count($content) > $config->max_error_count) |
|
1801 | 1801 | { |
1802 | - foreach($content as $val) |
|
1802 | + foreach ($content as $val) |
|
1803 | 1803 | { |
1804 | - $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
1804 | + $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
1805 | 1805 | } |
1806 | 1806 | $message .= '</ul>'; |
1807 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
1807 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
1808 | 1808 | |
1809 | 1809 | //send message |
1810 | 1810 | $oCommunicationController = getController('communication'); |
1811 | 1811 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
1812 | 1812 | |
1813 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
1813 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
1814 | 1814 | { |
1815 | 1815 | $view_url = Context::getRequestUri(); |
1816 | - $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
1816 | + $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
1817 | 1817 | $oMail = new Mail(); |
1818 | 1818 | $oMail->setTitle($title); |
1819 | 1819 | $oMail->setContent($content); |
1820 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
1820 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
1821 | 1821 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
1822 | 1822 | $oMail->send(); |
1823 | 1823 | } |
@@ -1827,9 +1827,9 @@ discard block |
||
1827 | 1827 | } |
1828 | 1828 | // Call a trigger after successfully log-in (after) |
1829 | 1829 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
1830 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
1830 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
1831 | 1831 | // When user checked to use auto-login |
1832 | - if($keep_signed) |
|
1832 | + if ($keep_signed) |
|
1833 | 1833 | { |
1834 | 1834 | // Key generate for auto login |
1835 | 1835 | $oPassword = new Password(); |
@@ -1841,12 +1841,12 @@ discard block |
||
1841 | 1841 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
1842 | 1842 | executeQuery('member.deleteAutologin', $autologin_args); |
1843 | 1843 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
1844 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
1844 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
1845 | 1845 | } |
1846 | - if($this->memberInfo->is_admin == 'Y') |
|
1846 | + if ($this->memberInfo->is_admin == 'Y') |
|
1847 | 1847 | { |
1848 | 1848 | $oMemberAdminModel = getAdminModel('member'); |
1849 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
1849 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
1850 | 1850 | { |
1851 | 1851 | $_SESSION['denied_admin'] = 'Y'; |
1852 | 1852 | } |
@@ -1864,18 +1864,18 @@ discard block |
||
1864 | 1864 | { |
1865 | 1865 | $oMemberModel = getModel('member'); |
1866 | 1866 | // If your information came through the current session information to extract information from the users |
1867 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
1867 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
1868 | 1868 | { |
1869 | 1869 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
1870 | 1870 | // If you do not destroy the session Profile |
1871 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
1871 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
1872 | 1872 | { |
1873 | 1873 | $this->destroySessionInfo(); |
1874 | 1874 | return; |
1875 | 1875 | } |
1876 | 1876 | } |
1877 | 1877 | // Stop using the session id is destroyed |
1878 | - if($this->memberInfo->denied=='Y') |
|
1878 | + if ($this->memberInfo->denied == 'Y') |
|
1879 | 1879 | { |
1880 | 1880 | $this->destroySessionInfo(); |
1881 | 1881 | return; |
@@ -1905,10 +1905,10 @@ discard block |
||
1905 | 1905 | Context::set('logged_info', $this->memberInfo); |
1906 | 1906 | |
1907 | 1907 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
1908 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
1909 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
1910 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
1911 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
1908 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
1909 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
1910 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
1911 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | /** |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
1931 | 1931 | { |
1932 | 1932 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
1933 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
1933 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
1934 | 1934 | |
1935 | 1935 | $obj = new stdClass; |
1936 | 1936 | $obj->url = $url; |
@@ -1949,33 +1949,33 @@ discard block |
||
1949 | 1949 | { |
1950 | 1950 | // Call a trigger (before) |
1951 | 1951 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
1952 | - if(!$output->toBool()) return $output; |
|
1952 | + if (!$output->toBool()) return $output; |
|
1953 | 1953 | // Terms and Conditions portion of the information set up by members reaffirmed |
1954 | 1954 | $oModuleModel = getModel('module'); |
1955 | 1955 | $config = $oModuleModel->getModuleConfig('member'); |
1956 | 1956 | |
1957 | 1957 | $logged_info = Context::get('logged_info'); |
1958 | 1958 | // If the date of the temporary restrictions limit further information on the date of |
1959 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
1959 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
1960 | 1960 | |
1961 | 1961 | $args->member_srl = getNextSequence(); |
1962 | 1962 | $args->list_order = -1 * $args->member_srl; |
1963 | 1963 | |
1964 | 1964 | // Execute insert or update depending on the value of member_srl |
1965 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
1965 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
1966 | 1966 | // Enter the user's identity changed to lowercase |
1967 | 1967 | else $args->user_id = strtolower($args->user_id); |
1968 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
1969 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
1968 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
1969 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
1970 | 1970 | |
1971 | 1971 | // Control of essential parameters |
1972 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
1973 | - if($args->denied!='Y') $args->denied = 'N'; |
|
1974 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
1972 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
1973 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
1974 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
1975 | 1975 | |
1976 | - if($logged_info->is_admin == 'Y') |
|
1976 | + if ($logged_info->is_admin == 'Y') |
|
1977 | 1977 | { |
1978 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
1978 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
1979 | 1979 | } |
1980 | 1980 | else |
1981 | 1981 | { |
@@ -1990,88 +1990,88 @@ discard block |
||
1990 | 1990 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1991 | 1991 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1992 | 1992 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1993 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
1994 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
1993 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
1994 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
1995 | 1995 | |
1996 | 1996 | // Create a model object |
1997 | 1997 | $oMemberModel = getModel('member'); |
1998 | 1998 | |
1999 | 1999 | // Check password strength |
2000 | - if($args->password && !$password_is_hashed) |
|
2000 | + if ($args->password && !$password_is_hashed) |
|
2001 | 2001 | { |
2002 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2002 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2003 | 2003 | { |
2004 | 2004 | $message = Context::getLang('about_password_strength'); |
2005 | 2005 | return new Object(-1, $message[$config->password_strength]); |
2006 | 2006 | } |
2007 | 2007 | $args->password = $oMemberModel->hashPassword($args->password); |
2008 | 2008 | } |
2009 | - elseif(!$args->password) |
|
2009 | + elseif (!$args->password) |
|
2010 | 2010 | { |
2011 | 2011 | unset($args->password); |
2012 | 2012 | } |
2013 | 2013 | |
2014 | 2014 | // Check if ID is prohibited |
2015 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
2015 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
2016 | 2016 | { |
2017 | - return new Object(-1,'denied_user_id'); |
|
2017 | + return new Object(-1, 'denied_user_id'); |
|
2018 | 2018 | } |
2019 | 2019 | |
2020 | 2020 | // Check if ID is duplicate |
2021 | 2021 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2022 | - if($member_srl) |
|
2022 | + if ($member_srl) |
|
2023 | 2023 | { |
2024 | - return new Object(-1,'msg_exists_user_id'); |
|
2024 | + return new Object(-1, 'msg_exists_user_id'); |
|
2025 | 2025 | } |
2026 | 2026 | |
2027 | 2027 | // Check if nickname is prohibited |
2028 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
2028 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
2029 | 2029 | { |
2030 | - return new Object(-1,'denied_nick_name'); |
|
2030 | + return new Object(-1, 'denied_nick_name'); |
|
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | // Check if nickname is duplicate |
2034 | 2034 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
2035 | - if($member_srl) |
|
2035 | + if ($member_srl) |
|
2036 | 2036 | { |
2037 | - return new Object(-1,'msg_exists_nick_name'); |
|
2037 | + return new Object(-1, 'msg_exists_nick_name'); |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | // Check if email address is duplicate |
2041 | 2041 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
2042 | - if($member_srl) |
|
2042 | + if ($member_srl) |
|
2043 | 2043 | { |
2044 | - return new Object(-1,'msg_exists_email_address'); |
|
2044 | + return new Object(-1, 'msg_exists_email_address'); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | // Insert data into the DB |
2048 | 2048 | $args->list_order = -1 * $args->member_srl; |
2049 | 2049 | |
2050 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2051 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
2050 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2051 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
2052 | 2052 | |
2053 | 2053 | $oDB = &DB::getInstance(); |
2054 | 2054 | $oDB->begin(); |
2055 | 2055 | |
2056 | 2056 | $output = executeQuery('member.insertMember', $args); |
2057 | - if(!$output->toBool()) |
|
2057 | + if (!$output->toBool()) |
|
2058 | 2058 | { |
2059 | 2059 | $oDB->rollback(); |
2060 | 2060 | return $output; |
2061 | 2061 | } |
2062 | 2062 | |
2063 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2063 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2064 | 2064 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
2065 | 2065 | // If no value is entered the default group, the value of group registration |
2066 | - if(!$args->group_srl_list) |
|
2066 | + if (!$args->group_srl_list) |
|
2067 | 2067 | { |
2068 | 2068 | $columnList = array('site_srl', 'group_srl'); |
2069 | 2069 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
2070 | - if($default_group) |
|
2070 | + if ($default_group) |
|
2071 | 2071 | { |
2072 | 2072 | // Add to the default group |
2073 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
2074 | - if(!$output->toBool()) |
|
2073 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
2074 | + if (!$output->toBool()) |
|
2075 | 2075 | { |
2076 | 2076 | $oDB->rollback(); |
2077 | 2077 | return $output; |
@@ -2081,11 +2081,11 @@ discard block |
||
2081 | 2081 | } |
2082 | 2082 | else |
2083 | 2083 | { |
2084 | - for($i=0;$i<count($group_srl_list);$i++) |
|
2084 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
2085 | 2085 | { |
2086 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
2086 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
2087 | 2087 | |
2088 | - if(!$output->toBool()) |
|
2088 | + if (!$output->toBool()) |
|
2089 | 2089 | { |
2090 | 2090 | $oDB->rollback(); |
2091 | 2091 | return $output; |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | |
2096 | 2096 | $member_config = $oModuleModel->getModuleConfig('member'); |
2097 | 2097 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
2098 | - if($args->denied == 'Y') |
|
2098 | + if ($args->denied == 'Y') |
|
2099 | 2099 | { |
2100 | 2100 | // Insert data into the authentication DB |
2101 | 2101 | $oPassword = new Password(); |
@@ -2107,7 +2107,7 @@ discard block |
||
2107 | 2107 | $auth_args->is_register = 'Y'; |
2108 | 2108 | |
2109 | 2109 | $output = executeQuery('member.insertAuthMail', $auth_args); |
2110 | - if(!$output->toBool()) |
|
2110 | + if (!$output->toBool()) |
|
2111 | 2111 | { |
2112 | 2112 | $oDB->rollback(); |
2113 | 2113 | return $output; |
@@ -2115,10 +2115,10 @@ discard block |
||
2115 | 2115 | $this->_sendAuthMail($auth_args, $args); |
2116 | 2116 | } |
2117 | 2117 | // Call a trigger (after) |
2118 | - if($output->toBool()) |
|
2118 | + if ($output->toBool()) |
|
2119 | 2119 | { |
2120 | 2120 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
2121 | - if(!$trigger_output->toBool()) |
|
2121 | + if (!$trigger_output->toBool()) |
|
2122 | 2122 | { |
2123 | 2123 | $oDB->rollback(); |
2124 | 2124 | return $trigger_output; |
@@ -2140,41 +2140,41 @@ discard block |
||
2140 | 2140 | { |
2141 | 2141 | // Call a trigger (before) |
2142 | 2142 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
2143 | - if(!$output->toBool()) return $output; |
|
2143 | + if (!$output->toBool()) return $output; |
|
2144 | 2144 | // Create a model object |
2145 | 2145 | $oMemberModel = getModel('member'); |
2146 | 2146 | |
2147 | 2147 | $logged_info = Context::get('logged_info'); |
2148 | 2148 | // Get what you want to modify the original information |
2149 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2149 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2150 | 2150 | // Control of essential parameters |
2151 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
2152 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
2151 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
2152 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
2153 | 2153 | |
2154 | - if($logged_info->is_admin == 'Y') |
|
2154 | + if ($logged_info->is_admin == 'Y') |
|
2155 | 2155 | { |
2156 | - if($args->denied!='Y') $args->denied = 'N'; |
|
2157 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
2156 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
2157 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
2158 | 2158 | } |
2159 | 2159 | else |
2160 | 2160 | { |
2161 | 2161 | unset($args->is_admin); |
2162 | - if($is_admin == false) |
|
2162 | + if ($is_admin == false) |
|
2163 | 2163 | unset($args->denied); |
2164 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
2164 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
2165 | 2165 | { |
2166 | 2166 | return $this->stop('msg_invalid_request'); |
2167 | 2167 | } |
2168 | 2168 | } |
2169 | 2169 | |
2170 | 2170 | // Sanitize user ID, username, nickname, homepage, blog |
2171 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2171 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2172 | 2172 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2173 | 2173 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2174 | 2174 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2175 | 2175 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2176 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
2177 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
2176 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
2177 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
2178 | 2178 | |
2179 | 2179 | // check member identifier form |
2180 | 2180 | $config = $oMemberModel->getMemberConfig(); |
@@ -2183,56 +2183,56 @@ discard block |
||
2183 | 2183 | $orgMemberInfo = $output->data; |
2184 | 2184 | |
2185 | 2185 | // Check if email address or user ID is duplicate |
2186 | - if($config->identifier == 'email_address') |
|
2186 | + if ($config->identifier == 'email_address') |
|
2187 | 2187 | { |
2188 | 2188 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
2189 | - if($member_srl && $args->member_srl != $member_srl) |
|
2189 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2190 | 2190 | { |
2191 | - return new Object(-1,'msg_exists_email_address'); |
|
2191 | + return new Object(-1, 'msg_exists_email_address'); |
|
2192 | 2192 | } |
2193 | 2193 | $args->email_address = $orgMemberInfo->email_address; |
2194 | 2194 | } |
2195 | 2195 | else |
2196 | 2196 | { |
2197 | 2197 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2198 | - if($member_srl && $args->member_srl != $member_srl) |
|
2198 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2199 | 2199 | { |
2200 | - return new Object(-1,'msg_exists_user_id'); |
|
2200 | + return new Object(-1, 'msg_exists_user_id'); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | 2203 | $args->user_id = $orgMemberInfo->user_id; |
2204 | 2204 | } |
2205 | 2205 | |
2206 | - if($logged_info->is_admin !== 'Y') |
|
2206 | + if ($logged_info->is_admin !== 'Y') |
|
2207 | 2207 | { |
2208 | 2208 | // Check if ID is prohibited |
2209 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
2209 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
2210 | 2210 | { |
2211 | - return new Object(-1,'denied_user_id'); |
|
2211 | + return new Object(-1, 'denied_user_id'); |
|
2212 | 2212 | } |
2213 | 2213 | |
2214 | 2214 | // Check if nickname is prohibited |
2215 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
2215 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
2216 | 2216 | { |
2217 | 2217 | return new Object(-1, 'denied_nick_name'); |
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | |
2221 | 2221 | // Check if ID is duplicate |
2222 | - if($args->user_id) |
|
2222 | + if ($args->user_id) |
|
2223 | 2223 | { |
2224 | 2224 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2225 | - if($member_srl && $args->member_srl != $member_srl) |
|
2225 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2226 | 2226 | { |
2227 | - return new Object(-1,'msg_exists_user_id'); |
|
2227 | + return new Object(-1, 'msg_exists_user_id'); |
|
2228 | 2228 | } |
2229 | 2229 | } |
2230 | 2230 | |
2231 | 2231 | // Check if nickname is duplicate |
2232 | 2232 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
2233 | - if($member_srl && $args->member_srl != $member_srl) |
|
2233 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2234 | 2234 | { |
2235 | - return new Object(-1,'msg_exists_nick_name'); |
|
2235 | + return new Object(-1, 'msg_exists_nick_name'); |
|
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2241,9 +2241,9 @@ discard block |
||
2241 | 2241 | $oDB->begin(); |
2242 | 2242 | |
2243 | 2243 | // Check password strength |
2244 | - if($args->password) |
|
2244 | + if ($args->password) |
|
2245 | 2245 | { |
2246 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2246 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2247 | 2247 | { |
2248 | 2248 | $message = Context::getLang('about_password_strength'); |
2249 | 2249 | return new Object(-1, $message[$config->password_strength]); |
@@ -2255,40 +2255,40 @@ discard block |
||
2255 | 2255 | $args->password = $orgMemberInfo->password; |
2256 | 2256 | } |
2257 | 2257 | |
2258 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
2259 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
2260 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
2261 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
2262 | - if(!$args->birthday) $args->birthday = ''; |
|
2258 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
2259 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
2260 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
2261 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
2262 | + if (!$args->birthday) $args->birthday = ''; |
|
2263 | 2263 | |
2264 | 2264 | $output = executeQuery('member.updateMember', $args); |
2265 | 2265 | |
2266 | - if(!$output->toBool()) |
|
2266 | + if (!$output->toBool()) |
|
2267 | 2267 | { |
2268 | 2268 | $oDB->rollback(); |
2269 | 2269 | return $output; |
2270 | 2270 | } |
2271 | 2271 | |
2272 | - if($args->group_srl_list) |
|
2272 | + if ($args->group_srl_list) |
|
2273 | 2273 | { |
2274 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2274 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2275 | 2275 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
2276 | 2276 | // If the group information, group information changes |
2277 | - if(count($group_srl_list) > 0) |
|
2277 | + if (count($group_srl_list) > 0) |
|
2278 | 2278 | { |
2279 | 2279 | $args->site_srl = 0; |
2280 | 2280 | // One of its members to delete all the group |
2281 | 2281 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
2282 | - if(!$output->toBool()) |
|
2282 | + if (!$output->toBool()) |
|
2283 | 2283 | { |
2284 | 2284 | $oDB->rollback(); |
2285 | 2285 | return $output; |
2286 | 2286 | } |
2287 | 2287 | // Enter one of the loop a |
2288 | - for($i=0;$i<count($group_srl_list);$i++) |
|
2288 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
2289 | 2289 | { |
2290 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
2291 | - if(!$output->toBool()) |
|
2290 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
2291 | + if (!$output->toBool()) |
|
2292 | 2292 | { |
2293 | 2293 | $oDB->rollback(); |
2294 | 2294 | return $output; |
@@ -2300,9 +2300,9 @@ discard block |
||
2300 | 2300 | } |
2301 | 2301 | } |
2302 | 2302 | // Call a trigger (after) |
2303 | - if($output->toBool()) { |
|
2303 | + if ($output->toBool()) { |
|
2304 | 2304 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
2305 | - if(!$trigger_output->toBool()) |
|
2305 | + if (!$trigger_output->toBool()) |
|
2306 | 2306 | { |
2307 | 2307 | $oDB->rollback(); |
2308 | 2308 | return $trigger_output; |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
2316 | 2316 | |
2317 | 2317 | // Save Session |
2318 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2318 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2319 | 2319 | $logged_info = Context::get('logged_info'); |
2320 | 2320 | |
2321 | 2321 | $output->add('member_srl', $args->member_srl); |
@@ -2327,14 +2327,14 @@ discard block |
||
2327 | 2327 | */ |
2328 | 2328 | function updateMemberPassword($args) |
2329 | 2329 | { |
2330 | - if($args->password) |
|
2330 | + if ($args->password) |
|
2331 | 2331 | { |
2332 | 2332 | |
2333 | 2333 | // check password strength |
2334 | 2334 | $oMemberModel = getModel('member'); |
2335 | 2335 | $config = $oMemberModel->getMemberConfig(); |
2336 | 2336 | |
2337 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2337 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2338 | 2338 | { |
2339 | 2339 | $message = Context::getLang('about_password_strength'); |
2340 | 2340 | return new Object(-1, $message[$config->password_strength]); |
@@ -2342,13 +2342,13 @@ discard block |
||
2342 | 2342 | |
2343 | 2343 | $args->password = $oMemberModel->hashPassword($args->password); |
2344 | 2344 | } |
2345 | - else if($args->hashed_password) |
|
2345 | + else if ($args->hashed_password) |
|
2346 | 2346 | { |
2347 | 2347 | $args->password = $args->hashed_password; |
2348 | 2348 | } |
2349 | 2349 | |
2350 | 2350 | $output = executeQuery('member.updateMemberPassword', $args); |
2351 | - if($output->toBool()) |
|
2351 | + if ($output->toBool()) |
|
2352 | 2352 | { |
2353 | 2353 | $result = executeQuery('member.updateChangePasswordDate', $args); |
2354 | 2354 | } |
@@ -2367,18 +2367,18 @@ discard block |
||
2367 | 2367 | $trigger_obj = new stdClass(); |
2368 | 2368 | $trigger_obj->member_srl = $member_srl; |
2369 | 2369 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
2370 | - if(!$output->toBool()) return $output; |
|
2370 | + if (!$output->toBool()) return $output; |
|
2371 | 2371 | // Create a model object |
2372 | 2372 | $oMemberModel = getModel('member'); |
2373 | 2373 | // Bringing the user's information |
2374 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
2374 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
2375 | 2375 | { |
2376 | 2376 | $columnList = array('member_srl', 'is_admin'); |
2377 | 2377 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
2378 | 2378 | } |
2379 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
2379 | + if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
2380 | 2380 | // If managers can not be deleted |
2381 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
2381 | + if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
2382 | 2382 | |
2383 | 2383 | $oDB = &DB::getInstance(); |
2384 | 2384 | $oDB->begin(); |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | $args->member_srl = $member_srl; |
2388 | 2388 | // Delete the entries in member_auth_mail |
2389 | 2389 | $output = executeQuery('member.deleteAuthMail', $args); |
2390 | - if(!$output->toBool()) |
|
2390 | + if (!$output->toBool()) |
|
2391 | 2391 | { |
2392 | 2392 | $oDB->rollback(); |
2393 | 2393 | return $output; |
@@ -2402,23 +2402,23 @@ discard block |
||
2402 | 2402 | */ |
2403 | 2403 | // Delete the entries in member_group_member |
2404 | 2404 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
2405 | - if(!$output->toBool()) |
|
2405 | + if (!$output->toBool()) |
|
2406 | 2406 | { |
2407 | 2407 | $oDB->rollback(); |
2408 | 2408 | return $output; |
2409 | 2409 | } |
2410 | 2410 | // member removed from the table |
2411 | 2411 | $output = executeQuery('member.deleteMember', $args); |
2412 | - if(!$output->toBool()) |
|
2412 | + if (!$output->toBool()) |
|
2413 | 2413 | { |
2414 | 2414 | $oDB->rollback(); |
2415 | 2415 | return $output; |
2416 | 2416 | } |
2417 | 2417 | // Call a trigger (after) |
2418 | - if($output->toBool()) |
|
2418 | + if ($output->toBool()) |
|
2419 | 2419 | { |
2420 | 2420 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
2421 | - if(!$trigger_output->toBool()) |
|
2421 | + if (!$trigger_output->toBool()) |
|
2422 | 2422 | { |
2423 | 2423 | $oDB->rollback(); |
2424 | 2424 | return $trigger_output; |
@@ -2442,23 +2442,23 @@ discard block |
||
2442 | 2442 | */ |
2443 | 2443 | function destroySessionInfo() |
2444 | 2444 | { |
2445 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
2445 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
2446 | 2446 | |
2447 | 2447 | $memberInfo = Context::get('logged_info'); |
2448 | 2448 | $memberSrl = $memberInfo->member_srl; |
2449 | 2449 | |
2450 | - foreach($_SESSION as $key => $val) |
|
2450 | + foreach ($_SESSION as $key => $val) |
|
2451 | 2451 | { |
2452 | 2452 | $_SESSION[$key] = ''; |
2453 | 2453 | } |
2454 | 2454 | |
2455 | 2455 | session_destroy(); |
2456 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
2457 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
2458 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
2456 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2457 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2458 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2459 | 2459 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
2460 | 2460 | |
2461 | - if($memberSrl || $_COOKIE['xeak']) |
|
2461 | + if ($memberSrl || $_COOKIE['xeak']) |
|
2462 | 2462 | { |
2463 | 2463 | $args = new stdClass(); |
2464 | 2464 | $args->member_srl = $memberSrl; |
@@ -2474,22 +2474,22 @@ discard block |
||
2474 | 2474 | $pointGroup = $pointModuleConfig->point_group; |
2475 | 2475 | |
2476 | 2476 | $levelGroup = array(); |
2477 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
2477 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
2478 | 2478 | { |
2479 | 2479 | $levelGroup = array_flip($pointGroup); |
2480 | 2480 | ksort($levelGroup); |
2481 | 2481 | } |
2482 | 2482 | $maxLevel = 0; |
2483 | 2483 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
2484 | - if(count($resultGroup) > 0) |
|
2484 | + if (count($resultGroup) > 0) |
|
2485 | 2485 | $maxLevel = max(array_flip($resultGroup)); |
2486 | 2486 | |
2487 | - if($maxLevel > 0) |
|
2487 | + if ($maxLevel > 0) |
|
2488 | 2488 | { |
2489 | 2489 | $oPointModel = getModel('point'); |
2490 | 2490 | $originPoint = $oPointModel->getPoint($memberSrl); |
2491 | 2491 | |
2492 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
2492 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
2493 | 2493 | { |
2494 | 2494 | $oPointController = getController('point'); |
2495 | 2495 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2499,18 +2499,18 @@ discard block |
||
2499 | 2499 | |
2500 | 2500 | function procMemberModifyEmailAddress() |
2501 | 2501 | { |
2502 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
2502 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
2503 | 2503 | |
2504 | 2504 | $member_info = Context::get('logged_info'); |
2505 | 2505 | $newEmail = Context::get('email_address'); |
2506 | 2506 | |
2507 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
2507 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
2508 | 2508 | |
2509 | 2509 | $oMemberModel = getModel('member'); |
2510 | 2510 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
2511 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
2511 | + if ($member_srl) return new Object(-1, 'msg_exists_email_address'); |
|
2512 | 2512 | |
2513 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
2513 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
2514 | 2514 | { |
2515 | 2515 | return $this->stop('msg_invalid_request'); |
2516 | 2516 | } |
@@ -2526,7 +2526,7 @@ discard block |
||
2526 | 2526 | $oDB = &DB::getInstance(); |
2527 | 2527 | $oDB->begin(); |
2528 | 2528 | $output = executeQuery('member.insertAuthMail', $auth_args); |
2529 | - if(!$output->toBool()) |
|
2529 | + if (!$output->toBool()) |
|
2530 | 2530 | { |
2531 | 2531 | $oDB->rollback(); |
2532 | 2532 | return $output; |
@@ -2536,7 +2536,7 @@ discard block |
||
2536 | 2536 | $member_config = $oModuleModel->getModuleConfig('member'); |
2537 | 2537 | |
2538 | 2538 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
2539 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2539 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2540 | 2540 | |
2541 | 2541 | global $lang; |
2542 | 2542 | |
@@ -2548,17 +2548,17 @@ discard block |
||
2548 | 2548 | |
2549 | 2549 | Context::set('newEmail', $newEmail); |
2550 | 2550 | |
2551 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
2551 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
2552 | 2552 | Context::set('auth_url', $auth_url); |
2553 | 2553 | |
2554 | 2554 | $oTemplate = &TemplateHandler::getInstance(); |
2555 | 2555 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
2556 | 2556 | |
2557 | 2557 | $oMail = new Mail(); |
2558 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
2558 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
2559 | 2559 | $oMail->setContent($content); |
2560 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
2561 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
2560 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
2561 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
2562 | 2562 | $result = $oMail->send(); |
2563 | 2563 | |
2564 | 2564 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2572,16 +2572,16 @@ discard block |
||
2572 | 2572 | { |
2573 | 2573 | $member_srl = Context::get('member_srl'); |
2574 | 2574 | $auth_key = Context::get('auth_key'); |
2575 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
2575 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
2576 | 2576 | |
2577 | 2577 | // Test logs for finding password by user_id and authkey |
2578 | 2578 | $args = new stdClass; |
2579 | 2579 | $args->member_srl = $member_srl; |
2580 | 2580 | $args->auth_key = $auth_key; |
2581 | 2581 | $output = executeQuery('member.getAuthMail', $args); |
2582 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
2582 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
2583 | 2583 | { |
2584 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2584 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2585 | 2585 | return $this->stop('msg_invalid_modify_email_auth_key'); |
2586 | 2586 | } |
2587 | 2587 | |
@@ -2590,10 +2590,10 @@ discard block |
||
2590 | 2590 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
2591 | 2591 | |
2592 | 2592 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
2593 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
2593 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
2594 | 2594 | |
2595 | 2595 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
2596 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
2596 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2597 | 2597 | |
2598 | 2598 | $this->_clearMemberCache($args->member_srl); |
2599 | 2599 | |
@@ -2611,7 +2611,7 @@ discard block |
||
2611 | 2611 | **/ |
2612 | 2612 | function triggerGetDocumentMenu(&$menu_list) |
2613 | 2613 | { |
2614 | - if(!Context::get('is_logged')) return new Object(); |
|
2614 | + if (!Context::get('is_logged')) return new Object(); |
|
2615 | 2615 | |
2616 | 2616 | $logged_info = Context::get('logged_info'); |
2617 | 2617 | $document_srl = Context::get('target_srl'); |
@@ -2622,12 +2622,12 @@ discard block |
||
2622 | 2622 | $member_srl = $oDocument->get('member_srl'); |
2623 | 2623 | $module_srl = $oDocument->get('module_srl'); |
2624 | 2624 | |
2625 | - if(!$member_srl) return new Object(); |
|
2626 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2625 | + if (!$member_srl) return new Object(); |
|
2626 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
2627 | 2627 | |
2628 | 2628 | $oDocumentController = getController('document'); |
2629 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
2630 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
2629 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
2630 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
2631 | 2631 | |
2632 | 2632 | return new Object(); |
2633 | 2633 | } |
@@ -2641,7 +2641,7 @@ discard block |
||
2641 | 2641 | **/ |
2642 | 2642 | function triggerGetCommentMenu(&$menu_list) |
2643 | 2643 | { |
2644 | - if(!Context::get('is_logged')) return new Object(); |
|
2644 | + if (!Context::get('is_logged')) return new Object(); |
|
2645 | 2645 | |
2646 | 2646 | $logged_info = Context::get('logged_info'); |
2647 | 2647 | $comment_srl = Context::get('target_srl'); |
@@ -2652,12 +2652,12 @@ discard block |
||
2652 | 2652 | $module_srl = $oComment->get('module_srl'); |
2653 | 2653 | $member_srl = $oComment->get('member_srl'); |
2654 | 2654 | |
2655 | - if(!$member_srl) return new Object(); |
|
2656 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2655 | + if (!$member_srl) return new Object(); |
|
2656 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
2657 | 2657 | |
2658 | 2658 | $oCommentController = getController('comment'); |
2659 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
2660 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
2659 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
2660 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
2661 | 2661 | |
2662 | 2662 | return new Object(); |
2663 | 2663 | } |
@@ -2669,7 +2669,7 @@ discard block |
||
2669 | 2669 | **/ |
2670 | 2670 | function procMemberSpammerManage() |
2671 | 2671 | { |
2672 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
2672 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
2673 | 2673 | |
2674 | 2674 | $logged_info = Context::get('logged_info'); |
2675 | 2675 | $member_srl = Context::get('member_srl'); |
@@ -2677,7 +2677,7 @@ discard block |
||
2677 | 2677 | $cnt_loop = Context::get('cnt_loop'); |
2678 | 2678 | $proc_type = Context::get('proc_type'); |
2679 | 2679 | $isMoveToTrash = true; |
2680 | - if($proc_type == "delete") |
|
2680 | + if ($proc_type == "delete") |
|
2681 | 2681 | $isMoveToTrash = false; |
2682 | 2682 | |
2683 | 2683 | // check grant |
@@ -2686,7 +2686,7 @@ discard block |
||
2686 | 2686 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
2687 | 2687 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
2688 | 2688 | |
2689 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
2689 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
2690 | 2690 | |
2691 | 2691 | $proc_msg = ""; |
2692 | 2692 | |
@@ -2695,10 +2695,10 @@ discard block |
||
2695 | 2695 | |
2696 | 2696 | // delete or trash destination |
2697 | 2697 | // proc member |
2698 | - if($cnt_loop == 1) |
|
2698 | + if ($cnt_loop == 1) |
|
2699 | 2699 | $this->_spammerMember($member_srl); |
2700 | 2700 | // proc document and comment |
2701 | - elseif($cnt_loop>1) |
|
2701 | + elseif ($cnt_loop > 1) |
|
2702 | 2702 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
2703 | 2703 | |
2704 | 2704 | // get destination count |
@@ -2707,11 +2707,11 @@ discard block |
||
2707 | 2707 | |
2708 | 2708 | $total_count = Context::get('total_count'); |
2709 | 2709 | $remain_count = $cnt_document + $cnt_comment; |
2710 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
2710 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
2711 | 2711 | |
2712 | 2712 | // get progress percent |
2713 | - if($total_count > 0) |
|
2714 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
2713 | + if ($total_count > 0) |
|
2714 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
2715 | 2715 | else |
2716 | 2716 | $progress = 100; |
2717 | 2717 | |
@@ -2735,7 +2735,7 @@ discard block |
||
2735 | 2735 | **/ |
2736 | 2736 | private function _spammerMember($member_srl) { |
2737 | 2737 | $logged_info = Context::get('logged_info'); |
2738 | - $spam_description = trim( Context::get('spam_description') ); |
|
2738 | + $spam_description = trim(Context::get('spam_description')); |
|
2739 | 2739 | |
2740 | 2740 | $oMemberModel = getModel('member'); |
2741 | 2741 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2754,10 +2754,10 @@ discard block |
||
2754 | 2754 | $args->user_id = $member_info->user_id; |
2755 | 2755 | $args->nick_name = $member_info->nick_name; |
2756 | 2756 | $args->denied = "Y"; |
2757 | - $args->description = trim( $member_info->description ); |
|
2758 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
2757 | + $args->description = trim($member_info->description); |
|
2758 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
2759 | 2759 | |
2760 | - $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
|
2760 | + $args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]"; |
|
2761 | 2761 | |
2762 | 2762 | $output = $this->updateMember($args, true); |
2763 | 2763 | |
@@ -2786,21 +2786,21 @@ discard block |
||
2786 | 2786 | // 1. proc comment, 2. proc document |
2787 | 2787 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
2788 | 2788 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
2789 | - if($cnt_comment > 0) |
|
2789 | + if ($cnt_comment > 0) |
|
2790 | 2790 | { |
2791 | 2791 | $columnList = array(); |
2792 | 2792 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
2793 | - if($commentList) { |
|
2794 | - foreach($commentList as $v) { |
|
2793 | + if ($commentList) { |
|
2794 | + foreach ($commentList as $v) { |
|
2795 | 2795 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
2796 | 2796 | } |
2797 | 2797 | } |
2798 | - } elseif($cnt_document > 0) { |
|
2798 | + } elseif ($cnt_document > 0) { |
|
2799 | 2799 | $columnList = array(); |
2800 | 2800 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
2801 | - if($documentList) { |
|
2802 | - foreach($documentList as $v) { |
|
2803 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
2801 | + if ($documentList) { |
|
2802 | + foreach ($documentList as $v) { |
|
2803 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
2804 | 2804 | else $oDocumentController->deleteDocument($v->document_srl); |
2805 | 2805 | } |
2806 | 2806 | } |
@@ -2812,24 +2812,24 @@ discard block |
||
2812 | 2812 | function _clearMemberCache($member_srl, $site_srl = 0) |
2813 | 2813 | { |
2814 | 2814 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
2815 | - if($oCacheHandler->isSupport()) |
|
2815 | + if ($oCacheHandler->isSupport()) |
|
2816 | 2816 | { |
2817 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
2817 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
2818 | 2818 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2819 | 2819 | $oCacheHandler->delete($cache_key); |
2820 | 2820 | |
2821 | - if($site_srl !== 0) |
|
2821 | + if ($site_srl !== 0) |
|
2822 | 2822 | { |
2823 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
2823 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
2824 | 2824 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2825 | 2825 | $oCacheHandler->delete($cache_key); |
2826 | 2826 | } |
2827 | 2827 | } |
2828 | 2828 | |
2829 | 2829 | $oCacheHandler = CacheHandler::getInstance('object'); |
2830 | - if($oCacheHandler->isSupport()) |
|
2830 | + if ($oCacheHandler->isSupport()) |
|
2831 | 2831 | { |
2832 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
2832 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
2833 | 2833 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2834 | 2834 | $oCacheHandler->delete($cache_key); |
2835 | 2835 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | $component = Context::get('component'); |
28 | 28 | |
29 | 29 | $site_module_info = Context::get('site_module_info'); |
30 | - $site_srl = (int)$site_module_info->site_srl; |
|
30 | + $site_srl = (int) $site_module_info->site_srl; |
|
31 | 31 | // Get compoenet object |
32 | 32 | $oEditorModel = getModel('editor'); |
33 | 33 | $oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl); |
34 | - if(!$oComponent->toBool()) |
|
34 | + if (!$oComponent->toBool()) |
|
35 | 35 | { |
36 | 36 | Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
37 | 37 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | $component_name = Context::get('component_name'); |
59 | 59 | |
60 | 60 | $site_module_info = Context::get('site_module_info'); |
61 | - $site_srl = (int)$site_module_info->site_srl; |
|
61 | + $site_srl = (int) $site_module_info->site_srl; |
|
62 | 62 | |
63 | 63 | $oEditorModel = getModel('editor'); |
64 | 64 | $component = $oEditorModel->getComponent($component_name, $site_srl); |
65 | 65 | |
66 | - if(!$component->component_name) { |
|
66 | + if (!$component->component_name) { |
|
67 | 67 | $this->stop('msg_invalid_request'); |
68 | 68 | return; |
69 | 69 | } |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | $current_module_srl = Context::get('module_srl'); |
84 | 84 | $current_module_srls = Context::get('module_srls'); |
85 | 85 | |
86 | - if(!$current_module_srl && !$current_module_srls) |
|
86 | + if (!$current_module_srl && !$current_module_srls) |
|
87 | 87 | { |
88 | 88 | // Get information of the current module |
89 | 89 | $current_module_info = Context::get('current_module_info'); |
90 | 90 | $current_module_srl = $current_module_info->module_srl; |
91 | - if(!$current_module_srl) return new Object(); |
|
91 | + if (!$current_module_srl) return new Object(); |
|
92 | 92 | } |
93 | 93 | // Get editors settings |
94 | 94 | $oEditorModel = getModel('editor'); |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
102 | 102 | Context::set('editor_skin_list', $editor_skin_list); |
103 | 103 | |
104 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); |
|
104 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin); |
|
105 | 105 | Context::set('editor_colorset_list', $skin_info->colorset); |
106 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin); |
|
106 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->comment_editor_skin); |
|
107 | 107 | Context::set('editor_comment_colorset_list', $skin_info->colorset); |
108 | 108 | |
109 | 109 | $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); |
110 | 110 | $content_style_list = array(); |
111 | - for($i=0,$c=count($contents);$i<$c;$i++) |
|
111 | + for ($i = 0, $c = count($contents); $i < $c; $i++) |
|
112 | 112 | { |
113 | 113 | $style = $contents[$i]; |
114 | - $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); |
|
114 | + $info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles'); |
|
115 | 115 | $content_style_list[$style] = new stdClass(); |
116 | 116 | $content_style_list[$style]->title = $info->title; |
117 | 117 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $skin = Context::get('skin'); |
150 | 150 | $oModuleModel = getModel('module'); |
151 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin); |
|
151 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); |
|
152 | 152 | $colorset = $skin_info->colorset; |
153 | 153 | Context::set('colorset', $colorset); |
154 | 154 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $mode = Context::get('mode'); |
162 | 162 | |
163 | - if($mode != 'main') |
|
163 | + if ($mode != 'main') |
|
164 | 164 | { |
165 | 165 | $option_com = new stdClass(); |
166 | 166 | $option_com->allow_fileupload = false; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getEditorConfig($module_srl = null) |
25 | 25 | { |
26 | - if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
26 | + if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
27 | 27 | { |
28 | 28 | // Get trackback settings of the selected module |
29 | 29 | $oModuleModel = getModel('module'); |
@@ -34,55 +34,55 @@ discard block |
||
34 | 34 | $oModuleModel = getModel('module'); |
35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
36 | 36 | |
37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
37 | + if (!is_object($editor_config)) $editor_config = new stdClass(); |
|
38 | 38 | |
39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
39 | + if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
40 | + if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
41 | + if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
42 | + if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
43 | + if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
44 | + if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
45 | + if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
46 | + if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
47 | + if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array(); |
|
48 | 48 | |
49 | - if(!$editor_config->editor_height) |
|
49 | + if (!$editor_config->editor_height) |
|
50 | 50 | { |
51 | 51 | $editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500; |
52 | 52 | } |
53 | - if(!$editor_config->comment_editor_height) |
|
53 | + if (!$editor_config->comment_editor_height) |
|
54 | 54 | { |
55 | 55 | $editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120; |
56 | 56 | } |
57 | - if(!$editor_config->editor_skin) |
|
57 | + if (!$editor_config->editor_skin) |
|
58 | 58 | { |
59 | 59 | $editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor'; |
60 | 60 | } |
61 | - if(!$editor_config->comment_editor_skin) |
|
61 | + if (!$editor_config->comment_editor_skin) |
|
62 | 62 | { |
63 | 63 | $editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor'; |
64 | 64 | } |
65 | - if(!$editor_config->content_style) |
|
65 | + if (!$editor_config->content_style) |
|
66 | 66 | { |
67 | 67 | $editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light'; |
68 | 68 | } |
69 | - if(!$editor_config->content_font && $editor_default_config->content_font) |
|
69 | + if (!$editor_config->content_font && $editor_default_config->content_font) |
|
70 | 70 | { |
71 | 71 | $editor_config->content_font = $editor_default_config->content_font; |
72 | 72 | } |
73 | - if(!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
73 | + if (!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
74 | 74 | { |
75 | 75 | $editor_config->content_font_size = $editor_default_config->content_font_size; |
76 | 76 | } |
77 | - if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
77 | + if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
78 | 78 | { |
79 | 79 | $editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset; |
80 | 80 | } |
81 | - if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
81 | + if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
82 | 82 | { |
83 | 83 | $editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset; |
84 | 84 | } |
85 | - if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
85 | + if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
86 | 86 | { |
87 | 87 | $editor_config->comment_content_style = $editor_default_config->comment_content_style; |
88 | 88 | } |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | |
93 | 93 | function loadDrComponents() |
94 | 94 | { |
95 | - $drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/'; |
|
95 | + $drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/'; |
|
96 | 96 | $drComponentList = FileHandler::readDir($drComponentPath); |
97 | 97 | |
98 | 98 | $oTemplate = &TemplateHandler::getInstance(); |
99 | 99 | |
100 | 100 | $drComponentInfo = array(); |
101 | - if($drComponentList) |
|
101 | + if ($drComponentList) |
|
102 | 102 | { |
103 | - foreach($drComponentList as $i => $drComponent) |
|
103 | + foreach ($drComponentList as $i => $drComponent) |
|
104 | 104 | { |
105 | 105 | unset($obj); |
106 | 106 | $obj = $this->getDrComponentXmlInfo($drComponent); |
107 | - Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent)); |
|
108 | - $path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent); |
|
109 | - $obj->html = $oTemplate->compile($path,$drComponent); |
|
107 | + Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent)); |
|
108 | + $path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent); |
|
109 | + $obj->html = $oTemplate->compile($path, $drComponent); |
|
110 | 110 | $drComponentInfo[$drComponent] = $obj; |
111 | 111 | } |
112 | 112 | } |
113 | - Context::set('drComponentList',$drComponentInfo); |
|
113 | + Context::set('drComponentList', $drComponentInfo); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | function getDrComponentXmlInfo($drComponentName) |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $xml_file = sprintf('%sinfo.xml', $component_path); |
123 | 123 | $cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type); |
124 | 124 | // Return information after including it after cached xml file exists |
125 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
125 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
126 | 126 | { |
127 | 127 | include($cache_file); |
128 | 128 | return $xml_info; |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); |
152 | 152 | |
153 | 153 | // Author information |
154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
154 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
155 | 155 | else $author_list = $xml_doc->component->author; |
156 | 156 | |
157 | - for($i=0; $i < count($author_list); $i++) |
|
157 | + for ($i = 0; $i < count($author_list); $i++) |
|
158 | 158 | { |
159 | 159 | $buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body); |
160 | 160 | $buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address); |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | |
164 | 164 | // List extra variables (text type only in the editor component) |
165 | 165 | $extra_vars = $xml_doc->component->extra_vars->var; |
166 | - if($extra_vars) |
|
166 | + if ($extra_vars) |
|
167 | 167 | { |
168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
169 | - foreach($extra_vars as $key => $val) |
|
168 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
169 | + foreach ($extra_vars as $key => $val) |
|
170 | 170 | { |
171 | 171 | unset($obj); |
172 | 172 | $key = $val->attrs->name; |
@@ -198,47 +198,47 @@ discard block |
||
198 | 198 | * Editor's default options |
199 | 199 | */ |
200 | 200 | // Option setting to allow file upload |
201 | - if($upload_target_srl) |
|
201 | + if ($upload_target_srl) |
|
202 | 202 | { |
203 | 203 | $option->editor_sequence = $upload_target_srl; |
204 | 204 | } |
205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
205 | + if (!$option->allow_fileupload) $allow_fileupload = false; |
|
206 | 206 | else $allow_fileupload = true; |
207 | 207 | // content_style setting |
208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
208 | + if (!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
209 | 209 | Context::set('content_style', $option->content_style); |
210 | - Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style); |
|
210 | + Context::set('content_style_path', $this->module_path.'styles/'.$option->content_style); |
|
211 | 211 | // Default font setting |
212 | 212 | Context::set('content_font', addslashes($option->content_font)); |
213 | 213 | Context::set('content_font_size', $option->content_font_size); |
214 | 214 | |
215 | 215 | // Option setting to allow auto-save |
216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
216 | + if (!$option->enable_autosave) $enable_autosave = false; |
|
217 | + elseif (Context::get($option->primary_key_name)) $enable_autosave = false; |
|
218 | 218 | else $enable_autosave = true; |
219 | 219 | // Option setting to allow the default editor component |
220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
220 | + if (!$option->enable_default_component) $enable_default_component = false; |
|
221 | 221 | else $enable_default_component = true; |
222 | 222 | // Option setting to allow other extended components |
223 | - if(!$option->enable_component) $enable_component = false; |
|
223 | + if (!$option->enable_component) $enable_component = false; |
|
224 | 224 | else $enable_component = true; |
225 | 225 | // Setting for html-mode |
226 | - if($option->disable_html) $html_mode = false; |
|
226 | + if ($option->disable_html) $html_mode = false; |
|
227 | 227 | else $html_mode = true; |
228 | 228 | // Set Height |
229 | - if(!$option->height) $editor_height = 300; |
|
229 | + if (!$option->height) $editor_height = 300; |
|
230 | 230 | else $editor_height = $option->height; |
231 | 231 | // Skin Setting |
232 | 232 | $skin = $option->skin; |
233 | - if(!$skin) $skin = 'ckeditor'; |
|
233 | + if (!$skin) $skin = 'ckeditor'; |
|
234 | 234 | |
235 | 235 | $colorset = $option->colorset; |
236 | - if(!$colorset) $colorset = 'moono'; |
|
236 | + if (!$colorset) $colorset = 'moono'; |
|
237 | 237 | Context::set('colorset', $colorset); |
238 | 238 | Context::set('skin', $skin); |
239 | 239 | Context::set('module_type', $option->module_type); |
240 | 240 | |
241 | - if($skin=='dreditor') |
|
241 | + if ($skin == 'dreditor') |
|
242 | 242 | { |
243 | 243 | $this->loadDrComponents(); |
244 | 244 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | /** |
247 | 247 | * Check the automatic backup feature (do not use if the post is edited) |
248 | 248 | */ |
249 | - if($enable_autosave) |
|
249 | + if ($enable_autosave) |
|
250 | 250 | { |
251 | 251 | // Extract auto-saved data |
252 | 252 | $saved_doc = $this->getSavedDoc($upload_target_srl); |
@@ -258,26 +258,26 @@ discard block |
||
258 | 258 | /** |
259 | 259 | * Extract editor's unique number (in order to display multiple editors on a single page) |
260 | 260 | */ |
261 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
261 | + if ($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
262 | 262 | else |
263 | 263 | { |
264 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
265 | - $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
|
264 | + if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
265 | + $editor_sequence = $_SESSION['_editor_sequence_']++; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Upload setting by using configuration of the file module internally |
270 | 270 | */ |
271 | 271 | $files_count = 0; |
272 | - if($allow_fileupload) |
|
272 | + if ($allow_fileupload) |
|
273 | 273 | { |
274 | 274 | $oFileModel = getModel('file'); |
275 | 275 | // Get upload configuration to set on SWFUploader |
276 | 276 | $file_config = $oFileModel->getUploadConfig(); |
277 | - $file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024; |
|
278 | - $file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024; |
|
277 | + $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; |
|
278 | + $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; |
|
279 | 279 | |
280 | - Context::set('file_config',$file_config); |
|
280 | + Context::set('file_config', $file_config); |
|
281 | 281 | // Configure upload status such as file size |
282 | 282 | $upload_status = $oFileModel->getUploadStatus(); |
283 | 283 | Context::set('upload_status', $upload_status); |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | $oFileController = getController('file'); |
286 | 286 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
287 | 287 | // Check if the file already exists |
288 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
288 | + if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
289 | 289 | } |
290 | - Context::set('files_count', (int)$files_count); |
|
290 | + Context::set('files_count', (int) $files_count); |
|
291 | 291 | |
292 | 292 | Context::set('allow_fileupload', $allow_fileupload); |
293 | 293 | // Set editor_sequence value |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Check editor component |
305 | 305 | */ |
306 | 306 | $site_module_info = Context::get('site_module_info'); |
307 | - $site_srl = (int)$site_module_info->site_srl; |
|
308 | - if($enable_component) |
|
307 | + $site_srl = (int) $site_module_info->site_srl; |
|
308 | + if ($enable_component) |
|
309 | 309 | { |
310 | - if(!Context::get('component_list')) |
|
310 | + if (!Context::get('component_list')) |
|
311 | 311 | { |
312 | 312 | $component_list = $this->getComponentList(true, $site_srl); |
313 | 313 | Context::set('component_list', $component_list); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
335 | 335 | $tpl_file = 'editor.html'; |
336 | 336 | |
337 | - if(!file_exists($tpl_path.$tpl_file)) |
|
337 | + if (!file_exists($tpl_path.$tpl_file)) |
|
338 | 338 | { |
339 | 339 | $skin = 'ckeditor'; |
340 | 340 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $config->module_type = $type; |
365 | 365 | |
366 | 366 | // Configurations listed according to a type |
367 | - if($type == 'document') |
|
367 | + if ($type == 'document') |
|
368 | 368 | { |
369 | 369 | $config->editor_skin = $editor_config->editor_skin; |
370 | 370 | $config->content_style = $editor_config->content_style; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $config->enable_autosave = 'N'; |
394 | 394 | } |
395 | 395 | // Check a group_list of the currently logged-in user for permission check |
396 | - if(Context::get('is_logged')) |
|
396 | + if (Context::get('is_logged')) |
|
397 | 397 | { |
398 | 398 | $logged_info = Context::get('logged_info'); |
399 | 399 | $group_list = $logged_info->group_list; |
@@ -412,12 +412,12 @@ discard block |
||
412 | 412 | $option->colorset = $config->sel_editor_colorset; |
413 | 413 | // Permission check for file upload |
414 | 414 | $option->allow_fileupload = false; |
415 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
416 | - elseif(count($config->upload_file_grant)) |
|
415 | + if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true; |
|
416 | + elseif (count($config->upload_file_grant)) |
|
417 | 417 | { |
418 | - foreach($group_list as $group_srl => $group_info) |
|
418 | + foreach ($group_list as $group_srl => $group_info) |
|
419 | 419 | { |
420 | - if(in_array($group_srl, $config->upload_file_grant)) |
|
420 | + if (in_array($group_srl, $config->upload_file_grant)) |
|
421 | 421 | { |
422 | 422 | $option->allow_fileupload = true; |
423 | 423 | break; |
@@ -427,12 +427,12 @@ discard block |
||
427 | 427 | else $option->allow_fileupload = true; |
428 | 428 | // Permission check for using default components |
429 | 429 | $option->enable_default_component = false; |
430 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
431 | - elseif(count($config->enable_default_component_grant)) |
|
430 | + if ($logged_info->is_admin == 'Y') $option->enable_default_component = true; |
|
431 | + elseif (count($config->enable_default_component_grant)) |
|
432 | 432 | { |
433 | - foreach($group_list as $group_srl => $group_info) |
|
433 | + foreach ($group_list as $group_srl => $group_info) |
|
434 | 434 | { |
435 | - if(in_array($group_srl, $config->enable_default_component_grant)) |
|
435 | + if (in_array($group_srl, $config->enable_default_component_grant)) |
|
436 | 436 | { |
437 | 437 | $option->enable_default_component = true; |
438 | 438 | break; |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | else $option->enable_default_component = true; |
443 | 443 | // Permisshion check for using extended components |
444 | 444 | $option->enable_component = false; |
445 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
446 | - elseif(count($config->enable_component_grant)) |
|
445 | + if ($logged_info->is_admin == 'Y') $option->enable_component = true; |
|
446 | + elseif (count($config->enable_component_grant)) |
|
447 | 447 | { |
448 | - foreach($group_list as $group_srl => $group_info) |
|
448 | + foreach ($group_list as $group_srl => $group_info) |
|
449 | 449 | { |
450 | - if(in_array($group_srl, $config->enable_component_grant)) |
|
450 | + if (in_array($group_srl, $config->enable_component_grant)) |
|
451 | 451 | { |
452 | 452 | $option->enable_component = true; |
453 | 453 | break; |
@@ -457,12 +457,12 @@ discard block |
||
457 | 457 | else $option->enable_component = true; |
458 | 458 | // HTML editing privileges |
459 | 459 | $enable_html = false; |
460 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
461 | - elseif(count($config->enable_html_grant)) |
|
460 | + if ($logged_info->is_admin == 'Y') $enable_html = true; |
|
461 | + elseif (count($config->enable_html_grant)) |
|
462 | 462 | { |
463 | - foreach($group_list as $group_srl => $group_info) |
|
463 | + foreach ($group_list as $group_srl => $group_info) |
|
464 | 464 | { |
465 | - if(in_array($group_srl, $config->enable_html_grant)) |
|
465 | + if (in_array($group_srl, $config->enable_html_grant)) |
|
466 | 466 | { |
467 | 467 | $enable_html = true; |
468 | 468 | break; |
@@ -471,12 +471,12 @@ discard block |
||
471 | 471 | } |
472 | 472 | else $enable_html = true; |
473 | 473 | |
474 | - if($enable_html) $option->disable_html = false; |
|
474 | + if ($enable_html) $option->disable_html = false; |
|
475 | 475 | else $option->disable_html = true; |
476 | 476 | // Set Height |
477 | 477 | $option->height = $config->editor_height; |
478 | 478 | // Set an option for Auto-save |
479 | - $option->enable_autosave = $config->enable_autosave=='Y'?true:false; |
|
479 | + $option->enable_autosave = $config->enable_autosave == 'Y' ? true : false; |
|
480 | 480 | // Other settings |
481 | 481 | $option->primary_key_name = $primary_key_name; |
482 | 482 | $option->content_key_name = $content_key_name; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | { |
492 | 492 | $auto_save_args = new stdClass(); |
493 | 493 | // Find a document by using member_srl for logged-in user and ipaddress for non-logged user |
494 | - if(Context::get('is_logged')) |
|
494 | + if (Context::get('is_logged')) |
|
495 | 495 | { |
496 | 496 | $logged_info = Context::get('logged_info'); |
497 | 497 | $auto_save_args->member_srl = $logged_info->member_srl; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | } |
503 | 503 | $auto_save_args->module_srl = Context::get('module_srl'); |
504 | 504 | // Get the current module if module_srl doesn't exist |
505 | - if(!$auto_save_args->module_srl) |
|
505 | + if (!$auto_save_args->module_srl) |
|
506 | 506 | { |
507 | 507 | $current_module_info = Context::get('current_module_info'); |
508 | 508 | $auto_save_args->module_srl = $current_module_info->module_srl; |
@@ -511,20 +511,20 @@ discard block |
||
511 | 511 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
512 | 512 | $saved_doc = $output->data; |
513 | 513 | // Return null if no result is auto-saved |
514 | - if(!$saved_doc) return; |
|
514 | + if (!$saved_doc) return; |
|
515 | 515 | // Check if the auto-saved document already exists |
516 | 516 | $oDocumentModel = getModel('document'); |
517 | 517 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
518 | - if($oSaved->isExists()) return; |
|
518 | + if ($oSaved->isExists()) return; |
|
519 | 519 | // Move all the files if the auto-saved data contains document_srl and file |
520 | 520 | // Then set document_srl to editor_sequence |
521 | - if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
521 | + if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
522 | 522 | { |
523 | 523 | $saved_doc->module_srl = $auto_save_args->module_srl; |
524 | 524 | $oFileController = getController('file'); |
525 | 525 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
526 | 526 | } |
527 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
527 | + else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
528 | 528 | // Change auto-saved data |
529 | 529 | $oEditorController = getController('editor'); |
530 | 530 | $oEditorController->deleteSavedDoc(false); |
@@ -540,18 +540,18 @@ discard block |
||
540 | 540 | */ |
541 | 541 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
542 | 542 | { |
543 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
543 | + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return; |
|
544 | 544 | |
545 | - if(!$this->loaded_component_list[$component][$editor_sequence]) |
|
545 | + if (!$this->loaded_component_list[$component][$editor_sequence]) |
|
546 | 546 | { |
547 | 547 | // Create an object of the component and execute |
548 | 548 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
549 | 549 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
550 | - if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
550 | + if (!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
551 | 551 | // Create an object after loading the class file |
552 | 552 | require_once($class_file); |
553 | 553 | $oComponent = new $component($editor_sequence, $class_path); |
554 | - if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
554 | + if (!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
555 | 555 | // Add configuration information |
556 | 556 | $component_info = $this->getComponent($component, $site_srl); |
557 | 557 | $oComponent->setInfo($component_info); |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | /** |
573 | 573 | * @brief Return the cache file name of editor component list |
574 | 574 | */ |
575 | - function getCacheFile($filter_enabled= true, $site_srl = 0) |
|
575 | + function getCacheFile($filter_enabled = true, $site_srl = 0) |
|
576 | 576 | { |
577 | 577 | $lang = Context::getLangType(); |
578 | 578 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
579 | 579 | FileHandler::makeDir($cache_path); |
580 | - $cache_file = $cache_path.'component_list.' . $lang .'.'; |
|
581 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
582 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
580 | + $cache_file = $cache_path.'component_list.'.$lang.'.'; |
|
581 | + if ($filter_enabled) $cache_file .= 'filter.'; |
|
582 | + if ($site_srl) $cache_file .= $site_srl.'.'; |
|
583 | 583 | $cache_file .= 'php'; |
584 | 584 | return $cache_file; |
585 | 585 | } |
@@ -587,19 +587,19 @@ discard block |
||
587 | 587 | /** |
588 | 588 | * @brief Return a component list (DB Information included) |
589 | 589 | */ |
590 | - function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) |
|
590 | + function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false) |
|
591 | 591 | { |
592 | 592 | $cache_file = $this->getCacheFile(false, $site_srl); |
593 | - if($from_db || !file_exists($cache_file)) |
|
593 | + if ($from_db || !file_exists($cache_file)) |
|
594 | 594 | { |
595 | 595 | $oEditorController = getController('editor'); |
596 | 596 | $oEditorController->makeCache(false, $site_srl); |
597 | 597 | } |
598 | 598 | |
599 | - if(!file_exists($cache_file)) return; |
|
599 | + if (!file_exists($cache_file)) return; |
|
600 | 600 | include($cache_file); |
601 | 601 | $logged_info = Context::get('logged_info'); |
602 | - if($logged_info && is_array($logged_info->group_list)) |
|
602 | + if ($logged_info && is_array($logged_info->group_list)) |
|
603 | 603 | { |
604 | 604 | $group_list = array_keys($logged_info->group_list); |
605 | 605 | } |
@@ -608,45 +608,45 @@ discard block |
||
608 | 608 | $group_list = array(); |
609 | 609 | } |
610 | 610 | |
611 | - if(count($component_list)) |
|
611 | + if (count($component_list)) |
|
612 | 612 | { |
613 | - foreach($component_list as $key => $val) |
|
613 | + foreach ($component_list as $key => $val) |
|
614 | 614 | { |
615 | - if(!trim($key)) continue; |
|
616 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
615 | + if (!trim($key)) continue; |
|
616 | + if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
617 | 617 | { |
618 | 618 | FileHandler::removeFile($cache_file); |
619 | 619 | return $this->getComponentList($filter_enabled, $site_srl); |
620 | 620 | } |
621 | - if(!$filter_enabled) continue; |
|
622 | - if($val->enabled == "N") |
|
621 | + if (!$filter_enabled) continue; |
|
622 | + if ($val->enabled == "N") |
|
623 | 623 | { |
624 | 624 | unset($component_list->{$key}); |
625 | 625 | continue; |
626 | 626 | } |
627 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
628 | - if($val->target_group) |
|
627 | + if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
628 | + if ($val->target_group) |
|
629 | 629 | { |
630 | - if(!$logged_info) |
|
630 | + if (!$logged_info) |
|
631 | 631 | { |
632 | 632 | $val->enabled = "N"; |
633 | 633 | } |
634 | 634 | else |
635 | 635 | { |
636 | 636 | $is_granted = false; |
637 | - foreach($group_list as $group_srl) |
|
637 | + foreach ($group_list as $group_srl) |
|
638 | 638 | { |
639 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
639 | + if (in_array($group_srl, $val->target_group)) $is_granted = true; |
|
640 | 640 | } |
641 | - if(!$is_granted) $val->enabled = "N"; |
|
641 | + if (!$is_granted) $val->enabled = "N"; |
|
642 | 642 | } |
643 | 643 | } |
644 | - if($val->enabled != "N" && $val->mid_list) |
|
644 | + if ($val->enabled != "N" && $val->mid_list) |
|
645 | 645 | { |
646 | 646 | $mid = Context::get('mid'); |
647 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
647 | + if (!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
648 | 648 | } |
649 | - if($val->enabled == "N") |
|
649 | + if ($val->enabled == "N") |
|
650 | 650 | { |
651 | 651 | unset($component_list->{$key}); |
652 | 652 | continue; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | $args = new stdClass(); |
665 | 665 | $args->component_name = $component_name; |
666 | 666 | |
667 | - if($site_srl) |
|
667 | + if ($site_srl) |
|
668 | 668 | { |
669 | 669 | $args->site_srl = $site_srl; |
670 | 670 | $output = executeQuery('editor.getSiteComponent', $args); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | } |
676 | 676 | $component = $output->data; |
677 | 677 | |
678 | - if(!$output->data) return false; |
|
678 | + if (!$output->data) return false; |
|
679 | 679 | |
680 | 680 | $component_name = $component->component_name; |
681 | 681 | |
@@ -687,25 +687,25 @@ discard block |
||
687 | 687 | |
688 | 688 | $xml_info->mid_list = array(); |
689 | 689 | |
690 | - if($component->extra_vars) |
|
690 | + if ($component->extra_vars) |
|
691 | 691 | { |
692 | 692 | $extra_vars = unserialize($component->extra_vars); |
693 | 693 | |
694 | - if($extra_vars->target_group) |
|
694 | + if ($extra_vars->target_group) |
|
695 | 695 | { |
696 | 696 | $xml_info->target_group = $extra_vars->target_group; |
697 | 697 | unset($extra_vars->target_group); |
698 | 698 | } |
699 | 699 | |
700 | - if($extra_vars->mid_list) |
|
700 | + if ($extra_vars->mid_list) |
|
701 | 701 | { |
702 | 702 | $xml_info->mid_list = $extra_vars->mid_list; |
703 | 703 | unset($extra_vars->mid_list); |
704 | 704 | } |
705 | 705 | |
706 | - if($xml_info->extra_vars) |
|
706 | + if ($xml_info->extra_vars) |
|
707 | 707 | { |
708 | - foreach($xml_info->extra_vars as $key => $val) |
|
708 | + foreach ($xml_info->extra_vars as $key => $val) |
|
709 | 709 | { |
710 | 710 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
711 | 711 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type); |
730 | 730 | |
731 | 731 | // Include and return xml file information if cached file exists |
732 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
732 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
733 | 733 | { |
734 | 734 | include($cache_file); |
735 | 735 | |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $component_info->component_name = $component; |
747 | 747 | $component_info->title = $xml_doc->component->title->body; |
748 | 748 | |
749 | - if($xml_doc->component->version) |
|
749 | + if ($xml_doc->component->version) |
|
750 | 750 | { |
751 | 751 | $component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body); |
752 | 752 | $component_info->version = $xml_doc->component->version->body; |
@@ -772,10 +772,10 @@ discard block |
||
772 | 772 | |
773 | 773 | // Author information |
774 | 774 | $author_list = array(); |
775 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
775 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
776 | 776 | else $author_list = $xml_doc->component->author; |
777 | 777 | |
778 | - for($i = 0; $i < count($author_list); $i++) |
|
778 | + for ($i = 0; $i < count($author_list); $i++) |
|
779 | 779 | { |
780 | 780 | $author = new stdClass; |
781 | 781 | $author->name = $author_list[$i]->name->body; |
@@ -786,39 +786,39 @@ discard block |
||
786 | 786 | |
787 | 787 | // List extra variables (text type only for editor component) |
788 | 788 | $extra_vars = $xml_doc->component->extra_vars; |
789 | - if($extra_vars) |
|
789 | + if ($extra_vars) |
|
790 | 790 | { |
791 | 791 | $extra_var_groups = $extra_vars->group; |
792 | - if(!$extra_var_groups) |
|
792 | + if (!$extra_var_groups) |
|
793 | 793 | { |
794 | 794 | $extra_var_groups = $extra_vars; |
795 | 795 | } |
796 | - if(!is_array($extra_var_groups)) |
|
796 | + if (!is_array($extra_var_groups)) |
|
797 | 797 | { |
798 | 798 | $extra_var_groups = array($extra_var_groups); |
799 | 799 | } |
800 | 800 | |
801 | - foreach($extra_var_groups as $group) |
|
801 | + foreach ($extra_var_groups as $group) |
|
802 | 802 | { |
803 | 803 | $extra_vars = $group->var; |
804 | - if(!is_array($group->var)) |
|
804 | + if (!is_array($group->var)) |
|
805 | 805 | { |
806 | 806 | $extra_vars = array($group->var); |
807 | 807 | } |
808 | 808 | |
809 | - foreach($extra_vars as $key => $val) |
|
809 | + foreach ($extra_vars as $key => $val) |
|
810 | 810 | { |
811 | - if(!$val) |
|
811 | + if (!$val) |
|
812 | 812 | { |
813 | 813 | continue; |
814 | 814 | } |
815 | 815 | |
816 | 816 | $obj = new stdClass(); |
817 | - if(!$val->attrs) |
|
817 | + if (!$val->attrs) |
|
818 | 818 | { |
819 | 819 | $val->attrs = new stdClass(); |
820 | 820 | } |
821 | - if(!$val->attrs->type) |
|
821 | + if (!$val->attrs->type) |
|
822 | 822 | { |
823 | 823 | $val->attrs->type = 'text'; |
824 | 824 | } |
@@ -828,26 +828,26 @@ discard block |
||
828 | 828 | $obj->title = $val->title->body; |
829 | 829 | $obj->type = $val->attrs->type; |
830 | 830 | $obj->description = $val->description->body; |
831 | - if($obj->name) |
|
831 | + if ($obj->name) |
|
832 | 832 | { |
833 | 833 | $obj->value = $extra_vals->{$obj->name}; |
834 | 834 | } |
835 | - if(strpos($obj->value, '|@|') != FALSE) |
|
835 | + if (strpos($obj->value, '|@|') != FALSE) |
|
836 | 836 | { |
837 | 837 | $obj->value = explode('|@|', $obj->value); |
838 | 838 | } |
839 | - if($obj->type == 'mid_list' && !is_array($obj->value)) |
|
839 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) |
|
840 | 840 | { |
841 | 841 | $obj->value = array($obj->value); |
842 | 842 | } |
843 | 843 | |
844 | 844 | // 'Select'type obtained from the option list. |
845 | - if($val->options && !is_array($val->options)) |
|
845 | + if ($val->options && !is_array($val->options)) |
|
846 | 846 | { |
847 | 847 | $val->options = array($val->options); |
848 | 848 | } |
849 | 849 | |
850 | - for($i = 0, $c = count($val->options); $i < $c; $i++) |
|
850 | + for ($i = 0, $c = count($val->options); $i < $c; $i++) |
|
851 | 851 | { |
852 | 852 | $obj->options[$i] = new stdClass(); |
853 | 853 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | |
862 | 862 | $buff = array(); |
863 | 863 | $buff[] = '<?php if(!defined(\'__XE__\')) exit();'; |
864 | - $buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';'; |
|
864 | + $buff[] = '$xml_info = '.var_export($component_info, TRUE).';'; |
|
865 | 865 | $buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff)); |
866 | 866 | |
867 | 867 | FileHandler::writeFile($cache_file, $buff, 'w'); |
@@ -34,17 +34,37 @@ discard block |
||
34 | 34 | $oModuleModel = getModel('module'); |
35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
36 | 36 | |
37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
38 | - |
|
39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
37 | + if(!is_object($editor_config)) { |
|
38 | + $editor_config = new stdClass(); |
|
39 | + } |
|
40 | + |
|
41 | + if($editor_config->enable_autosave != 'N') { |
|
42 | + $editor_config->enable_autosave = 'Y'; |
|
43 | + } |
|
44 | + if(!is_array($editor_config->enable_html_grant)) { |
|
45 | + $editor_config->enable_html_grant = array(); |
|
46 | + } |
|
47 | + if(!is_array($editor_config->enable_comment_html_grant)) { |
|
48 | + $editor_config->enable_comment_html_grant = array(); |
|
49 | + } |
|
50 | + if(!is_array($editor_config->upload_file_grant)) { |
|
51 | + $editor_config->upload_file_grant = array(); |
|
52 | + } |
|
53 | + if(!is_array($editor_config->comment_upload_file_grant)) { |
|
54 | + $editor_config->comment_upload_file_grant = array(); |
|
55 | + } |
|
56 | + if(!is_array($editor_config->enable_default_component_grant)) { |
|
57 | + $editor_config->enable_default_component_grant = array(); |
|
58 | + } |
|
59 | + if(!is_array($editor_config->enable_comment_default_component_grant)) { |
|
60 | + $editor_config->enable_comment_default_component_grant = array(); |
|
61 | + } |
|
62 | + if(!is_array($editor_config->enable_component_grant)) { |
|
63 | + $editor_config->enable_component_grant = array(); |
|
64 | + } |
|
65 | + if(!is_array($editor_config->enable_comment_component_grant)) { |
|
66 | + $editor_config->enable_comment_component_grant= array(); |
|
67 | + } |
|
48 | 68 | |
49 | 69 | if(!$editor_config->editor_height) |
50 | 70 | { |
@@ -151,8 +171,11 @@ discard block |
||
151 | 171 | $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); |
152 | 172 | |
153 | 173 | // Author information |
154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
155 | - else $author_list = $xml_doc->component->author; |
|
174 | + if(!is_array($xml_doc->component->author)) { |
|
175 | + $author_list[] = $xml_doc->component->author; |
|
176 | + } else { |
|
177 | + $author_list = $xml_doc->component->author; |
|
178 | + } |
|
156 | 179 | |
157 | 180 | for($i=0; $i < count($author_list); $i++) |
158 | 181 | { |
@@ -165,7 +188,9 @@ discard block |
||
165 | 188 | $extra_vars = $xml_doc->component->extra_vars->var; |
166 | 189 | if($extra_vars) |
167 | 190 | { |
168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
191 | + if(!is_array($extra_vars)) { |
|
192 | + $extra_vars = array($extra_vars); |
|
193 | + } |
|
169 | 194 | foreach($extra_vars as $key => $val) |
170 | 195 | { |
171 | 196 | unset($obj); |
@@ -202,10 +227,15 @@ discard block |
||
202 | 227 | { |
203 | 228 | $option->editor_sequence = $upload_target_srl; |
204 | 229 | } |
205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
206 | - else $allow_fileupload = true; |
|
230 | + if(!$option->allow_fileupload) { |
|
231 | + $allow_fileupload = false; |
|
232 | + } else { |
|
233 | + $allow_fileupload = true; |
|
234 | + } |
|
207 | 235 | // content_style setting |
208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
236 | + if(!$option->content_style) { |
|
237 | + $option->content_style = 'ckeditor_light'; |
|
238 | + } |
|
209 | 239 | Context::set('content_style', $option->content_style); |
210 | 240 | Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style); |
211 | 241 | // Default font setting |
@@ -213,27 +243,47 @@ discard block |
||
213 | 243 | Context::set('content_font_size', $option->content_font_size); |
214 | 244 | |
215 | 245 | // Option setting to allow auto-save |
216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
218 | - else $enable_autosave = true; |
|
246 | + if(!$option->enable_autosave) { |
|
247 | + $enable_autosave = false; |
|
248 | + } elseif(Context::get($option->primary_key_name)) { |
|
249 | + $enable_autosave = false; |
|
250 | + } else { |
|
251 | + $enable_autosave = true; |
|
252 | + } |
|
219 | 253 | // Option setting to allow the default editor component |
220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
221 | - else $enable_default_component = true; |
|
254 | + if(!$option->enable_default_component) { |
|
255 | + $enable_default_component = false; |
|
256 | + } else { |
|
257 | + $enable_default_component = true; |
|
258 | + } |
|
222 | 259 | // Option setting to allow other extended components |
223 | - if(!$option->enable_component) $enable_component = false; |
|
224 | - else $enable_component = true; |
|
260 | + if(!$option->enable_component) { |
|
261 | + $enable_component = false; |
|
262 | + } else { |
|
263 | + $enable_component = true; |
|
264 | + } |
|
225 | 265 | // Setting for html-mode |
226 | - if($option->disable_html) $html_mode = false; |
|
227 | - else $html_mode = true; |
|
266 | + if($option->disable_html) { |
|
267 | + $html_mode = false; |
|
268 | + } else { |
|
269 | + $html_mode = true; |
|
270 | + } |
|
228 | 271 | // Set Height |
229 | - if(!$option->height) $editor_height = 300; |
|
230 | - else $editor_height = $option->height; |
|
272 | + if(!$option->height) { |
|
273 | + $editor_height = 300; |
|
274 | + } else { |
|
275 | + $editor_height = $option->height; |
|
276 | + } |
|
231 | 277 | // Skin Setting |
232 | 278 | $skin = $option->skin; |
233 | - if(!$skin) $skin = 'ckeditor'; |
|
279 | + if(!$skin) { |
|
280 | + $skin = 'ckeditor'; |
|
281 | + } |
|
234 | 282 | |
235 | 283 | $colorset = $option->colorset; |
236 | - if(!$colorset) $colorset = 'moono'; |
|
284 | + if(!$colorset) { |
|
285 | + $colorset = 'moono'; |
|
286 | + } |
|
237 | 287 | Context::set('colorset', $colorset); |
238 | 288 | Context::set('skin', $skin); |
239 | 289 | Context::set('module_type', $option->module_type); |
@@ -258,10 +308,13 @@ discard block |
||
258 | 308 | /** |
259 | 309 | * Extract editor's unique number (in order to display multiple editors on a single page) |
260 | 310 | */ |
261 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
262 | - else |
|
311 | + if($option->editor_sequence) { |
|
312 | + $editor_sequence = $option->editor_sequence; |
|
313 | + } else |
|
263 | 314 | { |
264 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
315 | + if(!$_SESSION['_editor_sequence_']) { |
|
316 | + $_SESSION['_editor_sequence_'] = 1; |
|
317 | + } |
|
265 | 318 | $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
266 | 319 | } |
267 | 320 | |
@@ -285,7 +338,9 @@ discard block |
||
285 | 338 | $oFileController = getController('file'); |
286 | 339 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
287 | 340 | // Check if the file already exists |
288 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
341 | + if($upload_target_srl) { |
|
342 | + $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
343 | + } |
|
289 | 344 | } |
290 | 345 | Context::set('files_count', (int)$files_count); |
291 | 346 | |
@@ -377,8 +432,7 @@ discard block |
||
377 | 432 | $config->enable_html_grant = $editor_config->enable_html_grant; |
378 | 433 | $config->editor_height = $editor_config->editor_height; |
379 | 434 | $config->enable_autosave = $editor_config->enable_autosave; |
380 | - } |
|
381 | - else |
|
435 | + } else |
|
382 | 436 | { |
383 | 437 | $config->editor_skin = $editor_config->comment_editor_skin; |
384 | 438 | $config->content_style = $editor_config->comment_content_style; |
@@ -397,8 +451,7 @@ discard block |
||
397 | 451 | { |
398 | 452 | $logged_info = Context::get('logged_info'); |
399 | 453 | $group_list = $logged_info->group_list; |
400 | - } |
|
401 | - else |
|
454 | + } else |
|
402 | 455 | { |
403 | 456 | $group_list = array(); |
404 | 457 | } |
@@ -412,8 +465,9 @@ discard block |
||
412 | 465 | $option->colorset = $config->sel_editor_colorset; |
413 | 466 | // Permission check for file upload |
414 | 467 | $option->allow_fileupload = false; |
415 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
416 | - elseif(count($config->upload_file_grant)) |
|
468 | + if($logged_info->is_admin=='Y') { |
|
469 | + $option->allow_fileupload = true; |
|
470 | + } elseif(count($config->upload_file_grant)) |
|
417 | 471 | { |
418 | 472 | foreach($group_list as $group_srl => $group_info) |
419 | 473 | { |
@@ -423,12 +477,14 @@ discard block |
||
423 | 477 | break; |
424 | 478 | } |
425 | 479 | } |
480 | + } else { |
|
481 | + $option->allow_fileupload = true; |
|
426 | 482 | } |
427 | - else $option->allow_fileupload = true; |
|
428 | 483 | // Permission check for using default components |
429 | 484 | $option->enable_default_component = false; |
430 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
431 | - elseif(count($config->enable_default_component_grant)) |
|
485 | + if($logged_info->is_admin=='Y') { |
|
486 | + $option->enable_default_component = true; |
|
487 | + } elseif(count($config->enable_default_component_grant)) |
|
432 | 488 | { |
433 | 489 | foreach($group_list as $group_srl => $group_info) |
434 | 490 | { |
@@ -438,12 +494,14 @@ discard block |
||
438 | 494 | break; |
439 | 495 | } |
440 | 496 | } |
497 | + } else { |
|
498 | + $option->enable_default_component = true; |
|
441 | 499 | } |
442 | - else $option->enable_default_component = true; |
|
443 | 500 | // Permisshion check for using extended components |
444 | 501 | $option->enable_component = false; |
445 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
446 | - elseif(count($config->enable_component_grant)) |
|
502 | + if($logged_info->is_admin=='Y') { |
|
503 | + $option->enable_component = true; |
|
504 | + } elseif(count($config->enable_component_grant)) |
|
447 | 505 | { |
448 | 506 | foreach($group_list as $group_srl => $group_info) |
449 | 507 | { |
@@ -453,12 +511,14 @@ discard block |
||
453 | 511 | break; |
454 | 512 | } |
455 | 513 | } |
514 | + } else { |
|
515 | + $option->enable_component = true; |
|
456 | 516 | } |
457 | - else $option->enable_component = true; |
|
458 | 517 | // HTML editing privileges |
459 | 518 | $enable_html = false; |
460 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
461 | - elseif(count($config->enable_html_grant)) |
|
519 | + if($logged_info->is_admin=='Y') { |
|
520 | + $enable_html = true; |
|
521 | + } elseif(count($config->enable_html_grant)) |
|
462 | 522 | { |
463 | 523 | foreach($group_list as $group_srl => $group_info) |
464 | 524 | { |
@@ -468,11 +528,15 @@ discard block |
||
468 | 528 | break; |
469 | 529 | } |
470 | 530 | } |
531 | + } else { |
|
532 | + $enable_html = true; |
|
471 | 533 | } |
472 | - else $enable_html = true; |
|
473 | 534 | |
474 | - if($enable_html) $option->disable_html = false; |
|
475 | - else $option->disable_html = true; |
|
535 | + if($enable_html) { |
|
536 | + $option->disable_html = false; |
|
537 | + } else { |
|
538 | + $option->disable_html = true; |
|
539 | + } |
|
476 | 540 | // Set Height |
477 | 541 | $option->height = $config->editor_height; |
478 | 542 | // Set an option for Auto-save |
@@ -495,8 +559,7 @@ discard block |
||
495 | 559 | { |
496 | 560 | $logged_info = Context::get('logged_info'); |
497 | 561 | $auto_save_args->member_srl = $logged_info->member_srl; |
498 | - } |
|
499 | - else |
|
562 | + } else |
|
500 | 563 | { |
501 | 564 | $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
502 | 565 | } |
@@ -511,11 +574,15 @@ discard block |
||
511 | 574 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
512 | 575 | $saved_doc = $output->data; |
513 | 576 | // Return null if no result is auto-saved |
514 | - if(!$saved_doc) return; |
|
577 | + if(!$saved_doc) { |
|
578 | + return; |
|
579 | + } |
|
515 | 580 | // Check if the auto-saved document already exists |
516 | 581 | $oDocumentModel = getModel('document'); |
517 | 582 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
518 | - if($oSaved->isExists()) return; |
|
583 | + if($oSaved->isExists()) { |
|
584 | + return; |
|
585 | + } |
|
519 | 586 | // Move all the files if the auto-saved data contains document_srl and file |
520 | 587 | // Then set document_srl to editor_sequence |
521 | 588 | if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
@@ -523,8 +590,9 @@ discard block |
||
523 | 590 | $saved_doc->module_srl = $auto_save_args->module_srl; |
524 | 591 | $oFileController = getController('file'); |
525 | 592 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
593 | + } else if($upload_target_srl) { |
|
594 | + $saved_doc->document_srl = $upload_target_srl; |
|
526 | 595 | } |
527 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
528 | 596 | // Change auto-saved data |
529 | 597 | $oEditorController = getController('editor'); |
530 | 598 | $oEditorController->deleteSavedDoc(false); |
@@ -540,18 +608,24 @@ discard block |
||
540 | 608 | */ |
541 | 609 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
542 | 610 | { |
543 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
611 | + if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) { |
|
612 | + return; |
|
613 | + } |
|
544 | 614 | |
545 | 615 | if(!$this->loaded_component_list[$component][$editor_sequence]) |
546 | 616 | { |
547 | 617 | // Create an object of the component and execute |
548 | 618 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
549 | 619 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
550 | - if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
620 | + if(!file_exists($class_file)) { |
|
621 | + return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
622 | + } |
|
551 | 623 | // Create an object after loading the class file |
552 | 624 | require_once($class_file); |
553 | 625 | $oComponent = new $component($editor_sequence, $class_path); |
554 | - if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
626 | + if(!$oComponent) { |
|
627 | + return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
628 | + } |
|
555 | 629 | // Add configuration information |
556 | 630 | $component_info = $this->getComponent($component, $site_srl); |
557 | 631 | $oComponent->setInfo($component_info); |
@@ -578,8 +652,12 @@ discard block |
||
578 | 652 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
579 | 653 | FileHandler::makeDir($cache_path); |
580 | 654 | $cache_file = $cache_path.'component_list.' . $lang .'.'; |
581 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
582 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
655 | + if($filter_enabled) { |
|
656 | + $cache_file .= 'filter.'; |
|
657 | + } |
|
658 | + if($site_srl) { |
|
659 | + $cache_file .= $site_srl.'.'; |
|
660 | + } |
|
583 | 661 | $cache_file .= 'php'; |
584 | 662 | return $cache_file; |
585 | 663 | } |
@@ -596,14 +674,15 @@ discard block |
||
596 | 674 | $oEditorController->makeCache(false, $site_srl); |
597 | 675 | } |
598 | 676 | |
599 | - if(!file_exists($cache_file)) return; |
|
677 | + if(!file_exists($cache_file)) { |
|
678 | + return; |
|
679 | + } |
|
600 | 680 | include($cache_file); |
601 | 681 | $logged_info = Context::get('logged_info'); |
602 | 682 | if($logged_info && is_array($logged_info->group_list)) |
603 | 683 | { |
604 | 684 | $group_list = array_keys($logged_info->group_list); |
605 | - } |
|
606 | - else |
|
685 | + } else |
|
607 | 686 | { |
608 | 687 | $group_list = array(); |
609 | 688 | } |
@@ -612,39 +691,50 @@ discard block |
||
612 | 691 | { |
613 | 692 | foreach($component_list as $key => $val) |
614 | 693 | { |
615 | - if(!trim($key)) continue; |
|
694 | + if(!trim($key)) { |
|
695 | + continue; |
|
696 | + } |
|
616 | 697 | if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
617 | 698 | { |
618 | 699 | FileHandler::removeFile($cache_file); |
619 | 700 | return $this->getComponentList($filter_enabled, $site_srl); |
620 | 701 | } |
621 | - if(!$filter_enabled) continue; |
|
702 | + if(!$filter_enabled) { |
|
703 | + continue; |
|
704 | + } |
|
622 | 705 | if($val->enabled == "N") |
623 | 706 | { |
624 | 707 | unset($component_list->{$key}); |
625 | 708 | continue; |
626 | 709 | } |
627 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
710 | + if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") { |
|
711 | + continue; |
|
712 | + } |
|
628 | 713 | if($val->target_group) |
629 | 714 | { |
630 | 715 | if(!$logged_info) |
631 | 716 | { |
632 | 717 | $val->enabled = "N"; |
633 | - } |
|
634 | - else |
|
718 | + } else |
|
635 | 719 | { |
636 | 720 | $is_granted = false; |
637 | 721 | foreach($group_list as $group_srl) |
638 | 722 | { |
639 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
723 | + if(in_array($group_srl, $val->target_group)) { |
|
724 | + $is_granted = true; |
|
725 | + } |
|
726 | + } |
|
727 | + if(!$is_granted) { |
|
728 | + $val->enabled = "N"; |
|
640 | 729 | } |
641 | - if(!$is_granted) $val->enabled = "N"; |
|
642 | 730 | } |
643 | 731 | } |
644 | 732 | if($val->enabled != "N" && $val->mid_list) |
645 | 733 | { |
646 | 734 | $mid = Context::get('mid'); |
647 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
735 | + if(!in_array($mid, $val->mid_list)) { |
|
736 | + $val->enabled = "N"; |
|
737 | + } |
|
648 | 738 | } |
649 | 739 | if($val->enabled == "N") |
650 | 740 | { |
@@ -668,14 +758,15 @@ discard block |
||
668 | 758 | { |
669 | 759 | $args->site_srl = $site_srl; |
670 | 760 | $output = executeQuery('editor.getSiteComponent', $args); |
671 | - } |
|
672 | - else |
|
761 | + } else |
|
673 | 762 | { |
674 | 763 | $output = executeQuery('editor.getComponent', $args); |
675 | 764 | } |
676 | 765 | $component = $output->data; |
677 | 766 | |
678 | - if(!$output->data) return false; |
|
767 | + if(!$output->data) { |
|
768 | + return false; |
|
769 | + } |
|
679 | 770 | |
680 | 771 | $component_name = $component->component_name; |
681 | 772 | |
@@ -754,8 +845,7 @@ discard block |
||
754 | 845 | $component_info->homepage = $xml_doc->component->link->body; |
755 | 846 | $component_info->license = $xml_doc->component->license->body; |
756 | 847 | $component_info->license_link = $xml_doc->component->license->attrs->link; |
757 | - } |
|
758 | - else |
|
848 | + } else |
|
759 | 849 | { |
760 | 850 | sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
761 | 851 | $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -772,8 +862,11 @@ discard block |
||
772 | 862 | |
773 | 863 | // Author information |
774 | 864 | $author_list = array(); |
775 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
776 | - else $author_list = $xml_doc->component->author; |
|
865 | + if(!is_array($xml_doc->component->author)) { |
|
866 | + $author_list[] = $xml_doc->component->author; |
|
867 | + } else { |
|
868 | + $author_list = $xml_doc->component->author; |
|
869 | + } |
|
777 | 870 | |
778 | 871 | for($i = 0; $i < count($author_list); $i++) |
779 | 872 | { |
@@ -22,59 +22,59 @@ discard block |
||
22 | 22 | { |
23 | 23 | $component_count = 0; |
24 | 24 | $site_module_info = Context::get('site_module_info'); |
25 | - $site_srl = (int)$site_module_info->site_srl; |
|
25 | + $site_srl = (int) $site_module_info->site_srl; |
|
26 | 26 | |
27 | 27 | // Get a type of component |
28 | 28 | $oEditorModel = getModel('editor'); |
29 | 29 | $oModuleModel = getModel('module'); |
30 | 30 | $editor_config = $oModuleModel->getModuleConfig('editor'); |
31 | 31 | |
32 | - if(!$editor_config) |
|
32 | + if (!$editor_config) |
|
33 | 33 | { |
34 | 34 | $editor_config = new stdClass(); |
35 | 35 | } |
36 | 36 | |
37 | 37 | //editor_config init |
38 | - if(!$editor_config->editor_height) $editor_config->editor_height = 300; |
|
39 | - if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
|
40 | - if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
|
41 | - if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
|
42 | - if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono'; |
|
43 | - if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono'; |
|
38 | + if (!$editor_config->editor_height) $editor_config->editor_height = 300; |
|
39 | + if (!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
|
40 | + if (!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
|
41 | + if (!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
|
42 | + if (!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset = 'moono'; |
|
43 | + if (!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset = 'moono'; |
|
44 | 44 | |
45 | 45 | $component_list = $oEditorModel->getComponentList(false, $site_srl, true); |
46 | 46 | $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
47 | 47 | |
48 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); |
|
48 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin); |
|
49 | 49 | |
50 | 50 | $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); |
51 | 51 | $content_style_list = array(); |
52 | - for($i=0,$c=count($contents);$i<$c;$i++) |
|
52 | + for ($i = 0, $c = count($contents); $i < $c; $i++) |
|
53 | 53 | { |
54 | 54 | $style = $contents[$i]; |
55 | - $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); |
|
55 | + $info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles'); |
|
56 | 56 | $content_style_list[$style] = new stdClass(); |
57 | 57 | $content_style_list[$style]->title = $info->title; |
58 | 58 | } |
59 | 59 | |
60 | 60 | // Get install info, update info, count |
61 | 61 | $oAutoinstallModel = getModel('autoinstall'); |
62 | - foreach($component_list as $component_name => $xml_info) |
|
62 | + foreach ($component_list as $component_name => $xml_info) |
|
63 | 63 | { |
64 | 64 | $component_count++; |
65 | 65 | $xml_info->path = './modules/editor/components/'.$xml_info->component_name; |
66 | 66 | $xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); |
67 | 67 | $xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); |
68 | - if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
68 | + if ($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
69 | 69 | } |
70 | 70 | |
71 | - if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
71 | + if (is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
72 | 72 | |
73 | - foreach($component_list as $component_name => $xml_info) |
|
73 | + foreach ($component_list as $component_name => $xml_info) |
|
74 | 74 | { |
75 | - if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
75 | + if ($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
76 | 76 | } |
77 | - $editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13"); |
|
77 | + $editor_config_default = array("editor_height" => "300", "comment_editor_height" => "100", "content_font_size"=>"13"); |
|
78 | 78 | |
79 | 79 | //editor preview |
80 | 80 | $config = $oEditorModel->getEditorConfig(); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | function dispEditorAdminSetupComponent() |
139 | 139 | { |
140 | 140 | $site_module_info = Context::get('site_module_info'); |
141 | - $site_srl = (int)$site_module_info->site_srl; |
|
141 | + $site_srl = (int) $site_module_info->site_srl; |
|
142 | 142 | |
143 | 143 | $component_name = Context::get('component_name'); |
144 | 144 | // Get information of the editor component |
145 | 145 | $oEditorModel = getModel('editor'); |
146 | - $component = $oEditorModel->getComponent($component_name,$site_srl); |
|
146 | + $component = $oEditorModel->getComponent($component_name, $site_srl); |
|
147 | 147 | |
148 | - if(!$component->component_name) { |
|
148 | + if (!$component->component_name) { |
|
149 | 149 | $this->stop('msg_invalid_request'); |
150 | 150 | return; |
151 | 151 | } |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | // Get a mid list |
159 | 159 | $oModuleModel = getModel('module'); |
160 | 160 | |
161 | - $args =new stdClass(); |
|
161 | + $args = new stdClass(); |
|
162 | 162 | $args->site_srl = $site_srl; |
163 | 163 | $columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title'); |
164 | 164 | $mid_list = $oModuleModel->getMidList($args, $columnList); |
165 | 165 | // Combination of module_category and module |
166 | - if(!$args->site_srl) |
|
166 | + if (!$args->site_srl) |
|
167 | 167 | { |
168 | 168 | // Get a list of module category |
169 | 169 | $module_categories = $oModuleModel->getModuleCategories(); |
170 | 170 | |
171 | - if(!is_array($mid_list)) $mid_list = array($mid_list); |
|
172 | - foreach($mid_list as $module_srl => $module) |
|
171 | + if (!is_array($mid_list)) $mid_list = array($mid_list); |
|
172 | + foreach ($mid_list as $module_srl => $module) |
|
173 | 173 | { |
174 | - if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
174 | + if ($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | else |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $module_categories[0]->list = $mid_list; |
180 | 180 | } |
181 | 181 | |
182 | - Context::set('mid_list',$module_categories); |
|
182 | + Context::set('mid_list', $module_categories); |
|
183 | 183 | |
184 | 184 | //Security |
185 | 185 | $security = new Security(); |
186 | 186 | $security->encodeHTML('group_list..title'); |
187 | 187 | $security->encodeHTML('component...', 'component_name'); |
188 | - $security->encodeHTML('mid_list..title','mid_list..list..browser_title'); |
|
188 | + $security->encodeHTML('mid_list..title', 'mid_list..list..browser_title'); |
|
189 | 189 | |
190 | 190 | $this->setTemplatePath($this->module_path.'tpl'); |
191 | 191 | $this->setTemplateFile('setup_component'); |