Merge remote-tracking branch 'refs/remotes/rhymix/develop' into develop

This commit is contained in:
MinSoo Kim 2016-02-22 23:59:34 +09:00
commit 25de7998c2
278 changed files with 6077 additions and 5165 deletions

3
.gitignore vendored
View file

@ -1,7 +1,8 @@
.DS_Store
Thumbs.db
config.user.inc.php
/config/config.user.inc.php
/config/install.config.php
/files/
/build/
/libs/

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

@ -8,13 +8,13 @@
- 무관한 이슈에 댓글을 달지 말아 주십시오. 엉뚱한 사람에게 메일 알림이 전달됩니다.
- 2가지 이상 서로 다른 문제가 있는 경우, 각각 이슈를 등록해 주십시오.
- 보안 취약점은 공개적으로 언급하지 말고 devops@rhymix.org로 알려 주시면 감사하겠습니다.
- **버그 신고 전 자신의 서버가 RhymiX의 실행 환경을 충족하는지 확인해 주십시오.**
- **버그 신고 전 자신의 서버가 Rhymix의 실행 환경을 충족하는지 확인해 주십시오.**
- PHP 5.3 미만, EUC-KR 환경, 퍼미션 오류 등은 호스팅 업체에 문의하셔야 합니다.
- 자신의 서버 환경은 `phpinfo`를 사용하여 확인할 수 있습니다.
- **버그 신고에는 아래의 내용을 반드시 포함시켜 주십시오.**
- 실행 환경
- 호스팅 환경에 대한 간단한 설명 (예: ○○24 리눅스 웹호스팅)
- RhymiX 버전 (예: 1.8.15)
- Rhymix 버전 (예: 1.8.15)
- PHP 버전 (예: 5.6.16)
- 브라우저 종류 및 버전 (예: IE 11)
- 에러가 발생하는 경우 에러 메시지 전체
@ -39,7 +39,7 @@
- 모든 소스 코드의 저작권은 해당 작성자가 가집니다.
- 모든 소스 코드에는 GPL v2 또는 그 이후 버전의 라이선스가 적용됩니다.
- RhymiX 개발팀을 비롯한 전세계 어느 누구라도 어떤 목적으로든지 자유롭게 사용, 수정, 재배포할 수 있습니다.
- Rhymix 개발팀을 비롯한 전세계 어느 누구라도 어떤 목적으로든지 자유롭게 사용, 수정, 재배포할 수 있습니다.
- 타인에게 저작권이 있는 코드를 가져온 경우, 원본의 라이선스를 GPL로 전환할 수 있어야 합니다.
- 한 번 적용한 라이선스는 철회할 수 없습니다.
- **풀 리퀘스트를 작성하실 경우 위의 두 가지에 동의하시는 것으로 간주합니다.**
@ -150,7 +150,7 @@ PHPDoc 주석 작성에 어려움이 있는 경우, 다른 클래스와 함수
### 기타
RhymiX에서 정한 `error_reporting` 설정 하에서 어떤 에러도 발생하지 않도록 하는 것을 목표로 합니다.
Rhymix에서 정한 `error_reporting` 설정 하에서 어떤 에러도 발생하지 않도록 하는 것을 목표로 합니다.
문자열과 문자열, 정수와 정수를 비교할 때는 가능하면 `==` 대신 `===`을 사용합니다.
실제 자료형이 다를 가능성이 있는 경우 `intval()`, `strval()` 등의 함수와 함께 사용합니다.

View file

@ -1,2 +1,2 @@
Copyright (c) RhymiX Developers and Contributors <devops@rhymix.org>
Copyright (c) Rhymix Developers and Contributors <devops@rhymix.org>
Copyright (c) NAVER <http://www.navercorp.com>

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

