diff --git a/.editorconfig b/.editorconfig index d433b6938..3a0b56850 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,12 +1,15 @@ root = true [*] -end_of_line = lf charset = utf-8 -trim_trailing_whitespace = false +end_of_line = lf +trim_trailing_whitespace = true insert_final_newline = true indent_style = tab +[*.md] +trim_trailing_whitespace = false + [*.py] indent_style = space indent_size = 4 @@ -14,3 +17,7 @@ indent_size = 4 [*.{json,yml,md}] indent_style = space indent_size = 2 + +[*.{jsx,tsx,svelte,vue}] +indent_style = space +indent_size = 2 diff --git a/classes/cache/CacheHandler.class.php b/classes/cache/CacheHandler.class.php index f40a5a1b6..08d972504 100644 --- a/classes/cache/CacheHandler.class.php +++ b/classes/cache/CacheHandler.class.php @@ -1,5 +1,4 @@ */ /** * CacheHandler @@ -12,7 +11,7 @@ class CacheHandler extends Handler * Force file cache. */ protected $_always_use_file = false; - + /** * Get a instance of CacheHandler(for singleton) * @@ -158,6 +157,3 @@ class CacheHandler extends Handler return Rhymix\Framework\Cache::clearGroup($keyGroupName); } } - -/* End of file CacheHandler.class.php */ -/* Location: ./classes/cache/CacheHandler.class.php */ diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 22c64a8bf..16f3c052f 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -1,5 +1,4 @@ */ /** * Manages Context such as request arguments/environment variables @@ -81,7 +80,7 @@ class Context * @var array */ public $opengraph_metadata = array(); - + /** * Canonical URL * @var string @@ -124,7 +123,7 @@ class Context * @var object */ private static $_instance = null; - + /** * Flag to prevent calling init() twice */ @@ -208,7 +207,7 @@ class Context */ private function __construct() { - + } /** @@ -224,16 +223,16 @@ class Context return; } self::$_init_called = true; - + // Obtain a singleton instance if not already given. if(self::$_instance === null) { self::$_instance = self::getInstance(); } - + // Load system configuration. self::loadDBInfo(); - + // Set information about the current request. self::_checkGlobalVars(); self::setRequestMethod(); @@ -249,7 +248,7 @@ class Context self::setRequestArguments(); } self::setUploadInfo(); - + // If Rhymix is installed, get virtual site information. if(self::isInstalled()) { @@ -279,7 +278,7 @@ class Context $site_module_info->is_default_replaced = true; self::set('site_module_info', $site_module_info); } - + // Redirect to SSL if the current domain requires SSL. if (!RX_SSL && PHP_SAPI !== 'cli' && $site_module_info->security !== 'none' && !$site_module_info->is_default_replaced) { @@ -288,12 +287,12 @@ class Context header('Location: ' . $ssl_url, true, 301); exit; } - + // Load language support. $enabled_langs = self::loadLangSelected(); $set_lang_cookie = false; self::set('lang_supported', $enabled_langs); - + if($lang_type = self::get('l')) { if($_COOKIE['lang_type'] !== $lang_type) @@ -318,13 +317,13 @@ class Context $set_lang_cookie = true; } } - + $lang_type = preg_replace('/[^a-zA-Z0-9_-]/', '', $lang_type); if ($set_lang_cookie) { setcookie('lang_type', $lang_type, time() + 86400 * 365, \RX_BASEURL, null, !!config('session.use_ssl_cookies')); } - + if(!$lang_type || !isset($enabled_langs[$lang_type])) { if(isset($site_module_info->settings->language) && $site_module_info->settings->language !== 'default') @@ -346,13 +345,13 @@ class Context $lang->loadDirectory(RX_BASEDIR . 'modules/module/lang', 'module'); self::setLangType(self::$_instance->lang_type = $lang_type); self::set('lang', self::$_instance->lang = $lang); - + // Set global variables for backward compatibility. $GLOBALS['oContext'] = self::$_instance; $GLOBALS['__Context__'] = &self::$_tpl_vars; $GLOBALS['_time_zone'] = config('locale.default_timezone'); $GLOBALS['lang'] = &$lang; - + // set session handler if(self::isInstalled() && config('session.use_db')) { @@ -363,14 +362,14 @@ class Context array($oSessionController, 'open'), array($oSessionController, 'close'), array($oSessionModel, 'read'), array($oSessionController, 'write'), array($oSessionController, 'destroy'), array($oSessionController, 'gc') ); } - + // start session if (\PHP_SAPI !== 'cli') { Rhymix\Framework\Session::checkSSO($site_module_info); Rhymix\Framework\Session::start(false); } - + // start output buffer if (\PHP_SAPI !== 'cli') { @@ -390,10 +389,10 @@ class Context self::set('logged_info', false); } } - + // start debugging Rhymix\Framework\Debug::isEnabledForCurrentUser(); - + // set locations for javascript use $current_url = $request_uri = self::getRequestUri(); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET' && self::$_get_vars) @@ -413,10 +412,10 @@ class Context } self::set('current_url', $current_url); self::set('request_uri', $request_uri); - + // set mobile status self::set('m', Mobile::isFromMobilePhone() ? 1 : 0); - + // If the site is locked, display the locked page. if(config('lock.locked')) { @@ -426,7 +425,7 @@ class Context /** * Get the session status - * + * * @return bool */ public static function getSessionStatus() @@ -436,7 +435,7 @@ class Context /** * Start the session if $_SESSION was touched - * + * * @return void */ public static function checkSessionStatus($force = false) @@ -456,7 +455,7 @@ class Context { DisplayHandler::getDebugInfo(); } - + // Check session status and close it if open. if (Rhymix\Framework\Session::checkStart()) { @@ -500,7 +499,7 @@ class Context { $config = Rhymix\Framework\Config::getAll(); } - + // Copy to old format for backward compatibility. self::$_instance->db_info = new stdClass; if (is_array($config) && count($config)) @@ -582,12 +581,12 @@ class Context { return $default_url; } - + if ($site_module_info === null) { $site_module_info = self::get('site_module_info'); } - + $prefix = ($site_module_info->security !== 'none' || $use_ssl) ? 'https://' : 'http://'; $hostname = $site_module_info->domain; $port = ($prefix === 'https://') ? $site_module_info->https_port : $site_module_info->http_port; @@ -751,7 +750,7 @@ class Context /** * Return site title - * + * * @return string */ public static function getSiteTitle() @@ -766,10 +765,10 @@ class Context return ''; } } - + /** * Return site subtitle - * + * * @return string */ public static function getSiteSubtitle() @@ -808,13 +807,13 @@ class Context $path = \RX_BASEDIR . $matches[1] . '/' . $matches[2] . '/lang'; $plugin_name = $matches[2]; } - + if (!(($GLOBALS['lang'] ?? null) instanceof Rhymix\Framework\Lang)) { $GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko'); $GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); } - + return $GLOBALS['lang']->loadDirectory($path, $plugin_name); } @@ -830,7 +829,7 @@ class Context { self::$_instance->db_info = new stdClass; } - + self::$_instance->db_info->lang_type = $lang_type; self::$_instance->lang_type = $lang_type; self::set('lang_type', $lang_type); @@ -864,7 +863,7 @@ class Context $GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko'); $GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); } - + return $GLOBALS['lang']->get($code); } @@ -882,7 +881,7 @@ class Context $GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko'); $GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); } - + $GLOBALS['lang']->set($code, $val); } @@ -900,7 +899,7 @@ class Context $lang = ModuleAdminController::getInstance()->makeCacheDefinedLangCode(0); } } - + return preg_replace_callback('/\$user_lang->([a-zA-Z0-9\_]+)/', function($matches) use($lang) { if(isset($lang[$matches[1]]) && !self::get($matches[1])) { @@ -912,7 +911,7 @@ class Context } }, $output); } - + /** * Convert strings of variables in $source_object into UTF-8 * @@ -1017,7 +1016,7 @@ class Context /** * Encode UTF-8 domain into IDNA (punycode) - * + * * @param string $domain Domain to convert * @return string Converted string */ @@ -1028,7 +1027,7 @@ class Context /** * Convert IDNA (punycode) domain into UTF-8 - * + * * @param string $domain Domain to convert * @return string Converted string */ @@ -1116,7 +1115,7 @@ class Context { self::$_instance->request_method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; } - + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') { // Set variables for XE compatibility. @@ -1132,7 +1131,7 @@ class Context { $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); } - + // Check the Content-Type header for a hint of JSON. foreach (array('HTTP_ACCEPT', 'HTTP_CONTENT_TYPE', 'CONTENT_TYPE') as $header) { @@ -1142,7 +1141,7 @@ class Context return; } } - + // Decide whether it's JSON or XMLRPC by looking at the first character of the POST data. if (!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) { @@ -1170,7 +1169,7 @@ class Context $request_args[$key] = $val; } } - + // Set JSON and XMLRPC arguments. if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && !$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) { @@ -1199,7 +1198,7 @@ class Context parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); } } - + foreach($params as $key => $val) { if ($val !== '' && $val !== null && !isset($request_args[$key])) @@ -1207,13 +1206,13 @@ class Context $request_args[$key] = $val; } } - + if (!empty($params['_rx_csrf_token']) && !isset($_REQUEST['_rx_csrf_token'])) { $_REQUEST['_rx_csrf_token'] = $params['_rx_csrf_token']; } } - + // Filter all arguments and set them to Context. foreach($request_args as $key => $val) { @@ -1225,10 +1224,10 @@ class Context } } } - + /** * Handle uploaded file info. - * + * * @return void */ private static function setUploadInfo() @@ -1302,7 +1301,7 @@ class Context /** * Check if a value (or array of values) matches a pattern defined in this class. - * + * * @param mixed $val Values to check * @return bool */ @@ -1334,7 +1333,7 @@ class Context } } } - + return true; } @@ -1355,7 +1354,7 @@ class Context foreach($val as $_key => $_val) { unset($_val->node_name, $_val->attrs); - + $args = new stdClass; foreach((array)$_val as $name => $node) { @@ -1363,7 +1362,7 @@ class Context { $node = array($node); } - + if($name == 'body' && count((array)$_val) === 1) { $_val = self::_filterRequestVar($key, $node); @@ -1381,7 +1380,7 @@ class Context } $result[escape($_key)] = !empty((array)$args) ? $args : $_val; } - + return $is_array ? $result : $result[0]; } @@ -1399,7 +1398,7 @@ class Context { return; } - + $result = array(); if(!$is_array = is_array($val)) { @@ -1438,7 +1437,7 @@ class Context $result[escape($_key)] = $_val; self::_recursiveCheckVar($_val); } - + return $is_array ? $result : $result[0]; } @@ -1477,7 +1476,7 @@ class Context { return; } - + // Allow if the current user is in the list of allowed IPs. if (PHP_SAPI === 'cli') { @@ -1487,7 +1486,7 @@ class Context { return; } - + // Set headers and constants for backward compatibility. header('HTTP/1.1 503 Service Unavailable'); define('_XE_SITELOCK_', TRUE); @@ -1495,7 +1494,7 @@ class Context define('_XE_SITELOCK_MESSAGE_', config('lock.message')); unset($_SESSION['XE_VALIDATOR_RETURN_URL']); self::$_instance->is_site_locked = true; - + // Load the sitelock template. if(FileHandler::exists(RX_BASEDIR . 'common/tpl/sitelock.user.html')) { @@ -1507,10 +1506,10 @@ class Context } exit; } - + /** * Display a generic error page and exit. - * + * * @param string $title * @param string $message * @return void @@ -1519,11 +1518,11 @@ class Context { // Change current directory to the Rhymix installation path. chdir(\RX_BASEDIR); - + // Set the title. self::setBrowserTitle(self::getSiteTitle()); self::addBrowserTitle($title); - + // Set the message. $oMessageObject = getView('message'); $oMessageObject->setError(-1); @@ -1531,7 +1530,7 @@ class Context { $oMessageObject->setHttpStatusCode($status); } - + // Find out the caller's location. if (!$location) { @@ -1543,7 +1542,7 @@ class Context $location = substr($location, strlen(\RX_BASEDIR)); } } - + if (in_array(self::getRequestMethod(), array('XMLRPC', 'JSON', 'JS_CALLBACK'))) { $oMessageObject->setMessage(trim($title . "\n\n" . $message)); @@ -1553,7 +1552,7 @@ class Context $oMessageObject->setMessage($title); $oMessageObject->dispMessage($message, $location); } - + // Display the message. $oModuleHandler = new ModuleHandler; $oModuleHandler->displayContent($oMessageObject); @@ -1610,7 +1609,7 @@ class Context { $rewrite_level = Rhymix\Framework\Router::getRewriteLevel(); } - + if ($site_module_info === null) { $site_module_info = self::get('site_module_info'); @@ -1697,12 +1696,12 @@ class Context } } } - + // remove vid, rnd, error_return_url unset($get_vars['error_return_url']); unset($get_vars['rnd']); unset($get_vars['vid']); - + // for compatibility to lower versions $act = $get_vars['act'] ?? null; $act_alias = array( @@ -1715,7 +1714,7 @@ class Context { $get_vars['act'] = $act_alias[$act]; } - + // Don't use full short URL for admin pages #1643 if (isset($get_vars['module']) && $get_vars['module'] === 'admin' && $rewrite_level > 1) { @@ -1725,14 +1724,14 @@ class Context { $force_rewrite_level = 0; } - + // organize URL $query = ''; if(count($get_vars) > 0) { $query = Rhymix\Framework\Router::getURL($get_vars, $force_rewrite_level ?: $rewrite_level); } - + // If using SSL always if($site_module_info->security !== 'none') { @@ -1833,7 +1832,7 @@ class Context } $site_module_info = $domain_infos[$domain] ?: $site_module_info; } - + $prefix = ($use_ssl || $site_module_info->security !== 'none') ? 'https://' : 'http://'; $hostname = $site_module_info->domain; $port = ($use_ssl || $site_module_info->security !== 'none') ? $site_module_info->https_port : $site_module_info->http_port; @@ -1856,7 +1855,7 @@ class Context trigger_error('Called Context::set() with an empty key', \E_USER_WARNING); return; } - + self::$_tpl_vars->{$key} = $val; if($set_to_get_vars || isset(self::$_get_vars->{$key})) @@ -1885,7 +1884,7 @@ class Context trigger_error('Called Context::get() with an empty key', \E_USER_WARNING); return; } - + if(isset(self::$_tpl_vars->{$key})) { return self::$_tpl_vars->{$key}; @@ -1949,7 +1948,7 @@ class Context /** * Clear all values from GET/POST/XMLRPC - * + * * @return void */ public static function clearRequestVars() @@ -1959,7 +1958,7 @@ class Context /** * Clear all user-set values - * + * * @return void */ public static function clearUserVars() @@ -1976,7 +1975,7 @@ class Context */ public static function addSSLAction($action) { - + } /** @@ -1988,7 +1987,7 @@ class Context */ public static function addSSLActions($action_array) { - + } /** @@ -2000,7 +1999,7 @@ class Context */ public static function subtractSSLAction($action) { - + } /** @@ -2092,7 +2091,7 @@ class Context { $args = func_get_args(); } - + self::$_oFrontEndFileHandler->loadFile($args); } @@ -2419,7 +2418,7 @@ class Context /** * Remove all content added by addHtmlHeader() - * + * * @return void */ public static function clearHtmlHeader() @@ -2544,7 +2543,7 @@ class Context /** * Set a validator message - * + * * @param string $id * @param string $message * @param string $type (optional) @@ -2601,7 +2600,7 @@ class Context /** * Check whether an addon, layout, module, or widget is distributed with Rhymix core. - * + * * @param string $plugin_name * @param string $type * @return bool @@ -2616,13 +2615,13 @@ class Context self::$_default_plugins = array(); } } - + return isset(self::$_default_plugins[$type][$plugin_name]); } - + /** * Check whether an addon, module, or widget is blacklisted - * + * * @param string $plugin_name * @param string $type * @return bool @@ -2637,7 +2636,7 @@ class Context self::$_blacklist = array(); } } - + if ($type) { return isset(self::$_blacklist[$type][$plugin_name]); @@ -2657,7 +2656,7 @@ class Context /** * Check whether a word is reserved in Rhymix - * + * * @param string $word * @return bool */ @@ -2671,7 +2670,7 @@ class Context self::$_reserved_words = array(); } } - + return isset(self::$_reserved_words[$word]); } @@ -2734,7 +2733,7 @@ class Context /** * Get meta tag - * + * * @param string $name (optional) * @return array The list of meta tags */ @@ -2744,7 +2743,7 @@ class Context { return isset(self::$_instance->meta_tags[$name]) ? self::$_instance->meta_tags[$name]['content'] : null; } - + $ret = array(); foreach(self::$_instance->meta_tags as $name => $content) { @@ -2769,17 +2768,17 @@ class Context 'content' => self::replaceUserLang($content), ); } - + /** * Get meta images - * + * * @return array */ public static function getMetaImages() { return self::$_instance->meta_images; } - + /** * Add meta image * @@ -2805,10 +2804,10 @@ class Context 'height' => $height, ); } - + /** * Get OpenGraph metadata - * + * * @return array */ public static function getOpenGraphData() @@ -2824,10 +2823,10 @@ class Context } return $ret; } - + /** * Add OpenGraph metadata - * + * * @param string $name * @param mixed $content * @return void @@ -2846,10 +2845,10 @@ class Context self::$_instance->opengraph_metadata[] = array($name, $content); } } - + /** * Set canonical URL - * + * * @param string $url * @return void */ @@ -2858,10 +2857,10 @@ class Context self::$_instance->canonical_url = escape($url, false); self::addOpenGraphData('og:url', self::$_instance->canonical_url); } - + /** * Get canonical URL - * + * * @return string */ public static function getCanonicalURL() @@ -2869,5 +2868,3 @@ class Context return self::$_instance->canonical_url; } } -/* End of file Context.class.php */ -/* Location: ./classes/context/Context.class.php */ diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index b9a05b4a7..a5c8dbc51 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -1,13 +1,9 @@ */ /** - * @class DisplayHandler + * DisplayHandler + * * @author NAVER (developers@xpressengine.com) - * DisplayHandler is responsible for displaying the execution result. \n - * Depending on the request type, it can display either HTML or XML content.\n - * Xml content is simple xml presentation of variables in oModule while html content - * is the combination of the variables of oModue and template files/. */ class DisplayHandler extends Handler { @@ -57,7 +53,7 @@ class DisplayHandler extends Handler { $handler = new HTMLDisplayHandler(); } - + // Handle error location info if ($location = $oModule->get('rx_error_location')) { @@ -151,16 +147,16 @@ class DisplayHandler extends Handler print $output; print $debug; } - + /** * Get debug information. - * + * * @return string */ public static function getDebugInfo(&$output = null) { // Check if debugging information has already been printed. - + if (self::$debug_printed) { return; @@ -169,13 +165,13 @@ class DisplayHandler extends Handler { self::$debug_printed = 1; } - + // Check if debugging is enabled for this request. if (!Rhymix\Framework\Debug::isEnabledForCurrentUser()) { return; } - + // Do not display debugging information if there is no output. $display_types = config('debug.display_type') ?: []; if ($display_types && !is_array($display_types)) @@ -186,7 +182,7 @@ class DisplayHandler extends Handler { return; } - + // Print debug information. $debug_output = ''; $response_type = Context::getResponseMethod(); @@ -234,7 +230,7 @@ class DisplayHandler extends Handler } } } - + switch ($response_type) { case 'HTML': @@ -293,7 +289,7 @@ class DisplayHandler extends Handler } } } - + return $debug_output; } @@ -323,10 +319,10 @@ class DisplayHandler extends Handler { header("Content-Type: application/json; charset=UTF-8"); } - + /** * print a custom Content-Type header. - * + * * @param string $content_type * @return void */ @@ -347,5 +343,3 @@ class DisplayHandler extends Handler } } -/* End of file DisplayHandler.class.php */ -/* Location: ./classes/display/DisplayHandler.class.php */ diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index d47da79a0..970928c46 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -1,5 +1,4 @@ */ class HTMLDisplayHandler { @@ -10,12 +9,12 @@ class HTMLDisplayHandler public const JQUERY_V2_MIGRATE = '1.4.1'; public const JQUERY_V3 = '3.6.3'; public const JQUERY_V3_MIGRATE = '3.4.0'; - + /** * Default viewport setting */ public const DEFAULT_VIEWPORT = 'width=device-width, initial-scale=1.0, user-scalable=yes'; - + /** * Reserved scripts */ @@ -37,12 +36,12 @@ class HTMLDisplayHandler '@\beditor/skins/xpresseditor/js/xe_textarea\.(?:min\.)?js@' => 'editor/skins/ckeditor/js/xe_textarea.js', '@/lang$@' => '/lang/lang.xml', ); - + /** * Image type information for SEO */ protected $_image_type = 'none'; - + /** * Produce HTML compliant content given a module object.\n * @param ModuleObject $oModule the module object @@ -171,7 +170,7 @@ class HTMLDisplayHandler $GLOBALS['__layout_compile_elapsed__'] = microtime(true) - $start; } } - + // Add OpenGraph and Twitter metadata if (config('seo.og_enabled') && Context::get('module') !== 'admin') { @@ -189,7 +188,7 @@ class HTMLDisplayHandler $mobicon_url = $oAdminModel->getMobileIconUrl($site_module_info->domain_srl); Context::set('favicon_url', $favicon_url); Context::set('mobicon_url', $mobicon_url); - + return $output; } @@ -234,10 +233,10 @@ class HTMLDisplayHandler $pattern = '/href=(["\'])(\?[^"\']+)/s'; $output = preg_replace($pattern, 'href=$1' . \RX_BASEURL . '$2', $output); } - + // prevent the 2nd request due to url(none) of the background-image $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); - + $INPUT_ERROR = Context::get('INPUT_ERROR'); if(is_array($INPUT_ERROR) && count($INPUT_ERROR)) { @@ -266,10 +265,10 @@ class HTMLDisplayHandler $this->_loadDesktopJSCSS(); } $output = $oTemplate->compile('./common/tpl', 'common_layout'); - + // replace the user-defined-language $output = Context::replaceUserLang($output); - + // remove template path comment tag /* if(!Rhymix\Framework\Debug::isEnabledForCurrentUser()) @@ -420,7 +419,7 @@ class HTMLDisplayHandler /** * Add OpenGraph metadata tags. - * + * * @return void */ function _addOpenGraphMetadata() @@ -455,14 +454,14 @@ class HTMLDisplayHandler } } } - + // Get existing metadata. $og_data = array(); foreach (Context::getOpenGraphData() as $val) { $og_data[$val['property']] = $val['content']; } - + // Add basic metadata. Context::addOpenGraphData('og:title', $permitted ? Context::getBrowserTitle() : lang('msg_not_permitted')); Context::addOpenGraphData('og:site_name', Context::getSiteTitle()); @@ -479,7 +478,7 @@ class HTMLDisplayHandler Context::addOpenGraphData('og:description', $description); Context::addMetaTag('description', $description); } - + // Add metadata about this page. if (!isset($og_data['og:type'])) { @@ -506,7 +505,7 @@ class HTMLDisplayHandler Context::addOpenGraphData('og:url', $canonical_url); Context::setCanonicalURL($canonical_url); } - + // Add metadata about the locale. $lang_type = Context::getLangType(); $locales = (include \RX_BASEDIR . 'common/defaults/locales.php'); @@ -518,7 +517,7 @@ class HTMLDisplayHandler { Context::addOpenGraphData('og:locale:alternate', $locales[$oDocument->getLangCode()]); } - + // Add image. if ($document_images = Context::getMetaImages()) { @@ -535,20 +534,20 @@ class HTMLDisplayHandler usort($document_files, function($a, $b) { return ord($b->cover_image) - ord($a->cover_image); }); - + foreach ($document_files as $file) { if ($file->isvalid !== 'Y' || !preg_match('/\.(?:bmp|gif|jpe?g|png)$/i', $file->uploaded_filename)) { continue; } - + list($width, $height) = @getimagesize($file->uploaded_filename); if ($width < 100 && $height < 100) { continue; } - + $document_images[] = array('filepath' => $file->uploaded_filename, 'width' => $width, 'height' => $height); break; } @@ -560,7 +559,7 @@ class HTMLDisplayHandler { $document_images = null; } - + if ($document_images) { $first_image = array_first($document_images); @@ -584,7 +583,7 @@ class HTMLDisplayHandler { $this->_image_type = 'none'; } - + // Add tags and hashtags for articles. if ($page_type === 'article' && $permitted) { @@ -596,7 +595,7 @@ class HTMLDisplayHandler Context::addOpenGraphData('og:article:tag', $tag, false); } } - + if (config('seo.og_extract_hashtags')) { $hashtags = $oDocument->getHashtags(); @@ -608,17 +607,17 @@ class HTMLDisplayHandler } } } - + Context::addOpenGraphData('og:article:section', Context::replaceUserLang($current_module_info->browser_title)); } - + // Add author name for articles. if ($page_type === 'article' && $permitted && config('seo.og_use_nick_name')) { Context::addMetaTag('author', $oDocument->getNickName()); Context::addOpenGraphData('og:article:author', $oDocument->getNickName()); } - + // Add datetime for articles. if ($page_type === 'article' && $permitted && config('seo.og_use_timestamps')) { @@ -626,17 +625,17 @@ class HTMLDisplayHandler Context::addOpenGraphData('og:article:modified_time', $oDocument->getUpdate('c')); } } - + /** * Add Twitter metadata tags. - * + * * @return void */ function _addTwitterMetadata() { $card_type = $this->_image_type === 'document' ? 'summary_large_image' : 'summary'; Context::addMetaTag('twitter:card', $card_type); - + foreach(Context::getOpenGraphData() as $val) { if ($val['property'] === 'og:title') @@ -686,9 +685,9 @@ class HTMLDisplayHandler $jquery_version = self::JQUERY_V2; $jquery_migrate_version = self::JQUERY_V2_MIGRATE; } - + Context::loadFile(array('./common/css/rhymix.scss', '', '', -1600000000), true); - + $original_file_list = array( 'plugins/jquery.migrate/jquery-migrate-' . $jquery_migrate_version . '.min.js', 'plugins/cookie/js.cookie.min.js', @@ -700,7 +699,7 @@ class HTMLDisplayHandler 'xml_handler.js', 'xml_js_filter.js', ); - + if(config('view.minify_scripts') === 'none') { Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.js', 'head', '', -1800000000), true); @@ -734,5 +733,3 @@ class HTMLDisplayHandler } } } -/* End of file HTMLDisplayHandler.class.php */ -/* Location: ./classes/display/HTMLDisplayHandler.class.php */ diff --git a/classes/display/JSCallbackDisplayHandler.php b/classes/display/JSCallbackDisplayHandler.php index 2926a5066..13cd92c23 100644 --- a/classes/display/JSCallbackDisplayHandler.php +++ b/classes/display/JSCallbackDisplayHandler.php @@ -1,5 +1,4 @@ */ class JSCallbackDisplayHandler { @@ -21,5 +20,3 @@ class JSCallbackDisplayHandler ', Context::getJSCallbackFunc(), json_encode($variables)); } } -/* End of file JSCallback.class.php */ -/* Location: ./classes/display/JSCallback.class.php */ diff --git a/classes/display/JSONDisplayHandler.php b/classes/display/JSONDisplayHandler.php index 7e7fc61a1..dc77d3f24 100644 --- a/classes/display/JSONDisplayHandler.php +++ b/classes/display/JSONDisplayHandler.php @@ -1,5 +1,4 @@ */ class JSONDisplayHandler { @@ -14,14 +13,14 @@ class JSONDisplayHandler $variables = $oModule->getVariables(); $variables['error'] = $oModule->getError(); $variables['message'] = $oModule->getMessage(); - + self::_convertCompat($variables, Context::getRequestMethod()); return json_encode($variables); } - + /** * Convert arrays in a format that is compatible with XE. - * + * * @param array $array * @param string $compat_type * @return array @@ -51,10 +50,10 @@ class JSONDisplayHandler } } } - + /** * Check if an array only has numeric keys. - * + * * @param array $array * @return bool */ @@ -74,5 +73,3 @@ class JSONDisplayHandler return true; } } -/* End of file JSONDisplayHandler.class.php */ -/* Location: ./classes/display/JSONDisplayHandler.class.php */ diff --git a/classes/display/VirtualXMLDisplayHandler.php b/classes/display/VirtualXMLDisplayHandler.php index 92095cbb0..bd71ec674 100644 --- a/classes/display/VirtualXMLDisplayHandler.php +++ b/classes/display/VirtualXMLDisplayHandler.php @@ -1,5 +1,4 @@ */ class VirtualXMLDisplayHandler { @@ -57,13 +56,11 @@ class VirtualXMLDisplayHandler $html[] = ' parent.location.href = ' . json_encode($output->url) . ';'; $html[] = '}'; } - + $html[] = ''; $html[] = ''; - + return join("\n", $html); } } -/* End of file VirtualXMLDisplayHandler.class.php */ -/* Location: ./classes/display/VirtualXMLDisplayHandler.class.php */ diff --git a/classes/display/XMLDisplayHandler.php b/classes/display/XMLDisplayHandler.php index 7ac08b88b..27b753038 100644 --- a/classes/display/XMLDisplayHandler.php +++ b/classes/display/XMLDisplayHandler.php @@ -1,5 +1,4 @@ */ class XMLDisplayHandler { @@ -26,7 +25,7 @@ class XMLDisplayHandler /** * produce XML code given variable object\n - * @param object $obj + * @param object $obj * @return string */ function _makeXmlDoc($obj) @@ -63,5 +62,3 @@ class XMLDisplayHandler } } -/* End of file XMLDisplayHandler.class.php */ -/* Location: ./classes/display/XMLDisplayHandler.class.php */ diff --git a/classes/editor/EditorHandler.class.php b/classes/editor/EditorHandler.class.php index 88810cf0f..25f5f0b11 100644 --- a/classes/editor/EditorHandler.class.php +++ b/classes/editor/EditorHandler.class.php @@ -1,9 +1,7 @@ */ /** - * Superclass of the edit component. - * Set up the component variables + * Superclass of the editor component. * * @class EditorHandler * @author NAVER (developers@xpressengine.com) @@ -32,5 +30,3 @@ class EditorHandler extends BaseObject } } -/* End of file EditorHandler.class.php */ -/* Location: ./classes/editor/EditorHandler.class.php */ diff --git a/classes/extravar/Extravar.class.php b/classes/extravar/Extravar.class.php index 9d5d0e534..0c37dbe1e 100644 --- a/classes/extravar/Extravar.class.php +++ b/classes/extravar/Extravar.class.php @@ -1,5 +1,4 @@ */ /** * A class to handle extra variables used in posts, member and others @@ -45,7 +44,7 @@ class ExtraVar /** * Register a key of extra variable - * + * * @param object[] $extra_keys Array of extra variable. A value of array is object that contains module_srl, idx, name, default, desc, is_required, search, value, eid. * @return void */ @@ -359,13 +358,13 @@ class ExtraItem return $country_name; case 'textarea' : return nl2br($value); - + case 'date' : return $value ? sprintf('%s-%s-%s', substr($value, 0, 4), substr($value, 4, 2), substr($value, 6, 2)) : ''; case 'language': return Rhymix\Framework\Lang::getSupportedList()[$value]['name']; - + case 'timezone': return Rhymix\Framework\DateTime::getTimezoneList()[$value]; case 'checkbox' : @@ -480,7 +479,7 @@ class ExtraItem { $selected = ' selected="selected"'; } - + $buff[] = ' '; } $buff[] = ''; @@ -560,7 +559,7 @@ class ExtraItem Context::loadJavascriptPlugin('ui.datepicker'); $formattedValue = $value ? sprintf('%s-%s-%s', substr($value, 0, 4), substr($value, 4, 2), substr($value, 6, 2)) : ''; - $buff[] = ''; + $buff[] = ''; $buff[] = ''; $buff[] = ''; $buff[] = '', json_encode(strval($_POST['_rx_ajax_form'])), json_encode($data)); return; } - + // Handle redirects. if($oModule->getRedirectUrl()) { @@ -1038,7 +1033,7 @@ class ModuleHandler extends Handler return; } } - + // If error occurred, handle it if($this->error) { @@ -1050,7 +1045,7 @@ class ModuleHandler extends Handler { $oMessageObject->setTemplateFile('http_status_code'); } - + // If module was called normally, change the templates of the module into ones of the message view module if($oModule) { @@ -1063,7 +1058,7 @@ class ModuleHandler extends Handler { $oModule = $oMessageObject; } - + self::_clearErrorSession(); } @@ -1118,7 +1113,7 @@ class ModuleHandler extends Handler { $oMenuAdminController = getAdminController('menu'); $homeMenuCacheFile = null; - + foreach($layout_info->menu as $menu_id => $menu) { // No menu selected if($menu->menu_srl == 0) @@ -1139,12 +1134,12 @@ class ModuleHandler extends Handler { include($homeMenuCacheFile); } - + $menu->xml_file = './files/cache/menu/' . $homeMenuSrl . '.xml.php'; $menu->php_file = './files/cache/menu/' . $homeMenuSrl . '.php'; $menu->menu_srl = $homeMenuSrl; } - + $php_file = FileHandler::exists($menu->php_file); if(!$php_file) { @@ -1156,7 +1151,7 @@ class ModuleHandler extends Handler include($php_file); } } - + Context::set($menu_id, $menu); } } @@ -1190,16 +1185,16 @@ class ModuleHandler extends Handler } } } - + // Set http status code if($this->httpStatusCode && $oModule->getHttpStatusCode() === 200) { $oModule->setHttpStatusCode($this->httpStatusCode); } - + // Set http status message self::_setHttpStatusMessage($oModule->getHttpStatusCode()); - + // Display contents $oDisplayHandler = new DisplayHandler(); $oDisplayHandler->printContent($oModule); @@ -1264,7 +1259,7 @@ class ModuleHandler extends Handler { $triggers = array(); } - + foreach($triggers as $item) { $module = $item->module; @@ -1289,13 +1284,13 @@ class ModuleHandler extends Handler { continue; } - + // do not call if module is blacklisted if (Context::isBlacklistedPlugin($oModule->module)) { continue; } - + try { $before_each_trigger_time = microtime(true); @@ -1310,7 +1305,7 @@ class ModuleHandler extends Handler if ($trigger_name !== 'common.flushDebugInfo') { $trigger_target = $module . ($type === 'class' ? '' : $type) . '.' . $called_method; - + if (Rhymix\Framework\Debug::isEnabledForCurrentUser()) { Rhymix\Framework\Debug::addTrigger(array( @@ -1364,7 +1359,7 @@ class ModuleHandler extends Handler { $trigger_target = 'closure'; } - + if (Rhymix\Framework\Debug::isEnabledForCurrentUser()) { Rhymix\Framework\Debug::addTrigger(array( @@ -1472,5 +1467,3 @@ class ModuleHandler extends Handler } } -/* End of file ModuleHandler.class.php */ -/* Location: ./classes/module/ModuleHandler.class.php */ diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index aa4dc8422..d6baa5539 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -1,10 +1,9 @@ */ /** - * @class ModuleObject + * ModuleObject + * * @author NAVER (developers@xpressengine.com) - * base class of ModuleHandler */ class ModuleObject extends BaseObject { @@ -52,7 +51,7 @@ class ModuleObject extends BaseObject /** * Singleton - * + * * @param string $module_hint (optional) * @return static */ @@ -97,7 +96,7 @@ class ModuleObject extends BaseObject /** * setter to set the name of module - * + * * @param string $module name of module * @return $this */ @@ -109,7 +108,7 @@ class ModuleObject extends BaseObject /** * setter to set the name of module path - * + * * @param string $path the directory path to a module directory * @return $this */ @@ -125,7 +124,7 @@ class ModuleObject extends BaseObject /** * setter to set an url for redirection - * + * * @param string $url url for redirection * @return $this */ @@ -145,7 +144,7 @@ class ModuleObject extends BaseObject /** * get url for redirection - * + * * @return string */ public function getRedirectUrl() @@ -157,7 +156,7 @@ class ModuleObject extends BaseObject * Set the template path for refresh.html * refresh.html is executed as a result of method execution * Tpl as the common run of the refresh.html .. - * + * * @deprecated * @return $this */ @@ -170,7 +169,7 @@ class ModuleObject extends BaseObject /** * Set the action name - * + * * @param string $act * @return $this */ @@ -179,10 +178,10 @@ class ModuleObject extends BaseObject $this->act = $act; return $this; } - + /** * Set module information - * + * * @param object $module_info object containing module information * @param object $xml_info object containing module description * @return $this @@ -197,14 +196,14 @@ class ModuleObject extends BaseObject $this->xml_info = $xml_info; $this->skin_vars = $module_info->skin_vars ?? null; $this->module_config = ModuleModel::getInstance()->getModuleConfig($this->module, $module_info->site_srl); - + // Set privileges(granted) information if($this->setPrivileges() !== true) { $this->stop('msg_not_permitted'); return; } - + // Set admin layout if(preg_match('/^disp[A-Z][a-z0-9\_]+Admin/', $this->act)) { @@ -219,7 +218,7 @@ class ModuleObject extends BaseObject $oTemplate->compile('modules/admin/tpl', '_admin_common.html'); } } - + // Execute init if(method_exists($this, 'init')) { @@ -235,10 +234,10 @@ class ModuleObject extends BaseObject return $this; } - + /** * Set privileges(granted) information of current user and check permission of current module - * + * * @return bool */ public function setPrivileges() @@ -253,7 +252,7 @@ class ModuleObject extends BaseObject { return false; } - + // If value is not array if(!is_array($check_module_srl)) { @@ -267,7 +266,7 @@ class ModuleObject extends BaseObject $check_module_srl = array($check_module_srl); } } - + // Check permission by privileges(granted) information for target module foreach($check_module_srl as $target_srl) { @@ -276,7 +275,7 @@ class ModuleObject extends BaseObject { return false; } - + // Check permission if(!$this->checkPermission($grant, $this->user)) { @@ -286,13 +285,13 @@ class ModuleObject extends BaseObject } } } - + // If no privileges(granted) information, check permission by privileges(granted) information for current module if(!isset($grant)) { // Get privileges(granted) information of current user for current module $grant = ModuleModel::getInstance()->getGrant($this->module_info, $this->user, $this->xml_info); - + // Check permission if(!$this->checkPermission($grant, $this->user)) { @@ -300,23 +299,23 @@ class ModuleObject extends BaseObject return false; } } - + // If member action, grant access for log-in, sign-up, member pages if(preg_match('/^(disp|proc)(Member|Communication)[A-Z][a-zA-Z]+$/', $this->act)) { $grant->access = true; } - + // Set privileges(granted) variables $this->grant = $grant; Context::set('grant', $grant); - + return true; } - + /** * Check permission - * + * * @param object $grant privileges(granted) information of user * @param object $member_info member information * @return bool @@ -328,28 +327,28 @@ class ModuleObject extends BaseObject { $member_info = $this->user; } - + // Get privileges(granted) information of the member for current module if(!$grant) { $grant = ModuleModel::getGrant($this->module_info, $member_info, $this->xml_info); } - + // If an administrator, Pass if($grant->root) { return true; } - + // Get permission types(guest, member, manager, root) of the currently requested action $permission = $this->xml_info->action->{$this->act}->permission->target ?: ($this->xml_info->permission->{$this->act} ?? null); - + // If admin action, set default permission if(empty($permission) && stripos($this->act, 'admin') !== false) { $permission = 'root'; } - + // If permission is not or 'guest', Pass if(empty($permission) || $permission == 'guest') { @@ -370,7 +369,7 @@ class ModuleObject extends BaseObject { return true; } - + // If permission is '*-managers', search modules to find manager privilege of the member if(Context::get('is_logged') && isset($type[2])) { @@ -401,7 +400,7 @@ class ModuleObject extends BaseObject else if($grant_names = explode(',', $permission)) { $privilege_list = array_keys((array) $this->xml_info->grant); - + foreach($grant_names as $name) { if(!in_array($name, $privilege_list) || !$grant->$name) @@ -409,16 +408,16 @@ class ModuleObject extends BaseObject return false; } } - + return true; } - + return false; } - + /** * Stop processing this module instance. - * + * * @param string $msg_code an error code * @return ModuleObject $this */ @@ -428,33 +427,33 @@ class ModuleObject extends BaseObject { // flag setting to stop the proc processing $this->stop_proc = true; - + // Error handling $this->setError(-1); $this->setMessage($msg_code); - + // Get backtrace $backtrace = debug_backtrace(false); $caller = array_shift($backtrace); $location = $caller['file'] . ':' . $caller['line']; - + // Error message display by message module $oMessageObject = MessageView::getInstance(); $oMessageObject->setError(-1); $oMessageObject->setMessage($msg_code); $oMessageObject->dispMessage('', $location); - + $this->setTemplatePath($oMessageObject->getTemplatePath()); $this->setTemplateFile($oMessageObject->getTemplateFile()); $this->setHttpStatusCode($oMessageObject->getHttpStatusCode()); } - + return $this; } /** * set the file name of the template file - * + * * @param string name of file * @return $this */ @@ -470,7 +469,7 @@ class ModuleObject extends BaseObject /** * retrieve the directory path of the template directory - * + * * @return string */ public function getTemplateFile() @@ -480,7 +479,7 @@ class ModuleObject extends BaseObject /** * set the directory path of the template directory - * + * * @param string path of template directory. * @return $this */ @@ -501,7 +500,7 @@ class ModuleObject extends BaseObject /** * retrieve the directory path of the template directory - * + * * @return string */ public function getTemplatePath() @@ -511,7 +510,7 @@ class ModuleObject extends BaseObject /** * set the file name of the temporarily modified by admin - * + * * @param string name of file * @return $this */ @@ -529,7 +528,7 @@ class ModuleObject extends BaseObject /** * retreived the file name of edited_layout_file - * + * * @return string */ public function getEditedLayoutFile() @@ -539,7 +538,7 @@ class ModuleObject extends BaseObject /** * set the file name of the layout file - * + * * @param string name of file * @return $this */ @@ -555,7 +554,7 @@ class ModuleObject extends BaseObject /** * get the file name of the layout file - * + * * @return string */ public function getLayoutFile() @@ -565,7 +564,7 @@ class ModuleObject extends BaseObject /** * set the directory path of the layout directory - * + * * @param string path of layout directory. * @return $this */ @@ -586,7 +585,7 @@ class ModuleObject extends BaseObject /** * set the directory path of the layout directory - * + * * @return string */ public function getLayoutPath($layout_name = "", $layout_type = "P") @@ -605,7 +604,7 @@ class ModuleObject extends BaseObject { return FALSE; } - + // Check mobile status $is_mobile = Mobile::isFromMobilePhone(); @@ -623,7 +622,7 @@ class ModuleObject extends BaseObject $oAddonController = AddonController::getInstance(); $addon_file = $oAddonController->getCacheFilePath($is_mobile ? "mobile" : "pc"); if(FileHandler::exists($addon_file)) include($addon_file); - + // Check mobile status again, in case a trigger changed it $is_mobile = Mobile::isFromMobilePhone(); @@ -636,7 +635,7 @@ class ModuleObject extends BaseObject $this->stop("msg_not_permitted_act"); return FALSE; } - + // Set module skin if(isset($this->module_info->skin) && $this->module_info->module === $this->module && strpos($this->act, 'Admin') === false) { @@ -645,7 +644,7 @@ class ModuleObject extends BaseObject $skin_dir = $is_mobile ? 'm.skins' : 'skins'; $module_skin = $this->module_info->{$skin_key} ?: '/USE_DEFAULT/'; $use_default_skin = $this->module_info->{'is_' . $skin_key . '_fix'} === 'N'; - + // Set default skin if(!$this->getTemplatePath() || $use_default_skin) { @@ -669,12 +668,12 @@ class ModuleObject extends BaseObject } $this->setTemplatePath(sprintf('%s%s/%s', $this->module_path, $skin_dir, $module_skin)); } - + // Set skin variable ModuleModel::syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); } - + // Run try { @@ -756,10 +755,10 @@ class ModuleObject extends BaseObject } return TRUE; } - + /** * Copy the response of another ModuleObject into this instance. - * + * * @param self $instance * @return void */ @@ -769,14 +768,14 @@ class ModuleObject extends BaseObject $this->error = $instance->getError(); $this->message = $instance->getMessage(); $this->httpStatusCode = $instance->getHttpStatusCode(); - + // Copy template settings. $this->setTemplatePath($instance->getTemplatePath()); $this->setTemplateFile($instance->getTemplateFile()); $this->setLayoutPath($instance->getLayoutPath()); $this->setLayoutFile($instance->getLayoutFile()); $this->setEditedLayoutFile($instance->getEditedLayoutFile()); - + // Copy all other variables: redirect URL, message type, etc. foreach ($instance->getVariables() as $key => $val) { @@ -784,5 +783,3 @@ class ModuleObject extends BaseObject } } } -/* End of file ModuleObject.class.php */ -/* Location: ./classes/module/ModuleObject.class.php */ diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index b23c53421..ad799387e 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -1,5 +1,4 @@ */ /** * Every module inherits from BaseObject class. @@ -44,7 +43,7 @@ class BaseObject { $this->setError($error); $this->setMessage($message); - + if ($error) { $backtrace = debug_backtrace(false); @@ -58,10 +57,10 @@ class BaseObject $this->add('rx_error_location', $location); } } - + /** * Set state for var_export() - * + * * @param array $vars * @return object */ @@ -94,7 +93,7 @@ class BaseObject { $this->error = -1; } - + // Convert the error message into the correct language and interpolate any other variables into it. if(count($args)) { @@ -104,7 +103,7 @@ class BaseObject $this->message = vsprintf($this->message, $args); } } - + return $this; } @@ -323,6 +322,3 @@ class BaseObject return $this->toBool(); } } - -/* End of file Object.class.php */ -/* Location: ./classes/object/Object.class.php */ diff --git a/classes/page/PageHandler.class.php b/classes/page/PageHandler.class.php index fd49df525..ba5c94234 100644 --- a/classes/page/PageHandler.class.php +++ b/classes/page/PageHandler.class.php @@ -1,41 +1,36 @@ */ /** - * @class PageHandler - * @author NAVER (developers@xpressengine.com) - * handles page navigation - * @version 0.1 + * PageHandler * - * @remarks Getting total counts, number of pages, current page number, number of items per page, - * this class implements methods and contains variables for page navigation + * @author NAVER (developers@xpressengine.com) */ class PageHandler extends Handler implements Iterator { // Number of total items public $total_count = 0; - + // Number of total pages public $total_page = 0; - + // Current page number public $cur_page = 0; - + // Number of page links displayed at one time. public $page_count = 10; - + // First page number public $first_page = 1; - + // Last page number public $last_page = 1; - + // Stepper public $point = 0; /** * Constructor - * + * * @param int $total_count number of total items * @param int $total_page number of total pages * @param int $cur_page current page number @@ -71,7 +66,7 @@ class PageHandler extends Handler implements Iterator /** * Request next page - * + * * @return int */ public function getNextPage(): int @@ -86,7 +81,7 @@ class PageHandler extends Handler implements Iterator /** * Return number of page that added offset. - * + * * @param int $offset * @return int */ @@ -97,7 +92,7 @@ class PageHandler extends Handler implements Iterator /** * Rewind iterator stepper. - * + * * @return void */ public function rewind(): void @@ -107,7 +102,7 @@ class PageHandler extends Handler implements Iterator /** * Determine if a current iterated item is valid. - * + * * @return bool */ public function valid(): bool @@ -118,7 +113,7 @@ class PageHandler extends Handler implements Iterator /** * Get a current iterated page number. - * + * * @return int */ public function current(): int @@ -128,7 +123,7 @@ class PageHandler extends Handler implements Iterator /** * Get a current iterator stepper. - * + * * @return int */ public function key(): int @@ -138,7 +133,7 @@ class PageHandler extends Handler implements Iterator /** * Step up the iterator. - * + * * @return void */ public function next(): void @@ -146,5 +141,3 @@ class PageHandler extends Handler implements Iterator $this->point++; } } -/* End of file PageHandler.class.php */ -/* Location: ./classes/page/PageHandler.class.php */ diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index 47d529b9f..a92daa59a 100644 --- a/classes/security/EmbedFilter.class.php +++ b/classes/security/EmbedFilter.class.php @@ -1,5 +1,4 @@ */ class EmbedFilter { @@ -14,68 +13,66 @@ class EmbedFilter /** * Return EmbedFilter object - * + * * @return EmbedFilter */ function getInstance() { return new self(); } - + public function getWhiteUrlList() { return Rhymix\Framework\Filters\MediaFilter::getObjectWhitelist(); } - + public function getWhiteIframeUrlList() { return Rhymix\Framework\Filters\MediaFilter::getIframeWhitelist(); } - + function isWhiteDomain($urlAttribute) { return Rhymix\Framework\Filters\MediaFilter::matchObjectWhitelist($urlAttribute); } - + function isWhiteIframeDomain($urlAttribute) { return Rhymix\Framework\Filters\MediaFilter::matchIframeWhitelist($urlAttribute); } - + function isWhiteMimetype($mimeType) { return true; } - + function isWhiteExt($ext) { return true; } - + function check(&$content) { // This functionality has been moved to the HTMLFilter class. } - + function checkIframeTag(&$content) { // This functionality has been moved to the HTMLFilter class. } - + function checkObjectTag(&$content) { // This functionality has been moved to the HTMLFilter class. } - + function checkEmbedTag(&$content) { // This functionality has been moved to the HTMLFilter class. } - + function checkParamTag(&$content) { // This functionality has been moved to the HTMLFilter class. } } -/* End of file : EmbedFilter.class.php */ -/* Location: ./classes/security/EmbedFilter.class.php */ diff --git a/classes/security/IpFilter.class.php b/classes/security/IpFilter.class.php index 925616a41..32468ca5d 100644 --- a/classes/security/IpFilter.class.php +++ b/classes/security/IpFilter.class.php @@ -1,5 +1,4 @@ */ class IpFilter { @@ -8,13 +7,10 @@ class IpFilter if(!$ip) $ip = \RX_CLIENT_IP; return Rhymix\Framework\Filters\IpFilter::inRanges($ip, $ip_list); } - + public static function validate($ip_list = array()) { return Rhymix\Framework\Filters\IpFilter::validateRanges($ip_list); } - -} -/* End of file : IpFilter.class.php */ -/* Location: ./classes/security/IpFilter.class.php */ +} diff --git a/classes/security/Password.class.php b/classes/security/Password.class.php index a0012d048..38fba605e 100644 --- a/classes/security/Password.class.php +++ b/classes/security/Password.class.php @@ -1,5 +1,4 @@ */ class Password { @@ -58,22 +57,22 @@ class Password { return Rhymix\Framework\Password::getRandomPassword($length); } - + public static function createSignature($string) { return Rhymix\Framework\Security::createSignature($string); } - + public static function checkSignature($string, $signature) { return Rhymix\Framework\Security::verifySignature($string, $signature); } - + public static function getSecretKey() { return config('crypto.authentication_key'); } - + public static function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24) { $hash = Rhymix\Framework\Security::pbkdf2($password, $salt, $algorithm, $iterations, $length); @@ -91,5 +90,3 @@ class Password return Rhymix\Framework\Security::compareStrings($a, $b); } } -/* End of file : Password.class.php */ -/* Location: ./classes/security/Password.class.php */ diff --git a/classes/security/Purifier.class.php b/classes/security/Purifier.class.php index 9a17d5294..cd84749c2 100644 --- a/classes/security/Purifier.class.php +++ b/classes/security/Purifier.class.php @@ -1,5 +1,4 @@ */ class Purifier { @@ -7,12 +6,10 @@ class Purifier { return new self(); } - + public function purify(&$content) { $content = Rhymix\Framework\Filters\HTMLFilter::clean($content); } } -/* End of file : Purifier.class.php */ -/* Location: ./classes/security/Purifier.class.php */ diff --git a/classes/security/Security.class.php b/classes/security/Security.class.php index 10d3b25f5..ee052573e 100644 --- a/classes/security/Security.class.php +++ b/classes/security/Security.class.php @@ -1,12 +1,9 @@ */ /** - * - Security class - * - This class helps to solve security problems. + * Security class + * * @author NAVER (developers@xpressengine.com) - * @package /classes/security - * @version 0.1 */ class Security { @@ -188,5 +185,3 @@ class Security return !Rhymix\Framework\Security::checkXXE($xml); } } -/* End of file : Security.class.php */ -/* Location: ./classes/security/Security.class.php */ diff --git a/classes/security/UploadFileFilter.class.php b/classes/security/UploadFileFilter.class.php index a74b72ced..219d1f99c 100644 --- a/classes/security/UploadFileFilter.class.php +++ b/classes/security/UploadFileFilter.class.php @@ -4,7 +4,7 @@ class UploadFileFilter { /** * Generic checker - * + * * @param string $file * @param string $filename * @return bool @@ -16,7 +16,7 @@ class UploadFileFilter { return false; } - + // Don't check partial uploads (chunks). if (Context::get('act') === 'procFileUpload' && preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'])) { @@ -27,6 +27,3 @@ class UploadFileFilter return Rhymix\Framework\Filters\FileContentFilter::check($file, $filename); } } - -/* End of file : UploadFileFilter.class.php */ -/* Location: ./classes/security/UploadFileFilter.class.php */ diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 20e29281b..bc8abfc49 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -1,13 +1,9 @@ */ /** - * @class TemplateHandler + * Template compiler + * * @author NAVER (developers@xpressengine.com) - * template compiler - * @version 0.1 - * @remarks It compiles template file by using regular expression into php - * code, and XE caches compiled code for further uses */ class TemplateHandler { @@ -21,7 +17,7 @@ class TemplateHandler private $skipTags = NULL; private $handler_mtime = 0; private static $rootTpl = NULL; - + /** * Context variables accessible as $this in template files */ @@ -66,7 +62,7 @@ class TemplateHandler /** * Reset all instance properties to the default state. - * + * * @return void */ protected function resetState() @@ -166,7 +162,7 @@ class TemplateHandler } $latest_mtime = max(filemtime($this->file), $this->handler_mtime); - + // make compiled file if(!file_exists($this->compiled_file) || filemtime($this->compiled_file) < $latest_mtime) { @@ -180,14 +176,14 @@ class TemplateHandler trigger_error($error_message, \E_USER_WARNING); return escape($error_message); } - + $this->compiled_file = $tmpfilename; } } - + Rhymix\Framework\Debug::addFilenameAlias($this->file, $this->compiled_file); $output = $this->_fetch($this->compiled_file); - + // delete tmpfile if(isset($tmpfilename)) { @@ -326,7 +322,7 @@ class TemplateHandler { $autoform = true; } - + // form ruleset attribute move to hidden tag if ($autoform && $matches[1]) { @@ -399,7 +395,7 @@ class TemplateHandler $matches[1] = preg_replace('/no-(?:error-)?return-url="true"/i', '', $matches[1]); } } - + array_shift($matches); return implode('', $matches); } @@ -415,28 +411,28 @@ class TemplateHandler $__Context = Context::getAll(); $__Context->tpl_path = $this->path; global $lang; - + // Start the output buffer. $__ob_level_before_fetch = ob_get_level(); ob_start(); - + // Include the compiled template. include $filename; - + // Fetch contents of the output buffer until the buffer level is the same as before. $contents = ''; while (ob_get_level() > $__ob_level_before_fetch) { $contents .= ob_get_clean(); } - + // Insert template path comment tag. if(Rhymix\Framework\Debug::isEnabledForCurrentUser() && Context::getResponseMethod() === 'HTML' && !starts_with('web_path . $this->filename . ' -->' . "\n"; $contents = sprintf($sign, 'start') . $contents . sprintf($sign, 'end'); } - + return $contents; } @@ -525,11 +521,11 @@ class TemplateHandler { // list of self closing tags $self_closing = array('area' => 1, 'base' => 1, 'basefont' => 1, 'br' => 1, 'hr' => 1, 'input' => 1, 'img' => 1, 'link' => 1, 'meta' => 1, 'param' => 1, 'frame' => 1, 'col' => 1); - + $skip = $this->skipTags ? sprintf('(?!%s)', implode('|', $this->skipTags)) : ''; $split_regex = "@([^<>{}\"]+|.*?|{[^}]*}|\"(?>'.*?'|.)*?\"|.)*?>)@s"; $nodes = preg_split($split_regex, $buff, -1, PREG_SPLIT_DELIM_CAPTURE); - + for($idx = 1, $node_len = count($nodes); $idx < $node_len; $idx+=2) { if(!($node = $nodes[$idx])) @@ -652,7 +648,7 @@ class TemplateHandler { return $m[0]; } - + if($m[1][0] == '@') { $m[1] = self::_replaceVar(substr($m[1], 1)); @@ -677,7 +673,7 @@ class TemplateHandler { $escape_option = $this->config->autoescape !== null ? 'auto' : 'noescape'; } - + // Separate filters from variable. if (preg_match('@^(.+?)(?_applyEscapeOption($var, $escape_option); $var = "nl2br({$var})"; $escape_option = 'noescape'; break; - + case 'join': $var = $filter_option ? "implode({$filter_option}, {$var})" : "implode(', ', {$var})"; break; - + case 'date': $var = $filter_option ? "getDisplayDateTime(ztime({$var}), {$filter_option})" : "getDisplayDateTime(ztime({$var}), 'Y-m-d H:i:s')"; break; - + case 'format': case 'number_format': $var = $filter_option ? "number_format({$var}, {$filter_option})" : "number_format({$var})"; break; - - case 'shorten': + + case 'shorten': case 'number_shorten': $var = $filter_option ? "number_shorten({$var}, {$filter_option})" : "number_shorten({$var})"; break; - + case 'link': $var = $this->_applyEscapeOption($var, $escape_option); if ($filter_option) @@ -791,13 +787,13 @@ class TemplateHandler } $escape_option = 'noescape'; break; - + default: $filter = escape_sqstr($filter); $var = "'INVALID FILTER ({$filter})'"; } } - + // Apply the escape option and return. return '_applyEscapeOption($var, $escape_option) . ' ?>'; } @@ -1035,7 +1031,7 @@ class TemplateHandler { $str = "$str ?? ''"; } - + switch($escape_option) { case 'escape': @@ -1089,10 +1085,10 @@ class TemplateHandler return $path; } - + /** * Check if a string seems to contain a variable. - * + * * @param string $str * @return bool */ @@ -1103,7 +1099,7 @@ class TemplateHandler /** * Replace PHP variables of $ character - * + * * @param string $php * @return string */ @@ -1113,12 +1109,12 @@ class TemplateHandler { return ''; } - + // Replace variables that need to be enclosed in curly braces, using temporary entities to prevent double-replacement. $php = preg_replace_callback('@(?\$([a-z_][a-z0-9_]*)@i', function($matches) { return '->' . self::_getTempEntityForChar('{') . '$__Context->' . $matches[1] . self::_getTempEntityForChar('}'); }, $php); - + // Replace all other variables with Context attributes. $php = preg_replace_callback('@(?|(?' . $matches[1]; } }, $php); - + return $php; } - + /** * Replace temporary entities to curly braces. - * + * * @param string $str * @return string */ @@ -1147,10 +1143,10 @@ class TemplateHandler '}' => '}', ]); } - + /** * Get the temporary entity for a character. - * + * * @param string $char * @return string */ @@ -1159,5 +1155,3 @@ class TemplateHandler return '&#x' . strtoupper(bin2hex($char)) . ';'; } } -/* End of File: TemplateHandler.class.php */ -/* Location: ./classes/template/TemplateHandler.class.php */ diff --git a/classes/validator/Validator.class.php b/classes/validator/Validator.class.php index 7b5fc635b..f58b732e2 100644 --- a/classes/validator/Validator.class.php +++ b/classes/validator/Validator.class.php @@ -1,11 +1,9 @@ */ /** * Validator class + * * @author NAVER (developers@xpressengine.com) - * @package /classes/validator - * @version 0.1 */ class Validator { @@ -133,7 +131,7 @@ class Validator $rules = array(); $messages = array(); - + // custom rules if(isset($xml->ruleset->customrules) && isset($xml->ruleset->customrules->rule)) { @@ -196,7 +194,7 @@ class Validator { $fieldsNames[$name] = $title; } - + unset($filter['name']); // conditional statement @@ -832,10 +830,10 @@ class Validator return "(function($,v){\nv=xe.getApp('validator')[0];if(!v)return;\n{$addrules}\nv.cast('ADD_FILTER',['{$ruleset}', {{$content}}]);\n{$messages}\n})(jQuery);"; } - + /** * Polyfill for create_function() - * + * * @param mixed $value * @param string $expression * @return mixed @@ -853,5 +851,3 @@ class Validator } } -/* End of file Validator.class.php */ -/* Location: ./classes/validator/Validator.class.php */ diff --git a/classes/widget/WidgetHandler.class.php b/classes/widget/WidgetHandler.class.php index 94a9c2320..54994a39f 100644 --- a/classes/widget/WidgetHandler.class.php +++ b/classes/widget/WidgetHandler.class.php @@ -1,17 +1,11 @@ */ /** - * @class WidgetHandler + * WidgetHandler + * * @author NAVER (developers@xpressengine.com) - * @brief Handler class for widget execution - * @remark it is empty for now, it would be removed in the future */ class WidgetHandler { - var $widget_path = ''; - } -/* End of file WidgetHandler.class.php */ -/* Location: ./classes/widget/WidgetHandler.class.php */ diff --git a/classes/xml/GeneralXmlParser.class.php b/classes/xml/GeneralXmlParser.class.php index e742d7420..9416ca13a 100644 --- a/classes/xml/GeneralXmlParser.class.php +++ b/classes/xml/GeneralXmlParser.class.php @@ -1,5 +1,4 @@ */ /** * GeneralXmlParser class @@ -102,5 +101,3 @@ class GeneralXmlParser } } -/* End of file GeneralXmlParser.class.php */ -/* Location: ./classes/xml/GeneralXmlParser.class.php */ diff --git a/classes/xml/XmlGenerator.class.php b/classes/xml/XmlGenerator.class.php index 1d738556f..b8a3719b7 100644 --- a/classes/xml/XmlGenerator.class.php +++ b/classes/xml/XmlGenerator.class.php @@ -1,5 +1,4 @@ */ /** * XmlGenerator class @@ -72,5 +71,3 @@ class XmlGenerator } } -/* End of file XmlGenerator.class.php */ -/* Location: ./classes/xml/XmlGenerator.class.php */ diff --git a/classes/xml/XmlJsFilter.class.php b/classes/xml/XmlJsFilter.class.php index 34efcfcc3..a519e8bb6 100644 --- a/classes/xml/XmlJsFilter.class.php +++ b/classes/xml/XmlJsFilter.class.php @@ -1,5 +1,4 @@ */ /** * filter class traslate xml content into javascript code @@ -70,7 +69,7 @@ class XmlJsFilter extends XeXmlParser * Compiled js file * @var string */ - var $js_file = NULL; // / + var $js_file = NULL; // / /** * constructor @@ -424,5 +423,3 @@ class XmlJsFilter extends XeXmlParser } } -/* End of file XmlJsFilter.class.php */ -/* Location: ./classes/xml/XmlJsFilter.class.php */ diff --git a/classes/xml/XmlLangParser.class.php b/classes/xml/XmlLangParser.class.php index 9a0dc11f9..acf43a065 100644 --- a/classes/xml/XmlLangParser.class.php +++ b/classes/xml/XmlLangParser.class.php @@ -1,5 +1,4 @@ */ /** * XmlLangParser class @@ -275,5 +274,3 @@ class XmlLangParser extends XeXmlParser } } -/* End of file XmlLangParser.class.php */ -/* Location: ./classes/xml/XmlLangParser.class.php */ diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index b3f720c54..c23a2557b 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -1,5 +1,4 @@ */ /** * Xml_Node_ class @@ -26,7 +25,7 @@ class Xml_Node_ /** * XmlParser class * Class parsing a given xmlrpc request and creating a data object - * @remarks
{ 
+ * @remarks 
{
  * This class may drops unsupported xml lanuage attributes when multiple language attributes are given.
  * For example, if 'xml:lang='ko, en, ch, jp..' is given in a xml file, only ko will be left ignoring all other language
  * attributes when kor is only supported language. It seems to work fine now but we did not scrutinze any potential side effects,
@@ -221,8 +220,8 @@ class XeXmlParser
 	}
 
 	/**
-	 * Method to transfer values in an array to a data object       
-	 * @param array $arr data array 
+	 * Method to transfer values in an array to a data object
+	 * @param array $arr data array
 	 * @return Xml_Node_ object
 	 */
 	function _arrToAttrsObj($arr)
@@ -245,6 +244,3 @@ if (!class_exists('XmlParser', false))
 {
 	class_alias('XeXmlParser', 'XmlParser');
 }
-
-/* End of file XmlParser.class.php */
-/* Location: ./classes/xml/XmlParser.class.php */
diff --git a/common/autoload.php b/common/autoload.php
index aa22f0861..fba20349f 100644
--- a/common/autoload.php
+++ b/common/autoload.php
@@ -107,7 +107,7 @@ spl_autoload_register(function($class_name)
 	$filename2 = null;
 	$lang_plugin = null;
 	$lang_path = null;
-	
+
 	// Try namespaced classes, legacy classes, and module classes.
 	if (preg_match('!^Rhymix/(Framework|Addons|Modules|Plugins|Themes|Widgets)/((\w+)/(?:\w+/)*)?(\w+)$!', $class_name, $matches))
 	{
@@ -136,7 +136,7 @@ spl_autoload_register(function($class_name)
 			$lang_path = RX_BASEDIR . 'modules/' . $module . '/lang';
 		}
 	}
-	
+
 	// Load the PHP file.
 	if ($filename1 && file_exists($filename1))
 	{
@@ -146,7 +146,7 @@ spl_autoload_register(function($class_name)
 	{
 		include $filename2;
 	}
-	
+
 	// Load the lang file for the plugin.
 	if ($lang_plugin)
 	{
diff --git a/common/framework/Cache.php b/common/framework/Cache.php
index f8a198a9e..1f3fe58fb 100644
--- a/common/framework/Cache.php
+++ b/common/framework/Cache.php
@@ -12,25 +12,25 @@ class Cache
 	 */
 	protected static $_driver = null;
 	protected static $_driver_name = null;
-	
+
 	/**
 	 * The cache prefix.
 	 */
 	protected static $_prefix = null;
-	
+
 	/**
 	 * The default TTL.
 	 */
 	protected static $_ttl = 86400;
-	
+
 	/**
 	 * Cache group versions.
 	 */
 	protected static $_group_versions = array();
-	
+
 	/**
 	 * Initialize the cache system.
-	 * 
+	 *
 	 * @param array $config
 	 * @return void
 	 */
@@ -40,7 +40,7 @@ class Cache
 		{
 			$config = array($config);
 		}
-		
+
 		if (isset($config['type']))
 		{
 			$driver_name = $config['type'];
@@ -61,7 +61,7 @@ class Cache
 			$driver_name = null;
 			$class_name = null;
 		}
-		
+
 		if ($class_name !== null && $driver_name !== 'file' && class_exists($class_name) && $class_name::isSupported())
 		{
 			self::$_driver = $class_name::getInstance($config);
@@ -72,7 +72,7 @@ class Cache
 			self::$_driver = Drivers\Cache\Dummy::getInstance(array());
 			self::$_driver_name = 'dummy';
 		}
-		
+
 		if (self::$_driver->prefix)
 		{
 			self::$_prefix = substr(sha1(\RX_BASEDIR), 0, 10) . ':' . \RX_VERSION . ':';
@@ -81,13 +81,13 @@ class Cache
 		{
 			self::$_prefix = \RX_VERSION . ':';
 		}
-		
+
 		return self::$_driver;
 	}
-	
+
 	/**
 	 * Get the list of supported cache drivers.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getSupportedDrivers()
@@ -104,20 +104,20 @@ class Cache
 		}
 		return $result;
 	}
-	
+
 	/**
 	 * Get the name of the currently enabled cache driver.
-	 * 
+	 *
 	 * @return string|null
 	 */
 	public static function getDriverName()
 	{
 		return self::$_driver_name;
 	}
-	
+
 	/**
 	 * Get the currently enabled cache driver, or a named driver with the given settings.
-	 * 
+	 *
 	 * @param string $name (optional)
 	 * @param array $config (optional)
 	 * @return object|null
@@ -141,30 +141,30 @@ class Cache
 			}
 		}
 	}
-	
+
 	/**
 	 * Get the automatically generated cache prefix for this installation of Rhymix.
-	 * 
+	 *
 	 * @return object|null
 	 */
 	public static function getPrefix()
 	{
 		return self::$_prefix;
 	}
-	
+
 	/**
 	 * Get the default TTL.
-	 * 
+	 *
 	 * @return int
 	 */
 	public static function getDefaultTTL()
 	{
 		return self::$_ttl;
 	}
-	
+
 	/**
 	 * Set the default TTL.
-	 * 
+	 *
 	 * @param int $ttl
 	 * @return void
 	 */
@@ -172,12 +172,12 @@ class Cache
 	{
 		self::$_ttl = $ttl;
 	}
-	
+
 	/**
 	 * Get the value of a key.
-	 * 
+	 *
 	 * This method returns null if the key was not found.
-	 * 
+	 *
 	 * @param string $key
 	 * @return mixed
 	 */
@@ -192,14 +192,14 @@ class Cache
 			return null;
 		}
 	}
-	
+
 	/**
 	 * Set the value to a key.
-	 * 
+	 *
 	 * This method returns true on success and false on failure.
 	 * $ttl is measured in seconds. If it is not given, the default TTL is used.
 	 * $force is used to cache essential data when using the default driver.
-	 * 
+	 *
 	 * @param string $key
 	 * @param mixed $value
 	 * @param int $ttl (optional)
@@ -226,13 +226,13 @@ class Cache
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Delete a key.
-	 * 
+	 *
 	 * This method returns true on success and false on failure.
 	 * If the key does not exist, it should return false.
-	 * 
+	 *
 	 * @param string $key
 	 * @return bool
 	 */
@@ -247,12 +247,12 @@ class Cache
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Check if a key exists.
-	 * 
+	 *
 	 * This method returns true on success and false on failure.
-	 * 
+	 *
 	 * @param string $key
 	 * @return bool
 	 */
@@ -267,13 +267,13 @@ class Cache
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Increase the value of a key by $amount.
-	 * 
+	 *
 	 * If the key does not exist, this method assumes that the current value is zero.
 	 * This method returns the new value, or -1 on failure.
-	 * 
+	 *
 	 * @param string $key
 	 * @param int $amount (optional)
 	 * @return int
@@ -289,13 +289,13 @@ class Cache
 			return -1;
 		}
 	}
-	
+
 	/**
 	 * Decrease the value of a key by $amount.
-	 * 
+	 *
 	 * If the key does not exist, this method assumes that the current value is zero.
 	 * This method returns the new value, or -1 on failure.
-	 * 
+	 *
 	 * @param string $key
 	 * @param int $amount (optional)
 	 * @return int
@@ -311,12 +311,12 @@ class Cache
 			return -1;
 		}
 	}
-	
+
 	/**
 	 * Clear a group of keys from the cache.
-	 * 
+	 *
 	 * This method returns true on success and false on failure.
-	 * 
+	 *
 	 * @param string $group_name
 	 * @return bool
 	 */
@@ -333,12 +333,12 @@ class Cache
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Clear all keys from the cache.
-	 * 
+	 *
 	 * This method returns true on success and false on failure.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public static function clearAll(): bool
@@ -352,10 +352,10 @@ class Cache
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Get the group version.
-	 * 
+	 *
 	 * @param string $group_name
 	 * @return int
 	 */
@@ -377,10 +377,10 @@ class Cache
 			}
 		}
 	}
-	
+
 	/**
 	 * Get the actual key used by Rhymix.
-	 * 
+	 *
 	 * @param string $key
 	 * @return string
 	 */
@@ -390,7 +390,7 @@ class Cache
 		{
 			$key = $matches[1] . '#' . self::getGroupVersion($matches[1]) . ':' . $matches[2];
 		}
-		
+
 		return self::$_prefix . $key;
 	}
 }
diff --git a/common/framework/Calendar.php b/common/framework/Calendar.php
index 67aaafbe4..3c65a2c83 100644
--- a/common/framework/Calendar.php
+++ b/common/framework/Calendar.php
@@ -9,7 +9,7 @@ class Calendar
 {
 	/**
 	 * This method returns the English name of a month, e.g. 9 = 'September'.
-	 * 
+	 *
 	 * @param int $month_number
 	 * @param bool $long_format (optional, default is true)
 	 * @return string
@@ -21,16 +21,16 @@ class Calendar
 		{
 			return false;
 		}
-		
+
 		return date($long_format ? 'F' : 'M', mktime(0, 0, 0, $month_number, 1));
 	}
-	
+
 	/**
 	 * This method returns the day on which a month begins.
-	 * 
+	 *
 	 * 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday.
 	 * If you do not specify a year, the current year is assumed.
-	 * 
+	 *
 	 * @param int $month_number
 	 * @param int $year (optional)
 	 * @return int
@@ -42,16 +42,16 @@ class Calendar
 		{
 			return false;
 		}
-		
+
 		return (int)date('w', mktime(0, 0, 0, $month_number, 1, $year ?: date('Y')));
 	}
-	
+
 	/**
 	 * This method returns the number of days in a month, e.g. February 2016 has 29 days.
-	 * 
+	 *
 	 * If you do not specify a year, the current year is assumed.
 	 * You must specify a year to get the number of days in February.
-	 * 
+	 *
 	 * @param int $month_number
 	 * @param int $year (optional)
 	 * @return int
@@ -63,19 +63,19 @@ class Calendar
 		{
 			return false;
 		}
-		
+
 		return (int)date('t', mktime(0, 0, 0, $month_number, 1, $year ?: date('Y')));
 	}
-	
+
 	/**
 	 * This method returns a complete calendar for a month.
-	 * 
+	 *
 	 * The return value is an array with six members, each representing a week.
 	 * Each week is an array with seven members, each representing a day.
 	 * 6 weeks are returned. Empty cells are represented by nulls.
-	 * 
+	 *
 	 * If you do not specify a year, the current year is assumed.
-	 * 
+	 *
 	 * @param int $month_number
 	 * @param int $year (optional)
 	 * @param int $start_dow (optional)
@@ -96,13 +96,13 @@ class Calendar
 		{
 			$year = date('Y');
 		}
-		
+
 		$start = self::getMonthStartDayOfWeek($month_number, $year);
 		$count = self::getMonthDays($month_number, $year);
 		$initial_blank_cells = (7 + $start - $start_dow) % 7;
 		$final_blank_cells = 42 - $count - $initial_blank_cells;
 		$temp = array();
-		
+
 		for ($i = 0; $i < $initial_blank_cells; $i++)
 		{
 			$temp[] = null;
@@ -115,7 +115,7 @@ class Calendar
 		{
 			$temp[] = null;
 		}
-		
+
 		$return = array();
 		for ($i = 0; $i < 6; $i++)
 		{
@@ -126,7 +126,7 @@ class Calendar
 			}
 			$return[] = $week;
 		}
-		
+
 		return $return;
 	}
 }
diff --git a/common/framework/Config.php b/common/framework/Config.php
index 490529d4f..b7e75c792 100644
--- a/common/framework/Config.php
+++ b/common/framework/Config.php
@@ -11,7 +11,7 @@ class Config
 	 * System configuration is stored here.
 	 */
 	protected static $_config = array();
-	
+
 	/**
 	 * Location of configuration files.
 	 */
@@ -20,10 +20,10 @@ class Config
 	public static $old_ftp_config_filename = 'files/config/ftp.config.php';
 	public static $old_lang_config_filename = 'files/config/lang_selected.info';
 	public static $default_config_filename = 'common/defaults/config.php';
-	
+
 	/**
 	 * Load system configuration.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function init()
@@ -43,30 +43,30 @@ class Config
 		}
 		return self::$_config;
 	}
-	
+
 	/**
 	 * Get all system configuration.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getAll()
 	{
 		return self::$_config;
 	}
-	
+
 	/**
 	 * Get default system configuration.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getDefaults()
 	{
 		return (include \RX_BASEDIR . self::$default_config_filename);
 	}
-	
+
 	/**
 	 * Get a system configuration value.
-	 * 
+	 *
 	 * @param string $key
 	 * @return mixed
 	 */
@@ -88,10 +88,10 @@ class Config
 		}
 		return $data;
 	}
-	
+
 	/**
 	 * Set a system configuration value.
-	 * 
+	 *
 	 * @param string $key
 	 * @param mixed $value
 	 * @return void
@@ -110,10 +110,10 @@ class Config
 		}
 		$data = $value;
 	}
-	
+
 	/**
 	 * Set all system configuration.
-	 * 
+	 *
 	 * @param array $config
 	 * @return void
 	 */
@@ -121,10 +121,10 @@ class Config
 	{
 		self::$_config = $config;
 	}
-	
+
 	/**
 	 * Save the current system configuration.
-	 * 
+	 *
 	 * @param array $config (optional)
 	 * @return bool
 	 */
@@ -134,7 +134,7 @@ class Config
 		{
 			self::setAll($config);
 		}
-		
+
 		// Backup the main config file.
 		$config_filename = \RX_BASEDIR . self::$config_filename;
 		if (Storage::exists($config_filename))
@@ -147,7 +147,7 @@ class Config
 				return false;
 			}
 		}
-		
+
 		// Save the main config file.
 		$buff = 'getMessage());
 		}
-		
+
 		// Get the DB version.
 		$this->db_version = $this->_handle->getAttribute(\PDO::ATTR_SERVER_VERSION);
-		
+
 		// Cache the debug comment setting.
 		$this->_debug_queries = in_array('queries', Config::get('debug.display_content') ?: []);
 		$this->_debug_comment = !!config('debug.query_comment');
 		$this->_debug_full_stack = !!Config::get('debug.query_full_stack');
 	}
-	
+
 	/**
 	 * Get the PDO handle for direct manipulation.
-	 * 
+	 *
 	 * @return Helpers\DBHelper
 	 */
 	public function getHandle(): Helpers\DBHelper
 	{
 		return $this->_handle;
 	}
-	
+
 	/**
 	 * Create a prepared statement.
-	 * 
+	 *
 	 * Table names in the FROM or JOIN clause of the statement are
 	 * automatically prefixed with the configured prefix.
-	 * 
+	 *
 	 * @param string $statement
 	 * @param array $driver_options
 	 * @return Helpers\DBStmtHelper
@@ -162,30 +162,30 @@ class DB
 	{
 		// Add table prefixes to the query string.
 		$statement = $this->addPrefixes($statement);
-		
+
 		// Add the debug comment.
 		if ($this->_debug_comment)
 		{
 			$statement .= "\n" . sprintf('/* prepare() %s */', \RX_CLIENT_IP);
 		}
-		
+
 		// Create and return a prepared statement.
 		$this->_last_stmt = null;
 		$this->_last_stmt = $this->_handle->prepare($statement, $driver_options);
 		return $this->_last_stmt;
 	}
-	
+
 	/**
 	 * Execute a query string with or without parameters.
-	 * 
+	 *
 	 * This method will automatically use prepared statements if there are
 	 * any parameters. It is strongly recommended to pass any user-supplied
 	 * values as separate parameters instead of embedding them directly
 	 * in the query string, in order to prevent SQL injection attacks.
-	 * 
+	 *
 	 * Table names in the FROM or JOIN clause of the statement are
 	 * automatically prefixed with the configured prefix.
-	 * 
+	 *
 	 * @param string $query_string
 	 * @param mixed ...$args
 	 * @return Helpers\DBStmtHelper
@@ -197,16 +197,16 @@ class DB
 		{
 			$args = $args[0];
 		}
-		
+
 		// Add table prefixes to the query string.
 		$query_string = $this->addPrefixes($query_string);
-		
+
 		// Add the debug comment.
 		if ($this->_debug_comment)
 		{
 			$query_string .= "\n" . sprintf('/* query() %s */', \RX_CLIENT_IP);
 		}
-		
+
 		// Execute either a prepared statement or a regular query depending on whether there are arguments.
 		$this->_last_stmt = null;
 		if (count($args))
@@ -220,10 +220,10 @@ class DB
 		}
 		return $this->_last_stmt;
 	}
-	
+
 	/**
 	 * Execute an XML-defined query.
-	 * 
+	 *
 	 * @param string $query_id
 	 * @param array $args
 	 * @param array $columns
@@ -250,13 +250,13 @@ class DB
 		{
 			return $this->setError(-1, 'DB is not configured.');
 		}
-		
+
 		// Force the column list to a numerical array.
 		$column_list = is_array($column_list) ? array_values($column_list) : array();
-		
+
 		// Start measuring elapsed time.
 		$start_time = microtime(true);
-		
+
 		// Get the name of the XML file.
 		$parts = explode('.', $query_id);
 		if (count($parts) === 2)
@@ -271,7 +271,7 @@ class DB
 			$this->_total_time += (microtime(true) - $start_time);
 			return $output;
 		}
-		
+
 		// Parse and cache the XML file.
 		$cache_key = sprintf('query:%s:%d', $filename, filemtime($filename));
 		$query = Cache::get($cache_key);
@@ -290,7 +290,7 @@ class DB
 				return $output;
 			}
 		}
-		
+
 		// Get the query string and parameters.
 		try
 		{
@@ -304,7 +304,7 @@ class DB
 			$this->_total_time += (microtime(true) - $start_time);
 			return $output;
 		}
-		
+
 		// If this query requires pagination, execute the COUNT(*) query first.
 		$last_index = 0;
 		if ($query->requiresPagination())
@@ -319,7 +319,7 @@ class DB
 				$this->_total_time += (microtime(true) - $start_time);
 				return $output;
 			}
-			
+
 			// Do not execute the main query if the current page is out of bounds.
 			if ($output->page > $output->total_page)
 			{
@@ -335,7 +335,7 @@ class DB
 		{
 			$output = new Helpers\DBResultHelper;
 		}
-		
+
 		// Prepare and execute the main query.
 		try
 		{
@@ -343,7 +343,7 @@ class DB
 			{
 				$query_string .= "\n" . sprintf('/* %s %s */', $query_id, \RX_CLIENT_IP);
 			}
-			
+
 			$this->_query_id = $query_id;
 			$this->_last_stmt = null;
 			if (count($query_params))
@@ -355,7 +355,7 @@ class DB
 			{
 				$this->_last_stmt = $this->_handle->query($query_string);
 			}
-			
+
 			if ($this->isError())
 			{
 				$output = $this->getError();
@@ -387,22 +387,22 @@ class DB
 			$this->_total_time += (microtime(true) - $start_time);
 			return $output;
 		}
-		
+
 		// Fill query information and result data in the output object.
 		$this->_query_id = '';
 		$this->_total_time += ($elapsed_time = microtime(true) - $start_time);
 		$output->add('_query', $query_string);
 		$output->add('_elapsed_time', sprintf('%0.5f', $elapsed_time));
 		$output->data = $result;
-		
+
 		// Return the complete result.
 		$this->clearError();
 		return $output;
 	}
-	
+
 	/**
 	 * Execute a COUNT(*) query for pagination.
-	 * 
+	 *
 	 * @param string $query_id
 	 * @param Parsers\DBQuery\Query $query
 	 * @param array $args
@@ -421,7 +421,7 @@ class DB
 		{
 			return $this->setError(-1, $e->getMessage());
 		}
-		
+
 		// Prepare and execute the query.
 		try
 		{
@@ -429,7 +429,7 @@ class DB
 			{
 				$query_string .= "\n" . sprintf('/* %s %s */', $query_id, \RX_CLIENT_IP);
 			}
-			
+
 			$this->_last_stmt = null;
 			if (count($query_params))
 			{
@@ -440,7 +440,7 @@ class DB
 			{
 				$this->_last_stmt = $this->_handle->query($query_string);
 			}
-			
+
 			if ($this->isError())
 			{
 				return $this->getError();
@@ -461,7 +461,7 @@ class DB
 			$output = $this->setError(-1, $e->getMessage());
 			return $output;
 		}
-		
+
 		// Collect various counts used in the page calculation.
 		list($is_expression, $list_count) = $query->navigation->list_count->getValue($args);
 		list($is_expression, $page_count) = $query->navigation->page_count->getValue($args);
@@ -470,7 +470,7 @@ class DB
 		$total_page = max(1, intval(ceil($total_count / $list_count)));
 		$last_index = $total_count - (($page - 1) * $list_count);
 		$page_handler = new \PageHandler($total_count, $total_page, $page, $page_count ?: 10);
-		
+
 		// Compose the output object.
 		$output = new Helpers\DBResultHelper;
 		$output->add('_count', $query_string);
@@ -481,13 +481,13 @@ class DB
 		$output->page_navigation = $page_handler;
 		return $output;
 	}
-	
+
 	/**
 	 * Execute a literal query string.
-	 * 
+	 *
 	 * This method should not be public, as it starts with an underscore.
 	 * But since there are many legacy apps that rely on it, we will leave it public.
-	 * 
+	 *
 	 * @param string $query_string
 	 * @return Helpers\DBStmtHelper
 	 */
@@ -497,18 +497,18 @@ class DB
 		{
 			$query_string .= "\n" . sprintf('/* _query() %s */', \RX_CLIENT_IP);
 		}
-		
+
 		$this->_last_stmt = null;
 		$this->_last_stmt = $this->_handle->query($query_string);
 		return $this->_last_stmt;
 	}
-	
+
 	/**
 	 * Fetch results from a query.
-	 * 
+	 *
 	 * This method should not be public, as it starts with an underscore.
 	 * But since there are many legacy apps that rely on it, we will leave it public.
-	 * 
+	 *
 	 * @param \PDOStatement $stmt
 	 * @param int $last_index
 	 * @param string $result_type
@@ -525,7 +525,7 @@ class DB
 		{
 			return $stmt;
 		}
-		
+
 		try
 		{
 			$result = array();
@@ -541,14 +541,14 @@ class DB
 				$result[$index] = $row;
 				$index += $step;
 			}
-			
+
 			$stmt->closeCursor();
 		}
 		catch (\PDOException $e)
 		{
 			throw new Exceptions\DBError($e->getMessage());
 		}
-		
+
 		if ($result_type === 'auto' && $last_index === 0 && count($result) <= 1)
 		{
 			return isset($result[0]) ? $result[0] : null;
@@ -558,10 +558,10 @@ class DB
 			return $result;
 		}
 	}
-	
+
 	/**
 	 * Begin a transaction.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function begin(): int
@@ -577,7 +577,7 @@ class DB
 			{
 				$this->setError(-1, $e->getMessage());
 			}
-			
+
 			if (Debug::isEnabledForCurrentUser())
 			{
 				Debug::addQuery($this->getQueryLog('START TRANSACTION', 0));
@@ -590,10 +590,10 @@ class DB
 		$this->_transaction_level++;
 		return $this->_transaction_level;
 	}
-	
+
 	/**
 	 * Roll back a transaction.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function rollback(): int
@@ -609,7 +609,7 @@ class DB
 			{
 				$this->setError(-1, $e->getMessage());
 			}
-			
+
 			if (Debug::isEnabledForCurrentUser())
 			{
 				Debug::addQuery($this->getQueryLog('ROLLBACK', 0));
@@ -619,17 +619,17 @@ class DB
 		{
 			$this->_handle->exec(sprintf('ROLLBACK TO SAVEPOINT `%s%s%d`', $this->_prefix, 'savepoint', $this->_transaction_level - 1));
 		}
-		
+
 		if ($this->_transaction_level > 0)
 		{
 			$this->_transaction_level--;
 		}
 		return $this->_transaction_level;
 	}
-	
+
 	/**
 	 * Commit a transaction.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function commit(): int
@@ -645,7 +645,7 @@ class DB
 			{
 				$this->setError(-1, $e->getMessage());
 			}
-			
+
 			if (Debug::isEnabledForCurrentUser())
 			{
 				Debug::addQuery($this->getQueryLog('COMMIT', 0));
@@ -658,44 +658,44 @@ class DB
 				Debug::addQuery($this->getQueryLog('NESTED COMMIT IGNORED BY RHYMIX', 0));
 			}
 		}
-		
+
 		if ($this->_transaction_level > 0)
 		{
 			$this->_transaction_level--;
 		}
 		return $this->_transaction_level;
 	}
-	
+
 	/**
 	 * Get the current transaction level.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function getTransactionLevel(): int
 	{
 		return $this->_transaction_level;
 	}
-	
+
 	/**
 	 * Get the number of rows affected by the last statement.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function getAffectedRows(): int
 	{
 		return $this->_last_stmt ? intval($this->_last_stmt->rowCount()) : 0;
 	}
-	
+
 	/**
 	 * Get the auto-incremented ID generated by the last statement.
-	 * 
+	 *
 	 * @return int
 	 */
 	public function getInsertID(): int
 	{
 		return intval($this->_handle->lastInsertId());
 	}
-	
+
 	/**
 	 * Get the next global sequence value.
 	 */
@@ -707,19 +707,19 @@ class DB
 		{
 			throw new Exceptions\DBError($this->getError()->getMessage());
 		}
-		
+
 		if($sequence % 10000 == 0)
 		{
 			$this->_handle->exec(sprintf('DELETE FROM `%s` WHERE seq < %d', $this->addQuotes($this->_prefix . 'sequence'), $sequence));
 		}
-		
+
 		$this->clearError();
 		return $sequence;
 	}
-	
+
 	/**
 	 * Check if a password is valid according to MySQL's old password hashing algorithm.
-	 * 
+	 *
 	 * @param string $password
 	 * @param string $saved_password
 	 * @return bool
@@ -734,10 +734,10 @@ class DB
 		{
 			return Password::checkPassword($password, $saved_password, 'mysql_old_password');
 		}
-		
+
 		return false;
 	}
-	
+
 	/**
 	 * Check if a table exists.
 	 *
@@ -750,10 +750,10 @@ class DB
 		$result = $this->_fetch($stmt);
 		return $result ? true : false;
 	}
-	
+
 	/**
 	 * Create a table.
-	 * 
+	 *
 	 * @param string $filename
 	 * @param string $content
 	 * @return Helpers\DBResultHelper
@@ -770,16 +770,16 @@ class DB
 		{
 			return new Helpers\DBResultHelper;
 		}
-		
+
 		// Generate the CREATE TABLE query and execute it.
 		$query_string = $table->getCreateQuery($this->_prefix, $this->_charset, $this->_engine);
 		$result = $this->_handle->exec($query_string);
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Drop a table.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @return Helpers\DBResultHelper
 	 */
@@ -788,7 +788,7 @@ class DB
 		$stmt = $this->_handle->exec(sprintf("DROP TABLE `%s`", $this->addQuotes($this->_prefix . $table_name)));
 		return $stmt ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Check if a column exists.
 	 *
@@ -802,10 +802,10 @@ class DB
 		$result = $this->_fetch($stmt);
 		return $result ? true : false;
 	}
-	
+
 	/**
 	 * Add a column.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $column_name
 	 * @param string $type
@@ -819,12 +819,12 @@ class DB
 	{
 		// Normalize the type and size.
 		list($type, $xetype, $size) = Parsers\DBTableParser::getTypeAndSize($type, strval($size));
-		
+
 		// Compose the ADD COLUMN query.
 		$query = sprintf("ALTER TABLE `%s` ADD COLUMN `%s` ", $this->addQuotes($this->_prefix . $table_name), $this->addQuotes($column_name));
 		$query .= $size ? sprintf('%s(%s)', $type, $size) : $type;
 		$query .= $notnull ? ' NOT NULL' : '';
-		
+
 		// Add the default value according to the type.
 		if (isset($default))
 		{
@@ -837,7 +837,7 @@ class DB
 				$query .= sprintf(" DEFAULT '%s'", $this->addQuotes($default));
 			}
 		}
-		
+
 		// Add position information.
 		if ($after_column === 'FIRST')
 		{
@@ -847,15 +847,15 @@ class DB
 		{
 			$query .= sprintf(' AFTER `%s`', $this->addQuotes($after_column));
 		}
-		
+
 		// Execute the query and return the result.
 		$result = $this->_handle->exec($query);
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Modify a column.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $column_name
 	 * @param string $type
@@ -871,7 +871,7 @@ class DB
 	{
 		// Normalize the type and size.
 		list($type, $xetype, $size) = Parsers\DBTableParser::getTypeAndSize($type, strval($size));
-		
+
 		// Compose the MODIFY COLUMN query.
 		if ($new_name && $new_name !== $column_name)
 		{
@@ -882,17 +882,17 @@ class DB
 			$query = sprintf("ALTER TABLE `%s` MODIFY `%s` ", $this->addQuotes($this->_prefix . $table_name), $this->addQuotes($column_name));
 		}
 		$query .= $size ? sprintf('%s(%s)', $type, $size) : $type;
-		
+
 		// Add the character set information.
 		if (isset($new_charset))
 		{
 			$new_collation = preg_match('/^utf8/i', $new_charset) ? ($new_charset . '_unicode_ci') : ($new_charset . '_general_ci');
 			$query .= ' CHARACTER SET ' . $new_charset . ' COLLATE ' . $new_collation;
 		}
-		
+
 		// Add the NOT NULL constraint.
 		$query .= $notnull ? ' NOT NULL' : '';
-		
+
 		// Add the default value according to the type.
 		if (isset($default))
 		{
@@ -905,7 +905,7 @@ class DB
 				$query .= sprintf(" DEFAULT '%s'", $this->addQuotes($default));
 			}
 		}
-		
+
 		// Add position information.
 		if ($after_column === 'FIRST')
 		{
@@ -915,15 +915,15 @@ class DB
 		{
 			$query .= sprintf(' AFTER `%s`', $this->addQuotes($after_column));
 		}
-		
+
 		// Execute the query and return the result.
 		$result = $this->_handle->exec($query);
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Drop a column.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $column_name
 	 * @return Helpers\DBResultHelper
@@ -933,7 +933,7 @@ class DB
 		$result = $this->_handle->exec(sprintf("ALTER TABLE `%s` DROP `%s`", $this->addQuotes($this->_prefix . $table_name), $this->addQuotes($column_name)));
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Get column information.
 	 *
@@ -950,7 +950,7 @@ class DB
 		{
 			return false;
 		}
-		
+
 		// Reorganize the type information.
 		$dbtype = strtolower($column_info->{'Type'});
 		if (preg_match('/^([a-z0-9_]+)\(([0-9,\s]+)\)$/i', $dbtype, $matches))
@@ -963,7 +963,7 @@ class DB
 			$size = '';
 		}
 		$xetype = Parsers\DBTableParser::getXEType($dbtype, $size ?: '');
-		
+
 		// Return the result as an object.
 		return (object)array(
 			'name' => $column_name,
@@ -974,10 +974,10 @@ class DB
 			'notnull' => strncmp($column_info->{'Null'}, 'NO', 2) == 0 ? true : false,
 		);
 	}
-	
+
 	/**
 	 * Check if an index exists.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $index_name
 	 * @return boolean
@@ -988,10 +988,10 @@ class DB
 		$result = $this->_fetch($stmt);
 		return $result ? true : false;
 	}
-	
+
 	/**
 	 * Add an index.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $index_name
 	 * @param array $columns
@@ -1005,12 +1005,12 @@ class DB
 		{
 			$columns = array($columns);
 		}
-		
+
 		if ($type === true || $type === 1)
 		{
 			$type = 'UNIQUE';
 		}
-		
+
 		$query = vsprintf("ALTER TABLE `%s` ADD %s `%s` (%s) %s", array(
 			$this->addQuotes($this->_prefix . $table_name),
 			ltrim($type . ' INDEX'),
@@ -1027,14 +1027,14 @@ class DB
 			}, $columns)),
 			$options,
 		));
-		
+
 		$result = $this->_handle->exec($query);
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Drop an index.
-	 * 
+	 *
 	 * @param string $table_name
 	 * @param string $index_name
 	 * @return Helpers\DBResultHelper
@@ -1044,10 +1044,10 @@ class DB
 		$result = $this->_handle->exec(sprintf("ALTER TABLE `%s` DROP INDEX `%s`", $this->addQuotes($this->_prefix . $table_name), $this->addQuotes($index_name)));
 		return $result ? new Helpers\DBResultHelper : $this->getError();
 	}
-	
+
 	/**
 	 * Add table prefixes to a query string.
-	 * 
+	 *
 	 * @param string $query_string
 	 * @return string
 	 */
@@ -1077,10 +1077,10 @@ class DB
 			}, $query_string);
 		}
 	}
-	
+
 	/**
 	 * Escape a string according to current DB settings.
-	 * 
+	 *
 	 * @param string $str
 	 * @return string
 	 */
@@ -1095,10 +1095,10 @@ class DB
 			return preg_replace("/^'(.*)'$/s", '$1', $this->_handle->quote($str));
 		}
 	}
-	
+
 	/**
 	 * Find out the best supported character set.
-	 * 
+	 *
 	 * @return string
 	 */
 	public function getBestSupportedCharset(): string
@@ -1109,30 +1109,30 @@ class DB
 		})));
 		return $utf8mb4_support ? 'utf8mb4' : 'utf8';
 	}
-	
+
 	/**
 	 * Check if the last statement produced an error.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public function isError(): bool
 	{
 		return $this->_errno !== 0 ? true : false;
 	}
-	
+
 	/**
 	 * Get the last error information.
-	 * 
+	 *
 	 * @return Helpers\DBResultHelper
 	 */
 	public function getError(): Helpers\DBResultHelper
 	{
 		return new Helpers\DBResultHelper($this->_errno, $this->_errstr);
 	}
-	
+
 	/**
 	 * Set error information to instance properties.
-	 * 
+	 *
 	 * @param int $errno
 	 * @param string $errstr
 	 * @return Helpers\DBResultHelper
@@ -1144,10 +1144,10 @@ class DB
 		$output = new Helpers\DBResultHelper($errno, $errstr);
 		return $output;
 	}
-	
+
 	/**
 	 * Clear error information.
-	 * 
+	 *
 	 * @return void
 	 */
 	public function clearError()
@@ -1155,10 +1155,10 @@ class DB
 		$this->_errno = 0;
 		$this->_errstr = 'success';
 	}
-	
+
 	/**
 	 * Generate a query log entry.
-	 * 
+	 *
 	 * @param string $query
 	 * @param float $elapsed_time
 	 * @return array
@@ -1179,7 +1179,7 @@ class DB
 			'called_method' => null,
 			'backtrace' => array(),
 		);
-		
+
 		// Add debug information if enabled.
 		if ($this->_errno || $this->_debug_queries)
 		{
@@ -1205,13 +1205,13 @@ class DB
 				}
 			}
 		}
-		
+
 		return $result;
 	}
-	
+
 	/**
 	 * Send an entry to the query log for debugging.
-	 * 
+	 *
 	 * @param array $log
 	 * @return void
 	 */
@@ -1219,10 +1219,10 @@ class DB
 	{
 		Debug::addQuery($log);
 	}
-	
+
 	/**
 	 * Add elapsed time.
-	 * 
+	 *
 	 * @param float $elapsed_time
 	 * @return void
 	 */
@@ -1230,45 +1230,45 @@ class DB
 	{
 		$this->_query_time += $elapsed_time;
 	}
-	
+
 	/**
 	 * Get total time spent during queries.
-	 * 
+	 *
 	 * @return float
 	 */
 	public function getQueryElapsedTime(): float
 	{
 		return $this->_query_time;
 	}
-	
+
 	/**
 	 * Get total time spent in this class.
-	 * 
+	 *
 	 * @return float
 	 */
 	public function getTotalElapsedTime(): float
 	{
 		return $this->_total_time;
 	}
-	
+
 	/**
 	 * Enable or disable debug comments.
-	 * 
+	 *
 	 * @param bool $enabled
 	 */
 	public function setDebugComment(bool $enabled)
 	{
 		$this->_debug_comment = $enabled;
 	}
-	
+
 	/**
 	 * ========================== DEPRECATED METHODS ==========================
 	 * ==================== KEPT FOR COMPATIBILITY WITH XE ====================
 	 */
-	
+
 	/**
 	 * Old alias to getInstance().
-	 * 
+	 *
 	 * @deprecated
 	 * @return self
 	 */
@@ -1276,10 +1276,10 @@ class DB
 	{
 		return self::getInstance();
 	}
-	
+
 	/**
 	 * Old alias to $stmt->fetchObject().
-	 * 
+	 *
 	 * @deprecated
 	 * @param \PDOStatement $stmt
 	 * @return object|false
@@ -1288,10 +1288,10 @@ class DB
 	{
 		return $stmt->fetchObject();
 	}
-	
+
 	/**
 	 * Old alias to $stmt->closeCursor().
-	 * 
+	 *
 	 * @deprecated
 	 * @param \PDOStatement $stmt
 	 * @return bool
@@ -1300,10 +1300,10 @@ class DB
 	{
 		return $stmt->closeCursor();
 	}
-	
+
 	/**
 	 * Old alias to getInsertID().
-	 * 
+	 *
 	 * @deprecated
 	 * @return int
 	 */
@@ -1311,10 +1311,10 @@ class DB
 	{
 		return $this->getInsertID();
 	}
-	
+
 	/**
 	 * Get the list of supported database drivers.
-	 * 
+	 *
 	 * @deprecated
 	 * @return array
 	 */
@@ -1327,10 +1327,10 @@ class DB
 			),
 		);
 	}
-	
+
 	/**
 	 * Get the list of enabled database drivers.
-	 * 
+	 *
 	 * @deprecated
 	 * @return array
 	 */
@@ -1340,10 +1340,10 @@ class DB
 			return $item->enable;
 		});
 	}
-   
+
 	/**
 	 * Get the list of disabled database drivers.
-	 * 
+	 *
 	 * @deprecated
 	 * @return array
 	 */
@@ -1353,10 +1353,10 @@ class DB
 			return !$item->enable;
 		});
 	}
-	
+
 	/**
 	 * Check if the current instance is supported.
-	 * 
+	 *
 	 * @deprecated
 	 * @return bool
 	 */
@@ -1364,10 +1364,10 @@ class DB
 	{
 		return true;
 	}
-	
+
 	/**
 	 * Check if the current instance is connected.
-	 * 
+	 *
 	 * @deprecated
 	 * @return bool
 	 */
@@ -1375,10 +1375,10 @@ class DB
 	{
 		return true;
 	}
-	
+
 	/**
 	 * Close the DB connection.
-	 * 
+	 *
 	 * @deprecated
 	 * @return bool
 	 */
@@ -1386,10 +1386,10 @@ class DB
 	{
 		return true;
 	}
-	
+
 	/**
 	 * Methods related to table creation.
-	 * 
+	 *
 	 * @deprecated
 	 * @return void
 	 */
@@ -1408,10 +1408,10 @@ class DB
 		$output = $this->createTable('', $xml_doc);
 		return $output->toBool();
 	}
-	
+
 	/**
 	 * Methods related to the click count cache feature.
-	 * 
+	 *
 	 * @deprecated
 	 * @return bool
 	 */
@@ -1427,7 +1427,7 @@ class DB
 	{
 		return false;
 	}
-	
+
 	/**
 	 * Other deprecated methods.
 	 */
diff --git a/common/framework/DateTime.php b/common/framework/DateTime.php
index 5e5e08eb5..d96740f98 100644
--- a/common/framework/DateTime.php
+++ b/common/framework/DateTime.php
@@ -11,10 +11,10 @@ class DateTime
 	 * Time zone objects and settings are cached here.
 	 */
 	protected static $_timezones = array();
-	
+
 	/**
 	 * Format a Unix timestamp using the internal timezone.
-	 * 
+	 *
 	 * @param string $format Format used in PHP date() function
 	 * @param int $timestamp Unix timestamp (optional, default is now)
 	 * @return string
@@ -25,14 +25,14 @@ class DateTime
 		{
 			return self::getRelativeTimestamp($timestamp ?: time());
 		}
-		
+
 		$offset = Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
 		return gmdate($format, ($timestamp ?: time()) + $offset);
 	}
-	
+
 	/**
 	 * Format a Unix timestamp for the current user's timezone.
-	 * 
+	 *
 	 * @param string $format Format used in PHP date() function
 	 * @param int $timestamp Unix timestamp (optional, default is now)
 	 * @return string
@@ -43,7 +43,7 @@ class DateTime
 		{
 			return self::getRelativeTimestamp($timestamp ?: time());
 		}
-		
+
 		$timezone = self::getTimezoneForCurrentUser();
 		if (!isset(self::$_timezones[$timezone]))
 		{
@@ -54,10 +54,10 @@ class DateTime
 		$datetime->setTimezone(self::$_timezones[$timezone]);
 		return $datetime->format($format);
 	}
-	
+
 	/**
 	 * Get the current user's timezone.
-	 * 
+	 *
 	 * @return string
 	 */
 	public static function getTimezoneForCurrentUser()
@@ -79,10 +79,10 @@ class DateTime
 			return @date_default_timezone_get();
 		}
 	}
-	
+
 	/**
 	 * Get the list of time zones supported on this server.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getTimezoneList()
@@ -103,10 +103,10 @@ class DateTime
 		$result['Etc/UTC'] = 'GMT/UTC (+00:00)';
 		return $result;
 	}
-	
+
 	/**
 	 * Get the absolute (UTC) offset of a timezone.
-	 * 
+	 *
 	 * @param string $timezone Timezone identifier, e.g. Asia/Seoul
 	 * @param int $timestamp Unix timestamp (optional, default is now)
 	 * @return int
@@ -122,10 +122,10 @@ class DateTime
 		$datetime->setTimezone(self::$_timezones[$timezone]);
 		return $datetime->getOffset();
 	}
-	
+
 	/**
 	 * Get the relative offset between a timezone and Rhymix's internal timezone.
-	 * 
+	 *
 	 * @param string $timezone Timezone identifier, e.g. Asia/Seoul
 	 * @param int $timestamp Unix timestamp (optional, default is now)
 	 * @return int
@@ -134,10 +134,10 @@ class DateTime
 	{
 		return self::getTimezoneOffset($timezone, $timestamp) - Config::get('locale.internal_timezone');
 	}
-	
+
 	/**
 	 * Get the absolute (UTC) offset of a timezone written in XE legacy format ('+0900').
-	 * 
+	 *
 	 * @param string $timezone
 	 * @return int
 	 */
@@ -148,16 +148,16 @@ class DateTime
 		list($hours, $minutes) = str_split($timezone, 2);
 		return (((int)$hours * 60) + (int)$minutes) * $multiplier;
 	}
-	
+
 	/**
 	 * Get a PHP time zone by UTC offset.
-	 * 
+	 *
 	 * Time zones with both (a) fractional offsets and (b) daylight saving time
 	 * (such as Iran's +03:30/+04:30) cannot be converted in this way.
 	 * However, if Rhymix is installed for the first time in such a time zone,
 	 * the internal time zone will be automatically set to UTC,
 	 * so this should never be a problem in practice.
-	 * 
+	 *
 	 * @param int $offset
 	 * @return bool
 	 */
@@ -178,10 +178,10 @@ class DateTime
 			default: return 'Etc/GMT' . ($offset > 0 ? '-' : '+') . intval(abs($offset / 3600));
 		}
 	}
-	
+
 	/**
 	 * Get a relative timestamp (3 hours ago, etc.)
-	 * 
+	 *
 	 * @param int $timestamp
 	 * @return string
 	 */
@@ -189,7 +189,7 @@ class DateTime
 	{
 		$diff = \RX_TIME - $timestamp;
 		$langs = lang('common.time_gap');
-		
+
 		if ($diff < 3)
 		{
 			return $langs['now'];
diff --git a/common/framework/Debug.php b/common/framework/Debug.php
index 00dc235c3..e7bc81dc3 100644
--- a/common/framework/Debug.php
+++ b/common/framework/Debug.php
@@ -25,90 +25,90 @@ class Debug
 	protected static $_slow_remote_requests = array();
 	protected static $_session_time = 0;
 	protected static $_query_time = 0;
-	
+
 	/**
 	 * Enable log collection.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function enable()
 	{
 		self::$_enabled = true;
 	}
-	
+
 	/**
 	 * Disable log collection.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function disable()
 	{
 		self::$_enabled = false;
 	}
-	
+
 	/**
 	 * Get all entries.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getEntries()
 	{
 		return self::$_entries;
 	}
-	
+
 	/**
 	 * Clear all entries.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearEntries()
 	{
 		self::$_entries = array();
 	}
-	
+
 	/**
 	 * Get all errors.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getErrors()
 	{
 		return self::$_errors;
 	}
-	
+
 	/**
 	 * Clear all errors.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearErrors()
 	{
 		self::$_errors = array();
 	}
-	
+
 	/**
 	 * Get all queries.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getQueries()
 	{
 		return self::$_queries;
 	}
-	
+
 	/**
 	 * Get all slow queries.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getSlowQueries()
 	{
 		return self::$_slow_queries;
 	}
-	
+
 	/**
 	 * Clear all queries.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearQueries()
@@ -116,30 +116,30 @@ class Debug
 		self::$_queries = array();
 		self::$_slow_queries = array();
 	}
-	
+
 	/**
 	 * Get all triggers.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getTriggers()
 	{
 		return self::$_triggers;
 	}
-	
+
 	/**
 	 * Get all slow triggers.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getSlowTriggers()
 	{
 		return self::$_slow_triggers;
 	}
-	
+
 	/**
 	 * Clear all triggers.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearTriggers()
@@ -147,30 +147,30 @@ class Debug
 		self::$_triggers = array();
 		self::$_slow_triggers = array();
 	}
-	
+
 	/**
 	 * Get all widgets.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getWidgets()
 	{
 		return self::$_widgets;
 	}
-	
+
 	/**
 	 * Get all slow widgets.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getSlowWidgets()
 	{
 		return self::$_slow_widgets;
 	}
-	
+
 	/**
 	 * Clear all widgets.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearWidgets()
@@ -178,30 +178,30 @@ class Debug
 		self::$_widgets = array();
 		self::$_slow_widgets = array();
 	}
-	
+
 	/**
 	 * Get all remote requests.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getRemoteRequests()
 	{
 		return self::$_remote_requests;
 	}
-	
+
 	/**
 	 * Get all slow remote requests.
-	 * 
+	 *
 	 * @return array
 	 */
 	public static function getSlowRemoteRequests()
 	{
 		return self::$_slow_remote_requests;
 	}
-	
+
 	/**
 	 * Clear all remote requests.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearRemoteRequests()
@@ -209,10 +209,10 @@ class Debug
 		self::$_remote_requests = array();
 		self::$_slow_remote_requests = array();
 	}
-	
+
 	/**
 	 * Clear all records.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function clearAll()
@@ -230,10 +230,10 @@ class Debug
 		self::$_session_time = 0;
 		self::$_query_time = 0;
 	}
-	
+
 	/**
 	 * Add a filename alias.
-	 * 
+	 *
 	 * @param string $display_filename
 	 * @param string $real_filename
 	 * @return void
@@ -242,10 +242,10 @@ class Debug
 	{
 		self::$_aliases[$real_filename] = $display_filename;
 	}
-	
+
 	/**
 	 * Add session start time.
-	 * 
+	 *
 	 * @param float $session_start_time
 	 * @return void
 	 */
@@ -253,10 +253,10 @@ class Debug
 	{
 		self::$_session_time += $session_start_time;
 	}
-	
+
 	/**
 	 * Add an arbitrary entry to the log.
-	 * 
+	 *
 	 * @param string $message
 	 * @return void
 	 */
@@ -267,14 +267,14 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Get the backtrace.
 		$backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
 		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && empty($backtrace[1]['class']))
 		{
 			array_shift($backtrace);
 		}
-		
+
 		// Create a log entry.
 		$entry = (object)array(
 			'message' => unserialize(serialize($message)),
@@ -285,7 +285,7 @@ class Debug
 			'type' => 'Debug',
 		);
 		self::$_entries[] = $entry;
-		
+
 		// Add the entry to the error log.
 		if (isset(self::$_config['write_error_log']) && self::$_config['write_error_log'] === 'all')
 		{
@@ -294,10 +294,10 @@ class Debug
 			error_log($log_entry);
 		}
 	}
-	
+
 	/**
 	 * Add a PHP error to the log.
-	 * 
+	 *
 	 * @param int $errno
 	 * @param string $errstr
 	 * @param string $errfile
@@ -312,13 +312,13 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Do not handle error types that we were told to ignore.
 		if (!($errno & error_reporting()))
 		{
 			return;
 		}
-		
+
 		// Rewrite the error message with relative paths.
 		$message = str_replace(array(
 			' called in ' . \RX_BASEDIR,
@@ -327,10 +327,10 @@ class Debug
 			' called in ',
 			' defined in ',
 		), $errstr);
-		
+
 		// Get the backtrace.
 		$backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
-		
+
 		// Prepare the error entry.
 		self::$_errors[] = $errinfo = (object)array(
 			'message' => $message,
@@ -340,7 +340,7 @@ class Debug
 			'time' => microtime(true),
 			'type' => self::getErrorType($errno),
 		);
-		
+
 		// Add the entry to the error log.
 		if (isset(self::$_config['write_error_log']) && self::$_config['write_error_log'] === 'all')
 		{
@@ -348,10 +348,10 @@ class Debug
 			error_log($log_entry . \PHP_EOL . self::formatBacktrace($backtrace));
 		}
 	}
-	
+
 	/**
 	 * Add a query to the log.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function addQuery($query)
@@ -361,7 +361,7 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Prepare the log entry.
 		$query_object = (object)array(
 			'query_id' => $query['query_id'],
@@ -377,10 +377,10 @@ class Debug
 			'time' => microtime(true),
 			'type' => 'Query',
 		);
-		
+
 		self::$_queries[] = $query_object;
 		self::$_query_time += $query_object->query_time;
-		
+
 		// Add the entry to the error log if the result wasn't successful.
 		if ($query['result'] === 'error')
 		{
@@ -392,26 +392,26 @@ class Debug
 				'time' => $query_object->time,
 				'type' => 'Query Error',
 			);
-			
+
 			self::$_errors[] = $error_object;
-			
+
 			if (self::$_config['write_error_log'] === 'all')
 			{
 				$log_entry = strtr(sprintf('Query Error: %s in %s on line %d', $error_object->message, $error_object->file, intval($error_object->line)), "\0\r\n\t\v\e\f", '       ');
 				error_log($log_entry . \PHP_EOL . self::formatBacktrace($error_object->backtrace));
 			}
 		}
-		
+
 		// Add the entry to the slow query log.
 		if ($query_object->query_time && $query_object->query_time >= (self::$_config['log_slow_queries'] ?? 1))
 		{
 			self::$_slow_queries[] = $query_object;
 		}
 	}
-	
+
 	/**
 	 * Add a trigger to the log.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public static function addTrigger($trigger)
@@ -421,7 +421,7 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Prepare the log entry.
 		$trigger_object = (object)array(
 			'trigger_name' => $trigger['name'],
@@ -435,17 +435,17 @@ class Debug
 			'time' => microtime(true),
 			'type' => 'Trigger',
 		);
-		
+
 		self::$_triggers[] = $trigger_object;
 		if ($trigger_object->trigger_time && $trigger_object->trigger_time >= (self::$_config['log_slow_triggers'] ?? 1))
 		{
 			self::$_slow_triggers[] = $trigger_object;
 		}
 	}
-	
+
 	/**
 	 * Add a widget to the log.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public static function addWidget($widget)
@@ -455,7 +455,7 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Prepare the log entry.
 		$widget_object = (object)array(
 			'widget_name' => $widget['name'],
@@ -467,17 +467,17 @@ class Debug
 			'time' => microtime(true),
 			'type' => 'Widget',
 		);
-		
+
 		self::$_widgets[] = $widget_object;
 		if ($widget_object->widget_time && $widget_object->widget_time >= (self::$_config['log_slow_widgets'] ?? 1))
 		{
 			self::$_slow_widgets[] = $widget_object;
 		}
 	}
-	
+
 	/**
 	 * Add a remote request to the log.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public static function addRemoteRequest($request)
@@ -487,7 +487,7 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Prepare the log entry.
 		$request_object = (object)array(
 			'url' => $request['url'],
@@ -501,17 +501,17 @@ class Debug
 			'time' => microtime(true),
 			'type' => 'Remote Request',
 		);
-		
+
 		self::$_remote_requests[] = $request_object;
 		if ($request_object->elapsed_time && $request_object->elapsed_time >= (self::$_config['log_slow_remote_requests'] ?? 1))
 		{
 			self::$_slow_remote_requests[] = $request_object;
 		}
 	}
-	
+
 	/**
 	 * The default handler for catching exceptions.
-	 * 
+	 *
 	 * @param Exception $e
 	 * @return void
 	 */
@@ -519,7 +519,7 @@ class Debug
 	{
 		// Find out the file where the error really occurred.
 		$errfile = self::translateFilename($e->getFile());
-		
+
 		// If the exception was thrown in a Rhymix Framework class, find out where that class was called.
 		$backtrace = $e->getTrace();
 		$caller_errfile = $errfile;
@@ -537,9 +537,9 @@ class Debug
 				$caller_errline = $trace['line'];
 			}
 		}
-		
+
 		// Add the exception to the error log.
-		
+
 		if ($caller_errfile && $caller_errfile !== $errfile)
 		{
 			$log_entry = str_replace("\0", '', sprintf('%s #%d "%s" in %s on line %d (via %s on line %d)',
@@ -554,15 +554,15 @@ class Debug
 		{
 			error_log('PHP Exception: ' . $log_entry . \PHP_EOL . self::formatBacktrace($e->getTrace()));
 		}
-		
+
 		// Display the error screen.
 		self::displayErrorScreen($log_entry);
 		exit;
 	}
-	
+
 	/**
 	 * The default handler for catching fatal errors.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function shutdownHandler()
@@ -573,10 +573,10 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Find out the file where the error really occurred.
 		$errinfo['file'] = self::translateFilename($errinfo['file']);
-		
+
 		// Add the entry to the error log.
 		$message = sprintf('%s in %s on line %d', $errinfo['message'], $errinfo['file'], intval($errinfo['line']));
 		$log_entry = str_replace("\0", '', 'PHP ' . self::getErrorType($errinfo['type']) . ': ' . $message);
@@ -584,11 +584,11 @@ class Debug
 		{
 			error_log($log_entry);
 		}
-		
+
 		// Display the error screen.
 		self::displayErrorScreen($log_entry);
 	}
-	
+
 	/**
 	 * Format a backtrace for error logging.
 	 */
@@ -607,10 +607,10 @@ class Debug
 		}
 		return implode(\PHP_EOL, $result);
 	}
-	
+
 	/**
 	 * Translate filenames.
-	 * 
+	 *
 	 * @param string $filename
 	 * @return string
 	 */
@@ -626,10 +626,10 @@ class Debug
 		}
 		return $filename;
 	}
-	
+
 	/**
 	 * Register all error handlers.
-	 * 
+	 *
 	 * @return void
 	 */
 	public static function registerErrorHandlers($error_types)
@@ -639,10 +639,10 @@ class Debug
 		set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler');
 		register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler');
 	}
-	
+
 	/**
 	 * Display a fatal error screen.
-	 * 
+	 *
 	 * @param string $message
 	 * @return void
 	 */
@@ -653,20 +653,20 @@ class Debug
 		{
 			return;
 		}
-		
+
 		// Disable output buffering.
 		while (ob_get_level())
 		{
 			ob_end_clean();
 		}
-		
+
 		// Localize the error title.
 		$title = lang('msg_server_error');
 		if ($title === 'msg_server_error')
 		{
 			$message = 'Server Error';
 		}
-		
+
 		// Localize the error message.
 		$display_error_message = ini_get('display_errors') || !\Context::isInstalled() || Session::isAdmin() || self::isEnabledForCurrentUser();
 		$message = $display_error_message ? $message : lang('msg_server_error_see_log');
@@ -674,7 +674,7 @@ class Debug
 		{
 			$message = 'Your server is configured to hide error messages. Please see your server\'s error log for details.';
 		}
-		
+
 		// Display a generic error page.
 		try
 		{
@@ -685,10 +685,10 @@ class Debug
 			self::displayError($message);
 		}
 	}
-	
+
 	/**
 	 * Display a default error.
-	 * 
+	 *
 	 * @param string $message
 	 * @return void
 	 */
@@ -706,10 +706,10 @@ class Debug
 			echo json_encode(array('error' => -1, 'message' => escape($message, false)), \JSON_UNESCAPED_UNICODE);
 		}
 	}
-	
+
 	/**
 	 * Check if debugging is enabled for the current user.
-	 * 
+	 *
 	 * @return bool
 	 */
 	public static function isEnabledForCurrentUser()
@@ -722,12 +722,12 @@ class Debug
 		{
 			return self::$_enabled = false;
 		}
-		
+
 		switch (self::$_config['display_to'])
 		{
 			case 'everyone':
 				return self::$_enabled = true;
-			
+
 			case 'ip':
 				if (Filters\IpFilter::inRanges(\RX_CLIENT_IP, self::$_config['allow']))
 				{
@@ -742,7 +742,7 @@ class Debug
 					return self::$_enabled = true;
 				}
 				return self::$_enabled = false;
-			
+
 			case 'admin':
 			default:
 				$logged_info = \Context::get('logged_info');
@@ -760,10 +760,10 @@ class Debug
 				}
 		}
 	}
-	
+
 	/**
 	 * Get all debug information as an object.
-	 * 
+	 *
 	 * @return object
 	 */
 	public static function getDebugData()
@@ -802,7 +802,7 @@ class Debug
 			'slow_widgets' => self::$_slow_widgets,
 			'slow_remote_requests' => self::$_slow_remote_requests,
 		);
-		
+
 		// Clean up the querystring.
 		if (isset($data->queries))
 		{
@@ -811,7 +811,7 @@ class Debug
 				$query->query_string = trim(utf8_normalize_spaces($query->query_string, true));
 			}
 		}
-		
+
 		// Clean up the backtrace.
 		foreach (array('entries', 'errors', 'queries', 'slow_queries', 'remote_requests', 'slow_remote_requests') as $key)
 		{
@@ -838,13 +838,13 @@ class Debug
 				}
 			}
 		}
-		
+
 		return $data;
 	}
-	
+
 	/**
 	 * Convert a PHP error number to the corresponding error name.
-	 * 
+	 *
 	 * @param int $errno
 	 * @return string
 	 */
diff --git a/common/framework/Exception.php b/common/framework/Exception.php
index 7d61053a4..0ff93aa68 100644
--- a/common/framework/Exception.php
+++ b/common/framework/Exception.php
@@ -7,5 +7,5 @@ namespace Rhymix\Framework;
  */
 class Exception extends \Exception
 {
-	
+
 }
diff --git a/common/framework/Formatter.php b/common/framework/Formatter.php
index 8f17d59a2..005406ecd 100644
--- a/common/framework/Formatter.php
+++ b/common/framework/Formatter.php
@@ -12,16 +12,16 @@ class Formatter
 	 */
 	const TEXT_NEWLINE_AS_P = 1;
 	const TEXT_DOUBLE_NEWLINE_AS_P = 2;
-	
+
 	/**
 	 * Options for Markdown to HTML conversion.
 	 */
 	const MD_NEWLINE_AS_BR = 16;
 	const MD_ENABLE_EXTRA = 128;
-	
+
 	/**
 	 * Convert plain text to HTML.
-	 * 
+	 *
 	 * @param string $text
 	 * @param int $options (optional)
 	 * @return string
@@ -39,7 +39,7 @@ class Formatter
 			}
 			return $result;
 		}
-		
+
 		// This option uses 
to separate lines and

to separate paragraphs. if ($options & self::TEXT_DOUBLE_NEWLINE_AS_P) { @@ -52,14 +52,14 @@ class Formatter } return $result; } - + // The default is to use
always. return nl2br(escape(trim($text))) . "
\n"; } - + /** * Convert HTML to plain text. - * + * * @param string $html * @return string */ @@ -69,7 +69,7 @@ class Formatter $html = preg_replace('!]*>\s*!i', "\n", $html); $html = preg_replace('!]*>\s*!i', '', $html); $html = preg_replace('!]*>\s*!i', "\n\n", $html); - + // Encode links and images to preserve essential information. $html = preg_replace_callback('!]*href="([^>"]+)"[^>]*>([^<]*)!i', function($matches) { return trim($matches[2] . ' <' . $matches[1] . '>'); @@ -79,20 +79,20 @@ class Formatter $title = $title ?: (preg_match('!alt="([^>"]+)"!i', $matches[0], $m) ? $m[1] : 'IMAGE'); return trim('[' . $title . '] <' . $matches[1] . '>'); }, $html); - + // Strip all other HTML. $text = html_entity_decode(strip_tags($html)); unset($html); - + // Normalize whitespace and return. $text = str_replace("\r\n", "\n", $text); $text = preg_replace('/\n(?:\s*\n)+/', "\n\n", $text); return trim($text) . "\n"; } - + /** * Convert Markdown to HTML. - * + * * @param string $markdown * @param int $options (optional) * @return string @@ -110,19 +110,19 @@ class Formatter $classes = false; $parser = new \Michelf\Markdown; } - + if ($options & self::MD_NEWLINE_AS_BR) { $parser->hard_wrap = true; } - + $html = $parser->transform($markdown); return Filters\HTMLFilter::clean($html, $classes); } - + /** * Convert HTML to Markdown. - * + * * @param string $html * @return string */ @@ -133,10 +133,10 @@ class Formatter $converter->getConfig()->setOption('strip_tags', true); return trim($converter->convert($html)) . "\n"; } - + /** * Convert BBCode to HTML. - * + * * @param string $bbcode * @return string */ @@ -144,21 +144,21 @@ class Formatter { $parser = new \JBBCode\Parser; $parser->addCodeDefinitionSet(new \JBBCode\DefaultCodeDefinitionSet()); - + $builder = new \JBBCode\CodeDefinitionBuilder('quote', '

{param}
'); $parser->addCodeDefinition($builder->build()); $builder = new \JBBCode\CodeDefinitionBuilder('code', '
{param}
'); $builder->setParseContent(false); $parser->addCodeDefinition($builder->build()); - + $parser->parse($bbcode); $html = $parser->getAsHtml(); return Filters\HTMLFilter::clean($html); } - + /** * Apply smart quotes and other stylistic enhancements to HTML. - * + * * @param string $html * @return string */ @@ -166,10 +166,10 @@ class Formatter { return \Michelf\SmartyPants::defaultTransform($html, 'qbBdDiew'); } - + /** * Compile LESS into CSS. - * + * * @param string|array $source_filename * @param string $target_filename * @param array $variables (optional) @@ -181,7 +181,7 @@ class Formatter // Get the cleaned and concatenated content. $imported_list = []; $content = self::concatCSS($source_filename, $target_filename, true, $imported_list); - + // Compile! try { @@ -192,7 +192,7 @@ class Formatter { $less_compiler->setVariables($variables); } - + $content = $less_compiler->compile($content) . "\n"; $content = strpos($content, '@charset') === false ? ('@charset "UTF-8";' . "\n" . $content) : $content; $result = true; @@ -204,20 +204,20 @@ class Formatter $content = sprintf("/*\n Error while compiling %s\n\n %s\n*/\n", $filename, $message); $result = false; } - + // Save the result to the target file. Storage::write($target_filename, $content); - + // Save the list of imported files. Storage::writePHPData(preg_replace('/\.css$/', '.imports.php', $target_filename), $imported_list, null, false); - + // Also return the compiled CSS content. return $result; } - + /** * Compile SCSS into CSS. - * + * * @param string|array $source_filename * @param string $target_filename * @param array $variables (optional) @@ -229,7 +229,7 @@ class Formatter // Get the cleaned and concatenated content. $imported_list = []; $content = self::concatCSS($source_filename, $target_filename, true, $imported_list); - + // Compile! try { @@ -240,7 +240,7 @@ class Formatter { $scss_compiler->addVariables(array_map('\ScssPhp\ScssPhp\ValueConverter::parseValue', $variables)); } - + $content = $scss_compiler->compileString($content)->getCss() . "\n"; $content = strpos($content, '@charset') === false ? ('@charset "UTF-8";' . "\n" . $content) : $content; $result = true; @@ -252,20 +252,20 @@ class Formatter $content = sprintf("/*\n Error while compiling %s\n\n %s\n*/\n", $filename, $message); $result = false; } - + // Save the result to the target file. Storage::write($target_filename, $content); - + // Save the list of imported files. Storage::writePHPData(preg_replace('/\.css$/', '.imports.php', $target_filename), $imported_list, null, false); - + // Also return the compiled CSS content. return $result; } - + /** * Minify CSS. - * + * * @param string|array $source_filename * @param string $target_filename * @return bool @@ -290,10 +290,10 @@ class Formatter Storage::write($target_filename, $content); return strlen($content) ? true : false; } - + /** * Minify JS. - * + * * @param string|array $source_filename * @param string $target_filename * @return bool @@ -316,10 +316,10 @@ class Formatter Storage::write($target_filename, $content); return strlen($content) ? true : false; } - + /** * CSS concatenation subroutine for compileLESS() and compileSCSS(). - * + * * @param string|array $source_filename * @param string $target_filename * @param bool $add_comment @@ -331,12 +331,12 @@ class Formatter $charsets = []; $imported_urls = []; $result = ''; - + if (!is_array($source_filename)) { $source_filename = array($source_filename); } - + foreach ($source_filename as $filename) { // Get the media query. @@ -348,10 +348,10 @@ class Formatter { $media = null; } - + // Clean the content. $content = utf8_clean(file_get_contents($filename)); - + // Convert all paths in LESS and SCSS imports, too. $dirname = dirname($filename); $import_type = ends_with('.scss', $filename) ? 'scss' : 'normal'; @@ -421,7 +421,7 @@ class Formatter } return trim($import_content); }, $content); - + // Convert all paths to be relative to the new filename. $path_converter = new \MatthiasMullie\PathConverter\Converter($filename, $target_filename); $content = preg_replace_callback('/\burl\\(([^)]+)\\)/iU', function($matches) use ($path_converter) { @@ -436,19 +436,19 @@ class Formatter } }, $content); unset($path_converter); - + // Extract all @charset declarations. $content = preg_replace_callback('/@charset\s+(["\'a-z0-9_-]+);[\r\n]*/i', function($matches) use (&$charsets) { $charsets[] = trim($matches[1], '"\''); return ''; }, $content); - + // Wrap the content in a media query if there is one. if ($media !== null) { $content = "@media $media {\n\n" . trim($content) . "\n\n}"; } - + // Append to the result string. $original_filename = starts_with(\RX_BASEDIR, $filename) ? substr($filename, strlen(\RX_BASEDIR)) : $filename; if ($add_comment) @@ -460,7 +460,7 @@ class Formatter $result .= trim($content) . "\n\n"; } } - + // Place all @charset and @import statements at the beginning. if (count($imported_urls)) { @@ -474,13 +474,13 @@ class Formatter $charset = '@charset "' . escape_dqstr(array_first($charsets)) . '";'; $result = $charset . "\n" . $result; } - + return $result; } - + /** * JS concatenation subroutine. - * + * * @param string|array $source_filename * @param string $target_filename * @return string @@ -488,12 +488,12 @@ class Formatter public static function concatJS($source_filename, $target_filename) { $result = ''; - + if (!is_array($source_filename)) { $source_filename = array($source_filename); } - + foreach ($source_filename as $filename) { // Handle the array format, previously used for the targetIE attribute. @@ -501,21 +501,21 @@ class Formatter { $filename = reset($filename); } - + // Clean the content. $content = utf8_clean(file_get_contents($filename)); - + // Append to the result string. $original_filename = starts_with(\RX_BASEDIR, $filename) ? substr($filename, strlen(\RX_BASEDIR)) : $filename; $result .= '/* Original file: ' . $original_filename . ' */' . "\n\n" . trim($content) . ";\n\n"; } - + return $result; } - + /** * Convert IE conditional comments to JS conditions. - * + * * @deprecated * @param string $condition * @return string diff --git a/common/framework/Image.php b/common/framework/Image.php index ff638f3a9..2fa9cbebb 100644 --- a/common/framework/Image.php +++ b/common/framework/Image.php @@ -9,7 +9,7 @@ class Image { /** * Check if a file is an image - * + * * @param string $filename * @return bool */ @@ -17,10 +17,10 @@ class Image { return array_shift(explode('/', MIME::getContentType($filename))) === 'image'; } - + /** * Check if a file is an animated GIF. - * + * * @param string $filename * @return bool */ @@ -46,10 +46,10 @@ class Image fclose($fp); return $frames > 1; } - + /** * Get image information - * + * * @param string $filename * @return array|false */ diff --git a/common/framework/Korea.php b/common/framework/Korea.php index a7413af64..fa6e1c9c2 100644 --- a/common/framework/Korea.php +++ b/common/framework/Korea.php @@ -9,7 +9,7 @@ class Korea { /** * Format a phone number. - * + * * @param string $num * @return string */ @@ -17,7 +17,7 @@ class Korea { // Remove all non-numbers. $num = preg_replace('/[^0-9]/', '', $num); - + // Remove the country code. if (strncmp($num, '82', 2) === 0) { @@ -27,7 +27,7 @@ class Korea $num = '0' . $num; } } - + // Apply different format based on the number of digits. switch (strlen($num)) { @@ -62,10 +62,10 @@ class Korea } } } - + /** * Check if a Korean phone number contains a valid area code and the correct number of digits. - * + * * @param string $num * @return bool */ @@ -90,10 +90,10 @@ class Korea } return false; } - + /** * Check if a Korean phone number is a mobile phone number. - * + * * @param string $num * @return bool */ @@ -103,14 +103,14 @@ class Korea $len = strlen($num); return preg_match('/^01[016789][2-9][0-9]{6,7}$/', $num) ? true : false; } - + /** * Check if the given string is a valid resident registration number (주민등록번호) * or foreigner registration number (외국인등록번호). - * + * * This method only checks the format. * It does not check that the number is actually in use. - * + * * @param string $code * @return bool */ @@ -121,16 +121,16 @@ class Korea { return false; } - + // Remove hyphen. $code = str_replace('-', '', $code); - + // Return false if the date of birth is in the future. if (in_array((int)($code[6]), array(3, 4, 7, 8)) && intval(substr($code, 0, 6), 10) > date('ymd')) { return false; } - + // Calculate the checksum. $sum = 0; for ($i = 0; $i < 12; $i++) @@ -154,13 +154,13 @@ class Korea } } } - + /** * Check if the given string is a valid corporation registration number (법인등록번호). - * + * * This method only checks the format. * It does not check that the number is actually in use. - * + * * @param string $code * @return bool */ @@ -171,10 +171,10 @@ class Korea { return false; } - + // Remove hyphen. $code = str_replace('-', '', $code); - + // Calculate the checksum. $sum = 0; for ($i = 0; $i < 12; $i++) @@ -182,7 +182,7 @@ class Korea $sum += $code[$i] * (($i % 2) + 1); } $checksum = (10 - ($sum % 10)) % 10; - + // Check the 7th and 13th digits. if ($code[6] !== '0') { @@ -190,13 +190,13 @@ class Korea } return $checksum === (int)($code[12]); } - + /** * Check if the given string is a valid business registration number (사업자등록번호). - * + * * This method only checks the format. * It does not check that the number is actually in use. - * + * * @param string $code * @return bool */ @@ -207,10 +207,10 @@ class Korea { return false; } - + // Remove hyphen. $code = str_replace('-', '', $code); - + // Calculate the checksum. $sum = 0; $sum += $code[0] + ($code[1] * 3) + ($code[2] * 7); @@ -218,17 +218,17 @@ class Korea $sum += $code[6] + ($code[7] * 3) + ($code[8] * 5); $sum += floor(($code[8] * 5) / 10); $checksum = (10 - ($sum % 10)) % 10; - + // Check the last digit. return $checksum === (int)($code[9]); } - + /** * Check if the given IP address is Korean. * * This method may return incorrect results if the IP allocation databases * (korea.ipv4.php, korea.ipv6.php) are out of date. - * + * * @param string $ip * @return bool */ @@ -236,22 +236,22 @@ class Korea { // Extract the IPv4 address from an "IPv4-mapped IPv6" address. if (preg_match('/::ffff:(?:0+:)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/', $ip, $matches)) $ip = $matches[1]; - + // Return false if the IP address is not in the right format. if (!filter_var($ip, \FILTER_VALIDATE_IP)) return false; - + // Check IPv4. if (filter_var($ip, \FILTER_VALIDATE_IP, array('flags' => \FILTER_FLAG_IPV4))) { // Convert to integer. $ipnum = sprintf('%u', ip2long($ip)); - + // Treat local addresses as Korean. if ($ipnum >= 167772160 && $ipnum <= 184549375) return true; // 10.0.0.0/8 if ($ipnum >= 2130706432 && $ipnum <= 2147483647) return true; // 127.0.0.0/8 if ($ipnum >= 3232235520 && $ipnum <= 3232301055) return true; // 192.168.0.0/16 if ($ipnum >= 2886729728 && $ipnum <= 2887778303) return true; // 172.16.0.0/20 - + // Check the IPv4 allocation database. $ranges = (include \RX_BASEDIR . 'common/defaults/korea.ipv4.php'); foreach ($ranges as $range) @@ -260,17 +260,17 @@ class Korea } return false; } - + // Check IPv6. elseif (function_exists('inet_pton')) { // Convert to hexadecimal format. $ipbin = strtolower(bin2hex(inet_pton($ip))); - + // Treat local addresses as Korean. if ($ipbin == '00000000000000000000000000000001') return true; // ::1 if (preg_match('/^f(?:[cd]|e80{13})/', $ipbin)) return true; // fc00::/8, fd00::/8, fe80::/64 - + // Check the IPv6 allocation database. $ranges = (include \RX_BASEDIR . 'common/defaults/korea.ipv6.php'); foreach ($ranges as $range) @@ -279,16 +279,16 @@ class Korea } return false; } - + return false; } - + /** * Check if the given email address is hosted by a Korean portal site. - * + * * This can be used to tell which recipients may subscribe to the KISA RBL (kisarbl.or.kr). * If the domain is not found, this method returns false. - * + * * @param string $domain * @param bool $clear_cache (optional) * @return bool @@ -300,7 +300,7 @@ class Korea { self::$_domain_cache = array(); } - + // Get the domain from the email address. if ($pos = strpos($email_address, '@')) { @@ -311,13 +311,13 @@ class Korea $domain = $email_address; } $domain = rtrim(strtolower($domain), '.'); - + // Return cached result if available. if (array_key_exists($domain, self::$_domain_cache)) { return self::$_domain_cache[$domain]; } - + // Shortcut for known domains. if (in_array($domain, self::$known_korean)) { @@ -327,10 +327,10 @@ class Korea { return self::$_domain_cache[$domain] = false; } - + // For unknown domains, check the MX record. $mx = self::_getDNSRecords($domain, \DNS_MX); - + $i = 0; foreach ($mx as $mx) { @@ -358,13 +358,13 @@ class Korea break; } } - + return self::$_domain_cache[$domain] = false; } - + /** * Get the DNS records of a domain. - * + * * @param string $domain * @param int $type * @return array @@ -376,7 +376,7 @@ class Korea { return array(); } - + $result = array(); foreach ($records as $record) { @@ -397,16 +397,16 @@ class Korea $result[] = $record['txt']; } } - + ksort($result); return $result; } - + /** * Prevent multiple lookups for the same domain. */ protected static $_domain_cache = array(); - + /** * Domains known to be Korean and subscribed to the KISA RBL. */ @@ -432,7 +432,7 @@ class Korea 'empal.com', 'hanafos.com', ); - + /** * Domains known to be foreign. */ diff --git a/common/framework/Lang.php b/common/framework/Lang.php index aebc123da..5417e6e77 100644 --- a/common/framework/Lang.php +++ b/common/framework/Lang.php @@ -11,7 +11,7 @@ class Lang * Instances are stored here. */ protected static $_instances = array(); - + /** * Configuration. */ @@ -19,10 +19,10 @@ class Lang protected $_loaded_directories = array(); protected $_loaded_plugins = array(); protected $_search_priority = array(); - + /** * This method returns the cached instance of a language. - * + * * @param string $language * @return object */ @@ -38,10 +38,10 @@ class Lang } return self::$_instances[$language]; } - + /** * The constructor should not be called from outside. - * + * * @param string $language */ protected function __construct($language) @@ -49,20 +49,20 @@ class Lang $this->_language = preg_replace('/[^a-z0-9_-]/i', '', $language); $this->_loaded_plugins['_custom_'] = new \stdClass(); } - + /** * Return language type. - * + * * @return string */ public function langType() { return $this->_language; } - + /** * Load translations from a plugin (module, addon). - * + * * @param string $name * @return bool */ @@ -72,7 +72,7 @@ class Lang { return true; } - + if ($name === 'common') { $this->loadDirectory(\RX_BASEDIR . 'common/lang', 'common'); @@ -90,10 +90,10 @@ class Lang $this->loadDirectory(\RX_BASEDIR . "addons/$name/lang", $name); } } - + /** * Load translations from a directory. - * + * * @param string $dir * @param string $plugin_name * @return bool @@ -107,12 +107,12 @@ class Lang { return true; } - + // Initialize variables. $filename = null; $lang = new \stdClass; $result = true; - + // Find a suitable language file in the given directory. if (file_exists($dir . '/' . $this->_language . '.php')) { @@ -130,7 +130,7 @@ class Lang { $filename = $dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php'; } - + // Load the language file. if ($filename) { @@ -142,23 +142,23 @@ class Lang { $result = false; } - + // Mark this directory and plugin as loaded. $this->_loaded_directories[$dir] = true; $this->_loaded_plugins[$plugin_name] = $lang; - + // Load the same directory in the default language, too. if ($this->_language !== 'en') { self::getInstance('en')->loadDirectory($dir, $plugin_name); } - + return $result; } - + /** * Get the list of supported languages. - * + * * @return array */ public static function getSupportedList() @@ -170,10 +170,10 @@ class Lang } return $list; } - + /** * Generic getter. - * + * * @param string $key * @return string */ @@ -185,20 +185,20 @@ class Lang { $args = $args[0]; } - + // Get the translation. $translation = $this->__get($key); - + // If there are no arguments, return the translation. if (!count($args)) return $translation; - + // If there are arguments, interpolate them into the translation and return the result. return vsprintf($translation, $args); } - + /** * Generic setter. - * + * * @param string $key * @param string $value * @return void @@ -207,10 +207,10 @@ class Lang { $this->__set($key, $value); } - + /** * Fallback method for getting the default translation. - * + * * @param string $key * @return string */ @@ -225,10 +225,10 @@ class Lang return self::getInstance('en')->__get($key); } } - + /** * Magic method for translations without arguments. - * + * * @param string $key * @return string */ @@ -247,7 +247,7 @@ class Lang { return $this->getFromDefaultLang($key); } - + // Find the given key. $lang = $this->_loaded_plugins[$plugin_name]; foreach ($keys as $subkey) @@ -267,14 +267,14 @@ class Lang } return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; } - + // Search custom translations first. if (isset($this->_loaded_plugins['_custom_']->{$key})) { $lang = $this->_loaded_plugins['_custom_']->{$key}; return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; } - + // Search other plugins. foreach ($this->_search_priority as $plugin_name) { @@ -284,14 +284,14 @@ class Lang return is_array($lang) ? new \ArrayObject($lang, 3) : $lang; } } - + // If no translation is found, return the default language. return $this->getFromDefaultLang($key); } - + /** * Magic method for setting a new custom translation. - * + * * @param string $key * @param string $value * @return void @@ -311,7 +311,7 @@ class Lang { return false; } - + // Set the given key. $count = count($keys); $lang = $this->_loaded_plugins[$plugin_name]; @@ -363,14 +363,14 @@ class Lang } } } - + // Set a regular key. $this->_loaded_plugins['_custom_']->{$key} = $value; } - + /** * Magic method for checking whether a translation exists. - * + * * @param string $key * @return bool */ @@ -385,10 +385,10 @@ class Lang } return false; } - + /** * Magic method for unsetting a translation. - * + * * @param string $key * @return void */ @@ -396,10 +396,10 @@ class Lang { $this->set($key, null); } - + /** * Magic method for translations with arguments. - * + * * @param string $key * @param mixed $args * @return string|null diff --git a/common/framework/MIME.php b/common/framework/MIME.php index 2a0eec848..e29311705 100644 --- a/common/framework/MIME.php +++ b/common/framework/MIME.php @@ -9,9 +9,9 @@ class MIME { /** * Get the MIME type of a file, detected by its content. - * + * * This method returns the MIME type of a file, or false on error. - * + * * @param string $filename * @return array|false */ @@ -38,10 +38,10 @@ class MIME return false; } } - + /** * Get the MIME type for the given extension. - * + * * @param string $extension * @return string */ @@ -50,10 +50,10 @@ class MIME $extension = strtolower($extension); return array_key_exists($extension, self::$_types) ? self::$_types[$extension][0] : self::$_default; } - + /** * Get the MIME type for the given filename. - * + * * @param string $filename * @return string */ @@ -64,10 +64,10 @@ class MIME $extension = strtolower(substr($extension, 1)); return array_key_exists($extension, self::$_types) ? self::$_types[$extension][0] : self::$_default; } - + /** * Get the most common extension for the given MIME type. - * + * * @param string $type * @return string|false */ @@ -82,17 +82,17 @@ class MIME } return false; } - + /** * The default MIME type for unknown extensions. */ protected static $_default = 'application/octet-stream'; - + /** * The list of known MIME types. */ protected static $_types = array( - + // Text-based document formats. 'html' => ['text/html'], 'htm' => ['text/html'], @@ -107,7 +107,7 @@ class MIME 'xsl' => ['text/xml'], 'css' => ['text/css'], 'csv' => ['text/csv'], - + // Binary document formats. 'doc' => ['application/msword'], 'dot' => ['application/msword'], @@ -124,7 +124,7 @@ class MIME 'odb' => ['application/vnd.oasis.opendocument.database'], 'pdf' => ['application/pdf'], 'dvi' => ['application/x-dvi'], - + // Images. 'bmp' => ['image/bmp'], 'gif' => ['image/gif'], @@ -138,7 +138,7 @@ class MIME 'tiff' => ['image/tiff'], 'tif' => ['image/tiff'], 'ico' => ['image/x-icon'], - + // Audio. 'mid' => ['audio/midi'], 'midi' => ['audio/midi'], @@ -153,7 +153,7 @@ class MIME 'aiff' => ['audio/x-aiff'], 'ra' => ['audio/x-realaudio'], 'm4a' => ['audio/x-m4a'], - + // Video. 'avi' => ['video/x-msvideo'], 'flv' => ['video/x-flv'], @@ -173,7 +173,7 @@ class MIME 'wma' => ['video/x-ms-asf'], 'asf' => ['video/x-ms-asf'], 'm4v' => ['video/x-m4v'], - + // Other multimedia file formats. 'psd' => ['application/x-photoshop'], 'swf' => ['application/x-shockwave-flash'], @@ -182,11 +182,11 @@ class MIME 'ps' => ['application/postscript'], 'mif' => ['application/vnd.mif'], 'xul' => ['application/vnd.mozilla.xul+xml'], - + // Source code formats. 'phps' => ['application/x-httpd-php-source'], 'js' => ['application/x-javascript'], - + // Archives. 'bz2' => ['application/x-bzip'], 'gz' => ['application/x-gzip'], @@ -195,13 +195,13 @@ class MIME 'gtar' => ['application/x-gtar'], 'rar' => ['application/x-rar-compressed'], 'zip' => ['application/x-zip'], - + // Executables and packages. 'apk' => ['application/vnd.android.package-archive'], 'pkg' => ['application/x-newton-compatible-pkg'], 'exe' => ['application/vnd.microsoft.portable-executable'], 'msi' => ['application/x-msdownload'], - + // RFC822 email message. 'eml' => ['message/rfc822'], ); diff --git a/common/framework/Mail.php b/common/framework/Mail.php index b49f24db3..911e5bdfc 100644 --- a/common/framework/Mail.php +++ b/common/framework/Mail.php @@ -17,16 +17,16 @@ class Mail protected $attachments = array(); public $errors = array(); protected $sent = false; - + /** * Static properties. */ public static $default_driver = null; public static $custom_drivers = array(); - + /** * Set the default driver. - * + * * @param object $driver * @return void */ @@ -34,10 +34,10 @@ class Mail { self::$default_driver = $driver; } - + /** * Get the default driver. - * + * * @return object */ public static function getDefaultDriver() @@ -58,7 +58,7 @@ class Mail } return self::$default_driver; } - + /** * Add a custom mail driver. */ @@ -66,10 +66,10 @@ class Mail { self::$custom_drivers[] = $driver; } - + /** * Get the list of supported mail drivers. - * + * * @return array */ public static function getSupportedDrivers() @@ -106,7 +106,7 @@ class Mail ksort($result); return $result; } - + /** * The constructor. */ @@ -115,7 +115,7 @@ class Mail $this->message = new \Swift_Message; $this->driver = self::getDefaultDriver(); } - + /** * Set the sender (From:). * @@ -136,7 +136,7 @@ class Mail return false; } } - + /** * Get the sender (From:). * @@ -147,7 +147,7 @@ class Mail $list = $this->message->getFrom(); return $list ? array_first($this->formatAddresses($list)) : null; } - + /** * Add a recipient (To:). * @@ -168,7 +168,7 @@ class Mail return false; } } - + /** * Add a recipient (CC:). * @@ -189,7 +189,7 @@ class Mail return false; } } - + /** * Add a recipient (BCC:). * @@ -210,7 +210,7 @@ class Mail return false; } } - + /** * Get the list of recipients. * @@ -219,7 +219,7 @@ class Mail public function getRecipients() { $result = array(); - + foreach ($this->formatAddresses($this->message->getTo()) as $address) { $result[] = $address; @@ -232,10 +232,10 @@ class Mail { $result[] = $address; } - + return array_unique($result); } - + /** * Set the Reply-To: address. * @@ -255,7 +255,7 @@ class Mail return false; } } - + /** * Set the Return-Path: address. * @@ -275,7 +275,7 @@ class Mail return false; } } - + /** * Set the Message ID. * @@ -296,7 +296,7 @@ class Mail return false; } } - + /** * Set the In-Reply-To: header. * @@ -317,7 +317,7 @@ class Mail return false; } } - + /** * Set the References: header. * @@ -338,7 +338,7 @@ class Mail return false; } } - + /** * Set the subject. * @@ -358,7 +358,7 @@ class Mail return false; } } - + /** * Get the subject. * @@ -368,7 +368,7 @@ class Mail { return $this->message->getSubject(); } - + /** * Set the subject (alias to setSubject). * @@ -379,7 +379,7 @@ class Mail { return $this->setSubject($subject); } - + /** * Get the subject (alias to getSubject). * @@ -389,7 +389,7 @@ class Mail { return $this->getSubject(); } - + /** * Set the body content. * @@ -403,25 +403,25 @@ class Mail { $this->setContentType($content_type); } - + if (strpos($this->content_type, 'html') !== false) { $content = Filters\HTMLFilter::fixRelativeUrls($content); } - + $this->message->setBody($content, $this->content_type); } - + /** * Get the body content. - * + * * @return string */ public function getBody() { return $this->message->getBody(); } - + /** * Set the body content (alias to setBody). * @@ -433,20 +433,20 @@ class Mail { return $this->setBody($content, $content_type); } - + /** * Get the body content (alias to getBody). - * + * * @return string */ public function getContent() { return $this->getBody(); } - + /** * Set the content type. - * + * * @param string $mode The type * @return void */ @@ -454,17 +454,17 @@ class Mail { $this->content_type = (strpos($type, 'html') !== false) ? 'text/html' : ((strpos($type, '/') !== false) ? $type : 'text/plain'); } - + /** * Get the content type. - * + * * @return string */ public function getContentType() { return $this->content_type; } - + /** * Attach a file. * @@ -482,11 +482,11 @@ class Mail { return false; } - + $attachment = \Swift_Attachment::fromPath($local_filename); $attachment->setFilename($display_filename); $result = $this->message->attach($attachment); - + if ($result) { $this->attachments[] = (object)array( @@ -502,7 +502,7 @@ class Mail return false; } } - + /** * Embed a file. * @@ -516,14 +516,14 @@ class Mail { return false; } - + $embedded = \Swift_EmbeddedFile::fromPath($local_filename); if ($cid !== null) { $embedded->setId(preg_replace('/^cid:/i', '', $cid)); } $result = $this->message->embed($embedded); - + if ($result) { $this->attachments[] = (object)array( @@ -539,20 +539,20 @@ class Mail return false; } } - + /** * Get the list of attachments to this message. - * + * * @return array */ public function getAttachments() { return $this->attachments; } - + /** * Send the email. - * + * * @return bool */ public function send() @@ -563,20 +563,20 @@ class Mail { $this->caller = $backtrace[0]['file'] . ($backtrace[0]['line'] ? (' line ' . $backtrace[0]['line']) : ''); } - + // Reset Message-ID in case send() is called multiple times. $random = substr(hash('sha256', mt_rand() . microtime() . getmypid()), 0, 32); $sender = $this->message->getFrom(); reset($sender); $id = $random . '@' . (preg_match('/^(.+)@([^@]+)$/', key($sender), $matches) ? $matches[2] : 'swift.generated'); $this->message->getHeaders()->get('Message-ID')->setId($id); - + $output = \ModuleHandler::triggerCall('mail.send', 'before', $this); if(!$output->toBool()) { $this->errors[] = $output->getMessage(); return false; } - + try { $this->sent = $this->driver->send($this) ? true : false; @@ -586,46 +586,46 @@ class Mail $this->errors[] = $e->getMessage(); $this->sent = false; } - + $output = \ModuleHandler::triggerCall('mail.send', 'after', $this); if(!$output->toBool()) { $this->errors[] = $output->getMessage(); } - + return $this->sent; } - + /** * Check if the message was sent. - * + * * @return bool */ public function isSent() { return $this->sent; } - + /** * Get caller information. - * + * * @return string */ public function getCaller() { return $this->caller; } - + /** * Get errors. - * + * * @return array */ public function getErrors() { return $this->errors; } - + /** * Convert image paths to absolute URLs. * @@ -637,22 +637,22 @@ class Mail { return Filters\HTMLFilter::fixRelativeUrls($matches[0]); } - + /** * Format an array of addresses for display. - * + * * @param array $addresses * @return array */ protected function formatAddresses($addresses) { $result = array(); - + if (!$addresses) { return array(); } - + foreach($addresses as $email => $name) { if(strval($name) === '') @@ -664,7 +664,7 @@ class Mail $result[] = $name . ' <' . $email . '>'; } } - + return $result; } } diff --git a/common/framework/Pagination.php b/common/framework/Pagination.php index cc26906e4..5b602b0ee 100644 --- a/common/framework/Pagination.php +++ b/common/framework/Pagination.php @@ -12,10 +12,10 @@ class Pagination */ const COUNT_STYLE_NORMAL = 1; const COUNT_STYLE_CONTINUOUS = 2; - + /** * Calculate the number of pages. - * + * * @param int $total_items * @param int $items_per_page * @param int $minimum (optional) @@ -32,10 +32,10 @@ class Pagination return (int)max($minimum, ceil($total_items / $items_per_page)); } } - + /** * Create HTML for pagination. - * + * * @param string $base_url ($PAGE will be replaced with the page number) * @param int $current_page * @param int $total_pages @@ -47,7 +47,7 @@ class Pagination $current_page = (int)$current_page; $total_pages = (int)$total_pages; $count = (int)$count; - + // Determine the range of pages to show. if ($count_style === self::COUNT_STYLE_NORMAL) { @@ -72,10 +72,10 @@ class Pagination $first_shown = max(1, $last_shown - $count + 1); } } - + // Open the
tag. $return = array('
* * @param object $obj Search options @@ -72,13 +72,13 @@ class FileAdminModel extends File { $args->isvalid = $obj->isvalid; } - + // Set multimedia/common file if(isset($obj->direct_download) && in_array($obj->direct_download, ['Y', 'N'])) { $args->direct_download = $obj->direct_download; } - + // Set variables $args->sort_index = $obj->sort_index ?? null; $args->order_type = $obj->order_type ?? 'desc'; @@ -97,7 +97,7 @@ class FileAdminModel extends File { $output = executeQueryArray('file.getFileList', $args, $columnList); } - + // Return if no result or an error occurs if(!$output->toBool() || !count($output->data)) { diff --git a/modules/file/file.admin.view.php b/modules/file/file.admin.view.php index 9fdc63497..8d133297f 100644 --- a/modules/file/file.admin.view.php +++ b/modules/file/file.admin.view.php @@ -34,7 +34,7 @@ class FileAdminView extends File // Get a list $oFileAdminModel = getAdminModel('file'); $output = $oFileAdminModel->getFileList($args); - + // Get the document for looping a list if($output->data) { @@ -60,7 +60,7 @@ class FileAdminView extends File // Find and update if upload_target_type doesn't exist if(!$file->upload_target_type) { - // Pass if upload_target_type is already found + // Pass if upload_target_type is already found if(isset($document_list[$target_srl])) { $file->upload_target_type = 'doc'; @@ -223,7 +223,7 @@ class FileAdminView extends File $config = $oFileModel->getFileConfig(); Context::set('config', $config); Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command)); - + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('upload_config'); @@ -239,7 +239,7 @@ class FileAdminView extends File $oFileModel = getModel('file'); $config = $oFileModel->getFileConfig(); Context::set('config',$config); - + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('download_config'); @@ -255,7 +255,7 @@ class FileAdminView extends File $oFileModel = getModel('file'); $config = $oFileModel->getFileConfig(); Context::set('config',$config); - + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('other_config'); diff --git a/modules/file/file.class.php b/modules/file/file.class.php index c8f9e7796..9674137f3 100644 --- a/modules/file/file.class.php +++ b/modules/file/file.class.php @@ -15,11 +15,11 @@ class File extends ModuleObject { // Register action forward (to use in administrator mode) $oModuleController = getController('module'); - + // Generate a directory for the file module FileHandler::makeDir('./files/attach/images'); FileHandler::makeDir('./files/attach/binaries'); - + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); @@ -45,12 +45,12 @@ class File extends ModuleObject if($oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; if($oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; if($oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; - + if($oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; if($oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; if($oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; if($oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; - + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true; @@ -63,11 +63,11 @@ class File extends ModuleObject // A column to determine a target type if(!$oDB->isColumnExists('files', 'upload_target_type')) return true; - // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied + // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true; if(!$oDB->isColumnExists('files', 'cover_image')) return true; - + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after')) { return true; @@ -165,7 +165,7 @@ class File extends ModuleObject { $oModuleController->deleteTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); } - + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); @@ -184,14 +184,14 @@ class File extends ModuleObject // A column to determine a target type if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3'); - // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied + // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) { $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'); } if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N'); - + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after')) { $oModuleController->insertTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'); diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index b89d16cf6..26bf3ed29 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -34,13 +34,13 @@ class FileController extends File // Basic variables setting $editor_sequence = Context::get('editor_sequence'); $module_srl = $this->module_srl; - + // Exit a session if there is neither upload permission nor information if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + // Get upload_target_srl $upload_target_srl = intval(Context::get('uploadTargetSrl')) ?: intval(Context::get('upload_target_srl')); if (!$upload_target_srl) @@ -52,7 +52,7 @@ class FileController extends File $upload_target_srl = getNextSequence(); $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl; } - + // Handle chunking if (preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'], $matches)) { @@ -66,7 +66,7 @@ class FileController extends File } $this->add('chunk_current_size', $chunk_size); $this->add('chunk_uploaded_size', $chunk_start); - + // Check existing chunks $temp_key = hash_hmac('sha1', sprintf('%d:%d:%d:%s:%s', $editor_sequence, $upload_target_srl, $module_srl, $file_info['name'], session_id()), config('crypto.authentication_key')); $temp_filename = RX_BASEDIR . 'files/attach/chunks/' . $temp_key; @@ -82,7 +82,7 @@ class FileController extends File $this->add('chunk_status', 12); throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk'); } - + // Check size limit $is_admin = (Context::get('logged_info')->is_admin === 'Y'); if (!$is_admin) @@ -102,7 +102,7 @@ class FileController extends File throw new Rhymix\Framework\Exception('msg_exceeds_limit_size'); } } - + // Append to chunk $fp = fopen($file_info['tmp_name'], 'r'); $success = Rhymix\Framework\Storage::write($temp_filename, $fp, 'a'); @@ -135,14 +135,14 @@ class FileController extends File { $this->add('chunk_status', -1); } - + // Save the file $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); if($output->error != '0') { throw new Rhymix\Framework\Exception($output->message); } - + // Create the response Context::setResponseMethod('JSON'); $this->add('file_srl', $output->get('file_srl')); @@ -303,7 +303,7 @@ class FileController extends File { throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found'); } - + // Not allow the file outlink $file_module_config = FileModel::getFileConfig($file_obj->module_srl); if($file_module_config->allow_outlink == 'N' && $_SERVER["HTTP_REFERER"]) @@ -355,13 +355,13 @@ class FileController extends File throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_allowed_outlink'); } } - + // Check if the file is downloadable if(!FileModel::isDownloadable($file_obj)) { throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download'); } - + // Call a trigger (before) $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); if(!$output->toBool()) @@ -389,7 +389,7 @@ class FileController extends File $file_key_data = sprintf('%d:%d:%s:%s', $file_obj->file_srl, $file_key_timestamp, $file_obj->uploaded_filename, \RX_CLIENT_IP); $file_key_sig = \Rhymix\Framework\Security::createSignature($file_key_data); $file_key = dechex($file_key_timestamp) . $file_key_sig; - + // Use short URL or long URL if ($file_module_config->download_short_url === 'Y' && config('use_rewrite')) { @@ -399,7 +399,7 @@ class FileController extends File { $url = getNotEncodedUrl('', 'module', 'file', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key, 'force_download', Context::get('force_download') === 'Y' ? 'Y' : null); } - + header('X-Robots-Tag: noindex'); header('Location: ' . $url); Context::close(); @@ -412,7 +412,7 @@ class FileController extends File $file_srl = Context::get('file_srl'); $file_key = Context::get('file_key'); $filename_arg = Context::get('filename'); - + $columnList = array('source_filename', 'uploaded_filename', 'file_size'); $file_obj = FileModel::getFile($file_srl, $columnList); $file_config = FileModel::getFileConfig($file_obj->module_srl ?: null); @@ -435,13 +435,13 @@ class FileController extends File { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Check filename if given if ($filename_arg !== null && $filename_arg !== $filename) { throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found'); } - + // Check if file exists $uploaded_filename = $file_obj->uploaded_filename; if(!file_exists($uploaded_filename)) @@ -453,7 +453,7 @@ class FileController extends File if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim(trim($_SERVER['HTTP_IF_NONE_MATCH']), '\'"') === $etag) { header('HTTP/1.1 304 Not Modified'); - exit(); + exit(); } // If client sent an If-Modified-Since header with a recent modification date, do not download again @@ -532,19 +532,19 @@ class FileController extends File { $download_type = 'attachment'; } - + // Clear buffer while(ob_get_level()) ob_end_clean(); - + // Set filename headers header('Content-Type: ' . $mime_type); header('Content-Disposition: ' . $download_type . $filename_param); - + // Set cache headers header('Cache-Control: private; max-age=3600'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Pragma: '); - + // Set other headers header('Content-Length: ' . $range_length); header('Accept-Ranges: bytes'); @@ -610,13 +610,13 @@ class FileController extends File { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + $logged_info = Context::get('logged_info'); if($logged_info->is_admin !== 'Y' && !ModuleModel::isSiteAdmin($logged_info)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + $fileSrls = Context::get('file_srls'); if($fileSrls) $fileSrlList = explode(',', $fileSrls); @@ -692,7 +692,7 @@ class FileController extends File { $module_srl = $obj->module_srl; if(!$module_srl) return; - + return $this->deleteModuleFiles($module_srl); } @@ -723,7 +723,7 @@ class FileController extends File } $_SESSION['upload_info'][$editor_sequence]->enabled = true; $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl; - + return $editor_sequence; } @@ -788,13 +788,13 @@ class FileController extends File $trigger_obj->upload_target_srl = $upload_target_srl; $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); if(!$output->toBool()) return $output; - + // A workaround for Firefox upload bug if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) { $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); } - + // Set base information $file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']); $file_info['type'] = $file_info['original_type'] = Rhymix\Framework\MIME::getContentType($file_info['tmp_name']); @@ -804,7 +804,7 @@ class FileController extends File $file_info['duration'] = null; $file_info['thumbnail'] = null; $file_info['converted'] = false; - + // Correct extension if($file_info['extension']) { @@ -818,10 +818,10 @@ class FileController extends File } } } - + // Get file module configuration $config = FileModel::getFileConfig($module_srl); - + // Check file extension if(!$manual_insert && !$this->user->isAdmin()) { @@ -830,7 +830,7 @@ class FileController extends File throw new Rhymix\Framework\Exception('msg_not_allowed_filetype'); } } - + // Adjust if(!$manual_insert) { @@ -839,14 +839,14 @@ class FileController extends File { $file_info = $this->adjustUploadedImage($file_info, $config); } - + // video if(in_array($file_info['extension'], ['mp4', 'webm', 'ogv'])) { $file_info = $this->adjustUploadedVideo($file_info, $config); } } - + // Check file size if(!$manual_insert && !$this->user->isAdmin()) { @@ -857,7 +857,7 @@ class FileController extends File { throw new Rhymix\Framework\Exception('msg_exceeds_limit_size'); } - + $size_args = new stdClass; $size_args->upload_target_srl = $upload_target_srl; $output = executeQuery('file.getAttachedFileSize', $size_args); @@ -866,7 +866,7 @@ class FileController extends File throw new Rhymix\Framework\Exception('msg_exceeds_limit_size'); } } - + $args = new stdClass; $args->file_srl = getNextSequence(); $args->regdate = date('YmdHis'); @@ -880,20 +880,20 @@ class FileController extends File $args->width = $file_info['width']; $args->height = $file_info['height']; $args->duration = $file_info['duration']; - + // Set original type $args->original_type = null; if($file_info['type'] !== $file_info['original_type']) { $args->original_type = $file_info['original_type']; } - + // Add changed extension if($file_info['extension'] && $file_info['extension'] !== $file_info['original_extension']) { $args->source_filename .= '.' . $file_info['extension']; } - + // Set storage path by checking if the attachement is an image or other kinds of file if($direct = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename)) { @@ -903,7 +903,7 @@ class FileController extends File { $storage_path = $this->getStoragePath('binaries', $args->file_srl, $module_srl, $upload_target_srl, $args->regdate); } - + if($config->allow_multimedia_direct_download !== 'N') { $args->direct_download = $direct ? 'Y' : 'N'; @@ -912,13 +912,13 @@ class FileController extends File { $args->direct_download = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename, false) ? 'Y' : 'N'; } - + // Create a directory if(!Rhymix\Framework\Storage::isDirectory($storage_path) && !Rhymix\Framework\Storage::createDirectory($storage_path)) { throw new Rhymix\Framework\Exception('msg_not_permitted_create'); } - + // Set move type and uploaded filename $move_type = $manual_insert ? 'copy' : ''; if($file_info['converted'] || starts_with(RX_BASEDIR . 'files/attach/chunks/', $file_info['tmp_name'])) @@ -931,7 +931,7 @@ class FileController extends File { $uploaded_filename = $storage_path . Rhymix\Framework\Security::getRandom(32, 'hex') . $extension; } - + // Move the uploaded file if(!Rhymix\Framework\Storage::moveUploadedFile($file_info['tmp_name'], $uploaded_filename, $move_type)) { @@ -939,7 +939,7 @@ class FileController extends File } $args->uploaded_filename = './' . substr($uploaded_filename, strlen(RX_BASEDIR)); $args->file_size = @filesize($uploaded_filename); - + // Move the generated thumbnail image if($file_info['thumbnail']) { @@ -953,10 +953,10 @@ class FileController extends File $args->thumbnail_filename = './' . substr($thumbnail_filename, strlen(RX_BASEDIR)); } } - + $oDB = DB::getInstance(); $oDB->begin(); - + // Insert file information $output = executeQuery('file.insertFile', $args); if(!$output->toBool()) @@ -965,7 +965,7 @@ class FileController extends File $this->deleteFile(array($args)); return $output; } - + // Insert changelog if($config->save_changelog === 'Y') { @@ -983,14 +983,14 @@ class FileController extends File return $output; } } - + $oDB->commit(); - + // Call a trigger (after) ModuleHandler::triggerCall('file.insertFile', 'after', $args); - + $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; - + $output->add('file_srl', $args->file_srl); $output->add('file_size', $args->file_size); $output->add('sid', $args->sid); @@ -1000,10 +1000,10 @@ class FileController extends File $output->add('uploaded_filename', $args->uploaded_filename); $output->add('thumbnail_filename', $args->thumbnail_filename); $output->add('original_type', $args->original_type); - + return $output; } - + /** * Adjust uploaded image */ @@ -1014,11 +1014,11 @@ class FileController extends File { return $file_info; } - + // Set image size $file_info['width'] = $image_info['width']; $file_info['height'] = $image_info['height']; - + // Set base information $force = false; $adjusted = [ @@ -1029,7 +1029,7 @@ class FileController extends File 'rotate' => 0, ]; $is_animated = Rhymix\Framework\Image::isAnimatedGIF($file_info['tmp_name']); - + // Adjust image type if ($config->image_autoconv['gif2mp4'] && $is_animated && function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command)) { @@ -1047,7 +1047,7 @@ class FileController extends File { $adjusted['type'] = 'jpg'; } - + // Adjust image rotation if ($config->image_autorotate && $image_info['type'] === 'jpg') { @@ -1062,7 +1062,7 @@ class FileController extends File $adjusted['rotate'] = $rotate; } } - + // Adjust image size if ($config->max_image_size_action && ($config->max_image_width || $config->max_image_height) && (!$this->user->isAdmin() || $config->max_image_size_admin === 'Y')) { @@ -1081,7 +1081,7 @@ class FileController extends File $resize_height = $config->max_image_height; $exceeded++; } - + if ($exceeded) { // Block upload @@ -1101,7 +1101,7 @@ class FileController extends File } throw new Rhymix\Framework\Exception($message); } - + $adjusted['width'] = (int)$resize_width; $adjusted['height'] = (int)$resize_height; if (!$is_animated && $adjusted['type'] === $image_info['type'] && $config->max_image_size_same_format !== 'Y') @@ -1110,7 +1110,7 @@ class FileController extends File } } } - + // Set force for remove EXIF data if($config->image_remove_exif_data && $image_info['type'] === 'jpg' && function_exists('exif_read_data')) { @@ -1123,7 +1123,7 @@ class FileController extends File $force = true; } } - + // Convert image if adjusted if ( $force || @@ -1134,13 +1134,13 @@ class FileController extends File ) { $output_name = $file_info['tmp_name'] . '.converted.' . $adjusted['type']; - + // Generate an output file if ($adjusted['type'] === 'mp4') { $adjusted['width'] -= $adjusted['width'] % 2; $adjusted['height'] -= $adjusted['height'] % 2; - + // Convert using ffmpeg $command = \RX_WINDOWS ? escapeshellarg($config->ffmpeg_command) : $config->ffmpeg_command; $command .= ' -nostdin -i ' . escapeshellarg($file_info['tmp_name']); @@ -1149,7 +1149,7 @@ class FileController extends File $command .= ' ' . escapeshellarg($output_name); @exec($command, $output, $return_var); $result = $return_var === 0 ? true : false; - + // Generate a thumbnail image if ($result) { @@ -1164,7 +1164,7 @@ class FileController extends File { $result = FileHandler::createImageFile($file_info['tmp_name'], $output_name, $adjusted['width'], $adjusted['height'], $adjusted['type'], 'fill', $adjusted['quality'], $adjusted['rotate']); } - + // Change to information in the output file if ($result) { @@ -1177,10 +1177,10 @@ class FileController extends File $file_info['converted'] = true; } } - + return $file_info; } - + /** * Adjust uploaded video */ @@ -1190,7 +1190,7 @@ class FileController extends File { return $file_info; } - + // Analyze video file $command = \RX_WINDOWS ? escapeshellarg($config->ffprobe_command) : $config->ffprobe_command; $command .= ' -v quiet -print_format json -show_streams'; @@ -1200,7 +1200,7 @@ class FileController extends File { return $file_info; } - + // Get stream information $stream_info = []; foreach ($output['streams'] as $info) @@ -1211,12 +1211,12 @@ class FileController extends File { return $file_info; } - + // Set video size $file_info['width'] = (int)$stream_info['video']['width']; $file_info['height'] = (int)$stream_info['video']['height']; $file_info['duration'] = (int)$stream_info['video']['duration']; - + // MP4 if ($file_info['extension'] === 'mp4') { @@ -1226,7 +1226,7 @@ class FileController extends File $file_info['original_type'] = 'image/gif'; } } - + // Generate a thumbnail image if ($config->video_thumbnail) { @@ -1240,10 +1240,10 @@ class FileController extends File $file_info['thumbnail'] = $thumbnail_name; } } - + return $file_info; } - + /** * Delete the attachment * @@ -1277,16 +1277,16 @@ class FileController extends File { $file_list = explode(',', $file_list); } - + if(empty($file_list)) { return new BaseObject(); } - + $config = FileModel::getFileConfig(); $oDB = DB::getInstance(); $oDB->begin(); - + foreach($file_list as $file) { if(!is_object($file)) @@ -1297,16 +1297,16 @@ class FileController extends File } $file = FileModel::getFile($file_srl); } - + if(empty($file->file_srl)) { continue; } - + // Call a trigger (before) $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $file); if(!$output->toBool()) return $output; - + // Remove from the DB $output = executeQuery('file.deleteFile', $file); if(!$output->toBool()) @@ -1314,7 +1314,7 @@ class FileController extends File $oDB->rollback(); return $output; } - + if($config->save_changelog === 'Y') { $clargs = new stdClass; @@ -1329,16 +1329,16 @@ class FileController extends File return $output; } } - + // If successfully deleted, remove the file Rhymix\Framework\Storage::delete(FileHandler::getRealPath($file->uploaded_filename)); - + // Call a trigger (after) ModuleHandler::triggerCall('file.deleteFile', 'after', $file); - + // Remove empty directories Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->uploaded_filename)), true); - + // Remove thumbnail if ($file->thumbnail_filename) { @@ -1346,11 +1346,11 @@ class FileController extends File Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->thumbnail_filename)), true); } } - + $oDB->commit(); return new BaseObject(); } - + /** * Delete all attachments of a particular document * @@ -1361,17 +1361,17 @@ class FileController extends File { // Get a list of attachements $file_list = FileModel::getFiles($upload_target_srl); - + // Success returned if no attachement exists if(empty($file_list)) { return new BaseObject(); } - + // Delete the file return $this->deleteFile($file_list); } - + /** * Delete the attachment of a particular module * @@ -1388,11 +1388,11 @@ class FileController extends File { return $output; } - + // Delete the file return $this->deleteFile($file_list); } - + /** * Move an attachement to the other document * @@ -1413,11 +1413,11 @@ class FileController extends File $config = FileModel::getFileConfig($module_srl); $oDB = DB::getInstance(); $oDB->begin(); - + foreach($file_list as $i => $file_info) { $old_file = $file_info->uploaded_filename; - + // Determine the file path by checking if the file is an image or other kinds if (Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($file_info->source_filename)) { @@ -1432,19 +1432,19 @@ class FileController extends File $random_filename = basename($file_info->uploaded_filename) ?: Rhymix\Framework\Security::getRandom(32, 'hex'); $new_file = $path . $random_filename; } - + // Pass if a target document to move is same if($old_file === $new_file) continue; - + // Create a directory FileHandler::makeDir($path); - + // Move the file FileHandler::rename($old_file, $new_file); - + // Delete old path Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($old_file)), true); - + // Update DB information $args = new stdClass; $args->file_srl = $file_info->file_srl; @@ -1452,7 +1452,7 @@ class FileController extends File $args->module_srl = $file_info->module_srl; $args->upload_target_srl = $target_srl; $output = executeQuery('file.updateFile', $args); - + if($config->save_changelog === 'Y') { $clargs = new stdClass; @@ -1469,18 +1469,18 @@ class FileController extends File } } } - + $oDB->commit(); return new BaseObject(); } - + function copyFile($source_file, $module_srl, $upload_target_srl, &$content = null) { $file_info = array(); $file_info['name'] = $source_file->source_filename; $file_info['tmp_name'] = $source_file->uploaded_filename; $copied_file = $this->insertFile($file_info, $module_srl, $upload_target_srl, 0, true); - + if($content) { // if image/video files @@ -1497,23 +1497,23 @@ class FileController extends File $content = str_replace('sid=' . $source_file->sid, 'sid=' . $copied_file->get('sid'), $content); } } - + return $copied_file; } - + function copyFiles($source_file_list, $module_srl, $upload_target_srl, &$content = null) { if(!is_array($source_file_list)) { $source_file_list = FileModel::getFiles($source_file_list, array(), 'file_srl', true); } - + foreach($source_file_list as $source_file) { $this->copyFile($source_file, $module_srl, $upload_target_srl, $content); } } - + public function procFileSetCoverImage() { $vars = Context::getRequestVars(); @@ -1535,7 +1535,7 @@ class FileController extends File $oDB = &DB::getInstance(); $oDB->begin(); - + $args->cover_image = 'N'; $output = executeQuery('file.updateClearCoverImage', $args); if(!$output->toBool()) @@ -1565,10 +1565,10 @@ class FileController extends File $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3)); Filehandler::removeFilesInDir($thumbnail_path); } - + /** * Determine storage path based on file.folder_structure configuration. - * + * * @param string $file_type images or binary * @param int $file_srl * @param int $module_srl @@ -1584,13 +1584,13 @@ class FileController extends File $module_srl = intval($module_srl); $upload_target_srl = $upload_target_srl ?: $file_srl; $regdate = $regdate ?: date('YmdHis'); - + // 시스템 설정 참고 (기존 사용자는 1, 신규 설치시 2가 기본값임) $folder_structure = config('file.folder_structure'); - + // 기본 경로 지정 $prefix = $absolute_path ? \RX_BASEDIR : './'; - + // 2: 년월일 단위로 정리 if ($folder_structure == 2) { @@ -1603,7 +1603,7 @@ class FileController extends File return sprintf('%sfiles/attach/%s/%d/%s', $prefix, $file_type, $module_srl, $components); } } - + /** * Find the attachment where a key is upload_target_srl and then return java script code * @@ -1616,34 +1616,34 @@ class FileController extends File { return; } - + function triggerMoveDocument($obj) { $obj->upload_target_srls = $obj->document_srls; executeQuery('file.updateFileModule', $obj); executeQuery('file.updateFileModuleComment', $obj); } - + function triggerAddCopyDocument(&$obj) { if(!$obj->source->uploaded_count) { return; } - + $this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content); } - + function triggerAddCopyCommentByDocument(&$obj) { if(!$obj->source->uploaded_count) { return; } - + $this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content); } - + function triggerCopyModule(&$obj) { $fileConfig = ModuleModel::getModulePartConfig('file', $obj->originModuleSrl); diff --git a/modules/file/file.model.php b/modules/file/file.model.php index 9a5828e6e..2f1f95d00 100644 --- a/modules/file/file.model.php +++ b/modules/file/file.model.php @@ -32,12 +32,12 @@ class FileModel extends File { $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; } - + // Get uploaded files if($upload_target_srl) { $oDocument = DocumentModel::getDocument($upload_target_srl); - + // Check permissions of the comment if(!$oDocument->isExists()) { @@ -51,13 +51,13 @@ class FileModel extends File $oDocument = DocumentModel::getDocument($oComment->get('document_srl')); } } - + // Check permissions of the document if($oDocument->isExists() && !$oDocument->isAccessible()) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + // Check permissions of the module if($module_srl = isset($oComment) ? $oComment->get('module_srl') : $oDocument->get('module_srl')) { @@ -72,7 +72,7 @@ class FileModel extends File throw new Rhymix\Framework\Exceptions\NotPermitted; } } - + // Set file list foreach(self::getFiles($upload_target_srl) as $file_info) { @@ -94,18 +94,18 @@ class FileModel extends File { $obj->download_url = self::getDirectFileUrl($file_info->download_url); } - + $file_list[] = $obj; $attached_size += $file_info->file_size; } } - + // Set output $this->add('files', $file_list); $this->add('attached_size', FileHandler::filesize($attached_size)); $this->add('editor_sequence', $editor_sequence); $this->add('upload_target_srl', $upload_target_srl); - + // Set upload config $upload_config = self::getUploadConfig(); if($this->user->isAdmin()) @@ -120,13 +120,13 @@ class FileModel extends File $this->add('allowed_attach_size', FileHandler::filesize($upload_config->allowed_attach_size * 1024 * 1024)); $this->add('allowed_extensions', $upload_config->allowed_extensions); } - + // for compatibility $this->add('allowed_filetypes', $upload_config->allowed_filetypes); $this->add('upload_status', self::getUploadStatus($attached_size)); $this->add('left_size', $upload_config->allowed_attach_size * 1024 * 1024 - $attached_size); } - + /** * Check if the file is downloadable * @@ -144,13 +144,13 @@ class FileModel extends File { return true; } - + // Check the validity if($file_info->isvalid !== 'Y') { return false; } - + // Check download groups $config = self::getFileConfig($file_info->module_srl); if($config->download_groups) @@ -177,10 +177,10 @@ class FileModel extends File return false; } } - + return true; } - + /** * Check if the file is deletable * @@ -202,7 +202,7 @@ class FileModel extends File { return true; } - + // Check permissions of the module $module_info = ModuleModel::getModuleInfoByModuleSrl($file_info->module_srl); if(empty($module_info->module_srl)) @@ -214,24 +214,24 @@ class FileModel extends File { return true; } - + // Check permissions of the document $oDocument = DocumentModel::getDocument($file_info->upload_target_srl); if($oDocument->isExists() && $oDocument->isGranted()) { return true; } - + // Check permissions of the comment $oComment = CommentModel::getComment($file_info->upload_target_srl); if($oComment->isExists() && $oComment->isGranted()) { return true; } - + return false; } - + /** * Return number of attachments which belongs to a specific document * @@ -266,7 +266,7 @@ class FileModel extends File return sprintf('index.php?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid); } } - + /** * Return direct download file url * @@ -277,7 +277,7 @@ class FileModel extends File { return \RX_BASEURL . ltrim($path, './'); } - + /** * Get file configurations * @@ -296,7 +296,7 @@ class FileModel extends File $config->$key = $value; } } - + // Default setting if not exists $config->allowed_filesize = $config->allowed_filesize ?? '2'; $config->allowed_attach_size = $config->allowed_attach_size ?? '3'; @@ -310,7 +310,7 @@ class FileModel extends File $config->video_mp4_gif_time = $config->video_mp4_gif_time ?? 0; $config->ffmpeg_command = $config->ffmpeg_command ?? '/usr/bin/ffmpeg'; $config->ffprobe_command = $config->ffprobe_command ?? '/usr/bin/ffprobe'; - + // Set allowed_extensions if(!isset($config->allowed_extensions)) { @@ -323,10 +323,10 @@ class FileModel extends File }, explode(';', $config->allowed_filetypes)); } } - + // Set download_groups $config->download_groups = is_array($config->download_grant) ? array_filter($config->download_grant) : []; - + return $config; } @@ -388,7 +388,7 @@ class FileModel extends File { return array(); } - + $fileList = array(); foreach ($output->data as $file) { @@ -435,7 +435,7 @@ class FileModel extends File { $allowed_filesize = min($file_config->allowed_filesize * 1024 * 1024, FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size'))); } - + // Display upload status $upload_status = sprintf( '%s : %s/ %s
%s : %s (%s : %s)', @@ -452,7 +452,7 @@ class FileModel extends File /** * method for compatibility - * + * * @deprecated */ public static function getFileModuleConfig($module_srl) @@ -462,7 +462,7 @@ class FileModel extends File /** * method for compatibility - * + * * @deprecated */ public static function getFileGrant($file_info, $member_info) diff --git a/modules/file/file.view.php b/modules/file/file.view.php index 44d69ecf9..8aeb3f296 100644 --- a/modules/file/file.view.php +++ b/modules/file/file.view.php @@ -33,16 +33,16 @@ class FileView extends File return; } } - + // Get file configurations of the module $config = FileModel::getFileConfig($current_module_srl); Context::set('config', $config); Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command)); - + // Get a permission for group setting $group_list = MemberModel::getGroups(); Context::set('group_list', $group_list); - + // Set a template file $oTemplate = TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config'); diff --git a/modules/install/install.admin.controller.php b/modules/install/install.admin.controller.php index 3095849d6..924990afe 100644 --- a/modules/install/install.admin.controller.php +++ b/modules/install/install.admin.controller.php @@ -43,16 +43,16 @@ class installAdminController extends install { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + Rhymix\Framework\Session::close(); - + $output = $oModule->moduleUpdate(); if($output instanceof BaseObject && !$output->toBool()) { Rhymix\Framework\Session::start(); return $output; } - + $oModuleController = getController('module'); $output = $oModuleController->registerActionForwardRoutes($module_name); if($output instanceof BaseObject && !$output->toBool()) @@ -60,7 +60,7 @@ class installAdminController extends install Rhymix\Framework\Session::start(); return $output; } - + Rhymix\Framework\Session::start(); $this->setMessage('success_updated'); } diff --git a/modules/install/install.class.php b/modules/install/install.class.php index 613d08a28..577cabe0d 100644 --- a/modules/install/install.class.php +++ b/modules/install/install.class.php @@ -12,7 +12,7 @@ class install extends ModuleObject */ function moduleInstall() { - + } /** @@ -28,7 +28,7 @@ class install extends ModuleObject */ function moduleUpdate() { - + } /** diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index b39d3f033..4f202d940 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -19,7 +19,7 @@ class installController extends install { throw new Rhymix\Framework\Exception('msg_already_installed'); } - + // Increase time limit. @set_time_limit(0); } @@ -31,13 +31,13 @@ class installController extends install { // Get DB config variables. $config = Context::gets('db_type', 'db_host', 'db_port', 'db_user', 'db_pass', 'db_database', 'db_prefix'); - + // Disallow installation using the root account. if (trim($config->db_user) === 'root' && !preg_match('/Development Server$/', $_SERVER['SERVER_SOFTWARE'])) { return new BaseObject(-1, 'msg_dbroot_disallowed'); } - + // Create a temporary setting object. Rhymix\Framework\Config::set('db.master', array( 'type' => $config->db_type, @@ -48,7 +48,7 @@ class installController extends install 'database' => $config->db_database, 'prefix' => $config->db_prefix ? (rtrim($config->db_prefix, '_') . '_') : '', )); - + // Check connection to the DB. $oDB = DB::getInstance(); $output = $oDB->getError(); @@ -56,7 +56,7 @@ class installController extends install { return $output; } - + // Check MySQL server capabilities. if(stripos($config->db_type, 'mysql') !== false) { @@ -70,12 +70,12 @@ class installController extends install break; } } - + // Check if utf8mb4 is supported. $oDB->charset = $oDB->getBestSupportedCharset(); $config->db_charset = $oDB->charset; } - + // Check if tables already exist. $table_check = array('documents', 'comments', 'modules', 'sites'); foreach ($table_check as $table_name) @@ -85,10 +85,10 @@ class installController extends install throw new Rhymix\Framework\Exception('msg_table_already_exists'); } } - + // Save DB config in session. $_SESSION['db_config'] = $config; - + // Continue the installation. if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) { @@ -107,7 +107,7 @@ class installController extends install { throw new Rhymix\Framework\Exception('msg_already_installed'); } - + // Get install parameters. $config = Rhymix\Framework\Config::getDefaults(); if ($install_config) @@ -147,23 +147,23 @@ class installController extends install $time_zone = Context::get('time_zone'); $user_info = Context::gets('email_address', 'password', 'nick_name', 'user_id'); } - + // Fix the database table prefix. $config['db']['master']['prefix'] = rtrim($config['db']['master']['prefix'], '_'); if ($config['db']['master']['prefix'] !== '') { $config['db']['master']['prefix'] .= '_'; } - + // Create new crypto keys. $config['crypto']['encryption_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum'); $config['crypto']['authentication_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum'); $config['crypto']['session_key'] = Rhymix\Framework\Security::getRandom(64, 'alnum'); - + // Set the default language. $config['locale']['default_lang'] = Context::getLangType(); $config['locale']['enabled_lang'] = array($config['locale']['default_lang']); - + // Set the default time zone. if (strpos($time_zone, '/') !== false) { @@ -183,7 +183,7 @@ class installController extends install $config['locale']['default_timezone'] = 'Etc/GMT' . ($user_timezone > 0 ? '-' : '+') . abs($user_timezone); } } - + // Set the internal time zone. if ($config['locale']['default_timezone'] === 'Asia/Seoul') { @@ -197,24 +197,24 @@ class installController extends install { $config['locale']['internal_timezone'] = 0; } - + // Set the default URL. $config['url']['default'] = Context::getRequestUri(); - + // Set the default umask. $config['file']['umask'] = Rhymix\Framework\Storage::recommendUmask(); - + // Load the new configuration. Rhymix\Framework\Config::setAll($config); Context::loadDBInfo($config); - + // Check DB. $oDB = DB::getInstance(); if (!$oDB->isConnected()) { return $oDB->getError(); } - + // Assign a temporary administrator while installing. foreach ($user_info as $key => $val) { @@ -222,7 +222,7 @@ class installController extends install } $user_info->is_admin = 'Y'; Context::set('logged_info', $user_info); - + // Install all the modules. try { @@ -235,7 +235,7 @@ class installController extends install $oDB->rollback(); throw new Rhymix\Framework\Exception($e->getMessage()); } - + // Execute the install script. $scripts = FileHandler::readDir(RX_BASEDIR . 'modules/install/script', '/(\.php)$/'); if(count($scripts)) @@ -247,7 +247,7 @@ class installController extends install $output = include($script_path . $script); } } - + // Apply site lock. if (Context::get('use_sitelock') === 'Y') { @@ -256,23 +256,23 @@ class installController extends install Rhymix\Framework\Config::set('lock.message', 'This site is locked.'); Rhymix\Framework\Config::set('lock.allow', array('127.0.0.1', $user_ip_range)); } - + // Use APC cache if available. if (function_exists('apcu_exists')) { Rhymix\Framework\Config::set('cache.type', 'apc'); } - + // Save the new configuration. Rhymix\Framework\Config::save(); - + // Unset temporary session variables. unset($_SESSION['use_rewrite']); unset($_SESSION['db_config']); - + // Redirect to the home page. $this->setMessage('msg_install_completed'); - + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : RX_BASEURL; $this->setRedirectUrl($returnUrl); return new BaseObject(); @@ -315,13 +315,13 @@ class installController extends install { $checklist['permission'] = false; } - + // Check session availability $license_agreement_time = intval(trim(FileHandler::readFile($this->flagLicenseAgreement))); if(isset($_SESSION['license_agreement']) && (!$license_agreement_time || ($license_agreement_time == $_SESSION['license_agreement']))) { $sess_autostart = intval(ini_get('session.auto_start')); - + if($sess_autostart === 0) { $checklist['session'] = true; @@ -425,7 +425,7 @@ class installController extends install { throw new Rhymix\Framework\Exception('msg_must_accept_license_agreement'); } - + $license_agreement_time = time(); $_SESSION['license_agreement'] = $license_agreement_time; FileHandler::writeFile($this->flagLicenseAgreement, $license_agreement_time . PHP_EOL); @@ -465,13 +465,13 @@ class installController extends install { // Get module name $module = basename($module_path); - + // Only install default modules at this time if (!Context::isDefaultPlugin($module, 'module')) { continue; } - + // Try to group modules by category $xml_info = ModuleModel::getModuleInfoXml($module); if (!$xml_info) @@ -480,14 +480,14 @@ class installController extends install } $modules[$xml_info->category ?: 'other'][] = $module; } - + // Install "module" module in advance $this->installModule('module','./modules/module'); $this->updateModule('module'); - + // Determine the order of module installation depending on category $install_step = array('system','content','member'); - + // Install all the remaining modules foreach($install_step as $category) { @@ -502,7 +502,7 @@ class installController extends install unset($modules[$category]); } } - + // Install all the remaining modules if(count($modules)) { @@ -544,16 +544,16 @@ class installController extends install { continue; } - + $table_name = $matches[1]; if(isset($schema_sorted[$table_name]) || $oDB->isTableExists($table_name)) { continue; } - + $schema_sorted[$table_name] = $filename; } - + $schema_sorted = Rhymix\Framework\Parsers\DBTableParser::resolveDependency($schema_sorted); foreach ($schema_sorted as $table_name => $filename) { @@ -563,7 +563,7 @@ class installController extends install throw new Exception(lang('msg_create_table_failed') . ': ' . $table_name . ': ' . $oDB->getError()->getMessage()); } } - + // Create a table and module instance and then execute install() method $oModule = ModuleModel::getModuleInstallClass($module); if($oModule && method_exists($oModule, 'moduleInstall')) @@ -572,10 +572,10 @@ class installController extends install } return new BaseObject(); } - + /** * Update a module if necessary. - * + * * @param string $module * @return mixed */ @@ -590,10 +590,10 @@ class installController extends install } } } - + /** * Placeholder for third-party apps that try to manipulate system configuration. - * + * * @return void */ public function makeConfigFile() diff --git a/modules/install/install.model.php b/modules/install/install.model.php index 9bc7b0562..275a0b57b 100644 --- a/modules/install/install.model.php +++ b/modules/install/install.model.php @@ -35,7 +35,7 @@ class installModel extends install function getInstallFTPList() { - if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) + if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) { return $this->setError('msg_ftp_invalid_auth_info'); } @@ -57,17 +57,17 @@ class installModel extends install if(!$connection) return $this->setError(sprintf(lang('msg_ftp_not_connected'), 'host')); if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) { - ftp_close($connection); + ftp_close($connection); return $this->setError('msg_ftp_invalid_auth_info'); } - if($ftp_info->ftp_pasv != "N") + if($ftp_info->ftp_pasv != "N") { ftp_pasv($connection, true); } $_list = ftp_rawlist($connection, $this->pwd); - ftp_close($connection); + ftp_close($connection); } else { @@ -92,7 +92,7 @@ class installModel extends install { foreach($_list as $k => $v) { - $src = new stdClass(); + $src = new stdClass(); $src->data = $v; $res = Context::convertEncoding($src); $v = $res->data; diff --git a/modules/install/install.view.php b/modules/install/install.view.php index 05844ffdc..dbf02797b 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -21,13 +21,13 @@ class installView extends install { throw new Rhymix\Framework\Exception('msg_already_installed'); } - + // Set the browser title. Context::setBrowserTitle(lang('introduce_title')); - + // Specify the template path. $this->setTemplatePath($this->module_path.'tpl'); - + // Check the environment. $oInstallController = getController('install'); self::$checkEnv = $oInstallController->checkInstallEnv(); @@ -46,7 +46,7 @@ class installView extends install if (file_exists(RX_BASEDIR . 'config/install.config.php')) { include RX_BASEDIR . 'config/install.config.php'; - + if (isset($install_config) && is_array($install_config)) { $oInstallController = getController('install'); @@ -61,7 +61,7 @@ class installView extends install } } } - + // Otherwise, display the license agreement screen. Context::set('lang_type', Context::getLangType()); $this->setTemplateFile('license_agreement'); @@ -75,7 +75,7 @@ class installView extends install // Create a temporary file for mod_rewrite check. self::$rewriteCheckString = Rhymix\Framework\Security::getRandom(32); FileHandler::writeFile(RX_BASEDIR . self::$rewriteCheckFilePath, self::$rewriteCheckString); - + // Check if the web server is nginx. Context::set('use_nginx', stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false); $this->setTemplateFile('check_env'); @@ -91,16 +91,16 @@ class installView extends install { return $this->dispInstallCheckEnv(); } - + // Delete mod_rewrite check file FileHandler::removeFile(RX_BASEDIR . self::$rewriteCheckFilePath); - + // Save mod_rewrite check status. if(Context::get('rewrite') === 'Y') { Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'Y'); } - + Context::set('error_return_url', getNotEncodedUrl('', 'act', Context::get('act'))); $this->setTemplateFile('db_config'); } @@ -115,19 +115,19 @@ class installView extends install { return $this->dispInstallCheckEnv(); } - + // Get list of time zones. Context::set('timezones', Rhymix\Framework\DateTime::getTimezoneList()); - + // Automatically select a time zone for the user. Context::set('selected_timezone', $this->detectUserTimeZone()); - + // Always use SSL if installing via SSL. Context::set('use_ssl', RX_SSL ? 'always' : 'none'); Context::set('sitelock_ip_range', $this->detectUserIPRange()); $this->setTemplateFile('other_config'); } - + /** * Detect the IP range of the user. */ @@ -148,7 +148,7 @@ class installView extends install return RX_CLIENT_IP; } } - + /** * Detect best time zone for the user. */ diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index c94c3d0a6..58df55250 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -18,7 +18,7 @@ class layoutAdminController extends layout /** * Create a new layout * Insert a title into "layouts" table in order to create a layout - * @deprecated + * @deprecated * @return void|Object (void : success, Object : fail) */ function procLayoutAdminInsert() @@ -65,7 +65,7 @@ class layoutAdminController extends layout * Initiate if it is faceoff layout * @param int $layout_srl * @param string $layout_name - * @return void + * @return void */ function initLayout($layout_srl, $layout_name) { @@ -278,12 +278,12 @@ class layoutAdminController extends layout $layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl); FileHandler::removeFile($layout_file); - + // Delete Layout $args = new stdClass(); $args->layout_srl = $layout_srl; $output = executeQuery("layout.deleteLayout", $args); - + Rhymix\Framework\Cache::delete('layout:' . $args->layout_srl); if(!$output->toBool()) return $output; @@ -390,7 +390,7 @@ class layoutAdminController extends layout $ext = substr(strrchr($filename,'.'),1); $filename = sprintf('%s.%s', md5($filename), $ext); } - + if(file_exists($path .'/'. $filename)) @unlink($path . $filename); if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false; return true; @@ -693,7 +693,7 @@ class layoutAdminController extends layout $args->extra_vars = $output->extra_vars; $extra_vars = unserialize($args->extra_vars); $image_list = array(); - + if($layout->extra_var_count && $extra_vars) { $reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/"; diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index 6cbc12cc3..95c8cde7e 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -97,7 +97,7 @@ class layoutAdminView extends layout $layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type); if ($layout_info) { - $layout_list[$item->layout]['title'] = $layout_info->title; + $layout_list[$item->layout]['title'] = $layout_info->title; } } diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php index 86ece0493..e8312f214 100644 --- a/modules/layout/layout.class.php +++ b/modules/layout/layout.class.php @@ -3,7 +3,7 @@ /** * @class layout * @author NAVER (developers@xpressengine.com) - * high class of the layout module + * high class of the layout module */ class layout extends ModuleObject { @@ -13,7 +13,7 @@ class layout extends ModuleObject */ function moduleInstall() { - + } /** @@ -31,7 +31,7 @@ class layout extends ModuleObject */ function moduleUpdate() { - + } /** @@ -40,7 +40,7 @@ class layout extends ModuleObject */ function recompileCache() { - + } } /* End of file layout.class.php */ diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 5467dcb2f..19d1c90d6 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -44,7 +44,7 @@ class layoutModel extends layout unset($output->data[$no]); } } - + $oLayoutAdminModel = getAdminModel('layout'); $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type); if($siteDefaultLayoutSrl) @@ -64,7 +64,7 @@ class layoutModel extends layout $responsiveLayoutInfo->title = lang('use_responsive_pc_layout'); array_unshift($output->data, $responsiveLayoutInfo); } - + return $output->data; } @@ -162,7 +162,7 @@ class layoutModel extends layout $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title; } } - + if($layout) { if(count($instanceList) < 1 && $downloadedList[$layout]) @@ -265,7 +265,7 @@ class layoutModel extends layout { return $layout_info; } - + // Get information from the DB $args = new stdClass(); $args->layout_srl = $layout_srl; @@ -589,7 +589,7 @@ class layoutModel extends layout $count = count($extra_vars); $extra_var_count += $count; - + for($i=0;$i<$count;$i++) { unset($var, $options); @@ -680,7 +680,7 @@ class layoutModel extends layout $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); - + $extra_var_count = 0; $buff[] = '$layout_info->extra_var = new stdClass;'; foreach($extra_var_groups as $group) diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php index 1f355367c..658ccfeb2 100644 --- a/modules/layout/layout.view.php +++ b/modules/layout/layout.view.php @@ -35,7 +35,7 @@ class layoutView extends layout /** * Preview a layout with module. - * + * * @return Object */ public function dispLayoutPreviewWithModule() @@ -260,7 +260,7 @@ class layoutView extends layout { throw new Rhymix\Framework\Exception(lang('msg_unabled_preview')); } - + $mid = current($output->data)->mid; } @@ -397,7 +397,7 @@ class layoutView extends layout } else { - return ''; + return ''; } } @@ -413,7 +413,7 @@ class layoutView extends layout } else { - return ''; + return ''; } } diff --git a/modules/member/controllers/Device.php b/modules/member/controllers/Device.php index cdfe7aa47..639119388 100644 --- a/modules/member/controllers/Device.php +++ b/modules/member/controllers/Device.php @@ -6,9 +6,9 @@ class Device extends \Member { /** * Automatically recognize device token from header or cookie and register it. - * + * * If the device is already registered, just update its last active date. - * + * * @return \BaseObject */ public function autoRegisterDevice(int $member_srl): \BaseObject @@ -33,10 +33,10 @@ class Device extends \Member } return new \BaseObject; } - + /** * Automatically recognize device token from header or cookie and unregister it. - * + * * @return \BaseObject */ public function autoUnregisterDevice(int $member_srl): \BaseObject @@ -115,7 +115,7 @@ class Device extends \Member { return new \BaseObject(-1, 'INVALID_DEVICE_TOKEN'); } - + if ($member_srl) { $member_srl = intval($member_srl); @@ -150,7 +150,7 @@ class Device extends \Member $args->device_type = $device_type; $args->device_version = $device_version; $args->device_model = $device_model; - + // Call trigger (before) $trigger_output = \ModuleHandler::triggerCall('member.insertMemberDevice', 'before', $args); if(!$trigger_output->toBool()) return $trigger_output; @@ -158,10 +158,10 @@ class Device extends \Member // Start transaction $oDB = \DB::getInstance(); $oDB->begin(); - + // Remove duplicated token key executeQuery('member.deleteMemberDevice', ['device_token' => $device_token]); - + // Create member_device $output = executeQuery('member.insertMemberDevice', $args); if(!$output->toBool()) @@ -169,10 +169,10 @@ class Device extends \Member $oDB->rollback(); return $output; } - + // Call trigger (after) \ModuleHandler::triggerCall('member.insertMemberDevice', 'after', $args); - + $oDB->commit(); // Set parameters @@ -242,7 +242,7 @@ class Device extends \Member { if(isset($member_info->phone_number)) { - $user_id = $member_info->phone_number; + $user_id = $member_info->phone_number; } else { @@ -259,26 +259,26 @@ class Device extends \Member { $member_info = null; } - + // Update last active date executeQuery('member.updateMemberDeviceLastActiveDate', ['device_token' => $device_token]); - + $this->add('member_srl', $member_srl); $this->add('user_id', $member_info ? $member_info->user_id : null); $this->add('user_name', $member_info ? $member_info->user_name : null); $this->add('nick_name', $member_info ? $member_info->nick_name : null); } - + /** * Unregister a registered device. - * + * * This action requires a device token and matching device key. * It is intended to be called by mobile applications. */ public function procMemberUnregisterDevice() { \Context::setResponseMethod('JSON'); - + // Check member_srl, device_token, device_key $allow_guest_device = config('push.allow_guest_device'); $member_srl = abs(\Context::get('member_srl')); @@ -298,7 +298,7 @@ class Device extends \Member { return new \BaseObject(-1, 'NULL_DEVICE_KEY'); } - + // Check the device token and key. $args = new \stdClass; $args->member_srl = $member_srl; @@ -313,7 +313,7 @@ class Device extends \Member { return new \BaseObject(-1, 'UNREGISTERED_DEVICE'); } - + // Delete the device. $args = new \stdClass; $args->device_token = $device_token; @@ -323,10 +323,10 @@ class Device extends \Member return new \BaseObject(-1, 'DELETE_FAILED'); } } - + /** * Delete a registered device. - * + * * This action requires only the device_srl, but it must belong to the currently logged in member. * It is intended to be called from the web frontend. */ @@ -338,13 +338,13 @@ class Device extends \Member { throw new \Rhymix\Framework\Exceptions\InvalidRequest; } - + $member_srl = $this->user->member_srl; if (!$member_srl) { throw new \Rhymix\Framework\Exceptions\NotPermitted; } - + // Check that the device_srl matches the member. $args = new \stdClass; $args->device_srl = $device_srl; @@ -354,17 +354,17 @@ class Device extends \Member { throw new \Rhymix\Framework\Exceptions\TargetNotFound; } - + // Delete the device. $args = new \stdClass; $args->device_token = $output->data->device_token; $output = executeQuery('member.deleteMemberDevice', $args); return $output; } - + /** * Get device token from POST parameter, HTTP header or cookie - * + * * @return string|null */ protected function _getDeviceToken() @@ -375,14 +375,14 @@ class Device extends \Member { return $device_token; } - + // HTTP header named X-Device-Token $device_token = $_SERVER['HTTP_X_DEVICE_TOKEN'] ?? null; if ($device_token) { return $device_token; } - + // Cookie named device_token $device_token = $_COOKIE['device_token'] ?? null; if ($device_token) @@ -390,10 +390,10 @@ class Device extends \Member return $device_token; } } - + /** * Set device key via header or cookie - * + * * @return void */ protected function _setDeviceKey() @@ -404,7 +404,7 @@ class Device extends \Member { return; } - + // Set header if header was given, or cookie otherwise if (isset($_SERVER['HTTP_X_DEVICE_TOKEN'])) { diff --git a/modules/member/member.admin.controller.php b/modules/member/member.admin.controller.php index 9f115fc93..931a210fd 100644 --- a/modules/member/member.admin.controller.php +++ b/modules/member/member.admin.controller.php @@ -89,7 +89,7 @@ class MemberAdminController extends Member { $extra_vars = new stdClass; } - + // Get list of extra vars $all_args = Context::getRequestVars(); foreach($config->signupForm as $formInfo) @@ -114,7 +114,7 @@ class MemberAdminController extends Member { $args->limit_date = ''; } - + // remove whitespace $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); foreach($checkInfos as $val) @@ -130,7 +130,7 @@ class MemberAdminController extends Member { $args->description = ''; } - + $oMemberController = getController('member'); // Execute insert or update depending on the value of member_srl if(!$args->member_srl) @@ -146,7 +146,7 @@ class MemberAdminController extends Member } if(!$output->toBool()) return $output; - + // Invalidate sessions if denied or limited if ($args->denied === 'Y' || $args->limited >= date('Ymd')) { @@ -155,13 +155,13 @@ class MemberAdminController extends Member Rhymix\Framework\Session::setValidityInfo($args->member_srl, $validity_info); executeQuery('member.deleteAutologin', ['member_srl' => $args->member_srl]); } - + // Invalidate auth mail if denied or limited if ($args->denied === 'Y' || $args->limited >= date('Ymd')) { executeQuery('member.deleteAuthMail', ['member_srl' => $args->member_srl]); } - + // Save Signature $signature = Context::get('signature'); $oMemberController->putSignature($args->member_srl, $signature); @@ -193,7 +193,7 @@ class MemberAdminController extends Member // Clear cache MemberController::clearMemberCache($args->member_srl); - + // Return result $this->add('member_srl', $args->member_srl); $this->setMessage($msg_code); @@ -238,7 +238,7 @@ class MemberAdminController extends Member 'allow_duplicate_nickname', 'member_profile_view' ); - + if ($args->enable_join === 'KEY') { $args->enable_join = 'N'; @@ -259,12 +259,12 @@ class MemberAdminController extends Member { $args->authmail_expires_unit = 86400; } - + if(!array_key_exists($args->password_hashing_algorithm, Rhymix\Framework\Password::getSupportedAlgorithms())) { $args->password_hashing_algorithm = 'md5'; } - + $args->password_hashing_work_factor = intval($args->password_hashing_work_factor, 10); if($args->password_hashing_work_factor < 4) { @@ -278,7 +278,7 @@ class MemberAdminController extends Member { $args->password_hashing_auto_upgrade = 'N'; } - + if(!in_array($args->nickname_symbols, ['Y', 'N', 'LIST'])) { $args->nickname_symbols = 'Y'; @@ -299,7 +299,7 @@ class MemberAdminController extends Member { $config = new stdClass; $config->features = array(); - + $args = Context::gets( 'scrapped_documents', 'saved_documents', @@ -312,7 +312,7 @@ class MemberAdminController extends Member { $config->features[$key] = toBool($value); } - + $oModuleController = getController('module'); $output = $oModuleController->updateModuleConfig('member', $config); @@ -328,7 +328,7 @@ class MemberAdminController extends Member $config = new stdClass; $config->agreements = array(); $config->agreement = null; - + $args = Context::getRequestVars(); for ($i = 1; $i < 20; $i++) { @@ -347,14 +347,14 @@ class MemberAdminController extends Member $config->agreements[$i] = $agreement; } } - + $oModuleController = getController('module'); $output = $oModuleController->updateModuleConfig('member', $config); if (!$output->toBool()) { return $output; } - + // Delete old agreement files. foreach (Context::loadLangSupported() as $key => $val) { @@ -371,12 +371,12 @@ class MemberAdminController extends Member $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminAgreementsConfig'); $this->setRedirectUrl($returnUrl); } - + public function procMemberAdminInsertSignupConfig() { $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); - + $oModuleController = getController('module'); $args = Context::gets( @@ -433,7 +433,7 @@ class MemberAdminController extends Member { return new BaseObject('-1', 'msg_need_default_country'); } - + // set default $all_args->is_nick_name_public = 'Y'; @@ -474,7 +474,7 @@ class MemberAdminController extends Member $signupItem->required = ($all_args->{$key} == 'required') || $signupItem->mustRequired; $signupItem->isUse = in_array($key, $usable_list) || $signupItem->required; $signupItem->isPublic = ($all_args->{'is_'.$key.'_public'} == 'Y' && $signupItem->isUse) ? 'Y' : 'N'; - + if(in_array($key, ['signature', 'profile_image', 'image_name', 'image_mark'])) { $args->$key = $signupItem->isPublic; @@ -538,7 +538,7 @@ class MemberAdminController extends Member 'after_login_url', 'after_logout_url' ); - + if(!count($args->identifiers)) { return new BaseObject(-1, 'msg_need_identifier'); @@ -565,7 +565,7 @@ class MemberAdminController extends Member } $args->signupForm = $config->signupForm; $args->identifier = array_first($args->identifiers); - + if(!$args->change_password_date) { $args->change_password_date = 0; @@ -630,7 +630,7 @@ class MemberAdminController extends Member { global $lang; $oMemberModel = getModel('member'); - + // Get join form list which is additionally set $extendItems = $oMemberModel->getJoinFormList(); @@ -700,7 +700,7 @@ class MemberAdminController extends Member */ function _createSignupRuleset($signupForm) { - + } /** @@ -710,7 +710,7 @@ class MemberAdminController extends Member */ function _createLoginRuleset($identifier) { - + } /** @@ -720,7 +720,7 @@ class MemberAdminController extends Member */ function _createFindAccountByQuestion($identifier) { - + } /** @@ -984,7 +984,7 @@ class MemberAdminController extends Member } $this->setMessage('success_updated'); break; - } + } case 'delete': { $oMemberController->memberInfo = null; @@ -1017,7 +1017,7 @@ class MemberAdminController extends Member } $oDB->commit(); - + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminList'); $this->setRedirectUrl($returnUrl); } @@ -1313,7 +1313,7 @@ class MemberAdminController extends Member // Call trigger (after) ModuleHandler::triggerCall('member.insertGroup', 'after', $args); - + return $output; } @@ -1325,7 +1325,7 @@ class MemberAdminController extends Member function updateGroup($args) { if(!$args->group_srl) throw new Rhymix\Framework\Exceptions\TargetNotFound; - + // Call trigger (before) $trigger_output = ModuleHandler::triggerCall('member.updateGroup', 'before', $args); if(!$trigger_output->toBool()) @@ -1346,10 +1346,10 @@ class MemberAdminController extends Member $output = executeQuery('member.updateGroup', $args); $this->_deleteMemberGroupCache(); - + // Call trigger (after) ModuleHandler::triggerCall('member.updateGroup', 'after', $args); - + return $output; } @@ -1369,7 +1369,7 @@ class MemberAdminController extends Member if(!$group_info) throw new Rhymix\Framework\Exceptions\TargetNotFound; if($group_info->is_default == 'Y') throw new Rhymix\Framework\Exception('msg_not_delete_default'); - + // Call trigger (before) $trigger_output = ModuleHandler::triggerCall('member.deleteGroup', 'before', $group_info); if(!$trigger_output->toBool()) diff --git a/modules/member/member.admin.model.php b/modules/member/member.admin.model.php index adecf2cc1..262ce0ec2 100644 --- a/modules/member/member.admin.model.php +++ b/modules/member/member.admin.model.php @@ -35,7 +35,7 @@ class MemberAdminModel extends Member /** * Get a member list - * + * * @return object|array (object : when member count is 1, array : when member count is more than 1) */ function getMemberList() @@ -143,7 +143,7 @@ class MemberAdminModel extends Member else { $query_id = 'member.getMemberList'; - $args->sort_index = $sort_index; + $args->sort_index = $sort_index; } $args->sort_order = $sort_order; @@ -159,7 +159,7 @@ class MemberAdminModel extends Member /** * Get a memebr list for each site - * + * * @param int $site_srl * @param int $page * @@ -178,8 +178,8 @@ class MemberAdminModel extends Member /** * Get member_srls lists about site admins - * - * @return array + * + * @return array */ function getSiteAdminMemberSrls() { @@ -197,8 +197,8 @@ class MemberAdminModel extends Member /** * Return colorset list of a skin in the member module - * - * @return void + * + * @return void */ function getMemberAdminColorset() { @@ -225,7 +225,7 @@ class MemberAdminModel extends Member /** * Return member count with date - * + * * @param string $date * * @return int @@ -292,7 +292,7 @@ class MemberAdminModel extends Member $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); - foreach($config->signupForm as $item) + foreach($config->signupForm as $item) { $list[] = $item->name; } @@ -307,7 +307,7 @@ class MemberAdminModel extends Member } /** - * check allowed target ip address when login for admin. + * check allowed target ip address when login for admin. * * @return boolean (true : allowed, false : refuse) */ @@ -317,12 +317,12 @@ class MemberAdminModel extends Member { return Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, $allow_list); } - + if ($deny_list = ($deny_list === null) ? config('admin.deny') : $deny_list) { return !Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, $deny_list); } - + return true; } } diff --git a/modules/member/member.admin.view.php b/modules/member/member.admin.view.php index 67b3d321b..6c41d2907 100644 --- a/modules/member/member.admin.view.php +++ b/modules/member/member.admin.view.php @@ -1,4 +1,4 @@ - */ /** * @class memberAdminView @@ -102,7 +102,7 @@ class MemberAdminView extends Member 'user_name' => 'user_name', 'nick_name' => 'nick_name' ); - $usedIdentifiers = array(); + $usedIdentifiers = array(); if(is_array($config->signupForm)) { @@ -116,7 +116,7 @@ class MemberAdminView extends Member } } } - + // Get list of new members who have not completed email auth $check_list = array(); foreach ($output->data as $member) @@ -181,7 +181,7 @@ class MemberAdminView extends Member $password_algos['sha256'] = false; } Context::set('password_hashing_algos', $password_algos); - + $this->setTemplateFile('default_config'); } @@ -242,7 +242,7 @@ class MemberAdminView extends Member $option->height = 300; $option->editor_toolbar_hide = 'Y'; Context::set('editor', $oEditorModel->getEditor(0, $option)); - + $signupForm = $config->signupForm; foreach($signupForm as $val) { @@ -272,7 +272,7 @@ class MemberAdminView extends Member $managedEmailHost = $oMemberModel->getManagedEmailHosts(); Context::set('managedEmailHost', $managedEmailHost); $oSecurity->encodeHTML('managedEmailHost..email_host'); - + // Get country calling code list $country_list = Rhymix\Framework\i18n::listCountries(Context::get('lang_type') === 'ko' ? Rhymix\Framework\i18n::SORT_NAME_KOREAN : Rhymix\Framework\i18n::SORT_NAME_ENGLISH); Context::set('country_list', $country_list); @@ -400,7 +400,7 @@ class MemberAdminView extends Member Context::set('member_config', $member_config); $extendForm = $oMemberModel->getCombineJoinForm($this->memberInfo); Context::set('extend_form_list', $extendForm); - + $memberInfo = Context::get('member_info'); if(!is_object($memberInfo) || !$memberInfo->member_srl) { @@ -433,7 +433,7 @@ class MemberAdminView extends Member { $oMemberModel = getModel('member'); $member_config = $this->memberConfig; - + if($member_info = Context::get('member_info')) { $member_info->signature = $oMemberModel->getSignature($this->memberInfo->member_srl); @@ -442,12 +442,12 @@ class MemberAdminView extends Member { $member_info = new stdClass; } - + Context::set('member_info', $member_info); - + $formTags = $this->_getMemberInputTag($member_info, true); Context::set('formTags', $formTags); - + // Editor of the module set for signing by calling getEditor foreach($formTags as $formTag) { @@ -468,22 +468,22 @@ class MemberAdminView extends Member $option->editor_toolbar_hide = 'Y'; $option->editor_skin = $member_config->signature_editor_skin; $option->sel_editor_colorset = $member_config->sel_editor_colorset; - + Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option)); } } - + $identifierForm = new stdClass; $identifierForm->title = lang($member_config->identifier); $identifierForm->name = $member_config->identifier; $identifierForm->value = $member_info->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); - + if ($member_info->limit_date < date('Ymd')) { $member_info->limit_date = ''; } - + $member_unauthenticated = false; if ($member_info->member_srl && $member_info->denied !== 'N') { @@ -499,7 +499,7 @@ class MemberAdminView extends Member } } Context::set('member_unauthenticated', $member_unauthenticated); - + $this->setTemplateFile('insert_member'); } @@ -518,7 +518,7 @@ class MemberAdminView extends Member $extend_form_list = $oMemberModel->getCombineJoinForm($memberInfo); $security = new Security($extend_form_list); $security->encodeHTML('..column_title', '..description', '..default_value.'); - + if ($memberInfo) { $memberInfo = get_object_vars($memberInfo); @@ -533,17 +533,17 @@ class MemberAdminView extends Member { $member_config = $this->memberConfig = $oMemberModel->getMemberConfig(); } - + global $lang; $formTags = array(); - + foreach($member_config->signupForm as $no=>$formInfo) { if(!$formInfo->isUse || $formInfo->name == $member_config->identifier || $formInfo->name == 'password') { continue; } - + $formTag = new stdClass(); $inputTag = ''; $formTag->title = $formInfo->title; @@ -593,7 +593,7 @@ class MemberAdminView extends Member { $inputTag = sprintf('', $formInfo->name); } - + $max_filesize = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size'))); if (isset($member_config->{$formInfo->name.'_max_filesize'})) { diff --git a/modules/member/member.class.php b/modules/member/member.class.php index 4131f0066..357873a50 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -12,7 +12,7 @@ class Member extends ModuleObject */ public $admin_extra_vars = ['refused_reason', 'limited_reason']; public $nouse_extra_vars = ['error_return_url', 'success_return_url', '_rx_ajax_compat', '_rx_csrf_token', 'ruleset', 'captchaType', 'use_editor', 'use_html']; - + /** * constructor * @@ -32,14 +32,14 @@ class Member extends ModuleObject { $oModuleController = getController('module'); $config = ModuleModel::getModuleConfig('member'); - + // Set default config if(!$config) { $config = MemberModel::getMemberConfig(); $oModuleController->insertModuleConfig('member', $config); } - + $oMemberModel = getModel('member'); $oMemberController = getController('member'); $oMemberAdminController = getAdminController('member'); @@ -127,36 +127,36 @@ class Member extends ModuleObject if(!$oDB->isIndexExists("member","idx_phone_country")) return true; if(!$oDB->isColumnExists("member", "phone_type")) return true; if(!$oDB->isIndexExists("member","idx_phone_type")) return true; - + // Add columns for IP address if(!$oDB->isColumnExists("member", "ipaddress")) return true; if(!$oDB->isIndexExists("member","idx_ipaddress")) return true; if(!$oDB->isColumnExists("member", "last_login_ipaddress")) return true; if(!$oDB->isIndexExists("member","idx_last_login_ipaddress")) return true; - + // Add column for list order if(!$oDB->isColumnExists("member", "list_order")) return true; if(!$oDB->isIndexExists("member","idx_list_order")) return true; - + // Check autologin table if(!$oDB->isColumnExists("member_autologin", "security_key")) return true; - + // Check scrap folder table if(!$oDB->isColumnExists("member_scrap", "folder_srl")) return true; if(!$oDB->isIndexExists('member_nickname_log', 'idx_before_nick_name')) return true; if(!$oDB->isIndexExists('member_nickname_log', 'idx_after_nick_name')) return true; if(!$oDB->isIndexExists('member_nickname_log', 'idx_user_id')) return true; - + // Check individual indexes for member_group_member table if(!$oDB->isIndexExists('member_group_member', 'idx_member_srl')) return true; - + // Add device token type and last active date 2020.10.28 if(!$oDB->isColumnExists('member_devices', 'device_token_type')) return true; if(!$oDB->isColumnExists('member_devices', 'last_active_date')) return true; - + $config = ModuleModel::getModuleConfig('member'); - + // Check members with phone country in old format if ($config->phone_number_default_country && !preg_match('/^[A-Z]{3}$/', $config->phone_number_default_country)) { @@ -167,7 +167,7 @@ class Member extends ModuleObject { return true; } - + // Check signup form if(!$config->signupForm || !is_array($config->signupForm)) return true; $phone_found = false; @@ -190,7 +190,7 @@ class Member extends ModuleObject { return true; } - + // Check agreements if(!$config->agreements) { @@ -225,7 +225,7 @@ class Member extends ModuleObject return true; } } - + return false; } @@ -238,13 +238,13 @@ class Member extends ModuleObject { $oDB = DB::getInstance(); $oModuleController = getController('module'); - + // Check member directory FileHandler::makeDir('./files/member_extra_info/image_name'); FileHandler::makeDir('./files/member_extra_info/image_mark'); FileHandler::makeDir('./files/member_extra_info/signature'); FileHandler::makeDir('./files/member_extra_info/profile_image'); - + // Add columns for phone number if(!$oDB->isColumnExists("member", "phone_number")) { @@ -270,7 +270,7 @@ class Member extends ModuleObject { $oDB->addIndex("member","idx_phone_type", array("phone_type")); } - + // Add columns for IP address if(!$oDB->isColumnExists("member", "ipaddress")) { @@ -303,7 +303,7 @@ class Member extends ModuleObject { $oDB->addIndex("member","idx_list_order", array("list_order")); } - + // Check autologin table if(!$oDB->isColumnExists("member_autologin", "security_key")) { @@ -317,7 +317,7 @@ class Member extends ModuleObject $oDB->addColumn("member_scrap", "folder_srl", "number", 11); $oDB->addIndex("member_scrap","idx_folder_srl", array("folder_srl")); } - + // Add to index in member nickname log table. 2020. 07 .20 @BJRambo if(!$oDB->isIndexExists('member_nickname_log', 'idx_before_nick_name')) { @@ -325,13 +325,13 @@ class Member extends ModuleObject $oDB->addIndex('member_nickname_log', 'idx_after_nick_name', array('after_nick_name')); $oDB->addIndex('member_nickname_log', 'idx_user_id', array('user_id')); } - + // Check index for member_group_member table if(!$oDB->isIndexExists('member_group_member', 'idx_member_srl')) { $oDB->addIndex('member_group_member', 'idx_member_srl', array('member_srl')); } - + // Add device token type and last active date 2020.10.28 if(!$oDB->isColumnExists('member_devices', 'device_token_type')) { @@ -346,10 +346,10 @@ class Member extends ModuleObject $oDB->addIndex('member_devices', 'idx_last_active_date', array('last_active_date')); $oDB->query("UPDATE member_devices SET last_active_date = regdate WHERE last_active_date = ''"); } - + $config = ModuleModel::getModuleConfig('member') ?: new stdClass; $changed = false; - + // Check members with phone country in old format if ($config->phone_number_default_country && !preg_match('/^[A-Z]{3}$/', $config->phone_number_default_country)) { @@ -364,7 +364,7 @@ class Member extends ModuleObject 'new_phone_country' => 'KOR', )); } - + // Check signup form $oModuleController = getController('module'); $oMemberAdminController = getAdminController('member'); @@ -422,7 +422,7 @@ class Member extends ModuleObject $config->signupForm = $newForm; $changed = true; } - + // Check agreements if(!$config->agreements) { @@ -441,7 +441,7 @@ class Member extends ModuleObject { $output = $oModuleController->updateModuleConfig('member', $config); } - + // Check skin if($config->skin) { diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 4576ef9da..d26803b24 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -97,10 +97,10 @@ class MemberController extends Member $args = new stdClass(); $args->member_srl = $member_info->member_srl; executeQuery('member.deleteAuthMail', $args); - + // If a device token is supplied, attempt to register it. Rhymix\Modules\Member\Controllers\Device::getInstance()->autoRegisterDevice($member_info->member_srl); - + if(!$config->after_login_url) { $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); @@ -123,11 +123,11 @@ class MemberController extends Member $logged_info = Context::get('logged_info'); $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); if(!$trigger_output->toBool()) return $trigger_output; - + // Destroy session information Rhymix\Framework\Session::logout(); self::clearMemberCache($logged_info->member_srl); - + // Call a trigger after log-out (after) ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); @@ -155,38 +155,38 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + $oDocument = DocumentModel::getDocument($document_srl); - + // Check document if(!$oDocument->isAccessible()) { throw new Rhymix\Framework\Exception('msg_is_secret'); } - + $module_info = ModuleModel::getModuleInfoByModuleSrl($oDocument->get('module_srl')); - + $logged_info = Context::get('logged_info'); $grant = ModuleModel::getGrant($module_info, $logged_info); - + // Check access to module of the document if(!$grant->access) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + // Check grant to module of the document if(isset($grant->list) && isset($grant->view) && (!$grant->list || !$grant->view)) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + // Check consultation option if(isset($grant->consultation_read) && $module_info->consultation == 'Y' && !$grant->consultation_read && !$oDocument->isGranted()) { throw new Rhymix\Framework\Exceptions\NotPermitted; } - + // Find default scrap folder $args = new stdClass(); $args->member_srl = $logged_info->member_srl; @@ -200,7 +200,7 @@ class MemberController extends Member { $default_folder_srl = null; } - + // Variables $args = new stdClass(); $args->document_srl = intval($document_srl); @@ -211,31 +211,31 @@ class MemberController extends Member $args->nick_name = $oDocument->get('nick_name'); $args->target_member_srl = $oDocument->get('member_srl'); $args->title = $oDocument->get('title'); - + // Check if already scrapped $output = executeQuery('member.getScrapDocument', $args); if($output->data->count) { throw new Rhymix\Framework\Exception('msg_alreay_scrapped'); } - + // Call trigger (before) $trigger_output = ModuleHandler::triggerCall('member.procMemberScrapDocument', 'before', $args); if (!$trigger_output->toBool()) { return $trigger_output; } - + // Insert $output = executeQuery('member.addScrapDocument', $args); if(!$output->toBool()) { return $output; } - + // Call trigger (after) ModuleHandler::triggerCall('member.procMemberScrapDocument', 'after', $args); - + //$this->setError(-1); $this->setMessage('success_registed'); } @@ -261,21 +261,21 @@ class MemberController extends Member $args = new stdClass; $args->member_srl = $logged_info->member_srl; $args->document_srl = $document_srl; - + // Call trigger (before) $trigger_output = ModuleHandler::triggerCall('member.deleteScrapDocument', 'before', $args); if (!$trigger_output->toBool()) { return $trigger_output; } - + // Delete $output = executeQuery('member.deleteScrapDocument', $args); if (!$output->toBool()) { return $output; } - + // Call trigger (after) ModuleHandler::triggerCall('member.deleteScrapDocument', 'after', $args); } @@ -297,7 +297,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Check that the target folder exists and belongs to member $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -307,7 +307,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Move $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -326,7 +326,7 @@ class MemberController extends Member // Check login information if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\MustLogin; $logged_info = Context::get('logged_info'); - + // Get new folder name $folder_name = Context::get('name'); $folder_name = escape(trim(utf8_normalize_spaces($folder_name))); @@ -334,7 +334,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Check existing folder with same name $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -344,7 +344,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_folder_alreay_exists'); } - + // Create folder $args = new stdClass; $args->folder_srl = getNextSequence(); @@ -365,7 +365,7 @@ class MemberController extends Member // Check login information if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\MustLogin; $logged_info = Context::get('logged_info'); - + // Get new folder name $folder_srl = intval(Context::get('folder_srl')); $folder_name = Context::get('name'); @@ -374,7 +374,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Check that the original folder exists and belongs to member $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -388,7 +388,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_folder_is_default'); } - + // Check existing folder with same name $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -399,7 +399,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_folder_alreay_exists'); } - + // Rename folder $args = new stdClass; $args->folder_srl = $folder_srl; @@ -417,14 +417,14 @@ class MemberController extends Member // Check login information if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\MustLogin; $logged_info = Context::get('logged_info'); - + // Get folder_srl to delete $folder_srl = intval(Context::get('folder_srl')); if(!$folder_srl) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Check that the folder exists and belongs to member $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -438,7 +438,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_folder_is_default'); } - + // Check that the folder is empty $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -448,7 +448,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_folder_not_empty'); } - + // Delete folder $args = new stdClass; $args->folder_srl = $folder_srl; @@ -503,7 +503,7 @@ class MemberController extends Member $document_srl = (int)Context::get('document_srl'); if(!$document_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest; - + $oDocument = DocumentModel::getDocument($document_srl); if ($oDocument->get('member_srl') != $logged_info->member_srl) { @@ -519,7 +519,7 @@ class MemberController extends Member $oDocumentController = getController('document'); $oDocumentController->deleteDocument($document_srl); } - + /** * Delete an autologin */ @@ -528,14 +528,14 @@ class MemberController extends Member // Check login information if(!Context::get('is_logged')) throw new Rhymix\Framework\Exceptions\MustLogin; $logged_info = Context::get('logged_info'); - + $autologin_id = intval(Context::get('autologin_id')); $autologin_key = Context::get('autologin_key'); if (!$autologin_id || !$autologin_key) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + $args = new stdClass; $args->autologin_id = $autologin_id; $args->autologin_key = $autologin_key; @@ -639,13 +639,13 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\SecurityViolation; } - + $config = MemberModel::getMemberConfig(); // call a trigger (before) $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); if(!$trigger_output->toBool ()) return $trigger_output; - + // Check if an administrator allows a membership if ($config->enable_join !== 'Y' || !$config->signupForm) { @@ -654,7 +654,7 @@ class MemberController extends Member throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled'); } } - + // Check if the user accept the license terms (only if terms exist) $accept_agreement = Context::get('accept_agreement'); if(!is_array($accept_agreement)) @@ -706,7 +706,7 @@ class MemberController extends Member $args->phone_country = preg_replace('/[^A-Z]/', '', Context::get('phone_country')); } } - + // mobile input date format can be different if($args->birthday) { @@ -719,23 +719,23 @@ class MemberController extends Member $args->birthday = intval($args->birthday); } } - + if(!$args->birthday && $args->birthday_ui) { $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); } - + $args->allow_mailing = Context::get('allow_mailing'); $args->allow_message = Context::get('allow_message'); if($args->password1) $args->password = $args->password1; - + // Check all required fields $output = $this->_checkSignUpFields($config, $args, 'insert'); if (!$output->toBool()) { return $output; } - + // Check phone number if ($use_phone) { @@ -745,7 +745,7 @@ class MemberController extends Member return $output; } } - + // check password strength if(!MemberModel::checkPasswordStrength($args->password, $config->password_strength)) { @@ -767,7 +767,7 @@ class MemberController extends Member // Set the user state as "denied" when using mail authentication if($config->enable_confirm == 'Y') $args->denied = 'Y'; - + // remove whitespace $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); foreach($checkInfos as $val) @@ -777,7 +777,7 @@ class MemberController extends Member $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', utf8_clean(html_entity_decode($args->{$val}))); } } - + // Check symbols in nickname if($config->nickname_symbols === 'N') { @@ -794,14 +794,14 @@ class MemberController extends Member throw new Rhymix\Framework\Exception(sprintf(lang('msg_invalid_symbol_in_nickname'), escape($matches[0]))); } } - + // Insert member info $output = $this->insertMember($args); if($output instanceof BaseObject && !$output->toBool()) { return $output; } - + // Insert agreement info foreach($accept_agreement_rearranged as $agreement_sequence => $agreed) { @@ -849,7 +849,7 @@ class MemberController extends Member return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); } } - + // Register device Rhymix\Modules\Member\Controllers\Device::getInstance()->autoRegisterDevice($args->member_srl, false); @@ -863,7 +863,7 @@ class MemberController extends Member return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new BaseObject(-12, $msg)); } else $this->setMessage('success_registed'); - + // Call a trigger (after) ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); @@ -912,7 +912,7 @@ class MemberController extends Member $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; $member_info = MemberModel::getMemberInfoByMemberSrl($member_srl); - + // Verify the current password if(!MemberModel::isValidPassword($member_info->password, $password)) { @@ -948,7 +948,7 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + // Get current module config and user info $config = MemberModel::getMemberConfig(); $logged_info = Context::get('logged_info'); @@ -981,7 +981,7 @@ class MemberController extends Member $args->phone_country = preg_replace('/[^A-Z]/', '', Context::get('phone_country')); } } - + // mobile input date format can be different if($args->birthday) { @@ -994,19 +994,19 @@ class MemberController extends Member $args->birthday = intval($args->birthday); } } - + if(!$args->birthday && $args->birthday_ui) { $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); } - + // Check all required fields $output = $this->_checkSignUpFields($config, $args, 'update'); if (!$output->toBool()) { return $output; } - + // Check phone number if ($use_phone) { @@ -1016,7 +1016,7 @@ class MemberController extends Member return $output; } } - + // Fill in member_srl $args->member_srl = $logged_info->member_srl; @@ -1027,7 +1027,7 @@ class MemberController extends Member { unset($extra_vars->$key); } - + // Update extra vars $all_args = Context::getRequestVars(); foreach($config->signupForm as $formInfo) @@ -1066,7 +1066,7 @@ class MemberController extends Member throw new Rhymix\Framework\Exception(sprintf(lang('msg_invalid_symbol_in_nickname'), escape($matches[0]))); } } - + // Execute insert or update depending on the value of member_srl $output = $this->updateMember($args); if(!$output->toBool()) return $output; @@ -1096,7 +1096,7 @@ class MemberController extends Member { getController('file')->setFilesValid($args->member_srl, 'sig'); } - + // Get user_id information $member_info = MemberModel::getMemberInfoByMemberSrl($args->member_srl); @@ -1104,7 +1104,7 @@ class MemberController extends Member ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $member_info); unset($_SESSION['rechecked_password_step']); $this->setSessionInfo(); - + // Return result $this->add('member_srl', $args->member_srl); $this->setMessage('success_updated'); @@ -1157,7 +1157,7 @@ class MemberController extends Member { return $output; } - + // Log out all other sessions. $member_config = ModuleModel::getModuleConfig('member'); if ($member_config->password_change_invalidate_other_sessions === 'Y') @@ -1242,7 +1242,7 @@ class MemberController extends Member function insertProfileImage($member_srl, $target_file) { $config = MemberModel::getMemberConfig(); - + // Get an image size $max_width = $config->profile_image_max_width; $max_height = $config->profile_image_max_height; @@ -1369,7 +1369,7 @@ class MemberController extends Member function insertImageName($member_srl, $target_file) { $config = MemberModel::getMemberConfig(); - + // Get an image size $max_width = $config->image_name_max_width; $max_height = $config->image_name_max_height; @@ -1419,7 +1419,7 @@ class MemberController extends Member FileHandler::removeFilesInDir($target_path); @copy($target_file, $target_filename); - + } clearstatcache(true, $target_filename); @@ -1523,7 +1523,7 @@ class MemberController extends Member function insertImageMark($member_srl, $target_file) { $config = MemberModel::getMemberConfig(); - + // Get an image size $max_width = $config->image_mark_max_width; $max_height = $config->image_mark_max_height; @@ -1727,7 +1727,7 @@ class MemberController extends Member function procMemberAuthAccount() { $config = MemberModel::getMemberConfig(); - + // Test user_id and authkey $member_srl = Context::get('member_srl'); $auth_key = Context::get('auth_key'); @@ -1855,14 +1855,14 @@ class MemberController extends Member { throw new Rhymix\Framework\Exception('msg_activation_key_not_found'); } - + $auth_info = $output->data[0]; // Update the regdate of authmail entry $renewal_args = new stdClass; $renewal_args->member_srl = $member_info->member_srl; $renewal_args->auth_key = $auth_info->auth_key; - $output = executeQuery('member.updateAuthMail', $renewal_args); + $output = executeQuery('member.updateAuthMail', $renewal_args); $memberInfo = array(); global $lang; @@ -1954,7 +1954,7 @@ class MemberController extends Member $oTemplate = &TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); - + // Send a mail $oMail = new \Rhymix\Framework\Mail(); $oMail->setSubject(lang('msg_confirm_account_title')); @@ -1971,7 +1971,7 @@ class MemberController extends Member */ function procMemberSiteSignUp() { - + } /** @@ -1982,7 +1982,7 @@ class MemberController extends Member */ function procMemberSiteLeave() { - + } /** @@ -2011,7 +2011,7 @@ class MemberController extends Member getController('member')->delSignature($member_srl); return; } - + // Editor converter $obj = new stdClass; $config = MemberModel::getMemberConfig(); @@ -2022,12 +2022,12 @@ class MemberController extends Member $obj->content = $signature; $obj->editor_skin = $config->signature_editor_skin; $signature = getModel('editor')->converter($obj); - + $filename = RX_BASEDIR . sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl); $buff = sprintf('%s', $signature); Rhymix\Framework\Storage::write($filename, $buff); clearstatcache(true, $filename); - + self::clearMemberCache($member_srl); return $signature; } @@ -2072,10 +2072,10 @@ class MemberController extends Member { executeQuery('member.deleteMemberGroupMember', $args); } - + // Add member to group $output = executeQuery('member.addMemberToGroup', $args); - + ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); self::clearMemberCache($member_srl); @@ -2146,7 +2146,7 @@ class MemberController extends Member { return false; } - + // Fetch autologin information from DB. $args = new stdClass; $args->autologin_key = $autologin_key; @@ -2159,10 +2159,10 @@ class MemberController extends Member { $output->data = array_first($output->data); } - + // Hash the security key. $valid_security_keys = array(base64_encode(hash_hmac('sha256', $security_key, $autologin_key, true))); - + // Check the security key. if (!in_array($output->data->security_key, $valid_security_keys) || !$output->data->member_srl) { @@ -2171,7 +2171,7 @@ class MemberController extends Member executeQuery('member.deleteAutologin', $args); return false; } - + // Update the security key. $new_security_key = Rhymix\Framework\Security::getRandom(24, 'alnum'); $args = new stdClass; @@ -2182,11 +2182,11 @@ class MemberController extends Member { Rhymix\Framework\Session::setAutologinKeys($autologin_key, $new_security_key); } - + // Update the last login time. executeQuery('member.updateLastLogin', (object)['member_srl' => $output->data->member_srl]); self::clearMemberCache($output->data->member_srl); - + // Return the member_srl. return intval($output->data->member_srl); } @@ -2207,7 +2207,7 @@ class MemberController extends Member { return new BaseObject(-1, 'null_user_id'); } - + // Call a trigger before log-in (before) $trigger_obj = new stdClass(); $trigger_obj->user_id = $user_id; @@ -2251,18 +2251,18 @@ class MemberController extends Member { return $this->recordLoginError(-1, 'invalid_user_id'); } - + if($phone_country && !preg_match('/^[A-Z]{3}$/', $phone_country)) { $phone_country = Rhymix\Framework\i18n::getCountryCodeByCallingCode($phone_country); } - + $numbers_only = preg_replace('/[^0-9]/', '', $user_id); if (!$numbers_only) { return $this->recordLoginError(-1, 'null_user_id'); } - + $member_info = MemberModel::getMemberInfoByPhoneNumber($numbers_only, $phone_country); $used_identifier = 'phone_number'; if(!$member_info || preg_replace('/[^0-9]/', '', $member_info->phone_number) !== $numbers_only) @@ -2335,18 +2335,18 @@ class MemberController extends Member { return new BaseObject(-1, sprintf(lang('msg_user_not_confirmed'), $member_info->email_address)); } - + $refused_reason = $member_info->refused_reason ? ('
' . lang('refused_reason') . ': ' . $member_info->refused_reason) : ''; return new BaseObject(-1, lang('msg_user_denied') . $refused_reason); } - + // Notify if user is limited if($member_info->limit_date && substr($member_info->limit_date,0,8) >= date("Ymd")) { $limited_reason = $member_info->limited_reason ? ('
' . lang('refused_reason') . ': ' . $member_info->limited_reason) : ''; return new BaseObject(-9, sprintf(lang('msg_user_limited'), zdate($member_info->limit_date,"Y-m-d")) . $limited_reason); } - + // Do not allow login as admin if not in allowed IP list if($member_info->is_admin === 'Y' && $this->act === 'procMemberLogin') { @@ -2356,7 +2356,7 @@ class MemberController extends Member return new BaseObject(-1, 'msg_admin_ip_not_allowed'); } } - + // Update the latest login time $args->member_srl = $member_info->member_srl; $output = executeQuery('member.updateLastLogin', $args); @@ -2400,10 +2400,10 @@ class MemberController extends Member } } } - + // Call a trigger after successfully log-in (after) ModuleHandler::triggerCall('member.doLogin', 'after', $member_info); - + // When user checked to use auto-login if($keep_signed) { @@ -2419,17 +2419,17 @@ class MemberController extends Member Rhymix\Framework\Session::setAutologinKeys(substr($random_key, 0, 24), substr($random_key, 24, 24)); } } - + // Log in! Rhymix\Framework\Session::login($member_info->member_srl); $this->setSessionInfo(); - + // Log out all other sessions if so configured. if ($config->login_invalidate_other_sessions === 'Y') { Rhymix\Framework\Session::destroyOtherSessions($member_info->member_srl); } - + return $output; } @@ -2491,10 +2491,10 @@ class MemberController extends Member Context::set('logged_info', $logged_info); } } - + /** * Replace lang codes in member menu - * + * * @param $logged_info * @return void */ @@ -2635,7 +2635,7 @@ class MemberController extends Member } } } - + // Check password strength if($args->password && !$password_is_hashed) { @@ -2646,7 +2646,7 @@ class MemberController extends Member } $args->password = MemberModel::hashPassword($args->password); } - + // Check if ID is prohibited if($logged_info->is_admin !== 'Y' && MemberModel::isDeniedID($args->user_id)) { @@ -2690,7 +2690,7 @@ class MemberController extends Member $message = sprintf($managed_email_host[$emailhost_check],implode(', ',$hosts),'id@'.implode(', id@',$hosts)); return new BaseObject(-1, $message); } - + // Format phone number if (strval($args->phone_number) !== '') { @@ -2736,7 +2736,7 @@ class MemberController extends Member } } } - + // Insert data into the DB $args->list_order = -1 * $args->member_srl; @@ -2801,14 +2801,14 @@ class MemberController extends Member } $this->_sendAuthMail($auth_args, $args); } - + ModuleHandler::triggerCall('member.insertMember', 'after', $args); $oDB->commit(); - + // Remove from cache self::clearMemberCache($args->member_srl); - + $output->add('member_srl', $args->member_srl); return $output; } @@ -2827,10 +2827,10 @@ class MemberController extends Member $config = MemberModel::getMemberConfig(); $logged_info = Context::get('logged_info'); - + // Get what you want to modify the original information $orgMemberInfo = MemberModel::getMemberInfoByMemberSrl($args->member_srl); - + // Control of essential parameters if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; @@ -2921,7 +2921,7 @@ class MemberController extends Member } } } - + // Format phone number if (strval($args->phone_number) !== '') { @@ -2996,7 +2996,7 @@ class MemberController extends Member } } } - + // Check if ID is prohibited if($logged_info->is_admin !== 'Y' && $args->user_id && MemberModel::isDeniedID($args->user_id)) { @@ -3107,7 +3107,7 @@ class MemberController extends Member $this->_updatePointByGroup($orgMemberInfo->member_srl, $group_srl_list); } } - + // Call a trigger (after) ModuleHandler::triggerCall('member.updateMember', 'after', $args); @@ -3132,13 +3132,13 @@ class MemberController extends Member { return $output; } - + $extra_vars = $output->data->extra_vars ? unserialize($output->data->extra_vars) : new stdClass; foreach ($values as $key => $val) { $extra_vars->{$key} = $val; } - + $args = new stdClass(); $args->member_srl = $member_srl; $args->extra_vars = serialize($extra_vars); @@ -3147,7 +3147,7 @@ class MemberController extends Member { return $output; } - + self::clearMemberCache($member_srl); return $output; @@ -3200,14 +3200,14 @@ class MemberController extends Member { return $output; } - + // Bringing the user's information $member_info = MemberModel::getMemberInfoByMemberSrl($member_srl); if (!$member_info || !$member_info->member_srl) { return new BaseObject(-1, 'msg_not_exists_member'); } - + // If managers can not be deleted if ($member_info->is_admin == 'Y') { @@ -3264,14 +3264,14 @@ class MemberController extends Member ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); $oDB->commit(); - + // Name, image, image, mark, sign, delete $this->procMemberDeleteImageName($member_srl); $this->procMemberDeleteImageMark($member_srl); $this->procMemberDeleteProfileImage($member_srl); $this->delSignature($member_srl); self::clearMemberCache($member_srl); - + // Delete all remaining extra info $dirs = Rhymix\Framework\Storage::readDirectory(RX_BASEDIR . 'files/member_extra_info', true, true, false); foreach ($dirs as $dir) @@ -3435,7 +3435,7 @@ class MemberController extends Member $trigger_obj->member_srl = $args->member_srl; $trigger_obj->email_address = $args->email_address; $trigger_output = ModuleHandler::triggerCall('member.updateMemberEmailAddress', 'after', $trigger_obj); - + // Redirect to member info page $this->setRedirectUrl(getNotEncodedUrl('', 'act', 'dispMemberInfo')); } @@ -3447,10 +3447,10 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\FeatureDisabled; } - + $phone_country = Context::get('phone_country'); $phone_number = Context::get('phone_number'); - + if ($config->phone_number_default_country && (!$phone_country || $config->phone_number_hide_country === 'Y')) { $phone_country = $config->phone_number_default_country; @@ -3467,7 +3467,7 @@ class MemberController extends Member { return new BaseObject(-1, 'msg_invalid_phone_country'); } - + if (!preg_match('/[0-9]{2,}/', $phone_number)) { return new BaseObject(-1, 'msg_invalid_phone_number'); @@ -3476,9 +3476,9 @@ class MemberController extends Member { return new BaseObject(-1, 'msg_invalid_phone_number'); } - + $is_special = ($config->special_phone_number && $config->special_phone_number === preg_replace('/[^0-9]/', '', $phone_number)); - + // Check if SMS has already been sent if (!$is_special) { @@ -3493,7 +3493,7 @@ class MemberController extends Member return new BaseObject(-1, 'msg_auth_sms_rate_limited'); } } - + // Check if phone number is duplicate if (!$is_special && $config->phone_number_allow_duplicate !== 'Y') { @@ -3503,7 +3503,7 @@ class MemberController extends Member return new BaseObject(-1, 'msg_exists_phone_number'); } } - + // Generate code and store in session $code = intval(mt_rand(100000, 999999)); $_SESSION['verify_by_sms'] = array( @@ -3512,7 +3512,7 @@ class MemberController extends Member 'code' => $is_special ? intval($config->special_phone_code) : $code, 'status' => false, ); - + // Store in DB $args = new stdClass; $args->member_srl = $this->user->member_srl ?: 0; @@ -3520,12 +3520,12 @@ class MemberController extends Member $args->phone_country = $phone_country; $args->code = $is_special ? intval($config->special_phone_code) : $code; executeQuery('member.insertAuthSms', $args); - + if ($is_special) { return new BaseObject(0, 'verify_by_sms_code_sent'); } - + $sms = new Rhymix\Framework\SMS; $sms->addTo($phone_number, $phone_country_calling_code); $content = '[' . Context::get('site_module_info')->settings->title . '] ' . sprintf(lang('member.verify_by_sms_message'), $code); @@ -3540,7 +3540,7 @@ class MemberController extends Member return new BaseObject(0, 'verify_by_sms_error'); } } - + function procMemberConfirmVerificationSMS() { $config = MemberModel::getMemberConfig(); @@ -3548,19 +3548,19 @@ class MemberController extends Member { throw new Rhymix\Framework\Exceptions\FeatureDisabled; } - + $code = Context::get('code'); if(!preg_match('/^[0-9]{6}$/', $code)) { throw new Rhymix\Framework\Exception('verify_by_sms_code_incorrect'); } - + $code = intval($code); if(!isset($_SESSION['verify_by_sms']) || $_SESSION['verify_by_sms']['code'] !== $code) { throw new Rhymix\Framework\Exception('verify_by_sms_code_incorrect'); } - + $_SESSION['verify_by_sms']['status'] = true; return new BaseObject(0, 'verify_by_sms_code_confirmed'); } @@ -3768,10 +3768,10 @@ class MemberController extends Member return array(); } - + /** * Check required fields on signup or modify info - * + * * @param object $config * @param object $args * @param string $mode @@ -3818,13 +3818,13 @@ class MemberController extends Member } } } - + return new BaseObject; } /** * Check required fields on signup or modify info - * + * * @param object $config * @param object $args * @param string $mode @@ -3843,7 +3843,7 @@ class MemberController extends Member break; } } - + if ($verify) { // Attempt to fill in the country code. @@ -3867,7 +3867,7 @@ class MemberController extends Member return new BaseObject; } } - + // If updating, check if the new info is the same as the old info. if ($mode === 'update' && $original) { @@ -3885,7 +3885,7 @@ class MemberController extends Member return new BaseObject; } } - + // Check if verified by SMS. if (!isset($_SESSION['verify_by_sms']) || !$_SESSION['verify_by_sms']['status']) { @@ -3900,13 +3900,13 @@ class MemberController extends Member return new BaseObject(-1, 'verify_by_sms_incomplete'); } } - + return new BaseObject; } - + /** * Check if a variable is empty. - * + * * @param mixed $var * @param string $type * @return bool @@ -3927,7 +3927,7 @@ class MemberController extends Member return trim(strval($var)) === ''; } } - + /** * @deprecated * @return void @@ -3936,10 +3936,10 @@ class MemberController extends Member { self::clearMemberCache($member_srl); } - + /** * Clear all cache entries about a member. - * + * * @param int $member_srl * @return void */ diff --git a/modules/member/member.mobile.php b/modules/member/member.mobile.php index 87a259e2c..d09c2a150 100644 --- a/modules/member/member.mobile.php +++ b/modules/member/member.mobile.php @@ -4,7 +4,7 @@ class MemberMobile extends MemberView { /** - * Support method are + * Support method are * dispMemberInfo, dispMemberSignUpForm, dispMemberFindAccount, dispMemberGetTempPassword, dispMemberModifyInfo, dispMemberModifyInfoBefore */ var $memberInfo; diff --git a/modules/member/member.model.php b/modules/member/member.model.php index 2488ad92f..fda531324 100644 --- a/modules/member/member.model.php +++ b/modules/member/member.model.php @@ -20,7 +20,7 @@ class MemberModel extends Member */ public function init() { - + } /** @@ -32,9 +32,9 @@ class MemberModel extends Member { return self::$_member_config; } - + $config = ModuleModel::getModuleConfig('member') ?: new stdClass; - + // Set default config $config->enable_join = $config->enable_join ?? 'Y'; $config->enable_confirm = $config->enable_confirm ?? 'N'; @@ -49,7 +49,7 @@ class MemberModel extends Member $config->password_hashing_work_factor = $config->password_hashing_work_factor ?? 10; $config->password_hashing_auto_upgrade = $config->password_hashing_auto_upgrade ?? 'Y'; $config->password_change_invalidate_other_sessions = $config->password_change_invalidate_other_sessions ?? 'N'; - + // Set features config if(!isset($config->features)) $config->features = array(); $config->features['scrapped_documents'] = $config->features['scrapped_documents'] ?? true; @@ -58,7 +58,7 @@ class MemberModel extends Member $config->features['my_comments'] = $config->features['my_comments'] ?? true; $config->features['active_logins'] = $config->features['active_logins'] ?? true; $config->features['nickname_log'] = $config->features['nickname_log'] ?? true; - + // Set agreements config if(!isset($config->agreements) || !is_array($config->agreements)) { @@ -69,7 +69,7 @@ class MemberModel extends Member $config->agreements[1]->type = !empty($config->agreements[1]->content) ? 'required' : 'disabled'; } unset($config->agreement); - + // Set signup config $config->limit_day = $config->limit_day ?? 0; $config->emailhost_check = $config->emailhost_check ?? 'allowed'; @@ -103,7 +103,7 @@ class MemberModel extends Member { $config->signature_editor_skin = 'ckeditor'; } - + // Set login config $config->identifier = $config->identifier ?? 'user_id'; $config->identifiers = $config->identifiers ?? array('user_id', 'email_address'); @@ -114,17 +114,17 @@ class MemberModel extends Member $config->login_invalidate_other_sessions = $config->login_invalidate_other_sessions ?? 'N'; $config->after_login_url = $config->after_login_url ?? null; $config->after_logout_url = $config->after_logout_url ?? null; - + // Set design config $config->layout_srl = $config->layout_srl ?? 0; $config->skin = $config->skin ?? 'default'; $config->colorset = $config->colorset ?? 'white'; $config->mlayout_srl = $config->mlayout_srl ?? 0; $config->mskin = $config->mskin ?? 'default'; - + // Set group image config $config->group_image_mark = $config->group_image_mark ?? 'N'; - + // Set signup form if(!isset($config->signupForm) || !is_array($config->signupForm)) { @@ -138,13 +138,13 @@ class MemberModel extends Member } $config->signupForm[$key]->isPublic = $config->signupForm[$key]->isPublic ?? 'Y'; } - + return self::$_member_config = $config; } /** * Get member agreement from old version - * + * * @deprecated */ protected static function _getAgreement() @@ -188,11 +188,11 @@ class MemberModel extends Member $this->add('errorDetail', 'ERR_CSRF_INVALID_ORIGIN'); return; } - + // Add CORS restriction header('Access-Control-Allow-Origin: ' . rtrim(Rhymix\Framework\Url::getCurrentDomainURL(), '/')); header('Cross-Origin-Resource-Policy: same-origin'); - + // Return login status and CSRF token Context::setResponseMethod('JSON'); $this->add('status', Rhymix\Framework\Session::getLoginStatus()); @@ -211,12 +211,12 @@ class MemberModel extends Member { return; } - + $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $module_config = self::getMemberConfig(); $icon_path = ''; - + // Get requested member info if($member_srl == $logged_info->member_srl) { @@ -237,7 +237,7 @@ class MemberModel extends Member ModuleHandler::triggerCall('member.getMemberMenu', 'before', $member_info); $oMemberController = MemberController::getInstance(); - + // Display member information (Don't display to non-logged user) if($logged_info->member_srl) { @@ -269,7 +269,7 @@ class MemberModel extends Member } } } - + // Check if homepage and blog are public $homepage_is_public = false; $blog_is_public = false; @@ -292,19 +292,19 @@ class MemberModel extends Member } } } - + // View homepage info if($member_info->homepage && $homepage_is_public) { $oMemberController->addMemberPopupMenu(escape($member_info->homepage, false), 'homepage', '', '_blank', 'homepage'); } - + // View blog info if($member_info->blog && $blog_is_public) { $oMemberController->addMemberPopupMenu(escape($member_info->blog, false), 'blog', '', '_blank', 'blog'); } - + // Call a trigger (after) ModuleHandler::triggerCall('member.getMemberMenu', 'after', $member_info); // Display a menu for editting member info to a top administrator @@ -315,7 +315,7 @@ class MemberModel extends Member $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',0); $oMemberController->addMemberPopupMenu($url,'cmd_spammer',$icon_path,'popup'); - + $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl); $oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument'); @@ -351,7 +351,7 @@ class MemberModel extends Member /** * @brief Return member information with user_id - * + * * @return object|null */ public static function getMemberInfoByUserID($user_id) @@ -371,7 +371,7 @@ class MemberModel extends Member /** * @brief Return member information with email_address - * + * * @return object|null */ public static function getMemberInfoByEmailAddress($email_address) @@ -390,7 +390,7 @@ class MemberModel extends Member /** * @brief Return member information with phone number - * + * * @return object|null */ public static function getMemberInfoByPhoneNumber($phone_number, $phone_country = null) @@ -407,7 +407,7 @@ class MemberModel extends Member $phone_country = array(preg_replace('/[^0-9]/', '', $phone_country), Rhymix\Framework\i18n::getCountryCodeByCallingCode($phone_country)); } } - + $args = new stdClass(); $args->phone_number = $phone_number; $args->phone_country = $phone_country; @@ -421,7 +421,7 @@ class MemberModel extends Member /** * @brief Return member information with member_srl - * + * * @return object */ public static function getMemberInfoByMemberSrl($member_srl) @@ -459,7 +459,7 @@ class MemberModel extends Member /** * @brief Shortcut to getMemberInfoByMemberSrl() - * + * * @param int $member_srl * @return object */ @@ -1190,7 +1190,7 @@ class MemberModel extends Member { return null; } - + $info = null; $member_group = self::getMemberGroups($member_srl); $groups_info = self::getGroups(); @@ -1226,7 +1226,7 @@ class MemberModel extends Member $GLOBALS['__member_info__']['group_image_mark'][$member_srl] = ''; } } - + return $GLOBALS['__member_info__']['group_image_mark'][$member_srl]; } @@ -1249,7 +1249,7 @@ class MemberModel extends Member if(file_exists($filename)) { $signature = preg_replace('/<\?.*\?>/', '', FileHandler::readFile($filename)); - + // retroact $config = self::getMemberConfig(); if($config->signature_html_retroact == 'Y' && $config->signature_html == 'N' && preg_match('/<[^br]+>/i', $signature)) @@ -1257,7 +1257,7 @@ class MemberModel extends Member $signature = preg_replace('/(\r?\n)+/', "\n", $signature); return MemberController::getInstance()->putSignature($member_srl, $signature); } - + $GLOBALS['__member_info__']['signature'][$member_srl] = $signature; } else @@ -1265,7 +1265,7 @@ class MemberModel extends Member $GLOBALS['__member_info__']['signature'][$member_srl] = ''; } } - + return $GLOBALS['__member_info__']['signature'][$member_srl]; } @@ -1283,7 +1283,7 @@ class MemberModel extends Member { return false; } - + // Check the password $password_match = false; $current_algorithm = false; @@ -1301,7 +1301,7 @@ class MemberModel extends Member { return false; } - + // Update the encryption method if necessary $config = self::getMemberConfig(); if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') @@ -1324,7 +1324,7 @@ class MemberModel extends Member $need_upgrade = false; } } - + if ($need_upgrade) { $args = new stdClass(); @@ -1333,10 +1333,10 @@ class MemberModel extends Member MemberController::getInstance()->updateMemberPassword($args); } } - + return true; } - + /** * @brief Create a hash of plain text password * @param string $password_text The password to hash @@ -1347,37 +1347,37 @@ class MemberModel extends Member { return Rhymix\Framework\Password::hashPassword($password_text, $algorithm); } - + public static function checkPasswordStrength($password, $strength) { $logged_info = Context::get('logged_info'); if($logged_info->is_admin == 'Y') return true; - + if($strength == NULL) { $config = self::getMemberConfig(); $strength = $config->password_strength?$config->password_strength:'normal'; } - + $length = strlen($password); - + switch ($strength) { case 'high': if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; /* no break */ - + case 'normal': if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; break; - + case 'low': if($length < 4) return false; break; } - + return true; } - + public static function getAdminGroupSrl() { $groupSrl = 0; @@ -1395,12 +1395,12 @@ class MemberModel extends Member } return $groupSrl; } - + public static function getMemberModifyNicknameLog($page = 1, $member_srl = null) { $search_keyword = Context::get('search_keyword'); $search_target = Context::get('search_target'); - + // $this->user 에 재대로 된 회원 정보가 들어 가지 않음. $logged_info = Context::get('logged_info'); @@ -1429,14 +1429,14 @@ class MemberModel extends Member break; } $output = executeQuery('member.getMemberModifyNickName', $args); - + return $output; } } - + $args->member_srl = $member_srl; $output = executeQuery('member.getMemberModifyNickName', $args); - + return $output; } } diff --git a/modules/member/member.view.php b/modules/member/member.view.php index 8f5b94615..89d032a5c 100644 --- a/modules/member/member.view.php +++ b/modules/member/member.view.php @@ -208,7 +208,7 @@ class MemberView extends Member // Get the member information if logged-in if($this->user->member_srl) throw new Rhymix\Framework\Exception('msg_already_logged'); - // call a trigger (before) + // call a trigger (before) $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); if(!$trigger_output->toBool()) return $trigger_output; @@ -233,11 +233,11 @@ class MemberView extends Member throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled'); } } - + $formTags = getAdminView('member')->_getMemberInputTag(); Context::set('formTags', $formTags); Context::set('email_confirmation_required', $member_config->enable_confirm); - + // Editor of the module set for signing by calling getEditor foreach($formTags as $formTag) { @@ -262,21 +262,21 @@ class MemberView extends Member { $option->editor_skin = 'textarea'; } - + Context::set('editor', getModel('editor')->getEditor(0, $option)); } } - + $identifierForm = new stdClass; $identifierForm->title = lang($member_config->identifier); $identifierForm->name = $member_config->identifier; Context::set('identifierForm', $identifierForm); - + $this->addExtraFormValidatorMessage(); - + // Set a copy of the agreement for compatibility with old skins $member_config->agreement = $member_config->agreements[1]->content ?? ''; - + // Set a template file $this->setTemplateFile('signup_form'); } @@ -301,7 +301,7 @@ class MemberView extends Member if ($this->member_config->identifier == 'email_address') { Context::set('identifierTitle', lang('email_address')); - Context::set('identifierValue', $logged_info->email_address); + Context::set('identifierValue', $logged_info->email_address); } else { @@ -315,7 +315,7 @@ class MemberView extends Member /** * @brief Modify member information */ - function dispMemberModifyInfo() + function dispMemberModifyInfo() { if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') { @@ -337,10 +337,10 @@ class MemberView extends Member $member_info = MemberModel::getMemberInfoByMemberSrl($member_srl, 0, $columnList); $member_info->signature = MemberModel::getSignature($member_srl); Context::set('member_info', $member_info); - + $formTags = getAdminView('member')->_getMemberInputTag($member_info); Context::set('formTags', $formTags); - + // Editor of the module set for signing by calling getEditor foreach($formTags as $formTag) { @@ -365,19 +365,19 @@ class MemberView extends Member { $option->editor_skin = 'textarea'; } - + Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option)); } } - + $identifierForm = new stdClass; $identifierForm->title = lang($member_config->identifier); $identifierForm->name = $member_config->identifier; $identifierForm->value = $member_info->{$member_config->identifier}; Context::set('identifierForm', $identifierForm); - + $this->addExtraFormValidatorMessage(); - + // Set a template file $this->setTemplateFile('modify_info'); } @@ -411,7 +411,7 @@ class MemberView extends Member $args->module_srl = intval(Context::get('selected_module_srl')) ?: null; $args->sort_index = 'list_order'; $args->statusList = array('PUBLIC', 'SECRET'); - + $columnList = array('document_srl', 'module_srl', 'category_srl', 'member_srl', 'title', 'nick_name', 'comment_count', 'trackback_count', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status'); $output = DocumentModel::getDocumentList($args, false, false, $columnList); Context::set('total_count', $output->total_count); @@ -454,7 +454,7 @@ class MemberView extends Member $args->member_srl = array($this->user->member_srl, $this->user->member_srl * -1); $args->module_srl = intval(Context::get('selected_module_srl')) ?: null; $args->sort_index = 'list_order'; - + $output = CommentModel::getTotalCommentList($args); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); @@ -485,7 +485,7 @@ class MemberView extends Member } $logged_info = Context::get('logged_info'); - + // Check folders $args = new stdClass; $args->member_srl = $logged_info->member_srl; @@ -498,11 +498,11 @@ class MemberView extends Member { return $output; } - + $output = executeQueryArray('member.getScrapFolderList', $args); $folders = $output->data; } - + // Get default folder if no folder is selected $folder_srl = (int)Context::get('folder_srl'); if($folder_srl && !array_filter($folders, function($folder) use($folder_srl) { return $folder->folder_srl == $folder_srl; })) @@ -513,7 +513,7 @@ class MemberView extends Member { $folder_srl = array_first($folders)->folder_srl; } - + // Get folder info $folder_info = new stdClass; foreach($folders as $folder) @@ -547,7 +547,7 @@ class MemberView extends Member break; } $output = executeQueryArray('member.getScrapDocumentList', $args); - + Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); @@ -577,7 +577,7 @@ class MemberView extends Member $logged_info = Context::get('logged_info'); if(!$logged_info->member_srl) throw new Rhymix\Framework\Exceptions\MustLogin; // Get the saved document(module_srl is set to member_srl instead) - + $args = new stdClass(); $args->member_srl = $logged_info->member_srl; $args->page = Context::get('page'); @@ -607,7 +607,7 @@ class MemberView extends Member { throw new Rhymix\Framework\Exceptions\MustLogin; } - + $args = new stdClass(); $args->member_srl = $logged_info->member_srl; $args->page = Context::get('page'); @@ -617,7 +617,7 @@ class MemberView extends Member Context::set('page', $output->page); Context::set('active_logins', $output->data); Context::set('page_navigation', $output->page_navigation); - + $args = new stdClass(); $args->member_srl = $logged_info->member_srl; $output = executeQueryArray('member.getMemberDevice', $args); @@ -625,9 +625,9 @@ class MemberView extends Member $this->setTemplateFile('active_logins'); } - + /** - * @brief Display the login form + * @brief Display the login form */ function dispMemberLoginForm() { @@ -638,7 +638,7 @@ class MemberView extends Member $referer_url = getNotEncodedUrl('act', ''); } Context::set('referer_url', $referer_url); - + // Return to previous screen if already logged in. if(Context::get('is_logged')) { @@ -734,7 +734,7 @@ class MemberView extends Member $this->setRedirectUrl(getNotEncodedUrl('act', '')); return; } - + $output = MemberController::getInstance()->procMemberLogout(); $this->setRedirectUrl(isset($output->redirect_url) ? $output->redirect_url : getNotEncodedUrl('act', '')); } @@ -808,7 +808,7 @@ class MemberView extends Member $js_code[] = 'if(!validator) return false;'; $errorLang = array(); - foreach($extraList as $val) + foreach($extraList as $val) { $title = str_ireplace(array('column_title)); if($val->column_type == 'kr_zip' || $val->column_type == 'tel') @@ -832,7 +832,7 @@ class MemberView extends Member /** * Spammer manage popup - * + * * @return void **/ function dispMemberSpammer() diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index bde1748b2..71c18b31e 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -239,7 +239,7 @@ class menuAdminController extends menu $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl); $this->setRedirectUrl($returnUrl); } - + /** * Change the menu design (layout) */ @@ -253,7 +253,7 @@ class menuAdminController extends menu { return; } - + $args = new stdClass; $args->menu_srl = $menu_srl; $output = executeQueryArray('layout.getLayoutModules', $args); @@ -285,7 +285,7 @@ class menuAdminController extends menu return $output; } } - + Rhymix\Framework\Cache::clearGroup('site_and_module'); } } @@ -1653,10 +1653,10 @@ class menuAdminController extends menu $oModuleModel = getModel('module'); //$info = $oModuleModel->getModuleInfoXml($moduleName); $info = $oModuleModel->getModuleActionXml($moduleName); - + $args = new stdClass(); $args->url = 'index.php?module=admin'; - + if($info->menu->{$menuName}->index) { $args->url .= '&act=' . $info->menu->{$menuName}->index; @@ -1665,7 +1665,7 @@ class menuAdminController extends menu { $args->url .= '&act=' . $info->admin_index_act; } - + $args->menu_item_srl = (!$requestArgs->menu_item_srl) ? getNextSequence() : $requestArgs->menu_item_srl; $args->parent_srl = $requestArgs->parent_srl; $args->menu_srl = $requestArgs->menu_srl; @@ -1730,7 +1730,7 @@ class menuAdminController extends menu { $exposure = implode(',', $exposure); } - + if(in_array($exposure, array('-1','-3'))) { $args->group_srls = $exposure; @@ -1835,7 +1835,7 @@ class menuAdminController extends menu FileHandler::writeFile($xml_file, ''); FileHandler::writeFile($php_file, ''); return $xml_file; - } + } $site_srl = 0; $domain = null; @@ -1947,7 +1947,7 @@ class menuAdminController extends menu { $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); } - + // List variables $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); $name_arr_str = ''; @@ -1976,11 +1976,11 @@ class menuAdminController extends menu $normal_btn = strval($node->normal_btn); if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = escape($normal_btn); else $normal_btn = ''; - + $hover_btn = strval($node->hover_btn); if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = escape($hover_btn); else $hover_btn = ''; - + $active_btn = strval($node->active_btn); if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = escape($active_btn); else $active_btn = ''; diff --git a/modules/menu/menu.admin.model.php b/modules/menu/menu.admin.model.php index 4bf5a04cd..ec30626fb 100644 --- a/modules/menu/menu.admin.model.php +++ b/modules/menu/menu.admin.model.php @@ -74,10 +74,10 @@ class menuAdminModel extends menu $menu_info->php_file = sprintf('./files/cache/menu/%d.php',$menu_srl); return $menu_info; } - + /** * Get actual menu info data - * + * * @param int $menu_srl * @return object */ @@ -85,7 +85,7 @@ class menuAdminModel extends menu { $menu = new stdClass; $menu->list = []; - + $filename = sprintf('./files/cache/menu/%d.php', $menu_srl); if (!FileHandler::exists($filename)) { @@ -95,7 +95,7 @@ class menuAdminModel extends menu { include $filename; } - + return $menu; } @@ -350,7 +350,7 @@ class menuAdminModel extends menu $oAutoinstallAdminModel = getAdminModel('autoinstall'); $config = $oAutoinstallAdminModel->getAutoInstallAdminModuleConfig(); - + foreach($_allModules as $module_name) { $module = $oModuleModel->getModuleInfoXml($module_name); @@ -489,7 +489,7 @@ class menuAdminModel extends menu $oModuleModel = getModel('module'); $oMenuAdminController = getAdminController('menu'); $columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl'); - + $start_module_list = executeQuery('module.getDomainInfo', new stdClass); $start_module = $start_module_list->data; @@ -503,7 +503,7 @@ class menuAdminModel extends menu { include($php_file); } - else + else { $oMenuAdminController->makeXmlFile($menuSrl); } @@ -663,7 +663,7 @@ class menuAdminModel extends menu { $start_module = $start_module ? array($start_module) : array(); } - + // if url is empty and is_shortcut is 'N', change to is_shortcut 'Y' if(!$menu['url'] && $menu['is_shortcut'] == 'N') { diff --git a/modules/menu/menu.admin.view.php b/modules/menu/menu.admin.view.php index 808449b44..c7ef95bc3 100644 --- a/modules/menu/menu.admin.view.php +++ b/modules/menu/menu.admin.view.php @@ -21,7 +21,7 @@ class menuAdminView extends menu $this->setTemplatePath($this->module_path.'tpl'); } - + /** * Site map admin menu index page * @return void @@ -40,7 +40,7 @@ class menuAdminView extends menu $oMenuController = getAdminController('menu'); $oMenuController->linkAllModuleInstancesToSitemap(); } - + // get installed module list $oPageController = getController('page'); //for lang $oMenuAdminModel = getAdminModel('menu'); @@ -79,7 +79,7 @@ class menuAdminView extends menu } } Context::set('group_list', $groupList); - + // Get layout instance list $oLayoutModel = getModel('layout'); $layouts_P = $oLayoutModel->getLayoutList(0, 'P') ?: []; diff --git a/modules/menu/menu.class.php b/modules/menu/menu.class.php index 706d7a74f..552df4f30 100644 --- a/modules/menu/menu.class.php +++ b/modules/menu/menu.class.php @@ -27,19 +27,19 @@ class menu extends ModuleObject function checkUpdate() { $oDB = DB::getInstance(); - + // 2015. 06. 15 add column desc if(!$oDB->isColumnExists('menu_item', 'desc')) { return true; } - + // 2021. 01. 20 add column icon if(!$oDB->isColumnExists('menu_item', 'icon')) { return true; } - + return false; } @@ -50,13 +50,13 @@ class menu extends ModuleObject function moduleUpdate() { $oDB = DB::getInstance(); - + // 2015. 06. 15 add column desc if(!$oDB->isColumnExists('menu_item', 'desc')) { $oDB->addColumn('menu_item', 'desc', 'varchar', 250, null, false, 'name'); } - + // 2021. 01. 20 add column icon if(!$oDB->isColumnExists('menu_item', 'icon')) { @@ -116,4 +116,4 @@ class menu extends ModuleObject } } /* End of file menu.class.php */ -/* Location: ./modules/menu/menu.class.php */ \ No newline at end of file +/* Location: ./modules/menu/menu.class.php */ diff --git a/modules/menu/menu.mobile.php b/modules/menu/menu.mobile.php index 5fbe8cfd9..0b4ec4aae 100644 --- a/modules/menu/menu.mobile.php +++ b/modules/menu/menu.mobile.php @@ -67,7 +67,7 @@ class menuMobile extends moduleObject } } - Context::set('menu', $this->result); + Context::set('menu', $this->result); $this->setTemplatePath(sprintf("%stpl/",$this->module_path)); $this->setTemplateFile('menu.html'); diff --git a/modules/message/message.class.php b/modules/message/message.class.php index 9d8b194b8..d52080995 100644 --- a/modules/message/message.class.php +++ b/modules/message/message.class.php @@ -12,7 +12,7 @@ class Message extends ModuleObject */ function moduleInstall() { - + } /** diff --git a/modules/message/message.mobile.php b/modules/message/message.mobile.php index 4f290b9ec..99e8a9034 100644 --- a/modules/message/message.mobile.php +++ b/modules/message/message.mobile.php @@ -3,7 +3,7 @@ class MessageMobile extends MessageView { - + } /* End of file message.mobile.php */ /* Location: ./modules/message/message.mobile.php */ diff --git a/modules/message/message.view.php b/modules/message/message.view.php index 1f6abdc4b..0179da2ae 100644 --- a/modules/message/message.view.php +++ b/modules/message/message.view.php @@ -29,7 +29,7 @@ class MessageView extends Message { $config->mskin = 'default'; } - + // Set the template path if (contains('mobile', get_class($this), false)) { @@ -63,13 +63,13 @@ class MessageView extends Message // Get the member configuration $member_config = ModuleModel::getModuleConfig('member'); Context::set('member_config', $member_config); - + // Disable location if debug not available if (!Rhymix\Framework\Debug::isEnabledForCurrentUser()) { $location = null; } - + // Remove basedir from location (if any) if ($location && starts_with(\RX_BASEDIR, $location)) { @@ -80,7 +80,7 @@ class MessageView extends Message Context::set('system_message', nl2br($this->getMessage())); Context::set('system_message_detail', nl2br($detail)); Context::set('system_message_location', escape($location)); - + if ($this->getError()) { if ($detail) @@ -94,7 +94,7 @@ class MessageView extends Message } $this->setTemplateFile('system_message'); - + // Default 403 Error if($this->getHttpStatusCode() === 200) { diff --git a/modules/module/module.admin.controller.php b/modules/module/module.admin.controller.php index bd744ae5d..bb4b8bff3 100644 --- a/modules/module/module.admin.controller.php +++ b/modules/module/module.admin.controller.php @@ -285,10 +285,10 @@ class ModuleAdminController extends Module $columnList = array('module_srl', 'module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); if(!$module_info) throw new Rhymix\Framework\Exceptions\InvalidRequest; - + $oDB = DB::getInstance(); $oDB->begin(); - + // Register Admin ID $oModuleController->deleteAdminId($module_srl); $admin_member = Context::get('admin_member'); @@ -357,9 +357,9 @@ class ModuleAdminController extends Module if(!$output->toBool()) return $output; } } - + $oDB->commit(); - + Rhymix\Framework\Cache::delete("site_and_module:module_grants:$module_srl"); $this->setMessage('success_registed'); } @@ -646,10 +646,10 @@ class ModuleAdminController extends Module } } } - + Rhymix\Framework\Cache::delete("site_and_module:module_grants:$module_srl"); $this->setMessage('success_registed'); - + if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { if(Context::get('success_return_url')) @@ -876,10 +876,10 @@ class ModuleAdminController extends Module $langMap[$langCode] += $langMap[$targetLangCode]; } - + Rhymix\Framework\Cache::set('site_and_module:user_defined_langs:0:' . $langCode, $langMap[$langCode], 0, true); } - + $currentLang = Context::getLangType(); return isset($langMap[$currentLang]) ? $langMap[$currentLang] : array(); } diff --git a/modules/module/module.admin.model.php b/modules/module/module.admin.model.php index e43a6024d..ec5115225 100644 --- a/modules/module/module.admin.model.php +++ b/modules/module/module.admin.model.php @@ -201,7 +201,7 @@ class ModuleAdminModel extends Module $group_list = MemberModel::getGroups(); Context::set('group_list', $group_list); - //Security + //Security $security = new Security(); $security->encodeHTML('group_list..title'); $security->encodeHTML('group_list..description'); @@ -360,12 +360,12 @@ class ModuleAdminModel extends Module if($skin_info->extra_vars) { - foreach($skin_info->extra_vars as $key => $val) + foreach($skin_info->extra_vars as $key => $val) { $group = $val->group; $name = $val->name; $type = $val->type; - if($skin_vars[$name]) + if($skin_vars[$name]) { $value = $skin_vars[$name]->value; } @@ -387,7 +387,7 @@ class ModuleAdminModel extends Module Context::set('mode', $mode); //Security - $security = new Security(); + $security = new Security(); $security->encodeHTML('mid'); $security->encodeHTML('module_info.browser_title'); $security->encodeHTML('skin_info...'); diff --git a/modules/module/module.admin.view.php b/modules/module/module.admin.view.php index bc55898e9..7cc50fa0e 100644 --- a/modules/module/module.admin.view.php +++ b/modules/module/module.admin.view.php @@ -87,7 +87,7 @@ class ModuleAdminView extends Module $module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module')); Context::set('module_info', $module_info); - $security = new Security(); + $security = new Security(); $security->encodeHTML('module_info...'); // Set the layout to be pop-up @@ -257,7 +257,7 @@ class ModuleAdminView extends Module $oMemberModel = getModel('member'); $group_list = $oMemberModel->getGroups(); Context::set('group_list', $group_list); - $security = new Security(); + $security = new Security(); $security->encodeHTML('group_list..title'); // Set the layout to be pop-up @@ -310,10 +310,10 @@ class ModuleAdminView extends Module Context::set('filebox_list', $output->data); Context::set('page_navigation', $output->page_navigation); Context::set('page', $page); - + $max_filesize = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size'))); Context::set('max_filesize', $max_filesize); - + $oSecurity = new Security(); $oSecurity->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); $this->setTemplateFile('adminFileBox'); diff --git a/modules/module/module.class.php b/modules/module/module.class.php index 3c9f669f3..1aea3bc5d 100644 --- a/modules/module/module.class.php +++ b/modules/module/module.class.php @@ -43,7 +43,7 @@ class Module extends ModuleObject return $output; } } - + // Create a directory to use in the module module FileHandler::makeDir('./files/cache/module_info'); FileHandler::makeDir('./files/cache/triggers'); @@ -56,7 +56,7 @@ class Module extends ModuleObject function checkUpdate() { $oDB = DB::getInstance(); - + // check ruleset directory if(!is_dir(RX_BASEDIR . 'files/ruleset')) return true; @@ -104,7 +104,7 @@ class Module extends ModuleObject if(!$oDB->isColumnExists('action_forward', 'route_regexp')) return true; if(!$oDB->isColumnExists('action_forward', 'route_config')) return true; if(!$oDB->isColumnExists('action_forward', 'global_route')) return true; - + // check additional indexes on lang table $column_info = $oDB->getColumnInfo('lang', 'name'); if($column_info->size > 100) @@ -115,7 +115,7 @@ class Module extends ModuleObject if(!$oDB->isIndexExists('lang', 'idx_name')) return true; if(!$oDB->isIndexExists('lang', 'idx_lang_code')) return true; if(!$oDB->isIndexExists('lang', 'idx_lang')) return true; - + // check module_trigger table if($oDB->isIndexExists('module_trigger', 'idx_trigger')) { @@ -130,7 +130,7 @@ class Module extends ModuleObject { return true; } - + // check deprecated lang code $output = executeQuery('module.getLangCount', ['site_srl' => 0, 'lang_code' => 'jp']); if ($output->data->count > 0) @@ -151,7 +151,7 @@ class Module extends ModuleObject { $this->migrateDomains(); } - + // check ruleset directory FileHandler::makeDir(RX_BASEDIR . 'files/ruleset'); @@ -192,7 +192,7 @@ class Module extends ModuleObject $oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), false); } } - + // check route columns in action_forward table if(!$oDB->isColumnExists('action_forward', 'route_regexp')) { @@ -206,7 +206,7 @@ class Module extends ModuleObject { $oDB->addColumn('action_forward', 'global_route', 'char', 1, 'N', true); } - + // check additional indexes on lang table $column_info = $oDB->getColumnInfo('lang', 'name'); if($column_info->size > 100) @@ -229,7 +229,7 @@ class Module extends ModuleObject { $oDB->addIndex('lang', 'idx_lang', array('site_srl', 'name', 'lang_code'), false); } - + // check module_trigger table if($oDB->isIndexExists('module_trigger', 'idx_trigger')) { @@ -249,7 +249,7 @@ class Module extends ModuleObject $oDB->addIndex('module_trigger', 'idx_trigger_name', array('trigger_name', 'called_position')); $oDB->addIndex('module_trigger', 'idx_trigger_target', array('module', 'type', 'called_method')); } - + // check deprecated lang code $output = executeQuery('module.getLangCount', ['site_srl' => 0, 'lang_code' => 'jp']); if ($output->data->count > 0) @@ -261,7 +261,7 @@ class Module extends ModuleObject } } } - + /** * @brief Migrate old sites and multidomain info to new 'domains' table */ @@ -273,14 +273,14 @@ class Module extends ModuleObject { $oDB->createTable($this->module_path . 'schemas/domains.xml'); } - + // Get current site configuration. $config = ModuleModel::getModuleConfig('module'); - + // Initialize domains data. $domains = array(); $default_domain = new stdClass; - + // Check XE sites. $output = executeQueryArray('module.getSites'); if ($output->data) @@ -292,7 +292,7 @@ class Module extends ModuleObject { $site_domain = 'http://' . $site_domain; } - + $domain = new stdClass(); $domain->domain_srl = $site_info->site_srl; $domain->domain = Rhymix\Framework\URL::getDomainFromURL(strtolower($site_domain)); @@ -322,7 +322,7 @@ class Module extends ModuleObject { $output = executeQuery('module.getDefaultMidInfo', $args); $default_hostinfo = parse_url(Rhymix\Framework\URL::getCurrentURL()); - + $domain = new stdClass(); $domain->domain_srl = 0; $domain->domain = Rhymix\Framework\URL::decodeIdna(strtolower($default_hostinfo['host'])); @@ -343,7 +343,7 @@ class Module extends ModuleObject $domains[$domain->domain] = $domain; $default_domain = $domain; } - + // Check multidomain module. if (getModel('multidomain')) { @@ -357,7 +357,7 @@ class Module extends ModuleObject { $site_domain = 'http://' . $site_domain; } - + $domain = new stdClass(); $domain->domain_srl = $site_info->multidomain_srl; $domain->domain = Rhymix\Framework\URL::getDomainFromURL(strtolower($site_domain)); @@ -384,7 +384,7 @@ class Module extends ModuleObject } } } - + // Insert into DB. foreach ($domains as $domain) { @@ -394,11 +394,11 @@ class Module extends ModuleObject return $output; } } - + // Clear cache. Rhymix\Framework\Cache::clearGroup('site_and_module'); ModuleModel::$_mid_map = ModuleModel::$_module_srl_map = []; - + // Return the default domain info. return $default_domain; } @@ -413,7 +413,7 @@ class Module extends ModuleObject $module_names = array_map(function($module_info) { return $module_info->module; }, $module_list); - + // Delete triggers belonging to modules that don't exist $args = new stdClass; $args->module = $module_names ?: []; diff --git a/modules/module/module.controller.php b/modules/module/module.controller.php index d04943e04..ae077c45d 100644 --- a/modules/module/module.controller.php +++ b/modules/module/module.controller.php @@ -28,7 +28,7 @@ class ModuleController extends Module $args->route_regexp = is_scalar($route_regexp) ? $route_regexp : serialize($route_regexp); $args->route_config = is_scalar($route_config) ? $route_config : serialize($route_config); $args->global_route = $global_route === 'Y' ? 'Y' : 'N'; - + $oDB = DB::getInstance(); $oDB->begin(); $output = executeQuery('module.deleteActionForward', ['act' => $act]); @@ -56,7 +56,7 @@ class ModuleController extends Module /** * @brief Add trigger callback function - * + * * @param string $trigger_name * @param string $called_position * @param callable $callback_function @@ -147,18 +147,18 @@ class ModuleController extends Module { return false; } - + if(in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) { return false; } - + $args = new stdClass; $args->parent_module = $parent_module; $args->extend_module = $extend_module; $args->type = $type; $args->kind = $kind == 'admin' ? 'admin' : ''; - + $output = executeQuery('module.insertModuleExtend', $args); if($output->toBool()) { @@ -166,7 +166,7 @@ class ModuleController extends Module unset($GLOBALS['__MODULE_EXTEND__']); FileHandler::removeFile('files/cache/common/module_extend.php'); } - + return $output; } @@ -197,10 +197,10 @@ class ModuleController extends Module { $origin_config->{$key} = $val; } - + return $this->insertModuleConfig($module, $origin_config); } - + public function updateModuleSectionConfig($module, $section, $config) { $origin_config = ModuleModel::getModuleSectionConfig($module, $section) ?: new stdClass; @@ -208,7 +208,7 @@ class ModuleController extends Module { $origin_config->{$key} = $val; } - + return $this->insertModuleSectionConfig($module, $section, $origin_config); } @@ -219,13 +219,13 @@ class ModuleController extends Module { $origin_config->{$key} = $val; } - + return $this->insertModulePartConfig($module, $module_srl, $origin_config); } /** * Save global config for a module. - * + * * @param string $module * @param object $config * @return BaseObject @@ -254,7 +254,7 @@ class ModuleController extends Module } $oDB->commit(); - + //remove from cache Rhymix\Framework\Cache::clearGroup('site_and_module'); return $output; @@ -262,7 +262,7 @@ class ModuleController extends Module /** * Save an independent section of module config. - * + * * @param string $module * @param string $section * @param object $config @@ -275,7 +275,7 @@ class ModuleController extends Module /** * Save module config for a specific module_srl. - * + * * @param string $module * @param int $module_srl * @param object $config @@ -378,7 +378,7 @@ class ModuleController extends Module { return $output; } - + // Check whether the module name already exists if(ModuleModel::isIDExists($args->mid)) { @@ -494,7 +494,7 @@ class ModuleController extends Module { $isMenuCreate = TRUE; } - + $output = $this->arrangeModuleInfo($args, $extra_vars); if(!$output->toBool()) return $output; // begin transaction @@ -567,7 +567,7 @@ class ModuleController extends Module foreach($menuOutput->data as $itemInfo) { $itemInfo->url = $args->mid; - + $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); if(!$updateMenuItemOutput->toBool()) { @@ -804,12 +804,12 @@ class ModuleController extends Module { return; } - + $args = new stdClass(); $args->module_srl = intval($module_srl); $args->member_srl = $member_info->member_srl; $output = executeQuery('module.insertAdminId', $args); - + Rhymix\Framework\Cache::delete("site_and_module:module_admins:" . intval($module_srl)); return $output; } @@ -837,7 +837,7 @@ class ModuleController extends Module $args->member_srl = $member_info->member_srl; } } - + $output = executeQuery('module.deleteAdminId', $args); Rhymix\Framework\Cache::delete("site_and_module:module_admins:" . intval($module_srl)); return $output; @@ -969,7 +969,7 @@ class ModuleController extends Module { $this->deleteModuleExtraVars($module_srl); getDestroyXeVars($obj); - + foreach(get_object_vars($obj) as $key => $val) { if(is_object($val) || is_array($val)) continue; @@ -981,7 +981,7 @@ class ModuleController extends Module if(!$args->name || !$args->value) continue; $output = executeQuery('module.insertModuleExtraVars', $args); } - + Rhymix\Framework\Cache::delete("site_and_module:module_extra_vars:$module_srl"); } @@ -1021,7 +1021,7 @@ class ModuleController extends Module executeQuery('module.insertModuleGrant', $args); } } - + Rhymix\Framework\Cache::delete("site_and_module:module_grants:$module_srl"); } @@ -1033,7 +1033,7 @@ class ModuleController extends Module $args = new stdClass(); $args->module_srl = $module_srl; $output = executeQuery('module.deleteModuleGrants', $args); - + Rhymix\Framework\Cache::delete("site_and_module:module_grants:$module_srl"); return $output; } @@ -1048,7 +1048,7 @@ class ModuleController extends Module $output = Context::replaceUserLang($output); } } - + /** * @brief Add and update a file into the file box */ @@ -1181,7 +1181,7 @@ class ModuleController extends Module // get file path $path = ModuleModel::getModuleFileBoxPath($vars->module_filebox_srl); FileHandler::makeDir($path); - + $random = Rhymix\Framework\Security::getRandom(32, 'hex'); $ext = substr(strrchr($vars->addfile['name'], '.'), 1); $save_filename = sprintf('%s%s.%s', $path, $random, $ext); @@ -1224,7 +1224,7 @@ class ModuleController extends Module { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + $vars = new stdClass(); $vars->module_filebox_srl = $module_filebox_srl; $output = $this->deleteModuleFileBox($vars); @@ -1286,10 +1286,10 @@ class ModuleController extends Module ModuleModel::$_mid_map = ModuleModel::$_module_srl_map = []; return $output; } - + /** * Check if all action-forwardable routes are registered. If not, register them. - * + * * @param string $module_name * @return object */ @@ -1297,7 +1297,7 @@ class ModuleController extends Module { $action_forward = ModuleModel::getActionForward(); $module_action_info = ModuleModel::getModuleActionXml($module_name); - + // Get the list of forwardable actions and their routes. $forwardable_routes = array(); foreach ($module_action_info->action ?: [] as $action_name => $action_info) @@ -1326,7 +1326,7 @@ class ModuleController extends Module $forwardable_routes[$action_name]['regexp'][] = ['POST', $regexp]; } } - + // Insert or delete from the action_forward table. foreach ($forwardable_routes as $action_name => $route_info) { @@ -1348,7 +1348,7 @@ class ModuleController extends Module { return $output; } - + $output = $this->insertActionForward($module_name, $route_info['type'], $action_name, $route_info['regexp'], $route_info['config'], $route_info['global_route']); if (!$output->toBool()) @@ -1357,7 +1357,7 @@ class ModuleController extends Module } } } - + // Clean up any action-forward routes that are no longer needed. foreach ($forwardable_routes as $action_name => $route_info) { @@ -1374,7 +1374,7 @@ class ModuleController extends Module } } } - + return new BaseObject(); } } diff --git a/modules/module/module.mobile.php b/modules/module/module.mobile.php index 700c8f7ea..22f48ff24 100644 --- a/modules/module/module.mobile.php +++ b/modules/module/module.mobile.php @@ -2,5 +2,5 @@ class ModuleMobile extends ModuleView { - + } diff --git a/modules/module/module.model.php b/modules/module/module.model.php index f5124e87a..0200bd7f2 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -33,7 +33,7 @@ class ModuleModel extends Module { return true; } - + $dirs = array_map('strtolower', FileHandler::readDir(RX_BASEDIR)); $dirs[] = 'rss'; $dirs[] = 'atom'; @@ -42,7 +42,7 @@ class ModuleModel extends Module { return true; } - + // mid test $args = new stdClass(); $args->mid = $id; @@ -51,7 +51,7 @@ class ModuleModel extends Module return false; } - + /** * @brief Get all domains */ @@ -92,7 +92,7 @@ class ModuleModel extends Module $domain_info = false; } } - + return $domain_info; } @@ -121,7 +121,7 @@ class ModuleModel extends Module $domain_info = false; } } - + return $domain_info; } @@ -142,7 +142,7 @@ class ModuleModel extends Module { return false; } - + $domain = strtolower($domain); $domain_info = Rhymix\Framework\Cache::get('site_and_module:domain_info:domain:' . $domain); if ($domain_info === null) @@ -164,7 +164,7 @@ class ModuleModel extends Module $domain_info = false; } } - + return $domain_info; } @@ -187,7 +187,7 @@ class ModuleModel extends Module Rhymix\Framework\Cache::set('site_and_module:document_srl:' . $document_srl, $module_info, 0, true); } } - + self::_applyDefaultSkin($module_info); return self::addModuleExtraVars($module_info); } @@ -200,7 +200,7 @@ class ModuleModel extends Module // Get current domain. $domain = $domain ?: strtolower(preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST'])); $domain = Rhymix\Framework\URL::decodeIdna($domain); - + // Find the domain information. $domain_info = self::getSiteInfoByDomain($domain); if (!$domain_info) @@ -212,7 +212,7 @@ class ModuleModel extends Module } $domain_info->is_default_replaced = true; } - + // Fill in module extra vars and return. if ($domain_info->module_srl) { @@ -246,7 +246,7 @@ class ModuleModel extends Module { $module_info = null; } - + if($module_info === null) { $output = executeQuery('module.getMidInfo', $args); @@ -339,7 +339,7 @@ class ModuleModel extends Module { $mid_info = null; } - + if($mid_info === null) { Rhymix\Framework\Cache::set('site_and_module:module_srl:' . $mid, $output->data->module_srl, 0, true); @@ -411,7 +411,7 @@ class ModuleModel extends Module /** * @brief Shortcut to getModuleInfoByModuleSrl() - * + * * @param int $module_srl * @return object */ @@ -471,14 +471,14 @@ class ModuleModel extends Module { return []; } - + $cache_key = 'site_and_module:modules_info:' . implode(',', $module_srls) . ':' . implode(',', $columnList ?: []); $result = Rhymix\Framework\Cache::get($cache_key); if ($result !== null) { return $result; } - + $args = new stdClass(); $args->module_srls = $module_srls; $output = executeQueryArray('module.getModulesInfo', $args, $columnList); @@ -487,7 +487,7 @@ class ModuleModel extends Module { $result = self::addModuleExtraVars($result); } - + Rhymix\Framework\Cache::set($cache_key, $result, 0, true); return $result; } @@ -539,14 +539,14 @@ class ModuleModel extends Module { unset($args->site_srl); } - + // Check if there are any arguments. $argsCount = $args === null ? 0 : countobj($args); if(!$argsCount) { $columnList = array(); } - + // Use cache only if there are no arguments. Otherwise, get data from DB. $list = $argsCount ? null : Rhymix\Framework\Cache::get('site_and_module:module:mid_list'); if($list === null) @@ -554,14 +554,14 @@ class ModuleModel extends Module $output = executeQueryArray('module.getMidList', $args, $columnList); if(!$output->toBool()) return $output; $list = $output->data; - + // Set cache only if there are no arguments. if(!$argsCount) { Rhymix\Framework\Cache::set('site_and_module:module:mid_list', $list, 0, true); } } - + if(!$list) return; if(!is_array($list)) $list = array($list); @@ -590,7 +590,7 @@ class ModuleModel extends Module /** * @brief Return an array of module_srl corresponding to a mid list - * + * * @param int|string|array $mid * @param bool $assoc * @return array @@ -601,7 +601,7 @@ class ModuleModel extends Module { $mid = explode(',', $mid); } - + if (count($mid) == 1 && ($first_mid = array_first($mid)) && isset(self::$_mid_map[$first_mid])) { return array($first_mid => self::$_mid_map[$first_mid]); @@ -610,7 +610,7 @@ class ModuleModel extends Module $args = new stdClass; $args->mid = $mid; $output = executeQueryArray('module.getModuleSrlByMid', $args); - + $module_srl_list = []; foreach($output->data as $row) { @@ -623,7 +623,7 @@ class ModuleModel extends Module /** * @brief Return mid corresponding to a module_srl list - * + * * @param int|array $module_srl * @return string|array */ @@ -638,19 +638,19 @@ class ModuleModel extends Module } return $result; } - + $module_srl = intval($module_srl); if (isset(self::$_module_srl_map[$module_srl])) { return self::$_module_srl_map[$module_srl]; } - + $mid = Rhymix\Framework\Cache::get('site_and_module:module_srl_mid:' . $module_srl); if (isset($mid)) { return $mid; } - + $args = new stdClass; $args->module_srls = $module_srl; $output = executeQuery('module.getModuleInfoByModuleSrl', $args, ['mid']); @@ -680,7 +680,7 @@ class ModuleModel extends Module { return; } - + $action_forward = array(); foreach($output->data as $item) { @@ -688,10 +688,10 @@ class ModuleModel extends Module if ($item->route_config) $item->route_config = unserialize($item->route_config); $action_forward[$item->act] = $item; } - + Rhymix\Framework\Cache::set('action_forward', $action_forward, 0, true); } - + if(!isset($act)) { return $action_forward; @@ -700,7 +700,7 @@ class ModuleModel extends Module { return; } - + return $action_forward[$act]; } @@ -736,7 +736,7 @@ class ModuleModel extends Module Rhymix\Framework\Cache::set('triggers', $triggers, 0, true); } } - + $triggers = $triggers ?: array(); foreach($triggers as $item) { @@ -770,7 +770,7 @@ class ModuleModel extends Module /** * @brief Get module extend - * + * * @deprecated */ public static function getModuleExtend($parent_module, $type, $kind = '') @@ -780,9 +780,9 @@ class ModuleModel extends Module /** * @brief Get all the module extend - * + * * @deprecated - * + * */ public static function loadModuleExtends() { @@ -799,7 +799,7 @@ class ModuleModel extends Module if (!$module_path) return; $xml_file = $module_path . 'conf/info.xml'; if (!file_exists($xml_file)) return; - + // Load the XML file and cache the definition. $lang_type = Context::getLangType() ?: 'en'; $mtime1 = filemtime($xml_file); @@ -811,7 +811,7 @@ class ModuleModel extends Module $info = Rhymix\Framework\Parsers\ModuleInfoParser::loadXML($xml_file); Rhymix\Framework\Cache::set($cache_key, $info, 0, true); } - + return $info; } @@ -825,7 +825,7 @@ class ModuleModel extends Module if (!$module_path) return; $xml_file = $module_path . 'conf/module.xml'; if (!file_exists($xml_file)) return; - + // Load the XML file and cache the definition. $lang_type = Context::getLangType() ?: 'en'; $mtime = filemtime($xml_file); @@ -836,10 +836,10 @@ class ModuleModel extends Module $info = Rhymix\Framework\Parsers\ModuleActionParser::loadXML($xml_file); Rhymix\Framework\Cache::set($cache_key, $info, 0, true); } - + return $info; } - + /** * Get a skin list for js API. * return void @@ -925,7 +925,7 @@ class ModuleModel extends Module { $moduleName = 'ARTICLE'; } - + $useDefaultList = array(); if(array_key_exists($moduleName, $installedMenuTypes)) { @@ -966,7 +966,7 @@ class ModuleModel extends Module { return; } - + // Create XmlParser object $oXmlParser = new XeXmlParser(); $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); @@ -1017,12 +1017,12 @@ class ModuleModel extends Module { continue; } - + if(!is_array($group->var)) { $extra_vars = array($group->var); } - + foreach($extra_vars as $key => $val) { $obj = new stdClass; @@ -1033,7 +1033,7 @@ class ModuleModel extends Module $obj->description = $val->description->body ?? null; $obj->value = $val->attrs->value ?? null; $obj->default = $val->attrs->default ?? null; - + if(preg_match('/,|\|@\|/', $obj->value ?? '', $delimiter) && $delimiter[0]) { $obj->value = explode($delimiter[0], $obj->value); @@ -1042,7 +1042,7 @@ class ModuleModel extends Module { $obj->value = array($obj->value); } - + // Get an option list from 'select'type if(is_array($val->options)) { @@ -1061,7 +1061,7 @@ class ModuleModel extends Module $obj->options[0]->title = $val->options->title->body ?? null; $obj->options[0]->value = $val->options->attrs->value ?? null; } - + $skin_info->extra_vars[] = $obj; } } @@ -1209,7 +1209,7 @@ class ModuleModel extends Module /** * Get global config for a module. - * + * * @param string $module * @return mixed */ @@ -1223,7 +1223,7 @@ class ModuleModel extends Module $args = new stdClass; $args->module = $module; $output = executeQuery('module.getModuleConfig', $args); - + // Only object type if(isset($output->data->config) && $output->data->config) { @@ -1233,7 +1233,7 @@ class ModuleModel extends Module { $config = -1; // Use -1 as a temporary value because null cannot be cached } - + // Set cache if($output->toBool()) { @@ -1242,14 +1242,14 @@ class ModuleModel extends Module } $GLOBALS['__ModuleConfig__'][$module] = $config; } - + $config = $GLOBALS['__ModuleConfig__'][$module]; return $config === -1 ? null : $config; } /** * Get an independent section of module config. - * + * * @param string $module * @param string $section * @return mixed @@ -1261,7 +1261,7 @@ class ModuleModel extends Module /** * Get config for a specific module_srl. - * + * * @param string module * @param int $module_srl * @return mixed @@ -1277,7 +1277,7 @@ class ModuleModel extends Module $args->module = $module; $args->module_srl = $module_srl ?: 0; $output = executeQuery('module.getModulePartConfig', $args); - + // Object or Array(compatibility) type if($output->data && isset($output->data->config)) { @@ -1287,13 +1287,13 @@ class ModuleModel extends Module { $config = -1; // Use -1 as a temporary value because null cannot be cached } - + // Deprecate use of ArrayObject because of https://bugs.php.net/bug.php?id=77298 if($config instanceof ArrayObject) { $config = (object)($config->getArrayCopy()); } - + // Set cache if($output->toBool()) { @@ -1302,7 +1302,7 @@ class ModuleModel extends Module } $GLOBALS['__ModulePartConfig__'][$module][$module_srl] = $config; } - + $config = $GLOBALS['__ModulePartConfig__'][$module][$module_srl]; return $config === -1 ? null : $config; } @@ -1315,18 +1315,18 @@ class ModuleModel extends Module $args = new stdClass(); $args->module = $module; $output = executeQueryArray('module.getModulePartConfigs', $args); - + if(!$output->toBool() || !$output->data) { return array(); } - + $result = array(); foreach($output->data as $key => $val) { $result[$val->module_srl] = unserialize($val->config); } - + return $result; } @@ -1395,9 +1395,9 @@ class ModuleModel extends Module /** * Get module install class - * + * * This method supports namespaced modules as well as XE-compatible modules. - * + * * @param string $module_name * @return ModuleObject|null */ @@ -1487,7 +1487,7 @@ class ModuleModel extends Module $searched_count = count($searched_list); if(!$searched_count) return; - + // Get action forward $action_forward = self::getActionForward(); @@ -1506,7 +1506,7 @@ class ModuleModel extends Module $table_count++; } } - + // Check if the table is created $created_table_count = 0; foreach ($schema_files as $filename) @@ -1515,7 +1515,7 @@ class ModuleModel extends Module { continue; } - + if($oDB->isTableExists($matches[1])) { $created_table_count++; @@ -1532,7 +1532,7 @@ class ModuleModel extends Module $info->table_count = $table_count; $info->path = $path; $info->admin_index_act = $info->admin_index_act ?? null; - + if(!Context::isBlacklistedPlugin($module_name, 'module')) { // Check if DB is installed @@ -1544,7 +1544,7 @@ class ModuleModel extends Module { $info->need_install = false; } - + // Check if it is upgraded to module.class.php on each module $oDummy = self::getModuleInstallClass($module_name); if($oDummy && method_exists($oDummy, "checkUpdate")) @@ -1552,7 +1552,7 @@ class ModuleModel extends Module $info->need_update = $oDummy->checkUpdate(); } unset($oDummy); - + // Check if all action-forwardable routes are registered $module_action_info = self::getModuleActionXml($module_name); $forwardable_routes = array(); @@ -1589,7 +1589,7 @@ class ModuleModel extends Module $info->need_update = true; } } - + // Clean up any action-forward routes that are no longer needed. foreach ($forwardable_routes as $action_name => $route_info) { @@ -1694,7 +1694,7 @@ class ModuleModel extends Module if(!$site_module_info) return false; $module_srl = $site_module_info->module_srl; } - + $module_srl = $module_srl ?: 0; $module_admins = Rhymix\Framework\Cache::get("site_and_module:module_admins:$module_srl"); if ($module_admins === null) @@ -1930,7 +1930,7 @@ class ModuleModel extends Module public static function syncMobileSkinInfoToModuleInfo(&$module_info) { if(!$module_info->module_srl) return; - + $skin_vars = Rhymix\Framework\Cache::get('site_and_module:module_mobile_skin_vars:' . $module_info->module_srl); if($skin_vars === null) { @@ -1950,7 +1950,7 @@ class ModuleModel extends Module $module_info->{$val->name} = $val->value; } } - + /** * @brief Return privileges(granted) information by using module info, xml info and member info */ @@ -1961,7 +1961,7 @@ class ModuleModel extends Module $module_info = new stdClass; $module_info->module = $module_info->module_srl = 0; } - + if (isset($GLOBALS['__MODULE_GRANT__'][$module_info->module][intval($module_info->module_srl ?? 0)][intval($member_info->member_srl ?? 0)])) { $__cache = &$GLOBALS['__MODULE_GRANT__'][$module_info->module][intval($module_info->module_srl ?? 0)][intval($member_info->member_srl ?? 0)]; @@ -1970,30 +1970,30 @@ class ModuleModel extends Module return $__cache; } } - + $grant = new stdClass; - - // Get information of module.xml + + // Get information of module.xml if(!$xml_info) { $xml_info = self::getModuleActionXml($module_info->module); } $xml_grant_list = isset($xml_info->grant) ? (array)$xml_info->grant : array(); - + // Get group information of member $member_group = !empty($member_info->group_list) ? array_keys($member_info->group_list) : array(); $is_module_admin = !empty($module_info->module_srl) ? self::isModuleAdmin($member_info, $module_info->module_srl) : false; - + // Get 'privilege name' list from module.xml $privilege_list = array_keys($xml_grant_list); - + // Prepend default 'privilege name' // manager, is_site_admin not distinguish because of compatibility. array_unshift($privilege_list, 'access', 'is_admin', 'manager', 'is_site_admin', 'root'); - + // Unique $privilege_list = array_unique($privilege_list, SORT_STRING); - + // Grant first foreach($privilege_list as $val) { @@ -2018,12 +2018,12 @@ class ModuleModel extends Module $grant->{$val} = false; } } - + // If access were not granted, check more if(!$grant->access) { $checked = array(); - + // Grant privileges by information that get from the DB foreach(self::getModuleGrants($module_info->module_srl)->data as $val) { @@ -2032,14 +2032,14 @@ class ModuleModel extends Module { continue; } - + // All user if($val->group_srl == 0) { $grant->{$val->name} = true; continue; } - + // Log-in member only if($member_info && $member_info->member_srl) { @@ -2062,13 +2062,13 @@ class ModuleModel extends Module } } } - + // Grant access by default if(!isset($checked['access'])) { $grant->access = true; } - + // Grant privileges by default information of module foreach($xml_grant_list as $name => $item) { @@ -2076,15 +2076,15 @@ class ModuleModel extends Module { continue; } - + // All user if($item->default == 'guest') { $grant->{$name} = true; - + continue; } - + // Log-in member only if($member_info && $member_info->member_srl) { @@ -2095,13 +2095,13 @@ class ModuleModel extends Module } } } - + return $__cache = $grant; } - + /** * Get the list of modules that the member can access. - * + * * @param object $member_info * @return array */ @@ -2111,13 +2111,13 @@ class ModuleModel extends Module { $member_info = Context::get('logged_info'); } - + $result = Rhymix\Framework\Cache::get(sprintf('site_and_module:accessible_modules:%d', $member_info->member_srl)); if($result === null) { $mid_list = self::getMidList(); $result = array(); - + foreach($mid_list as $module_info) { $grant = self::getGrant($module_info, $member_info); @@ -2135,13 +2135,13 @@ class ModuleModel extends Module $result[$module_info->module_srl] = $module_info; } ksort($result); - + Rhymix\Framework\Cache::set(sprintf('site_and_module:accessible_modules:%d', $member_info->member_srl), $result); } - + return $result; } - + /** * Get privileges(granted) information of the member for target module by target_srl * @param string $target_srl as module_srl. It may be a reference serial number @@ -2155,7 +2155,7 @@ class ModuleModel extends Module { return false; } - + if($type) { if($type == 'document') @@ -2175,25 +2175,25 @@ class ModuleModel extends Module $module_info = self::getModuleInfoByMid($target_srl); } } - + if(!isset($module_info)) { $module_info = self::getModuleInfoByModuleSrl($target_srl); } - + if(!$module_info->module_srl) { return false; } - + if(!$member_info) { $member_info = Context::get('logged_info'); } - + return self::getGrant($module_info, $member_info); } - + /** * @brief Search all modules to find manager privilege of the member * @param object $member_info member information @@ -2206,23 +2206,23 @@ class ModuleModel extends Module { return false; } - + foreach($mid_list as $module_info) { if($module && $module_info->module != $module) { continue; } - + if(($grant = self::getGrant($module_info, $member_info)) && $grant->manager) { return $grant; } } - + return false; } - + /** * @brief Get module grants */ diff --git a/modules/module/module.view.php b/modules/module/module.view.php index 541685aac..b93143cc2 100644 --- a/modules/module/module.view.php +++ b/modules/module/module.view.php @@ -23,7 +23,7 @@ class ModuleView extends Module { $selected_module = Context::get('selected_module'); $skin = preg_replace('/[^a-zA-Z0-9-_]/', '', Context::get('skin')); - + // Get modules/skin information $module_path = sprintf("./modules/%s/", $selected_module); if(!is_dir($module_path)) throw new Rhymix\Framework\Exceptions\InvalidRequest; @@ -46,32 +46,32 @@ class ModuleView extends Module // Get a list of modules at the site $args = new stdClass; $output = executeQueryArray(isset($query_id) ? $query_id : 'module.getSiteModules', $args); - + $mid_list = array(); - + foreach($output->data as $key => $val) { if(!ModuleModel::getGrant($val, Context::get('logged_info'))->manager) { continue; } - + if(!isset($mid_list[$val->module])) { $mid_list[$val->module] = new stdClass; $mid_list[$val->module]->list = array(); } - + $obj = new stdClass; $obj->module_srl = $val->module_srl; $obj->browser_title = $val->browser_title; - + $mid_list[$val->module]->list[$val->category ?: 0][$val->mid] = $obj; $mid_list[$val->module]->title = ModuleModel::getModuleInfoXml($val->module)->title; } - + Context::set('mid_list', $mid_list); - + if(!empty($mid_list)) { if(($selected_module = Context::get('selected_module')) && isset($mid_list[$selected_module]->list)) @@ -88,10 +88,10 @@ class ModuleView extends Module { Context::set('selected_mids', array()); } - + $security = new Security(); $security->encodeHTML('id', 'type', 'site_keyword'); - + $this->setLayoutFile('popup_layout'); $this->setTemplateFile('module_selector'); } diff --git a/modules/ncenterlite/ncenterlite.admin.controller.php b/modules/ncenterlite/ncenterlite.admin.controller.php index 19516f99f..4dae1af0a 100644 --- a/modules/ncenterlite/ncenterlite.admin.controller.php +++ b/modules/ncenterlite/ncenterlite.admin.controller.php @@ -96,7 +96,7 @@ class ncenterliteAdminController extends ncenterlite $config->admin_notify_module_srls = array(); } } - + if($obj->disp_act == 'dispNcenterliteAdminOtherComment') { if(!$obj->comment_all) @@ -116,7 +116,7 @@ class ncenterliteAdminController extends ncenterlite $config->notify_count = 0; } } - + $output = $oModuleController->insertModuleConfig('ncenterlite', $config); if(!$output->toBool()) { @@ -203,7 +203,7 @@ class ncenterliteAdminController extends ncenterlite } $this->setMessage('msg_test_notifycation_success'); - + if (Context::get('success_return_url')) { $this->setRedirectUrl(Context::get('success_return_url')); diff --git a/modules/ncenterlite/ncenterlite.admin.view.php b/modules/ncenterlite/ncenterlite.admin.view.php index be9a45845..c2f955350 100644 --- a/modules/ncenterlite/ncenterlite.admin.view.php +++ b/modules/ncenterlite/ncenterlite.admin.view.php @@ -29,7 +29,7 @@ class ncenterliteAdminView extends ncenterlite Context::set('mid_list', $mid_list); Context::set('config', $config); } - + function dispNcenterliteAdminOtherComment() { $oModuleModel = getModel('module'); diff --git a/modules/ncenterlite/ncenterlite.class.php b/modules/ncenterlite/ncenterlite.class.php index 4af0998af..2428b8821 100644 --- a/modules/ncenterlite/ncenterlite.class.php +++ b/modules/ncenterlite/ncenterlite.class.php @@ -42,7 +42,7 @@ class ncenterlite extends ModuleObject function moduleInstall() { - + } function checkUpdate() @@ -93,7 +93,7 @@ class ncenterlite extends ModuleObject } } } - + // #1903 #1906 foreach(['target_browser', 'target_summary'] as $column_name) { @@ -103,7 +103,7 @@ class ncenterlite extends ModuleObject return true; } } - + // PK duplicate if($oDB->isIndexExists('ncenterlite_notify', 'idx_notify')) { @@ -114,7 +114,7 @@ class ncenterlite extends ModuleObject { return true; } - + if($oDB->isColumnExists('ncenterlite_user_set','custom_notify')) { return true; @@ -182,7 +182,7 @@ class ncenterlite extends ModuleObject { $oDB->addColumn('ncenterlite_notify', 'target_p_srl', 'number', 10, true); } - + foreach(['idx_srl', 'idx_member_srl', 'idx_regdate', 'idx_readed', 'idx_target_srl', 'idx_target_p_srl', 'idx_target_member_srl'] as $index_name) { if(!$oDB->isIndexExists('ncenterlite_notify', $index_name)) @@ -219,13 +219,13 @@ class ncenterlite extends ModuleObject { $oDB->dropColumn('ncenterlite_user_set', 'custom_notify'); } - + // Composite index to speed up getNotifyList if(!$oDB->isIndexExists('ncenterlite_notify', 'idx_member_srl_and_readed')) { $oDB->addIndex('ncenterlite_notify', 'idx_member_srl_and_readed', array('member_srl', 'readed')); } - + // #1903 #1906 foreach(['target_browser', 'target_summary'] as $column_name) { @@ -235,7 +235,7 @@ class ncenterlite extends ModuleObject $oDB->modifyColumn('ncenterlite_notify', $column_name, 'varchar', 80, null, false); } } - + // PK duplicate if($oDB->isIndexExists('ncenterlite_notify', 'idx_notify')) { @@ -309,7 +309,7 @@ class ncenterlite extends ModuleObject { return $oSmsHandler; } - + $variable_name = array(); $member_config = getModel('member')->getMemberConfig(); foreach($member_config->signupForm as $value) diff --git a/modules/ncenterlite/ncenterlite.controller.php b/modules/ncenterlite/ncenterlite.controller.php index 12c9f1d36..f704d5cdb 100644 --- a/modules/ncenterlite/ncenterlite.controller.php +++ b/modules/ncenterlite/ncenterlite.controller.php @@ -9,10 +9,10 @@ class ncenterliteController extends ncenterlite 'dispNcenterliteNotifyList' => true, 'dispEditorFrame' => true, ); - + /** * Send any message to a member. - * + * * @param int $from_member_srl Sender * @param int $to_member_srl Recipient * @param string|object $message Message content @@ -36,7 +36,7 @@ class ncenterliteController extends ncenterlite $args->target_browser = ''; $args->target_summary = ''; $args->target_content = null; - + if (is_object($message)) { $args->target_body = $message->subject; @@ -48,7 +48,7 @@ class ncenterliteController extends ncenterlite { $args->target_body = $message; } - + $output = $this->_insertNotify($args); if(!$output->toBool()) { @@ -152,7 +152,7 @@ class ncenterliteController extends ncenterlite $this->setRedirectUrl(getNotEncodedUrl('act', 'dispNcenterliteUserConfig', 'member_srl', $member_srl)); } } - + function procNcenterliteInsertUnsubscribe() { $config = NcenterliteModel::getConfig(); @@ -164,19 +164,19 @@ class ncenterliteController extends ncenterlite { throw new Rhymix\Framework\Exception('msg_unsubscribe_block_not_support'); } - + $obj = Context::getRequestVars(); - + if(!$this->user->member_srl || (!intval($obj->unsubscribe_srl) && !intval($obj->target_srl))) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + if($obj->target_srl) { $oNcenterliteModel = getModel('ncenterlite'); $userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByTargetSrl($obj->target_srl, $this->user->member_srl); - + // If there was a record directed by unsubscribe_srl, the record should be used to validate the input data. if($userBlockData) { @@ -184,24 +184,24 @@ class ncenterliteController extends ncenterlite { $obj->unsubscribe_srl = $userBlockData->unsubscribe_srl; } - + if (intval($obj->unsubscribe_srl) != intval($userBlockData->unsubscribe_srl)) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } } } - + if(!$userBlockData && $obj->unsubscribe_srl) { $userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByUnsubscribeSrl($obj->unsubscribe_srl); - + // The input member_srl from the POST or GET might not equal to the member_srl from the record of unsubscribe_srl. if(intval($this->user->member_srl) != intval($userBlockData->member_srl)) { throw new Rhymix\Framework\Exception('ncenterlite_stop_no_permission_other_user_block_settings'); } - + // If there was a record directed by unsubscribe_srl, the record should be used to validate the input data. if($userBlockData) { @@ -209,19 +209,19 @@ class ncenterliteController extends ncenterlite { $obj->target_srl = $userBlockData->target_srl; } - + if (intval($obj->target_srl) != intval($userBlockData->target_srl)) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } } } - + if($userBlockData) { $obj->unsubscribe_srl = $userBlockData->unsubscribe_srl; } - + // Content type can be document and comment, now. However, the default type cannot be specified, as the type can be another in the future. if($obj->unsubscribe_type == 'document') { @@ -237,7 +237,7 @@ class ncenterliteController extends ncenterlite { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + $args = new stdClass(); $args->member_srl = $this->user->member_srl; $args->target_srl = $obj->target_srl; @@ -251,7 +251,7 @@ class ncenterliteController extends ncenterlite } $args->unsubscribe_type = $obj->unsubscribe_type; $args->text = $text; - + if($obj->value == 'Y') { // 데이터가 있으면 차단, 데이터가 없으면 차단하지 않기 때문에 따로 업데이트를 하지 않는다. @@ -275,7 +275,7 @@ class ncenterliteController extends ncenterlite { throw new Rhymix\Framework\Exception('msg_unsubscribe_not_in_list'); } - + $args->unsubscribe_srl = $obj->unsubscribe_srl; $output = executeQuery('ncenterlite.deleteUnsubscribe', $args); if(!$output->toBool()) @@ -329,7 +329,7 @@ class ncenterliteController extends ncenterlite { $this->removeFlagFile($args->member_srl); } - + // Delete to user setting. $userSetOutput = executeQuery('ncenterlite.deleteNcenterliteUserSettingData', $args); if(!$userSetOutput->toBool()) @@ -436,7 +436,7 @@ class ncenterliteController extends ncenterlite { continue; } - + $args = new stdClass(); $args->config_type = 'comment_all'; $args->member_srl = abs($value->member_srl); @@ -461,7 +461,7 @@ class ncenterliteController extends ncenterlite } } } - + $obj->admin_comment_notify = false; $admin_list = $oNcenterliteModel->getMemberAdmins(); @@ -547,12 +547,12 @@ class ncenterliteController extends ncenterlite { return; } - + if($oNcenterliteModel->getUserUnsubscribeConfigByTargetSrl($parent_srl, $abs_member_srl)) { return; } - + $args = new stdClass(); $args->config_type = 'comment_comment'; $args->member_srl = $abs_member_srl; @@ -592,7 +592,7 @@ class ncenterliteController extends ncenterlite { return; } - + if($config->user_notify_setting == 'Y') { $document_comment_member_config = NcenterliteModel::getUserConfig($abs_member_srl); @@ -673,7 +673,7 @@ class ncenterliteController extends ncenterlite return $output; } } - + function triggerAfterScrap($obj) { $config = NcenterliteModel::getConfig(); @@ -681,7 +681,7 @@ class ncenterliteController extends ncenterlite { return; } - + if($config->user_notify_setting === 'Y') { $target_member_config = NcenterliteModel::getUserConfig(abs($obj->target_member_srl)); @@ -690,10 +690,10 @@ class ncenterliteController extends ncenterlite return; } } - + $oModuleModel = getModel('module'); $module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl); - + $args = new stdClass(); $args->config_type = 'scrap'; $args->target_member_srl = abs($obj->member_srl); @@ -755,7 +755,7 @@ class ncenterliteController extends ncenterlite $args->module_srl = $obj->module_srl; $this->_insertNotify($args, $config->anonymous_voter !== 'N'); } - + function triggerAfterDocumentVotedCancel($obj) { $config = NcenterliteModel::getConfig(); @@ -771,7 +771,7 @@ class ncenterliteController extends ncenterlite { return; } - + if($config->anonymous_voter === 'Y') { $member_srl = -1 * $this->user->member_srl; @@ -780,7 +780,7 @@ class ncenterliteController extends ncenterlite { $member_srl = $this->user->member_srl; } - + $args = new stdClass(); $args->type = $this->_TYPE_DOCUMENT; $args->target_type = $this->_TYPE_VOTED; @@ -792,7 +792,7 @@ class ncenterliteController extends ncenterlite $this->removeFlagFile(abs($obj->member_srl)); } } - + function triggerAfterCommentVotedCount($obj) { $config = NcenterliteModel::getConfig(); @@ -812,14 +812,14 @@ class ncenterliteController extends ncenterlite return; } } - + $oCommentModel = getModel('comment'); $oComment = $oCommentModel->getComment($obj->comment_srl); - + $content = $oComment->get('content'); $document_srl = $oComment->get('document_srl'); $module_info = getModel('module')->getModuleInfoByDocumentSrl($document_srl); - + $args = new stdClass(); $args->config_type = 'vote'; $args->member_srl = abs($obj->member_srl); @@ -852,7 +852,7 @@ class ncenterliteController extends ncenterlite { return; } - + $args = new stdClass(); $args->type = $this->_TYPE_COMMENT; $args->target_type = $this->_TYPE_VOTED; @@ -872,7 +872,7 @@ class ncenterliteController extends ncenterlite { return; } - + $member_srls = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->comment_srl); $args = new stdClass(); @@ -894,7 +894,7 @@ class ncenterliteController extends ncenterlite { return; } - + $member_srls = ncenterliteModel::getInstance()->getNotifyMemberSrlBySrl($obj->document_srl); $args = new stdClass(); @@ -1058,23 +1058,23 @@ class ncenterliteController extends ncenterlite { return; } - + // 레이아웃에서 알림센터 사용중이라면 중지 if(Context::get('layout_info')->use_ncenter_widget == 'Y') { return; } - + Context::set('ncenterlite_config', $config); - + if($config->highlight_effect === 'Y') { Context::loadFile(array('./modules/ncenterlite/tpl/js/ncenterlite.js', 'body', '', 100000)); } - + $logged_info = Context::get('logged_info'); $_output = $oNcenterliteModel->getMyNotifyList($logged_info->member_srl); - + if($config->always_display !== 'Y') { if(!$_output->data) @@ -1082,7 +1082,7 @@ class ncenterliteController extends ncenterlite return; } } - + $_latest_notify_id = array_slice($_output->data, 0, 1); $_latest_notify_id = count($_latest_notify_id) > 0 ? $_latest_notify_id[0]->notify : ""; Context::set('ncenterlite_latest_notify_id', $_latest_notify_id); @@ -1139,7 +1139,7 @@ class ncenterliteController extends ncenterlite { Context::set('ncenterlite_zindex', ' style="z-index:' . $config->zindex . ';" '); } - + $result = TemplateHandler::getInstance()->compile($this->template_path, 'ncenterlite.html'); $this->_addFile(); $output_display = $result . $output_display; @@ -1331,7 +1331,7 @@ class ncenterliteController extends ncenterlite function _insertNotify($args, $anonymous = FALSE) { $config = NcenterliteModel::getConfig(); - + if(is_array($config->hide_module_srls) && in_array($args->module_srl, $config->hide_module_srls)) { return new BaseObject(); @@ -1348,7 +1348,7 @@ class ncenterliteController extends ncenterlite { $args->notify = $this->_getNotifyId($args); } - + // 날짜가 없는 경우 자동 생성 if (!$args->regdate) { @@ -1389,7 +1389,7 @@ class ncenterliteController extends ncenterlite $args->target_user_id = ''; $args->target_email_address = ''; } - + // 수신자가 웹 알림을 거부한 경우 이미 읽은 것으로 처리 if($config->user_notify_setting == 'Y') { @@ -1405,7 +1405,7 @@ class ncenterliteController extends ncenterlite { return $trigger_output; } - + $output = executeQuery('ncenterlite.insertNotify', $args); if($output->toBool()) { @@ -1431,7 +1431,7 @@ class ncenterliteController extends ncenterlite $cache_key = sprintf('ncenterlite:notify_list:%d', $member_srl); Rhymix\Framework\Cache::set($cache_key, $output); - + $flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php'; if (Rhymix\Framework\Cache::getDriverName() !== 'dummy') { @@ -1454,7 +1454,7 @@ class ncenterliteController extends ncenterlite $cache_key = sprintf('ncenterlite:notify_list:%d', $member_srl); Rhymix\Framework\Cache::delete($cache_key); - + $flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php'; if(file_exists($flag_path)) { @@ -1479,13 +1479,13 @@ class ncenterliteController extends ncenterlite $oMemberModel = getModel('member'); $config = NcenterliteModel::getConfig(); $logged_info = Context::get('logged_info'); - + // Extract mentions. $content = html_entity_decode(strip_tags($content)); preg_match_all('/(?:^|\s)@([^\pC\pM\pP\pS\pZ]+)/u', $content, $matches); $mentions = array_unique($matches[1]); $members = array(); - + // Find members. foreach ($mentions as $mention) { @@ -1493,12 +1493,12 @@ class ncenterliteController extends ncenterlite { continue; } - + if (count($members) >= $config->mention_limit) { break; } - + if ($config->mention_suffix_always_cut != 'Y') { if ($config->mention_names === 'id') @@ -1514,7 +1514,7 @@ class ncenterliteController extends ncenterlite { $member_srl = null; } - + if (!$member_srl) { foreach ($config->mention_suffixes as $suffix) @@ -1524,7 +1524,7 @@ class ncenterliteController extends ncenterlite $mention = substr($mention, 0, $pos); } } - + if (isset($members[$mention])) { continue; @@ -1542,10 +1542,10 @@ class ncenterliteController extends ncenterlite { continue; } - + $members[$mention] = $member_srl; } - + return array_values($members); } @@ -1568,11 +1568,11 @@ class ncenterliteController extends ncenterlite { return false; } - + $oNcenterliteModel = getModel('ncenterlite'); $content = $oNcenterliteModel->getNotificationText($args); $content = htmlspecialchars_decode(preg_replace('/<\/?(strong|)[^>]*>/', '', $content)); - + $target_url = $args->target_url; if (!preg_match('!^https?://!', $target_url)) { @@ -1604,10 +1604,10 @@ class ncenterliteController extends ncenterlite $oPush->setURL(strval($target_url)); $oPush->addTo(intval($args->member_srl)); $output = $oPush->send(); - + return $output; } - + function sendSmsMessage($args) { $config = NcenterliteModel::getConfig(); @@ -1645,7 +1645,7 @@ class ncenterliteController extends ncenterlite { $phone_country = $member_info->phone_country; $phone_number = $member_info->phone_number; - + // Sending SMS outside of Korea is currently not supported. if($phone_country !== 'KOR') { @@ -1695,7 +1695,7 @@ class ncenterliteController extends ncenterlite { return false; } - + $oNcenterliteModel = getModel('ncenterlite'); $content = $oNcenterliteModel->getNotificationText($args); @@ -1711,7 +1711,7 @@ class ncenterliteController extends ncenterlite { $target_url = Rhymix\Framework\URL::getCurrentDomainUrl($target_url); } - + $mail_content = sprintf("

%s

\n

%s

\n", $content, $target_url); $member_info = MemberModel::getMemberInfoByMemberSrl($args->member_srl); @@ -1816,9 +1816,9 @@ class ncenterliteController extends ncenterlite $document_srl = Context::get('target_srl'); $config = NcenterliteModel::getConfig(); - + if($config->unsubscribe !== 'Y') return; - + $oDocumentController = getController('document'); $url = getUrl('','module','ncenterlite','act','dispNcenterliteInsertUnsubscribe', 'target_srl', $document_srl, 'unsubscribe_type', 'document'); $oDocumentController->addDocumentPopupMenu($url,'ncenterlite_cmd_unsubscribe_settings','','popup'); @@ -1838,17 +1838,17 @@ class ncenterliteController extends ncenterlite $comment_srl = Context::get('target_srl'); $config = NcenterliteModel::getConfig(); - + if($config->unsubscribe !== 'Y') return; - + $oCommentController = getController('comment'); $url = getUrl('','module','ncenterlite','act','dispNcenterliteInsertUnsubscribe', 'target_srl', $comment_srl, 'unsubscribe_type', 'comment'); $oCommentController->addCommentPopupMenu($url,'ncenterlite_cmd_unsubscribe_settings','','popup'); } - + /** * Cut a string to fit the notification summary column. - * + * * @param string $str * @return string */ @@ -1864,10 +1864,10 @@ class ncenterliteController extends ncenterlite return cut_str($str, 45); } } - + /** * Cut a string to fit the notification content column. - * + * * @param string $str * @return string */ diff --git a/modules/ncenterlite/ncenterlite.model.php b/modules/ncenterlite/ncenterlite.model.php index 4a4c14d81..a56ab61ca 100644 --- a/modules/ncenterlite/ncenterlite.model.php +++ b/modules/ncenterlite/ncenterlite.model.php @@ -12,12 +12,12 @@ class ncenterliteModel extends ncenterlite { $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('ncenterlite'); - + if(!$config) { $config = new stdClass(); } - + $config->use = $config->use ?? array('message' => array('web' => 1)); $config->display_use = $config->display_use ?? 'all'; $config->always_display = $config->always_display ?? 'N'; @@ -45,7 +45,7 @@ class ncenterliteModel extends ncenterlite $config->mcolorset = $config->mcolorset ?? 'black'; $config->zindex = $config->zindex ?? '9999'; $config->notify_count = $config->notify_count ?? 5; - + if(!isset($config->hide_module_srls)) { $config->hide_module_srls = array(); @@ -54,7 +54,7 @@ class ncenterliteModel extends ncenterlite { $config->hide_module_srls = explode('|@|', $config->hide_module_srls); } - + // Convert old config format if($config->use === 'Y') { @@ -74,13 +74,13 @@ class ncenterliteModel extends ncenterlite getController('module')->insertModuleConfig('ncenterlite', $config); } unset($config->mention_format); - + self::$_config = $config; } return self::$_config; } - + public static function getNotifyTypes() { $default = array( @@ -95,7 +95,7 @@ class ncenterliteModel extends ncenterlite { $default['admin_content'] = 0; } - + $custom_types = Rhymix\Framework\Cache::get('ncenterlite:notify_types'); if (!$custom_types) { @@ -109,11 +109,11 @@ class ncenterliteModel extends ncenterlite $default[$type->notify_type_id] = $type->notify_type_srl; } } - + $default['custom'] = 0; return $default; } - + public static function getUserSetNotifyTypes() { return array( @@ -196,20 +196,20 @@ class ncenterliteModel extends ncenterlite return false; } } - + $member_srl = intval($member_srl); $config = self::$_user_config[$member_srl] ?? null; if ($config !== null) { return $config; } - + $config = Rhymix\Framework\Cache::get('ncenterlite:user_config:' . $member_srl); if ($config !== null) { return $config; } - + $args = new stdClass(); $args->member_srl = $member_srl; $output = executeQuery('ncenterlite.getUserConfig', $args); @@ -238,7 +238,7 @@ class ncenterliteModel extends ncenterlite } } } - + self::$_user_config[$member_srl] = $config; Rhymix\Framework\Cache::set('ncenterlite:user_config:' . $member_srl, $config); return $config; @@ -271,31 +271,31 @@ class ncenterliteModel extends ncenterlite { $output = $this->_getMyNotifyList($member_srl, $page, $readed); } - + $config = $this->getConfig(); $oMemberModel = getModel('member'); $list = $output->data; - + foreach($list as $k => $v) { $v->text = $this->getNotificationText($v); $v->ago = $this->getAgo($v->regdate); $v->url = getUrl('','act','procNcenterliteRedirect', 'notify', $v->notify); - + if($v->target_member_srl < 0) { $v->target_member_srl = 0; $v->target_nick_name = lang('anonymous'); $v->target_user_id = $v->target_email_address = 'anonymous'; } - + if(($v->target_type === $this->_TYPE_VOTED && $config->anonymous_voter === 'Y') || ($v->target_type === $this->_TYPE_SCRAPPED && $config->anonymous_scrap === 'Y')) { $v->target_member_srl = 0; $v->target_nick_name = lang('anonymous'); $v->target_user_id = $v->target_email_address = 'anonymous'; } - + if($v->target_member_srl) { $profileImage = $oMemberModel->getProfileImage($v->target_member_srl); @@ -389,19 +389,19 @@ class ncenterliteModel extends ncenterlite $args = new stdClass(); $args->member_srl = $member_srl; - + $args->page = $page ? $page : 1; if ($readed) { $args->readed = $readed; } - + $notify_count = intval(self::getConfig()->notify_count); if($notify_count) { $args->list_count = $notify_count; } - + $output = executeQueryArray('ncenterlite.getNotifyList', $args); if (!$output->data) { @@ -467,7 +467,7 @@ class ncenterliteModel extends ncenterlite { $member_srl[] = $member->member_srl; } - + return $member_srl; } @@ -495,7 +495,7 @@ class ncenterliteModel extends ncenterlite $output = $this->_getMyNotifyList($member_srl); return $output->total_count; } - + $args = new stdClass(); $args->member_srl = $member_srl; $output = executeQuery('ncenterlite.getNotifyNewCount', $args); @@ -520,10 +520,10 @@ class ncenterliteModel extends ncenterlite if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); $this->add('colorset_list', $colorsets); } - + /** * Get information about a single notification. - * + * * @param string $notify * @param int $member_srl * @return object|false @@ -543,10 +543,10 @@ class ncenterliteModel extends ncenterlite return false; } } - + /** * Return the notification text. - * + * * @param object $notification * @return string */ @@ -599,15 +599,15 @@ class ncenterliteModel extends ncenterlite $notification->target_summary, // %6$s $notification->target_url, // %7$s )); - + // Other. case 'U': default: return $this->getNotifyTypeString($notification->notify_type, unserialize($notification->target_body)) ?: lang('ncenterlite'); } - + $config = $this->getConfig(); - + // Get the notification text. switch ($notification->target_type) { @@ -685,7 +685,7 @@ class ncenterliteModel extends ncenterlite case 'I': $str = sprintf(lang('ncenterlite_insert_member_message'), $notification->target_nick_name); break; - + case 'G': $str = sprintf(lang('ncenterlite_commented'), $notification->target_nick_name, $type, $notification->target_summary); break; @@ -754,7 +754,7 @@ class ncenterliteModel extends ncenterlite return $output->data; } - + /** * 알림에서 member_srl 만 정리해서 보내준다. * @param int $srl @@ -773,7 +773,7 @@ class ncenterliteModel extends ncenterlite { return []; } - + $member_srls = array(); foreach($output->data ?? [] as $value) { @@ -798,7 +798,7 @@ class ncenterliteModel extends ncenterlite { $member_srl = $this->user->member_srl; } - + $args = new stdClass(); $args->target_srl = $target_srl; $args->member_srl = $member_srl; diff --git a/modules/ncenterlite/ncenterlite.view.php b/modules/ncenterlite/ncenterlite.view.php index c7df27bb5..dfe768f5c 100644 --- a/modules/ncenterlite/ncenterlite.view.php +++ b/modules/ncenterlite/ncenterlite.view.php @@ -67,7 +67,7 @@ class ncenterliteView extends ncenterlite throw new Rhymix\Framework\Exceptions\NotPermitted('ncenterlite_stop_no_permission_other_user'); } } - + $user_selected = []; $user_config = NcenterliteModel::getUserConfig($member_srl) ?: new stdClass; $notify_types = NcenterliteModel::getUserSetNotifyTypes(); @@ -84,7 +84,7 @@ class ncenterliteView extends ncenterlite $user_selected[$notify_type][$item]->selected = $selected; } } - + Context::set('member_info', $member_info ?? null); Context::set('notify_types', $notify_types); Context::set('user_config', $user_config); @@ -105,12 +105,12 @@ class ncenterliteView extends ncenterlite /** @var ncenterliteModel $oNcenterliteModel */ $oNcenterliteModel = getModel('ncenterlite'); $config = $oNcenterliteModel->getConfig(); - + if($config->unsubscribe !== 'Y') { throw new Rhymix\Framework\Exception('msg_unsubscribe_block_not_support'); } - + if(!Rhymix\Framework\Session::getMemberSrl()) { throw new Rhymix\Framework\Exceptions\MustLogin; @@ -125,7 +125,7 @@ class ncenterliteView extends ncenterlite { throw new Rhymix\Framework\Exceptions\NotPermitted('msg_unsubscribe_not_permission'); } - + $args = new stdClass(); $args->page = Context::get('page'); $args->list_count = '20'; @@ -138,32 +138,32 @@ class ncenterliteView extends ncenterlite Context::set('page', $output->page); Context::set('unsubscribe_list', $output->data); Context::set('page_navigation', $output->page_navigation); - + $this->setTemplateFileOrDefault('unsubscribeList'); } - + function dispNcenterliteInsertUnsubscribe() { $this->setLayoutFile('popup_layout'); - + /** @var ncenterliteModel $oNcenterliteModel */ $oNcenterliteModel = getModel('ncenterlite'); $target_srl = Context::get('target_srl'); $unsubscribe_srl = Context::get('unsubscribe_srl'); $unsubscribe_type = Context::get('unsubscribe_type'); - + $member_srl = Context::get('member_srl'); - + if(!$member_srl) { $member_srl = $this->user->member_srl; } - + if($this->user->is_admin !== 'Y' && intval($member_srl) !== intval($this->user->member_srl)) { throw new \Rhymix\Framework\Exception('msg_invalid_request'); } - + if($unsubscribe_srl) { $output = $oNcenterliteModel->getUserUnsubscribeConfigByUnsubscribeSrl($unsubscribe_srl); @@ -172,12 +172,12 @@ class ncenterliteView extends ncenterlite { $output = $oNcenterliteModel->getUserUnsubscribeConfigByTargetSrl($target_srl, $member_srl); } - + if((!$target_srl || !$unsubscribe_type) && empty($output)) { throw new Rhymix\Framework\Exceptions\InvalidRequest; } - + if($unsubscribe_type == 'document') { $text = getModel('document')->getDocument($target_srl)->getTitleText(); @@ -215,11 +215,11 @@ class ncenterliteView extends ncenterlite } } } - + Context::set('unsubscribeData', $output); Context::set('text', $text); Context::set('type', $type); - + $this->setTemplateFileOrDefault('unsubscribe'); } diff --git a/modules/page/page.admin.controller.php b/modules/page/page.admin.controller.php index f458883ce..70f17de76 100644 --- a/modules/page/page.admin.controller.php +++ b/modules/page/page.admin.controller.php @@ -40,7 +40,7 @@ class pageAdminController extends page $args->browser_title = trim(utf8_normalize_spaces($args->browser_title)); $args->meta_keywords = $args->meta_keywords ? implode(', ', array_map('trim', explode(',', $args->meta_keywords))) : ''; $args->meta_description = trim(utf8_normalize_spaces($args->meta_description)); - + // Check if an original module exists by using module_srl if($args->module_srl) { @@ -328,7 +328,7 @@ class pageAdminController extends page $target = ($obj->isMobile == 'Y') ? 'mdocument_srl' : 'document_srl'; // 이미 존재하는 경우 수정 - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) + if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) { $output = $oDocumentController->updateDocument($oDocument, $obj); $msg_code = 'success_updated'; diff --git a/modules/page/page.admin.view.php b/modules/page/page.admin.view.php index 8ef82b6d5..930ef1248 100644 --- a/modules/page/page.admin.view.php +++ b/modules/page/page.admin.view.php @@ -188,10 +188,10 @@ class pageAdminView extends page { throw new Rhymix\Framework\Exception(sprintf('%s method is not exists', $method)); } - + Context::set('module_info', $this->module_info); Context::set('page_content', $page_content); - + $this->setLayoutFile(''); $this->setTemplateFile('mcontent'); } @@ -258,11 +258,11 @@ class pageAdminView extends page //Security $security = new Security(); $security->encodeHTML('widget_list..title','module_info.mid'); - + // Load admin resources $oTemplate = TemplateHandler::getInstance(); $oTemplate->compile('modules/admin/tpl', '_admin_common.html'); - + // Set a template file $this->setLayoutFile(''); $this->setTemplateFile($templateFile); @@ -289,7 +289,7 @@ class pageAdminView extends page $document_srl = $this->module_info->{$target}; $oDocument->setDocument($document_srl); Context::set('document_srl', $document_srl); - } + } else if(Context::get('document_srl')) { $document_srl = Context::get('document_srl'); @@ -300,11 +300,11 @@ class pageAdminView extends page { $oDocument->add('module_srl', $this->module_info->module_srl); } - + Context::addJsFilter($this->module_path.'tpl/filter', 'insert_article.xml'); Context::set('oDocument', $oDocument); Context::set('mid', $this->module_info->mid); - + $this->setLayoutFile(''); $this->setTemplateFile('article_content_modify'); } diff --git a/modules/page/page.controller.php b/modules/page/page.controller.php index 24378049c..22af4b488 100644 --- a/modules/page/page.controller.php +++ b/modules/page/page.controller.php @@ -67,7 +67,7 @@ class pageController extends page } /** - * @brief Change the value of src, href in the content + * @brief Change the value of src, href in the content */ function replaceSrc($content, $path) { diff --git a/modules/page/page.view.php b/modules/page/page.view.php index 4bbf09656..f5ba1b1a8 100644 --- a/modules/page/page.view.php +++ b/modules/page/page.view.php @@ -32,7 +32,7 @@ class pageView extends page $this instanceof pageMobile ? 'm' : 'pc', ]); } - + if ($this->module_info->page_type === 'OUTSIDE') { $this->interval = (int)($this->module_info->page_caching_interval ?? 0); @@ -79,7 +79,7 @@ class pageView extends page Context::set('module_info', $this->module_info); Context::set('page_content', $page_content); - + // if the page type is the widget or outside, there might be usable GET entities. $request_vars = Context::getRequestVars(); if (isset($request_vars->document_srl) && intval($request_vars->document_srl) > 0 && $page_type_name == 'article') @@ -104,7 +104,7 @@ class pageView extends page { $page_content = $this->module_info->content; } - + if ($this->interval > 0) { if (!file_exists($this->cache_file) || !filesize($this->cache_file)) @@ -118,7 +118,7 @@ class pageView extends page if($mtime && $mtime + ($this->interval * 60) > \RX_TIME) { - $page_content = FileHandler::readFile($this->cache_file); + $page_content = FileHandler::readFile($this->cache_file); $page_content = str_replace('