@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
| 36 | 36 | { |
| 37 | 37 | // If XE has not installed yet, set module as install |
| 38 | - if(!Context::isInstalled()) |
|
| 38 | + if (!Context::isInstalled()) |
|
| 39 | 39 | { |
| 40 | 40 | $this->module = 'install'; |
| 41 | 41 | $this->act = Context::get('act'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance(); |
| 46 | - if($oContext->isSuccessInit == FALSE) |
|
| 46 | + if ($oContext->isSuccessInit == FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | // @see https://github.com/xpressengine/xe-core/issues/2304 |
| 49 | 49 | $this->error = 'msg_invalid_request'; |
@@ -56,26 +56,26 @@ discard block |
||
| 56 | 56 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 57 | 57 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 58 | 58 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 59 | - if($entry = Context::get('entry')) |
|
| 59 | + if ($entry = Context::get('entry')) |
|
| 60 | 60 | { |
| 61 | 61 | $this->entry = Context::convertEncodingStr($entry); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Validate variables to prevent XSS |
| 65 | 65 | $isInvalid = NULL; |
| 66 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 66 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 67 | 67 | { |
| 68 | 68 | $isInvalid = TRUE; |
| 69 | 69 | } |
| 70 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 70 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 71 | 71 | { |
| 72 | 72 | $isInvalid = TRUE; |
| 73 | 73 | } |
| 74 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 74 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 75 | 75 | { |
| 76 | 76 | $isInvalid = TRUE; |
| 77 | 77 | } |
| 78 | - if($isInvalid) |
|
| 78 | + if ($isInvalid) |
|
| 79 | 79 | { |
| 80 | 80 | htmlHeader(); |
| 81 | 81 | echo Context::getLang("msg_invalid_request"); |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | exit; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 87 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 88 | 88 | { |
| 89 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 89 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 90 | 90 | { |
| 91 | - if(Context::get('_https_port')!=null) { |
|
| 92 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
| 91 | + if (Context::get('_https_port') != null) { |
|
| 92 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
| 93 | 93 | } else { |
| 94 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
| 94 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
| 95 | 95 | } |
| 96 | 96 | return; |
| 97 | 97 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // call a trigger before moduleHandler init |
| 101 | 101 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
| 102 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 102 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 103 | 103 | { |
| 104 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 104 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 105 | 105 | { |
| 106 | 106 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
| 107 | 107 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -112,40 +112,40 @@ discard block |
||
| 112 | 112 | $called_position = 'before_module_init'; |
| 113 | 113 | $oAddonController = getController('addon'); |
| 114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 115 | - if(file_exists($addon_file)) include($addon_file); |
|
| 115 | + if (file_exists($addon_file)) include($addon_file); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 119 | 119 | { |
| 120 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 120 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 121 | 121 | { |
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | set_error_handler(function() { }, ~0); |
| 126 | 126 | |
| 127 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 128 | - if(!file_exists($debug_file)) |
|
| 127 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 128 | + if (!file_exists($debug_file)) |
|
| 129 | 129 | { |
| 130 | 130 | $print[] = '<?php exit() ?>'; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $errorname = self::getErrorType($errnumber); |
| 134 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 134 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 135 | 135 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 136 | 136 | $backtrace = debug_backtrace($backtrace_args); |
| 137 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 137 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 138 | 138 | { |
| 139 | 139 | array_shift($backtrace); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - foreach($backtrace as $key => $value) |
|
| 142 | + foreach ($backtrace as $key => $value) |
|
| 143 | 143 | { |
| 144 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 144 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 145 | 145 | $print[] = $message; |
| 146 | 146 | } |
| 147 | 147 | $print[] = PHP_EOL; |
| 148 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 148 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 149 | 149 | restore_error_handler(); |
| 150 | 150 | |
| 151 | 151 | return true; |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | set_error_handler(function() { }, ~0); |
| 163 | 163 | |
| 164 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 165 | - if(!file_exists($debug_file)) |
|
| 164 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 165 | + if (!file_exists($debug_file)) |
|
| 166 | 166 | { |
| 167 | 167 | $print[] = '<?php exit() ?>'; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $errorname = self::getErrorType($errinfo['type']); |
| 171 | 171 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 172 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 172 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 173 | 173 | |
| 174 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 174 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 175 | 175 | $print[] = $message; |
| 176 | 176 | |
| 177 | 177 | $print[] = PHP_EOL; |
| 178 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 178 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 179 | 179 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 180 | 180 | |
| 181 | 181 | return true; |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 220 | 220 | $defaultHost = $defaultUrlInfo['host']; |
| 221 | 221 | |
| 222 | - foreach($urls as $url) |
|
| 222 | + foreach ($urls as $url) |
|
| 223 | 223 | { |
| 224 | - if(empty($url)) |
|
| 224 | + if (empty($url)) |
|
| 225 | 225 | { |
| 226 | 226 | continue; |
| 227 | 227 | } |
@@ -229,29 +229,29 @@ discard block |
||
| 229 | 229 | $urlInfo = parse_url($url); |
| 230 | 230 | $host = $urlInfo['host']; |
| 231 | 231 | |
| 232 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 232 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 233 | 233 | { |
| 234 | 234 | throw new Exception('msg_default_url_is_null'); |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 238 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 239 | 239 | { |
| 240 | 240 | $oDocumentModel = getModel('document'); |
| 241 | 241 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 242 | - if($this->document_srl) |
|
| 242 | + if ($this->document_srl) |
|
| 243 | 243 | { |
| 244 | 244 | Context::set('document_srl', $this->document_srl); |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // Get module's information based on document_srl, if it's specified |
| 249 | - if($this->document_srl) |
|
| 249 | + if ($this->document_srl) |
|
| 250 | 250 | { |
| 251 | 251 | |
| 252 | 252 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 253 | 253 | // If the document does not exist, remove document_srl |
| 254 | - if(!$module_info) |
|
| 254 | + if (!$module_info) |
|
| 255 | 255 | { |
| 256 | 256 | unset($this->document_srl); |
| 257 | 257 | } |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | // If it exists, compare mid based on the module information |
| 261 | 261 | // if mids are not matching, set it as the document's mid |
| 262 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 262 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 263 | 263 | { |
| 264 | 264 | |
| 265 | - if(Context::getRequestMethod() == 'GET') |
|
| 265 | + if (Context::getRequestMethod() == 'GET') |
|
| 266 | 266 | { |
| 267 | 267 | $this->mid = $module_info->mid; |
| 268 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 268 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 269 | 269 | return FALSE; |
| 270 | 270 | } |
| 271 | 271 | else |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | } |
| 278 | 278 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 279 | - if($this->module && $module_info->module != $this->module) |
|
| 279 | + if ($this->module && $module_info->module != $this->module) |
|
| 280 | 280 | { |
| 281 | 281 | unset($module_info); |
| 282 | 282 | } |
@@ -285,36 +285,36 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 288 | - if(!$module_info && $this->mid) |
|
| 288 | + if (!$module_info && $this->mid) |
|
| 289 | 289 | { |
| 290 | 290 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 291 | 291 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // redirect, if module_site_srl and site_srl are different |
| 295 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 295 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 296 | 296 | { |
| 297 | 297 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 298 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 298 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 299 | 299 | return FALSE; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // If module_info is not set still, and $module does not exist, find the default module |
| 303 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 303 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 304 | 304 | { |
| 305 | 305 | $module_info = $site_module_info; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 308 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 309 | 309 | { |
| 310 | 310 | $module_info = $site_module_info; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 314 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 314 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 315 | 315 | { |
| 316 | 316 | // If the module is of virtual site |
| 317 | - if($module_info->site_srl) |
|
| 317 | + if ($module_info->site_srl) |
|
| 318 | 318 | { |
| 319 | 319 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 320 | 320 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | else |
| 324 | 324 | { |
| 325 | 325 | $db_info = Context::getDBInfo(); |
| 326 | - if(!$db_info->default_url) |
|
| 326 | + if (!$db_info->default_url) |
|
| 327 | 327 | { |
| 328 | 328 | return Context::getLang('msg_default_url_is_not_defined'); |
| 329 | 329 | } |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | - header("location:" . $redirect_url); |
|
| 335 | + header("location:".$redirect_url); |
|
| 336 | 336 | return FALSE; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // If module info was set, retrieve variables from the module information |
| 340 | - if($module_info) |
|
| 340 | + if ($module_info) |
|
| 341 | 341 | { |
| 342 | 342 | $this->module = $module_info->module; |
| 343 | 343 | $this->mid = $module_info->mid; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 349 | 349 | |
| 350 | 350 | // use the site default layout. |
| 351 | - if($module_info->{$targetSrl} == -1) |
|
| 351 | + if ($module_info->{$targetSrl} == -1) |
|
| 352 | 352 | { |
| 353 | 353 | $oLayoutAdminModel = getAdminModel('layout'); |
| 354 | 354 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // Set module and mid into module_info |
| 369 | - if(!isset($this->module_info)) |
|
| 369 | + if (!isset($this->module_info)) |
|
| 370 | 370 | { |
| 371 | 371 | $this->module_info = new stdClass(); |
| 372 | 372 | } |
@@ -377,21 +377,21 @@ discard block |
||
| 377 | 377 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 378 | 378 | |
| 379 | 379 | // Still no module? it's an error |
| 380 | - if(!$this->module) |
|
| 380 | + if (!$this->module) |
|
| 381 | 381 | { |
| 382 | 382 | $this->error = 'msg_module_is_not_exists'; |
| 383 | 383 | $this->httpStatusCode = '404'; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | // If mid exists, set mid into context |
| 387 | - if($this->mid) |
|
| 387 | + if ($this->mid) |
|
| 388 | 388 | { |
| 389 | 389 | Context::set('mid', $this->mid, TRUE); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | // Call a trigger after moduleHandler init |
| 393 | 393 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 394 | - if(!$output->toBool()) |
|
| 394 | + if (!$output->toBool()) |
|
| 395 | 395 | { |
| 396 | 396 | $this->error = $output->getMessage(); |
| 397 | 397 | return TRUE; |
@@ -413,14 +413,14 @@ discard block |
||
| 413 | 413 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 414 | 414 | |
| 415 | 415 | // If error occurred while preparation, return a message instance |
| 416 | - if($this->error) |
|
| 416 | + if ($this->error) |
|
| 417 | 417 | { |
| 418 | 418 | $this->_setInputErrorToContext(); |
| 419 | 419 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 420 | 420 | $oMessageObject->setError(-1); |
| 421 | 421 | $oMessageObject->setMessage($this->error); |
| 422 | 422 | $oMessageObject->dispMessage(); |
| 423 | - if($this->httpStatusCode) |
|
| 423 | + if ($this->httpStatusCode) |
|
| 424 | 424 | { |
| 425 | 425 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 426 | 426 | } |
@@ -431,22 +431,22 @@ discard block |
||
| 431 | 431 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 432 | 432 | |
| 433 | 433 | // If not installed yet, modify act |
| 434 | - if($this->module == "install") |
|
| 434 | + if ($this->module == "install") |
|
| 435 | 435 | { |
| 436 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 436 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 437 | 437 | { |
| 438 | 438 | $this->act = $xml_info->default_index_act; |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // if act exists, find type of the action, if not use default index act |
| 443 | - if(!$this->act) |
|
| 443 | + if (!$this->act) |
|
| 444 | 444 | { |
| 445 | 445 | $this->act = $xml_info->default_index_act; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | // still no act means error |
| 449 | - if(!$this->act) |
|
| 449 | + if (!$this->act) |
|
| 450 | 450 | { |
| 451 | 451 | $this->error = 'msg_module_is_not_exists'; |
| 452 | 452 | $this->httpStatusCode = '404'; |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $oMessageObject->setError(-1); |
| 457 | 457 | $oMessageObject->setMessage($this->error); |
| 458 | 458 | $oMessageObject->dispMessage(); |
| 459 | - if($this->httpStatusCode) |
|
| 459 | + if ($this->httpStatusCode) |
|
| 460 | 460 | { |
| 461 | 461 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 462 | 462 | } |
@@ -474,17 +474,17 @@ discard block |
||
| 474 | 474 | Context::addMetaTag('robots', 'noindex'); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - if(!$kind && $this->module == 'admin') |
|
| 477 | + if (!$kind && $this->module == 'admin') |
|
| 478 | 478 | { |
| 479 | 479 | $kind = 'admin'; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // check REQUEST_METHOD in controller |
| 483 | - if($type == 'controller') |
|
| 483 | + if ($type == 'controller') |
|
| 484 | 484 | { |
| 485 | 485 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 486 | 486 | |
| 487 | - if(!$allowedMethod) |
|
| 487 | + if (!$allowedMethod) |
|
| 488 | 488 | { |
| 489 | 489 | $allowedMethodList[0] = 'POST'; |
| 490 | 490 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 496 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 497 | 497 | { |
| 498 | 498 | $this->error = "msg_invalid_request"; |
| 499 | 499 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - if($this->module_info->use_mobile != "Y") |
|
| 507 | + if ($this->module_info->use_mobile != "Y") |
|
| 508 | 508 | { |
| 509 | 509 | Mobile::setMobile(FALSE); |
| 510 | 510 | } |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | // check CSRF for non-GET actions |
| 515 | 515 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 516 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 516 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 517 | 517 | { |
| 518 | 518 | $this->error = 'msg_invalid_request'; |
| 519 | 519 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | // Admin ip |
| 527 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 527 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 528 | 528 | { |
| 529 | 529 | $this->_setInputErrorToContext(); |
| 530 | 530 | $this->error = "msg_not_permitted_act"; |
@@ -536,13 +536,13 @@ discard block |
||
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | // if(type == view, and case for using mobilephone) |
| 539 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 539 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 540 | 540 | { |
| 541 | 541 | $orig_type = "view"; |
| 542 | 542 | $type = "mobile"; |
| 543 | 543 | // create a module instance |
| 544 | 544 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 545 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 545 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 546 | 546 | { |
| 547 | 547 | $type = $orig_type; |
| 548 | 548 | Mobile::setMobile(FALSE); |
@@ -555,14 +555,14 @@ discard block |
||
| 555 | 555 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | - if(!is_object($oModule)) |
|
| 558 | + if (!is_object($oModule)) |
|
| 559 | 559 | { |
| 560 | 560 | $this->_setInputErrorToContext(); |
| 561 | 561 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 562 | 562 | $oMessageObject->setError(-1); |
| 563 | 563 | $oMessageObject->setMessage($this->error); |
| 564 | 564 | $oMessageObject->dispMessage(); |
| 565 | - if($this->httpStatusCode) |
|
| 565 | + if ($this->httpStatusCode) |
|
| 566 | 566 | { |
| 567 | 567 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 568 | 568 | } |
@@ -570,10 +570,10 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | // If there is no such action in the module object |
| 573 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 573 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 574 | 574 | { |
| 575 | 575 | |
| 576 | - if(!Context::isInstalled()) |
|
| 576 | + if (!Context::isInstalled()) |
|
| 577 | 577 | { |
| 578 | 578 | $this->_setInputErrorToContext(); |
| 579 | 579 | $this->error = 'msg_invalid_request'; |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | $oMessageObject->setError(-1); |
| 582 | 582 | $oMessageObject->setMessage($this->error); |
| 583 | 583 | $oMessageObject->dispMessage(); |
| 584 | - if($this->httpStatusCode) |
|
| 584 | + if ($this->httpStatusCode) |
|
| 585 | 585 | { |
| 586 | 586 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 587 | 587 | } |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | $forward = NULL; |
| 592 | 592 | // 1. Look for the module with action name |
| 593 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 593 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 594 | 594 | { |
| 595 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 595 | + $module = strtolower($matches[2].$matches[3]); |
|
| 596 | 596 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 597 | 597 | |
| 598 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 598 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 599 | 599 | { |
| 600 | 600 | $forward = new stdClass(); |
| 601 | 601 | $forward->module = $module; |
@@ -616,12 +616,12 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if(!$forward) |
|
| 619 | + if (!$forward) |
|
| 620 | 620 | { |
| 621 | 621 | $forward = $oModuleModel->getActionForward($this->act); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 624 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 625 | 625 | { |
| 626 | 626 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 627 | 627 | $type = $forward->type; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $tpl_path = $oModule->getTemplatePath(); |
| 630 | 630 | $orig_module = $oModule; |
| 631 | 631 | |
| 632 | - if($forward->meta_noindex === 'true') { |
|
| 632 | + if ($forward->meta_noindex === 'true') { |
|
| 633 | 633 | Context::addMetaTag('robots', 'noindex'); |
| 634 | 634 | } |
| 635 | 635 | |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | |
| 638 | 638 | // check CSRF for non-GET actions |
| 639 | 639 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 640 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 640 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 641 | 641 | { |
| 642 | 642 | $this->error = 'msg_invalid_request'; |
| 643 | 643 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | |
| 650 | 650 | // SECISSUE also check foward act method |
| 651 | 651 | // check REQUEST_METHOD in controller |
| 652 | - if($type == 'controller') |
|
| 652 | + if ($type == 'controller') |
|
| 653 | 653 | { |
| 654 | 654 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 655 | 655 | |
| 656 | - if(!$allowedMethod) |
|
| 656 | + if (!$allowedMethod) |
|
| 657 | 657 | { |
| 658 | 658 | $allowedMethodList[0] = 'POST'; |
| 659 | 659 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 665 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 666 | 666 | { |
| 667 | 667 | $this->error = "msg_invalid_request"; |
| 668 | 668 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -673,13 +673,13 @@ discard block |
||
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 676 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 677 | 677 | { |
| 678 | 678 | $orig_type = "view"; |
| 679 | 679 | $type = "mobile"; |
| 680 | 680 | // create a module instance |
| 681 | 681 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 682 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 682 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 683 | 683 | { |
| 684 | 684 | $type = $orig_type; |
| 685 | 685 | Mobile::setMobile(FALSE); |
@@ -691,25 +691,25 @@ discard block |
||
| 691 | 691 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - if(!is_object($oModule)) |
|
| 694 | + if (!is_object($oModule)) |
|
| 695 | 695 | { |
| 696 | 696 | $this->_setInputErrorToContext(); |
| 697 | 697 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 698 | 698 | $oMessageObject->setError(-1); |
| 699 | 699 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 700 | 700 | $oMessageObject->dispMessage(); |
| 701 | - if($this->httpStatusCode) |
|
| 701 | + if ($this->httpStatusCode) |
|
| 702 | 702 | { |
| 703 | 703 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 704 | 704 | } |
| 705 | 705 | return $oMessageObject; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - if($this->module == "admin" && $type == "view") |
|
| 708 | + if ($this->module == "admin" && $type == "view") |
|
| 709 | 709 | { |
| 710 | - if($logged_info->is_admin == 'Y') |
|
| 710 | + if ($logged_info->is_admin == 'Y') |
|
| 711 | 711 | { |
| 712 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 712 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 713 | 713 | { |
| 714 | 714 | $oAdminView = getAdminView('admin'); |
| 715 | 715 | $oAdminView->makeGnbUrl($forward->module); |
@@ -729,10 +729,10 @@ discard block |
||
| 729 | 729 | return $oMessageObject; |
| 730 | 730 | } |
| 731 | 731 | } |
| 732 | - if($kind == 'admin') |
|
| 732 | + if ($kind == 'admin') |
|
| 733 | 733 | { |
| 734 | 734 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 735 | - if(!$grant->manager) |
|
| 735 | + if (!$grant->manager) |
|
| 736 | 736 | { |
| 737 | 737 | $this->_setInputErrorToContext(); |
| 738 | 738 | $this->error = 'msg_is_not_manager'; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | } |
| 745 | 745 | else |
| 746 | 746 | { |
| 747 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 747 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 748 | 748 | { |
| 749 | 749 | $this->_setInputErrorToContext(); |
| 750 | 750 | $this->error = 'msg_is_not_administrator'; |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 760 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 761 | 761 | { |
| 762 | 762 | $this->act = $xml_info->default_index_act; |
| 763 | 763 | } |
@@ -771,16 +771,16 @@ discard block |
||
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // ruleset check... |
| 774 | - if(!empty($ruleset)) |
|
| 774 | + if (!empty($ruleset)) |
|
| 775 | 775 | { |
| 776 | 776 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 777 | 777 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 778 | - if(!empty($rulesetFile)) |
|
| 778 | + if (!empty($rulesetFile)) |
|
| 779 | 779 | { |
| 780 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 780 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 781 | 781 | { |
| 782 | 782 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 783 | - foreach($errorLang as $key => $val) |
|
| 783 | + foreach ($errorLang as $key => $val) |
|
| 784 | 784 | { |
| 785 | 785 | Context::setLang($key, $val); |
| 786 | 786 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $Validator = new Validator($rulesetFile); |
| 791 | 791 | $result = $Validator->validate(); |
| 792 | - if(!$result) |
|
| 792 | + if (!$result) |
|
| 793 | 793 | { |
| 794 | 794 | $lastError = $Validator->getLastError(); |
| 795 | 795 | $returnUrl = Context::get('error_return_url'); |
@@ -821,26 +821,26 @@ discard block |
||
| 821 | 821 | 'dispLayoutPreviewWithModule' => 1 |
| 822 | 822 | ); |
| 823 | 823 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 824 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 824 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 825 | 825 | { |
| 826 | 826 | global $lang; |
| 827 | 827 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
| 828 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
| 828 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
| 829 | 829 | Context::addHtmlHeader($header); |
| 830 | 830 | Context::addHtmlFooter($footer); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
| 833 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
| 834 | 834 | { |
| 835 | 835 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 836 | - if($module_config->htmlFooter) |
|
| 836 | + if ($module_config->htmlFooter) |
|
| 837 | 837 | { |
| 838 | 838 | Context::addHtmlFooter($module_config->htmlFooter); |
| 839 | 839 | } |
| 840 | - if($module_config->siteTitle) |
|
| 840 | + if ($module_config->siteTitle) |
|
| 841 | 841 | { |
| 842 | 842 | $siteTitle = Context::getBrowserTitle(); |
| 843 | - if(!$siteTitle) |
|
| 843 | + if (!$siteTitle) |
|
| 844 | 844 | { |
| 845 | 845 | Context::setBrowserTitle($module_config->siteTitle); |
| 846 | 846 | } |
@@ -857,18 +857,18 @@ discard block |
||
| 857 | 857 | $procResult = $oModule->proc(); |
| 858 | 858 | |
| 859 | 859 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 860 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 860 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 861 | 861 | { |
| 862 | 862 | $error = $oModule->getError(); |
| 863 | 863 | $message = $oModule->getMessage(); |
| 864 | 864 | $messageType = $oModule->getMessageType(); |
| 865 | 865 | $redirectUrl = $oModule->getRedirectUrl(); |
| 866 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 866 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 867 | 867 | |
| 868 | - if(!$procResult) |
|
| 868 | + if (!$procResult) |
|
| 869 | 869 | { |
| 870 | 870 | $this->error = $message; |
| 871 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 871 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 872 | 872 | { |
| 873 | 873 | $redirectUrl = Context::get('error_return_url'); |
| 874 | 874 | } |
@@ -881,13 +881,13 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 883 | 883 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 884 | - if($message != 'success') |
|
| 884 | + if ($message != 'success') |
|
| 885 | 885 | { |
| 886 | 886 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 887 | 887 | } |
| 888 | 888 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 889 | 889 | |
| 890 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 890 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 891 | 891 | { |
| 892 | 892 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 893 | 893 | } |
@@ -903,27 +903,27 @@ discard block |
||
| 903 | 903 | * */ |
| 904 | 904 | function _setInputErrorToContext() |
| 905 | 905 | { |
| 906 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 906 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 907 | 907 | { |
| 908 | 908 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 909 | 909 | } |
| 910 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 910 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 911 | 911 | { |
| 912 | 912 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 913 | 913 | } |
| 914 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 914 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 915 | 915 | { |
| 916 | 916 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 917 | 917 | } |
| 918 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 918 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 919 | 919 | { |
| 920 | 920 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 921 | 921 | } |
| 922 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 922 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 923 | 923 | { |
| 924 | 924 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 925 | 925 | } |
| 926 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 926 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 927 | 927 | { |
| 928 | 928 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 929 | 929 | } |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | { |
| 954 | 954 | $requestVars = Context::getRequestVars(); |
| 955 | 955 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 956 | - foreach($requestVars AS $key => $value) |
|
| 956 | + foreach ($requestVars AS $key => $value) |
|
| 957 | 957 | { |
| 958 | 958 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 959 | 959 | } |
@@ -967,41 +967,41 @@ discard block |
||
| 967 | 967 | function displayContent($oModule = NULL) |
| 968 | 968 | { |
| 969 | 969 | // If the module is not set or not an object, set error |
| 970 | - if(!$oModule || !is_object($oModule)) |
|
| 970 | + if (!$oModule || !is_object($oModule)) |
|
| 971 | 971 | { |
| 972 | 972 | $this->error = 'msg_module_is_not_exists'; |
| 973 | 973 | $this->httpStatusCode = '404'; |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | // If connection to DB has a problem even though it's not install module, set error |
| 977 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 977 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 978 | 978 | { |
| 979 | 979 | $this->error = 'msg_dbconnect_failed'; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | // Call trigger after moduleHandler proc |
| 983 | 983 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 984 | - if(!$output->toBool()) |
|
| 984 | + if (!$output->toBool()) |
|
| 985 | 985 | { |
| 986 | 986 | $this->error = $output->getMessage(); |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | // Use message view object, if HTML call |
| 990 | 990 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 991 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 991 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 992 | 992 | { |
| 993 | 993 | |
| 994 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 994 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 995 | 995 | { |
| 996 | 996 | $display_handler = new DisplayHandler(); |
| 997 | 997 | $display_handler->_debugOutput(); |
| 998 | 998 | |
| 999 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 999 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 1000 | 1000 | return; |
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | // If error occurred, handle it |
| 1004 | - if($this->error) |
|
| 1004 | + if ($this->error) |
|
| 1005 | 1005 | { |
| 1006 | 1006 | // display content with message module instance |
| 1007 | 1007 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -1010,14 +1010,14 @@ discard block |
||
| 1010 | 1010 | $oMessageObject->setMessage($this->error); |
| 1011 | 1011 | $oMessageObject->dispMessage(); |
| 1012 | 1012 | |
| 1013 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1013 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 1016 | 1016 | $oMessageObject->setTemplateFile('http_status_code'); |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | // If module was called normally, change the templates of the module into ones of the message view module |
| 1020 | - if($oModule) |
|
| 1020 | + if ($oModule) |
|
| 1021 | 1021 | { |
| 1022 | 1022 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1023 | 1023 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | // Check if layout_srl exists for the module |
| 1035 | - if(Mobile::isFromMobilePhone()) |
|
| 1035 | + if (Mobile::isFromMobilePhone()) |
|
| 1036 | 1036 | { |
| 1037 | 1037 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1038 | 1038 | } |
@@ -1042,58 +1042,58 @@ discard block |
||
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | // if layout_srl is rollback by module, set default layout |
| 1045 | - if($layout_srl == -1) |
|
| 1045 | + if ($layout_srl == -1) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1048 | 1048 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1049 | 1049 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1052 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1053 | 1053 | { |
| 1054 | 1054 | |
| 1055 | 1055 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1056 | 1056 | $oLayoutModel = getModel('layout'); |
| 1057 | 1057 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1058 | - if($layout_info) |
|
| 1058 | + if ($layout_info) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | |
| 1061 | 1061 | // Input extra_vars into $layout_info |
| 1062 | - if($layout_info->extra_var_count) |
|
| 1062 | + if ($layout_info->extra_var_count) |
|
| 1063 | 1063 | { |
| 1064 | 1064 | |
| 1065 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1065 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1066 | 1066 | { |
| 1067 | - if($val->type == 'image') |
|
| 1067 | + if ($val->type == 'image') |
|
| 1068 | 1068 | { |
| 1069 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1069 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1070 | 1070 | { |
| 1071 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1071 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1072 | 1072 | } |
| 1073 | 1073 | } |
| 1074 | 1074 | $layout_info->{$var_id} = $val->value; |
| 1075 | 1075 | } |
| 1076 | 1076 | } |
| 1077 | 1077 | // Set menus into context |
| 1078 | - if($layout_info->menu_count) |
|
| 1078 | + if ($layout_info->menu_count) |
|
| 1079 | 1079 | { |
| 1080 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1080 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1081 | 1081 | { |
| 1082 | 1082 | // set default menu set(included home menu) |
| 1083 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1083 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1084 | 1084 | { |
| 1085 | 1085 | $oMenuAdminController = getAdminController('menu'); |
| 1086 | 1086 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1087 | 1087 | |
| 1088 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1088 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1089 | 1089 | { |
| 1090 | 1090 | include($homeMenuCacheFile); |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | - if(!$menu->menu_srl) |
|
| 1093 | + if (!$menu->menu_srl) |
|
| 1094 | 1094 | { |
| 1095 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1096 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1095 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1096 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1097 | 1097 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1098 | 1098 | } |
| 1099 | 1099 | else |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | $php_file = FileHandler::exists($menu->php_file); |
| 1107 | - if($php_file) |
|
| 1107 | + if ($php_file) |
|
| 1108 | 1108 | { |
| 1109 | 1109 | include($php_file); |
| 1110 | 1110 | } |
@@ -1120,17 +1120,17 @@ discard block |
||
| 1120 | 1120 | |
| 1121 | 1121 | // If layout was modified, use the modified version |
| 1122 | 1122 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1123 | - if(file_exists($edited_layout)) |
|
| 1123 | + if (file_exists($edited_layout)) |
|
| 1124 | 1124 | { |
| 1125 | 1125 | $oModule->setEditedLayoutFile($edited_layout); |
| 1126 | 1126 | } |
| 1127 | 1127 | } |
| 1128 | 1128 | } |
| 1129 | 1129 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1130 | - if($isLayoutDrop) |
|
| 1130 | + if ($isLayoutDrop) |
|
| 1131 | 1131 | { |
| 1132 | 1132 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1133 | - if($kind == 'admin') |
|
| 1133 | + if ($kind == 'admin') |
|
| 1134 | 1134 | { |
| 1135 | 1135 | $oModule->setLayoutFile('popup_layout'); |
| 1136 | 1136 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1169 | 1169 | { |
| 1170 | 1170 | |
| 1171 | - if(__DEBUG__ == 3) |
|
| 1171 | + if (__DEBUG__ == 3) |
|
| 1172 | 1172 | { |
| 1173 | 1173 | $start_time = getMicroTime(); |
| 1174 | 1174 | } |
@@ -1178,51 +1178,51 @@ discard block |
||
| 1178 | 1178 | $type = strtolower($type); |
| 1179 | 1179 | |
| 1180 | 1180 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1181 | - if(!isset($kinds[$kind])) |
|
| 1181 | + if (!isset($kinds[$kind])) |
|
| 1182 | 1182 | { |
| 1183 | 1183 | $kind = 'svc'; |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1186 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1187 | 1187 | |
| 1188 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1188 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1189 | 1189 | { |
| 1190 | 1190 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | // if there is no instance of the module in global variable, create a new one |
| 1194 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1194 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1197 | 1197 | |
| 1198 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1198 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | $module = $parent_module; |
| 1201 | 1201 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | // Check if the base class and instance class exist |
| 1205 | - if(!class_exists($module, true)) |
|
| 1205 | + if (!class_exists($module, true)) |
|
| 1206 | 1206 | { |
| 1207 | 1207 | return NULL; |
| 1208 | 1208 | } |
| 1209 | - if(!class_exists($instance_name, true)) |
|
| 1209 | + if (!class_exists($instance_name, true)) |
|
| 1210 | 1210 | { |
| 1211 | 1211 | return NULL; |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | // Create an instance |
| 1215 | 1215 | $oModule = new $instance_name(); |
| 1216 | - if(!is_object($oModule)) |
|
| 1216 | + if (!is_object($oModule)) |
|
| 1217 | 1217 | { |
| 1218 | 1218 | return NULL; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | 1221 | // Load language files for the class |
| 1222 | - Context::loadLang($class_path . 'lang'); |
|
| 1223 | - if($extend_module) |
|
| 1222 | + Context::loadLang($class_path.'lang'); |
|
| 1223 | + if ($extend_module) |
|
| 1224 | 1224 | { |
| 1225 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1225 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | // Set variables to the instance |
@@ -1230,10 +1230,10 @@ discard block |
||
| 1230 | 1230 | $oModule->setModulePath($class_path); |
| 1231 | 1231 | |
| 1232 | 1232 | // If the module has a constructor, run it. |
| 1233 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1233 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1236 | - if(@method_exists($oModule, $instance_name)) |
|
| 1236 | + if (@method_exists($oModule, $instance_name)) |
|
| 1237 | 1237 | { |
| 1238 | 1238 | $oModule->{$instance_name}(); |
| 1239 | 1239 | } |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | - if(__DEBUG__ == 3) |
|
| 1246 | + if (__DEBUG__ == 3) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1249 | 1249 | } |
@@ -1259,17 +1259,17 @@ discard block |
||
| 1259 | 1259 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1260 | 1260 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1261 | 1261 | |
| 1262 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1263 | - if(!in_array($type, $types)) |
|
| 1262 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1263 | + if (!in_array($type, $types)) |
|
| 1264 | 1264 | { |
| 1265 | 1265 | $type = $types[0]; |
| 1266 | 1266 | } |
| 1267 | - if($type == 'class') |
|
| 1267 | + if ($type == 'class') |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $instanceName = '%s'; |
| 1270 | 1270 | $classFile = '%s%s.%s.php'; |
| 1271 | 1271 | } |
| 1272 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1272 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1273 | 1273 | { |
| 1274 | 1274 | $instanceName = '%sAdmin%s'; |
| 1275 | 1275 | $classFile = '%s%s.admin.%s.php'; |
@@ -1294,26 +1294,26 @@ discard block |
||
| 1294 | 1294 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1295 | 1295 | { |
| 1296 | 1296 | // skip if not installed |
| 1297 | - if(!Context::isInstalled()) |
|
| 1297 | + if (!Context::isInstalled()) |
|
| 1298 | 1298 | { |
| 1299 | 1299 | return new BaseObject(); |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | $oModuleModel = getModel('module'); |
| 1303 | 1303 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1304 | - if(!$triggers || count($triggers) < 1) |
|
| 1304 | + if (!$triggers || count($triggers) < 1) |
|
| 1305 | 1305 | { |
| 1306 | 1306 | return new BaseObject(); |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | //store before trigger call time |
| 1310 | 1310 | $before_trigger_time = NULL; |
| 1311 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1311 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | $before_trigger_time = microtime(true); |
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | - foreach($triggers as $item) |
|
| 1316 | + foreach ($triggers as $item) |
|
| 1317 | 1317 | { |
| 1318 | 1318 | $module = $item->module; |
| 1319 | 1319 | $type = $item->type; |
@@ -1321,7 +1321,7 @@ discard block |
||
| 1321 | 1321 | |
| 1322 | 1322 | // todo why don't we call a normal class object ? |
| 1323 | 1323 | $oModule = getModule($module, $type); |
| 1324 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1324 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1325 | 1325 | { |
| 1326 | 1326 | continue; |
| 1327 | 1327 | } |
@@ -1334,12 +1334,12 @@ discard block |
||
| 1334 | 1334 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1335 | 1335 | |
| 1336 | 1336 | $slowlog = new stdClass; |
| 1337 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1338 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1337 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1338 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1339 | 1339 | $slowlog->called_extension = $module; |
| 1340 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1340 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1341 | 1341 | |
| 1342 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1342 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1343 | 1343 | { |
| 1344 | 1344 | return $output; |
| 1345 | 1345 | } |
@@ -1424,9 +1424,9 @@ discard block |
||
| 1424 | 1424 | '511' => 'Network Authentication Required', |
| 1425 | 1425 | ); |
| 1426 | 1426 | $statusMessage = $statusMessageList[$code]; |
| 1427 | - if(!$statusMessage) |
|
| 1427 | + if (!$statusMessage) |
|
| 1428 | 1428 | { |
| 1429 | - $statusMessage = 'HTTP ' . $code; |
|
| 1429 | + $statusMessage = 'HTTP '.$code; |
|
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | Context::set('http_status_code', $code); |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function &getInstance($target = 'object', $info = null, $always_use_file = false) |
| 32 | 32 | { |
| 33 | - $cache_handler_key = $target . ($always_use_file ? '_file' : ''); |
|
| 34 | - if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 33 | + $cache_handler_key = $target.($always_use_file ? '_file' : ''); |
|
| 34 | + if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 35 | 35 | { |
| 36 | 36 | $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file); |
| 37 | 37 | } |
@@ -51,61 +51,61 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function __construct($target, $info = null, $always_use_file = false) |
| 53 | 53 | { |
| 54 | - if(!$info) |
|
| 54 | + if (!$info) |
|
| 55 | 55 | { |
| 56 | 56 | $info = Context::getDBInfo(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($info) |
|
| 59 | + if ($info) |
|
| 60 | 60 | { |
| 61 | - if($target == 'object') |
|
| 61 | + if ($target == 'object') |
|
| 62 | 62 | { |
| 63 | - if($info->use_object_cache == 'apc') |
|
| 63 | + if ($info->use_object_cache == 'apc') |
|
| 64 | 64 | { |
| 65 | 65 | $type = 'apc'; |
| 66 | 66 | } |
| 67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 67 | + else if (substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 68 | 68 | { |
| 69 | 69 | $type = 'memcache'; |
| 70 | 70 | $url = $info->use_object_cache; |
| 71 | 71 | } |
| 72 | - else if($info->use_object_cache == 'wincache') |
|
| 72 | + else if ($info->use_object_cache == 'wincache') |
|
| 73 | 73 | { |
| 74 | 74 | $type = 'wincache'; |
| 75 | 75 | } |
| 76 | - else if($info->use_object_cache == 'file') |
|
| 76 | + else if ($info->use_object_cache == 'file') |
|
| 77 | 77 | { |
| 78 | 78 | $type = 'file'; |
| 79 | 79 | } |
| 80 | - else if($always_use_file) |
|
| 80 | + else if ($always_use_file) |
|
| 81 | 81 | { |
| 82 | 82 | $type = 'file'; |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | - else if($target == 'template') |
|
| 85 | + else if ($target == 'template') |
|
| 86 | 86 | { |
| 87 | - if($info->use_template_cache == 'apc') |
|
| 87 | + if ($info->use_template_cache == 'apc') |
|
| 88 | 88 | { |
| 89 | 89 | $type = 'apc'; |
| 90 | 90 | } |
| 91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 91 | + else if (substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 92 | 92 | { |
| 93 | 93 | $type = 'memcache'; |
| 94 | 94 | $url = $info->use_template_cache; |
| 95 | 95 | } |
| 96 | - else if($info->use_template_cache == 'wincache') |
|
| 96 | + else if ($info->use_template_cache == 'wincache') |
|
| 97 | 97 | { |
| 98 | 98 | $type = 'wincache'; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if($type) |
|
| 102 | + if ($type) |
|
| 103 | 103 | { |
| 104 | - $class = 'Cache' . ucfirst($type); |
|
| 104 | + $class = 'Cache'.ucfirst($type); |
|
| 105 | 105 | include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); |
| 106 | 106 | $this->handler = call_user_func(array($class, 'getInstance'), $url); |
| 107 | 107 | $this->keyGroupVersions = $this->handler->get('key_group_versions', 0); |
| 108 | - if(!$this->keyGroupVersions) |
|
| 108 | + if (!$this->keyGroupVersions) |
|
| 109 | 109 | { |
| 110 | 110 | $this->keyGroupVersions = array(); |
| 111 | 111 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function isSupport() |
| 123 | 123 | { |
| 124 | - if($this->handler && $this->handler->isSupport()) |
|
| 124 | + if ($this->handler && $this->handler->isSupport()) |
|
| 125 | 125 | { |
| 126 | 126 | return true; |
| 127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $key = str_replace('/', ':', $key); |
| 141 | 141 | |
| 142 | - return __XE_VERSION__ . ':' . $key; |
|
| 142 | + return __XE_VERSION__.':'.$key; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function get($key, $modified_time = 0) |
| 154 | 154 | { |
| 155 | - if(!$this->handler) |
|
| 155 | + if (!$this->handler) |
|
| 156 | 156 | { |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function put($key, $obj, $valid_time = 0) |
| 176 | 176 | { |
| 177 | - if(!$this->handler && !$key) |
|
| 177 | + if (!$this->handler && !$key) |
|
| 178 | 178 | { |
| 179 | 179 | return false; |
| 180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | function delete($key) |
| 194 | 194 | { |
| 195 | - if(!$this->handler) |
|
| 195 | + if (!$this->handler) |
|
| 196 | 196 | { |
| 197 | 197 | return false; |
| 198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function isValid($key, $modified_time = 0) |
| 214 | 214 | { |
| 215 | - if(!$this->handler) |
|
| 215 | + if (!$this->handler) |
|
| 216 | 216 | { |
| 217 | 217 | return false; |
| 218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function truncate() |
| 231 | 231 | { |
| 232 | - if(!$this->handler) |
|
| 232 | + if (!$this->handler) |
|
| 233 | 233 | { |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function getGroupKey($keyGroupName, $key) |
| 257 | 257 | { |
| 258 | - if(!$this->keyGroupVersions[$keyGroupName]) |
|
| 258 | + if (!$this->keyGroupVersions[$keyGroupName]) |
|
| 259 | 259 | { |
| 260 | 260 | $this->keyGroupVersions[$keyGroupName] = 1; |
| 261 | 261 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key; |
|
| 264 | + return 'cache_group_'.$this->keyGroupVersions[$keyGroupName].':'.$keyGroupName.':'.$key; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | 345 | session_start(); |
| 346 | 346 | |
| 347 | 347 | // set authentication information in Context and session |
| 348 | - if(self::isInstalled()) |
|
| 348 | + if (self::isInstalled()) |
|
| 349 | 349 | { |
| 350 | 350 | $oModuleModel = getModel('module'); |
| 351 | 351 | $oModuleModel->loadModuleExtends(); |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | $oMemberModel = getModel('member'); |
| 354 | 354 | $oMemberController = getController('member'); |
| 355 | 355 | |
| 356 | - if($oMemberController && $oMemberModel) |
|
| 356 | + if ($oMemberController && $oMemberModel) |
|
| 357 | 357 | { |
| 358 | 358 | // if signed in, validate it. |
| 359 | - if($oMemberModel->isLogged()) |
|
| 359 | + if ($oMemberModel->isLogged()) |
|
| 360 | 360 | { |
| 361 | 361 | $oMemberController->setSessionInfo(); |
| 362 | 362 | } |
| 363 | 363 | // check auto sign-in |
| 364 | - elseif($_COOKIE['xeak']) |
|
| 364 | + elseif ($_COOKIE['xeak']) |
|
| 365 | 365 | { |
| 366 | 366 | $oMemberController->doAutologin(); |
| 367 | 367 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // load common language file |
| 375 | 375 | $this->lang = &$GLOBALS['lang']; |
| 376 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 376 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 377 | 377 | |
| 378 | 378 | // check if using rewrite module |
| 379 | 379 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -381,28 +381,28 @@ discard block |
||
| 381 | 381 | // set locations for javascript use |
| 382 | 382 | $url = array(); |
| 383 | 383 | $current_url = self::getRequestUri(); |
| 384 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 384 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | 385 | { |
| 386 | - if($this->get_vars) |
|
| 386 | + if ($this->get_vars) |
|
| 387 | 387 | { |
| 388 | 388 | $url = array(); |
| 389 | - foreach($this->get_vars as $key => $val) |
|
| 389 | + foreach ($this->get_vars as $key => $val) |
|
| 390 | 390 | { |
| 391 | - if(is_array($val) && count($val) > 0) |
|
| 391 | + if (is_array($val) && count($val) > 0) |
|
| 392 | 392 | { |
| 393 | - foreach($val as $k => $v) |
|
| 393 | + foreach ($val as $k => $v) |
|
| 394 | 394 | { |
| 395 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 395 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | - elseif($val) |
|
| 398 | + elseif ($val) |
|
| 399 | 399 | { |
| 400 | - $url[] = $key . '=' . urlencode($val); |
|
| 400 | + $url[] = $key.'='.urlencode($val); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 405 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 406 | 406 | } |
| 407 | 407 | else |
| 408 | 408 | { |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $this->set('current_url', $current_url); |
| 418 | 418 | $this->set('request_uri', self::getRequestUri()); |
| 419 | 419 | |
| 420 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 420 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | 421 | { |
| 422 | 422 | $this->set('current_url', self::decodeIdna($current_url)); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 425 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | 426 | { |
| 427 | 427 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 428 | 428 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | $self = self::getInstance(); |
| 449 | 449 | |
| 450 | - if(!$self->isInstalled()) |
|
| 450 | + if (!$self->isInstalled()) |
|
| 451 | 451 | { |
| 452 | 452 | return; |
| 453 | 453 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | ob_end_clean(); |
| 458 | 458 | |
| 459 | 459 | // If master_db information does not exist, the config file needs to be updated |
| 460 | - if(!isset($db_info->master_db)) |
|
| 460 | + if (!isset($db_info->master_db)) |
|
| 461 | 461 | { |
| 462 | 462 | $db_info->master_db = array(); |
| 463 | 463 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 476 | 476 | unset($db_info->db_table_prefix); |
| 477 | 477 | |
| 478 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 478 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 479 | 479 | { |
| 480 | 480 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 481 | 481 | } |
@@ -487,33 +487,33 @@ discard block |
||
| 487 | 487 | $oInstallController->makeConfigFile(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - if(!$db_info->use_prepared_statements) |
|
| 490 | + if (!$db_info->use_prepared_statements) |
|
| 491 | 491 | { |
| 492 | 492 | $db_info->use_prepared_statements = 'Y'; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if(!$db_info->time_zone) |
|
| 495 | + if (!$db_info->time_zone) |
|
| 496 | 496 | $db_info->time_zone = date('O'); |
| 497 | 497 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 498 | 498 | |
| 499 | - if($db_info->qmail_compatibility != 'Y') |
|
| 499 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 500 | 500 | $db_info->qmail_compatibility = 'N'; |
| 501 | 501 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 502 | 502 | |
| 503 | - if(!$db_info->use_db_session) |
|
| 503 | + if (!$db_info->use_db_session) |
|
| 504 | 504 | $db_info->use_db_session = 'N'; |
| 505 | - if(!$db_info->use_ssl) |
|
| 505 | + if (!$db_info->use_ssl) |
|
| 506 | 506 | $db_info->use_ssl = 'none'; |
| 507 | 507 | $this->set('_use_ssl', $db_info->use_ssl); |
| 508 | 508 | |
| 509 | 509 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 510 | 510 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 511 | 511 | |
| 512 | - if(!$db_info->sitelock_whitelist) { |
|
| 512 | + if (!$db_info->sitelock_whitelist) { |
|
| 513 | 513 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 516 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 517 | 517 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 518 | 518 | } |
| 519 | 519 | |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | function loadLangSupported() |
| 585 | 585 | { |
| 586 | 586 | static $lang_supported = null; |
| 587 | - if(!$lang_supported) |
|
| 587 | + if (!$lang_supported) |
|
| 588 | 588 | { |
| 589 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 590 | - foreach($langs as $val) |
|
| 589 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 590 | + foreach ($langs as $val) |
|
| 591 | 591 | { |
| 592 | 592 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 593 | 593 | $lang_text = trim($lang_text); |
@@ -605,17 +605,17 @@ discard block |
||
| 605 | 605 | function loadLangSelected() |
| 606 | 606 | { |
| 607 | 607 | static $lang_selected = null; |
| 608 | - if(!$lang_selected) |
|
| 608 | + if (!$lang_selected) |
|
| 609 | 609 | { |
| 610 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 611 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 612 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 610 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 611 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 612 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 613 | 613 | { |
| 614 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 614 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 615 | 615 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 618 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 619 | 619 | { |
| 620 | 620 | $buff = FileHandler::readFile($orig_lang_file); |
| 621 | 621 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | else |
| 625 | 625 | { |
| 626 | 626 | $langs = file($selected_lang_file); |
| 627 | - foreach($langs as $val) |
|
| 627 | + foreach ($langs as $val) |
|
| 628 | 628 | { |
| 629 | 629 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 630 | 630 | $lang_text = trim($lang_text); |
@@ -643,56 +643,56 @@ discard block |
||
| 643 | 643 | function checkSSO() |
| 644 | 644 | { |
| 645 | 645 | // pass if it's not GET request or XE is not yet installed |
| 646 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 646 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 647 | 647 | { |
| 648 | 648 | return TRUE; |
| 649 | 649 | } |
| 650 | 650 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 651 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 651 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 652 | 652 | { |
| 653 | 653 | return TRUE; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // pass if default URL is not set |
| 657 | 657 | $default_url = trim($this->db_info->default_url); |
| 658 | - if(!$default_url) |
|
| 658 | + if (!$default_url) |
|
| 659 | 659 | { |
| 660 | 660 | return TRUE; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 663 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 664 | 664 | { |
| 665 | 665 | $default_url .= '/'; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | // for sites recieving SSO valdiation |
| 669 | - if($default_url == self::getRequestUri()) |
|
| 669 | + if ($default_url == self::getRequestUri()) |
|
| 670 | 670 | { |
| 671 | - if(self::get('url')) |
|
| 671 | + if (self::get('url')) |
|
| 672 | 672 | { |
| 673 | 673 | $url = base64_decode(self::get('url')); |
| 674 | 674 | $url_info = parse_url($url); |
| 675 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 675 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 676 | 676 | { |
| 677 | 677 | echo self::get('lang')->msg_invalid_request; |
| 678 | 678 | return false; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $oModuleModel = getModel('module'); |
| 682 | - $domain = $url_info['host'] . $url_info['path']; |
|
| 683 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 682 | + $domain = $url_info['host'].$url_info['path']; |
|
| 683 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 684 | 684 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 685 | 685 | |
| 686 | - if($site_info->site_srl) |
|
| 686 | + if ($site_info->site_srl) |
|
| 687 | 687 | { |
| 688 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 689 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 688 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 689 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 690 | 690 | } |
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | 693 | $redirect_url = $url; |
| 694 | 694 | } |
| 695 | - header('location:' . $redirect_url); |
|
| 695 | + header('location:'.$redirect_url); |
|
| 696 | 696 | |
| 697 | 697 | return FALSE; |
| 698 | 698 | } |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | else |
| 702 | 702 | { |
| 703 | 703 | // result handling : set session_name() |
| 704 | - if($session_name = self::get('SSOID')) |
|
| 704 | + if ($session_name = self::get('SSOID')) |
|
| 705 | 705 | { |
| 706 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 706 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 707 | 707 | { |
| 708 | 708 | echo self::get('lang')->msg_invalid_request; |
| 709 | 709 | return false; |
@@ -712,17 +712,17 @@ discard block |
||
| 712 | 712 | setcookie(session_name(), $session_name); |
| 713 | 713 | |
| 714 | 714 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 715 | - header('location:' . $url); |
|
| 715 | + header('location:'.$url); |
|
| 716 | 716 | return FALSE; |
| 717 | 717 | // send SSO request |
| 718 | 718 | } |
| 719 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 719 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 720 | 720 | { |
| 721 | 721 | setcookie('sso', md5(self::getRequestUri())); |
| 722 | 722 | $origin_url = self::getRequestUrl(); |
| 723 | 723 | $origin_sig = Password::createSignature($origin_url); |
| 724 | 724 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 725 | - header('location:' . $url); |
|
| 725 | + header('location:'.$url); |
|
| 726 | 726 | return FALSE; |
| 727 | 727 | } |
| 728 | 728 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | { |
| 750 | 750 | $self = self::getInstance(); |
| 751 | 751 | |
| 752 | - if(!$self->isFTPRegisted()) |
|
| 752 | + if (!$self->isFTPRegisted()) |
|
| 753 | 753 | { |
| 754 | 754 | return null; |
| 755 | 755 | } |
@@ -767,15 +767,15 @@ discard block |
||
| 767 | 767 | */ |
| 768 | 768 | function addBrowserTitle($site_title) |
| 769 | 769 | { |
| 770 | - if(!$site_title) |
|
| 770 | + if (!$site_title) |
|
| 771 | 771 | { |
| 772 | 772 | return; |
| 773 | 773 | } |
| 774 | 774 | $self = self::getInstance(); |
| 775 | 775 | |
| 776 | - if($self->site_title) |
|
| 776 | + if ($self->site_title) |
|
| 777 | 777 | { |
| 778 | - $self->site_title .= ' - ' . $site_title; |
|
| 778 | + $self->site_title .= ' - '.$site_title; |
|
| 779 | 779 | } |
| 780 | 780 | else |
| 781 | 781 | { |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | function setBrowserTitle($site_title) |
| 793 | 793 | { |
| 794 | - if(!$site_title) |
|
| 794 | + if (!$site_title) |
|
| 795 | 795 | { |
| 796 | 796 | return; |
| 797 | 797 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $oModuleModel = getModel('module'); |
| 824 | 824 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 825 | 825 | |
| 826 | - if(isset($moduleConfig->siteTitle)) |
|
| 826 | + if (isset($moduleConfig->siteTitle)) |
|
| 827 | 827 | { |
| 828 | 828 | return $moduleConfig->siteTitle; |
| 829 | 829 | } |
@@ -850,30 +850,30 @@ discard block |
||
| 850 | 850 | global $lang; |
| 851 | 851 | |
| 852 | 852 | $self = self::getInstance(); |
| 853 | - if(!$self->lang_type) |
|
| 853 | + if (!$self->lang_type) |
|
| 854 | 854 | { |
| 855 | 855 | return; |
| 856 | 856 | } |
| 857 | - if(!is_object($lang)) |
|
| 857 | + if (!is_object($lang)) |
|
| 858 | 858 | { |
| 859 | 859 | $lang = new stdClass; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 862 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 863 | 863 | { |
| 864 | 864 | $filename = $self->_loadPhpLang($path); |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - if(!is_array($self->loaded_lang_files)) |
|
| 867 | + if (!is_array($self->loaded_lang_files)) |
|
| 868 | 868 | { |
| 869 | 869 | $self->loaded_lang_files = array(); |
| 870 | 870 | } |
| 871 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 871 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 872 | 872 | { |
| 873 | 873 | return; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - if($filename && is_readable($filename)) |
|
| 876 | + if ($filename && is_readable($filename)) |
|
| 877 | 877 | { |
| 878 | 878 | $self->loaded_lang_files[] = $filename; |
| 879 | 879 | include($filename); |
@@ -894,24 +894,24 @@ discard block |
||
| 894 | 894 | { |
| 895 | 895 | global $lang; |
| 896 | 896 | |
| 897 | - if(!$path) return; |
|
| 897 | + if (!$path) return; |
|
| 898 | 898 | |
| 899 | - $_path = 'eval://' . $path; |
|
| 899 | + $_path = 'eval://'.$path; |
|
| 900 | 900 | |
| 901 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 901 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 902 | 902 | { |
| 903 | 903 | return; |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 906 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 907 | 907 | { |
| 908 | 908 | $path .= '/'; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 911 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 912 | 912 | $content = $oXmlLangParser->getCompileContent(); |
| 913 | 913 | |
| 914 | - if($content) |
|
| 914 | + if ($content) |
|
| 915 | 915 | { |
| 916 | 916 | $this->loaded_lang_files[] = $_path; |
| 917 | 917 | eval($content); |
@@ -926,9 +926,9 @@ discard block |
||
| 926 | 926 | */ |
| 927 | 927 | function _loadXmlLang($path) |
| 928 | 928 | { |
| 929 | - if(!$path) return; |
|
| 929 | + if (!$path) return; |
|
| 930 | 930 | |
| 931 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 931 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 932 | 932 | return $oXmlLangParser->compile(); |
| 933 | 933 | } |
| 934 | 934 | |
@@ -940,22 +940,22 @@ discard block |
||
| 940 | 940 | */ |
| 941 | 941 | function _loadPhpLang($path) |
| 942 | 942 | { |
| 943 | - if(!$path) return; |
|
| 943 | + if (!$path) return; |
|
| 944 | 944 | |
| 945 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 945 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 946 | 946 | { |
| 947 | 947 | $path .= '/'; |
| 948 | 948 | } |
| 949 | - $path_tpl = $path . '%s.lang.php'; |
|
| 949 | + $path_tpl = $path.'%s.lang.php'; |
|
| 950 | 950 | $file = sprintf($path_tpl, $this->lang_type); |
| 951 | 951 | |
| 952 | 952 | $langs = array('ko', 'en'); // this will be configurable. |
| 953 | - while(!is_readable($file) && $langs[0]) |
|
| 953 | + while (!is_readable($file) && $langs[0]) |
|
| 954 | 954 | { |
| 955 | 955 | $file = sprintf($path_tpl, array_shift($langs)); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | - if(!is_readable($file)) |
|
| 958 | + if (!is_readable($file)) |
|
| 959 | 959 | { |
| 960 | 960 | return FALSE; |
| 961 | 961 | } |
@@ -997,11 +997,11 @@ discard block |
||
| 997 | 997 | */ |
| 998 | 998 | function getLang($code) |
| 999 | 999 | { |
| 1000 | - if(!$code) |
|
| 1000 | + if (!$code) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | return; |
| 1003 | 1003 | } |
| 1004 | - if($GLOBALS['lang']->{$code}) |
|
| 1004 | + if ($GLOBALS['lang']->{$code}) |
|
| 1005 | 1005 | { |
| 1006 | 1006 | return $GLOBALS['lang']->{$code}; |
| 1007 | 1007 | } |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | */ |
| 1018 | 1018 | function setLang($code, $val) |
| 1019 | 1019 | { |
| 1020 | - if(!isset($GLOBALS['lang'])) |
|
| 1020 | + if (!isset($GLOBALS['lang'])) |
|
| 1021 | 1021 | { |
| 1022 | 1022 | $GLOBALS['lang'] = new stdClass(); |
| 1023 | 1023 | } |
@@ -1042,17 +1042,17 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | $obj = clone $source_obj; |
| 1044 | 1044 | |
| 1045 | - foreach($charset_list as $charset) |
|
| 1045 | + foreach ($charset_list as $charset) |
|
| 1046 | 1046 | { |
| 1047 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1047 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1048 | 1048 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1049 | - if($flag) |
|
| 1049 | + if ($flag) |
|
| 1050 | 1050 | { |
| 1051 | - if($charset == 'UTF-8') |
|
| 1051 | + if ($charset == 'UTF-8') |
|
| 1052 | 1052 | { |
| 1053 | 1053 | return $obj; |
| 1054 | 1054 | } |
| 1055 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1055 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1056 | 1056 | return $obj; |
| 1057 | 1057 | } |
| 1058 | 1058 | } |
@@ -1071,11 +1071,11 @@ discard block |
||
| 1071 | 1071 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1072 | 1072 | { |
| 1073 | 1073 | static $flag = TRUE; |
| 1074 | - if($charset) |
|
| 1074 | + if ($charset) |
|
| 1075 | 1075 | { |
| 1076 | - if(is_array($val)) |
|
| 1077 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1078 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1076 | + if (is_array($val)) |
|
| 1077 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1078 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1079 | 1079 | else $flag = FALSE; |
| 1080 | 1080 | } |
| 1081 | 1081 | else |
@@ -1099,9 +1099,9 @@ discard block |
||
| 1099 | 1099 | { |
| 1100 | 1100 | if (is_array($val)) |
| 1101 | 1101 | { |
| 1102 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1102 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1103 | 1103 | } |
| 1104 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1104 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | /** |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | */ |
| 1113 | 1113 | function convertEncodingStr($str) |
| 1114 | 1114 | { |
| 1115 | - if(!$str) return null; |
|
| 1115 | + if (!$str) return null; |
|
| 1116 | 1116 | $obj = new stdClass(); |
| 1117 | 1117 | $obj->str = $str; |
| 1118 | 1118 | $obj = self::convertEncoding($obj); |
@@ -1121,9 +1121,9 @@ discard block |
||
| 1121 | 1121 | |
| 1122 | 1122 | function decodeIdna($domain) |
| 1123 | 1123 | { |
| 1124 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1124 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1125 | 1125 | { |
| 1126 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1126 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1127 | 1127 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1128 | 1128 | $domain = $IDN->decode($domain); |
| 1129 | 1129 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | { |
| 1155 | 1155 | $self = self::getInstance(); |
| 1156 | 1156 | |
| 1157 | - if($self->response_method) |
|
| 1157 | + if ($self->response_method) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | return $self->response_method; |
| 1160 | 1160 | } |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1195 | 1195 | |
| 1196 | 1196 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1197 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1197 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1198 | 1198 | { |
| 1199 | 1199 | $this->isSuccessInit = FALSE; |
| 1200 | 1200 | } |
@@ -1207,30 +1207,30 @@ discard block |
||
| 1207 | 1207 | */ |
| 1208 | 1208 | function _setRequestArgument() |
| 1209 | 1209 | { |
| 1210 | - if(!count($_REQUEST)) |
|
| 1210 | + if (!count($_REQUEST)) |
|
| 1211 | 1211 | { |
| 1212 | 1212 | return; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | $requestMethod = $this->getRequestMethod(); |
| 1216 | - foreach($_REQUEST as $key => $val) |
|
| 1216 | + foreach ($_REQUEST as $key => $val) |
|
| 1217 | 1217 | { |
| 1218 | - if($val === '' || self::get($key)) |
|
| 1218 | + if ($val === '' || self::get($key)) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | continue; |
| 1221 | 1221 | } |
| 1222 | 1222 | $key = htmlentities($key); |
| 1223 | 1223 | $val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET')); |
| 1224 | 1224 | |
| 1225 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1225 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1226 | 1226 | { |
| 1227 | 1227 | $set_to_vars = TRUE; |
| 1228 | 1228 | } |
| 1229 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1229 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | $set_to_vars = TRUE; |
| 1232 | 1232 | } |
| 1233 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1233 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $set_to_vars = TRUE; |
| 1236 | 1236 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | $set_to_vars = FALSE; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | - if($set_to_vars) |
|
| 1242 | + if ($set_to_vars) |
|
| 1243 | 1243 | { |
| 1244 | 1244 | $this->_recursiveCheckVar($val); |
| 1245 | 1245 | } |
@@ -1250,20 +1250,20 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | function _recursiveCheckVar($val) |
| 1252 | 1252 | { |
| 1253 | - if(is_string($val)) |
|
| 1253 | + if (is_string($val)) |
|
| 1254 | 1254 | { |
| 1255 | - foreach($this->patterns as $pattern) |
|
| 1255 | + foreach ($this->patterns as $pattern) |
|
| 1256 | 1256 | { |
| 1257 | - if(preg_match($pattern, $val)) |
|
| 1257 | + if (preg_match($pattern, $val)) |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $this->isSuccessInit = FALSE; |
| 1260 | 1260 | return; |
| 1261 | 1261 | } |
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | - else if(is_array($val)) |
|
| 1264 | + else if (is_array($val)) |
|
| 1265 | 1265 | { |
| 1266 | - foreach($val as $val2) |
|
| 1266 | + foreach ($val as $val2) |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $this->_recursiveCheckVar($val2); |
| 1269 | 1269 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | */ |
| 1278 | 1278 | function _setJSONRequestArgument() |
| 1279 | 1279 | { |
| 1280 | - if($this->getRequestMethod() != 'JSON') |
|
| 1280 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1281 | 1281 | { |
| 1282 | 1282 | return; |
| 1283 | 1283 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | $params = array(); |
| 1286 | 1286 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1287 | 1287 | |
| 1288 | - foreach($params as $key => $val) |
|
| 1288 | + foreach ($params as $key => $val) |
|
| 1289 | 1289 | { |
| 1290 | 1290 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1291 | 1291 | } |
@@ -1298,13 +1298,13 @@ discard block |
||
| 1298 | 1298 | */ |
| 1299 | 1299 | function _setXmlRpcArgument() |
| 1300 | 1300 | { |
| 1301 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1301 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1302 | 1302 | { |
| 1303 | 1303 | return; |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1307 | - if(Security::detectingXEE($xml)) |
|
| 1307 | + if (Security::detectingXEE($xml)) |
|
| 1308 | 1308 | { |
| 1309 | 1309 | header("HTTP/1.0 400 Bad Request"); |
| 1310 | 1310 | exit; |
@@ -1316,12 +1316,12 @@ discard block |
||
| 1316 | 1316 | $params = $xml_obj->methodcall->params; |
| 1317 | 1317 | unset($params->node_name, $params->attrs, $params->body); |
| 1318 | 1318 | |
| 1319 | - if(!count(get_object_vars($params))) |
|
| 1319 | + if (!count(get_object_vars($params))) |
|
| 1320 | 1320 | { |
| 1321 | 1321 | return; |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | - foreach($params as $key => $val) |
|
| 1324 | + foreach ($params as $key => $val) |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1327 | 1327 | } |
@@ -1336,10 +1336,10 @@ discard block |
||
| 1336 | 1336 | */ |
| 1337 | 1337 | function _filterXmlVars($key, $val) |
| 1338 | 1338 | { |
| 1339 | - if(is_array($val)) |
|
| 1339 | + if (is_array($val)) |
|
| 1340 | 1340 | { |
| 1341 | 1341 | $stack = array(); |
| 1342 | - foreach($val as $k => $v) |
|
| 1342 | + foreach ($val as $k => $v) |
|
| 1343 | 1343 | { |
| 1344 | 1344 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1345 | 1345 | } |
@@ -1349,20 +1349,20 @@ discard block |
||
| 1349 | 1349 | |
| 1350 | 1350 | $body = $val->body; |
| 1351 | 1351 | unset($val->node_name, $val->attrs, $val->body); |
| 1352 | - if(!count(get_object_vars($val))) |
|
| 1352 | + if (!count(get_object_vars($val))) |
|
| 1353 | 1353 | { |
| 1354 | 1354 | return $this->_filterRequestVar($key, $body, 0); |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | $stack = new stdClass(); |
| 1358 | - foreach($val as $k => $v) |
|
| 1358 | + foreach ($val as $k => $v) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | $output = $this->_filterXmlVars($k, $v); |
| 1361 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1361 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1362 | 1362 | { |
| 1363 | 1363 | $output = array($output); |
| 1364 | 1364 | } |
| 1365 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1365 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1366 | 1366 | { |
| 1367 | 1367 | return $output; |
| 1368 | 1368 | } |
@@ -1370,7 +1370,7 @@ discard block |
||
| 1370 | 1370 | $stack->{$k} = $output; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - if(!count(get_object_vars($stack))) |
|
| 1373 | + if (!count(get_object_vars($stack))) |
|
| 1374 | 1374 | { |
| 1375 | 1375 | return NULL; |
| 1376 | 1376 | } |
@@ -1389,16 +1389,16 @@ discard block |
||
| 1389 | 1389 | */ |
| 1390 | 1390 | function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false) |
| 1391 | 1391 | { |
| 1392 | - if(!($isArray = is_array($val))) |
|
| 1392 | + if (!($isArray = is_array($val))) |
|
| 1393 | 1393 | { |
| 1394 | 1394 | $val = array($val); |
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | $result = array(); |
| 1398 | - foreach($val as $k => $v) |
|
| 1398 | + foreach ($val as $k => $v) |
|
| 1399 | 1399 | { |
| 1400 | - if($remove_hack && !is_array($v)) { |
|
| 1401 | - if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1400 | + if ($remove_hack && !is_array($v)) { |
|
| 1401 | + if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1402 | 1402 | { |
| 1403 | 1403 | $result[$k] = escape($v); |
| 1404 | 1404 | continue; |
@@ -1406,18 +1406,18 @@ discard block |
||
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | $k = htmlentities($k); |
| 1409 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1409 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1410 | 1410 | { |
| 1411 | 1411 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1412 | 1412 | } |
| 1413 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1413 | + elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) { |
|
| 1414 | 1414 | $result[$k] = escape($v, false); |
| 1415 | 1415 | } |
| 1416 | - elseif($key === 'vid') |
|
| 1416 | + elseif ($key === 'vid') |
|
| 1417 | 1417 | { |
| 1418 | 1418 | $result[$k] = urlencode($v); |
| 1419 | 1419 | } |
| 1420 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1420 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | unset($result[$k]); |
| 1423 | 1423 | } |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | { |
| 1426 | 1426 | $result[$k] = $v; |
| 1427 | 1427 | |
| 1428 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1428 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1429 | 1429 | { |
| 1430 | 1430 | if (is_array($result[$k])) |
| 1431 | 1431 | { |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | } |
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | - if(is_array($result[$k])) |
|
| 1440 | + if (is_array($result[$k])) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1443 | 1443 | } |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | $result[$k] = trim($result[$k]); |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - if($remove_hack) |
|
| 1449 | + if ($remove_hack) |
|
| 1450 | 1450 | { |
| 1451 | 1451 | $result[$k] = escape($result[$k], false); |
| 1452 | 1452 | } |
@@ -1474,17 +1474,17 @@ discard block |
||
| 1474 | 1474 | */ |
| 1475 | 1475 | function _setUploadedArgument() |
| 1476 | 1476 | { |
| 1477 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1477 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1478 | 1478 | { |
| 1479 | 1479 | return; |
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | - foreach($_FILES as $key => $val) |
|
| 1482 | + foreach ($_FILES as $key => $val) |
|
| 1483 | 1483 | { |
| 1484 | 1484 | $tmp_name = $val['tmp_name']; |
| 1485 | - if(!is_array($tmp_name)) |
|
| 1485 | + if (!is_array($tmp_name)) |
|
| 1486 | 1486 | { |
| 1487 | - if(!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1487 | + if (!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1488 | 1488 | { |
| 1489 | 1489 | continue; |
| 1490 | 1490 | } |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | $files = array(); |
| 1498 | 1498 | foreach ($tmp_name as $i => $j) |
| 1499 | 1499 | { |
| 1500 | - if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1500 | + if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1501 | 1501 | { |
| 1502 | 1502 | $files = array(); |
| 1503 | 1503 | unset($_FILES[$key]); |
@@ -1511,7 +1511,7 @@ discard block |
||
| 1511 | 1511 | $file['size'] = $val['size'][$i]; |
| 1512 | 1512 | $files[] = $file; |
| 1513 | 1513 | } |
| 1514 | - if(count($files)) |
|
| 1514 | + if (count($files)) |
|
| 1515 | 1515 | { |
| 1516 | 1516 | self::set($key, $files, true); |
| 1517 | 1517 | } |
@@ -1536,16 +1536,16 @@ discard block |
||
| 1536 | 1536 | function getRequestUrl() |
| 1537 | 1537 | { |
| 1538 | 1538 | static $url = null; |
| 1539 | - if(is_null($url)) |
|
| 1539 | + if (is_null($url)) |
|
| 1540 | 1540 | { |
| 1541 | 1541 | $url = self::getRequestUri(); |
| 1542 | - if(count($_GET) > 0) |
|
| 1542 | + if (count($_GET) > 0) |
|
| 1543 | 1543 | { |
| 1544 | - foreach($_GET as $key => $val) |
|
| 1544 | + foreach ($_GET as $key => $val) |
|
| 1545 | 1545 | { |
| 1546 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1546 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1547 | 1547 | } |
| 1548 | - $url .= '?' . join('&', $vars); |
|
| 1548 | + $url .= '?'.join('&', $vars); |
|
| 1549 | 1549 | } |
| 1550 | 1550 | } |
| 1551 | 1551 | return $url; |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | $self = self::getInstance(); |
| 1561 | 1561 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1562 | 1562 | |
| 1563 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1563 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1564 | 1564 | { |
| 1565 | 1565 | unset($js_callback_func); |
| 1566 | 1566 | unset($_GET['xe_js_callback']); |
@@ -1588,22 +1588,22 @@ discard block |
||
| 1588 | 1588 | $self = self::getInstance(); |
| 1589 | 1589 | |
| 1590 | 1590 | // retrieve virtual site information |
| 1591 | - if(is_null($site_module_info)) |
|
| 1591 | + if (is_null($site_module_info)) |
|
| 1592 | 1592 | { |
| 1593 | 1593 | $site_module_info = self::get('site_module_info'); |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1597 | - if($domain && isSiteID($domain)) |
|
| 1597 | + if ($domain && isSiteID($domain)) |
|
| 1598 | 1598 | { |
| 1599 | 1599 | $vid = $domain; |
| 1600 | 1600 | $domain = ''; |
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | // If $domain, $vid are not set, use current site information |
| 1604 | - if(!$domain && !$vid) |
|
| 1604 | + if (!$domain && !$vid) |
|
| 1605 | 1605 | { |
| 1606 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1606 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1607 | 1607 | { |
| 1608 | 1608 | $vid = $site_module_info->domain; |
| 1609 | 1609 | } |
@@ -1614,21 +1614,21 @@ discard block |
||
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1617 | - if($domain) |
|
| 1617 | + if ($domain) |
|
| 1618 | 1618 | { |
| 1619 | 1619 | $domain_info = parse_url($domain); |
| 1620 | - if(is_null($current_info)) |
|
| 1620 | + if (is_null($current_info)) |
|
| 1621 | 1621 | { |
| 1622 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1622 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1623 | 1623 | } |
| 1624 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1624 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1625 | 1625 | { |
| 1626 | 1626 | unset($domain); |
| 1627 | 1627 | } |
| 1628 | 1628 | else |
| 1629 | 1629 | { |
| 1630 | 1630 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1631 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1631 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $domain .= '/'; |
| 1634 | 1634 | } |
@@ -1638,41 +1638,41 @@ discard block |
||
| 1638 | 1638 | $get_vars = array(); |
| 1639 | 1639 | |
| 1640 | 1640 | // If there is no GET variables or first argument is '' to reset variables |
| 1641 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1641 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1642 | 1642 | { |
| 1643 | 1643 | // rearrange args_list |
| 1644 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1644 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1645 | 1645 | { |
| 1646 | 1646 | array_shift($args_list); |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| 1649 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1649 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1650 | 1650 | { |
| 1651 | 1651 | // Otherwise, make GET variables into array |
| 1652 | 1652 | $get_vars = get_object_vars($self->get_vars); |
| 1653 | 1653 | } |
| 1654 | 1654 | else |
| 1655 | 1655 | { |
| 1656 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1662 | - if($get_vars['act'] == 'IS') |
|
| 1656 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1662 | + if ($get_vars['act'] == 'IS') |
|
| 1663 | 1663 | { |
| 1664 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1664 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1665 | 1665 | } |
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | // arrange args_list |
| 1669 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1669 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1670 | 1670 | { |
| 1671 | 1671 | $key = $args_list[$i]; |
| 1672 | 1672 | $val = trim($args_list[$i + 1]); |
| 1673 | 1673 | |
| 1674 | 1674 | // If value is not set, remove the key |
| 1675 | - if(!isset($val) || !strlen($val)) |
|
| 1675 | + if (!isset($val) || !strlen($val)) |
|
| 1676 | 1676 | { |
| 1677 | 1677 | unset($get_vars[$key]); |
| 1678 | 1678 | continue; |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | |
| 1684 | 1684 | // remove vid, rnd |
| 1685 | 1685 | unset($get_vars['rnd']); |
| 1686 | - if($vid) |
|
| 1686 | + if ($vid) |
|
| 1687 | 1687 | { |
| 1688 | 1688 | $get_vars['vid'] = $vid; |
| 1689 | 1689 | } |
@@ -1700,17 +1700,17 @@ discard block |
||
| 1700 | 1700 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1701 | 1701 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1702 | 1702 | ); |
| 1703 | - if($act_alias[$act]) |
|
| 1703 | + if ($act_alias[$act]) |
|
| 1704 | 1704 | { |
| 1705 | 1705 | $get_vars['act'] = $act_alias[$act]; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | 1708 | // organize URL |
| 1709 | 1709 | $query = ''; |
| 1710 | - if(count($get_vars) > 0) |
|
| 1710 | + if (count($get_vars) > 0) |
|
| 1711 | 1711 | { |
| 1712 | 1712 | // if using rewrite mod |
| 1713 | - if($self->allow_rewrite) |
|
| 1713 | + if ($self->allow_rewrite) |
|
| 1714 | 1714 | { |
| 1715 | 1715 | $var_keys = array_keys($get_vars); |
| 1716 | 1716 | sort($var_keys); |
@@ -1730,8 +1730,8 @@ discard block |
||
| 1730 | 1730 | 'vid' => $vid, |
| 1731 | 1731 | 'mid' => $mid, |
| 1732 | 1732 | 'mid.vid' => "$vid/$mid", |
| 1733 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1734 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1733 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1734 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1735 | 1735 | 'document_srl' => $srl, |
| 1736 | 1736 | 'document_srl.mid' => "$mid/$srl", |
| 1737 | 1737 | 'document_srl.vid' => "$vid/$srl", |
@@ -1748,66 +1748,66 @@ discard block |
||
| 1748 | 1748 | $query = $target_map[$target]; |
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | - if(!$query) |
|
| 1751 | + if (!$query) |
|
| 1752 | 1752 | { |
| 1753 | 1753 | $queries = array(); |
| 1754 | - foreach($get_vars as $key => $val) |
|
| 1754 | + foreach ($get_vars as $key => $val) |
|
| 1755 | 1755 | { |
| 1756 | - if(is_array($val) && count($val) > 0) |
|
| 1756 | + if (is_array($val) && count($val) > 0) |
|
| 1757 | 1757 | { |
| 1758 | - foreach($val as $k => $v) |
|
| 1758 | + foreach ($val as $k => $v) |
|
| 1759 | 1759 | { |
| 1760 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1760 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1761 | 1761 | } |
| 1762 | 1762 | } |
| 1763 | - elseif(!is_array($val)) |
|
| 1763 | + elseif (!is_array($val)) |
|
| 1764 | 1764 | { |
| 1765 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1765 | + $queries[] = $key.'='.urlencode($val); |
|
| 1766 | 1766 | } |
| 1767 | 1767 | } |
| 1768 | - if(count($queries) > 0) |
|
| 1768 | + if (count($queries) > 0) |
|
| 1769 | 1769 | { |
| 1770 | - $query = 'index.php?' . join('&', $queries); |
|
| 1770 | + $query = 'index.php?'.join('&', $queries); |
|
| 1771 | 1771 | } |
| 1772 | 1772 | } |
| 1773 | 1773 | } |
| 1774 | 1774 | |
| 1775 | 1775 | // If using SSL always |
| 1776 | 1776 | $_use_ssl = $self->get('_use_ssl'); |
| 1777 | - if($_use_ssl == 'always') |
|
| 1777 | + if ($_use_ssl == 'always') |
|
| 1778 | 1778 | { |
| 1779 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1779 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1780 | 1780 | // optional SSL use |
| 1781 | 1781 | } |
| 1782 | - elseif($_use_ssl == 'optional') |
|
| 1782 | + elseif ($_use_ssl == 'optional') |
|
| 1783 | 1783 | { |
| 1784 | 1784 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1785 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1785 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1786 | 1786 | // no SSL |
| 1787 | 1787 | } |
| 1788 | 1788 | else |
| 1789 | 1789 | { |
| 1790 | 1790 | // currently on SSL but target is not based on SSL |
| 1791 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1791 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1792 | 1792 | { |
| 1793 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1793 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1794 | 1794 | } |
| 1795 | - else if($domain) // if $domain is set |
|
| 1795 | + else if ($domain) // if $domain is set |
|
| 1796 | 1796 | { |
| 1797 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1797 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1798 | 1798 | } |
| 1799 | 1799 | else |
| 1800 | 1800 | { |
| 1801 | - $query = getScriptPath() . $query; |
|
| 1801 | + $query = getScriptPath().$query; |
|
| 1802 | 1802 | } |
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | - if(!$encode) |
|
| 1805 | + if (!$encode) |
|
| 1806 | 1806 | { |
| 1807 | 1807 | return $query; |
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | - if(!$autoEncode) |
|
| 1810 | + if (!$autoEncode) |
|
| 1811 | 1811 | { |
| 1812 | 1812 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1813 | 1813 | } |
@@ -1816,16 +1816,16 @@ discard block |
||
| 1816 | 1816 | $encode_queries = array(); |
| 1817 | 1817 | $parsedUrl = parse_url($query); |
| 1818 | 1818 | parse_str($parsedUrl['query'], $output); |
| 1819 | - foreach($output as $key => $value) |
|
| 1819 | + foreach ($output as $key => $value) |
|
| 1820 | 1820 | { |
| 1821 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1821 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1822 | 1822 | { |
| 1823 | 1823 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1824 | 1824 | } |
| 1825 | - $encode_queries[] = $key . '=' . $value; |
|
| 1825 | + $encode_queries[] = $key.'='.$value; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | |
| 1828 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1828 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | 1831 | /** |
@@ -1840,17 +1840,17 @@ discard block |
||
| 1840 | 1840 | static $url = array(); |
| 1841 | 1841 | |
| 1842 | 1842 | // Check HTTP Request |
| 1843 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1843 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1844 | 1844 | { |
| 1845 | 1845 | return; |
| 1846 | 1846 | } |
| 1847 | 1847 | |
| 1848 | - if(self::get('_use_ssl') == 'always') |
|
| 1848 | + if (self::get('_use_ssl') == 'always') |
|
| 1849 | 1849 | { |
| 1850 | 1850 | $ssl_mode = ENFORCE_SSL; |
| 1851 | 1851 | } |
| 1852 | 1852 | |
| 1853 | - if($domain) |
|
| 1853 | + if ($domain) |
|
| 1854 | 1854 | { |
| 1855 | 1855 | $domain_key = md5($domain); |
| 1856 | 1856 | } |
@@ -1859,14 +1859,14 @@ discard block |
||
| 1859 | 1859 | $domain_key = 'default'; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1862 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1863 | 1863 | { |
| 1864 | 1864 | return $url[$ssl_mode][$domain_key]; |
| 1865 | 1865 | } |
| 1866 | 1866 | |
| 1867 | 1867 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1868 | 1868 | |
| 1869 | - switch($ssl_mode) |
|
| 1869 | + switch ($ssl_mode) |
|
| 1870 | 1870 | { |
| 1871 | 1871 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1872 | 1872 | break; |
@@ -1876,34 +1876,34 @@ discard block |
||
| 1876 | 1876 | break; |
| 1877 | 1877 | } |
| 1878 | 1878 | |
| 1879 | - if($domain) |
|
| 1879 | + if ($domain) |
|
| 1880 | 1880 | { |
| 1881 | 1881 | $target_url = trim($domain); |
| 1882 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1882 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1883 | 1883 | { |
| 1884 | - $target_url.= '/'; |
|
| 1884 | + $target_url .= '/'; |
|
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| 1887 | 1887 | else |
| 1888 | 1888 | { |
| 1889 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1889 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1890 | 1890 | } |
| 1891 | 1891 | |
| 1892 | - $url_info = parse_url('http://' . $target_url); |
|
| 1892 | + $url_info = parse_url('http://'.$target_url); |
|
| 1893 | 1893 | |
| 1894 | - if($current_use_ssl != $use_ssl) |
|
| 1894 | + if ($current_use_ssl != $use_ssl) |
|
| 1895 | 1895 | { |
| 1896 | 1896 | unset($url_info['port']); |
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | - if($use_ssl) |
|
| 1899 | + if ($use_ssl) |
|
| 1900 | 1900 | { |
| 1901 | 1901 | $port = self::get('_https_port'); |
| 1902 | - if($port && $port != 443) |
|
| 1902 | + if ($port && $port != 443) |
|
| 1903 | 1903 | { |
| 1904 | 1904 | $url_info['port'] = $port; |
| 1905 | 1905 | } |
| 1906 | - elseif($url_info['port'] == 443) |
|
| 1906 | + elseif ($url_info['port'] == 443) |
|
| 1907 | 1907 | { |
| 1908 | 1908 | unset($url_info['port']); |
| 1909 | 1909 | } |
@@ -1911,17 +1911,17 @@ discard block |
||
| 1911 | 1911 | else |
| 1912 | 1912 | { |
| 1913 | 1913 | $port = self::get('_http_port'); |
| 1914 | - if($port && $port != 80) |
|
| 1914 | + if ($port && $port != 80) |
|
| 1915 | 1915 | { |
| 1916 | 1916 | $url_info['port'] = $port; |
| 1917 | 1917 | } |
| 1918 | - elseif($url_info['port'] == 80) |
|
| 1918 | + elseif ($url_info['port'] == 80) |
|
| 1919 | 1919 | { |
| 1920 | 1920 | unset($url_info['port']); |
| 1921 | 1921 | } |
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1924 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1925 | 1925 | |
| 1926 | 1926 | return $url[$ssl_mode][$domain_key]; |
| 1927 | 1927 | } |
@@ -1938,16 +1938,16 @@ discard block |
||
| 1938 | 1938 | { |
| 1939 | 1939 | $self = self::getInstance(); |
| 1940 | 1940 | $self->context->{$key} = $val; |
| 1941 | - if($set_to_get_vars === FALSE) |
|
| 1941 | + if ($set_to_get_vars === FALSE) |
|
| 1942 | 1942 | { |
| 1943 | 1943 | return; |
| 1944 | 1944 | } |
| 1945 | - if($val === NULL || $val === '') |
|
| 1945 | + if ($val === NULL || $val === '') |
|
| 1946 | 1946 | { |
| 1947 | 1947 | unset($self->get_vars->{$key}); |
| 1948 | 1948 | return; |
| 1949 | 1949 | } |
| 1950 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1950 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1951 | 1951 | { |
| 1952 | 1952 | $self->get_vars->{$key} = $val; |
| 1953 | 1953 | } |
@@ -1963,7 +1963,7 @@ discard block |
||
| 1963 | 1963 | { |
| 1964 | 1964 | $self = self::getInstance(); |
| 1965 | 1965 | |
| 1966 | - if(!isset($self->context->{$key})) |
|
| 1966 | + if (!isset($self->context->{$key})) |
|
| 1967 | 1967 | { |
| 1968 | 1968 | return null; |
| 1969 | 1969 | } |
@@ -1978,7 +1978,7 @@ discard block |
||
| 1978 | 1978 | function gets() |
| 1979 | 1979 | { |
| 1980 | 1980 | $num_args = func_num_args(); |
| 1981 | - if($num_args < 1) |
|
| 1981 | + if ($num_args < 1) |
|
| 1982 | 1982 | { |
| 1983 | 1983 | return; |
| 1984 | 1984 | } |
@@ -1986,7 +1986,7 @@ discard block |
||
| 1986 | 1986 | |
| 1987 | 1987 | $args_list = func_get_args(); |
| 1988 | 1988 | $output = new stdClass(); |
| 1989 | - foreach($args_list as $v) |
|
| 1989 | + foreach ($args_list as $v) |
|
| 1990 | 1990 | { |
| 1991 | 1991 | $output->{$v} = $self->get($v); |
| 1992 | 1992 | } |
@@ -2012,7 +2012,7 @@ discard block |
||
| 2012 | 2012 | function getRequestVars() |
| 2013 | 2013 | { |
| 2014 | 2014 | $self = self::getInstance(); |
| 2015 | - if($self->get_vars) |
|
| 2015 | + if ($self->get_vars) |
|
| 2016 | 2016 | { |
| 2017 | 2017 | return clone($self->get_vars); |
| 2018 | 2018 | } |
@@ -2029,13 +2029,13 @@ discard block |
||
| 2029 | 2029 | { |
| 2030 | 2030 | $self = self::getInstance(); |
| 2031 | 2031 | |
| 2032 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2032 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2033 | 2033 | { |
| 2034 | 2034 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2035 | 2035 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | - if(!isset($self->ssl_actions[$action])) |
|
| 2038 | + if (!isset($self->ssl_actions[$action])) |
|
| 2039 | 2039 | { |
| 2040 | 2040 | $self->ssl_actions[$action] = 1; |
| 2041 | 2041 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2053,16 +2053,16 @@ discard block |
||
| 2053 | 2053 | { |
| 2054 | 2054 | $self = self::getInstance(); |
| 2055 | 2055 | |
| 2056 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2056 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2057 | 2057 | { |
| 2058 | 2058 | unset($self->ssl_actions); |
| 2059 | 2059 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2060 | 2060 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | - foreach($action_array as $action) |
|
| 2063 | + foreach ($action_array as $action) |
|
| 2064 | 2064 | { |
| 2065 | - if(!isset($self->ssl_actions[$action])) |
|
| 2065 | + if (!isset($self->ssl_actions[$action])) |
|
| 2066 | 2066 | { |
| 2067 | 2067 | $self->ssl_actions[$action] = 1; |
| 2068 | 2068 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2081,7 +2081,7 @@ discard block |
||
| 2081 | 2081 | { |
| 2082 | 2082 | $self = self::getInstance(); |
| 2083 | 2083 | |
| 2084 | - if($self->isExistsSSLAction($action)) |
|
| 2084 | + if ($self->isExistsSSLAction($action)) |
|
| 2085 | 2085 | { |
| 2086 | 2086 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2087 | 2087 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | function getSSLActions() |
| 2099 | 2099 | { |
| 2100 | 2100 | $self = self::getInstance(); |
| 2101 | - if($self->getSslStatus() == 'optional') |
|
| 2101 | + if ($self->getSslStatus() == 'optional') |
|
| 2102 | 2102 | { |
| 2103 | 2103 | return $self->ssl_actions; |
| 2104 | 2104 | } |
@@ -2125,12 +2125,12 @@ discard block |
||
| 2125 | 2125 | */ |
| 2126 | 2126 | function normalizeFilePath($file) |
| 2127 | 2127 | { |
| 2128 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2128 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2129 | 2129 | { |
| 2130 | - $file = './' . $file; |
|
| 2130 | + $file = './'.$file; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2133 | - while(strpos($file, '/../') !== FALSE) |
|
| 2133 | + while (strpos($file, '/../') !== FALSE) |
|
| 2134 | 2134 | { |
| 2135 | 2135 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2136 | 2136 | } |
@@ -2149,13 +2149,13 @@ discard block |
||
| 2149 | 2149 | { |
| 2150 | 2150 | $file = self::normalizeFilePath($file); |
| 2151 | 2151 | $script_path = getScriptPath(); |
| 2152 | - if(strpos($file, './') === 0) |
|
| 2152 | + if (strpos($file, './') === 0) |
|
| 2153 | 2153 | { |
| 2154 | - $file = $script_path . substr($file, 2); |
|
| 2154 | + $file = $script_path.substr($file, 2); |
|
| 2155 | 2155 | } |
| 2156 | - elseif(strpos($file, '../') === 0) |
|
| 2156 | + elseif (strpos($file, '../') === 0) |
|
| 2157 | 2157 | { |
| 2158 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2158 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2159 | 2159 | } |
| 2160 | 2160 | |
| 2161 | 2161 | return $file; |
@@ -2225,12 +2225,12 @@ discard block |
||
| 2225 | 2225 | */ |
| 2226 | 2226 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2227 | 2227 | { |
| 2228 | - if($isRuleset) |
|
| 2228 | + if ($isRuleset) |
|
| 2229 | 2229 | { |
| 2230 | - if(strpos($file, '#') !== FALSE) |
|
| 2230 | + if (strpos($file, '#') !== FALSE) |
|
| 2231 | 2231 | { |
| 2232 | 2232 | $file = str_replace('#', '', $file); |
| 2233 | - if(!is_readable($file)) |
|
| 2233 | + if (!is_readable($file)) |
|
| 2234 | 2234 | { |
| 2235 | 2235 | $file = $autoPath; |
| 2236 | 2236 | } |
@@ -2295,9 +2295,9 @@ discard block |
||
| 2295 | 2295 | ksort($files); |
| 2296 | 2296 | $files = array_values($files); |
| 2297 | 2297 | $filenames = array(); |
| 2298 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2298 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2299 | 2299 | { |
| 2300 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2300 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2301 | 2301 | { |
| 2302 | 2302 | unset($files[$i]); |
| 2303 | 2303 | } |
@@ -2382,14 +2382,14 @@ discard block |
||
| 2382 | 2382 | */ |
| 2383 | 2383 | function getJavascriptPluginInfo($pluginName) |
| 2384 | 2384 | { |
| 2385 | - if($plugin_name == 'ui.datepicker') |
|
| 2385 | + if ($plugin_name == 'ui.datepicker') |
|
| 2386 | 2386 | { |
| 2387 | 2387 | $plugin_name = 'ui'; |
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2391 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2392 | - if(!is_readable($info_file)) |
|
| 2390 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2391 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2392 | + if (!is_readable($info_file)) |
|
| 2393 | 2393 | { |
| 2394 | 2394 | return; |
| 2395 | 2395 | } |
@@ -2399,32 +2399,32 @@ discard block |
||
| 2399 | 2399 | $result->jsList = array(); |
| 2400 | 2400 | $result->cssList = array(); |
| 2401 | 2401 | |
| 2402 | - foreach($list as $filename) |
|
| 2402 | + foreach ($list as $filename) |
|
| 2403 | 2403 | { |
| 2404 | 2404 | $filename = trim($filename); |
| 2405 | - if(!$filename) |
|
| 2405 | + if (!$filename) |
|
| 2406 | 2406 | { |
| 2407 | 2407 | continue; |
| 2408 | 2408 | } |
| 2409 | 2409 | |
| 2410 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2410 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2411 | 2411 | { |
| 2412 | 2412 | $filename = substr($filename, 2); |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2415 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2416 | 2416 | { |
| 2417 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2417 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2418 | 2418 | } |
| 2419 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2419 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2420 | 2420 | { |
| 2421 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2421 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2422 | 2422 | } |
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | - if(is_dir($plugin_path . 'lang')) |
|
| 2425 | + if (is_dir($plugin_path.'lang')) |
|
| 2426 | 2426 | { |
| 2427 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2427 | + $result->langPath = $plugin_path.'lang'; |
|
| 2428 | 2428 | } |
| 2429 | 2429 | |
| 2430 | 2430 | return $result; |
@@ -2440,50 +2440,50 @@ discard block |
||
| 2440 | 2440 | static $loaded_plugins = array(); |
| 2441 | 2441 | |
| 2442 | 2442 | $self = self::getInstance(); |
| 2443 | - if($plugin_name == 'ui.datepicker') |
|
| 2443 | + if ($plugin_name == 'ui.datepicker') |
|
| 2444 | 2444 | { |
| 2445 | 2445 | $plugin_name = 'ui'; |
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | - if($loaded_plugins[$plugin_name]) |
|
| 2448 | + if ($loaded_plugins[$plugin_name]) |
|
| 2449 | 2449 | { |
| 2450 | 2450 | return; |
| 2451 | 2451 | } |
| 2452 | 2452 | $loaded_plugins[$plugin_name] = TRUE; |
| 2453 | 2453 | |
| 2454 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2455 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2456 | - if(!is_readable($info_file)) |
|
| 2454 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2455 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2456 | + if (!is_readable($info_file)) |
|
| 2457 | 2457 | { |
| 2458 | 2458 | return; |
| 2459 | 2459 | } |
| 2460 | 2460 | |
| 2461 | 2461 | $list = file($info_file); |
| 2462 | - foreach($list as $filename) |
|
| 2462 | + foreach ($list as $filename) |
|
| 2463 | 2463 | { |
| 2464 | 2464 | $filename = trim($filename); |
| 2465 | - if(!$filename) |
|
| 2465 | + if (!$filename) |
|
| 2466 | 2466 | { |
| 2467 | 2467 | continue; |
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2470 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2471 | 2471 | { |
| 2472 | 2472 | $filename = substr($filename, 2); |
| 2473 | 2473 | } |
| 2474 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2474 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2475 | 2475 | { |
| 2476 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2476 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2477 | 2477 | } |
| 2478 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2478 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2479 | 2479 | { |
| 2480 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2480 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2481 | 2481 | } |
| 2482 | 2482 | } |
| 2483 | 2483 | |
| 2484 | - if(is_dir($plugin_path . 'lang')) |
|
| 2484 | + if (is_dir($plugin_path.'lang')) |
|
| 2485 | 2485 | { |
| 2486 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2486 | + $self->loadLang($plugin_path.'lang'); |
|
| 2487 | 2487 | } |
| 2488 | 2488 | } |
| 2489 | 2489 | |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | function addHtmlHeader($header) |
| 2497 | 2497 | { |
| 2498 | 2498 | $self = self::getInstance(); |
| 2499 | - $self->html_header .= "\n" . $header; |
|
| 2499 | + $self->html_header .= "\n".$header; |
|
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | function clearHtmlHeader() |
@@ -2548,7 +2548,7 @@ discard block |
||
| 2548 | 2548 | function addBodyHeader($header) |
| 2549 | 2549 | { |
| 2550 | 2550 | $self = self::getInstance(); |
| 2551 | - $self->body_header .= "\n" . $header; |
|
| 2551 | + $self->body_header .= "\n".$header; |
|
| 2552 | 2552 | } |
| 2553 | 2553 | |
| 2554 | 2554 | /** |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | function addHtmlFooter($footer) |
| 2571 | 2571 | { |
| 2572 | 2572 | $self = self::getInstance(); |
| 2573 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2573 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2574 | 2574 | } |
| 2575 | 2575 | |
| 2576 | 2576 | /** |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | */ |
| 2592 | 2592 | function getConfigFile() |
| 2593 | 2593 | { |
| 2594 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2594 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2595 | 2595 | } |
| 2596 | 2596 | |
| 2597 | 2597 | /** |
@@ -2601,7 +2601,7 @@ discard block |
||
| 2601 | 2601 | */ |
| 2602 | 2602 | function getFTPConfigFile() |
| 2603 | 2603 | { |
| 2604 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2604 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2605 | 2605 | } |
| 2606 | 2606 | |
| 2607 | 2607 | /** |
@@ -2653,14 +2653,14 @@ discard block |
||
| 2653 | 2653 | $_path = explode('/', $path); |
| 2654 | 2654 | $_base = explode('/', $base_url); |
| 2655 | 2655 | |
| 2656 | - if(!$_base[count($_base) - 1]) |
|
| 2656 | + if (!$_base[count($_base) - 1]) |
|
| 2657 | 2657 | { |
| 2658 | 2658 | array_pop($_base); |
| 2659 | 2659 | } |
| 2660 | 2660 | |
| 2661 | - foreach($_xe as $idx => $dir) |
|
| 2661 | + foreach ($_xe as $idx => $dir) |
|
| 2662 | 2662 | { |
| 2663 | - if($_path[0] != $dir) |
|
| 2663 | + if ($_path[0] != $dir) |
|
| 2664 | 2664 | { |
| 2665 | 2665 | break; |
| 2666 | 2666 | } |
@@ -2668,9 +2668,9 @@ discard block |
||
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | $idx = count($_xe) - $idx - 1; |
| 2671 | - while($idx--) |
|
| 2671 | + while ($idx--) |
|
| 2672 | 2672 | { |
| 2673 | - if(count($_base) > 0) |
|
| 2673 | + if (count($_base) > 0) |
|
| 2674 | 2674 | { |
| 2675 | 2675 | array_shift($_base); |
| 2676 | 2676 | } |
@@ -2680,13 +2680,13 @@ discard block |
||
| 2680 | 2680 | } |
| 2681 | 2681 | } |
| 2682 | 2682 | |
| 2683 | - if(count($_base) > 0) |
|
| 2683 | + if (count($_base) > 0) |
|
| 2684 | 2684 | { |
| 2685 | 2685 | array_unshift($_path, join('/', $_base)); |
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | - $path = '/' . join('/', $_path); |
|
| 2689 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2688 | + $path = '/'.join('/', $_path); |
|
| 2689 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2690 | 2690 | { |
| 2691 | 2691 | $path .= '/'; |
| 2692 | 2692 | } |
@@ -2701,13 +2701,13 @@ discard block |
||
| 2701 | 2701 | { |
| 2702 | 2702 | $self = self::getInstance(); |
| 2703 | 2703 | |
| 2704 | - if(!is_array($self->meta_tags)) |
|
| 2704 | + if (!is_array($self->meta_tags)) |
|
| 2705 | 2705 | { |
| 2706 | 2706 | $self->meta_tags = array(); |
| 2707 | 2707 | } |
| 2708 | 2708 | |
| 2709 | 2709 | $ret = array(); |
| 2710 | - foreach($self->meta_tags as $key => $val) |
|
| 2710 | + foreach ($self->meta_tags as $key => $val) |
|
| 2711 | 2711 | { |
| 2712 | 2712 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2713 | 2713 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2727,7 +2727,7 @@ discard block |
||
| 2727 | 2727 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2728 | 2728 | { |
| 2729 | 2729 | $self = self::getInstance(); |
| 2730 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2730 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2731 | 2731 | } |
| 2732 | 2732 | |
| 2733 | 2733 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $this->loadDBInfo(); |
| 231 | 231 | if($this->db_info->use_sitelock == 'Y') |
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
| 234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 235 | + } |
|
| 234 | 236 | |
| 235 | 237 | if(!IpFilter::filter($whitelist)) |
| 236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
| 245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 246 | 248 | { |
| 247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 248 | - } |
|
| 249 | - else |
|
| 250 | + } else |
|
| 250 | 251 | { |
| 251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
| 303 | 304 | { |
| 304 | 305 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 305 | 306 | } |
| 306 | - } |
|
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + } elseif($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
@@ -341,7 +341,9 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if($sess = $_POST[session_name()]) { |
|
| 345 | + session_id($sess); |
|
| 346 | + } |
|
| 345 | 347 | session_start(); |
| 346 | 348 | |
| 347 | 349 | // set authentication information in Context and session |
@@ -394,22 +396,21 @@ discard block |
||
| 394 | 396 | { |
| 395 | 397 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 396 | 398 | } |
| 397 | - } |
|
| 398 | - elseif($val) |
|
| 399 | + } elseif($val) |
|
| 399 | 400 | { |
| 400 | 401 | $url[] = $key . '=' . urlencode($val); |
| 401 | 402 | } |
| 402 | 403 | } |
| 403 | 404 | |
| 404 | 405 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | - } |
|
| 407 | - else |
|
| 406 | + if($url) { |
|
| 407 | + $current_url .= '?' . join('&', $url); |
|
| 408 | + } |
|
| 409 | + } else |
|
| 408 | 410 | { |
| 409 | 411 | $current_url = $this->getUrl(); |
| 410 | 412 | } |
| 411 | - } |
|
| 412 | - else |
|
| 413 | + } else |
|
| 413 | 414 | { |
| 414 | 415 | $current_url = self::getRequestUri(); |
| 415 | 416 | } |
@@ -492,18 +493,22 @@ discard block |
||
| 492 | 493 | $db_info->use_prepared_statements = 'Y'; |
| 493 | 494 | } |
| 494 | 495 | |
| 495 | - if(!$db_info->time_zone) |
|
| 496 | - $db_info->time_zone = date('O'); |
|
| 496 | + if(!$db_info->time_zone) { |
|
| 497 | + $db_info->time_zone = date('O'); |
|
| 498 | + } |
|
| 497 | 499 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 498 | 500 | |
| 499 | - if($db_info->qmail_compatibility != 'Y') |
|
| 500 | - $db_info->qmail_compatibility = 'N'; |
|
| 501 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 502 | + $db_info->qmail_compatibility = 'N'; |
|
| 503 | + } |
|
| 501 | 504 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 502 | 505 | |
| 503 | - if(!$db_info->use_db_session) |
|
| 504 | - $db_info->use_db_session = 'N'; |
|
| 505 | - if(!$db_info->use_ssl) |
|
| 506 | - $db_info->use_ssl = 'none'; |
|
| 506 | + if(!$db_info->use_db_session) { |
|
| 507 | + $db_info->use_db_session = 'N'; |
|
| 508 | + } |
|
| 509 | + if(!$db_info->use_ssl) { |
|
| 510 | + $db_info->use_ssl = 'none'; |
|
| 511 | + } |
|
| 507 | 512 | $this->set('_use_ssl', $db_info->use_ssl); |
| 508 | 513 | |
| 509 | 514 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -620,8 +625,7 @@ discard block |
||
| 620 | 625 | $buff = FileHandler::readFile($orig_lang_file); |
| 621 | 626 | FileHandler::writeFile($selected_lang_file, $buff); |
| 622 | 627 | $lang_selected = self::loadLangSupported(); |
| 623 | - } |
|
| 624 | - else |
|
| 628 | + } else |
|
| 625 | 629 | { |
| 626 | 630 | $langs = file($selected_lang_file); |
| 627 | 631 | foreach($langs as $val) |
@@ -680,15 +684,16 @@ discard block |
||
| 680 | 684 | |
| 681 | 685 | $oModuleModel = getModel('module'); |
| 682 | 686 | $domain = $url_info['host'] . $url_info['path']; |
| 683 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 687 | + if(substr_compare($domain, '/', -1) === 0) { |
|
| 688 | + $domain = substr($domain, 0, -1); |
|
| 689 | + } |
|
| 684 | 690 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 685 | 691 | |
| 686 | 692 | if($site_info->site_srl) |
| 687 | 693 | { |
| 688 | 694 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
| 689 | 695 | $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
| 690 | - } |
|
| 691 | - else |
|
| 696 | + } else |
|
| 692 | 697 | { |
| 693 | 698 | $redirect_url = $url; |
| 694 | 699 | } |
@@ -697,8 +702,7 @@ discard block |
||
| 697 | 702 | return FALSE; |
| 698 | 703 | } |
| 699 | 704 | // for sites requesting SSO validation |
| 700 | - } |
|
| 701 | - else |
|
| 705 | + } else |
|
| 702 | 706 | { |
| 703 | 707 | // result handling : set session_name() |
| 704 | 708 | if($session_name = self::get('SSOID')) |
@@ -715,8 +719,7 @@ discard block |
||
| 715 | 719 | header('location:' . $url); |
| 716 | 720 | return FALSE; |
| 717 | 721 | // send SSO request |
| 718 | - } |
|
| 719 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 722 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 720 | 723 | { |
| 721 | 724 | setcookie('sso', md5(self::getRequestUri())); |
| 722 | 725 | $origin_url = self::getRequestUrl(); |
@@ -776,8 +779,7 @@ discard block |
||
| 776 | 779 | if($self->site_title) |
| 777 | 780 | { |
| 778 | 781 | $self->site_title .= ' - ' . $site_title; |
| 779 | - } |
|
| 780 | - else |
|
| 782 | + } else |
|
| 781 | 783 | { |
| 782 | 784 | $self->site_title = $site_title; |
| 783 | 785 | } |
@@ -877,8 +879,7 @@ discard block |
||
| 877 | 879 | { |
| 878 | 880 | $self->loaded_lang_files[] = $filename; |
| 879 | 881 | include($filename); |
| 880 | - } |
|
| 881 | - else |
|
| 882 | + } else |
|
| 882 | 883 | { |
| 883 | 884 | $self->_evalxmlLang($path); |
| 884 | 885 | } |
@@ -894,7 +895,9 @@ discard block |
||
| 894 | 895 | { |
| 895 | 896 | global $lang; |
| 896 | 897 | |
| 897 | - if(!$path) return; |
|
| 898 | + if(!$path) { |
|
| 899 | + return; |
|
| 900 | + } |
|
| 898 | 901 | |
| 899 | 902 | $_path = 'eval://' . $path; |
| 900 | 903 | |
@@ -926,7 +929,9 @@ discard block |
||
| 926 | 929 | */ |
| 927 | 930 | function _loadXmlLang($path) |
| 928 | 931 | { |
| 929 | - if(!$path) return; |
|
| 932 | + if(!$path) { |
|
| 933 | + return; |
|
| 934 | + } |
|
| 930 | 935 | |
| 931 | 936 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 932 | 937 | return $oXmlLangParser->compile(); |
@@ -940,7 +945,9 @@ discard block |
||
| 940 | 945 | */ |
| 941 | 946 | function _loadPhpLang($path) |
| 942 | 947 | { |
| 943 | - if(!$path) return; |
|
| 948 | + if(!$path) { |
|
| 949 | + return; |
|
| 950 | + } |
|
| 944 | 951 | |
| 945 | 952 | if(substr_compare($path, '/', -1) !== 0) |
| 946 | 953 | { |
@@ -1073,12 +1080,14 @@ discard block |
||
| 1073 | 1080 | static $flag = TRUE; |
| 1074 | 1081 | if($charset) |
| 1075 | 1082 | { |
| 1076 | - if(is_array($val)) |
|
| 1077 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1078 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1079 | - else $flag = FALSE; |
|
| 1080 | - } |
|
| 1081 | - else |
|
| 1083 | + if(is_array($val)) { |
|
| 1084 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1085 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1086 | + $flag = FALSE; |
|
| 1087 | + } else { |
|
| 1088 | + $flag = FALSE; |
|
| 1089 | + } |
|
| 1090 | + } else |
|
| 1082 | 1091 | { |
| 1083 | 1092 | $return = $flag; |
| 1084 | 1093 | $flag = TRUE; |
@@ -1100,8 +1109,9 @@ discard block |
||
| 1100 | 1109 | if (is_array($val)) |
| 1101 | 1110 | { |
| 1102 | 1111 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1112 | + } else { |
|
| 1113 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1103 | 1114 | } |
| 1104 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1105 | 1115 | } |
| 1106 | 1116 | |
| 1107 | 1117 | /** |
@@ -1112,7 +1122,9 @@ discard block |
||
| 1112 | 1122 | */ |
| 1113 | 1123 | function convertEncodingStr($str) |
| 1114 | 1124 | { |
| 1115 | - if(!$str) return null; |
|
| 1125 | + if(!$str) { |
|
| 1126 | + return null; |
|
| 1127 | + } |
|
| 1116 | 1128 | $obj = new stdClass(); |
| 1117 | 1129 | $obj->str = $str; |
| 1118 | 1130 | $obj = self::convertEncoding($obj); |
@@ -1225,16 +1237,13 @@ discard block |
||
| 1225 | 1237 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1226 | 1238 | { |
| 1227 | 1239 | $set_to_vars = TRUE; |
| 1228 | - } |
|
| 1229 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1240 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1230 | 1241 | { |
| 1231 | 1242 | $set_to_vars = TRUE; |
| 1232 | - } |
|
| 1233 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1243 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1234 | 1244 | { |
| 1235 | 1245 | $set_to_vars = TRUE; |
| 1236 | - } |
|
| 1237 | - else |
|
| 1246 | + } else |
|
| 1238 | 1247 | { |
| 1239 | 1248 | $set_to_vars = FALSE; |
| 1240 | 1249 | } |
@@ -1260,8 +1269,7 @@ discard block |
||
| 1260 | 1269 | return; |
| 1261 | 1270 | } |
| 1262 | 1271 | } |
| 1263 | - } |
|
| 1264 | - else if(is_array($val)) |
|
| 1272 | + } else if(is_array($val)) |
|
| 1265 | 1273 | { |
| 1266 | 1274 | foreach($val as $val2) |
| 1267 | 1275 | { |
@@ -1409,19 +1417,15 @@ discard block |
||
| 1409 | 1417 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1410 | 1418 | { |
| 1411 | 1419 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1412 | - } |
|
| 1413 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1420 | + } elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1414 | 1421 | $result[$k] = escape($v, false); |
| 1415 | - } |
|
| 1416 | - elseif($key === 'vid') |
|
| 1422 | + } elseif($key === 'vid') |
|
| 1417 | 1423 | { |
| 1418 | 1424 | $result[$k] = urlencode($v); |
| 1419 | - } |
|
| 1420 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1425 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1421 | 1426 | { |
| 1422 | 1427 | unset($result[$k]); |
| 1423 | - } |
|
| 1424 | - else |
|
| 1428 | + } else |
|
| 1425 | 1429 | { |
| 1426 | 1430 | $result[$k] = $v; |
| 1427 | 1431 | |
@@ -1430,8 +1434,7 @@ discard block |
||
| 1430 | 1434 | if (is_array($result[$k])) |
| 1431 | 1435 | { |
| 1432 | 1436 | array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); |
| 1433 | - } |
|
| 1434 | - else |
|
| 1437 | + } else |
|
| 1435 | 1438 | { |
| 1436 | 1439 | $result[$k] = stripslashes($result[$k]); |
| 1437 | 1440 | } |
@@ -1440,8 +1443,7 @@ discard block |
||
| 1440 | 1443 | if(is_array($result[$k])) |
| 1441 | 1444 | { |
| 1442 | 1445 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1443 | - } |
|
| 1444 | - else |
|
| 1446 | + } else |
|
| 1445 | 1447 | { |
| 1446 | 1448 | $result[$k] = trim($result[$k]); |
| 1447 | 1449 | } |
@@ -1491,8 +1493,7 @@ discard block |
||
| 1491 | 1493 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1492 | 1494 | $this->set($key, $val, TRUE); |
| 1493 | 1495 | $this->is_uploaded = TRUE; |
| 1494 | - } |
|
| 1495 | - else |
|
| 1496 | + } else |
|
| 1496 | 1497 | { |
| 1497 | 1498 | $files = array(); |
| 1498 | 1499 | foreach ($tmp_name as $i => $j) |
@@ -1606,8 +1607,7 @@ discard block |
||
| 1606 | 1607 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1607 | 1608 | { |
| 1608 | 1609 | $vid = $site_module_info->domain; |
| 1609 | - } |
|
| 1610 | - else |
|
| 1610 | + } else |
|
| 1611 | 1611 | { |
| 1612 | 1612 | $domain = $site_module_info->domain; |
| 1613 | 1613 | } |
@@ -1624,8 +1624,7 @@ discard block |
||
| 1624 | 1624 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1625 | 1625 | { |
| 1626 | 1626 | unset($domain); |
| 1627 | - } |
|
| 1628 | - else |
|
| 1627 | + } else |
|
| 1629 | 1628 | { |
| 1630 | 1629 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1631 | 1630 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1645,23 +1644,35 @@ discard block |
||
| 1645 | 1644 | { |
| 1646 | 1645 | array_shift($args_list); |
| 1647 | 1646 | } |
| 1648 | - } |
|
| 1649 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1647 | + } elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1650 | 1648 | { |
| 1651 | 1649 | // Otherwise, make GET variables into array |
| 1652 | 1650 | $get_vars = get_object_vars($self->get_vars); |
| 1653 | - } |
|
| 1654 | - else |
|
| 1651 | + } else |
|
| 1655 | 1652 | { |
| 1656 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1653 | + if(!!$self->get_vars->module) { |
|
| 1654 | + $get_vars['module'] = $self->get_vars->module; |
|
| 1655 | + } |
|
| 1656 | + if(!!$self->get_vars->mid) { |
|
| 1657 | + $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | + } |
|
| 1659 | + if(!!$self->get_vars->act) { |
|
| 1660 | + $get_vars['act'] = $self->get_vars->act; |
|
| 1661 | + } |
|
| 1662 | + if(!!$self->get_vars->page) { |
|
| 1663 | + $get_vars['page'] = $self->get_vars->page; |
|
| 1664 | + } |
|
| 1665 | + if(!!$self->get_vars->search_target) { |
|
| 1666 | + $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1667 | + } |
|
| 1668 | + if(!!$self->get_vars->search_keyword) { |
|
| 1669 | + $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1670 | + } |
|
| 1662 | 1671 | if($get_vars['act'] == 'IS') |
| 1663 | 1672 | { |
| 1664 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1673 | + if(!!$self->get_vars->is_keyword) { |
|
| 1674 | + $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1675 | + } |
|
| 1665 | 1676 | } |
| 1666 | 1677 | } |
| 1667 | 1678 | |
@@ -1686,8 +1697,7 @@ discard block |
||
| 1686 | 1697 | if($vid) |
| 1687 | 1698 | { |
| 1688 | 1699 | $get_vars['vid'] = $vid; |
| 1689 | - } |
|
| 1690 | - else |
|
| 1700 | + } else |
|
| 1691 | 1701 | { |
| 1692 | 1702 | unset($get_vars['vid']); |
| 1693 | 1703 | } |
@@ -1759,8 +1769,7 @@ discard block |
||
| 1759 | 1769 | { |
| 1760 | 1770 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1761 | 1771 | } |
| 1762 | - } |
|
| 1763 | - elseif(!is_array($val)) |
|
| 1772 | + } elseif(!is_array($val)) |
|
| 1764 | 1773 | { |
| 1765 | 1774 | $queries[] = $key . '=' . urlencode($val); |
| 1766 | 1775 | } |
@@ -1778,25 +1787,23 @@ discard block |
||
| 1778 | 1787 | { |
| 1779 | 1788 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1780 | 1789 | // optional SSL use |
| 1781 | - } |
|
| 1782 | - elseif($_use_ssl == 'optional') |
|
| 1790 | + } elseif($_use_ssl == 'optional') |
|
| 1783 | 1791 | { |
| 1784 | 1792 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1785 | 1793 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1786 | 1794 | // no SSL |
| 1787 | - } |
|
| 1788 | - else |
|
| 1795 | + } else |
|
| 1789 | 1796 | { |
| 1790 | 1797 | // currently on SSL but target is not based on SSL |
| 1791 | 1798 | if($_SERVER['HTTPS'] == 'on') |
| 1792 | 1799 | { |
| 1793 | 1800 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1794 | - } |
|
| 1795 | - else if($domain) // if $domain is set |
|
| 1801 | + } else if($domain) { |
|
| 1802 | + // if $domain is set |
|
| 1796 | 1803 | { |
| 1797 | 1804 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1798 | 1805 | } |
| 1799 | - else |
|
| 1806 | + } else |
|
| 1800 | 1807 | { |
| 1801 | 1808 | $query = getScriptPath() . $query; |
| 1802 | 1809 | } |
@@ -1853,8 +1860,7 @@ discard block |
||
| 1853 | 1860 | if($domain) |
| 1854 | 1861 | { |
| 1855 | 1862 | $domain_key = md5($domain); |
| 1856 | - } |
|
| 1857 | - else |
|
| 1863 | + } else |
|
| 1858 | 1864 | { |
| 1859 | 1865 | $domain_key = 'default'; |
| 1860 | 1866 | } |
@@ -1883,8 +1889,7 @@ discard block |
||
| 1883 | 1889 | { |
| 1884 | 1890 | $target_url.= '/'; |
| 1885 | 1891 | } |
| 1886 | - } |
|
| 1887 | - else |
|
| 1892 | + } else |
|
| 1888 | 1893 | { |
| 1889 | 1894 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1890 | 1895 | } |
@@ -1902,20 +1907,17 @@ discard block |
||
| 1902 | 1907 | if($port && $port != 443) |
| 1903 | 1908 | { |
| 1904 | 1909 | $url_info['port'] = $port; |
| 1905 | - } |
|
| 1906 | - elseif($url_info['port'] == 443) |
|
| 1910 | + } elseif($url_info['port'] == 443) |
|
| 1907 | 1911 | { |
| 1908 | 1912 | unset($url_info['port']); |
| 1909 | 1913 | } |
| 1910 | - } |
|
| 1911 | - else |
|
| 1914 | + } else |
|
| 1912 | 1915 | { |
| 1913 | 1916 | $port = self::get('_http_port'); |
| 1914 | 1917 | if($port && $port != 80) |
| 1915 | 1918 | { |
| 1916 | 1919 | $url_info['port'] = $port; |
| 1917 | - } |
|
| 1918 | - elseif($url_info['port'] == 80) |
|
| 1920 | + } elseif($url_info['port'] == 80) |
|
| 1919 | 1921 | { |
| 1920 | 1922 | unset($url_info['port']); |
| 1921 | 1923 | } |
@@ -2152,8 +2154,7 @@ discard block |
||
| 2152 | 2154 | if(strpos($file, './') === 0) |
| 2153 | 2155 | { |
| 2154 | 2156 | $file = $script_path . substr($file, 2); |
| 2155 | - } |
|
| 2156 | - elseif(strpos($file, '../') === 0) |
|
| 2157 | + } elseif(strpos($file, '../') === 0) |
|
| 2157 | 2158 | { |
| 2158 | 2159 | $file = self::normalizeFilePath($script_path . $file); |
| 2159 | 2160 | } |
@@ -2415,8 +2416,7 @@ discard block |
||
| 2415 | 2416 | if(substr_compare($filename, '.js', -3) === 0) |
| 2416 | 2417 | { |
| 2417 | 2418 | $result->jsList[] = $plugin_path . $filename; |
| 2418 | - } |
|
| 2419 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2419 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2420 | 2420 | { |
| 2421 | 2421 | $result->cssList[] = $plugin_path . $filename; |
| 2422 | 2422 | } |
@@ -2673,8 +2673,7 @@ discard block |
||
| 2673 | 2673 | if(count($_base) > 0) |
| 2674 | 2674 | { |
| 2675 | 2675 | array_shift($_base); |
| 2676 | - } |
|
| 2677 | - else |
|
| 2676 | + } else |
|
| 2678 | 2677 | { |
| 2679 | 2678 | array_unshift($_base, '..'); |
| 2680 | 2679 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function __construct($path, $mode) |
| 38 | 38 | { |
| 39 | - if($path != NULL) |
|
| 39 | + if ($path != NULL) |
|
| 40 | 40 | { |
| 41 | 41 | $this->Open($path, $mode); |
| 42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | function append($file_name) |
| 52 | 52 | { |
| 53 | 53 | $target = new FileObject($file_name, "r"); |
| 54 | - while(!$target->feof()) |
|
| 54 | + while (!$target->feof()) |
|
| 55 | 55 | { |
| 56 | 56 | $readstr = $target->read(); |
| 57 | 57 | $this->write($readstr); |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | function write($str) |
| 90 | 90 | { |
| 91 | 91 | $len = strlen($str); |
| 92 | - if(!$str || $len <= 0) |
|
| 92 | + if (!$str || $len <= 0) |
|
| 93 | 93 | { |
| 94 | 94 | return FALSE; |
| 95 | 95 | } |
| 96 | - if(!$this->fp) |
|
| 96 | + if (!$this->fp) |
|
| 97 | 97 | { |
| 98 | 98 | return FALSE; |
| 99 | 99 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function open($path, $mode) |
| 114 | 114 | { |
| 115 | - if($this->fp != NULL) |
|
| 115 | + if ($this->fp != NULL) |
|
| 116 | 116 | { |
| 117 | 117 | $this->close(); |
| 118 | 118 | } |
| 119 | 119 | $this->fp = fopen($path, $mode); |
| 120 | - if(!is_resource($this->fp)) |
|
| 120 | + if (!is_resource($this->fp)) |
|
| 121 | 121 | { |
| 122 | 122 | $this->fp = NULL; |
| 123 | 123 | return FALSE; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function getPath() |
| 135 | 135 | { |
| 136 | - if($this->fp != NULL) |
|
| 136 | + if ($this->fp != NULL) |
|
| 137 | 137 | { |
| 138 | 138 | return $this->path; |
| 139 | 139 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function close() |
| 152 | 152 | { |
| 153 | - if($this->fp != NULL) |
|
| 153 | + if ($this->fp != NULL) |
|
| 154 | 154 | { |
| 155 | 155 | fclose($this->fp); |
| 156 | 156 | $this->fp = NULL; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * constructor |
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | - function __construct($host, $port, $scheme='') |
|
| 44 | + function __construct($host, $port, $scheme = '') |
|
| 45 | 45 | { |
| 46 | 46 | $this->m_host = $host; |
| 47 | 47 | $this->m_port = $port; |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | $this->addToHeader('Connection', 'close'); |
| 77 | 77 | |
| 78 | 78 | $method = strtoupper($method); |
| 79 | - if(!$allow_methods) |
|
| 79 | + if (!$allow_methods) |
|
| 80 | 80 | { |
| 81 | 81 | $allow_methods = explode(' ', 'GET POST PUT'); |
| 82 | 82 | } |
| 83 | - if(!in_array($method, $allow_methods)) |
|
| 83 | + if (!in_array($method, $allow_methods)) |
|
| 84 | 84 | { |
| 85 | 85 | $method = $allow_methods[0]; |
| 86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | $timout = max((int) $timeout, 0); |
| 90 | 90 | |
| 91 | 91 | // list of post variables |
| 92 | - if(!is_array($post_vars)) |
|
| 92 | + if (!is_array($post_vars)) |
|
| 93 | 93 | { |
| 94 | 94 | $post_vars = array(); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(FALSE && is_callable('curl_init')) |
|
| 97 | + if (FALSE && is_callable('curl_init')) |
|
| 98 | 98 | { |
| 99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
| 100 | 100 | } |
@@ -117,30 +117,30 @@ discard block |
||
| 117 | 117 | static $crlf = "\r\n"; |
| 118 | 118 | |
| 119 | 119 | $scheme = ''; |
| 120 | - if($this->m_scheme=='https') |
|
| 120 | + if ($this->m_scheme == 'https') |
|
| 121 | 121 | { |
| 122 | 122 | $scheme = 'ssl://'; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
| 126 | - if(!$sock) |
|
| 125 | + $sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
| 126 | + if (!$sock) |
|
| 127 | 127 | { |
| 128 | 128 | return new BaseObject(-1, 'socket_connect_failed'); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $headers = $this->m_headers + array(); |
| 132 | - if(!isset($headers['Accept-Encoding'])) |
|
| 132 | + if (!isset($headers['Accept-Encoding'])) |
|
| 133 | 133 | { |
| 134 | 134 | $headers['Accept-Encoding'] = 'identity'; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // post body |
| 138 | 138 | $post_body = ''; |
| 139 | - if($method == 'POST' && count($post_vars)) |
|
| 139 | + if ($method == 'POST' && count($post_vars)) |
|
| 140 | 140 | { |
| 141 | - foreach($post_vars as $key => $value) |
|
| 141 | + foreach ($post_vars as $key => $value) |
|
| 142 | 142 | { |
| 143 | - $post_body .= urlencode($key) . '=' . urlencode($value) . '&'; |
|
| 143 | + $post_body .= urlencode($key).'='.urlencode($value).'&'; |
|
| 144 | 144 | } |
| 145 | 145 | $post_body = substr($post_body, 0, -1); |
| 146 | 146 | |
@@ -149,35 +149,35 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $request = "$method $target HTTP/1.1$crlf"; |
| 152 | - foreach($headers as $equiv => $content) |
|
| 152 | + foreach ($headers as $equiv => $content) |
|
| 153 | 153 | { |
| 154 | 154 | $request .= "$equiv: $content$crlf"; |
| 155 | 155 | } |
| 156 | - $request .= $crlf . $post_body; |
|
| 156 | + $request .= $crlf.$post_body; |
|
| 157 | 157 | fwrite($sock, $request); |
| 158 | 158 | |
| 159 | 159 | list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3); |
| 160 | 160 | |
| 161 | 161 | // read response headers |
| 162 | 162 | $is_chunked = FALSE; |
| 163 | - while(strlen(trim($line = fgets($sock)))) |
|
| 163 | + while (strlen(trim($line = fgets($sock)))) |
|
| 164 | 164 | { |
| 165 | 165 | list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2); |
| 166 | - if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
| 166 | + if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
| 167 | 167 | { |
| 168 | 168 | $is_chunked = TRUE; |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $body = ''; |
| 173 | - while(!feof($sock)) |
|
| 173 | + while (!feof($sock)) |
|
| 174 | 174 | { |
| 175 | - if($is_chunked) |
|
| 175 | + if ($is_chunked) |
|
| 176 | 176 | { |
| 177 | 177 | $chunk_size = hexdec(fgets($sock)); |
| 178 | - if($chunk_size) |
|
| 178 | + if ($chunk_size) |
|
| 179 | 179 | { |
| 180 | - $body .= fgets($sock, $chunk_size+1); |
|
| 180 | + $body .= fgets($sock, $chunk_size + 1); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | else |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
| 220 | 220 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 221 | 221 | |
| 222 | - switch($method) |
|
| 222 | + switch ($method) |
|
| 223 | 223 | { |
| 224 | 224 | case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true); |
| 225 | 225 | break; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $arr_headers = array(); |
| 235 | - foreach($headers as $key => $value) |
|
| 235 | + foreach ($headers as $key => $value) |
|
| 236 | 236 | { |
| 237 | 237 | $arr_headers[] = "$key: $value"; |
| 238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers); |
| 241 | 241 | |
| 242 | 242 | $body = curl_exec($ch); |
| 243 | - if(curl_errno($ch)) |
|
| 243 | + if (curl_errno($ch)) |
|
| 244 | 244 | { |
| 245 | 245 | return new BaseObject(-1, 'socket_connect_failed'); |
| 246 | 246 | } |
@@ -18,32 +18,32 @@ discard block |
||
| 18 | 18 | function proc($args) |
| 19 | 19 | { |
| 20 | 20 | // Targets to sort |
| 21 | - if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order'; |
|
| 21 | + if (!in_array($args->order_target, array('list_order', 'update_order'))) $args->order_target = 'list_order'; |
|
| 22 | 22 | // Sort order |
| 23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
| 23 | + if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
| 24 | 24 | // The number of displayed lists |
| 25 | - $args->list_count = (int)$args->list_count; |
|
| 26 | - if(!$args->list_count) $args->list_count = 5; |
|
| 25 | + $args->list_count = (int) $args->list_count; |
|
| 26 | + if (!$args->list_count) $args->list_count = 5; |
|
| 27 | 27 | // Cut the length of the title |
| 28 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 28 | + if (!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 29 | 29 | // Cut the length of contents |
| 30 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 30 | + if (!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 31 | 31 | // Viewing options |
| 32 | - $args->option_view_arr = explode(',',$args->option_view); |
|
| 32 | + $args->option_view_arr = explode(',', $args->option_view); |
|
| 33 | 33 | // markup options |
| 34 | - if(!$args->markup_type) $args->markup_type = 'list'; |
|
| 34 | + if (!$args->markup_type) $args->markup_type = 'list'; |
|
| 35 | 35 | // Set variables for internal use |
| 36 | 36 | $oModuleModel = getModel('module'); |
| 37 | 37 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
| 38 | 38 | $site_module_info = Context::get('site_module_info'); |
| 39 | 39 | // List URLs if a type is RSS |
| 40 | - if($args->content_type == 'rss') |
|
| 40 | + if ($args->content_type == 'rss') |
|
| 41 | 41 | { |
| 42 | 42 | $args->rss_urls = array(); |
| 43 | - $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
|
| 44 | - for($i=0,$c=count($rss_urls);$i<$c;$i++) |
|
| 43 | + $rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4)); |
|
| 44 | + for ($i = 0, $c = count($rss_urls); $i < $c; $i++) |
|
| 45 | 45 | { |
| 46 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 46 | + if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 47 | 47 | } |
| 48 | 48 | // Get module information after listing module_srls if the module is not RSS |
| 49 | 49 | } |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $obj = new stdClass(); |
| 53 | 53 | // Apply to all modules in the site if a target module is not specified |
| 54 | - if(!$args->module_srls) |
|
| 54 | + if (!$args->module_srls) |
|
| 55 | 55 | { |
| 56 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
| 56 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
| 57 | 57 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 58 | - if($output->data) |
|
| 58 | + if ($output->data) |
|
| 59 | 59 | { |
| 60 | - foreach($output->data as $key => $val) |
|
| 60 | + foreach ($output->data as $key => $val) |
|
| 61 | 61 | { |
| 62 | 62 | $args->modules_info[$val->mid] = $val; |
| 63 | 63 | $args->module_srls_info[$val->module_srl] = $val; |
@@ -73,35 +73,35 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $obj->module_srls = $args->module_srls; |
| 75 | 75 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 76 | - if($output->data) |
|
| 76 | + if ($output->data) |
|
| 77 | 77 | { |
| 78 | - foreach($output->data as $key => $val) |
|
| 78 | + foreach ($output->data as $key => $val) |
|
| 79 | 79 | { |
| 80 | 80 | $args->modules_info[$val->mid] = $val; |
| 81 | 81 | $args->module_srls_info[$val->module_srl] = $val; |
| 82 | 82 | $module_srls[] = $val->module_srl; |
| 83 | 83 | } |
| 84 | - $idx = explode(',',$args->module_srls); |
|
| 85 | - for($i=0,$c=count($idx);$i<$c;$i++) |
|
| 84 | + $idx = explode(',', $args->module_srls); |
|
| 85 | + for ($i = 0, $c = count($idx); $i < $c; $i++) |
|
| 86 | 86 | { |
| 87 | 87 | $srl = $idx[$i]; |
| 88 | - if(!$args->module_srls_info[$srl]) continue; |
|
| 88 | + if (!$args->module_srls_info[$srl]) continue; |
|
| 89 | 89 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | // Exit if no module is found |
| 94 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 95 | - $args->module_srl = implode(',',$module_srls); |
|
| 94 | + if (!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 95 | + $args->module_srl = implode(',', $module_srls); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist |
| 100 | 100 | */ |
| 101 | 101 | // tab mode |
| 102 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 102 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 103 | 103 | { |
| 104 | - switch($args->content_type) |
|
| 104 | + switch ($args->content_type) |
|
| 105 | 105 | { |
| 106 | 106 | case 'comment': |
| 107 | 107 | $content_items = $this->_getCommentItems($args); |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $content_items = array(); |
| 127 | 127 | |
| 128 | - switch($args->content_type) |
|
| 128 | + switch ($args->content_type) |
|
| 129 | 129 | { |
| 130 | 130 | case 'comment': |
| 131 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 131 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 132 | 132 | { |
| 133 | 133 | $args->module_srl = $module_srl; |
| 134 | 134 | $content_items[$module_srl] = $this->_getCommentItems($args); |
| 135 | 135 | } |
| 136 | 136 | break; |
| 137 | 137 | case 'image': |
| 138 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 138 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 139 | 139 | { |
| 140 | 140 | $args->module_srl = $module_srl; |
| 141 | 141 | $content_items[$module_srl] = $this->_getImageItems($args); |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | $content_items = $this->getRssItems($args); |
| 146 | 146 | break; |
| 147 | 147 | case 'trackback': |
| 148 | - foreach($args->mid_lists as $module_srl => $mid){ |
|
| 148 | + foreach ($args->mid_lists as $module_srl => $mid) { |
|
| 149 | 149 | $args->module_srl = $module_srl; |
| 150 | 150 | $content_items[$module_srl] = $this->_getTrackbackItems($args); |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | default: |
| 154 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 154 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 155 | 155 | { |
| 156 | 156 | $args->module_srl = $module_srl; |
| 157 | 157 | $content_items[$module_srl] = $this->_getDocumentItems($args); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $output = $this->_compile($args,$content_items); |
|
| 163 | + $output = $this->_compile($args, $content_items); |
|
| 164 | 164 | return $output; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $content_items = array(); |
| 182 | 182 | |
| 183 | - if(!count($output)) return; |
|
| 183 | + if (!count($output)) return; |
|
| 184 | 184 | |
| 185 | - foreach($output as $key => $oComment) |
|
| 185 | + foreach ($output as $key => $oComment) |
|
| 186 | 186 | { |
| 187 | 187 | $attribute = $oComment->getObjectVars(); |
| 188 | 188 | $title = $oComment->getSummary($args->content_cut_size); |
| 189 | 189 | $thumbnail = $oComment->getThumbnail(); |
| 190 | - $url = sprintf("%s#comment_%s",getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl')); |
|
| 190 | + $url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl')); |
|
| 191 | 191 | |
| 192 | 192 | $attribute->mid = $args->mid_lists[$attribute->module_srl]; |
| 193 | 193 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | // Get categories |
| 213 | 213 | $obj = new stdClass(); |
| 214 | 214 | $obj->module_srl = $args->module_srl; |
| 215 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 216 | - if($output->toBool() && $output->data) |
|
| 215 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 216 | + if ($output->toBool() && $output->data) |
|
| 217 | 217 | { |
| 218 | - foreach($output->data as $key => $val) |
|
| 218 | + foreach ($output->data as $key => $val) |
|
| 219 | 219 | { |
| 220 | 220 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 221 | 221 | } |
@@ -223,17 +223,17 @@ discard block |
||
| 223 | 223 | // Get a list of documents |
| 224 | 224 | $obj->module_srl = $args->module_srl; |
| 225 | 225 | $obj->sort_index = $args->order_target; |
| 226 | - $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
|
| 226 | + $obj->order_type = $args->order_type == "desc" ? "asc" : "desc"; |
|
| 227 | 227 | $obj->list_count = $args->list_count; |
| 228 | 228 | $obj->statusList = array('PUBLIC'); |
| 229 | 229 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
| 230 | - if(!$output->toBool() || !$output->data) return; |
|
| 230 | + if (!$output->toBool() || !$output->data) return; |
|
| 231 | 231 | // If the result exists, make each document as an object |
| 232 | 232 | $content_items = array(); |
| 233 | 233 | $first_thumbnail_idx = -1; |
| 234 | - if(count($output->data)) |
|
| 234 | + if (count($output->data)) |
|
| 235 | 235 | { |
| 236 | - foreach($output->data as $key => $attribute) |
|
| 236 | + foreach ($output->data as $key => $attribute) |
|
| 237 | 237 | { |
| 238 | 238 | $oDocument = new documentItem(); |
| 239 | 239 | $oDocument->setAttribute($attribute, false); |
@@ -242,23 +242,23 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | $oDocumentModel->setToAllDocumentExtraVars(); |
| 244 | 244 | |
| 245 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 245 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 246 | 246 | { |
| 247 | 247 | $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]]; |
| 248 | 248 | $document_srl = $oDocument->document_srl; |
| 249 | 249 | $module_srl = $oDocument->get('module_srl'); |
| 250 | 250 | $category_srl = $oDocument->get('category_srl'); |
| 251 | 251 | $thumbnail = $oDocument->getThumbnail(); |
| 252 | - $content_item = new mcontentItem( $args->module_srls_info[$module_srl]->browser_title ); |
|
| 252 | + $content_item = new mcontentItem($args->module_srls_info[$module_srl]->browser_title); |
|
| 253 | 253 | $content_item->adds($oDocument->getObjectVars()); |
| 254 | 254 | $content_item->setTitle($oDocument->getTitleText()); |
| 255 | - $content_item->setCategory( $category_lists[$module_srl][$category_srl]->title ); |
|
| 256 | - $content_item->setDomain( $args->module_srls_info[$module_srl]->domain ); |
|
| 255 | + $content_item->setCategory($category_lists[$module_srl][$category_srl]->title); |
|
| 256 | + $content_item->setDomain($args->module_srls_info[$module_srl]->domain); |
|
| 257 | 257 | $content_item->setContent($oDocument->getSummary($args->content_cut_size)); |
| 258 | - $content_item->setLink( getSiteUrl($domain,'', 'mid',$args->mid_lists[$module_srl], 'document_srl',$document_srl) ); |
|
| 258 | + $content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl)); |
|
| 259 | 259 | $content_item->setThumbnail($thumbnail); |
| 260 | 260 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
| 261 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 261 | + if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 262 | 262 | $content_items[] = $content_item; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | $obj->direct_download = 'Y'; |
| 277 | 277 | $obj->isvalid = 'Y'; |
| 278 | 278 | // Get categories |
| 279 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 280 | - if($output->toBool() && $output->data) |
|
| 279 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 280 | + if ($output->toBool() && $output->data) |
|
| 281 | 281 | { |
| 282 | - foreach($output->data as $key => $val) |
|
| 282 | + foreach ($output->data as $key => $val) |
|
| 283 | 283 | { |
| 284 | 284 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 285 | 285 | } |
@@ -288,24 +288,24 @@ discard block |
||
| 288 | 288 | $obj->list_count = $args->list_count; |
| 289 | 289 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
| 290 | 290 | $files_count = count($files_output->data); |
| 291 | - if(!$files_count) return; |
|
| 291 | + if (!$files_count) return; |
|
| 292 | 292 | |
| 293 | 293 | $content_items = array(); |
| 294 | 294 | |
| 295 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 295 | + for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 296 | 296 | |
| 297 | 297 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
| 298 | 298 | |
| 299 | - if(!count($tmp_document_list)) return; |
|
| 299 | + if (!count($tmp_document_list)) return; |
|
| 300 | 300 | |
| 301 | - foreach($tmp_document_list as $oDocument) |
|
| 301 | + foreach ($tmp_document_list as $oDocument) |
|
| 302 | 302 | { |
| 303 | 303 | $attribute = $oDocument->getObjectVars(); |
| 304 | 304 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
| 305 | 305 | $domain = $args->module_srls_info[$attribute->module_srl]->domain; |
| 306 | 306 | $category = $category_lists[$attribute->module_srl]->text; |
| 307 | 307 | $content = $oDocument->getSummary($args->content_cut_size); |
| 308 | - $url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount()); |
|
| 308 | + $url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount()); |
|
| 309 | 309 | $thumbnail = $oDocument->getThumbnail(); |
| 310 | 310 | $content_item = new mcontentItem($browser_title); |
| 311 | 311 | $content_item->adds($attribute); |
@@ -327,11 +327,11 @@ discard block |
||
| 327 | 327 | $content_items = array(); |
| 328 | 328 | $args->mid_lists = array(); |
| 329 | 329 | |
| 330 | - foreach($args->rss_urls as $key => $rss) |
|
| 330 | + foreach ($args->rss_urls as $key => $rss) |
|
| 331 | 331 | { |
| 332 | 332 | $args->rss_url = $rss; |
| 333 | 333 | $content_item = $this->_getRssItems($args); |
| 334 | - if(count($content_item) > 0) |
|
| 334 | + if (count($content_item) > 0) |
|
| 335 | 335 | { |
| 336 | 336 | $browser_title = $content_item[0]->getBrowserTitle(); |
| 337 | 337 | $args->mid_lists[] = $browser_title; |
@@ -339,40 +339,40 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 342 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 343 | 343 | { |
| 344 | 344 | $items = array(); |
| 345 | - foreach($content_items as $key => $val) |
|
| 345 | + foreach ($content_items as $key => $val) |
|
| 346 | 346 | { |
| 347 | - foreach($val as $k => $v) |
|
| 347 | + foreach ($val as $k => $v) |
|
| 348 | 348 | { |
| 349 | 349 | $date = $v->get('regdate'); |
| 350 | - $i=0; |
|
| 351 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 352 | - $items[sprintf('%s%02d',$date,$i)] = $v; |
|
| 350 | + $i = 0; |
|
| 351 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
| 352 | + $items[sprintf('%s%02d', $date, $i)] = $v; |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | - if($args->order_type =='asc') ksort($items); |
|
| 355 | + if ($args->order_type == 'asc') ksort($items); |
|
| 356 | 356 | else krsort($items); |
| 357 | - $content_items = array_slice(array_values($items),0,$args->list_count); |
|
| 357 | + $content_items = array_slice(array_values($items), 0, $args->list_count); |
|
| 358 | 358 | } return $content_items; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | function _getRssBody($value) |
| 362 | 362 | { |
| 363 | - if(!$value || is_string($value)) return $value; |
|
| 364 | - if(is_object($value)) $value = get_object_vars($value); |
|
| 363 | + if (!$value || is_string($value)) return $value; |
|
| 364 | + if (is_object($value)) $value = get_object_vars($value); |
|
| 365 | 365 | $body = null; |
| 366 | - if(!count($value)) return; |
|
| 367 | - foreach($value as $key => $val) |
|
| 366 | + if (!count($value)) return; |
|
| 367 | + foreach ($value as $key => $val) |
|
| 368 | 368 | { |
| 369 | - if($key == 'body') |
|
| 369 | + if ($key == 'body') |
|
| 370 | 370 | { |
| 371 | 371 | $body = $val; |
| 372 | 372 | continue; |
| 373 | 373 | } |
| 374 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
| 375 | - if($body !== null) return $body; |
|
| 374 | + if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val); |
|
| 375 | + if ($body !== null) return $body; |
|
| 376 | 376 | } |
| 377 | 377 | return $body; |
| 378 | 378 | } |
@@ -383,17 +383,17 @@ discard block |
||
| 383 | 383 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
| 384 | 384 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
| 385 | 385 | // Remove Tag |
| 386 | - $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
| 386 | + $content = preg_replace('!<([^>]*?)>!is', '', $content); |
|
| 387 | 387 | // Replace tags to < , > , " |
| 388 | - $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
| 388 | + $content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content); |
|
| 389 | 389 | // Delete a series of whitespaces |
| 390 | 390 | $content = preg_replace('/ ( +)/is', ' ', $content); |
| 391 | 391 | // Truncate string |
| 392 | 392 | $content = trim(cut_str($content, $str_size, $tail)); |
| 393 | 393 | // Replace back < , > , " to theoriginal tags |
| 394 | - $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
| 394 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 395 | 395 | // Fixed a newline bug on a set of consecutive English letters |
| 396 | - $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
| 396 | + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content); |
|
| 397 | 397 | return $content; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | function requestFeedContents($rss_url) |
| 406 | 406 | { |
| 407 | - $rss_url = str_replace('&','&',Context::convertEncodingStr($rss_url)); |
|
| 407 | + $rss_url = str_replace('&', '&', Context::convertEncodingStr($rss_url)); |
|
| 408 | 408 | return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml'); |
| 409 | 409 | } |
| 410 | 410 | |
@@ -416,52 +416,52 @@ discard block |
||
| 416 | 416 | $buff = $this->requestFeedContents($args->rss_url); |
| 417 | 417 | |
| 418 | 418 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
| 419 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 419 | + if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 420 | 420 | |
| 421 | 421 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
| 422 | 422 | |
| 423 | 423 | $oXmlParser = new XmlParser(); |
| 424 | 424 | $xml_doc = $oXmlParser->parse($buff); |
| 425 | 425 | $rss = new stdClass(); |
| 426 | - if($xml_doc->rss) |
|
| 426 | + if ($xml_doc->rss) |
|
| 427 | 427 | { |
| 428 | 428 | $rss->title = $xml_doc->rss->channel->title->body; |
| 429 | 429 | $rss->link = $xml_doc->rss->channel->link->body; |
| 430 | 430 | |
| 431 | 431 | $items = $xml_doc->rss->channel->item; |
| 432 | 432 | |
| 433 | - if(!$items) return; |
|
| 434 | - if($items && !is_array($items)) $items = array($items); |
|
| 433 | + if (!$items) return; |
|
| 434 | + if ($items && !is_array($items)) $items = array($items); |
|
| 435 | 435 | |
| 436 | 436 | $content_items = array(); |
| 437 | 437 | |
| 438 | 438 | foreach ($items as $key => $value) |
| 439 | 439 | { |
| 440 | - if($key >= $args->list_count) break; |
|
| 440 | + if ($key >= $args->list_count) break; |
|
| 441 | 441 | unset($item); |
| 442 | 442 | $item = new stdClass(); |
| 443 | 443 | |
| 444 | - foreach($value as $key2 => $value2) |
|
| 444 | + foreach ($value as $key2 => $value2) |
|
| 445 | 445 | { |
| 446 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 446 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 447 | 447 | $item->{$key2} = $this->_getRssBody($value2); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | $content_item = new mcontentItem($rss->title); |
| 451 | 451 | $content_item->setContentsLink($rss->link); |
| 452 | 452 | $content_item->setTitle($item->title); |
| 453 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 453 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 454 | 454 | //$content_item->setCategory($item->category); |
| 455 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 455 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 456 | 456 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 457 | 457 | $content_item->setLink($item->link); |
| 458 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 458 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 459 | 459 | $content_item->setRegdate($date); |
| 460 | 460 | |
| 461 | 461 | $content_items[] = $content_item; |
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | - else if($xml_doc->{'rdf:rdf'}) |
|
| 464 | + else if ($xml_doc->{'rdf:rdf'}) |
|
| 465 | 465 | { |
| 466 | 466 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol |
| 467 | 467 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -469,102 +469,102 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $items = $xml_doc->{'rdf:rdf'}->item; |
| 471 | 471 | |
| 472 | - if(!$items) return; |
|
| 473 | - if($items && !is_array($items)) $items = array($items); |
|
| 472 | + if (!$items) return; |
|
| 473 | + if ($items && !is_array($items)) $items = array($items); |
|
| 474 | 474 | |
| 475 | 475 | $content_items = array(); |
| 476 | 476 | |
| 477 | 477 | foreach ($items as $key => $value) |
| 478 | 478 | { |
| 479 | - if($key >= $args->list_count) break; |
|
| 479 | + if ($key >= $args->list_count) break; |
|
| 480 | 480 | unset($item); |
| 481 | 481 | $item = new stdClass(); |
| 482 | 482 | |
| 483 | - foreach($value as $key2 => $value2) |
|
| 483 | + foreach ($value as $key2 => $value2) |
|
| 484 | 484 | { |
| 485 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 485 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 486 | 486 | $item->{$key2} = $this->_getRssBody($value2); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $content_item = new mcontentItem($rss->title); |
| 490 | 490 | $content_item->setContentsLink($rss->link); |
| 491 | 491 | $content_item->setTitle($item->title); |
| 492 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 492 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 493 | 493 | //$content_item->setCategory($item->category); |
| 494 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 494 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 495 | 495 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 496 | 496 | $content_item->setLink($item->link); |
| 497 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 497 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 498 | 498 | $content_item->setRegdate($date); |
| 499 | 499 | |
| 500 | 500 | $content_items[] = $content_item; |
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 503 | + else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 504 | 504 | { |
| 505 | 505 | // Atom 1.0 spec supported by misol |
| 506 | 506 | $rss->title = $xml_doc->feed->title->body; |
| 507 | 507 | $links = $xml_doc->feed->link; |
| 508 | - if(is_array($links)) |
|
| 508 | + if (is_array($links)) |
|
| 509 | 509 | { |
| 510 | 510 | foreach ($links as $value) |
| 511 | 511 | { |
| 512 | - if($value->attrs->rel == 'alternate') |
|
| 512 | + if ($value->attrs->rel == 'alternate') |
|
| 513 | 513 | { |
| 514 | 514 | $rss->link = $value->attrs->href; |
| 515 | 515 | break; |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 519 | + else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 520 | 520 | |
| 521 | 521 | $items = $xml_doc->feed->entry; |
| 522 | 522 | |
| 523 | - if(!$items) return; |
|
| 524 | - if($items && !is_array($items)) $items = array($items); |
|
| 523 | + if (!$items) return; |
|
| 524 | + if ($items && !is_array($items)) $items = array($items); |
|
| 525 | 525 | |
| 526 | 526 | $content_items = array(); |
| 527 | 527 | |
| 528 | 528 | foreach ($items as $key => $value) |
| 529 | 529 | { |
| 530 | - if($key >= $args->list_count) break; |
|
| 530 | + if ($key >= $args->list_count) break; |
|
| 531 | 531 | unset($item); |
| 532 | 532 | |
| 533 | - foreach($value as $key2 => $value2) |
|
| 533 | + foreach ($value as $key2 => $value2) |
|
| 534 | 534 | { |
| 535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 535 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 536 | 536 | $item->{$key2} = $this->_getRssBody($value2); |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $content_item = new mcontentItem($rss->title); |
| 540 | 540 | $links = $value->link; |
| 541 | - if(is_array($links)) |
|
| 541 | + if (is_array($links)) |
|
| 542 | 542 | { |
| 543 | 543 | foreach ($links as $val) |
| 544 | 544 | { |
| 545 | - if($val->attrs->rel == 'alternate') |
|
| 545 | + if ($val->attrs->rel == 'alternate') |
|
| 546 | 546 | { |
| 547 | 547 | $item->link = $val->attrs->href; |
| 548 | 548 | break; |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 552 | + else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 553 | 553 | |
| 554 | 554 | $content_item->setContentsLink($rss->link); |
| 555 | - if($item->title) |
|
| 555 | + if ($item->title) |
|
| 556 | 556 | { |
| 557 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 557 | + if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 558 | 558 | } |
| 559 | 559 | $content_item->setTitle($item->title); |
| 560 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 560 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 561 | 561 | $content_item->setAuthorSite($value->author->uri->body); |
| 562 | 562 | |
| 563 | 563 | //$content_item->setCategory($item->category); |
| 564 | 564 | $item->description = ($item->content) ? $item->content : $item->description = $item->summary; |
| 565 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 565 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 566 | 566 | |
| 567 | - if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 567 | + if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 568 | 568 | { |
| 569 | 569 | $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 570 | 570 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 574 | 574 | $content_item->setLink($item->link); |
| 575 | - $date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'}))); |
|
| 575 | + $date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'}))); |
|
| 576 | 576 | $content_item->setRegdate($date); |
| 577 | 577 | |
| 578 | 578 | $content_items[] = $content_item; |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | return $content_items; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - function _getTrackbackItems($args){ |
|
| 584 | + function _getTrackbackItems($args) { |
|
| 585 | 585 | // Get categories |
| 586 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 587 | - if($output->toBool() && $output->data) |
|
| 586 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 587 | + if ($output->toBool() && $output->data) |
|
| 588 | 588 | { |
| 589 | - foreach($output->data as $key => $val) { |
|
| 589 | + foreach ($output->data as $key => $val) { |
|
| 590 | 590 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 591 | 591 | } |
| 592 | 592 | } |
@@ -598,14 +598,14 @@ discard block |
||
| 598 | 598 | $oTrackbackModel = getModel('trackback'); |
| 599 | 599 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
| 600 | 600 | // If an error occurs, just ignore it. |
| 601 | - if(!$output->toBool() || !$output->data) return; |
|
| 601 | + if (!$output->toBool() || !$output->data) return; |
|
| 602 | 602 | // If the result exists, make each document as an object |
| 603 | 603 | $content_items = array(); |
| 604 | - foreach($output->data as $key => $item) |
|
| 604 | + foreach ($output->data as $key => $item) |
|
| 605 | 605 | { |
| 606 | 606 | $domain = $args->module_srls_info[$item->module_srl]->domain; |
| 607 | 607 | $category = $category_lists[$item->module_srl]->text; |
| 608 | - $url = getSiteUrl($domain,'','mid', $args->mid_lists[$item->module_srl],'document_srl',$item->document_srl); |
|
| 608 | + $url = getSiteUrl($domain, '', 'mid', $args->mid_lists[$item->module_srl], 'document_srl', $item->document_srl); |
|
| 609 | 609 | $browser_title = $args->module_srls_info[$item->module_srl]->browser_title; |
| 610 | 610 | |
| 611 | 611 | $content_item = new mcontentItem($browser_title); |
@@ -613,8 +613,8 @@ discard block |
||
| 613 | 613 | $content_item->setTitle($item->title); |
| 614 | 614 | $content_item->setCategory($category); |
| 615 | 615 | $content_item->setNickName($item->blog_name); |
| 616 | - $content_item->setContent($item->excerpt); ///<< |
|
| 617 | - $content_item->setDomain($domain); ///<< |
|
| 616 | + $content_item->setContent($item->excerpt); ///<< |
|
| 617 | + $content_item->setDomain($domain); ///<< |
|
| 618 | 618 | $content_item->setLink($url); |
| 619 | 619 | $content_item->add('mid', $args->mid_lists[$item->module_srl]); |
| 620 | 620 | $content_item->setRegdate($item->regdate); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | return $content_items; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - function _compile($args,$content_items) |
|
| 626 | + function _compile($args, $content_items) |
|
| 627 | 627 | { |
| 628 | 628 | $oTemplate = &TemplateHandler::getInstance(); |
| 629 | 629 | // Set variables for widget |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | var $contents_link = null; |
| 672 | 672 | var $domain = null; |
| 673 | 673 | |
| 674 | - function __construct($browser_title='') |
|
| 674 | + function __construct($browser_title = '') |
|
| 675 | 675 | { |
| 676 | 676 | $this->browser_title = $browser_title; |
| 677 | 677 | } |
@@ -681,58 +681,58 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | function setFirstThumbnailIdx($first_thumbnail_idx) |
| 683 | 683 | { |
| 684 | - if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) { |
|
| 684 | + if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) { |
|
| 685 | 685 | $this->has_first_thumbnail_idx = true; |
| 686 | - $this->first_thumbnail_idx= $first_thumbnail_idx; |
|
| 686 | + $this->first_thumbnail_idx = $first_thumbnail_idx; |
|
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | function setExtraImages($extra_images) |
| 690 | 690 | { |
| 691 | - $this->add('extra_images',$extra_images); |
|
| 691 | + $this->add('extra_images', $extra_images); |
|
| 692 | 692 | } |
| 693 | 693 | function setDomain($domain) |
| 694 | 694 | { |
| 695 | 695 | static $default_domain = null; |
| 696 | - if(!$domain) |
|
| 696 | + if (!$domain) |
|
| 697 | 697 | { |
| 698 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 698 | + if (is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 699 | 699 | $domain = $default_domain; |
| 700 | 700 | } |
| 701 | 701 | $this->domain = $domain; |
| 702 | 702 | } |
| 703 | 703 | function setLink($url) |
| 704 | 704 | { |
| 705 | - $this->add('url',$url); |
|
| 705 | + $this->add('url', $url); |
|
| 706 | 706 | } |
| 707 | 707 | function setTitle($title) |
| 708 | 708 | { |
| 709 | - $this->add('title',$title); |
|
| 709 | + $this->add('title', $title); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | function setThumbnail($thumbnail) |
| 713 | 713 | { |
| 714 | - $this->add('thumbnail',$thumbnail); |
|
| 714 | + $this->add('thumbnail', $thumbnail); |
|
| 715 | 715 | } |
| 716 | 716 | function setContent($content) |
| 717 | 717 | { |
| 718 | - $this->add('content',$content); |
|
| 718 | + $this->add('content', $content); |
|
| 719 | 719 | } |
| 720 | 720 | function setRegdate($regdate) |
| 721 | 721 | { |
| 722 | - $this->add('regdate',$regdate); |
|
| 722 | + $this->add('regdate', $regdate); |
|
| 723 | 723 | } |
| 724 | 724 | function setNickName($nick_name) |
| 725 | 725 | { |
| 726 | - $this->add('nick_name',$nick_name); |
|
| 726 | + $this->add('nick_name', $nick_name); |
|
| 727 | 727 | } |
| 728 | 728 | // Save author's homepage url by misol |
| 729 | 729 | function setAuthorSite($site_url) |
| 730 | 730 | { |
| 731 | - $this->add('author_site',$site_url); |
|
| 731 | + $this->add('author_site', $site_url); |
|
| 732 | 732 | } |
| 733 | 733 | function setCategory($category) |
| 734 | 734 | { |
| 735 | - $this->add('category',$category); |
|
| 735 | + $this->add('category', $category); |
|
| 736 | 736 | } |
| 737 | 737 | function getBrowserTitle() |
| 738 | 738 | { |
@@ -760,17 +760,17 @@ discard block |
||
| 760 | 760 | { |
| 761 | 761 | return $this->get('module_srl'); |
| 762 | 762 | } |
| 763 | - function getTitle($cut_size = 0, $tail='...') |
|
| 763 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 764 | 764 | { |
| 765 | 765 | $title = strip_tags($this->get('title')); |
| 766 | 766 | |
| 767 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 767 | + if ($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 768 | 768 | |
| 769 | 769 | $attrs = array(); |
| 770 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 771 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 770 | + if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 771 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 772 | 772 | |
| 773 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
| 773 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title)); |
|
| 774 | 774 | |
| 775 | 775 | return $title; |
| 776 | 776 | } |
@@ -793,12 +793,12 @@ discard block |
||
| 793 | 793 | function getCommentCount() |
| 794 | 794 | { |
| 795 | 795 | $comment_count = $this->get('comment_count'); |
| 796 | - return $comment_count>0 ? $comment_count : ''; |
|
| 796 | + return $comment_count > 0 ? $comment_count : ''; |
|
| 797 | 797 | } |
| 798 | 798 | function getTrackbackCount() |
| 799 | 799 | { |
| 800 | 800 | $trackback_count = $this->get('trackback_count'); |
| 801 | - return $trackback_count>0 ? $trackback_count : ''; |
|
| 801 | + return $trackback_count > 0 ? $trackback_count : ''; |
|
| 802 | 802 | } |
| 803 | 803 | function getRegdate($format = 'Y.m.d H:i:s') |
| 804 | 804 | { |
@@ -18,48 +18,48 @@ discard block |
||
| 18 | 18 | function proc($args) |
| 19 | 19 | { |
| 20 | 20 | // Targets to sort |
| 21 | - if(!in_array($args->order_target, array('regdate','update_order'))) $args->order_target = 'regdate'; |
|
| 21 | + if (!in_array($args->order_target, array('regdate', 'update_order'))) $args->order_target = 'regdate'; |
|
| 22 | 22 | // Sort order |
| 23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
| 23 | + if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
| 24 | 24 | // Pages |
| 25 | - $args->page_count = (int)$args->page_count; |
|
| 26 | - if(!$args->page_count) $args->page_count = 1; |
|
| 25 | + $args->page_count = (int) $args->page_count; |
|
| 26 | + if (!$args->page_count) $args->page_count = 1; |
|
| 27 | 27 | // The number of displayed lists |
| 28 | - $args->list_count = (int)$args->list_count; |
|
| 29 | - if(!$args->list_count) $args->list_count = 5; |
|
| 28 | + $args->list_count = (int) $args->list_count; |
|
| 29 | + if (!$args->list_count) $args->list_count = 5; |
|
| 30 | 30 | // The number of thumbnail columns |
| 31 | - $args->cols_list_count = (int)$args->cols_list_count; |
|
| 32 | - if(!$args->cols_list_count) $args->cols_list_count = 5; |
|
| 31 | + $args->cols_list_count = (int) $args->cols_list_count; |
|
| 32 | + if (!$args->cols_list_count) $args->cols_list_count = 5; |
|
| 33 | 33 | // Cut the length of the title |
| 34 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 34 | + if (!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 35 | 35 | // Cut the length of contents |
| 36 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 36 | + if (!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 37 | 37 | // Cut the length of nickname |
| 38 | - if(!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
| 38 | + if (!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
| 39 | 39 | // Display time of the latest post |
| 40 | - if(!$args->duration_new) $args->duration_new = 12; |
|
| 40 | + if (!$args->duration_new) $args->duration_new = 12; |
|
| 41 | 41 | // How to create thumbnails |
| 42 | - if(!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
| 42 | + if (!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
| 43 | 43 | // Horizontal size of thumbnails |
| 44 | - if(!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
| 44 | + if (!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
| 45 | 45 | // Vertical size of thumbnails |
| 46 | - if(!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
| 46 | + if (!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
| 47 | 47 | // Viewing options |
| 48 | - $args->option_view_arr = explode(',',$args->option_view); |
|
| 48 | + $args->option_view_arr = explode(',', $args->option_view); |
|
| 49 | 49 | // markup options |
| 50 | - if(!$args->markup_type) $args->markup_type = 'table'; |
|
| 50 | + if (!$args->markup_type) $args->markup_type = 'table'; |
|
| 51 | 51 | // Set variables used internally |
| 52 | 52 | $oModuleModel = getModel('module'); |
| 53 | 53 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
| 54 | 54 | $site_module_info = Context::get('site_module_info'); |
| 55 | 55 | // List URLs if a type is RSS |
| 56 | - if($args->content_type == 'rss') |
|
| 56 | + if ($args->content_type == 'rss') |
|
| 57 | 57 | { |
| 58 | 58 | $args->rss_urls = array(); |
| 59 | - $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
|
| 60 | - for($i=0,$c=count($rss_urls);$i<$c;$i++) |
|
| 59 | + $rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4)); |
|
| 60 | + for ($i = 0, $c = count($rss_urls); $i < $c; $i++) |
|
| 61 | 61 | { |
| 62 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 62 | + if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 63 | 63 | } |
| 64 | 64 | // Get module information after listing module_srls if the module is not RSS |
| 65 | 65 | } |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $obj = new stdClass(); |
| 69 | 69 | // Apply to all modules in the site if a target module is not specified |
| 70 | - if(!$args->module_srls) |
|
| 70 | + if (!$args->module_srls) |
|
| 71 | 71 | { |
| 72 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
| 72 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
| 73 | 73 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 74 | - if($output->data) |
|
| 74 | + if ($output->data) |
|
| 75 | 75 | { |
| 76 | - foreach($output->data as $key => $val) |
|
| 76 | + foreach ($output->data as $key => $val) |
|
| 77 | 77 | { |
| 78 | 78 | $args->modules_info[$val->mid] = $val; |
| 79 | 79 | $args->module_srls_info[$val->module_srl] = $val; |
@@ -89,35 +89,35 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $obj->module_srls = $args->module_srls; |
| 91 | 91 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 92 | - if($output->data) |
|
| 92 | + if ($output->data) |
|
| 93 | 93 | { |
| 94 | - foreach($output->data as $key => $val) |
|
| 94 | + foreach ($output->data as $key => $val) |
|
| 95 | 95 | { |
| 96 | 96 | $args->modules_info[$val->mid] = $val; |
| 97 | 97 | $args->module_srls_info[$val->module_srl] = $val; |
| 98 | 98 | $module_srls[] = $val->module_srl; |
| 99 | 99 | } |
| 100 | - $idx = explode(',',$args->module_srls); |
|
| 101 | - for($i=0,$c=count($idx);$i<$c;$i++) |
|
| 100 | + $idx = explode(',', $args->module_srls); |
|
| 101 | + for ($i = 0, $c = count($idx); $i < $c; $i++) |
|
| 102 | 102 | { |
| 103 | 103 | $srl = $idx[$i]; |
| 104 | - if(!$args->module_srls_info[$srl]) continue; |
|
| 104 | + if (!$args->module_srls_info[$srl]) continue; |
|
| 105 | 105 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | // Exit if no module is found |
| 110 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 111 | - $args->module_srl = implode(',',$module_srls); |
|
| 110 | + if (!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 111 | + $args->module_srl = implode(',', $module_srls); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist |
| 116 | 116 | */ |
| 117 | 117 | // tab type |
| 118 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 118 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 119 | 119 | { |
| 120 | - switch($args->content_type) |
|
| 120 | + switch ($args->content_type) |
|
| 121 | 121 | { |
| 122 | 122 | case 'comment': |
| 123 | 123 | $content_items = $this->_getCommentItems($args); |
@@ -141,17 +141,17 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $content_items = array(); |
| 143 | 143 | |
| 144 | - switch($args->content_type) |
|
| 144 | + switch ($args->content_type) |
|
| 145 | 145 | { |
| 146 | 146 | case 'comment': |
| 147 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 147 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 148 | 148 | { |
| 149 | 149 | $args->module_srl = $module_srl; |
| 150 | 150 | $content_items[$module_srl] = $this->_getCommentItems($args); |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | case 'image': |
| 154 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 154 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 155 | 155 | { |
| 156 | 156 | $args->module_srl = $module_srl; |
| 157 | 157 | $content_items[$module_srl] = $this->_getImageItems($args); |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | $content_items = $this->getRssItems($args); |
| 162 | 162 | break; |
| 163 | 163 | case 'trackback': |
| 164 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 164 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 165 | 165 | { |
| 166 | 166 | $args->module_srl = $module_srl; |
| 167 | 167 | $content_items[$module_srl] = $this->_getTrackbackItems($args); |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | default: |
| 171 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 171 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 172 | 172 | { |
| 173 | 173 | $args->module_srl = $module_srl; |
| 174 | 174 | $content_items[$module_srl] = $this->_getDocumentItems($args); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $output = $this->_compile($args,$content_items); |
|
| 180 | + $output = $this->_compile($args, $content_items); |
|
| 181 | 181 | return $output; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $content_items = array(); |
| 199 | 199 | |
| 200 | - if(!count($output)) return; |
|
| 200 | + if (!count($output)) return; |
|
| 201 | 201 | |
| 202 | - foreach($output as $key => $oComment) |
|
| 202 | + foreach ($output as $key => $oComment) |
|
| 203 | 203 | { |
| 204 | 204 | $attribute = $oComment->getObjectVars(); |
| 205 | 205 | $title = $oComment->getSummary($args->content_cut_size); |
| 206 | - $thumbnail = $oComment->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 207 | - $url = sprintf("%s#comment_%s",getUrl('','mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl')); |
|
| 206 | + $thumbnail = $oComment->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 207 | + $url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl')); |
|
| 208 | 208 | |
| 209 | 209 | $attribute->mid = $args->mid_lists[$attribute->module_srl]; |
| 210 | 210 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | // Get categories |
| 230 | 230 | $obj = new stdClass(); |
| 231 | 231 | $obj->module_srl = $args->module_srl; |
| 232 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 233 | - if($output->toBool() && $output->data) |
|
| 232 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 233 | + if ($output->toBool() && $output->data) |
|
| 234 | 234 | { |
| 235 | - foreach($output->data as $key => $val) |
|
| 235 | + foreach ($output->data as $key => $val) |
|
| 236 | 236 | { |
| 237 | 237 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 238 | 238 | } |
@@ -241,24 +241,24 @@ discard block |
||
| 241 | 241 | $obj->module_srl = $args->module_srl; |
| 242 | 242 | $obj->category_srl = $args->category_srl; |
| 243 | 243 | $obj->sort_index = $args->order_target; |
| 244 | - if($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
| 244 | + if ($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
| 245 | 245 | { |
| 246 | - $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
|
| 246 | + $obj->order_type = $args->order_type == "desc" ? "asc" : "desc"; |
|
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | - $obj->order_type = $args->order_type=="desc"?"desc":"asc"; |
|
| 250 | + $obj->order_type = $args->order_type == "desc" ? "desc" : "asc"; |
|
| 251 | 251 | } |
| 252 | 252 | $obj->list_count = $args->list_count * $args->page_count; |
| 253 | 253 | $obj->statusList = array('PUBLIC'); |
| 254 | 254 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
| 255 | - if(!$output->toBool() || !$output->data) return; |
|
| 255 | + if (!$output->toBool() || !$output->data) return; |
|
| 256 | 256 | // If the result exists, make each document as an object |
| 257 | 257 | $content_items = array(); |
| 258 | 258 | $first_thumbnail_idx = -1; |
| 259 | - if(count($output->data)) |
|
| 259 | + if (count($output->data)) |
|
| 260 | 260 | { |
| 261 | - foreach($output->data as $key => $attribute) |
|
| 261 | + foreach ($output->data as $key => $attribute) |
|
| 262 | 262 | { |
| 263 | 263 | $oDocument = new documentItem(); |
| 264 | 264 | $oDocument->setAttribute($attribute, false); |
@@ -267,26 +267,26 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | $oDocumentModel->setToAllDocumentExtraVars(); |
| 269 | 269 | |
| 270 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 270 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 271 | 271 | { |
| 272 | 272 | $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]]; |
| 273 | 273 | $document_srl = $oDocument->document_srl; |
| 274 | 274 | $module_srl = $oDocument->get('module_srl'); |
| 275 | 275 | $category_srl = $oDocument->get('category_srl'); |
| 276 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 276 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 277 | 277 | |
| 278 | - $content_item = new contentItem( $args->module_srls_info[$module_srl]->browser_title ); |
|
| 278 | + $content_item = new contentItem($args->module_srls_info[$module_srl]->browser_title); |
|
| 279 | 279 | $content_item->adds($oDocument->getObjectVars()); |
| 280 | 280 | $content_item->add('original_content', $oDocument->get('content')); |
| 281 | 281 | $content_item->setTitle($oDocument->getTitleText()); |
| 282 | - $content_item->setCategory( $category_lists[$module_srl][$category_srl]->title ); |
|
| 283 | - $content_item->setDomain( $args->module_srls_info[$module_srl]->domain ); |
|
| 282 | + $content_item->setCategory($category_lists[$module_srl][$category_srl]->title); |
|
| 283 | + $content_item->setDomain($args->module_srls_info[$module_srl]->domain); |
|
| 284 | 284 | $content_item->setContent($oDocument->getSummary($args->content_cut_size)); |
| 285 | - $content_item->setLink( getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl],'document_srl',$document_srl) ); |
|
| 285 | + $content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl)); |
|
| 286 | 286 | $content_item->setThumbnail($thumbnail); |
| 287 | 287 | $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60)); |
| 288 | 288 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
| 289 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 289 | + if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 290 | 290 | $content_items[] = $content_item; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | $obj->direct_download = 'Y'; |
| 308 | 308 | $obj->isvalid = 'Y'; |
| 309 | 309 | // Get categories |
| 310 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 311 | - if($output->toBool() && $output->data) |
|
| 310 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 311 | + if ($output->toBool() && $output->data) |
|
| 312 | 312 | { |
| 313 | - foreach($output->data as $key => $val) |
|
| 313 | + foreach ($output->data as $key => $val) |
|
| 314 | 314 | { |
| 315 | 315 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 316 | 316 | } |
@@ -319,25 +319,25 @@ discard block |
||
| 319 | 319 | $obj->list_count = $args->list_count * $args->page_count; |
| 320 | 320 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
| 321 | 321 | $files_count = count($files_output->data); |
| 322 | - if(!$files_count) return; |
|
| 322 | + if (!$files_count) return; |
|
| 323 | 323 | |
| 324 | 324 | $content_items = array(); |
| 325 | 325 | |
| 326 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 326 | + for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 327 | 327 | |
| 328 | 328 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
| 329 | 329 | |
| 330 | - if(!count($tmp_document_list)) return; |
|
| 330 | + if (!count($tmp_document_list)) return; |
|
| 331 | 331 | |
| 332 | - foreach($tmp_document_list as $oDocument) |
|
| 332 | + foreach ($tmp_document_list as $oDocument) |
|
| 333 | 333 | { |
| 334 | 334 | $attribute = $oDocument->getObjectVars(); |
| 335 | 335 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
| 336 | 336 | $domain = $args->module_srls_info[$attribute->module_srl]->domain; |
| 337 | 337 | $category = $category_lists[$attribute->module_srl]->text; |
| 338 | 338 | $content = $oDocument->getSummary($args->content_cut_size); |
| 339 | - $url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount()); |
|
| 340 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 339 | + $url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount()); |
|
| 340 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 341 | 341 | $extra_images = $oDocument->printExtraImages($args->duration_new); |
| 342 | 342 | |
| 343 | 343 | $content_item = new contentItem($browser_title); |
@@ -360,11 +360,11 @@ discard block |
||
| 360 | 360 | $content_items = array(); |
| 361 | 361 | $args->mid_lists = array(); |
| 362 | 362 | |
| 363 | - foreach($args->rss_urls as $key => $rss) |
|
| 363 | + foreach ($args->rss_urls as $key => $rss) |
|
| 364 | 364 | { |
| 365 | 365 | $args->rss_url = $rss; |
| 366 | 366 | $content_item = $this->_getRssItems($args); |
| 367 | - if(count($content_item) > 0) |
|
| 367 | + if (count($content_item) > 0) |
|
| 368 | 368 | { |
| 369 | 369 | $browser_title = $content_item[0]->getBrowserTitle(); |
| 370 | 370 | $args->mid_lists[] = $browser_title; |
@@ -372,37 +372,37 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | // If it is not a tab type |
| 375 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 375 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 376 | 376 | { |
| 377 | 377 | $items = array(); |
| 378 | - foreach($content_items as $key => $val) |
|
| 378 | + foreach ($content_items as $key => $val) |
|
| 379 | 379 | { |
| 380 | - foreach($val as $k => $v) |
|
| 380 | + foreach ($val as $k => $v) |
|
| 381 | 381 | { |
| 382 | 382 | $date = $v->get('regdate'); |
| 383 | - $i=0; |
|
| 384 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 385 | - $items[sprintf('%s%02d',$date,$i)] = $v; |
|
| 383 | + $i = 0; |
|
| 384 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
| 385 | + $items[sprintf('%s%02d', $date, $i)] = $v; |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | - if($args->order_type =='asc') ksort($items); |
|
| 388 | + if ($args->order_type == 'asc') ksort($items); |
|
| 389 | 389 | else krsort($items); |
| 390 | - $content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count); |
|
| 390 | + $content_items = array_slice(array_values($items), 0, $args->list_count * $args->page_count); |
|
| 391 | 391 | // Tab Type |
| 392 | 392 | } |
| 393 | 393 | else |
| 394 | 394 | { |
| 395 | - foreach($content_items as $key=> $content_item_list) |
|
| 395 | + foreach ($content_items as $key=> $content_item_list) |
|
| 396 | 396 | { |
| 397 | 397 | $items = array(); |
| 398 | - foreach($content_item_list as $k => $content_item) |
|
| 398 | + foreach ($content_item_list as $k => $content_item) |
|
| 399 | 399 | { |
| 400 | 400 | $date = $content_item->get('regdate'); |
| 401 | - $i=0; |
|
| 402 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 403 | - $items[sprintf('%s%02d',$date,$i)] = $content_item; |
|
| 401 | + $i = 0; |
|
| 402 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
| 403 | + $items[sprintf('%s%02d', $date, $i)] = $content_item; |
|
| 404 | 404 | } |
| 405 | - if($args->order_type =='asc') ksort($items); |
|
| 405 | + if ($args->order_type == 'asc') ksort($items); |
|
| 406 | 406 | else krsort($items); |
| 407 | 407 | |
| 408 | 408 | $content_items[$key] = array_values($items); |
@@ -413,19 +413,19 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | function _getRssBody($value) |
| 415 | 415 | { |
| 416 | - if(!$value || is_string($value)) return $value; |
|
| 417 | - if(is_object($value)) $value = get_object_vars($value); |
|
| 416 | + if (!$value || is_string($value)) return $value; |
|
| 417 | + if (is_object($value)) $value = get_object_vars($value); |
|
| 418 | 418 | $body = null; |
| 419 | - if(!count($value)) return; |
|
| 420 | - foreach($value as $key => $val) |
|
| 419 | + if (!count($value)) return; |
|
| 420 | + foreach ($value as $key => $val) |
|
| 421 | 421 | { |
| 422 | - if($key == 'body') |
|
| 422 | + if ($key == 'body') |
|
| 423 | 423 | { |
| 424 | 424 | $body = $val; |
| 425 | 425 | continue; |
| 426 | 426 | } |
| 427 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
| 428 | - if($body !== null) return $body; |
|
| 427 | + if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val); |
|
| 428 | + if ($body !== null) return $body; |
|
| 429 | 429 | } |
| 430 | 430 | return $body; |
| 431 | 431 | } |
@@ -436,17 +436,17 @@ discard block |
||
| 436 | 436 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
| 437 | 437 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
| 438 | 438 | // Remove Tag |
| 439 | - $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
| 439 | + $content = preg_replace('!<([^>]*?)>!is', '', $content); |
|
| 440 | 440 | // Replace tags to <, >, " and whitespace |
| 441 | - $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
| 441 | + $content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content); |
|
| 442 | 442 | // Delete a series of whitespaces |
| 443 | 443 | $content = preg_replace('/ ( +)/is', ' ', $content); |
| 444 | 444 | // Truncate string |
| 445 | 445 | $content = trim(cut_str($content, $str_size, $tail)); |
| 446 | 446 | // Replace back <, >, " to the original tags |
| 447 | - $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
| 447 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 448 | 448 | // Fixed to a newline bug for consecutive sets of English letters |
| 449 | - $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
| 449 | + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content); |
|
| 450 | 450 | return $content; |
| 451 | 451 | } |
| 452 | 452 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | function requestFeedContents($rss_url) |
| 458 | 458 | { |
| 459 | - $rss_url = str_replace('&','&',Context::convertEncodingStr($rss_url)); |
|
| 459 | + $rss_url = str_replace('&', '&', Context::convertEncodingStr($rss_url)); |
|
| 460 | 460 | return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml'); |
| 461 | 461 | } |
| 462 | 462 | |
@@ -468,51 +468,51 @@ discard block |
||
| 468 | 468 | $buff = $this->requestFeedContents($args->rss_url); |
| 469 | 469 | |
| 470 | 470 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
| 471 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 471 | + if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 472 | 472 | |
| 473 | 473 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
| 474 | 474 | |
| 475 | 475 | $oXmlParser = new XmlParser(); |
| 476 | 476 | $xml_doc = $oXmlParser->parse($buff); |
| 477 | - if($xml_doc->rss) |
|
| 477 | + if ($xml_doc->rss) |
|
| 478 | 478 | { |
| 479 | 479 | $rss->title = $xml_doc->rss->channel->title->body; |
| 480 | 480 | $rss->link = $xml_doc->rss->channel->link->body; |
| 481 | 481 | |
| 482 | 482 | $items = $xml_doc->rss->channel->item; |
| 483 | 483 | |
| 484 | - if(!$items) return; |
|
| 485 | - if($items && !is_array($items)) $items = array($items); |
|
| 484 | + if (!$items) return; |
|
| 485 | + if ($items && !is_array($items)) $items = array($items); |
|
| 486 | 486 | |
| 487 | 487 | $content_items = array(); |
| 488 | 488 | |
| 489 | 489 | foreach ($items as $key => $value) |
| 490 | 490 | { |
| 491 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 491 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 492 | 492 | unset($item); |
| 493 | 493 | |
| 494 | - foreach($value as $key2 => $value2) |
|
| 494 | + foreach ($value as $key2 => $value2) |
|
| 495 | 495 | { |
| 496 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 496 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 497 | 497 | $item->{$key2} = $this->_getRssBody($value2); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | $content_item = new contentItem($rss->title); |
| 501 | 501 | $content_item->setContentsLink($rss->link); |
| 502 | 502 | $content_item->setTitle($item->title); |
| 503 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 503 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 504 | 504 | //$content_item->setCategory($item->category); |
| 505 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 505 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 506 | 506 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 507 | 507 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 508 | 508 | $content_item->setLink($item->link); |
| 509 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 509 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 510 | 510 | $content_item->setRegdate($date); |
| 511 | 511 | |
| 512 | 512 | $content_items[] = $content_item; |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | - else if($xml_doc->{'rdf:rdf'}) |
|
| 515 | + else if ($xml_doc->{'rdf:rdf'}) |
|
| 516 | 516 | { |
| 517 | 517 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol |
| 518 | 518 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -520,102 +520,102 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $items = $xml_doc->{'rdf:rdf'}->item; |
| 522 | 522 | |
| 523 | - if(!$items) return; |
|
| 524 | - if($items && !is_array($items)) $items = array($items); |
|
| 523 | + if (!$items) return; |
|
| 524 | + if ($items && !is_array($items)) $items = array($items); |
|
| 525 | 525 | |
| 526 | 526 | $content_items = array(); |
| 527 | 527 | |
| 528 | 528 | foreach ($items as $key => $value) |
| 529 | 529 | { |
| 530 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 530 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 531 | 531 | unset($item); |
| 532 | 532 | |
| 533 | - foreach($value as $key2 => $value2) |
|
| 533 | + foreach ($value as $key2 => $value2) |
|
| 534 | 534 | { |
| 535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 535 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 536 | 536 | $item->{$key2} = $this->_getRssBody($value2); |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $content_item = new contentItem($rss->title); |
| 540 | 540 | $content_item->setContentsLink($rss->link); |
| 541 | 541 | $content_item->setTitle($item->title); |
| 542 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 542 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 543 | 543 | //$content_item->setCategory($item->category); |
| 544 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 544 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 545 | 545 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 546 | 546 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 547 | 547 | $content_item->setLink($item->link); |
| 548 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 548 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 549 | 549 | $content_item->setRegdate($date); |
| 550 | 550 | |
| 551 | 551 | $content_items[] = $content_item; |
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 554 | + else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 555 | 555 | { |
| 556 | 556 | // Atom 1.0 spec supported by misol |
| 557 | 557 | $rss->title = $xml_doc->feed->title->body; |
| 558 | 558 | $links = $xml_doc->feed->link; |
| 559 | - if(is_array($links)) |
|
| 559 | + if (is_array($links)) |
|
| 560 | 560 | { |
| 561 | 561 | foreach ($links as $value) |
| 562 | 562 | { |
| 563 | - if($value->attrs->rel == 'alternate') |
|
| 563 | + if ($value->attrs->rel == 'alternate') |
|
| 564 | 564 | { |
| 565 | 565 | $rss->link = $value->attrs->href; |
| 566 | 566 | break; |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 570 | + else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 571 | 571 | |
| 572 | 572 | $items = $xml_doc->feed->entry; |
| 573 | 573 | |
| 574 | - if(!$items) return; |
|
| 575 | - if($items && !is_array($items)) $items = array($items); |
|
| 574 | + if (!$items) return; |
|
| 575 | + if ($items && !is_array($items)) $items = array($items); |
|
| 576 | 576 | |
| 577 | 577 | $content_items = array(); |
| 578 | 578 | |
| 579 | 579 | foreach ($items as $key => $value) |
| 580 | 580 | { |
| 581 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 581 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 582 | 582 | unset($item); |
| 583 | 583 | |
| 584 | - foreach($value as $key2 => $value2) |
|
| 584 | + foreach ($value as $key2 => $value2) |
|
| 585 | 585 | { |
| 586 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 586 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 587 | 587 | $item->{$key2} = $this->_getRssBody($value2); |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $content_item = new contentItem($rss->title); |
| 591 | 591 | $links = $value->link; |
| 592 | - if(is_array($links)) |
|
| 592 | + if (is_array($links)) |
|
| 593 | 593 | { |
| 594 | 594 | foreach ($links as $val) |
| 595 | 595 | { |
| 596 | - if($val->attrs->rel == 'alternate') |
|
| 596 | + if ($val->attrs->rel == 'alternate') |
|
| 597 | 597 | { |
| 598 | 598 | $item->link = $val->attrs->href; |
| 599 | 599 | break; |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 603 | + else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 604 | 604 | |
| 605 | 605 | $content_item->setContentsLink($rss->link); |
| 606 | - if($item->title) |
|
| 606 | + if ($item->title) |
|
| 607 | 607 | { |
| 608 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 608 | + if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 609 | 609 | } |
| 610 | 610 | $content_item->setTitle($item->title); |
| 611 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 611 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 612 | 612 | $content_item->setAuthorSite($value->author->uri->body); |
| 613 | 613 | |
| 614 | 614 | //$content_item->setCategory($item->category); |
| 615 | 615 | $item->description = ($item->content) ? $item->content : $item->description = $item->summary; |
| 616 | - $item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description); |
|
| 616 | + $item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description); |
|
| 617 | 617 | |
| 618 | - if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 618 | + if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 619 | 619 | { |
| 620 | 620 | $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 621 | 621 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 625 | 625 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 626 | 626 | $content_item->setLink($item->link); |
| 627 | - $date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'}))); |
|
| 627 | + $date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'}))); |
|
| 628 | 628 | $content_item->setRegdate($date); |
| 629 | 629 | |
| 630 | 630 | $content_items[] = $content_item; |
@@ -637,15 +637,15 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | @preg_match('@<img[^>]+src\s*=\s*(?:"(.+)"|\'(.+)\'|([^\s>(?:/>)]+))@', $content, $matches); |
| 639 | 639 | |
| 640 | - if($matches[1]) |
|
| 640 | + if ($matches[1]) |
|
| 641 | 641 | { |
| 642 | 642 | return $matches[1]; |
| 643 | 643 | } |
| 644 | - elseif($matches[2]) |
|
| 644 | + elseif ($matches[2]) |
|
| 645 | 645 | { |
| 646 | 646 | return $matches[2]; |
| 647 | 647 | } |
| 648 | - elseif($matches[3]) |
|
| 648 | + elseif ($matches[3]) |
|
| 649 | 649 | { |
| 650 | 650 | return $matches[3]; |
| 651 | 651 | } |
@@ -658,17 +658,17 @@ discard block |
||
| 658 | 658 | function _getTrackbackItems($args) |
| 659 | 659 | { |
| 660 | 660 | $oTrackbackModel = getModel('trackback'); |
| 661 | - if(!$oTrackbackModel) |
|
| 661 | + if (!$oTrackbackModel) |
|
| 662 | 662 | { |
| 663 | 663 | return; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | $obj = new stdClass; |
| 667 | 667 | // Get categories |
| 668 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 669 | - if($output->toBool() && $output->data) |
|
| 668 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 669 | + if ($output->toBool() && $output->data) |
|
| 670 | 670 | { |
| 671 | - foreach($output->data as $key => $val) |
|
| 671 | + foreach ($output->data as $key => $val) |
|
| 672 | 672 | { |
| 673 | 673 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 674 | 674 | } |
@@ -681,14 +681,14 @@ discard block |
||
| 681 | 681 | // Get model object from the trackback module and execute getTrackbackList() method |
| 682 | 682 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
| 683 | 683 | // If an error occurs, just ignore it. |
| 684 | - if(!$output->toBool() || !$output->data) return; |
|
| 684 | + if (!$output->toBool() || !$output->data) return; |
|
| 685 | 685 | // If the result exists, make each document as an object |
| 686 | 686 | $content_items = array(); |
| 687 | - foreach($output->data as $key => $item) |
|
| 687 | + foreach ($output->data as $key => $item) |
|
| 688 | 688 | { |
| 689 | 689 | $domain = $args->module_srls_info[$item->module_srl]->domain; |
| 690 | 690 | $category = $category_lists[$item->module_srl]->text; |
| 691 | - $url = getSiteUrl($domain,'','document_srl',$item->document_srl); |
|
| 691 | + $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl); |
|
| 692 | 692 | $browser_title = $args->module_srls_info[$item->module_srl]->browser_title; |
| 693 | 693 | |
| 694 | 694 | $content_item = new contentItem($browser_title); |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | $content_item->setTitle($item->title); |
| 697 | 697 | $content_item->setCategory($category); |
| 698 | 698 | $content_item->setNickName($item->blog_name); |
| 699 | - $content_item->setContent($item->excerpt); ///<< |
|
| 700 | - $content_item->setDomain($domain); ///<< |
|
| 699 | + $content_item->setContent($item->excerpt); ///<< |
|
| 700 | + $content_item->setDomain($domain); ///<< |
|
| 701 | 701 | $content_item->setLink($url); |
| 702 | 702 | $content_item->add('mid', $args->mid_lists[$item->module_srl]); |
| 703 | 703 | $content_item->setRegdate($item->regdate); |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | return $content_items; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - function _compile($args,$content_items) |
|
| 709 | + function _compile($args, $content_items) |
|
| 710 | 710 | { |
| 711 | 711 | $oTemplate = &TemplateHandler::getInstance(); |
| 712 | 712 | // Set variables for widget |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | $widget_info->nickname_cut_size = $args->nickname_cut_size; |
| 721 | 721 | $widget_info->new_window = $args->new_window; |
| 722 | 722 | |
| 723 | - $widget_info->duration_new = $args->duration_new * 60*60; |
|
| 723 | + $widget_info->duration_new = $args->duration_new * 60 * 60; |
|
| 724 | 724 | $widget_info->thumbnail_type = $args->thumbnail_type; |
| 725 | 725 | $widget_info->thumbnail_width = $args->thumbnail_width; |
| 726 | 726 | $widget_info->thumbnail_height = $args->thumbnail_height; |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $widget_info->markup_type = $args->markup_type; |
| 740 | 740 | // If it is a tab type, list up tab items and change key value(module_srl) to index |
| 741 | - if($args->tab_type != 'none' && $args->tab_type) |
|
| 741 | + if ($args->tab_type != 'none' && $args->tab_type) |
|
| 742 | 742 | { |
| 743 | 743 | $tab = array(); |
| 744 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 744 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 745 | 745 | { |
| 746 | - if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
| 746 | + if (!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
| 747 | 747 | |
| 748 | 748 | unset($tab_item); |
| 749 | 749 | $tab_item = new stdClass(); |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $tab_item->content_items = $content_items[$module_srl]; |
| 752 | 752 | $tab_item->domain = $content_items[$module_srl][0]->getDomain(); |
| 753 | 753 | $tab_item->url = $content_items[$module_srl][0]->getContentsLink(); |
| 754 | - if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
| 754 | + if (!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '', 'mid', $mid); |
|
| 755 | 755 | $tab[] = $tab_item; |
| 756 | 756 | } |
| 757 | 757 | $widget_info->tab = $tab; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | var $contents_link = null; |
| 780 | 780 | var $domain = null; |
| 781 | 781 | |
| 782 | - function __construct($browser_title='') |
|
| 782 | + function __construct($browser_title = '') |
|
| 783 | 783 | { |
| 784 | 784 | $this->browser_title = $browser_title; |
| 785 | 785 | } |
@@ -789,22 +789,22 @@ discard block |
||
| 789 | 789 | } |
| 790 | 790 | function setFirstThumbnailIdx($first_thumbnail_idx) |
| 791 | 791 | { |
| 792 | - if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) |
|
| 792 | + if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) |
|
| 793 | 793 | { |
| 794 | 794 | $this->has_first_thumbnail_idx = true; |
| 795 | - $this->first_thumbnail_idx= $first_thumbnail_idx; |
|
| 795 | + $this->first_thumbnail_idx = $first_thumbnail_idx; |
|
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | function setExtraImages($extra_images) |
| 799 | 799 | { |
| 800 | - $this->add('extra_images',$extra_images); |
|
| 800 | + $this->add('extra_images', $extra_images); |
|
| 801 | 801 | } |
| 802 | 802 | function setDomain($domain) |
| 803 | 803 | { |
| 804 | 804 | static $default_domain = null; |
| 805 | - if(!$domain) |
|
| 805 | + if (!$domain) |
|
| 806 | 806 | { |
| 807 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 807 | + if (is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 808 | 808 | $domain = $default_domain; |
| 809 | 809 | } |
| 810 | 810 | $this->domain = $domain; |
@@ -868,17 +868,17 @@ discard block |
||
| 868 | 868 | { |
| 869 | 869 | return $this->get('module_srl'); |
| 870 | 870 | } |
| 871 | - function getTitle($cut_size = 0, $tail='...') |
|
| 871 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 872 | 872 | { |
| 873 | 873 | $title = htmlspecialchars($this->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 874 | 874 | |
| 875 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 875 | + if ($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 876 | 876 | |
| 877 | 877 | $attrs = array(); |
| 878 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 879 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 878 | + if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 879 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 880 | 880 | |
| 881 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 881 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 882 | 882 | |
| 883 | 883 | return $title; |
| 884 | 884 | } |
@@ -890,9 +890,9 @@ discard block |
||
| 890 | 890 | { |
| 891 | 891 | return $this->get('category'); |
| 892 | 892 | } |
| 893 | - function getNickName($cut_size = 0, $tail='...') |
|
| 893 | + function getNickName($cut_size = 0, $tail = '...') |
|
| 894 | 894 | { |
| 895 | - if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 895 | + if ($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 896 | 896 | else $nick_name = $this->get('nick_name'); |
| 897 | 897 | |
| 898 | 898 | return $nick_name; |
@@ -904,12 +904,12 @@ discard block |
||
| 904 | 904 | function getCommentCount() |
| 905 | 905 | { |
| 906 | 906 | $comment_count = $this->get('comment_count'); |
| 907 | - return $comment_count>0 ? $comment_count : ''; |
|
| 907 | + return $comment_count > 0 ? $comment_count : ''; |
|
| 908 | 908 | } |
| 909 | 909 | function getTrackbackCount() |
| 910 | 910 | { |
| 911 | 911 | $trackback_count = $this->get('trackback_count'); |
| 912 | - return $trackback_count>0 ? $trackback_count : ''; |
|
| 912 | + return $trackback_count > 0 ? $trackback_count : ''; |
|
| 913 | 913 | } |
| 914 | 914 | function getRegdate($format = 'Y.m.d H:i:s') |
| 915 | 915 | { |