@ -1,19 +1,19 @@
[![RhymiX](https://cloud.githubusercontent.com/assets/8565457/12807700/92e90982-cb54-11e5-806f-df28792ed9a3.png)](https://www.rhymix.org)
[![Rhymix](https://cloud.githubusercontent.com/assets/8565457/12881857/7c3e69d6-ce90-11e5-94dc-8a592cf9ab7d.png)](https://www.rhymix.org)
RhymiX(라이믹스)는 누구든지 쉽고 자유롭게 독립적인 홈페이지를 만들어
Rhymix(라이믹스)는 누구든지 쉽고 자유롭게 독립적인 홈페이지를 만들어
자신을 표현하고 커뮤니티를 키워나갈 수 있도록 돕기 위한 CMS(content management system)입니다.
XETOWN 커뮤니티에서 [XE](https://www.xpressengine.com)를 fork(가지치기)하여 진행하는 프로젝트로,
누구나 무료로 사용할 수 있고 개발에 참여할 수도 있는 자유 소프트웨어(free software)입니다.
RhymiX는 "시를 짓다, 운을 맞추다"라는 의미의 "rhyme"과
Rhymix는 "시를 짓다, 운을 맞추다"라는 의미의 "rhyme"과
"조합하다, 변주하다"라는 의미의 "remix"를 합친 이름입니다.
라이믹스는 인터넷 공간에서 자유롭게 창작 활동을 하고
다양한 소프트웨어와 콘텐츠를 조합하여 새로운 것을 만들어내는 모든 사용자들을 응원합니다.
### 개발 방향
RhymiX는 개발자와 사용자가 서로의 권리와 책임을 존중하는 인터넷 생태계,
Rhymix는 개발자와 사용자가 서로의 권리와 책임을 존중하는 인터넷 생태계,
중앙집중형 SNS 플랫폼에 의존하지 않고도 누구나 내 목소리를 낼 수 있는 세상,
벤처기업이나 스타트업의 개발자들뿐 아니라 평범한 블로거, 동호회, 학생, 장애인 등도
사이버 공간에 당당하게 집을 짓고 서로 소통할 수 있는 미래를 만들어가길 원합니다.
@ -47,7 +47,7 @@ RhymiX는 개발자와 사용자가 서로의 권리와 책임을 존중하는
### 개발 참여
RhymiX는 개발자, 디자이너, 번역가 등의 도움과 일반 사용자들의 버그 신고를 환영합니다.
Rhymix는 개발자, 디자이너, 번역가 등의 도움과 일반 사용자들의 버그 신고를 환영합니다.
참여를 원하시는 분은 질서있고 효율적인 프로젝트 운영을 위해
[CONTRIBUTING.md](./CONTRIBUTING.md)를 먼저 읽어 주시기 바랍니다.
@ -57,28 +57,28 @@ devops@rhymix.org로 알려 주시면 감사하겠습니다.
### 공식 홈페이지
- XETOWN : https://www.xetown.com
- RhymiX : https://www.rhymix.org
- Rhymix : https://www.rhymix.org
### 저작권 및 라이선스
RhymiX는 [GNU GPL v2](http://korea.gnu.org/documents/copyleft/gpl.ko.html)
Rhymix는 [GNU GPL v2](http://korea.gnu.org/documents/copyleft/gpl.ko.html)
또는 그 이후 버전 라이선스의 적용을 받는 자유 소프트웨어(free software)입니다.
자유 소프트웨어는 "오픈소스" 또는 "개방형"이라는 명칭으로도 알려져 있으며,
개발자와 사용자의 자유와 권리, 참여와 책임을 강조하는 프로그램으로
누구나 무료로 사용할 수 있고 개발에 참여할 수도 있습니다.
RhymiX는 [NAVER](https://www.navercorp.com/)가 저작권을 가진
Rhymix는 [NAVER](https://www.navercorp.com/)가 저작권을 가진
[XpressEngine](https://www.xpressengine.com)의 소스코드에 바탕을 두고 있습니다.
RhymiX 개발자들이 추가 및 변경한 부분의 저작권은 해당 개발자들에게 있습니다.
Rhymix 개발자들이 추가 및 변경한 부분의 저작권은 해당 개발자들에게 있습니다.
XpressEngine은 초창기에 GPL을 사용하다가 버전 1.4.0부터 LGPL로 전환했지만,
RhymiX는 사용자의 권리를 더욱 보호하고 자유 소프트웨어 본연의 정신에 충실하기 위해 라이선스를 GPL로 되돌렸습니다.
Rhymix는 사용자의 권리를 더욱 보호하고 자유 소프트웨어 본연의 정신에 충실하기 위해 라이선스를 GPL로 되돌렸습니다.
(라이선스 전환은 [LGPL v2.1 제3조](http://korea.gnu.org/people/chsong/copyleft/lgpl.ko.html#term3)에서 허용하고 있습니다.)
GPL은 WordPress, Drupal, Joomla 등 세계적인 CMS들이 공통으로 채택하고 있는 라이선스이므로
사용자 및 개발자의 권리와 의무도 이러한 CMS들의 경우와 동일합니다.
홈페이지에 RhymiX를 사용하는 것만으로 소스코드를 공개할 의무가 발생하지는 않으며,
RhymiX의 소스코드를 수정하거나 확장 기능을 직접 개발하여 사용하더라도 마찬가지입니다.
홈페이지에 Rhymix를 사용하는 것만으로 소스코드를 공개할 의무가 발생하지는 않으며,
Rhymix의 소스코드를 수정하거나 확장 기능을 직접 개발하여 사용하더라도 마찬가지입니다.
그러나 직접 개발한 확장 기능을 제3자에게 배포 또는 판매할 경우에는 반드시 소스코드를 제공해야 하며,
이러한 소스코드는 모두 GPL 라이선스의 적용을 받습니다.

View file

@ -1,45 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">커뮤니케이션</title>
<title xml:lang="jp">コミュニケーション</title>
<title xml:lang="zh-CN">会员交流</title>
<title xml:lang="en">Communication</title>
<title xml:lang="vi">Truyền thông</title>
<title xml:lang="ge">커뮤니케이션</title>
<title xml:lang="es">커뮤니케이션</title>
<title xml:lang="ru">Общение</title>
<title xml:lang="zh-TW">交流</title>
<title xml:lang="ko">[DEPRECATED] 커뮤니케이션</title>
<title xml:lang="jp">[DEPRECATED] コミュニケーション</title>
<title xml:lang="zh-CN">[DEPRECATED] 会员交流</title>
<title xml:lang="en">[DEPRECATED] Communication</title>
<title xml:lang="vi">[DEPRECATED] Truyền thông</title>
<title xml:lang="ge">[DEPRECATED] Communication</title>
<title xml:lang="es">[DEPRECATED] Communication</title>
<title xml:lang="ru">[DEPRECATED] Общение</title>
<title xml:lang="zh-TW">[DEPRECATED] 交流</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">
讓會員擁有短訊和新增好友功能。
[DEPRECATED] 이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다.
</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>
</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

@ -59,4 +59,29 @@
<name xml:lang="ru">NAVER</name>
<name xml:lang="zh-TW">NAVER</name>
</author>
<extra_vars>
<var name="icon_duplication" type="select">
<title xml:lang="ko">아이콘 중복 설정</title>
<description xml:lang="ko">아이콘 중복 설정을 적용할 경우 그룹아이콘이 있을때 포인트 레벨 아이콘은 띄우지 않도록 합니다.</description>
<options value="">
<title xml:lang="ko">적용하지 않음</title>
<title xml:lang="zh-CN">不启用</title>
<title xml:lang="jp">적용하지 않음</title>
<title xml:lang="zh-TW">關閉</title>
<title xml:lang="en">Not apply</title>
<title xml:lang="ru">Not apply</title>
<title xml:lang="vi">Không áp dụng</title>
</options>
<options value="Y">
<title xml:lang="ko">적용</title>
<title xml:lang="zh-CN">启用</title>
<title xml:lang="jp">적용</title>
<title xml:lang="zh-TW">開啟</title>
<title xml:lang="en">Apply</title>
<title xml:lang="ru">Apply</title>
<title xml:lang="vi">Áp dụng</title>
</options>
</var>
</extra_vars>
</addon>

View file

@ -19,7 +19,9 @@ if($called_position != "before_display_content" || Context::get('act') == 'dispP
require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php');
$temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output);
$temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', function($matches) use($addon_info) {
return pointLevelIconTrans($matches, $addon_info);
}, $output);
if($temp_output)
{
$output = $temp_output;

View file

@ -4,7 +4,7 @@
/**
* @brief Function to change point icon.
*/
function pointLevelIconTrans($matches)
function pointLevelIconTrans($matches, $addon_info)
{
$member_srl = $matches[3];
// If anonymous or not member_srl go to Hide Point Icon
@ -15,12 +15,14 @@ function pointLevelIconTrans($matches)
$orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]);
$oMemberModel = getModel('member');
// Check Group Image Mark
if($oMemberModel->getGroupImageMark($member_srl))
if($addon_info->icon_duplication != 'Y')
{
return $orig_text . $matches[5] . '</' . $matches[6] . '>';
// Check Group Image Mark
$oMemberModel = getModel('member');
if($oMemberModel->getGroupImageMark($member_srl))
{
return $orig_text . $matches[5] . '</' . $matches[6] . '>';
}
}
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl]))

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

@ -9,7 +9,6 @@
*/
class Context
{
/**
* Allow rewrite
* @var bool TRUE: using rewrite mod, FALSE: otherwise
@ -209,7 +208,7 @@ class Context
*/
public function init()
{
// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
// Fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above.
if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
{
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
@ -220,17 +219,14 @@ class Context
unset($GLOBALS['HTTP_RAW_POST_DATA']);
}
}
// set context variables in $GLOBALS (backward compatibility)
// Set global variables for backward compatibility.
$GLOBALS['__Context__'] = $this;
$GLOBALS['lang'] = &$this->lang;
$this->_COOKIE = $_COOKIE;
// 20140429 editor/image_link
// Set information about the current request.
$this->setRequestMethod();
$this->_checkGlobalVars();
$this->setRequestMethod('');
$this->_setXmlRpcArgument();
$this->_setJSONRequestArgument();
$this->_setRequestArgument();
@ -241,77 +237,37 @@ class Context
self::$_instance->request_method = 'XMLRPC';
self::$_instance->response_method = 'JSON';
}
// Load system configuration.
$this->loadDBInfo();
if($this->db_info->use_sitelock == 'Y')
{
if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
if(!IpFilter::filter($whitelist))
{
$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
$message = $this->db_info->sitelock_message;
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', $title);
define('_XE_SITELOCK_MESSAGE_', $message);
header("HTTP/1.1 403 Forbidden");
if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
{
include _XE_PATH_ . 'common/tpl/sitelock.user.html';
}
else
{
include _XE_PATH_ . 'common/tpl/sitelock.html';
}
exit;
}
}
// If XE is installed, get virtual site information
// If Rhymix is installed, get virtual site information.
if(self::isInstalled())
{
$oModuleModel = getModel('module');
$site_module_info = $oModuleModel->getDefaultMid();
if(!isset($site_module_info))
{
$site_module_info = new stdClass;
}
$site_module_info = $oModuleModel->getDefaultMid() ?: new stdClass;
// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
{
$site_module_info->domain = $this->db_info->default_url;
}
self::set('site_module_info', $site_module_info);
if($site_module_info->site_srl && isSiteID($site_module_info->domain))
{
self::set('vid', $site_module_info->domain, TRUE);
}
if(!isset($this->db_info))
{
$this->db_info = new stdClass;
}
$this->db_info->lang_type = $site_module_info->default_language;
if(!$this->db_info->lang_type)
{
$this->db_info->lang_type = 'ko';
}
if(!$this->db_info->use_db_session)
{
$this->db_info->use_db_session = 'N';
}
}
else
{
$site_module_info = new stdClass;
}
// Load Language File
$lang_supported = self::loadLangSelected();
// Retrieve language type set in user's cookie
// Load language support.
$enabled_langs = self::loadLangSelected();
self::set('lang_supported', $enabled_langs);
if($this->lang_type = self::get('l'))
{
if($_COOKIE['lang_type'] != $this->lang_type)
@ -323,33 +279,29 @@ class Context
{
$this->lang_type = $_COOKIE['lang_type'];
}
// If it's not exists, follow default language type set in db_info
if(!$this->lang_type)
elseif($site_module_info->default_language)
{
$this->lang_type = $this->db_info->lang_type = $site_module_info->default_language;
}
else
{
$this->lang_type = $this->db_info->lang_type;
}
// if still lang_type has not been set or has not-supported type , set as Korean.
if(!$this->lang_type)
{
$this->lang_type = 'ko';
}
if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
if(!$this->lang_type || !isset($enabled_langs[$this->lang_type]))
{
$this->lang_type = 'ko';
}
self::set('lang_supported', $lang_supported);
self::setLangType($this->lang_type);
// Load languages
$this->lang = Rhymix\Framework\Lang::getInstance($this->lang_type);
$this->lang->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
$this->lang->loadDirectory(RX_BASEDIR . 'modules/module/lang', 'module');
$GLOBALS['lang'] = $this->lang;
// set session handler
if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
if(self::isInstalled() && config('session.use_db'))
{
$oSessionModel = getModel('session');
$oSessionController = getController('session');
@ -370,19 +322,19 @@ class Context
$session_id = $_COOKIE[$session_name];
}
if($session_id !== NULL || $this->db_info->delay_session != 'Y')
if($session_id !== NULL || !config('session.delay'))
{
$this->setCacheControl(0, false);
session_start();
}
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())
{
@ -412,57 +364,31 @@ class Context
}
}
}
// check if using rewrite module
$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
// set locations for javascript use
$url = array();
$current_url = self::getRequestUri();
if($_SERVER['REQUEST_METHOD'] == 'GET')
$current_url = $request_uri = self::getRequestUri();
if ($_SERVER['REQUEST_METHOD'] == 'GET' && $this->get_vars)
{
if($this->get_vars)
if ($query_string = http_build_query($this->get_vars))
{
$url = array();
foreach($this->get_vars as $key => $val)
{
if(is_array($val) && count($val) > 0)
{
foreach($val as $k => $v)
{
$url[] = $key . '[' . $k . ']=' . urlencode($v);
}
}
elseif($val)
{
$url[] = $key . '=' . urlencode($val);
}
}
$current_url = self::getRequestUri();
if($url) $current_url .= '?' . join('&', $url);
}
else
{
$current_url = self::getUrl();
$current_url .= '?' . $query_string;
}
}
else
if (strpos($current_url, 'xn--') !== false)
{
$current_url = self::getRequestUri();
$current_url = self::decodeIdna($current_url);
}
if (strpos($request_uri, 'xn--') !== false)
{
$request_uri = self::decodeIdna($request_uri);
}
self::set('current_url', $current_url);
self::set('request_uri', self::getRequestUri());
if(strpos($current_url, 'xn--') !== FALSE)
self::set('request_uri', $request_uri);
// If the site is locked, display the locked page.
if(config('lock.locked'))
{
self::set('current_url', self::decodeIdna($current_url));
}
if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
{
self::set('request_uri', self::decodeIdna(self::getRequestUri()));
self::enforceSiteLock();
}
}
@ -485,7 +411,7 @@ class Context
{
if(self::getSessionStatus())
{
return;
return true;
}
if($force_start || (count($_SESSION) && !headers_sent()))
{
@ -493,7 +419,9 @@ class Context
unset($_SESSION);
session_start();
$_SESSION = $tempSession;
return true;
}
return false;
}
/**
@ -503,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();
}
}
/**
@ -535,81 +467,109 @@ class Context
*
* @return void
*/
public static function loadDBInfo()
public static function loadDBInfo($config = null)
{
if(!self::isInstalled())
// Load new configuration format.
if ($config === null)
{
$config = Rhymix\Framework\Config::getAll();
}
if (!count($config))
{
self::$_instance->db_info = self::$_instance->db_info ?: new stdClass;
return;
}
$config_file = self::getConfigFile();
if(is_readable($config_file))
{
include($config_file);
}
// Copy to old format for backward compatibility.
self::$_instance->db_info = self::convertDBInfo($config);
self::$_instance->allow_rewrite = self::$_instance->db_info->use_rewrite;
self::set('_http_port', self::$_instance->db_info->http_port ?: null);
self::set('_https_port', self::$_instance->db_info->https_port ?: null);
self::set('_use_ssl', self::$_instance->db_info->use_ssl);
$GLOBALS['_time_zone'] = self::$_instance->db_info->time_zone;
}
// If master_db information does not exist, the config file needs to be updated
if(!isset($db_info->master_db))
/**
* Convert Rhymix configuration to XE DBInfo format
*
* @param array $config
* @return object
*/
public static function convertDBInfo($config)
{
$db_info = new stdClass;
$db_info->master_db = array(
'db_type' => $config['db']['master']['type'] . ($config['db']['master']['engine'] === 'innodb' ? '_innodb' : ''),
'db_hostname' => $config['db']['master']['host'],
'db_port' => $config['db']['master']['port'],
'db_userid' => $config['db']['master']['user'],
'db_password' => $config['db']['master']['pass'],
'db_database' => $config['db']['master']['database'],
'db_table_prefix' => $config['db']['master']['prefix'],
'db_charset' => $config['db']['master']['charset'],
);
$db_info->slave_db = array();
foreach ($config['db'] as $key => $dbconfig)
{
$db_info->master_db = array();
$db_info->master_db["db_type"] = $db_info->db_type;
unset($db_info->db_type);
$db_info->master_db["db_port"] = $db_info->db_port;
unset($db_info->db_port);
$db_info->master_db["db_hostname"] = $db_info->db_hostname;
unset($db_info->db_hostname);
$db_info->master_db["db_password"] = $db_info->db_password;
unset($db_info->db_password);
$db_info->master_db["db_database"] = $db_info->db_database;
unset($db_info->db_database);
$db_info->master_db["db_userid"] = $db_info->db_userid;
unset($db_info->db_userid);
$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
unset($db_info->db_table_prefix);
if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
if ($key !== 'master')
{
$db_info->master_db["db_table_prefix"] .= '_';
$db_info->slave_db[] = array(
'db_type' => $dbconfig['type'] . ($dbconfig['engine'] === 'innodb' ? '_innodb' : ''),
'db_hostname' => $dbconfig['host'],
'db_port' => $dbconfig['port'],
'db_userid' => $dbconfig['user'],
'db_password' => $dbconfig['pass'],
'db_database' => $dbconfig['database'],
'db_table_prefix' => $dbconfig['prefix'],
'db_charset' => $dbconfig['charset'],
);
}
$db_info->slave_db = array($db_info->master_db);
self::setDBInfo($db_info);
$oInstallController = getController('install');
$oInstallController->makeConfigFile();
}
if(!$db_info->use_prepared_statements)
if (!count($db_info->slave_db))
{
$db_info->use_prepared_statements = 'Y';
$db_info->slave_db = array($db_info->master_db);
}
if(!$db_info->time_zone)
$db_info->time_zone = date('O');
$GLOBALS['_time_zone'] = $db_info->time_zone;
$GLOBALS['_time_zone_offset'] = get_time_zone_offset($db_info->time_zone);
if($db_info->qmail_compatibility != 'Y')
$db_info->qmail_compatibility = 'N';
$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
if(!$db_info->use_db_session)
$db_info->use_db_session = 'N';
if(!$db_info->use_ssl)
$db_info->use_ssl = 'none';
self::set('_use_ssl', $db_info->use_ssl);
self::set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
self::set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
if(!$db_info->sitelock_whitelist) {
$db_info->sitelock_whitelist = '127.0.0.1';
$db_info->use_object_cache = count($config['cache']) ? array_first($config['cache']) : null;
$db_info->ftp_info = new stdClass;
$db_info->ftp_info->ftp_host = $config['ftp']['host'];
$db_info->ftp_info->ftp_port = $config['ftp']['port'];
$db_info->ftp_info->ftp_user = $config['ftp']['user'];
$db_info->ftp_info->ftp_pasv = $config['ftp']['pasv'] ? 'Y' : 'N';
$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;
}
if(is_string($db_info->sitelock_whitelist)) {
$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
$db_info->http_port = $config['url']['http_port'];
$db_info->https_port = $config['url']['https_port'];
$db_info->use_ssl = $config['url']['ssl'];
$db_info->lang_type = $config['locale']['default_lang'];
$db_info->time_zone = $config['locale']['internal_timezone'];
$db_info->time_zone = sprintf('%s%02d%02d', $db_info->time_zone >= 0 ? '+' : '-', abs($db_info->time_zone) / 3600, (abs($db_info->time_zone) % 3600 / 60));
$db_info->delay_session = $config['session']['delay'] ? 'Y' : 'N';
$db_info->use_db_session = $config['session']['use_db'] ? 'Y' : 'N';
$db_info->minify_scripts = $config['view']['minify_scripts'] ? 'Y' : 'N';
$db_info->admin_ip_list = count($config['admin']['allow']) ? $config['admin']['allow'] : null;
$db_info->use_sitelock = $config['lock']['locked'] ? 'Y' : 'N';
$db_info->sitelock_title = $config['lock']['title'];
$db_info->sitelock_message = $config['lock']['message'];
$db_info->sitelock_whitelist = count($config['lock']['allow']) ? $config['lock']['allow'] : array('127.0.0.1');
$db_info->embed_white_iframe = $config['embedfilter']['iframe'];
$db_info->embed_white_object = $config['embedfilter']['object'];
$db_info->use_mobile_view = $config['use_mobile_view'] ? 'Y' : 'N';
$db_info->use_prepared_statements = $config['use_prepared_statements'] ? 'Y' : 'N';
$db_info->use_rewrite = $config['use_rewrite'] ? 'Y' : 'N';
$db_info->use_sso = $config['use_sso'] ? 'Y' : 'N';
if (is_array($config['other']))
{
foreach ($config['other'] as $key => $value)
{
$db_info->{$key} = $value;
}
}
self::setDBInfo($db_info);
return $db_info;
}
/**
@ -650,7 +610,7 @@ class Context
*/
public static function getSslStatus()
{
return self::getDBInfo()->use_ssl;
return self::get('_use_ssl');
}
/**
@ -660,7 +620,7 @@ class Context
*/
public static function getDefaultUrl()
{
return self::getDBInfo()->default_url;
return self::$_instance->db_info->default_url;
}
/**
@ -680,39 +640,21 @@ class Context
*/
public static function loadLangSelected()
{
static $lang_selected = null;
if(!$lang_selected)
static $lang_selected = array();
if(!count($lang_selected))
{
$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
if(!FileHandler::hasContent($selected_lang_file))
$supported = Rhymix\Framework\Lang::getSupportedList();
$selected = Rhymix\Framework\Config::get('locale.enabled_lang');
if ($selected)
{
$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
}
if(!FileHandler::hasContent($selected_lang_file))
{
$lang_selected = Rhymix\Framework\Lang::getSupportedList();
$buff = '';
foreach($lang_selected as $key => $val)
foreach ($selected as $lang)
{
$buff .= "$key,$val\n";
$lang_selected[$lang] = $supported[$lang];
}
FileHandler::writeFile($selected_lang_file, $buff);
}
else
{
$langs = file($selected_lang_file);
foreach($langs as $val)
{
list($lang_prefix, $lang_text) = explode(',', $val);
if($lang_prefix === 'jp')
{
$lang_prefix = 'ja';
}
$lang_text = trim($lang_text);
$lang_selected[$lang_prefix] = $lang_text;
}
$lang_selected = $supported;
}
}
return $lang_selected;
@ -726,7 +668,7 @@ class Context
public function checkSSO()
{
// pass if it's not GET request or XE is not yet installed
if($this->db_info->use_sso != 'Y' || isCrawler())
if(!config('use_sso') || isCrawler())
{
return TRUE;
}
@ -820,7 +762,8 @@ class Context
*/
public static function isFTPRegisted()
{
return file_exists(self::getFTPConfigFile());
$ftp_info = self::$_instance->db_info->ftp_info;
return ($ftp_info->ftp_user && $ftp_info->ftp_root_path);
}
/**
@ -830,11 +773,11 @@ class Context
*/
public static function getFTPInfo()
{
if(!self::isFTPRegisted())
$ftp_info = self::$_instance->db_info->ftp_info;
if (!$ftp_info->ftp_user || !$ftp_info->ftp_root_path)
{
return null;
}
include(self::getFTPConfigFile());
return $ftp_info;
}
@ -929,7 +872,14 @@ class Context
{
$plugin_name = null;
}
return self::$_instance->lang->loadDirectory($path, $plugin_name);
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
}
return $GLOBALS['lang']->loadDirectory($path, $plugin_name);
}
/**
@ -940,6 +890,11 @@ class Context
*/
public static function setLangType($lang_type = 'ko')
{
if (!self::$_instance->db_info)
{
self::$_instance->db_info = new stdClass;
}
self::$_instance->db_info->lang_type = $lang_type;
self::$_instance->lang_type = $lang_type;
self::set('lang_type', $lang_type);
@ -967,8 +922,13 @@ class Context
*/
public static function getLang($code)
{
$lang = self::$_instance->lang;
return isset($lang->{$code}) ? $lang->{$code} : $code;
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
}
return $GLOBALS['lang']->get($code);
}
/**
@ -980,7 +940,13 @@ class Context
*/
public static function setLang($code, $val)
{
self::$_instance->lang->{$code} = $val;
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(self::$_instance->lang_type ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
}
$GLOBALS['lang']->set($code, $val);
}
/**
@ -1216,7 +1182,7 @@ class Context
{
continue;
}
$key = htmlentities($key);
$key = escape($key);
$val = $this->_filterRequestVar($key, $val);
if($requestMethod == 'GET' && isset($_GET[$key]))
@ -1392,7 +1358,7 @@ class Context
$result = array();
foreach($val as $k => $v)
{
$k = htmlentities($k);
$k = escape($k);
if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
{
$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
@ -1411,10 +1377,21 @@ class Context
if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
{
$result[$k] = stripslashes($result[$k]);
if (is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
}
else
{
$result[$k] = stripslashes($result[$k]);
}
}
if(!is_array($result[$k]))
if(is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
}
else
{
$result[$k] = trim($result[$k]);
}
@ -1478,6 +1455,79 @@ class Context
}
}
/**
* Enforce site lock.
*/
private static function enforceSiteLock()
{
// Allow if the current user is logged in as administrator, or trying to log in.
$logged_info = self::get('logged_info');
if ($logged_info && $logged_info->is_admin === 'Y')
{
return;
}
elseif (in_array(self::get('act'), array('procMemberLogin', 'dispMemberLogout')))
{
return;
}
// Allow if the current user is in the list of allowed IPs.
$allowed_list = config('lock.allow');
foreach ($allowed_list as $allowed_ip)
{
if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $allowed_ip))
{
return;
}
}
// Set headers and constants for backward compatibility.
header('HTTP/1.1 503 Service Unavailable');
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', config('lock.title') ?: self::getLang('admin.sitelock_in_use'));
define('_XE_SITELOCK_MESSAGE_', config('lock.message'));
unset($_SESSION['XE_VALIDATOR_RETURN_URL']);
// Load the sitelock template.
if(FileHandler::exists(RX_BASEDIR . 'common/tpl/sitelock.user.html'))
{
include RX_BASEDIR . 'common/tpl/sitelock.user.html';
}
else
{
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)
@ -1845,7 +1895,7 @@ class Context
self::$_user_vars->{$key} = $val;
self::$_instance->{$key} = $val;
if($set_to_get_vars)
if($set_to_get_vars || isset(self::$_instance->get_vars->{$key}))
{
if($val === NULL || $val === '')
{
@ -2003,6 +2053,10 @@ class Context
{
return self::$_instance->ssl_actions;
}
else
{
return array();
}
}
/**
@ -2468,7 +2522,7 @@ class Context
*/
public static function getConfigFile()
{
return _XE_PATH_ . 'files/config/db.config.php';
return RX_BASEDIR . Rhymix\Framework\Config::$old_db_config_filename;
}
/**
@ -2478,7 +2532,7 @@ class Context
*/
public static function getFTPConfigFile()
{
return _XE_PATH_ . 'files/config/ftp.config.php';
return RX_BASEDIR . Rhymix\Framework\Config::$old_ftp_config_filename;
}
/**
@ -2488,7 +2542,7 @@ class Context
*/
public static function isInstalled()
{
return FileHandler::hasContent(self::getConfigFile());
return (bool)config('config_version');
}
/**
@ -2509,7 +2563,7 @@ class Context
*/
public static function isAllowRewrite()
{
return self::getInstance()->allow_rewrite;
return self::$_instance->allow_rewrite;
}
/**

View file

@ -22,26 +22,18 @@ class DB
* priority of DBMS
* @var array
*/
var $priority_dbms = array(
protected static $priority_dbms = array(
'mysqli' => 6,
'mysqli_innodb' => 5,
'mysql' => 4,
'mysql_innodb' => 3,
'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' => '>',
@ -56,94 +48,98 @@ 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
* @param string $db_type type of db
* @return DB return DB object instance
*/
function &getInstance($db_type = NULL)
public static function getInstance($db_type = NULL)
{
if(!$db_type)
{
$db_type = Context::getDBType();
$db_type = config('db.master.type');
if (config('db.master.engine') === 'innodb')
{
$db_type .= '_innodb';
}
}
if(!$db_type && Context::isInstalled())
{
@ -157,7 +153,7 @@ class DB
if(!isset($GLOBALS['__DB__'][$db_type]))
{
$class_name = 'DB' . ucfirst($db_type);
$class_file = _XE_PATH_ . "classes/db/$class_name.class.php";
$class_file = RX_BASEDIR . "classes/db/$class_name.class.php";
if(!file_exists($class_file))
{
return new Object(-1, 'msg_db_not_setted');
@ -165,7 +161,7 @@ class DB
// get a singletone instance of the database driver class
require_once($class_file);
$GLOBALS['__DB__'][$db_type] = call_user_func(array($class_name, 'create'));
$GLOBALS['__DB__'][$db_type] = new $class_name;
$GLOBALS['__DB__'][$db_type]->db_type = $db_type;
}
@ -176,7 +172,7 @@ class DB
* returns instance of db
* @return DB return DB object instance
*/
function create()
public static function create()
{
return new static();
}
@ -185,9 +181,8 @@ class DB
* constructor
* @return void
*/
function __construct()
public function __construct()
{
$this->count_cache_path = _XE_PATH_ . $this->count_cache_path;
$this->cache_file = _XE_PATH_ . $this->cache_file;
}
@ -197,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();
}
/**
@ -208,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)
{
@ -237,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)
{
@ -263,86 +253,50 @@ 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";
$supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE);
// after creating instance of class, check is supported
for($i = 0; $i < count($supported_list); $i++)
foreach ($supported_list as $db_type)
{
$db_type = $supported_list[$i];
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
$class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name);
if(!file_exists($class_file))
if(!file_exists($class_file) || stripos($class_file, '_innodb') !== false)
{
continue;
}
unset($oDB);
require_once($class_file);
$oDB = new $class_name();
if(!$oDB)
{
continue;
}
$obj = new stdClass;
$obj->db_type = $db_type;
$obj->enable = $oDB->isSupported() ? TRUE : FALSE;
unset($oDB);
$get_supported_list[] = $obj;
}
// 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;
}
/**
@ -350,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;
}
@ -361,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')
{
@ -378,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;
@ -390,7 +344,7 @@ class DB
* finish recording log
* @return void
*/
function actFinish()
public function actFinish()
{
if(!$this->query)
{
@ -410,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);
}
/**
@ -466,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);
}
/**
@ -477,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;
@ -487,7 +433,7 @@ class DB
* Return error status
* @return boolean true: error, false: no error
*/
function isError()
public function isError()
{
return ($this->errno !== 0);
}
@ -496,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);
@ -510,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();
@ -577,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);
@ -606,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;
@ -624,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;
}
@ -657,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();
}
@ -673,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;
*/
}
/**
@ -733,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);
*/
}
/**
@ -771,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;
*/
}
/**
@ -801,7 +651,7 @@ class DB
* @param string $table_name
* @return void
*/
function dropTable($table_name)
public function dropTable($table_name)
{
if(!$table_name)
{
@ -817,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 == '')
@ -886,7 +736,7 @@ class DB
*
* @param $queryObject
*/
function getClickCountQuery($queryObject)
public function getClickCountQuery($queryObject)
{
$new_update_columns = array();
$click_count_columns = $queryObject->getClickCountColumns();
@ -912,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 ';
@ -944,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 == '')
@ -976,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);
@ -989,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);
@ -1002,15 +852,15 @@ 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')
if($type == 'master' || $this->transactionNestedLevel)
{
if(!$this->master_db['is_connected'])
{
$this->_connect($type);
}
$this->connection = 'Master ' . $this->master_db['db_hostname'];
$this->connection = 'master (' . $this->master_db['host'] . ')';
return $this->master_db["resource"];
}
@ -1019,12 +869,21 @@ class DB
$indx = $this->_getSlaveConnectionStringIndex($type);
}
if($this->slave_db[$indx]['host'] == $this->master_db['host'] && $this->slave_db[$indx]['port'] == $this->master_db['port'])
{
if(!$this->master_db['is_connected'])
{
$this->_connect($type);
}
$this->connection = 'master (' . $this->master_db['host'] . ')';
return $this->master_db["resource"];
}
if(!$this->slave_db[$indx]['is_connected'])
{
$this->_connect($type, $indx);
}
$this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname'];
$this->connection = 'slave (' . $this->slave_db[$indx]['host'] . ')';
return $this->slave_db[$indx]["resource"];
}
@ -1032,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)
{
}
@ -1062,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))
{
@ -1089,7 +940,7 @@ class DB
* this method is protected
* @return boolean
*/
function _begin($transactionLevel = 0)
protected function _begin($transactionLevel = 0)
{
return TRUE;
}
@ -1098,7 +949,7 @@ class DB
* DB transaction start
* @return void
*/
function begin()
public function begin()
{
if(!$this->isConnected())
{
@ -1117,7 +968,7 @@ class DB
* this method is protected
* @return boolean
*/
function _rollback($transactionLevel = 0)
protected function _rollback($transactionLevel = 0)
{
return TRUE;
}
@ -1126,7 +977,7 @@ class DB
* DB transaction rollback
* @return void
*/
function rollback()
public function rollback()
{
if(!$this->isConnected() || !$this->transaction_started)
{
@ -1148,7 +999,7 @@ class DB
* this method is protected
* @return boolean
*/
function _commit()
protected function _commit()
{
return TRUE;
}
@ -1158,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))
{
@ -1182,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)
{
@ -1217,25 +1068,13 @@ class DB
* this method is protected
* @return void
*/
function _setDBInfo()
protected function _setDBInfo()
{
$db_info = Context::getDBInfo();
$this->master_db = $db_info->master_db;
if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"]
&& $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"]
&& $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"]
&& $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"]
&& $db_info->master_db["db_database"] == $db_info->slave_db[0]["db_database"]
)
{
$this->slave_db[0] = &$this->master_db;
}
else
{
$this->slave_db = $db_info->slave_db;
}
$this->prefix = $db_info->master_db["db_table_prefix"];
$this->use_prepared_statements = $db_info->use_prepared_statements;
$db_info = config('db');
$this->master_db = $db_info['master'];
$this->slave_db = $db_info ? array_values($db_info) : null;
$this->prefix = $this->master_db['prefix'];
$this->use_prepared_statements = config('use_prepared_statements');
}
/**
@ -1244,7 +1083,7 @@ class DB
* @param array $connection
* @return void
*/
function __connect($connection)
protected function __connect($connection)
{
}
@ -1255,7 +1094,7 @@ class DB
* @param resource $connection
* @return void
*/
function _afterConnect($connection)
protected function _afterConnect($connection)
{
}
@ -1267,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))
{
@ -1288,7 +1127,7 @@ class DB
{
$connection = &$this->slave_db[$indx];
}
$result = $this->__connect($connection);
if($result === NULL || $result === FALSE)
{
@ -1301,7 +1140,7 @@ class DB
$connection["is_connected"] = TRUE;
// Save connection info for db logs
$this->connection = ucfirst($type) . ' ' . $connection["db_hostname"];
$this->connection = $type . ' (' . $connection['host'] . ')';
// regist $this->close callback
register_shutdown_function(array($this, "close"));
@ -1313,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);
@ -1324,7 +1163,7 @@ class DB
* Finish recording DBClass log
* @return void
*/
function actDBClassFinish()
public function actDBClassFinish()
{
if(!$this->query)
{
@ -1346,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

@ -55,15 +55,6 @@ class DBCubrid extends DB
$this->_connect();
}
/**
* Create an instance of this class
* @return DBCubrid return DBCubrid object instance
*/
function create()
{
return new DBCubrid;
}
/**
* DB Connect
* this method is private
@ -73,7 +64,7 @@ class DBCubrid extends DB
function __connect($connection)
{
// attempts to connect
$result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]);
$result = @cubrid_connect($connection['host'], $connection['port'], $connection['database'], $connection['user'], $connection['pass']);
// check connections
if(!$result)
@ -116,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))
{
/*
@ -986,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)
{
@ -1017,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)
@ -1049,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)
@ -1092,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())
@ -1162,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);
@ -1210,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

@ -48,15 +48,6 @@ class DBMssql extends DB
$this->_connect();
}
/**
* Create an instance of this class
* @return DBMssql return DBMssql object instance
*/
function create()
{
return new DBMssql;
}
/**
* DB Connect
* this method is private
@ -68,7 +59,11 @@ class DBMssql extends DB
//sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
//sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
//sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
$result = @sqlsrv_connect($connection["db_hostname"], array('Database' => $connection["db_database"], 'UID' => $connection["db_userid"], 'PWD' => $connection["db_password"]));
$result = @sqlsrv_connect($connection['host'], array(
'Database' => $connection['database'],
'UID' => $connection['user'],
'PWD' => $connection['pass'],
));
if(!$result)
{
@ -99,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;
@ -952,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())
@ -1033,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

@ -58,13 +58,13 @@ class DBMysql extends DB
function __connect($connection)
{
// Ignore if no DB information exists
if(strpos($connection["db_hostname"], ':') === false && $connection["db_port"])
if(strpos($connection['host'], ':') === false && $connection['port'])
{
$connection["db_hostname"] .= ':' . $connection["db_port"];
$connection['host'] .= ':' . $connection['port'];
}
// Attempt to connect
$result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]);
$result = @mysql_connect($connection['host'], $connection['user'], $connection['pass']);
if(!$result)
{
exit('Unable to connect to DB.');
@ -79,16 +79,16 @@ class DBMysql extends DB
// Error appears if the version is lower than 4.1.13
if(version_compare(mysql_get_server_info($result), '4.1.13', '<'))
{
$this->setError(-1, 'RhymiX requires MySQL 4.1.13 or later. Current MySQL version is ' . mysql_get_server_info());
$this->setError(-1, 'Rhymix requires MySQL 4.1.13 or later. Current MySQL version is ' . mysql_get_server_info());
return;
}
// Set charset
$this->charset = isset($connection["db_charset"]) ? $connection["db_charset"] : 'utf8';
$this->charset = isset($connection['charset']) ? $connection['charset'] : 'utf8';
mysql_set_charset($this->charset, $result);
// select db
@mysql_select_db($connection["db_database"], $result);
@mysql_select_db($connection['database'], $result);
if(mysql_error())
{
$this->setError(mysql_errno(), mysql_error());
@ -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

@ -24,20 +24,13 @@ class DBMysqli extends DBMysql
function __connect($connection)
{
// Attempt to connect
if($connection["db_port"])
if($connection['port'])
{
$result = @mysqli_connect($connection["db_hostname"]
, $connection["db_userid"]
, $connection["db_password"]
, $connection["db_database"]
, $connection["db_port"]);
$result = @mysqli_connect($connection['host'], $connection['user'], $connection['pass'], $connection['database'], $connection['port']);
}
else
{
$result = @mysqli_connect($connection["db_hostname"]
, $connection["db_userid"]
, $connection["db_password"]
, $connection["db_database"]);
$result = @mysqli_connect($connection['host'], $connection['user'], $connection['pass'], $connection['database']);
}
$error = mysqli_connect_errno();
if($error)
@ -45,7 +38,7 @@ class DBMysqli extends DBMysql
$this->setError($error, mysqli_connect_error());
return;
}
$this->charset = isset($connection["db_charset"]) ? $connection["db_charset"] : 'utf8';
$this->charset = isset($connection['charset']) ? $connection['charset'] : 'utf8';
mysqli_set_charset($result, $this->charset);
return $result;
}
@ -68,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');
@ -89,6 +78,11 @@ class DBMysqli extends DBMysql
*/
function __query($query, $connection)
{
if ($connection === null)
{
debug_print_backtrace();
exit;
}
if($this->use_prepared_statements == 'Y')
{
// 1. Prepare query

View file

@ -49,8 +49,7 @@ class CubridTableWithHint extends Table
$result = '';
// Retrieve table prefix, to add it to index name
$db_info = Context::getDBInfo();
$prefix = $db_info->master_db["db_table_prefix"];
$prefix = config('db.master.prefix');
foreach($this->index_hints_list as $index_hint)
{

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;
@ -25,12 +25,7 @@ class DisplayHandler extends Handler
public function printContent(&$oModule)
{
// Check if the gzip encoding supported
if(
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE &&
extension_loaded('zlib') &&
$oModule->gzhandler_enable
)
if(config('view.use_gzip') && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && extension_loaded('zlib') && $oModule->gzhandler_enable)
{
$this->gz_enabled = TRUE;
}
@ -65,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"))
{
@ -78,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)
{
@ -107,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;
@ -119,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);
@ -235,17 +223,17 @@ class HTMLDisplayHandler
// convert the final layout
Context::set('content', $output);
Context::set('m', $is_mobile = Mobile::isFromMobilePhone() ? 1 : 0);
$oTemplate = TemplateHandler::getInstance();
if(Mobile::isFromMobilePhone())
if($is_mobile)
{
$this->_loadMobileJSCSS();
$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
}
else
{
$this->_loadDesktopJSCSS();
$output = $oTemplate->compile('./common/tpl', 'common_layout');
}
$output = $oTemplate->compile('./common/tpl', 'common_layout');
// replace the user-defined-language
$oModuleController = getController('module');
@ -433,7 +421,7 @@ class HTMLDisplayHandler
$original_file_list = array('x', 'common', 'js_app', 'xml_handler', 'xml_js_filter');
$jquery_version = preg_match('/MSIE [5-8]\./', $_SERVER['HTTP_USER_AGENT']) ? '1.11.3' : '2.1.4';
if(Context::getDBInfo()->minify_scripts === 'none')
if(config('view.minify_scripts') === 'none')
{
Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.js', 'head', '', -1730000), true);
Context::loadFile(array('./common/js/plugins/jquery.migrate/jquery-migrate-1.2.1.js', 'head', '', -1720000), true);

View file

@ -224,6 +224,10 @@ class ExtraItem
{
$values = explode(',', $value);
}
else
{
$values = array($value);
}
$values = array_values($values);
for($i = 0, $c = count($values); $i < $c; $i++)

View file

@ -152,7 +152,7 @@ class FrontEndFileHandler extends Handler
if(self::$minify === null)
{
self::$minify = Context::getDBInfo()->minify_scripts ?: 'common';
self::$minify = config('view.minify_scripts') ?: 'common';
}
if(isset($existsInfo[$existsKey]))

View file

@ -3,11 +3,6 @@
/**
* Mail class
*
* This class was originally written for the Advanced Mailer module.
* Advanced Mailer is licensed under GPLv2, but the author hereby relicenses
* this class under the same license as the remainder of RhymiX.
* All other parts of the Advanced Mailer module remain under GPLv2.
*
* @author Kijin Sung <kijin@kijinsung.com>
*/
class Mail

View file

@ -50,9 +50,9 @@ class Mobile
{
return $this->ismobile;
}
if(Mobile::isMobileEnabled() === false || Context::get('full_browse') || $_COOKIE["FullBrowse"])
if(!config('use_mobile_view') || Context::get('full_browse') || $_COOKIE["FullBrowse"])
{
return ($this->ismobile = false);
return $this->ismobile = false;
}
$xe_web_path = Context::pathToUrl(_XE_PATH_);
@ -231,6 +231,6 @@ class Mobile
public static function isMobileEnabled()
{
return (Context::getDBInfo()->use_mobile_view === 'Y');
return config('use_mobile_view');
}
}

View file

@ -132,17 +132,23 @@ class ModuleHandler extends Handler
{
continue;
}
$urlInfo = parse_url($url);
$host = $urlInfo['host'];
$dbInfo = Context::getDBInfo();
$defaultUrlInfo = parse_url($dbInfo->default_url);
$defaultHost = $defaultUrlInfo['host'];
if($host && ($host != $defaultHost && $host != $site_module_info->domain))
if($host = parse_url($url, PHP_URL_HOST))
{
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);
}
}
}
}
@ -233,17 +239,9 @@ class ModuleHandler extends Handler
}
else
{
$db_info = Context::getDBInfo();
if(!$db_info->default_url)
{
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);
header("Location: $redirect_url");
return FALSE;
}
@ -430,18 +428,6 @@ class ModuleHandler extends Handler
$logged_info = Context::get('logged_info');
// Admin ip
if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
{
self::_setInputErrorToContext();
$this->error = "msg_not_permitted_act";
$oMessageObject = self::getModuleInstance('message', $display_mode);
$oMessageObject->setError(-1);
$oMessageObject->setMessage($this->error);
$oMessageObject->dispMessage();
return $oMessageObject;
}
// if(type == view, and case for using mobilephone)
if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
{
@ -640,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);
@ -764,7 +750,6 @@ class ModuleHandler extends Handler
$message = $oModule->getMessage();
$messageType = $oModule->getMessageType();
$redirectUrl = $oModule->getRedirectUrl();
if($messageType == 'error') debugPrint($message, 'ERROR');
if(!$procResult)
{
@ -899,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;
}
@ -1080,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);
@ -1149,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];
}
@ -1213,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)
{
@ -1233,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())
{
@ -1255,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();
@ -394,18 +290,16 @@ class EmbedFilter
{
$this->whiteIframeUrlList[] = $prefix;
}
$db_info = Context::getDBInfo();
if(isset($db_info->embed_white_object) && count($db_info->embed_white_object))
if ($embedfilter_object = config('embedfilter.object'))
{
foreach ($db_info->embed_white_object as $prefix)
foreach ($embedfilter_object as $prefix)
{
$this->whiteUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix;
}
}
if(isset($db_info->embed_white_iframe) && count($db_info->embed_white_iframe))
if ($embedfilter_iframe = config('embedfilter.iframe'))
{
foreach ($db_info->embed_white_iframe as $prefix)
foreach ($embedfilter_iframe as $prefix)
{
$this->whiteIframeUrlList[] = preg_match('@^https?://(.*)$@i', $prefix, $matches) ? $matches[1] : $prefix;
}

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,10 +3,10 @@
/**
* 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);
/**
* Set the default timezone.
* Suppress date/time errors until the internal time zone is set (see below).
*/
date_default_timezone_set(@date_default_timezone_get());
@ -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.
*/
@ -191,7 +186,20 @@ spl_autoload_register(function($class_name)
/**
* Also include the Composer autoloader.
*/
if (file_exists(RX_BASEDIR . 'vendor/autoload.php'))
{
require_once RX_BASEDIR . 'vendor/autoload.php';
}
require_once RX_BASEDIR . 'vendor/autoload.php';
/**
* Load system configuration.
*/
Rhymix\Framework\Config::init();
/**
* Install the debugger.
*/
Rhymix\Framework\Debug::registerErrorHandlers(error_reporting());
/**
* Set the internal timezone.
*/
$internal_timezone = Rhymix\Framework\DateTime::getTimezoneNameByOffset(config('locale.internal_timezone'));
date_default_timezone_set($internal_timezone);

View file

@ -3,7 +3,7 @@
/**
* RX_VERSION is the version number of the Rhymix CMS.
*/
define('RX_VERSION', '1.8.15');
define('RX_VERSION', '1.8.17');
/**
* RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch.
@ -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

@ -5,3 +5,105 @@
*
* Copyright (c) Rhymix Developers and Contributors
*/
return array(
'config_version' => '2.0',
'db' => array(
'master' => array(
'type' => 'mysql',
'host' => 'localhost',
'port' => 3306,
'user' => null,
'pass' => null,
'database' => null,
'prefix' => null,
'charset' => null,
'engine' => null,
),
),
'cache' => array(),
'ftp' => array(
'host' => 'localhost',
'port' => 21,
'path' => null,
'user' => null,
'pass' => null,
'pasv' => true,
'sftp' => false,
),
'crypto' => array(
'encryption_key' => null,
'authentication_key' => null,
'session_key' => null,
),
'locale' => array(
'default_lang' => 'ko',
'enabled_lang' => array('ko'),
'default_timezone' => 'Asia/Seoul',
'internal_timezone' => 32400,
),
'url' => array(
'default' => null,
'http_port' => null,
'https_port' => null,
'ssl' => 'none',
),
'session' => array(
'delay' => false,
'use_db' => false,
'domain' => null,
'path' => null,
'lifetime' => 0,
'refresh' => 300,
),
'file' => array(
'umask' => '022',
),
'mail' => array(
'transport' => 'mail',
'smtp_host' => null,
'smtp_port' => null,
'smtp_security' => 'none',
'smtp_user' => null,
'smtp_pass' => null,
'api_domain' => null,
'api_token' => null,
'api_user' => null,
'api_pass' => null,
),
'view' => array(
'minify_scripts' => 'common',
'concat_scripts' => 'none',
'use_gzip' => false,
),
'admin' => array(
'allow' => array(),
'deny' => array(),
),
'lock' => array(
'locked' => false,
'title' => 'Maintenance',
'message' => '',
'allow' => array(),
),
'debug' => array(
'enabled' => true,
'log_errors' => true,
'log_queries' => false,
'log_slow_queries' => 0,
'log_slow_triggers' => 0,
'log_slow_widgets' => 0,
'log_filename' => null,
'display_type' => 'comment',
'display_to' => 'admin',
'allow' => array(),
),
'embedfilter' => array(
'iframe' => array(),
'object' => array(),
),
'use_mobile_view' => true,
'use_prepared_statements' => true,
'use_rewrite' => true,
'use_sso' => false,
'other' => array(),
);

View file

@ -1,7 +1,7 @@
<?php
/**
* List of languages supported by RhymiX
* List of languages supported by Rhymix
*
* Copyright (c) Rhymix Developers and Contributors
*/

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

@ -0,0 +1,261 @@
<?php
namespace Rhymix\Framework\Compat;
use Rhymix\Framework\Config;
use Rhymix\Framework\DateTime;
/**
* Config parser class for XE compatibility.
*/
class ConfigParser
{
/**
* Convert previous configuration files to the current format and return it.
*
* @return array
*/
public static function convert()
{
// Load DB info file.
if (file_exists(RX_BASEDIR . Config::$old_db_config_filename))
{
include RX_BASEDIR . Config::$old_db_config_filename;
}
else
{
return array();
}
// Load FTP info file.
if (file_exists(RX_BASEDIR . Config::$old_ftp_config_filename))
{
include RX_BASEDIR . Config::$old_ftp_config_filename;
}
// Load selected language file.
if (file_exists(RX_BASEDIR . Config::$old_lang_config_filename))
{
$lang_selected = array();
$lang_selected_raw = file_get_contents(RX_BASEDIR . Config::$old_lang_config_filename);
$lang_selected_raw = array_map('trim', explode("\n", $lang_selected_raw));
foreach ($lang_selected_raw as $lang_selected_item)
{
$lang_selected_item = array_map('trim', explode(',', $lang_selected_item));
if (count($lang_selected_item) && $lang_selected_item[0] !== '')
{
$lang_selected_item[0] = ($lang_selected_item[0] === 'jp' ? 'ja' : $lang_selected_item[0]);
$lang_selected[] = $lang_selected_item[0];
}
}
$lang_selected = array_unique($lang_selected);
unset($lang_selected_raw, $lang_selected_item);
}
else
{
$lang_selected = \Context::getLangType() === 'jp' ? 'ja' : \Context::getLangType();
$lang_selected = array($lang_selected);
}
// Load defaults for the new configuration.
$config = (include RX_BASEDIR . Config::$default_config_filename);
// Convert database configuration.
if (!isset($db_info->master_db))
{
$db_info->master_db = array();
$db_info->master_db['db_type'] = $db_info->db_type;
$db_info->master_db['db_hostname'] = $db_info->db_hostname;
$db_info->master_db['db_port'] = $db_info->db_port;
$db_info->master_db['db_userid'] = $db_info->db_userid;
$db_info->master_db['db_password'] = $db_info->db_password;
$db_info->master_db['db_database'] = $db_info->db_database;
$db_info->master_db['db_table_prefix'] = $db_info->db_table_prefix;
}
$config['db']['master']['type'] = strtolower($db_info->master_db['db_type']);
$config['db']['master']['host'] = $db_info->master_db['db_hostname'];
$config['db']['master']['port'] = $db_info->master_db['db_port'];
$config['db']['master']['user'] = $db_info->master_db['db_userid'];
$config['db']['master']['pass'] = $db_info->master_db['db_password'];
$config['db']['master']['database'] = $db_info->master_db['db_database'];
$config['db']['master']['prefix'] = $db_info->master_db['db_table_prefix'];
if (substr($config['db']['master']['prefix'], -1) !== '_')
{
$config['db']['master']['prefix'] .= '_';
}
$config['db']['master']['charset'] = $db_info->master_db['db_charset'] ?: 'utf8';
if (strpos($config['db']['master']['type'], 'innodb') !== false)
{
$config['db']['master']['type'] = str_replace('_innodb', '', $config['db']['master']['type']);
$config['db']['master']['engine'] = 'innodb';
}
elseif (strpos($config['db']['master']['type'], 'mysql') !== false)
{
$config['db']['master']['engine'] = 'myisam';
}
if (isset($db_info->slave_db) && count($db_info->slave_db))
{
foreach ($db_info->slave_db as $slave_id => $slave_db)
{
if ($slave_db !== $db_info->master_db)
{
$slave_id = 'slave' . $slave_id;
$config['db'][$slave_id]['type'] = strtolower($slave_db['db_type']);
$config['db'][$slave_id]['host'] = $slave_db['db_hostname'];
$config['db'][$slave_id]['port'] = $slave_db['db_type'];
$config['db'][$slave_id]['user'] = $slave_db['db_userid'];
$config['db'][$slave_id]['pass'] = $slave_db['db_password'];
$config['db'][$slave_id]['database'] = $slave_db['db_database'];
$config['db'][$slave_id]['prefix'] = $slave_db['db_table_prefix'];
if (substr($config['db'][$slave_id]['prefix'], -1) !== '_')
{
$config['db'][$slave_id]['prefix'] .= '_';
}
$config['db'][$slave_id]['charset'] = $slave_db['db_charset'] ?: 'utf8';
if (strpos($config['db'][$slave_id]['type'], 'innodb') !== false)
{
$config['db'][$slave_id]['type'] = str_replace('_innodb', '', $config['db'][$slave_id]['type']);
$config['db'][$slave_id]['engine'] = 'innodb';
}
elseif (strpos($config['db'][$slave_id]['type'], 'mysql') !== false)
{
$config['db'][$slave_id]['engine'] = 'myisam';
}
}
}
}
// Convert cache configuration.
if (isset($db_info->use_object_cache))
{
$config['cache'][] = $db_info->use_object_cache;
}
// Convert FTP configuration.
if (isset($ftp_info))
{
$config['ftp']['host'] = $ftp_info->ftp_host;
$config['ftp']['port'] = $ftp_info->ftp_port;
$config['ftp']['path'] = $ftp_info->ftp_root_path;
$config['ftp']['user'] = $ftp_info->ftp_user;
$config['ftp']['pasv'] = $ftp_info->ftp_pasv;
$config['ftp']['sftp'] = $ftp_info->sftp === 'Y' ? true : false;
}
// Create new crypto keys.
$config['crypto']['encryption_key'] = \Password::createSecureSalt(64, 'alnum');
$config['crypto']['authentication_key'] = \Password::createSecureSalt(64, 'alnum');
$config['crypto']['session_key'] = \Password::createSecureSalt(64, 'alnum');
// Convert language configuration.
if (isset($db_info->lang_type))
{
$config['locale']['default_lang'] = str_replace('jp', 'ja', strtolower($db_info->lang_type));
}
elseif (count($lang_selected))
{
$config['locale']['default_lang'] = array_first($lang_selected);
}
$config['locale']['enabled_lang'] = array_values($lang_selected);
// Convert timezone configuration.
$old_timezone = DateTime::getTimezoneOffsetByLegacyFormat($db_info->time_zone ?: '+0900');
switch ($old_timezone)
{
case 32400:
$config['locale']['default_timezone'] = 'Asia/Seoul'; break;
default:
$config['locale']['default_timezone'] = DateTime::getTimezoneNameByOffset($old_timezone);
}
$config['locale']['internal_timezone'] = intval(date('Z'));
// Convert URL configuration.
$default_url = $db_info->default_url;
if (strpos($default_url, 'xn--') !== false)
{
$default_url = \Context::decodeIdna($default_url);
}
$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';
// Convert session configuration.
$config['session']['delay'] = $db_info->delay_session === 'Y' ? true : false;
$config['session']['use_db'] = $db_info->use_db_session === 'Y' ? true : false;
// Convert view configuration.
$config['view']['minify_scripts'] = $db_info->minify_scripts ?: 'common';
$config['view']['use_gzip'] = (defined('__OB_GZHANDLER_ENABLE__') && constant('__OB_GZHANDLER_ENABLE__'));
// Convert admin IP whitelist.
if (isset($db_info->admin_ip_list) && is_array($db_info->admin_ip_list) && count($db_info->admin_ip_list))
{
$config['admin']['allow'] = array_values($db_info->admin_ip_list);
}
// Convert sitelock configuration.
$config['lock']['locked'] = $db_info->use_sitelock === 'Y' ? true : false;
$config['lock']['title'] = strval($db_info->sitelock_title);
$config['lock']['message'] = strval($db_info->sitelock_message);
if (!is_array($db_info->sitelock_whitelist))
{
$db_info->sitelock_whitelist = $db_info->sitelock_whitelist ? array_map('trim', explode(',', trim($db_info->sitelock_whitelist))) : array();
}
if (!in_array('127.0.0.1', $db_info->sitelock_whitelist))
{
$db_info->sitelock_whitelist[] = '127.0.0.1';
}
$config['lock']['allow'] = array_values($db_info->sitelock_whitelist);
// Convert embed filter configuration.
if (is_array($db_info->embed_white_iframe))
{
$whitelist = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $db_info->embed_white_iframe));
natcasesort($whitelist);
$config['embedfilter']['iframe'] = $whitelist;
}
if (is_array($db_info->embed_white_object))
{
$whitelist = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $db_info->embed_white_object));
natcasesort($whitelist);
$config['embedfilter']['object'] = $whitelist;
}
// Convert miscellaneous configuration.
$config['use_mobile_view'] = $db_info->use_mobile_view === 'N' ? false : true;
$config['use_prepared_statements'] = $db_info->use_prepared_statements === 'Y' ? true : false;
$config['use_rewrite'] = $db_info->use_rewrite === 'Y' ? true : false;
$config['use_sso'] = $db_info->use_sso === 'Y' ? true : false;
// Copy other configuration.
unset($db_info->master_db, $db_info->slave_db);
unset($db_info->lang_type, $db_info->time_zone);
unset($db_info->default_url, $db_info->http_port, $db_info->https_port, $db_info->use_ssl);
unset($db_info->delay_session, $db_info->use_db_session);
unset($db_info->minify_scripts, $db_info->admin_ip_list);
unset($db_info->use_sitelock, $db_info->sitelock_title, $db_info->sitelock_message, $db_info->sitelock_whitelist);
unset($db_info->embed_white_iframe, $db_info->embed_white_object);
unset($db_info->use_object_cache, $db_info->use_mobile_view, $db_info->use_prepared_statements);
unset($db_info->use_rewrite, $db_info->use_sso);
foreach ($db_info as $key => $value)
{
$config['other'][$key] = $value;
}
// Return the new configuration.
return $config;
}
}

