diff --git a/.gitignore b/.gitignore index 2917e66cb..1ab6c7b20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ .DS_Store Thumbs.db -config.user.inc.php +/config/config.user.inc.php +/config/install.config.php /files/ /build/ /libs/ diff --git a/.travis.yml b/.travis.yml index 7686fb2d4..23ccb125a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5053ce24..7e482d998 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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()` 등의 함수와 함께 사용합니다. diff --git a/COPYRIGHT b/COPYRIGHT index f04e44091..6c9ed950e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,2 +1,2 @@ -Copyright (c) RhymiX Developers and Contributors +Copyright (c) Rhymix Developers and Contributors Copyright (c) NAVER diff --git a/Gruntfile.js b/Gruntfile.js index 66be1ac71..243a6a552 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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, diff --git a/README.md b/README.md index d81b41b63..7c3975e43 100644 --- a/README.md +++ b/README.md @@ -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 라이선스의 적용을 받습니다. diff --git a/addons/member_communication/conf/info.xml b/addons/member_communication/conf/info.xml index 00f38f2f1..d9419aec7 100644 --- a/addons/member_communication/conf/info.xml +++ b/addons/member_communication/conf/info.xml @@ -1,45 +1,16 @@ - 커뮤니케이션 - コミュニケーション - 会员交流 - Communication - Truyền thông - 커뮤니케이션 - 커뮤니케이션 - Общение - 交流 + [DEPRECATED] 커뮤니케이션 + [DEPRECATED] コミュニケーション + [DEPRECATED] 会员交流 + [DEPRECATED] Communication + [DEPRECATED] Truyền thông + [DEPRECATED] Communication + [DEPRECATED] Communication + [DEPRECATED] Общение + [DEPRECATED] 交流 - 커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다. - 쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다. - - - メッセージ・友達機能を使うにはこのアドオンを「使用」にして下さい。 - - - 此插件可激活短信箱及添加好友功能。 - - - 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. - - - 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. - - - 커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다. - 쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다. - - - 커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다. - 쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다. - - - Активизирует модуль Общение, позволяет использование сообщений между друзьями. - - - 讓會員擁有短訊和新增好友功能。 + [DEPRECATED] 이 애드온은 빈 애드온입니다. 모든 기능은 커뮤니케이션 모듈로 이전되었습니다. 1.7 2013-11-27 @@ -56,39 +27,5 @@ NAVER - - 알람기능 사용 - Using alarm - Using alarm - Using alarm - Using alarm - Using alarm - Using alarm - 새로운 쪽지가 왔을때 팝업으로 알립니다. - Pop-up alram when new message received. - Pop-up alram when new message received. - Pop-up alram when new message received. - Pop-up alram when new message received. - Pop-up alram when new message received. - Pop-up alram when new message received. - - 사용함 - Using - Using - Using - Using - Using - Using - - - 사용하지 않음 - Not using - Not using - Not using - Not using - Not using - Not using - - - + \ No newline at end of file diff --git a/addons/member_communication/lang/en.php b/addons/member_communication/lang/en.php deleted file mode 100644 index bdfbfc3ce..000000000 --- a/addons/member_communication/lang/en.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?'; diff --git a/addons/member_communication/lang/es.php b/addons/member_communication/lang/es.php deleted file mode 100644 index 146c9b962..000000000 --- a/addons/member_communication/lang/es.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?'; diff --git a/addons/member_communication/lang/ja.php b/addons/member_communication/lang/ja.php deleted file mode 100644 index 39a7d3c53..000000000 --- a/addons/member_communication/lang/ja.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか?'; diff --git a/addons/member_communication/lang/ko.php b/addons/member_communication/lang/ko.php deleted file mode 100644 index c3e865818..000000000 --- a/addons/member_communication/lang/ko.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?'; diff --git a/addons/member_communication/lang/ru.php b/addons/member_communication/lang/ru.php deleted file mode 100644 index 4b132bd1b..000000000 --- a/addons/member_communication/lang/ru.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = 'У Вас новые сообщения. Проверите сейчас?'; diff --git a/addons/member_communication/lang/vi.php b/addons/member_communication/lang/vi.php deleted file mode 100644 index e27acc310..000000000 --- a/addons/member_communication/lang/vi.php +++ /dev/null @@ -1,2 +0,0 @@ -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?'; diff --git a/addons/member_communication/lang/zh-CN.php b/addons/member_communication/lang/zh-CN.php deleted file mode 100644 index 51f4fc2e6..000000000 --- a/addons/member_communication/lang/zh-CN.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = '您有新消息。要确认吗?'; diff --git a/addons/member_communication/lang/zh-TW.php b/addons/member_communication/lang/zh-TW.php deleted file mode 100644 index 4a4798b01..000000000 --- a/addons/member_communication/lang/zh-TW.php +++ /dev/null @@ -1,2 +0,0 @@ -alert_new_message_arrived = '您收到 %d 個新訊息。要檢視嗎?'; diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php index 0c660c1e9..c6498c297 100644 --- a/addons/member_communication/member_communication.addon.php +++ b/addons/member_communication/member_communication.addon.php @@ -1,85 +1,6 @@ */ +/* 이 애드온의 기능은 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(""); - } -} -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 */ diff --git a/addons/member_communication/tpl/member_communication.js b/addons/member_communication/tpl/member_communication.js deleted file mode 100644 index d92c813ea..000000000 --- a/addons/member_communication/tpl/member_communication.js +++ /dev/null @@ -1,26 +0,0 @@ -(function($){ -window.xeNotifyMessage = function(text, count){ - var $bar; - $bar = $('div.message.info'); - if(!$bar.length) { - $bar = $('
') - .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('

'+text+'

').height(); - else - h = $bar.html('

'+text+'

').height(); - $bar.show().animate({top:0}); - // hide after 10 seconds - setTimeout(function(){ - $bar.slideUp(); - }, 5000); -}; -})(jQuery); diff --git a/addons/point_level_icon/conf/info.xml b/addons/point_level_icon/conf/info.xml index 174175fca..6bbe48857 100644 --- a/addons/point_level_icon/conf/info.xml +++ b/addons/point_level_icon/conf/info.xml @@ -59,4 +59,29 @@ NAVER NAVER + + + + 아이콘 중복 설정 + 아이콘 중복 설정을 적용할 경우 그룹아이콘이 있을때 포인트 레벨 아이콘은 띄우지 않도록 합니다. + + 적용하지 않음 + 不启用 + 적용하지 않음 + 關閉 + Not apply + Not apply + Không áp dụng + + + 적용 + 启用 + 적용 + 開啟 + Apply + Apply + Áp dụng + + + diff --git a/addons/point_level_icon/point_level_icon.addon.php b/addons/point_level_icon/point_level_icon.addon.php index 69f7eb8d9..fd3b2919e 100644 --- a/addons/point_level_icon/point_level_icon.addon.php +++ b/addons/point_level_icon/point_level_icon.addon.php @@ -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; diff --git a/addons/point_level_icon/point_level_icon.lib.php b/addons/point_level_icon/point_level_icon.lib.php index 9dd9e3054..f72b46359 100644 --- a/addons/point_level_icon/point_level_icon.lib.php +++ b/addons/point_level_icon/point_level_icon.lib.php @@ -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] . ''; + // Check Group Image Mark + $oMemberModel = getModel('member'); + if($oMemberModel->getGroupImageMark($member_srl)) + { + return $orig_text . $matches[5] . ''; + } } if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) diff --git a/classes/cache/CacheHandler.class.php b/classes/cache/CacheHandler.class.php index 39a038999..f98c77def 100644 --- a/classes/cache/CacheHandler.class.php +++ b/classes/cache/CacheHandler.class.php @@ -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; } diff --git a/classes/cache/CacheMemcache.class.php b/classes/cache/CacheMemcache.class.php index b37019ab6..c7ba54d93 100644 --- a/classes/cache/CacheMemcache.class.php +++ b/classes/cache/CacheMemcache.class.php @@ -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(); } } diff --git a/classes/cache/CacheRedis.class.php b/classes/cache/CacheRedis.class.php index 0c8742ba5..028b1341c 100644 --- a/classes/cache/CacheRedis.class.php +++ b/classes/cache/CacheRedis.class.php @@ -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; } } diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 56eeab0cc..d3f6914ea 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -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; } /** diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 6a5a6cc1e..fbc205adc 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -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[] = ''; + $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) diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index aaff4c6c3..9059b99ce 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -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()) { diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index 7dda69d35..c6d150b8c 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -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); diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 268ce952d..1b5264ed8 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -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()) { diff --git a/classes/db/DBMysqli.class.php b/classes/db/DBMysqli.class.php index 95bfb4d3f..8c425be45 100644 --- a/classes/db/DBMysqli.class.php +++ b/classes/db/DBMysqli.class.php @@ -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 diff --git a/classes/db/queryparts/table/CubridTableWithHint.class.php b/classes/db/queryparts/table/CubridTableWithHint.class.php index a8b1e1640..9f614a816 100644 --- a/classes/db/queryparts/table/CubridTableWithHint.class.php +++ b/classes/db/queryparts/table/CubridTableWithHint.class.php @@ -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) { diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 15a71f809..f48da0460 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -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; // / 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('', RX_BASEURL, 'common/js/debug.js', filemtime(RX_BASEDIR . 'common/js/debug.js')); + if (isset($_SESSION['_rx_debug_previous'])) + { + $panel_script .= "\n"; + unset($_SESSION['_rx_debug_previous']); + } + $panel_script .= "\n"; + $body_end_position = strrpos($output, '') ?: 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 ""; - } - - // 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\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 = '' . "\n"; + } + else + { + $phpheader = ''; + } + FileHandler::writeFile($log_filename, $phpheader . $content, 'a'); + return ''; + } + else + { + return ''; + } } } diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 777548bcf..2254c2694 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -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 in body to the header $output = preg_replace_callback('!(.*?)<\/style>!is', array($this, '_moveStyleToHeader'), $output); @@ -218,10 +209,7 @@ class HTMLDisplayHandler $output = preg_replace_callback('@]*\sname="' . $keys . '".+@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); diff --git a/classes/extravar/Extravar.class.php b/classes/extravar/Extravar.class.php index 224de5255..3960d4d94 100644 --- a/classes/extravar/Extravar.class.php +++ b/classes/extravar/Extravar.class.php @@ -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++) diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index 8c36ab1a5..38758d4ef 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -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])) diff --git a/classes/mail/Mail.class.php b/classes/mail/Mail.class.php index 3877adaba..c2d9725db 100644 --- a/classes/mail/Mail.class.php +++ b/classes/mail/Mail.class.php @@ -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 */ class Mail diff --git a/classes/mobile/Mobile.class.php b/classes/mobile/Mobile.class.php index 4b4bc6e22..5b3528621 100644 --- a/classes/mobile/Mobile.class.php +++ b/classes/mobile/Mobile.class.php @@ -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'); } } diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 9e3c7807c..1567df78b 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -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()) { diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 18838295b..b6e994f30 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -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') { diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index f82bdc0f5..2f90a753e 100644 --- a/classes/security/EmbedFilter.class.php +++ b/classes/security/EmbedFilter.class.php @@ -1,8 +1,6 @@ */ -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; } diff --git a/classes/security/phphtmlparser/LICENSE b/classes/security/phphtmlparser/LICENSE deleted file mode 100755 index e76b18587..000000000 --- a/classes/security/phphtmlparser/LICENSE +++ /dev/null @@ -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. - * ==================================================================== - * - */ - diff --git a/classes/security/phphtmlparser/src/html2text.inc b/classes/security/phphtmlparser/src/html2text.inc deleted file mode 100755 index 72384e950..000000000 --- a/classes/security/phphtmlparser/src/html2text.inc +++ /dev/null @@ -1,214 +0,0 @@ -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; - } -} diff --git a/classes/security/phphtmlparser/src/htmlparser.inc b/classes/security/phphtmlparser/src/htmlparser.inc deleted file mode 100755 index 7cc718dbd..000000000 --- a/classes/security/phphtmlparser/src/htmlparser.inc +++ /dev/null @@ -1,365 +0,0 @@ -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?> diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index dcdd16b1b..ea4f6a1dd 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -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; } diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index 521396ddb..327d0219f 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -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; } diff --git a/classes/xml/xmlquery/queryargument/DefaultValue.class.php b/classes/xml/xmlquery/queryargument/DefaultValue.class.php index 455d06537..0e0d53471 100644 --- a/classes/xml/xmlquery/queryargument/DefaultValue.class.php +++ b/classes/xml/xmlquery/queryargument/DefaultValue.class.php @@ -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' : diff --git a/common/autoload.php b/common/autoload.php index c4925cc87..49bc48ef0 100644 --- a/common/autoload.php +++ b/common/autoload.php @@ -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); diff --git a/common/constants.php b/common/constants.php index d084ed0f4..31f4a7333 100644 --- a/common/constants.php +++ b/common/constants.php @@ -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. diff --git a/common/css/xe.css b/common/css/xe.css index 2bdbb9740..c02a052e5 100644 --- a/common/css/xe.css +++ b/common/css/xe.css @@ -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; +} diff --git a/common/debug.php b/common/debug.php deleted file mode 100644 index 0e56fac0b..000000000 --- a/common/debug.php +++ /dev/null @@ -1,149 +0,0 @@ - - */ - -/** - * 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); -} diff --git a/common/defaults/config.php b/common/defaults/config.php index 20c3d7894..71ee5ff4f 100644 --- a/common/defaults/config.php +++ b/common/defaults/config.php @@ -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(), +); diff --git a/common/defaults/lang.php b/common/defaults/lang.php index 7317918b5..fe754781d 100644 --- a/common/defaults/lang.php +++ b/common/defaults/lang.php @@ -1,7 +1,7 @@ or tag + /** + * Allowed domains in or tag + */ 'object' => array( // YouTube 'www.youtube.com/', @@ -49,7 +56,9 @@ return array( 'sbsplayer.sbs.co.kr/', ), - // Allowed domains in "); + } + + } + elseif($act == 'getMemberMenu') + { + $member_srl = Context::get('target_srl'); + $oCommunicationModel = getModel('communication'); + $logged_info = Context::get('logged_info'); + // Add a feature to display own message box. + if($logged_info->member_srl == $member_srl) + { + $mid = Context::get('cur_mid'); + $oMemberController = getController('member'); + // Add your own viewing Note Template + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); + // Display a list of friends + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); + // If not, Add menus to send message and to add friends + } + else + { + // Get member information + $oMemberModel = getModel('member'); + $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); + if(!$target_member_info->member_srl) + { + return new Object(); + } + + $oMemberController = getController('member'); + // Add a menu for sending message + if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) + { + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); + } + // Add a menu for listing friends (if a friend is new) + if(!$oCommunicationModel->isAddedFriend($member_srl)) + { + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); + } + } + } + } } /* End of file communication.controller.php */ /* Location: ./modules/comment/communication.controller.php */ diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index 6a466f853..753bb2132 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -51,10 +51,15 @@ class communicationModel extends communication { $communication_config->mskin = 'default'; } - + if(!$communication_config->grant_write) { - $communication_config->grant_write = array('default_grant'=>'member'); + $communication_config->grant_write = array('default_grant' => 'member'); + } + + if(!$communication_config->member_menu) + { + $communication_config->member_menu = 'Y'; } return $communication_config; @@ -228,6 +233,22 @@ class communicationModel extends communication return $message; } + function getNewMessageCount($member_srl = null) + { + if(!$member_srl) + { + $logged_info = Context::get('logged_info'); + $member_srl = $logged_info->member_srl; + } + + $args = new stdClass(); + $args->receiver_srl = $member_srl; + $args->readed = 'N'; + + $output = executeQuery('communication.getNewMessageCount', $args); + return $output->data->count; + } + /** * get a message list * @param string $message_type (R: Received Message, S: Sent Message, T: Archive) diff --git a/modules/communication/lang/en.php b/modules/communication/lang/en.php index 550842e2c..4289cec4c 100644 --- a/modules/communication/lang/en.php +++ b/modules/communication/lang/en.php @@ -34,3 +34,4 @@ $lang->message_notice = 'Send a message to the author about this. If you don\'t $lang->friends_page_does_not_support = 'Friends in a mobile environment is not supported. Please go to the PC page.'; $lang->cmd_write_communication = 'Write Grant'; $lang->cmd_manage_base = 'Basic infomation'; +$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?'; diff --git a/modules/communication/lang/es.php b/modules/communication/lang/es.php index f60b5dee8..789ed1c77 100644 --- a/modules/communication/lang/es.php +++ b/modules/communication/lang/es.php @@ -28,3 +28,4 @@ $lang->msg_content_is_null = 'Por favor ingresar el contenido'; $lang->msg_allow_message_to_friend = 'Falló el envío por permitir sólo mensajes de sus amigos'; $lang->msg_disallow_message = 'Falló el envío por ser usuario rechazado para recibir mensajes'; $lang->about_allow_message = 'Usted puede decidir la recepción del mensaje'; +$lang->alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?'; diff --git a/modules/communication/lang/ja.php b/modules/communication/lang/ja.php index 0e11f9b44..b0a821f76 100644 --- a/modules/communication/lang/ja.php +++ b/modules/communication/lang/ja.php @@ -32,3 +32,4 @@ $lang->msg_disallow_message = 'メッセージの受信を拒否している受 $lang->about_allow_message = 'メッセージを受信するか設定します。'; $lang->message_notice = '作成者にメッセージを送信し、知らせます。作成しなければ送信されません。'; $lang->friends_page_does_not_support = 'モバイル環境では友達リストページをサポートしません。PC画面へ移動してください。'; +$lang->alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか?'; diff --git a/modules/communication/lang/ko.php b/modules/communication/lang/ko.php index 3def19bbe..fc7b22f74 100644 --- a/modules/communication/lang/ko.php +++ b/modules/communication/lang/ko.php @@ -34,3 +34,4 @@ $lang->message_notice = '저작자에게 쪽지를 발송해서 이 사실을 $lang->friends_page_does_not_support = '모바일 환경에서는 친구 보기 페이지를 지원하지 않습니다. PC 화면으로 이동하세요.'; $lang->cmd_write_communication = '작성 권한'; $lang->cmd_manage_base = '기본 정보'; +$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?'; diff --git a/modules/communication/lang/ru.php b/modules/communication/lang/ru.php index fb3a21f48..cb9f9fde3 100644 --- a/modules/communication/lang/ru.php +++ b/modules/communication/lang/ru.php @@ -29,3 +29,4 @@ $lang->msg_content_is_null = 'Пожалуйста, введите содерж $lang->msg_allow_message_to_friend = 'Сообщение не отправлено, поскольку являетесь пользователем, имеющим право посылать сообщения только друзьям'; $lang->msg_disallow_message = 'Сообщение не отправлено, поскольку получатель запретил прием сообщений'; $lang->about_allow_message = 'Вы можете установить режим принятия сообщений'; +$lang->alert_new_message_arrived = 'У Вас новые сообщения. Проверите сейчас?'; diff --git a/modules/communication/lang/vi.php b/modules/communication/lang/vi.php index ecf6d6723..cfd796f53 100644 --- a/modules/communication/lang/vi.php +++ b/modules/communication/lang/vi.php @@ -29,3 +29,4 @@ $lang->msg_content_is_null = 'Xin vui lòng nhập nội dung.'; $lang->msg_allow_message_to_friend = 'Không thể gửi vì người nhận chỉ chấp nhận những tin nhắn từ bạn bè của họ.'; $lang->msg_disallow_message = 'Không thể gửi vì người nhận đã từ chối nhận tin nhắn.'; $lang->about_allow_message = 'Bạn có thể đồng ý nhận tin nhắn.'; +$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?'; diff --git a/modules/communication/lang/zh-CN.php b/modules/communication/lang/zh-CN.php index 4f05d282e..a020a4b92 100644 --- a/modules/communication/lang/zh-CN.php +++ b/modules/communication/lang/zh-CN.php @@ -29,3 +29,4 @@ $lang->msg_content_is_null = '请输入内容。'; $lang->msg_allow_message_to_friend = '因其为只允许接收好友短消息的用户,所以不能发送短消息。'; $lang->msg_disallow_message = '因其为拒绝接收短消息的用户,所以不能发送短消息。'; $lang->about_allow_message = '可以选择短消息接收与否。'; +$lang->alert_new_message_arrived = '您有新消息。要确认吗?'; diff --git a/modules/communication/lang/zh-TW.php b/modules/communication/lang/zh-TW.php index 97cc047ce..f2dafd5e9 100644 --- a/modules/communication/lang/zh-TW.php +++ b/modules/communication/lang/zh-TW.php @@ -29,3 +29,4 @@ $lang->msg_content_is_null = '請輸入內容。'; $lang->msg_allow_message_to_friend = '只允許接收好友短訊息的用戶,不能發送短訊息。'; $lang->msg_disallow_message = '拒絕接收短訊息的用戶,不能發送短訊息。'; $lang->about_allow_message = '可選擇是否接收短訊息。'; +$lang->alert_new_message_arrived = '您收到 %d 個新訊息。要檢視嗎?'; diff --git a/modules/communication/queries/getNewMessageCount.xml b/modules/communication/queries/getNewMessageCount.xml new file mode 100644 index 000000000..9ef32c1e0 --- /dev/null +++ b/modules/communication/queries/getNewMessageCount.xml @@ -0,0 +1,15 @@ + + + +
+ + + + + + + + + + + diff --git a/modules/communication/tpl/index.html b/modules/communication/tpl/index.html index 7f21fa105..da496c9b0 100644 --- a/modules/communication/tpl/index.html +++ b/modules/communication/tpl/index.html @@ -99,7 +99,12 @@ - +
+ +
+ +
+
diff --git a/modules/communication/tpl/js/member_communication.js b/modules/communication/tpl/js/member_communication.js new file mode 100644 index 000000000..78f6501e2 --- /dev/null +++ b/modules/communication/tpl/js/member_communication.js @@ -0,0 +1,26 @@ +(function($){ + window.xeNotifyMessage = function(text, count){ + var $bar; + $bar = $('div.message.info'); + if(!$bar.length) { + $bar = $('
') + .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('

'+text+'

').height(); + else + h = $bar.html('

'+text+'

').height(); + $bar.show().animate({top:0}); + // hide after 10 seconds + setTimeout(function(){ + $bar.slideUp(); + }, 5000); + }; +})(jQuery); diff --git a/modules/document/document.admin.controller.php b/modules/document/document.admin.controller.php index 6e624491b..8e6de0410 100644 --- a/modules/document/document.admin.controller.php +++ b/modules/document/document.admin.controller.php @@ -92,6 +92,7 @@ class documentAdminController extends document $obj = $oDocument->getObjectVars(); // ISSUE https://github.com/xpressengine/xe-core/issues/32 + $args_doc_origin = new stdClass(); $args_doc_origin->document_srl = $document_srl; $output_ori = executeQuery('document.getDocument', $args_doc_origin, array('content')); $obj->content = $output_ori->data->content; diff --git a/modules/document/document.class.php b/modules/document/document.class.php index 278f540f4..17d9d0530 100644 --- a/modules/document/document.class.php +++ b/modules/document/document.class.php @@ -208,9 +208,8 @@ class document extends ModuleObject // 2009. 03. 09 Add a column(lang_code) to the documnets table if(!$oDB->isColumnExists("documents","lang_code")) { - $db_info = Context::getDBInfo(); - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); - $obj->lang_code = $db_info->lang_type; + $oDB->addColumn('documents',"lang_code","varchar",10, config('locale.default_lang')); + $obj->lang_code = config('locale.default_lang'); executeQuery('document.updateDocumentsLangCode', $obj); } // 2009. 03. 11 Check the index in the document_extra_vars table diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 9800206b7..569cbc022 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -389,7 +389,7 @@ class documentController extends document $obj->homepage = $logged_info->homepage; } // If the tile is empty, extract string from the contents. - $obj->title = htmlspecialchars($obj->title); + $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); settype($obj->title, "string"); if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); // If no tile extracted from the contents, leave it untitled. @@ -610,7 +610,7 @@ class documentController extends document $obj->homepage = $source_obj->get('homepage'); } // If the tile is empty, extract string from the contents. - $obj->title = htmlspecialchars($obj->title); + $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); settype($obj->title, "string"); if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); // If no tile extracted from the contents, leave it untitled. diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 589a0cbd1..abb9e9614 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -580,57 +580,44 @@ class documentItem extends Object return $content; } - function getRegdate($format = 'Y.m.d H:i:s', $conversion = TRUE) + function getRegdate($format = 'Y.m.d H:i:s', $conversion = true) { return zdate($this->get('regdate'), $format, $conversion); } function getRegdateTime() { - $regdate = $this->get('regdate'); - $year = substr($regdate,0,4); - $month = substr($regdate,4,2); - $day = substr($regdate,6,2); - $hour = substr($regdate,8,2); - $min = substr($regdate,10,2); - $sec = substr($regdate,12,2); - return mktime($hour,$min,$sec,$month,$day,$year); + return ztime($this->get('regdate')); } function getRegdateGM() { - return $this->getRegdate('D, d M Y H:i:s', FALSE).' '.$GLOBALS['_time_zone']; + return gmdate('r', ztime($this->get('regdate'))); } function getRegdateDT() { - return $this->getRegdate('Y-m-d', FALSE).'T'.$this->getRegdate('H:i:s', FALSE).substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); + return zdate($this->get('regdate'), 'c', false); } - function getUpdate($format = 'Y.m.d H:i:s', $conversion = TRUE) + function getUpdate($format = 'Y.m.d H:i:s', $conversion = true) { return zdate($this->get('last_update'), $format, $conversion); } function getUpdateTime() { - $year = substr($this->get('last_update'),0,4); - $month = substr($this->get('last_update'),4,2); - $day = substr($this->get('last_update'),6,2); - $hour = substr($this->get('last_update'),8,2); - $min = substr($this->get('last_update'),10,2); - $sec = substr($this->get('last_update'),12,2); - return mktime($hour,$min,$sec,$month,$day,$year); + return ztime($this->get('last_update')); } function getUpdateGM() { - return gmdate("D, d M Y H:i:s", $this->getUpdateTime()); + return gmdate('r', ztime($this->get('last_update'))); } function getUpdateDT() { - return $this->getUpdate('Y-m-d', FALSE).'T'.$this->getUpdate('H:i:s', FALSE).substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); + return zdate($this->get('last_update'), 'c', false); } function getPermanentUrl() diff --git a/modules/document/document.model.php b/modules/document/document.model.php index c353a33a4..2420eebb0 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -621,7 +621,7 @@ class documentModel extends document $this->_setSearchOption($opt, $args, $query_id, $use_division); - if($sort_check->isExtraVars) + if($sort_check->isExtraVars || !$opt->list_count) { return 1; } diff --git a/modules/document/tpl/declared_list.html b/modules/document/tpl/declared_list.html index 239e16dcb..488f81894 100644 --- a/modules/document/tpl/declared_list.html +++ b/modules/document/tpl/declared_list.html @@ -19,7 +19,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; {$status_name_list['SECRET']} | {$status_name_list['TEMP']} - {$lang->help} + {$lang->help} | {$lang->cmd_declared_list}({number_format($total_count)}) diff --git a/modules/document/tpl/document_list.html b/modules/document/tpl/document_list.html index 4ee16718b..e3eb56d8d 100644 --- a/modules/document/tpl/document_list.html +++ b/modules/document/tpl/document_list.html @@ -19,7 +19,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; {$status_name_list['SECRET']}({number_format($total_count)}) | {$status_name_list['TEMP']}({number_format($total_count)}) - {$lang->help} + {$lang->help} | {$lang->cmd_declared_list} | @@ -46,13 +46,14 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
+ diff --git a/modules/document/tpl/header.html b/modules/document/tpl/header.html index d1c5c7f9d..d0fe0267b 100644 --- a/modules/document/tpl/header.html +++ b/modules/document/tpl/header.html @@ -1,7 +1,7 @@
-

{$lang->document} {$lang->help}

+

{$lang->document} {$lang->help}

  • diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index 003b81bd9..b4782b307 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -60,7 +60,7 @@ class editorController extends editor if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); else return new Object(-1,sprintf('%s method is not exists', $method)); - if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output; + if($output instanceof Object && !$output->toBool()) return $output; $this->setError($oComponent->getError()); $this->setMessage($oComponent->getMessage()); diff --git a/modules/editor/tpl/admin_index.html b/modules/editor/tpl/admin_index.html index 1ce31b79a..b99743896 100644 --- a/modules/editor/tpl/admin_index.html +++ b/modules/editor/tpl/admin_index.html @@ -1,6 +1,6 @@
    -

    {$lang->editor} {$lang->help}

    +

    {$lang->editor} {$lang->help}

    {$XE_VALIDATOR_MESSAGE}

    diff --git a/modules/file/tpl/adminConfig.html b/modules/file/tpl/adminConfig.html index 8a77884ff..905a6654b 100644 --- a/modules/file/tpl/adminConfig.html +++ b/modules/file/tpl/adminConfig.html @@ -1,5 +1,5 @@
    -

    {$lang->file_upload} {$lang->help}

    +

    {$lang->file_upload} {$lang->help}

    @@ -11,7 +11,7 @@
    - +
    @@ -32,13 +32,13 @@
    - +
    MB/{$upload_max_filesize}
    - +
    MB
    diff --git a/modules/file/tpl/file_list.html b/modules/file/tpl/file_list.html index 9d92e862c..6fcc2a058 100644 --- a/modules/file/tpl/file_list.html +++ b/modules/file/tpl/file_list.html @@ -6,7 +6,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
    -

    {$lang->file} {$lang->help}

    +

    {$lang->file} {$lang->help}

    {$XE_VALIDATOR_MESSAGE}

    @@ -18,7 +18,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; {$lang->is_valid}({number_format($total_count)}) | {$lang->is_stand_by}({number_format($total_count)}) - {$lang->help} + {$lang->help} {$lang->delete} diff --git a/modules/importer/importer.admin.controller.php b/modules/importer/importer.admin.controller.php index 0c48b430d..f0ac7f915 100644 --- a/modules/importer/importer.admin.controller.php +++ b/modules/importer/importer.admin.controller.php @@ -107,8 +107,7 @@ class importerAdminController extends importer /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */ - $db_info = Context::getDBInfo (); - if($db_info->db_type != "cubrid") + if(config('db.master.type') !== 'cubrid') { $output = executeQuery('importer.updateDocumentSync'.$postFix); $output = executeQuery('importer.updateCommentSync'.$postFix); diff --git a/modules/importer/tpl/header.html b/modules/importer/tpl/header.html index 7b8b85358..67cc8d4bc 100644 --- a/modules/importer/tpl/header.html +++ b/modules/importer/tpl/header.html @@ -1,6 +1,6 @@ {@ $type_list = array('module'=>$lang->type_module, 'ttxml'=>$lang->type_ttxml, 'member'=>$lang->type_member, 'sync'=>$lang->type_syncmember, 'message'=>$lang->type_message) }
    -

    {$lang->importer} {$lang->help}

    +

    {$lang->importer} {$lang->help}

    {nl2br($lang->about_importer)}

    diff --git a/modules/install/conf/module.xml b/modules/install/conf/module.xml index d99d2cf41..c10d5ab53 100644 --- a/modules/install/conf/module.xml +++ b/modules/install/conf/module.xml @@ -3,25 +3,18 @@ - - + - - - - + + + - + - - - - - diff --git a/modules/install/install.admin.controller.php b/modules/install/install.admin.controller.php index 3d6551068..9c430eba7 100644 --- a/modules/install/install.admin.controller.php +++ b/modules/install/install.admin.controller.php @@ -44,105 +44,6 @@ class installAdminController extends install return $output; } - /** - * @brief Change settings - */ - function procInstallAdminSaveTimeZone() - { - $db_info = Context::getDBInfo(); - - $admin_ip_list = Context::get('admin_ip_list'); - - if($admin_ip_list) - { - $admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list); - $admin_ip_list = preg_replace("/\s+/","",$admin_ip_list); - if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list)) - { - $admin_ip_list = ''; - } - $admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR']; - $admin_ip_list = explode(',',trim($admin_ip_list, ',')); - $admin_ip_list = array_unique($admin_ip_list); - if(!IpFilter::validate($admin_ip_list)) { - return new Object(-1, 'msg_invalid_ip'); - } - } - - $default_url = Context::get('default_url'); - if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; - if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/'; - - /* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */ - $default_url = Context::encodeIdna($default_url); - - $use_ssl = Context::get('use_ssl'); - if(!$use_ssl) $use_ssl = 'none'; - - $http_port = Context::get('http_port'); - $https_port = Context::get('https_port'); - - $use_rewrite = Context::get('use_rewrite'); - if($use_rewrite!='Y') $use_rewrite = 'N'; - - $use_sso = Context::get('use_sso'); - if($use_sso !='Y') $use_sso = 'N'; - - $use_db_session = Context::get('use_db_session'); - if($use_db_session!='Y') $use_db_session = 'N'; - - $qmail_compatibility = Context::get('qmail_compatibility'); - if($qmail_compatibility!='Y') $qmail_compatibility = 'N'; - - $delay_session = Context::get('delay_session'); - if($delay_session!='Y') $delay_session = 'N'; - unset($db_info->cache_friendly); - - $minify_scripts = Context::get('minify_scripts'); - if(!$minify_scripts) $minify_scripts = 'common'; - - $use_html5 = Context::get('use_html5'); - if(!$use_html5) $use_html5 = 'N'; - - $db_info->default_url = $default_url; - $db_info->qmail_compatibility = $qmail_compatibility; - $db_info->minify_scripts = $minify_scripts; - $db_info->delay_session = $delay_session; - $db_info->use_db_session = $use_db_session; - $db_info->use_rewrite = $use_rewrite; - $db_info->use_sso = $use_sso; - $db_info->use_ssl = $use_ssl; - $db_info->use_html5 = $use_html5; - $db_info->admin_ip_list = $admin_ip_list; - - if($http_port) $db_info->http_port = (int) $http_port; - else if($db_info->http_port) unset($db_info->http_port); - - if($https_port) $db_info->https_port = (int) $https_port; - else if($db_info->https_port) unset($db_info->https_port); - - unset($db_info->lang_type); - - $oInstallController = getController('install'); - if(!$oInstallController->makeConfigFile()) - { - return new Object(-1, 'msg_invalid_request'); - } - else - { - Context::setDBInfo($db_info); - if($default_url) - { - $site_args = new stdClass; - $site_args->site_srl = 0; - $site_args->domain = $default_url; - $oModuleController = getController('module'); - $oModuleController->updateSite($site_args); - } - $this->setRedirectUrl(Context::get('error_return_url')); - } - } - function procInstallAdminUpdateIndexModule() { if(!Context::get('index_module_srl') || !Context::get('menu_item_srl')) @@ -229,188 +130,6 @@ class installAdminController extends install $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); $this->setRedirectUrl($returnUrl); } - - function procInstallAdminConfig() - { - $use_mobile_view = Context::get('use_mobile_view'); - if($use_mobile_view!='Y') $use_mobile_view = 'N'; - - $time_zone = Context::get('time_zone'); - - $db_info = Context::getDBInfo(); - $db_info->use_mobile_view = $use_mobile_view; - $db_info->time_zone = $time_zone; - - unset($db_info->lang_type); - Context::setDBInfo($db_info); - $oInstallController = getController('install'); - if(!$oInstallController->makeConfigFile()) - { - return new Object(-1, 'msg_invalid_request'); - } - - $site_args = new stdClass(); - $site_args->site_srl = 0; - $site_args->index_module_srl = Context::get('index_module_srl');// - $site_args->default_language = Context::get('change_lang_type');// - $oModuleController = getController('module'); - $oModuleController->updateSite($site_args); - - //언어 선택 - $selected_lang = Context::get('selected_lang'); - $this->saveLangSelected($selected_lang); - - //save icon images - $deleteFavicon = Context::get('is_delete_favicon'); - $deleteMobicon = Context::get('is_delete_mobicon'); - - $this->updateIcon('favicon.ico',$deleteFavicon); - $this->updateIcon('mobicon.png',$deleteMobicon); - - //모듈 설정 저장(썸네일, 풋터스크립트) - $config = new stdClass(); - $config->thumbnail_type = Context::get('thumbnail_type'); - $config->htmlFooter = Context::get('htmlFooter'); - $config->siteTitle = Context::get('site_title'); - $this->setModulesConfig($config); - - $this->setRedirectUrl(Context::get('error_return_url')); - } - - public function procInstallAdminConfigIconUpload() { - $this->setTemplatePath($this->module_path.'tpl'); - $this->setTemplateFile("after_upload_config_image.html"); - - $favicon = Context::get('favicon'); - $mobicon = Context::get('mobicon'); - if(!$favicon && !$mobicon) { - Context::set('msg', Context::getLang("msg_invalid_format")); - return; - } - if($favicon) { - $name = 'favicon'; - $tmpFileName = $this->saveIconTmp($favicon,'favicon.ico'); - } else { - $name = 'mobicon'; - $tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png'); - } - - Context::set('name', $name); - Context::set('tmpFileName', $tmpFileName.'?'.$_SERVER['REQUEST_TIME']); - } - - /** - * @brief Supported languages (was procInstallAdminSaveLangSelected) - */ - function saveLangSelected($selected_lang) - { - $langs = $selected_lang; - - $lang_supported = Context::loadLangSupported(); - $buff = null; - for($i=0;$isetMessage('success_updated'); - } - - /* 썸내일 보여주기 방식 변경.*/ - function setModulesConfig($config) - { - $args = new stdClass(); - - if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop'; - else $args->thumbnail_type = 'ratio'; - - $oModuleController = getController('module'); - $oModuleController->insertModuleConfig('document',$args); - - unset($args); - - $args = new stdClass; - $args->htmlFooter = $config->htmlFooter; - $args->siteTitle = $config->siteTitle; - $oModuleController->updateModuleConfig('module',$args); - - return $output; - } - - private function saveIconTmp($icon, $iconname) - { - - $site_info = Context::get('site_module_info'); - $virtual_site = ''; - if($site_info->site_srl) - { - $virtual_site = $site_info->site_srl . '/'; - } - - $target_file = $icon['tmp_name']; - $type = $icon['type']; - $relative_filename = 'files/attach/xeicon/'.$virtual_site.'tmp/'.$iconname; - $target_filename = _XE_PATH_.$relative_filename; - - list($width, $height, $type_no, $attrs) = @getimagesize($target_file); - if($iconname == 'favicon.ico') - { - if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) { - Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); - return; - } - } - else if($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::createImageFile($target_file, $target_filename, $fitHeight, $fitWidth, $ext); - FileHandler::copyFile($target_file, $target_filename); - return $relative_filename; - } - - private function updateIcon($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 = _XE_PATH_.'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 install.admin.controller.php */ /* Location: ./modules/install/install.admin.controller.php */ diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 771ce9dab..90d608952 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -7,8 +7,6 @@ */ class installController extends install { - var $db_tmp_config_file = ''; - var $etc_tmp_config_file = ''; var $flagLicenseAgreement = './files/env/license_agreement'; /** @@ -16,12 +14,12 @@ class installController extends install */ function init() { - // Error occurs if already installed - if(Context::isInstalled()) + // Stop if already installed. + if (Context::isInstalled()) { return new Object(-1, 'msg_already_installed'); } - + $this->db_tmp_config_file = _XE_PATH_.'files/config/tmpDB.config.php'; $this->etc_tmp_config_file = _XE_PATH_.'files/config/tmpEtc.config.php'; } @@ -29,134 +27,204 @@ class installController extends install /** * @brief division install step... DB Config temp file create */ - function procDBSetting() + function procDBConfig() { - // Get DB-related variables - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); - $con_string->db_table_prefix = rtrim($con_string->db_table_prefix, '_'); - - $db_info = new stdClass(); - $db_info->master_db = get_object_vars($con_string); - $db_info->slave_db = array($db_info->master_db); - $db_info->default_url = Context::getRequestUri(); - $db_info->lang_type = Context::getLangType(); - $db_info->use_mobile_view = 'Y'; - - // Set DB type and information - Context::setDBInfo($db_info); - - // Check if available to connect to the DB - $oDB = &DB::getInstance(); + // Get DB config variables. + $config = Context::gets('db_type', 'db_host', 'db_port', 'db_user', 'db_pass', 'db_database', 'db_prefix'); + + // Create a temporary setting object. + Rhymix\Framework\Config::set('db.master', array( + 'type' => $config->db_type, + 'host' => $config->db_host, + 'port' => $config->db_port, + 'user' => $config->db_user, + 'pass' => $config->db_pass, + 'database' => $config->db_database, + 'prefix' => rtrim($config->db_prefix, '_') . '_', + )); + + // Check connection to the DB. + $oDB = DB::getInstance(); $output = $oDB->getError(); - if(!$output->toBool()) return $output; - if(!$oDB->isConnected()) return $oDB->getError(); - - // Check if MySQL server supports InnoDB - if(stripos($con_string->db_type, 'innodb') !== false) + if (!$output->toBool() || !$oDB->isConnected()) { - $innodb_supported = false; + return $output; + } + + // Check MySQL server capabilities. + if(stripos($config->db_type, 'mysql') !== false) + { + // Check if InnoDB is supported. $show_engines = $oDB->_fetch($oDB->_query('SHOW ENGINES')); foreach($show_engines as $engine_info) { - if(strcasecmp($engine_info->Engine, 'InnoDB') === 0) + if ($engine_info->Engine === 'InnoDB') { - $innodb_supported = true; + $config->db_type .= '_innodb'; + break; } } - - // If server does not support InnoDB, fall back to default storage engine (usually MyISAM) - if(!$innodb_supported) + + // Check if utf8mb4 is supported. + $oDB->charset = $oDB->getBestSupportedCharset(); + $config->db_charset = $oDB->charset; + } + + // Check if tables already exist. + $table_check = array('documents', 'comments', 'modules', 'sites'); + foreach ($table_check as $table_name) + { + if ($oDB->isTableExists($table_name)) { - $con_string->db_type = str_ireplace('_innodb', '', $con_string->db_type); - $db_info->master_db['db_type'] = $con_string->db_type; - $db_info->slave_db[0]['db_type'] = $con_string->db_type; - Context::set('db_type', $con_string->db_type); - Context::setDBInfo($db_info); + return new Object(-1, 'msg_table_already_exists'); } } - - // Create a db temp config file - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); - - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + + // Save DB config in session. + $_SESSION['db_config'] = $config; + + // Continue the installation. + if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) { - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); - header('location:'.$returnUrl); - return; + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallOtherConfig'); + $this->setRedirectUrl($returnUrl); } } /** * @brief Install with received information */ - function procInstall() + function procInstall($install_config = null) { // Check if it is already installed - if(Context::isInstalled()) + if (Context::isInstalled()) { return new Object(-1, 'msg_already_installed'); } - - // Save rewrite and time zone settings - if(!Context::get('install_config')) + + // Get install parameters. + $config = Rhymix\Framework\Config::getDefaults(); + if ($install_config) { - $config_info = Context::gets('use_rewrite','time_zone', 'use_ssl'); - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; - if(!$this->makeEtcConfigFile($config_info)) - { - return new Object(-1, 'msg_install_failed'); - } + $install_config = (array)$install_config; + $config['db']['master']['type'] = str_replace('_innodb', '', $install_config['db_type']); + $config['db']['master']['host'] = $install_config['db_hostname']; + $config['db']['master']['port'] = $install_config['db_port']; + $config['db']['master']['user'] = $install_config['db_userid']; + $config['db']['master']['pass'] = $install_config['db_password']; + $config['db']['master']['database'] = $install_config['db_database']; + $config['db']['master']['prefix'] = $install_config['db_table_prefix']; + $config['db']['master']['charset'] = $install_config['db_charset']; + $config['db']['master']['engine'] = strpos($install_config['db_type'], 'innodb') !== false ? 'innodb' : (strpos($install_config['db_type'], 'mysql') !== false ? 'myisam' : null); + $config['use_rewrite'] = $install_config['use_rewrite'] === 'Y' ? true : false; + $config['url']['ssl'] = $install_config['use_ssl'] ?: 'none'; + $time_zone = $install_config['time_zone']; + $user_info = new stdClass; + $user_info->email_address = $install_config['email_address']; + $user_info->password = $install_config['password']; + $user_info->nick_name = $install_config['nick_name']; + $user_info->user_id = $install_config['user_id']; } - - // Assign a temporary administrator when installing - $logged_info = new stdClass(); - $logged_info->is_admin = 'Y'; - Context::set('logged_info', $logged_info); - - // check install config - if(Context::get('install_config')) - { - $db_info = $this->_makeDbInfoByInstallConfig(); - } - // install by default XE UI else { - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; + $config['db']['master']['type'] = str_replace('_innodb', '', $_SESSION['db_config']->db_type); + $config['db']['master']['host'] = $_SESSION['db_config']->db_host; + $config['db']['master']['port'] = $_SESSION['db_config']->db_port; + $config['db']['master']['user'] = $_SESSION['db_config']->db_user; + $config['db']['master']['pass'] = $_SESSION['db_config']->db_pass; + $config['db']['master']['database'] = $_SESSION['db_config']->db_database; + $config['db']['master']['prefix'] = $_SESSION['db_config']->db_prefix; + $config['db']['master']['charset'] = $_SESSION['db_config']->db_charset; + $config['db']['master']['engine'] = strpos($_SESSION['db_config']->db_type, 'innodb') !== false ? 'innodb' : (strpos($_SESSION['db_config']->db_type, 'mysql') !== false ? 'myisam' : null); + $config['use_rewrite'] = $_SESSION['use_rewrite'] === 'Y' ? true : false; + $config['url']['ssl'] = Context::get('use_ssl') ?: 'none'; + $time_zone = Context::get('time_zone'); + $user_info = Context::gets('email_address', 'password', 'nick_name', 'user_id'); } - - // Set DB type and information - Context::setDBInfo($db_info); - // Create DB Instance - $oDB = &DB::getInstance(); - // Check if available to connect to the DB - if(!$oDB->isConnected()) return $oDB->getError(); - - // Check DB charset if using MySQL - if(stripos($db_info->master_db['db_type'], 'mysql') !== false && !isset($db_info->master_db['db_charset'])) + + // Fix the database table prefix. + $config['db']['master']['prefix'] = rtrim($config['db']['master']['prefix'], '_'); + if ($config['db']['master']['prefix'] !== '') { - $oDB->charset = $oDB->getBestSupportedCharset(); - $db_info->master_db['db_charset'] = $oDB->charset; - $db_info->slave_db[0]['db_charset'] = $oDB->charset; - Context::setDBInfo($db_info); + $config['db']['master']['prefix'] .= '_'; } - - // Install all the modules - try { + + // Set the default language. + $config['locale']['default_lang'] = Context::getLangType(); + $config['locale']['enabled_lang'] = array($config['locale']['default_lang']); + + // Set the default time zone. + if (strpos($time_zone, '/') !== false) + { + $config['locale']['default_timezone'] = $time_zone; + $user_timezone = null; + } + else + { + $user_timezone = intval(Rhymix\Framework\DateTime::getTimezoneOffsetByLegacyFormat($time_zone ?: '+0900') / 3600); + switch ($user_timezone) + { + case 9: + $config['locale']['default_timezone'] = 'Asia/Seoul'; break; + case 0: + $config['locale']['default_timezone'] = 'Etc/UTC'; break; + default: + $config['locale']['default_timezone'] = 'Etc/GMT' . ($user_timezone > 0 ? '-' : '+') . abs($user_timezone); + } + } + + // Set the internal time zone. + if ($config['locale']['default_timezone'] === 'Asia/Seoul') + { + $config['locale']['internal_timezone'] = 32400; + } + elseif ($user_timezone !== null) + { + $config['locale']['internal_timezone'] = $user_timezone * 3600; + } + else + { + $config['locale']['internal_timezone'] = 0; + } + + // Set the default URL. + $config['url']['default'] = Context::getRequestUri(); + + // Load the new configuration. + Rhymix\Framework\Config::setAll($config); + Context::loadDBInfo($config); + + // Check DB. + $oDB = DB::getInstance(); + if (!$oDB->isConnected()) + { + return $oDB->getError(); + } + + // Assign a temporary administrator while installing. + foreach ($user_info as $key => $val) + { + Context::set($key, $val, true); + } + $user_info->is_admin = 'Y'; + Context::set('logged_info', $user_info); + + // Install all the modules. + try + { $oDB->begin(); $this->installDownloadedModule(); $oDB->commit(); - } catch(Exception $e) { + } + catch(Exception $e) + { $oDB->rollback(); return new Object(-1, $e->getMessage()); } - - // Create a config file - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); - - // load script + + // Execute the install script. $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); - if(count($scripts)>0) + if(count($scripts)) { sort($scripts); foreach($scripts as $script) @@ -165,48 +233,30 @@ class installController extends install $output = include($script_path . $script); } } - - // save selected lang info - $oInstallAdminController = getAdminController('install'); - $oInstallAdminController->saveLangSelected(array(Context::getLangType())); - - // Display a message that installation is completed - $this->setMessage('msg_install_completed'); - - unset($_SESSION['use_rewrite']); - - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + + // Apply site lock. + + if (Context::get('use_sitelock') === 'Y') { - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); - header('location:'.$returnUrl); - return new Object(); + $user_ip_range = getView('install')->detectUserIPRange(); + Rhymix\Framework\Config::set('lock.locked', true); + Rhymix\Framework\Config::set('lock.message', 'This site is locked.'); + Rhymix\Framework\Config::set('lock.allow', array('127.0.0.1', $user_ip_range)); } - } - - /** - * @brief Make DB Information by Install Config - */ - function _makeDbInfoByInstallConfig() - { - $db_info = new stdClass(); - $db_info->master_db = array( - 'db_type' => Context::get('db_type'), - 'db_port' => Context::get('db_port'), - 'db_hostname' => Context::get('db_hostname'), - 'db_userid' => Context::get('db_userid'), - 'db_password' => Context::get('db_password'), - 'db_database' => Context::get('db_database'), - 'db_table_prefix' => Context::get('db_table_prefix'), - 'db_charset' => Context::get('db_charset'), - ); - $db_info->slave_db = array($db_info->master_db); - $db_info->default_url = Context::getRequestUri(); - $db_info->lang_type = Context::get('lang_type') ? Context::get('lang_type') : Context::getLangType(); - Context::setLangType($db_info->lang_type); - $db_info->use_rewrite = Context::get('use_rewrite'); - $db_info->time_zone = Context::get('time_zone'); - - return $db_info; + + // Save the new configuration. + Rhymix\Framework\Config::save(); + + // Unset temporary session variables. + unset($_SESSION['use_rewrite']); + unset($_SESSION['db_config']); + + // Redirect to the home page. + $this->setMessage('msg_install_completed'); + + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : RX_BASEURL; + $this->setRedirectUrl($returnUrl); + return new Object(); } /** @@ -436,7 +486,7 @@ class installController extends install /** * @brief License agreement */ - function procInstallLicenseAggrement() + function procInstallLicenseAgreement() { $vars = Context::getRequestVars(); @@ -575,133 +625,15 @@ class installController extends install if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); return new Object(); } - - function _getDBConfigFileContents($db_info) - { - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') - { - $db_info->master_db['db_table_prefix'] .= '_'; - } - - foreach($db_info->slave_db as &$slave) - { - if(substr($slave['db_table_prefix'], -1) != '_') - { - $slave['db_table_prefix'] .= '_'; - } - } - - $buff = array(); - $buff[] = 'db_tmp_config_file; - - $db_info = Context::getDBInfo(); - if(!$db_info) return; - - $buff = $this->_getDBConfigFileContents($db_info); - - FileHandler::writeFile($db_tmp_config_file, $buff); - - if(@file_exists($db_tmp_config_file)) return true; - return false; - } - - /** - * @brief Create etc config file - * Create the config file when all settings are completed - */ - function makeEtcConfigFile($config_info) - { - $etc_tmp_config_file = $this->etc_tmp_config_file; - - $buff = ' $val) - { - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); - } - - FileHandler::writeFile($etc_tmp_config_file, $buff); - - if(@file_exists($etc_tmp_config_file)) return true; - return false; - } - - /** - * @brief Create config file - * Create the config file when all settings are completed - */ - function makeConfigFile() - { - try { - $config_file = Context::getConfigFile(); - //if(file_exists($config_file)) return; - - $db_info = Context::getDBInfo(); - if(!$db_info) return; - - $buff = $this->_getDBConfigFileContents($db_info); - - FileHandler::writeFile($config_file, $buff); - - if(@file_exists($config_file)) - { - FileHandler::removeFile($this->db_tmp_config_file); - FileHandler::removeFile($this->etc_tmp_config_file); - return true; - } - return false; - } catch (Exception $e) { - return false; - } - } - - function installByConfig($install_config_file) - { - include $install_config_file; - if(!is_array($auto_config)) return false; - - $auto_config['module'] = 'install'; - $auto_config['act'] = 'procInstall'; - - $fstr = "<%s>\r\n"; - $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; - $body = "\r\n\r\n\r\n"; - foreach($auto_config as $k => $v) - { - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); - } - $body .= "\r\n"; - - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); - $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); - - if($fp) - { - fputs($fp, $header); - while(!feof($fp)) - { - $line = trim(fgets($fp, 4096)); - if(strncmp('', $line, 7) === 0) - { - fclose($fp); - return false; - } - } - fclose($fp); - } return true; - } } /* End of file install.controller.php */ diff --git a/modules/install/install.view.php b/modules/install/install.view.php index 5f505ae78..752208b80 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -7,8 +7,7 @@ */ class installView extends install { - public $install_enable = false; - + public static $checkEnv = false; public static $rewriteCheckFilePath = 'files/cache/tmpRewriteCheck.txt'; public static $rewriteCheckString = ''; @@ -17,81 +16,56 @@ class installView extends install */ function init() { - // Set browser title + // Stop if already installed. + if (Context::isInstalled()) + { + return $this->stop('msg_already_installed'); + } + + // Set the browser title. Context::setBrowserTitle(Context::getLang('introduce_title')); - // Specify the template path + + // Specify the template path. $this->setTemplatePath($this->module_path.'tpl'); - // Error occurs if already installed - if(Context::isInstalled()) return $this->stop('msg_already_installed'); - // Install a controller + + // Check the environment. $oInstallController = getController('install'); - $this->install_enable = $oInstallController->checkInstallEnv(); - // If the environment is installable, execute installController::makeDefaultDirectory() - if($this->install_enable) $oInstallController->makeDefaultDirectory(); + self::$checkEnv = $oInstallController->checkInstallEnv(); + if (self::$checkEnv) + { + $oInstallController->makeDefaultDirectory(); + } } /** - * @brief Display license messages + * @brief Index page */ - function dispInstallIntroduce() + function dispInstallIndex() { - $install_config_file = FileHandler::getRealPath('./config/install.config.php'); - if(file_exists($install_config_file)) + // If there is an autoinstall config file, use it. + if (file_exists(RX_BASEDIR . 'config/install.config.php')) { - /** - * If './config/install.config.php' file created and write array shown in the example below, XE installed using config file. - * ex ) - $install_config = array( - 'db_type' =>'mysqli_innodb', - 'db_port' =>'3306', - 'db_hostname' =>'localhost', - 'db_userid' =>'root', - 'db_password' =>'root', - 'db_database' =>'rx_database', - 'db_table_prefix' =>'rx', - 'user_rewrite' =>'N', - 'time_zone' =>'0000', - 'email_address' =>'admin@admin.net', - 'password' =>'pass', - 'password2' =>'pass', - 'nick_name' =>'admin', - 'user_id' =>'admin', - 'lang_type' =>'ko', // en, jp, ... - ); - */ - include $install_config_file; - if(is_array($install_config)) + include RX_BASEDIR . 'config/install.config.php'; + + if (isset($install_config) && is_array($install_config)) { - foreach($install_config as $k => $v) - { - $v = ($k == 'db_table_prefix') ? $v.'_' : $v; - Context::set($k,$v,true); - } - unset($GLOBALS['__DB__']); - Context::set('install_config', true, true); $oInstallController = getController('install'); - $output = $oInstallController->procInstall(); - if (!$output->toBool()) return $output; - header("location: ./"); - Context::close(); - exit; + $output = $oInstallController->procInstall($install_config); + if (!$output->toBool()) + { + return $output; + } + else + { + $this->setRedirectUrl(RX_BASEURL); + return new Object(); + } } } - - Context::set('l', Context::getLangType()); - return $this->dispInstallLicenseAgreement(); - //$this->setTemplateFile('introduce'); - } - - /** - * @brief License agreement - */ - function dispInstallLicenseAgreement() - { + + // Otherwise, display the license agreement screen. + Context::set('lang_type', Context::getLangType()); $this->setTemplateFile('license_agreement'); - - $lang_type = Context::getLangType(); - Context::set('lang_type', $lang_type); } /** @@ -99,111 +73,132 @@ class installView extends install */ function dispInstallCheckEnv() { - $oInstallController = getController('install'); - + // Create a temporary file for mod_rewrite check. self::$rewriteCheckString = Password::createSecureSalt(32); FileHandler::writeFile(_XE_PATH_ . self::$rewriteCheckFilePath, self::$rewriteCheckString);; - Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'N'); - Context::set('use_nginx', stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false); + // Check if the web server is nginx. + Context::set('use_nginx', stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false); $this->setTemplateFile('check_env'); } /** - * @brief Choose a DB + * @brief Configure the database */ - function dispInstallSelectDB() + function dispInstallDBConfig() { // Display check_env if it is not installable - if(!$this->install_enable) return $this->dispInstallCheckEnv(); + if(!self::$checkEnv) + { + return $this->dispInstallCheckEnv(); + } // Delete mod_rewrite check file FileHandler::removeFile(_XE_PATH_ . self::$rewriteCheckFilePath); - // Save mod_rewrite check status + // Save mod_rewrite check status. if(Context::get('rewrite') === 'Y') { Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'Y'); } - // Enter ftp information + // FTP config is disabled in Rhymix. + /* if(ini_get('safe_mode') && !Context::isFTPRegisted()) { Context::set('progressMenu', '3'); Context::set('server_ip_address', $_SERVER['SERVER_ADDR']); Context::set('server_ftp_user', get_current_user()); $this->setTemplateFile('ftp'); + return; } - else + */ + + $defaultDatabase = 'mysqli'; + $disableList = DB::getDisableList(); + if(is_array($disableList)) { - $defaultDatabase = 'mysqli_innodb'; - $disableList = DB::getDisableList(); - if(is_array($disableList)) + foreach($disableList as $key => $value) { - foreach($disableList AS $key=>$value) + if($value->db_type == $defaultDatabase) { - if($value->db_type == $defaultDatabase) - { - $defaultDatabase = 'mysql'; - break; - } + $defaultDatabase = 'mysql'; + break; } } - Context::set('defaultDatabase', $defaultDatabase); - Context::set('progressMenu', '4'); - - $error_return_url = getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type')); - if(RX_SSL) - { - // Error occured when using https protocol at "ModuleHandler::init() ' - $parsedUrl = parse_url($error_return_url); - $error_return_url = ''; - if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path']; - if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query']; - if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment']; - } - Context::set('error_return_url', $error_return_url); - - $this->setTemplateFile('select_db'); } + Context::set('defaultDatabase', $defaultDatabase); + + Context::set('progressMenu', '4'); + Context::set('error_return_url', getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type'))); + $this->setTemplateFile('db_config'); } /** * @brief Display a screen to enter DB and administrator's information */ - function dispInstallManagerForm() + function dispInstallOtherConfig() { // Display check_env if not installable - if(!$this->install_enable) + if(!self::$checkEnv) { return $this->dispInstallCheckEnv(); } - - include _XE_PATH_.'files/config/tmpDB.config.php'; - - Context::set('use_rewrite', $_SESSION['use_rewrite']); + + // Get list of time zones. + Context::set('timezones', Rhymix\Framework\DateTime::getTimezoneList()); + + // Automatically select a time zone for the user. + Context::set('selected_timezone', $this->detectUserTimeZone()); + + // Always use SSL if installing via SSL. Context::set('use_ssl', RX_SSL ? 'always' : 'none'); - Context::set('time_zone', $GLOBALS['time_zone']); - Context::set('db_type', $db_info->db_type); - $this->setTemplateFile('admin_form'); + Context::set('sitelock_ip_range', $this->detectUserIPRange()); + $this->setTemplateFile('other_config'); } - + /** - * @brief Check whether this server supports mod_rewrite + * Detect the IP range of the user. */ - function useRewriteModule() + function detectUserIPRange() { - if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules())) + if (RX_CLIENT_IP_VERSION === 4) { - return true; + return preg_replace('/\.\d+$/', '.*', RX_CLIENT_IP); + } + elseif (function_exists('inet_pton')) + { + $binary = inet_pton(RX_CLIENT_IP); + $binary = substr($binary, 0, 8) . str_repeat(chr(0), 8); + return inet_ntop($binary) . '/64'; + } + else + { + return RX_CLIENT_IP; + } + } + + /** + * Detect best time zone for the user. + */ + function detectUserTimeZone() + { + switch (Context::getLangType()) + { + case 'ko': return 'Asia/Seoul'; + case 'en': return 'Europe/London'; + case 'ja': return 'Asia/Tokyo'; + case 'zh-CN': return 'Asia/Shanghai'; + case 'zh-TW': return 'Asia/Taipei'; + case 'de': return 'Europe/Berlin'; + case 'es': return 'Europe/Madrid'; + case 'fr': return 'Europe/Paris'; + case 'mn': return 'Asia/Ulaanbaatar'; + case 'ru': return 'Europe/Moscow'; + case 'tr': return 'Europe/Istanbul'; + case 'vi': return 'Asia/Ho_Chi_Minh'; + default: return 'UTC'; } - - require_once(_XE_PATH_.'classes/httprequest/XEHttpRequest.class.php'); - $httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']); - $xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1)); - $output = $httpRequest->send($xeInstallPath.'modules/install/conf/info.xml'); - - return (strpos($output->body, 'ftp_host = 'FTP-Server hostname'; $lang->ftp_port = 'FTP Port'; $lang->about_ftp_password = 'Das Passwort des FTPs wird nicht gespeichert.'; $lang->cmd_check_ftp_connect = 'Verbindung des FTPs checken'; -$lang->msg_safe_mode_ftp_needed = 'Zur Installation und Nutzung des RhymiXs muss die Angabe des FTPs festgestellt werden, wenn safe_mode in PHP \'An\' ist.'; +$lang->msg_safe_mode_ftp_needed = 'Zur Installation und Nutzung des Rhymixs muss die Angabe des FTPs festgestellt werden, wenn safe_mode in PHP \'An\' ist.'; $lang->msg_safe_mode_ftp_config = 'Die Angabe wird unter files/config/ftp.config.php gespeichert. Nach der Installation ist es auch möglich, dass die Angabe von Administrator modifiziert oder gelöscht werden kann.'; $lang->msg_ftp_not_connected = 'Ein Verbindungsfehler des FTPs an localhost ist aufgetreten. Bitte FTP_Port checken, oder ob FTP_Service möglich ist.'; $lang->msg_ftp_invalid_auth_info = 'Anmeldungsfehler mit der Angabe des FTPs Bitte die Angabe des FTPs festlegen.'; @@ -13,5 +13,5 @@ $lang->msg_ftp_mkdir_fail = 'Der Befehl von Herstellung des Verzeichnisses durch $lang->msg_ftp_chmod_fail = 'Die Modifikation der Zugriffsberechtigung des Verzeichnisses durch FTP ist gescheitert. FTP_Server festlegen.'; $lang->msg_ftp_connect_success = 'Die Verbindung zu FTP ist erfolgreich und verifiziert.'; $lang->ftp_path_title = 'Pfad des FTPs eingeben'; -$lang->msg_ftp_installed_realpath = 'absoluter Pfad, in dem RhymiX installiert ist.'; -$lang->msg_ftp_installed_ftp_realpath = 'absoluten Pfad des FTPs, in dem RhymiX installiert ist, festlegen.'; +$lang->msg_ftp_installed_realpath = 'absoluter Pfad, in dem Rhymix installiert ist.'; +$lang->msg_ftp_installed_ftp_realpath = 'absoluten Pfad des FTPs, in dem Rhymix installiert ist, festlegen.'; diff --git a/modules/install/lang/en.php b/modules/install/lang/en.php index 3d0fc474e..c4d9aed81 100644 --- a/modules/install/lang/en.php +++ b/modules/install/lang/en.php @@ -1,5 +1,5 @@ introduce_title = 'RhymiX Installation'; +$lang->introduce_title = 'Rhymix Installation'; $lang->enviroment_gather = 'Agreement on gathering installation environment information'; $lang->input_dbinfo_by_dbtype = 'Input %s info'; $lang->install_progress_menu['language'] = 'Select language'; @@ -10,8 +10,8 @@ $lang->install_progress_menu['dbSelect'] = 'Choose database type'; $lang->install_progress_menu['dbInfo'] = 'DB Setup'; $lang->install_progress_menu['configInfo'] = 'Configuration'; $lang->install_progress_menu['adminInfo'] = 'Create Administrator Account'; -$lang->install_condition_enable = 'Your server is compatible with RhymiX.'; -$lang->install_condition_disable = 'Your server does not support RhymiX.'; +$lang->install_condition_enable = 'Your server is compatible with Rhymix.'; +$lang->install_condition_disable = 'Your server does not support Rhymix.'; $lang->install_details = 'Details'; $lang->install_simply = 'Simply'; $lang->advanced_setup = 'Advanced Setup'; @@ -26,11 +26,11 @@ $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_start setting'; $lang->install_checklist_title['db_support'] = 'DB support'; -$lang->install_checklist_desc['php_version'] = '[Required] RhymiX supports only PHP Version %s or higher'; -$lang->install_checklist_desc['php_version_warning'] = '[Recommend] RhymiX recommends only PHP Version %s or higher'; -$lang->install_checklist_desc['permission'] = '[Required] RhymiX installation path or ./files directory\'s permission must be 777'; +$lang->install_checklist_desc['php_version'] = '[Required] Rhymix supports only PHP Version %s or higher'; +$lang->install_checklist_desc['php_version_warning'] = '[Recommend] Rhymix recommends only PHP Version %s or higher'; +$lang->install_checklist_desc['permission'] = '[Required] Rhymix installation path or ./files directory\'s permission must be 777'; $lang->install_checklist_desc['xml'] = '[Required] XML Library is needed for XML communication'; -$lang->install_checklist_desc['session'] = '[Required] PHP setting file\'s (php.ini) \'Session.auto_start\' must equal to zero in order for RhymiX to use the session'; +$lang->install_checklist_desc['session'] = '[Required] PHP setting file\'s (php.ini) \'Session.auto_start\' must equal to zero in order for Rhymix to use the session'; $lang->install_checklist_desc['iconv'] = 'Iconv should be installed in order to convert between UTF-8 and other language sets'; $lang->install_checklist_desc['gd'] = 'GD Library should be installed in order to use functions to convert images'; $lang->install_checklist_xml = 'Install XML Library'; @@ -45,10 +45,8 @@ $lang->cmd_install_refresh_page = 'Refresh'; $lang->cmd_install_next = 'Continue installation'; $lang->cmd_ignore = 'Ignore'; $lang->cmd_recommended = 'Recommended'; -$lang->db_desc['mysqli'] = 'Use MySQL as a database via the mysqli extension.
    Use the MyISAM storage engine, which does not support transactions.'; -$lang->db_desc['mysqli_innodb'] = 'Use MySQL as a database via the mysqli extension.
    Use the InnoDB storage engine, which supports transactions and higher concurrency.'; -$lang->db_desc['mysql'] = 'Use MySQL as a database via PHP\'s mysql_* functions.
    Use the MyISAM storage engine, which does not support transactions.'; -$lang->db_desc['mysql_innodb'] = 'Use MySQL as a database via PHP\'s mysql_* functions.
    Use the InnoDB storage engine, which supports transactions and higher concurrency.'; +$lang->db_desc['mysqli'] = 'Use MySQL as a database via the mysqli extension.'; +$lang->db_desc['mysql'] = 'Use MySQL as a database via mysql_* functions.'; $lang->db_desc['cubrid'] = 'Use CUBRID as a database. See Manual for more info'; $lang->db_desc['mssql'] = 'Use Microsoft SQL Server as a database.'; $lang->can_use_when_installed = 'Not installed on this server'; @@ -74,23 +72,30 @@ $lang->use_sso = 'SSO'; $lang->about_rewrite = 'If web server provides mod_rewrite, long URL such as http://blah/?document_srl=123 can be shortened like http://blah/123'; $lang->checking_rewrite = 'Checking whether "Friendly URL" feature is available...'; $lang->disable_rewrite = '"Friendly URL" feature is not available. Please check with the server administrator about mod_rewrite module support.'; -$lang->disable_rewrite_can_proceed = 'It is OK to continue to install and use RhymiX without the "Friendly URL" feature.'; +$lang->disable_rewrite_can_proceed = 'It is OK to continue to install and use Rhymix without the "Friendly URL" feature.'; $lang->about_nginx_rewrite = 'To use this feature at nginx, you need to configure rewrite. See here.'; $lang->time_zone = 'Time Zone'; $lang->about_time_zone = 'If the server time is different from your time zone, you can use this option to display times in your time zone.'; $lang->use_ssl = 'SSL'; -$lang->ssl_options['none'] = 'Never'; +$lang->ssl_options['none'] = 'None'; $lang->ssl_options['optional'] = 'Optional'; $lang->ssl_options['always'] = 'Always'; +$lang->use_sitelock = 'Site Lock'; +$lang->sitelock_options['none'] = 'None'; +$lang->sitelock_options['lock'] = 'Lock after Install'; +$lang->about_sitelock_after_install = 'If you lock your site, only your current IP range (%s) will be able to access your site.'; $lang->about_database_file = 'Sqlite saves data in a file. Location of the database file should be unreachable by web
    Data file should be inside the permission of 777.'; $lang->success_installed = 'Installation has been completed.'; +$lang->msg_db_checking = 'Checking...'; +$lang->msg_installing = 'Installing...'; $lang->msg_cannot_proc = 'Installation environment is not proper to proceed.'; -$lang->msg_already_installed = 'RhymiX is already installed.'; +$lang->msg_already_installed = 'Rhymix is already installed.'; $lang->msg_dbconnect_failed = 'An error has occurred while connecting to DB. Please check DB information again.'; $lang->msg_table_is_exists = 'Table is already created in the DB. Config file is recreated.'; -$lang->msg_install_completed = 'Installation has been completed. Thank you for choosing RhymiX.'; +$lang->msg_install_completed = 'Installation has been completed. Thank you for choosing Rhymix.'; $lang->msg_install_failed = 'An error has occurred while creating installation file.'; $lang->msg_create_table_failed = 'Failed to create database tables.'; +$lang->msg_table_already_exists = 'Database tables already exist. Try using a different prefix.'; $lang->ftp_get_list = 'Get List'; $lang->ftp_form_title = 'FTP Account Information'; $lang->ftp = 'FTP'; @@ -98,7 +103,7 @@ $lang->ftp_host = 'FTP hostname'; $lang->ftp_port = 'FTP server port'; $lang->about_ftp_password = 'FTP password will not be stored.'; $lang->cmd_check_ftp_connect = 'Check FTP Connection'; -$lang->msg_safe_mode_ftp_needed = 'When safe_mode setting of PHP is On, you should enter FTP account information to install RhymiX.'; +$lang->msg_safe_mode_ftp_needed = 'When safe_mode setting of PHP is On, you should enter FTP account information to install Rhymix.'; $lang->msg_safe_mode_ftp_needed2 = 'Easy installation or update of module is enabled.'; $lang->msg_safe_mode_ftp_config = 'This information is stored in files/config/ftp.config.php. You can add, change or delete this on the Settings page after the installation.'; $lang->msg_ftp_not_connected = 'Connection to the localhost via FTP failed. Please check the port number and whether the FTP service is available.'; @@ -107,7 +112,7 @@ $lang->msg_ftp_mkdir_fail = 'Failed to create a directory using FTP. Please chec $lang->msg_ftp_chmod_fail = 'Chmod failed. Please check the permission and configuration of the FTP server.'; $lang->msg_ftp_connect_success = 'Successfully connected to FTP server and authenticated.'; $lang->ftp_path_title = 'FTP Path Information'; -$lang->msg_ftp_installed_realpath = 'Absolute Path of RhymiX'; -$lang->msg_ftp_installed_ftp_realpath = 'RhymiX installation path'; +$lang->msg_ftp_installed_realpath = 'Absolute Path of Rhymix'; +$lang->msg_ftp_installed_ftp_realpath = 'Rhymix installation path'; $lang->db_config_php_validation = 'Validation of db.config.php'; $lang->msg_possible_only_file = 'You can upload files only.'; diff --git a/modules/install/lang/es.php b/modules/install/lang/es.php index 341cc9522..294d415dd 100644 --- a/modules/install/lang/es.php +++ b/modules/install/lang/es.php @@ -1,5 +1,5 @@ introduce_title = 'Instalación de RhymiX'; +$lang->introduce_title = 'Instalación de Rhymix'; $lang->install_checklist_title['php_version'] = 'Versión PHP'; $lang->install_checklist_title['permission'] = 'Permisos de carpeta files'; $lang->install_checklist_title['xml'] = 'xml / simplexml'; @@ -9,9 +9,9 @@ $lang->install_checklist_title['json'] = 'json'; $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'Configuración session.auto_start'; -$lang->install_checklist_desc['permission'] = '[Requerido] La ruta de la instalación de RhymiX o el directorio de ./archivos deberia tener la atribución 777'; +$lang->install_checklist_desc['permission'] = '[Requerido] La ruta de la instalación de Rhymix o el directorio de ./archivos deberia tener la atribución 777'; $lang->install_checklist_desc['xml'] = '[Requerido] Libreria XML es necesario para la comunicación de XML'; -$lang->install_checklist_desc['session'] = '[Requerido] Para el uso de la sesion de RhymiX, el archivo php.ini deberia estar configurada session.auto_start=0'; +$lang->install_checklist_desc['session'] = '[Requerido] Para el uso de la sesion de Rhymix, el archivo php.ini deberia estar configurada session.auto_start=0'; $lang->install_checklist_desc['iconv'] = 'Para transformar UTF-8 y otra paquete del idioma deberia estar instalado el Iconv.'; $lang->install_checklist_desc['gd'] = 'Libreria GD deberia estar instalado para utilizar la funcion de convertir la imagen'; $lang->install_checklist_xml = 'Instalar Librería XML '; @@ -24,10 +24,8 @@ $lang->install_permission_denied = 'La atribución de la ruta de instalacion no $lang->cmd_install_refresh_page = 'Refrescar'; $lang->cmd_install_next = 'Continuar la instalación'; $lang->cmd_recommended = 'Recomendado'; -$lang->db_desc['mysqli'] = 'Utilizando las funciones mysqli*() de PHP usar DB mysql.
    La transacción es desabilitado ya que DB(Bases de Datos) está creado por myisam.'; -$lang->db_desc['mysqli_innodb'] = 'Utilizando innodb usar BD mysql.
    La transacción es hablilitado para innodb'; -$lang->db_desc['mysql'] = 'Utilizando las funciones mysql_*() de PHP usar DB mysql.
    La transacción es desabilitado ya que DB(Bases de Datos) está creado por myisam.'; -$lang->db_desc['mysql_innodb'] = 'Utilizando innodb usar BD mysql.
    La transacción es hablilitado para innodb'; +$lang->db_desc['mysqli'] = 'Utilizando las funciones mysqli*() de PHP usar DB mysql.'; +$lang->db_desc['mysql'] = 'Utilizando las funciones mysql_*() de PHP usar DB mysql.'; $lang->db_desc['cubrid'] = 'Usar BD CUBRID. Manual'; $lang->db_desc['mssql'] = 'Usar Microsoft SQL Server.'; $lang->form_title = 'Ingresar BD & Información del Administrador;'; @@ -56,7 +54,7 @@ $lang->ssl_options['always'] = 'Utilice siempre el'; $lang->about_database_file = 'Sqlite guarda el dato en el archivo. Es necesario crear archivo de BD en un lugar inaccesible de la web.
    El archivo de dato debe estar ubicado en un lugar con la atribución 777.'; $lang->success_installed = 'Instalación finalizada'; $lang->msg_cannot_proc = 'No puede ser ejecutado lo requerido por no disponer del ambiente de instalación.'; -$lang->msg_already_installed = 'Instalación de RhymiX ya existe.'; +$lang->msg_already_installed = 'Instalación de Rhymix ya existe.'; $lang->msg_dbconnect_failed = 'Ha ocurrido un error en la conección de BD. Por favor chequee la información de BD nuevamente'; $lang->msg_table_is_exists = 'La tabla ya ha sido creado en BD. Creado nuevamente el archivo de configuración.'; $lang->msg_install_completed = 'Instalación finalizada. Muchas gracias.'; @@ -64,10 +62,10 @@ $lang->msg_install_failed = 'Ha ocurrido un error al crear el archivo de instala $lang->ftp_form_title = 'Datos de conexión para FTP'; $lang->ftp = 'FTP'; $lang->cmd_check_ftp_connect = 'conexión de FTP confirmada'; -$lang->msg_safe_mode_ftp_needed = 'Si la la variable safe_mode está activa[safe_mode=On], debe rellenar los datos de FTP para seguir instalando y usar con normalidad el RhymiX.'; +$lang->msg_safe_mode_ftp_needed = 'Si la la variable safe_mode está activa[safe_mode=On], debe rellenar los datos de FTP para seguir instalando y usar con normalidad el Rhymix.'; $lang->msg_ftp_not_connected = 'Ha ocurrico un error de conexión al FTP del localhost. Verifique el puerto del FTP y/o el funcionamiento del servicio FTP.'; $lang->msg_ftp_invalid_auth_info = 'Los datos de login para el FTP no son correctos. Veriféquelos.'; $lang->msg_ftp_mkdir_fail = 'Ha fallado el comando de FTP para la creación de directorio. Verifique la configuración del servicio FTP en el servidor'; $lang->msg_ftp_chmod_fail = 'Ha fallado el comando de FTP para la modificación de atributos de directorio. Verifique la configuración del servicio FTP en el servidor.'; $lang->msg_ftp_connect_success = 'conexión con éxito al FTP'; -$lang->msg_ftp_installed_ftp_realpath = '설치된 RhymiX의 FTP 절대경로'; +$lang->msg_ftp_installed_ftp_realpath = '설치된 Rhymix의 FTP 절대경로'; diff --git a/modules/install/lang/fr.php b/modules/install/lang/fr.php index 957d1f454..4d5a64573 100644 --- a/modules/install/lang/fr.php +++ b/modules/install/lang/fr.php @@ -1,5 +1,5 @@ introduce_title = 'Installation du RhymiX'; +$lang->introduce_title = 'Installation du Rhymix'; $lang->install_checklist_title['php_version'] = 'Version de PHP'; $lang->install_checklist_title['permission'] = 'Autorisations de dossier files'; $lang->install_checklist_title['xml'] = 'xml / simplexml'; @@ -9,9 +9,9 @@ $lang->install_checklist_title['json'] = 'json'; $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'Configuration de session.auto_start'; -$lang->install_checklist_desc['permission'] = '[Obligatoire] Chemin de l\'installation de RhymiX ou la permission de répertoire de ./files doit être 777'; +$lang->install_checklist_desc['permission'] = '[Obligatoire] Chemin de l\'installation de Rhymix ou la permission de répertoire de ./files doit être 777'; $lang->install_checklist_desc['xml'] = '[Obligatoire] La bibliothèque de XML est nécessaire pour la communication de XML'; -$lang->install_checklist_desc['session'] = '[Obligatoire] \'Session.auto_start\' dans le fichier de configuration pour PHP (php.ini) doit être égal à zéro car RhymiX utilise la session'; +$lang->install_checklist_desc['session'] = '[Obligatoire] \'Session.auto_start\' dans le fichier de configuration pour PHP (php.ini) doit être égal à zéro car Rhymix utilise la session'; $lang->install_checklist_desc['iconv'] = 'Iconv doit être installé afin de convertir UTF-8 et des autres assortiments des langues'; $lang->install_checklist_desc['gd'] = 'La bibliothèque de GD doit être installé afin d\'utiliser la fonction à convertir des images'; $lang->install_checklist_xml = 'Installation la bibliothèque de XML'; @@ -24,10 +24,8 @@ $lang->install_permission_denied = 'La permission du chemin d\'installation n\'e $lang->cmd_install_refresh_page = 'Rafraîchir'; $lang->cmd_install_next = 'Continuer à installer'; $lang->cmd_recommended = 'Recommandé'; -$lang->db_desc['mysqli'] = 'Utilisera fonction mysqli*() pour utiliser la base de données de mysql.
    La transaction sera invalidé parce que le fichier de Base de Données est créé par myisam.'; -$lang->db_desc['mysqli_innodb'] = 'Utilisera innodb pour utiliser Base de Données de mysql.
    La transaction sera validé pour innodb'; -$lang->db_desc['mysql'] = 'Utilisera fonction mysql_*() pour utiliser la base de données de mysql.
    La transaction sera invalidé parce que le fichier de Base de Données est créé par myisam.'; -$lang->db_desc['mysql_innodb'] = 'Utilisera innodb pour utiliser Base de Données de mysql.
    La transaction sera validé pour innodb'; +$lang->db_desc['mysqli'] = 'Utilisera fonction mysqli_*() pour utiliser la base de données de MySQL.'; +$lang->db_desc['mysql'] = 'Utilisera fonction mysql_*() pour utiliser la base de données de MySQL'; $lang->db_desc['cubrid'] = 'Utiliser la Base de Données de CUBRID. Manual'; $lang->db_desc['mssql'] = 'Utiliser la Base de Données de Microsoft SQL Server.'; $lang->can_use_when_installed = 'Pas installé sur ce serveur'; @@ -56,17 +54,17 @@ $lang->ssl_options['always'] = 'Toujours'; $lang->about_database_file = 'Sqlite conserve des données dans le fichier. Vous devez placer le fichier de la base de données où l\'on ne peut pas accéder par web.
    Le fichier des Donées doit être en dedans la permission 777.'; $lang->success_installed = 'Installation s\'est complété'; $lang->msg_cannot_proc = 'Environnement d\'Installation n\'est pas équipé à procéder.'; -$lang->msg_already_installed = 'RhymiX est déjà installé'; +$lang->msg_already_installed = 'Rhymix est déjà installé'; $lang->msg_dbconnect_failed = 'Erreur a lieu en essayant connecter à la Base de Données. Vérifiez encore une fois les informations sur la Base de Données, S.V.P.'; $lang->msg_table_is_exists = 'La Table est déjà créée dans la Base de Données. Le fichier de Configuration est recréé.'; -$lang->msg_install_completed = 'Installation a complété. Merci pour choisir RhymiX.'; +$lang->msg_install_completed = 'Installation a complété. Merci pour choisir Rhymix.'; $lang->msg_install_failed = 'Une erreur a lieu en créant le fichier d\'installation.'; $lang->ftp_form_title = 'FTP 정보 입력'; $lang->ftp = 'FTP'; -$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해야 RhymiX의 설치 및 사용이 가능합니다'; +$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해야 Rhymix의 설치 및 사용이 가능합니다'; $lang->msg_ftp_not_connected = 'localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인하거나 ftp 서비스가 가능한지 확인해주세요'; $lang->msg_ftp_invalid_auth_info = '입력한 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요'; $lang->msg_ftp_mkdir_fail = 'FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요'; $lang->msg_ftp_chmod_fail = 'FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요'; $lang->msg_ftp_connect_success = 'FTP 접속 및 인증 성공하였습니다'; -$lang->msg_ftp_installed_ftp_realpath = '설치된 RhymiX의 FTP 절대경로'; +$lang->msg_ftp_installed_ftp_realpath = '설치된 Rhymix의 FTP 절대경로'; diff --git a/modules/install/lang/ja.php b/modules/install/lang/ja.php index 14d50a39a..857aff19f 100644 --- a/modules/install/lang/ja.php +++ b/modules/install/lang/ja.php @@ -1,5 +1,5 @@ introduce_title = 'RhymiXのインストール'; +$lang->introduce_title = 'Rhymixのインストール'; $lang->enviroment_gather = 'インストール環境収集に同意する'; $lang->input_dbinfo_by_dbtype = '%s 情報入力'; $lang->install_progress_menu['language'] = '言語の選択'; @@ -27,10 +27,10 @@ $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_startの設定'; $lang->install_checklist_title['db_support'] = 'DBサポート'; $lang->install_checklist_desc['php_version'] = '[必修] %s以上のPHPバージョンでインストールが可能です。'; -$lang->install_checklist_desc['php_version_warning'] = '[推奨] RhymiXはPHP %sバージョン以上をおすすめします。'; -$lang->install_checklist_desc['permission'] = '【必須】RhymiXのインストール先、または「./files」ディレクトリのパーミッションを「777」に設定してください。'; +$lang->install_checklist_desc['php_version_warning'] = '[推奨] RhymixはPHP %sバージョン以上をおすすめします。'; +$lang->install_checklist_desc['permission'] = '【必須】Rhymixのインストール先、または「./files」ディレクトリのパーミッションを「777」に設定してください。'; $lang->install_checklist_desc['xml'] = '【必須】XML通信のためにXMLライブラリが必要です。'; -$lang->install_checklist_desc['session'] = '【必須】RhymiXでは、セッションを使用しているため、「php.ini」の設定を「session.auto_start=0」にしてください。'; +$lang->install_checklist_desc['session'] = '【必須】Rhymixでは、セッションを使用しているため、「php.ini」の設定を「session.auto_start=0」にしてください。'; $lang->install_checklist_desc['iconv'] = 'UTF-8と多言語サポート及び文字コード変換のため、「iconv」をインストールする必要があります。'; $lang->install_checklist_desc['gd'] = 'イメージ変換機能を使用するためには、「GDライブラリ」をインストールする必要があります。'; $lang->install_checklist_xml = 'XMLライブラリのインストール'; @@ -45,10 +45,8 @@ $lang->cmd_install_refresh_page = 'リフレッシュ'; $lang->cmd_install_next = 'インストールを続けます。'; $lang->cmd_ignore = 'FTP設定を省略する'; $lang->cmd_recommended = '推奨'; -$lang->db_desc['mysqli'] = 'mysqliモジュールを使用してMySQL DBに接続します。
    MyISAMのエンジンを使用するので、トランザクションが行われず、データの損傷の危険があります。'; -$lang->db_desc['mysqli_innodb'] = 'mysqliモジュールを使用してMySQL DBに接続します。
    InnoDBのエンジンは、トランザクションを支援してデータの損傷の危険が低く、同時処理能力が優れています。'; -$lang->db_desc['mysql'] = 'PHPのmysql_*()関数を使用してMySQL DBに接続します。
    MyISAMのエンジンを使用するので、トランザクションが行われず、データの損傷の危険があります。'; -$lang->db_desc['mysql_innodb'] = 'PHPのmysql_*()関数を使用してMySQL DBに接続します。
    InnoDBのエンジンは、トランザクションを支援してデータの損傷の危険が低く、同時処理能力が優れています。'; +$lang->db_desc['mysqli'] = 'mysqliモジュールを使用してMySQL DBに接続します。'; +$lang->db_desc['mysql'] = 'mysql_*()関数を使用してMySQL DBに接続します。'; $lang->db_desc['cubrid'] = 'CUBRID DBを利用します。 Manual'; $lang->db_desc['mssql'] = 'Microsoft SQL Serverを利用します。'; $lang->can_use_when_installed = 'このサーバーにインストールされていません'; @@ -72,7 +70,7 @@ $lang->use_sso = 'SSO使用'; $lang->about_rewrite = 'Webサーバで「リライト・モジュール(mod_rewrite)」をサポートしている場合は、「http://アドレス/?document_srl=123」のようなアドレスを、動的だけど「http://アドレス/123」のように静的なページに見せることができます。'; $lang->checking_rewrite = '短縮アドレスを使用できるかどうかを確認しています...'; $lang->disable_rewrite = '短縮アドレスを使用できません。ウェブサーバー担当者に mod_rewriteサポート可否を確認してください。'; -$lang->disable_rewrite_can_proceed = 'この機能は、RhymiXをインストールと使用するために必要ではありません。'; +$lang->disable_rewrite_can_proceed = 'この機能は、Rhymixをインストールと使用するために必要ではありません。'; $lang->about_nginx_rewrite = 'nginxを使用する場合、短縮アクセスを使用するためにrewrite設定が必要です。設定方法はこのページを参考ください。'; $lang->time_zone = 'タイムゾーン'; $lang->about_time_zone = 'サーバの設定時間とサービスしているローカル時間との差がある場合、タイムゾーンを指定して表示時間を合わせることができます。'; @@ -80,6 +78,10 @@ $lang->use_ssl = 'SSLを使用'; $lang->ssl_options['none'] = '使わない'; $lang->ssl_options['optional'] = '部分的に使う'; $lang->ssl_options['always'] = '常に使う'; +$lang->use_sitelock = 'サイトロック'; +$lang->sitelock_options['none'] = '使わない'; +$lang->sitelock_options['lock'] = 'ロック'; +$lang->about_sitelock_after_install = 'サイトをロックすると、インストールに使用したIP帯域(%s)以外接続できなくなるので注意してください。'; $lang->about_database_file = 'Sqliteはファイルにデータを保存します。そのため、データベースファイルにはウェブからアクセスできない場所にしなければなりません。
    データファイルのパーミッションは「777」に設定してください。'; $lang->success_installed = '正常にインストールされました。'; $lang->msg_cannot_proc = 'インストールできる環境が整っていないため、リクエストを実行できませんでした。'; @@ -95,7 +97,7 @@ $lang->ftp_host = 'FTPサーバーアドレス'; $lang->ftp_port = 'FTPサーバーポート'; $lang->about_ftp_password = 'FTP情報は保存できません。'; $lang->cmd_check_ftp_connect = 'FTP接続を確認する'; -$lang->msg_safe_mode_ftp_needed = 'PHPのsafe_modeがOnの場合、FTP情報を登録することで、RhymiXのインストール及び利用が可能になります。'; +$lang->msg_safe_mode_ftp_needed = 'PHPのsafe_modeがOnの場合、FTP情報を登録することで、Rhymixのインストール及び利用が可能になります。'; $lang->msg_safe_mode_ftp_needed2 = 'モジュールのイージーインストール、または更新が可能になります。'; $lang->msg_ftp_not_connected = 'localhostへのFTP接続エラーが発生しました。FTPポート(port)番号をはじめ、FTPサービスが可能であるかを確認してください。'; $lang->msg_ftp_invalid_auth_info = 'ログインに失敗しました。FTPアクセス情報を再度確認してください。'; @@ -103,7 +105,7 @@ $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->msg_ftp_installed_realpath = 'インストールされたRhymiXの絶対パス'; -$lang->msg_ftp_installed_ftp_realpath = 'インストールされたRhymiXのFTP絶対パス設定'; +$lang->msg_ftp_installed_realpath = 'インストールされたRhymixの絶対パス'; +$lang->msg_ftp_installed_ftp_realpath = 'インストールされたRhymixのFTP絶対パス設定'; $lang->db_config_php_validation = 'db.config.php 有効性確認'; $lang->msg_possible_only_file = 'ファイルのみアップロード可能です。'; diff --git a/modules/install/lang/ko.php b/modules/install/lang/ko.php index e30fdfe59..51092c35d 100644 --- a/modules/install/lang/ko.php +++ b/modules/install/lang/ko.php @@ -1,5 +1,5 @@ introduce_title = 'RhymiX 설치'; +$lang->introduce_title = 'Rhymix 설치'; $lang->enviroment_gather = '설치 환경 수집 동의'; $lang->input_dbinfo_by_dbtype = '%s 정보입력'; $lang->install_progress_menu['language'] = '설치 언어 선택'; @@ -26,11 +26,11 @@ $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_start 설정'; $lang->install_checklist_title['db_support'] = 'DB 지원'; -$lang->install_checklist_desc['php_version'] = '[필수] RhymiX를 설치하려면 PHP 버전이 %s 이상이어야 합니다.'; -$lang->install_checklist_desc['php_version_warning'] = '[권장] RhymiX는 PHP %s 이상을 권장합니다.'; -$lang->install_checklist_desc['permission'] = '[필수] RhymiX의 설치 경로 또는 ./files 디렉토리의 퍼미션이 777이어야 합니다.'; +$lang->install_checklist_desc['php_version'] = '[필수] Rhymix를 설치하려면 PHP 버전이 %s 이상이어야 합니다.'; +$lang->install_checklist_desc['php_version_warning'] = '[권장] Rhymix는 PHP %s 이상을 권장합니다.'; +$lang->install_checklist_desc['permission'] = '[필수] Rhymix의 설치 경로 또는 ./files 디렉토리의 퍼미션이 777이어야 합니다.'; $lang->install_checklist_desc['xml'] = '[필수] XML통신을 위하여 XML 라이브러리가 필요합니다.'; -$lang->install_checklist_desc['session'] = '[필수] RhymiX에서 세션 사용을 위해 php.ini 설정의 session.auto_start=0 이어야 합니다.'; +$lang->install_checklist_desc['session'] = '[필수] Rhymix에서 세션 사용을 위해 php.ini 설정의 session.auto_start=0 이어야 합니다.'; $lang->install_checklist_desc['iconv'] = 'UTF-8과 다른 언어셋의 변환을 위한 iconv설치가 필요합니다.'; $lang->install_checklist_desc['gd'] = '이미지변환 기능을 사용하기 위해 GD라이브러리가 설치되어 있어야 합니다.'; $lang->install_checklist_xml = 'XML 라이브러리 설치'; @@ -45,10 +45,8 @@ $lang->cmd_install_refresh_page = '새로고침'; $lang->cmd_install_next = '설치를 진행합니다.'; $lang->cmd_ignore = '무시'; $lang->cmd_recommended = '권장'; -$lang->db_desc['mysqli'] = 'mysqli 모듈을 사용하여 MySQL DB에 접속합니다.
    MyISAM 저장엔진을 사용하므로 트랜잭션이 이루어지지 않으며 데이터 손상의 위험이 있습니다.'; -$lang->db_desc['mysqli_innodb'] = 'mysqli 모듈을 사용하여 MySQL DB에 접속합니다.
    InnoDB 저장엔진은 트랜잭션을 지원하여 데이터 손상의 위험이 낮으며, 동시 처리 능력이 뛰어납니다.'; -$lang->db_desc['mysql'] = 'PHP의 mysql_*() 함수를 사용하여 MySQL DB에 접속합니다.
    MyISAM 저장엔진을 사용하므로 트랜잭션이 이루어지지 않으며 데이터 손상의 위험이 있습니다.'; -$lang->db_desc['mysql_innodb'] = 'PHP의 mysql_*() 함수를 사용하여 MySQL DB에 접속합니다.
    InnoDB 저장엔진은 트랜잭션을 지원하여 데이터 손상의 위험이 낮으며, 동시 처리 능력이 뛰어납니다.'; +$lang->db_desc['mysqli'] = 'mysqli 모듈을 사용하여 MySQL DB에 접속합니다.'; +$lang->db_desc['mysql'] = 'mysql_*() 함수를 사용하여 MySQL DB에 접속합니다.'; $lang->db_desc['cubrid'] = 'CUBRID DB를 이용합니다. Manual'; $lang->db_desc['mssql'] = 'Microsoft SQL Server를 이용합니다.'; $lang->can_use_when_installed = '설치되어 있지 않음'; @@ -74,7 +72,7 @@ $lang->use_sso = 'SSO 사용'; $lang->about_rewrite = '이 기능을 사용하면 http://yourdomain/?document_srl=123 과 같이 복잡한 주소를 http://yourdomain/123 과 같이 간단하게 줄일 수 있습니다. 웹 서버에서 mod_rewrite를 지원해야 합니다. 지원 여부는 서버 관리자에게 문의하세요.'; $lang->checking_rewrite = '짧은 주소를 사용할 수 있는지 확인하는 중입니다...'; $lang->disable_rewrite = '짧은 주소를 사용할 수 없습니다. 웹 서버 담당자에게 mod_rewrite 지원 여부를 확인 바랍니다.'; -$lang->disable_rewrite_can_proceed = '짧은 주소를 사용할 수 없더라도 RhymiX 설치와 사용에는 지장이 없습니다.'; +$lang->disable_rewrite_can_proceed = '짧은 주소를 사용할 수 없더라도 Rhymix 설치와 사용에는 지장이 없습니다.'; $lang->about_nginx_rewrite = 'nginx에서 짧은 주소를 사용하려면 rewrite 설정이 필요합니다. 여기를 참고하세요.'; $lang->time_zone = '표준 시간대'; $lang->about_time_zone = '서버의 시간과 주 사용자의 시간이 다를 경우 (예: 해외 서버인 경우) 원하는 표준 시간대를 선택할 수 있습니다.'; @@ -82,15 +80,22 @@ $lang->use_ssl = 'SSL 사용'; $lang->ssl_options['none'] = '사용 안함'; $lang->ssl_options['optional'] = '선택적으로'; $lang->ssl_options['always'] = '항상 사용'; +$lang->use_sitelock = '사이트 잠금'; +$lang->sitelock_options['none'] = '사용 안함'; +$lang->sitelock_options['lock'] = '잠금 상태로 설치'; +$lang->about_sitelock_after_install = '사이트를 잠그면 설치에 사용하신 IP 대역 (%s) 외에는 접속할 수 없게 되니 주의하십시오.'; $lang->about_database_file = 'Sqlite는 파일에 데이터를 저장합니다. 데이터베이스 파일의 위치를 웹에서 접근할 수 없는 곳으로 해야 합니다.
    데이터 파일은 777퍼미션 설정된 곳으로 지정해주세요.'; $lang->success_installed = '설치가 되었습니다.'; $lang->msg_cannot_proc = '설치 환경이 갖춰지지 않아 요청을 실행할 수가 없습니다.'; +$lang->msg_db_checking = '확인 중입니다...'; +$lang->msg_installing = '설치 중입니다...'; $lang->msg_already_installed = '이미 설치가 되어 있습니다.'; $lang->msg_dbconnect_failed = 'DB접속 오류가 발생하였습니다. DB정보를 다시 확인해주세요.'; $lang->msg_table_is_exists = '이미 DB에 테이블이 생성되어 있습니다. config 파일을 재생성하였습니다.'; $lang->msg_install_completed = '설치가 완료되었습니다. 감사합니다.'; $lang->msg_install_failed = '설치 파일 생성 시에 오류가 발생하였습니다.'; $lang->msg_create_table_failed = 'DB 테이블 생성에 실패했습니다.'; +$lang->msg_table_already_exists = 'DB 테이블이 이미 존재합니다. 다른 사이트에서 사용중인 DB라면 테이블 접두사를 바꾸어 보십시오.'; $lang->ftp_get_list = '목록 가져오기'; $lang->ftp_form_title = 'FTP 계정 정보 입력'; $lang->ftp = 'FTP'; @@ -98,7 +103,7 @@ $lang->ftp_host = 'FTP 서버 주소'; $lang->ftp_port = 'FTP 서버 포트'; $lang->about_ftp_password = '비밀번호는 FTP 경로 확인을 위한 FTP 접속 시 필요하며 사용 후 저장하지 않습니다.'; $lang->cmd_check_ftp_connect = 'FTP 접속 확인'; -$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode=On일 경우 RhymiX의 정상적인 동작을 돕습니다.'; +$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode=On일 경우 Rhymix의 정상적인 동작을 돕습니다.'; $lang->msg_safe_mode_ftp_needed2 = '모듈의 쉬운 설치 또는 업데이트가 가능해 집니다.'; $lang->msg_safe_mode_ftp_config = '이 정보는 files/config/ftp.config.php 파일에 저장 됩니다. 설치 후 환경설정 페이지에서도 등록, 변경, 제거 할 수 있습니다.'; $lang->msg_ftp_not_connected = 'localhost로의 FTP 접속 오류가 발생했습니다. FTP 포트 번호를 확인하거나 FTP 서비스가 가능한지 확인해주세요.'; @@ -107,7 +112,7 @@ $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->msg_ftp_installed_realpath = '설치된 RhymiX의 절대경로'; -$lang->msg_ftp_installed_ftp_realpath = 'RhymiX 설치 경로'; +$lang->msg_ftp_installed_realpath = '설치된 Rhymix의 절대경로'; +$lang->msg_ftp_installed_ftp_realpath = 'Rhymix 설치 경로'; $lang->db_config_php_validation = 'db.config.php 유효성 확인'; $lang->msg_possible_only_file = '파일만 업로드 가능합니다.'; diff --git a/modules/install/lang/mn.php b/modules/install/lang/mn.php index db0a212e7..d3869234d 100644 --- a/modules/install/lang/mn.php +++ b/modules/install/lang/mn.php @@ -2,7 +2,7 @@ $lang->ftp_form_title = 'FTP мэдээлэл оруулах'; $lang->ftp = 'FTP'; $lang->cmd_check_ftp_connect = 'FTP холболт шалгах'; -$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode가 Onбайх тохиолдолд , FTP мэдээллийг заавал оруулснаар RhymiX идэвжvvлэх болон хэрэглэх боломжтой болно.'; +$lang->msg_safe_mode_ftp_needed = 'PHP의 safe_mode가 Onбайх тохиолдолд , FTP мэдээллийг заавал оруулснаар Rhymix идэвжvvлэх болон хэрэглэх боломжтой болно.'; $lang->msg_ftp_not_connected = 'localhost-ын FTP холболт амжилтгvй боллоо. FTP дугаараа шалгах буюу эсвэл FTP vйлчилгээг ашиглах боломжтой эсэхээ шалгана уу.'; $lang->msg_ftp_invalid_auth_info = 'Таны оруулсан FTP мэдээллээр нэвтэрч чадсангvй. FTPмэдээллээ шалгана уу.'; $lang->msg_ftp_mkdir_fail = 'FTP-г ашиглан eгсeн eгeгдлийг биелvvлж чадсангvй. FTP серверийн идэвхжvvлэлтээ шалгана уу.'; diff --git a/modules/install/lang/ru.php b/modules/install/lang/ru.php index f936bb0b3..041ee560d 100644 --- a/modules/install/lang/ru.php +++ b/modules/install/lang/ru.php @@ -1,5 +1,5 @@ introduce_title = 'Установка RhymiX'; +$lang->introduce_title = 'Установка Rhymix'; $lang->install_checklist_title['php_version'] = 'Версия PHP'; $lang->install_checklist_title['permission'] = 'права доступа к папке files'; $lang->install_checklist_title['xml'] = 'xml / simplexml'; @@ -9,9 +9,9 @@ $lang->install_checklist_title['json'] = 'json'; $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_start настройка'; -$lang->install_checklist_desc['permission'] = '[Требуется] Путь установки RhymiX или директория ./files должна иметь права доступа 777'; +$lang->install_checklist_desc['permission'] = '[Требуется] Путь установки Rhymix или директория ./files должна иметь права доступа 777'; $lang->install_checklist_desc['xml'] = '[Требуется] XML Библиотека нужна для XML коммуникации'; -$lang->install_checklist_desc['session'] = '[Требуется] Файл настроек PHP (php.ini) \'Session.auto_start\' должен быть равен нулю, чтобы RhymiX могла использовать сессии'; +$lang->install_checklist_desc['session'] = '[Требуется] Файл настроек PHP (php.ini) \'Session.auto_start\' должен быть равен нулю, чтобы Rhymix могла использовать сессии'; $lang->install_checklist_desc['iconv'] = 'Iconv должна быть установлена для конвертирования между UTF-8 и иными языковыми кодировками'; $lang->install_checklist_desc['gd'] = 'GD Библиотека должна быть установлена для использования функции конвертироваия изображений'; $lang->install_checklist_xml = 'Установить XML библиотеку'; @@ -24,10 +24,8 @@ $lang->install_permission_denied = 'Права доступа пути не ус $lang->cmd_install_refresh_page = 'обновление'; $lang->cmd_install_next = 'Продолжить установку'; $lang->cmd_recommended = 'рекомендуемые'; -$lang->db_desc['mysqli'] = 'Используем mysqli*() функцию, чтобы использовать базу данных mysql.
    Транзакция отключена из-за того, что файл базы данных создан посредством myisam.'; -$lang->db_desc['mysqli_innodb'] = 'Используем innodb чтобы использовать базу данных mysql.
    Транзакция включена для innodb'; -$lang->db_desc['mysql'] = 'Используем mysql_*() функцию, чтобы использовать базу данных mysql.
    Транзакция отключена из-за того, что файл базы данных создан посредством myisam.'; -$lang->db_desc['mysql_innodb'] = 'Используем innodb чтобы использовать базу данных mysql.
    Транзакция включена для innodb'; +$lang->db_desc['mysqli'] = 'Используем mysqli_*() функцию, чтобы использовать базу данных mysql.'; +$lang->db_desc['mysql'] = 'Используем mysql_*() функцию, чтобы использовать базу данных mysql.'; $lang->db_desc['cubrid'] = 'Используем CUBRID DB. Manual'; $lang->db_desc['mssql'] = 'Используем Microsoft SQL Server DB.'; $lang->form_title = 'Пожалуйста, введите дазу данных & Административная Информация'; @@ -56,10 +54,10 @@ $lang->ssl_options['always'] = 'Всегда'; $lang->about_database_file = 'Sqlite сохраняет данные в файл. Размещение базы данных должно быть недоступно с веб
    Файл базы данных должен иметь права доступа 777.'; $lang->success_installed = 'Установка завершена'; $lang->msg_cannot_proc = 'Невозможно исполнить запрос, поскольку окружение установки не указано'; -$lang->msg_already_installed = 'RhymiX уже установлена'; +$lang->msg_already_installed = 'Rhymix уже установлена'; $lang->msg_dbconnect_failed = 'Произошла ошибка подключения к базе данных. Пожалуйста, проверьте иформацию базы данных еще раз'; $lang->msg_table_is_exists = 'Таблица существует в базе данных. Файл конфигурации создан заново'; -$lang->msg_install_completed = 'Установка завершена. Спасибо Вам за выбор RhymiX.'; +$lang->msg_install_completed = 'Установка завершена. Спасибо Вам за выбор Rhymix.'; $lang->msg_install_failed = 'Произошла ошибка при создании файла конфигурации.'; $lang->ftp_form_title = 'Введите данные FTP'; $lang->ftp = 'FTP'; diff --git a/modules/install/lang/tr.php b/modules/install/lang/tr.php index 3ab533f8d..4a811e07b 100644 --- a/modules/install/lang/tr.php +++ b/modules/install/lang/tr.php @@ -9,9 +9,9 @@ $lang->install_checklist_title['json'] = 'json'; $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_start(otomatik.oturum_acma) ayarı'; -$lang->install_checklist_desc['permission'] = '[Gerekli] RhymiX kurulum yolu ya da ./files directory yolunun yetkisi 777 olmalıdır'; +$lang->install_checklist_desc['permission'] = '[Gerekli] Rhymix kurulum yolu ya da ./files directory yolunun yetkisi 777 olmalıdır'; $lang->install_checklist_desc['xml'] = '[Gerekli] XML iletişimi için XML kitaplığı gereklidir.'; -$lang->install_checklist_desc['session'] = '[Gerekli] PHP ayar dosyasındaki (php.ini) \'Session.auto_start\' RhymiX\'nin oturumu kullanabilmesi için sıfıra eşit olmalıdır'; +$lang->install_checklist_desc['session'] = '[Gerekli] PHP ayar dosyasındaki (php.ini) \'Session.auto_start\' Rhymix\'nin oturumu kullanabilmesi için sıfıra eşit olmalıdır'; $lang->install_checklist_desc['iconv'] = 'Iconv, UTF-8 ve diğer dil ayarlarını değiştirebilmek için kurulmuş olmalıdır'; $lang->install_checklist_desc['gd'] = 'GD Kitaplığı, resim değiştirme özelliğini kullanabilmek için kurulmuş, olmalıdır'; $lang->install_checklist_xml = 'XML Kitaplığını Kur'; @@ -25,10 +25,8 @@ $lang->cmd_install_refresh_page = 'Gerekli koşulları tamamladım.'; $lang->cmd_install_next = 'Kuruluma Devam Et'; $lang->cmd_ignore = 'Önemseme'; $lang->cmd_recommended = 'Tavsiye edilen'; -$lang->db_desc['mysqli'] = 'PHP\'de mysqli*() özellikleri için MySQL\'ü veritabanı olarak kullanınız.
    İşlemler, veritabanı dosyası myisam \'da oluşturulduğu zaman işlenmeyecektir.'; -$lang->db_desc['mysqli_innodb'] = 'innodb ile MySQL\'ü veritabanı olrak kullanınız.
    İşlemler, innodb ile işlenecektir'; -$lang->db_desc['mysql'] = 'PHP\'de mysql_*() özellikleri için MySQL\'ü veritabanı olarak kullanınız.
    İşlemler, veritabanı dosyası myisam \'da oluşturulduğu zaman işlenmeyecektir.'; -$lang->db_desc['mysql_innodb'] = 'innodb ile MySQL\'ü veritabanı olrak kullanınız.
    İşlemler, innodb ile işlenecektir'; +$lang->db_desc['mysqli'] = 'PHP\'de mysqli_*() özellikleri için MySQL\'ü veritabanı olarak kullanınız.'; +$lang->db_desc['mysql'] = 'PHP\'de mysql_*() özellikleri için MySQL\'ü veritabanı olarak kullanınız.'; $lang->db_desc['cubrid'] = 'CUBRID\'ü veritabanı olarak kullanın. Daha fazla bilgi için Manueli inceleyiniz'; $lang->db_desc['mssql'] = 'Microsoft SQL Server\'ü veritabanı olarak kullanın'; $lang->form_title = 'Veritabanı & Yönetici Bilgisi'; @@ -56,10 +54,10 @@ $lang->ssl_options['always'] = 'Her zaman'; $lang->about_database_file = 'Sqlite veriyi dosyaya kaydeder. Veritabanı dosyası tarayıcıyla erişilebilir olmamalıdır.
    Veri dosyası 777 yetki kapsamı içinde olmalıdır.'; $lang->success_installed = 'Kurulum tamamlandı'; $lang->msg_cannot_proc = 'Kurulum ortamı devam etmek için uygun değil.'; -$lang->msg_already_installed = 'RhymiX zaten kurulmuştur'; +$lang->msg_already_installed = 'Rhymix zaten kurulmuştur'; $lang->msg_dbconnect_failed = 'VT\'ye ulaşırken bir hata oluştu. Lütfen VT bilgisini tekrar kontrol ediniz'; $lang->msg_table_is_exists = 'Tablo zaten VT\'da oluşturuldu. Yapılandırma dosyası yeniden oluşturuldu'; -$lang->msg_install_completed = 'Kurulum tamamlandı. RhymiX\'yi seçtiğiniz için teşekkür ederiz.'; +$lang->msg_install_completed = 'Kurulum tamamlandı. Rhymix\'yi seçtiğiniz için teşekkür ederiz.'; $lang->msg_install_failed = 'Kurulum dosyası oluşturulurken bir hata oluştu.'; $lang->ftp_get_list = 'Liste Al'; $lang->ftp_form_title = 'FTP Hesap Bilgileri'; @@ -68,13 +66,13 @@ $lang->ftp_host = 'FTP sistem adı'; $lang->ftp_port = 'FTP portu'; $lang->about_ftp_password = 'FTP şifresi saklanmayacaktır.'; $lang->cmd_check_ftp_connect = 'FTP Bağlantısını kontrol ediniz'; -$lang->msg_safe_mode_ftp_needed = 'Eğer PHP güvenli mod ayarları etkinse, RhymiX\'yi kurmak için FTP hesap bilgilerini girmelisiniz.'; +$lang->msg_safe_mode_ftp_needed = 'Eğer PHP güvenli mod ayarları etkinse, Rhymix\'yi kurmak için FTP hesap bilgilerini girmelisiniz.'; $lang->msg_ftp_not_connected = 'Yerel web alanına FTP bağlantısı sağlanamadı. Lütfen port numarasını ve FTP servisinin mevcut olup-olmadığını kontrol ediniz .'; $lang->msg_ftp_invalid_auth_info = 'Kimlik doğrulama başarısız oldu. Lütfen kullanıcı adını ve şifreyi kontrol ediniz.'; $lang->msg_ftp_mkdir_fail = 'Dizin oluşturma başarısız oldu. Lütfen FTP hesap iznini kontrol ediniz.'; $lang->msg_ftp_chmod_fail = 'Chmod başarılamadı. Lütfen FTP sunucusunun izin ve yapılandırmasını kontrol ediniz.'; $lang->msg_ftp_connect_success = 'FTP sunucusu için bağlantı ve kimlik doğrulama sağlandı.'; $lang->ftp_path_title = 'FTP Yolu Bilgileri'; -$lang->msg_ftp_installed_realpath = 'RhymiX Salt Yolu'; -$lang->msg_ftp_installed_ftp_realpath = 'RhymiX Salt FTP Yolu'; +$lang->msg_ftp_installed_realpath = 'Rhymix Salt Yolu'; +$lang->msg_ftp_installed_ftp_realpath = 'Rhymix Salt FTP Yolu'; $lang->msg_possible_only_file = 'Sadece dosyalarını yükleyebilirsiniz.'; diff --git a/modules/install/lang/vi.php b/modules/install/lang/vi.php index c92079840..9ca0ca2ab 100644 --- a/modules/install/lang/vi.php +++ b/modules/install/lang/vi.php @@ -1,12 +1,12 @@ introduce_title = 'Cài đặt RhymiX'; +$lang->introduce_title = 'Cài đặt Rhymix'; $lang->install_progress_menu['language'] = 'Chọn ngôn ngữ cài đặt'; $lang->install_checklist_title['php_version'] = 'Phiên bản PHP'; $lang->install_checklist_title['permission'] = 'Điều khoản thư mục files'; $lang->install_checklist_title['session'] = 'Thiết lập session.auto_start'; -$lang->install_checklist_desc['permission'] = '[Bắt buộc] Thư mục cài đặt của RhymiX hay ./files directory phải CHMOD thành 777'; +$lang->install_checklist_desc['permission'] = '[Bắt buộc] Thư mục cài đặt của Rhymix hay ./files directory phải CHMOD thành 777'; $lang->install_checklist_desc['xml'] = '[Bắt buộc] XML Library cần thiết cho việc truyền thông File XML.'; -$lang->install_checklist_desc['session'] = '[Bắt buộc] File thiết lập của PHP (php.ini) \'Session.auto_start\' phải là 0 theo thứ tự số cho phiên làm việc của RhymiX hoạt động.'; +$lang->install_checklist_desc['session'] = '[Bắt buộc] File thiết lập của PHP (php.ini) \'Session.auto_start\' phải là 0 theo thứ tự số cho phiên làm việc của Rhymix hoạt động.'; $lang->install_checklist_desc['iconv'] = 'Iconv cần phải được cài đặt cho việc chuyển đổi ngôn ngữ thàng UTFF-8 của những ngôn ngữ khác.'; $lang->install_checklist_desc['gd'] = 'GD Library cần phải được cài đặt cho việc chuyển đổi hình ảnh.'; $lang->install_checklist_xml = 'Cài đặt XML Library'; @@ -20,10 +20,8 @@ $lang->cmd_install_refresh_page = 'Tôi đã thay đổi để phù hợp với $lang->cmd_install_next = 'Tiếp tục cài đặt'; $lang->cmd_ignore = 'Bỏ qua'; $lang->cmd_recommended = 'Đê'; -$lang->db_desc['mysqli'] = 'Dùng chức năng mysqli*() để sử dụng MySql Database.
    Giao dịch được vô hiệu hóa bởi File Database được tạo ra bởi myisam.'; -$lang->db_desc['mysqli_innodb'] = 'Dùng chức năng innodb để sử dụng MySql Database.
    Giao dịch được kích hoạt cho innodb'; -$lang->db_desc['mysql'] = 'Dùng chức năng mysql_*() để sử dụng MySql Database.
    Giao dịch được vô hiệu hóa bởi File Database được tạo ra bởi myisam.'; -$lang->db_desc['mysql_innodb'] = 'Dùng chức năng innodb để sử dụng MySql Database.
    Giao dịch được kích hoạt cho innodb'; +$lang->db_desc['mysqli'] = 'Dùng chức năng mysqli_*() để sử dụng MySql Database.'; +$lang->db_desc['mysql'] = 'Dùng chức năng mysql_*() để sử dụng MySql Database.'; $lang->db_desc['cubrid'] = 'Sử dụng CUBRID Database. Hướng dẫn'; $lang->form_title = 'Hãy nhập thông tin Database và thông tin Administrator'; $lang->db_title = 'Xin hãy nhập thông tin Database'; @@ -49,12 +47,12 @@ $lang->ssl_options['none'] = 'Không sử dụng'; $lang->ssl_options['optional'] = 'Tùy chỉnh'; $lang->ssl_options['always'] = 'Luôn luôn'; $lang->about_database_file = 'Sqlite lưu trữ dữ liệu trong một File, vì vậy cần tới sự truy cập đến nó trong Database.
    Hãy CHMOD thành 777.'; -$lang->success_installed = 'Chúc mừng bạn đã cài đặt RhymiX thành công!'; +$lang->success_installed = 'Chúc mừng bạn đã cài đặt Rhymix thành công!'; $lang->msg_cannot_proc = 'Môi trường cài đặt không thích hợp.'; -$lang->msg_already_installed = 'Một phiên bản nào đó của RhymiX đã được cài đặt từ trước.
    Xin hãy kiểm tra lại!'; +$lang->msg_already_installed = 'Một phiên bản nào đó của Rhymix đã được cài đặt từ trước.
    Xin hãy kiểm tra lại!'; $lang->msg_dbconnect_failed = 'Đã có lỗi xảy ra khi kết nối tới Database. Xin vui lòng kiểm tra lại thông tin!'; $lang->msg_table_is_exists = 'Table đã có sẵn trên Database. File Config đã đuwọc thiết lập lại.'; -$lang->msg_install_completed = 'Đã cài đặt RhymiX thành công!. Xin cảm ơn đã sử dụng RhymiX!'; +$lang->msg_install_completed = 'Đã cài đặt Rhymix thành công!. Xin cảm ơn đã sử dụng Rhymix!'; $lang->msg_install_failed = 'Đã có lỗi xảy ra khi tạo File cài đặt.'; $lang->ftp_get_list = 'Nhận danh sách'; $lang->ftp_form_title = 'Thông tin FTP'; @@ -63,12 +61,12 @@ $lang->ftp_host = 'Tên Host FTP'; $lang->ftp_port = 'Cổng kết nối'; $lang->about_ftp_password = 'Mật khẩu của FTP sẽ không lưu lại'; $lang->cmd_check_ftp_connect = 'Kiểm tra kết nối bằng FTP'; -$lang->msg_safe_mode_ftp_needed = 'Nếu safe_mode của PHP mở, bạn có thể cài đặt các thành phần bổ xung cho RhymiX một cách tự động qua FTP.'; +$lang->msg_safe_mode_ftp_needed = 'Nếu safe_mode của PHP mở, bạn có thể cài đặt các thành phần bổ xung cho Rhymix một cách tự động qua FTP.'; $lang->msg_ftp_not_connected = 'Kết nối bằng FTP không thành công. Xin vui lòng kiểm tra lại thông tin tài khoản và cổng kết nối!'; $lang->msg_ftp_invalid_auth_info = 'Xác nhận thất bại. Xin vui lòng kiểm tra lại tên sử dụng và mật khẩu.'; $lang->msg_ftp_mkdir_fail = 'Lỗi khi tạo thư mục. Xin vui lòng kiểm tra lại quyền truy cập FTP.'; $lang->msg_ftp_chmod_fail = 'CHMOD thất bại. Xin vui lòng kiểm tra lại.'; $lang->msg_ftp_connect_success = 'Đã xác nhận và kết nối thành công tới máy chủ bằng FTP.'; $lang->ftp_path_title = 'Hãy nhập thông tin đường dẫn của FTP.'; -$lang->msg_ftp_installed_realpath = 'Đường dẫn thư mục đã cài đặt RhymiX'; -$lang->msg_ftp_installed_ftp_realpath = 'Đường dẫn tuyệt đối của thư mục cài đặt RhymiX trên FTP'; +$lang->msg_ftp_installed_realpath = 'Đường dẫn thư mục đã cài đặt Rhymix'; +$lang->msg_ftp_installed_ftp_realpath = 'Đường dẫn tuyệt đối của thư mục cài đặt Rhymix trên FTP'; diff --git a/modules/install/lang/zh-CN.php b/modules/install/lang/zh-CN.php index 827234d9c..99a1a1a08 100644 --- a/modules/install/lang/zh-CN.php +++ b/modules/install/lang/zh-CN.php @@ -1,5 +1,5 @@ introduce_title = '安装RhymiX'; +$lang->introduce_title = '安装Rhymix'; $lang->install_progress_menu['language'] = '选择安装语言'; $lang->install_progress_menu['license_agreement'] = '许可协议'; $lang->install_progress_menu['condition'] = '检查安装条件'; @@ -33,10 +33,8 @@ $lang->cmd_install_refresh_page = '刷新屏幕'; $lang->cmd_install_next = '开始安装'; $lang->cmd_ignore = '忽略'; $lang->cmd_recommended = '推荐'; -$lang->db_desc['mysqli'] = '利用php的 mysqli*()函数使用mysql DB。
    DB数据是以myisam生成,因此不能实现transaction。'; -$lang->db_desc['mysqli_innodb'] = '利用innodb使用mysql DB。
    innodb可以使用transaction。'; -$lang->db_desc['mysql'] = '利用php的 mysql_*()函数使用mysql DB。
    DB数据是以myisam生成,因此不能实现transaction。'; -$lang->db_desc['mysql_innodb'] = '利用innodb使用mysql DB。
    innodb可以使用transaction。'; +$lang->db_desc['mysqli'] = '利用php的 mysqli*()函数使用mysql DB。'; +$lang->db_desc['mysql'] = '利用php的 mysql_*()函数使用mysql DB。'; $lang->db_desc['cubrid'] = '使用CUBRID DB。 Manual'; $lang->db_desc['mssql'] = '使用 Microsoft SQL Server。'; $lang->can_use_when_installed = '不是这个服务器上安装'; @@ -79,13 +77,13 @@ $lang->ftp_host = 'FTP服务器名'; $lang->ftp_port = 'FTP端口'; $lang->about_ftp_password = 'FTP密码不会被保存。'; $lang->cmd_check_ftp_connect = '测试FTP连接'; -$lang->msg_safe_mode_ftp_needed = '当PHP的safe_mode=On时,请必须输入相关FTP信息,否则将无法正常安装或使用RhymiX程序。'; +$lang->msg_safe_mode_ftp_needed = '当PHP的safe_mode=On时,请必须输入相关FTP信息,否则将无法正常安装或使用Rhymix程序。'; $lang->msg_ftp_not_connected = '发生本地(localhost)FTP连接错误。请确认ftp端口号及支持ftp服务与否。'; $lang->msg_ftp_invalid_auth_info = 'FTP登录失败。请确认输入的FTP信息。'; $lang->msg_ftp_mkdir_fail = '新建文件夹失败。请确认 FTP服务器设置。'; $lang->msg_ftp_chmod_fail = '修改文件夹属性失败。请确认 FTP服务器设置。'; $lang->msg_ftp_connect_success = 'FTP连接成功。'; $lang->ftp_path_title = '输入FTP路径信息'; -$lang->msg_ftp_installed_realpath = 'RhymiX绝对路径'; +$lang->msg_ftp_installed_realpath = 'Rhymix绝对路径'; $lang->msg_ftp_installed_ftp_realpath = 'FTP绝对路径设置'; $lang->msg_possible_only_file = '请上传文件.'; diff --git a/modules/install/lang/zh-TW.php b/modules/install/lang/zh-TW.php index 2d2fce818..3c0f27afc 100644 --- a/modules/install/lang/zh-TW.php +++ b/modules/install/lang/zh-TW.php @@ -1,5 +1,5 @@ introduce_title = '安裝RhymiX'; +$lang->introduce_title = '安裝Rhymix'; $lang->install_progress_menu['language'] = '選擇安裝語言'; $lang->install_progress_menu['license_agreement'] = '許可協議'; $lang->install_progress_menu['condition'] = '檢查安裝條件'; @@ -17,7 +17,7 @@ $lang->install_checklist_title['json'] = 'json'; $lang->install_checklist_title['gd'] = 'gd'; $lang->install_checklist_title['mcrypt'] = 'mcrypt / openssl'; $lang->install_checklist_title['session'] = 'session.auto_start設置'; -$lang->install_checklist_desc['permission'] = '[必須] RhymiX的資料夾或『./files』資料夾權限必須是『777』。'; +$lang->install_checklist_desc['permission'] = '[必須] Rhymix的資料夾或『./files』資料夾權限必須是『777』。'; $lang->install_checklist_desc['xml'] = '[必須] 必須要安裝『XML Library』,才能夠使用 XML 通訊。'; $lang->install_checklist_desc['session'] = '[必須] 在『php.ini』中必須要設定『session.auto_start=0』,才能使用暫存功能'; $lang->install_checklist_desc['iconv'] = '安裝『iconv』,才能使 UTF-8 和其他語言文字作互相轉換。'; @@ -33,10 +33,8 @@ $lang->cmd_install_refresh_page = '刷新屏幕'; $lang->cmd_install_next = '開始進行安裝'; $lang->cmd_ignore = '忽略'; $lang->cmd_recommended = '推薦'; -$lang->db_desc['mysqli'] = '利用 PHP 的『mysqli*()』函數使用 MySQL 資料庫。
    利用『myisam』建立資料庫檔案,因此不能實現transaction。'; -$lang->db_desc['mysqli_innodb'] = '利用『innodb』使用 Mysql 資料庫。
    innodb可以使用 transaction。'; -$lang->db_desc['mysql'] = '利用 PHP 的『mysql_*()』函數使用 MySQL 資料庫。
    利用『myisam』建立資料庫檔案,因此不能實現transaction。'; -$lang->db_desc['mysql_innodb'] = '利用『innodb』使用 Mysql 資料庫。
    innodb可以使用 transaction。'; +$lang->db_desc['mysqli'] = '利用 PHP 的『mysqli*()』函數使用 MySQL 資料庫。'; +$lang->db_desc['mysql'] = '利用 PHP 的『mysql_*()』函數使用 MySQL 資料庫。'; $lang->db_desc['cubrid'] = '使用 CUBRID DB。 Manual'; $lang->db_desc['mssql'] = '使用 Microsoft SQL Server。'; $lang->can_use_when_installed = '不是這個服務器上安裝'; @@ -87,5 +85,5 @@ $lang->msg_ftp_mkdir_fail = '新增資料夾失敗。請確認 FTP 主機設置 $lang->msg_ftp_chmod_fail = '修改資料夾權限失敗。請確認 FTP 主機設置。'; $lang->msg_ftp_connect_success = 'FTP連線成功。'; $lang->ftp_path_title = '請輸入 FTP 路經'; -$lang->msg_ftp_installed_realpath = 'RhymiX絕對路經'; -$lang->msg_ftp_installed_ftp_realpath = 'RhymiX的 FTP 絕對路經'; +$lang->msg_ftp_installed_realpath = 'Rhymix絕對路經'; +$lang->msg_ftp_installed_ftp_realpath = 'Rhymix的 FTP 絕對路經'; diff --git a/modules/install/ruleset/install.xml b/modules/install/ruleset/install.xml index 100f8b689..3ed218653 100644 --- a/modules/install/ruleset/install.xml +++ b/modules/install/ruleset/install.xml @@ -8,6 +8,5 @@ - diff --git a/modules/install/script/ko.install.php b/modules/install/script/ko.install.php index 485c8cb9b..d0ea28061 100644 --- a/modules/install/script/ko.install.php +++ b/modules/install/script/ko.install.php @@ -269,9 +269,9 @@ $obj->email_address = $logged_info->email_address; $obj->module_srl = $module_srl; Context::set('version', __XE_VERSION__); -$obj->title = 'Welcome Rhymix'; +$obj->title = 'Welcome to Rhymix'; -$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_'.$lang); +$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content'); $output = $oDocumentController->insertDocument($obj, true); if(!$output->toBool()) return $output; @@ -279,7 +279,7 @@ if(!$output->toBool()) return $output; $document_srl = $output->get('document_srl'); unset($obj->document_srl); -$obj->title = 'Welcome mobile Rhymix'; +$obj->title = 'Welcome to Mobile Rhymix'; $output = $oDocumentController->insertDocument($obj, true); if(!$output->toBool()) return $output; diff --git a/modules/install/script/welcome_content/welcome_content_jp.html b/modules/install/script/welcome_content/welcome_content.html similarity index 67% rename from modules/install/script/welcome_content/welcome_content_jp.html rename to modules/install/script/welcome_content/welcome_content.html index 75d64ffc0..8b7baa170 100644 --- a/modules/install/script/welcome_content/welcome_content_jp.html +++ b/modules/install/script/welcome_content/welcome_content.html @@ -1,9 +1,9 @@
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - XE 시작하기 + HELLO, WORLD! +

    WELCOME TO RHYMIX

    +

    Rhymix는 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    + 시작하기
    diff --git a/modules/install/script/welcome_content/welcome_content_de.html b/modules/install/script/welcome_content/welcome_content_de.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_de.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_en.html b/modules/install/script/welcome_content/welcome_content_en.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_en.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_es.html b/modules/install/script/welcome_content/welcome_content_es.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_es.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_fr.html b/modules/install/script/welcome_content/welcome_content_fr.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_fr.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_ko.html b/modules/install/script/welcome_content/welcome_content_ko.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_ko.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_mn.html b/modules/install/script/welcome_content/welcome_content_mn.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_mn.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_ru.html b/modules/install/script/welcome_content/welcome_content_ru.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_ru.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_tr.html b/modules/install/script/welcome_content/welcome_content_tr.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_tr.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_vi.html b/modules/install/script/welcome_content/welcome_content_vi.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_vi.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_zh-CN.html b/modules/install/script/welcome_content/welcome_content_zh-CN.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_zh-CN.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/script/welcome_content/welcome_content_zh-TW.html b/modules/install/script/welcome_content/welcome_content_zh-TW.html deleted file mode 100644 index 725a5b456..000000000 --- a/modules/install/script/welcome_content/welcome_content_zh-TW.html +++ /dev/null @@ -1,9 +0,0 @@ - -
    -
    - WELCOME TO -

    WELCOME TO Rhymix

    -

    Rhymix은 자유로운 웹 콘텐츠 발행을 돕는 CMS입니다.
    간편한 설치와 다양한 추가 프로그램을 활용하여
    자신만의 웹페이지를 쉽고 빠르게 만들 수 있습니다.

    - Rhymix 시작하기 -
    -
    diff --git a/modules/install/tpl/check_env.html b/modules/install/tpl/check_env.html index aadff1a61..8bb498790 100644 --- a/modules/install/tpl/check_env.html +++ b/modules/install/tpl/check_env.html @@ -42,7 +42,7 @@
@@ -53,7 +53,7 @@ « {$lang->cmd_back} diff --git a/modules/install/tpl/css/install.css b/modules/install/tpl/css/install.css index 79499ff2a..8739cc3f0 100644 --- a/modules/install/tpl/css/install.css +++ b/modules/install/tpl/css/install.css @@ -176,7 +176,10 @@ button.grey:hover, a.button.grey:hover { .x #content ul li { line-height: 160%; } -.x #content label input[type=checkbox] { +.x #content label.x_inline { + display: inline-block; margin-right: 12px; +} +.x #content label input[type=checkbox], .x #content label input[type=radio] { position: relative; top: 2px; } @@ -207,6 +210,9 @@ button.grey:hover, a.button.grey:hover { line-height: 17px; padding: 3px 5px; width: 260px; box-sizing: border-box; } +.x .x_control-group .x_controls input[type=checkbox], .x .x_control-group .x_controls input[type=radio] { + padding: 0; width: auto; +} .x .x_control-group .x_controls select { line-height: 17px; padding: 3px 7px 3px 3px; width: 260px; box-sizing: border-box; diff --git a/modules/install/tpl/select_db.html b/modules/install/tpl/db_config.html similarity index 60% rename from modules/install/tpl/select_db.html rename to modules/install/tpl/db_config.html index 0a52f8263..901e0e332 100644 --- a/modules/install/tpl/select_db.html +++ b/modules/install/tpl/db_config.html @@ -8,7 +8,7 @@ - +
@@ -16,7 +16,7 @@ @@ -27,28 +27,28 @@

{$lang->db_desc[$val->db_type]}

- -
+ +
- -
+ +
- -
+ +
- -
+ +
- -
+ +
- -
+ +

{$lang->db_info_desc}
{$lang->db_prefix_desc} @@ -59,7 +59,7 @@ « {$lang->cmd_back}

- +
diff --git a/modules/install/tpl/footer.html b/modules/install/tpl/footer.html index 3d7a4377e..049cfdd35 100644 --- a/modules/install/tpl/footer.html +++ b/modules/install/tpl/footer.html @@ -6,7 +6,7 @@ diff --git a/modules/install/tpl/js/install.js b/modules/install/tpl/js/install.js index ee565d81f..76943a8a7 100644 --- a/modules/install/tpl/js/install.js +++ b/modules/install/tpl/js/install.js @@ -37,4 +37,20 @@ jQuery(function($){ } }); } + if($("#task-db-select").size()) { + $("#task-db-select").parents("form").on("submit", function() { + setTimeout(function() { + $("#task-db-select").text($("#task-db-select").data("checking")); + $("#task-db-select").prop("disabled", true); + }, 100); + }); + } + if($("#task-complete-install").size()) { + $("#task-complete-install").parents("form").on("submit", function() { + setTimeout(function() { + $("#task-complete-install").text($("#task-complete-install").data("installing")); + $("#task-complete-install").prop("disabled", true); + }, 100); + }); + } }); diff --git a/modules/install/tpl/license_agreement.html b/modules/install/tpl/license_agreement.html index 2296de1ae..a13af53b4 100644 --- a/modules/install/tpl/license_agreement.html +++ b/modules/install/tpl/license_agreement.html @@ -7,7 +7,7 @@

{$XE_VALIDATOR_MESSAGE}

- +
@@ -22,7 +22,7 @@
- +
diff --git a/modules/install/tpl/license_text.en.html b/modules/install/tpl/license_text.en.html index aacb2e846..6dd233ba0 100644 --- a/modules/install/tpl/license_text.en.html +++ b/modules/install/tpl/license_text.en.html @@ -1,10 +1,10 @@

- Copyright © RhymiX Developers and Contributors
+ Copyright © Rhymix Developers and Contributors
Copyright © NAVER

- RhymiX is free software; you can redistribute it and/or modify it + Rhymix is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

diff --git a/modules/install/tpl/license_text.ko.html b/modules/install/tpl/license_text.ko.html index beae0c040..a734e70bf 100644 --- a/modules/install/tpl/license_text.ko.html +++ b/modules/install/tpl/license_text.ko.html @@ -1,10 +1,10 @@

- Copyright © RhymiX Developers and Contributors
+ Copyright © Rhymix Developers and Contributors
Copyright © NAVER

- RhymiX는 자유 소프트웨어입니다. + Rhymix는 자유 소프트웨어입니다. 소프트웨어의 피양도자는 자유 소프트웨어 재단이 공표한 GNU 일반 공중 사용 허가서 2판 또는 그 이후 판을 임의로 선택해서, 그 규정에 따라 프로그램을 개작하거나 재배포할 수 있습니다.

diff --git a/modules/install/tpl/admin_form.html b/modules/install/tpl/other_config.html similarity index 67% rename from modules/install/tpl/admin_form.html rename to modules/install/tpl/other_config.html index 0694b43bd..493c76cb8 100644 --- a/modules/install/tpl/admin_form.html +++ b/modules/install/tpl/other_config.html @@ -7,7 +7,6 @@

{$XE_VALIDATOR_MESSAGE}

-
@@ -43,7 +42,7 @@
@@ -51,20 +50,26 @@
- {$val} -
+
+ +
+ + +
+
+

{$lang->about_sitelock_after_install($sitelock_ip_range)}

- +
diff --git a/modules/install/tpl/progress_menu.html b/modules/install/tpl/progress_menu.html index 103437d45..12c1ef842 100644 --- a/modules/install/tpl/progress_menu.html +++ b/modules/install/tpl/progress_menu.html @@ -2,8 +2,8 @@
  • {$lang->install_progress_menu['license_agreement']}
  • {$lang->install_progress_menu['condition']}
  • -
  • {$lang->install_progress_menu['ftp']}
  • -
  • {$lang->install_progress_menu['dbInfo']}
  • -
  • {$lang->install_progress_menu['adminInfo']}
  • +
  • {$lang->install_progress_menu['ftp']}
  • +
  • {$lang->install_progress_menu['dbInfo']}
  • +
  • {$lang->install_progress_menu['adminInfo']}
diff --git a/modules/layout/tpl/header.html b/modules/layout/tpl/header.html index 7259ca17c..6d6518ae2 100644 --- a/modules/layout/tpl/header.html +++ b/modules/layout/tpl/header.html @@ -4,7 +4,7 @@

- {$lang->installed_layout} {$lang->help} + {$lang->installed_layout} {$lang->help} > {$layout_info->title} v{$layout_info->version} > {$selected_layout->title} v{$selected_layout->version} > {$selected_layout->layout_title} diff --git a/modules/layout/tpl/layout_modify.html b/modules/layout/tpl/layout_modify.html index c355355b3..8fdcc28d2 100644 --- a/modules/layout/tpl/layout_modify.html +++ b/modules/layout/tpl/layout_modify.html @@ -1,3 +1,3 @@ -{$content} \ No newline at end of file +{$content} diff --git a/modules/member/conf/module.xml b/modules/member/conf/module.xml index ab452dea1..d7d7c9550 100644 --- a/modules/member/conf/module.xml +++ b/modules/member/conf/module.xml @@ -24,7 +24,6 @@ - diff --git a/modules/member/lang/en.php b/modules/member/lang/en.php index 775a7da50..f4c4940cd 100644 --- a/modules/member/lang/en.php +++ b/modules/member/lang/en.php @@ -130,7 +130,7 @@ $lang->msg_success_authed = 'Your account has been successfully activated and lo $lang->msg_success_confirmed = 'Your account has been activated successfully.'; $lang->msg_new_member = 'Add Member'; $lang->msg_rechecked_password = 'Re-checked password'; -$lang->msg_update_member = 'Inquiry/Modify User Info'; +$lang->msg_update_member = 'View and Modify User Info'; $lang->msg_leave_member = 'Delete Account'; $lang->msg_group_is_null = 'There is no group.'; $lang->msg_not_delete_default = 'Default items cannot be deleted'; @@ -152,6 +152,7 @@ $lang->msg_accept_agreement = 'You have to accept the agreement.'; $lang->msg_user_denied = 'You have entered a prohibited ID.'; $lang->msg_user_not_confirmed = 'Your account is not activated yet. Please check your email.'; $lang->msg_user_limited = 'You have entered an ID that cannot be used before %s'; +$lang->msg_admin_ip_not_allowed = 'Your IP address is not allowed to log in as an administrator.'; $lang->about_rechecked_password = 'Confirm your password before editing account information.'; $lang->about_user_id = 'User ID should be 3~20 characters long, consist of alphanumeric and start with a letter.'; $lang->about_password = 'Password should be 6~20 characters long.'; diff --git a/modules/member/lang/es.php b/modules/member/lang/es.php index 76420c629..45557fec6 100644 --- a/modules/member/lang/es.php +++ b/modules/member/lang/es.php @@ -107,6 +107,7 @@ $lang->msg_accept_agreement = 'Usted primero debe aceptar el acuerdo'; $lang->msg_user_denied = 'ID ingresado ha sido prohibido para su uso'; $lang->msg_user_not_confirmed = '아직 메일 인증이 이루어지지 않았습니다. 메일을 확인해 주세요'; $lang->msg_user_limited = 'ID ingresado puede ser usado luego de %s'; +$lang->msg_admin_ip_not_allowed = 'Su dirección IP no se puede iniciar la sesión como administrador.'; $lang->about_user_id = 'ID del usuario debe ser entre 3-20 letras que consiste en alfabetos+número con alfabeto como primera letra.'; $lang->about_password = 'Contraseña debe ser entre 6-20 letras'; $lang->about_user_name = 'Nombre debe ser entre 2-20 letras'; diff --git a/modules/member/lang/fr.php b/modules/member/lang/fr.php index 6abe33787..d3674d841 100644 --- a/modules/member/lang/fr.php +++ b/modules/member/lang/fr.php @@ -120,6 +120,7 @@ $lang->msg_accept_agreement = 'Vous devez agréer l\'accord'; $lang->msg_user_denied = 'Le compte que vous avez entré est suspendu'; $lang->msg_user_not_confirmed = 'Vous n\'avez pas encore authentifié. Verifiez votre mél, S.V.P.'; $lang->msg_user_limited = 'Vous avez entré un compte qui peut être utilisé depuis %s'; +$lang->msg_admin_ip_not_allowed = 'Votre adresse IP ne soit pas autorisé à se connecter en tant qu\'administrateur.'; $lang->about_user_id = 'Le compte d\'utilisateur doit être long de 3~20 lettres et se composer des alphabets et des chiffres avec un alphabet au premier.'; $lang->about_password = 'Le Mot de Passe doit être long de 6~20 lettres.'; $lang->about_user_name = 'Le Nom doit être long de 2~20 lettres.'; diff --git a/modules/member/lang/ja.php b/modules/member/lang/ja.php index 097d72ba0..2338a3d7f 100644 --- a/modules/member/lang/ja.php +++ b/modules/member/lang/ja.php @@ -156,6 +156,7 @@ $lang->msg_accept_agreement = '利用規約に同意しなければなりませ $lang->msg_user_denied = '利用が中止されているユーザIDです。'; $lang->msg_user_not_confirmed = 'メールでの認証が行われていません。メールを確認してください。'; $lang->msg_user_limited = '入力したユーザIDは%s以前まで使用できません。'; +$lang->msg_admin_ip_not_allowed = '接続したIPアドレスでは、管理者のログインが許容されないです。'; $lang->about_rechecked_password = '会員の情報を安全に保護するため、パスワードを再度確認します。'; $lang->about_user_id = 'ユーザーIDは、3~20文字までの英数文字にしてください。先頭文字は英字でなければなりません。'; $lang->about_password = 'パスワードは6~20文字にしてください。'; diff --git a/modules/member/lang/ko.php b/modules/member/lang/ko.php index 4da8f0cee..6de7477fc 100644 --- a/modules/member/lang/ko.php +++ b/modules/member/lang/ko.php @@ -158,6 +158,7 @@ $lang->msg_accept_agreement = '약관에 동의해야 합니다.'; $lang->msg_user_denied = '입력한 아이디의 사용이 중지 되었습니다.'; $lang->msg_user_not_confirmed = '아직 메일 인증이 이루어지지 않았습니다. 메일을 확인해 주세요.'; $lang->msg_user_limited = '입력한 아이디는 %s 까지 사용하실 수 없습니다.'; +$lang->msg_admin_ip_not_allowed = '접속하신 IP 주소에서는 관리자 로그인이 허용되지 않습니다.'; $lang->about_rechecked_password = '회원의 정보를 안전하게 보호하기 위해 비밀번호를 다시 한번 확인 합니다.'; $lang->about_user_id = '회원 ID는 3~20자 사이의 영문+숫자로 이루어져야 하며 영문으로 시작해야 합니다.'; $lang->about_password = '비밀번호는 6~20자로 되어야 합니다.'; diff --git a/modules/member/lang/zh-CN.php b/modules/member/lang/zh-CN.php index 3fbd9346f..cdc5fefd5 100644 --- a/modules/member/lang/zh-CN.php +++ b/modules/member/lang/zh-CN.php @@ -154,6 +154,7 @@ $lang->msg_accept_agreement = '您必须同意条款。'; $lang->msg_user_denied = '您输入的用户名已禁止使用!'; $lang->msg_user_not_confirmed = '您的注册信息还没有被激活,请确认您的电子邮箱。'; $lang->msg_user_limited = '您输入的用户名%s以后才可以开始使用。'; +$lang->msg_admin_ip_not_allowed = '连接的IP地址中,管理者的登录在不允许的。'; $lang->about_rechecked_password = '为了会员资料的安全保护,再次确认密码。'; $lang->about_user_id = '用户名长度必须由 3 ~20 字以内的英文+数字组成,且首个字母必须是英文字母。'; $lang->about_password = '密码长度必须在6~20字以内。'; diff --git a/modules/member/lang/zh-TW.php b/modules/member/lang/zh-TW.php index 42db8dc17..8b168786e 100644 --- a/modules/member/lang/zh-TW.php +++ b/modules/member/lang/zh-TW.php @@ -142,6 +142,7 @@ $lang->msg_accept_agreement = '您必須同意條款。'; $lang->msg_user_denied = '您輸入的帳號已禁止使用!'; $lang->msg_user_not_confirmed = '您的註冊資料尚未啟用,請確認您的電子郵箱。'; $lang->msg_user_limited = '您輸入的帳號 %s 以後才可以開始使用。'; +$lang->msg_admin_ip_not_allowed = '連接的IP地址中,管理者的登錄在不允許的。'; $lang->about_user_id = '帳號必須由 3~20 字以內的英文+數字組成,開頭必須是英文。'; $lang->about_password = '密碼必須在 6~20 字以內。'; $lang->about_user_name = '姓名必須是 2~20 字以內。'; diff --git a/modules/member/member.admin.model.php b/modules/member/member.admin.model.php index c17237d23..9bca07a60 100644 --- a/modules/member/member.admin.model.php +++ b/modules/member/member.admin.model.php @@ -294,14 +294,33 @@ class memberAdminModel extends member * * @return boolean (true : allowed, false : refuse) */ - function getMemberAdminIPCheck() + function getMemberAdminIPCheck($allow_list = null, $deny_list = null) { - $db_info = Context::getDBInfo(); - $admin_ip_list = $db_info->admin_ip_list; - if(!$admin_ip_list) return true; - if(!is_array($admin_ip_list)) $admin_ip_list = explode(',',$admin_ip_list); - if(!count($admin_ip_list) || IpFilter::filter($admin_ip_list)) return true; - else return false; + if ($allow_list = ($allow_list === null) ? config('admin.allow') : $allow_list) + { + foreach ($allow_list as $range) + { + if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) + { + return true; + } + } + return false; + } + + if ($deny_list = ($deny_list === null) ? config('admin.deny') : $deny_list) + { + foreach ($deny_list as $range) + { + if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) + { + return false; + } + } + return true; + } + + return true; } } /* End of file member.admin.model.php */ diff --git a/modules/member/member.admin.view.php b/modules/member/member.admin.view.php index ca4318ce1..21e3d6ba8 100644 --- a/modules/member/member.admin.view.php +++ b/modules/member/member.admin.view.php @@ -631,7 +631,7 @@ class memberAdminView extends member } $replace = array_merge($extentionReplace, $replace); - $inputTag = preg_replace_callback('@%(\w+)%@', function($n) { return $replace[$n[1]]; }, $template); + $inputTag = preg_replace_callback('@%(\w+)%@', function($n) use($replace) { return $replace[$n[1]]; }, $template); if($extendForm->description) $inputTag .= '

'.$extendForm->description.'

'; diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 090c2f522..c99dc0062 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -1156,7 +1156,7 @@ class memberController extends member return $this->stop('msg_invalid_auth_key'); } - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) + if(ztime($output->data->regdate) < time() - 86400) { executeQuery('member.deleteAuthMail', $args); return $this->stop('msg_invalid_auth_key'); @@ -1753,8 +1753,23 @@ class memberController extends member } return new Object(-1, ($this->memberInfo->refused_reason)? Context::getLang('msg_user_denied') . "\n" . $this->memberInfo->refused_reason : 'msg_user_denied'); } - // Notify if denied_date is less than the current time - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); + + // Notify if user is limited + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) + { + return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); + } + + // Do not allow login as admin if not in allowed IP list + if($this->memberInfo->is_admin === 'Y' && $this->act === 'procMemberLogin') + { + $oMemberAdminModel = getAdminModel('member'); + if(!$oMemberAdminModel->getMemberAdminIPCheck()) + { + return new Object(-1, 'msg_admin_ip_not_allowed'); + } + } + // Update the latest login time $args->member_srl = $this->memberInfo->member_srl; $output = executeQuery('member.updateLastLogin', $args); @@ -1819,17 +1834,8 @@ class memberController extends member $autologin_output = executeQuery('member.insertAutologin', $autologin_args); if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000, '/'); } - if($this->memberInfo->is_admin == 'Y') - { - $oMemberAdminModel = getAdminModel('member'); - if(!$oMemberAdminModel->getMemberAdminIPCheck()) - { - $_SESSION['denied_admin'] = 'Y'; - } - } $this->setSessionInfo(); - return $output; } @@ -1839,6 +1845,7 @@ class memberController extends member function setSessionInfo() { $oMemberModel = getModel('member'); + $config = $oMemberModel->getMemberConfig(); // If your information came through the current session information to extract information from the users if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) { @@ -1885,7 +1892,10 @@ class memberController extends member $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); - $this->addMemberMenu( 'dispMemberModifyNicknameLog', 'cmd_modify_nickname_log'); + if($config->update_nick_log == 'Y') + { + $this->addMemberMenu( 'dispMemberModifyNicknameLog', 'cmd_modify_nickname_log'); + } } /** diff --git a/modules/member/member.model.php b/modules/member/member.model.php index 32a33692f..fd72ef1ce 100644 --- a/modules/member/member.model.php +++ b/modules/member/member.model.php @@ -92,8 +92,7 @@ class memberModel extends member return FileHandler::readFile($agreement_file); } - $db_info = Context::getDBInfo(); - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt'; + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . config('locale.default_lang') . '.txt'; if(is_readable($agreement_file)) { return FileHandler::readFile($agreement_file); @@ -295,8 +294,7 @@ class memberModel extends member $args = new stdClass(); - $db_info = Context::getDBInfo (); - if($db_info->master_db['db_type'] == "cubrid") + if(config('db.master.type') == 'cubrid') { $args->email_address = strtolower($email_address); $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); diff --git a/modules/member/tpl/design_config.html b/modules/member/tpl/design_config.html index 468fb3713..e83d65ac5 100644 --- a/modules/member/tpl/design_config.html +++ b/modules/member/tpl/design_config.html @@ -6,7 +6,7 @@
- +
diff --git a/modules/member/tpl/group_list.html b/modules/member/tpl/group_list.html index 2910840e9..1ff21815f 100644 --- a/modules/member/tpl/group_list.html +++ b/modules/member/tpl/group_list.html @@ -10,7 +10,7 @@ .filebox_item{max-height:16px}
-

{$lang->member_group} {$lang->help}

+

{$lang->member_group} {$lang->help}

{$XE_VALIDATOR_MESSAGE}

@@ -53,7 +53,7 @@ - {$lang->help} + {$lang->help}

diff --git a/modules/member/tpl/header.html b/modules/member/tpl/header.html index 55cb6c18f..98dba615e 100644 --- a/modules/member/tpl/header.html +++ b/modules/member/tpl/header.html @@ -1,6 +1,6 @@
-

{$lang->cmd_member_config} {$lang->help}

+

{$lang->cmd_member_config} {$lang->help}

{$XE_VALIDATOR_MESSAGE}

diff --git a/modules/member/tpl/insert_member.html b/modules/member/tpl/insert_member.html index e8f5245ed..e76df5070 100644 --- a/modules/member/tpl/insert_member.html +++ b/modules/member/tpl/insert_member.html @@ -21,14 +21,14 @@
- +
- +
diff --git a/modules/member/tpl/login_config.html b/modules/member/tpl/login_config.html index 3eb041145..53799cf51 100644 --- a/modules/member/tpl/login_config.html +++ b/modules/member/tpl/login_config.html @@ -12,7 +12,7 @@
-

{$lang->enable_login_fail_report} {$lang->help}

+

{$lang->enable_login_fail_report} {$lang->help}

diff --git a/modules/member/tpl/member_list.html b/modules/member/tpl/member_list.html index a77844a37..18bc43e5b 100644 --- a/modules/member/tpl/member_list.html +++ b/modules/member/tpl/member_list.html @@ -5,7 +5,7 @@
-

{$lang->user_list} {$lang->help}

+

{$lang->user_list} {$lang->help}

{$XE_VALIDATOR_MESSAGE}

@@ -123,7 +123,7 @@ diff --git a/modules/member/tpl/signup_config.html b/modules/member/tpl/signup_config.html index 7973c5442..1e7de04ef 100644 --- a/modules/member/tpl/signup_config.html +++ b/modules/member/tpl/signup_config.html @@ -83,7 +83,7 @@
-

{$lang->cmd_manage_form} {$lang->help}

+

{$lang->cmd_manage_form} {$lang->help}

{$module_list[$oDocument->get('module_srl')]->browser_title} - {htmlspecialchars($oDocument->getTitleText())}{$lang->no_title_document} - {$oDocument->getNickName()} + {$oDocument->getNickName()} ({$lang->anonymous}) {$member_nick_name[abs($oDocument->get('member_srl'))]} {$oDocument->get('readed_count')}
@@ -116,7 +116,7 @@ diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 84a6cbfaf..011b09128 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -1608,7 +1608,6 @@ class menuAdminController extends menu $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index); if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); - $dbInfo = Context::getDBInfo(); $args = new stdClass(); $args->menu_item_srl = (!$requestArgs->menu_item_srl) ? getNextSequence() : $requestArgs->menu_item_srl; @@ -1618,11 +1617,11 @@ class menuAdminController extends menu //if now page is https... if(strpos($url, 'https') !== false) { - $args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url); + $args->url = str_replace('https'.substr(Context::getDefaultUrl(), 4), '', $url); } else { - $args->url = str_replace($dbInfo->default_url, '', $url); + $args->url = str_replace(Context::getDefaultUrl(), '', $url); } $args->open_window = 'N'; $args->expand = 'N'; diff --git a/modules/menu/tpl/sitemap.html b/modules/menu/tpl/sitemap.html index c0fe23878..5f68736fe 100644 --- a/modules/menu/tpl/sitemap.html +++ b/modules/menu/tpl/sitemap.html @@ -21,7 +21,7 @@
-

{$lang->menu_gnb_sub['siteMap']} {$lang->help}

+

{$lang->menu_gnb_sub['siteMap']} {$lang->help}

@@ -60,7 +60,7 @@

{$lang->add_new_sitemap} - {$lang->help} + {$lang->help}

    @@ -127,7 +127,7 @@
  • {$lang->menu_img_btn}
  • @@ -363,7 +363,7 @@

    {$lang->design}

    -

    {$lang->menu_gnb_sub['siteDesign']} {$lang->help}

    +

    {$lang->menu_gnb_sub['siteDesign']} {$lang->help}

    @@ -414,7 +414,7 @@

    {$lang->layout} - {$lang->help} + {$lang->help}

- {$item->title} {$lang->help} + {$item->title} {$lang->help}