Merge pull request #1 from rhymix/develop

UPDATE
This commit is contained in:
YJSoft 2016-02-17 18:33:17 +09:00
commit 94215ad7c4
182 changed files with 2906 additions and 2766 deletions

View file

@ -17,7 +17,7 @@ before_script:
- if [[ ! -f codecept.phar ]]; then wget http://codeception.com/codecept.phar; fi
script:
- if [[ -f codecept.phar ]]; then php codecept.phar build; fi
- if [[ $TRAVIS_PHP_VERSION == "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis --skip Install; fi
- if [[ $TRAVIS_PHP_VERSION == "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi
- if [[ $TRAVIS_PHP_VERSION != "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis; fi
- grunt lint
notifications:

View file

@ -39,6 +39,8 @@ module.exports = function(grunt) {
import : 2,
'adjoining-classes' : false,
'box-model' : false,
'box-sizing' : false,
'font-sizes' : false,
'duplicate-background-images' : false,
'ids' : false,
'important' : false,

View file

@ -10,36 +10,7 @@
<title xml:lang="ru">Общение</title>
<title xml:lang="zh-TW">交流</title>
<description xml:lang="ko">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="jp">
メッセージ・友達機能を使うにはこのアドオンを「使用」にして下さい。
</description>
<description xml:lang="zh-CN">
此插件可激活短信箱及添加好友功能。
</description>
<description xml:lang="en">
This addon enables the communication module in order to use messaging or friend functions.
Please enable this addon in case you want to use those functions.
</description>
<description xml:lang="vi">
Addon này cho phép sử dụng Module truyền thông để sử dụng tin nhắn hay chức năng bạn bè.
Hãy kích hoạt nếu bạn muốn sử dụng chức năng này.
</description>
<description xml:lang="ge">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="es">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="ru">
Активизирует модуль Общение, позволяет использование сообщений между друзьями.
</description>
<description xml:lang="zh-TW">
讓會員擁有短訊和新增好友功能。
이 애드온은 더 이상 역활을 하지 않습니다. 이 애드온의 기능은 커뮤니케이션 모듈로 흡수되었습니다.
</description>
<version>1.7</version>
<date>2013-11-27</date>
@ -56,39 +27,5 @@
<name xml:lang="zh-TW">NAVER</name>
</author>
<extra_vars>
<var name="use_alarm" type="select">
<title xml:lang="ko">알람기능 사용</title>
<title xml:lang="zh-CN">Using alarm</title>
<title xml:lang="jp">Using alarm</title>
<title xml:lang="zh-TW">Using alarm</title>
<title xml:lang="en">Using alarm</title>
<title xml:lang="ru">Using alarm</title>
<title xml:lang="vi">Using alarm</title>
<description xml:lang="ko">새로운 쪽지가 왔을때 팝업으로 알립니다.</description>
<description xml:lang="zh-CN">Pop-up alram when new message received.</description>
<description xml:lang="jp">Pop-up alram when new message received.</description>
<description xml:lang="zh-TW">Pop-up alram when new message received.</description>
<description xml:lang="en">Pop-up alram when new message received.</description>
<description xml:lang="ru">Pop-up alram when new message received.</description>
<description xml:lang="vi">Pop-up alram when new message received.</description>
<options value="">
<title xml:lang="ko">사용함</title>
<title xml:lang="zh-CN">Using</title>
<title xml:lang="jp">Using</title>
<title xml:lang="zh-TW">Using</title>
<title xml:lang="en">Using</title>
<title xml:lang="ru">Using</title>
<title xml:lang="vi">Using</title>
</options>
<options value="N">
<title xml:lang="ko">사용하지 않음</title>
<title xml:lang="zh-CN">Not using</title>
<title xml:lang="jp">Not using</title>
<title xml:lang="zh-TW">Not using</title>
<title xml:lang="en">Not using</title>
<title xml:lang="ru">Not using</title>
<title xml:lang="vi">Not using</title>
</options>
</var>
</extra_vars>
</addon>

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'У Вас новые сообщения. Проверите сейчас?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'Bạn có một tin nhắn mới. bạn có muốn kiểm tra ngay bây giờ không?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '您有新消息。要确认吗?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '您收到 %d 個新訊息。要檢視嗎?';

View file

@ -1,85 +1,6 @@
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/* 이 애드온은 communication 모둘로 흡수 되었습니다. */
if(!defined('__XE__'))
exit();
/**
* @file member_communication.addon.php
* @author NAVER (developers@xpressengine.com)
* @brief Promote user communication
*
* - Pop-up the message if new message comes in
* - When calling MemberModel::getMemberMenu, feature to send a message is added
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
*/
// Stop if non-logged-in user is
if(!Context::get('is_logged') || isCrawler())
{
return;
}
$logged_info = Context::get('logged_info');
/**
* Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
* */
if($this->module != 'member' && $called_position == 'before_module_init')
{
// Load a language file from the communication module
Context::loadLang(_XE_PATH_ . 'modules/communication/lang');
// Add menus on the member login information
$oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
$flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl;
if($addon_info->use_alarm != 'N' && file_exists($flag_file))
{
// Pop-up to display messages if a flag on new message is set
$new_message_count = (int) trim(FileHandler::readFile($flag_file));
FileHandler::removeFile($flag_file);
Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang');
Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true);
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
}
}
elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
{
$member_srl = Context::get('target_srl');
$oCommunicationModel = getModel('communication');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl)
{
$mid = Context::get('cur_mid');
$oMemberController = getController('member');
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
}
else
{
// Get member information
$oMemberModel = getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl)
{
return;
}
$oMemberController = getController('member');
// Add a menu for sending message
if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
}
}
/* End of file member_communication.addon.php */
/* Location: ./addons/member_communication/member_communication.addon.php */

View file

@ -1,26 +0,0 @@
(function($){
window.xeNotifyMessage = function(text, count){
var $bar;
$bar = $('div.message.info');
if(!$bar.length) {
$bar = $('<div class="message info" />')
.hide()
.css({
'position' : 'absolute',
'z-index' : '100',
})
.prependTo(document.body);
}
text = text.replace('%d', count);
var cur_module = current_url.getQuery('module');
if( cur_module == "admin" )
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'" target="_blank">'+text+'</a></p>').height();
else
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'">'+text+'</a></p>').height();
$bar.show().animate({top:0});
// hide after 10 seconds
setTimeout(function(){
$bar.slideUp();
}, 5000);
};
})(jQuery);

View file

@ -8,17 +8,22 @@
*/
class CacheHandler extends Handler
{
/**
* Instances are stored here.
*/
protected static $_instances = array();
/**
* instance of cache handler
* @var CacheBase
*/
var $handler = null;
protected $handler = null;
/**
* Version of key group
* @var int
*/
var $keyGroupVersions = null;
protected $keyGroupVersions = null;
/**
* Get a instance of CacheHandler(for singleton)
@ -28,14 +33,14 @@ class CacheHandler extends Handler
* @param boolean $always_use_file If set true, use a file cache always
* @return CacheHandler
*/
function getInstance($target = 'object', $info = null, $always_use_file = false)
public static function getInstance($target = 'object', $info = null, $always_use_file = false)
{
$cache_handler_key = $target . ($always_use_file ? '_file' : '');
if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key])
$key = 'object' . ($always_use_file ? '_file' : '');
if (!isset(self::$_instances[$key]))
{
$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file);
self::$_instances[$key] = new self($target, $info, $always_use_file);
}
return $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key];
return self::$_instances[$key];
}
/**
@ -44,84 +49,53 @@ class CacheHandler extends Handler
* Do not use this directly. You can use getInstance() instead.
*
* @see CacheHandler::getInstance
* @param string $target type of cache (object|template)
* @param string $target type of cache (object)
* @param object $info info. of DB
* @param boolean $always_use_file If set true, use a file cache always
* @return CacheHandler
*/
function __construct($target, $info = null, $always_use_file = false)
protected function __construct($target, $info = null, $always_use_file = false)
{
if(!$info)
// Allow using custom cache info for backward compatibility.
if (is_object($info) && $info->use_object_cache)
{
$info = Context::getDBInfo();
$cache_config = $cache_config_array = $info->use_object_cache;
}
if($info)
else
{
if($target == 'object')
$cache_config = $cache_config_array = config('cache');
if (is_array($cache_config) && count($cache_config))
{
if($info->use_object_cache == 'apc')
{
$type = 'apc';
}
else if(substr($info->use_object_cache, 0, 8) == 'memcache')
{
$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';
}
else if($info->use_object_cache == 'file')
{
$type = 'file';
}
else if($always_use_file)
{
$type = 'file';
}
}
else if($target == 'template')
{
if($info->use_template_cache == 'apc')
{
$type = 'apc';
}
else if(substr($info->use_template_cache, 0, 8) == 'memcache')
{
$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';
}
}
if($type)
{
$class = 'Cache' . ucfirst($type);
include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
$this->handler = call_user_func(array($class, 'getInstance'), $url);
$this->keyGroupVersions = $this->handler->get('key_group_versions', 0);
if(!$this->keyGroupVersions)
{
$this->keyGroupVersions = array();
$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
}
$cache_config = array_first($cache_config);
}
}
// Handle various types of cache backend.
if (preg_match('/^(apc|memcache|redis|wincache|file)/', strval($cache_config), $matches))
{
$type = $matches[1];
}
elseif ($always_use_file)
{
$type = 'file';
}
else
{
return;
}
// Create an instance of cache backend.
$class = 'Cache' . ucfirst($type);
include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
$this->handler = $class::getInstance($cache_config_array);
// Initialize key group versions.
$this->keyGroupVersions = $this->handler->get('key_group_versions', 0);
if(!$this->keyGroupVersions)
{
$this->keyGroupVersions = array();
$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
}
}
/**
@ -129,14 +103,19 @@ class CacheHandler extends Handler
*
* @return boolean
*/
function isSupport()
public function isSupport($type = null, $cache_config = null)
{
if($this->handler && $this->handler->isSupport())
if ($type === null)
{
return true;
return ($this->handler && $this->handler->isSupport());
}
else
{
$class = 'Cache' . ucfirst(str_replace('memcached', 'memcache', $type));
include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
$handler = $class::getInstance($cache_config, true);
return $handler->isSupport();
}
return false;
}
/**
@ -145,11 +124,9 @@ class CacheHandler extends Handler
* @param string $key The key that will be associated with the item.
* @return string Returns cache name
*/
function getCacheKey($key)
public function getCacheKey($key)
{
$key = str_replace('/', ':', $key);
return __XE_VERSION__ . ':' . $key;
return RX_VERSION . ':' . str_replace('/', ':', $key);
}
/**
@ -160,16 +137,10 @@ class CacheHandler extends Handler
* 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)
public function get($key, $modified_time = 0)
{
if(!$this->handler)
{
return false;
}
$key = $this->getCacheKey($key);
return $this->handler->get($key, $modified_time);
if (!$key) return false;
return $this->handler ? $this->handler->get($this->getCacheKey($key), $modified_time) : false;
}
/**
@ -182,16 +153,10 @@ class CacheHandler extends Handler
* If no ttl is supplied, use the default valid time.
* @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
*/
function put($key, $obj, $valid_time = 0)
public function put($key, $obj, $valid_time = 0)
{
if(!$this->handler && !$key)
{
return false;
}
$key = $this->getCacheKey($key);
return $this->handler->put($key, $obj, $valid_time);
if (!$key) return false;
return $this->handler ? $this->handler->put($this->getCacheKey($key), $obj, $valid_time) : false;
}
/**
@ -200,16 +165,10 @@ class CacheHandler extends Handler
* @param string $key Cache key
* @return void
*/
function delete($key)
public function delete($key)
{
if(!$this->handler)
{
return false;
}
$key = $this->getCacheKey($key);
return $this->handler->delete($key);
if (!$key) return false;
return $this->handler ? $this->handler->delete($this->getCacheKey($key)) : false;
}
/**
@ -220,16 +179,10 @@ class CacheHandler extends Handler
* 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)
public function isValid($key, $modified_time = 0)
{
if(!$this->handler)
{
return false;
}
$key = $this->getCacheKey($key);
return $this->handler->isValid($key, $modified_time);
if (!$key) return false;
return $this->handler ? $this->handler->isValid($this->getCacheKey($key), $modified_time) : false;
}
/**
@ -237,14 +190,9 @@ class CacheHandler extends Handler
*
* @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
*/
function truncate()
public function truncate()
{
if(!$this->handler)
{
return false;
}
return $this->handler->truncate();
return $this->handler ? $this->handler->truncate() : false;
}
/**
@ -263,7 +211,7 @@ class CacheHandler extends Handler
* @param string $key Cache key
* @return string
*/
function getGroupKey($keyGroupName, $key)
public function getGroupKey($keyGroupName, $key)
{
if(!$this->keyGroupVersions[$keyGroupName])
{
@ -280,12 +228,11 @@ class CacheHandler extends Handler
* @param string $keyGroupName Group name
* @return void
*/
function invalidateGroupKey($keyGroupName)
public function invalidateGroupKey($keyGroupName)
{
$this->keyGroupVersions[$keyGroupName]++;
$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
}
}
/**
@ -299,7 +246,7 @@ class CacheBase
* Default valid time
* @var int
*/
var $valid_time = 36000;
public $valid_time = 36000;
/**
* Get cached data
@ -309,7 +256,7 @@ class CacheBase
* 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)
public function get($key, $modified_time = 0)
{
return false;
}
@ -324,10 +271,18 @@ class CacheBase
* If no ttl is supplied, use the default valid time.
* @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
*/
function put($key, $obj, $valid_time = 0)
public function put($key, $obj, $valid_time = 0)
{
return false;
}
/**
* Alias of put()
*/
public function set($key, $obj, $valid_time = 0)
{
return $this->put($key, $obj, $valid_time = 0);
}
/**
* Return whether cache is valid or invalid
@ -337,7 +292,7 @@ class CacheBase
* 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)
public function isValid($key, $modified_time = 0)
{
return false;
}
@ -347,7 +302,7 @@ class CacheBase
*
* @return boolean
*/
function isSupport()
public function isSupport()
{
return false;
}
@ -357,7 +312,7 @@ class CacheBase
*
* @return bool|void Returns true on success or false on failure. If use CacheFile, returns void.
*/
function truncate()
public function truncate()
{
return false;
}

View file

@ -9,11 +9,12 @@
class CacheMemcache extends CacheBase
{
/**
* instance of Memcahe
* @var Memcahe
* Instance of Memcache
*/
var $Memcache;
var $SelectedExtension;
protected static $_instance;
protected $_conn;
protected $_status;
protected $_useExtension;
/**
* Get instance of CacheMemcache
@ -21,13 +22,13 @@ class CacheMemcache extends CacheBase
* @param string $url url of memcache
* @return CacheMemcache instance of CacheMemcache
*/
function getInstance($url)
public static function getInstance($url, $force_new_instance = false)
{
if(!$GLOBALS['__CacheMemcache__'])
if(!self::$_instance || $force_new_instance)
{
$GLOBALS['__CacheMemcache__'] = new CacheMemcache($url);
self::$_instance = new self($url);
}
return $GLOBALS['__CacheMemcache__'];
return self::$_instance;
}
/**
@ -37,19 +38,19 @@ class CacheMemcache extends CacheBase
* @param string $url url of memcache
* @return void
*/
function __construct($url)
protected function __construct($url)
{
//$config['url'] = array('memcache://localhost:11211');
$config['url'] = is_array($url) ? $url : array($url);
if(class_exists('Memcached'))
{
$this->Memcache = new Memcached;
$this->SelectedExtension = 'Memcached';
$this->_conn = new Memcached;
$this->_useExtension = 'Memcached';
}
elseif(class_exists('Memcache'))
{
$this->Memcache = new Memcache;
$this->SelectedExtension = 'Memcache';
$this->_conn = new Memcache;
$this->_useExtension = 'Memcache';
}
else
{
@ -59,7 +60,7 @@ class CacheMemcache extends CacheBase
foreach($config['url'] as $url)
{
$info = parse_url($url);
$this->Memcache->addServer($info['host'], $info['port']);
$this->_conn->addServer($info['host'], $info['port']);
}
}
@ -68,24 +69,24 @@ class CacheMemcache extends CacheBase
*
* @return bool Return true on support or false on not support
*/
function isSupport()
public function isSupport()
{
if(isset($GLOBALS['XE_MEMCACHE_SUPPORT']))
if(isset($this->_status))
{
return $GLOBALS['XE_MEMCACHE_SUPPORT'];
return $this->_status;
}
if($this->SelectedExtension === 'Memcached')
if($this->_useExtension === 'Memcached')
{
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1);
return $this->_status = $this->_conn->set('xe', 'xe', 1);
}
elseif($this->SelectedExtension === 'Memcache')
elseif($this->_useExtension === 'Memcache')
{
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1);
return $this->_status = $this->_conn->set('xe', 'xe', MEMCACHE_COMPRESSED, 1);
}
else
{
return $GLOBALS['XE_MEMCACHE_SUPPORT'] = false;
return $this->_status = false;
}
}
@ -95,7 +96,7 @@ class CacheMemcache extends CacheBase
* @param string $key Cache key
* @return string Return unique key
*/
function getKey($key)
protected function getKey($key)
{
return md5(_XE_PATH_ . $key);
}
@ -117,20 +118,20 @@ class CacheMemcache extends CacheBase
* If it's equal to zero, use the default valid time CacheMemcache::valid_time.
* @return bool Returns true on success or false on failure.
*/
function put($key, $buff, $valid_time = 0)
public function put($key, $buff, $valid_time = 0)
{
if($valid_time == 0)
{
$valid_time = $this->valid_time;
}
if($this->SelectedExtension === 'Memcached')
if($this->_useExtension === 'Memcached')
{
return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time);
return $this->_conn->set($this->getKey($key), array(time(), $buff), $valid_time);
}
else
{
return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time);
return $this->_conn->set($this->getKey($key), array(time(), $buff), MEMCACHE_COMPRESSED, $valid_time);
}
}
@ -142,20 +143,17 @@ class CacheMemcache extends CacheBase
* 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)
public function isValid($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->Memcache->get($_key);
$obj = $this->_conn->get($this->getKey($key));
if(!$obj || !is_array($obj))
{
return false;
}
unset($obj[1]);
if($modified_time > 0 && $modified_time > $obj[0])
{
$this->_delete($_key);
$this->delete($key);
return false;
}
@ -172,10 +170,9 @@ class CacheMemcache extends CacheBase
* 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)
public function get($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->Memcache->get($_key);
$obj = $this->_conn->get($this->getKey($key));
if(!$obj || !is_array($obj))
{
return false;
@ -183,12 +180,10 @@ class CacheMemcache extends CacheBase
if($modified_time > 0 && $modified_time > $obj[0])
{
$this->_delete($_key);
$this->delete($key);
return false;
}
unset($obj[0]);
return $obj[1];
}
@ -200,22 +195,9 @@ class CacheMemcache extends CacheBase
* @param string $key The key associated with the item to delete.
* @return void
*/
function delete($key)
public function delete($key)
{
$_key = $this->getKey($key);
$this->_delete($_key);
}
/**
* Delete item from the server(private)
*
* @see CacheMemcache::delete()
* @param string $_key The key associated with the item to delete.
* @return void
*/
function _delete($_key)
{
$this->Memcache->delete($_key);
return $this->_conn->delete($this->getKey($key));
}
/**
@ -227,9 +209,9 @@ class CacheMemcache extends CacheBase
*
* @return bool Returns true on success or false on failure.
*/
function truncate()
public function truncate()
{
return $this->Memcache->flush();
return $this->_conn->flush();
}
}

View file

@ -9,11 +9,11 @@
class CacheRedis extends CacheBase
{
/**
* instance of Redis
* @var redis
* Instance of Memcache
*/
var $redis;
var $status;
protected static $_instance;
protected $_conn;
protected $_status;
/**
* Get instance of CacheRedis
@ -21,13 +21,13 @@ class CacheRedis extends CacheBase
* @param string $url url of Redis
* @return CacheRedis instance of CacheRedis
*/
function getInstance($url)
public static function getInstance($url, $force_new_instance = false)
{
if(!$GLOBALS['__CacheRedis__'])
if(!self::$_instance || $force_new_instance)
{
$GLOBALS['__CacheRedis__'] = new CacheRedis($url);
self::$_instance = new self($url);
}
return $GLOBALS['__CacheRedis__'];
return self::$_instance;
}
/**
@ -37,34 +37,33 @@ class CacheRedis extends CacheBase
* @param string $url url of Redis
* @return void
*/
function __construct($url)
protected function __construct($url)
{
//$config['url'] = 'redis://localhost:6379/1';
$config['url'] = is_array($url) ? reset($url) : $url;
//$url = 'redis://localhost:6379/1';
$url = is_array($url) ? reset($url) : $url;
if(!class_exists('Redis'))
{
return $this->status = false;
$this->_status = false;
}
try
{
$this->redis = new Redis;
$this->_conn = new Redis;
$info = parse_url($url);
$this->redis->connect($info['host'], $info['port'], 0.15);
$this->_conn->connect($info['host'], $info['port'], 0.15);
if(isset($info['user']) || isset($info['pass']))
{
$this->redis->auth(isset($info['user']) ? $info['user'] : $info['pass']);
$this->_conn->auth(isset($info['user']) ? $info['user'] : $info['pass']);
}
if(isset($info['path']) && $dbnum = intval(substr($info['path'], 1)))
{
$this->redis->select($dbnum);
$this->_conn->select($dbnum);
}
return $this->status = true;
}
catch(RedisException $e)
{
return $this->status = false;
$this->_status = false;
}
}
@ -73,20 +72,20 @@ class CacheRedis extends CacheBase
*
* @return bool Return true on support or false on not support
*/
function isSupport()
public function isSupport()
{
if($this->status !== null)
if($this->_status !== null)
{
return $this->status;
return $this->_status;
}
try
{
return $this->redis->setex('xe', 1, 'xe');
return $this->_conn->setex('xe', 1, 'xe');
}
catch(RedisException $e)
{
return $this->status = false;
return $this->_status = false;
}
}
@ -96,7 +95,7 @@ class CacheRedis extends CacheBase
* @param string $key Cache key
* @return string Return unique key
*/
function getKey($key)
protected function getKey($key)
{
static $prefix = null;
if($prefix === null)
@ -123,7 +122,7 @@ class CacheRedis extends CacheBase
* 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)
public function put($key, $buff, $valid_time = 0)
{
if($valid_time > 60 * 60 * 24 * 30)
{
@ -136,11 +135,11 @@ class CacheRedis extends CacheBase
try
{
return $this->redis->setex($this->getKey($key), $valid_time, serialize(array($_SERVER['REQUEST_TIME'], $buff)));
return $this->_conn->setex($this->getKey($key), $valid_time, serialize(array($_SERVER['REQUEST_TIME'], $buff)));
}
catch(RedisException $e)
{
return $this->status = false;
return $this->_status = false;
}
}
@ -152,20 +151,18 @@ class CacheRedis extends CacheBase
* 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)
public function isValid($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->redis->get($_key);
$obj = $this->_conn->get($this->getKey($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);
$this->_conn->del($this->getKey($key));
return false;
}
@ -182,10 +179,9 @@ class CacheRedis extends CacheBase
* 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)
public function get($key, $modified_time = 0)
{
$_key = $this->getKey($key);
$obj = $this->redis->get($_key);
$obj = $this->_conn->get($this->getKey($key));
$obj = $obj ? unserialize($obj) : false;
if(!$obj || !is_array($obj))
{
@ -194,7 +190,7 @@ class CacheRedis extends CacheBase
if($modified_time > 0 && $modified_time > $obj[0])
{
$this->redis->del($_key);
$this->_conn->del($this->getKey($key));
return false;
}
@ -209,17 +205,15 @@ class CacheRedis extends CacheBase
* @param string $key The key associated with the item to delete.
* @return void
*/
function delete($key)
public function delete($key)
{
$_key = $this->getKey($key);
try
{
$this->redis->del($_key);
return $this->_conn->del($this->getKey($key));
}
catch(RedisException $e)
{
return $this->status = false;
return $this->_status = false;
}
}
@ -231,15 +225,15 @@ class CacheRedis extends CacheBase
*
* @return bool Returns true on success or false on failure.
*/
function truncate()
public function truncate()
{
try
{
return $this->redis->flushDB();
return $this->_conn->flushDB();
}
catch(RedisException $e)
{
return $this->status = false;
return $this->_status = false;
}
}

View file

@ -329,12 +329,12 @@ class Context
}
else
{
ob_start();
$this->setCacheControl(-1, true);
register_shutdown_function(array($this, 'checkSessionStatus'));
$_SESSION = array();
}
ob_start();
// set authentication information in Context and session
if(self::isInstalled())
{
@ -411,7 +411,7 @@ class Context
{
if(self::getSessionStatus())
{
return;
return true;
}
if($force_start || (count($_SESSION) && !headers_sent()))
{
@ -419,7 +419,9 @@ class Context
unset($_SESSION);
session_start();
$_SESSION = $tempSession;
return true;
}
return false;
}
/**
@ -429,7 +431,11 @@ class Context
*/
public static function close()
{
session_write_close();
// Check session status and close it if open.
if (self::checkSessionStatus())
{
session_write_close();
}
}
/**
@ -531,6 +537,10 @@ class Context
$db_info->ftp_info->ftp_root_path = $config['ftp']['path'];
$db_info->ftp_info->sftp = $config['ftp']['sftp'] ? 'Y' : 'N';
$db_info->default_url = $config['url']['default'];
if (!$db_info->default_url)
{
$db_info->default_url = (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . RX_BASEURL;
}
$db_info->http_port = $config['url']['http_port'];
$db_info->https_port = $config['url']['https_port'];
$db_info->use_ssl = $config['url']['ssl'];
@ -1464,18 +1474,39 @@ class Context
}
else
{
self::setBrowserTitle(self::getSiteTitle());
$oMessageObject = getView('message');
$oMessageObject->setHttpStatusCode(503);
$oMessageObject->setError(-1);
$oMessageObject->setMessage(_XE_SITELOCK_TITLE_);
$oMessageObject->dispMessage();
$oModuleHandler = new ModuleHandler;
$oModuleHandler->displayContent($oMessageObject);
self::displayErrorPage(_XE_SITELOCK_TITLE_, _XE_SITELOCK_MESSAGE_, 503);
}
exit;
}
/**
* Display a generic error page and exit.
*
* @param string $title
* @param string $message
* @return void
*/
public static function displayErrorPage($title = 'Error', $message = '', $status = 500)
{
// Change current directory to the Rhymix installation path.
chdir(\RX_BASEDIR);
// Set the title.
self::setBrowserTitle(self::getSiteTitle());
self::addBrowserTitle($title);
// Set the message.
$oMessageObject = getView('message');
$oMessageObject->setError(-1);
$oMessageObject->setHttpStatusCode($status);
$oMessageObject->setMessage($title);
$oMessageObject->dispMessage($message);
// Display the message.
$oModuleHandler = new ModuleHandler;
$oModuleHandler->displayContent($oMessageObject);
}
/**
* Return request method
* @return string Request method type. (Optional - GET|POST|XMLRPC|JSON)

View file

@ -22,24 +22,18 @@ class DB
* priority of DBMS
* @var array
*/
var $priority_dbms = array(
protected static $priority_dbms = array(
'mysqli' => 6,
'mysql' => 4,
'cubrid' => 2,
'mssql' => 1
);
/**
* count cache path
* @var string
*/
var $count_cache_path = 'files/cache/db';
/**
* operations for condition
* @var array
*/
var $cond_operation = array(
protected static $cond_operation = array(
'equal' => '=',
'more' => '>=',
'excess' => '>',
@ -54,83 +48,83 @@ class DB
* master database connection string
* @var array
*/
var $master_db = NULL;
protected $master_db = NULL;
/**
* array of slave databases connection strings
* @var array
*/
var $slave_db = NULL;
var $result = NULL;
protected $slave_db = NULL;
protected $result = NULL;
/**
* error code (0 means no error)
* @var int
*/
var $errno = 0;
protected $errno = 0;
/**
* error message
* @var string
*/
var $errstr = '';
protected $errstr = '';
/**
* query string of latest executed query
* @var string
*/
var $query = '';
var $connection = '';
protected $query = '';
protected $connection = '';
/**
* elapsed time of latest executed query
* @var int
*/
var $elapsed_time = 0;
protected $elapsed_time = 0;
/**
* elapsed time of latest executed DB class
* @var int
*/
var $elapsed_dbclass_time = 0;
protected $elapsed_dbclass_time = 0;
/**
* transaction flag
* @var boolean
*/
var $transaction_started = FALSE;
var $is_connected = FALSE;
protected $transaction_started = FALSE;
protected $is_connected = FALSE;
/**
* returns enable list in supported dbms list
* will be written by classes/DB/DB***.class.php
* @var array
*/
var $supported_list = array();
protected static $supported_list = array();
/**
* location of query cache
* @var string
*/
var $cache_file = 'files/cache/queries/';
protected $cache_file = 'files/cache/queries/';
/**
* stores database type: 'mysql','cubrid','mssql' etc. or 'db' when database is not yet set
* @var string
*/
var $db_type;
public $db_type;
/**
* flag to decide if class prepared statements or not (when supported); can be changed from db.config.info
* @var string
*/
var $use_prepared_statements;
public $use_prepared_statements;
/**
* leve of transaction
* @var unknown
*/
private $transactionNestedLevel = 0;
protected $transactionNestedLevel = 0;
/**
* returns instance of certain db type
@ -189,7 +183,6 @@ class DB
*/
public function __construct()
{
$this->count_cache_path = _XE_PATH_ . $this->count_cache_path;
$this->cache_file = _XE_PATH_ . $this->cache_file;
}
@ -199,10 +192,9 @@ class DB
* check by instance can creatable
* @return array return supported DBMS list
*/
function getSupportedList()
public static function getSupportedList()
{
$oDB = new DB();
return $oDB->_getSupportedList();
return self::_getSupportedList();
}
/**
@ -210,20 +202,18 @@ class DB
* this list return by child class
* @return array return enable DBMS list in supported dbms list
*/
function getEnableList()
public static function getEnableList()
{
is_a($this, 'DB') ? $self = $this : $self = self::getInstance();
if(!$self->supported_list)
if(!self::$supported_list)
{
$oDB = new DB();
$self->supported_list = $oDB->_getSupportedList();
self::$supported_list = self::_getSupportedList();
}
$enableList = array();
if(is_array($self->supported_list))
if(is_array(self::$supported_list))
{
foreach($self->supported_list AS $key => $value)
foreach(self::$supported_list AS $key => $value)
{
if($value->enable)
{
@ -239,20 +229,18 @@ class DB
* this list return by child class
* @return array return disable DBMS list in supported dbms list
*/
function getDisableList()
public static function getDisableList()
{
is_a($this, 'DB') ? $self = $this : $self = self::getInstance();
if(!$self->supported_list)
if(!self::$supported_list)
{
$oDB = new DB();
$self->supported_list = $oDB->_getSupportedList();
self::$supported_list = self::_getSupportedList();
}
$disableList = array();
if(is_array($self->supported_list))
if(is_array(self::$supported_list))
{
foreach($self->supported_list AS $key => $value)
foreach(self::$supported_list AS $key => $value)
{
if(!$value->enable)
{
@ -265,17 +253,16 @@ class DB
/**
* returns list of supported dbms list
* this method is private
*
* @return array return supported DBMS list
*/
function _getSupportedList()
protected static function _getSupportedList()
{
static $get_supported_list = '';
if(is_array($get_supported_list))
if(self::$supported_list)
{
$this->supported_list = $get_supported_list;
return $this->supported_list;
return self::$supported_list;
}
$get_supported_list = array();
$db_classes_path = _XE_PATH_ . "classes/db/";
$filter = "/^DB([^\.]+)\.class\.php/i";
@ -303,41 +290,13 @@ class DB
}
// sort
@usort($get_supported_list, array($this, '_sortDBMS'));
usort($get_supported_list, function($a, $b) {
$priority_a = isset(self::$priority_dbms[$a->db_type]) ? self::$priority_dbms[$a->db_type] : 0;
$priority_b = isset(self::$priority_dbms[$b->db_type]) ? self::$priority_dbms[$b->db_type] : 0;
return $a - $b;
});
$this->supported_list = $get_supported_list;
return $this->supported_list;
}
/**
* sort dbms as priority
*/
function _sortDBMS($a, $b)
{
if(!isset($this->priority_dbms[$a->db_type]))
{
$priority_a = 0;
}
else
{
$priority_a = $this->priority_dbms[$a->db_type];
}
if(!isset($this->priority_dbms[$b->db_type]))
{
$priority_b = 0;
}
else
{
$priority_b = $this->priority_dbms[$b->db_type];
}
if($priority_a == $priority_b)
{
return 0;
}
return ($priority_a > $priority_b) ? -1 : 1;
return self::$supported_list = $get_supported_list;
}
/**
@ -345,7 +304,7 @@ class DB
* The value is set in the child class
* @return boolean true: is supported, false: is not supported
*/
function isSupported()
public function isSupported()
{
return self::$isSupported;
}
@ -356,7 +315,7 @@ class DB
* @param int $indx key of server list
* @return boolean true: connected, false: not connected
*/
function isConnected($type = 'master', $indx = 0)
public function isConnected($type = 'master', $indx = 0)
{
if($type == 'master')
{
@ -373,7 +332,7 @@ class DB
* @param string $query query string
* @return void
*/
function actStart($query)
public function actStart($query)
{
$this->setError(0, 'success');
$this->query = $query;
@ -385,7 +344,7 @@ class DB
* finish recording log
* @return void
*/
function actFinish()
public function actFinish()
{
if(!$this->query)
{
@ -405,55 +364,47 @@ class DB
$log['module'] = $site_module_info->module;
$log['act'] = Context::get('act');
$log['time'] = date('Y-m-d H:i:s');
$log['backtrace'] = array();
$bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
foreach($bt as $no => $call)
if (config('debug.enabled') && config('debug.log_queries'))
{
if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
$bt = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
foreach($bt as $no => $call)
{
$call_no = $no;
$call_no++;
$log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line'];
$log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']);
$call_no++;
$log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function'];
break;
}
}
// leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined)
if($this->isError())
{
$log['result'] = 'Failed';
$log['errno'] = $this->errno;
$log['errstr'] = $this->errstr;
if(__DEBUG_DB_OUTPUT__ == 1)
{
$debug_file = _XE_PATH_ . "files/_debug_db_query.php";
$buff = array();
if(!file_exists($debug_file))
if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
{
$buff[] = '<?php exit(); ?' . '>';
$call_no = $no;
$call_no++;
$log['called_file'] = $bt[$call_no]['file'];
$log['called_line'] = $bt[$call_no]['line'];
$call_no++;
$log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function'];
$log['backtrace'] = array_slice($bt, $call_no, 1);
break;
}
$buff[] = print_r($log, TRUE);
@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX);
}
}
else
{
$log['result'] = 'Success';
$log['called_file'] = $log['called_line'] = $log['called_method'] = null;
$log['backtrace'] = array();
}
// leave error log if an error occured
if($this->isError())
{
$log['result'] = 'error';
$log['errno'] = $this->errno;
$log['errstr'] = $this->errstr;
}
else
{
$log['result'] = 'success';
$log['errno'] = null;
$log['errstr'] = null;
}
$this->setQueryLog($log);
$log_args = new stdClass;
$log_args->query = $this->query;
$log_args->query_id = $this->query_id;
$log_args->caller = $log['called_method'] . '() in ' . $log['called_file'];
$log_args->connection = $log['connection'];
writeSlowlog('query', $elapsed_time, $log_args);
}
/**
@ -461,9 +412,9 @@ class DB
* @param array $log values set query debug
* @return void
*/
function setQueryLog($log)
public function setQueryLog($log)
{
$GLOBALS['__db_queries__'][] = $log;
Rhymix\Framework\Debug::addQuery($log);
}
/**
@ -472,7 +423,7 @@ class DB
* @param string $errstr error message
* @return void
*/
function setError($errno = 0, $errstr = 'success')
public function setError($errno = 0, $errstr = 'success')
{
$this->errno = $errno;
$this->errstr = $errstr;
@ -482,7 +433,7 @@ class DB
* Return error status
* @return boolean true: error, false: no error
*/
function isError()
public function isError()
{
return ($this->errno !== 0);
}
@ -491,7 +442,7 @@ class DB
* Returns object of error info
* @return object object of error
*/
function getError()
public function getError()
{
$this->errstr = Context::convertEncodingStr($this->errstr);
return new Object($this->errno, $this->errstr);
@ -505,7 +456,7 @@ class DB
* @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns
* @return object result of query
*/
function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $type = NULL)
public function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $type = NULL)
{
static $cache_file = array();
@ -572,7 +523,7 @@ class DB
* @param string $xml_file original xml query file
* @return string cache file
*/
function checkQueryCacheFile($query_id, $xml_file)
public function checkQueryCacheFile($query_id, $xml_file)
{
// first try finding cache file
$cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type);
@ -601,7 +552,7 @@ class DB
* @param array $arg_columns column list. if you want get specific colums from executed result, add column list to $arg_columns
* @return object result of query
*/
function _executeQuery($cache_file, $source_args, $query_id, $arg_columns, $type)
public function _executeQuery($cache_file, $source_args, $query_id, $arg_columns, $type)
{
global $lang;
@ -619,7 +570,7 @@ class DB
$output = include($cache_file);
if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool())
if($output instanceof Object && !$output->toBool())
{
return $output;
}
@ -652,7 +603,7 @@ class DB
{
$output = $this->getError();
}
else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object'))
elseif(!($output instanceof Object))
{
$output = new Object();
}
@ -668,57 +619,9 @@ class DB
* @param string $condition condition to get data
* @return int count of cache data
*/
function getCountCache($tables, $condition)
public function getCountCache($tables, $condition)
{
return FALSE;
/*
if(!$tables)
{
return FALSE;
}
if(!is_dir($this->count_cache_path))
{
return FileHandler::makeDir($this->count_cache_path);
}
$condition = md5($condition);
if(!is_array($tables))
{
$tables_str = $tables;
}
else
{
$tables_str = implode('.', $tables);
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
if(!file_exists($cache_filename))
{
return FALSE;
}
$cache_mtime = filemtime($cache_filename);
if(!is_array($tables))
{
$tables = array($tables);
}
foreach($tables as $alias => $table)
{
$table_filename = sprintf('%s/cache.%s%s', $this->count_cache_path, $this->prefix, $table);
if(!file_exists($table_filename) || filemtime($table_filename) > $cache_mtime)
{
return FALSE;
}
}
$count = (int) FileHandler::readFile($cache_filename);
return $count;
*/
}
/**
@ -728,37 +631,9 @@ class DB
* @param int $count count of cache data to save
* @return void
*/
function putCountCache($tables, $condition, $count = 0)
public function putCountCache($tables, $condition, $count = 0)
{
return FALSE;
/*
if(!$tables)
{
return FALSE;
}
if(!is_dir($this->count_cache_path))
{
return FileHandler::makeDir($this->count_cache_path);
}
$condition = md5($condition);
if(!is_array($tables))
{
$tables_str = $tables;
}
else
{
$tables_str = implode('.', $tables);
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
FileHandler::writeFile($cache_filename, $count);
*/
}
/**
@ -766,29 +641,9 @@ class DB
* @param array|string $tables tables to reset cache data
* @return boolean true: success, false: failed
*/
function resetCountCache($tables)
public function resetCountCache($tables)
{
return FALSE;
/*
if(!$tables)
{
return FALSE;
}
return FileHandler::makeDir($this->count_cache_path);
if(!is_array($tables))
{
$tables = array($tables);
}
foreach($tables as $alias => $table)
{
$filename = sprintf('%s/cache.%s%s', $this->count_cache_path, $this->prefix, $table);
FileHandler::removeFile($filename);
FileHandler::writeFile($filename, '');
}
return TRUE;
*/
}
/**
@ -796,7 +651,7 @@ class DB
* @param string $table_name
* @return void
*/
function dropTable($table_name)
public function dropTable($table_name)
{
if(!$table_name)
{
@ -812,7 +667,7 @@ class DB
* @param boolean $with_values
* @return string
*/
function getSelectSql($query, $with_values = TRUE)
public function getSelectSql($query, $with_values = TRUE)
{
$select = $query->getSelectString($with_values);
if($select == '')
@ -881,7 +736,7 @@ class DB
*
* @param $queryObject
*/
function getClickCountQuery($queryObject)
public function getClickCountQuery($queryObject)
{
$new_update_columns = array();
$click_count_columns = $queryObject->getClickCountColumns();
@ -907,7 +762,7 @@ class DB
* @param boolean $with_priority
* @return string
*/
function getDeleteSql($query, $with_values = TRUE, $with_priority = FALSE)
public function getDeleteSql($query, $with_values = TRUE, $with_priority = FALSE)
{
$sql = 'DELETE ';
@ -939,7 +794,7 @@ class DB
* @param boolean $with_priority
* @return string
*/
function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE)
public function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE)
{
$columnsList = $query->getUpdateString($with_values);
if($columnsList == '')
@ -971,7 +826,7 @@ class DB
* @param boolean $with_priority
* @return string
*/
function getInsertSql($query, $with_values = TRUE, $with_priority = FALSE)
public function getInsertSql($query, $with_values = TRUE, $with_priority = FALSE)
{
$tableName = $query->getFirstTableName();
$values = $query->getInsertString($with_values);
@ -984,7 +839,7 @@ class DB
* Return index from slave server list
* @return int
*/
function _getSlaveConnectionStringIndex()
public function _getSlaveConnectionStringIndex()
{
$max = count($this->slave_db);
$indx = rand(0, $max - 1);
@ -997,7 +852,7 @@ class DB
* @param int $indx if indx value is NULL, return rand number in slave server list
* @return resource
*/
function _getConnection($type = 'master', $indx = NULL)
public function _getConnection($type = 'master', $indx = NULL)
{
if($type == 'master' || $this->transactionNestedLevel)
{
@ -1005,7 +860,7 @@ class DB
{
$this->_connect($type);
}
$this->connection = 'Master ' . $this->master_db['host'];
$this->connection = 'master (' . $this->master_db['host'] . ')';
return $this->master_db["resource"];
}
@ -1020,7 +875,7 @@ class DB
{
$this->_connect($type);
}
$this->connection = 'Master ' . $this->master_db['host'];
$this->connection = 'master (' . $this->master_db['host'] . ')';
return $this->master_db["resource"];
}
@ -1028,7 +883,7 @@ class DB
{
$this->_connect($type, $indx);
}
$this->connection = 'Slave ' . $this->slave_db[$indx]['host'];
$this->connection = 'slave (' . $this->slave_db[$indx]['host'] . ')';
return $this->slave_db[$indx]["resource"];
}
@ -1036,26 +891,18 @@ class DB
* check db information exists
* @return boolean
*/
function _dbInfoExists()
public function _dbInfoExists()
{
if(!$this->master_db)
{
return FALSE;
}
if(count($this->slave_db) === 0)
{
return FALSE;
}
return TRUE;
return ($this->master_db && count($this->slave_db));
}
/**
* DB disconnection
* this method is protected
*
* @param resource $connection
* @return void
*/
function _close($connection)
protected function _close($connection)
{
}
@ -1066,7 +913,7 @@ class DB
* @param int $indx number in slave dbms server list
* @return void
*/
function close($type = 'master', $indx = 0)
public function close($type = 'master', $indx = 0)
{
if(!$this->isConnected($type, $indx))
{
@ -1093,7 +940,7 @@ class DB
* this method is protected
* @return boolean
*/
function _begin($transactionLevel = 0)
protected function _begin($transactionLevel = 0)
{
return TRUE;
}
@ -1102,7 +949,7 @@ class DB
* DB transaction start
* @return void
*/
function begin()
public function begin()
{
if(!$this->isConnected())
{
@ -1121,7 +968,7 @@ class DB
* this method is protected
* @return boolean
*/
function _rollback($transactionLevel = 0)
protected function _rollback($transactionLevel = 0)
{
return TRUE;
}
@ -1130,7 +977,7 @@ class DB
* DB transaction rollback
* @return void
*/
function rollback()
public function rollback()
{
if(!$this->isConnected() || !$this->transaction_started)
{
@ -1152,7 +999,7 @@ class DB
* this method is protected
* @return boolean
*/
function _commit()
protected function _commit()
{
return TRUE;
}
@ -1162,7 +1009,7 @@ class DB
* @param boolean $force regardless transaction start status or connect status, forced to commit
* @return void
*/
function commit($force = FALSE)
public function commit($force = FALSE)
{
if(!$force && (!$this->isConnected() || !$this->transaction_started))
{
@ -1186,19 +1033,19 @@ class DB
* @param resource $connection
* @return void
*/
function __query($query, $connection)
protected function __query($query, $connection)
{
}
/**
* Execute the query
* this method is protected
*
* @param string $query
* @param resource $connection
* @return resource
*/
function _query($query, $connection = NULL)
public function _query($query, $connection = NULL)
{
if($connection == NULL)
{
@ -1221,7 +1068,7 @@ class DB
* this method is protected
* @return void
*/
function _setDBInfo()
protected function _setDBInfo()
{
$db_info = config('db');
$this->master_db = $db_info['master'];
@ -1236,7 +1083,7 @@ class DB
* @param array $connection
* @return void
*/
function __connect($connection)
protected function __connect($connection)
{
}
@ -1247,7 +1094,7 @@ class DB
* @param resource $connection
* @return void
*/
function _afterConnect($connection)
protected function _afterConnect($connection)
{
}
@ -1259,7 +1106,7 @@ class DB
* @param int $indx number in slave dbms server list
* @return void
*/
function _connect($type = 'master', $indx = 0)
protected function _connect($type = 'master', $indx = 0)
{
if($this->isConnected($type, $indx))
{
@ -1293,7 +1140,7 @@ class DB
$connection["is_connected"] = TRUE;
// Save connection info for db logs
$this->connection = ucfirst($type) . ' ' . $connection['host'];
$this->connection = $type . ' (' . $connection['host'] . ')';
// regist $this->close callback
register_shutdown_function(array($this, "close"));
@ -1305,7 +1152,7 @@ class DB
* Start recording DBClass log
* @return void
*/
function actDBClassStart()
public function actDBClassStart()
{
$this->setError(0, 'success');
$this->act_dbclass_start = microtime(true);
@ -1316,7 +1163,7 @@ class DB
* Finish recording DBClass log
* @return void
*/
function actDBClassFinish()
public function actDBClassFinish()
{
if(!$this->query)
{
@ -1338,7 +1185,7 @@ class DB
* @param boolean $force force load DBParser instance
* @return DBParser
*/
function getParser($force = FALSE)
public function getParser($force = FALSE)
{
static $dbParser = NULL;
if(!$dbParser || $force)

View file

@ -107,12 +107,6 @@ class DBCubrid extends DB
*/
function addQuotes($string)
{
if(version_compare(PHP_VERSION, "5.4.0", "<") &&
get_magic_quotes_gpc())
{
$string = stripslashes(str_replace("\\", "\\\\", $string));
}
if(!is_numeric($string))
{
/*
@ -977,8 +971,6 @@ class DBCubrid extends DB
return;
}
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query);
if($result && !$this->transaction_started)
{
@ -1008,8 +1000,6 @@ class DBCubrid extends DB
return;
}
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query);
if($result && !$this->transaction_started)
@ -1040,8 +1030,6 @@ class DBCubrid extends DB
return;
}
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query);
if($result && !$this->transaction_started)
@ -1083,7 +1071,6 @@ class DBCubrid extends DB
return;
}
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query, $connection);
if($this->isError())
@ -1153,7 +1140,6 @@ class DBCubrid extends DB
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
$result = $this->_query($count_query, $connection);
$count_output = $this->_fetch($result);
$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
@ -1201,7 +1187,6 @@ class DBCubrid extends DB
$start_count = ($page - 1) * $list_count;
$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query, $connection);
if($this->isError())
{

View file

@ -94,10 +94,6 @@ class DBMssql extends DB
*/
function addQuotes($string)
{
if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
{
$string = stripslashes(str_replace("\\", "\\\\", $string));
}
//if(!is_numeric($string)) $string = str_replace("'","''",$string);
return $string;
@ -947,8 +943,6 @@ class DBMssql extends DB
// TODO Decide if we continue to pass parameters like this
$this->param = $queryObject->getArguments();
$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query, $connection);
if($this->isError())
@ -1028,7 +1022,6 @@ class DBMssql extends DB
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$this->param = $queryObject->getArguments();
$result_count = $this->_query($count_query, $connection);
$count_output = $this->_fetch($result_count);

View file

@ -116,10 +116,6 @@ class DBMysql extends DB
*/
function addQuotes($string)
{
if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
{
$string = stripslashes(str_replace("\\", "\\\\", $string));
}
if(!is_numeric($string))
{
$string = @mysql_real_escape_string($string);
@ -693,7 +689,6 @@ class DBMysql extends DB
function _executeInsertAct($queryObject, $with_values = true)
{
$query = $this->getInsertSql($queryObject, $with_values, true);
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
if(is_a($query, 'Object'))
{
return;
@ -715,10 +710,6 @@ class DBMysql extends DB
if(!$query->toBool()) return $query;
else return;
}
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
return $this->_query($query);
}
@ -731,7 +722,6 @@ class DBMysql extends DB
function _executeDeleteAct($queryObject, $with_values = true)
{
$query = $this->getDeleteSql($queryObject, $with_values, true);
$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
if(is_a($query, 'Object'))
{
return;
@ -763,7 +753,6 @@ class DBMysql extends DB
{
return;
}
$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
$result = $this->_query($query, $connection);
if($this->isError())
@ -884,7 +873,6 @@ class DBMysql extends DB
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
}
$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
$result_count = $this->_query($count_query, $connection);
$count_output = $this->_fetch($result_count);
$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
@ -931,7 +919,6 @@ class DBMysql extends DB
$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
$result = $this->_query($query, $connection);
if($this->isError())
{

View file

@ -61,10 +61,6 @@ class DBMysqli extends DBMysql
*/
function addQuotes($string)
{
if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
{
$string = stripslashes(str_replace("\\", "\\\\", $string));
}
if(!is_numeric($string))
{
$connection = $this->_getConnection('master');

View file

@ -11,7 +11,7 @@
*/
class DisplayHandler extends Handler
{
public static $response_size = 0;
var $content_size = 0; // /< The size of displaying contents
var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip
var $handler = NULL;
@ -60,12 +60,17 @@ class DisplayHandler extends Handler
// call a trigger before display
ModuleHandler::triggerCall('display', 'before', $output);
$original_output = $output;
// execute add-on
$called_position = 'before_display_content';
$oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if(file_exists($addon_file)) include($addon_file);
if($output === false || $output === null || $output instanceof Object)
{
$output = $original_output;
}
if(method_exists($handler, "prepareToPrint"))
{
@ -73,10 +78,9 @@ class DisplayHandler extends Handler
}
// Start the session if $_SESSION was touched
Context::getInstance()->checkSessionStatus();
Context::checkSessionStatus();
// header output
$httpStatusCode = $oModule->getHttpStatusCode();
if($httpStatusCode && $httpStatusCode != 200)
{
@ -102,7 +106,10 @@ class DisplayHandler extends Handler
}
// disable gzip if output already exists
ob_flush();
while (ob_get_level())
{
ob_end_flush();
}
if(headers_sent())
{
$this->gz_enabled = FALSE;
@ -114,201 +121,118 @@ class DisplayHandler extends Handler
ini_set('zlib.output_compression', true);
}
// results directly output
print $output;
// debugOutput output
$this->content_size = strlen($output);
print $this->_debugOutput();
// call a trigger after display
self::$response_size = $this->content_size = strlen($output);
ModuleHandler::triggerCall('display', 'after', $output);
flushSlowlog();
// Output the page content and debug data.
$debug = $this->getDebugInfo($output);
print $output;
print $debug;
}
/**
* Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n
* This method only functions when __DEBUG__ variable is set to 1.
* __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php
* @return void
* Get debug information.
*
* @return string
*/
public function _debugOutput()
public function getDebugInfo(&$output)
{
if(!__DEBUG__)
// Check if debugging is enabled for this request.
if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser())
{
return;
}
$end = microtime(true);
// Firebug console output
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
// Print debug information.
switch ($display_type = config('debug.display_type'))
{
static $firephp;
if(!isset($firephp))
{
$firephp = FirePHP::getInstance(true);
}
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
{
$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
return;
}
// display total execution time and Request/Response info
if(__DEBUG__ & 2)
{
$firephp->fb(
array(
'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(),
array(
array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'),
array(
sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']),
$_SERVER['REQUEST_METHOD'],
Context::getResponseMethod(),
$this->content_size . ' byte',
FileHandler::filesize(memory_get_peak_usage())
)
)
),
'TABLE'
);
$firephp->fb(
array(
'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - RX_MICROTIME),
array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'),
array(
sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
sprintf('%0.5f sec', $GLOBALS['__elapsed_class_load__']),
sprintf('%0.5f sec (%d called)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']),
sprintf('%0.5f sec', $GLOBALS['__xmlparse_elapsed__']),
sprintf('%0.5f sec', $end - RX_MICROTIME - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']),
sprintf('%0.5f sec', $GLOBALS['__widget_excute_elapsed__']),
sprintf('%0.5f sec', $GLOBALS['__trans_content_elapsed__'])
)
)
),
'TABLE'
);
}
// display DB query history
if((__DEBUG__ & 4) && $GLOBALS['__db_queries__'])
{
$queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query'));
foreach($GLOBALS['__db_queries__'] as $query)
case 'panel':
$data = Rhymix\Framework\Debug::getDebugData();
if ($data->entries)
{
$queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']);
}
$firephp->fb(
array(
'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
$queries_output
),
'TABLE'
);
}
// dislpay the file and HTML comments
}
else
{
$buff = array();
// display total execution time and Request/Response info
if(__DEBUG__ & 2)
{
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
{
return;
}
// Request/Response information
$buff[] = "\n- Request/ Response info";
$buff[] = sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']);
$buff[] = sprintf("\tRequest method \t\t\t: %s", $_SERVER['REQUEST_METHOD']);
$buff[] = sprintf("\tResponse method \t\t: %s", Context::getResponseMethod());
$buff[] = sprintf("\tResponse contents size\t: %d byte", $this->content_size);
// total execution time
$buff[] = sprintf("\n- Total elapsed time : %0.5f sec", $end - RX_MICROTIME);
$buff[] = sprintf("\tclass file load elapsed time \t: %0.5f sec", $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tTemplate compile elapsed time\t: %0.5f sec (%d called)", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']);
$buff[] = sprintf("\tXmlParse compile elapsed time\t: %0.5f sec", $GLOBALS['__xmlparse_elapsed__']);
$buff[] = sprintf("\tPHP elapsed time \t\t\t\t: %0.5f sec", $end - RX_MICROTIME - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tDB class elapsed time \t\t\t: %0.5f sec", $GLOBALS['__dbclass_elapsed_time__'] - $GLOBALS['__db_elapsed_time__']);
// widget execution time
$buff[] = sprintf("\tWidgets elapsed time \t\t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']);
// layout execution time
$buff[] = sprintf("\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']);
// Widgets, the editor component replacement time
$buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']);
}
// DB Logging
if(__DEBUG__ & 4)
{
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
{
return;
}
if($GLOBALS['__db_queries__'])
{
$buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
$num = 0;
foreach($GLOBALS['__db_queries__'] as $query)
foreach ($data->entries as &$entry)
{
if($query['result'] == 'Success')
if (is_scalar($entry->message))
{
$query_result = "Query Success";
$entry->message = var_export($entry->message, true);
}
else
{
$query_result = sprintf("Query $s : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']);
$entry->message = trim(print_r($entry->message, true));
}
$buff[] = sprintf("\t%02d. %s\n\t\t%0.6f sec. %s.", ++$num, $query['query'], $query['elapsed_time'], $query_result);
$buff[] = sprintf("\t\tConnection: %s.", $query['connection']);
$buff[] = sprintf("\t\tQuery ID: %s", $query['query_id']);
$buff[] = sprintf("\t\tCalled: %s. %s()", str_replace(_XE_PATH_, '', $query['called_file']), $query['called_method']);
}
}
}
// Output in HTML comments
if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML')
{
$buff = implode("\r\n", $buff);
$buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
switch (Context::getResponseMethod())
{
$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
case 'HTML':
$json_options = defined('JSON_PRETTY_PRINT') ? (JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) : 0;
$panel_script = sprintf('<script src="%s%s?%s"></script>', RX_BASEURL, 'common/js/debug.js', filemtime(RX_BASEDIR . 'common/js/debug.js'));
if (isset($_SESSION['_rx_debug_previous']))
{
$panel_script .= "\n<script>\nvar rhymix_debug_previous = " . json_encode($_SESSION['_rx_debug_previous'], $json_options) . ";\n</script>";
unset($_SESSION['_rx_debug_previous']);
}
$panel_script .= "\n<script>\nvar rhymix_debug_content = " . json_encode($data, $json_options) . ";\n</script>";
$body_end_position = strrpos($output, '</body>') ?: strlen($output);
$output = substr($output, 0, $body_end_position) . "\n$panel_script\n" . substr($output, $body_end_position);
return;
case 'JSON':
if (RX_POST && preg_match('/^proc/', Context::get('act')))
{
$data->ajax_module = Context::get('module');
$data->ajax_act = Context::get('act');
$_SESSION['_rx_debug_previous'] = $data;
}
else
{
unset($_SESSION['_rx_debug_previous']);
}
if (preg_match('/^(.+)\}$/', $output, $matches))
{
$output = $matches[1] . ',"_rx_debug":' . json_encode($data) . '}';
}
return;
default:
return;
}
return "<!--\r\n" . $buff . "\r\n-->";
}
// Output to a file
if($buff && __DEBUG_OUTPUT__ == 0)
{
$debug_file = _XE_PATH_ . 'files/_debug_message.php';
$buff = implode(PHP_EOL, $buff);
$buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true));
$buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80);
$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX))
case 'comment':
case 'file':
default:
if ($display_type === 'comment' && Context::getResponseMethod() !== 'HTML')
{
return;
}
}
ob_start();
$data = Rhymix\Framework\Debug::getDebugData();
include RX_BASEDIR . 'common/tpl/debug_comment.html';
$content = ob_get_clean();
if ($display_type === 'file')
{
$log_filename = config('debug.log_filename') ?: 'files/debug/YYYYMMDD.php';
$log_filename = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array(
getInternalDateTime(RX_TIME, 'Y'),
getInternalDateTime(RX_TIME, 'y'),
getInternalDateTime(RX_TIME, 'm'),
getInternalDateTime(RX_TIME, 'd'),
), $log_filename);
$log_filename = RX_BASEDIR . $log_filename;
if (!file_exists($log_filename) || !filesize($log_filename))
{
$phpheader = '<?php exit; ?>' . "\n";
}
else
{
$phpheader = '';
}
FileHandler::writeFile($log_filename, $phpheader . $content, 'a');
return '';
}
else
{
return '<!--' . PHP_EOL . $content . PHP_EOL . '-->';
}
}
}

View file

@ -86,10 +86,7 @@ class HTMLDisplayHandler
if(Context::get('layout') != 'none')
{
if(__DEBUG__ == 3)
{
$start = microtime(true);
}
$start = microtime(true);
Context::set('content', $output, false);
@ -142,10 +139,7 @@ class HTMLDisplayHandler
$pathInfo = pathinfo($layout_file);
$onlyLayoutFile = $pathInfo['filename'];
if(__DEBUG__ == 3)
{
$GLOBALS['__layout_compile_elapsed__'] = microtime(true) - $start;
}
$GLOBALS['__layout_compile_elapsed__'] = microtime(true) - $start;
if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
{
@ -168,10 +162,7 @@ class HTMLDisplayHandler
return;
}
if(__DEBUG__ == 3)
{
$start = microtime(true);
}
$start = microtime(true);
// move <style ..></style> in body to the header
$output = preg_replace_callback('!<style(.*?)>(.*?)<\/style>!is', array($this, '_moveStyleToHeader'), $output);
@ -218,10 +209,7 @@ class HTMLDisplayHandler
$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
}
if(__DEBUG__ == 3)
{
$GLOBALS['__trans_content_elapsed__'] = microtime(true) - $start;
}
$GLOBALS['__trans_content_elapsed__'] = microtime(true) - $start;
// Remove unnecessary information
$output = preg_replace('/member\_\-([0-9]+)/s', 'member_0', $output);

View file

@ -133,23 +133,22 @@ class ModuleHandler extends Handler
continue;
}
$urlInfo = parse_url($url);
$host = $urlInfo['host'];
$defaultUrl = Context::getDefaultUrl();
if($defaultUrl)
if($host = parse_url($url, PHP_URL_HOST))
{
$defaultUrlInfo = parse_url($defaultUrl);
$defaultHost = $defaultUrlInfo['host'];
}
else
{
$defaultHost = $_SERVER['HTTP_HOST'];
}
if($host && ($host != $defaultHost && $host != $site_module_info->domain))
{
throw new Exception('msg_default_url_is_null');
$defaultHost = parse_url(Context::getDefaultUrl(), PHP_URL_HOST);
if($host !== $defaultHost)
{
$siteModuleHost = $site_module_info->domain;
if(strpos($siteModuleHost, '/') !== false)
{
$siteModuleHost = parse_url($siteModuleHost, PHP_URL_HOST);
}
if($host !== $siteModuleHost)
{
Context::set('success_return_url', null);
Context::set('error_return_url', null);
}
}
}
}
@ -240,14 +239,7 @@ class ModuleHandler extends Handler
}
else
{
if(!Context::getDefaultUrl())
{
return Context::getLang('msg_default_url_is_not_defined');
}
else
{
$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
}
$redirect_url = getNotEncodedSiteUrl(Context::getDefaultUrl(), 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
}
header("Location: $redirect_url");
return FALSE;
@ -634,7 +626,7 @@ class ModuleHandler extends Handler
if(!$grant->manager)
{
self::_setInputErrorToContext();
$this->error = 'msg_is_not_manager';
$this->error = 'msg_is_not_administrator';
$oMessageObject = self::getModuleInstance('message', $display_mode);
$oMessageObject->setError(-1);
$oMessageObject->setMessage($this->error);
@ -758,7 +750,6 @@ class ModuleHandler extends Handler
$message = $oModule->getMessage();
$messageType = $oModule->getMessageType();
$redirectUrl = $oModule->getRedirectUrl();
if($messageType == 'error') debugPrint($message, 'ERROR');
if(!$procResult)
{
@ -893,10 +884,6 @@ class ModuleHandler extends Handler
if($_SESSION['XE_VALIDATOR_RETURN_URL'])
{
$display_handler = new DisplayHandler();
$display_handler->_debugOutput();
Context::getInstance()->checkSessionStatus();
header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
return;
}
@ -1074,12 +1061,6 @@ class ModuleHandler extends Handler
* */
public static function getModuleInstance($module, $type = 'view', $kind = '')
{
if(__DEBUG__ == 3)
{
$start_time = microtime(true);
}
$parent_module = $module;
$kind = strtolower($kind);
$type = strtolower($type);
@ -1143,11 +1124,6 @@ class ModuleHandler extends Handler
$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
}
if(__DEBUG__ == 3)
{
$GLOBALS['__elapsed_class_load__'] += microtime(true) - $start_time;
}
// return the instance
return $GLOBALS['_loaded_module'][$module][$type][$kind];
}
@ -1207,11 +1183,7 @@ class ModuleHandler extends Handler
}
//store before trigger call time
$before_trigger_time = NULL;
if(__LOG_SLOW_TRIGGER__> 0)
{
$before_trigger_time = microtime(true);
}
$before_trigger_time = microtime(true);
foreach($triggers as $item)
{
@ -1227,17 +1199,20 @@ class ModuleHandler extends Handler
}
$before_each_trigger_time = microtime(true);
$output = $oModule->{$called_method}($obj);
$after_each_trigger_time = microtime(true);
$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
$slowlog = new stdClass;
$slowlog->caller = $trigger_name . '.' . $called_position;
$slowlog->called = $module . '.' . $called_method;
$slowlog->called_extension = $module;
if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
if ($trigger_name !== 'common.flushDebugInfo')
{
$trigger_target = $module . ($type === 'class' ? '' : $type) . '.' . $called_method;
Rhymix\Framework\Debug::addTrigger(array(
'name' => $trigger_name . '.' . $called_position,
'target' => $trigger_target,
'target_plugin' => $module,
'elapsed_time' => $after_each_trigger_time - $before_each_trigger_time,
));
}
if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
{
@ -1249,7 +1224,39 @@ class ModuleHandler extends Handler
$trigger_functions = $oModuleModel->getTriggerFunctions($trigger_name, $called_position);
foreach($trigger_functions as $item)
{
$before_each_trigger_time = microtime(true);
$item($obj);
$after_each_trigger_time = microtime(true);
if ($trigger_name !== 'common.writeSlowlog')
{
if (is_string($item))
{
$trigger_target = $item;
}
elseif (is_array($item) && count($item))
{
if (is_object($item[0]))
{
$trigger_target = get_class($item[0]) . '.' . strval($item[1]);
}
else
{
$trigger_target = implode('.', $item);
}
}
else
{
$trigger_target = 'closure';
}
Rhymix\Framework\Debug::addTrigger(array(
'name' => $trigger_name . '.' . $called_position,
'target' => $trigger_target,
'target_plugin' => null,
'elapsed_time' => $after_each_trigger_time - $before_each_trigger_time,
));
}
if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
{

View file

@ -384,7 +384,6 @@ class ModuleObject extends Object
// pass if stop_proc is true
if($this->stop_proc)
{
debugPrint($this->message, 'ERROR');
return FALSE;
}
@ -447,6 +446,18 @@ class ModuleObject extends Object
return FALSE;
}
// check return value of action
if($output instanceof Object)
{
$this->setError($output->getError());
$this->setMessage($output->getMessage());
$original_output = clone $output;
}
else
{
$original_output = null;
}
// trigger call
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
if(!$triggerOutput->toBool())
@ -462,16 +473,17 @@ class ModuleObject extends Object
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if(FileHandler::exists($addon_file)) include($addon_file);
if(is_a($output, 'Object') || is_subclass_of($output, 'Object'))
if($original_output instanceof Object && !$original_output->toBool())
{
return FALSE;
}
elseif($output instanceof Object && $output->getError())
{
$this->setError($output->getError());
$this->setMessage($output->getMessage());
if(!$output->toBool())
{
return FALSE;
}
return FALSE;
}
// 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')
{

View file

@ -1,8 +1,6 @@
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
include _XE_PATH_ . 'classes/security/phphtmlparser/src/htmlparser.inc';
class EmbedFilter
{
@ -17,7 +15,6 @@ class EmbedFilter
* @var int
*/
var $allowscriptaccessKey = 0;
var $whiteUrlDefaultFile = './classes/security/conf/whitelist.php';
var $whiteUrlList = array();
var $whiteIframeUrlList = array();
var $mimeTypeList = array();
@ -68,106 +65,9 @@ class EmbedFilter
$this->checkObjectTag($content);
$this->checkEmbedTag($content);
$this->checkIframeTag($content);
$this->checkParamTag($content);
}
/**
* Check object tag in the content.
* @return void
*/
function checkObjectTag(&$content)
{
preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m);
$objectTagList = $m[0];
if($objectTagList)
{
foreach($objectTagList AS $key => $objectTag)
{
$isWhiteDomain = true;
$isWhiteMimetype = true;
$isWhiteExt = true;
$ext = '';
$parser = new HtmlParser($objectTag);
while($parser->parse())
{
if(is_array($parser->iNodeAttributes))
{
foreach($parser->iNodeAttributes AS $attrName => $attrValue)
{
// data url check
if($attrValue && strtolower($attrName) == 'data')
{
$ext = strtolower(substr(strrchr($attrValue, "."), 1));
$isWhiteDomain = $this->isWhiteDomain($attrValue);
}
// mime type check
if(strtolower($attrName) == 'type' && $attrValue)
{
$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
}
}
}
}
if(!$isWhiteDomain || !$isWhiteMimetype)
{
$content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
}
}
}
}
/**
* Check embed tag in the content.
* @return void
*/
function checkEmbedTag(&$content)
{
preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m);
$embedTagList = $m[0];
if($embedTagList)
{
foreach($embedTagList AS $key => $embedTag)
{
$isWhiteDomain = TRUE;
$isWhiteMimetype = TRUE;
$isWhiteExt = TRUE;
$ext = '';
$parser = new HtmlParser($embedTag);
while($parser->parse())
{
if(is_array($parser->iNodeAttributes))
{
foreach($parser->iNodeAttributes AS $attrName => $attrValue)
{
// src url check
if($attrValue && strtolower($attrName) == 'src')
{
$ext = strtolower(substr(strrchr($attrValue, "."), 1));
$isWhiteDomain = $this->isWhiteDomain($attrValue);
}
// mime type check
if(strtolower($attrName) == 'type' && $attrValue)
{
$isWhiteMimetype = $this->isWhiteMimetype($attrValue);
}
}
}
}
if(!$isWhiteDomain || !$isWhiteMimetype)
{
$content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
}
}
}
}
/**
* Check iframe tag in the content.
* @return void
@ -176,39 +76,52 @@ class EmbedFilter
{
// check in Purifier class
return;
}
preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m);
$iframeTagList = $m[0];
if($iframeTagList)
{
foreach($iframeTagList AS $key => $iframeTag)
/**
* Check object tag in the content.
* @return void
*/
function checkObjectTag(&$content)
{
$content = preg_replace_callback('/<\s*object\s*[^>]+(?:\/?>?)/is', function($m) {
$html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]);
foreach ($html->find('object') as $element)
{
$isWhiteDomain = TRUE;
$ext = '';
$parser = new HtmlParser($iframeTag);
while($parser->parse())
if ($element->data && !$this->isWhiteDomain($element->data))
{
if(is_array($parser->iNodeAttributes))
{
foreach($parser->iNodeAttributes AS $attrName => $attrValue)
{
// src url check
if(strtolower($attrName) == 'src' && $attrValue)
{
$ext = strtolower(substr(strrchr($attrValue, "."), 1));
$isWhiteDomain = $this->isWhiteIframeDomain($attrValue);
}
}
}
return escape($m[0], false);
}
if(!$isWhiteDomain)
if ($element->type && !$this->isWhiteMimetype($element->type))
{
$content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
return escape($m[0], false);
}
}
}
return $m[0];
}, $content);
}
/**
* Check embed tag in the content.
* @return void
*/
function checkEmbedTag(&$content)
{
$content = preg_replace_callback('/<\s*embed\s*[^>]+(?:\/?>?)/is', function($m) {
$html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]);
foreach ($html->find('embed') as $element)
{
if ($element->src && !$this->isWhiteDomain($element->src))
{
return escape($m[0], false);
}
if ($element->type && !$this->isWhiteMimetype($element->type))
{
return escape($m[0], false);
}
}
return $m[0];
}, $content);
}
/**
@ -217,36 +130,20 @@ class EmbedFilter
*/
function checkParamTag(&$content)
{
preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m);
$paramTagList = $m[0];
if($paramTagList)
{
foreach($paramTagList AS $key => $paramTag)
$content = preg_replace_callback('/<\s*param\s*[^>]+(?:\/?>?)/is', function($m) {
$html = Sunra\PhpSimple\HtmlDomParser::str_get_html($m[0]);
foreach ($html->find('param') as $element)
{
$isWhiteDomain = TRUE;
$isWhiteExt = TRUE;
$ext = '';
$parser = new HtmlParser($paramTag);
while($parser->parse())
foreach (array('movie', 'src', 'href', 'url', 'source') as $attr)
{
if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value'])
if ($element->$attr && !$this->isWhiteDomain($element->$attr))
{
$name = strtolower($parser->iNodeAttributes['name']);
if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source')
{
$ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1));
$isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']);
if(!$isWhiteDomain)
{
$content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content);
}
}
return escape($m[0], false);
}
}
}
}
return $m[0];
}, $content);
}
/**
@ -359,8 +256,7 @@ class EmbedFilter
*/
function _makeWhiteDomainList($whitelist = NULL)
{
$whiteUrlDefaultFile = FileHandler::getRealPath($this->whiteUrlDefaultFile);
$whiteUrlDefaultList = (include $whiteUrlDefaultFile);
$whiteUrlDefaultList = (include RX_BASEDIR . 'common/defaults/whitelist.php');
$this->extList = $whiteUrlDefaultList['extensions'];
$this->mimeTypeList = $whiteUrlDefaultList['mime'];
$this->whiteUrlList = array();

View file

@ -1,48 +0,0 @@
/* ====================================================================
* Based on The Apache Software License, Version 1.1
*
* Copyright (c) 2003 Jose Solorzano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by
* Jose Solorzano."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The name "Jose Solorzano" must not be used to endorse or promote
* products derived from this software without prior written
* permission.
*
* 5. Products derived from this software may not be called "Jose Solorzano",
* nor may "Jose Solorzano" appear in their name, without prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL STARNETSYS, LLC. OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
*/

View file

@ -1,214 +0,0 @@
<?
/*
* Copyright (c) 2003 Jose Solorzano. All rights reserved.
* Redistribution of source must retain this copyright notice.
*/
include ("htmlparser.inc");
/**
* Class Html2Text. (HtmlParser example.)
* Converts HTML to ASCII attempting to preserve
* document structure.
* To use, create an instance of Html2Text passing
* the text to convert and the desired maximum
* number of characters per line. Then invoke
* convert() which returns ASCII text.
*/
class Html2Text {
// Private fields
var $iCurrentLine = "";
var $iCurrentWord = "";
var $iCurrentWordArray;
var $iCurrentWordIndex;
var $iInScript;
var $iListLevel = 0;
var $iHtmlText;
var $iMaxColumns;
var $iHtmlParser;
// Constants
var $TOKEN_BR = 0;
var $TOKEN_P = 1;
var $TOKEN_LI = 2;
var $TOKEN_AFTERLI = 3;
var $TOKEN_UL = 4;
var $TOKEN_ENDUL = 5;
function Html2Text ($aHtmlText, $aMaxColumns) {
$this->iHtmlText = $aHtmlText;
$this->iMaxColumns = $aMaxColumns;
}
function convert() {
$this->iHtmlParser = new HtmlParser($this->iHtmlText);
$wholeText = "";
while (($line = $this->getLine()) !== false) {
$wholeText .= ($line . "\r\n");
}
return $wholeText;
}
function getLine() {
while (true) {
if (!$this->addWordToLine($this->iCurrentWord)) {
$retvalue = $this->iCurrentLine;
$this->iCurrentLine = "";
return $retvalue;
}
$word = $this->getWord();
if ($word === false) {
if ($this->iCurrentLine == "") {
break;
}
$retvalue = $this->iCurrentLine;
$this->iCurrentLine = "";
$this->iInText = false;
$this->iCurrentWord = "";
return $retvalue;
}
}
return false;
}
function addWordToLine ($word) {
if ($this->iInScript) {
return true;
}
$prevLine = $this->iCurrentLine;
if ($word === $this->TOKEN_BR) {
$this->iCurrentWord = "";
return false;
}
if ($word === $this->TOKEN_P) {
$this->iCurrentWord = $this->TOKEN_BR;
return false;
}
if ($word === $this->TOKEN_UL) {
$this->iCurrentWord = $this->TOKEN_BR;
return false;
}
if ($word === $this->TOKEN_ENDUL) {
$this->iCurrentWord = $this->TOKEN_BR;
return false;
}
if ($word === $this->TOKEN_LI) {
$this->iCurrentWord = $this->TOKEN_AFTERLI;
return false;
}
$toAdd = $word;
if ($word === $this->TOKEN_AFTERLI) {
$toAdd = "";
}
if ($prevLine != "") {
$prevLine .= " ";
}
else {
$prevLine = $this->getIndentation($word === $this->TOKEN_AFTERLI);
}
$candidateLine = $prevLine . $toAdd;
if (strlen ($candidateLine) > $this->iMaxColumns && $prevLine != "") {
return false;
}
$this->iCurrentLine = $candidateLine;
return true;
}
function getWord() {
while (true) {
if ($this->iHtmlParser->iNodeType == NODE_TYPE_TEXT) {
if (!$this->iInText) {
$words = $this->splitWords($this->iHtmlParser->iNodeValue);
$this->iCurrentWordArray = $words;
$this->iCurrentWordIndex = 0;
$this->iInText = true;
}
if ($this->iCurrentWordIndex < count($this->iCurrentWordArray)) {
$this->iCurrentWord = $this->iCurrentWordArray[$this->iCurrentWordIndex++];
return $this->iCurrentWord;
}
else {
$this->iInText = false;
}
}
else if ($this->iHtmlParser->iNodeType == NODE_TYPE_ELEMENT) {
if (strcasecmp ($this->iHtmlParser->iNodeName, "br") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = $this->TOKEN_BR;
return $this->iCurrentWord;
}
else if (strcasecmp ($this->iHtmlParser->iNodeName, "p") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = $this->TOKEN_P;
return $this->iCurrentWord;
}
else if (strcasecmp ($this->iHtmlParser->iNodeName, "script") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = "";
$this->iInScript = true;
return $this->iCurrentWord;
}
else if (strcasecmp ($this->iHtmlParser->iNodeName, "ul") == 0 || strcasecmp ($this->iHtmlParser->iNodeName, "ol") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = $this->TOKEN_UL;
$this->iListLevel++;
return $this->iCurrentWord;
}
else if (strcasecmp ($this->iHtmlParser->iNodeName, "li") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = $this->TOKEN_LI;
return $this->iCurrentWord;
}
}
else if ($this->iHtmlParser->iNodeType == NODE_TYPE_ENDELEMENT) {
if (strcasecmp ($this->iHtmlParser->iNodeName, "script") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = "";
$this->iInScript = false;
return $this->iCurrentWord;
}
else if (strcasecmp ($this->iHtmlParser->iNodeName, "ul") == 0 || strcasecmp ($this->iHtmlParser->iNodeName, "ol") == 0) {
$this->iHtmlParser->parse();
$this->iCurrentWord = $this->TOKEN_ENDUL;
if ($this->iListLevel > 0) {
$this->iListLevel--;
}
return $this->iCurrentWord;
}
}
if (!$this->iHtmlParser->parse()) {
break;
}
}
return false;
}
function splitWords ($text) {
$words = split ("[ \t\r\n]+", $text);
for ($idx = 0; $idx < count($words); $idx++) {
$words[$idx] = $this->htmlDecode($words[$idx]);
}
return $words;
}
function htmlDecode ($text) {
// TBD
return $text;
}
function getIndentation ($hasLI) {
$indent = "";
$idx = 0;
for ($idx = 0; $idx < ($this->iListLevel - 1); $idx++) {
$indent .= " ";
}
if ($this->iListLevel > 0) {
$indent = $hasLI ? ($indent . "- ") : ($indent . " ");
}
return $indent;
}
}

View file

@ -1,365 +0,0 @@
<?php
/*
* Copyright (c) 2003 Jose Solorzano. All rights reserved.
* Redistribution of source must retain this copyright notice.
*
* Jose Solorzano (http://jexpert.us) is a software consultant.
*
* Contributions by:
* - Leo West (performance improvements)
*/
define ("NODE_TYPE_START",0);
define ("NODE_TYPE_ELEMENT",1);
define ("NODE_TYPE_ENDELEMENT",2);
define ("NODE_TYPE_TEXT",3);
define ("NODE_TYPE_COMMENT",4);
define ("NODE_TYPE_DONE",5);
/**
* Class HtmlParser.
* To use, create an instance of the class passing
* HTML text. Then invoke parse() until it's false.
* When parse() returns true, $iNodeType, $iNodeName
* $iNodeValue and $iNodeAttributes are updated.
*
* To create an HtmlParser instance you may also
* use convenience functions HtmlParser_ForFile
* and HtmlParser_ForURL.
*/
class HtmlParser {
/**
* Field iNodeType.
* May be one of the NODE_TYPE_* constants above.
*/
var $iNodeType;
/**
* Field iNodeName.
* For elements, it's the name of the element.
*/
var $iNodeName = "";
/**
* Field iNodeValue.
* For text nodes, it's the text.
*/
var $iNodeValue = "";
/**
* Field iNodeAttributes.
* A string-indexed array containing attribute values
* of the current node. Indexes are always lowercase.
*/
var $iNodeAttributes;
// The following fields should be
// considered private:
var $iHtmlText;
var $iHtmlTextLength;
var $iHtmlTextIndex = 0;
var $iHtmlCurrentChar;
var $BOE_ARRAY;
var $B_ARRAY;
var $BOS_ARRAY;
/**
* Constructor.
* Constructs an HtmlParser instance with
* the HTML text given.
*/
function HtmlParser ($aHtmlText) {
$this->iHtmlText = $aHtmlText;
$this->iHtmlTextLength = strlen($aHtmlText);
$this->iNodeAttributes = array();
$this->setTextIndex (0);
$this->BOE_ARRAY = array (" ", "\t", "\r", "\n", "=" );
$this->B_ARRAY = array (" ", "\t", "\r", "\n" );
$this->BOS_ARRAY = array (" ", "\t", "\r", "\n", "/" );
}
/**
* Method parse.
* Parses the next node. Returns false only if
* the end of the HTML text has been reached.
* Updates values of iNode* fields.
*/
function parse() {
$text = $this->skipToElement();
if ($text != "") {
$this->iNodeType = NODE_TYPE_TEXT;
$this->iNodeName = "Text";
$this->iNodeValue = $text;
return true;
}
return $this->readTag();
}
function clearAttributes() {
$this->iNodeAttributes = array();
}
function readTag() {
if ($this->iCurrentChar != "<") {
$this->iNodeType = NODE_TYPE_DONE;
return false;
}
$this->clearAttributes();
$this->skipMaxInTag ("<", 1);
if ($this->iCurrentChar == '/') {
$this->moveNext();
$name = $this->skipToBlanksInTag();
$this->iNodeType = NODE_TYPE_ENDELEMENT;
$this->iNodeName = $name;
$this->iNodeValue = "";
$this->skipEndOfTag();
return true;
}
$name = $this->skipToBlanksOrSlashInTag();
if (!$this->isValidTagIdentifier ($name)) {
$comment = false;
if (strpos($name, "!--") === 0) {
$ppos = strpos($name, "--", 3);
if (strpos($name, "--", 3) === (strlen($name) - 2)) {
$this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment";
$this->iNodeValue = "<" . $name . ">";
$comment = true;
}
else {
$rest = $this->skipToStringInTag ("-->");
if ($rest != "") {
$this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment";
$this->iNodeValue = "<" . $name . $rest;
$comment = true;
// Already skipped end of tag
return true;
}
}
}
if (!$comment) {
$this->iNodeType = NODE_TYPE_TEXT;
$this->iNodeName = "Text";
$this->iNodeValue = "<" . $name;
return true;
}
}
else {
$this->iNodeType = NODE_TYPE_ELEMENT;
$this->iNodeValue = "";
$this->iNodeName = $name;
while ($this->skipBlanksInTag()) {
$attrName = $this->skipToBlanksOrEqualsInTag();
if ($attrName != "" && $attrName != "/") {
$this->skipBlanksInTag();
if ($this->iCurrentChar == "=") {
$this->skipEqualsInTag();
$this->skipBlanksInTag();
$value = $this->readValueInTag();
$this->iNodeAttributes[strtolower($attrName)] = $value;
}
else {
$this->iNodeAttributes[strtolower($attrName)] = "";
}
}
}
}
$this->skipEndOfTag();
return true;
}
function isValidTagIdentifier ($name) {
return ereg ("^[A-Za-z0-9_\\-]+$", $name);
}
function skipBlanksInTag() {
return "" != ($this->skipInTag ($this->B_ARRAY));
}
function skipToBlanksOrEqualsInTag() {
return $this->skipToInTag ($this->BOE_ARRAY);
}
function skipToBlanksInTag() {
return $this->skipToInTag ($this->B_ARRAY);
}
function skipToBlanksOrSlashInTag() {
return $this->skipToInTag ($this->BOS_ARRAY);
}
function skipEqualsInTag() {
return $this->skipMaxInTag ("=", 1);
}
function readValueInTag() {
$ch = $this->iCurrentChar;
$value = "";
if ($ch == "\"") {
$this->skipMaxInTag ("\"", 1);
$value = $this->skipToInTag ("\"");
$this->skipMaxInTag ("\"", 1);
}
else if ($ch == "'") {
$this->skipMaxInTag ("'", 1);
$value = $this->skipToInTag ("'");
$this->skipMaxInTag ("'", 1);
}
else {
$value = $this->skipToBlanksInTag();
}
return $value;
}
function setTextIndex ($index) {
$this->iHtmlTextIndex = $index;
if ($index >= $this->iHtmlTextLength) {
$this->iCurrentChar = -1;
}
else {
$this->iCurrentChar = $this->iHtmlText{$index};
}
}
function moveNext() {
if ($this->iHtmlTextIndex < $this->iHtmlTextLength) {
$this->setTextIndex ($this->iHtmlTextIndex + 1);
return true;
}
else {
return false;
}
}
function skipEndOfTag() {
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == ">") {
$this->moveNext();
return;
}
$this->moveNext();
}
}
function skipInTag ($chars) {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == ">") {
return $sb;
} else {
$match = false;
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
if (!$match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
}
return $sb;
}
function skipMaxInTag ($chars, $maxChars) {
$sb = "";
$count = 0;
while (($ch = $this->iCurrentChar) !== -1 && $count++ < $maxChars) {
if ($ch == ">") {
return $sb;
} else {
$match = false;
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
if (!$match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
}
return $sb;
}
function skipToInTag ($chars) {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
$match = $ch == ">";
if (!$match) {
for ($idx = 0; $idx < count($chars); $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
}
}
}
if ($match) {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
return $sb;
}
function skipToElement() {
$sb = "";
while (($ch = $this->iCurrentChar) !== -1) {
if ($ch == "<") {
return $sb;
}
$sb .= $ch;
$this->moveNext();
}
return $sb;
}
/**
* Returns text between current position and $needle,
* inclusive, or "" if not found. The current index is moved to a point
* after the location of $needle, or not moved at all
* if nothing is found.
*/
function skipToStringInTag ($needle) {
$pos = strpos ($this->iHtmlText, $needle, $this->iHtmlTextIndex);
if ($pos === false) {
return "";
}
$top = $pos + strlen($needle);
$retvalue = substr ($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex);
$this->setTextIndex ($top);
return $retvalue;
}
}
function HtmlParser_ForFile ($fileName) {
return HtmlParser_ForURL($fileName);
}
function HtmlParser_ForURL ($url) {
$fp = fopen ($url, "r");
$content = "";
while (true) {
$data = fread ($fp, 8192);
if (strlen($data) == 0) {
break;
}
$content .= $data;
}
fclose ($fp);
return new HtmlParser ($content);
}
php?>

View file

@ -42,16 +42,13 @@ class TemplateHandler
{
static $oTemplate = NULL;
if(__DEBUG__ == 3)
if(!isset($GLOBALS['__TemplateHandlerCalled__']))
{
if(!isset($GLOBALS['__TemplateHandlerCalled__']))
{
$GLOBALS['__TemplateHandlerCalled__'] = 1;
}
else
{
$GLOBALS['__TemplateHandlerCalled__']++;
}
$GLOBALS['__TemplateHandlerCalled__'] = 1;
}
else
{
$GLOBALS['__TemplateHandlerCalled__']++;
}
if(!$oTemplate)
@ -117,13 +114,8 @@ class TemplateHandler
*/
public function compile($tpl_path, $tpl_filename, $tpl_file = '')
{
$buff = false;
// store the starting time for debug information
if(__DEBUG__ == 3)
{
$start = microtime(true);
}
$start = microtime(true);
// initiation
$this->init($tpl_path, $tpl_filename, $tpl_file);
@ -143,37 +135,13 @@ class TemplateHandler
$source_template_mtime = filemtime($this->file);
$latest_mtime = $source_template_mtime > $this->handler_mtime ? $source_template_mtime : $this->handler_mtime;
// cache control
$oCacheHandler = CacheHandler::getInstance('template');
// get cached buff
if($oCacheHandler->isSupport())
// get cached file
if(!file_exists($this->compiled_file) || filemtime($this->compiled_file) < $latest_mtime)
{
$cache_key = 'template:' . $this->file;
$buff = $oCacheHandler->get($cache_key, $latest_mtime);
}
else
{
if(is_readable($this->compiled_file) && filemtime($this->compiled_file) > $latest_mtime && filesize($this->compiled_file))
{
$buff = 'file://' . $this->compiled_file;
}
FileHandler::writeFile($this->compiled_file, $this->parse());
}
if($buff === FALSE)
{
$buff = $this->parse();
if($oCacheHandler->isSupport())
{
$oCacheHandler->put($cache_key, $buff);
}
else
{
FileHandler::writeFile($this->compiled_file, $buff);
}
}
$output = $this->_fetch($buff);
$output = $this->_fetch($this->compiled_file);
if($__templatehandler_root_tpl == $this->file)
{
@ -181,10 +149,7 @@ class TemplateHandler
}
// store the ending time for debug information
if(__DEBUG__ == 3)
{
$GLOBALS['__template_elapsed__'] += microtime(true) - $start;
}
$GLOBALS['__template_elapsed__'] += microtime(true) - $start;
return $output;
}
@ -358,54 +323,20 @@ class TemplateHandler
* @param string $buff if buff is not null, eval it instead of including compiled template file
* @return string
*/
private function _fetch($buff)
private function _fetch($filename)
{
if(!$buff)
{
return;
}
$__Context = Context::getInstance();
$__Context->tpl_path = $this->path;
$level = ob_get_level();
$__ob_level_before_fetch = ob_get_level();
ob_start();
if(substr($buff, 0, 7) == 'file://')
{
if(__DEBUG__)
{
//load cache file from disk
$eval_str = FileHandler::readFile(substr($buff, 7));
$eval_str_buffed = "?>" . $eval_str;
@eval($eval_str_buffed);
$error_info = error_get_last();
//parse error
if ($error_info['type'] == 4)
{
throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
}
}
else
{
include(substr($buff, 7));
}
}
else
{
$eval_str = "?>" . $buff;
@eval($eval_str);
$error_info = error_get_last();
//parse error
if ($error_info['type'] == 4)
{
throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}");
}
}
include $filename;
$contents = '';
while (ob_get_level() - $level > 0) {
$contents .= ob_get_contents();
ob_end_clean();
while (ob_get_level() > $__ob_level_before_fetch)
{
$contents .= ob_get_clean();
}
return $contents;
}

View file

@ -89,10 +89,7 @@ class XmlParser
function parse($input = '', $arg1 = NULL, $arg2 = NULL)
{
// Save the compile starting time for debugging
if(__DEBUG__ == 3)
{
$start = microtime(true);
}
$start = microtime(true);
$this->lang = Context::getLangType();
@ -141,10 +138,7 @@ class XmlParser
$output = array_shift($this->output);
// Save compile starting time for debugging
if(__DEBUG__ == 3)
{
$GLOBALS['__xmlparse_elapsed__'] += microtime(true) - $start;
}
$GLOBALS['__xmlparse_elapsed__'] += microtime(true) - $start;
return $output;
}

View file

@ -126,14 +126,15 @@ class DefaultValue
switch($func_name)
{
case 'ipaddress' :
$val = '$_SERVER[\'REMOTE_ADDR\']';
$val = '\\RX_CLIENT_IP';
$this->_is_string_from_function = TRUE;
break;
case 'unixtime' :
$val = '$_SERVER[\'REQUEST_TIME\']';
$val = '\\RX_TIME';
$this->_is_string_from_function = TRUE;
break;
case 'curdate' :
$val = 'date("YmdHis")';
$val = 'getInternalDateTime()';
$this->_is_string_from_function = TRUE;
break;
case 'sequence' :

View file

@ -3,7 +3,7 @@
/**
* Set error reporting rules.
*/
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
/**
* Suppress date/time errors until the internal time zone is set (see below).
@ -42,11 +42,6 @@ if(file_exists(RX_BASEDIR . 'config/config.user.inc.php'))
require_once RX_BASEDIR . 'config/config.user.inc.php';
}
/**
* Load legacy debug settings.
*/
require_once __DIR__ . '/debug.php';
/**
* Define the list of legacy class names for the autoloader.
*/
@ -198,6 +193,11 @@ require_once RX_BASEDIR . 'vendor/autoload.php';
*/
Rhymix\Framework\Config::init();
/**
* Install the debugger.
*/
Rhymix\Framework\Debug::registerErrorHandlers(error_reporting());
/**
* Set the internal timezone.
*/

View file

@ -133,6 +133,8 @@ define('_XE_PACKAGE_', 'XE');
define('_XE_LOCATION_', 'en');
define('_XE_LOCATION_SITE_', 'https://www.xpressengine.com/');
define('_XE_DOWNLOAD_SERVER_', 'https://download.xpressengine.com/');
define('__PROXY_SERVER__', null);
define('__DEBUG__', 0);
/**
* Other useful constants.

View file

@ -290,3 +290,142 @@ button.btn {
.btn-group>.btn.active {
z-index: 2;
}
/* Debug */
#rhymix_debug_button {
position: fixed;
left: 0; bottom: 40px;
background: #eeeeee;
background: linear-gradient(to bottom, #f4f4f4 0%, #eaeaea 100%);
border: 1px solid #ccc; border-left: 0;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.18), 0 0 6px 0 rgba(0, 0, 0, 0.12);
z-index: 1073741824;
}
#rhymix_debug_button:hover {
background: #dddddd;
background: linear-gradient(to bottom, #e8e8e8 0%, #d9d9d9 100%);
}
#rhymix_debug_button a {
display: block;
font: bold 12px/14px Arial, sans-serif;
color: #444;
text-decoration: none;
padding: 4px 8px;
}
#rhymix_debug_button a.has_errors {
color: #f44336;
}
#rhymix_debug_panel {
display: none;
position: fixed;
left: 0; top: 0;
max-width: 100%;
height: 100%;
overflow-y: scroll;
background: #fcfcfc;
box-sizing: border-box;
border-right: 1px solid #ccc;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.18), 0 0 8px 0 rgba(0, 0, 0, 0.12);
z-index: 1073741824;
}
#rhymix_debug_panel .debug_header {
clear: both;
width: 100%;
height: 36px;
background: #444444;
background: linear-gradient(to right, #222222 0%, #444444 40%, #eeeeee 100%);
position: relative;
}
#rhymix_debug_panel .debug_header h2 {
font: bold 16px/20px Arial, sans-serif;
color: #fcfcfc;
position: absolute;
left: 10px; top: 10px;
margin: 0; padding: 0;
}
#rhymix_debug_panel .debug_header .debug_maximize {
font: normal 20px/24px Arial, sans-serif;
text-decoration: none;
color: #444444;
position: absolute;
right: 32px; top: 6px;
}
#rhymix_debug_panel .debug_header .debug_close {
font: normal 28px/28px Arial, sans-serif;
text-decoration: none;
color: #444444;
position: absolute;
right: 10px; top: 4px;
}
#rhymix_debug_panel .debug_header .debug_close:hover {
color: #f44336;
}
#rhymix_debug_panel .debug_page {
clear: both;
margin: 12px 10px;
font: normal 12px/16px Arial, NanumBarunGothic, NanumGothic, "Malgun Gothic", sans-serif;
}
#rhymix_debug_panel .debug_page .debug_page_header {
padding-bottom: 8px;
border-bottom: 1px solid #ddd;
position: relative;
cursor: pointer;
}
#rhymix_debug_panel .debug_page .debug_page_header h3 {
color: #444;
font: inherit;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 0;
}
#rhymix_debug_panel .debug_page .debug_page_collapse {
display: block;
position: absolute;
right: 0; top: 0;
color: #999;
font-size: 10px;
line-height: 12px;
text-decoration: none;
padding: 2px 2px;
}
#rhymix_debug_panel .debug_page .debug_page_body {
margin: 8px 4px 8px 10px;
}
#rhymix_debug_panel .debug_page .debug_page_body h4 {
color: #444;
font: inherit;
font-size: 13px;
font-weight: bold;
margin: 0 0 8px 0;
padding: 0;
}
#rhymix_debug_panel .debug_page .debug_entry {
font-family: Consolas, "Courier New", monospace;
color: #444;
margin-left: 38px;
margin-bottom: 8px;
text-indent: -28px;
word-wrap: break-word;
word-break: break-all;
}
#rhymix_debug_panel .debug_page .debug_entry.pre_wrap {
white-space: pre-wrap;
}
#rhymix_debug_panel .debug_page .debug_entry ul.debug_metadata {
margin: 0 0 0 -16px; padding: 0;
}
#rhymix_debug_panel .debug_page .debug_entry ul.debug_metadata li {
list-style: disc;
margin: 0; padding: 0; text-indent: 0;
}
#rhymix_debug_panel .debug_page .debug_entry ul.debug_backtrace {
margin: 4px 0 0 16px; padding: 0;
}
#rhymix_debug_panel .debug_page .debug_entry ul.debug_backtrace li {
list-style: disc;
margin: 0; padding: 0; text-indent: 0;
color: #888;
}

View file

@ -1,149 +0,0 @@
<?php
/**
* Legacy debug settings for XE Compatibility
*
* Copyright (c) NAVER <http://www.navercorp.com>
*/
/**
* output debug message (bit value)
*
* 0: generate debug messages/not display
* 1: display messages through debugPrint() function
* 2: output execute time, Request/Response info
* 4: output DB query history
*/
if(!defined('__DEBUG__'))
{
define('__DEBUG__', 0);
}
/**
* output location of debug message
*
* 0: connect to the files/_debug_message.php and output
* 1: HTML output as a comment on the bottom (when response method is the HTML)
* 2: Firebug console output (PHP 4 & 5. Firebug/FirePHP plug-in required)
*/
if(!defined('__DEBUG_OUTPUT__'))
{
define('__DEBUG_OUTPUT__', 0);
}
/**
* output comments of the firePHP console and browser
*
* 0: No limit (not recommended)
* 1: Allow only specified IP addresses
*/
if(!defined('__DEBUG_PROTECT__'))
{
define('__DEBUG_PROTECT__', 1);
}
/**
* Set a ip address to allow debug
*/
if(!defined('__DEBUG_PROTECT_IP__'))
{
define('__DEBUG_PROTECT_IP__', '127.0.0.1');
}
/**
* DB error message definition
*
* 0: No output
* 1: files/_debug_db_query.php connected to the output
*/
if(!defined('__DEBUG_DB_OUTPUT__'))
{
define('__DEBUG_DB_OUTPUT__', 0);
}
/**
* Query log for only timeout query among DB queries
*
* 0: Do not leave a log
* > 0: leave a log when the slow query takes over specified seconds
* Log file is saved as ./files/_slowlog_query.php file
*/
if(!defined('__LOG_SLOW_QUERY__'))
{
define('__LOG_SLOW_QUERY__', 0);
}
/**
* Trigger excute time log
*
* 0: Do not leave a log
* > 0: leave a log when the trigger takes over specified milliseconds
* Log file is saved as ./files/_slowlog_trigger.php
*/
if(!defined('__LOG_SLOW_TRIGGER__'))
{
define('__LOG_SLOW_TRIGGER__', 0);
}
/**
* Addon excute time log
*
* 0: Do not leave a log
* > 0: leave a log when the trigger takes over specified milliseconds
* Log file is saved as ./files/_slowlog_addon.php
*/
if(!defined('__LOG_SLOW_ADDON__'))
{
define('__LOG_SLOW_ADDON__', 0);
}
/**
* Widget excute time log
*
* 0: Do not leave a log
* > 0: leave a log when the widget takes over specified milliseconds
* Log file is saved as ./files/_slowlog_widget.php
*/
if(!defined('__LOG_SLOW_WIDGET__'))
{
define('__LOG_SLOW_WIDGET__', 0);
}
/**
* output comments of the slowlog files
*
* 0: No limit (not recommended)
* 1: Allow only specified IP addresses
*/
if(!defined('__LOG_SLOW_PROTECT__'))
{
define('__LOG_SLOW_PROTECT__', 1);
}
/**
* Set a ip address to allow slowlog
*/
if(!defined('__LOG_SLOW_PROTECT_IP__'))
{
define('__LOG_SLOW_PROTECT_IP__', '127.0.0.1');
}
/**
* Leave DB query information
*
* 0: Do not add information to the query
* 1: Comment the XML Query ID
*/
if(!defined('__DEBUG_QUERY__'))
{
define('__DEBUG_QUERY__', 0);
}
/**
* __PROXY_SERVER__ has server information to request to the external through the target server
* FileHandler:: getRemoteResource uses the constant
*/
if(!defined('__PROXY_SERVER__'))
{
define('__PROXY_SERVER__', NULL);
}

View file

@ -89,9 +89,10 @@ return array(
'enabled' => true,
'log_errors' => true,
'log_queries' => false,
'log_slow_queries' => 1,
'log_slow_triggers' => 1,
'log_slow_widgets' => 1,
'log_slow_queries' => 0,
'log_slow_triggers' => 0,
'log_slow_widgets' => 0,
'log_filename' => null,
'display_type' => 'comment',
'display_to' => 'admin',
'allow' => array(),

View file

@ -1,8 +1,15 @@
<?php
/**
* Rhymix Default iframe/object/iframe Whitelist
*
* Copyright (c) Rhymix Developers and Contributors
*/
return array(
// Allowed domains in <object> or <embed> tag
/**
* Allowed domains in <object> or <embed> tag
*/
'object' => array(
// YouTube
'www.youtube.com/',
@ -49,7 +56,9 @@ return array(
'sbsplayer.sbs.co.kr/',
),
// Allowed domains in <iframe> tag
/**
* Allowed domains in <iframe> tag
*/
'iframe' => array(
// YouTube
'www.youtube.com/',
@ -69,7 +78,9 @@ return array(
'afree.ca/',
),
// Allowed extensions
/**
* Allowed extensions in <object> or <embed> tag
*/
'extensions' => array(
'123' => 1,
'3ds' => 1,

View file

@ -183,7 +183,7 @@ class ConfigParser
{
$default_url = \Context::decodeIdna($default_url);
}
$config['url']['default'] = $default_url ?: \RX_BASEURL;
$config['url']['default'] = $default_url ?: (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL;
$config['url']['http_port'] = $db_info->http_port ?: null;
$config['url']['https_port'] = $db_info->https_port ?: null;
$config['url']['ssl'] = $db_info->use_ssl ?: 'none';
@ -216,14 +216,6 @@ class ConfigParser
}
$config['lock']['allow'] = array_values($db_info->sitelock_whitelist);
// Convert debug configuration.
$config['debug']['enabled'] = true;
$config['debug']['log_errors'] = true;
$config['debug']['log_queries'] = (\__DEBUG__ & 4) ? true : false;
$config['debug']['log_slow_queries'] = floatval(\__LOG_SLOW_QUERY__);
$config['debug']['log_slow_triggers'] = floatval(\__LOG_SLOW_TRIGGER__ * 1000);
$config['debug']['log_slow_widgets'] = floatval(\__LOG_SLOW_WIDGET__ * 1000);
// Convert embed filter configuration.
if (is_array($db_info->embed_white_iframe))
{

View file

@ -12,6 +12,19 @@ class DateTime
*/
protected static $_timezones = array();
/**
* Format a Unix timestamp using the internal timezone.
*
* @param string $format Format used in PHP date() function
* @param int $timestamp Unix timestamp (optional, default is now)
* @return string
*/
public static function formatTimestamp($format, $timestamp = null)
{
$offset = Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
return gmdate($format, $timestamp + $offset);
}
/**
* Format a Unix timestamp for the current user's timezone.
*
@ -125,6 +138,12 @@ class DateTime
/**
* Get a PHP time zone by UTC offset.
*
* Time zones with both (a) fractional offsets and (b) daylight saving time
* (such as Iran's +03:30/+04:30) cannot be converted in this way.
* However, if Rhymix is installed for the first time in such a time zone,
* the internal time zone will be automatically set to UTC,
* so this should never be a problem in practice.
*
* @param int $offset
* @return bool
*/
@ -133,6 +152,15 @@ class DateTime
switch ($offset)
{
case 0: return 'Etc/UTC';
case -34200: return 'Pacific/Marquesas'; // -09:30
case -16200: return 'America/Caracas'; // -04:30
case 16200: return 'Asia/Kabul'; // +04:30
case 19800: return 'Asia/Kolkata'; // +05:30
case 20700: return 'Asia/Kathmandu'; // +05:45
case 23400: return 'Asia/Rangoon'; // +06:30
case 30600: return 'Asia/Pyongyang'; // +08:30
case 31500: return 'Australia/Eucla'; // +08:45
case 34200: return 'Australia/Darwin'; // +09:30
default: return 'Etc/GMT' . ($offset > 0 ? '-' : '+') . intval(abs($offset / 3600));
}
}

561
common/framework/debug.php Normal file
View file

@ -0,0 +1,561 @@
<?php
namespace Rhymix\Framework;
/**
* The debug class.
*/
class Debug
{
/**
* Store log entries here.
*/
protected static $_aliases = array();
protected static $_entries = array();
protected static $_errors = array();
protected static $_queries = array();
protected static $_slow_queries = array();
protected static $_triggers = array();
protected static $_slow_triggers = array();
protected static $_widgets = array();
protected static $_slow_widgets = array();
/**
* Also write to error log.
*/
public static $write_to_error_log = true;
/**
* Get all entries.
*
* @return array
*/
public static function getEntries()
{
return self::$_entries;
}
/**
* Get all errors.
*
* @return array
*/
public static function getErrors()
{
return self::$_errors;
}
/**
* Get all queries.
*
* @return array
*/
public static function getQueries()
{
return self::$_queries;
}
/**
* Get all slow queries.
*
* @return array
*/
public static function getSlowQueries()
{
return self::$_slow_queries;
}
/**
* Get all triggers.
*
* @return array
*/
public static function getTriggers()
{
return self::$_triggers;
}
/**
* Get all slow triggers.
*
* @return array
*/
public static function getSlowTriggers()
{
return self::$_slow_triggers;
}
/**
* Get all widgets.
*
* @return array
*/
public static function getWidgets()
{
return self::$_widgets;
}
/**
* Get all slow widgets.
*
* @return array
*/
public static function getSlowWidgets()
{
return self::$_slow_widgets;
}
/**
* Add a filename alias.
*
* @param string $display_filename
* @param string $real_filename
* @return void
*/
public static function addFilenameAlias($display_filename, $real_filename)
{
self::$_aliases[$real_filename] = $display_filename;
}
/**
* Add an arbitrary entry to the log.
*
* @param string $message
* @return void
*/
public static function addEntry($message)
{
// Get the backtrace.
$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
$backtrace = debug_backtrace($backtrace_args);
if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
{
array_shift($backtrace);
}
// Create a log entry.
$entry = (object)array(
'type' => 'Debug',
'time' => microtime(true),
'message' => $message,
'file' => isset($backtrace[0]['file']) ? $backtrace[0]['file'] : null,
'line' => isset($backtrace[0]['line']) ? $backtrace[0]['line'] : 0,
'backtrace' => $backtrace,
);
self::$_entries[] = $entry;
// Add the entry to the error log.
if (self::$write_to_error_log)
{
$log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d',
var_export($message, true), $entry->file, $entry->line));
error_log($log_entry);
}
}
/**
* Add a PHP error to the log.
*
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @param array $errcontext
* @return void
*/
public static function addError($errno, $errstr, $errfile, $errline, $errcontext)
{
// Do not handle error types that we were told to ignore.
if (!($errno & error_reporting()))
{
return;
}
// Rewrite the error message with relative paths.
$message = str_replace(array(
' called in ' . RX_BASEDIR,
' defined in ' . RX_BASEDIR,
), array(
' called in ',
' defined in ',
), $errstr);
// Get the backtrace.
$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
$backtrace = debug_backtrace($backtrace_args);
// Prepare the error entry.
self::$_errors[] = $errinfo = (object)array(
'type' => self::getErrorType($errno),
'time' => microtime(true),
'message' => $message,
'file' => $errfile,
'line' => $errline,
'backtrace' => $backtrace,
);
// Add the entry to the error log.
if (self::$write_to_error_log)
{
$log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d',
$errinfo->type, $errstr, $errfile, intval($errline)));
error_log($log_entry);
}
}
/**
* Add a query to the log.
*
* @return void
*/
public static function addQuery($query)
{
$query_object = (object)array(
'type' => 'Query',
'time' => microtime(true),
'message' => $query['result'] === 'success' ? 'success' : $query['errstr'],
'error_code' => $query['result'] === 'success' ? 0 : $query['errno'],
'query_id' => $query['query_id'],
'query_connection' => $query['connection'],
'query_string' => $query['query'],
'query_time' => $query['elapsed_time'],
'file' => $query['called_file'],
'line' => $query['called_line'],
'method' => $query['called_method'],
'backtrace' => $query['backtrace'],
);
self::$_queries[] = $query_object;
if ($query_object->query_time && $query_object->query_time >= config('debug.log_slow_queries'))
{
self::$_slow_queries[] = $query_object;
}
}
/**
* Add a trigger to the log.
*
* @return bool
*/
public static function addTrigger($trigger)
{
$trigger_object = (object)array(
'type' => 'Trigger',
'time' => microtime(true),
'message' => null,
'file' => null,
'line' => null,
'backtrace' => array(),
'trigger_name' => $trigger['name'],
'trigger_target' => $trigger['target'],
'trigger_plugin' => $trigger['target_plugin'],
'trigger_time' => $trigger['elapsed_time'],
);
self::$_triggers[] = $trigger_object;
if ($trigger_object->trigger_time && $trigger_object->trigger_time >= config('debug.log_slow_triggers'))
{
self::$_slow_triggers[] = $trigger_object;
}
}
/**
* Add a widget to the log.
*
* @return bool
*/
public static function addWidget($widget)
{
$widget_object = (object)array(
'type' => 'Widget',
'time' => microtime(true),
'message' => null,
'file' => null,
'line' => null,
'backtrace' => array(),
'widget_name' => $widget['name'],
'widget_time' => $widget['elapsed_time'],
);
self::$_widgets[] = $widget_object;
if ($widget_object->widget_time && $widget_object->widget_time >= config('debug.log_slow_widgets'))
{
self::$_slow_widgets[] = $widget_object;
}
}
/**
* The default handler for catching exceptions.
*
* @param Exception $e
* @return void
*/
public static function exceptionHandler($e)
{
// Find out the file where the error really occurred.
$errfile = self::translateFilename($e->getFile());
// If the exception was thrown in a Rhymix Framework class, find out where that class was called.
$backtrace = $e->getTrace();
$caller_errfile = $errfile;
$caller_errline = $e->getLine();
while (preg_match('#^(classes|common)/#i', $caller_errfile))
{
$trace = array_shift($backtrace);
if (!$trace)
{
$caller_errfile = $caller_errline = null;
}
else
{
$caller_errfile = self::translateFilename($trace['file']);
$caller_errline = $trace['line'];
}
}
// Add the exception to the error log.
if ($caller_errfile && $caller_errfile !== $errfile)
{
$log_entry = str_replace("\0", '', sprintf('%s #%d "%s" in %s on line %d (via %s on line %d)',
get_class($e), $e->getCode(), $e->getMessage(), $caller_errfile, $caller_errline, $errfile, $e->getLine()));
}
else
{
$log_entry = str_replace("\0", '', sprintf('%s #%d "%s" in %s on line %d',
get_class($e), $e->getCode(), $e->getMessage(), $errfile, $e->getLine()));
}
error_log('PHP Exception: ' . $log_entry . "\n" . str_replace("\0", '', $e->getTraceAsString()));
// Display the error screen.
self::displayErrorScreen($log_entry);
exit;
}
/**
* The default handler for catching fatal errors.
*
* @return void
*/
public static function shutdownHandler()
{
// Check if we are exiting because of a fatal error.
$errinfo = error_get_last();
if ($errinfo === null || ($errinfo['type'] !== 1 && $errinfo['type'] !== 4))
{
return;
}
// Find out the file where the error really occurred.
$errinfo['file'] = self::translateFilename($errinfo['file']);
// Add the entry to the error log.
$message = sprintf('%s in %s on line %d', $errinfo['message'], $errinfo['file'], intval($errinfo['line']));
$log_entry = str_replace("\0", '', 'PHP ' . self::getErrorType($errinfo['type']) . ': ' . $message);
error_log($log_entry);
// Display the error screen.
self::displayErrorScreen($log_entry);
}
/**
* Translate filenames.
*
* @param string $filename
* @return string
*/
public static function translateFilename($filename)
{
if (isset(self::$_aliases[$filename]))
{
$filename = self::$_aliases[$filename];
}
if (!strncmp($filename, \RX_BASEDIR, strlen(\RX_BASEDIR)))
{
$filename = substr($filename, strlen(\RX_BASEDIR));
}
return $filename;
}
/**
* Register all error handlers.
*
* @return void
*/
public static function registerErrorHandlers($error_types)
{
set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types);
set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler');
register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler');
}
/**
* Display a fatal error screen.
*
* @param string $message
* @return void
*/
public static function displayErrorScreen($message)
{
// Disable output buffering.
while (ob_get_level())
{
ob_end_clean();
}
// Localize the error title.
$title = \Context::getLang('msg_server_error');
if ($title === 'msg_server_error')
{
$message = 'Server Error';
}
// Localize the error message.
$message = ini_get('display_errors') ? $message : \Context::getLang('msg_server_error_see_log');
if ($message === 'msg_server_error_see_log')
{
$message = 'Your server is configured to hide error messages. Please see your server\'s error log for details.';
}
// Display a generic error page.
\Context::displayErrorPage($title, $message, 500);
}
/**
* Check if debugging is enabled for the current user.
*
* @return bool
*/
public static function isEnabledForCurrentUser()
{
static $cache = null;
if ($cache !== null)
{
return $cache;
}
if (!Config::get('debug.enabled'))
{
return $cache = false;
}
$display_to = Config::get('debug.display_to');
switch ($display_to)
{
case 'everyone':
return $cache = true;
case 'ip':
$allowed_ip = Config::get('debug.allow');
foreach ($allowed_ip as $range)
{
if (IpFilter::inRange(RX_CLIENT_IP, $range))
{
return $cache = true;
}
}
return $cache = false;
case 'admin':
default:
$logged_info = \Context::get('logged_info');
if ($logged_info && $logged_info->is_admin === 'Y')
{
return $cache = true;
}
return $cache = false;
}
}
/**
* Get all debug information as an object.
*
* @return object
*/
public static function getDebugData()
{
// Collect debug information.
$data = (object)array(
'timestamp' => DateTime::formatTimestamp('Y-m-d H:i:s', RX_TIME),
'url' => getCurrentPageUrl(),
'request' => (object)array(
'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''),
'size' => intval($_SERVER['CONTENT_LENGTH']),
),
'response' => (object)array(
'method' => \Context::getResponseMethod(),
'size' => \DisplayHandler::$response_size,
),
'timing' => (object)array(
'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME),
'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']),
'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__']),
'db_query' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__db_elapsed_time__'], count(self::$_queries)),
'db_class' => sprintf('%0.4f sec', $GLOBALS['__dbclass_elapsed_time__'] - $GLOBALS['__db_elapsed_time__']),
'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__']),
'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__']),
'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__']),
),
'entries' => self::$_entries,
'errors' => config('debug.log_errors') ? self::$_errors : null,
'queries' => config('debug.log_queries') ? self::$_queries : null,
'slow_queries' => self::$_slow_queries,
'slow_triggers' => self::$_slow_triggers,
'slow_widgets' => self::$_slow_widgets,
);
// Clean up the backtrace.
foreach (array('entries', 'errors', 'queries', 'slow_queries') as $key)
{
if (!$data->$key)
{
continue;
}
foreach ($data->$key as &$entry)
{
if (isset($entry->file))
{
$entry->file = self::translateFilename($entry->file);
}
if (isset($entry->backtrace) && is_array($entry->backtrace))
{
foreach ($entry->backtrace as &$backtrace)
{
$backtrace['file'] = self::translateFilename($backtrace['file']);
unset($backtrace['object'], $backtrace['args']);
}
}
}
}
return $data;
}
/**
* Convert a PHP error number to the corresponding error name.
*
* @param int $errno
* @return string
*/
public static function getErrorType($errno)
{
switch ($errno)
{
case \E_ERROR: return 'Fatal Error';
case \E_WARNING: return 'Warning';
case \E_NOTICE: return 'Notice';
case \E_CORE_ERROR: return 'Core Error';
case \E_CORE_WARNING: return 'Core Warning';
case \E_COMPILE_ERROR: return 'Compile-time Error';
case \E_COMPILE_WARNING: return 'Compile-time Warning';
case \E_USER_ERROR: return 'User Error';
case \E_USER_WARNING: return 'User Warning';
case \E_USER_NOTICE: return 'User Notice';
case \E_STRICT: return 'Strict Standards';
case \E_PARSE: return 'Parse Error';
case \E_DEPRECATED: return 'Deprecated';
case \E_USER_DEPRECATED: return 'User Deprecated';
case \E_RECOVERABLE_ERROR: return 'Catchable Fatal Error';
default: return 'Error';
}
}
}

View file

@ -7,9 +7,10 @@
*/
/**
* Get system configuration.
* Get or set system configuration.
*
* @param string $key
* @param string $value (optional)
* @return mixed
*/
function config($key, $value = null)

View file

@ -28,6 +28,9 @@
}
});
/* Array for pending debug data */
window.rhymix_debug_pending_data = [];
/**
* @brief XE 공용 유틸리티 함수
* @namespace XE

200
common/js/debug.js Normal file
View file

@ -0,0 +1,200 @@
/**
* Client-side script for manipulating the debug panel on Rhymix.
*
* @file debug.js
* @author Kijin Sung <kijin@kijinsung.com>
*/
$(function() {
"use strict";
// Find debug panel elements.
var panel = $("#rhymix_debug_panel");
var button = $("#rhymix_debug_button");
// Initialize the debug button.
var button_link = $('<a href="#"></a>').text("DEBUG").appendTo(button).click(function(event) {
event.preventDefault();
var max_width = Math.min(540, $(window).width());
panel.css({ width: max_width, left: max_width * -1 }).show().animate({ left: 0 }, 200);
button.hide();
});
// Initialize the debug panel.
var header = $('<div class="debug_header"></div>').appendTo(panel);
header.append('<h2>RHYMIX DEBUG</h2>');
header.append($('<a class="debug_maximize" href="#">+</a>').click(function(event) {
panel.animate({ width: "100%" }, 300);
}));
header.append($('<a class="debug_close" href="#">&times;</a>').click(function(event) {
event.preventDefault();
panel.animate({ left: panel.width() * -1 }, 200, function() {
panel.hide();
button.show();
});
}));
// Define a function for adding debug data to the panel.
window.rhymix_debug_add_data = function(data, open) {
// Define loop variables.
var i, j, entry, num, backtrace, description;
// New pages are open by default.
if (open !== true && open !== false)
{
open = true;
}
// Create the page.
var page = $('<div class="debug_page"></div>').appendTo(panel);
var page_body = $('<div class="debug_page_body"></div>').appendTo(page);
if (!open)
{
page_body.hide();
}
// Create the page header.
var page_header = $('<div class="debug_page_header"></div>').prependTo(page).click(function() {
$(this).find("a.debug_page_collapse").triggerHandler("click");
});
page_header.append($('<h3></h3>').text(data.page_title).attr("title", data.url));
page_header.append($('<a class="debug_page_collapse" href="#"></a>').text(open ? "▲" : "▼").click(function(event) {
event.preventDefault();
event.stopPropagation();
if (page_body.is(":visible")) {
page_body.slideUp(200);
$(this).text("▼");
} else {
page_body.slideDown(200);
$(this).text("▲");
}
}));
// Add general information.
page_body.append($('<h4></h4>').text('General Information'));
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
var metadata = $('<ul class="debug_metadata"></ul>').appendTo(entry);
metadata.append($('<li></li>').text('Request: ' + data.request.method + (data.request.method !== "GET" ? (' - ' + data.request.size + ' bytes') : "")));
metadata.append($('<li></li>').text('Response: ' + data.response.method + ' - ' + data.response.size + ' bytes'));
metadata.append($('<li></li>').text('Total Time: ' + data.timing.total));
metadata.append($('<li></li>').text('Query Time: ' + data.timing.db_query));
// Add debug entries.
if (data.entries && data.entries.length) {
page_body.append($('<h4></h4>').text('Debug Entries (' + data.entries.length + ')'));
for (i in data.entries) {
entry = $('<div class="debug_entry pre_wrap"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.entries[i].message);
backtrace = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
for (j in data.entries[i].backtrace) {
if (data.entries[i].backtrace[j].file) {
backtrace.append($('<li></li>').text(data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line));
}
}
}
}
// Add errors.
if (data.errors && data.errors.length) {
page_body.append($('<h4></h4>').text('Errors (' + data.errors.length + ')'));
for (i in data.errors) {
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.errors[i].type + ": " + data.errors[i].message);
backtrace = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
for (j in data.errors[i].backtrace) {
if (data.errors[i].backtrace[j].file) {
backtrace.append($('<li></li>').text(data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line));
}
}
}
}
// Add queries.
if (data.queries && data.queries.length) {
page_body.append($('<h4></h4>').text('Queries (' + data.queries.length + ')'));
for (i in data.queries) {
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.queries[i].query_string);
description = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
if (data.queries[i].file && data.queries[i].line) {
description.append($('<li></li>').text("Caller: " + data.queries[i].file + ":" + data.queries[i].line).append("<br>(" + data.queries[i].method + ")"));
description.append($('<li></li>').text("Connection: " + data.queries[i].query_connection));
description.append($('<li></li>').text("Query ID: " + data.queries[i].query_id));
description.append($('<li></li>').text("Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : "")));
}
description.append($('<li></li>').text("Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message))));
}
}
// Add slow queries.
if (data.slow_queries && data.slow_queries.length) {
page_body.append($('<h4></h4>').text('Slow Queries (' + data.slow_queries.length + ')'));
for (i in data.slow_queries) {
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.slow_queries[i].query_string);
description = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
if (data.slow_queries[i].file && data.slow_queries[i].line) {
description.append($('<li></li>').text("Caller: " + data.slow_queries[i].file + ":" + data.slow_queries[i].line).append("<br>(" + data.slow_queries[i].method + ")"));
description.append($('<li></li>').text("Connection: " + data.slow_queries[i].query_connection));
description.append($('<li></li>').text("Query ID: " + data.slow_queries[i].query_id));
description.append($('<li></li>').text("Query Time: " + (data.slow_queries[i].query_time ? (data.slow_queries[i].query_time.toFixed(4) + " sec") : "")));
}
description.append($('<li></li>').text("Result: " + ((data.slow_queries[i].message === "success" || !data.slow_queries[i].message) ? "success" : ("error " + data.slow_queries[i].error_code + " " + data.slow_queries[i].message))));
}
}
// Add slow triggers.
if (data.slow_triggers && data.slow_triggers.length) {
page_body.append($('<h4></h4>').text('Slow Triggers (' + data.slow_triggers.length + ')'));
for (i in data.slow_triggers) {
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.slow_triggers[i].trigger_name);
description = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
description.append($('<li></li>').text("Target: " + data.slow_triggers[i].trigger_target));
description.append($('<li></li>').text("Exec Time: " + (data.slow_triggers[i].trigger_time ? (data.slow_triggers[i].trigger_time.toFixed(4) + " sec") : "")));
}
}
// Add slow widgets.
if (data.slow_widgets && data.slow_widgets.length) {
page_body.append($('<h4></h4>').text('Slow Widgets (' + data.slow_widgets.length + ')'));
for (i in data.slow_widgets) {
entry = $('<div class="debug_entry"></div>').appendTo(page_body);
num = parseInt(i) + 1; if (num < 10) num = "0" + num;
entry.text(num + ". " + data.slow_widgets[i].widget_name);
description = $('<ul class="debug_backtrace"></ul>').appendTo(entry);
description.append($('<li></li>').text("Exec Time: " + (data.slow_widgets[i].widget_time ? (data.slow_widgets[i].widget_time.toFixed(4) + " sec") : "")));
}
}
// If there are errors, turn the button text red.
if (data.errors && data.errors.length) {
button_link.addClass("has_errors");
}
};
// Add debug data from the previous request.
if (window.rhymix_debug_previous) {
window.rhymix_debug_previous.page_title = 'PREVIOUS POST : ' + window.rhymix_debug_previous.ajax_module + "." + window.rhymix_debug_previous.ajax_act;
rhymix_debug_add_data(window.rhymix_debug_previous, false);
}
// Add debug data from the current request.
if (window.rhymix_debug_content) {
window.rhymix_debug_content.page_title = 'MAIN PAGE';
rhymix_debug_add_data(window.rhymix_debug_content, true);
}
// Add debug data from pending AJAX requests.
if (window.rhymix_debug_pending_data) {
while (window.rhymix_debug_pending_data.length) {
rhymix_debug_add_data(window.rhymix_debug_pending_data.shift());
}
}
});

View file

@ -77,6 +77,16 @@
}
});
// Add debug information.
if (data._rx_debug) {
data._rx_debug.page_title = "AJAX : " + params.module + "." + params.act;
if (window.rhymix_debug_add_data) {
window.rhymix_debug_add_data(data._rx_debug);
} else {
window.rhymix_debug_pending_data.push(data._rx_debug);
}
}
// If the response contains an error, display the error message.
if (data.error != "0") {
// This way of calling an error handler is deprecated. Do not use it.
@ -176,6 +186,16 @@
clearTimeout(wfsr_timeout);
waiting_obj.hide().trigger("cancel_confirm");
// Add debug information.
if (data._rx_debug) {
data._rx_debug.page_title = "AJAX : " + params.module + "." + params.act;
if (window.rhymix_debug_add_data) {
window.rhymix_debug_add_data(data._rx_debug);
} else {
window.rhymix_debug_pending_data.push(data._rx_debug);
}
}
// If the response contains an error, display the error message.
if(data.error != "0" && data.error > -1000) {
if(data.error == -1 && data.message == "msg_is_not_administrator") {

View file

@ -215,7 +215,6 @@ $lang->msg_invalid_format = 'ein falsches Format';
$lang->msg_not_permitted_act = 'Sie haben keine Berechtigung, um den aufgeforderten Vorgang auszuführen.';
$lang->msg_module_is_not_exists = 'Das aufgeforderte Modul ist nicht zu finden. Bitte melden Sie sich dem Administrator des Moduls!';
$lang->msg_module_is_not_standalone = 'Das aufgeforderte Modul kann nicht selbstständig ausgeführt werden.';
$lang->msg_default_url_is_not_defined = 'Der Vorgang ist unterbrochen, denn Das Default_URL ist nicht eingegen.';
$lang->msg_empty_search_target = 'Nicht finden können die das Suchziel.';
$lang->msg_empty_search_keyword = 'Nicht finden können das Stichwort.';
$lang->comment_to_be_approved = 'Ihr Kommentar muss von admin vor der Veröffentlichung genehmigt werden.';
@ -298,4 +297,3 @@ $lang->dashboard = 'Armaturenbrett';
$lang->user = 'Mitglied';
$lang->yes = 'ja';
$lang->not = 'nicht';
$lang->msg_default_url_is_null = 'Standard URL ist null.';

View file

@ -223,9 +223,10 @@ $lang->msg_invalid_format = 'Invalid Format';
$lang->msg_not_permitted_act = 'You do not have permission to execute requested action.';
$lang->msg_module_is_not_exists = 'Cannot find the page you requested. Ask your Site Admin to check the page.';
$lang->msg_module_is_not_standalone = 'Requested page cannot be executed independently.';
$lang->msg_default_url_is_not_defined = 'Default URL is not defined.';
$lang->msg_empty_search_target = 'Cannot find the Search target.';
$lang->msg_empty_search_keyword = 'Cannot find the Keyword.';
$lang->msg_server_error = 'Server Error';
$lang->msg_server_error_see_log = 'Your server is configured to hide error messages. Please see your server\'s error log for details.';
$lang->comment_to_be_approved = 'Your comment must be approved by admin before being published.';
$lang->success_registed = 'Registered successfully.';
$lang->success_declared = 'Reported successfully.';
@ -320,7 +321,6 @@ $lang->dashboard = 'Dashboard';
$lang->user = 'Member';
$lang->yes = 'Yes';
$lang->not = 'No';
$lang->msg_default_url_is_null = 'Default url is null.';
$lang->license_agreement = 'License Agreement';
$lang->license = 'GPL v2';
$lang->cmd_license_agree = 'I understand the license, and I accept it.';

View file

@ -172,7 +172,6 @@ $lang->msg_not_founded = 'L\'objet n\'est pas trouvé.';
$lang->msg_no_result = 'Nul Résultat';
$lang->msg_not_permitted_act = 'Vous n\'êtes pas autorisés à exécuter l\'action que vous avez demandé.';
$lang->msg_module_is_not_standalone = 'Le module demandé ne peut pas être exécuté indépendamment.';
$lang->msg_default_url_is_not_defined = 'URL par défaut n\'est pas défini.';
$lang->success_registed = 'Enregistré avec succès';
$lang->success_declared = 'Accusé avec succès';
$lang->success_updated = 'Mise à jour avec succès';

View file

@ -223,9 +223,10 @@ $lang->msg_invalid_format = '正しくないフォーマットです。';
$lang->msg_not_permitted_act = '現在の操作を実行する権限がありません。';
$lang->msg_module_is_not_exists = 'モジュールが見つかりません。 サイトマネージャへモジュールの点検をお問い合わせください。';
$lang->msg_module_is_not_standalone = 'このモジュールはスタンドアローンでは作動しません。';
$lang->msg_default_url_is_not_defined = 'デフォルトURLが定められてないため、動作を中止します。';
$lang->msg_empty_search_target = '検索対象がありません。';
$lang->msg_empty_search_keyword = 'キーワードがありません。';
$lang->msg_server_error = 'サーバーエラー';
$lang->msg_server_error_see_log = 'エラーメッセージを表示しないように設定されています。サーバーのエラーログで詳細を確認してください。';
$lang->comment_to_be_approved = '管理者の確認が必要なコメントです。';
$lang->success_registed = '登録しました。';
$lang->success_declared = '通報しました。';
@ -314,4 +315,3 @@ $lang->dashboard = 'ダッシュボード';
$lang->user = '会員';
$lang->yes = 'はい';
$lang->not = 'いいえ';
$lang->msg_default_url_is_null = '基本URLが設定されていません。';

View file

@ -195,10 +195,10 @@ $lang->unit_meridiem['am'] = '오전';
$lang->unit_meridiem['pm'] = '오후';
$lang->unit_meridiem['AM'] = '오전';
$lang->unit_meridiem['PM'] = '오후';
$lang->time_gap['min'] = '%d 분 전';
$lang->time_gap['mins'] = '%d 분 전';
$lang->time_gap['hour'] = '%d 시간 전';
$lang->time_gap['hours'] = '%d 시간 전';
$lang->time_gap['min'] = '%d분 전';
$lang->time_gap['mins'] = '%d분 전';
$lang->time_gap['hour'] = '%d시간 전';
$lang->time_gap['hours'] = '%d시간 전';
$lang->about_tag = '쉼표(,)를 이용하여 복수 등록';
$lang->about_layout = '레이아웃은 콘텐츠의 겉모습을 꾸며줍니다. 상단 레이아웃 메뉴에서 관리할 수 있습니다.';
$lang->about_ipaddress_input = 'IP주소 입력형식<br />1. 와일드카드(*) 사용가능(예: 192.168.0.*)<br />2. 하이픈(-)을 사용하여 대역으로 입력가능<br />(단, 대역폭으로 입력할 경우 와일드카드 사용불가. 예: 192.168.0.1-192.168.0.254)<br />3.여러개의 항목은 줄을 바꾸어 입력하세요';
@ -223,9 +223,10 @@ $lang->msg_invalid_format = '잘못된 형식입니다.';
$lang->msg_not_permitted_act = '요청한 기능을 실행할 수 있는 권한이 없습니다.';
$lang->msg_module_is_not_exists = '요청한 페이지를 찾을 수 없습니다. 사이트 관리자에게 문의해 주세요.';
$lang->msg_module_is_not_standalone = '요청한 페이지는 독립적으로 동작할 수 없습니다.';
$lang->msg_default_url_is_not_defined = '기본 URL이 정해지지 않아서 동작을 중지합니다';
$lang->msg_empty_search_target = '검색대상이 없습니다.';
$lang->msg_empty_search_keyword = '검색어가 없습니다.';
$lang->msg_server_error = '서버 오류';
$lang->msg_server_error_see_log = '오류 메시지를 표시하지 않도록 설정되어 있습니다. 서버의 에러 로그에서 자세한 내용을 확인해 주십시오.';
$lang->comment_to_be_approved = '관리자의 확인이 필요한 댓글입니다.';
$lang->success_registed = '등록했습니다.';
$lang->success_declared = '신고했습니다.';
@ -320,7 +321,6 @@ $lang->dashboard = '대시보드';
$lang->user = '회원';
$lang->yes = '예';
$lang->not = '아니오';
$lang->msg_default_url_is_null = '기본 URL 설정이 안 되어 있습니다.';
$lang->license_agreement = '사용권 동의';
$lang->license = 'GPL v2';
$lang->cmd_license_agree = '사용권에 대해 이해했으며, 이에 동의합니다.';

View file

@ -187,7 +187,6 @@ $lang->msg_fail_to_request_open = 'Ошибка в запрашиваемом с
$lang->msg_invalid_format = 'Неверный формат';
$lang->msg_not_permitted_act = 'У Вас нет прав для исполнения запрошенного действия';
$lang->msg_module_is_not_standalone = 'Запрошенный модуль не может быть исполнен независимо';
$lang->msg_default_url_is_not_defined = 'Default URL is not define';
$lang->success_registed = 'Зарегистрировано успешно';
$lang->success_declared = 'Жалоба отправлена';
$lang->success_updated = 'Обновление успешно';

View file

@ -211,7 +211,6 @@ $lang->msg_fail_to_request_open = 'İsteğiniz gercekleşemedi.';
$lang->msg_invalid_format = 'Geçersiz Format';
$lang->msg_not_permitted_act = 'İstenilen eylemi gercekleştirmeye yetkiniz yok.';
$lang->msg_module_is_not_standalone = 'İstenilen modul bağımsız calıştırılamaz.';
$lang->msg_default_url_is_not_defined = 'Varsayılan URL tanımlı değil.';
$lang->msg_empty_search_target = 'Arama amacı bulunamadı';
$lang->msg_empty_search_keyword = 'Anahtar kelime yok';
$lang->comment_to_be_approved = 'Yorumunuz, yayınlanmadan önce adminden onay almanız gerekir';

View file

@ -213,7 +213,6 @@ $lang->msg_invalid_format = '错误的格式!';
$lang->msg_not_permitted_act = '没有权限执行 action命令';
$lang->msg_module_is_not_exists = '您所请求的模块不存在,请联系您的网站管理员。';
$lang->msg_module_is_not_standalone = '您请求的模块不能单独执行';
$lang->msg_default_url_is_not_defined = '请设置XE通行证';
$lang->msg_empty_search_target = '搜索不到目标';
$lang->msg_empty_search_keyword = '搜索不到关键字';
$lang->comment_to_be_approved = '您的回复在通过管理员审核之后才会被显示出来。';

View file

@ -213,7 +213,6 @@ $lang->msg_invalid_format = '格式錯誤';
$lang->msg_not_permitted_act = '沒有權限執行';
$lang->msg_module_is_not_exists = '找不到所登錄的模組。 請詢問網站管理員檢查模組。';
$lang->msg_module_is_not_standalone = '您請求的模組不能單獨執行';
$lang->msg_default_url_is_not_defined = '尚未設定預設網址';
$lang->msg_empty_search_target = '搜尋不到目標';
$lang->msg_empty_search_keyword = '搜尋不到關鍵字';
$lang->success_registed = '成功送出!';

View file

@ -530,8 +530,9 @@ function ztime($str)
{
$hour = $min = $sec = 0;
}
$offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z');
return gmmktime($hour, $min, $sec, $month, $day, $year) - $offset;
$timestamp = gmmktime($hour, $min, $sec, $month, $day, $year);
$offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
return $timestamp - $offset;
}
/**
@ -601,6 +602,32 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false)
return $result;
}
/**
* Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone.
* If the timestamp is not given, the current time is used.
*
* @param int $timestamp Unix timestamp
* @return string
*/
function getInternalDateTime($timestamp = null, $format = 'YmdHis')
{
$timestamp = ($timestamp !== null) ? $timestamp : time();
return Rhymix\Framework\DateTime::formatTimestamp($format, $timestamp);
}
/**
* Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone.
* If the timestamp is not given, the current time is used.
*
* @param int $timestamp Unix timestamp
* @return string
*/
function getDisplayDateTime($timestamp = null, $format = 'YmdHis')
{
$timestamp = ($timestamp !== null) ? $timestamp : time();
return Rhymix\Framework\DateTime::formatTimestampForCurrentUser($format, $timestamp);
}
/**
* If the recent post within a day, output format of YmdHis is "min/hours ago from now". If not within a day, it return format string.
*
@ -610,24 +637,24 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false)
*/
function getTimeGap($date, $format = 'Y.m.d')
{
$gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);
$gap = RX_TIME - ztime($date);
$lang_time_gap = Context::getLang('time_gap');
if($gap < 60)
if($gap < 60 * 1.5)
{
$buff = sprintf($lang_time_gap['min'], (int)($gap / 60) + 1);
$buff = sprintf($lang_time_gap['min'], round($gap / 60));
}
elseif($gap < 60 * 60)
{
$buff = sprintf($lang_time_gap['mins'], (int)($gap / 60) + 1);
$buff = sprintf($lang_time_gap['mins'], round($gap / 60));
}
elseif($gap < 60 * 60 * 2)
elseif($gap < 60 * 60 * 1.5)
{
$buff = sprintf($lang_time_gap['hour'], (int)($gap / 60 / 60) + 1);
$buff = sprintf($lang_time_gap['hour'], round($gap / 60 / 60));
}
elseif($gap < 60 * 60 * 24)
{
$buff = sprintf($lang_time_gap['hours'], (int)($gap / 60 / 60) + 1);
$buff = sprintf($lang_time_gap['hours'], round($gap / 60 / 60));
}
else
{
@ -668,100 +695,14 @@ function getEncodeEmailAddress($email)
}
/**
* Prints debug messages
* Add an entry to the debug log.
*
* Display $buff contents into the file ./files/_debug_message.php.
* You can see the file on your prompt by command: tail-f./files/_debug_message.php
*
* @param mixed $debug_output Target object to be printed
* @param bool $display_option boolean Flag whether to print seperator (default:true)
* @param string $file Target file name
* @param mixed $entry Target object to be printed
* @return void
*/
function debugPrint($debug_output = NULL, $display_option = TRUE, $file = '_debug_message.php')
function debugPrint($entry = null)
{
static $debug_file;
static $debug_file_exist;
if(!(__DEBUG__ & 1))
{
return;
}
static $firephp;
$bt = debug_backtrace();
if(is_array($bt))
{
$bt_debug_print = array_shift($bt);
$bt_called_function = array_shift($bt);
}
$file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);
$line_num = $bt_debug_print['line'];
$function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
{
if(!isset($firephp))
{
$firephp = FirePHP::getInstance(TRUE);
}
$type = FirePHP::INFO;
$label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage()));
// Check a FirePHP option
if($display_option === 'TABLE')
{
$label = $display_option;
}
if($display_option === 'ERROR')
{
$type = $display_option;
}
// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
{
$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
$label = NULL;
}
$firephp->fb($debug_output, $label, $type);
}
else
{
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
{
return;
}
$print = array();
if($debug_file_exist === NULL) $print[] = '<?php exit() ?>';
if(!$debug_file) $debug_file = _XE_PATH_ . 'files/' . $file;
if(!$debug_file_exist) $debug_file_exist = file_exists($debug_file);
if($display_option === TRUE || $display_option === 'ERROR')
{
$print[] = str_repeat('=', 80);
}
$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));
$type = gettype($debug_output);
if(!in_array($type, array('array', 'object', 'resource')))
{
if($display_option === 'ERROR') $print[] = 'ERROR : ' . var_export($debug_output, TRUE);
else $print[] = $type . '(' . var_export($debug_output, TRUE) . ')';
$print[] = PHP_EOL.PHP_EOL;
}
else
{
$print[] = print_r($debug_output, TRUE);
$print[] = PHP_EOL;
}
@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
}
Rhymix\Framework\Debug::addEntry($entry);
}
/**
@ -771,64 +712,7 @@ function debugPrint($debug_output = NULL, $display_option = TRUE, $file = '_debu
*/
function writeSlowlog($type, $elapsed_time, $obj)
{
if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
if(__LOG_SLOW_PROTECT__ === 1 && __LOG_SLOW_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) return;
static $log_filename = array(
'query' => 'files/_slowlog_query.php',
'trigger' => 'files/_slowlog_trigger.php',
'addon' => 'files/_slowlog_addon.php',
'widget' => 'files/_slowlog_widget.php'
);
$write_file = true;
$log_file = _XE_PATH_ . $log_filename[$type];
$buff = array();
$buff[] = '<?php exit(); ?>';
$buff[] = date('c');
if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
{
$buff[] = "\tCaller : " . $obj->caller;
$buff[] = "\tCalled : " . $obj->called;
}
else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
{
$buff[] = "\tAddon : " . $obj->called;
$buff[] = "\tCalled position : " . $obj->caller;
}
else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
{
$buff[] = "\tWidget : " . $obj->called;
}
else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
{
$buff[] = $obj->query;
$buff[] = "\tQuery ID : " . $obj->query_id;
$buff[] = "\tCaller : " . $obj->caller;
$buff[] = "\tConnection : " . $obj->connection;
}
else
{
$write_file = false;
}
if($write_file)
{
$buff[] = sprintf("\t%0.6f sec", $elapsed_time);
$buff[] = PHP_EOL . PHP_EOL;
file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
}
if($type != 'query')
{
$trigger_args = $obj;
$trigger_args->_log_type = $type;
$trigger_args->_elapsed_time = $elapsed_time;
ModuleHandler::triggerCall('XE.writeSlowlog', 'after', $trigger_args);
}
// no-op
}
/**
@ -836,10 +720,7 @@ function writeSlowlog($type, $elapsed_time, $obj)
*/
function flushSlowlog()
{
$trigger_args = new stdClass();
$trigger_args->_log_type = 'flush';
$trigger_args->_elapsed_time = 0;
ModuleHandler::triggerCall('XE.writeSlowlog', 'after', $trigger_args);
// no-op
}
/**
@ -891,7 +772,7 @@ function getDestroyXeVars($vars)
}
/**
* Change error_handing to debugPrint on php5 higher
* Legacy error handler
*
* @param int $errno
* @param string $errstr
@ -899,22 +780,9 @@ function getDestroyXeVars($vars)
* @param int $line
* @return void
*/
function handleError($errno, $errstr, $file, $line)
function handleError($errno, $errstr, $file, $line, $context)
{
if(!__DEBUG__)
{
return;
}
$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
if(!in_array($errno, $errors))
{
return;
}
$output = sprintf("Fatal error : %s - %d", $file, $line);
$output .= sprintf("%d - %s", $errno, $errstr);
debugPrint($output);
Rhymix\Framework\Debug::addError($errno, $errstr, $file, $line, $context);
}
/**
@ -1315,42 +1183,58 @@ function requirePear()
*/
function checkCSRF()
{
if($_SERVER['REQUEST_METHOD'] != 'POST')
// If this is not a POST request, FAIL.
if ($_SERVER['REQUEST_METHOD'] != 'POST')
{
return FALSE;
return false;
}
// Get the referer. If the referer is empty, PASS.
$referer = strval($_SERVER['HTTP_REFERER']);
if ($referer === '')
{
return true;
}
if (strpos($referer, 'xn--') !== false)
{
$referer = Context::decodeIdna($referer);
}
$referer_host = parse_url($referer, PHP_URL_HOST);
// If the referer is the same domain as the current host, PASS.
$current_host = $_SERVER['HTTP_HOST'];
if (strpos($current_host, 'xn--') !== false)
{
$current_host = Context::decodeIdna($current_host);
}
if ($referer_host === $current_host)
{
return true;
}
// If the referer is the same domain as the default URL, PASS.
$default_url = Context::getDefaultUrl();
$referer = $_SERVER["HTTP_REFERER"];
if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
if (strpos($default_url, 'xn--') !== false)
{
$referer = Context::encodeIdna($referer);
$default_url = Context::decodeIdna($default_url);
}
$default_url = parse_url($default_url);
$referer = parse_url($referer);
if ($referer_host === parse_url($default_url, PHP_URL_HOST))
{
return true;
}
// Check if we have a virtual site with a matching domain.
$oModuleModel = getModel('module');
$siteModuleInfo = $oModuleModel->getDefaultMid();
if($siteModuleInfo->site_srl == 0)
$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
if (strcasecmp($virtualSiteInfo->domain, Context::get('vid')) && stristr($virtualSiteInfo->domain, $referer_host))
{
if($default_url['host'] !== $referer['host'])
{
return FALSE;
}
return true;
}
else
{
$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
{
return FALSE;
}
return false;
}
return TRUE;
}
/**

View file

@ -71,7 +71,9 @@ xe.msg_select_menu = "{$lang->msg_select_menu}";
{$content}
{Context::getHtmlFooter()}
<!-- ETC -->
<div class="wfsr"></div>
<div id="rhymix_waiting" class="wfsr"></div>
<div id="rhymix_debug_panel"></div>
<div id="rhymix_debug_button"></div>
{@ $js_body_files = Context::getJsFile('body') }
<block loop="$js_body_files => $key, $js_file">
<block cond="$js_file['targetie']"><!--[if {$js_file['targetie']}]></block><script src="{$js_file['file']}"></script><block cond="$js_file['targetie']"><![endif]--></block>

View file

@ -0,0 +1,152 @@
<?php if (!defined('RX_BASEDIR')) exit; ?>
<?php echo '[' . $data->timestamp . ']' . "\n"; ?>
Request / Response
==================
Request URL: <?php echo $data->url . "\n"; ?>
Request Method: <?php echo $data->request->method . "\n" ?>
Request Body Size: <?php echo $data->request->size . "\n" ?>
Response Method: <?php echo $data->response->method . "\n"; ?>
Response Body Size: <?php echo $data->response->size . "\n"; ?>
Page Generation Time
====================
Total Time: <?php echo $data->timing->total . "\n"; ?>
Template Compile Time: <?php echo $data->timing->template . "\n"; ?>
XML Parsing Time: <?php echo $data->timing->xmlparse . "\n"; ?>
DB Query Time: <?php echo $data->timing->db_query . "\n"; ?>
DB Processing Time: <?php echo $data->timing->db_class . "\n"; ?>
Layout Processing Time: <?php echo $data->timing->layout . "\n"; ?>
Widget Processing Time: <?php echo $data->timing->widget . "\n"; ?>
Content Transform Time: <?php echo $data->timing->trans . "\n"; ?>
Resource Usage
==============
Peak Memory Usage: <?php echo sprintf('%0.1f MB', memory_get_peak_usage(true) / 1024 / 1024) . "\n"; ?>
Included Files: <?php echo count(get_included_files()) . "\n"; ?>
Debug Entries
=============
<?php
$entry_count = 0;
if (!count($data->entries))
{
echo 'None' . "\n";
}
foreach ($data->entries as $entry)
{
if (is_scalar($entry->message))
{
$entry->message = var_export($entry->message, true);
}
else
{
$entry->message = trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($entry->message, true)));
}
echo sprintf('%02d. %s', ++$entry_count, $entry->message) . "\n";
foreach ($entry->backtrace as $key => $backtrace)
{
echo sprintf(' - %s line %d', $backtrace['file'], $backtrace['line']) . "\n";
}
}
?>
PHP Errors and Warnings
=======================
<?php if ($data->errors === null): ?>
Error logging is disabled.
<?php else: ?>
<?php
$error_count = 0;
if (!count($data->errors))
{
echo 'None' . "\n";
}
foreach ($data->errors as $error)
{
echo sprintf('%02d. %s: %s', ++$error_count, $error->type, $error->message) . "\n";
foreach ($error->backtrace as $key => $backtrace)
{
echo sprintf(' - %s line %d', $backtrace['file'], $backtrace['line']) . "\n";
}
}
?>
<?php endif; ?>
Database Queries
================
<?php if ($data->queries === null): ?>
Query logging is disabled.
<?php else: ?>
<?php
$query_count = 0;
if (!count($data->queries))
{
echo 'None'. "\n";
}
foreach ($data->queries as $query)
{
$query_caller = sprintf('%s line %d (%s)', $query->file, $query->line, $query->method);
$query_result = ($query->message === 'success') ? 'success' : sprintf('error %d %s', $query->error_code, $query->message);
echo sprintf('%02d. %s', ++$query_count, $query->query_string) . "\n";
echo sprintf(' - Caller: %s', $query_caller) . "\n";
echo sprintf(' - Connection: %s', $query->query_connection) . "\n";
echo sprintf(' - Query ID: %s', $query->query_id) . "\n";
echo sprintf(' - Query Time: %0.4f sec', $query->query_time) . "\n";
echo sprintf(' - Result: %s', $query_result) . "\n";
}
?>
<?php endif; ?>
Slow Queries
============
<?php
$query_count = 0;
if (!count($data->slow_queries))
{
echo 'None'. "\n";
}
foreach ($data->slow_queries as $query)
{
$query_caller = sprintf('%s line %d (%s)', $query->file, $query->line, $query->method);
$query_result = ($query->message === 'success') ? 'success' : sprintf('error %d %s', $query->error_code, $query->message);
echo sprintf('%02d. %s', ++$query_count, $query->query_string) . "\n";
echo sprintf(' - Caller: %s', $query_caller) . "\n";
echo sprintf(' - Connection: %s', $query->query_connection) . "\n";
echo sprintf(' - Query ID: %s', $query->query_id) . "\n";
echo sprintf(' - Query Time: %0.4f sec', $query->query_time) . "\n";
echo sprintf(' - Result: %s', $query_result) . "\n";
}
?>
Slow Triggers
=============
<?php
$trigger_count = 0;
if (!count($data->slow_triggers))
{
echo 'None'. "\n";
}
foreach ($data->slow_triggers as $trigger)
{
echo sprintf('%02d. %s', ++$trigger_count, $trigger->trigger_name) . "\n";
echo sprintf(' - Target: %s', $trigger->trigger_target) . "\n";
echo sprintf(' - Exec Time: %0.4f sec', $trigger->trigger_time) . "\n";
}
?>
Slow Widgets
============
<?php
$widget_count = 0;
if (!count($data->slow_widgets))
{
echo 'None'. "\n";
}
foreach ($data->slow_widgets as $widget)
{
echo sprintf('%02d. %s', ++$widget_count, $widget->widget_name) . "\n";
echo sprintf(' - Exec Time: %0.4f sec', $widget->widget_time) . "\n";
}
?>

View file

@ -60,7 +60,8 @@ var default_url = "{Context::getDefaultUrl()}";
{Context::getBodyHeader()}
{$content}
{Context::getHtmlFooter()}
<div id="rhymix_debug_panel"></div>
<div id="rhymix_debug_button"></div>
<!--// ETC -->
{@ $js_body_files = Context::getJsFile('body') }
<!--@foreach($js_body_files as $key => $js_file)-->

View file

@ -53,22 +53,13 @@ if($oContext->checkSSO())
{
$oModuleHandler = new ModuleHandler();
try
if($oModuleHandler->init())
{
if($oModuleHandler->init())
{
$oModuleHandler->displayContent($oModuleHandler->procModule());
}
}
catch(Exception $e)
{
htmlHeader();
echo Context::getLang($e->getMessage());
htmlFooter();
$oModuleHandler->displayContent($oModuleHandler->procModule());
}
}
$oContext->close();
Context::close();
/* End of file index.php */
/* Location: ./index.php */

View file

@ -200,8 +200,6 @@ a:hover, a:active, a:focus {
background-color: #555
}
.footer .copyright {
width: 1200px;
margin: 0 auto;
font-size: 13px;
color: #f1f1f1;
line-height: 16px
@ -266,8 +264,7 @@ a:hover, a:active, a:focus {
display: inline-block;
margin: 0 0 20px;
padding: 0 23px;
font-size: 15px;
font-weight: bold;
font-size: 18px;
color: #555
}
.footer .site_map > ul ul {

View file

@ -1 +1 @@
Copyright @ <a href="http://www.navercorp.com/" target="_blank">NAVER Corp.</a> Supported by <a href="http://dev.naver.com/d2" target="_blank">D2 Program</a>. <span>Powerd by <a href="https://www.xpressengine.com/" target="_blank">XpressEngine</a>.</span>
<span>Powerd by <a href="https://www.rhymix.org/" target="_blank">Rhymix</a></span>

View file

@ -1,4 +1,8 @@
<p class="f_logo">
<a href="#"><img src="../img/f_logo.png" alt="Rhymix" /></a>
Rhymix
</p>
<p class="sub_desc">
Rhymix is free software.
You can redistribute or modify it under the terms of the GNU General Public License (version 2 or later)
as published by the Free Software Foundation.
</p>
<p class="sub_desc">Rhymix is a free software CMS. You can redistribute or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation.</p>

View file

@ -9,8 +9,8 @@
</section>
<section class="guide">
<span class="noti">GUIDE</span>
<h1 class="tit">START-UP</h1>
<span class="noti">GET STARTED</span>
<h1 class="tit">BUILD YOUR SITE</h1>
<ul>
<li>
<a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral')}" target="_blank" class="ico"><i class="xi-pen"></i><span class="blind">사이트 제목 바꾸기</span></a>
@ -45,8 +45,8 @@
</ul>
</section>
<section class="features">
<span class="noti">FEATURES</span>
<h1 class="tit">Rhymix. FEATURES</h1>
<span class="noti">GET BETTER</span>
<h1 class="tit">RHYMIX FEATURES</h1>
<p class="cont">Rhymix는 프레임웍을 기반으로 개별 프로그램과 스킨을 실행하여 결과물을 생성합니다.<br />다양한 개성을 가진 프로그램과 스킨을 조합하여 다채로운 기능을 가진 멋진 웹사이트를 만들 수 있습니다.</p>
<ul>
<li>
@ -104,12 +104,12 @@
<h1 class="tit">GET INVOLVED</h1>
<ul>
<li>
<a href="https://www.xpressengine.com/forum" target="_blank" class="ico"><i class="xi-community"></i><span class="blind">COMMUNITY</span></a>
<a href="https://www.xetown.com/" target="_blank" class="ico"><i class="xi-community"></i><span class="blind">COMMUNITY</span></a>
<h2>COMMUNITY</h2>
<p>Rhymix와 관련한 다양한 커뮤니티를 만나보세요.</p>
</li>
<li>
<a href="https://www.xpressengine.com/qna" target="_blank" class="ico"><i class="xi-users"></i><span class="blind">Q&A</span></a>
<a href="https://www.xetown.com/qna" target="_blank" class="ico"><i class="xi-users"></i><span class="blind">Q&A</span></a>
<h2>Q&A</h2>
<p>도움이 필요할 때에는 전문가들과 이야기할 수 있습니다.</p>
</li>
@ -121,7 +121,7 @@
<li>
<a href="https://github.com/rhymix/rhymix" target="_blank" class="ico"><i class="xi-github"></i><span class="blind">GITHUB</span></a>
<h2>GITHUB</h2>
<p>오픈소스 프로젝트 개발참여를 위한 GitHub 페이지입니다.</p>
<p>오픈소스 프로젝트 개발 참여를 위한 GitHub 페이지입니다.</p>
</li>
</ul>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -34,8 +34,8 @@ class addonController extends addon
$site_module_info = Context::get('site_module_info');
$site_srl = $site_module_info->site_srl;
$addon_path = _XE_PATH_ . 'files/cache/addons/';
$addon_file = $addon_path . $site_srl . $type . '.acivated_addons.cache.php';
$addon_path = RX_BASEDIR . 'files/cache/addons/';
$addon_file = $addon_path . 'addons.' . intval($site_srl) . '.' . $type . '.php';
if($this->addon_file_called)
{
@ -46,7 +46,7 @@ class addonController extends addon
FileHandler::makeDir($addon_path);
if(!file_exists($addon_file))
if(!file_exists($addon_file) || filemtime($addon_file) < filemtime(__FILE__))
{
$this->makeCacheFile($site_srl, $type);
}
@ -88,57 +88,78 @@ class addonController extends addon
|| ($type == "pc" && $val->is_used != 'Y')
|| ($type == "mobile" && $val->is_used_m != 'Y')
|| ($gtype == 'global' && $val->is_fixed != 'Y')
|| !is_dir(_XE_PATH_ . 'addons/' . $addon))
|| !is_dir(RX_BASEDIR . 'addons/' . $addon))
{
continue;
}
$extra_vars = unserialize($val->extra_vars);
if(!$extra_vars)
{
$extra_vars = new stdClass;
}
$mid_list = $extra_vars->mid_list;
if(!is_array($mid_list) || count($mid_list) < 1)
if(!is_array($mid_list))
{
$mid_list = NULL;
$mid_list = array();
}
// Initialize
$buff[] = '$before_time = microtime(true);';
$buff[] = '$rm = \'' . $extra_vars->xe_run_method . "';";
$buff[] = '$ml = array(';
if($mid_list)
// Run method and mid list
$run_method = $extra_vars->xe_run_method ?: 'run_selected';
$buff[] = '$rm = \'' . $run_method . "';";
$buff[] = '$ml = ' . var_export(array_fill_keys($mid_list, true), true) . ';';
// Addon filename
$buff[] = sprintf('$addon_file = RX_BASEDIR . \'addons/%s/%s.addon.php\';', $addon, $addon);
// Addon configuration
$buff[] = '$addon_info = unserialize(' . var_export(serialize($extra_vars), true) . ');';
// Decide whether to run in this mid
if ($run_method === 'no_run_selected')
{
foreach($mid_list as $mid)
{
$buff[] = "'$mid' => 1,";
}
$buff[] = '$run = !isset($ml[$_m]);';
}
$buff[] = ');';
$buff[] = sprintf('$addon_file = \'./addons/%s/%s.addon.php\';', $addon, $addon);
if($val->extra_vars)
elseif (!count($mid_list))
{
unset($extra_vars);
$extra_vars = base64_encode($val->extra_vars);
$buff[] = '$run = true;';
}
$addon_include = sprintf('unset($addon_info); $addon_info = unserialize(base64_decode(\'%s\')); @include($addon_file);', $extra_vars);
$buff[] = 'if(file_exists($addon_file)){';
$buff[] = 'if($rm === \'no_run_selected\'){';
$buff[] = 'if(!isset($ml[$_m])){';
$buff[] = $addon_include;
$buff[] = '}}else{';
$buff[] = 'if(isset($ml[$_m]) || count($ml) === 0){';
$buff[] = $addon_include;
$buff[] = '}}}';
$buff[] = '$after_time = microtime(true);';
$buff[] = '$addon_time_log = new stdClass();';
$buff[] = '$addon_time_log->caller = $called_position;';
$buff[] = '$addon_time_log->called = "' . $addon . '";';
$buff[] = '$addon_time_log->called_extension = "' . $addon . '";';
$buff[] = 'writeSlowlog("addon",$after_time-$before_time,$addon_time_log);';
else
{
$buff[] = '$run = isset($ml[$_m]);';
}
// Write debug info
$buff[] = 'if ($run && file_exists($addon_file)):';
$buff[] = ' include($addon_file);';
$buff[] = ' $after_time = microtime(true);';
$buff[] = ' if (class_exists("Rhymix\\\\Framework\\\\Debug")):';
$buff[] = ' Rhymix\\Framework\\Debug::addTrigger(array(';
$buff[] = ' "name" => "addon." . $called_position,';
$buff[] = ' "target" => "' . $addon . '",';
$buff[] = ' "target_plugin" => "' . $addon . '",';
$buff[] = ' "elapsed_time" => $after_time - $before_time,';
$buff[] = ' ));';
$buff[] = ' endif;';
$buff[] = 'endif;';
$buff[] = '';
}
$addon_path = _XE_PATH_ . 'files/cache/addons/';
FileHandler::makeDir($addon_path);
$addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php';
// Write file in new location
$addon_path = RX_BASEDIR . 'files/cache/addons/';
$addon_file = $addon_path . 'addons.' . ($gtype == 'site' ? intval($site_srl) : 'G') . '.' . $type . '.php';
FileHandler::writeFile($addon_file, join(PHP_EOL, $buff));
// Remove file from old location
$old_addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php';
if (file_exists($old_addon_file))
{
FileHandler::removeFile($old_addon_file);
}
}
/**
@ -176,12 +197,17 @@ class addonController extends addon
*/
function removeAddonConfig($site_srl)
{
$addon_path = _XE_PATH_ . 'files/cache/addons/';
$addon_file = $addon_path . $site_srl . '.acivated_addons.cache.php';
$addon_path = RX_BASEDIR . 'files/cache/addons/';
$addon_file = $addon_path . 'addons.' . intval($site_srl) . '.' . $type . '.php';
if(file_exists($addon_file))
{
FileHandler::removeFile($addon_file);
}
$old_addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php';
if (file_exists($old_addon_file))
{
FileHandler::removeFile($old_addon_file);
}
$args = new stdClass();
$args->site_srl = $site_srl;

View file

@ -1,5 +1,5 @@
<div class="x_page-header">
<h1>{$lang->installed_addons} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_advanced_installed_addon" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->installed_addons} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_advanced_installed_addon" target="_blank">{$lang->help}</a></h1>
</div>
<p>{$lang->about_installed_addon}</p>
<form action="./" method="post">

View file

@ -626,17 +626,59 @@ class adminAdminController extends admin
{
return new Object(-1, 'msg_invalid_default_url');
}
Rhymix\Framework\Config::set('url.default', $vars->default_url);
// SSL and ports
if ($vars->http_port == 80) $vars->http_port = null;
if ($vars->https_port == 443) $vars->https_port = null;
$use_ssl = $vars->use_ssl ?: 'none';
// Check if all URL configuration is consistent
if ($use_ssl === 'always' && !preg_match('@^https://@', $default_url))
{
return new Object(-1, 'msg_default_url_ssl_inconsistent');
}
if ($vars->http_port && preg_match('@^http://@', $default_url) && parse_url($default_url, PHP_URL_PORT) != $vars->http_port)
{
return new Object(-1, 'msg_default_url_http_port_inconsistent');
}
if ($vars->https_port && preg_match('@^https://@', $default_url) && parse_url($default_url, PHP_URL_PORT) != $vars->https_port)
{
return new Object(-1, 'msg_default_url_https_port_inconsistent');
}
// Set all URL configuration
Rhymix\Framework\Config::set('url.default', $default_url);
Rhymix\Framework\Config::set('url.http_port', $vars->http_port ?: null);
Rhymix\Framework\Config::set('url.https_port', $vars->https_port ?: null);
Rhymix\Framework\Config::set('url.ssl', $vars->use_ssl ?: 'none');
Rhymix\Framework\Config::set('url.ssl', $use_ssl);
getController('module')->updateSite((object)array(
'site_srl' => 0,
'domain' => preg_replace('@^https?://@', '', $default_url),
));
// Object cache
if ($vars->object_cache_type)
{
if ($vars->object_cache_type === 'memcached' || $vars->object_cache_type === 'redis')
{
$cache_config = $vars->object_cache_type . '://' . $vars->object_cache_host . ':' . intval($vars->object_cache_port);
}
else
{
$cache_config = $vars->object_cache_type;
}
if (!CacheHandler::isSupport($vars->object_cache_type, $cache_config))
{
return new Object(-1, 'msg_cache_handler_not_supported');
}
Rhymix\Framework\Config::set('cache', array($cache_config));
}
else
{
Rhymix\Framework\Config::set('cache', array());
}
// Other settings
Rhymix\Framework\Config::set('use_mobile_view', $vars->use_mobile_view === 'Y');
Rhymix\Framework\Config::set('use_rewrite', $vars->use_rewrite === 'Y');
Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y');
Rhymix\Framework\Config::set('session.delay', $vars->delay_session === 'Y');
@ -648,7 +690,63 @@ class adminAdminController extends admin
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigAdvanced'));
$this->setRedirectUrl(Context::get('success_return_url') ?: $default_url . 'index.php?act=dispAdminConfigAdvanced');
}
/**
* Update debug configuration.
*/
function procAdminUpdateDebug()
{
$vars = Context::getRequestVars();
// Debug settings
Rhymix\Framework\Config::set('debug.enabled', $vars->debug_enabled === 'Y');
Rhymix\Framework\Config::set('debug.log_errors', $vars->debug_log_errors === 'Y');
Rhymix\Framework\Config::set('debug.log_queries', $vars->debug_log_queries === 'Y');
Rhymix\Framework\Config::set('debug.log_slow_queries', max(0, floatval($vars->debug_log_slow_queries)));
Rhymix\Framework\Config::set('debug.log_slow_triggers', max(0, floatval($vars->debug_log_slow_triggers)));
Rhymix\Framework\Config::set('debug.log_slow_widgets', max(0, floatval($vars->debug_log_slow_widgets)));
Rhymix\Framework\Config::set('debug.display_type', strval($vars->debug_display_type) ?: 'comment');
Rhymix\Framework\Config::set('debug.display_to', strval($vars->debug_display_to) ?: 'admin');
// Log filename
$log_filename = strval($vars->debug_log_filename);
$log_filename_today = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array(
getInternalDateTime(RX_TIME, 'Y'),
getInternalDateTime(RX_TIME, 'y'),
getInternalDateTime(RX_TIME, 'm'),
getInternalDateTime(RX_TIME, 'd'),
), $log_filename);
if (file_exists(RX_BASEDIR . $log_filename_today) && !is_writable(RX_BASEDIR . $log_filename_today))
{
return new Object(-1, 'msg_debug_log_filename_not_writable');
}
if (!file_exists(dirname(RX_BASEDIR . $log_filename)) && !FileHandler::makeDir(dirname(RX_BASEDIR . $log_filename)))
{
return new Object(-1, 'msg_debug_log_filename_not_writable');
}
if (!is_writable(dirname(RX_BASEDIR . $log_filename)))
{
return new Object(-1, 'msg_debug_log_filename_not_writable');
}
Rhymix\Framework\Config::set('debug.log_filename', $log_filename);
// IP access control
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->debug_allowed_ip));
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
return $item !== '';
}));
if (!IpFilter::validate($whitelist)) {
return new Object(-1, 'msg_invalid_ip');
}
Rhymix\Framework\Config::set('debug.allow', array_values($allowed_ip));
// Save
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigDebug'));
}
/**

View file

@ -129,14 +129,15 @@ class adminAdminView extends admin
$currentAct = Context::get('act');
$subMenuTitle = '';
foreach((array) $moduleActionInfo->menu as $key => $value)
foreach((array)$moduleActionInfo->menu as $key => $value)
{
if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts))
if(is_array($value->acts) && in_array($currentAct, $value->acts))
{
$subMenuTitle = $value->title;
break;
}
}
// get current menu's srl(=parentSrl)
$parentSrl = 0;
$oMenuAdminConroller = getAdminController('menu');
@ -301,7 +302,7 @@ class adminAdminView extends admin
{
foreach($needUpdateList AS $key => $value)
{
$helpUrl = './common/manual/admin/#';
$helpUrl = './common/manual/admin/index.html#';
switch($value->type)
{
case 'addon':
@ -449,6 +450,27 @@ class adminAdminView extends admin
Context::set('http_port', Rhymix\Framework\Config::get('url.http_port'));
Context::set('https_port', Rhymix\Framework\Config::get('url.https_port'));
// Object cache
$object_cache_config = Rhymix\Framework\Config::get('cache');
if (is_array($object_cache_config))
{
$object_cache_config = array_first($object_cache_config);
}
$object_cache_types = array('apc', 'file', 'memcached', 'redis', 'wincache');
$object_cache_type = preg_match('/^(' . implode('|', $object_cache_types) . ')/', $object_cache_config, $matches) ? $matches[1] : '';
Context::set('object_cache_types', $object_cache_types);
Context::set('object_cache_type', $object_cache_type);
if ($object_cache_type)
{
Context::set('object_cache_host', parse_url($object_cache_config, PHP_URL_HOST) ?: null);
Context::set('object_cache_port', parse_url($object_cache_config, PHP_URL_PORT) ?: null);
}
else
{
Context::set('object_cache_host', null);
Context::set('object_cache_port', null);
}
// Other settings
Context::set('use_mobile_view', Rhymix\Framework\Config::get('use_mobile_view'));
Context::set('use_rewrite', Rhymix\Framework\Config::get('use_rewrite'));
@ -461,6 +483,31 @@ class adminAdminView extends admin
$this->setTemplateFile('config_advanced');
}
/**
* Display Debug Settings page
* @return void
*/
function dispAdminConfigDebug()
{
// Load debug settings.
Context::set('debug_enabled', Rhymix\Framework\Config::get('debug.enabled'));
Context::set('debug_log_errors', Rhymix\Framework\Config::get('debug.log_errors'));
Context::set('debug_log_queries', Rhymix\Framework\Config::get('debug.log_queries'));
Context::set('debug_log_slow_queries', Rhymix\Framework\Config::get('debug.log_slow_queries'));
Context::set('debug_log_slow_triggers', Rhymix\Framework\Config::get('debug.log_slow_triggers'));
Context::set('debug_log_slow_widgets', Rhymix\Framework\Config::get('debug.log_slow_widgets'));
Context::set('debug_log_filename', Rhymix\Framework\Config::get('debug.log_filename') ?: 'files/debug/YYYYMMDD.php');
Context::set('debug_display_type', Rhymix\Framework\Config::get('debug.display_type'));
Context::set('debug_display_to', Rhymix\Framework\Config::get('debug.display_to'));
// IP access control
$allowed_ip = Rhymix\Framework\Config::get('debug.allow');
Context::set('debug_allowed_ip', implode(PHP_EOL, $allowed_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_debug');
}
/**
* Display Sitelock Settings page
* @return void

View file

@ -154,7 +154,7 @@ class admin extends ModuleObject
$output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList);
if(is_array($output->data))
{
foreach($output->data AS $key => $value)
foreach($output->data as $key => $value)
{
preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m);
$gnbDBList[$m[1]] = $value->menu_item_srl;
@ -162,90 +162,43 @@ class admin extends ModuleObject
}
unset($args);
$gnbModuleList = array(
0 => array(
'module' => 'menu',
'subMenu' => array('siteMap', 'siteDesign'),
$gnbMenuStructure = array(
'menu' => array(
'menu.siteMap',
'menu.siteDesign',
),
1 => array(
'module' => 'member',
'subMenu' => array('userList', 'userSetting', 'userGroup'),
'user' => array(
'member.userList',
'member.userSetting',
'member.userGroup',
'point.point',
),
2 => array(
'module' => 'document',
'subMenu' => array('document'),
'content' => array(
'board.board',
'document.document',
'comment.comment',
'file.file',
'poll.poll',
'editor.editor',
'importer.importer',
'spamfilter.spamFilter',
'trash.trash',
),
3 => array(
'module' => 'comment',
'subMenu' => array('comment'),
'configuration' => array(
'admin.adminConfigurationGeneral',
'admin.adminConfigurationFtp',
'admin.adminMenuSetup',
'file.fileUpload',
'module.filebox',
),
4 => array(
'module' => 'file',
'subMenu' => array('file'),
),
5 => array(
'module' => 'poll',
'subMenu' => array('poll'),
),
6 => array(
'module' => 'rss',
'subMenu' => array('rss'),
),
7 => array(
'module' => 'module',
'subMenu' => array('multilingual'),
),
8 => array(
'module' => 'importer',
'subMenu' => array('importer'),
),
9 => array(
'module' => 'trash',
'subMenu' => array('trash'),
),
10 => array(
'module' => 'autoinstall',
'subMenu' => array('easyInstall'),
),
11 => array(
'module' => 'layout',
'subMenu' => array('installedLayout'),
),
12 => array(
'module' => 'module',
'subMenu' => array('installedModule'),
),
13 => array(
'module' => 'widget',
'subMenu' => array('installedWidget'),
),
14 => array(
'module' => 'addon',
'subMenu' => array('installedAddon'),
),
15 => array(
'module' => 'editor',
'subMenu' => array('editor'),
),
16 => array(
'module' => 'spamfilter',
'subMenu' => array('spamFilter'),
),
17 => array(
'module' => 'admin',
'subMenu' => array('adminConfigurationGeneral', 'adminConfigurationFtp', 'adminMenuSetup'),
),
18 => array(
'module' => 'file',
'subMenu' => array('fileUpload'),
),
19 => array(
'module' => 'module',
'subMenu' => array('filebox'),
),
20 => array(
'module' => 'point',
'subMenu' => array('point')
'advanced' => array(
'autoinstall.easyInstall',
'layout.installedLayout',
'module.installedModule',
'addon.installedAddon',
'widget.installedWidget',
'module.multilingual',
'rss.rss',
),
);
@ -253,8 +206,7 @@ class admin extends ModuleObject
$output = $oMemberModel->getAdminGroup(array('group_srl'));
$adminGroupSrl = $output->group_srl;
// gnb sub item create
// common argument setting
// gnb common argument setting
$args = new stdClass();
$args->menu_srl = $menuSrl;
$args->open_window = 'N';
@ -264,24 +216,24 @@ class admin extends ModuleObject
$args->active_btn = '';
$args->group_srls = $adminGroupSrl;
$oModuleModel = getModel('module');
foreach($gnbModuleList AS $key => $value)
$moduleActionInfo = array();
foreach ($gnbMenuStructure as $key => $items)
{
if(is_array($value['subMenu']))
foreach ($items as $item)
{
$moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']);
foreach($value['subMenu'] AS $key2 => $value2)
list($module_name, $menu_name) = explode('.', $item);
if (!isset($moduleActionInfo[$module_name]))
{
$gnbKey = "'" . $this->_getGnbKey($value2) . "'";
//insert menu item
$args->menu_item_srl = getNextSequence();
$args->parent_srl = $gnbDBList[$gnbKey];
$args->name = '{$lang->menu_gnb_sub[\'' . $value2 . '\']}';
$args->url = 'index.php?module=admin&act=' . $moduleActionInfo->menu->{$value2}->index;
$args->listorder = -1 * $args->menu_item_srl;
$output = executeQuery('menu.insertMenuItem', $args);
$moduleActionInfo[$module_name] = $oModuleModel->getModuleActionXml($module_name);
}
$args->menu_item_srl = getNextSequence();
$args->parent_srl = $gnbDBList["'" . $key . "'"];
$args->name = '{$lang->menu_gnb_sub[\'' . $menu_name . '\']}';
$args->url = 'index.php?module=admin&act=' . $moduleActionInfo[$module_name]->menu->{$menu_name}->index;
$args->listorder = -1 * $args->menu_item_srl;
$output = executeQuery('menu.insertMenuItem', $args);
}
}
@ -293,55 +245,6 @@ class admin extends ModuleObject
FileHandler::RemoveFilesInDir('./files/cache/menu/admin_lang');
}
/**
* Return parent menu key by child menu
* @return string
*/
function _getGnbKey($menuName)
{
switch($menuName)
{
case 'siteMap':
case 'siteDesign':
return 'menu';
break;
case 'userList':
case 'userSetting':
case 'userGroup':
case 'point':
return 'user';
break;
case 'document':
case 'comment':
case 'file':
case 'poll':
case 'rss':
case 'multilingual':
case 'importer':
case 'trash':
case 'spamFilter':
return 'content';
break;
case 'easyInstall':
case 'installedLayout':
case 'installedModule':
case 'installedWidget':
case 'installedAddon':
case 'editor':
return 'advanced';
break;
case 'adminConfigurationGeneral':
case 'adminConfigurationFtp':
case 'adminMenuSetup':
case 'fileUpload':
case 'filebox':
return 'configuration';
break;
default:
return 'advanced';
}
}
/**
* Return parent old menu key by child menu
* @return string

View file

@ -7,6 +7,7 @@
<action name="dispAdminConfigGeneral" type="view" menu_name="adminConfigurationGeneral" menu_index="true" />
<action name="dispAdminConfigSecurity" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigAdvanced" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigDebug" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigSitelock" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigFtp" type="view" menu_name="adminConfigurationFtp" menu_index="true" />
<action name="dispAdminSetup" type="view" menu_name="adminMenuSetup" menu_index="true" />
@ -24,6 +25,7 @@
<action name="procAdminUpdateConfigGeneral" type="controller" />
<action name="procAdminUpdateSecurity" type="controller" />
<action name="procAdminUpdateAdvanced" type="controller" />
<action name="procAdminUpdateDebug" type="controller" />
<action name="procAdminUpdateSitelock" type="controller" />
<action name="procAdminUpdateFTPInfo" type="controller" />
<action name="procAdminRemoveFTPInfo" type="controller" />

View file

@ -4,6 +4,7 @@ $lang->cmd_configure = 'Configure';
$lang->subtitle_primary = 'General Settings';
$lang->subtitle_security = 'Security Settings';
$lang->subtitle_advanced = 'Advanced Settings';
$lang->subtitle_debug = 'Debug Settings';
$lang->subtitle_etc = 'Other Settings';
$lang->current_state = 'Current state';
$lang->latest_documents = 'Latest Documents';
@ -86,7 +87,15 @@ $lang->about_minify_scripts = 'Automatically minify all CSS and JS scripts in th
$lang->use_gzip = 'gzip Compression';
$lang->delay_session = 'Delay session start';
$lang->about_delay_session = 'To improve performance when using a caching proxy 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.';
$lang->use_object_cache = 'Use Object Cache';
$lang->use_object_cache_do_not_use = 'none';
$lang->cache_host = 'Host';
$lang->cache_port = 'Port';
$lang->msg_cache_handler_not_supported = 'Your server does not support the selected cache method, or Rhymix is unable to use the cache with the given settings.';
$lang->msg_invalid_default_url = 'The default URL is invalid.';
$lang->msg_default_url_ssl_inconsistent = 'In order to use SSL always, the default URL must also begin with https://';
$lang->msg_default_url_http_port_inconsistent = 'In order to change the HTTP port, the default URL must also include the port number.';
$lang->msg_default_url_https_port_inconsistent = 'In order to change the HTTPS port, the default URL must also include the port number.';
$lang->sftp = 'Use SFTP';
$lang->ftp_get_list = 'Get List';
$lang->ftp_remove_info = 'Remove FTP Info.';
@ -100,6 +109,25 @@ $lang->use_ftp_passive_mode = 'Use FTP Passive Mode';
$lang->use_sftp_support = 'Use SFTP';
$lang->disable_sftp_support = 'You should install ssh2 PHP module to use SFTP.';
$lang->msg_self_restart_cache_engine = 'Please restart Memcached or cache daemon.';
$lang->debug_enabled = 'Enable Debugging';
$lang->debug_log_errors = 'Log Errors';
$lang->debug_log_queries = 'Log Queries';
$lang->debug_log_slow_queries = 'Log Slow Queries';
$lang->debug_log_slow_triggers = 'Log Slow Triggers';
$lang->debug_log_slow_widgets = 'Log Slow Widgets';
$lang->debug_seconds = 'seconds or longer';
$lang->debug_display_type = 'Display Debug Info As';
$lang->debug_display_type_comment = 'HTML source comment';
$lang->debug_display_type_panel = 'On-screen panel';
$lang->debug_display_type_file = 'Write to file';
$lang->debug_display_to = 'Display Debug Info To';
$lang->debug_display_to_admin = 'Administrator only';
$lang->debug_display_to_ip = 'Visitors from IP adresses listed below';
$lang->debug_display_to_everyone = 'Everyone';
$lang->debug_log_filename = 'Log filename';
$lang->about_debug_log_filename = 'YYYYMMDD in the filename will be replaced with the current date.<br>It is recommended to split the log file by date to prevent it from getting too large.';
$lang->msg_debug_log_filename_not_writable = 'Rhymix cannot write log files in the specified path.';
$lang->debug_allowed_ip = 'Allowed IP addresses';
$lang->autoinstall = 'EasyInstall';
$lang->last_week = 'Last Week';
$lang->this_week = 'This Week';

View file

@ -86,6 +86,15 @@ $lang->about_minify_scripts = 'コアとすべてのモジュールに含まれ
$lang->use_gzip = 'gzip 圧縮';
$lang->delay_session = 'セッションの開始を遅延';
$lang->about_delay_session = 'Varnishなどのプロキシキャッシュサーバ使用時のパフォーマンスを向上させるために、ログインしていないユーザーには、認証セッションを付与しません。<br>このオプションを選択した場合、訪問者数とヒット集計が正確でない場合があります。';
$lang->use_object_cache = 'オブジェクトキャッシュ';
$lang->use_object_cache_do_not_use = '使用していない';
$lang->cache_host = 'ホスト';
$lang->cache_port = 'ポート';
$lang->msg_cache_handler_not_supported = '選択したキャッシュ方式をサーバーでサポートされていないか、与えられた情報でキャッシュにアクセスすることができません。';
$lang->msg_invalid_default_url = '基本URLが正しくありません。';
$lang->msg_default_url_ssl_inconsistent = 'SSLを常に使用する場合、基本URLもhttps//で始まる必要があります。';
$lang->msg_default_url_http_port_inconsistent = 'HTTPポートを変更する場合、基本URLも同じポートが含まれている必要があります。';
$lang->msg_default_url_https_port_inconsistent = 'HTTPSポートを変更する場合、基本URLも同じポートが含まれている必要があります。';
$lang->sftp = 'SFTP使用';
$lang->ftp_get_list = 'ディレクトリを読み込む';
$lang->ftp_remove_info = 'FTP情報削除';

View file

@ -4,6 +4,7 @@ $lang->cmd_configure = '설정하기';
$lang->subtitle_primary = '기본 설정';
$lang->subtitle_security = '보안 설정';
$lang->subtitle_advanced = '고급 설정';
$lang->subtitle_debug = '디버그 설정';
$lang->subtitle_etc = '기타';
$lang->current_state = '현황';
$lang->latest_documents = '최근 글';
@ -86,7 +87,15 @@ $lang->about_minify_scripts = '코어와 모든 모듈에 포함된 CSS, JS 파
$lang->use_gzip = 'gzip 압축';
$lang->delay_session = '세션 시작 지연';
$lang->about_delay_session = 'Varnish 등의 프록시 캐싱 서버 사용시 성능 개선을 위해, 로그인하지 않은 사용자에게는 인증 세션을 부여하지 않습니다.<br>이 옵션을 선택할 경우 방문자 수 및 조회수 집계가 정확하게 이루어지지 않을 수 있습니다.';
$lang->use_object_cache = '오브젝트 캐시 사용';
$lang->use_object_cache_do_not_use = '사용하지 않음';
$lang->cache_host = '호스트';
$lang->cache_port = '포트';
$lang->msg_cache_handler_not_supported = '선택하신 캐시 방식을 서버에서 지원하지 않거나, 주어진 정보로 캐시에 접속할 수 없습니다.';
$lang->msg_invalid_default_url = '기본 URL이 올바르지 않습니다.';
$lang->msg_default_url_ssl_inconsistent = 'SSL을 항상 사용하실 경우 기본 URL도 https://로 시작해야 합니다.';
$lang->msg_default_url_http_port_inconsistent = 'HTTP 포트를 변경하실 경우 기본 URL에도 동일한 포트가 포함되어야 합니다.';
$lang->msg_default_url_https_port_inconsistent = 'HTTPS 포트를 변경하실 경우 기본 URL에도 동일한 포트가 포함되어야 합니다.';
$lang->sftp = 'SFTP 사용';
$lang->msg_ftp_not_connected = 'FTP 서버에 접속할 수 없습니다. 주소와 포트를 확인해 주십시오.';
$lang->msg_ftp_invalid_auth_info = 'FTP 서버에 로그인할 수 없습니다. 아이디와 비밀번호를 확인해 주십시오.';
@ -97,6 +106,25 @@ $lang->use_ftp_passive_mode = 'Passive 모드 사용';
$lang->use_sftp_support = 'SFTP 사용';
$lang->disable_sftp_support = 'SFTP를 사용하려면 PHP에 ssh2 모듈이 설치되어 있어야 합니다.';
$lang->msg_self_restart_cache_engine = 'Memcached 또는 캐시 서비스를 재시작해 주세요.';
$lang->debug_enabled = '디버그 기능 사용';
$lang->debug_log_errors = '에러 기록';
$lang->debug_log_queries = '쿼리 기록';
$lang->debug_log_slow_queries = '느린 쿼리 기록';
$lang->debug_log_slow_triggers = '느린 트리거 기록';
$lang->debug_log_slow_widgets = '느린 위젯 기록';
$lang->debug_seconds = '초 이상 소요시 기록';
$lang->debug_display_type = '디버그 정보 표시 방법';
$lang->debug_display_type_comment = 'HTML 소스에 표시 (주석)';
$lang->debug_display_type_panel = '화면에 표시 (패널)';
$lang->debug_display_type_file = '파일에 기록';
$lang->debug_display_to = '디버그 정보 표시 대상';
$lang->debug_display_to_admin = '관리자에게만 표시';
$lang->debug_display_to_ip = '아래 IP의 방문자에게만 표시';
$lang->debug_display_to_everyone = '모두에게 표시';
$lang->debug_log_filename = '디버그 정보 기록 파일';
$lang->about_debug_log_filename = '파일명에 YYYYMMDD가 포함된 경우 날짜별로 파일을 분리하여 기록합니다.<br>파일을 분리하지 않으면 용량이 매우 커질 수 있으니 주의하십시오.';
$lang->msg_debug_log_filename_not_writable = '지정한 경로에 로그 파일을 작성할 수 없습니다.';
$lang->debug_allowed_ip = '디버그 허용 IP';
$lang->autoinstall = '쉬운 설치';
$lang->last_week = '지난주';
$lang->this_week = '이번주';

View file

@ -28,7 +28,7 @@
<script>
var __xe_admin_gnb_txs = new Array();
</script>
<!--@foreach($gnbUrlList AS $key=>$value)-->
<!--@foreach($gnbUrlList as $key=>$value)-->
<!--@if(strstr($value['menu_name_key'], 'configuration'))-->
<li class="open"|cond="$_COOKIE['__xe_admin_gnb_tx_favorite'] == 'open'">
<script>

View file

@ -1,6 +1,6 @@
<load target="./js/menu_setup.js" usecdn="true" />
<div class="x_page-header">
<h1>{$lang->admin_setup} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_admin" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->admin_setup} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_admin" target="_blank">{$lang->help}</a></h1>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/admin/tpl/admin_setup/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>

View file

@ -8,13 +8,13 @@
<input type="hidden" name="act" value="procAdminUpdateAdvanced" />
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_advanced/1" />
<div class="x_control-group">
<label class="x_control-label" for="default_url">{$lang->default_url} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_default_url" target="_blank">{$lang->help}</a></label>
<label class="x_control-label" for="default_url">{$lang->default_url} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_default_url" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<input type="url" name="default_url" id="default_url" style="min-width:90%" value="{$default_url}"/>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_ssl} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_ssl" target="_blank">{$lang->help}</a></label>
<label class="x_control-label">{$lang->use_ssl} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_ssl" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<!--@foreach($lang->ssl_options as $key => $val)-->
<label for="ssl_{$key}" class="x_inline"><input type="radio" name="use_ssl" id="ssl_{$key}" value="{$key}" checked="checked"|cond="$use_ssl==$key" /> {$val}</label>
@ -36,7 +36,7 @@
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_sso} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_sso" target="_blank">{$lang->help}</a></label>
<label class="x_control-label">{$lang->use_sso} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_sso" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<label for="use_sso_y" class="x_inline"><input type="radio" name="use_sso" id="use_sso_y" value="Y" checked="checked"|cond="$use_sso" /> {$lang->cmd_yes}</label>
<label for="use_sso_n" class="x_inline"><input type="radio" name="use_sso" id="use_sso_n" value="N" checked="checked"|cond="!$use_sso" /> {$lang->cmd_no}</label>
@ -52,12 +52,25 @@
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_db_session} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_db_session" target="_blank">{$lang->help}</a></label>
<label class="x_control-label">{$lang->use_db_session} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_db_session" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<label for="use_db_session_y" class="x_inline"><input type="radio" name="use_db_session" id="use_db_session_y" value="Y" checked="checked"|cond="$use_db_session" /> {$lang->cmd_yes}</label>
<label for="use_db_session_n" class="x_inline"><input type="radio" name="use_db_session" id="use_db_session_n" value="N" checked="checked"|cond="!$use_db_session" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_object_cache}</label>
<div class="x_controls">
<select name="object_cache_type" id="object_cache_type">
<option value="">{$lang->use_object_cache_do_not_use}</option>
<option value="{$key}" loop="$object_cache_types=>$key" selected="selected"|cond="$key==$object_cache_type">{$key}</option>
</select>
<div id="object_cache_additional_config" class="x_inline" style="display:none;margin-left:16px">
<label for="object_cache_host" class="x_inline">{$lang->cache_host}: <input type="text" name="object_cache_host" id="object_cache_host" value="{$object_cache_host}" /></label>
<label for="object_cache_port" class="x_inline">{$lang->cache_port}: <input type="number" name="object_cache_port" id="object_cache_port" size="5" style="min-width:70px" value="{$object_cache_port}" /></label>
</div>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->minify_scripts}</label>
<div class="x_controls">

View file

@ -0,0 +1,87 @@
<include target="config_header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/admin/tpl/config_debug/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
<form action="./" method="post" class="x_form-horizontal">
<input type="hidden" name="module" value="admin" />
<input type="hidden" name="act" value="procAdminUpdateDebug" />
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_debug/1" />
<div class="x_control-group">
<label class="x_control-label">{$lang->debug_enabled}</label>
<div class="x_controls">
<label for="debug_enabled_y" class="x_inline"><input type="radio" name="debug_enabled" id="debug_enabled_y" value="Y" checked="checked"|cond="$debug_enabled" /> {$lang->cmd_yes}</label>
<label for="debug_enabled_n" class="x_inline"><input type="radio" name="debug_enabled" id="debug_enabled_n" value="N" checked="checked"|cond="!$debug_enabled" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->debug_log_errors}</label>
<div class="x_controls">
<label for="debug_log_errors_y" class="x_inline"><input type="radio" name="debug_log_errors" id="debug_log_errors_y" value="Y" checked="checked"|cond="$debug_log_errors" /> {$lang->cmd_yes}</label>
<label for="debug_log_errors_n" class="x_inline"><input type="radio" name="debug_log_errors" id="debug_log_errors_n" value="N" checked="checked"|cond="!$debug_log_errors" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->debug_log_queries}</label>
<div class="x_controls">
<label for="debug_log_queries_y" class="x_inline"><input type="radio" name="debug_log_queries" id="debug_log_queries_y" value="Y" checked="checked"|cond="$debug_log_queries" /> {$lang->cmd_yes}</label>
<label for="debug_log_queries_n" class="x_inline"><input type="radio" name="debug_log_queries" id="debug_log_queries_n" value="N" checked="checked"|cond="!$debug_log_queries" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_slow_queries">{$lang->debug_log_slow_queries}</label>
<div class="x_controls">
<input type="text" name="debug_log_slow_queries" id="debug_log_slow_queries" size="5" value="{$debug_log_slow_queries}" />
&nbsp;{$lang->debug_seconds}
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_slow_triggers">{$lang->debug_log_slow_triggers}</label>
<div class="x_controls">
<input type="text" name="debug_log_slow_triggers" id="debug_log_slow_triggers" size="5" value="{$debug_log_slow_triggers}" />
&nbsp;{$lang->debug_seconds}
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_slow_widgets">{$lang->debug_log_slow_widgets}</label>
<div class="x_controls">
<input type="text" name="debug_log_slow_widgets" id="debug_log_slow_widgets" size="5" value="{$debug_log_slow_widgets}" />
&nbsp;{$lang->debug_seconds}
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_slow_widgets">{$lang->debug_display_type}</label>
<div class="x_controls">
<label for="debug_display_type_comment" class="x_inline"><input type="radio" name="debug_display_type" id="debug_display_type_comment" value="comment" checked="checked"|cond="$debug_display_type=='comment'" /> {$lang->debug_display_type_comment}</label>
<label for="debug_display_type_panel" class="x_inline"><input type="radio" name="debug_display_type" id="debug_display_type_panel" value="panel" checked="checked"|cond="$debug_display_type=='panel'" /> {$lang->debug_display_type_panel}</label>
<label for="debug_display_type_file" class="x_inline"><input type="radio" name="debug_display_type" id="debug_display_type_file" value="file" checked="checked"|cond="$debug_display_type=='file'" /> {$lang->debug_display_type_file}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_filename">{$lang->debug_log_filename}</label>
<div class="x_controls">
<input type="text" name="debug_log_filename" id="debug_log_filename" value="{$debug_log_filename}" />
<p class="x_help-block">{$lang->about_debug_log_filename}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_log_slow_widgets">{$lang->debug_display_to}</label>
<div class="x_controls">
<label for="debug_display_to_admin" class="x_inline"><input type="radio" name="debug_display_to" id="debug_display_to_admin" value="admin" checked="checked"|cond="$debug_display_to=='admin'" /> {$lang->debug_display_to_admin}</label>
<label for="debug_display_to_ip" class="x_inline"><input type="radio" name="debug_display_to" id="debug_display_to_ip" value="ip" checked="checked"|cond="$debug_display_to=='ip'" /> {$lang->debug_display_to_ip}</label>
<label for="debug_display_to_everyone" class="x_inline"><input type="radio" name="debug_display_to" id="debug_display_to_everyone" value="everyone" checked="checked"|cond="$debug_display_to=='everyone'" /> {$lang->debug_display_to_everyone}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="debug_allowed_ip">{$lang->debug_allowed_ip}</label>
<div class="x_controls">
<textarea name="debug_allowed_ip" id="debug_allowed_ip" rows="4" cols="42" placeholder="{$remote_addr} ({$lang->local_ip_address})" style="margin-right:10px">{$debug_allowed_ip}</textarea>
</div>
</div>
<div class="x_clearfix btnArea">
<div class="x_pull-right">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
</div>
</div>
</form>
</section>

View file

@ -1,7 +1,7 @@
<load target="./js/config.js" />
<load target="../../session/tpl/js/session.js" />
<div class="x_page-header">
<h1>{$lang->menu_gnb_sub['adminConfigurationFtp']} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_ftp" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->menu_gnb_sub['adminConfigurationFtp']} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_ftp" target="_blank">{$lang->help}</a></h1>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/admin/tpl/config_ftp/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>

View file

@ -11,13 +11,13 @@
</form>
<div class="x_form-horizontal" id="admin_config">
<div class="x_control-group">
<label class="x_control-label">{$lang->site_title} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_site_title" target="_blank">{$lang->help}</a></label>
<label class="x_control-label">{$lang->site_title} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_site_title" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<input type="text" name="site_title" value="{$site_title}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="_target_module">{$lang->start_module} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_homepage" target="_blank">{$lang->help}</a></label>
<label class="x_control-label" for="_target_module">{$lang->start_module} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_homepage" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<input class="module_search" type="text" name="index_module_srl" value="{$start_module->index_module_srl}" />
</div>

View file

@ -1,11 +1,12 @@
<load target="./js/config.js" />
<load target="../../session/tpl/js/session.js" />
<div class="x_page-header">
<h1>{$lang->menu_gnb_sub['adminConfigurationGeneral']} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->menu_gnb_sub['adminConfigurationGeneral']} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general" target="_blank">{$lang->help}</a></h1>
</div>
<ul class="x_nav x_nav-tabs">
<li class="x_active"|cond="$act == 'dispAdminConfigGeneral'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral')}">{$lang->subtitle_primary}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigSecurity'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigSecurity')}">{$lang->subtitle_security}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigAdvanced'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigAdvanced')}">{$lang->subtitle_advanced}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigDebug'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug')}">{$lang->subtitle_debug}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigSitelock'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock')}">{$lang->subtitle_sitelock}</a></li>
</ul>

View file

@ -9,7 +9,7 @@
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_sitelock/1" />
<div class="x_control-group">
<label class="x_control-label">{$lang->use_sitelock} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_sitelock" target="_blank">{$lang->help}</a></label>
<label class="x_control-label">{$lang->use_sitelock} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_sitelock" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<label for="sitelock_locked_y" class="x_inline"><input type="radio" name="sitelock_locked" id="sitelock_locked_y" value="Y" checked="checked"|cond="$sitelock_locked" /> {$lang->cmd_yes}</label>
<label for="sitelock_locked_n" class="x_inline"><input type="radio" name="sitelock_locked" id="sitelock_locked_n" value="N" checked="checked"|cond="!$sitelock_locked" /> {$lang->cmd_no}</label>
@ -17,7 +17,7 @@
</div>
<div class="x_control-group">
<label class="x_control-label" for="sitelock_allowed_ip">{$lang->sitelock_whitelist} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_config_general_sitelock_whitelist" target="_blank">{$lang->help}</a></label>
<label class="x_control-label" for="sitelock_allowed_ip">{$lang->sitelock_whitelist} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_config_general_sitelock_whitelist" target="_blank">{$lang->help}</a></label>
<div class="x_controls">
<textarea name="sitelock_allowed_ip" id="sitelock_allowed_ip" rows="4" cols="42" placeholder="{$remote_addr} ({$lang->local_ip_address})" style="margin-right:10px">{$sitelock_allowed_ip}</textarea>
<span class="x_help-block">{$lang->sitelock_warning_whitelist}</span>

View file

@ -1064,7 +1064,7 @@ margin-bottom: 10px;
border-top-color: #eee;
}
.x>.body>.gnb>ul>li[data-index="5"] {
margin-bottom: 25px;
margin-bottom: 1px;
}
.x>.body>.gnb>ul>li[data-index="6"] {
border-top-color: #eee;

View file

@ -8,7 +8,7 @@
<div class="content" id="content">
<div class="x_page-header">
<h1>{$lang->control_panel} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_dashboard" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->control_panel} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_dashboard" target="_blank">{$lang->help}</a></h1>
</div>
<div id="checkBrowserMessage" class="message error" style="display:none;">

View file

@ -2,6 +2,27 @@ jQuery(function($){
$('.tgContent ul').bind('click', function(){
$('#sitefind_addBtn').css('display','');
});
if ($("#object_cache_type").size()) {
$("#object_cache_type").on("change", function() {
if ($(this).val().match(/memcache|redis/)) {
$("#object_cache_additional_config").show();
if (!$("#object_cache_host").val()) {
$("#object_cache_host").val('127.0.0.1');
}
if (!$("#object_cache_port").val()) {
$("#object_cache_port").val($(this).val().match(/memcache/) ? '11211' : '6379');
}
if ($(this).val().match(/memcache/) && $("#object_cache_port").val() == '6379') {
$("#object_cache_port").val('11211');
}
if ($(this).val().match(/redis/) && $("#object_cache_port").val() == '11211') {
$("#object_cache_port").val('6379');
}
} else {
$("#object_cache_additional_config").hide();
}
}).triggerHandler("change");
}
});
function setStartModule(){

View file

@ -164,7 +164,7 @@ class ModuleInstaller
}
$output = $oModule->moduleUninstall();
if(is_subclass_of($output, 'Object') && !$output->toBool())
if($output instanceof Object && !$output->toBool())
{
return $output;
}

View file

@ -1,4 +1,4 @@
<load target="./css/autoinstall.css" index="11" />
<div class="x_page-header">
<h1>{$lang->autoinstall} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_advanced_easyinstall" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->autoinstall} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_advanced_easyinstall" target="_blank">{$lang->help}</a></h1>
</div>

View file

@ -114,9 +114,22 @@ class boardController extends board
return new Object(-1,'msg_not_permitted');
}
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_update_content == 'Y')
{
return new Object(-1,'msg_protect_content');
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_update_content');
}
}
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if(!$this->grant->manager)
@ -202,11 +215,23 @@ class boardController extends board
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// check protect content
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
{
return new Object(-1, 'msg_protect_content');
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_delete_content');
}
}
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// generate document module controller object
$oDocumentController = getController('document');
@ -306,12 +331,12 @@ class boardController extends board
else
{
$comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
if($this->module_info->protect_comment === 'Y' && $this->grant->manager == false)
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($obj->comment_srl);
if (count($childs) > 0)
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_protect_comment');
return new Object(-1, 'msg_board_update_protect_comment');
}
}
}
@ -349,6 +374,15 @@ class boardController extends board
}
else
{
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($comment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// check the grant
if(!$comment->isGranted())
{
@ -384,15 +418,24 @@ class boardController extends board
$oCommentModel = getModel('comment');
if($this->module_info->protect_comment === 'Y' && $this->grant->manager==false)
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_protect_comment');
return new Object(-1, 'msg_board_delete_protect_comment');
}
}
$comment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($comment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
// generate comment controller object
$oCommentController = getController('comment');

View file

@ -692,9 +692,24 @@ class boardView extends board
if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
$oDocument->add('module_srl', $this->module_srl);
if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($oDocument->isExists())
{
return new Object(-1, 'msg_protect_content');
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y')
{
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{
return new Object(-1, 'msg_protect_update_content');
}
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
@ -806,9 +821,22 @@ class boardView extends board
return $this->setTemplateFile('input_password_form');
}
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
return $this->dispBoardMessage('msg_protect_content');
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_delete_content == 'Y')
{
if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{
return new Object(-1,'msg_protect_delete_content');
}
}
Context::set('oDocument',$oDocument);
@ -955,6 +983,23 @@ class boardView extends board
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oComment->member_srl);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_update_protect_comment');
}
}
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
@ -1006,6 +1051,26 @@ class boardView extends board
$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
}
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
$format = Context::getLang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage);
}
}
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
$oCommentModel = getModel('comment');
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
return new Object(-1, 'msg_board_delete_protect_comment');
}
}
// if the comment is not existed, then back to the board content page
if(!$oComment->isExists() )
{

View file

@ -42,8 +42,14 @@ $lang->hide_category = '분류 숨기기';
$lang->about_hide_category = '임시로 분류를 사용하지 않으려면 체크하세요.';
$lang->protect_content = '글 보호 기능';
$lang->protect_comment = '댓글 보호 기능';
$lang->about_protect_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정하거나 삭제 할 수 없습니다. ';
$lang->msg_protect_content = '댓글이 작성된 게시물의 글을 수정 또는 삭제 할 수 없습니다.';
$lang->protect_regdate = '기간 제한 기능';
$lang->about_protect_regdate = '작성된 글이나 댓글의 작성기간이 설정한 기간보다 이전일일 경우 글을 수정 또는 삭제할 수 없도록 합니다. (단위 : day)';
$lang->about_protect_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정 또는 삭제를 할 수 없습니다.';
$lang->msg_protect_delete_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 삭제할 수 없습니다. ';
$lang->msg_protect_update_content = '작성된 글에 댓글이 작성된 경우 글 작성자는 해당 글을 수정할 수 없습니다. ';
$lang->msg_admin_document_no_modify = '최고관리자의 게시물을 수정할 권한이 없습니다.';
$lang->msg_admin_comment_no_modify = '최고관리자의 댓글을 수정할 권한이 없습니다.';
$lang->msg_board_protect_comment = '댓글이 작성된 댓글의 글을 수정 또는 삭제할 수 없습니다.';
$lang->msg_board_delete_protect_comment = '댓글이 작성된 댓글의 글을 삭제할 수 없습니다.';
$lang->msg_board_update_protect_comment = '댓글이 작성된 댓글의 글을 수정할 수 없습니다.';
$lang->msg_protect_regdate_document = '%s일 이전의 게시글은 수정 또는 삭제 할 수 없습니다.';
$lang->msg_protect_regdate_comment = '%s일 이전의 댓글은 수정 또는 삭제 할 수 없습니다.';

View file

@ -202,13 +202,25 @@
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_content}</label>
<div class="x_controls">
<label class="x_inline" for="protect_content"><input type="checkbox" name="protect_content" id="protect_content" value="Y" checked="checked"|cond="$module_info->protect_content == 'Y'" /> {$lang->about_protect_content}</label>
<label class="x_inline" for="protect_delete_content"><input type="checkbox" name="protect_delete_content" id="protect_delete_content" value="Y" checked="checked"|cond="$module_info->protect_delete_content == 'Y'" /> {$lang->cmd_delete}</label>
<label class="x_inline" for="protect_update_content"><input type="checkbox" name="protect_update_content" id="protect_update_content" value="Y" checked="checked"|cond="$module_info->protect_update_content == 'Y'" /> {$lang->cmd_modify}</label>
<p>{$lang->about_protect_content}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_comment}</label>
<div class="x_controls">
<label class="x_inline" for="protect_comment"><input type="checkbox" name="protect_comment" id="protect_comment" value="Y" checked="checked"|cond="$module_info->protect_comment == 'Y'" /> {$lang->about_protect_comment}</label>
<label class="x_inline" for="protect_delete_comment"><input type="checkbox" name="protect_delete_comment" id="protect_delete_comment" value="Y" checked="checked"|cond="$module_info->protect_delete_comment == 'Y'" />{$lang->cmd_delete} </label>
<label class="x_inline" for="protect_update_comment"><input type="checkbox" name="protect_update_comment" id="protect_update_comment" value="Y" checked="checked"|cond="$module_info->protect_update_comment == 'Y'" />{$lang->cmd_modify} </label>
<p>{$lang->about_protect_comment}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->protect_regdate}</label>
<div class="x_controls">
{$lang->document} : <input type="number" name="protect_document_regdate" id="protect_document_regdate" value="{$module_info->protect_document_regdate}" />
{$lang->comment} : <input type="number" name="protect_comment_regdate" id="protect_comment_regdate" value="{$module_info->protect_comment_regdate}" />
<p>{$lang->about_protect_regdate}</p>
</div>
</div>
<div class="x_control-group">

View file

@ -1,4 +1,4 @@
<load target="js/comment_admin.js" usecdn="true" />
<div class="x_page-header">
<h1>{$lang->comment} {$lang->cmd_management} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_comment" target="_blank">{$lang->help}</a></h1>
<h1>{$lang->comment} {$lang->cmd_management} <a class="x_icon-question-sign" href="./common/manual/admin/index.html#UMAN_content_comment" target="_blank">{$lang->help}</a></h1>
</div>

View file

@ -24,7 +24,7 @@ class communicationAdminController extends communication
function procCommunicationAdminInsertConfig()
{
// get the default information
$args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group');
$args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group', 'member_menu');
$args->editor_colorset = $args->sel_editor_colorset;
unset($args->sel_editor_colorset);

View file

@ -66,7 +66,6 @@ class communicationAdminView extends communication
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('index');
}
}
/* End of file communication.admin.view.php */
/* Location: ./modules/comment/communication.admin.view.php */

View file

@ -8,13 +8,21 @@
*/
class communication extends ModuleObject
{
private $triggers = array(
array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerAfter', 'after')
);
/**
* Implement if additional tasks are necessary when installing
* @return Object
*/
function moduleInstall()
{
$oModuleController = getController('module');
foreach($this->triggers as $trigger)
{
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
}
// Create a temporary file storage for one new private message notification
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
return new Object();
@ -46,6 +54,15 @@ class communication extends ModuleObject
}
}
}
$oModuleModel = getModel('module');
foreach($this->triggers as $trigger)
{
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
{
return TRUE;
}
}
return FALSE;
}
@ -61,6 +78,14 @@ class communication extends ModuleObject
}
$oModuleModel = getModel('module');
$oModuleController = getController('module');
foreach($this->triggers as $trigger)
{
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
{
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
}
}
$config = $oModuleModel->getModuleConfig('message');
if(!is_object($config))
{
@ -76,7 +101,6 @@ class communication extends ModuleObject
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = getController('module');
$oModuleController->updateModuleConfig('communication', $config);
}
}

View file

@ -14,7 +14,6 @@ class communicationController extends communication
*/
function init()
{
}
/**
@ -778,6 +777,82 @@ class communicationController extends communication
return executeQuery('communication.setMessageReaded', $args);
}
function triggerModuleHandlerAfter($module)
{
if(!Context::get('is_logged') && isCrawler())
{
return new Object();
}
if($module->module == 'admin')
{
return new Object();
}
$oCommunicationModel = getModel('communication');
$config = $oCommunicationModel->getConfig();
if($config->member_menu != 'Y')
{
return new Object();
}
$act = Context::get('act');
if($module->module != 'member')
{
$oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// Pop-up to display messages if a flag on new message is set
$new_message_count = $oCommunicationModel->getNewMessageCount();
if($new_message_count > 0)
{
Context::loadFile('./modules/communication/tpl/js/member_communication.js');
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
Context::addHtmlHeader("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
}
}
elseif($act == 'getMemberMenu')
{
$member_srl = Context::get('target_srl');
$oCommunicationModel = getModel('communication');
$logged_info = Context::get('logged_info');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl)
{
$mid = Context::get('cur_mid');
$oMemberController = getController('member');
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
}
else
{
// Get member information
$oMemberModel = getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl)
{
return new Object();
}
$oMemberController = getController('member');
// Add a menu for sending message
if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
}
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
}
}
}
}
}
/* End of file communication.controller.php */
/* Location: ./modules/comment/communication.controller.php */

View file

@ -51,10 +51,15 @@ class communicationModel extends communication
{
$communication_config->mskin = 'default';
}
if(!$communication_config->grant_write)
{
$communication_config->grant_write = array('default_grant'=>'member');
$communication_config->grant_write = array('default_grant' => 'member');
}
if(!$communication_config->member_menu)
{
$communication_config->member_menu = 'Y';
}
return $communication_config;
@ -228,6 +233,22 @@ class communicationModel extends communication
return $message;
}
function getNewMessageCount($member_srl = null)
{
if(!$member_srl)
{
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
}
$args = new stdClass();
$args->receiver_srl = $member_srl;
$args->readed = 'N';
$output = executeQuery('communication.getNewMessageCount', $args);
return $output->data->count;
}
/**
* get a message list
* @param string $message_type (R: Received Message, S: Sent Message, T: Archive)

View file

@ -34,3 +34,4 @@ $lang->message_notice = 'Send a message to the author about this. If you don\'t
$lang->friends_page_does_not_support = 'Friends in a mobile environment is not supported. Please go to the PC page.';
$lang->cmd_write_communication = 'Write Grant';
$lang->cmd_manage_base = 'Basic infomation';
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';

View file

@ -28,3 +28,4 @@ $lang->msg_content_is_null = 'Por favor ingresar el contenido';
$lang->msg_allow_message_to_friend = 'Falló el envío por permitir sólo mensajes de sus amigos';
$lang->msg_disallow_message = 'Falló el envío por ser usuario rechazado para recibir mensajes';
$lang->about_allow_message = 'Usted puede decidir la recepción del mensaje';
$lang->alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?';

View file

@ -32,3 +32,4 @@ $lang->msg_disallow_message = 'メッセージの受信を拒否している受
$lang->about_allow_message = 'メッセージを受信するか設定します。';
$lang->message_notice = '作成者にメッセージを送信し、知らせます。作成しなければ送信されません。';
$lang->friends_page_does_not_support = 'モバイル環境では友達リストページをサポートしません。PC画面へ移動してください。';
$lang->alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか';

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