View file

@ -0,0 +1,132 @@
<?php
namespace Rhymix\Framework\Compat;
use Rhymix\Framework\Lang;
/**
* Lang parser class for XE compatibility.
*/
class LangParser
{
/**
* Convert a directory of old language files to the Rhymix format.
*
* @param string $dir
* @param array $xml_langs When converting XML to PHP, only convert these languages. (Optional)
* @return void
*/
public static function convertDirectory($dir, $xml_langs = array())
{
if (file_exists("$dir/lang.xml"))
{
$langs = count($xml_langs) ? $xml_langs : array_keys(Lang::getSupportedList());
foreach ($langs as $lang)
{
self::compileXMLtoPHP("$dir/lang.xml", $lang === 'ja' ? 'jp' : $lang, "$dir/$lang.php");
}
}
else
{
$files = glob($dir . '/*.lang.php');
foreach ($files as $filename)
{
$new_filename = preg_replace('/\.lang\.php$/', '.php', str_replace('jp.lang', 'ja.lang', $filename));
\FileHandler::rename($filename, $new_filename);
}
}
}
/**
* Compile XE-compatible XML lang files into PHP.
*
* @param string $filename
* @param string $language
* @return string|false
*/
public static function compileXMLtoPHP($filename, $language, $output_filename = null)
{
// Check if the cache file already exists.
if ($output_filename === null)
{
$output_filename = RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php';
if (file_exists($output_filename) && filemtime($output_filename) > filemtime($filename))
{
return $output_filename;
}
}
// Load the XML lang file.
$xml = @simplexml_load_file($filename);
if ($xml === false)
{
\FileHandler::writeFile($output_filename, '');
return false;
}
// Convert XML to a PHP array.
$lang = array();
self::_toArray($xml, $lang, $language);
unset($xml);
// Save the array as a cache file.
$buff = "<?php\n";
foreach ($lang as $key => $value)
{
if (is_array($value))
{
foreach ($value as $subkey => $subvalue)
{
if (is_array($subvalue))
{
foreach ($subvalue as $subsubkey => $subsubvalue)
{
$buff .= '$lang->' . $key . "['$subkey']['$subsubkey']" . ' = ' . var_export($subsubvalue, true) . ";\n";
}
}
else
{
$buff .= '$lang->' . $key . "['$subkey']" . ' = ' . var_export($subvalue, true) . ";\n";
}
}
}
else
{
$buff .= '$lang->' . $key . ' = ' . var_export($value, true) . ";\n";
}
}
\FileHandler::writeFile($output_filename, $buff);
return $output_filename;
}
/**
* XML to array conversion callback.
*
* @param array $items
* @return void
*/
protected static function _toArray($items, &$lang, $language)
{
foreach ($items as $item)
{
$name = strval($item['name']);
if (count($item->item))
{
$lang[$name] = array();
self::_toArray($item->item, $lang[$name], $language);
}
else
{
foreach ($item->value as $value)
{
$attribs = $value->attributes('xml', true);
if (strval($attribs['lang']) === $language)
{
$lang[$name] = strval($value);
break;
}
}
}
}
}
}

182
common/framework/config.php Normal file
View file

@ -0,0 +1,182 @@
<?php
namespace Rhymix\Framework;
/**
* The config class.
*/
class Config
{
/**
* System configuration is stored here.
*/
protected static $_config = array();
/**
* Location of configuration files.
*/
public static $config_filename = 'files/config/config.php';
public static $old_db_config_filename = 'files/config/db.config.php';
public static $old_ftp_config_filename = 'files/config/ftp.config.php';
public static $old_lang_config_filename = 'files/config/lang_selected.info';
public static $default_config_filename = 'common/defaults/config.php';
/**
* Load system configuration.
*
* @return void
*/
public static function init()
{
if (file_exists(RX_BASEDIR . self::$config_filename))
{
self::$_config = (include RX_BASEDIR . self::$config_filename);
}
else
{
if (self::$_config = Compat\ConfigParser::convert())
{
self::save();
}
}
return self::$_config;
}
/**
* Get all system configuration.
*
* @return array
*/
public static function getAll()
{
return self::$_config;
}
/**
* Get default system configuration.
*
* @return array
*/
public static function getDefaults()
{
return (include RX_BASEDIR . self::$default_config_filename);
}
/**
* Get a system configuration value.
*
* @param string $key
* @return mixed
*/
public static function get($key)
{
if (!count(self::$_config))
{
self::init();
}
$data = self::$_config;
$key = explode('.', $key);
foreach ($key as $step)
{
if ($key === '' || !isset($data[$step]))
{
return null;
}
$data = $data[$step];
}
return $data;
}
/**
* Set a system configuration value.
*
* @param string $key
* @param mixed $value
* @return void
*/
public static function set($key, $value)
{
if (!count(self::$_config))
{
self::init();
}
$data = &self::$_config;
$key = explode('.', $key);
foreach ($key as $step)
{
$data = &$data[$step];
}
$data = $value;
}
/**
* Set all system configuration.
*
* @param array $config
* @return void
*/
public static function setAll($config)
{
self::$_config = $config;
}
/**
* Save the current system configuration.
*
* @param array $config (optional)
* @return bool
*/
public static function save($config = null)
{
if ($config)
{
self::setAll($config);
}
// Save the main config file.
$buff = '<?php' . "\n" . '// Rhymix System Configuration' . "\n" . 'return ' . self::serialize(self::$_config) . ';' . "\n";
$result = \FileHandler::writeFile(RX_BASEDIR . self::$config_filename, $buff) ? true : false;
//if (!$result) return false;
// Save XE-compatible config files.
$db_info = \Context::convertDBInfo(self::$_config);
$ftp_info = $db_info->ftp_info;
$db_info_without_ftp = clone $db_info;
unset($db_info_without_ftp->ftp_info);
$buff = '<?php' . "\n" . '$db_info = ' . self::serialize($db_info_without_ftp) . ';' . "\n";
\FileHandler::writeFile(RX_BASEDIR . self::$old_db_config_filename, $buff);
$buff = '<?php' . "\n" . '$ftp_info = ' . self::serialize($ftp_info) . ';' . "\n";
\FileHandler::writeFile(RX_BASEDIR . self::$old_ftp_config_filename, $buff);
return true;
}
/**
* Serialize a value for insertion into a PHP-based configuration file.
*
* @param mixed $value
* @return string
*/
public static function serialize($value)
{
if (is_object($value))
{
return '(object)' . self::serialize((array)$value);
}
elseif (is_array($value))
{
$value = var_export($value, true);
$value = preg_replace('/array \(\n/', "array(\n", $value);
$value = preg_replace('/=>\s+array\(\n/', "=> array(\n", $value);
$value = preg_replace('/array\(\s*\n\s*\)/', 'array()', $value);
$value = preg_replace_callback('/\n(\x20+)/', function($m) {
return "\n" . str_repeat("\t", intval(strlen($m[1]) / 2));
}, $value);
$value = preg_replace('/\n(\t+)[0-9]+ => /', "\n\$1", $value);
return $value;
}
else
{
return var_export($value, true);
}
}
}

View file

@ -0,0 +1,167 @@
<?php
namespace Rhymix\Framework;
/**
* The datetime class.
*/
class DateTime
{
/**
* Time zone objects and settings are cached here.
*/
protected static $_timezones = array();
/**
* Format a Unix timestamp using the internal timezone.
*
* @param string $format Format used in PHP date() function
* @param int $timestamp Unix timestamp (optional, default is now)
* @return string
*/
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.
*
* @param string $format Format used in PHP date() function
* @param int $timestamp Unix timestamp (optional, default is now)
* @return string
*/
public static function formatTimestampForCurrentUser($format, $timestamp = null)
{
$timezone = self::getTimezoneForCurrentUser();
if (!isset(self::$_timezones[$timezone]))
{
self::$_timezones[$timezone] = new \DateTimeZone($timezone);
}
$datetime = new \DateTime();
$datetime->setTimestamp($timestamp ?: time());
$datetime->setTimezone(self::$_timezones[$timezone]);
return $datetime->format($format);
}
/**
* Get the current user's timezone.
*
* @return string
*/
public static function getTimezoneForCurrentUser()
{
if (isset($_SESSION['timezone']) && $_SESSION['timezone'])
{
return $_SESSION['timezone'];
}
elseif ($default = Config::get('locale.default_timezone'))
{
return $default;
}
else
{
return @date_default_timezone_get();
}
}
/**
* Get the list of time zones supported on this server.
*
* @return array
*/
public static function getTimezoneList()
{
$result = array();
$tzlist = \DateTimeZone::listIdentifiers();
foreach ($tzlist as $tzid)
{
if (!preg_match('/^(?:A|Europe|Indian|Pacific)/', $tzid)) continue;
$name = str_replace('_', ' ', $tzid);
$datetime = new \DateTime(null, new \DateTimeZone($tzid));
$offset = $datetime->getOffset();
$offset = ($offset >= 0 ? '+' : '-') . sprintf('%02d', floor(abs($offset) / 3600)) . ':' . sprintf('%02d', (abs($offset) % 3600) / 60);
unset($datetime);
$result[$tzid] = "$name ($offset)";
}
asort($result);
$result['Etc/UTC'] = 'GMT/UTC (+00:00)';
return $result;
}
/**
* Get the absolute (UTC) offset of a timezone.
*
* @param string $timezone Timezone identifier, e.g. Asia/Seoul
* @param int $timestamp Unix timestamp (optional, default is now)
* @return int
*/
public static function getTimezoneOffset($timezone, $timestamp = null)
{
if (!isset(self::$_timezones[$timezone]))
{
self::$_timezones[$timezone] = new \DateTimeZone($timezone);
}
$datetime = new \DateTime();
$datetime->setTimestamp($timestamp ?: time());
$datetime->setTimezone(self::$_timezones[$timezone]);
return $datetime->getOffset();
}
/**
* Get the relative offset between a timezone and Rhymix's internal timezone.
*
* @param string $timezone Timezone identifier, e.g. Asia/Seoul
* @param int $timestamp Unix timestamp (optional, default is now)
* @return int
*/
public static function getTimezoneOffsetFromInternal($timezone, $timestamp = null)
{
return self::getTimezoneOffset($timezone, $timestamp) - Config::get('locale.internal_timezone');
}
/**
* Get the absolute (UTC) offset of a timezone written in XE legacy format ('+0900').
*
* @param string $timezone
* @return int
*/
public static function getTimezoneOffsetByLegacyFormat($timezone)
{
$multiplier = ($timezone[0] === '-') ? -60 : 60;
$timezone = preg_replace('/[^0-9]/', '', $timezone);
list($hours, $minutes) = str_split($timezone, 2);
return (((int)$hours * 60) + (int)$minutes) * $multiplier;
}
/**
* Get a PHP time zone by UTC offset.
*
* Time zones with both (a) fractional offsets and (b) daylight saving time
* (such as Iran's +03:30/+04:30) cannot be converted in this way.
* However, if Rhymix is installed for the first time in such a time zone,
* the internal time zone will be automatically set to UTC,
* so this should never be a problem in practice.
*
* @param int $offset
* @return bool
*/
public static function getTimezoneNameByOffset($offset)
{
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

@ -174,7 +174,6 @@ class IpFilter
$range .= str_repeat('.*', 4 - $count);
}
$range = str_replace(array('.', '*'), array('\\.', '\\d+'), trim($range));
var_dump($ip, $range);
return preg_match("/^$range$/", $ip) ? true : false;
}

