mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Remove trailing whitespace in legacy class files
This commit is contained in:
parent
8a6039b829
commit
c881e73c1d
29 changed files with 481 additions and 483 deletions
2
classes/cache/CacheHandler.class.php
vendored
2
classes/cache/CacheHandler.class.php
vendored
|
|
@ -12,7 +12,7 @@ class CacheHandler extends Handler
|
|||
* Force file cache.
|
||||
*/
|
||||
protected $_always_use_file = false;
|
||||
|
||||
|
||||
/**
|
||||
* Get a instance of CacheHandler(for singleton)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ class VirtualXMLDisplayHandler
|
|||
$html[] = ' parent.location.href = ' . json_encode($output->url) . ';';
|
||||
$html[] = '}';
|
||||
}
|
||||
|
||||
|
||||
$html[] = '</script>';
|
||||
$html[] = '</head><body></body></html>';
|
||||
|
||||
|
||||
return join("\n", $html);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class XMLDisplayHandler
|
|||
|
||||
/**
|
||||
* produce XML code given variable object\n
|
||||
* @param object $obj
|
||||
* @param object $obj
|
||||
* @return string
|
||||
*/
|
||||
function _makeXmlDoc($obj)
|
||||
|
|
|
|||
|
|
@ -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[] = ' <option value="' . $lang_type . '" ' . $selected . '>' . $supported_lang[$lang_type]['name'] . '</option>';
|
||||
}
|
||||
$buff[] = '</select>';
|
||||
|
|
@ -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[] = '<input type="hidden" class="rx_ev_date" name="' . $column_name . '" value="' . $value . '" />';
|
||||
$buff[] = '<input type="hidden" class="rx_ev_date" name="' . $column_name . '" value="' . $value . '" />';
|
||||
$buff[] = '<input type="text" id="date_' . $column_name . '" value="' . $formattedValue . '" class="date" autocomplete="off" />';
|
||||
$buff[] = '<input type="button" value="' . lang('cmd_delete') . '" class="btn" id="dateRemover_' . $column_name . '" />';
|
||||
$buff[] = '<script type="text/javascript">';
|
||||
|
|
@ -600,7 +600,7 @@ class ExtraItem
|
|||
{
|
||||
$buff[] = '<p>' . escape(Context::replaceUserLang($this->desc), false) . '</p>';
|
||||
}
|
||||
|
||||
|
||||
return join("\n", $buff);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class FileHandler
|
|||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
$output = array();
|
||||
foreach ($list as $filename)
|
||||
{
|
||||
|
|
@ -290,12 +290,12 @@ class FileHandler
|
|||
'verify' => \RX_BASEDIR . 'common/vendor/composer/ca-bundle/res/cacert.pem',
|
||||
'timeout' => $timeout,
|
||||
);
|
||||
|
||||
|
||||
foreach($headers as $key => $val)
|
||||
{
|
||||
$request_headers[$key] = $val;
|
||||
}
|
||||
|
||||
|
||||
if(isset($cookies[$host]) && is_array($cookies[$host]))
|
||||
{
|
||||
foreach($cookies[$host] as $key => $val)
|
||||
|
|
@ -307,17 +307,17 @@ class FileHandler
|
|||
{
|
||||
$request_headers['Cookie'] = implode('; ', $request_cookies);
|
||||
}
|
||||
|
||||
|
||||
foreach($request_config as $key => $val)
|
||||
{
|
||||
$request_options[$key] = $val;
|
||||
}
|
||||
|
||||
|
||||
if($content_type)
|
||||
{
|
||||
$request_headers['Content-Type'] = $content_type;
|
||||
}
|
||||
|
||||
|
||||
if(defined('__PROXY_SERVER__'))
|
||||
{
|
||||
$proxy = parse_url(__PROXY_SERVER__);
|
||||
|
|
@ -331,7 +331,7 @@ class FileHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$url = str_replace('&', '&', $url);
|
||||
$start_time = microtime(true);
|
||||
$response = Requests::request($url, $request_headers, $body ?: $post_data, $method, $request_options);
|
||||
|
|
@ -341,12 +341,12 @@ class FileHandler
|
|||
$GLOBALS['__remote_request_elapsed__'] = 0;
|
||||
}
|
||||
$GLOBALS['__remote_request_elapsed__'] += $elapsed_time;
|
||||
|
||||
|
||||
$log = array();
|
||||
$log['url'] = $url;
|
||||
$log['status'] = $response ? $response->status_code : 0;
|
||||
$log['elapsed_time'] = $elapsed_time;
|
||||
|
||||
|
||||
if (Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
||||
{
|
||||
if (in_array('slow_remote_requests', config('debug.display_content')))
|
||||
|
|
@ -373,12 +373,12 @@ class FileHandler
|
|||
}
|
||||
Rhymix\Framework\Debug::addRemoteRequest($log);
|
||||
}
|
||||
|
||||
|
||||
foreach($response->cookies as $cookie)
|
||||
{
|
||||
$cookies[$host][$cookie->name] = $cookie->value;
|
||||
}
|
||||
|
||||
|
||||
if($response->success)
|
||||
{
|
||||
if (isset($request_config['filename']))
|
||||
|
|
@ -420,7 +420,7 @@ class FileHandler
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$request_config['filename'] = $target_filename;
|
||||
$success = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
|
||||
return $success ? true : false;
|
||||
|
|
@ -487,7 +487,7 @@ class FileHandler
|
|||
|
||||
/**
|
||||
* Check if image needs rotation
|
||||
*
|
||||
*
|
||||
* @param string $filename
|
||||
* @return int|bool 0, 90, 180, 360, or false
|
||||
*/
|
||||
|
|
@ -571,7 +571,7 @@ class FileHandler
|
|||
6 => 'bmp',
|
||||
18 => 'webp',
|
||||
);
|
||||
|
||||
|
||||
$type = isset($typemap[$type]) ? $typemap[$type] : null;
|
||||
if (!$type)
|
||||
{
|
||||
|
|
@ -583,13 +583,13 @@ class FileHandler
|
|||
{
|
||||
$target_type = 'jpg';
|
||||
}
|
||||
|
||||
|
||||
// Automatically set resize_height if it is 'auto'
|
||||
if ($resize_height === 'auto')
|
||||
{
|
||||
$resize_height = round($resize_width / ($width / $height));
|
||||
}
|
||||
|
||||
|
||||
// create temporary image having original type
|
||||
if ($type === 'gif' && function_exists('imagecreatefromgif'))
|
||||
{
|
||||
|
|
@ -654,7 +654,7 @@ class FileHandler
|
|||
imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Resize the original image and copy it to a temporary image
|
||||
if ($resize_needed)
|
||||
{
|
||||
|
|
@ -663,7 +663,7 @@ class FileHandler
|
|||
$ratio_y = ($resize_height > 0 && $height > 0) ? $resize_height / $height : 1;
|
||||
$ratio_max = max($ratio_x, $ratio_y);
|
||||
$ratio_min = min($ratio_x, $ratio_y);
|
||||
|
||||
|
||||
// Determine the X-Y coordinates to copy
|
||||
if ($thumbnail_type === 'stretch')
|
||||
{
|
||||
|
|
@ -690,16 +690,16 @@ class FileHandler
|
|||
$dst_width = round($width * min(1, $ratio_max));
|
||||
$dst_height = round($height * min(1, $ratio_max));
|
||||
}
|
||||
|
||||
|
||||
// Adjust for small margins of error
|
||||
if (abs($resize_width - $dst_width) < ($resize_width * 0.02)) $dst_width = $resize_width;
|
||||
if (abs($resize_height - $dst_height) < ($resize_height * 0.02)) $dst_height = $resize_height;
|
||||
$dst_x = round(($resize_width - $dst_width) / 2);
|
||||
$dst_y = round(($resize_height - $dst_height) / 2);
|
||||
|
||||
|
||||
imagecopyresampled($thumb, $source, $dst_x, $dst_y, 0, 0, $dst_width, $dst_height, $width, $height);
|
||||
}
|
||||
|
||||
|
||||
// create directory
|
||||
self::makeDir(dirname($target_file));
|
||||
|
||||
|
|
@ -728,7 +728,7 @@ class FileHandler
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
imagedestroy($thumb);
|
||||
imagedestroy($source);
|
||||
@chmod($target_file, 0666 & ~Rhymix\Framework\Storage::getUmask());
|
||||
|
|
@ -748,7 +748,7 @@ class FileHandler
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$arr = parse_ini_file($filename, true);
|
||||
return is_array($arr) ? $arr : array();
|
||||
}
|
||||
|
|
@ -876,7 +876,7 @@ class FileHandler
|
|||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
*
|
||||
* Clears file status cache
|
||||
*
|
||||
* @param string|array $target filename or directory
|
||||
|
|
@ -897,10 +897,10 @@ class FileHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
*
|
||||
* Invalidates a cached script of OPcache
|
||||
*
|
||||
* @param string|array $target filename or directory
|
||||
|
|
@ -909,7 +909,7 @@ class FileHandler
|
|||
public static function invalidateOpcache($target, $force = true)
|
||||
{
|
||||
static $opcache = null;
|
||||
|
||||
|
||||
if($opcache === null)
|
||||
{
|
||||
$opcache = function_exists('opcache_invalidate');
|
||||
|
|
@ -918,7 +918,7 @@ class FileHandler
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach(is_array($target) ? $target : array($target) as $target_item)
|
||||
{
|
||||
if(substr($target_item, -4) === '.php')
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
/**
|
||||
* File abstraction class
|
||||
* File abstraction class
|
||||
*
|
||||
* @author NAVER (developers@xpressengine.com)
|
||||
*/
|
||||
|
|
@ -28,10 +28,10 @@ class FileObject extends BaseObject
|
|||
var $mode = "r";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param string $path Path of target file
|
||||
* @param string $mode File open mode
|
||||
* @param string $mode File open mode
|
||||
* @return void
|
||||
*/
|
||||
function __construct($path, $mode)
|
||||
|
|
@ -43,10 +43,10 @@ class FileObject extends BaseObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Append target file's content to current file
|
||||
* Append target file's content to current file
|
||||
*
|
||||
* @param string $file_name Path of target file
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
function append($file_name)
|
||||
{
|
||||
|
|
@ -62,7 +62,7 @@ class FileObject extends BaseObject
|
|||
/**
|
||||
* Check current file meets eof
|
||||
*
|
||||
* @return bool true: if eof. false: otherwise
|
||||
* @return bool true: if eof. false: otherwise
|
||||
*/
|
||||
function feof()
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ class FileObject extends BaseObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Read from current file
|
||||
* Read from current file
|
||||
*
|
||||
* @param int $size Size to read
|
||||
* @return string Returns the read string or false on failure.
|
||||
|
|
@ -81,7 +81,7 @@ class FileObject extends BaseObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Write string to current file
|
||||
* Write string to current file
|
||||
*
|
||||
* @param string $str String to write
|
||||
* @return int Returns the number of bytes written, or false on error.
|
||||
|
|
@ -144,7 +144,7 @@ class FileObject extends BaseObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Close file
|
||||
* Close file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class FrontEndFileHandler extends Handler
|
|||
*/
|
||||
public static $minify = null;
|
||||
public static $concat = null;
|
||||
|
||||
|
||||
/**
|
||||
* Directory for minified, compiled, and concatenated CSS/JS assets.
|
||||
*/
|
||||
|
|
@ -93,11 +93,11 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
$args = array($args);
|
||||
}
|
||||
|
||||
|
||||
// Replace obsolete paths with current paths.
|
||||
$args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]);
|
||||
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
|
||||
|
||||
|
||||
// Prevent overwriting common scripts.
|
||||
if(!isset($args[3]) || intval($args[3]) > -1500000000)
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($args[2]) && preg_match('/IE/i', $args[2]))
|
||||
{
|
||||
$source_hint = '';
|
||||
|
|
@ -127,7 +127,7 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
$source_hint = '';
|
||||
}
|
||||
|
||||
|
||||
$file = $this->getFileInfo($args[0], $args[2] ?? '', $args[1] ?? 'all', $args[4] ?? [], $isCommon);
|
||||
$file->index = (int)($args[3] ?? 0);
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ class FrontEndFileHandler extends Handler
|
|||
protected function getFileInfo($fileName, $targetIe = '', $media = 'all', $vars = array(), $isCommon = false)
|
||||
{
|
||||
$pathInfo = pathinfo($fileName);
|
||||
|
||||
|
||||
$file = new stdClass();
|
||||
$file->fileName = $pathInfo['basename'];
|
||||
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname'] ?? '');
|
||||
|
|
@ -221,16 +221,16 @@ class FrontEndFileHandler extends Handler
|
|||
$file->fileFullPath = $file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Do not minify common JS plugins
|
||||
if (strpos($file->filePath, 'common/js/plugins') !== false)
|
||||
{
|
||||
$file->isMinified = true;
|
||||
}
|
||||
|
||||
|
||||
// Since Rhymix 2.1, targetIe is always empty
|
||||
$file->targetIe = '';
|
||||
|
||||
|
||||
// Process media attributes and generate the key
|
||||
if($file->fileExtension == 'css' || $file->fileExtension == 'less' || $file->fileExtension == 'scss')
|
||||
{
|
||||
|
|
@ -244,10 +244,10 @@ class FrontEndFileHandler extends Handler
|
|||
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process CSS and JS file
|
||||
*
|
||||
*
|
||||
* @param object $file
|
||||
* @param bool $minify
|
||||
* @return void
|
||||
|
|
@ -258,11 +258,11 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$minifiedFileName = $file->fileNameNoExt . '.min.' . $file->fileExtension;
|
||||
$minifiedFileHash = ltrim(str_replace(array('/', '\\'), '.', substr($file->fileRealPath, strlen(\RX_BASEDIR))), '.');
|
||||
$minifiedFilePath = \RX_BASEDIR . self::$assetdir . '/minified/' . $minifiedFileHash . '.' . $minifiedFileName;
|
||||
|
||||
|
||||
if (!file_exists($minifiedFilePath) || filemtime($minifiedFilePath) < filemtime($file->fileFullPath))
|
||||
{
|
||||
$method_name = 'minify' . $file->fileExtension;
|
||||
|
|
@ -272,7 +272,7 @@ class FrontEndFileHandler extends Handler
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$file->fileName = $minifiedFileHash . '.' . $minifiedFileName;
|
||||
$file->filePath = \RX_BASEURL . self::$assetdir . '/minified';
|
||||
$file->fileRealPath = \RX_BASEDIR . self::$assetdir . '/minified';
|
||||
|
|
@ -281,10 +281,10 @@ class FrontEndFileHandler extends Handler
|
|||
$file->cdnPath = './' . self::$assetdir . '/minified';
|
||||
$file->isMinified = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process LESS and SCSS file
|
||||
*
|
||||
*
|
||||
* @param object $file
|
||||
* @param bool $minify
|
||||
* @return void
|
||||
|
|
@ -295,7 +295,7 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$default_font_config = Context::get('default_font_config') ?: EditorModel::$default_font_config;
|
||||
$file->vars['enable_xe_btn_styles'] = (defined('DISABLE_XE_BTN_STYLES') && DISABLE_XE_BTN_STYLES) ? 'false' : 'true';
|
||||
$file->vars['enable_xe_msg_styles'] = (defined('DISABLE_XE_MSG_STYLES') && DISABLE_XE_MSG_STYLES) ? 'false' : 'true';
|
||||
|
|
@ -306,14 +306,14 @@ class FrontEndFileHandler extends Handler
|
|||
return preg_match('/^[0-9a-zA-Z\.%_-]+$/', $str) ? $str : ('~"' . str_replace('"', '\\"', $str) . '"');
|
||||
}, $file->vars);
|
||||
}
|
||||
|
||||
|
||||
$compiledFileName = $file->fileName . ($minify ? '.min' : '') . '.css';
|
||||
$compiledFileHash = sha1($file->fileRealPath . ':' . serialize($file->vars));
|
||||
$compiledFilePath = \RX_BASEDIR . self::$assetdir . '/compiled/' . $compiledFileHash . '.' . $compiledFileName;
|
||||
|
||||
$importedFileName = $file->fileName . ($minify ? '.min' : '') . '.imports.php';
|
||||
$importedFilePath = \RX_BASEDIR . self::$assetdir . '/compiled/' . $compiledFileHash . '.' . $importedFileName;
|
||||
|
||||
|
||||
if (!file_exists($compiledFilePath))
|
||||
{
|
||||
$recompile = 1;
|
||||
|
|
@ -346,13 +346,13 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($recompile)
|
||||
{
|
||||
$method_name = 'compile' . $file->fileExtension;
|
||||
Rhymix\Framework\Formatter::$method_name($file->fileFullPath, $compiledFilePath, $file->vars, $minify);
|
||||
}
|
||||
|
||||
|
||||
$file->fileName = $compiledFileHash . '.' . $compiledFileName;
|
||||
$file->filePath = \RX_BASEURL . self::$assetdir . '/compiled';
|
||||
$file->fileRealPath = \RX_BASEDIR . self::$assetdir . '/compiled';
|
||||
|
|
@ -434,7 +434,7 @@ class FrontEndFileHandler extends Handler
|
|||
$minify = self::$minify !== null ? self::$minify : (config('view.minify_scripts') ?: 'common');
|
||||
$concat = strpos(self::$concat !== null ? self::$concat : config('view.concat_scripts'), 'css') !== false;
|
||||
$this->_sortMap($map, $mapIndex);
|
||||
|
||||
|
||||
// Minify all scripts, and compile LESS/SCSS into CSS.
|
||||
if ($finalize)
|
||||
{
|
||||
|
|
@ -454,7 +454,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add all files to the final result.
|
||||
$result = array();
|
||||
if ($concat && $finalize && count($concat_list = $this->_concatMap($map)))
|
||||
|
|
@ -507,7 +507,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Enable HTTP/2 server push for CSS resources.
|
||||
if ($finalize && $this->_isServerPushEnabled())
|
||||
{
|
||||
|
|
@ -541,11 +541,11 @@ class FrontEndFileHandler extends Handler
|
|||
$map = &$this->jsBodyMap;
|
||||
$mapIndex = &$this->jsBodyMapIndex;
|
||||
}
|
||||
|
||||
|
||||
$minify = self::$minify !== null ? self::$minify : (config('view.minify_scripts') ?: 'common');
|
||||
$concat = strpos(self::$concat !== null ? self::$concat : config('view.concat_scripts'), 'js') !== false;
|
||||
$this->_sortMap($map, $mapIndex);
|
||||
|
||||
|
||||
// Minify all scripts.
|
||||
if ($finalize)
|
||||
{
|
||||
|
|
@ -560,7 +560,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add all files to the final result.
|
||||
$result = array();
|
||||
if ($concat && $finalize && $type === 'head' && count($concat_list = $this->_concatMap($map)))
|
||||
|
|
@ -611,7 +611,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Enable HTTP/2 server push for JS resources.
|
||||
if ($type === 'head' && $finalize && $this->_isServerPushEnabled())
|
||||
{
|
||||
|
|
@ -625,10 +625,10 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a concatenation map, skipping external URLs and unreadable scripts.
|
||||
*
|
||||
*
|
||||
* @param array $map
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -654,7 +654,7 @@ class FrontEndFileHandler extends Handler
|
|||
}
|
||||
return $concat_list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort a map
|
||||
*
|
||||
|
|
@ -724,7 +724,7 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($hint)
|
||||
{
|
||||
$tmp = $hint;
|
||||
|
|
@ -744,10 +744,10 @@ class FrontEndFileHandler extends Handler
|
|||
$file->index += isset($cssSortList[$tmp]) ? $cssSortList[$tmp] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if server push is enabled.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isServerPushEnabled()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||
|
||||
/**
|
||||
* An abstract class of (*)Handler
|
||||
* An abstract class of (*)Handler
|
||||
*
|
||||
* @author NAVER (developers@xpressengine.com)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class XEHttpRequest
|
|||
var $m_port;
|
||||
|
||||
/**
|
||||
* target scheme
|
||||
* target scheme
|
||||
* @var string
|
||||
*/
|
||||
var $m_scheme;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* Mail class for XE Compatibility
|
||||
*
|
||||
*
|
||||
* @author Kijin Sung <kijin@kijinsung.com>
|
||||
*/
|
||||
class Mail extends Rhymix\Framework\Mail
|
||||
|
|
@ -18,7 +18,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
self::useSMTP(null, 'smtp.gmail.com', $account_name, $account_passwd, 'ssl', 465);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set parameters for using SMTP protocol
|
||||
*
|
||||
|
|
@ -41,7 +41,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
'smtp_pass' => $pass,
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set additional parameters
|
||||
*/
|
||||
|
|
@ -49,7 +49,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the sender (From:).
|
||||
*
|
||||
|
|
@ -61,7 +61,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
$this->setFrom($email, $name ?: null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the sender.
|
||||
*
|
||||
|
|
@ -71,7 +71,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
return $this->getFrom() ?: false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set Recipient (To:)
|
||||
*
|
||||
|
|
@ -84,7 +84,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
$this->message->setTo(array());
|
||||
return $this->addTo($email, $name ?: null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Recipient (To:)
|
||||
*
|
||||
|
|
@ -95,7 +95,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
$list = $this->getRecipients();
|
||||
return $list ? array_first($list) : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set BCC
|
||||
*
|
||||
|
|
@ -107,7 +107,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
$this->message->setBcc(array());
|
||||
return $this->addBcc($bcc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the Plain content of body message
|
||||
*
|
||||
|
|
@ -117,17 +117,17 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
return chunk_split(base64_encode(htmlspecialchars($this->message->getBody())));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the HTML content of body message
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHTMLContent()
|
||||
{
|
||||
return chunk_split(base64_encode($this->content_type != 'text/html' ? nl2br($this->message->getBody()) : $this->message->getBody()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add file attachment
|
||||
*
|
||||
|
|
@ -139,7 +139,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
return $this->attach($original_filename, $filename);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add content attachment
|
||||
*
|
||||
|
|
@ -151,7 +151,7 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
return $this->embed($original_filename, $cid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the images from attachments
|
||||
*
|
||||
|
|
@ -161,20 +161,20 @@ class Mail extends Rhymix\Framework\Mail
|
|||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the images from body content. This functions is used if Mailer is set as mail not as SMTP
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function procCidAttachments()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if DNS of param is real or fake
|
||||
*
|
||||
*
|
||||
* @param string $email_address Email address to check
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -198,20 +198,20 @@ class Mail extends Rhymix\Framework\Mail
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if this class supports Advanced Mailer features.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAdvancedMailer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if param is a valid email or not
|
||||
*
|
||||
*
|
||||
* @param string $email_address Email address to check
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -13,20 +13,20 @@ class Mobile
|
|||
* @var bool
|
||||
*/
|
||||
protected static $_ismobile = null;
|
||||
|
||||
|
||||
/**
|
||||
* Get instance of Mobile class
|
||||
*
|
||||
*
|
||||
* @return Mobile
|
||||
*/
|
||||
public function getInstance()
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current mobile mode
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFromMobilePhone()
|
||||
|
|
@ -36,13 +36,13 @@ class Mobile
|
|||
{
|
||||
return self::$_ismobile;
|
||||
}
|
||||
|
||||
|
||||
// Not mobile if disabled explicitly.
|
||||
if (!self::isMobileEnabled() || Context::get('full_browse') || ($_COOKIE['FullBrowse'] ?? 0))
|
||||
{
|
||||
return self::$_ismobile = false;
|
||||
}
|
||||
|
||||
|
||||
// Try to detect from URL arguments and cookies, and finally fall back to user-agent detection.
|
||||
$m = Context::get('m');
|
||||
$cookie = isset($_COOKIE['rx_uatype']) ? $_COOKIE['rx_uatype'] : null;
|
||||
|
|
@ -55,7 +55,7 @@ class Mobile
|
|||
{
|
||||
$m = substr($cookie, -1);
|
||||
}
|
||||
|
||||
|
||||
if ($m === '1')
|
||||
{
|
||||
self::$_ismobile = TRUE;
|
||||
|
|
@ -68,7 +68,7 @@ class Mobile
|
|||
{
|
||||
self::$_ismobile = Rhymix\Framework\UA::isMobile() && (config('mobile.tablets') || !Rhymix\Framework\UA::isTablet());
|
||||
}
|
||||
|
||||
|
||||
// Set cookie to prevent recalculation.
|
||||
$uatype = $uahash . ':' . (self::$_ismobile ? '1' : '0');
|
||||
if ($cookie !== $uatype)
|
||||
|
|
@ -76,10 +76,10 @@ class Mobile
|
|||
setcookie('rx_uatype', $uatype, 0, \RX_BASEURL, null, !!config('session.use_ssl_cookies'));
|
||||
$_COOKIE['rx_uatype'] = $uatype;
|
||||
}
|
||||
|
||||
|
||||
return self::$_ismobile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current mobile mode
|
||||
*
|
||||
|
|
@ -89,7 +89,7 @@ class Mobile
|
|||
{
|
||||
return self::isFromMobilePhone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detect mobile device by user agent
|
||||
*
|
||||
|
|
@ -109,7 +109,7 @@ class Mobile
|
|||
{
|
||||
return Rhymix\Framework\UA::isTablet();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set mobile mode
|
||||
*
|
||||
|
|
@ -123,7 +123,7 @@ class Mobile
|
|||
|
||||
/**
|
||||
* Check if mobile view is enabled
|
||||
*
|
||||
*
|
||||
* @raturn bool
|
||||
*/
|
||||
public static function isMobileEnabled()
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class ModuleHandler extends Handler
|
|||
public function init()
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
||||
|
||||
// Check unregistered domain action.
|
||||
if (!$site_module_info || !isset($site_module_info->domain_srl) || ($site_module_info->is_default_replaced ?? false))
|
||||
{
|
||||
|
|
@ -133,17 +133,17 @@ class ModuleHandler extends Handler
|
|||
case 'redirect_301':
|
||||
header('Location: ' . Context::getDefaultUrl($site_module_info) . RX_REQUEST_URL, true, 301);
|
||||
return false;
|
||||
|
||||
|
||||
case 'redirect_302':
|
||||
header('Location: ' . Context::getDefaultUrl($site_module_info) . RX_REQUEST_URL, true, 302);
|
||||
return false;
|
||||
|
||||
|
||||
case 'block':
|
||||
$this->error = 'The site does not exist';
|
||||
$this->error_detail = 'ERR_DOMAIN_NOT_FOUND';
|
||||
$this->httpStatusCode = 404;
|
||||
return true;
|
||||
|
||||
|
||||
case 'display':
|
||||
// pass
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ class ModuleHandler extends Handler
|
|||
Context::set($key, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If the Router returned an error earlier, show an error here.
|
||||
if($this->route && $this->route->status > 200)
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ class ModuleHandler extends Handler
|
|||
$this->httpStatusCode = 404;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Convert document alias (entry) to document_srl
|
||||
if(!$this->document_srl && $this->mid && $this->entry)
|
||||
{
|
||||
|
|
@ -193,7 +193,7 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
$module_info = null;
|
||||
}
|
||||
|
||||
|
||||
// Get module info from mid.
|
||||
if(!$module_info && $this->mid)
|
||||
{
|
||||
|
|
@ -219,7 +219,7 @@ class ModuleHandler extends Handler
|
|||
header('location: ' . getNotEncodedSiteUrl($site_module_info->domain), true, 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// If module info was set, retrieve variables from the module information
|
||||
if($module_info)
|
||||
{
|
||||
|
|
@ -228,7 +228,7 @@ class ModuleHandler extends Handler
|
|||
$this->mid = $module_info->mid;
|
||||
$this->module_info = $module_info;
|
||||
$this->_setModuleSEOInfo($module_info, $site_module_info);
|
||||
|
||||
|
||||
// Check if the current request is from a mobile device.
|
||||
$this->is_mobile = Mobile::isFromMobilePhone();
|
||||
$viewType = $this->is_mobile ? 'M' : 'P';
|
||||
|
|
@ -257,7 +257,7 @@ class ModuleHandler extends Handler
|
|||
|
||||
// Reset layout_srl in module_info.
|
||||
$module_info->{$targetSrl} = $layoutSrl;
|
||||
|
||||
|
||||
// Add layout header script.
|
||||
$part_config = ModuleModel::getModulePartConfig('layout', $layoutSrl);
|
||||
Context::addHtmlHeader($part_config->header_script);
|
||||
|
|
@ -270,7 +270,7 @@ class ModuleHandler extends Handler
|
|||
}
|
||||
|
||||
$this->_setModuleColorScheme($site_module_info);
|
||||
|
||||
|
||||
// Always overwrite site_srl (deprecated)
|
||||
$this->module_info->site_srl = $site_module_info->site_srl;
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
Context::set('mid', $this->mid, TRUE);
|
||||
}
|
||||
|
||||
|
||||
// Call a trigger after moduleHandler init
|
||||
$output = self::triggerCall('moduleHandler.init', 'after', $this->module_info);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -376,7 +376,7 @@ class ModuleHandler extends Handler
|
|||
return self::_createErrorMessage(-1, 'msg_security_violation', 403, 'ERR_CSRF_CHECK_FAILED');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check if the current action allows standalone access (without mid)
|
||||
if(isset($xml_info->action->{$this->act}))
|
||||
{
|
||||
|
|
@ -467,7 +467,7 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
return self::_createErrorMessage(-1, 'msg_invalid_request', 403, 'ERR_NOT_FORWARDABLE');
|
||||
}
|
||||
|
||||
|
||||
// 1. Look for the module with action name
|
||||
if(preg_match('/^[a-z]+([A-Z][a-z0-9\_]+).*$/', $this->act, $matches))
|
||||
{
|
||||
|
|
@ -497,12 +497,12 @@ class ModuleHandler extends Handler
|
|||
$forward->act = $this->act;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(empty($forward->module))
|
||||
{
|
||||
$forward = ModuleModel::getActionForward($this->act);
|
||||
}
|
||||
|
||||
|
||||
if(!empty($forward->module))
|
||||
{
|
||||
$kind = (stripos($forward->act, 'admin') !== false || stripos($forward->class_name, 'admin') !== false) ? 'admin' : '';
|
||||
|
|
@ -514,9 +514,9 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
Context::addMetaTag('robots', 'noindex');
|
||||
}
|
||||
|
||||
|
||||
$xml_info = ModuleModel::getModuleActionXml($forward->module);
|
||||
|
||||
|
||||
// Protect admin action
|
||||
if(($this->module == 'admin' || $kind == 'admin') && !ModuleModel::getGrant($forward, $logged_info)->root)
|
||||
{
|
||||
|
|
@ -525,7 +525,7 @@ class ModuleHandler extends Handler
|
|||
return self::_createErrorMessage(-1, 'admin.msg_is_not_administrator');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SECISSUE also check REQUEST_METHOD for forwarded actions
|
||||
$allowedMethodList = explode('|', $xml_info->action->{$this->act}->method);
|
||||
if(!in_array($_SERVER['REQUEST_METHOD'], $allowedMethodList))
|
||||
|
|
@ -541,7 +541,7 @@ class ModuleHandler extends Handler
|
|||
return self::_createErrorMessage(-1, 'msg_security_violation', 403, 'ERR_CSRF_CHECK_FAILED');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($forward->class_name)
|
||||
{
|
||||
$class_fullname = sprintf('Rhymix\\Modules\\%s\\%s', $forward->module, $forward->class_name);
|
||||
|
|
@ -572,12 +572,12 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
$oModule = self::getModuleInstance($forward->module, $type, $kind);
|
||||
}
|
||||
|
||||
|
||||
if(!is_object($oModule))
|
||||
{
|
||||
return self::_createErrorMessage(-1, 'msg_module_class_not_found', 404);
|
||||
}
|
||||
|
||||
|
||||
// Admin page layout
|
||||
if($this->module == 'admin' && $type == 'view' && $this->act != 'dispLayoutAdminLayoutModify')
|
||||
{
|
||||
|
|
@ -598,7 +598,7 @@ class ModuleHandler extends Handler
|
|||
return $oModule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ruleset check...
|
||||
if(!empty($ruleset))
|
||||
{
|
||||
|
|
@ -668,11 +668,11 @@ class ModuleHandler extends Handler
|
|||
$domain_info = Context::get('site_module_info');
|
||||
if ($domain_info && $domain_info->settings && $domain_info->settings->html_header)
|
||||
{
|
||||
Context::addHtmlHeader($domain_info->settings->html_header);
|
||||
Context::addHtmlHeader($domain_info->settings->html_header);
|
||||
}
|
||||
if ($domain_info && $domain_info->settings && $domain_info->settings->html_footer)
|
||||
{
|
||||
Context::addHtmlFooter($domain_info->settings->html_footer);
|
||||
Context::addHtmlFooter($domain_info->settings->html_footer);
|
||||
}
|
||||
if ($domain_info && $domain_info->settings && $domain_info->settings->title)
|
||||
{
|
||||
|
|
@ -737,7 +737,7 @@ class ModuleHandler extends Handler
|
|||
|
||||
/**
|
||||
* Check the value of $document_srl. This method is called during init().
|
||||
*
|
||||
*
|
||||
* @return object|false
|
||||
*/
|
||||
protected function _checkDocumentSrl()
|
||||
|
|
@ -773,14 +773,14 @@ class ModuleHandler extends Handler
|
|||
Context::set('mid', $this->mid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove module info if a different module has already been selected for the current request.
|
||||
if($this->module && $module_info->module !== $this->module)
|
||||
{
|
||||
$module_info = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Block access to secret or temporary documents.
|
||||
if(Context::getRequestMethod() === 'GET')
|
||||
{
|
||||
|
|
@ -794,14 +794,14 @@ class ModuleHandler extends Handler
|
|||
$this->httpStatusCode = 403;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return the module info for further processing.
|
||||
return $module_info;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set color scheme.
|
||||
*
|
||||
*
|
||||
* @param object $site_module_info
|
||||
*/
|
||||
protected function _setModuleColorScheme($site_module_info)
|
||||
|
|
@ -820,10 +820,10 @@ class ModuleHandler extends Handler
|
|||
Context::addBodyClass('color_scheme_' . $color_scheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set SEO information to Context.
|
||||
*
|
||||
*
|
||||
* @param object $module_info
|
||||
* @param object $site_module_info
|
||||
*/
|
||||
|
|
@ -845,7 +845,7 @@ class ModuleHandler extends Handler
|
|||
'subpage_title' => $module_info->browser_title,
|
||||
'page' => Context::get('page') ?: 1,
|
||||
));
|
||||
|
||||
|
||||
// Set meta keywords.
|
||||
$module_config = ModuleModel::getModuleConfig('module');
|
||||
if (!empty($module_info->meta_keywords))
|
||||
|
|
@ -860,7 +860,7 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
Context::addMetaTag('keywords', $module_config->meta_keywords);
|
||||
}
|
||||
|
||||
|
||||
// Set meta description.
|
||||
if (!empty($module_info->meta_description))
|
||||
{
|
||||
|
|
@ -875,10 +875,10 @@ class ModuleHandler extends Handler
|
|||
Context::addMetaTag('description', $module_config->meta_description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save input values to session so that they can be recovered after returning to the previous form.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function _setInputValueToSession()
|
||||
|
|
@ -893,7 +893,7 @@ class ModuleHandler extends Handler
|
|||
|
||||
/**
|
||||
* Get previous error information and restore it to Context so that it is available to templates.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function _setInputErrorToContext()
|
||||
|
|
@ -905,7 +905,7 @@ class ModuleHandler extends Handler
|
|||
'XE_VALIDATOR_ERROR',
|
||||
'XE_VALIDATOR_RETURN_URL',
|
||||
];
|
||||
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if (!Context::get($key))
|
||||
|
|
@ -913,7 +913,7 @@ class ModuleHandler extends Handler
|
|||
Context::set($key, empty($_SESSION[$key]) ? null : $_SESSION[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($_SESSION['INPUT_ERROR']))
|
||||
{
|
||||
Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
|
||||
|
|
@ -947,7 +947,7 @@ class ModuleHandler extends Handler
|
|||
$caller = array_shift($backtrace);
|
||||
$location = $caller['file'] . ':' . $caller['line'];
|
||||
}
|
||||
|
||||
|
||||
self::_setInputErrorToContext();
|
||||
$oMessageObject = MessageView::getInstance();
|
||||
$oMessageObject->setError($error);
|
||||
|
|
@ -966,7 +966,7 @@ class ModuleHandler extends Handler
|
|||
{
|
||||
// Set the display mode for the current device type.
|
||||
$this->is_mobile = Mobile::isFromMobilePhone();
|
||||
|
||||
|
||||
// If the module is not set or not an object, set error
|
||||
if(!$oModule || !is_object($oModule))
|
||||
{
|
||||
|
|
@ -1006,12 +1006,12 @@ class ModuleHandler extends Handler
|
|||
$data['message'] = lang($oModule->message);
|
||||
}
|
||||
$data = array_merge($data, $oModule->getVariables());
|
||||
|
||||
|
||||
ob_end_clean();
|
||||
echo sprintf('<html><head></head><body><script>parent.XE.handleIframeResponse(%s, %s);</script></body></html>', 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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Purifier
|
|||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
|
||||
public function purify(&$content)
|
||||
{
|
||||
$content = Rhymix\Framework\Filters\HTMLFilter::clean($content);
|
||||
|
|
|
|||
|
|
@ -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']))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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('<!DOCTYPE', $contents) && !starts_with('<?xml', $contents))
|
||||
{
|
||||
$sign = "\n" . '<!-- Template %s : ' . $this->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 = "@(</?{$skip}[a-zA-Z](?>[^<>{}\"]+|<!--.*?-->.*?<!--.*?end-->|{[^}]*}|\"(?>'.*?'|.)*?\"|.)*?>)@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('@^(.+?)(?<![|\s])((?:\|[a-z]{2}[a-z0-9_]+(?::.+)?)+)$@', $m[1], $mm))
|
||||
{
|
||||
|
|
@ -688,10 +688,10 @@ class TemplateHandler
|
|||
{
|
||||
$filters = array();
|
||||
}
|
||||
|
||||
|
||||
// Process the variable.
|
||||
$var = self::_replaceVar($m[1]);
|
||||
|
||||
|
||||
// Apply filters.
|
||||
foreach ($filters as $filter)
|
||||
{
|
||||
|
|
@ -713,7 +713,7 @@ class TemplateHandler
|
|||
{
|
||||
$filter_option = null;
|
||||
}
|
||||
|
||||
|
||||
// Apply each filter.
|
||||
switch ($filter)
|
||||
{
|
||||
|
|
@ -724,60 +724,60 @@ class TemplateHandler
|
|||
case 'noescape':
|
||||
$escape_option = $filter;
|
||||
break;
|
||||
|
||||
|
||||
case 'escapejs':
|
||||
$var = "escape_js({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'json':
|
||||
$var = "json_encode({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'strip':
|
||||
case 'strip_tags':
|
||||
$var = $filter_option ? "strip_tags({$var}, {$filter_option})" : "strip_tags({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'trim':
|
||||
$var = "trim({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'urlencode':
|
||||
$var = "rawurlencode({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'lower':
|
||||
$var = "strtolower({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'upper':
|
||||
$var = "strtoupper({$var})";
|
||||
break;
|
||||
|
||||
|
||||
case 'nl2br':
|
||||
$var = $this->_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 '<?php echo ' . $this->_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('@(?<!\$__Context)->\$([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('@(?<!::|\\\\|\$__Context->|(?<!eval\()\')\$([a-z_][a-z0-9_]*)@i', function($matches) {
|
||||
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|_SESSION|__Context|this|lang)$/', $matches[1]))
|
||||
|
|
@ -1130,13 +1130,13 @@ class TemplateHandler
|
|||
return '$__Context->' . $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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@
|
|||
*/
|
||||
class WidgetHandler
|
||||
{
|
||||
|
||||
var $widget_path = '';
|
||||
|
||||
}
|
||||
/* End of file WidgetHandler.class.php */
|
||||
/* Location: ./classes/widget/WidgetHandler.class.php */
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class XmlJsFilter extends XeXmlParser
|
|||
* Compiled js file
|
||||
* @var string
|
||||
*/
|
||||
var $js_file = NULL; // /
|
||||
var $js_file = NULL; // /
|
||||
|
||||
/**
|
||||
* constructor
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Xml_Node_
|
|||
/**
|
||||
* XmlParser class
|
||||
* Class parsing a given xmlrpc request and creating a data object
|
||||
* @remarks <pre>{
|
||||
* @remarks <pre>{
|
||||
* 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue