Merge pull request #2 from kijin/crazymerge

Crazymerge
This commit is contained in:
CONORY 2015-12-18 13:25:41 +09:00
commit 890a5dbfe9
185 changed files with 3108 additions and 662 deletions

View file

@ -8,9 +8,9 @@ class wap extends mobileXE {
/**
* @brief constructor
**/
function wap()
function __construct()
{
parent::mobileXE();
parent::__construct();
}
/**

View file

@ -9,9 +9,9 @@ class wap extends mobileXE
/**
* @brief constructor
**/
function wap()
function __construct()
{
parent::mobileXE();
parent::__construct();
}
/**

View file

@ -76,7 +76,7 @@ class mobileXE
/**
* @brief constructor
*/
function mobileXE()
function __construct()
{
// Check navigation mode
if(Context::get('nm'))

View file

@ -8,9 +8,9 @@ class wap extends mobileXE
/**
* @brief constructor
*/
function wap()
function __construct()
{
parent::mobileXE();
parent::__construct();
}
/**

View file

@ -7,15 +7,17 @@
function pointLevelIconTrans($matches)
{
$member_srl = $matches[3];
if($member_srl < 1)
// If anonymous or not member_srl go to Hide Point Icon
if($member_srl < 1||!$member_srl)
{
return $matches[0];
}
$orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]);
// Check Group Image Mark
$oMemberModel = getModel('member');
// Check Group Image Mark
if($oMemberModel->getGroupImageMark($member_srl))
{
return $orig_text . $matches[5] . '</' . $matches[6] . '>';

View file

@ -30,7 +30,7 @@ class CacheApc extends CacheBase
*
* @return void
*/
function CacheApc()
function __construct()
{
}

View file

@ -6,7 +6,7 @@
*
* Filedisk Cache Handler
*
* @author NAVER (developers@xpressengine.com)
* @author NAVER (developers@xpressengine.com)
*/
class CacheFile extends CacheBase
{
@ -35,7 +35,7 @@ class CacheFile extends CacheBase
*
* @return void
*/
function CacheFile()
function __construct()
{
$this->cache_dir = _XE_PATH_ . $this->cache_dir;
FileHandler::makeDir($this->cache_dir);
@ -78,10 +78,10 @@ class CacheFile extends CacheBase
$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
$content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
if(function_exists('opcache_invalidate'))
{
@opcache_invalidate($cache_file, true);
}
if(function_exists('opcache_invalidate'))
{
@opcache_invalidate($cache_file, true);
}
}
/**
@ -94,15 +94,15 @@ class CacheFile extends CacheBase
function isValid($key, $modified_time = 0)
{
$cache_file = $this->getCacheFileName($key);
if(file_exists($cache_file))
{
if($modified_time > 0 && filemtime($cache_file) < $modified_timed)
{
FileHandler::removeFile($cache_file);
return false;
}
if($modified_time > 0 && filemtime($cache_file) < $modified_time)
{
FileHandler::removeFile($cache_file);
return false;
}
return true;
}
@ -118,19 +118,19 @@ class CacheFile extends CacheBase
*/
function get($key, $modified_time = 0)
{
if(!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
{
return false;
}
if($modified_time > 0 && filemtime($cache_file) < $modified_timed)
if(!$cache_file = FileHandler::exists($this->getCacheFileName($key)))
{
FileHandler::removeFile($cache_file);
return false;
}
$content = include($cache_file);
if($modified_time > 0 && filemtime($cache_file) < $modified_time)
{
FileHandler::removeFile($cache_file);
return false;
}
$content = include($cache_file);
return unserialize(stripslashes($content));
}
@ -143,10 +143,10 @@ class CacheFile extends CacheBase
function _delete($_key)
{
$cache_file = $this->getCacheFileName($_key);
if(function_exists('opcache_invalidate'))
{
@opcache_invalidate($cache_file, true);
}
if(function_exists('opcache_invalidate'))
{
@opcache_invalidate($cache_file, true);
}
FileHandler::removeFile($cache_file);
}

View file

@ -49,7 +49,7 @@ class CacheHandler extends Handler
* @param boolean $always_use_file If set true, use a file cache always
* @return CacheHandler
*/
function CacheHandler($target, $info = null, $always_use_file = false)
function __construct($target, $info = null, $always_use_file = false)
{
if(!$info)
{
@ -69,6 +69,11 @@ class CacheHandler extends Handler
$type = 'memcache';
$url = $info->use_object_cache;
}
else if(substr($info->use_object_cache, 0, 5) == 'redis')
{
$type = 'redis';
$url = $info->use_object_cache;
}
else if($info->use_object_cache == 'wincache')
{
$type = 'wincache';
@ -93,6 +98,11 @@ class CacheHandler extends Handler
$type = 'memcache';
$url = $info->use_template_cache;
}
else if(substr($info->use_template_cache, 0, 5) == 'redis')
{
$type = 'redis';
$url = $info->use_template_cache;
}
else if($info->use_template_cache == 'wincache')
{
$type = 'wincache';

View file

@ -13,6 +13,7 @@ class CacheMemcache extends CacheBase
* @var Memcahe
*/
var $Memcache;
var $SelectedExtension;
/**
* Get instance of CacheMemcache
@ -36,11 +37,24 @@ class CacheMemcache extends CacheBase
* @param string $url url of memcache
* @return void
*/
function CacheMemcache($url)
function __construct($url)
{
//$config['url'] = array('memcache://localhost:11211');
$config['url'] = is_array($url) ? $url : array($url);
$this->Memcache = new Memcache;
if(class_exists('Memcached'))
{
$this->Memcache = new Memcached;
$this->SelectedExtension = 'Memcached';
}
elseif(class_exists('Memcache'))
{
$this->Memcache = new Memcache;
$this->SelectedExtension = 'Memcache';
}
else
{
return false;
}
foreach($config['url'] as $url)
{
@ -58,19 +72,21 @@ class CacheMemcache extends CacheBase
{
if(isset($GLOBALS['XE_MEMCACHE_SUPPORT']))
{
return true;
return $GLOBALS['XE_MEMCACHE_SUPPORT'];
}
if($this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1))
if($this->SelectedExtension === 'Memcached')
{
$GLOBALS['XE_MEMCACHE_SUPPORT'] = true;
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1);
}
elseif($this->SelectedExtension === 'Memcache')
{
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1);
}
else
{
$GLOBALS['XE_MEMCACHE_SUPPORT'] = false;
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = false;
}
return $GLOBALS['XE_MEMCACHE_SUPPORT'];
}
/**
@ -108,7 +124,14 @@ class CacheMemcache extends CacheBase
$valid_time = $this->valid_time;
}
return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time);
if($this->SelectedExtension === 'Memcached')
{
return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time);
}
else
{
return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time);
}
}
/**

248
classes/cache/CacheRedis.class.php vendored Normal file
View file

@ -0,0 +1,248 @@
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* Cache class for Redis
*
* @author NAVER (developer@xpressengine.com)
*/
class CacheRedis extends CacheBase
{
/**
* instance of Redis
* @var redis
*/
var $redis;
var $status;
/**
* Get instance of CacheRedis
*
* @param string $url url of Redis
* @return CacheRedis instance of CacheRedis
*/
function getInstance($url)
{
if(!$GLOBALS['__CacheRedis__'])
{
$GLOBALS['__CacheRedis__'] = new CacheRedis($url);
}
return $GLOBALS['__CacheRedis__'];
}
/**
* Construct
*
* Do not use this directly. You can use getInstance() instead.
* @param string $url url of Redis
* @return void
*/
function CacheRedis($url)
{
//$config['url'] = 'redis://localhost:6379/1';
$config['url'] = is_array($url) ? reset($url) : $url;
if(!class_exists('Redis'))
{
return $this->status = false;
}
try
{
$this->redis = new Redis;
$info = parse_url($url);
$this->redis->connect($info['host'], $info['port'], 0.15);
if(isset($info['user']) || isset($info['pass']))
{
$this->redis->auth(isset($info['user']) ? $info['user'] : $info['pass']);
}
if(isset($info['path']) && $dbnum = intval(substr($info['path'], 1)))
{
$this->redis->select($dbnum);
}
return $this->status = true;
}
catch(RedisException $e)
{
return $this->status = false;
}
}
/**
* Return whether support or not support cache
*
* @return bool Return true on support or false on not support
*/
function isSupport()
{
if($this->status !== null)
{
return $this->status;
}
try
{
return $this->redis->setex('xe', 1, 'xe');
}
catch(RedisException $e)
{
return $this->status = false;
}
}
/**
* Get unique key of given key by path of XE
*
* @param string $key Cache key
* @return string Return unique key
*/
function getKey($key)
{
static $prefix = null;
if($prefix === null)
{
$prefix = substr(sha1(_XE_PATH_), 0, 12) . ':';
}
return $prefix . $key;
}
/**
* Store data at the server
*
* CacheRedis::put() stores an item $buff with $key on the Redis server.
* Parameter $valid_time is expiration time in seconds. If it's 0, the item never expires
* (but Redis server doesn't guarantee this item to be stored all the time, it could be delete from the cache to make place for other items).
*
* Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache,
* because they can not be adequately represented in serialized state.
*
* @param string $key The key that will be associated with the item.
* @param mixed $buff The variable to store. Strings and integers are stored as is, other types are stored serialized.
* @param int $valid_time Expiration time of the item.
* You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).
* If it's equal to zero, use the default valid time CacheRedis::valid_time.
* @return bool Returns true on success or false on failure.
*/
function put($key, $buff, $valid_time = 0)
{
if($valid_time > 60 * 60 * 24 * 30)
{
$valid_time = $valid_time - time();
}
if($valid_time <= 0)
{
$valid_time = $this->valid_time;
}
try
{
return $this->redis->setex($this->getKey($key), $valid_time, serialize(array($_SERVER['REQUEST_TIME'], $buff)));
}
catch(RedisException $e)
{
return $this->status = false;
}
}
/**
* Return whether cache is valid or invalid
*
* @param string $key Cache key
* @param int $modified_time Unix time of data modified.
* If stored time is older then modified time, the data is invalid.
* @return bool Return true on valid or false on invalid.
*/
function isValid($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->redis->get($_key);
$obj = $obj ? unserialize($obj) : false;
if(!$obj || !is_array($obj))
{
return false;
}
unset($obj[1]);
if($modified_time > 0 && $modified_time > $obj[0])
{
$this->redis->del($_key);
return false;
}
return true;
}
/**
* Retrieve item from the server
*
* CacheRedis::get() returns previously stored data if an item with such $key exists on the server at this moment.
*
* @param string $key The key to fetch
* @param int $modified_time Unix time of data modified.
* If stored time is older then modified time, return false.
* @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success.
*/
function get($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->redis->get($_key);
$obj = $obj ? unserialize($obj) : false;
if(!$obj || !is_array($obj))
{
return false;
}
if($modified_time > 0 && $modified_time > $obj[0])
{
$this->redis->del($_key);
return false;
}
return $obj[1];
}
/**
* Delete item from the server
*
* CacheRedis::delete() deletes an item with tey $key.
*
* @param string $key The key associated with the item to delete.
* @return void
*/
function delete($key)
{
$_key = $this->getKey($key);
try
{
$this->redis->del($_key);
}
catch(RedisException $e)
{
return $this->status = false;
}
}
/**
* Flush all existing items at the server
*
* CacheRedis::truncate() immediately invalidates all existing items.
* If using multiple databases, items in other databases are not affected.
*
* @return bool Returns true on success or false on failure.
*/
function truncate()
{
try
{
return $this->redis->flushDB();
}
catch(RedisException $e)
{
return $this->status = false;
}
}
}
/* End of file CacheRedis.class.php */
/* Location: ./classes/cache/CacheRedis.class.php */

View file

@ -32,7 +32,7 @@ class CacheWincache extends CacheBase
*
* @return void
*/
function CacheWincache()
function __construct()
{
}

View file

@ -159,7 +159,7 @@ class Context
*
* @return object Instance
*/
function &getInstance()
public static function &getInstance()
{
static $theInstance = null;
if(!$theInstance)
@ -175,7 +175,7 @@ class Context
*
* @return void
*/
function Context()
public function __construct()
{
$this->oFrontEndFileHandler = new FrontEndFileHandler();
$this->get_vars = new stdClass();
@ -198,7 +198,7 @@ class Context
* @see This function should be called only once
* @return void
*/
function init()
public function init()
{
if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) {
if(simplexml_load_string(file_get_contents("php://input")) !== false) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
@ -334,8 +334,29 @@ class Context
);
}
if($sess = $_POST[session_name()]) session_id($sess);
session_start();
// start session if it was previously started
$session_name = session_name();
$session_id = NULL;
if($session_id = $_POST[$session_name])
{
session_id($session_id);
}
else
{
$session_id = $_COOKIE[$session_name];
}
if($session_id !== NULL || $this->db_info->cache_friendly != 'Y')
{
$this->setCacheControl(0, false);
session_start();
}
else
{
$this->setCacheControl(-1, true);
register_shutdown_function(array($this, 'checkSessionStatus'));
$_SESSION = array();
}
// set authentication information in Context and session
if(self::isInstalled())
@ -421,22 +442,78 @@ class Context
}
}
/**
* Get the session status
*
* @return bool
*/
function getSessionStatus()
{
return (session_id() !== '');
}
/**
* Start the session if $_SESSION was touched
*
* @return void
*/
function checkSessionStatus($force_start = false)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
if($self->getSessionStatus())
{
return;
}
if($force_start || (count($_SESSION) && !headers_sent()))
{
$tempSession = $_SESSION;
unset($_SESSION);
session_start();
$_SESSION = $tempSession;
}
}
/**
* Finalize using resources, such as DB connection
*
* @return void
*/
function close()
public static function close()
{
session_write_close();
}
/**
* set Cache-Control header
*
* @return void
*/
function setCacheControl($ttl = 0, $public = true)
{
if($ttl == 0)
{
header('Cache-Control: ' . ($public ? 'public, ' : 'private, ') . 'must-revalidate, post-check=0, pre-check=0, no-store, no-cache');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
}
elseif($ttl == -1)
{
header('Cache-Control: ' . ($public ? 'public, ' : 'private, ') . 'must-revalidate, post-check=0, pre-check=0');
}
else
{
header('Cache-Control: ' . ($public ? 'public, ' : 'private, ') . 'must-revalidate, max-age=' . (int)$ttl);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + (int)$ttl) . ' GMT');
}
}
/**
* Load the database information
*
* @return void
*/
function loadDBInfo()
public static function loadDBInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -499,7 +576,7 @@ class Context
$db_info->use_db_session = 'N';
if(!$db_info->use_ssl)
$db_info->use_ssl = 'none';
$this->set('_use_ssl', $db_info->use_ssl);
$self->set('_use_ssl', $db_info->use_ssl);
$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
@ -520,7 +597,7 @@ class Context
*
* @return string DB's db_type
*/
function getDBType()
public static function getDBType()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->db_info->master_db["db_type"];
@ -532,7 +609,7 @@ class Context
* @param object $db_info DB information
* @return void
*/
function setDBInfo($db_info)
public static function setDBInfo($db_info)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->db_info = $db_info;
@ -543,7 +620,7 @@ class Context
*
* @return object DB information
*/
function getDBInfo()
public static function getDBInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->db_info;
@ -554,7 +631,7 @@ class Context
*
* @return object SSL status (Optional - none|always|optional)
*/
function getSslStatus()
public static function getSslStatus()
{
$dbInfo = self::getDBInfo();
return $dbInfo->use_ssl;
@ -565,7 +642,7 @@ class Context
*
* @return string Default URL
*/
function getDefaultUrl()
public static function getDefaultUrl()
{
$db_info = self::getDBInfo();
return $db_info->default_url;
@ -576,7 +653,7 @@ class Context
*
* @return array Supported languages
*/
function loadLangSupported()
public static function loadLangSupported()
{
static $lang_supported = null;
if(!$lang_supported)
@ -597,7 +674,7 @@ class Context
*
* @return array Selected languages
*/
function loadLangSelected()
public static function loadLangSelected()
{
static $lang_selected = null;
if(!$lang_selected)
@ -635,7 +712,7 @@ class Context
*
* @return bool True : Module handling is necessary in the control path of current request , False : Otherwise
*/
function checkSSO()
public function checkSSO()
{
// pass if it's not GET request or XE is not yet installed
if($this->db_info->use_sso != 'Y' || isCrawler())
@ -660,53 +737,68 @@ class Context
$default_url .= '/';
}
// for sites recieving SSO valdiation
if($default_url == self::getRequestUri())
// Get current site information (only the base URL, not the full URL)
$current_site = self::getRequestUri();
// Step 1: if the current site is not the default site, send SSO validation request to the default site
if($default_url !== $current_site && !self::get('SSOID') && $_COOKIE['sso'] !== md5($current_site))
{
if(self::get('default_url'))
{
$url = base64_decode(self::get('default_url'));
$url_info = parse_url($url);
$oModuleModel = getModel('module');
$target_domain = (stripos($url, $default_url) !== 0) ? $url_info['host'] : $default_url;
$site_info = $oModuleModel->getSiteInfoByDomain($target_domain);
if(!$site_info->site_srl) {
$oModuleObject = new ModuleObject();
$oModuleObject->stop('msg_invalid_request');
return false;
}
$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
header('location:' . $redirect_url);
return FALSE;
}
// for sites requesting SSO validation
}
else
{
// result handling : set session_name()
if($session_name = self::get('SSOID'))
{
setcookie(session_name(), $session_name);
$url = preg_replace('/([\?\&])$/', '', str_replace('SSOID=' . $session_name, '', self::getRequestUrl()));
header('location:' . $url);
return FALSE;
// send SSO request
}
else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
{
setcookie('sso', md5(self::getRequestUri()), 0, '/');
$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl()));
header('location:' . $url);
return FALSE;
}
// Set sso cookie to prevent multiple simultaneous SSO validation requests
setcookie('sso', md5($current_site), 0, '/');
// Redirect to the default site
$redirect_url = sprintf('%s?return_url=%s', $default_url, urlencode(base64_encode($current_site)));
header('Location:' . $redirect_url);
return FALSE;
}
// Step 2: receive and process SSO validation request at the default site
if($default_url === $current_site && self::get('return_url'))
{
// Get the URL of the origin site
$url = base64_decode(self::get('return_url'));
$url_info = parse_url($url);
// Check that the origin site is a valid site in this XE installation (to prevent open redirect vuln)
if(!getModel('module')->getSiteInfoByDomain(rtrim($url, '/'))->site_srl)
{
htmlHeader();
echo self::getLang("msg_invalid_request");
htmlFooter();
return FALSE;
}
// Redirect back to the origin site
$url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
$redirect_url = sprintf('%s://%s%s%s%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? (':' . $url_info['port']) : '', $url_info['path'], ($url_info['query'] ? ('?' . $url_info['query']) : ''));
header('Location:' . $redirect_url);
return FALSE;
}
// Step 3: back at the origin site, set session ID to be the same as the default site
if($default_url !== $current_site && self::get('SSOID'))
{
// Check that the session ID was given by the default site (to prevent session fixation CSRF)
if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $default_url) !== 0)
{
htmlHeader();
echo self::getLang("msg_invalid_request");
htmlFooter();
return FALSE;
}
// Set session ID
setcookie(session_name(), self::get('SSOID'));
// Finally, redirect to the originally requested URL
$url_info = parse_url(self::getRequestUrl());
$url_info['query'] = preg_replace('/(^|\b)SSOID=([^&?]+)/', '', $url_info['query']);
$redirect_url = sprintf('%s://%s%s%s%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? (':' . $url_info['port']) : '', $url_info['path'], ($url_info['query'] ? ('?' . $url_info['query']) : ''));
header('Location:' . $redirect_url);
return FALSE;
}
// If none of the conditions above apply, proceed normally
return TRUE;
}
@ -715,7 +807,7 @@ class Context
*
* @return bool True: FTP information is registered, False: otherwise
*/
function isFTPRegisted()
public static function isFTPRegisted()
{
return file_exists(self::getFTPConfigFile());
}
@ -725,7 +817,7 @@ class Context
*
* @return object FTP information
*/
function getFTPInfo()
public static function getFTPInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -745,7 +837,7 @@ class Context
* @param string $site_title Browser title to be added
* @return void
*/
function addBrowserTitle($site_title)
public static function addBrowserTitle($site_title)
{
if(!$site_title)
{
@ -769,7 +861,7 @@ class Context
* @param string $site_title Browser title to be set
* @return void
*/
function setBrowserTitle($site_title)
public static function setBrowserTitle($site_title)
{
if(!$site_title)
{
@ -784,7 +876,7 @@ class Context
*
* @return string Browser title(htmlspecialchars applied)
*/
function getBrowserTitle()
public static function getBrowserTitle()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -798,7 +890,7 @@ class Context
* Return layout's title
* @return string layout's title
*/
public function getSiteTitle()
public static function getSiteTitle()
{
$oModuleModel = getModel('module');
$moduleConfig = $oModuleModel->getModuleConfig('module');
@ -814,7 +906,7 @@ class Context
* Get browser title
* @deprecated
*/
function _getBrowserTitle()
public function _getBrowserTitle()
{
return $this->getBrowserTitle();
}
@ -825,7 +917,7 @@ class Context
* @param string $path Path of the language file
* @return void
*/
function loadLang($path)
public static function loadLang($path)
{
global $lang;
@ -870,7 +962,7 @@ class Context
* @param string Path of the language file
* @return void
*/
function _evalxmlLang($path)
public function _evalxmlLang($path)
{
global $lang;
@ -904,7 +996,7 @@ class Context
* @param string $path Path of the language file
* @return string file name
*/
function _loadXmlLang($path)
public function _loadXmlLang($path)
{
if(!$path) return;
@ -918,7 +1010,7 @@ class Context
* @param string $path Path of the language file
* @return string file name
*/
function _loadPhpLang($path)
public function _loadPhpLang($path)
{
if(!$path) return;
@ -948,14 +1040,17 @@ class Context
* @param string $lang_type Language type.
* @return void
*/
function setLangType($lang_type = 'ko')
public static function setLangType($lang_type = 'ko')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->lang_type = $lang_type;
$self->set('lang_type', $lang_type);
$_SESSION['lang_type'] = $lang_type;
if($self->getSessionStatus())
{
$_SESSION['lang_type'] = $lang_type;
}
}
/**
@ -963,7 +1058,7 @@ class Context
*
* @return string Language type
*/
function getLangType()
public static function getLangType()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->lang_type;
@ -975,7 +1070,7 @@ class Context
* @param string $code Language variable name
* @return string If string for the code exists returns it, otherwise returns original code
*/
function getLang($code)
public static function getLang($code)
{
if(!$code)
{
@ -995,7 +1090,7 @@ class Context
* @param string $val `$code`s value
* @return void
*/
function setLang($code, $val)
public static function setLang($code, $val)
{
if(!isset($GLOBALS['lang']))
{
@ -1010,7 +1105,7 @@ class Context
* @param object $source_obj Conatins strings to convert
* @return object converted object
*/
function convertEncoding($source_obj)
public static function convertEncoding($source_obj)
{
$charset_list = array(
'UTF-8', 'EUC-KR', 'CP949', 'ISO8859-1', 'EUC-JP', 'SHIFT_JIS', 'CP932',
@ -1051,7 +1146,7 @@ class Context
* @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
* @return void
*/
function checkConvertFlag(&$val, $key = null, $charset = null)
public static function checkConvertFlag(&$val, $key = null, $charset = null)
{
static $flag = TRUE;
if($charset)
@ -1078,7 +1173,7 @@ class Context
* @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
* @return object converted object
*/
function doConvertEncoding(&$val, $key = null, $charset)
public static function doConvertEncoding(&$val, $key = null, $charset)
{
if (is_array($val))
{
@ -1093,7 +1188,7 @@ class Context
* @param string $str String to convert
* @return string converted string
*/
function convertEncodingStr($str)
public static function convertEncodingStr($str)
{
if(!$str) return null;
$obj = new stdClass();
@ -1120,7 +1215,7 @@ class Context
* @param string $method Response method. [HTML|XMLRPC|JSON]
* @return void
*/
function setResponseMethod($method = 'HTML')
public static function setResponseMethod($method = 'HTML')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1133,7 +1228,7 @@ class Context
*
* @return string Response method. If it's not set, returns request method.
*/
function getResponseMethod()
public static function getResponseMethod()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1154,7 +1249,7 @@ class Context
* @param string $type Request method. (Optional - GET|POST|XMLRPC|JSON)
* @return void
*/
function setRequestMethod($type = '')
public static function setRequestMethod($type = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1172,7 +1267,7 @@ class Context
*
* @return void
*/
function _checkGlobalVars()
public function _checkGlobalVars()
{
$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
@ -1188,7 +1283,7 @@ class Context
*
* @return void
*/
function _setRequestArgument()
public function _setRequestArgument()
{
if(!count($_REQUEST))
{
@ -1231,7 +1326,7 @@ class Context
}
}
function _recursiveCheckVar($val)
public function _recursiveCheckVar($val)
{
if(is_string($val))
{
@ -1258,7 +1353,7 @@ class Context
*
* @return void
*/
function _setJSONRequestArgument()
public function _setJSONRequestArgument()
{
if($this->getRequestMethod() != 'JSON')
{
@ -1279,7 +1374,7 @@ class Context
*
* @return void
*/
function _setXmlRpcArgument()
public function _setXmlRpcArgument()
{
if($this->getRequestMethod() != 'XMLRPC')
{
@ -1370,7 +1465,7 @@ class Context
* @param string $do_stripslashes Whether to strip slashes
* @return mixed filtered value. Type are string or array
*/
function _filterRequestVar($key, $val, $do_stripslashes = 1)
public function _filterRequestVar($key, $val, $do_stripslashes = 1)
{
if(!($isArray = is_array($val)))
{
@ -1417,7 +1512,7 @@ class Context
*
* @return bool True: exists, False: otherwise
*/
function isUploaded()
public static function isUploaded()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->is_uploaded;
@ -1428,7 +1523,7 @@ class Context
*
* @return void
*/
function _setUploadedArgument()
public function _setUploadedArgument()
{
if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
{
@ -1471,7 +1566,7 @@ class Context
* Return request method
* @return string Request method type. (Optional - GET|POST|XMLRPC|JSON)
*/
function getRequestMethod()
public static function getRequestMethod()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->request_method;
@ -1481,7 +1576,7 @@ class Context
* Return request URL
* @return string request URL
*/
function getRequestUrl()
public static function getRequestUrl()
{
static $url = null;
if(is_null($url))
@ -1503,7 +1598,7 @@ class Context
* Return js callback func.
* @return string callback func.
*/
function getJSCallbackFunc()
public static function getJSCallbackFunc()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
@ -1528,7 +1623,7 @@ class Context
* @param bool $autoEncode If TRUE, url encode automatically, detailed. Use this option, $encode value should be TRUE
* @return string URL
*/
function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE)
public static function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE)
{
static $site_module_info = null;
static $current_info = null;
@ -1770,7 +1865,7 @@ class Context
* @param string $domain Domain
* @retrun string converted URL
*/
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null)
public static function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null)
{
static $url = array();
@ -1869,7 +1964,7 @@ class Context
* @param mixed $set_to_get_vars If not FALSE, Set to get vars.
* @return void
*/
function set($key, $val, $set_to_get_vars = 0)
public static function set($key, $val, $set_to_get_vars = 0)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->context->{$key} = $val;
@ -1894,7 +1989,7 @@ class Context
* @param string $key Key
* @return string Key
*/
function get($key)
public static function get($key)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1910,7 +2005,7 @@ class Context
*
* @return object
*/
function gets()
public static function gets()
{
$num_args = func_num_args();
if($num_args < 1)
@ -1933,7 +2028,7 @@ class Context
*
* @return object All data
*/
function getAll()
public static function getAll()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->context;
@ -1944,7 +2039,7 @@ class Context
*
* @return Object Request variables.
*/
function getRequestVars()
public static function getRequestVars()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
if($self->get_vars)
@ -1960,7 +2055,7 @@ class Context
* @param string $action act name
* @return void
*/
function addSSLAction($action)
public static function addSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1984,7 +2079,7 @@ class Context
* @param string $action act name
* @return void
*/
function addSSLActions($action_array)
public static function addSSLActions($action_array)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -2012,7 +2107,7 @@ class Context
* @param string $action act name
* @return void
*/
function subtractSSLAction($action)
public static function subtractSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -2030,7 +2125,7 @@ class Context
*
* @return string acts in array
*/
function getSSLActions()
public static function getSSLActions()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
if($self->getSslStatus() == 'optional')
@ -2045,7 +2140,7 @@ class Context
* @param string $action act name
* @return bool If SSL exists, return TRUE.
*/
function isExistsSSLAction($action)
public static function isExistsSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return isset($self->ssl_actions[$action]);
@ -2058,7 +2153,7 @@ class Context
* @param string $file file path
* @return string normalized file path
*/
function normalizeFilePath($file)
public static function normalizeFilePath($file)
{
if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
{
@ -2080,7 +2175,7 @@ class Context
* @param string $file file path
* @return string Converted file path
*/
function getAbsFileUrl($file)
public static function getAbsFileUrl($file)
{
$file = self::normalizeFilePath($file);
if(strpos($file, './') === 0)
@ -2111,7 +2206,7 @@ class Context
* $args[3]: index
*
*/
function loadFile($args)
public static function loadFile($args)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -2126,7 +2221,7 @@ class Context
* @param string $media Media query
* @return void
*/
function unloadFile($file, $targetIe = '', $media = 'all')
public static function unloadFile($file, $targetIe = '', $media = 'all')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetIe, $media);
@ -2138,7 +2233,7 @@ class Context
* @param string $type Unload target (optional - all|css|js)
* @return void
*/
function unloadAllFiles($type = 'all')
public static function unloadAllFiles($type = 'all')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles($type);
@ -2157,7 +2252,7 @@ class Context
* @param string $autoPath If path not readed, set the path automatically.
* @return void
*/
function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
public static function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
{
if($isRuleset)
{
@ -2187,7 +2282,7 @@ class Context
* @param string $targetie target IE
* @return void
*/
function unloadJsFile($file, $optimized = FALSE, $targetie = '')
public static function unloadJsFile($file, $optimized = FALSE, $targetie = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie);
@ -2198,7 +2293,7 @@ class Context
*
* @return void
*/
function unloadAllJsFiles()
public static function unloadAllJsFiles()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles('js');
@ -2211,7 +2306,7 @@ class Context
* @param string $filename File name
* @return void
*/
function addJsFilter($path, $filename)
public static function addJsFilter($path, $filename)
{
$oXmlFilter = new XmlJSFilter($path, $filename);
$oXmlFilter->compile();
@ -2224,7 +2319,7 @@ class Context
* @param array $files File list
* @return array File list
*/
function _getUniqueFileList($files)
public static function _getUniqueFileList($files)
{
ksort($files);
$files = array_values($files);
@ -2247,7 +2342,7 @@ class Context
* @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
* @return array Returns javascript file list. Array contains file, targetie.
*/
function getJsFile($type = 'head')
public static function getJsFile($type = 'head')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->oFrontEndFileHandler->getJsFileList($type);
@ -2265,7 +2360,7 @@ class Context
* @return void
*
*/
function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0)
public static function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->loadFile(array($file, $media, $targetie, $index));
@ -2281,7 +2376,7 @@ class Context
* @param string $targetie target IE
* @return void
*/
function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '')
public static function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie, $media);
@ -2292,7 +2387,7 @@ class Context
*
* @return void
*/
function unloadAllCSSFiles()
public static function unloadAllCSSFiles()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles('css');
@ -2303,7 +2398,7 @@ class Context
*
* @return array Returns css file list. Array contains file, media, targetie.
*/
function getCSSFile()
public static function getCSSFile()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->oFrontEndFileHandler->getCssFileList();
@ -2314,7 +2409,7 @@ class Context
* @param string $pluginName
* @return stdClass
*/
function getJavascriptPluginInfo($pluginName)
public static function getJavascriptPluginInfo($pluginName)
{
if($plugin_name == 'ui.datepicker')
{
@ -2369,7 +2464,7 @@ class Context
* @param string $plugin_name plugin name
* @return void
*/
function loadJavascriptPlugin($plugin_name)
public static function loadJavascriptPlugin($plugin_name)
{
static $loaded_plugins = array();
@ -2427,13 +2522,13 @@ class Context
* @param string $header add html code before </head>.
* @return void
*/
function addHtmlHeader($header)
public static function addHtmlHeader($header)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_header .= "\n" . $header;
}
function clearHtmlHeader()
public static function clearHtmlHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_header = '';
@ -2444,7 +2539,7 @@ class Context
*
* @return string Added html code before </head>
*/
function getHtmlHeader()
public static function getHtmlHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->html_header;
@ -2455,7 +2550,7 @@ class Context
*
* @param string $class_name class name
*/
function addBodyClass($class_name)
public static function addBodyClass($class_name)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_class[] = $class_name;
@ -2466,7 +2561,7 @@ class Context
*
* @return string Return class to html body
*/
function getBodyClass()
public static function getBodyClass()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_class = array_unique($self->body_class);
@ -2479,7 +2574,7 @@ class Context
*
* @param string $header Add html code after <body>
*/
function addBodyHeader($header)
public static function addBodyHeader($header)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_header .= "\n" . $header;
@ -2490,7 +2585,7 @@ class Context
*
* @return string Added html code after <body>
*/
function getBodyHeader()
public static function getBodyHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->body_header;
@ -2501,7 +2596,7 @@ class Context
*
* @param string $footer Add html code before </body>
*/
function addHtmlFooter($footer)
public static function addHtmlFooter($footer)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
@ -2512,7 +2607,7 @@ class Context
*
* @return string Added html code before </body>
*/
function getHtmlFooter()
public static function getHtmlFooter()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->html_footer;
@ -2523,7 +2618,7 @@ class Context
*
* @retrun string The path of the config file that contains database settings
*/
function getConfigFile()
public static function getConfigFile()
{
return _XE_PATH_ . 'files/config/db.config.php';
}
@ -2533,7 +2628,7 @@ class Context
*
* @return string The path of the config file that contains FTP settings
*/
function getFTPConfigFile()
public static function getFTPConfigFile()
{
return _XE_PATH_ . 'files/config/ftp.config.php';
}
@ -2543,7 +2638,7 @@ class Context
*
* @return bool True if the config file exists, otherwise FALSE.
*/
function isInstalled()
public static function isInstalled()
{
return FileHandler::hasContent(self::getConfigFile());
}
@ -2554,7 +2649,7 @@ class Context
* @param string Transforms codes
* @return string Transforms codes
*/
function transContent($content)
public static function transContent($content)
{
return $content;
}
@ -2564,7 +2659,7 @@ class Context
*
* @return bool True if it is allowed to use rewrite mod, otherwise FALSE
*/
function isAllowRewrite()
public static function isAllowRewrite()
{
$oContext = self::getInstance();
return $oContext->allow_rewrite;
@ -2576,7 +2671,7 @@ class Context
* @param string $path URL path
* @return string Converted path
*/
function pathToUrl($path)
public static function pathToUrl($path)
{
$xe = _XE_PATH_;
$path = strtr($path, "\\", "/");
@ -2631,7 +2726,7 @@ class Context
* Get meta tag
* @return array The list of meta tags
*/
function getMetaTag()
public static function getMetaTag()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -2658,7 +2753,7 @@ class Context
* @param mixed $is_http_equiv value of http_equiv
* @return void
*/
function addMetaTag($name, $content, $is_http_equiv = FALSE)
public static function addMetaTag($name, $content, $is_http_equiv = FALSE)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;

View file

@ -185,7 +185,7 @@ class DB
* constructor
* @return void
*/
function DB()
function __construct()
{
$this->count_cache_path = _XE_PATH_ . $this->count_cache_path;
$this->cache_file = _XE_PATH_ . $this->cache_file;

View file

@ -49,7 +49,7 @@ class DBCubrid extends DB
* constructor
* @return void
*/
function DBCubrid()
function __construct()
{
$this->_setDBInfo();
$this->_connect();
@ -539,6 +539,68 @@ class DBCubrid extends DB
$this->_query($query);
}
/**
* Modify a column (only supported in CUBRID 8.4 and above, otherwise returns false)
* @param string $table_name table name
* @param string $column_name column name
* @param string $type column type, default value is 'number'
* @param int $size column size
* @param string|int $default default value
* @param boolean $notnull not null status, default value is false
* @return bool
*/
function modifyColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = FALSE)
{
if(!version_compare(__CUBRID_VERSION__, '8.4.0', '>='))
{
return false;
}
$type = strtoupper($this->column_type[$type]);
if($type == 'INTEGER')
{
$size = '';
}
$query = sprintf("alter class \"%s%s\" modify \"%s\" ", $this->prefix, $table_name, $column_name);
if($type == 'char' || $type == 'varchar')
{
if($size)
{
$size = $size * 3;
}
}
if($size)
{
$query .= sprintf("%s(%s) ", $type, $size);
}
else
{
$query .= sprintf("%s ", $type);
}
if($default)
{
if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
{
$query .= sprintf("default %d ", $default);
}
else
{
$query .= sprintf("default '%s' ", $default);
}
}
if($notnull)
{
$query .= "not null ";
}
return $this->_query($query) ? true : false;
}
/**
* Check column exist status of the table
* @param string $table_name table name
@ -567,6 +629,62 @@ class DBCubrid extends DB
return $output;
}
/**
* Get information about a column
* @param string $table_name table name
* @param string $column_name column name
* @return object
*/
function getColumnInfo($table_name, $column_name)
{
$query = sprintf("select * from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
$result = $this->_query($query);
if($this->isError())
{
return;
}
$output = $this->_fetch($result);
if($output)
{
$dbtype = strtolower($output->data_type);
if($dbtype === 'string') $dbtype = 'character varying';
$size = ($output->prec > 0) ? $output->prec : null;
if($xetype = array_search("$dbtype($size)", $this->column_type))
{
$dbtype = "$dbtype($size)";
$size = null;
}
elseif($size !== null)
{
if($xetype = array_search($dbtype, $this->column_type))
{
if($size % 3 == 0) $size = intval($size / 3);
}
else
{
$xetype = $dbtype;
}
}
else
{
$xetype = $dbtype;
$size = null;
}
return (object)array(
'name' => $output->attr_name,
'dbtype' => $dbtype,
'xetype' => $xetype,
'size' => $size,
'default_value' => $output->default_value,
'notnull' => !$output->is_nullable,
);
}
else
{
return false;
}
}
/**
* Add an index to the table
* $target_columns = array(col1, col2)

View file

@ -42,7 +42,7 @@ class DBMssql extends DB
* Constructor
* @return void
*/
function DBMssql()
function __construct()
{
$this->_setDBInfo();
$this->_connect();
@ -389,7 +389,7 @@ class DBMssql extends DB
$size = '';
}
$query = sprintf("alter table %s%s add %s ", $this->prefix, $table_name, $column_name);
$query = sprintf("alter table %s%s add \"%s\" ", $this->prefix, $table_name, $column_name);
if($size)
{
$query .= sprintf(" %s(%s) ", $type, $size);
@ -423,10 +423,50 @@ class DBMssql extends DB
{
return;
}
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
$query = sprintf("alter table %s%s drop column \"%s\" ", $this->prefix, $table_name, $column_name);
$this->_query($query);
}
/**
* Modify a column
* @param string $table_name table name
* @param string $column_name column name
* @param string $type column type, default value is 'number'
* @param int $size column size
* @param string|int $default default value
* @param boolean $notnull not null status, default value is false
* @return bool
*/
function modifyColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false)
{
$type = $this->column_type[$type];
if(strtoupper($type) == 'INTEGER')
{
$size = '';
}
$query = sprintf("alter table %s%s alter column %s ", $this->prefix, $table_name, $column_name);
if($size)
{
$query .= sprintf(" %s(%s) ", $type, $size);
}
else
{
$query .= sprintf(" %s ", $type);
}
if($default)
{
$query .= sprintf(" default '%s' ", $default);
}
if($notnull)
{
$query .= " not null ";
}
return $this->_query($query) ? true : false;
}
/**
* Check column exist status of the table
* @param string $table_name table name
@ -448,7 +488,67 @@ class DBMssql extends DB
}
return true;
}
/**
* Get information about a column
* @param string $table_name table name
* @param string $column_name column name
* @return object
*/
function getColumnInfo($table_name, $column_name)
{
$query = sprintf("select syscolumns.name as name, systypes.name as type_name, syscolumns.length as length, " .
"syscolumns.isnullable as isnullable, syscomments.text as default_value from syscolumns " .
"inner join sysobjects on sysobjects.id = syscolumns.id " .
"inner join systypes on systypes.xtype = syscolumns.xtype " .
"left join syscomments on syscolumns.cdefault = syscomments.id " .
"where sysobjects.name = '%s%s' and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name);
$result = $this->_query($query);
if($this->isError())
{
return;
}
$output = $this->_fetch($result);
if($output)
{
$dbtype = $output->type_name;
$size = ($output->length > 0) ? $output->length : null;
if($xetype = array_search("$dbtype($size)", $this->column_type))
{
$dbtype = "$dbtype($size)";
$size = null;
}
elseif($size !== null)
{
if($xetype = array_search($dbtype, $this->column_type))
{
// no-op
}
else
{
$xetype = $dbtype;
}
}
else
{
$xetype = $dbtype;
$size = null;
}
return (object)array(
'name' => $output->name,
'dbtype' => $dbtype,
'xetype' => $xetype,
'size' => $size,
'default_value' => $output->default_value,
'notnull' => !$output->isnullable,
);
}
else
{
return false;
}
}
/**
* Add an index to the table
* $target_columns = array(col1, col2)

View file

@ -43,7 +43,7 @@ class DBMysql extends DB
* Constructor
* @return void
*/
function DBMysql()
function __construct()
{
$this->_setDBInfo();
$this->_connect();
@ -340,6 +340,45 @@ class DBMysql extends DB
$this->_query($query);
}
/**
* Modify a column
* @param string $table_name table name
* @param string $column_name column name
* @param string $type column type, default value is 'number'
* @param int $size column size
* @param string|int $default default value
* @param boolean $notnull not null status, default value is false
* @return bool
*/
function modifyColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false)
{
$type = $this->column_type[$type];
if(strtoupper($type) == 'INTEGER')
{
$size = '';
}
$query = sprintf("alter table `%s%s` modify `%s` ", $this->prefix, $table_name, $column_name);
if($size)
{
$query .= sprintf(" %s(%s) ", $type, $size);
}
else
{
$query .= sprintf(" %s ", $type);
}
if($default)
{
$query .= sprintf(" default '%s' ", $default);
}
if($notnull)
{
$query .= " not null ";
}
return $this->_query($query) ? true : false;
}
/**
* Check column exist status of the table
* @param string $table_name table name
@ -370,6 +409,61 @@ class DBMysql extends DB
return false;
}
/**
* Get information about a column
* @param string $table_name table name
* @param string $column_name column name
* @return object
*/
function getColumnInfo($table_name, $column_name)
{
$query = sprintf("show fields from `%s%s` where `Field` = '%s'", $this->prefix, $table_name, $column_name);
$result = $this->_query($query);
if($this->isError())
{
return;
}
$output = $this->_fetch($result);
if($output)
{
$dbtype = $output->{'Type'};
if($xetype = array_search($dbtype, $this->column_type))
{
$size = null;
}
elseif(strpos($dbtype, '(') !== false)
{
list($dbtype, $size) = explode('(', $dbtype, 2);
$size = intval(rtrim($size, ')'));
if($xetype = array_search($dbtype, $this->column_type))
{
// no-op
}
else
{
$xetype = $dbtype;
}
}
else
{
$xetype = $dbtype;
$size = null;
}
return (object)array(
'name' => $output->{'Field'},
'dbtype' => $dbtype,
'xetype' => $xetype,
'size' => $size,
'default_value' => $output->{'Default'},
'notnull' => strncmp($output->{'Null'}, 'NO', 2) == 0 ? true : false,
);
}
else
{
return false;
}
}
/**
* Add an index to the table
* $target_columns = array(col1, col2)

View file

@ -20,7 +20,7 @@ class DBMysql_innodb extends DBMysql
* Constructor
* @return void
*/
function DBMysql_innodb()
function __construct()
{
$this->_setDBInfo();
$this->_connect();

View file

@ -20,7 +20,7 @@ class DBMysqli extends DBMysql
* Constructor
* @return void
*/
function DBMysqli()
function __construct()
{
$this->_setDBInfo();
$this->_connect();

View file

@ -20,7 +20,7 @@ class DBMysqli_innodb extends DBMysql
* Constructor
* @return void
*/
function DBMysqli_innodb()
function __construct()
{
$this->_setDBInfo();
$this->_connect();

View file

@ -94,7 +94,7 @@ class Query extends Object
* @param string $priority
* @return void
*/
function Query($queryID = NULL
function __construct($queryID = NULL
, $action = NULL
, $columns = NULL
, $tables = NULL

View file

@ -33,7 +33,7 @@ class Subquery extends Query
* @param string $join_type
* @return void
*/
function Subquery($alias, $columns, $tables, $conditions, $groups, $orderby, $limit, $join_type = null)
function __construct($alias, $columns, $tables, $conditions, $groups, $orderby, $limit, $join_type = null)
{
$this->alias = $alias;

View file

@ -41,7 +41,7 @@ class Condition
* @param string $pipe
* @return void
*/
function Condition($column_name, $argument, $operation, $pipe)
function __construct($column_name, $argument, $operation, $pipe)
{
$this->column_name = $column_name;
$this->argument = $argument;

View file

@ -29,7 +29,7 @@ class ConditionGroup
* @param string $pipe
* @return void
*/
function ConditionGroup($conditions, $pipe = "")
function __construct($conditions, $pipe = "")
{
$this->conditions = array();
foreach($conditions as $condition)

View file

@ -17,9 +17,9 @@ class ConditionSubquery extends Condition
* @param string $pipe
* @return void
*/
function ConditionSubquery($column_name, $argument, $operation, $pipe = "")
function __construct($column_name, $argument, $operation, $pipe = "")
{
parent::Condition($column_name, $argument, $operation, $pipe);
parent::__construct($column_name, $argument, $operation, $pipe);
$this->_value = $this->argument->toString();
}

View file

@ -17,14 +17,14 @@ class ConditionWithArgument extends Condition
* @param string $pipe
* @return void
*/
function ConditionWithArgument($column_name, $argument, $operation, $pipe = "")
function __construct($column_name, $argument, $operation, $pipe = "")
{
if($argument === null)
{
$this->_show = false;
return;
}
parent::Condition($column_name, $argument, $operation, $pipe);
parent::__construct($column_name, $argument, $operation, $pipe);
$this->_value = $argument->getValue();
}

View file

@ -17,9 +17,9 @@ class ConditionWithoutArgument extends Condition
* @param string $pipe
* @return void
*/
function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = "")
function __construct($column_name, $argument, $operation, $pipe = "")
{
parent::Condition($column_name, $argument, $operation, $pipe);
parent::__construct($column_name, $argument, $operation, $pipe);
$tmpArray = array('in' => 1, 'notin' => 1, 'not_in' => 1);
if(isset($tmpArray[$operation]))
{

View file

@ -23,9 +23,9 @@ class ClickCountExpression extends SelectExpression
* @param bool $click_count
* @return void
*/
function ClickCountExpression($column_name, $alias = NULL, $click_count = false)
function __construct($column_name, $alias = NULL, $click_count = false)
{
parent::SelectExpression($column_name, $alias);
parent::__construct($column_name, $alias);
if(!is_bool($click_count))
{

View file

@ -24,9 +24,9 @@ class DeleteExpression extends Expression
* @param mixed $value
* @return void
*/
function DeleteExpression($column_name, $value)
function __construct($column_name, $value)
{
parent::Expression($column_name);
parent::__construct($column_name);
$this->value = $value;
}

View file

@ -27,7 +27,7 @@ class Expression
* @param string $column_name
* @return void
*/
function Expression($column_name)
function __construct($column_name)
{
$this->column_name = $column_name;
}

View file

@ -23,9 +23,9 @@ class InsertExpression extends Expression
* @param object $argument
* @return void
*/
function InsertExpression($column_name, $argument)
function __construct($column_name, $argument)
{
parent::Expression($column_name);
parent::__construct($column_name);
$this->argument = $argument;
}

View file

@ -30,9 +30,9 @@ class SelectExpression extends Expression
* @param string $alias
* @return void
*/
function SelectExpression($column_name, $alias = NULL)
function __construct($column_name, $alias = NULL)
{
parent::Expression($column_name);
parent::__construct($column_name);
$this->column_alias = $alias;
}

View file

@ -16,9 +16,9 @@ class StarExpression extends SelectExpression
* constructor, set the column to asterisk
* @return void
*/
function StarExpression()
function __construct()
{
parent::SelectExpression("*");
parent::__construct("*");
}
function getArgument()

View file

@ -23,9 +23,9 @@ class UpdateExpression extends Expression
* @param object $argument
* @return void
*/
function UpdateExpression($column_name, $argument)
function __construct($column_name, $argument)
{
parent::Expression($column_name);
parent::__construct($column_name);
$this->argument = $argument;
}

View file

@ -23,9 +23,9 @@ class UpdateExpressionWithoutArgument extends UpdateExpression
* @param object $argument
* @return void
*/
function UpdateExpressionWithoutArgument($column_name, $argument)
function __construct($column_name, $argument)
{
parent::Expression($column_name);
parent::__construct($column_name);
$this->argument = $argument;
}

View file

@ -40,7 +40,7 @@ class Limit
* @param int $page_count
* @return void
*/
function Limit($list_count, $page = NULL, $page_count = NULL)
function __construct($list_count, $page = NULL, $page_count = NULL)
{
$this->list_count = $list_count;
if($page)

View file

@ -27,7 +27,7 @@ class OrderByColumn
* @param string $sort_order
* @return void
*/
function OrderByColumn($column_name, $sort_order)
function __construct($column_name, $sort_order)
{
$this->column_name = $column_name;
$this->sort_order = $sort_order;

View file

@ -34,9 +34,9 @@ class CubridTableWithHint extends Table
* @param array $index_hints_list
* @return void
*/
function CubridTableWithHint($name, $alias = NULL, $index_hints_list)
function __construct($name, $alias = NULL, $index_hints_list)
{
parent::Table($name, $alias);
parent::__construct($name, $alias);
$this->index_hints_list = $index_hints_list;
}

View file

@ -27,7 +27,7 @@ class IndexHint
* @param string $index_hint_type
* @return void
*/
function IndexHint($index_name, $index_hint_type)
function __construct($index_name, $index_hint_type)
{
$this->index_name = $index_name;
$this->index_hint_type = $index_hint_type;

View file

@ -32,9 +32,9 @@ class JoinTable extends Table
* @param array $conditions
* @return void
*/
function JoinTable($name, $alias, $join_type, $conditions)
function __construct($name, $alias, $join_type, $conditions)
{
parent::Table($name, $alias);
parent::__construct($name, $alias);
$this->join_type = $join_type;
$this->conditions = $conditions;
}

View file

@ -34,9 +34,9 @@ class MssqlTableWithHint extends Table
* @param string $index_hints_list
* @return void
*/
function MssqlTableWithHint($name, $alias = NULL, $index_hints_list)
function __construct($name, $alias = NULL, $index_hints_list)
{
parent::Table($name, $alias);
parent::__construct($name, $alias);
$this->index_hints_list = $index_hints_list;
}

View file

@ -34,9 +34,9 @@ class MysqlTableWithHint extends Table
* @param string $index_hints_list
* @return void
*/
function MysqlTableWithHint($name, $alias = NULL, $index_hints_list)
function __construct($name, $alias = NULL, $index_hints_list)
{
parent::Table($name, $alias);
parent::__construct($name, $alias);
$this->index_hints_list = $index_hints_list;
}

View file

@ -27,7 +27,7 @@ class Table
* @param string $alias
* @return void
*/
function Table($name, $alias = NULL)
function __construct($name, $alias = NULL)
{
$this->name = $name;
$this->alias = $alias;

View file

@ -28,7 +28,6 @@ class DisplayHandler extends Handler
if(
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE &&
function_exists('ob_gzhandler') &&
extension_loaded('zlib') &&
$oModule->gzhandler_enable
)
@ -78,6 +77,9 @@ class DisplayHandler extends Handler
$handler->prepareToPrint($output);
}
// Start the session if $_SESSION was touched
Context::getInstance()->checkSessionStatus();
// header output
$httpStatusCode = $oModule->getHttpStatusCode();
@ -112,17 +114,15 @@ class DisplayHandler extends Handler
$this->gz_enabled = FALSE;
}
// results directly output
// enable gzip using zlib extension
if($this->gz_enabled)
{
header("Content-Encoding: gzip");
print ob_gzhandler($output, 5);
}
else
{
print $output;
ini_set('zlib.output_compression', true);
}
// results directly output
print $output;
// call a trigger after display
ModuleHandler::triggerCall('display', 'after', $output);
@ -321,11 +321,6 @@ class DisplayHandler extends Handler
function _printXMLHeader()
{
header("Content-Type: text/xml; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
/**
@ -335,11 +330,6 @@ class DisplayHandler extends Handler
function _printHTMLHeader()
{
header("Content-Type: text/html; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
/**
@ -349,11 +339,6 @@ class DisplayHandler extends Handler
function _printJSONHeader()
{
header("Content-Type: text/html; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
/**

View file

@ -38,7 +38,7 @@ class ExtraVar
* @param int $module_srl Sequence of module
* @return void
*/
function ExtraVar($module_srl)
function __construct($module_srl)
{
$this->module_srl = $module_srl;
}
@ -157,7 +157,7 @@ class ExtraItem
* @param string $eid Unique id of extra variable in module
* @return void
*/
function ExtraItem($module_srl, $idx, $name, $type = 'text', $default = null, $desc = '', $is_required = 'N', $search = 'N', $value = null, $eid = '')
function __construct($module_srl, $idx, $name, $type = 'text', $default = null, $desc = '', $is_required = 'N', $search = 'N', $value = null, $eid = '')
{
if(!$idx)
{
@ -292,11 +292,11 @@ class ExtraItem
/**
* Returns a value for HTML
*
* @return string Returns a value expressed in HTML.
* @return string Returns filtered value
*/
function getValue()
{
return $this->_getTypeValue($this->type, $this->value);
return removeHackTag($this->value);
}
/**

View file

@ -520,7 +520,7 @@ class FileHandler
try
{
requirePear();
require_once('HTTP/Request.php');
if(!class_exists('HTTP_Request')) require_once('HTTP/Request.php');
$parsed_url = parse_url(__PROXY_SERVER__);
if($parsed_url["host"])

View file

@ -34,7 +34,7 @@ class FileObject extends Object
* @param string $mode File open mode
* @return void
*/
function FileObject($path, $mode)
function __construct($path, $mode)
{
if($path != NULL)
{

View file

@ -41,7 +41,7 @@ class XEHttpRequest
* constructor
* @return void
*/
function XEHttpRequest($host, $port, $scheme='')
function __construct($host, $port, $scheme='')
{
$this->m_host = $host;
$this->m_port = $port;

View file

@ -130,7 +130,7 @@ class Mail extends PHPMailer
*
* @return void
*/
function Mail()
function __construct()
{
}

View file

@ -123,13 +123,13 @@ class Mobile
setcookie("mobile", 'true', 0, $xe_web_path);
}
}
elseif($_COOKIE['mobile'] != 'false')
elseif(isset($_COOKIE['mobile']) && $_COOKIE['mobile'] != 'false')
{
$_COOKIE['mobile'] = 'false';
setcookie("mobile", 'false', 0, $xe_web_path);
}
if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
if(isset($_COOKIE['mobile']) && $_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
{
setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path);
}

View file

@ -32,7 +32,7 @@ class ModuleHandler extends Handler
* @return void
* */
function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
{
// If XE has not installed yet, set module as install
if(!Context::isInstalled())
@ -755,15 +755,23 @@ class ModuleHandler extends Handler
}
$_SESSION['XE_VALIDATOR_ERROR'] = $error;
$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
if($error != 0)
{
$_SESSION['XE_VALIDATOR_ERROR'] = $error;
}
if($validator_id = Context::get('xe_validator_id'))
{
$_SESSION['XE_VALIDATOR_ID'] = $validator_id;
}
if($message != 'success')
{
$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
}
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
if(Context::get('xeVirtualRequestMethod') != 'xml')
if($messageType != 'info')
{
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
}
if(Context::get('xeVirtualRequestMethod') != 'xml' && $redirectUrl)
{
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
}
@ -813,12 +821,12 @@ class ModuleHandler extends Handler
* */
function _clearErrorSession()
{
$_SESSION['XE_VALIDATOR_ERROR'] = '';
$_SESSION['XE_VALIDATOR_MESSAGE'] = '';
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = '';
$_SESSION['XE_VALIDATOR_RETURN_URL'] = '';
$_SESSION['XE_VALIDATOR_ID'] = '';
$_SESSION['INPUT_ERROR'] = '';
unset($_SESSION['XE_VALIDATOR_ERROR']);
unset($_SESSION['XE_VALIDATOR_MESSAGE']);
unset($_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
unset($_SESSION['XE_VALIDATOR_RETURN_URL']);
unset($_SESSION['XE_VALIDATOR_ID']);
unset($_SESSION['INPUT_ERROR']);
}
/**
@ -872,6 +880,7 @@ class ModuleHandler extends Handler
$display_handler = new DisplayHandler();
$display_handler->_debugOutput();
Context::getInstance()->checkSessionStatus();
header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
return;
}

View file

@ -472,8 +472,8 @@ class ModuleObject extends Object
return FALSE;
}
}
// execute api methos of the module if view action is and result is XMLRPC or JSON
if($this->module_info->module_type == 'view')
// execute api methods of the module if view action is and result is XMLRPC or JSON
if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
{
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
{

View file

@ -40,7 +40,7 @@ class Object
* @param string $message Error message
* @return void
*/
function Object($error = 0, $message = 'success')
function __construct($error = 0, $message = 'success')
{
$this->setError($error);
$this->setMessage($message);

View file

@ -30,7 +30,7 @@ class PageHandler extends Handler
* @return void
*/
function PageHandler($total_count, $total_page, $cur_page, $page_count = 10)
function __construct($total_count, $total_page, $cur_page, $page_count = 10)
{
$this->total_count = $total_count;
$this->total_page = $total_page;

View file

@ -0,0 +1,357 @@
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* This class makes encryption and digital signing easy to use in XE.
*
* The encryption methods use AES-128, and is fully compatible with
* https://github.com/defuse/php-encryption
* except that it uses base64-encoded keys and ciphertexts.
*
* The digital signature methods is based on the same SHA-256 based
* key derivation function used by the encryption methods.
*
* A key is automatically generated and saved to the files/config directory
* when first invoked. The same key will be used for all subsequent
* method calls that do not specify a different key.
* The key must be a binary string exactly 16 bytes long.
*
* @file Crypto.class.php
* @author Kijin Sung (kijin@kijinsung.com)
* @package /classes/security
* @version 1.0
*/
class Crypto
{
/**
* @brief Default configuration
*/
const ENCRYPTION_ALGO = 'aes-128';
const ENCRYPTION_MODE = 'cbc';
const ENCRYPTION_BLOCK_SIZE = 16;
const ENCRYPTION_KEY_SIZE = 16;
const ENCRYPTION_KEY_INFO = 'DefusePHP|KeyForEncryption';
const ENCRYPTION_MAC_ALGO = 'sha256';
const ENCRYPTION_MAC_SIZE = 32;
const ENCRYPTION_MAC_INFO = 'DefusePHP|KeyForAuthentication';
const SIGNATURE_ALGO = 'sha256';
const SIGNATURE_SIZE = '32';
/**
* @brief The default key
*/
protected static $_default_key = null;
/**
* @brief The currently selected extension
*/
protected static $_extension = null;
/**
* @brief If this is true, encryption and signature are only valid in current session
*/
protected $_current_session_only = false;
/**
* @brief Constructor
*/
public function __construct()
{
if(function_exists('openssl_encrypt'))
{
self::$_extension = 'openssl';
}
elseif(function_exists('mcrypt_encrypt'))
{
self::$_extension = 'mcrypt';
}
else
{
throw new Exception('Crypto class requires openssl or mcrypt extension.');
}
}
/**
* @brief Check if cryptography is supported on this server
* @return bool
*/
public static function isSupported()
{
return (function_exists('openssl_encrypt') || function_exists('mcrypt_encrypt'));
}
/**
* @brief Make encryption and signature only valid in current session
* @return void
*/
public function currentSessionOnly()
{
$this->_current_session_only = true;
}
/**
* @brief Encrypt a string
* @param string $plaintext The string to encrypt
* @param string $key Optional key. If empty, default key will be used.
* @return string
*/
public function encrypt($plaintext, $key = null)
{
if($key === null || $key === '')
{
$key = $this->_getSessionKey();
}
// Generate subkey for encryption
$enc_key = self::_defuseCompatibleHKDF($key, self::ENCRYPTION_KEY_INFO);
// Generate IV
$iv = self::_createIV();
// Encrypt the plaintext
if(self::$_extension === 'openssl')
{
$openssl_method = self::ENCRYPTION_ALGO . '-' . self::ENCRYPTION_MODE;
$ciphertext = openssl_encrypt($plaintext, $openssl_method, $enc_key, OPENSSL_RAW_DATA, $iv);
}
else
{
$mcrypt_method = str_replace('aes', 'rijndael', self::ENCRYPTION_ALGO);
$plaintext = self::_applyPKCS7Padding($plaintext, self::ENCRYPTION_BLOCK_SIZE);
$ciphertext = mcrypt_encrypt($mcrypt_method, $enc_key, $plaintext, self::ENCRYPTION_MODE, $iv);
}
// Generate MAC
$mac_key = self::_defuseCompatibleHKDF($key, self::ENCRYPTION_MAC_INFO);
$mac = hash_hmac(self::ENCRYPTION_MAC_ALGO, ($iv . $ciphertext), $mac_key, true);
// Return the MAC, IV, and ciphertext as a base64 encoded string
return base64_encode($mac . $iv . $ciphertext);
}
/**
* @brief Decrypt a string
* @param string $ciphertext The string to decrypt
* @param string $key Optional key. If empty, default key will be used.
* @return string
*/
public function decrypt($ciphertext, $key = null)
{
if($key === null || $key === '')
{
$key = $this->_getSessionKey();
}
// Base64 decode the ciphertext and check the length
$ciphertext = @base64_decode($ciphertext);
if(strlen($ciphertext) < (self::ENCRYPTION_MAC_SIZE + (self::ENCRYPTION_BLOCK_SIZE * 2)))
{
return false;
}
// Extract MAC and IV from the remainder of the ciphertext
$mac = substr($ciphertext, 0, self::ENCRYPTION_MAC_SIZE);
$iv = substr($ciphertext, self::ENCRYPTION_MAC_SIZE, self::ENCRYPTION_BLOCK_SIZE);
$ciphertext = substr($ciphertext, self::ENCRYPTION_MAC_SIZE + self::ENCRYPTION_BLOCK_SIZE);
// Validate MAC
$mac_key = self::_defuseCompatibleHKDF($key, self::ENCRYPTION_MAC_INFO);
$mac_compare = hash_hmac(self::ENCRYPTION_MAC_ALGO, ($iv . $ciphertext), $mac_key, true);
$oPassword = new Password();
if(!$oPassword->strcmpConstantTime($mac, $mac_compare))
{
return false;
}
// Generate subkey for encryption
$enc_key = self::_defuseCompatibleHKDF($key, self::ENCRYPTION_KEY_INFO);
// Decrypt the ciphertext
if (self::$_extension === 'openssl')
{
$openssl_method = self::ENCRYPTION_ALGO . '-' . self::ENCRYPTION_MODE;
$plaintext = openssl_decrypt($ciphertext, $openssl_method, $enc_key, OPENSSL_RAW_DATA, $iv);
}
else
{
$mcrypt_method = str_replace('aes', 'rijndael', self::ENCRYPTION_ALGO);
$plaintext = @mcrypt_decrypt($mcrypt_method, $enc_key, $ciphertext, self::ENCRYPTION_MODE, $iv);
if($plaintext === false)
{
return false;
}
$plaintext = self::_stripPKCS7Padding($plaintext, self::ENCRYPTION_BLOCK_SIZE);
if($plaintext === false)
{
return false;
}
}
// Return the plaintext
return $plaintext;
}
/**
* @brief Create a digital signature of a string
* @param string $plaintext The string to sign
* @param string $key Optional key. If empty, default key will be used.
* @return string
*/
public function createSignature($plaintext, $key = null)
{
if($key === null || $key === '')
{
$key = $this->_getSessionKey();
}
// Generate a signature using HMAC
return bin2hex(self::_defuseCompatibleHKDF($plaintext, $key));
}
/**
* @brief Verify a digital signature
* @param string $signature The signature to verify
* @param string $plaintext The string to verify
* @param string $key Optional key. If empty, default key will be used.
* @return bool
*/
public function verifySignature($signature, $plaintext, $key = null)
{
if($key === null || $key === '')
{
$key = $this->_getSessionKey();
}
// Verify the signature using HMAC
$oPassword = new Password();
$compare = bin2hex(self::_defuseCompatibleHKDF($plaintext, $key));
return $oPassword->strcmpConstantTime($signature, $compare);
}
/**
* @brief Get the default key applicable to this instance
* @return string
*/
protected function _getSessionKey()
{
if($this->_current_session_only)
{
if(!isset($_SESSION['XE_CRYPTO_SESSKEY']))
{
$_SESSION['XE_CRYPTO_SESSKEY'] = self::_createSecureKey();
}
$session_key = base64_decode($_SESSION['XE_CRYPTO_SESSKEY']);
return strval(self::_getDefaultKey()) ^ strval($session_key);
}
else
{
return strval(self::_getDefaultKey());
}
}
/**
* @brief Get the default key
* @return string
*/
protected static function _getDefaultKey()
{
if(self::$_default_key !== null)
{
return base64_decode(self::$_default_key);
}
else
{
$file_name = _XE_PATH_ . 'files/config/crypto.config.php';
if(file_exists($file_name) && is_readable($file_name))
{
$key = (include $file_name);
}
if(!isset($key) || !is_string($key))
{
$key = self::_createSecureKey();
self::_setDefaultKey($key);
}
return base64_decode(self::$_default_key = $key);
}
}
/**
* @brief Set the default key
* @param string $key The default key
* @return void
*/
protected static function _setDefaultKey($key)
{
self::$_default_key = $key = trim($key);
$file_name = _XE_PATH_ . 'files/config/crypto.config.php';
$file_content = '<?php return ' . var_export($key, true) . ';' . PHP_EOL;
FileHandler::writeFile($file_name, $file_content);
}
/**
* @brief Create a secure key
* @return string
*/
protected static function _createSecureKey()
{
$oPassword = new Password();
return base64_encode($oPassword->createSecureSalt(ENCRYPTION_KEY_SIZE, 'binary'));
}
/**
* @brief Create an IV
* @return string
*/
protected static function _createIV()
{
$oPassword = new Password();
return $oPassword->createSecureSalt(self::ENCRYPTION_BLOCK_SIZE, 'binary');
}
/**
* @brief Apply PKCS#7 padding to a string
* @param string $str The string
* @param int $block_size The block size
* @return string
*/
protected static function _applyPKCS7Padding($str, $block_size)
{
$padding_size = $block_size - (strlen($str) % $block_size);
if ($padding_size === 0) $padding_size = $block_size;
return $str . str_repeat(chr($padding_size), $padding_size);
}
/**
* @brief Remove PKCS#7 padding from a string
* @param string $str The string
* @param int $block_size The block size
* @return string
*/
protected static function _stripPKCS7Padding($str, $block_size)
{
if (strlen($str) % $block_size !== 0) return false;
$padding_size = ord(substr($str, -1));
if ($padding_size < 1 || $padding_size > $block_size) return false;
if (substr($str, (-1 * $padding_size)) !== str_repeat(chr($padding_size), $padding_size)) return false;
return substr($str, 0, strlen($str) - $padding_size);
}
/**
* @brief HKDF function compatible with defuse/php-encryption
* @return string
*/
protected static function _defuseCompatibleHKDF($key, $info)
{
$salt = str_repeat("\x00", self::ENCRYPTION_MAC_SIZE);
$prk = hash_hmac(self::ENCRYPTION_MAC_ALGO, $key, $salt, true);
$t = $last_block = '';
for ($block_index = 1; strlen($t) < self::ENCRYPTION_KEY_SIZE; $block_index++)
{
$t .= $last_block = hash_hmac(self::ENCRYPTION_MAC_ALGO, ($last_block . $info . chr($block_index)), $prk, true);
}
return substr($t, 0, self::ENCRYPTION_KEY_SIZE);
}
}
/* End of file : Crypto.class.php */
/* Location: ./classes/security/Crypto.class.php */

View file

@ -260,7 +260,7 @@ class EmbedFilter
* @constructor
* @return void
*/
function EmbedFilter()
function __construct()
{
$this->_makeWhiteDomainList();

View file

@ -9,7 +9,7 @@ class Purifier
private $_config;
private $_def;
public function Purifier()
public function __construct()
{
$this->_checkCacheDir();

View file

@ -22,7 +22,7 @@ class Security
* @param mixed $var Target context
* @return void
*/
function Security($var = NULL)
function __construct($var = NULL)
{
$this->_targetVar = $var;
}

View file

@ -19,6 +19,7 @@ class TemplateHandler
private $xe_path = NULL; ///< XpressEngine base path
private $web_path = NULL; ///< tpl file web path
private $compiled_file = NULL; ///< tpl file web path
private $config = NULL;
private $skipTags = NULL;
private $handler_mtime = 0;
static private $rootTpl = NULL;
@ -31,6 +32,7 @@ class TemplateHandler
{
$this->xe_path = rtrim(preg_replace('/([^\.^\/]+)\.php$/i', '', $_SERVER['SCRIPT_NAME']), '/');
$this->compiled_path = _XE_PATH_ . $this->compiled_path;
$this->config = new stdClass();
}
/**
@ -232,6 +234,13 @@ class TemplateHandler
$this->skipTags = array('marquee');
}
// reset config for this buffer (this step is necessary because we use a singleton for every template)
$previous_config = clone $this->config;
$this->config = new stdClass();
// detect existence of autoescape config
$this->config->autoescape = (strpos($buff, ' autoescape="') === FALSE) ? NULL : 'off';
// replace comments
$buff = preg_replace('@<!--//.*?-->@s', '', $buff);
@ -242,7 +251,7 @@ class TemplateHandler
$buff = $this->_parseInline($buff);
// include, unload/load, import
$buff = preg_replace_callback('/{(@[\s\S]+?|(?=\$\w+|_{1,2}[A-Z]+|[!\(+-]|\w+(?:\(|::)|\d+|[\'"].*?[\'"]).+?)}|<(!--[#%])?(include|import|(un)?load(?(4)|(?:_js_plugin)?))(?(2)\(["\']([^"\']+)["\'])(.*?)(?(2)\)--|\/)>|<!--(@[a-z@]*)([\s\S]*?)-->(\s*)/', array($this, '_parseResource'), $buff);
$buff = preg_replace_callback('/{(@[\s\S]+?|(?=\$\w+|_{1,2}[A-Z]+|[!\(+-]|\w+(?:\(|::)|\d+|[\'"].*?[\'"]).+?)}|<(!--[#%])?(include|import|(un)?load(?(4)|(?:_js_plugin)?)|config)(?(2)\(["\']([^"\']+)["\'])(.*?)(?(2)\)--|\/)>|<!--(@[a-z@]*)([\s\S]*?)-->(\s*)/', array($this, '_parseResource'), $buff);
// remove block which is a virtual tag
$buff = preg_replace('@</?block\s*>@is', '', $buff);
@ -260,6 +269,9 @@ class TemplateHandler
// remove php script reopening
$buff = preg_replace(array('/(\n|\r\n)+/', '/(;)?( )*\?\>\<\?php([\n\t ]+)?/'), array("\n", ";\n"), $buff);
// restore config to previous value
$this->config = $previous_config;
return $buff;
}
@ -509,7 +521,10 @@ class TemplateHandler
{
$expr_m[2] .= '=>' . trim($expr_m[3]);
}
$nodes[$idx - 1] .= "<?php if({$expr_m[1]}&&count({$expr_m[1]}))foreach({$expr_m[1]} as {$expr_m[2]}){ ?>";
$nodes[$idx - 1] .= sprintf(
'<?php $t%3$s=%1$s;if($t%3$s&&count($t%3$s))foreach($t%3$s as %2$s){ ?>'
,$expr_m[1], $expr_m[2], md5( $buff . strval($idx-1) )
);
}
elseif($expr_m[4])
{
@ -587,14 +602,35 @@ class TemplateHandler
{
return $m[0];
}
$echo = 'echo ';
if($m[1]{0} == '@')
{
$echo = '';
$m[1] = substr($m[1], 1);
$m[1] = $this->_replaceVar(substr($m[1], 1));
return "<?php {$m[1]} ?>";
}
else
{
$escape_option = $this->config->autoescape !== null ? 'auto' : 'noescape';
if(preg_match('@^(.+)\\|((?:no)?escape)$@', $m[1], $mm))
{
$m[1] = $mm[1];
$escape_option = $mm[2];
}
elseif($m[1] === '$content' && preg_match('@/layouts/.+/layout\.html$@', $this->file))
{
$escape_option = 'noescape';
}
$m[1] = $this->_replaceVar($m[1]);
switch($escape_option)
{
case 'auto':
return "<?php echo (\$this->config->autoescape === 'on' ? htmlspecialchars({$m[1]}, ENT_COMPAT, 'UTF-8', false) : {$m[1]}) ?>";
case 'escape':
return "<?php echo htmlspecialchars({$m[1]}, ENT_COMPAT, 'UTF-8', true) ?>";
case 'noescape':
return "<?php echo {$m[1]} ?>";
}
}
return '<?php ' . $echo . $this->_replaceVar($m[1]) . ' ?>';
}
if($m[3])
@ -727,6 +763,17 @@ class TemplateHandler
}
return $result;
// <config ...>
case 'config':
$result = '';
if(preg_match_all('@ (\w+)="([^"]+)"@', $m[6], $config_matches, PREG_SET_ORDER))
{
foreach($config_matches as $config_match)
{
$result .= "\$this->config->{$config_match[1]} = '" . trim(strtolower($config_match[2])) . "';";
}
}
return "<?php {$result} ?>";
}
}

View file

@ -79,7 +79,7 @@ class XmlJsFilter extends XmlParser
* @return void
*/
function XmlJsFilter($path, $xml_file)
function __construct($path, $xml_file)
{
if(substr($path, -1) !== '/')
{

View file

@ -53,7 +53,7 @@ class XmlLangParser extends XmlParser
* @param string $lang_type
* @return void
*/
function XmlLangParser($xml_file, $lang_type)
function __construct($xml_file, $lang_type)
{
$this->lang_type = $lang_type;
$this->xml_file = $xml_file;

View file

@ -24,7 +24,7 @@ class XmlQueryParser extends XmlParser
* constructor
* @return void
*/
function XmlQueryParser()
function __construct()
{
}

View file

@ -60,7 +60,7 @@ class DBParser
*
* @return void
*/
function DBParser($escape_char_left, $escape_char_right = "", $table_prefix = "xe_")
function __construct($escape_char_left, $escape_char_right = "", $table_prefix = "xe_")
{
$this->escape_char_left = $escape_char_left;
if($escape_char_right !== "")

View file

@ -30,7 +30,7 @@ class QueryParser
* @param bool $isSubQuery
* @return void
*/
function QueryParser($query = NULL, $isSubQuery = FALSE)
function __construct($query = NULL, $isSubQuery = FALSE)
{
if($query)
{

View file

@ -64,7 +64,7 @@ class Argument
* @return void
*/
function Argument($name, $value)
function __construct($name, $value)
{
$this->value = $value;
$this->name = $name;

View file

@ -23,7 +23,7 @@ class ConditionArgument extends Argument
* @param string $operation
* @return void
*/
function ConditionArgument($name, $value, $operation)
function __construct($name, $value, $operation)
{
$operationList = array('in' => 1, 'notin' => 1, 'not_in' => 1, 'between' => 1);
if(isset($value) && isset($operationList[$operation]) && !is_array($value) && $value != '')
@ -32,7 +32,7 @@ class ConditionArgument extends Argument
$value = str_replace('\'', '', $value);
$value = explode(',', $value);
}
parent::Argument($name, $value);
parent::__construct($name, $value);
$this->operation = $operation;
}

View file

@ -58,7 +58,7 @@ class DefaultValue
* @param mixed $value value
* @return void
*/
function DefaultValue($column_name, $value)
function __construct($column_name, $value)
{
$dbParser = DB::getParser();
$this->column_name = $dbParser->parseColumnName($column_name);

View file

@ -58,7 +58,7 @@ class QueryArgument
* @param bool $ignore_value
* @return void
*/
function QueryArgument($tag, $ignore_value = FALSE)
function __construct($tag, $ignore_value = FALSE)
{
static $number_of_arguments = 0;

View file

@ -59,7 +59,7 @@ class QueryArgumentValidator
* @param QueryArgument $argument
* @return void
*/
function QueryArgumentValidator($tag, $argument)
function __construct($tag, $argument)
{
$this->argument = $argument;
$this->argument_name = $this->argument->getArgumentName();

View file

@ -25,7 +25,7 @@ class ColumnTag
* @param string $name
* @return void
*/
function ColumnTag($name)
function __construct($name)
{
$this->name = $name;
}

View file

@ -25,9 +25,9 @@ class InsertColumnTag extends ColumnTag
*
* @return void
*/
function InsertColumnTag($column)
function __construct($column)
{
parent::ColumnTag($column->attrs->name);
parent::__construct($column->attrs->name);
$dbParser = DB::getParser();
$this->name = $dbParser->parseColumnName($this->name);
$this->argument = new QueryArgument($column);

View file

@ -17,9 +17,9 @@ class InsertColumnTagWithoutArgument extends ColumnTag
* @param object $column
* @return void
*/
function InsertColumnTagWithoutArgument($column)
function __construct($column)
{
parent::ColumnTag($column->attrs->name);
parent::__construct($column->attrs->name);
$dbParser = DB::getParser();
$this->name = $dbParser->parseColumnName($this->name);
}

View file

@ -24,7 +24,7 @@ class InsertColumnsTag
* @param array|string $xml_columns
* @return void
*/
function InsertColumnsTag($xml_columns)
function __construct($xml_columns)
{
$this->columns = array();

View file

@ -31,16 +31,16 @@ class SelectColumnTag extends ColumnTag
* @param string|object $column
* @return void
*/
function SelectColumnTag($column)
function __construct($column)
{
if($column == "*" || $column->attrs->name == '*')
{
parent::ColumnTag(NULL);
parent::__construct(NULL);
$this->name = "*";
}
else
{
parent::ColumnTag($column->attrs->name);
parent::__construct($column->attrs->name);
$dbParser = DB::getParser();
$this->name = $dbParser->parseExpression($this->name);

View file

@ -25,7 +25,7 @@ class SelectColumnsTag
* @internal param \Xml_Node_ $xml_columns
* @return void
*/
function SelectColumnsTag($xml_columns_tag)
function __construct($xml_columns_tag)
{
if(!$xml_columns_tag)
{

View file

@ -31,9 +31,9 @@ class UpdateColumnTag extends ColumnTag
* @param object $column
* @return void
*/
function UpdateColumnTag($column)
function __construct($column)
{
parent::ColumnTag($column->attrs->name);
parent::__construct($column->attrs->name);
$dbParser = DB::getParser();
$this->name = $dbParser->parseColumnName($this->name);

View file

@ -24,7 +24,7 @@ class UpdateColumnsTag
* @param array|object $xml_columns
* @return void
*/
function UpdateColumnsTag($xml_columns)
function __construct($xml_columns)
{
$this->columns = array();

View file

@ -29,7 +29,7 @@ class ConditionGroupTag
* @param string $pipe
* @return void
*/
function ConditionGroupTag($conditions, $pipe = "")
function __construct($conditions, $pipe = "")
{
$this->pipe = $pipe;

View file

@ -59,7 +59,7 @@ class ConditionTag
* @param object $condition
* @return void
*/
function ConditionTag($condition)
function __construct($condition)
{
$this->operation = $condition->attrs->operation;
$this->pipe = $condition->attrs->pipe;

View file

@ -22,7 +22,7 @@ class ConditionsTag
* @param object $xml_conditions
* @return void
*/
function ConditionsTag($xml_conditions)
function __construct($xml_conditions)
{
$this->condition_groups = array();
if(!$xml_conditions)

View file

@ -16,9 +16,9 @@ class JoinConditionsTag extends ConditionsTag
* @param object $xml_conditions
* @return void
*/
function JoinConditionsTag($xml_conditions)
function __construct($xml_conditions)
{
parent::ConditionsTag($xml_conditions);
parent::__construct($xml_conditions);
$this->condition_groups[0]->conditions[0]->setPipe("");
}

View file

@ -22,7 +22,7 @@ class GroupsTag
* @param array|string $xml_groups
* @return void
*/
function GroupsTag($xml_groups)
function __construct($xml_groups)
{
$this->groups = array();

View file

@ -46,7 +46,7 @@ class IndexTag
* @param object $index
* @return void
*/
function IndexTag($index)
function __construct($index)
{
$this->argument_name = $index->attrs->var;

View file

@ -40,7 +40,7 @@ class LimitTag
* @param object $index
* @return void
*/
function LimitTag($index)
function __construct($index)
{
if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs)
{

View file

@ -46,7 +46,7 @@ class NavigationTag
* @param object $xml_navigation
* @return void
*/
function NavigationTag($xml_navigation)
function __construct($xml_navigation)
{
$this->order = array();
if($xml_navigation)

View file

@ -119,7 +119,7 @@ class QueryTag
* @param bool $isSubQuery
* @return void
*/
function QueryTag($query, $isSubQuery = FALSE)
function __construct($query, $isSubQuery = FALSE)
{
$this->action = $query->attrs->action;
$this->query_id = $query->attrs->id;

View file

@ -25,9 +25,9 @@ class HintTableTag extends TableTag
* @param array $index
* @return void
*/
function HintTableTag($table, $index)
function __construct($table, $index)
{
parent::TableTag($table);
parent::__construct($table);
$this->index = $index;
}

View file

@ -66,7 +66,7 @@ class TableTag
* @param object $table XML <table> tag
* @return void
*/
function TableTag($table)
function __construct($table)
{
$dbParser = DB::getParser();

View file

@ -33,7 +33,7 @@ class TablesTag
* @param object $xml_index_hints_tag
* @return void
*/
function TablesTag($xml_tables_tag, $xml_index_hints_tag = NULL)
function __construct($xml_tables_tag, $xml_index_hints_tag = NULL)
{
$this->tables = array();

View file

@ -22,8 +22,8 @@
actDeleteFile : '.xefu-act-delete',
actSetCover : '.xefu-act-set-cover',
tmplXeUploaderFileitem : '<li class="xefu-file xe-clearfix" data-file-srl="{{file_srl}}"><span class="xefu-file-name">{{source_filename}}</span><span class="xefu-file-info"><span>{{disp_file_size}}</span><span><input type="checkbox" data-file-srl="{{file_srl}}"> 선택</span></span></li>',
tmplXeUploaderFileitemImage: '<li class="xefu-file xefu-file-image {{#if cover_image}}xefu-is-cover-image{{/if}}" data-file-srl="{{file_srl}}"><strong class="xefu-file-name">{{source_filename}}</strong><span class="xefu-file-info"><span class="xefu-file-size">{{disp_file_size}}</span><span><img src="{{download_url}}" alt=""></span><span><input type="checkbox" data-file-srl="{{file_srl}}"></span><button class="xefu-act-set-cover" data-file-srl="{{file_srl}}" title="커버이미지로 선택"><i class="xi-check-circle"></i></button></span></li>'
tmplXeUploaderFileitem : '<li class="xefu-file xe-clearfix" data-file-srl="{{file_srl}}"><span class="xefu-file-name">{{source_filename}}</span><span class="xefu-file-info"><span>{{disp_file_size}}</span><span><input type="checkbox" data-file-srl="{{file_srl}}"> Select</span></span></li>',
tmplXeUploaderFileitemImage: '<li class="xefu-file xefu-file-image {{#if cover_image}}xefu-is-cover-image{{/if}}" data-file-srl="{{file_srl}}"><strong class="xefu-file-name">{{source_filename}}</strong><span class="xefu-file-info"><span class="xefu-file-size">{{disp_file_size}}</span><span><img src="{{download_url}}" alt=""></span><span><input type="checkbox" data-file-srl="{{file_srl}}"></span><button class="xefu-act-set-cover" data-file-srl="{{file_srl}}" title="Be a cover image"><i class="xi-check-circle"></i></button></span></li>'
};
var _elements = [
@ -93,6 +93,7 @@
},
done: function(e, res) {
var result = res.response().result;
var temp_code = '';
if(!result) return;
@ -101,6 +102,12 @@
if(!result) return;
if(result.error == 0) {
if(/\.(jpe?g|png|gif)$/i.test(result.source_filename)) {
temp_code += '<img src="' + window.request_uri + result.download_url + '" alt="' + result.source_filename + '" editor_component="image_link" data-file-srl="' + result.file_srl + '" />';
temp_code += "\r\n<p><br></p>\r\n";
}
_getCkeInstance(settings.formData.editor_sequence).insertHtml(temp_code, "unfiltered_html");
} else {
alert(result.message);
}
@ -236,7 +243,7 @@
if(!fileinfo) return;
if(/\.(jpe?g|png|gif)$/i.test(fileinfo.download_url)) {
if(/\.(jpe?g|png|gif)$/i.test(fileinfo.source_filename)) {
temp_code += '<img src="' + window.request_uri + fileinfo.download_url + '" alt="' + fileinfo.source_filename + '" editor_component="image_link" data-file-srl="' + fileinfo.file_srl + '" />';
temp_code += "\r\n<p><br></p>\r\n";
} else {

File diff suppressed because one or more lines are too long

View file

@ -3319,6 +3319,18 @@
<value xml:lang="jp"><![CDATA[処理しますか?]]></value>
<value xml:lang="de"><![CDATA[Sind Sie sicher, dass Sie fortfahren möchten?]]></value>
</item>
<item name="comfirm_act_msg">
<value xml:lang="ko"><![CDATA[이 %1$s%3$s %2$s하시겠습니까?]]></value>
<value xml:lang="en"><![CDATA[Are you sure to %2$s this %1$s?]]></value>
</item>
<item name="msg_eul">
<value xml:lang="ko"><![CDATA[을]]></value>
<value xml:lang="en"><![CDATA[]]></value>
</item>
<item name="msg_rul">
<value xml:lang="ko"><![CDATA[를]]></value>
<value xml:lang="en"><![CDATA[]]></value>
</item>
<item name="column_type">
<value xml:lang="ko"><![CDATA[형식]]></value>
<value xml:lang="en"><![CDATA[Column Type]]></value>
@ -3734,6 +3746,10 @@
<value xml:lang="vi"><![CDATA[Định dạng của %s không hợp lệ. Chỉ sử dụng các chữ số]]></value>
<value xml:lang="mn"><![CDATA[%s-ын хэлбэр буруу байна. Зөвхөн тоогоор оруулах ёстой.]]></value>
</item>
<item name="invalid_extension">
<value xml:lang="ko"><![CDATA[%s의 형식이 잘못되었습니다. *.* 나 *.jpg;*.gif; 처럼 입력해야 합니다.]]></value>
<value xml:lang="en"><![CDATA[The format of %s is invalid. e.g.) *.* or *.jpg;*.gif;.]]></value>
</item>
</item>
<item name="security_invalid_session">
<value xml:lang="ko"><![CDATA[바르지 않은 접근입니다. 인증을 위해 다시 로그인해야 합니다.]]></value>

View file

@ -9,6 +9,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<block loop="Context::getMetaTag() => $no, $val">
<meta http-equiv="{$val['name']}"|cond="$val['is_http_equiv']" name="{$val['name']}"|cond="!$val['is_http_equiv']" content="{$val['content']}">
</block>
<!--// TITLE -->
<title>{Context::getBrowserTitle()}</title>
<!-- CSS -->

View file

@ -342,6 +342,7 @@ $GLOBALS['__xe_autoload_file_map'] = array_change_key_case(array(
'ModuleObject' => 'classes/module/ModuleObject.class.php',
'Object' => 'classes/object/Object.class.php',
'PageHandler' => 'classes/page/PageHandler.class.php',
'Crypto' => 'classes/security/Crypto.class.php',
'EmbedFilter' => 'classes/security/EmbedFilter.class.php',
'IpFilter' => 'classes/security/IpFilter.class.php',
'Password' => 'classes/security/Password.class.php',

View file

@ -134,6 +134,13 @@ a:hover, a:active, a:focus {
vertical-align: middle;
max-height: 40px;
}
.header > .logo-item a {
font-size: 24px;
color: #888;
}
.header > .logo-item a:hover {
color: #444;
}
/* Fixed Header */
.container.fixed_header {
padding-top: 100px

View file

@ -184,16 +184,14 @@
<block cond="$_magazine_header && $layout_info->logo_img_magazine">
{@ $_logo_img = $layout_info->logo_img_magazine}
</block>
<block cond="$_onepage_header && $layout_info->logo_img_transparent">
{@ $_logo_img = $layout_info->logo_img_transparent}
</block>
<a href="<!--@if($layout_info->logo_url)-->{$layout_info->logo_url}<!--@else-->{getUrl('')}<!--@end-->">
<!--@if($_logo_img)-->
<!--@if($_magazine_header)-->
<img src="{$layout_info->logo_img_magazine}" alt="{$layout_info->logo_text}" />
<!--@else-->
<block cond="$_onepage_header && $layout_info->logo_img_transparent">
{@ $_logo_img = $layout_info->logo_img_transparent}
</block>
<img src="{$_logo_img}" data-logo="{$layout_info->logo_img}"|cond="$_onepage_header && $layout_info->logo_img_transparent" alt="{$layout_info->logo_text}" />
<!--@endif-->
<img src="{$_logo_img}" data-logo="{$layout_info->logo_img}"|cond="$_onepage_header && $layout_info->logo_img_transparent" alt="{$layout_info->logo_text}" />
<!--@elseif($layout_info->logo_text)-->
{$layout_info->logo_text}
<!--@else-->
{@ $_logo_img = 'logo.png'}
<block cond="$_magazine_header">{@ $_logo_img = 'm_logo.png'}</block>

View file

@ -80,6 +80,7 @@ class addonController extends addon
{
// Add-on module for use in creating the cache file
$buff = array('<?php if(!defined("__XE__")) exit();', '$_m = Context::get(\'mid\');');
$buff[] = 'ob_start();';
$oAddonModel = getAdminModel('addon');
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
foreach($addon_list as $addon => $val)
@ -135,6 +136,7 @@ class addonController extends addon
$buff[] = '$addon_time_log->called_extension = "' . $addon . '";';
$buff[] = 'writeSlowlog("addon",$after_time-$before_time,$addon_time_log);';
}
$buff[] = 'ob_end_flush();';
$addon_path = _XE_PATH_ . 'files/cache/addons/';
FileHandler::makeDir($addon_path);
$addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php';

View file

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<permissions />
<permissions>
<permission action="procAddonAdminToggleActivate" target="manager" />
<permission action="dispAddonAdminSetup" target="manager" />
<permission action="procAddonAdminSetupAddon" target="manager" />
</permissions>
<actions>
<action name="dispAddonAdminIndex" type="view" admin_index="true" menu_name="installedAddon" menu_index="true" />
<action name="dispAddonAdminInfo" type="view" />
<action name="dispAddonAdminSetup" type="view" menu_name="installedAddon" />
<action name="procAddonAdminToggleActivate" type="controller" />
<action name="procAddonAdminSetupAddon" type="controller" ruleset="updateAddonSetup" />
<action name="procAddonAdminSaveActivate" type="controller" />
<action name="procAddonAdminSaveActivate" type="controller" />
</actions>
<menus>
<menu name="installedAddon">

View file

@ -140,7 +140,7 @@ class adminAdminController extends admin
$oMemberController = getController('member');
$oMemberController->procMemberLogout();
header('Location: ' . getNotEncodedUrl('', 'module', 'admin'));
header('Location: ' . getNotEncodedUrl(''));
}
public function procAdminInsertDefaultDesignInfo()

View file

@ -71,6 +71,7 @@ class adminAdminView extends admin
Context::set('use_html5', $db_info->use_html5 == 'Y' ? 'Y' : 'N');
Context::set('use_spaceremover', $db_info->use_spaceremover ? $db_info->use_spaceremover : 'Y'); //not use
Context::set('qmail_compatibility', $db_info->qmail_compatibility == 'Y' ? 'Y' : 'N');
Context::set('cache_friendly', $db_info->cache_friendly == 'Y' ? 'Y' : 'N');
Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y');
Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N');
Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none");

View file

@ -358,7 +358,7 @@
<value xml:lang="ko"><![CDATA[기본 URL]]></value>
<value xml:lang="en"><![CDATA[Default URL]]></value>
<value xml:lang="jp"><![CDATA[基本URL]]></value>
<value xml:lang="zh-CN"><![CDATA[XE通行证]]></value>
<value xml:lang="zh-CN"><![CDATA[预设网址]]></value>
<value xml:lang="zh-TW"><![CDATA[預設網址]]></value>
<value xml:lang="ru"><![CDATA[Основной URL]]></value>
<value xml:lang="tr"><![CDATA[Varsayılan URL]]></value>
@ -760,6 +760,18 @@
<value xml:lang="zh-CN"><![CDATA[启用Qmail]]></value>
<value xml:lang="tr"><![CDATA[Qmail etkinleştirin]]></value>
</item>
<item name="cache_friendly">
<value xml:lang="ko"><![CDATA[캐싱 최적화]]></value>
<value xml:lang="en"><![CDATA[Optimize for caching]]></value>
<value xml:lang="jp"><![CDATA[キャッシュに最適化]]></value>
<value xml:lang="zh-CN"><![CDATA[优化缓存]]></value>
<value xml:lang="tr"><![CDATA[Önbelleğe alma optimize]]></value>
</item>
<item name="about_cache_friendly">
<value xml:lang="ko"><![CDATA[Varnish 등의 캐싱 서버 사용시 성능 개선을 위해, 로그인하지 않은 사용자에게는 인증 세션을 부여하지 않습니다.<br>이 옵션을 선택할 경우 방문자 수 및 조회수 집계가 정확하지 않을 수 있습니다.]]></value>
<value xml:lang="en"><![CDATA[To improve performance when using a caching server such as Varnish, do not issue sessions to visitors until they log in.<br>Selecting this option may cause view counts and visitor counts to become inaccurate.]]></value>
<value xml:lang="jp"><![CDATA[Varnishなどのキャッシュサーバ使用時のパフォーマンスを向上させるために、ログインしていないユーザーには、認証セッションを付与しません。<br>このオプションを選択した場合、訪問者数とヒット集計が正確でない場合があります。]]></value>
</item>
<item name="sftp">
<value xml:lang="ko"><![CDATA[SFTP 사용]]></value>
<value xml:lang="en"><![CDATA[Use SFTP]]></value>
@ -1353,7 +1365,6 @@
<value xml:lang="jp"><![CDATA[PHPのsafe_modeがOnの場合、FTP情報を登録することで、XEのインストール及び利用が可能になります。]]></value>
<value xml:lang="zh-CN"><![CDATA[当PHP的safe_mode=On时请必须输入相关FTP信息否则将无法正常安装或使用XE程序。]]></value>
<value xml:lang="zh-TW"><![CDATA[當 PHP 的安全模式(safe_mode)開啟時,請輸入相關 FTP 資訊,否則無法正常安裝或使用程式。]]></value>
<value xml:lang="fr"><![CDATA[PHP의 safe_mode가 On일 경우 FTP 정보를 입력해야 XE의 설치 및 사용이 가능합니다]]></value>
<value xml:lang="de"><![CDATA[Zur Installation und Nutzung des XEs muss die Angabe des FTPs festgestellt werden, wenn safe_mode in PHP 'An' ist.]]></value>
<value xml:lang="es"><![CDATA[Si la la variable safe_mode está activa[safe_mode=On], debe rellenar los datos de FTP para seguir instalando y usar con normalidad el XE.]]></value>
<value xml:lang="tr"><![CDATA[Eğer PHP güvenli mod ayarları etkinse, XE'yi kurmak için FTP hesap bilgilerini girmelisiniz.]]></value>
@ -1397,7 +1408,6 @@
<value xml:lang="jp"><![CDATA[FTPでのディレクトリ作成に失敗しました。FTPサーバーの設定を再度確認してください。]]></value>
<value xml:lang="zh-CN"><![CDATA[新建文件夹失败。请确认 FTP服务器设置。]]></value>
<value xml:lang="zh-TW"><![CDATA[新增資料夾失敗。請確認 FTP 主機設置。]]></value>
<value xml:lang="fr"><![CDATA[FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요]]></value>
<value xml:lang="de"><![CDATA[Der Befehl von Herstellung des Verzeichnisses durch FTP ist gescheitert. FTP_Server festlegen.]]></value>
<value xml:lang="es"><![CDATA[Ha fallado el comando de FTP para la creación de directorio. Verifique la configuración del servicio FTP en el servidor]]></value>
<value xml:lang="tr"><![CDATA[Dizin oluşturma başarısız oldu. Lütfen FTP hesap iznini kontrol ediniz.]]></value>
@ -1410,7 +1420,6 @@
<value xml:lang="jp"><![CDATA[FTPでのディレクトリのアクセス権変更に失敗しました。FTPサーバーの設定を再度確認してください。]]></value>
<value xml:lang="zh-CN"><![CDATA[修改文件夹属性失败。请确认 FTP服务器设置。]]></value>
<value xml:lang="zh-TW"><![CDATA[修改資料夾權限失敗。請確認 FTP 主機設置。]]></value>
<value xml:lang="fr"><![CDATA[FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요]]></value>
<value xml:lang="de"><![CDATA[Die Modifikation der Zugriffsberechtigung des Verzeichnisses durch FTP ist gescheitert. FTP_Server festlegen.]]></value>
<value xml:lang="ru"><![CDATA[Chmod failed. Please check the permission and configuration of FTP server.]]></value>
<value xml:lang="es"><![CDATA[Ha fallado el comando de FTP para la modificación de atributos de directorio. Verifique la configuración del servicio FTP en el servidor.]]></value>
@ -1424,7 +1433,6 @@
<value xml:lang="jp"><![CDATA[FTP接続、および認証に成功しました。]]></value>
<value xml:lang="zh-CN"><![CDATA[FTP连接成功。]]></value>
<value xml:lang="zh-TW"><![CDATA[FTP連線成功。]]></value>
<value xml:lang="fr"><![CDATA[FTP 접속 및 인증 성공하였습니다]]></value>
<value xml:lang="de"><![CDATA[Die Verbindung zu FTP ist erfolgreich und verifiziert.]]></value>
<value xml:lang="es"><![CDATA[conexión con éxito al FTP]]></value>
<value xml:lang="tr"><![CDATA[FTP sunucusu için bağlantı ve kimlik doğrulaması sağlandı.]]></value>
@ -1457,12 +1465,30 @@
<value xml:lang="jp"><![CDATA[インストールされたXEのFTP絶対パス設定]]></value>
<value xml:lang="zh-CN"><![CDATA[FTP绝对路径设置]]></value>
<value xml:lang="zh-TW"><![CDATA[XE的 FTP 絕對路經]]></value>
<value xml:lang="fr"><![CDATA[설치된 XE의 FTP 절대경로]]></value>
<value xml:lang="de"><![CDATA[absoluten Pfad des FTPs, in dem XE installiert ist, festlegen.]]></value>
<value xml:lang="es"><![CDATA[설치된 XE의 FTP 절대경로]]></value>
<value xml:lang="tr"><![CDATA[XE Salt FTP Yolu]]></value>
<value xml:lang="vi"><![CDATA[Đường dẫn tuyệt đối của thư mục cài đặt XE trên FTP]]></value>
</item>
<item name="msg_php_warning_title">
<value xml:lang="ko"><![CDATA[안전하지 않은 PHP 버전 경고]]></value>
<value xml:lang="en"><![CDATA[Warning unsafe PHP version]]></value>
</item>
<item name="msg_php_warning_notice">
<value xml:lang="ko"><![CDATA[이 서버는 안전하지 않은 PHP 버전을 사용하고 있으며, PHP를 최신 안정 버전으로 업그레이드를 권장합니다.]]></value>
<value xml:lang="en"><![CDATA[The server is using a unsafe version of PHP, it is recommended to upgrade to the latest stable version.]]></value>
</item>
<item name="msg_php_warning_notice_explain">
<value xml:lang="ko"><![CDATA[<li>매우 심각한 PHP 보안 문제 및 공격에 노출될 수 있습니다.</li><li>XE 최신 버전을 사용할 수 없습니다.</li><li>XE 최신 버전 이상에서 지원하는 확장 기능을 사용할 수 없습니다.</li><li>일부 확장 기능이 동작하지 않거나, 이로 인해 장애가 발생할 수 있습니다.</li>]]></value>
<value xml:lang="en"><![CDATA[<li>PHP version of this server can be exposed to serious security problems and attacks.</li><li>Latest version of XE is not available.</li><li>You can not use extensions that are supported by the latest version of XE.</li><li>Some extensions may not work properly. It can cause problems.</li>]]></value>
</item>
<item name="msg_php_warning_now_version">
<value xml:lang="ko"><![CDATA[이 서버의 PHP 버전]]></value>
<value xml:lang="en"><![CDATA[PHP version of this server]]></value>
</item>
<item name="msg_php_warning_latest_version_check">
<value xml:lang="ko"><![CDATA[PHP 최신 안정버전 확인하기]]></value>
<value xml:lang="en"><![CDATA[Check the latest stable version of PHP]]></value>
</item>
<item name="admin_setup">
<value xml:lang="ko"><![CDATA[관리자 설정]]></value>
<value xml:lang="en"><![CDATA[Admin Setup]]></value>

Some files were not shown because too many files have changed in this diff Show more