View file

@ -119,7 +119,7 @@ class Lang
}
elseif (file_exists("$dir/lang.xml"))
{
$filename = self::compileXMLtoPHP("$dir/lang.xml", $this->_language === 'ja' ? 'jp' : $this->_language);
$filename = Compat\LangParser::compileXMLtoPHP("$dir/lang.xml", $this->_language === 'ja' ? 'jp' : $this->_language);
}
// Load the language file.
@ -140,127 +140,6 @@ class Lang
}
}
/**
* Convert a directory of old language files to the RhymiX format.
*
* @param string $dir
* @param array $xml_langs When converting XML to PHP, only convert these languages. (Optional)
* @return void
*/
public static function convertDirectory($dir, $xml_langs = array())
{
if (file_exists("$dir/lang.xml"))
{
$langs = count($xml_langs) ? $xml_langs : array_keys(self::getSupportedList());
foreach ($langs as $lang)
{
self::compileXMLtoPHP("$dir/lang.xml", $lang === 'ja' ? 'jp' : $lang, "$dir/$lang.php");
}
}
else
{
$files = glob($dir . '/*.lang.php');
foreach ($files as $filename)
{
$new_filename = preg_replace('/\.lang\.php$/', '.php', str_replace('jp.lang', 'ja.lang', $filename));
\FileHandler::rename($filename, $new_filename);
}
}
}
/**
* Compile XE-compatible XML lang files into PHP.
*
* @param string $filename
* @param string $language
* @return string|false
*/
public static function compileXMLtoPHP($filename, $language, $output_filename = null)
{
// Check if the cache file already exists.
if ($output_filename === null)
{
$output_filename = RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php';
if (file_exists($output_filename) && filemtime($output_filename) > filemtime($filename))
{
return $output_filename;
}
}
// Load the XML lang file.
$xml = @simplexml_load_file($filename);
if ($xml === false)
{
\FileHandler::writeFile($output_filename, '');
return false;
}
// Convert XML to a PHP array.
$lang = array();
self::_toArray($xml, $lang, $language);
unset($xml);
// Save the array as a cache file.
$buff = "<?php\n";
foreach ($lang as $key => $value)
{
if (is_array($value))
{
foreach ($value as $subkey => $subvalue)
{
if (is_array($subvalue))
{
foreach ($subvalue as $subsubkey => $subsubvalue)
{
$buff .= '$lang->' . $key . "['$subkey']['$subsubkey']" . ' = ' . var_export($subsubvalue, true) . ";\n";
}
}
else
{
$buff .= '$lang->' . $key . "['$subkey']" . ' = ' . var_export($subvalue, true) . ";\n";
}
}
}
else
{
$buff .= '$lang->' . $key . ' = ' . var_export($value, true) . ";\n";
}
}
\FileHandler::writeFile($output_filename, $buff);
return $output_filename;
}
/**
* XML to array conversion callback.
*
* @param array $items
* @return void
*/
protected static function _toArray($items, &$lang, $language)
{
foreach ($items as $item)
{
$name = strval($item['name']);
if (count($item->item))
{
$lang[$name] = array();
self::_toArray($item->item, $lang[$name], $language);
}
else
{
foreach ($item->value as $value)
{
$attribs = $value->attributes('xml', true);
if (strval($attribs['lang']) === $language)
{
$lang[$name] = strval($value);
break;
}
}
}
}
}
/**
* Get the list of supported languages.
*
@ -293,7 +172,7 @@ class Lang
public function __get($key)
{
// Separate the plugin name from the key.
if (($keys = explode('.', $key, 2)) && count($keys) === 2)
if (preg_match('/^[a-z0-9_.-]+$/i', $key) && ($keys = explode('.', $key, 2)) && count($keys) === 2)
{
list($plugin_name, $key) = $keys;
if (!isset($this->_loaded_plugins[$plugin_name]))

View file

@ -6,8 +6,27 @@
* Copyright (c) Rhymix Developers and Contributors
*/
/**
* Get or set system configuration.
*
* @param string $key
* @param string $value (optional)
* @return mixed
*/
function config($key, $value = null)
{
if ($value === null)
{
return Rhymix\Framework\Config::get($key);
}
else
{
Rhymix\Framework\Config::set($key, $value);
}
}
/** Get the first value of an array.
/**
* Get the first value of an array.
*
* @param array $array The input array
* @return mixed
@ -17,7 +36,8 @@ function array_first(array $array)
return reset($array);
}
/** Get the first key of an array.
/**
* Get the first key of an array.
*
* @param array $array The input array
* @return mixed
@ -28,7 +48,8 @@ function array_first_key(array $array)
return key($array);
}
/** Get the last value of an array.
/**
* Get the last value of an array.
*
* @param array $array The input array
* @return mixed
@ -38,7 +59,8 @@ function array_last(array $array)
return end($array);
}
/** Get the last key of an array.
/**
* Get the last key of an array.
*
* @param array $array The input array
* @return mixed

View file

@ -28,6 +28,9 @@
}
});
/* Array for pending debug data */
window.rhymix_debug_pending_data = [];
/**
* @brief XE 공용 유틸리티 함수
* @namespace XE
@ -930,7 +933,7 @@ function getCookie(name) {
}
function is_def(v) {
return (typeof(v)!='undefined');
return typeof(v) != 'undefined' && v !== null;
}
function ucfirst(str) {

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

@ -54,7 +54,7 @@
waiting_obj.css("opacity", 0.0);
var wfsr_timeout = setTimeout(function() {
if (show_waiting_message) {
waiting_obj.css("opacity", "").html(waiting_message).show();
waiting_obj.css("opacity", "").show();
}
}, 1000);
@ -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.
@ -165,7 +175,7 @@
waiting_obj.css("opacity", 0.0);
var wfsr_timeout = setTimeout(function() {
if (show_waiting_message) {
waiting_obj.css("opacity", "").html(waiting_message).show();
waiting_obj.css("opacity", "").show();
}
}, 1000);
@ -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") {
@ -250,7 +270,7 @@
waiting_obj.css("opacity", 0.0);
var wfsr_timeout = setTimeout(function() {
if (show_waiting_message) {
waiting_obj.css("opacity", "").html(waiting_message).show();
waiting_obj.css("opacity", "").show();
}
}, 1000);

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

@ -6,7 +6,7 @@ $lang->cmd_delete = 'Delete';
$lang->cmd_modify = 'Update';
$lang->cmd_edit = 'Edit';
$lang->cmd_view = 'View';
$lang->inquiry = 'Inquiry';
$lang->inquiry = 'View';
$lang->all = 'All';
$lang->cmd_view_all = 'View All';
$lang->cmd_list = 'List';
@ -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,18 +195,18 @@ $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.여러개의 항목은 줄을 바꾸어 입력하세요';
$lang->msg_invalid_ip = '잘못된 IP주소 형식입니다.';
$lang->msg_no_root = '루트는 선택 할 수 없습니다.';
$lang->msg_no_shortcut = '바로가기는 선택 할 수 없습니다.';
$lang->msg_no_root = '루트는 선택할 수 없습니다.';
$lang->msg_no_shortcut = '바로가기는 선택할 수 없습니다.';
$lang->msg_select_menu = '대상 메뉴 선택';
$lang->msg_call_server = '서버에 요청 중입니다. 잠시만 기다려주세요.';
$lang->msg_call_server = '서버에 요청 중입니다. 잠시만 기다려 주십시오...';
$lang->msg_db_not_setted = 'DB 설정이 되어 있지 않습니다.';
$lang->msg_dbconnect_failed = 'DB 접속 오류가 발생했습니다. DB정보를 다시 확인해주세요.';
$lang->msg_invalid_queryid = 'Query ID값이 잘못 지정되었습니다.';
@ -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

@ -6,54 +6,6 @@
* Copyright (c) NAVER <http://www.navercorp.com>
*/
/**
* Time zone
* @var array
*/
$time_zone = array(
'-1200' => '[UTC -12:00] Baker Island',
'-1100' => '[UTC -11:00] Niue, American Samoa',
'-1000' => '[UTC -10:00] Hawaii, Aleutian Islands, Cook Islands',
'-0930' => '[UTC -09:30] Marquesas Islands',
'-0900' => '[UTC -09:00] Alaska, Gambier Islands',
'-0800' => '[UTC -08:00] U.S. and Canada (Pacific)',
'-0700' => '[UTC -07:00] U.S. and Canada (Mountain)',
'-0600' => '[UTC -06:00] U.S. and Canada (Central), Mexico',
'-0500' => '[UTC -05:00] U.S. and Canada (Eastern), Chile',
'-0430' => '[UTC -04:30] Venezuela',
'-0400' => '[UTC -04:00] Canada (Atlantic), Brazil (Western)',
'-0330' => '[UTC -03:30] Canada (Newfoundland)',
'-0300' => '[UTC -03:00] Argentina, Brazil (Eastern), Greenland',
'-0200' => '[UTC -02:00] Fernando de Noronha, South Georgia &amp; South Sandwich Islands',
'-0100' => '[UTC -01:00] Azores, Cape Verde',
'0000' => '[UTC ±00:00] GMT, Ireland, Portugal, West Africa',
'+0100' => '[UTC +01:00] Central Europe, West Africa',
'+0200' => '[UTC +02:00] Eastern Europe, Central Africa, Russia (Kaliningrad)',
'+0300' => '[UTC +03:00] Russia (Moscow), East Africa',
'+0330' => '[UTC +03:30] Iran',
'+0400' => '[UTC +04:00] Armenia, Azerbaijan, Georgia, Oman, Russia (Samara), UAE',
'+0430' => '[UTC +04:30] Afghanistan',
'+0500' => '[UTC +05:00] Pakistan, Russia (Yekaterinburg), Central Asia',
'+0530' => '[UTC +05:30] India, Sri Lanka',
'+0545' => '[UTC +05:45] Nepal',
'+0600' => '[UTC +06:00] Bangladesh, Bhutan, Kyrgyzstan, Russia (Omsk)',
'+0630' => '[UTC +06:30] Cocos Islands, Myanmar',
'+0700' => '[UTC +07:00] Cambodia, Indonesia, Laos, Russia (Krasnoyarsk), Thailand, Vietnam',
'+0800' => '[UTC +08:00] China, Malaysia, Philippines, Russia (Irkutsk), Singapore, Taiwan',
'+0830' => '[UTC +08:30] North Korea',
'+0845' => '[UTC +08:45] Australia (Eucla)',
'+0900' => '[UTC +09:00] Korea, Japan, Palua, East Timor, Russia (Yakutsk)',
'+0930' => '[UTC +09:30] Australia (Central)',
'+1000' => '[UTC +10:00] Australia (Eastern), Guam, Russia (Vladivostok)',
'+1030' => '[UTC +10:30] Lord Howe Island',
'+1100' => '[UTC +11:00] New Caledonia, Solomon Islands, Vanuatu, Russia (Srednekolymsk)',
'+1130' => '[UTC +11:30] Norfolk Island (before 2015)',
'+1200' => '[UTC +12:00] Fiji, New Zealand, Russia (Kamchatka)',
'+1245' => '[UTC +12:45] Chatham Islands',
'+1300' => '[UTC +13:00] Samoa, Tokelau, Tonga, Phoenix Islands',
'+1400' => '[UTC +14:00] Line Islands'
);
/**
* Define a function to use {@see ModuleHandler::getModuleObject()} ($module_name, $type)
*
@ -531,35 +483,32 @@ function cut_str($string, $cut_size = 0, $tail = '...')
}
/**
* Get integer offset of time zone
* Convert XE legacy time zone format into UTC offset.
*
* @param string $time_zone Time zone in +0900 format
* @param string $time_zone Time zone in '+0900' format
* @return int
*/
function get_time_zone_offset($time_zone)
function get_time_zone_offset($timezone)
{
$multiplier = ($time_zone[0] === '-') ? -60 : 60;
$time_zone = preg_replace('/[^0-9]/', '', $time_zone);
list($hours, $minutes) = str_split($time_zone, 2);
return (((int)$hours * 60) + (int)$minutes) * $multiplier;
return Rhymix\Framework\DateTime::getTimezoneOffsetByLegacyFormat($timezone);
}
/**
* Get a time gap between server's timezone and XE's timezone
* Get the offset between the current user's time zone and Rhymix's internal time zone.
*
* @return int
*/
function zgap()
function zgap($timestamp = null)
{
$time_zone_offset = $GLOBALS['_time_zone_offset'];
$server_offset = date('Z');
return $time_zone_offset - $server_offset;
$current_user_timezone = Rhymix\Framework\DateTime::getTimezoneForCurrentUser();
return Rhymix\Framework\DateTime::getTimezoneOffsetFromInternal($current_user_timezone, $timestamp);
}
/**
* YYYYMMDDHHIISS format changed to unix time value
* Convert YYYYMMDDHHIISS format to Unix timestamp.
* This function assumes the internal timezone.
*
* @param string $str Time value in format of YYYYMMDDHHIISS
* @param string $str Time in YYYYMMDDHHIISS format
* @return int
*/
function ztime($str)
@ -576,24 +525,26 @@ function ztime($str)
$hour = (int)substr($str, 8, 2);
$min = (int)substr($str, 10, 2);
$sec = (int)substr($str, 12, 2);
$offset = zgap();
}
else
{
$hour = $min = $sec = $offset = 0;
$hour = $min = $sec = 0;
}
return mktime($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;
}
/**
* Change the time format YYYYMMDDHHIISS to the user defined format
* Convert YYYYMMDDHHIISS format to user-defined format.
* This function assumes the internal timezone.
*
* @param string|int $str YYYYMMDDHHIISS format time values
* @param string $format Time format of php date() function
* @param bool $conversion Means whether to convert automatically according to the language
* @param string $str Time in YYYYMMDDHHIISS format
* @param string $format Time format for date() function
* @param bool $conversion If true, convert automatically for the current language.
* @return string
*/
function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false)
{
if(!$str)
{
@ -601,7 +552,7 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
}
// convert the date format according to the language
if($conversion == TRUE)
if($conversion)
{
static $convtable = array(
'en' => array(
@ -637,18 +588,44 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
}
}
// get unixtime by using ztime() for date() function's argument.
$string = date($format, ztime($str));
// get unixtime by using ztime() for date() function's argument.
$result = Rhymix\Framework\DateTime::formatTimestampForCurrentUser($format, ztime($str));
// change day and am/pm for each language
if(preg_match('/[MFAa]/', $format))
{
$unit_week = (Array)Context::getLang('unit_week');
$unit_meridiem = (Array)Context::getLang('unit_meridiem');
$string = str_replace(array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'), $unit_week, $string);
$string = str_replace(array('am', 'pm', 'AM', 'PM'), $unit_meridiem, $string);
$result = str_replace(array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'), $unit_week, $result);
$result = str_replace(array('am', 'pm', 'AM', 'PM'), $unit_meridiem, $result);
}
return $string;
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);
}
/**
@ -660,24 +637,24 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
*/
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
{
@ -718,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);
}
/**
@ -821,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
}
/**
@ -886,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
}
/**
@ -941,7 +772,7 @@ function getDestroyXeVars($vars)
}
/**
* Change error_handing to debugPrint on php5 higher
* Legacy error handler
*
* @param int $errno
* @param string $errstr
@ -949,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);
}
/**
@ -1365,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

@ -53,7 +53,7 @@
이 매뉴얼과 같은 디렉터리에 존재하는 'rhymix-nginx.conf' 파일을 nginx.conf가 위치한 디렉터리(/etc/nginx)로 이동해 보도록 합시다.
[주석입니다. sudo mv (원본 디렉터리) (옮길 디렉터리)]
# sudo mv /(RhymiX의 설치 디렉터리)/common/manual/server_config/rhymix-nginx.conf /etc/nginx/
# sudo mv /(Rhymix의 설치 디렉터리)/common/manual/server_config/rhymix-nginx.conf /etc/nginx/
이제 **nginx.conf** 파일을 수정해 보도록 하겠습니다. rhymix-nginx.conf 파일을 **nginx.conf** 파일에 인클루드 하는 첫번째 과정입니다.
@ -91,7 +91,7 @@ site-enabled 디렉터리에 아래와 같은 서버 설정을 작성합니다.
1. 80 포트를 이용하여 보안 연결 없는 일반 HTTP 연결을 하고
2. example.com 도메인을 사용하며
3. /var/www/html 디렉터리에 RhymiX 파일이 위치하고
3. /var/www/html 디렉터리에 Rhymix 파일이 위치하고
4. site-enabled 디렉터리에 위치한 파일입니다.
파일의 이름은 'example.conf'라고 가정하도록 하겠습니다.
@ -118,9 +118,9 @@ site-enabled 디렉터리에 아래와 같은 서버 설정을 작성합니다.
혹은, 추가하는 include 구문을 아래와 같이 추가할 수도 있지만, **절대로 이런 방식으로 추가해서는 안됩니다.** **반면교사를 위한 보여주기입니다.**
include /RhymiX_설치경로/common/manual/server_config/rhymix-nginx.conf;
include /Rhymix_설치경로/common/manual/server_config/rhymix-nginx.conf;
RhymiX의 설치 경로가 **/var/www/html**이라면,
Rhymix의 설치 경로가 **/var/www/html**이라면,
include /var/www/html/common/manual/server_config/rhymix-nginx.conf;

View file

@ -1,33 +1,31 @@
{@
$db_info = Context::getDBInfo();
$lang_type = Context::getLangType();
$ssl_actions = Context::getSSLActions();
$css_files = Context::getCssFile();
$js_files = Context::getJsFile();
}
<!DOCTYPE html>
<html lang="{str_replace('jp','ja',$lang_type)}">
<html lang="{$lang_type = Context::getLangType()}" class="xe-mobilelayout"|cond="$m">
<head>
<!-- META -->
<meta charset="utf-8">
<meta name="Generator" content="Rhymix">
<meta name="generator" content="Rhymix">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes" cond="$m" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<block loop="Context::getMetaTag() => $no, $val">
<meta http-equiv="{$val['name']}"|cond="$val['is_http_equiv']" name="{$val['name']}"|cond="!$val['is_http_equiv']" content="{$val['content']}">
</block>
<!-- TITLE -->
<title>{Context::getBrowserTitle()}</title>
<!-- CSS -->
<block loop="$css_files=>$key,$css_file">
<block loop="Context::getCssFile() => $key, $css_file">
<block cond="$css_file['targetie']"><!--[if {$css_file['targetie']}]><block cond="stripos($css_file['targetie'], 'gt') === 0"><!--></block></block>
<link rel="stylesheet" href="{$css_file['file']}" media="{$css_file['media']}"|cond="$css_file['media'] != 'all'" />
<block cond="$css_file['targetie']"><block cond="stripos($css_file['targetie'], 'gt') === 0"><!--</block><![endif]--></block>
<block cond="$css_file['targetie']"><block cond="stripos($css_file['targetie'], 'gt') === 0"><!--</block><![endif]-->{"\n"}</block>
</block>
<!-- JS -->
<block loop="$js_files=>$key,$js_file">
<block loop="Context::getJsFile() => $key, $js_file">
<block cond="$js_file['targetie']"><!--[if {$js_file['targetie']}]><block cond="stripos($js_file['targetie'], 'gt') === 0"><!--></block></block>
<script src="{$js_file['file']}"></script>
<block cond="$js_file['targetie']"><block cond="stripos($js_file['targetie'], 'gt') === 0"><!--</block><![endif]--></block>
<block cond="$js_file['targetie']"><block cond="stripos($js_file['targetie'], 'gt') === 0"><!--</block><![endif]-->{"\n"}</block>
</block>
<!-- RSS -->
@ -35,46 +33,47 @@
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" cond="$general_rss_url" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" cond="$rss_url" />
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" cond="$general_rss_url" />
<!-- ICON -->
<!-- ICONS -->
<link cond="$favicon_url" rel="shortcut icon" href="{$favicon_url}" />
<link cond="$mobicon_url" rel="apple-touch-icon" href="{$mobicon_url}" />
{Context::getHtmlHeader()}
<script>
//<![CDATA[
var current_url = "{$current_url}";
var request_uri = "{$request_uri}";
<block cond="$vid">var xeVid = "{$vid}";</block>
var current_mid = "{$mid}";
var waiting_message = "{$lang->msg_call_server}";
var ssl_actions = new Array(<block cond="count($ssl_actions)">"{implode('","',array_keys($ssl_actions))}"</block>);
var default_url = "{Context::getDefaultUrl()}";
<block cond="Context::get('_http_port')">var http_port = {Context::get("_http_port")};</block>
<block cond="Context::get('_https_port')">var https_port = {Context::get("_https_port")};</block>
<block cond="Context::get('_use_ssl') && Context::get('_use_ssl') == 'always'">var enforce_ssl = true;</block>
xe.current_lang = "{$lang_type}";
xe.cmd_find = "{$lang->cmd_find}";
xe.cmd_cancel = "{$lang->cmd_cancel}";
xe.cmd_confirm = "{$lang->cmd_confirm}";
xe.msg_no_root = "{$lang->msg_no_root}";
xe.msg_no_shortcut = "{$lang->msg_no_shortcut}";
xe.msg_select_menu = "{$lang->msg_select_menu}";
//]]>
<!-- OTHER HEADERS -->
{Context::getHtmlHeader()}
<!-- COMMON JS VARIABLES -->
<script>
var default_url = "{Context::getDefaultUrl()}";
var current_url = "{$current_url}";
var request_uri = "{$request_uri}";
var current_lang = xe.current_lang = "{$lang_type}";
var current_mid = {json_encode($mid ?: null)};
var http_port = {Context::get("_http_port") ?: 'null'};
var https_port = {Context::get("_https_port") ?: 'null'};
var enforce_ssl = {Context::get('_use_ssl') === 'always' ? 'true' : 'false'};
var ssl_actions = {json_encode(array_values(Context::getSSLActions()))};
var xeVid = {json_encode($vid ?: null)};
</script>
</head>
{@$isAdminKind = false}
<!--@if(stripos(Context::get('act'),'admin') || Context::get('module') == 'admin')-->
{@$isAdminKind = true}
<!--@end-->
<!-- BODY START -->
<body{Context::getBodyClass()}>
<!-- PAGE CONTENT -->
{Context::getBodyHeader()}
{$content}
{Context::getHtmlFooter()}
<!-- ETC -->
<div class="wfsr"></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>
<div id="rhymix_waiting" class="wfsr" cond="!$m">{$lang->msg_call_server}</div>
<div id="rhymix_debug_panel"></div>
<div id="rhymix_debug_button"></div>
<!-- BODY JS -->
<block loop="Context::getJsFile('body') => $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]-->{"\n"}</block>
</block>
</body>

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

@ -1,72 +0,0 @@
{@
$lang_type = Context::getLangType();
$ssl_actions = Context::getSSLActions();
$css_files=Context::getCssFile();
$js_files=Context::getJsFile();
}
<!DOCTYPE html>
<html lang="{str_replace('jp','ja',$lang_type)}" class="xe-mobilelayout">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<block loop="Context::getMetaTag() => $no, $val">
<meta http-equiv="{$val['name']}"|cond="$val['is_http_equiv']" name="{$val['name']}"|cond="!$val['is_http_equiv']" content="{$val['content']}">
</block>
<!--// TITLE -->
<title>{Context::getBrowserTitle()}</title>
<!-- CSS -->
<block loop="$css_files=>$key,$css_file">
<block cond="$css_file['targetie']"><!--[if {$css_file['targetie']}]><block cond="stripos($css_file['targetie'], 'gt') === 0"><!--></block></block>
<link rel="stylesheet" href="{$css_file['file']}" media="{$css_file['media']}"|cond="$css_file['media'] != 'all'" />
<block cond="$css_file['targetie']"><block cond="stripos($css_file['targetie'], 'gt') === 0"><!--</block><![endif]--></block>
</block>
<!-- JS -->
<block loop="$js_files=>$key,$js_file">
<block cond="$js_file['targetie']"><!--[if {$js_file['targetie']}]><block cond="stripos($js_file['targetie'], 'gt') === 0"><!--></block></block>
<script src="{$js_file['file']}"></script>
<block cond="$js_file['targetie']"><block cond="stripos($js_file['targetie'], 'gt') === 0"><!--</block><![endif]--></block>
</block>
<!--// RSS -->
<!--@if($rss_url)-->
<link rel="alternate" type="application/rss+xml" title="RSS" href="{$rss_url}" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" />
<!--@end-->
<!--@if($general_rss_url)-->
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" />
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" />
<!--@end-->
<!--// ICON-->
<link cond="$favicon_url" rel="shortcut icon" href="{$favicon_url}" />
<link cond="$mobicon_url" rel="apple-touch-icon" href="{$mobicon_url}" />
{Context::getHtmlHeader()}
<script>
//<![CDATA[
var current_url = "{$current_url}";
var request_uri = "{$request_uri}";
<block cond="$vid">var xeVid = "{$vid}";</block>
var current_mid = "{$mid}";
var waiting_message = "{$lang->msg_call_server}";
var ssl_actions = new Array(<!--@if(count($ssl_actions))-->"{implode('","',array_keys($ssl_actions))}"<!--@end-->);
var default_url = "{Context::getDefaultUrl()}";
<block cond="Context::get('_http_port')">var http_port = {Context::get("_http_port")};</block>
<block cond="Context::get('_https_port')">var https_port = {Context::get("_https_port")};</block>
<block cond="Context::get('_use_ssl') && Context::get('_use_ssl') == 'always'">var enforce_ssl = true;</block>
//]]>
</script>
</head>
<body{Context::getBodyClass()}>
{Context::getBodyHeader()}
{$content}
{Context::getHtmlFooter()}
<!--// ETC -->
{@ $js_body_files = Context::getJsFile('body') }
<!--@foreach($js_body_files as $key => $js_file)-->
<!--@if($js_file['targetie'])--><!--[if {$js_file['targetie']}]><!--@end-->
<script src="{$js_file['file']}"></script>
<!--@if($js_file['targetie'])--><![endif]--><!--@end-->
<!--@end-->
</body>
</html>

View file

@ -1,48 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo _XE_SITELOCK_TITLE_?></title>
<style>
html,
body {
min-height: 100%;
}
body {
font-size: 12px;
}
h1 {
margin: 0;
font: bold 24px Arial, Helvetica, sans-serif;
color: #666;
}
section {
position: relative;
max-width: 500px;
margin: 100px auto 0 auto;
overflow: hidden;
}
div {
height: 100%;
}
p {
line-height: 1.5;
color: #666;
}
@media only all and (max-width: 480px) {
section {
margin-top: 20px;
}
}
</style>
</head>
<body>
<section>
<div>
<h1><?php echo _XE_SITELOCK_TITLE_?></h1>
<p><?php echo _XE_SITELOCK_MESSAGE_?>&nbsp;</p>
</div>
</section>
</body>
</html>

View file

@ -1,11 +1,11 @@
{
"name": "rhymix/rhymix",
"description": "RhymiX",
"description": "Rhymix",
"homepage": "https://www.rhymix.org",
"license": "GPL-2.0+",
"type": "project",
"authors": [
{ "name": "RhymiX Developers and Contributors", "email": "devops@rhymix.org" },
{ "name": "Rhymix Developers and Contributors", "email": "devops@rhymix.org" },
{ "name": "NAVER", "email": "developers@xpressengine.com" }
],
"require": {

View file

@ -8,7 +8,7 @@
*
* -----------------------------------------------------------------------------
*
* Copyright (c) RhymiX Developers and Contributors <devops@rhymix.org>
* Copyright (c) Rhymix Developers and Contributors <devops@rhymix.org>
* Copyright (c) NAVER <http://www.navercorp.com>
*
* This program is free software: you can redistribute it and/or modify it
@ -26,10 +26,10 @@
*
* -----------------------------------------------------------------------------
*
* RhymiX is a derivative work of XpressEngine (XE) version 1.x.
* Rhymix is a derivative work of XpressEngine (XE) version 1.x.
* The license has been changed from LGPL v2.1 to GPL v2 in accordance with
* section 3 of LGPL v2.1. This change is irreversible and applies to all of
* RhymiX, including parts that were copied verbatim from XpressEngine.
* Rhymix, including parts that were copied verbatim from XpressEngine.
*
* -----------------------------------------------------------------------------
*/
@ -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

@ -227,7 +227,7 @@ class addonAdminController extends addonController
* @param string $isUsed Whether to use
* @return Object
*/
function doInsert($addon, $site_srl = 0, $gtype = 'site', $isUsed = 'N')
function doInsert($addon, $site_srl = 0, $gtype = 'site', $isUsed = 'N', $extra_vars = null)
{
$args = new stdClass;
$args->addon = $addon;
@ -236,6 +236,7 @@ class addonAdminController extends addonController
{
return executeQuery('addon.insertAddon', $args);
}
$args->extra_vars = serialize($extra_vars);
$args->site_srl = $site_srl;
return executeQuery('addon.insertSiteAddon', $args);
}

View file

@ -111,7 +111,7 @@ class addonAdminModel extends addon
if(!in_array($addon_name, array_keys($inserted_addons)))
{
// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
$oAddonAdminController->doInsert($addon_name, $site_srl, $type);
$oAddonAdminController->doInsert($addon_name, $site_srl, $type, 'N', new stdClass);
// Is activated
}
else

View file

@ -25,6 +25,11 @@ class addon extends ModuleObject
$oAddonController->doInsert('resize_image', 0, 'site', 'Y');
$oAddonController->doInsert('openid_delegation_id');
$oAddonController->doInsert('point_level_icon');
$args = new stdClass();
$args->xe_validator_id = 'module/addon/tpl/setup_addon/1';
$args->apply_signup = 'apply';
$args->xe_run_method = 'run_selected';
$oAddonController->doInsert('captcha_member', 0, 'site', 'Y', $args);
$oAddonController->makeCacheFile(0);
return new Object();

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

@ -6,5 +6,6 @@
<column name="addon" var="addon" notnull="notnull" />
<column name="is_used" var="is_used" default="N" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="extra_vars" var="extra_vars" />
</columns>
</query>

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

@ -475,7 +475,6 @@ class adminAdminController extends admin
*/
function procAdminRemoveIcons()
{
$site_info = Context::get('site_module_info');
$virtual_site = '';
if($site_info->site_srl)
@ -495,97 +494,500 @@ class adminAdminController extends admin
}
$this->setMessage('success_deleted');
}
function procAdminUpdateSitelock()
/**
* Update general configuration.
*/
function procAdminUpdateConfigGeneral()
{
$oModuleController = getController('module');
$vars = Context::getRequestVars();
// Site title and HTML footer
$args = new stdClass;
$args->siteTitle = $vars->site_title;
$args->htmlFooter = $vars->html_footer;
$oModuleController->updateModuleConfig('module', $args);
// Index module
$site_args = new stdClass();
$site_args->site_srl = 0;
$site_args->index_module_srl = $vars->index_module_srl;
$site_args->default_language = $vars->default_lang;
$oModuleController->updateSite($site_args);
// Thumbnail settings
$args = new stdClass;
$args->thumbnail_type = $vars->thumbnail_type === 'ratio' ? 'ratio' : 'crop';
$oModuleController->insertModuleConfig('document', $args);
// Default and enabled languages
$enabled_lang = $vars->enabled_lang;
if (!in_array($vars->default_lang, $enabled_lang))
{
$enabled_lang[] = $vars->default_lang;
}
Rhymix\Framework\Config::set('locale.default_lang', $vars->default_lang);
Rhymix\Framework\Config::set('locale.enabled_lang', array_values($enabled_lang));
// Default time zone
Rhymix\Framework\Config::set('locale.default_timezone', $vars->default_timezone);
// Mobile view
Rhymix\Framework\Config::set('use_mobile_view', $vars->use_mobile_view === 'Y');
// Favicon and mobicon
$this->_saveFavicon('favicon.ico', $vars->is_delete_favicon);
$this->_saveFavicon('mobicon.png', $vars->is_delete_mobicon);
// Save
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'));
}
/**
* Update security configuration.
*/
function procAdminUpdateSecurity()
{
$vars = Context::getRequestVars();
$oInstallController = getController('install');
$db_info = Context::getDBInfo();
$db_info->use_sitelock = ($vars->use_sitelock) ? $vars->use_sitelock : 'N';
$db_info->sitelock_title = $vars->sitelock_title;
$db_info->sitelock_message = $vars->sitelock_message;
$whitelist = $vars->sitelock_whitelist;
$whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist);
$whitelist = preg_replace("/\s+/","",$whitelist);
if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
{
$whitelist = '';
}
$whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
$whitelist = explode(',',trim($whitelist, ','));
$whitelist = array_unique($whitelist);
if(!IpFilter::validate($whitelist)) {
// iframe filter
$embed_iframe = $vars->embedfilter_iframe;
$embed_iframe = array_filter(array_map('trim', preg_split('/[\r\n]/', $embed_iframe)), function($item) {
return $item !== '';
});
$embed_iframe = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $embed_iframe));
natcasesort($embed_iframe);
Rhymix\Framework\Config::set('embedfilter.iframe', array_values($embed_iframe));
// object filter
$embed_object = $vars->embedfilter_object;
$embed_object = array_filter(array_map('trim', preg_split('/[\r\n]/', $embed_object)), function($item) {
return $item !== '';
});
$embed_object = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $embed_object));
natcasesort($embed_object);
Rhymix\Framework\Config::set('embedfilter.object', array_values($embed_object));
// Admin IP access control
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_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');
}
$db_info->sitelock_whitelist = $whitelist;
$oInstallController = getController('install');
if(!$oInstallController->makeConfigFile())
{
return new Object(-1, 'msg_invalid_request');
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
$denied_ip = array_unique(array_filter($denied_ip, function($item) {
return $item !== '';
}));
if (!IpFilter::validate($whitelist)) {
return new Object(-1, 'msg_invalid_ip');
}
if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
$oMemberAdminModel = getAdminModel('member');
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
{
$returnUrl = Context::get('success_return_url');
if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
header('location:' . $returnUrl);
return;
return new Object(-1, 'msg_current_ip_will_be_denied');
}
Rhymix\Framework\Config::set('admin.allow', array_values($allowed_ip));
Rhymix\Framework\Config::set('admin.deny', array_values($denied_ip));
// Save
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigSecurity'));
}
function procAdminUpdateEmbedWhitelist()
/**
* Update advanced configuration.
*/
function procAdminUpdateAdvanced()
{
$vars = Context::getRequestVars();
$db_info = Context::getDBInfo();
$white_object = $vars->embed_white_object;
$white_object = preg_replace("/[\r\n|\r|\n]+/", '|@|', $white_object);
$white_object = preg_replace("/[\s\'\"]+/", '', $white_object);
$white_object = explode('|@|', $white_object);
$white_object = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $white_object));
natcasesort($white_object);
$white_iframe = $vars->embed_white_iframe;
$white_iframe = preg_replace("/[\r\n|\r|\n]+/", '|@|', $white_iframe);
$white_iframe = preg_replace("/[\s\'\"]+/", '', $white_iframe);
$white_iframe = explode('|@|', $white_iframe);
$white_iframe = array_unique(array_map(function($item) {
return preg_match('@^https?://(.*)$@i', $item, $matches) ? $matches[1] : $item;
}, $white_iframe));
natcasesort($white_iframe);
$whitelist = array(
'object' => $white_object,
'iframe' => $white_iframe,
);
$db_info->embed_white_object = $white_object;
$db_info->embed_white_iframe = $white_iframe;
$oInstallController = getController('install');
if(!$oInstallController->makeConfigFile())
// Default URL
$default_url = rtrim(trim($vars->default_url), '/\\') . '/';
if (!filter_var($default_url, FILTER_VALIDATE_URL) || !preg_match('@^https?://@', $default_url))
{
return new Object(-1, 'msg_invalid_request');
return new Object(-1, 'msg_invalid_default_url');
}
if (parse_url($default_url, PHP_URL_PATH) !== RX_BASEURL)
{
return new Object(-1, 'msg_invalid_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', $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_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');
Rhymix\Framework\Config::set('session.use_db', $vars->use_db_session === 'Y');
Rhymix\Framework\Config::set('view.minify_scripts', $vars->minify_scripts ?: 'common');
Rhymix\Framework\Config::set('view.gzip', $vars->use_gzip === 'Y');
// Save
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$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'));
}
/**
* Update sitelock configuration.
*/
function procAdminUpdateSitelock()
{
$vars = Context::gets('sitelock_locked', 'sitelock_allowed_ip', 'sitelock_title', 'sitelock_message');
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->sitelock_allowed_ip));
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
return $item !== '';
}));
if ($vars->sitelock_locked === 'Y')
{
$allowed_localhost = false;
$allowed_current = false;
foreach ($allowed_ip as $range)
{
if (Rhymix\Framework\IpFilter::inRange('127.0.0.1', $range))
{
$allowed_localhost = true;
}
if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range))
{
$allowed_current = true;
}
}
if (!$allowed_localhost)
{
array_unshift($allowed_ip, '127.0.0.1');
}
if (!$allowed_current)
{
array_unshift($allowed_ip, RX_CLIENT_IP);
}
}
if (!IpFilter::validate($whitelist))
{
return new Object(-1, 'msg_invalid_ip');
}
Rhymix\Framework\Config::set('lock.locked', $vars->sitelock_locked === 'Y');
Rhymix\Framework\Config::set('lock.title', trim($vars->sitelock_title));
Rhymix\Framework\Config::set('lock.message', trim($vars->sitelock_message));
Rhymix\Framework\Config::set('lock.allow', array_values($allowed_ip));
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigSitelock'));
}
/**
* Update FTP configuration.
*/
function procAdminUpdateFTPInfo()
{
$vars = Context::getRequestVars();
$vars->ftp_path = str_replace('\\', '/', rtrim(trim($vars->ftp_path), '/\\')) . '/';
if (strlen($vars->ftp_pass) === 0)
{
$vars->ftp_pass = Rhymix\Framework\Config::get('ftp.pass');
}
// Test FTP connection.
if ($vars->ftp_sftp !== 'Y')
{
if (!($conn = @ftp_connect($vars->ftp_host, $vars->ftp_port, 3)))
{
return new Object(-1, 'msg_ftp_not_connected');
}
if (!@ftp_login($conn, $vars->ftp_user, $vars->ftp_pass))
{
return new Object(-1, 'msg_ftp_invalid_auth_info');
}
if (!@ftp_pasv($conn, $vars->ftp_pasv === 'Y'))
{
return new Object(-1, 'msg_ftp_cannot_set_passive_mode');
}
if (!@ftp_chdir($conn, $vars->ftp_path))
{
return new Object(-1, 'msg_ftp_invalid_path');
}
ftp_close($conn);
}
else
{
if (!function_exists('ssh2_connect'))
{
return new Object(-1, 'disable_sftp_support');
}
if (!($conn = ssh2_connect($vars->ftp_host, $vars->ftp_port)))
{
return new Object(-1, 'msg_ftp_not_connected');
}
if (!@ssh2_auth_password($conn, $vars->ftp_user, $vars->ftp_pass))
{
return new Object(-1, 'msg_ftp_invalid_auth_info');
}
if (!@($sftp = ssh2_sftp($conn)))
{
return new Object(-1, 'msg_ftp_sftp_error');
}
if (!@ssh2_sftp_stat($sftp, $vars->ftp_path . 'common/defaults/config.php'))
{
return new Object(-1, 'msg_ftp_invalid_path');
}
unset($sftp, $conn);
}
// Save settings.
Rhymix\Framework\Config::set('ftp.host', $vars->ftp_host);
Rhymix\Framework\Config::set('ftp.port', $vars->ftp_port);
Rhymix\Framework\Config::set('ftp.user', $vars->ftp_user);
Rhymix\Framework\Config::set('ftp.pass', $vars->ftp_pass);
Rhymix\Framework\Config::set('ftp.path', $vars->ftp_path);
Rhymix\Framework\Config::set('ftp.pasv', $vars->ftp_pasv === 'Y');
Rhymix\Framework\Config::set('ftp.sftp', $vars->ftp_sftp === 'Y');
Rhymix\Framework\Config::save();
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigFtp'));
}
/**
* Remove FTP configuration.
*/
function procAdminRemoveFTPInfo()
{
Rhymix\Framework\Config::set('ftp.host', null);
Rhymix\Framework\Config::set('ftp.port', null);
Rhymix\Framework\Config::set('ftp.user', null);
Rhymix\Framework\Config::set('ftp.pass', null);
Rhymix\Framework\Config::set('ftp.path', null);
Rhymix\Framework\Config::set('ftp.pasv', true);
Rhymix\Framework\Config::set('ftp.sftp', false);
Rhymix\Framework\Config::save();
$this->setMessage('success_deleted');
}
/**
* Upload favicon and mobicon.
*/
public function procAdminFaviconUpload()
{
if ($favicon = Context::get('favicon'))
{
$name = 'favicon';
$tmpFileName = $this->_saveFaviconTemp($favicon, 'favicon.ico');
}
elseif ($mobicon = Context::get('mobicon'))
{
$name = 'mobicon';
$tmpFileName = $this->_saveFaviconTemp($mobicon, 'mobicon.png');
}
else
{
$name = $tmpFileName = '';
Context::set('msg', Context::getLang('msg_invalid_format'));
}
Context::set('name', $name);
Context::set('tmpFileName', $tmpFileName . '?' . time());
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile("favicon_upload.html");
}
private function _saveFaviconTemp($icon, $iconname)
{
$site_info = Context::get('site_module_info');
$virtual_site = '';
if ($site_info->site_srl)
{
$virtual_site = $site_info->site_srl . '/';
}
if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
$original_filename = $icon['tmp_name'];
$type = $icon['type'];
$relative_filename = 'files/attach/xeicon/'.$virtual_site.'tmp/'.$iconname;
$target_filename = RX_BASEDIR . $relative_filename;
list($width, $height, $type_no, $attrs) = @getimagesize($original_filename);
if ($iconname == 'favicon.ico')
{
$returnUrl = Context::get('success_return_url');
if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
header('location:' . $returnUrl);
if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) {
Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
return;
}
}
elseif ($iconname == 'mobicon.png')
{
if (!preg_match('/^.*(png).*$/',$type))
{
Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
return;
}
if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114')))
{
Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
return;
}
}
else
{
Context::set('msg', Context::getLang('msg_invalid_format'));
return;
}
$fitHeight = $fitWidth = $height;
FileHandler::copyFile($original_filename, $target_filename);
return $relative_filename;
}
private function _saveFavicon($iconname, $deleteIcon = false)
{
$site_info = Context::get('site_module_info');
$virtual_site = '';
if ($site_info->site_srl)
{
$virtual_site = $site_info->site_srl . '/';
}
$image_filepath = RX_BASEDIR . 'files/attach/xeicon/' . $virtual_site;
if ($deleteIcon)
{
FileHandler::removeFile($image_filepath.$iconname);
return;
}
$tmpicon_filepath = $image_filepath.'tmp/'.$iconname;
$icon_filepath = $image_filepath.$iconname;
if (file_exists($tmpicon_filepath))
{
FileHandler::moveFile($tmpicon_filepath, $icon_filepath);
}
FileHandler::removeFile($tmpicon_filepath);
}
}
/* End of file admin.admin.controller.php */
/* Location: ./modules/admin/admin.admin.controller.php */

