From 08cc9009b50c7ca9d4c5c9d657791e44b6bdf483 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 10 Feb 2016 00:14:32 +0900 Subject: [PATCH 01/87] Reorganize default admin menu --- modules/admin/admin.admin.view.php | 5 +- modules/admin/admin.class.php | 195 ++++++++--------------------- modules/admin/tpl/_header.html | 2 +- modules/admin/tpl/css/admin.css | 2 +- modules/member/conf/module.xml | 1 - modules/module/module.model.php | 3 +- 6 files changed, 55 insertions(+), 153 deletions(-) diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php index a3c47f6da..0d1c403b3 100644 --- a/modules/admin/admin.admin.view.php +++ b/modules/admin/admin.admin.view.php @@ -129,14 +129,15 @@ class adminAdminView extends admin $currentAct = Context::get('act'); $subMenuTitle = ''; - foreach((array) $moduleActionInfo->menu as $key => $value) + foreach((array)$moduleActionInfo->menu as $key => $value) { - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) + if(is_array($value->acts) && in_array($currentAct, $value->acts)) { $subMenuTitle = $value->title; break; } } + // get current menu's srl(=parentSrl) $parentSrl = 0; $oMenuAdminConroller = getAdminController('menu'); diff --git a/modules/admin/admin.class.php b/modules/admin/admin.class.php index 4eb9a801c..e02dcf53e 100644 --- a/modules/admin/admin.class.php +++ b/modules/admin/admin.class.php @@ -154,7 +154,7 @@ class admin extends ModuleObject $output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList); if(is_array($output->data)) { - foreach($output->data AS $key => $value) + foreach($output->data as $key => $value) { preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m); $gnbDBList[$m[1]] = $value->menu_item_srl; @@ -162,90 +162,43 @@ class admin extends ModuleObject } unset($args); - $gnbModuleList = array( - 0 => array( - 'module' => 'menu', - 'subMenu' => array('siteMap', 'siteDesign'), + $gnbMenuStructure = array( + 'menu' => array( + 'menu.siteMap', + 'menu.siteDesign', ), - 1 => array( - 'module' => 'member', - 'subMenu' => array('userList', 'userSetting', 'userGroup'), + 'user' => array( + 'member.userList', + 'member.userSetting', + 'member.userGroup', + 'point.point', ), - 2 => array( - 'module' => 'document', - 'subMenu' => array('document'), + 'content' => array( + 'board.board', + 'document.document', + 'comment.comment', + 'file.file', + 'poll.poll', + 'editor.editor', + 'importer.importer', + 'spamfilter.spamFilter', + 'trash.trash', ), - 3 => array( - 'module' => 'comment', - 'subMenu' => array('comment'), + 'configuration' => array( + 'admin.adminConfigurationGeneral', + 'admin.adminConfigurationFtp', + 'admin.adminMenuSetup', + 'file.fileUpload', + 'module.filebox', ), - 4 => array( - 'module' => 'file', - 'subMenu' => array('file'), - ), - 5 => array( - 'module' => 'poll', - 'subMenu' => array('poll'), - ), - 6 => array( - 'module' => 'rss', - 'subMenu' => array('rss'), - ), - 7 => array( - 'module' => 'module', - 'subMenu' => array('multilingual'), - ), - 8 => array( - 'module' => 'importer', - 'subMenu' => array('importer'), - ), - 9 => array( - 'module' => 'trash', - 'subMenu' => array('trash'), - ), - 10 => array( - 'module' => 'autoinstall', - 'subMenu' => array('easyInstall'), - ), - 11 => array( - 'module' => 'layout', - 'subMenu' => array('installedLayout'), - ), - 12 => array( - 'module' => 'module', - 'subMenu' => array('installedModule'), - ), - 13 => array( - 'module' => 'widget', - 'subMenu' => array('installedWidget'), - ), - 14 => array( - 'module' => 'addon', - 'subMenu' => array('installedAddon'), - ), - 15 => array( - 'module' => 'editor', - 'subMenu' => array('editor'), - ), - 16 => array( - 'module' => 'spamfilter', - 'subMenu' => array('spamFilter'), - ), - 17 => array( - 'module' => 'admin', - 'subMenu' => array('adminConfigurationGeneral', 'adminConfigurationFtp', 'adminMenuSetup'), - ), - 18 => array( - 'module' => 'file', - 'subMenu' => array('fileUpload'), - ), - 19 => array( - 'module' => 'module', - 'subMenu' => array('filebox'), - ), - 20 => array( - 'module' => 'point', - 'subMenu' => array('point') + 'advanced' => array( + 'autoinstall.easyInstall', + 'layout.installedLayout', + 'module.installedModule', + 'addon.installedAddon', + 'widget.installedWidget', + 'module.multilingual', + 'rss.rss', ), ); @@ -253,8 +206,7 @@ class admin extends ModuleObject $output = $oMemberModel->getAdminGroup(array('group_srl')); $adminGroupSrl = $output->group_srl; - // gnb sub item create - // common argument setting + // gnb common argument setting $args = new stdClass(); $args->menu_srl = $menuSrl; $args->open_window = 'N'; @@ -264,24 +216,24 @@ class admin extends ModuleObject $args->active_btn = ''; $args->group_srls = $adminGroupSrl; $oModuleModel = getModel('module'); - - foreach($gnbModuleList AS $key => $value) + + $moduleActionInfo = array(); + foreach ($gnbMenuStructure as $key => $items) { - if(is_array($value['subMenu'])) + foreach ($items as $item) { - $moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']); - foreach($value['subMenu'] AS $key2 => $value2) + list($module_name, $menu_name) = explode('.', $item); + if (!isset($moduleActionInfo[$module_name])) { - $gnbKey = "'" . $this->_getGnbKey($value2) . "'"; - - //insert menu item - $args->menu_item_srl = getNextSequence(); - $args->parent_srl = $gnbDBList[$gnbKey]; - $args->name = '{$lang->menu_gnb_sub[\'' . $value2 . '\']}'; - $args->url = 'index.php?module=admin&act=' . $moduleActionInfo->menu->{$value2}->index; - $args->listorder = -1 * $args->menu_item_srl; - $output = executeQuery('menu.insertMenuItem', $args); + $moduleActionInfo[$module_name] = $oModuleModel->getModuleActionXml($module_name); } + + $args->menu_item_srl = getNextSequence(); + $args->parent_srl = $gnbDBList["'" . $key . "'"]; + $args->name = '{$lang->menu_gnb_sub[\'' . $menu_name . '\']}'; + $args->url = 'index.php?module=admin&act=' . $moduleActionInfo[$module_name]->menu->{$menu_name}->index; + $args->listorder = -1 * $args->menu_item_srl; + $output = executeQuery('menu.insertMenuItem', $args); } } @@ -293,55 +245,6 @@ class admin extends ModuleObject FileHandler::RemoveFilesInDir('./files/cache/menu/admin_lang'); } - /** - * Return parent menu key by child menu - * @return string - */ - function _getGnbKey($menuName) - { - switch($menuName) - { - case 'siteMap': - case 'siteDesign': - return 'menu'; - break; - case 'userList': - case 'userSetting': - case 'userGroup': - case 'point': - return 'user'; - break; - case 'document': - case 'comment': - case 'file': - case 'poll': - case 'rss': - case 'multilingual': - case 'importer': - case 'trash': - case 'spamFilter': - return 'content'; - break; - case 'easyInstall': - case 'installedLayout': - case 'installedModule': - case 'installedWidget': - case 'installedAddon': - case 'editor': - return 'advanced'; - break; - case 'adminConfigurationGeneral': - case 'adminConfigurationFtp': - case 'adminMenuSetup': - case 'fileUpload': - case 'filebox': - return 'configuration'; - break; - default: - return 'advanced'; - } - } - /** * Return parent old menu key by child menu * @return string diff --git a/modules/admin/tpl/_header.html b/modules/admin/tpl/_header.html index d01a60040..bb50a84f1 100644 --- a/modules/admin/tpl/_header.html +++ b/modules/admin/tpl/_header.html @@ -28,7 +28,7 @@ - +
  • -

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

    +

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

    {$XE_VALIDATOR_MESSAGE}

    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}

    @@ -116,7 +116,7 @@ diff --git a/modules/menu/tpl/sitemap.html b/modules/menu/tpl/sitemap.html index c0fe23878..eb0515cf1 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}

    From 7881463ac72c30d227beff62c036e289f69f20f0 Mon Sep 17 00:00:00 2001 From: conory Date: Thu, 11 Feb 2016 19:01:55 +0900 Subject: [PATCH 20/87] =?UTF-8?q?getTimeGap()=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=83=80=EC=9E=84=EC=A1=B4=EC=9C=BC=EB=A1=9C=20=EC=9D=B8?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=EC=9D=B4=20=ED=91=9C=EC=8B=9C=EB=90=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/legacy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/legacy.php b/common/legacy.php index c948a158c..10532490d 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -610,7 +610,7 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false) */ function getTimeGap($date, $format = 'Y.m.d') { - $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); + $gap = $_SERVER['REQUEST_TIME'] - strtotime($date); $lang_time_gap = Context::getLang('time_gap'); if($gap < 60) From aaa3e25ad5426f3fb036f3727f35de064d1d1e43 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 11 Feb 2016 21:27:36 +0900 Subject: [PATCH 21/87] Implement more precise timezone handling in edge cases --- common/framework/datetime.php | 15 +++++++++++++++ common/legacy.php | 5 +++-- tests/Unit/framework/DateTimeTest.php | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/common/framework/datetime.php b/common/framework/datetime.php index ac7001c64..9c2fd727b 100644 --- a/common/framework/datetime.php +++ b/common/framework/datetime.php @@ -125,6 +125,12 @@ class DateTime /** * Get a PHP time zone by UTC offset. * + * Time zones with both (a) fractional offsets and (b) daylight saving time + * (such as Iran's +03:30/+04:30) cannot be converted in this way. + * However, if Rhymix is installed for the first time in such a time zone, + * the internal time zone will be automatically set to UTC, + * so this should never be a problem in practice. + * * @param int $offset * @return bool */ @@ -133,6 +139,15 @@ class DateTime switch ($offset) { case 0: return 'Etc/UTC'; + case -34200: return 'Pacific/Marquesas'; // -09:30 + case -16200: return 'America/Caracas'; // -04:30 + case 16200: return 'Asia/Kabul'; // +04:30 + case 19800: return 'Asia/Kolkata'; // +05:30 + case 20700: return 'Asia/Kathmandu'; // +05:45 + case 23400: return 'Asia/Rangoon'; // +06:30 + case 30600: return 'Asia/Pyongyang'; // +08:30 + case 31500: return 'Australia/Eucla'; // +08:45 + case 34200: return 'Australia/Darwin'; // +09:30 default: return 'Etc/GMT' . ($offset > 0 ? '-' : '+') . intval(abs($offset / 3600)); } } diff --git a/common/legacy.php b/common/legacy.php index c948a158c..851fd44bb 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -530,8 +530,9 @@ function ztime($str) { $hour = $min = $sec = 0; } - $offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z'); - return gmmktime($hour, $min, $sec, $month, $day, $year) - $offset; + $timestamp = gmmktime($hour, $min, $sec, $month, $day, $year); + $offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z', $timestamp); + return $timestamp - $offset; } /** diff --git a/tests/Unit/framework/DateTimeTest.php b/tests/Unit/framework/DateTimeTest.php index e25f0e424..8dd25ba71 100644 --- a/tests/Unit/framework/DateTimeTest.php +++ b/tests/Unit/framework/DateTimeTest.php @@ -131,5 +131,8 @@ class DateTimeTest extends \Codeception\TestCase\Test { $this->assertEquals('Etc/GMT-9', Rhymix\Framework\DateTime::getTimezoneNameByOffset(32400)); $this->assertEquals('Etc/GMT+5', Rhymix\Framework\DateTime::getTimezoneNameByOffset(-18000)); + $this->assertEquals('Etc/UTC', Rhymix\Framework\DateTime::getTimezoneNameByOffset(0)); + $this->assertEquals('Asia/Kolkata', Rhymix\Framework\DateTime::getTimezoneNameByOffset(19800)); + $this->assertEquals('Australia/Eucla', Rhymix\Framework\DateTime::getTimezoneNameByOffset(31500)); } } From 8dffa0ad93e5f40c0b6bef58ce8fc27ed575382c Mon Sep 17 00:00:00 2001 From: conory Date: Thu, 11 Feb 2016 22:36:22 +0900 Subject: [PATCH 22/87] =?UTF-8?q?getTimeGap()=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=83=80=EC=9E=84=EC=A1=B4=EC=9C=BC=EB=A1=9C=20=EC=9D=B8?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=EC=9D=B4=20=ED=91=9C=EC=8B=9C=EB=90=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/legacy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/legacy.php b/common/legacy.php index 10532490d..5ae09e2ec 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -610,7 +610,7 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false) */ function getTimeGap($date, $format = 'Y.m.d') { - $gap = $_SERVER['REQUEST_TIME'] - strtotime($date); + $gap = RX_TIME - ztime($date); $lang_time_gap = Context::getLang('time_gap'); if($gap < 60) From 540e1ff9d5c8d3e55e2bdce0a68625644c4cc1ea Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 08:51:21 +0900 Subject: [PATCH 23/87] Fix getTimeGap() to return more accurate results --- common/lang/ko.php | 8 ++++---- common/legacy.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/lang/ko.php b/common/lang/ko.php index 3a369e771..56f13c647 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -195,10 +195,10 @@ $lang->unit_meridiem['am'] = '오전'; $lang->unit_meridiem['pm'] = '오후'; $lang->unit_meridiem['AM'] = '오전'; $lang->unit_meridiem['PM'] = '오후'; -$lang->time_gap['min'] = '%d 분 전'; -$lang->time_gap['mins'] = '%d 분 전'; -$lang->time_gap['hour'] = '%d 시간 전'; -$lang->time_gap['hours'] = '%d 시간 전'; +$lang->time_gap['min'] = '%d분 전'; +$lang->time_gap['mins'] = '%d분 전'; +$lang->time_gap['hour'] = '%d시간 전'; +$lang->time_gap['hours'] = '%d시간 전'; $lang->about_tag = '쉼표(,)를 이용하여 복수 등록'; $lang->about_layout = '레이아웃은 콘텐츠의 겉모습을 꾸며줍니다. 상단 레이아웃 메뉴에서 관리할 수 있습니다.'; $lang->about_ipaddress_input = 'IP주소 입력형식
    1. 와일드카드(*) 사용가능(예: 192.168.0.*)
    2. 하이픈(-)을 사용하여 대역으로 입력가능
    (단, 대역폭으로 입력할 경우 와일드카드 사용불가. 예: 192.168.0.1-192.168.0.254)
    3.여러개의 항목은 줄을 바꾸어 입력하세요'; diff --git a/common/legacy.php b/common/legacy.php index 8152fe25e..214a92af5 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -614,21 +614,21 @@ function getTimeGap($date, $format = 'Y.m.d') $gap = RX_TIME - ztime($date); $lang_time_gap = Context::getLang('time_gap'); - if($gap < 60) + if($gap < 60 * 1.5) { - $buff = sprintf($lang_time_gap['min'], (int)($gap / 60) + 1); + $buff = sprintf($lang_time_gap['min'], round($gap / 60)); } elseif($gap < 60 * 60) { - $buff = sprintf($lang_time_gap['mins'], (int)($gap / 60) + 1); + $buff = sprintf($lang_time_gap['mins'], round($gap / 60)); } - elseif($gap < 60 * 60 * 2) + elseif($gap < 60 * 60 * 1.5) { - $buff = sprintf($lang_time_gap['hour'], (int)($gap / 60 / 60) + 1); + $buff = sprintf($lang_time_gap['hour'], round($gap / 60 / 60)); } elseif($gap < 60 * 60 * 24) { - $buff = sprintf($lang_time_gap['hours'], (int)($gap / 60 / 60) + 1); + $buff = sprintf($lang_time_gap['hours'], round($gap / 60 / 60)); } else { From b7c921bd0a7631315c87db50a9904cc4c375bd55 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 09:09:03 +0900 Subject: [PATCH 24/87] Add DateTime::formatTimestamp() method using the internal timezone --- common/framework/datetime.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/framework/datetime.php b/common/framework/datetime.php index 9c2fd727b..6c19c0b29 100644 --- a/common/framework/datetime.php +++ b/common/framework/datetime.php @@ -12,6 +12,19 @@ class DateTime */ protected static $_timezones = array(); + /** + * Format a Unix timestamp using the internal timezone. + * + * @param string $format Format used in PHP date() function + * @param int $timestamp Unix timestamp (optional, default is now) + * @return string + */ + public static function formatTimestamp($format, $timestamp = null) + { + $offset = Config::get('locale.internal_timezone') ?: date('Z', $timestamp); + return gmdate($format, $timestamp + $offset); + } + /** * Format a Unix timestamp for the current user's timezone. * From a75eb80f8e43720745e5fea8874cde596d50c1ce Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 09:09:27 +0900 Subject: [PATCH 25/87] Add getInternalDateTime() and getDisplayDateTime() functions --- common/legacy.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/common/legacy.php b/common/legacy.php index 214a92af5..f43b17e0d 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -602,6 +602,32 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false) return $result; } +/** + * Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone. + * If the timestamp is not given, the current time is used. + * + * @param int $timestamp Unix timestamp + * @return string + */ +function getInternalDateTime($timestamp = null, $format = 'YmdHis') +{ + $timestamp = ($timestamp !== null) ? $timestamp : time(); + return Rhymix\Framework\DateTime::formatTimestamp($format, $timestamp); +} + +/** + * Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone. + * If the timestamp is not given, the current time is used. + * + * @param int $timestamp Unix timestamp + * @return string + */ +function getDisplayDateTime($timestamp = null, $format = 'YmdHis') +{ + $timestamp = ($timestamp !== null) ? $timestamp : time(); + return Rhymix\Framework\DateTime::formatTimestampForCurrentUser($format, $timestamp); +} + /** * If the recent post within a day, output format of YmdHis is "min/hours ago from now". If not within a day, it return format string. * From 9b640ea15d43f6f370be8bfdc39a305c6b7bd805 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 09:09:47 +0900 Subject: [PATCH 26/87] Add unit tests for new date/time functions --- tests/Unit/framework/DateTimeTest.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/Unit/framework/DateTimeTest.php b/tests/Unit/framework/DateTimeTest.php index 8dd25ba71..0c0708b12 100644 --- a/tests/Unit/framework/DateTimeTest.php +++ b/tests/Unit/framework/DateTimeTest.php @@ -62,6 +62,35 @@ class DateTimeTest extends \Codeception\TestCase\Test Rhymix\Framework\Config::set('locale.internal_timezone', 10800); } + public function testGetInternalDateTime() + { + $timestamp = 1454000000; + + // Test zdate() when the internal time zone is different from the default time zone. + Rhymix\Framework\Config::set('locale.internal_timezone', 10800); + $this->assertEquals('20160128195320', getInternalDateTime($timestamp)); + + // Test zdate() when the internal time zone is the same as the default time zone. + Rhymix\Framework\Config::set('locale.internal_timezone', 32400); + $this->assertEquals('20160129015320', getInternalDateTime($timestamp)); + } + + public function testGetTimeGap() + { + Context::getInstance()->lang = Rhymix\Framework\Lang::getInstance('en'); + Context::getInstance()->lang->loadPlugin('common'); + + // Test getTimeGap() when the internal time zone is different from the default time zone. + Rhymix\Framework\Config::set('locale.internal_timezone', 10800); + $this->assertEquals('30 minutes ago', getTimeGap(getInternalDateTime(RX_TIME - 1800))); + $this->assertEquals('2 hours ago', getTimeGap(getInternalDateTime(RX_TIME - 6000))); + + // Test getTimeGap() when the internal time zone is the same as the default time zone. + Rhymix\Framework\Config::set('locale.internal_timezone', 32400); + $this->assertEquals('30 minutes ago', getTimeGap(getInternalDateTime(RX_TIME - 1800))); + $this->assertEquals('2 hours ago', getTimeGap(getInternalDateTime(RX_TIME - 6000))); + } + public function testGetTimezoneForCurrentUser() { // Test when the current user's time zone is different from the system default. @@ -82,16 +111,19 @@ class DateTimeTest extends \Codeception\TestCase\Test $_SESSION['timezone'] = 'America/Chicago'; $this->assertEquals('20160128 105320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_winter)); $this->assertEquals('20150728 115320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_summer)); + $this->assertEquals('20150728 115320', getDisplayDateTime($timestamp_summer, 'Ymd His')); // Test when the current user's time zone is in the Southern hemisphere with DST. $_SESSION['timezone'] = 'Pacific/Auckland'; $this->assertEquals('20160129 055320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_winter)); $this->assertEquals('20150729 045320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_summer)); + $this->assertEquals('20150729 045320', getDisplayDateTime($timestamp_summer, 'Ymd His')); // Test when the current user's time zone is the same as the system default without DST. unset($_SESSION['timezone']); $this->assertEquals('20160129 015320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_winter)); $this->assertEquals('20150729 015320', Rhymix\Framework\DateTime::formatTimestampForCurrentUser('Ymd His', $timestamp_summer)); + $this->assertEquals('20150729 015320', getDisplayDateTime($timestamp_summer, 'Ymd His')); } public function testGetTimezoneList() From 7ac2312eb70103b35c988fbb96f557be56cc7817 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 09:21:53 +0900 Subject: [PATCH 27/87] Use getInternalDateTime() as default time value for DB insert --- classes/xml/xmlquery/queryargument/DefaultValue.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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' : From a26b17d012572797aabb948c937599383aef3663 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 11:20:45 +0900 Subject: [PATCH 28/87] The default URL is always defined --- classes/context/Context.class.php | 4 +++ classes/module/ModuleHandler.class.php | 40 ++++++++++-------------- common/framework/compat/configparser.php | 2 +- common/lang/de.php | 2 -- common/lang/en.php | 2 -- common/lang/fr.php | 1 - common/lang/ja.php | 2 -- common/lang/ko.php | 2 -- common/lang/ru.php | 1 - common/lang/tr.php | 1 - common/lang/zh-CN.php | 1 - common/lang/zh-TW.php | 1 - 12 files changed, 21 insertions(+), 38 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index c9522e5d0..3434216ec 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -531,6 +531,10 @@ class Context $db_info->ftp_info->ftp_root_path = $config['ftp']['path']; $db_info->ftp_info->sftp = $config['ftp']['sftp'] ? 'Y' : 'N'; $db_info->default_url = $config['url']['default']; + if (!$db_info->default_url) + { + $db_info->default_url = (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . RX_BASEURL; + } $db_info->http_port = $config['url']['http_port']; $db_info->https_port = $config['url']['https_port']; $db_info->use_ssl = $config['url']['ssl']; diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index b996f5de0..e0a4ce38c 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -133,23 +133,22 @@ class ModuleHandler extends Handler continue; } - $urlInfo = parse_url($url); - $host = $urlInfo['host']; - - $defaultUrl = Context::getDefaultUrl(); - if($defaultUrl) + if($host = parse_url($url, PHP_URL_HOST)) { - $defaultUrlInfo = parse_url($defaultUrl); - $defaultHost = $defaultUrlInfo['host']; - } - else - { - $defaultHost = $_SERVER['HTTP_HOST']; - } - - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) - { - throw new Exception('msg_default_url_is_null'); + $defaultHost = parse_url(Context::getDefaultUrl(), PHP_URL_HOST); + if($host !== $defaultHost) + { + $siteModuleHost = $site_module_info->domain; + if(strpos($siteModuleHost, '/') !== false) + { + $siteModuleHost = parse_url($siteModuleHost, PHP_URL_HOST); + } + if($host !== $siteModuleHost) + { + Context::set('success_return_url', null); + Context::set('error_return_url', null); + } + } } } @@ -240,14 +239,7 @@ class ModuleHandler extends Handler } else { - if(!Context::getDefaultUrl()) - { - return Context::getLang('msg_default_url_is_not_defined'); - } - else - { - $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); - } + $redirect_url = getNotEncodedSiteUrl(Context::getDefaultUrl(), 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); } header("Location: $redirect_url"); return FALSE; diff --git a/common/framework/compat/configparser.php b/common/framework/compat/configparser.php index 7f15cd809..72063ee41 100644 --- a/common/framework/compat/configparser.php +++ b/common/framework/compat/configparser.php @@ -183,7 +183,7 @@ class ConfigParser { $default_url = \Context::decodeIdna($default_url); } - $config['url']['default'] = $default_url ?: \RX_BASEURL; + $config['url']['default'] = $default_url ?: (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL; $config['url']['http_port'] = $db_info->http_port ?: null; $config['url']['https_port'] = $db_info->https_port ?: null; $config['url']['ssl'] = $db_info->use_ssl ?: 'none'; diff --git a/common/lang/de.php b/common/lang/de.php index b35c0d913..ad9200ee7 100644 --- a/common/lang/de.php +++ b/common/lang/de.php @@ -215,7 +215,6 @@ $lang->msg_invalid_format = 'ein falsches Format'; $lang->msg_not_permitted_act = 'Sie haben keine Berechtigung, um den aufgeforderten Vorgang auszuführen.'; $lang->msg_module_is_not_exists = 'Das aufgeforderte Modul ist nicht zu finden. Bitte melden Sie sich dem Administrator des Moduls!'; $lang->msg_module_is_not_standalone = 'Das aufgeforderte Modul kann nicht selbstständig ausgeführt werden.'; -$lang->msg_default_url_is_not_defined = 'Der Vorgang ist unterbrochen, denn Das Default_URL ist nicht eingegen.'; $lang->msg_empty_search_target = 'Nicht finden können die das Suchziel.'; $lang->msg_empty_search_keyword = 'Nicht finden können das Stichwort.'; $lang->comment_to_be_approved = 'Ihr Kommentar muss von admin vor der Veröffentlichung genehmigt werden.'; @@ -298,4 +297,3 @@ $lang->dashboard = 'Armaturenbrett'; $lang->user = 'Mitglied'; $lang->yes = 'ja'; $lang->not = 'nicht'; -$lang->msg_default_url_is_null = 'Standard URL ist null.'; diff --git a/common/lang/en.php b/common/lang/en.php index 4876582de..a6f127672 100644 --- a/common/lang/en.php +++ b/common/lang/en.php @@ -223,7 +223,6 @@ $lang->msg_invalid_format = 'Invalid Format'; $lang->msg_not_permitted_act = 'You do not have permission to execute requested action.'; $lang->msg_module_is_not_exists = 'Cannot find the page you requested. Ask your Site Admin to check the page.'; $lang->msg_module_is_not_standalone = 'Requested page cannot be executed independently.'; -$lang->msg_default_url_is_not_defined = 'Default URL is not defined.'; $lang->msg_empty_search_target = 'Cannot find the Search target.'; $lang->msg_empty_search_keyword = 'Cannot find the Keyword.'; $lang->comment_to_be_approved = 'Your comment must be approved by admin before being published.'; @@ -320,7 +319,6 @@ $lang->dashboard = 'Dashboard'; $lang->user = 'Member'; $lang->yes = 'Yes'; $lang->not = 'No'; -$lang->msg_default_url_is_null = 'Default url is null.'; $lang->license_agreement = 'License Agreement'; $lang->license = 'GPL v2'; $lang->cmd_license_agree = 'I understand the license, and I accept it.'; diff --git a/common/lang/fr.php b/common/lang/fr.php index 0636976b0..b39285ade 100644 --- a/common/lang/fr.php +++ b/common/lang/fr.php @@ -172,7 +172,6 @@ $lang->msg_not_founded = 'L\'objet n\'est pas trouvé.'; $lang->msg_no_result = 'Nul Résultat'; $lang->msg_not_permitted_act = 'Vous n\'êtes pas autorisés à exécuter l\'action que vous avez demandé.'; $lang->msg_module_is_not_standalone = 'Le module demandé ne peut pas être exécuté indépendamment.'; -$lang->msg_default_url_is_not_defined = 'URL par défaut n\'est pas défini.'; $lang->success_registed = 'Enregistré avec succès'; $lang->success_declared = 'Accusé avec succès'; $lang->success_updated = 'Mise à jour avec succès'; diff --git a/common/lang/ja.php b/common/lang/ja.php index b7e9380ee..55a97b1a6 100644 --- a/common/lang/ja.php +++ b/common/lang/ja.php @@ -223,7 +223,6 @@ $lang->msg_invalid_format = '正しくないフォーマットです。'; $lang->msg_not_permitted_act = '現在の操作を実行する権限がありません。'; $lang->msg_module_is_not_exists = 'モジュールが見つかりません。 サイトマネージャへモジュールの点検をお問い合わせください。'; $lang->msg_module_is_not_standalone = 'このモジュールはスタンドアローンでは作動しません。'; -$lang->msg_default_url_is_not_defined = 'デフォルトURLが定められてないため、動作を中止します。'; $lang->msg_empty_search_target = '検索対象がありません。'; $lang->msg_empty_search_keyword = 'キーワードがありません。'; $lang->comment_to_be_approved = '管理者の確認が必要なコメントです。'; @@ -314,4 +313,3 @@ $lang->dashboard = 'ダッシュボード'; $lang->user = '会員'; $lang->yes = 'はい'; $lang->not = 'いいえ'; -$lang->msg_default_url_is_null = '基本URLが設定されていません。'; diff --git a/common/lang/ko.php b/common/lang/ko.php index 56f13c647..612b63536 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -223,7 +223,6 @@ $lang->msg_invalid_format = '잘못된 형식입니다.'; $lang->msg_not_permitted_act = '요청한 기능을 실행할 수 있는 권한이 없습니다.'; $lang->msg_module_is_not_exists = '요청한 페이지를 찾을 수 없습니다. 사이트 관리자에게 문의해 주세요.'; $lang->msg_module_is_not_standalone = '요청한 페이지는 독립적으로 동작할 수 없습니다.'; -$lang->msg_default_url_is_not_defined = '기본 URL이 정해지지 않아서 동작을 중지합니다'; $lang->msg_empty_search_target = '검색대상이 없습니다.'; $lang->msg_empty_search_keyword = '검색어가 없습니다.'; $lang->comment_to_be_approved = '관리자의 확인이 필요한 댓글입니다.'; @@ -320,7 +319,6 @@ $lang->dashboard = '대시보드'; $lang->user = '회원'; $lang->yes = '예'; $lang->not = '아니오'; -$lang->msg_default_url_is_null = '기본 URL 설정이 안 되어 있습니다.'; $lang->license_agreement = '사용권 동의'; $lang->license = 'GPL v2'; $lang->cmd_license_agree = '사용권에 대해 이해했으며, 이에 동의합니다.'; diff --git a/common/lang/ru.php b/common/lang/ru.php index 718b12cf2..37fa62c14 100644 --- a/common/lang/ru.php +++ b/common/lang/ru.php @@ -187,7 +187,6 @@ $lang->msg_fail_to_request_open = 'Ошибка в запрашиваемом с $lang->msg_invalid_format = 'Неверный формат'; $lang->msg_not_permitted_act = 'У Вас нет прав для исполнения запрошенного действия'; $lang->msg_module_is_not_standalone = 'Запрошенный модуль не может быть исполнен независимо'; -$lang->msg_default_url_is_not_defined = 'Default URL is not define'; $lang->success_registed = 'Зарегистрировано успешно'; $lang->success_declared = 'Жалоба отправлена'; $lang->success_updated = 'Обновление успешно'; diff --git a/common/lang/tr.php b/common/lang/tr.php index 288c6ce77..ca1223da7 100644 --- a/common/lang/tr.php +++ b/common/lang/tr.php @@ -211,7 +211,6 @@ $lang->msg_fail_to_request_open = 'İsteğiniz gercekleşemedi.'; $lang->msg_invalid_format = 'Geçersiz Format'; $lang->msg_not_permitted_act = 'İstenilen eylemi gercekleştirmeye yetkiniz yok.'; $lang->msg_module_is_not_standalone = 'İstenilen modul bağımsız calıştırılamaz.'; -$lang->msg_default_url_is_not_defined = 'Varsayılan URL tanımlı değil.'; $lang->msg_empty_search_target = 'Arama amacı bulunamadı'; $lang->msg_empty_search_keyword = 'Anahtar kelime yok'; $lang->comment_to_be_approved = 'Yorumunuz, yayınlanmadan önce adminden onay almanız gerekir'; diff --git a/common/lang/zh-CN.php b/common/lang/zh-CN.php index f0f9a1ea5..7830681e2 100644 --- a/common/lang/zh-CN.php +++ b/common/lang/zh-CN.php @@ -213,7 +213,6 @@ $lang->msg_invalid_format = '错误的格式!'; $lang->msg_not_permitted_act = '没有权限执行 action命令'; $lang->msg_module_is_not_exists = '您所请求的模块不存在,请联系您的网站管理员。'; $lang->msg_module_is_not_standalone = '您请求的模块不能单独执行'; -$lang->msg_default_url_is_not_defined = '请设置XE通行证!'; $lang->msg_empty_search_target = '搜索不到目标'; $lang->msg_empty_search_keyword = '搜索不到关键字'; $lang->comment_to_be_approved = '您的回复在通过管理员审核之后才会被显示出来。'; diff --git a/common/lang/zh-TW.php b/common/lang/zh-TW.php index fad9c6428..cc14d4c13 100644 --- a/common/lang/zh-TW.php +++ b/common/lang/zh-TW.php @@ -213,7 +213,6 @@ $lang->msg_invalid_format = '格式錯誤'; $lang->msg_not_permitted_act = '沒有權限執行'; $lang->msg_module_is_not_exists = '找不到所登錄的模組。 請詢問網站管理員檢查模組。'; $lang->msg_module_is_not_standalone = '您請求的模組不能單獨執行'; -$lang->msg_default_url_is_not_defined = '尚未設定預設網址'; $lang->msg_empty_search_target = '搜尋不到目標'; $lang->msg_empty_search_keyword = '搜尋不到關鍵字'; $lang->success_registed = '成功送出!'; From 81ef35a88711e6942fad79af4ee353b5ba28952b Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 12 Feb 2016 14:12:22 +0900 Subject: [PATCH 29/87] Make the error page more flexible --- classes/context/Context.class.php | 40 ++++++++++++++----- modules/message/message.view.php | 5 ++- .../message/skins/default/system_message.html | 2 +- .../skins/xedition/system_message.html | 8 ++-- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 3434216ec..c5451e817 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -1468,18 +1468,40 @@ class Context } else { - self::setBrowserTitle(self::getSiteTitle()); - $oMessageObject = getView('message'); - $oMessageObject->setHttpStatusCode(503); - $oMessageObject->setError(-1); - $oMessageObject->setMessage(_XE_SITELOCK_TITLE_); - $oMessageObject->dispMessage(); - $oModuleHandler = new ModuleHandler; - $oModuleHandler->displayContent($oMessageObject); + self::displayErrorPage(_XE_SITELOCK_TITLE_, _XE_SITELOCK_MESSAGE_, 503); } exit; } - + + /** + * Display a generic error page and exit. + * + * @param string $title + * @param string $message + * @return void + */ + public static function displayErrorPage($title = 'Error', $message = '', $status = 500) + { + // Change current directory to the Rhymix installation path. + chdir(\RX_BASEDIR); + + // Set the title. + self::setBrowserTitle(self::getSiteTitle()); + self::addBrowserTitle($title); + + // Set the message. + $oMessageObject = getView('message'); + $oMessageObject->setError(-1); + $oMessageObject->setHttpStatusCode($status); + $oMessageObject->setMessage($title); + $oMessageObject->dispMessage($message); + + // Display the message. + $oModuleHandler = new ModuleHandler; + $oModuleHandler->displayContent($oMessageObject); + exit; + } + /** * Return request method * @return string Request method type. (Optional - GET|POST|XMLRPC|JSON) diff --git a/modules/message/message.view.php b/modules/message/message.view.php index 7da104822..6360e4c0e 100644 --- a/modules/message/message.view.php +++ b/modules/message/message.view.php @@ -17,7 +17,7 @@ class messageView extends message /** * @brief Display messages */ - function dispMessage() + function dispMessage($detail = null) { // Get configurations (using module model object) $oModuleModel = getModel('module'); @@ -58,9 +58,10 @@ class messageView extends message { if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; } - Context::set('ssl_mode',$ssl_mode); + Context::set('ssl_mode', $ssl_mode); Context::set('system_message', nl2br($this->getMessage())); + Context::set('system_message_detail', nl2br($detail)); $this->setTemplateFile('system_message'); } diff --git a/modules/message/skins/default/system_message.html b/modules/message/skins/default/system_message.html index 9a5536b7d..832d99fa2 100644 --- a/modules/message/skins/default/system_message.html +++ b/modules/message/skins/default/system_message.html @@ -8,7 +8,7 @@
    - {$item->title} {$lang->help} + {$item->title} {$lang->help}
    +
    + + + + + + + + + + + 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); From 0c9fa7400f2728530ceb08b61aba8eac02a9e47b Mon Sep 17 00:00:00 2001 From: qw5414 Date: Sat, 13 Feb 2016 10:12:10 +0900 Subject: [PATCH 45/87] =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=9D=BC=EA=B2=BD=EC=9A=B0=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/communication/communication.controller.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 5b2d8007b..f77b3e05f 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -783,6 +783,12 @@ class communicationController extends communication { return new Object(); } + + if($module->module == 'admin') + { + return new Object(); + } + $oCommunicationModel = getModel('communication'); $config = $oCommunicationModel->getConfig(); @@ -791,7 +797,6 @@ class communicationController extends communication return new Object(); } $act = Context::get('act'); - $logged_info = Context::get('logged_info'); if($module->module != 'member') { $oMemberController = getController('member'); @@ -812,7 +817,7 @@ class communicationController extends communication { $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) { From 47860db6e477631c04876b72830cca455affaaa9 Mon Sep 17 00:00:00 2001 From: qw5414 Date: Sat, 13 Feb 2016 10:29:11 +0900 Subject: [PATCH 46/87] =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=9D=84=20=EA=B8=B0=EB=A1=9D=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EC=9D=84=EA=B2=BD=EC=9A=B0=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EB=A9=94=EB=89=B4=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/member/member.controller.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index a8dfbebdd..c99dc0062 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -1845,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() ) { @@ -1891,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'); + } } /** From 12673a29c6c661e63f9347e0cd7d435df12712e6 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 10:31:04 +0900 Subject: [PATCH 47/87] Also display debug information for previous AJAX request in panel --- classes/display/DisplayHandler.class.php | 15 ++++++++ common/js/debug.js | 48 +++++++++++++++++------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 4c3b3b5e5..ae0d29455 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -195,11 +195,26 @@ class DisplayHandler extends Handler 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) . '}'; diff --git a/common/js/debug.js b/common/js/debug.js index 6d93488e8..3911a48b3 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -15,7 +15,9 @@ $(function() { // Initialize the debug button. $('').text("DEBUG").appendTo(button).click(function(event) { event.preventDefault(); - panel.css({ width: 0 }).show().animate({ width: 640 }, 200); + panel.css({ width: 0 }).show().animate({ width: 640 }, 200, function() { + $(window).scrollTop(0); + }); button.hide(); }); @@ -34,19 +36,29 @@ $(function() { })); // Define a function for adding debug data to the panel. - window.rhymix_debug_add_data = function(data) { + window.rhymix_debug_add_data = function(data, open) { // Define loop variables. var i, j, entry, num, backtrace, description; + // New pages are open by default. + if (open !== true && open !== false) + { + open = true; + } + // Create the page. var page = $('
    ').appendTo(panel); var page_body = $('
    ').appendTo(page); + if (!open) + { + page_body.hide(); + } // Create the page header. var page_header = $('
    ').prependTo(page); page_header.append($('

    ').text(data.page_title).attr("title", data.url)); - page_header.append($('').text("▲").click(function(event) { + page_header.append($('').text(open ? "▲" : "▼").click(function(event) { event.preventDefault(); if (page_body.is(":visible")) { page_body.slideUp(200); @@ -99,25 +111,33 @@ $(function() { entry = $('
    ').appendTo(page_body); num = parseInt(i) + 1; if (num < 10) num = "0" + num; description = ""; - description += "\nCaller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; - description += "\nConnection: " + data.queries[i].query_connection; - description += "\nQuery Time: " + data.queries[i].query_time.toFixed(4) + " sec"; - description += "\nResult: " + ((data.queries[i].message === "success") ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); + if (data.queries[i].query_connection) { + description += "\n- Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; + description += "\n- Connection: " + data.queries[i].query_connection; + description += "\n- Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""); + } + description += "\n- Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); entry.text(num + ". " + data.queries[i].query_string + description); } } }; - // Add debug data from the current page. - if (rhymix_debug_content) { - rhymix_debug_content.page_title = 'MAIN PAGE'; - rhymix_debug_add_data(rhymix_debug_content); + // Add debug data from the previous request. + if (window.rhymix_debug_previous) { + window.rhymix_debug_previous.page_title = 'PREVIOUS POST: ' + window.rhymix_debug_previous.ajax_module + "." + window.rhymix_debug_previous.ajax_act; + rhymix_debug_add_data(window.rhymix_debug_previous, false); + } + + // Add debug data from the current request. + if (window.rhymix_debug_content) { + window.rhymix_debug_content.page_title = 'MAIN PAGE'; + rhymix_debug_add_data(window.rhymix_debug_content, true); } // Add debug data from pending AJAX requests. - if (rhymix_debug_pending_data) { - while (rhymix_debug_pending_data.length) { - rhymix_debug_add_data(rhymix_debug_pending_data.shift()); + if (window.rhymix_debug_pending_data) { + while (window.rhymix_debug_pending_data.length) { + rhymix_debug_add_data(window.rhymix_debug_pending_data.shift()); } } }); From e04efdd03e7787476f166ab8fb2f8da52e67f9c8 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 10:40:40 +0900 Subject: [PATCH 48/87] Do not display meaningless debug information --- common/framework/debug.php | 4 ++++ common/js/debug.js | 8 ++++++-- modules/document/document.item.php | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common/framework/debug.php b/common/framework/debug.php index 071377ff7..a32b9285f 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -101,6 +101,10 @@ class Debug // Get the backtrace. $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; $backtrace = debug_backtrace($backtrace_args); + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) + { + array_shift($backtrace); + } // Create a log entry. $entry = (object)array( diff --git a/common/js/debug.js b/common/js/debug.js index 3911a48b3..4c24d3b45 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -84,7 +84,9 @@ $(function() { num = parseInt(i) + 1; if (num < 10) num = "0" + num; backtrace = ""; for (j in data.entries[i].backtrace) { - backtrace += "\n- " + data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line; + if (data.entries[i].backtrace[j].file) { + backtrace += "\n- " + data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line; + } } entry.text(num + ". " + data.entries[i].message + backtrace); } @@ -98,7 +100,9 @@ $(function() { num = parseInt(i) + 1; if (num < 10) num = "0" + num; backtrace = ""; for (j in data.errors[i].backtrace) { - backtrace += "\n- " + data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line; + if (data.errors[i].backtrace[j].file) { + backtrace += "\n- " + data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line; + } } entry.text(num + ". " + data.errors[i].type + ": " + data.errors[i].message + backtrace); } diff --git a/modules/document/document.item.php b/modules/document/document.item.php index abb9e9614..e766530d5 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -59,6 +59,9 @@ class documentItem extends Object $this->columnList = $columnList; $this->_loadFromDB($load_extra_vars); + + trigger_error("This is a test error message.", E_USER_WARNING); + debugPrint(array("This message was printed with debugPrint() function", "Array is okay")); } function setDocument($document_srl, $load_extra_vars = true) From 968e25cd6ec80320652a385df5a5e83a2cc79016 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 10:51:11 +0900 Subject: [PATCH 49/87] Replace hyphen with bullet point --- common/js/debug.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/js/debug.js b/common/js/debug.js index 4c24d3b45..f1ca13853 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -85,7 +85,7 @@ $(function() { backtrace = ""; for (j in data.entries[i].backtrace) { if (data.entries[i].backtrace[j].file) { - backtrace += "\n- " + data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line; + backtrace += "\n• " + data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line; } } entry.text(num + ". " + data.entries[i].message + backtrace); @@ -101,7 +101,7 @@ $(function() { backtrace = ""; for (j in data.errors[i].backtrace) { if (data.errors[i].backtrace[j].file) { - backtrace += "\n- " + data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line; + backtrace += "\n• " + data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line; } } entry.text(num + ". " + data.errors[i].type + ": " + data.errors[i].message + backtrace); @@ -116,11 +116,11 @@ $(function() { num = parseInt(i) + 1; if (num < 10) num = "0" + num; description = ""; if (data.queries[i].query_connection) { - description += "\n- Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; - description += "\n- Connection: " + data.queries[i].query_connection; - description += "\n- Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""); + description += "\n• Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; + description += "\n• Connection: " + data.queries[i].query_connection; + description += "\n• Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""); } - description += "\n- Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); + description += "\n• Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); entry.text(num + ". " + data.queries[i].query_string + description); } } From 6b4d69bcc29a7cef9cffb55741ced3d4095157ea Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 11:19:13 +0900 Subject: [PATCH 50/87] Remove old debug constants --- classes/db/DB.class.php | 14 +-- classes/db/DBCubrid.class.php | 9 -- classes/db/DBMssql.class.php | 3 - classes/db/DBMysql.class.php | 9 -- classes/module/ModuleHandler.class.php | 6 +- common/autoload.php | 5 - common/constants.php | 2 + common/debug.php | 149 ----------------------- common/defaults/config.php | 6 +- common/framework/compat/configparser.php | 8 -- common/js/debug.js | 1 + common/legacy.php | 41 +++---- common/tpl/debug_comment.html | 1 + modules/document/document.item.php | 3 - 14 files changed, 29 insertions(+), 228 deletions(-) delete mode 100644 common/debug.php diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 8bc64a882..2d0d016ad 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -383,24 +383,12 @@ class DB } } - // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) + // leave error log if an error occured if($this->isError()) { $log['result'] = 'error'; $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)) - { - $buff[] = ''; - } - $buff[] = print_r($log, TRUE); - @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); - } } else { diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 5abb979ca..9059b99ce 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -971,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) { @@ -1002,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) @@ -1034,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) @@ -1077,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()) @@ -1147,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); @@ -1195,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 284bcbd0d..c6d150b8c 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -943,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()) @@ -1024,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 f01807fb1..1b5264ed8 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -689,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; @@ -711,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); } @@ -727,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; @@ -759,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()) @@ -880,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); @@ -927,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/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 4b2739046..30fa1410e 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -1184,11 +1184,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) { diff --git a/common/autoload.php b/common/autoload.php index 68f7b327f..0e47865c0 100644 --- a/common/autoload.php +++ b/common/autoload.php @@ -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. */ diff --git a/common/constants.php b/common/constants.php index d084ed0f4..06f4e1810 100644 --- a/common/constants.php +++ b/common/constants.php @@ -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/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 a9407e015..7fb040685 100644 --- a/common/defaults/config.php +++ b/common/defaults/config.php @@ -89,9 +89,9 @@ return array( 'enabled' => true, 'log_errors' => true, 'log_queries' => false, - 'log_slow_queries' => 1, - 'log_slow_triggers' => 1, - 'log_slow_widgets' => 1, + 'log_slow_queries' => 0, + 'log_slow_triggers' => 0, + 'log_slow_widgets' => 0, 'display_type' => 'comment', 'display_to' => 'admin', 'allow' => array(), diff --git a/common/framework/compat/configparser.php b/common/framework/compat/configparser.php index 72063ee41..b4d6fa067 100644 --- a/common/framework/compat/configparser.php +++ b/common/framework/compat/configparser.php @@ -216,14 +216,6 @@ class ConfigParser } $config['lock']['allow'] = array_values($db_info->sitelock_whitelist); - // Convert debug configuration. - $config['debug']['enabled'] = true; - $config['debug']['log_errors'] = true; - $config['debug']['log_queries'] = (\__DEBUG__ & 4) ? true : false; - $config['debug']['log_slow_queries'] = floatval(\__LOG_SLOW_QUERY__); - $config['debug']['log_slow_triggers'] = floatval(\__LOG_SLOW_TRIGGER__ * 1000); - $config['debug']['log_slow_widgets'] = floatval(\__LOG_SLOW_WIDGET__ * 1000); - // Convert embed filter configuration. if (is_array($db_info->embed_white_iframe)) { diff --git a/common/js/debug.js b/common/js/debug.js index f1ca13853..5b083ad27 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -118,6 +118,7 @@ $(function() { if (data.queries[i].query_connection) { description += "\n• Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; description += "\n• Connection: " + data.queries[i].query_connection; + description += "\n• Query ID: " + data.queries[i].query_id; description += "\n• Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""); } description += "\n• Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); diff --git a/common/legacy.php b/common/legacy.php index 025bc9f32..e849fdf9c 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -712,45 +712,44 @@ function debugPrint($entry = null) */ function writeSlowlog($type, $elapsed_time, $obj) { - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; - if(__LOG_SLOW_PROTECT__ === 1 && __LOG_SLOW_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) return; + static $config = array(); + if (!$config) + { + $config = config('debug'); + } + if(!$config['log_slow_queries'] && !$config['log_slow_triggers'] && !$config['log_slow_widgets']) + { + return; + } static $log_filename = array( 'query' => 'files/_slowlog_query.php', 'trigger' => 'files/_slowlog_trigger.php', - 'addon' => 'files/_slowlog_addon.php', 'widget' => 'files/_slowlog_widget.php' ); + $log_file = RX_BASEDIR . $log_filename[$type]; $write_file = true; - $log_file = _XE_PATH_ . $log_filename[$type]; - $buff = array(); $buff[] = ''; $buff[] = date('c'); - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) + if ($type == 'query' && $config['log_slow_queries'] > 0 && $elapsed_time > $config['log_slow_queries']) { - $buff[] = "\tCaller : " . $obj->caller; - $buff[] = "\tCalled : " . $obj->called; - } - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) - { - $buff[] = "\tAddon : " . $obj->called; - $buff[] = "\tCalled position : " . $obj->caller; - } - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) - { - $buff[] = "\tWidget : " . $obj->called; - } - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) - { - $buff[] = $obj->query; $buff[] = "\tQuery ID : " . $obj->query_id; $buff[] = "\tCaller : " . $obj->caller; $buff[] = "\tConnection : " . $obj->connection; } + elseif ($type == 'trigger' && $config['log_slow_triggers'] > 0 && $elapsed_time > $config['log_slow_triggers']) + { + $buff[] = "\tCaller : " . $obj->caller; + $buff[] = "\tCalled : " . $obj->called; + } + elseif ($type == 'widget' && $config['log_slow_widgets'] > 0 && $elapsed_time > $config['log_slow_widgets']) + { + $buff[] = "\tWidget : " . $obj->called; + } else { $write_file = false; diff --git a/common/tpl/debug_comment.html b/common/tpl/debug_comment.html index 544bc47f1..abb732305 100644 --- a/common/tpl/debug_comment.html +++ b/common/tpl/debug_comment.html @@ -92,6 +92,7 @@ Query logging is disabled. echo sprintf('%02d. %s', ++$query_count, $query->query_string) . "\n"; echo sprintf(' - Caller: %s', $query_caller) . "\n"; echo sprintf(' - Connection: %s', $query->query_connection) . "\n"; + echo sprintf(' - Query ID: %s', $query->query_id) . "\n"; echo sprintf(' - Query Time: %0.4f sec', $query->query_time) . "\n"; echo sprintf(' - Result: %s', $query_result) . "\n"; } diff --git a/modules/document/document.item.php b/modules/document/document.item.php index e766530d5..abb9e9614 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -59,9 +59,6 @@ class documentItem extends Object $this->columnList = $columnList; $this->_loadFromDB($load_extra_vars); - - trigger_error("This is a test error message.", E_USER_WARNING); - debugPrint(array("This message was printed with debugPrint() function", "Array is okay")); } function setDocument($document_srl, $load_extra_vars = true) From 55d7fe9df4f9cd2d53751b7c3be10509258cb9e3 Mon Sep 17 00:00:00 2001 From: qw5414 Date: Sat, 13 Feb 2016 11:25:40 +0900 Subject: [PATCH 51/87] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=AF=B9=EC=8A=A4?= =?UTF-8?q?=EB=A5=BC=20=EB=8D=AE=EC=96=B4=20=EC=94=8C=EC=9B=A0=EC=9D=84?= =?UTF-8?q?=EB=95=8C,=20=EC=95=A0=EB=93=9C=EC=98=A8=EC=9D=B4=20=EB=82=A8?= =?UTF-8?q?=EC=95=84=EC=9E=88=EC=96=B4=EB=8F=84=20=EC=9E=91=EB=8F=99?= =?UTF-8?q?=EC=9D=84=20=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/member_communication/conf/info.xml | 31 +++++++++++++++++++ .../member_communication.addon.php | 6 ++++ 2 files changed, 37 insertions(+) create mode 100644 addons/member_communication/conf/info.xml create mode 100644 addons/member_communication/member_communication.addon.php diff --git a/addons/member_communication/conf/info.xml b/addons/member_communication/conf/info.xml new file mode 100644 index 000000000..667368f27 --- /dev/null +++ b/addons/member_communication/conf/info.xml @@ -0,0 +1,31 @@ + + + 커뮤니케이션 + コミュニケーション + 会员交流 + Communication + Truyền thông + 커뮤니케이션 + 커뮤니케이션 + Общение + 交流 + + 이 애드온은 더 이상 역활을 하지 않습니다. 이 애드온의 기능은 커뮤니케이션 모듈로 흡수되었습니다. + + 1.7 + 2013-11-27 + + + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + NAVER + + + + diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php new file mode 100644 index 000000000..739abc3d3 --- /dev/null +++ b/addons/member_communication/member_communication.addon.php @@ -0,0 +1,6 @@ + */ +/* 이 애드온은 communication 모둘로 흡수 되었습니다. */ + +/* End of file member_communication.addon.php */ +/* Location: ./addons/member_communication/member_communication.addon.php */ From 51f985c2155ba01785e66daaee0b8cd0c298bb69 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 11:29:09 +0900 Subject: [PATCH 52/87] Only use error handler and slowlog when debugging is enabled --- classes/display/DisplayHandler.class.php | 30 +------------- common/framework/debug.php | 50 +++++++++++++++++++++++- common/legacy.php | 8 +++- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index ae0d29455..38cde2d5a 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -138,39 +138,11 @@ class DisplayHandler extends Handler public function getDebugInfo(&$output) { // Check if debugging is enabled for this request. - if (!config('debug.enabled')) + if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser()) { return; } - // Check if debugging info should be visible to the current user. - $display_to = config('debug.display_to'); - switch ($display_to) - { - case 'everyone': - break; - - case 'ip': - $allowed_ip = config('debug.allow'); - foreach ($allowed_ip as $range) - { - if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) - { - break 2; - } - } - return; - - case 'admin': - default: - $logged_info = Context::get('logged_info'); - if ($logged_info && $logged_info->is_admin === 'Y') - { - break; - } - return; - } - // Print debug information. switch ($display_type = config('debug.display_type')) { diff --git a/common/framework/debug.php b/common/framework/debug.php index a32b9285f..376bb9d04 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -308,7 +308,10 @@ class Debug */ public static function registerErrorHandlers($error_types) { - set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); + if (Config::get('debug.enabled')) + { + set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); + } set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler'); register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler'); } @@ -346,6 +349,51 @@ class Debug exit; } + /** + * Check if debugging is enabled for the current user. + * + * @return bool + */ + public static function isEnabledForCurrentUser() + { + static $cache = null; + if ($cache !== null) + { + return $cache; + } + if (!Config::get('debug.enabled')) + { + return $cache = false; + } + + $display_to = Config::get('debug.display_to'); + switch ($display_to) + { + case 'everyone': + return $cache = true; + + case 'ip': + $allowed_ip = Config::get('debug.allow'); + foreach ($allowed_ip as $range) + { + if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) + { + return $cache = true; + } + } + return $cache = false; + + case 'admin': + default: + $logged_info = \Context::get('logged_info'); + if ($logged_info && $logged_info->is_admin === 'Y') + { + return $cache = true; + } + return $cache = false; + } + } + /** * Get all debug information as an object. * diff --git a/common/legacy.php b/common/legacy.php index e849fdf9c..908f7262b 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -712,12 +712,16 @@ function debugPrint($entry = null) */ function writeSlowlog($type, $elapsed_time, $obj) { - static $config = array(); + static $config = null; if (!$config) { $config = config('debug'); } - if(!$config['log_slow_queries'] && !$config['log_slow_triggers'] && !$config['log_slow_widgets']) + if (!Rhymix\Framework\Debug::isEnabledForCurrentUser()) + { + return; + } + if (!$config['log_slow_queries'] && !$config['log_slow_triggers'] && !$config['log_slow_widgets']) { return; } From 4e2535624d7c536dffc722faab8154eff2a4c234 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 13 Feb 2016 21:11:05 +0900 Subject: [PATCH 53/87] Use separate debug files and prevent direct access --- classes/display/DisplayHandler.class.php | 12 ++++++++++-- modules/admin/lang/en.php | 2 +- modules/admin/lang/ko.php | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 38cde2d5a..9cc22a001 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -209,8 +209,16 @@ class DisplayHandler extends Handler $content = ob_get_clean(); if ($display_type === 'file') { - $debug_file = RX_BASEDIR . 'files/_debug_message.php'; - FileHandler::writeFile($debug_file, $content, 'a'); + $debug_file = RX_BASEDIR . 'files/debug/' . getInternalDateTime(RX_TIME, 'Ymd') . '.php'; + if (!file_exists($debug_file) || !filesize($debug_file)) + { + $phpheader = '' . "\n"; + } + else + { + $phpheader = ''; + } + FileHandler::writeFile($debug_file, $phpheader . $content, 'a'); return ''; } else diff --git a/modules/admin/lang/en.php b/modules/admin/lang/en.php index 938f3e441..932f2c978 100644 --- a/modules/admin/lang/en.php +++ b/modules/admin/lang/en.php @@ -119,7 +119,7 @@ $lang->debug_seconds = 'seconds or longer'; $lang->debug_display_type = 'Display Debug Info As'; $lang->debug_display_type_comment = 'HTML source comment'; $lang->debug_display_type_panel = 'On-screen panel'; -$lang->debug_display_type_file = 'Write to file'; +$lang->debug_display_type_file = 'Write to file (files/debug)'; $lang->debug_display_to = 'Display Debug Info To'; $lang->debug_display_to_admin = 'Administrator only'; $lang->debug_display_to_ip = 'Visitors from IP adresses listed below'; diff --git a/modules/admin/lang/ko.php b/modules/admin/lang/ko.php index 5dbf18725..c8997181d 100644 --- a/modules/admin/lang/ko.php +++ b/modules/admin/lang/ko.php @@ -116,7 +116,7 @@ $lang->debug_seconds = '초 이상 소요시 기록'; $lang->debug_display_type = '디버그 정보 표시 방법'; $lang->debug_display_type_comment = 'HTML 소스에 표시 (주석)'; $lang->debug_display_type_panel = '화면에 표시 (패널)'; -$lang->debug_display_type_file = '파일에 기록'; +$lang->debug_display_type_file = '파일에 기록 (files/debug)'; $lang->debug_display_to = '디버그 정보 표시 대상'; $lang->debug_display_to_admin = '관리자에게만 표시'; $lang->debug_display_to_ip = '아래 IP의 방문자에게만 표시'; From e1d85ffb22fc7f01a9259c039ddc8d0154792450 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 14 Feb 2016 20:08:11 +0900 Subject: [PATCH 54/87] Record debug entries in error log --- common/framework/debug.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/framework/debug.php b/common/framework/debug.php index 376bb9d04..436645c80 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -116,6 +116,11 @@ class Debug 'backtrace' => $backtrace, ); self::$_entries[] = $entry; + + // Add the entry to the error log. + $log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d', + var_export($message, true), $entry->file, $entry->line)); + error_log($log_entry); } /** From 05e9961b108030c7a333bf35f0b54e9933effc8c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 14 Feb 2016 22:14:59 +0900 Subject: [PATCH 55/87] Fix outdated license and community links --- layouts/xedition/css/layout.css | 5 +---- layouts/xedition/demo/copyright.html | 2 +- layouts/xedition/demo/footer.html | 8 ++++++-- layouts/xedition/demo/welcome_main.html | 14 +++++++------- layouts/xedition/img/f_logo.png | Bin 2859 -> 0 bytes modules/install/script/ko.install.php | 2 +- ...come_content_jp.html => welcome_content.html} | 8 ++++---- .../welcome_content/welcome_content_de.html | 9 --------- .../welcome_content/welcome_content_en.html | 9 --------- .../welcome_content/welcome_content_es.html | 9 --------- .../welcome_content/welcome_content_fr.html | 9 --------- .../welcome_content/welcome_content_ko.html | 9 --------- .../welcome_content/welcome_content_mn.html | 9 --------- .../welcome_content/welcome_content_ru.html | 9 --------- .../welcome_content/welcome_content_tr.html | 9 --------- .../welcome_content/welcome_content_vi.html | 9 --------- .../welcome_content/welcome_content_zh-CN.html | 9 --------- .../welcome_content/welcome_content_zh-TW.html | 9 --------- 18 files changed, 20 insertions(+), 118 deletions(-) delete mode 100644 layouts/xedition/img/f_logo.png rename modules/install/script/welcome_content/{welcome_content_jp.html => welcome_content.html} (67%) delete mode 100644 modules/install/script/welcome_content/welcome_content_de.html delete mode 100644 modules/install/script/welcome_content/welcome_content_en.html delete mode 100644 modules/install/script/welcome_content/welcome_content_es.html delete mode 100644 modules/install/script/welcome_content/welcome_content_fr.html delete mode 100644 modules/install/script/welcome_content/welcome_content_ko.html delete mode 100644 modules/install/script/welcome_content/welcome_content_mn.html delete mode 100644 modules/install/script/welcome_content/welcome_content_ru.html delete mode 100644 modules/install/script/welcome_content/welcome_content_tr.html delete mode 100644 modules/install/script/welcome_content/welcome_content_vi.html delete mode 100644 modules/install/script/welcome_content/welcome_content_zh-CN.html delete mode 100644 modules/install/script/welcome_content/welcome_content_zh-TW.html diff --git a/layouts/xedition/css/layout.css b/layouts/xedition/css/layout.css index e4c3573a4..adc89dc3f 100644 --- a/layouts/xedition/css/layout.css +++ b/layouts/xedition/css/layout.css @@ -200,8 +200,6 @@ a:hover, a:active, a:focus { background-color: #555 } .footer .copyright { - width: 1200px; - margin: 0 auto; font-size: 13px; color: #f1f1f1; line-height: 16px @@ -266,8 +264,7 @@ a:hover, a:active, a:focus { display: inline-block; margin: 0 0 20px; padding: 0 23px; - font-size: 15px; - font-weight: bold; + font-size: 18px; color: #555 } .footer .site_map > ul ul { diff --git a/layouts/xedition/demo/copyright.html b/layouts/xedition/demo/copyright.html index 46fd51ff9..f9eb502ae 100644 --- a/layouts/xedition/demo/copyright.html +++ b/layouts/xedition/demo/copyright.html @@ -1 +1 @@ -Copyright @ NAVER Corp. Supported by D2 Program. Powerd by XpressEngine. +Powerd by Rhymix diff --git a/layouts/xedition/demo/footer.html b/layouts/xedition/demo/footer.html index b1701abdb..c8d0e9c70 100644 --- a/layouts/xedition/demo/footer.html +++ b/layouts/xedition/demo/footer.html @@ -1,4 +1,8 @@ +

    + Rhymix is free software. + You can redistribute or modify it under the terms of the GNU General Public License (version 2 or later) + as published by the Free Software Foundation.

    -

    Rhymix is a free software CMS. You can redistribute or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation.

    diff --git a/layouts/xedition/demo/welcome_main.html b/layouts/xedition/demo/welcome_main.html index 965b9f0f6..ce3a94f0d 100644 --- a/layouts/xedition/demo/welcome_main.html +++ b/layouts/xedition/demo/welcome_main.html @@ -9,8 +9,8 @@
    - GUIDE -

    START-UP

    + GET STARTED +

    BUILD YOUR SITE

    - FEATURES -

    Rhymix. FEATURES

    + GET BETTER +

    RHYMIX FEATURES

    Rhymix는 프레임웍을 기반으로 개별 프로그램과 스킨을 실행하여 결과물을 생성합니다.
    다양한 개성을 가진 프로그램과 스킨을 조합하여 다채로운 기능을 가진 멋진 웹사이트를 만들 수 있습니다.

    • @@ -104,12 +104,12 @@

      GET INVOLVED

      • - COMMUNITY + COMMUNITY

        COMMUNITY

        Rhymix와 관련한 다양한 커뮤니티를 만나보세요.

      • - Q&A + Q&A

        Q&A

        도움이 필요할 때에는 전문가들과 이야기할 수 있습니다.

      • @@ -121,7 +121,7 @@
      • GITHUB

        GITHUB

        -

        오픈소스 프로젝트 개발참여를 위한 GitHub 페이지입니다.

        +

        오픈소스 프로젝트 개발 참여를 위한 GitHub 페이지입니다.

    diff --git a/layouts/xedition/img/f_logo.png b/layouts/xedition/img/f_logo.png deleted file mode 100644 index e9d88fd9e06dd262551a3745366146d84ab870d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2859 zcmeHJ_cI)d8eM|5S`cLmcExh_njq0P(aY5nqU!2tkTvZ;}!ww0CD`T6+;{yYCB@c)-Us>zAM#l`RXo10hw05r6h=;#@Mj36c! zR<_IR9Gq9UxOsTN5Gag~UjU8}yefng77-N_mync_mXVc{SGcaEeB-8ys=9`z7V6e* zZ5>@beFH-yW0Sv4&CD$D$cg+;{T)!s62M zkCoN6pT8*U8=G6(JHM&Bd;156N5?0pf6f5pPGbN72-Lr=Wf}BsgS2rk!xh@MLrwzV z0kkMYBu-UqjDU(xeu4YtW#DErBwqRUwU{k4VG&CDxS7`NzFF1?(p{_qQt@!4|b*(_EfRXExy< z9v>tgr`PoqVe+5-Xd_6O971HpgGlxUOz`ke)LkgdsKr6yVJw4psp$f1+&Kwk3Th_r z%m_mGbgN*_G;{^bk+yOw-7)CegZ$jb8s$FY@b}XDQMtiVHW;;CyaGXo*23G&y5lg9 z7rB@p_Gpcs%oIhqLm#ErkIJn`yRh8r9XMrm4bVzSs3}KYMmdZJ$n;w)UYF|A+-RLE z<%sD-Ds`NrBMfzK4KK;N?p>jw`)a-cXBP>mA7e=?3go%xRMc9rCx4ta&<%vOA7Ag+ z$ugVDJp3R*HZz7WB_icP;ys2W9vqF3(%)R`V_7T(LAAt{U_XT4A42pQt5gFj(1Fv1HXdMCIMQX_^9(X2$pTWtTV5 z8eHbaCylL}8DY!b$y!bgo}-_aY&>QYnW8=Pm0dE@=nm*)Yfl7st~WCF~preyD~*K>Kb(gba)yZ*4iNf`qHR5kmIxnw$a$+ES% z)dZ$!T{lrQ^+mRTzJ<#C@% zaGw%21X1uQb~{H_3B!hO%Z6 ztidghelhorjL6JJ<_`ba|P!iJSj*rb=$;f*eV zkSps}y#*$uTRg$Gs+?Hy7LB4r$GdCvGE>Y``t&HacNQ^-9fPxDA-qKPH^6_-56b4da>*-*H2)M$6r|o z@Mn1^Cv2fHa2E79q3jLDDrit`&>#=-)I;#vnch+Qid~QIi~#Y*X`v$cx*hYaP#5+{ zX!TExAeGAKJxE>`Y~>>`K49&&5>8AiBcFHGYD|u?v+A^)Gwp#eIWwZyeuBZ?2TGwW z!h)K!;~=vbkNcMfT!afJ7;1djqak#r5N$PR%T75UOHd>&!jVzhB&R4+1aGHu$O+&9{OZk|MkQPYM(Z$#;#bNa-Qn;!1Wa?Rml+0{-Ho^8RTIz@-b(<{ zGW#Fg4O*a&ThJkq9`crq!{zrY(4%h3O;q5n!?-vOV3RaK1KUh~CE O0MOSqxm}Gymodule_srl = $module_srl; Context::set('version', __XE_VERSION__); $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; 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 시작하기 -
    -
    From 7c4fc37dd3cfb6f23bf2d04dd78dbd9518a71354 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 14:28:57 +0900 Subject: [PATCH 56/87] Make debug log filename configurable --- classes/display/DisplayHandler.class.php | 13 ++++++++++--- common/defaults/config.php | 1 + common/framework/debug.php | 2 +- modules/admin/admin.admin.controller.php | 22 ++++++++++++++++++++++ modules/admin/admin.admin.view.php | 1 + modules/admin/lang/en.php | 5 ++++- modules/admin/lang/ko.php | 5 ++++- modules/admin/tpl/config_debug.html | 7 +++++++ 8 files changed, 50 insertions(+), 6 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 9cc22a001..bab8e6c67 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -209,8 +209,15 @@ class DisplayHandler extends Handler $content = ob_get_clean(); if ($display_type === 'file') { - $debug_file = RX_BASEDIR . 'files/debug/' . getInternalDateTime(RX_TIME, 'Ymd') . '.php'; - if (!file_exists($debug_file) || !filesize($debug_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"; } @@ -218,7 +225,7 @@ class DisplayHandler extends Handler { $phpheader = ''; } - FileHandler::writeFile($debug_file, $phpheader . $content, 'a'); + FileHandler::writeFile($log_filename, $phpheader . $content, 'a'); return ''; } else diff --git a/common/defaults/config.php b/common/defaults/config.php index 7fb040685..71ee5ff4f 100644 --- a/common/defaults/config.php +++ b/common/defaults/config.php @@ -92,6 +92,7 @@ return array( 'log_slow_queries' => 0, 'log_slow_triggers' => 0, 'log_slow_widgets' => 0, + 'log_filename' => null, 'display_type' => 'comment', 'display_to' => 'admin', 'allow' => array(), diff --git a/common/framework/debug.php b/common/framework/debug.php index 436645c80..b3e81dac6 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -408,7 +408,7 @@ class Debug { // Collect debug information. $data = (object)array( - 'timestamp' => DateTime::formatTimestampForCurrentUser('Y-m-d H:i:s P', RX_TIME), + 'timestamp' => DateTime::formatTimestamp('Y-m-d H:i:s', RX_TIME), 'url' => getCurrentPageUrl(), 'request' => (object)array( 'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''), diff --git a/modules/admin/admin.admin.controller.php b/modules/admin/admin.admin.controller.php index 699ddbf23..4fe62512b 100644 --- a/modules/admin/admin.admin.controller.php +++ b/modules/admin/admin.admin.controller.php @@ -710,6 +710,28 @@ class adminAdminController extends admin Rhymix\Framework\Config::set('debug.display_type', strval($vars->debug_display_type) ?: 'comment'); Rhymix\Framework\Config::set('debug.display_to', strval($vars->debug_display_to) ?: 'admin'); + // Log filename + $log_filename = strval($vars->debug_log_filename); + $log_filename_today = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array( + getInternalDateTime(RX_TIME, 'Y'), + getInternalDateTime(RX_TIME, 'y'), + getInternalDateTime(RX_TIME, 'm'), + getInternalDateTime(RX_TIME, 'd'), + ), $log_filename); + if (file_exists(RX_BASEDIR . $log_filename_today) && !is_writable(RX_BASEDIR . $log_filename_today)) + { + return new Object(-1, 'msg_debug_log_filename_not_writable'); + } + if (!file_exists(dirname(RX_BASEDIR . $log_filename)) && !FileHandler::makeDir(dirname(RX_BASEDIR . $log_filename))) + { + return new Object(-1, 'msg_debug_log_filename_not_writable'); + } + if (!is_writable(dirname(RX_BASEDIR . $log_filename))) + { + return new Object(-1, 'msg_debug_log_filename_not_writable'); + } + Rhymix\Framework\Config::set('debug.log_filename', $log_filename); + // IP access control $allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->debug_allowed_ip)); $allowed_ip = array_unique(array_filter($allowed_ip, function($item) { diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php index c3b9b7ba5..c31f8dd0c 100644 --- a/modules/admin/admin.admin.view.php +++ b/modules/admin/admin.admin.view.php @@ -496,6 +496,7 @@ class adminAdminView extends admin Context::set('debug_log_slow_queries', Rhymix\Framework\Config::get('debug.log_slow_queries')); Context::set('debug_log_slow_triggers', Rhymix\Framework\Config::get('debug.log_slow_triggers')); Context::set('debug_log_slow_widgets', Rhymix\Framework\Config::get('debug.log_slow_widgets')); + Context::set('debug_log_filename', Rhymix\Framework\Config::get('debug.log_filename') ?: 'files/debug/YYYYMMDD.php'); Context::set('debug_display_type', Rhymix\Framework\Config::get('debug.display_type')); Context::set('debug_display_to', Rhymix\Framework\Config::get('debug.display_to')); diff --git a/modules/admin/lang/en.php b/modules/admin/lang/en.php index 932f2c978..74b9d76f3 100644 --- a/modules/admin/lang/en.php +++ b/modules/admin/lang/en.php @@ -119,11 +119,14 @@ $lang->debug_seconds = 'seconds or longer'; $lang->debug_display_type = 'Display Debug Info As'; $lang->debug_display_type_comment = 'HTML source comment'; $lang->debug_display_type_panel = 'On-screen panel'; -$lang->debug_display_type_file = 'Write to file (files/debug)'; +$lang->debug_display_type_file = 'Write to file'; $lang->debug_display_to = 'Display Debug Info To'; $lang->debug_display_to_admin = 'Administrator only'; $lang->debug_display_to_ip = 'Visitors from IP adresses listed below'; $lang->debug_display_to_everyone = 'Everyone'; +$lang->debug_log_filename = 'Log filename'; +$lang->about_debug_log_filename = 'YYYYMMDD in the filename will be replaced with the current date.
    It is recommended to split the log file by date to prevent it from getting too large.'; +$lang->msg_debug_log_filename_not_writable = 'Rhymix cannot write log files in the specified path.'; $lang->debug_allowed_ip = 'Allowed IP addresses'; $lang->autoinstall = 'EasyInstall'; $lang->last_week = 'Last Week'; diff --git a/modules/admin/lang/ko.php b/modules/admin/lang/ko.php index c8997181d..3e959816e 100644 --- a/modules/admin/lang/ko.php +++ b/modules/admin/lang/ko.php @@ -116,11 +116,14 @@ $lang->debug_seconds = '초 이상 소요시 기록'; $lang->debug_display_type = '디버그 정보 표시 방법'; $lang->debug_display_type_comment = 'HTML 소스에 표시 (주석)'; $lang->debug_display_type_panel = '화면에 표시 (패널)'; -$lang->debug_display_type_file = '파일에 기록 (files/debug)'; +$lang->debug_display_type_file = '파일에 기록'; $lang->debug_display_to = '디버그 정보 표시 대상'; $lang->debug_display_to_admin = '관리자에게만 표시'; $lang->debug_display_to_ip = '아래 IP의 방문자에게만 표시'; $lang->debug_display_to_everyone = '모두에게 표시'; +$lang->debug_log_filename = '디버그 정보 기록 파일'; +$lang->about_debug_log_filename = '파일명에 YYYYMMDD가 포함된 경우 날짜별로 파일을 분리하여 기록합니다.
    파일을 분리하지 않으면 용량이 매우 커질 수 있으니 주의하십시오.'; +$lang->msg_debug_log_filename_not_writable = '지정한 경로에 로그 파일을 작성할 수 없습니다.'; $lang->debug_allowed_ip = '디버그 허용 IP'; $lang->autoinstall = '쉬운 설치'; $lang->last_week = '지난주'; diff --git a/modules/admin/tpl/config_debug.html b/modules/admin/tpl/config_debug.html index 861dadb78..06023192e 100644 --- a/modules/admin/tpl/config_debug.html +++ b/modules/admin/tpl/config_debug.html @@ -57,6 +57,13 @@
    +
    + +
    + +

    {$lang->about_debug_log_filename}

    +
    +
    From 283a1a73bc033f992bc5410c06d2a00adc709b24 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 14:36:21 +0900 Subject: [PATCH 57/87] Convert paths in error message relative to RX_BASEDIR --- common/framework/debug.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/framework/debug.php b/common/framework/debug.php index b3e81dac6..6017ac05b 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -141,6 +141,15 @@ class Debug return; } + // Rewrite the error message with relative paths. + $message = str_replace(array( + ' called in ' . RX_BASEDIR, + ' defined in ' . RX_BASEDIR, + ), array( + ' called in ', + ' defined in ', + ), $errstr); + // Get the backtrace. $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; $backtrace = debug_backtrace($backtrace_args); @@ -149,7 +158,7 @@ class Debug self::$_errors[] = $errinfo = (object)array( 'type' => self::getErrorType($errno), 'time' => microtime(true), - 'message' => $errstr, + 'message' => $message, 'file' => $errfile, 'line' => $errline, 'backtrace' => $backtrace, @@ -157,7 +166,7 @@ class Debug // Add the entry to the error log. $log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d', - $errinfo->type, $errinfo->message, $errinfo->file, intval($errinfo->line))); + $errinfo->type, $errstr, $errfile, intval($errline))); error_log($log_entry); } From 115738a84b69667690de081773070b21b33535b1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 14:40:01 +0900 Subject: [PATCH 58/87] Display debug panel at fixed position and scroll internally --- common/css/xe.css | 8 +++++--- common/js/debug.js | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/css/xe.css b/common/css/xe.css index 8f5269d5e..9cd77655c 100644 --- a/common/css/xe.css +++ b/common/css/xe.css @@ -317,11 +317,13 @@ button.btn { } #rhymix_debug_panel { display: none; - position: absolute; + position: fixed; left: 0; top: 0; - max-width: 96%; - min-height: 100%; + 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; diff --git a/common/js/debug.js b/common/js/debug.js index 5b083ad27..560cedfc6 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -15,9 +15,7 @@ $(function() { // Initialize the debug button. $('').text("DEBUG").appendTo(button).click(function(event) { event.preventDefault(); - panel.css({ width: 0 }).show().animate({ width: 640 }, 200, function() { - $(window).scrollTop(0); - }); + panel.css({ width: 0 }).show().animate({ width: 540 }, 200); button.hide(); }); @@ -25,7 +23,7 @@ $(function() { var header = $('
    ').appendTo(panel); header.append('

    RHYMIX DEBUG

    '); header.append($('+').click(function(event) { - panel.animate({ width: "95%" }, 300); + panel.animate({ width: "100%" }, 300); })); header.append($('×').click(function(event) { event.preventDefault(); From 83bf38c24572f8dd86df0fa3fdbd2357f1c7edcc Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 14:46:15 +0900 Subject: [PATCH 59/87] Fix debug panel style in admin module --- common/css/xe.css | 5 ++++- common/js/debug.js | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/css/xe.css b/common/css/xe.css index 9cd77655c..9c1d76115 100644 --- a/common/css/xe.css +++ b/common/css/xe.css @@ -341,15 +341,18 @@ button.btn { 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: 7px; + 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; diff --git a/common/js/debug.js b/common/js/debug.js index 560cedfc6..dcbd84e5a 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -15,7 +15,8 @@ $(function() { // Initialize the debug button. $('').text("DEBUG").appendTo(button).click(function(event) { event.preventDefault(); - panel.css({ width: 0 }).show().animate({ width: 540 }, 200); + var max_width = Math.min(540, $(window).width()); + panel.css({ width: max_width, left: max_width * -1 }).show().animate({ left: 0 }, 200); button.hide(); }); @@ -27,7 +28,7 @@ $(function() { })); header.append($('×').click(function(event) { event.preventDefault(); - panel.animate({ width: 0 }, 200, function() { + panel.animate({ left: panel.width() * -1 }, 200, function() { panel.hide(); button.show(); }); From a292ef29e92edc933c34c1f451d2ca06b0596312 Mon Sep 17 00:00:00 2001 From: qw5414 Date: Mon, 15 Feb 2016 15:00:12 +0900 Subject: [PATCH 60/87] =?UTF-8?q?=ED=94=BC=EB=9D=BC=EB=AF=B8=ED=84=B0?= =?UTF-8?q?=EA=B0=80=20=EC=97=86=EC=96=B4=EB=8F=84=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=EC=97=86=EB=8F=84=EB=A1=9D=20=EA=B3=A0=EC=B9=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/communication/communication.model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index 1c578535c..753bb2132 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -233,7 +233,7 @@ class communicationModel extends communication return $message; } - function getNewMessageCount($member_srl) + function getNewMessageCount($member_srl = null) { if(!$member_srl) { From 3045ac9c4216b765e3b5dc3b40d94dad3c9f6bed Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 15:38:01 +0900 Subject: [PATCH 61/87] Improve debug panel styles, and change color to red if there are errors --- common/css/xe.css | 32 ++++++++++++++++++--------- common/js/debug.js | 55 +++++++++++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/common/css/xe.css b/common/css/xe.css index 9c1d76115..680013067 100644 --- a/common/css/xe.css +++ b/common/css/xe.css @@ -296,6 +296,7 @@ button.btn { 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; @@ -303,7 +304,8 @@ button.btn { z-index: 1073741824; } #rhymix_debug_button:hover { - background: #444444; + background: #dddddd; + background: linear-gradient(to bottom, #e8e8e8 0%, #d9d9d9 100%); } #rhymix_debug_button a { display: block; @@ -312,8 +314,8 @@ button.btn { text-decoration: none; padding: 4px 8px; } -#rhymix_debug_button a:hover { - color: #eeeeee; +#rhymix_debug_button a.has_errors { + color: #f44336; } #rhymix_debug_panel { display: none; @@ -369,6 +371,7 @@ button.btn { padding-bottom: 8px; border-bottom: 1px solid #ddd; position: relative; + cursor: pointer; } #rhymix_debug_panel .debug_page .debug_page_header h3 { color: #444; @@ -401,16 +404,25 @@ button.btn { } #rhymix_debug_panel .debug_page .debug_entry { font-family: Consolas, "Courier New", monospace; - color: #666; + color: #444; margin-left: 38px; margin-bottom: 8px; text-indent: -28px; - white-space: pre-wrap; + word-wrap: break-word; + word-break: break-all; } -#rhymix_debug_panel .debug_page .debug_entry.no_indentation { - margin-left: 10px; - text-indent: 0; +#rhymix_debug_panel .debug_page .debug_entry ul.debug_metadata { + margin: 0 0 0 -16px; padding: 0; } -#rhymix_debug_panel .debug_page .debug_entry.collapse_spaces { - white-space: pre-line; +#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/js/debug.js b/common/js/debug.js index dcbd84e5a..44612f1e7 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -13,7 +13,7 @@ $(function() { var button = $("#rhymix_debug_button"); // Initialize the debug button. - $('').text("DEBUG").appendTo(button).click(function(event) { + var button_link = $('').text("DEBUG").appendTo(button).click(function(event) { event.preventDefault(); var max_width = Math.min(540, $(window).width()); panel.css({ width: max_width, left: max_width * -1 }).show().animate({ left: 0 }, 200); @@ -55,10 +55,13 @@ $(function() { } // Create the page header. - var page_header = $('
    ').prependTo(page); + var page_header = $('
    ').prependTo(page).click(function() { + $(this).find("a.debug_page_collapse").triggerHandler("click"); + }); page_header.append($('

    ').text(data.page_title).attr("title", data.url)); page_header.append($('').text(open ? "▲" : "▼").click(function(event) { event.preventDefault(); + event.stopPropagation(); if (page_body.is(":visible")) { page_body.slideUp(200); $(this).text("▼"); @@ -70,10 +73,12 @@ $(function() { // Add general information. page_body.append($('

    ').text('General Information')); - page_body.append($('
    ').text( - 'Request: ' + data.request.method + ' (' + data.request.size + ' bytes)' + "\n" + - 'Response: ' + data.response.method + ' (' + data.response.size + ' bytes)' + "\n" + - 'Time: ' + data.timing.total)); + entry = $('
    ').appendTo(page_body); + var metadata = $('').appendTo(entry); + metadata.append($('
  • ').text('Request: ' + data.request.method + (data.request.method !== "GET" ? (' - ' + data.request.size + ' bytes') : ""))); + metadata.append($('
  • ').text('Response: ' + data.response.method + ' - ' + data.response.size + ' bytes')); + metadata.append($('
  • ').text('Total Time: ' + data.timing.total)); + metadata.append($('
  • ').text('Query Time: ' + data.timing.db_query)); // Add debug entries. if (data.entries && data.entries.length) { @@ -81,13 +86,13 @@ $(function() { for (i in data.entries) { entry = $('
    ').appendTo(page_body); num = parseInt(i) + 1; if (num < 10) num = "0" + num; - backtrace = ""; + entry.text(num + ". " + data.entries[i].message); + backtrace = $('
      ').appendTo(entry); for (j in data.entries[i].backtrace) { if (data.entries[i].backtrace[j].file) { - backtrace += "\n• " + data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line; + backtrace.append($('
    • ').text(data.entries[i].backtrace[j].file + ":" + data.entries[i].backtrace[j].line)); } } - entry.text(num + ". " + data.entries[i].message + backtrace); } } @@ -97,13 +102,13 @@ $(function() { for (i in data.errors) { entry = $('
      ').appendTo(page_body); num = parseInt(i) + 1; if (num < 10) num = "0" + num; - backtrace = ""; + entry.text(num + ". " + data.errors[i].type + ": " + data.errors[i].message); + backtrace = $('
        ').appendTo(entry); for (j in data.errors[i].backtrace) { if (data.errors[i].backtrace[j].file) { - backtrace += "\n• " + data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line; + backtrace.append($('
      • ').text(data.errors[i].backtrace[j].file + ":" + data.errors[i].backtrace[j].line)); } } - entry.text(num + ". " + data.errors[i].type + ": " + data.errors[i].message + backtrace); } } @@ -111,24 +116,30 @@ $(function() { if (data.queries && data.queries.length) { page_body.append($('

        ').text('Queries (' + data.queries.length + ')')); for (i in data.queries) { - entry = $('
        ').appendTo(page_body); + entry = $('
        ').appendTo(page_body); num = parseInt(i) + 1; if (num < 10) num = "0" + num; - description = ""; - if (data.queries[i].query_connection) { - description += "\n• Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")"; - description += "\n• Connection: " + data.queries[i].query_connection; - description += "\n• Query ID: " + data.queries[i].query_id; - description += "\n• Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""); + entry.text(num + ". " + data.queries[i].query_string); + description = $('
          ').appendTo(entry); + if (data.queries[i].file && data.queries[i].line) { + description.append($('
        • ').text("Caller: " + data.queries[i].file + ":" + data.queries[i].line).append("
          (" + data.queries[i].method + ")")); + description.append($('
        • ').text("Connection: " + data.queries[i].query_connection)); + description.append($('
        • ').text("Query ID: " + data.queries[i].query_id)); + description.append($('
        • ').text("Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : ""))); } - description += "\n• Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)); - entry.text(num + ". " + data.queries[i].query_string + description); + description.append($('
        • ').text("Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message)))); } } + + // If there are errors, turn the button text red. + + if (data.errors && data.errors.length) { + button_link.addClass("has_errors"); + } }; // Add debug data from the previous request. if (window.rhymix_debug_previous) { - window.rhymix_debug_previous.page_title = 'PREVIOUS POST: ' + window.rhymix_debug_previous.ajax_module + "." + window.rhymix_debug_previous.ajax_act; + window.rhymix_debug_previous.page_title = 'PREVIOUS POST : ' + window.rhymix_debug_previous.ajax_module + "." + window.rhymix_debug_previous.ajax_act; rhymix_debug_add_data(window.rhymix_debug_previous, false); } From 0947bafa66d118522c439e6047d6bfb8b6751d9e Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 16:11:00 +0900 Subject: [PATCH 62/87] Add unit tests for the Debug class --- common/framework/debug.php | 23 ++++++++--- tests/Unit/framework/DebugTest.php | 65 ++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 tests/Unit/framework/DebugTest.php diff --git a/common/framework/debug.php b/common/framework/debug.php index 6017ac05b..fe19869ab 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -18,6 +18,11 @@ class Debug protected static $_slow_triggers = array(); protected static $_slow_widgets = array(); + /** + * Also write to error log. + */ + public static $write_to_error_log = true; + /** * Get all entries. * @@ -118,9 +123,12 @@ class Debug self::$_entries[] = $entry; // Add the entry to the error log. - $log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d', - var_export($message, true), $entry->file, $entry->line)); - error_log($log_entry); + if (self::$write_to_error_log) + { + $log_entry = str_replace("\0", '', sprintf('Rhymix Debug: %s in %s on line %d', + var_export($message, true), $entry->file, $entry->line)); + error_log($log_entry); + } } /** @@ -165,9 +173,12 @@ class Debug ); // Add the entry to the error log. - $log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d', - $errinfo->type, $errstr, $errfile, intval($errline))); - error_log($log_entry); + if (self::$write_to_error_log) + { + $log_entry = str_replace("\0", '', sprintf('PHP %s: %s in %s on line %d', + $errinfo->type, $errstr, $errfile, intval($errline))); + error_log($log_entry); + } } /** diff --git a/tests/Unit/framework/DebugTest.php b/tests/Unit/framework/DebugTest.php new file mode 100644 index 000000000..7325b34da --- /dev/null +++ b/tests/Unit/framework/DebugTest.php @@ -0,0 +1,65 @@ +assertEquals(1, count($entries)); + $this->assertEquals('foobar entry', $entries[0]->message); + $this->assertEquals($file, $entries[0]->file); + $this->assertEquals($line, $entries[0]->line); + } + + public function testDebugError() + { + $file = __FILE__; + $line = __LINE__ + 2; + Rhymix\Framework\Debug::$write_to_error_log = false; + Rhymix\Framework\Debug::addError(~0, 'Rhymix', $file, $line, null); + $errors = Rhymix\Framework\Debug::getErrors(); + $this->assertEquals(1, count($errors)); + $this->assertContains('Rhymix', $errors[0]->message); + $this->assertEquals($file, $errors[0]->file); + $this->assertEquals($line, $errors[0]->line); + } + + public function testDebugQuery() + { + Rhymix\Framework\Debug::addQuery(array( + 'result' => 'fail', + 'errno' => 1234, + 'errstr' => 'This is a unit test', + 'connection' => 'foobar', + 'query_id' => 'rhymix.unitTest', + 'query' => 'SELECT foo FROM bar', + 'elapsed_time' => 0.1234, + 'called_file' => __FILE__, + 'called_line' => __LINE__, + 'called_method' => 'rhymix.unitTest', + 'backtrace' => array(), + )); + $queries = Rhymix\Framework\Debug::getQueries(); + $this->assertEquals(1, count($queries)); + $this->assertEquals('SELECT foo FROM bar', $queries[0]->query_string); + $this->assertEquals('This is a unit test', $queries[0]->message); + $this->assertEquals(1234, $queries[0]->error_code); + } + + public function testDebugTranslateFilename() + { + $original_filename = __FILE__; + $trans_filename = substr($original_filename, strlen(\RX_BASEDIR)); + $this->assertEquals($trans_filename, Rhymix\Framework\Debug::translateFilename($original_filename)); + + $original_filename = __FILE__; + $alias_filename = $original_filename . '.foobar'; + $trans_filename = substr($alias_filename, strlen(\RX_BASEDIR)); + Rhymix\Framework\Debug::addFilenameAlias($alias_filename, $original_filename); + $this->assertEquals($trans_filename, Rhymix\Framework\Debug::translateFilename($original_filename)); + } +} From 63bddd0c9a598c7041c25a5b1c4b85c66e07000c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 19:35:32 +0900 Subject: [PATCH 63/87] Fix #273 'msg_is_not_manager' message and broken styles --- classes/module/ModuleHandler.class.php | 2 +- modules/message/skins/xedition/css/message.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index e0a4ce38c..f8712fe39 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -626,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); diff --git a/modules/message/skins/xedition/css/message.css b/modules/message/skins/xedition/css/message.css index df22fe434..e84a0123a 100644 --- a/modules/message/skins/xedition/css/message.css +++ b/modules/message/skins/xedition/css/message.css @@ -27,6 +27,7 @@ font-family: Arial, NanumBarunGothic, 'Malgun Gothic', Dotum, 'Apple SD Gothic Neo', AppleGothic, sans-serif; font-size: 13px; line-height: 17px; + height: auto; width: 100%; box-sizing: border-box; border: 1px solid #aaa; From 3614cef84a38c4847852e957df417f00a2cbc242 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 20:15:27 +0900 Subject: [PATCH 64/87] Modify checkCSRF() to always allow requests from the same hostname --- common/legacy.php | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/common/legacy.php b/common/legacy.php index f43b17e0d..c2184e77e 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -1342,42 +1342,58 @@ function requirePear() */ function checkCSRF() { - if($_SERVER['REQUEST_METHOD'] != 'POST') + // If this is not a POST request, FAIL. + if ($_SERVER['REQUEST_METHOD'] != 'POST') { - return FALSE; + return false; } - + + // Get the referer. If the referer is empty, PASS. + $referer = strval($_SERVER['HTTP_REFERER']); + if ($referer === '') + { + return true; + } + if (strpos($referer, 'xn--') !== false) + { + $referer = Context::decodeIdna($referer); + } + $referer_host = parse_url($referer, PHP_URL_HOST); + + // If the referer is the same domain as the current host, PASS. + $current_host = $_SERVER['HTTP_HOST']; + if (strpos($current_host, 'xn--') !== false) + { + $current_host = Context::decodeIdna($current_host); + } + if ($referer_host === $current_host) + { + return true; + } + + // If the referer is the same domain as the default URL, PASS. $default_url = Context::getDefaultUrl(); - $referer = $_SERVER["HTTP_REFERER"]; - - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) + if (strpos($default_url, 'xn--') !== false) { - $referer = Context::encodeIdna($referer); + $default_url = Context::decodeIdna($default_url); } - - $default_url = parse_url($default_url); - $referer = parse_url($referer); - + if ($referer_host === parse_url($default_url, PHP_URL_HOST)) + { + return true; + } + + // Check if we have a virtual site with a matching domain. $oModuleModel = getModel('module'); $siteModuleInfo = $oModuleModel->getDefaultMid(); - - if($siteModuleInfo->site_srl == 0) + $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); + if (strcasecmp($virtualSiteInfo->domain, Context::get('vid')) && stristr($virtualSiteInfo->domain, $referer_host)) { - if($default_url['host'] !== $referer['host']) - { - return FALSE; - } + return true; } else { - $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) - { - return FALSE; - } + return false; } - - return TRUE; } /** From 19469a7b0d43913f0577e8323331c738ccf720b6 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Feb 2016 20:16:03 +0900 Subject: [PATCH 65/87] After changing the default URL, redirect to new default URL --- modules/admin/admin.admin.controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/admin/admin.admin.controller.php b/modules/admin/admin.admin.controller.php index 09580f1d8..8d6e8cd1a 100644 --- a/modules/admin/admin.admin.controller.php +++ b/modules/admin/admin.admin.controller.php @@ -690,7 +690,7 @@ class adminAdminController extends admin Rhymix\Framework\Config::save(); $this->setMessage('success_updated'); - $this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'act', 'dispAdminConfigAdvanced')); + $this->setRedirectUrl(Context::get('success_return_url') ?: $default_url . 'index.php?act=dispAdminConfigAdvanced'); } /** From 516479cf207aadc04a0b7f3805311356641746dc Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:01:45 +0900 Subject: [PATCH 66/87] Migrate addon, trigger, and widget logging functions to Debug class --- classes/db/DB.class.php | 7 -- classes/display/DisplayHandler.class.php | 7 +- classes/module/ModuleHandler.class.php | 51 +++++++++-- common/framework/debug.php | 84 +++++++++++++---- common/legacy.php | 67 +------------- modules/addon/addon.controller.php | 110 ++++++++++++++--------- modules/widget/widget.controller.php | 9 +- 7 files changed, 188 insertions(+), 147 deletions(-) diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 2d0d016ad..695e0fd45 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -396,13 +396,6 @@ class DB } $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); } /** diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index bab8e6c67..80026a860 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -122,12 +122,13 @@ class DisplayHandler extends Handler self::$response_size = $this->content_size = strlen($output); ModuleHandler::triggerCall('display', 'after', $output); - // debugOutput output + // Output the page content and debug data. $debug = $this->getDebugInfo($output); print $output; print $debug; - - flushSlowlog(); + + // Flush the slow query/trigger/widget log. + ModuleHandler::triggerCall('common.flushDebugInfo', 'after', new stdClass); } /** diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 30fa1410e..80b565d9e 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -1200,17 +1200,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()) { @@ -1222,7 +1225,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/common/framework/debug.php b/common/framework/debug.php index fe19869ab..6c8ff7120 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -15,7 +15,9 @@ class Debug protected static $_errors = array(); protected static $_queries = array(); protected static $_slow_queries = array(); + protected static $_triggers = array(); protected static $_slow_triggers = array(); + protected static $_widgets = array(); protected static $_slow_widgets = array(); /** @@ -63,6 +65,16 @@ class Debug return self::$_slow_queries; } + /** + * Get all triggers. + * + * @return array + */ + public static function getTriggers() + { + return self::$_triggers; + } + /** * Get all slow triggers. * @@ -73,6 +85,16 @@ class Debug return self::$_slow_triggers; } + /** + * Get all widgets. + * + * @return array + */ + public static function getWidgets() + { + return self::$_widgets; + } + /** * Get all slow widgets. * @@ -80,7 +102,7 @@ class Debug */ public static function getSlowWidgets() { - return self::$_slow_triggers; + return self::$_slow_widgets; } /** @@ -188,7 +210,7 @@ class Debug */ public static function addQuery($query) { - self::$_queries[] = (object)array( + $query_object = (object)array( 'type' => 'Query', 'time' => microtime(true), 'message' => $query['result'] === 'success' ? 'success' : $query['errstr'], @@ -202,36 +224,64 @@ class Debug 'method' => $query['called_method'], 'backtrace' => $query['backtrace'], ); + + self::$_queries[] = $query_object; + if ($query_object->query_time && $query_object->query_time >= config('debug.log_slow_queries')) + { + self::$_slow_queries[] = $query_object; + } } /** - * Add a slow query to the log. + * Add a trigger to the log. * * @return bool */ - public static function addSlowQuery() + public static function addTrigger($trigger) { + $trigger_object = (object)array( + 'type' => 'Trigger', + 'time' => microtime(true), + 'message' => null, + 'file' => null, + 'line' => null, + 'backtrace' => array(), + 'trigger_name' => $trigger['name'], + 'trigger_target' => $trigger['target'], + 'trigger_plugin' => $trigger['target_plugin'], + 'trigger_time' => $trigger['elapsed_time'], + ); + self::$_triggers[] = $trigger_object; + if ($trigger_object->trigger_time && $trigger_object->trigger_time >= config('debug.log_slow_triggers')) + { + self::$_slow_triggers[] = $trigger_object; + } } /** - * Add a slow trigger to the log. + * Add a widget to the log. * * @return bool */ - public static function addSlowTrigger() - { - - } - - /** - * Add a slow widget to the log. - * - * @return bool - */ - public static function addSlowWidget() + public static function addWidget($widget) { + $widget_object = (object)array( + 'type' => 'Widget', + 'time' => microtime(true), + 'message' => null, + 'file' => null, + 'line' => null, + 'backtrace' => array(), + 'widget_name' => $widget['name'], + 'widget_time' => $widget['elapsed_time'], + ); + self::$_widgets[] = $widget_object; + if ($widget_object->widget_time && $widget_object->widget_time >= config('debug.log_slow_widgets')) + { + self::$_slow_widgets[] = $widget_object; + } } /** @@ -240,7 +290,7 @@ class Debug * @param Exception $e * @return void */ - public static function exceptionHandler(\Exception $e) + public static function exceptionHandler($e) { // Find out the file where the error really occurred. $errfile = self::translateFilename($e->getFile()); diff --git a/common/legacy.php b/common/legacy.php index 908f7262b..b53f2285b 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -712,67 +712,7 @@ function debugPrint($entry = null) */ function writeSlowlog($type, $elapsed_time, $obj) { - static $config = null; - if (!$config) - { - $config = config('debug'); - } - if (!Rhymix\Framework\Debug::isEnabledForCurrentUser()) - { - return; - } - if (!$config['log_slow_queries'] && !$config['log_slow_triggers'] && !$config['log_slow_widgets']) - { - return; - } - - static $log_filename = array( - 'query' => 'files/_slowlog_query.php', - 'trigger' => 'files/_slowlog_trigger.php', - 'widget' => 'files/_slowlog_widget.php' - ); - $log_file = RX_BASEDIR . $log_filename[$type]; - $write_file = true; - - $buff = array(); - $buff[] = ''; - $buff[] = date('c'); - - if ($type == 'query' && $config['log_slow_queries'] > 0 && $elapsed_time > $config['log_slow_queries']) - { - $buff[] = $obj->query; - $buff[] = "\tQuery ID : " . $obj->query_id; - $buff[] = "\tCaller : " . $obj->caller; - $buff[] = "\tConnection : " . $obj->connection; - } - elseif ($type == 'trigger' && $config['log_slow_triggers'] > 0 && $elapsed_time > $config['log_slow_triggers']) - { - $buff[] = "\tCaller : " . $obj->caller; - $buff[] = "\tCalled : " . $obj->called; - } - elseif ($type == 'widget' && $config['log_slow_widgets'] > 0 && $elapsed_time > $config['log_slow_widgets']) - { - $buff[] = "\tWidget : " . $obj->called; - } - else - { - $write_file = false; - } - - if($write_file) - { - $buff[] = sprintf("\t%0.6f sec", $elapsed_time); - $buff[] = PHP_EOL . PHP_EOL; - file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); - } - - if($type != 'query') - { - $trigger_args = $obj; - $trigger_args->_log_type = $type; - $trigger_args->_elapsed_time = $elapsed_time; - ModuleHandler::triggerCall('XE.writeSlowlog', 'after', $trigger_args); - } + // no-op } /** @@ -780,10 +720,7 @@ function writeSlowlog($type, $elapsed_time, $obj) */ function flushSlowlog() { - $trigger_args = new stdClass(); - $trigger_args->_log_type = 'flush'; - $trigger_args->_elapsed_time = 0; - ModuleHandler::triggerCall('XE.writeSlowlog', 'after', $trigger_args); + // no-op } /** diff --git a/modules/addon/addon.controller.php b/modules/addon/addon.controller.php index 241d10534..d647f62a2 100644 --- a/modules/addon/addon.controller.php +++ b/modules/addon/addon.controller.php @@ -34,8 +34,8 @@ class addonController extends addon $site_module_info = Context::get('site_module_info'); $site_srl = $site_module_info->site_srl; - $addon_path = _XE_PATH_ . 'files/cache/addons/'; - $addon_file = $addon_path . $site_srl . $type . '.acivated_addons.cache.php'; + $addon_path = RX_BASEDIR . 'files/cache/addons/'; + $addon_file = $addon_path . 'addons.' . intval($site_srl) . '.' . $type . '.php'; if($this->addon_file_called) { @@ -46,7 +46,7 @@ class addonController extends addon FileHandler::makeDir($addon_path); - if(!file_exists($addon_file)) + if(!file_exists($addon_file) || filemtime($addon_file) < filemtime(__FILE__)) { $this->makeCacheFile($site_srl, $type); } @@ -88,57 +88,78 @@ class addonController extends addon || ($type == "pc" && $val->is_used != 'Y') || ($type == "mobile" && $val->is_used_m != 'Y') || ($gtype == 'global' && $val->is_fixed != 'Y') - || !is_dir(_XE_PATH_ . 'addons/' . $addon)) + || !is_dir(RX_BASEDIR . 'addons/' . $addon)) { continue; } - + $extra_vars = unserialize($val->extra_vars); + if(!$extra_vars) + { + $extra_vars = new stdClass; + } + $mid_list = $extra_vars->mid_list; - if(!is_array($mid_list) || count($mid_list) < 1) + if(!is_array($mid_list)) { - $mid_list = NULL; + $mid_list = array(); } - + + // Initialize $buff[] = '$before_time = microtime(true);'; - $buff[] = '$rm = \'' . $extra_vars->xe_run_method . "';"; - $buff[] = '$ml = array('; - if($mid_list) + + // Run method and mid list + $run_method = $extra_vars->xe_run_method ?: 'run_selected'; + $buff[] = '$rm = \'' . $run_method . "';"; + $buff[] = '$ml = ' . var_export(array_fill_keys($mid_list, true), true) . ';'; + + // Addon filename + $buff[] = sprintf('$addon_file = RX_BASEDIR . \'addons/%s/%s.addon.php\';', $addon, $addon); + + // Addon configuration + $buff[] = '$addon_info = unserialize(' . var_export(serialize($extra_vars), true) . ');'; + + // Decide whether to run in this mid + if ($run_method === 'no_run_selected') { - foreach($mid_list as $mid) - { - $buff[] = "'$mid' => 1,"; - } + $buff[] = '$run = !isset($ml[$_m]);'; } - $buff[] = ');'; - $buff[] = sprintf('$addon_file = \'./addons/%s/%s.addon.php\';', $addon, $addon); - - if($val->extra_vars) + elseif (!count($mid_list)) { - unset($extra_vars); - $extra_vars = base64_encode($val->extra_vars); + $buff[] = '$run = true;'; } - $addon_include = sprintf('unset($addon_info); $addon_info = unserialize(base64_decode(\'%s\')); @include($addon_file);', $extra_vars); - - $buff[] = 'if(file_exists($addon_file)){'; - $buff[] = 'if($rm === \'no_run_selected\'){'; - $buff[] = 'if(!isset($ml[$_m])){'; - $buff[] = $addon_include; - $buff[] = '}}else{'; - $buff[] = 'if(isset($ml[$_m]) || count($ml) === 0){'; - $buff[] = $addon_include; - $buff[] = '}}}'; - $buff[] = '$after_time = microtime(true);'; - $buff[] = '$addon_time_log = new stdClass();'; - $buff[] = '$addon_time_log->caller = $called_position;'; - $buff[] = '$addon_time_log->called = "' . $addon . '";'; - $buff[] = '$addon_time_log->called_extension = "' . $addon . '";'; - $buff[] = 'writeSlowlog("addon",$after_time-$before_time,$addon_time_log);'; + else + { + $buff[] = '$run = isset($ml[$_m]);'; + } + + // Write debug info + $buff[] = 'if ($run && file_exists($addon_file)):'; + $buff[] = ' include($addon_file);'; + $buff[] = ' $after_time = microtime(true);'; + $buff[] = ' if (class_exists("Rhymix\\\\Framework\\\\Debug")):'; + $buff[] = ' Rhymix\\Framework\\Debug::addTrigger(array('; + $buff[] = ' "name" => "addon." . $called_position,'; + $buff[] = ' "target" => "' . $addon . '",'; + $buff[] = ' "target_plugin" => "' . $addon . '",'; + $buff[] = ' "elapsed_time" => $after_time - $before_time,'; + $buff[] = ' ));'; + $buff[] = ' endif;'; + $buff[] = 'endif;'; + $buff[] = ''; } - $addon_path = _XE_PATH_ . 'files/cache/addons/'; - FileHandler::makeDir($addon_path); - $addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php'; + + // Write file in new location + $addon_path = RX_BASEDIR . 'files/cache/addons/'; + $addon_file = $addon_path . 'addons.' . ($gtype == 'site' ? intval($site_srl) : 'G') . '.' . $type . '.php'; FileHandler::writeFile($addon_file, join(PHP_EOL, $buff)); + + // Remove file from old location + $old_addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php'; + if (file_exists($old_addon_file)) + { + FileHandler::removeFile($old_addon_file); + } } /** @@ -176,12 +197,17 @@ class addonController extends addon */ function removeAddonConfig($site_srl) { - $addon_path = _XE_PATH_ . 'files/cache/addons/'; - $addon_file = $addon_path . $site_srl . '.acivated_addons.cache.php'; + $addon_path = RX_BASEDIR . 'files/cache/addons/'; + $addon_file = $addon_path . 'addons.' . intval($site_srl) . '.' . $type . '.php'; if(file_exists($addon_file)) { FileHandler::removeFile($addon_file); } + $old_addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php'; + if (file_exists($old_addon_file)) + { + FileHandler::removeFile($old_addon_file); + } $args = new stdClass(); $args->site_srl = $site_srl; diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php index f13141365..1cd42c78c 100644 --- a/modules/widget/widget.controller.php +++ b/modules/widget/widget.controller.php @@ -644,11 +644,10 @@ class widgetController extends widget // Debug widget creation time information added to the results $elapsed_time = microtime(true) - $start; $GLOBALS['__widget_excute_elapsed__'] += $elapsed_time; - $slowlog = new stdClass; - $slowlog->caller = "widget.execute"; - $slowlog->called = $widget; - $slowlog->called_extension = $widget; - writeSlowlog('widget', $elapsed_time, $slowlog); + Rhymix\Framework\Debug::addWidget(array( + 'name' => $widget, + 'elapsed_time' => $elapsed_time, + )); // Return result return $output; From 191fa7c0c1326b0261010800d423ef85b2d4bfbc Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:12:01 +0900 Subject: [PATCH 67/87] Call common.flushDebugInfo automatically on shutdown --- classes/context/Context.class.php | 20 +++++++++++++++++--- classes/display/DisplayHandler.class.php | 2 +- classes/module/ModuleHandler.class.php | 1 - index.php | 2 -- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index c5451e817..c34554ada 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -331,9 +331,9 @@ class Context { ob_start(); $this->setCacheControl(-1, true); - register_shutdown_function(array($this, 'checkSessionStatus')); $_SESSION = array(); } + register_shutdown_function('Context::close'); // set authentication information in Context and session if(self::isInstalled()) @@ -411,7 +411,7 @@ class Context { if(self::getSessionStatus()) { - return; + return true; } if($force_start || (count($_SESSION) && !headers_sent())) { @@ -419,7 +419,9 @@ class Context unset($_SESSION); session_start(); $_SESSION = $tempSession; + return true; } + return false; } /** @@ -429,7 +431,19 @@ class Context */ public static function close() { - session_write_close(); + // Flush the slow query/trigger/widget log. + static $flushed = false; + if (!$flushed && config('debug.enabled')) + { + ModuleHandler::triggerCall('common.flushDebugInfo', 'after', new stdClass); + $flushed = true; + } + + // Check session status and close it if open. + if (self::checkSessionStatus()) + { + session_write_close(); + } } /** diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 80026a860..ba48d6dc7 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -78,7 +78,7 @@ class DisplayHandler extends Handler } // Start the session if $_SESSION was touched - Context::getInstance()->checkSessionStatus(); + Context::checkSessionStatus(); // header output $httpStatusCode = $oModule->getHttpStatusCode(); diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 80b565d9e..fb7449c83 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -884,7 +884,6 @@ class ModuleHandler extends Handler if($_SESSION['XE_VALIDATOR_RETURN_URL']) { - Context::getInstance()->checkSessionStatus(); header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); return; } diff --git a/index.php b/index.php index 6fda48144..bb7000fb1 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,5 @@ if($oContext->checkSSO()) } } -$oContext->close(); - /* End of file index.php */ /* Location: ./index.php */ From f1801a498228e45d95379ddb08fe2b63c623253f Mon Sep 17 00:00:00 2001 From: qw5414 Date: Tue, 16 Feb 2016 11:20:32 +0900 Subject: [PATCH 68/87] =?UTF-8?q?=EB=B9=84=ED=9A=8C=EC=9B=90=EC=9D=98=20?= =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=EC=9D=B4=20=EB=82=98=ED=83=80?= =?UTF-8?q?=EB=82=98=EC=A7=80=20=EC=95=8A=EB=8D=98=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EC=A0=90=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/document/tpl/document_list.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/document/tpl/document_list.html b/modules/document/tpl/document_list.html index 2daf9a530..e3eb56d8d 100644 --- a/modules/document/tpl/document_list.html +++ b/modules/document/tpl/document_list.html @@ -46,13 +46,14 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
          + From 588fefc88f198bfb90c899f0812a80f567a97e70 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:33:54 +0900 Subject: [PATCH 69/87] Add slow queries, triggers, and widgets to debug comment output --- common/framework/debug.php | 5 +++- common/tpl/debug_comment.html | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/common/framework/debug.php b/common/framework/debug.php index 6c8ff7120..a072c757e 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -501,10 +501,13 @@ class Debug 'entries' => self::$_entries, 'errors' => config('debug.log_errors') ? self::$_errors : null, 'queries' => config('debug.log_queries') ? self::$_queries : null, + 'slow_queries' => self::$_slow_queries, + 'slow_triggers' => self::$_slow_triggers, + 'slow_widgets' => self::$_slow_widgets, ); // Clean up the backtrace. - foreach (array('entries', 'errors', 'queries') as $key) + foreach (array('entries', 'errors', 'queries', 'slow_queries') as $key) { if (!$data->$key) { diff --git a/common/tpl/debug_comment.html b/common/tpl/debug_comment.html index abb732305..db0b873b0 100644 --- a/common/tpl/debug_comment.html +++ b/common/tpl/debug_comment.html @@ -98,3 +98,55 @@ Query logging is disabled. } ?> + +Slow Queries +============ +slow_queries)) + { + echo 'None'. "\n"; + } + foreach ($data->slow_queries as $query) + { + $query_caller = sprintf('%s line %d (%s)', $query->file, $query->line, $query->method); + $query_result = ($query->message === 'success') ? 'success' : sprintf('error %d %s', $query->error_code, $query->message); + echo sprintf('%02d. %s', ++$query_count, $query->query_string) . "\n"; + echo sprintf(' - Caller: %s', $query_caller) . "\n"; + echo sprintf(' - Connection: %s', $query->query_connection) . "\n"; + echo sprintf(' - Query ID: %s', $query->query_id) . "\n"; + echo sprintf(' - Query Time: %0.4f sec', $query->query_time) . "\n"; + echo sprintf(' - Result: %s', $query_result) . "\n"; + } +?> + +Slow Triggers +============= +slow_triggers)) + { + echo 'None'. "\n"; + } + foreach ($data->slow_triggers as $trigger) + { + echo sprintf('%02d. %s', ++$trigger_count, $trigger->trigger_name) . "\n"; + echo sprintf(' - Target: %s', $trigger->trigger_target) . "\n"; + echo sprintf(' - Exec Time: %0.4f sec', $trigger->trigger_time) . "\n"; + } +?> + +Slow Widgets +============ +slow_widgets)) + { + echo 'None'. "\n"; + } + foreach ($data->slow_widgets as $widget) + { + echo sprintf('%02d. %s', ++$widget_count, $widget->widget_name) . "\n"; + echo sprintf(' - Exec Time: %0.4f sec', $widget->widget_time) . "\n"; + } +?> From 04e729776c3370618af1ea963242d74a2b0b729d Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:40:37 +0900 Subject: [PATCH 70/87] Add slow queries, triggers, and widgets to debug panel output --- common/js/debug.js | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/common/js/debug.js b/common/js/debug.js index 44612f1e7..d14b28d13 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -130,8 +130,50 @@ $(function() { } } - // If there are errors, turn the button text red. + // Add slow queries. + if (data.slow_queries && data.slow_queries.length) { + page_body.append($('

          ').text('Slow Queries (' + data.slow_queries.length + ')')); + for (i in data.slow_queries) { + entry = $('
          ').appendTo(page_body); + num = parseInt(i) + 1; if (num < 10) num = "0" + num; + entry.text(num + ". " + data.slow_queries[i].query_string); + description = $('
            ').appendTo(entry); + if (data.slow_queries[i].file && data.slow_queries[i].line) { + description.append($('
          • ').text("Caller: " + data.slow_queries[i].file + ":" + data.slow_queries[i].line).append("
            (" + data.slow_queries[i].method + ")")); + description.append($('
          • ').text("Connection: " + data.slow_queries[i].query_connection)); + description.append($('
          • ').text("Query ID: " + data.slow_queries[i].query_id)); + description.append($('
          • ').text("Query Time: " + (data.slow_queries[i].query_time ? (data.slow_queries[i].query_time.toFixed(4) + " sec") : ""))); + } + description.append($('
          • ').text("Result: " + ((data.slow_queries[i].message === "success" || !data.slow_queries[i].message) ? "success" : ("error " + data.slow_queries[i].error_code + " " + data.slow_queries[i].message)))); + } + } + // Add slow triggers. + if (data.slow_triggers && data.slow_triggers.length) { + page_body.append($('

            ').text('Slow Triggers (' + data.slow_triggers.length + ')')); + for (i in data.slow_triggers) { + entry = $('
            ').appendTo(page_body); + num = parseInt(i) + 1; if (num < 10) num = "0" + num; + entry.text(num + ". " + data.slow_triggers[i].trigger_name); + description = $('
              ').appendTo(entry); + description.append($('
            • ').text("Target: " + data.slow_triggers[i].trigger_target)); + description.append($('
            • ').text("Exec Time: " + (data.slow_triggers[i].trigger_time ? (data.slow_triggers[i].trigger_time.toFixed(4) + " sec") : ""))); + } + } + + // Add slow widgets. + if (data.slow_widgets && data.slow_widgets.length) { + page_body.append($('

              ').text('Slow Widgets (' + data.slow_widgets.length + ')')); + for (i in data.slow_widgets) { + entry = $('
              ').appendTo(page_body); + num = parseInt(i) + 1; if (num < 10) num = "0" + num; + entry.text(num + ". " + data.slow_widgets[i].widget_name); + description = $('
                ').appendTo(entry); + description.append($('
              • ').text("Exec Time: " + (data.slow_widgets[i].widget_time ? (data.slow_widgets[i].widget_time.toFixed(4) + " sec") : ""))); + } + } + + // If there are errors, turn the button text red. if (data.errors && data.errors.length) { button_link.addClass("has_errors"); } From 2c7f220445af714bb9e8c896617bb7b6a8de9fea Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:43:03 +0900 Subject: [PATCH 71/87] Do not exit in Debug shutdown handler --- classes/context/Context.class.php | 1 - common/framework/debug.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index c34554ada..2da3ac8b0 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -1513,7 +1513,6 @@ class Context // Display the message. $oModuleHandler = new ModuleHandler; $oModuleHandler->displayContent($oMessageObject); - exit; } /** diff --git a/common/framework/debug.php b/common/framework/debug.php index a072c757e..a4232f336 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -329,6 +329,7 @@ class Debug // Display the error screen. self::displayErrorScreen($log_entry); + exit; } /** @@ -421,7 +422,6 @@ class Debug // Display a generic error page. \Context::displayErrorPage($title, $message, 500); - exit; } /** From 231e7100a1d442787700caf81ed693c6d0e1eae8 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 11:48:16 +0900 Subject: [PATCH 72/87] Fix duplicate namespace in IpFilter class call --- common/framework/debug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/framework/debug.php b/common/framework/debug.php index a4232f336..0196e9d71 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -451,7 +451,7 @@ class Debug $allowed_ip = Config::get('debug.allow'); foreach ($allowed_ip as $range) { - if (Rhymix\Framework\IpFilter::inRange(RX_CLIENT_IP, $range)) + if (IpFilter::inRange(RX_CLIENT_IP, $range)) { return $cache = true; } From c52eb1600ea8b3cb8f212a0a194db2a140815ed1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 13:03:17 +0900 Subject: [PATCH 73/87] Remove triggers after debug output --- classes/context/Context.class.php | 8 -------- classes/display/DisplayHandler.class.php | 3 --- 2 files changed, 11 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 2da3ac8b0..250df2afc 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -431,14 +431,6 @@ class Context */ public static function close() { - // Flush the slow query/trigger/widget log. - static $flushed = false; - if (!$flushed && config('debug.enabled')) - { - ModuleHandler::triggerCall('common.flushDebugInfo', 'after', new stdClass); - $flushed = true; - } - // Check session status and close it if open. if (self::checkSessionStatus()) { diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index ba48d6dc7..2f898edf8 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -126,9 +126,6 @@ class DisplayHandler extends Handler $debug = $this->getDebugInfo($output); print $output; print $debug; - - // Flush the slow query/trigger/widget log. - ModuleHandler::triggerCall('common.flushDebugInfo', 'after', new stdClass); } /** From edf984aeb57ac234a223f5d1a28ff6e26af72aca Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 13:10:41 +0900 Subject: [PATCH 74/87] Fix broken pre-wrap on debug entries --- common/css/xe.css | 3 +++ common/js/debug.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/css/xe.css b/common/css/xe.css index 680013067..c02a052e5 100644 --- a/common/css/xe.css +++ b/common/css/xe.css @@ -411,6 +411,9 @@ button.btn { 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; } diff --git a/common/js/debug.js b/common/js/debug.js index d14b28d13..1eaabfd0d 100644 --- a/common/js/debug.js +++ b/common/js/debug.js @@ -84,7 +84,7 @@ $(function() { if (data.entries && data.entries.length) { page_body.append($('

                ').text('Debug Entries (' + data.entries.length + ')')); for (i in data.entries) { - entry = $('
                ').appendTo(page_body); + entry = $('
                ').appendTo(page_body); num = parseInt(i) + 1; if (num < 10) num = "0" + num; entry.text(num + ". " + data.entries[i].message); backtrace = $('
                  ').appendTo(entry); From 1e69d7404a8d840bd30c078dbe7c4ee045731768 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 13:12:13 +0900 Subject: [PATCH 75/87] Fix input of slow log thresholds less than 1 --- modules/admin/tpl/config_debug.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/admin/tpl/config_debug.html b/modules/admin/tpl/config_debug.html index 06023192e..d9efecc66 100644 --- a/modules/admin/tpl/config_debug.html +++ b/modules/admin/tpl/config_debug.html @@ -31,21 +31,21 @@
                  - +  {$lang->debug_seconds}
                  - +  {$lang->debug_seconds}
                  - +  {$lang->debug_seconds}
                  From 9538322305c596b2863cb0b6b29247b722b3d2cc Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 13:20:27 +0900 Subject: [PATCH 76/87] Fix typo in comment for config() function --- common/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/functions.php b/common/functions.php index f626535f7..a1bd7234a 100644 --- a/common/functions.php +++ b/common/functions.php @@ -7,9 +7,10 @@ */ /** - * Get system configuration. + * Get or set system configuration. * * @param string $key + * @param string $value (optional) * @return mixed */ function config($key, $value = null) From fe54e83379fa154506d1eb7161eabcc0bb5c5e3c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 14:27:15 +0900 Subject: [PATCH 77/87] Do not get backtrace if query logging is disabled --- classes/db/DB.class.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 695e0fd45..fbc205adc 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -366,22 +366,29 @@ class DB $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']; - $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; + if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') + { + $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; + } } } + else + { + $log['called_file'] = $log['called_line'] = $log['called_method'] = null; + $log['backtrace'] = array(); + } // leave error log if an error occured if($this->isError()) @@ -393,6 +400,8 @@ class DB else { $log['result'] = 'success'; + $log['errno'] = null; + $log['errstr'] = null; } $this->setQueryLog($log); From e7bacf689a4a8769787c7f5edce3fb9ca2681e23 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 15:22:12 +0900 Subject: [PATCH 78/87] Update embed filter to use Simple HTML DOM Parser --- classes/security/EmbedFilter.class.php | 196 ++++++------------------- 1 file changed, 47 insertions(+), 149 deletions(-) diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index 12c98da94..a8d473ddb 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 { @@ -68,106 +66,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 +77,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 +131,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); } /** From a1e8d14b0dbc7543466686ca5fdb12d7e5047028 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 15:27:41 +0900 Subject: [PATCH 79/87] Move whitelist file to common location --- classes/security/EmbedFilter.class.php | 4 +--- .../conf => common/defaults}/whitelist.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) rename {classes/security/conf => common/defaults}/whitelist.php (99%) diff --git a/classes/security/EmbedFilter.class.php b/classes/security/EmbedFilter.class.php index a8d473ddb..2f90a753e 100644 --- a/classes/security/EmbedFilter.class.php +++ b/classes/security/EmbedFilter.class.php @@ -15,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(); @@ -257,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(); diff --git a/classes/security/conf/whitelist.php b/common/defaults/whitelist.php similarity index 99% rename from classes/security/conf/whitelist.php rename to common/defaults/whitelist.php index abd276136..272da733b 100644 --- a/classes/security/conf/whitelist.php +++ b/common/defaults/whitelist.php @@ -1,8 +1,15 @@ 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

                  IFrame

                  ', @@ -59,14 +59,11 @@ class FuncIncTest extends \Codeception\TestCase\Test 'dummy' ) ); - } - - /** - * @dataProvider provider - */ - public function testXss($source, $expected) - { - $result = removeHackTag($source); - $this->assertEquals($result, $expected); + + foreach ($tests as $test) + { + $result = removeHackTag($test[0]); + $this->assertEquals($test[1], $result); + } } } From bfe6be6535ae224639a61dfe84ff681dc5f80364 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 16:35:29 +0900 Subject: [PATCH 82/87] Never allow warnings to be printed before headers --- classes/context/Context.class.php | 3 ++- classes/display/DisplayHandler.class.php | 5 ++++- common/framework/debug.php | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 250df2afc..62b5d6ba2 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -329,10 +329,11 @@ class Context } else { - ob_start(); $this->setCacheControl(-1, true); $_SESSION = array(); } + + ob_start(); register_shutdown_function('Context::close'); // set authentication information in Context and session diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 2f898edf8..f48da0460 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -106,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; diff --git a/common/framework/debug.php b/common/framework/debug.php index 0196e9d71..0ed9bfb59 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -384,10 +384,7 @@ class Debug */ public static function registerErrorHandlers($error_types) { - if (Config::get('debug.enabled')) - { - set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); - } + set_error_handler('\\Rhymix\\Framework\\Debug::addError', $error_types); set_exception_handler('\\Rhymix\\Framework\\Debug::exceptionHandler'); register_shutdown_function('\\Rhymix\\Framework\\Debug::shutdownHandler'); } From 6b0d1bc22d0d820117c7475df4a1d5234094177c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 16:40:45 +0900 Subject: [PATCH 83/87] Fix install tests --- tests/install/AutoinstallCept.php | 2 +- tests/install/InstallCept.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/install/AutoinstallCept.php b/tests/install/AutoinstallCept.php index a628c37cc..01a733d01 100644 --- a/tests/install/AutoinstallCept.php +++ b/tests/install/AutoinstallCept.php @@ -3,7 +3,7 @@ use \Codeception\Configuration; $I = new InstallTester($scenario); -$config = (!$this->env) ? Configuration::suiteSettings('Install', Configuration::config()) : Configuration::suiteEnvironments('Install')[$this->env]; +$config = (!$this->env) ? Configuration::suiteSettings('install', Configuration::config()) : Configuration::suiteEnvironments('install')[$this->env]; $db_config = $config['modules']['config']['Db']; diff --git a/tests/install/InstallCept.php b/tests/install/InstallCept.php index 55447941e..8a79fa159 100644 --- a/tests/install/InstallCept.php +++ b/tests/install/InstallCept.php @@ -3,7 +3,7 @@ use \Codeception\Configuration; $I = new InstallTester($scenario); -$config = (!$this->env) ? Configuration::suiteSettings('Install', Configuration::config()) : Configuration::suiteEnvironments('Install')[$this->env]; +$config = (!$this->env) ? Configuration::suiteSettings('install', Configuration::config()) : Configuration::suiteEnvironments('install')[$this->env]; $db_config = $config['modules']['config']['Db']; From ad808a1058f820450da67f914179e7bbaf93b3c1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Feb 2016 17:43:05 +0900 Subject: [PATCH 84/87] Fix unit tests to remove warnings --- Gruntfile.js | 2 ++ tests/Unit/framework/DebugTest.php | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) 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/tests/Unit/framework/DebugTest.php b/tests/Unit/framework/DebugTest.php index 7325b34da..b6e4328d5 100644 --- a/tests/Unit/framework/DebugTest.php +++ b/tests/Unit/framework/DebugTest.php @@ -22,10 +22,11 @@ class DebugTest extends \Codeception\TestCase\Test Rhymix\Framework\Debug::$write_to_error_log = false; Rhymix\Framework\Debug::addError(~0, 'Rhymix', $file, $line, null); $errors = Rhymix\Framework\Debug::getErrors(); - $this->assertEquals(1, count($errors)); - $this->assertContains('Rhymix', $errors[0]->message); - $this->assertEquals($file, $errors[0]->file); - $this->assertEquals($line, $errors[0]->line); + $this->assertGreaterThanOrEqual(1, count($errors)); + $error = array_pop($errors); + $this->assertContains('Rhymix', $error->message); + $this->assertEquals($file, $error->file); + $this->assertEquals($line, $error->line); } public function testDebugQuery() From 833436465bcb491a4dc70a19b1052623554d499f Mon Sep 17 00:00:00 2001 From: conory Date: Tue, 16 Feb 2016 21:13:17 +0900 Subject: [PATCH 85/87] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=9C=84?= =?UTF-8?q?=EC=A0=AF=EC=97=90=20=EB=B9=84=EB=B0=80=EA=B8=80=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widgets/content/conf/info.xml | 26 ++++++++++++++++++++++++++ widgets/content/content.class.php | 11 ++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/widgets/content/conf/info.xml b/widgets/content/conf/info.xml index b76ddc545..c8b466ea2 100644 --- a/widgets/content/conf/info.xml +++ b/widgets/content/conf/info.xml @@ -622,6 +622,32 @@ Görüntüleme + + 비밀글 출력 + Display Secret + + N + 출력하지 않음 + No Display + Không hiển thị + No Display + 不显示 + 不顯示 + 表示しない + Görüntüleme + + + Y + 출력 + Display + Hiển thị + Display + 显示 + 顯示 + 表示 + Görüntüle + + new 표시 시간 (hours) new图标显示时间(hours) diff --git a/widgets/content/content.class.php b/widgets/content/content.class.php index 5399fbc98..c2777e6e3 100644 --- a/widgets/content/content.class.php +++ b/widgets/content/content.class.php @@ -249,8 +249,17 @@ class content extends WidgetHandler { $obj->order_type = $args->order_type=="desc"?"desc":"asc"; } + + if($args->show_secret == 'Y') + { + $obj->statusList = array('PUBLIC', 'SECRET'); + } + else + { + $obj->statusList = array('PUBLIC'); + } + $obj->list_count = $args->list_count * $args->page_count; - $obj->statusList = array('PUBLIC'); $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); if(!$output->toBool() || !$output->data) return; // If the result exists, make each document as an object From e5ffb52c535649f7ae9ed8834c7f9c2a009599cd Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 17 Feb 2016 09:37:13 +0900 Subject: [PATCH 86/87] Fix #284 Unable to save session in some environments --- classes/context/Context.class.php | 1 - index.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 62b5d6ba2..1479efabe 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -334,7 +334,6 @@ class Context } ob_start(); - register_shutdown_function('Context::close'); // set authentication information in Context and session if(self::isInstalled()) diff --git a/index.php b/index.php index bb7000fb1..bd0e2d53b 100644 --- a/index.php +++ b/index.php @@ -59,5 +59,7 @@ if($oContext->checkSSO()) } } +Context::close(); + /* End of file index.php */ /* Location: ./index.php */ From 0e57ddfb4e0c0395b87ddc6febf02eb112a0d1c1 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 17 Feb 2016 11:44:32 +0900 Subject: [PATCH 87/87] Fix E_STRICT errors being displayed in PHP 5.3 --- common/autoload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/autoload.php b/common/autoload.php index 0e47865c0..49bc48ef0 100644 --- a/common/autoload.php +++ b/common/autoload.php @@ -3,7 +3,7 @@ /** * Set error reporting rules. */ -error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED); +error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); /** * Suppress date/time errors until the internal time zone is set (see below).
                  {$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')}