From c881e73c1d99696960bfbcbda0b0738918ee1054 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 17 Jan 2023 21:07:55 +0900 Subject: [PATCH] Remove trailing whitespace in legacy class files --- classes/cache/CacheHandler.class.php | 2 +- classes/context/Context.class.php | 202 +++++++++--------- classes/display/DisplayHandler.class.php | 22 +- classes/display/HTMLDisplayHandler.php | 62 +++--- classes/display/JSONDisplayHandler.php | 10 +- classes/display/VirtualXMLDisplayHandler.php | 4 +- classes/display/XMLDisplayHandler.php | 2 +- classes/extravar/Extravar.class.php | 12 +- classes/file/FileHandler.class.php | 56 ++--- classes/file/FileObject.class.php | 18 +- .../FrontEndFileHandler.class.php | 68 +++--- classes/handler/Handler.class.php | 2 +- classes/httprequest/XEHttpRequest.class.php | 2 +- classes/mail/Mail.class.php | 44 ++-- classes/mobile/Mobile.class.php | 26 +-- classes/module/ModuleHandler.class.php | 118 +++++----- classes/module/ModuleObject.class.php | 120 +++++------ classes/object/Object.class.php | 10 +- classes/page/PageHandler.class.php | 30 +-- classes/security/EmbedFilter.class.php | 24 +-- classes/security/IpFilter.class.php | 4 +- classes/security/Password.class.php | 8 +- classes/security/Purifier.class.php | 2 +- classes/security/UploadFileFilter.class.php | 4 +- classes/template/TemplateHandler.class.php | 94 ++++---- classes/validator/Validator.class.php | 8 +- classes/widget/WidgetHandler.class.php | 2 - classes/xml/XmlJsFilter.class.php | 2 +- classes/xml/XmlParser.class.php | 6 +- 29 files changed, 481 insertions(+), 483 deletions(-) diff --git a/classes/cache/CacheHandler.class.php b/classes/cache/CacheHandler.class.php index f40a5a1b6..812561898 100644 --- a/classes/cache/CacheHandler.class.php +++ b/classes/cache/CacheHandler.class.php @@ -12,7 +12,7 @@ class CacheHandler extends Handler * Force file cache. */ protected $_always_use_file = false; - + /** * Get a instance of CacheHandler(for singleton) * diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 22c64a8bf..828577f8c 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -81,7 +81,7 @@ class Context * @var array */ public $opengraph_metadata = array(); - + /** * Canonical URL * @var string @@ -124,7 +124,7 @@ class Context * @var object */ private static $_instance = null; - + /** * Flag to prevent calling init() twice */ @@ -208,7 +208,7 @@ class Context */ private function __construct() { - + } /** @@ -224,16 +224,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 +249,7 @@ class Context self::setRequestArguments(); } self::setUploadInfo(); - + // If Rhymix is installed, get virtual site information. if(self::isInstalled()) { @@ -279,7 +279,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 +288,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 +318,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 +346,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 +363,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 +390,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 +413,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 +426,7 @@ class Context /** * Get the session status - * + * * @return bool */ public static function getSessionStatus() @@ -436,7 +436,7 @@ class Context /** * Start the session if $_SESSION was touched - * + * * @return void */ public static function checkSessionStatus($force = false) @@ -456,7 +456,7 @@ class Context { DisplayHandler::getDebugInfo(); } - + // Check session status and close it if open. if (Rhymix\Framework\Session::checkStart()) { @@ -500,7 +500,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 +582,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 +751,7 @@ class Context /** * Return site title - * + * * @return string */ public static function getSiteTitle() @@ -766,10 +766,10 @@ class Context return ''; } } - + /** * Return site subtitle - * + * * @return string */ public static function getSiteSubtitle() @@ -808,13 +808,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 +830,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 +864,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 +882,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 +900,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 +912,7 @@ class Context } }, $output); } - + /** * Convert strings of variables in $source_object into UTF-8 * @@ -1017,7 +1017,7 @@ class Context /** * Encode UTF-8 domain into IDNA (punycode) - * + * * @param string $domain Domain to convert * @return string Converted string */ @@ -1028,7 +1028,7 @@ class Context /** * Convert IDNA (punycode) domain into UTF-8 - * + * * @param string $domain Domain to convert * @return string Converted string */ @@ -1116,7 +1116,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 +1132,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 +1142,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 +1170,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 +1199,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 +1207,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 +1225,10 @@ class Context } } } - + /** * Handle uploaded file info. - * + * * @return void */ private static function setUploadInfo() @@ -1302,7 +1302,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 +1334,7 @@ class Context } } } - + return true; } @@ -1355,7 +1355,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 +1363,7 @@ class Context { $node = array($node); } - + if($name == 'body' && count((array)$_val) === 1) { $_val = self::_filterRequestVar($key, $node); @@ -1381,7 +1381,7 @@ class Context } $result[escape($_key)] = !empty((array)$args) ? $args : $_val; } - + return $is_array ? $result : $result[0]; } @@ -1399,7 +1399,7 @@ class Context { return; } - + $result = array(); if(!$is_array = is_array($val)) { @@ -1438,7 +1438,7 @@ class Context $result[escape($_key)] = $_val; self::_recursiveCheckVar($_val); } - + return $is_array ? $result : $result[0]; } @@ -1477,7 +1477,7 @@ class Context { return; } - + // Allow if the current user is in the list of allowed IPs. if (PHP_SAPI === 'cli') { @@ -1487,7 +1487,7 @@ class Context { return; } - + // Set headers and constants for backward compatibility. header('HTTP/1.1 503 Service Unavailable'); define('_XE_SITELOCK_', TRUE); @@ -1495,7 +1495,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 +1507,10 @@ class Context } exit; } - + /** * Display a generic error page and exit. - * + * * @param string $title * @param string $message * @return void @@ -1519,11 +1519,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 +1531,7 @@ class Context { $oMessageObject->setHttpStatusCode($status); } - + // Find out the caller's location. if (!$location) { @@ -1543,7 +1543,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 +1553,7 @@ class Context $oMessageObject->setMessage($title); $oMessageObject->dispMessage($message, $location); } - + // Display the message. $oModuleHandler = new ModuleHandler; $oModuleHandler->displayContent($oMessageObject); @@ -1610,7 +1610,7 @@ class Context { $rewrite_level = Rhymix\Framework\Router::getRewriteLevel(); } - + if ($site_module_info === null) { $site_module_info = self::get('site_module_info'); @@ -1697,12 +1697,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 +1715,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 +1725,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 +1833,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 +1856,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 +1885,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 +1949,7 @@ class Context /** * Clear all values from GET/POST/XMLRPC - * + * * @return void */ public static function clearRequestVars() @@ -1959,7 +1959,7 @@ class Context /** * Clear all user-set values - * + * * @return void */ public static function clearUserVars() @@ -1976,7 +1976,7 @@ class Context */ public static function addSSLAction($action) { - + } /** @@ -1988,7 +1988,7 @@ class Context */ public static function addSSLActions($action_array) { - + } /** @@ -2000,7 +2000,7 @@ class Context */ public static function subtractSSLAction($action) { - + } /** @@ -2092,7 +2092,7 @@ class Context { $args = func_get_args(); } - + self::$_oFrontEndFileHandler->loadFile($args); } @@ -2419,7 +2419,7 @@ class Context /** * Remove all content added by addHtmlHeader() - * + * * @return void */ public static function clearHtmlHeader() @@ -2544,7 +2544,7 @@ class Context /** * Set a validator message - * + * * @param string $id * @param string $message * @param string $type (optional) @@ -2601,7 +2601,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 +2616,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 +2637,7 @@ class Context self::$_blacklist = array(); } } - + if ($type) { return isset(self::$_blacklist[$type][$plugin_name]); @@ -2657,7 +2657,7 @@ class Context /** * Check whether a word is reserved in Rhymix - * + * * @param string $word * @return bool */ @@ -2671,7 +2671,7 @@ class Context self::$_reserved_words = array(); } } - + return isset(self::$_reserved_words[$word]); } @@ -2734,7 +2734,7 @@ class Context /** * Get meta tag - * + * * @param string $name (optional) * @return array The list of meta tags */ @@ -2744,7 +2744,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 +2769,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 +2805,10 @@ class Context 'height' => $height, ); } - + /** * Get OpenGraph metadata - * + * * @return array */ public static function getOpenGraphData() @@ -2824,10 +2824,10 @@ class Context } return $ret; } - + /** * Add OpenGraph metadata - * + * * @param string $name * @param mixed $content * @return void @@ -2846,10 +2846,10 @@ class Context self::$_instance->opengraph_metadata[] = array($name, $content); } } - + /** * Set canonical URL - * + * * @param string $url * @return void */ @@ -2858,10 +2858,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() diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index b9a05b4a7..45a6c8097 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -57,7 +57,7 @@ class DisplayHandler extends Handler { $handler = new HTMLDisplayHandler(); } - + // Handle error location info if ($location = $oModule->get('rx_error_location')) { @@ -151,16 +151,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 +169,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 +186,7 @@ class DisplayHandler extends Handler { return; } - + // Print debug information. $debug_output = ''; $response_type = Context::getResponseMethod(); @@ -234,7 +234,7 @@ class DisplayHandler extends Handler } } } - + switch ($response_type) { case 'HTML': @@ -293,7 +293,7 @@ class DisplayHandler extends Handler } } } - + return $debug_output; } @@ -323,10 +323,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 */ diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index d47da79a0..2807dacf7 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -10,12 +10,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 +37,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 +171,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 +189,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 +234,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 +266,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 +420,7 @@ class HTMLDisplayHandler /** * Add OpenGraph metadata tags. - * + * * @return void */ function _addOpenGraphMetadata() @@ -455,14 +455,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 +479,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 +506,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 +518,7 @@ class HTMLDisplayHandler { Context::addOpenGraphData('og:locale:alternate', $locales[$oDocument->getLangCode()]); } - + // Add image. if ($document_images = Context::getMetaImages()) { @@ -535,20 +535,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 +560,7 @@ class HTMLDisplayHandler { $document_images = null; } - + if ($document_images) { $first_image = array_first($document_images); @@ -584,7 +584,7 @@ class HTMLDisplayHandler { $this->_image_type = 'none'; } - + // Add tags and hashtags for articles. if ($page_type === 'article' && $permitted) { @@ -596,7 +596,7 @@ class HTMLDisplayHandler Context::addOpenGraphData('og:article:tag', $tag, false); } } - + if (config('seo.og_extract_hashtags')) { $hashtags = $oDocument->getHashtags(); @@ -608,17 +608,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 +626,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 +686,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 +700,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); diff --git a/classes/display/JSONDisplayHandler.php b/classes/display/JSONDisplayHandler.php index 7e7fc61a1..37aa6ba63 100644 --- a/classes/display/JSONDisplayHandler.php +++ b/classes/display/JSONDisplayHandler.php @@ -14,14 +14,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 +51,10 @@ class JSONDisplayHandler } } } - + /** * Check if an array only has numeric keys. - * + * * @param array $array * @return bool */ diff --git a/classes/display/VirtualXMLDisplayHandler.php b/classes/display/VirtualXMLDisplayHandler.php index 92095cbb0..62653ba4a 100644 --- a/classes/display/VirtualXMLDisplayHandler.php +++ b/classes/display/VirtualXMLDisplayHandler.php @@ -57,10 +57,10 @@ class VirtualXMLDisplayHandler $html[] = ' parent.location.href = ' . json_encode($output->url) . ';'; $html[] = '}'; } - + $html[] = ''; $html[] = ''; - + return join("\n", $html); } diff --git a/classes/display/XMLDisplayHandler.php b/classes/display/XMLDisplayHandler.php index 7ac08b88b..66890ef0f 100644 --- a/classes/display/XMLDisplayHandler.php +++ b/classes/display/XMLDisplayHandler.php @@ -26,7 +26,7 @@ class XMLDisplayHandler /** * produce XML code given variable object\n - * @param object $obj + * @param object $obj * @return string */ function _makeXmlDoc($obj) diff --git a/classes/extravar/Extravar.class.php b/classes/extravar/Extravar.class.php index 9d5d0e534..705bdb753 100644 --- a/classes/extravar/Extravar.class.php +++ b/classes/extravar/Extravar.class.php @@ -45,7 +45,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 +359,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 +480,7 @@ class ExtraItem { $selected = ' selected="selected"'; } - + $buff[] = ' '; } $buff[] = ''; @@ -560,7 +560,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 +1038,7 @@ class ModuleHandler extends Handler return; } } - + // If error occurred, handle it if($this->error) { @@ -1050,7 +1050,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 +1063,7 @@ class ModuleHandler extends Handler { $oModule = $oMessageObject; } - + self::_clearErrorSession(); } @@ -1118,7 +1118,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 +1139,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 +1156,7 @@ class ModuleHandler extends Handler include($php_file); } } - + Context::set($menu_id, $menu); } } @@ -1190,16 +1190,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 +1264,7 @@ class ModuleHandler extends Handler { $triggers = array(); } - + foreach($triggers as $item) { $module = $item->module; @@ -1289,13 +1289,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 +1310,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 +1364,7 @@ class ModuleHandler extends Handler { $trigger_target = 'closure'; } - + if (Rhymix\Framework\Debug::isEnabledForCurrentUser()) { Rhymix\Framework\Debug::addTrigger(array( diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index aa4dc8422..1b7d67cd1 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -52,7 +52,7 @@ class ModuleObject extends BaseObject /** * Singleton - * + * * @param string $module_hint (optional) * @return static */ @@ -97,7 +97,7 @@ class ModuleObject extends BaseObject /** * setter to set the name of module - * + * * @param string $module name of module * @return $this */ @@ -109,7 +109,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 +125,7 @@ class ModuleObject extends BaseObject /** * setter to set an url for redirection - * + * * @param string $url url for redirection * @return $this */ @@ -145,7 +145,7 @@ class ModuleObject extends BaseObject /** * get url for redirection - * + * * @return string */ public function getRedirectUrl() @@ -157,7 +157,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 +170,7 @@ class ModuleObject extends BaseObject /** * Set the action name - * + * * @param string $act * @return $this */ @@ -179,10 +179,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 +197,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 +219,7 @@ class ModuleObject extends BaseObject $oTemplate->compile('modules/admin/tpl', '_admin_common.html'); } } - + // Execute init if(method_exists($this, 'init')) { @@ -235,10 +235,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 +253,7 @@ class ModuleObject extends BaseObject { return false; } - + // If value is not array if(!is_array($check_module_srl)) { @@ -267,7 +267,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 +276,7 @@ class ModuleObject extends BaseObject { return false; } - + // Check permission if(!$this->checkPermission($grant, $this->user)) { @@ -286,13 +286,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 +300,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 +328,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 +370,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 +401,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 +409,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 +428,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 +470,7 @@ class ModuleObject extends BaseObject /** * retrieve the directory path of the template directory - * + * * @return string */ public function getTemplateFile() @@ -480,7 +480,7 @@ class ModuleObject extends BaseObject /** * set the directory path of the template directory - * + * * @param string path of template directory. * @return $this */ @@ -501,7 +501,7 @@ class ModuleObject extends BaseObject /** * retrieve the directory path of the template directory - * + * * @return string */ public function getTemplatePath() @@ -511,7 +511,7 @@ class ModuleObject extends BaseObject /** * set the file name of the temporarily modified by admin - * + * * @param string name of file * @return $this */ @@ -529,7 +529,7 @@ class ModuleObject extends BaseObject /** * retreived the file name of edited_layout_file - * + * * @return string */ public function getEditedLayoutFile() @@ -539,7 +539,7 @@ class ModuleObject extends BaseObject /** * set the file name of the layout file - * + * * @param string name of file * @return $this */ @@ -555,7 +555,7 @@ class ModuleObject extends BaseObject /** * get the file name of the layout file - * + * * @return string */ public function getLayoutFile() @@ -565,7 +565,7 @@ class ModuleObject extends BaseObject /** * set the directory path of the layout directory - * + * * @param string path of layout directory. * @return $this */ @@ -586,7 +586,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 +605,7 @@ class ModuleObject extends BaseObject { return FALSE; } - + // Check mobile status $is_mobile = Mobile::isFromMobilePhone(); @@ -623,7 +623,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 +636,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 +645,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 +669,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 +756,10 @@ class ModuleObject extends BaseObject } return TRUE; } - + /** * Copy the response of another ModuleObject into this instance. - * + * * @param self $instance * @return void */ @@ -769,14 +769,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) { diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index b23c53421..ceb52d1f0 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -44,7 +44,7 @@ class BaseObject { $this->setError($error); $this->setMessage($message); - + if ($error) { $backtrace = debug_backtrace(false); @@ -58,10 +58,10 @@ class BaseObject $this->add('rx_error_location', $location); } } - + /** * Set state for var_export() - * + * * @param array $vars * @return object */ @@ -94,7 +94,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 +104,7 @@ class BaseObject $this->message = vsprintf($this->message, $args); } } - + return $this; } diff --git a/classes/page/PageHandler.class.php b/classes/page/PageHandler.class.php index fd49df525..f76070d74 100644 --- a/classes/page/PageHandler.class.php +++ b/classes/page/PageHandler.class.php @@ -7,35 +7,35 @@ * handles page navigation * @version 0.1 * - * @remarks Getting total counts, number of pages, current page number, number of items per page, + * @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 */ 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 +71,7 @@ class PageHandler extends Handler implements Iterator /** * Request next page - * + * * @return int */ public function getNextPage(): int @@ -86,7 +86,7 @@ class PageHandler extends Handler implements Iterator /** * Return number of page that added offset. - * + * * @param int $offset * @return int */ @@ -97,7 +97,7 @@ class PageHandler extends Handler implements Iterator /** * Rewind iterator stepper. - * + * * @return void */ public function rewind(): void @@ -107,7 +107,7 @@ class PageHandler extends Handler implements Iterator /** * Determine if a current iterated item is valid. - * + * * @return bool */ public function valid(): bool @@ -118,7 +118,7 @@ class PageHandler extends Handler implements Iterator /** * Get a current iterated page number. - * + * * @return int */ public function current(): int @@ -128,7 +128,7 @@ class PageHandler extends Handler implements Iterator /** * Get a current iterator stepper. - * + * * @return int */ public function key(): int @@ -138,7 +138,7 @@ class PageHandler extends Handler implements Iterator /** * Step up the iterator. - * + * * @return void */ public function next(): void diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index 47d529b9f..cf0df75fe 100644 --- a/classes/security/EmbedFilter.class.php +++ b/classes/security/EmbedFilter.class.php @@ -14,64 +14,64 @@ 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. diff --git a/classes/security/IpFilter.class.php b/classes/security/IpFilter.class.php index 925616a41..18d37c5b0 100644 --- a/classes/security/IpFilter.class.php +++ b/classes/security/IpFilter.class.php @@ -8,12 +8,12 @@ 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 */ diff --git a/classes/security/Password.class.php b/classes/security/Password.class.php index a0012d048..5dfb2152a 100644 --- a/classes/security/Password.class.php +++ b/classes/security/Password.class.php @@ -58,22 +58,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); diff --git a/classes/security/Purifier.class.php b/classes/security/Purifier.class.php index 9a17d5294..41d0af974 100644 --- a/classes/security/Purifier.class.php +++ b/classes/security/Purifier.class.php @@ -7,7 +7,7 @@ class Purifier { return new self(); } - + public function purify(&$content) { $content = Rhymix\Framework\Filters\HTMLFilter::clean($content); diff --git a/classes/security/UploadFileFilter.class.php b/classes/security/UploadFileFilter.class.php index a74b72ced..a27279c36 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'])) { diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 20e29281b..131c7648f 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -21,7 +21,7 @@ class TemplateHandler private $skipTags = NULL; private $handler_mtime = 0; private static $rootTpl = NULL; - + /** * Context variables accessible as $this in template files */ @@ -66,7 +66,7 @@ class TemplateHandler /** * Reset all instance properties to the default state. - * + * * @return void */ protected function resetState() @@ -166,7 +166,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 +180,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 +326,7 @@ class TemplateHandler { $autoform = true; } - + // form ruleset attribute move to hidden tag if ($autoform && $matches[1]) { @@ -399,7 +399,7 @@ class TemplateHandler $matches[1] = preg_replace('/no-(?:error-)?return-url="true"/i', '', $matches[1]); } } - + array_shift($matches); return implode('', $matches); } @@ -415,28 +415,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 +525,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 +652,7 @@ class TemplateHandler { return $m[0]; } - + if($m[1][0] == '@') { $m[1] = self::_replaceVar(substr($m[1], 1)); @@ -677,7 +677,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 +791,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 +1035,7 @@ class TemplateHandler { $str = "$str ?? ''"; } - + switch($escape_option) { case 'escape': @@ -1089,10 +1089,10 @@ class TemplateHandler return $path; } - + /** * Check if a string seems to contain a variable. - * + * * @param string $str * @return bool */ @@ -1103,7 +1103,7 @@ class TemplateHandler /** * Replace PHP variables of $ character - * + * * @param string $php * @return string */ @@ -1113,12 +1113,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 +1147,10 @@ class TemplateHandler '}' => '}', ]); } - + /** * Get the temporary entity for a character. - * + * * @param string $char * @return string */ diff --git a/classes/validator/Validator.class.php b/classes/validator/Validator.class.php index 7b5fc635b..9cfc562d8 100644 --- a/classes/validator/Validator.class.php +++ b/classes/validator/Validator.class.php @@ -133,7 +133,7 @@ class Validator $rules = array(); $messages = array(); - + // custom rules if(isset($xml->ruleset->customrules) && isset($xml->ruleset->customrules->rule)) { @@ -196,7 +196,7 @@ class Validator { $fieldsNames[$name] = $title; } - + unset($filter['name']); // conditional statement @@ -832,10 +832,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 diff --git a/classes/widget/WidgetHandler.class.php b/classes/widget/WidgetHandler.class.php index 94a9c2320..6f15f771f 100644 --- a/classes/widget/WidgetHandler.class.php +++ b/classes/widget/WidgetHandler.class.php @@ -9,9 +9,7 @@ */ class WidgetHandler { - var $widget_path = ''; - } /* End of file WidgetHandler.class.php */ /* Location: ./classes/widget/WidgetHandler.class.php */ diff --git a/classes/xml/XmlJsFilter.class.php b/classes/xml/XmlJsFilter.class.php index 34efcfcc3..d1da97c6d 100644 --- a/classes/xml/XmlJsFilter.class.php +++ b/classes/xml/XmlJsFilter.class.php @@ -70,7 +70,7 @@ class XmlJsFilter extends XeXmlParser * Compiled js file * @var string */ - var $js_file = NULL; // / + var $js_file = NULL; // / /** * constructor diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index b3f720c54..a749e9d74 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -26,7 +26,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 +221,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)