View file

@ -401,7 +401,6 @@ class adminAdminModel extends admin
, 'widgetstyle' => array(),
);
$info = array();
$db_info = Context::getDBInfo();
$info['type'] = ($type != 'INSTALL' ? 'WORKING' : 'INSTALL');
$info['location'] = _XE_LOCATION_;
@ -412,9 +411,9 @@ class adminAdminModel extends admin
$info['php'] = phpversion();
$info['db_type'] = Context::getDBType();
$info['use_rewrite'] = $db_info->use_rewrite;
$info['use_db_session'] = $db_info->use_db_session == 'Y' ? 'Y' : 'N';
$info['use_ssl'] = $db_info->use_ssl;
$info['use_rewrite'] = config('use_rewrite') ? 'Y' : 'N';
$info['use_db_session'] = config('session.use_db') ? 'Y' : 'N';
$info['use_ssl'] = config('url.ssl') ?: 'none';
$info['phpext'] = '';
foreach(get_loaded_extensions() as $ext)

View file

@ -26,17 +26,7 @@ class adminAdminView extends admin
function __construct()
{
$db_info = Context::getDBInfo();
if(strpos($db_info->default_url, 'xn--') !== FALSE)
{
$xe_default_url = Context::decodeIdna($db_info->default_url);
}
else
{
$xe_default_url = $db_info->default_url;
}
Context::set('xe_default_url', $xe_default_url);
Context::set('xe_default_url', Context::getDefaultUrl());
}
/**
@ -61,30 +51,6 @@ class adminAdminView extends admin
$this->makeGnbUrl();
// Retrieve the list of installed modules
$db_info = Context::getDBInfo();
Context::set('time_zone_list', $GLOBALS['time_zone']);
Context::set('time_zone', $GLOBALS['_time_zone']);
Context::set('use_rewrite', $db_info->use_rewrite == 'Y' ? 'Y' : 'N');
Context::set('use_sso', $db_info->use_sso == 'Y' ? 'Y' : 'N');
Context::set('use_html5', $db_info->use_html5 == 'Y' ? 'Y' : 'N');
Context::set('use_spaceremover', $db_info->use_spaceremover ? $db_info->use_spaceremover : 'Y'); //not use
Context::set('qmail_compatibility', $db_info->qmail_compatibility == 'Y' ? 'Y' : 'N');
Context::set('minify_scripts', $db_info->minify_scripts ?: 'common');
Context::set('delay_session', $db_info->delay_session == 'Y' ? 'Y' : 'N');
Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y');
Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N');
Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none");
if($db_info->http_port)
{
Context::set('http_port', $db_info->http_port);
}
if($db_info->https_port)
{
Context::set('https_port', $db_info->https_port);
}
$this->checkEasyinstall();
}
@ -163,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');
@ -198,7 +165,7 @@ class adminAdminView extends admin
// Admin logo, title setup
$objConfig = $oModuleModel->getModuleConfig('admin');
$gnbTitleInfo = new stdClass();
$gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'RhymiX Admin';
$gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'Admin';
$gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : '';
$browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle;
@ -262,9 +229,6 @@ class adminAdminView extends admin
*/
function dispAdminIndex()
{
$db_info = Context::getDBInfo();
Context::set('db_info',$db_info);
// Get statistics
$args = new stdClass();
$args->date = date("Ymd000000", $_SERVER['REQUEST_TIME'] - 60 * 60 * 24);
@ -338,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':
@ -403,95 +367,197 @@ class adminAdminView extends admin
}
/**
* Display Configuration(settings) page
* Display General Settings page
* @return void
*/
function dispAdminConfigGeneral()
{
Context::loadLang('modules/install/lang');
$db_info = Context::getDBInfo();
Context::set('selected_lang', $db_info->lang_type);
if(strpos($db_info->default_url, 'xn--') !== FALSE)
{
$db_info->default_url = Context::decodeIdna($db_info->default_url);
}
Context::set('default_url', $db_info->default_url);
Context::set('langs', Context::loadLangSupported());
// site lock
Context::set('IP', $_SERVER['REMOTE_ADDR']);
if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...';
if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1';
if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR'];
$db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist);
Context::set('remote_addr', $_SERVER['REMOTE_ADDR']);
Context::set('use_sitelock', $db_info->use_sitelock);
Context::set('sitelock_title', $db_info->sitelock_title);
Context::set('sitelock_message', htmlspecialchars($db_info->sitelock_message, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$whitelist = implode("\r\n", $db_info->sitelock_whitelist);
Context::set('sitelock_whitelist', $whitelist);
if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list);
else $admin_ip_list = '';
Context::set('admin_ip_list', $admin_ip_list);
Context::set('lang_selected', Context::loadLangSelected());
// Default and enabled languages
Context::set('supported_lang', Rhymix\Framework\Lang::getSupportedList());
Context::set('default_lang', Rhymix\Framework\Config::get('locale.default_lang'));
Context::set('enabled_lang', Rhymix\Framework\Config::get('locale.enabled_lang'));
// Site title and HTML footer
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('module');
Context::set('site_title', escape($config->siteTitle));
Context::set('html_footer', escape($config->htmlFooter));
// Index module
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
Context::set('start_module', $start_module);
// Thumbnail settings
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
Context::set('thumbnail_type', $config->thumbnail_type ?: 'crop');
// Default time zone
Context::set('timezones', Rhymix\Framework\DateTime::getTimezoneList());
Context::set('selected_timezone', Rhymix\Framework\Config::get('locale.default_timezone'));
// Mobile view
Context::set('use_mobile_view', config('use_mobile_view') ? 'Y' : 'N');
// Favicon and mobicon
$oAdminModel = getAdminModel('admin');
$favicon_url = $oAdminModel->getFaviconUrl();
$mobicon_url = $oAdminModel->getMobileIconUrl();
Context::set('favicon_url', $favicon_url.'?'.$_SERVER['REQUEST_TIME']);
Context::set('mobicon_url', $mobicon_url.'?'.$_SERVER['REQUEST_TIME']);
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
Context::set('thumbnail_type', $config->thumbnail_type);
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('module');
Context::set('siteTitle', $config->siteTitle);
Context::set('htmlFooter', htmlspecialchars($config->htmlFooter));
// embed filter
$oEmbedFilter = EmbedFilter::getInstance();
context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList));
context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList));
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
Context::set('start_module', $start_module);
Context::set('pwd', $pwd);
$this->setTemplateFile('config_general');
$security = new Security();
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.');
}
/**
* Display Security Settings page
* @return void
*/
function dispAdminConfigSecurity()
{
// Load embed filter.
$oEmbedFilter = EmbedFilter::getInstance();
context::set('embedfilter_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList));
context::set('embedfilter_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList));
// Admin IP access control
$allowed_ip = Rhymix\Framework\Config::get('admin.allow');
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
$denied_ip = Rhymix\Framework\Config::get('admin.deny');
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_security');
}
/**
* Display Advanced Settings page
* @return void
*/
function dispAdminConfigAdvanced()
{
// Default URL
$default_url = Rhymix\Framework\Config::get('url.default');
if(strpos($default_url, 'xn--') !== FALSE)
{
$default_url = Context::decodeIdna($default_url);
}
Context::set('default_url', $default_url);
// SSL and ports
Context::set('use_ssl', Rhymix\Framework\Config::get('url.ssl') ?: 'none');
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'));
Context::set('use_sso', Rhymix\Framework\Config::get('use_sso'));
Context::set('delay_session', Rhymix\Framework\Config::get('session.delay'));
Context::set('use_db_session', Rhymix\Framework\Config::get('session.use_db'));
Context::set('minify_scripts', Rhymix\Framework\Config::get('view.minify_scripts'));
Context::set('use_gzip', Rhymix\Framework\Config::get('view.gzip'));
$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
*/
function dispAdminConfigSitelock()
{
Context::set('sitelock_locked', Rhymix\Framework\Config::get('lock.locked'));
Context::set('sitelock_title', escape(Rhymix\Framework\Config::get('lock.title')));
Context::set('sitelock_message', escape(Rhymix\Framework\Config::get('lock.message')));
$allowed_ip = Rhymix\Framework\Config::get('lock.allow') ?: array();
$allowed_localhost = false;
$allowed_current = false;
foreach ($allowed_ip as $range)
{
if (Rhymix\Framework\IpFilter::inRange('127.0.0.1', $range))
{
$allowed_localhost = true;
}
if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range))
{
$allowed_current = true;
}
}
if (!$allowed_localhost)
{
array_unshift($allowed_ip, '127.0.0.1');
}
if (!$allowed_current)
{
array_unshift($allowed_ip, RX_CLIENT_IP);
}
Context::set('sitelock_allowed_ip', implode(PHP_EOL, $allowed_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_sitelock');
}
/**
* Display FTP Configuration(settings) page
* @return void
*/
function dispAdminConfigFtp()
{
Context::loadLang('modules/install/lang');
$ftp_info = Context::getFTPInfo();
Context::set('ftp_info', $ftp_info);
Context::set('sftp_support', function_exists(ssh2_sftp));
Context::set('ftp_info', Rhymix\Framework\Config::get('ftp'));
Context::set('sftp_support', function_exists('ssh2_sftp'));
$this->setTemplateFile('config_ftp');
//$security = new Security();
//$security->encodeHTML('ftp_info..');
}
/**
* Display Admin Menu Configuration(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

@ -5,6 +5,10 @@
<actions>
<action name="dispAdminIndex" type="view" index="true" />
<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" />
<action name="dispAdminViewServerEnv" type="view" />
@ -18,52 +22,59 @@
<action name="procAdminUpdateConfig" type="controller" />
<action name="procAdminDeleteLogo" type="controller" />
<action name="procAdminMenuReset" type="controller" />
<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="procAdminUpdateEmbedWhitelist" type="controller" />
<action name="procAdminUpdateFTPInfo" type="controller" />
<action name="procAdminRemoveFTPInfo" type="controller" />
<action name="procAdminFaviconUpload" type="controller" />
<action name="getAdminFTPList" type="model" />
<action name="getAdminFTPPath" type="model" />
<action name="getSiteAllList" type="model" />
</actions>
<menus>
<menu name="adminConfigurationGeneral" type="all">
<title xml:lang="en">General</title>
<title xml:lang="ko">일반</title>
<title xml:lang="zh-CN">总览</title>
<title xml:lang="jp">一般</title>
<title xml:lang="es">General</title>
<title xml:lang="ru">General</title>
<title xml:lang="fr">General</title>
<title xml:lang="zh-TW">General</title>
<title xml:lang="vi">General</title>
<title xml:lang="mn">General</title>
<title xml:lang="tr">General</title>
<title xml:lang="en">System Settings</title>
<title xml:lang="ko">시스템 설정</title>
<title xml:lang="zh-CN">系统设置</title>
<title xml:lang="zh-TW">系統設置</title>
<title xml:lang="jp">システムの設定</title>
<title xml:lang="es">System Settings</title>
<title xml:lang="ru">System Settings</title>
<title xml:lang="fr">System Settings</title>
<title xml:lang="zh-TW">System Settings</title>
<title xml:lang="vi">System Settings</title>
<title xml:lang="mn">System Settings</title>
<title xml:lang="tr">System Settings</title>
</menu>
<menu name="adminMenuSetup" type="all">
<title xml:lang="en">Admin Setup</title>
<title xml:lang="ko">관리자 설정</title>
<title xml:lang="zh-CN">后台设置</title>
<title xml:lang="jp">管理者設定</title>
<title xml:lang="es">Admin Setup</title>
<title xml:lang="ru">Admin Setup</title>
<title xml:lang="fr">Admin Setup</title>
<title xml:lang="zh-TW">Admin Setup</title>
<title xml:lang="vi">Admin Setup</title>
<title xml:lang="mn">Admin Setup</title>
<title xml:lang="tr">Admin Setup</title>
<title xml:lang="en">Admin Panel Settings</title>
<title xml:lang="ko">관리자 화면 설정</title>
<title xml:lang="zh-CN">管理者页面设置</title>
<title xml:lang="zh-TW">管理者頁面設置</title>
<title xml:lang="jp">管理者画面の設定</title>
<title xml:lang="es">Admin Panel Settings</title>
<title xml:lang="ru">Admin Panel Settings</title>
<title xml:lang="fr">Admin Panel Settings</title>
<title xml:lang="zh-TW">Admin Panel Settings</title>
<title xml:lang="vi">Admin Panel Settings</title>
<title xml:lang="mn">Admin Panel Settings</title>
<title xml:lang="tr">Admin Panel Settings</title>
</menu>
<menu name="adminConfigurationFtp" type="all">
<title xml:lang="en">FTP Configuration</title>
<title xml:lang="en">FTP Settings</title>
<title xml:lang="ko">FTP 설정</title>
<title xml:lang="zh-CN">FTP 配置</title>
<title xml:lang="zh-CN">FTP设置</title>
<title xml:lang="zh-TW">FTP設置</title>
<title xml:lang="jp">FTP設定</title>
<title xml:lang="es">FTP Configuration</title>
<title xml:lang="ru">FTP Configuration</title>
<title xml:lang="fr">FTP Configuration</title>
<title xml:lang="zh-TW">FTP Configuration</title>
<title xml:lang="vi">FTP Configuration</title>
<title xml:lang="mn">FTP Configuration</title>
<title xml:lang="tr">FTP Configuration</title>
<title xml:lang="es">FTP Settings</title>
<title xml:lang="ru">FTP Settings</title>
<title xml:lang="fr">FTP Settings</title>
<title xml:lang="zh-TW">FTP Settings</title>
<title xml:lang="vi">FTP Settings</title>
<title xml:lang="mn">FTP Settings</title>
<title xml:lang="tr">FTP Settings</title>
</menu>
</menus>
</module>

View file

@ -1,8 +1,11 @@
<?php
$lang->admin = 'Admin';
$lang->subtitle_primary = 'Primary';
$lang->subtitle_advanced = 'Advanced';
$lang->subtitle_etc = 'Others';
$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';
$lang->latest_comments = 'Latest Comments';
@ -81,17 +84,50 @@ $lang->cmd_minify_all = 'All files';
$lang->cmd_minify_common = 'Common files only';
$lang->cmd_minify_none = 'None';
$lang->about_minify_scripts = 'Automatically minify all CSS and JS scripts in the Core and all modules.';
$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.';
$lang->msg_find_xe_path_fail = 'Failed to search Rhymix installed path automatically. Please set manually.';
$lang->msg_ftp_not_connected = 'Failed to connect to FTP server. Please check the hostname and port.';
$lang->msg_ftp_invalid_auth_info = 'Failed to log in to FTP server. Please check your username and password.';
$lang->msg_ftp_cannot_set_passive_mode = 'Failed to set passive mode. Please change your settings and try again.';
$lang->msg_ftp_invalid_path = 'Failed to read the specified FTP Path.';
$lang->msg_ftp_sftp_error = 'Failed to initialize SFTP mode after connecting to SSH server.';
$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';
@ -108,10 +144,13 @@ $lang->input_footer_script = 'Footer script';
$lang->detail_input_footer_script = 'The script is inserted into the bottom of body. It does not work at admin page.';
$lang->corp = 'Crop(Cut)';
$lang->ratio = 'Ratio(Keep Aspect)';
$lang->admin_ip_limit = 'Sepcify IP address band that can access the admin page.';
$lang->admin_ip_allow = 'IP addresses allowed to log in as administrator';
$lang->admin_ip_deny = 'IP addresses forbidden to log in as administrator';
$lang->local_ip_address = 'Local IP address';
$lang->about_admin_ip_limit = 'Specify IP address which can access to admin page. Please note that only the specified IP addresses can access the admin page. The information on IP address band is stored in /files/config/db.config.php. Change the line to multiple IP.';
$lang->detail_about_ftp_info = 'Enable easy installation if you enter FTP information. The information of FTP is stored in files/config/ftp.config.php. If you are unable to easy install, PHP\'s \'safe_mode\' must be changed \'On\'';
$lang->about_admin_ip_allow = 'If this list is not empty, the administrator will only be able to log in from one of the listed IP addresses.';
$lang->about_admin_ip_deny = 'This list can be used to designate IP addresses that are not allowed to log in as administrator.';
$lang->msg_current_ip_will_be_denied = 'The given IP list cannot be applied, as they would block your own IP address.';
$lang->detail_about_ftp_info = 'FTP information is needed for easyinstall when save_mode = on.';
$lang->allow_use_favicon = 'Do you want to use favicon?';
$lang->about_use_favicon = 'You can upload 16x16 size<em>*.ico</em> file only.';
$lang->allow_use_mobile_icon = 'Do you want to use the mobile home screen icon?';
@ -169,6 +208,7 @@ $lang->msg_ftp_connect_success = 'Successfully connected to FTP server and authe
$lang->ftp_path_title = 'FTP Path Information';
$lang->ftp_installed_realpath = 'Absolute Path of Rhymix';
$lang->msg_ftp_installed_ftp_realpath = 'Absolute FTP Path of Rhymix installed';
$lang->msg_ftp_autodetected_ftp_realpath = 'Auto-detected path';
$lang->msg_php_warning_title = 'Warning unsafe PHP version';
$lang->msg_php_warning_notice = 'The server is using a unsafe version of PHP, it is recommended to upgrade to the latest stable version.';
$lang->msg_php_warning_notice_explain = '<li>PHP version of this server can be exposed to serious security problems and attacks.</li><li>Latest version of Rhymix is not available.</li><li>You can not use extensions that are supported by the latest version of Rhymix.</li><li>Some extensions may not work properly. It can cause problems.</li>';
@ -198,6 +238,7 @@ $lang->sitelock_whitelist = 'IPs allowed to access';
$lang->sitelock_title = 'Sign Title';
$lang->sitelock_message = 'Sign Contents';
$lang->sitelock_message_help = 'You can use HTML tags.';
$lang->sitelock_warning_whitelist = 'You should include the IP of the administrator here.<br />If the access is blocked, you can unbrick this by changing `\'use_sitelock\' => \'<strong>Y</strong>\'` to `\'use_sitelock\' => \'<strong>N</strong>\'` in \'./files/config/db.config.php.\'<br />The file of site lock design is at \'./common/tpl/sitelock.html.\'';
$lang->sitelock_warning_whitelist = 'You should include the IP of the administrator here.';
$lang->your_ip = 'Your IP';
$lang->sitelock_in_use = 'Site lock in use';
$lang->sitelock_in_use = 'This site is locked.';
$lang->about_sitelock_in_use = 'Only the administrator and visitors from specified IP addresses can access this site.';

View file

@ -1,8 +1,10 @@
<?php
$lang->admin = '管理者';
$lang->subtitle_primary = '基本';
$lang->subtitle_advanced = '上級';
$lang->subtitle_etc = 'その他';
$lang->cmd_configure = '設定する';
$lang->subtitle_primary = '基本設定';
$lang->subtitle_security = 'セキュリティ設定';
$lang->subtitle_advanced = '上級設定';
$lang->subtitle_etc = 'その他設定';
$lang->current_state = '現況';
$lang->latest_documents = '新着書き込み';
$lang->latest_comments = '新着コメント';
@ -81,8 +83,18 @@ $lang->cmd_minify_all = '全てのファイルを圧縮';
$lang->cmd_minify_common = '共通のファイルを圧縮';
$lang->cmd_minify_none = '圧縮されません';
$lang->about_minify_scripts = 'コアとすべてのモジュールに含まれたCSS、JSファイルを自動的に圧縮(minify)して配信します。';
$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情報削除';
@ -108,9 +120,12 @@ $lang->input_footer_script = '下段footerスクリプト';
$lang->detail_input_footer_script = '最下段にコードを追加します。管理者ページでは遂行できません。';
$lang->corp = '切り取り';
$lang->ratio = 'Ratio(縦横の比率をキープ)';
$lang->admin_ip_limit = '管理者のIPアドレス帯域';
$lang->admin_ip_allow = '管理者ログイン許容IP';
$lang->admin_ip_deny = '管理者ログイン禁止IP';
$lang->local_ip_address = 'ローカルIPアドレス';
$lang->about_admin_ip_limit = '該当IPについてのみ管理者ページへアクセスできるため、注意してください。IP帯域情報は、/files/config/db.config.php ファイルに保存されます。Change the line to multiple IP.';
$lang->about_admin_ip_allow = 'ここでIPアドレスの一覧を表示すると、そのIPのみ、管理者のログインが可能になります。すべてのIPからのログインを許可するには、リストを空白のままに。';
$lang->about_admin_ip_deny = 'ここに記載され、IPアドレスは、管理者のログインが禁止されます。';
$lang->msg_current_ip_will_be_denied = '入力された設定によると、現在ログインして、管理者のIPアドレスもブロックされます。再度確認してください。';
$lang->detail_about_ftp_info = 'FTP情報を入力すれば簡単設置を可能にします。FTP情報は files/config/ftp.config.php ファイルに保存されます。簡単設置ができない場合、PHPのsafe_modeをOnへ変更が必要です。';
$lang->allow_use_favicon = 'ファビコン設定';
$lang->about_use_favicon = '16 x 16 サイズの<em>*.ico</em> ファイルのみ登録できます。';
@ -193,5 +208,7 @@ $lang->sitelock_whitelist = '接近許可IP';
$lang->sitelock_title = '案内文タイトル';
$lang->sitelock_message = '案内文内容';
$lang->sitelock_message_help = 'HTMLタグを使用できます。';
$lang->sitelock_warning_whitelist = 'ここに管理者のIPを必ず記入てください。<br />もし接近が遮断された場合、\'./files/config/db.config.php\' ファイルから `\'use_sitelock\' => \'<strong>Y</strong>\'`を `\'use_sitelock\' => \'<strong>N</strong>\'`へ変更すれば遮断が解除できます。<br />サイトロックの設計ファイルの場所は、\'./commo/tpl/sitelock.html\' です。';
$lang->sitelock_warning_whitelist = 'ここに管理者のIPを必ず記入てください。';
$lang->your_ip = '接続したIP';
$lang->sitelock_in_use = 'サイトロック状態です。';
$lang->about_sitelock_in_use = '管理者との接続が許可されたIPのみのサイトの利用が可能です。';

View file

@ -1,7 +1,10 @@
<?php
$lang->admin = '관리자';
$lang->subtitle_primary = '기본';
$lang->subtitle_advanced = '고급';
$lang->cmd_configure = '설정하기';
$lang->subtitle_primary = '기본 설정';
$lang->subtitle_security = '보안 설정';
$lang->subtitle_advanced = '고급 설정';
$lang->subtitle_debug = '디버그 설정';
$lang->subtitle_etc = '기타';
$lang->current_state = '현황';
$lang->latest_documents = '최근 글';
@ -81,17 +84,47 @@ $lang->cmd_minify_all = '모든 파일을 압축';
$lang->cmd_minify_common = '공통 파일만 압축';
$lang->cmd_minify_none = '압축하지 않음';
$lang->about_minify_scripts = '코어와 모든 모듈에 포함된 CSS, JS 파일들을 자동으로 압축(minify)하여 전송합니다.';
$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 정보 삭제';
$lang->msg_find_xe_path_fail = 'Rhymix 설치 경로를 자동으로 찾지 못하였습니다. 수동 설정해주세요.';
$lang->msg_ftp_invalid_path = 'FTP 경로(Path)를 읽을 수 없습니다.';
$lang->msg_ftp_not_connected = 'FTP 서버에 접속할 수 없습니다. 주소와 포트를 확인해 주십시오.';
$lang->msg_ftp_invalid_auth_info = 'FTP 서버에 로그인할 수 없습니다. 아이디와 비밀번호를 확인해 주십시오.';
$lang->msg_ftp_cannot_set_passive_mode = 'Passive 모드 설정에 실패하였습니다. 설정을 변경하여 다시 시도해 주십시오.';
$lang->msg_ftp_invalid_path = 'FTP 서버에서 입력하신 설치 경로를 찾을 수 없습니다.';
$lang->msg_ftp_sftp_error = 'SSH 서버에 접속한 후 SFTP 모드로 전환하는 데 실패했습니다.';
$lang->use_ftp_passive_mode = 'Passive 모드 사용';
$lang->use_sftp_support = 'SFTP 사용';
$lang->disable_sftp_support = 'SFTP를 사용하시려면 ssh2 PHP 모듈을 설치하셔야 합니다.';
$lang->msg_self_restart_cache_engine = 'Memcached 또는 캐쉬데몬을 재시작 해주세요.';
$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 = '이번주';
@ -108,10 +141,13 @@ $lang->input_footer_script = '하단(footer) 스크립트';
$lang->detail_input_footer_script = '최하단에 코드를 삽입합니다. 관리자 페이지에서는 수행되지 않습니다.';
$lang->corp = 'Crop(잘라내기)';
$lang->ratio = 'Ratio(비율 맞추기)';
$lang->admin_ip_limit = '관리자 IP대역';
$lang->admin_ip_allow = '관리자 로그인 허용 IP';
$lang->admin_ip_deny = '관리자 로그인 금지 IP';
$lang->local_ip_address = '로컬 IP 주소';
$lang->about_admin_ip_limit = '관리자 페이지로 접근가능한 IP대역을 지정합니다. 해당 IP에 대해서만 관리자 페이지로 접근이 가능하므로 주의 바랍니다. IP대역 정보는 /files/config/db.config.php 파일에 저장됩니다. 여러개의 항목은 줄을 바꾸어 입력하세요.';
$lang->detail_about_ftp_info = 'FTP 정보를 입력하면 쉬운 설치를 가능하도록 합니다. FTP 정보는 files/config/ftp.config.php 파일에 저장됩니다. 쉬운 설치가 불가능한 경우 PHP의 safe_mode를 On으로 변경해야 합니다.';
$lang->about_admin_ip_allow = '여기에 IP 주소를 나열하면 해당 IP에서만 관리자 로그인이 가능하게 됩니다. 모든 IP에서 로그인을 허용하려면 목록을 비워 두십시오.';
$lang->about_admin_ip_deny = '여기에 나열된 IP 주소에서는 관리자 로그인이 금지됩니다.';
$lang->msg_current_ip_will_be_denied = '주어진 설정에 따르면 현재 로그인하신 관리자의 IP 주소도 차단됩니다. 다시 확인해 주십시오.';
$lang->detail_about_ftp_info = 'safe_mode = on 상태에서 쉬운설치를 사용하려면 FTP 정보를 입력해야 합니다.';
$lang->allow_use_favicon = '파비콘 지정';
$lang->about_use_favicon = '16 x 16 크기의<em>*.ico</em> 파일 업로드 권장.';
$lang->allow_use_mobile_icon = '모바일 홈 화면 아이콘';
@ -156,7 +192,7 @@ $lang->server_env = '서버 정보';
$lang->ftp_form_title = 'FTP 계정 정보 입력';
$lang->ftp = 'FTP';
$lang->ftp_host = 'FTP 서버 주소';
$lang->ftp_port = 'FTP port';
$lang->ftp_port = 'FTP 포트';
$lang->about_ftp_password = '비밀번호는 FTP 경로 확인을 위한 FTP 접속 시 필요하며 사용 후 저장하지 않습니다.';
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
$lang->msg_safe_mode_ftp_needed = 'PHP의<strong>safe_mode=On</strong>일 경우 Rhymix의 정상적인 동작을 돕습니다.';
@ -167,8 +203,9 @@ $lang->msg_ftp_mkdir_fail = 'FTP를 이용한 디렉토리 생성 명령에 실
$lang->msg_ftp_chmod_fail = 'FTP를 이용한 디렉토리의 속성 변경에 실패했습니다. FTP 서버의 설정을 확인해주세요.';
$lang->msg_ftp_connect_success = 'FTP 접속 및 인증에 성공했습니다.';
$lang->ftp_path_title = 'FTP 경로 정보 입력';
$lang->ftp_installed_realpath = '설치된 Rhymix의 절대경로';
$lang->msg_ftp_installed_ftp_realpath = '설치된 Rhymix의 FTP 경로';
$lang->ftp_installed_realpath = 'Rhymix 설치 경로';
$lang->msg_ftp_installed_ftp_realpath = 'Rhymix 설치 경로';
$lang->msg_ftp_autodetected_ftp_realpath = '자동 감지된 경로';
$lang->msg_php_warning_title = '안전하지 않은 PHP 버전 경고';
$lang->msg_php_warning_notice = '이 서버는 안전하지 않은 PHP 버전을 사용하고 있으며, PHP를 최신 안정 버전으로 업그레이드를 권장합니다.';
$lang->msg_php_warning_notice_explain = '<li>매우 심각한 PHP 보안 문제 및 공격에 노출될 수 있습니다.</li><li>Rhymix 최신 버전을 사용할 수 없습니다.</li><li>Rhymix 최신 버전 이상에서 지원하는 확장 기능을 사용할 수 없습니다.</li><li>일부 확장 기능이 동작하지 않거나, 이로 인해 장애가 발생할 수 있습니다.</li>';
@ -198,7 +235,7 @@ $lang->sitelock_whitelist = '접근 허용 IP';
$lang->sitelock_title = '안내문 제목';
$lang->sitelock_message = '안내문 내용';
$lang->sitelock_message_help = 'HTML 태그를 사용할 수 있습니다.';
$lang->sitelock_warning_whitelist = '이곳에 관리자의 IP를 반드시 포함해야 합니다.<br />만약 접근이 차단된 경우 \'./files/config/db.config.php\' 파일에서 `\'use_sitelock\' => \'<strong>Y</strong>\'`를 `\'use_sitelock\' => \'<strong>N</strong>\'`으로 변경하여 차단을 해제할 수 있습니다.<br />사이트 잠금 디자인 파일의 위치는 \'./common/tpl/sitelock.html\' 입니다.';
$lang->sitelock_warning_whitelist = '사이트 잠금 사용시 관리자의 IP가 반드시 이 목록에 포함되어야 합니다.';
$lang->your_ip = '접속하신 IP';
$lang->sitelock_in_use = '사이트 잠금을 사용중입니다.';
$lang->about_sitelock_in_use = '관리자 페이지에서 허용한 IP를 제외한 사용자는 접속할 수 없습니다.';
$lang->sitelock_in_use = '사이트 잠금 상태입니다.';
$lang->about_sitelock_in_use = '관리자 및 접속이 허용된 IP에서만 사이트 이용이 가능합니다.';

View file

@ -93,7 +93,7 @@ $lang->input_footer_script = 'Alt (footer) Script Eklemek';
$lang->detail_input_footer_script = 'Script alt tarafa eklenmiştir. Yönetici sayfası çalışmıyor.';
$lang->corp = 'Crop (Kesme)';
$lang->ratio = 'Ratio(Yüzde Ayarı)';
$lang->admin_ip_limit = 'Yönetici sayfasına ulaşabileceğiniz IP aralığını belirleyiniz.';
$lang->admin_ip_allow = 'Yönetici sayfasına ulaşabileceğiniz IP aralığını belirleyiniz.';
$lang->local_ip_address = 'Yerel IP adresi';
$lang->about_admin_ip_limit = 'Sadece bu IP adresi üzerinden yönetici sayfasına erişim mümkündür.IP-bant bilgileri /files/config/db.config.php dosyasında saklanır. Satıra birden fazla öğe girin.';
$lang->detail_about_ftp_info = 'Kolay kurulum sağlayan FTP bilgilerini girdiğinizde. FTP bilgi, dosya / config / ftp.config.php dosyasında saklanır. Kolay yükleme sizin için mümkün değilse, PHP\'nin safe_mode ayarını On şeklinde değiştiriniz.';

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