From e3da3ba794d3dbefdd33105c5202905cbdff4e11 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 23 Dec 2019 13:50:15 +0900 Subject: [PATCH 01/13] Treat 'Mediapartners-Google' as a robot --- common/framework/ua.php | 6 +++--- tests/unit/framework/UATest.php | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/framework/ua.php b/common/framework/ua.php index 5c8b6b6dc..d57463ea5 100644 --- a/common/framework/ua.php +++ b/common/framework/ua.php @@ -146,7 +146,7 @@ class UA } // Look for common search engine names and the 'bot' keyword. - if (preg_match('/bot|spider|crawler|archiver|wget|curl|php|slurp|wordpress|facebook|teoma|yeti|daum|[(<+]https?:|@/i', $ua)) + if (preg_match('/bot|spider|crawler|archiver|wget|curl|php|slurp|wordpress|facebook|teoma|yeti|daum|mediapartners-google|[(<+]https?:|@/i', $ua)) { return self::$_robot_cache[$ua] = true; } @@ -308,10 +308,10 @@ class UA $result->version = $matches[1]; return $result; } - if (preg_match('#^([a-zA-Z0-9_-]+)/([0-9]+\\.[0-9]+)#', $ua, $matches)) + if (preg_match('#^([a-zA-Z0-9_-]+)(?:/([0-9]+\\.[0-9]+))?#', $ua, $matches)) { $result->browser = ucfirst($matches[1]); - $result->version = $matches[2]; + $result->version = $matches[2] ?: null; return $result; } diff --git a/tests/unit/framework/UATest.php b/tests/unit/framework/UATest.php index 06a1ec873..da01be134 100644 --- a/tests/unit/framework/UATest.php +++ b/tests/unit/framework/UATest.php @@ -240,6 +240,12 @@ class UATest extends \Codeception\TestCase\Test $this->assertEquals('1.0', $browser->version); $this->assertTrue($browser->is_robot); + // Mediapartners-Google + $browser = Rhymix\Framework\UA::getBrowserInfo('Mediapartners-Google'); + $this->assertEquals('Mediapartners-Google', $browser->browser); + $this->assertEquals(null, $browser->version); + $this->assertTrue($browser->is_robot); + // Bingbot $browser = Rhymix\Framework\UA::getBrowserInfo('Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)'); $this->assertEquals('Bingbot', $browser->browser); From 9cfd4ca363aa1799df8e781c7dad3b2c984d0190 Mon Sep 17 00:00:00 2001 From: BJRambo Date: Tue, 24 Dec 2019 22:54:46 +0900 Subject: [PATCH 02/13] =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=EB=A5=BC=20=ED=95=A8=EC=88=98=EB=A1=9C=20=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=98=A4=EB=A5=98=20=EA=B3=A0=EC=B9=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/file/file.model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/file/file.model.php b/modules/file/file.model.php index 4d906e886..68db2ff5f 100644 --- a/modules/file/file.model.php +++ b/modules/file/file.model.php @@ -403,7 +403,7 @@ class fileModel extends file function getUploadConfig() { $config = $this->getFileConfig(Context::get('module_srl') ?: Context::get('current_module_info')->module_srl); - if($this->user->isAdmin()) + if($this->user->is_admin === 'Y') { $module_config = getModel('module')->getModuleConfig('file'); $config->allowed_filesize = max($config->allowed_filesize, $module_config->allowed_filesize); From 9e6005ccbc244469caee1358571359112180d0f7 Mon Sep 17 00:00:00 2001 From: conory Date: Wed, 25 Dec 2019 23:01:37 +0900 Subject: [PATCH 03/13] =?UTF-8?q?form=20rx=5Fajax=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=8B=9C=20XE=5FVALIDATOR=5FMESSAGE=20=EC=84=B8=EC=85=98?= =?UTF-8?q?=EC=9D=84=20=EC=9D=B4=EC=9A=A9=ED=95=9C=20=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80=20=ED=91=9C=EC=8B=9C=EA=B0=80=20=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=AC=B8=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 --- classes/context/Context.class.php | 1 + classes/module/ModuleHandler.class.php | 2 +- common/js/xml_handler.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index abbe9c726..92a5b282e 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -165,6 +165,7 @@ class Context */ private static $_reserved_keys = array( '_rx_ajax_compat' => true, + '_rx_ajax_form' => true, '_rx_csrf_token' => true, '_rx_target_iframe' => true, ); diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 27de1368f..32cdbfad3 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -807,7 +807,7 @@ class ModuleHandler extends Handler $procResult = $oModule->proc(); $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) + if(!$oModule->stop_proc && (!isset($methodList[Context::getRequestMethod()]) || isset($_POST['_rx_ajax_form']))) { $error = $oModule->getError(); $message = $oModule->getMessage(); diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index eb6d531bd..47ff8bc2b 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -402,7 +402,7 @@ }, 1000); form.submit(); } else { - window.exec_json('raw', form.serialize(), callback_success, callback_error); + window.exec_json('raw', form.serialize() + '&_rx_ajax_form=1', callback_success, callback_error); } }); From 40e35a945107467673479db33d5364cb0e478bce Mon Sep 17 00:00:00 2001 From: conory Date: Thu, 26 Dec 2019 21:04:09 +0900 Subject: [PATCH 04/13] add rhymix_alert --- common/css/rhymix.less | 18 ++++++++++++++ common/js/common.js | 44 +++++++++++++++++++++++++++++++---- common/js/xml_handler.js | 10 +++++++- common/tpl/common_layout.html | 1 + 4 files changed, 68 insertions(+), 5 deletions(-) diff --git a/common/css/rhymix.less b/common/css/rhymix.less index 22ff2d8f1..15f312c80 100644 --- a/common/css/rhymix.less +++ b/common/css/rhymix.less @@ -157,6 +157,24 @@ a img { background: #333 url("../../common/img/msg.loading.gif") no-repeat center 15px; } +/* alert */ +#rhymix_alert { + display: none; + position: fixed; + left: 50%; + bottom: 20%; + width: 350px; + background-color: #000; + color: #fff; + font-size: 16px; + text-align: center; + opacity: 0.6; + padding: 12px 20px; + border-radius: 10px; + transform: translateX(-50%); + z-index: 999999999; +} + /* Debug */ #rhymix_debug_button { display: none; diff --git a/common/js/common.js b/common/js/common.js index e435d1f4e..6d90a3166 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -82,6 +82,38 @@ } }; + /** + * @brief display alert + */ + window.rhymix_alert = function(message, redirect_url, delay) { + if(!delay) { + delay = 2500; + } + if(!redirect_url) { + $('#rhymix_alert').text(message).show(); + setTimeout(function() { + $('#rhymix_alert').fadeOut(1000, function() { + $(this).empty(); + }); + }, delay); + } + else if(isSameOrigin(location.href, redirect_url)) { + Cookies.set('rhymix_alert_message', message, { expires: 1 / 1440, path: '' }); + Cookies.set('rhymix_alert_delay', delay, { expires: 1 / 1440, path: '' }); + } + else { + alert(message); + } + }; + + $(document).ready(function() { + if(Cookies.get('rhymix_alert_message')) { + rhymix_alert(Cookies.get('rhymix_alert_message'), null, Cookies.get('rhymix_alert_delay')); + Cookies.remove('rhymix_alert_message', { path: '' }); + Cookies.remove('rhymix_alert_delay', { path: '' }); + } + }); + /* Array for pending debug data */ window.rhymix_debug_pending_data = []; @@ -531,10 +563,7 @@ function sendMailTo(to) { * @brief url이동 (Rhymix 개선된 버전) */ function redirect(url) { - var absolute_url = window.location.href; - var relative_url = window.location.pathname + window.location.search; - if (url === absolute_url || url.indexOf(absolute_url.replace(/#.+$/, "") + "#") === 0 || - url === relative_url || url.indexOf(relative_url.replace(/#.+$/, "") + "#") === 0) { + if (isCurrentPageUrl(url)) { window.location.href = url; window.location.reload(); } else { @@ -542,6 +571,13 @@ function redirect(url) { } } +function isCurrentPageUrl(url) { + var absolute_url = window.location.href; + var relative_url = window.location.pathname + window.location.search; + return url === absolute_url || url.indexOf(absolute_url.replace(/#.+$/, "") + "#") === 0 || + url === relative_url || url.indexOf(relative_url.replace(/#.+$/, "") + "#") === 0; +} + /** * @brief url이동 (open_window 값이 N 가 아니면 새창으로 띄움) **/ diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index 47ff8bc2b..2468142d8 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -376,7 +376,15 @@ if (callback_success && window[callback_success] && $.isFunction(window[callback_success])) { callback_success = window[callback_success]; } else { - callback_success = null; + callback_success = function(data) { + if (data['message'] === 'success') { + return; + } + rhymix_alert(data['message'], data['redirect_url']); + if (data['redirect_url']) { + redirect(data.redirect_url); + } + }; } var callback_error = form.data('callback-error'); if (callback_error && window[callback_error] && $.isFunction(window[callback_error])) { diff --git a/common/tpl/common_layout.html b/common/tpl/common_layout.html index 43bd43d4d..3e7d26f59 100644 --- a/common/tpl/common_layout.html +++ b/common/tpl/common_layout.html @@ -72,6 +72,7 @@
{$lang->msg_call_server}
+
From b3068758eff0576c21bdd12847184b10c1127c31 Mon Sep 17 00:00:00 2001 From: conory Date: Thu, 26 Dec 2019 23:36:44 +0900 Subject: [PATCH 05/13] for unit test --- common/js/xml_handler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index 2468142d8..3e3a08f3f 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -377,11 +377,11 @@ callback_success = window[callback_success]; } else { callback_success = function(data) { - if (data['message'] === 'success') { + if (data.message === 'success') { return; } - rhymix_alert(data['message'], data['redirect_url']); - if (data['redirect_url']) { + rhymix_alert(data.message, data.redirect_url); + if (data.redirect_url) { redirect(data.redirect_url); } }; From 36aa4abb0cd0a24b5604587f7e87eef63b22e9df Mon Sep 17 00:00:00 2001 From: conory Date: Fri, 27 Dec 2019 11:11:15 +0900 Subject: [PATCH 06/13] close when click --- common/js/common.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/common/js/common.js b/common/js/common.js index 6d90a3166..b7cbdf891 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -82,6 +82,15 @@ } }; + window.rhymix_alert_close = function() { + if($('#rhymix_alert').is(':hidden')) { + return; + } + $('#rhymix_alert').fadeOut(500, function() { + $(this).empty(); + }); + }; + /** * @brief display alert */ @@ -91,11 +100,7 @@ } if(!redirect_url) { $('#rhymix_alert').text(message).show(); - setTimeout(function() { - $('#rhymix_alert').fadeOut(1000, function() { - $(this).empty(); - }); - }, delay); + setTimeout(rhymix_alert_close, delay); } else if(isSameOrigin(location.href, redirect_url)) { Cookies.set('rhymix_alert_message', message, { expires: 1 / 1440, path: '' }); @@ -112,6 +117,7 @@ Cookies.remove('rhymix_alert_message', { path: '' }); Cookies.remove('rhymix_alert_delay', { path: '' }); } + $('#rhymix_alert').click(rhymix_alert_close); }); /* Array for pending debug data */ From 9bf9f6266a80aca1c62f9712c2037237902b87b3 Mon Sep 17 00:00:00 2001 From: conory Date: Fri, 27 Dec 2019 22:00:20 +0900 Subject: [PATCH 07/13] adjust size --- common/css/rhymix.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/css/rhymix.less b/common/css/rhymix.less index 15f312c80..0405da1ed 100644 --- a/common/css/rhymix.less +++ b/common/css/rhymix.less @@ -163,7 +163,8 @@ a img { position: fixed; left: 50%; bottom: 20%; - width: 350px; + min-width: 250px; + max-width: 500px; background-color: #000; color: #fff; font-size: 16px; From 945ecb2da4b528975a663e26748e0fd6ae3c64da Mon Sep 17 00:00:00 2001 From: conory Date: Sat, 28 Dec 2019 00:06:22 +0900 Subject: [PATCH 08/13] for dark background --- common/css/rhymix.less | 1 + 1 file changed, 1 insertion(+) diff --git a/common/css/rhymix.less b/common/css/rhymix.less index 0405da1ed..240ed9001 100644 --- a/common/css/rhymix.less +++ b/common/css/rhymix.less @@ -171,6 +171,7 @@ a img { text-align: center; opacity: 0.6; padding: 12px 20px; + border: 1px solid #fff; border-radius: 10px; transform: translateX(-50%); z-index: 999999999; From 085b74b7dbd6f2e03c15a1fd9d0bf5495af2d4f3 Mon Sep 17 00:00:00 2001 From: conory Date: Sun, 29 Dec 2019 18:55:43 +0900 Subject: [PATCH 09/13] =?UTF-8?q?rx=5Fajax=20=EC=82=AC=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=20XE=5FVALIDATOR=5FMESSAGE=20=EB=8C=80=EC=8B=A0=20rhymix=5Fale?= =?UTF-8?q?rt=EB=A7=8C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 일관성 유지 --- classes/module/ModuleHandler.class.php | 43 ++++++++++++++++---------- common/js/xml_handler.js | 14 ++++++--- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 32cdbfad3..2c0ccc5b8 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -742,6 +742,7 @@ class ModuleHandler extends Handler //for xml response $oModule->setError(-1); $oModule->setMessage($errorMsg); + $oModule->setRedirectUrl($returnUrl); //for html redirect $this->error = $errorMsg; $_SESSION['XE_VALIDATOR_ERROR'] = -1; @@ -807,13 +808,12 @@ class ModuleHandler extends Handler $procResult = $oModule->proc(); $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); - if(!$oModule->stop_proc && (!isset($methodList[Context::getRequestMethod()]) || isset($_POST['_rx_ajax_form']))) + if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]) && !isset($_POST['_rx_ajax_form'])) { $error = $oModule->getError(); $message = $oModule->getMessage(); $messageType = $oModule->getMessageType(); $redirectUrl = $oModule->getRedirectUrl(); - if(!$procResult) { $this->error = $message; @@ -823,7 +823,6 @@ class ModuleHandler extends Handler } self::_setInputValueToSession(); } - if($error != 0) { $_SESSION['XE_VALIDATOR_ERROR'] = $error; @@ -837,9 +836,14 @@ class ModuleHandler extends Handler $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; } - if(Context::get('xeVirtualRequestMethod') != 'xml' && $redirectUrl) + if(Context::get('xeVirtualRequestMethod') === 'xml') + { + $oModule->setRedirectUrl(null); + } + elseif($redirectUrl) { $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; + $oModule->setRedirectUrl($redirectUrl); } } @@ -943,37 +947,44 @@ class ModuleHandler extends Handler // Handle iframe form submissions. if(isset($_POST['_rx_target_iframe']) && starts_with('_rx_temp_', $_POST['_rx_target_iframe'])) { - if($this->error && $this->error !== 'success') + $script = ''; + if(!$oModule->toBool()) { - ob_end_clean(); - echo sprintf('', json_encode($this->error), json_encode($_POST['_rx_target_iframe'])); - return; + $script .= sprintf('window.parent.alert(%s);', json_encode($oModule->getMessage())); } - if($_SESSION['XE_VALIDATOR_RETURN_URL']) + else { - ob_end_clean(); - echo sprintf('', json_encode($_SESSION['XE_VALIDATOR_RETURN_URL'])); - return; + if($oModule->getMessage() && $oModule->getMessage() !== 'success') + { + $script .= sprintf('window.parent.rhymix_alert(%s, %s);', json_encode($oModule->getMessage()), json_encode($oModule->getRedirectUrl())); + } + if($oModule->getRedirectUrl()) + { + $script .= sprintf('window.parent.redirect(%s);', json_encode($oModule->getRedirectUrl())); + } } + ob_end_clean(); + echo sprintf('', $script, json_encode($_POST['_rx_target_iframe'])); + return; } // Handle redirects. - if($_SESSION['XE_VALIDATOR_RETURN_URL']) + if($oModule->getRedirectUrl()) { if ($_SESSION['is_new_session']) { ob_end_clean(); - echo sprintf('', escape($_SESSION['XE_VALIDATOR_RETURN_URL'])); + echo sprintf('', escape($oModule->getRedirectUrl())); return; } else { ob_end_clean(); - header('location: ' . $_SESSION['XE_VALIDATOR_RETURN_URL']); + header('location: ' . $oModule->getRedirectUrl()); return; } } - + // If error occurred, handle it if($this->error) { diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index 3e3a08f3f..5515d92a3 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -377,10 +377,9 @@ callback_success = window[callback_success]; } else { callback_success = function(data) { - if (data.message === 'success') { - return; + if (data.message && data.message !== 'success') { + rhymix_alert(data.message, data.redirect_url); } - rhymix_alert(data.message, data.redirect_url); if (data.redirect_url) { redirect(data.redirect_url); } @@ -392,6 +391,13 @@ } else { callback_error = null; } + // Set _rx_ajax_form flag + if (!form.find('input[name=_rx_ajax_form]').size()) { + form.append(''); + setTimeout(function() { + form.find('input[name=_rx_ajax_form]').remove(); + }, 1000); + } // If the form has file uploads, use a hidden iframe to submit. Otherwise use exec_json. var has_files = form.find('input[type=file][name!=Filedata]').size(); if (has_files) { @@ -410,7 +416,7 @@ }, 1000); form.submit(); } else { - window.exec_json('raw', form.serialize() + '&_rx_ajax_form=1', callback_success, callback_error); + window.exec_json('raw', form.serialize(), callback_success, callback_error); } }); From 3efc2a6b1312a6e687572d1d968c689cd62f6128 Mon Sep 17 00:00:00 2001 From: conory Date: Mon, 30 Dec 2019 11:51:16 +0900 Subject: [PATCH 10/13] =?UTF-8?q?=5Frx=5Fajax=5Fform=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=EB=A1=9C=20=ED=8F=BC=20=EC=A0=9C=EC=B6=9C=20?= =?UTF-8?q?=EC=A2=85=EB=A5=98=EB=A5=BC=20=EA=B5=AC=EB=B6=84=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/context/Context.class.php | 1 - classes/module/ModuleHandler.class.php | 4 ++-- common/js/xml_handler.js | 13 ++++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 92a5b282e..bf4142daa 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -167,7 +167,6 @@ class Context '_rx_ajax_compat' => true, '_rx_ajax_form' => true, '_rx_csrf_token' => true, - '_rx_target_iframe' => true, ); /** diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 2c0ccc5b8..45a8035fb 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -945,7 +945,7 @@ class ModuleHandler extends Handler if(!isset($methodList[Context::getRequestMethod()])) { // Handle iframe form submissions. - if(isset($_POST['_rx_target_iframe']) && starts_with('_rx_temp_', $_POST['_rx_target_iframe'])) + if(isset($_POST['_rx_ajax_form']) && starts_with('_rx_temp_iframe_', $_POST['_rx_ajax_form'])) { $script = ''; if(!$oModule->toBool()) @@ -964,7 +964,7 @@ class ModuleHandler extends Handler } } ob_end_clean(); - echo sprintf('', $script, json_encode($_POST['_rx_target_iframe'])); + echo sprintf('', $script, json_encode($_POST['_rx_ajax_form'])); return; } diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index 5515d92a3..98353cdc1 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -393,7 +393,7 @@ } // Set _rx_ajax_form flag if (!form.find('input[name=_rx_ajax_form]').size()) { - form.append(''); + form.append(''); setTimeout(function() { form.find('input[name=_rx_ajax_form]').remove(); }, 1000); @@ -401,18 +401,17 @@ // If the form has file uploads, use a hidden iframe to submit. Otherwise use exec_json. var has_files = form.find('input[type=file][name!=Filedata]').size(); if (has_files) { - var iframe_id = '_rx_temp_' + (new Date()).getTime(); + var iframe_id = '_rx_temp_iframe_' + (new Date()).getTime(); $('').appendTo($(document.body)); - form.attr('method', 'POST').attr('enctype', 'multipart/form-data'); - form.attr('target', iframe_id).find('input[name=_rx_target_iframe]').remove(); - form.append(''); + form.attr('method', 'POST').attr('enctype', 'multipart/form-data').attr('target', iframe_id); + form.find('input[name=_rx_ajax_form]').val(iframe_id); window.remove_iframe = function(iframe_id) { - if (iframe_id.match(/^_rx_temp_[0-9]+$/)) { + if (iframe_id.match(/^_rx_temp_iframe_[0-9]+$/)) { $('iframe#' + iframe_id).remove(); } }; setTimeout(function() { - form.removeAttr('target').find('input[name=_rx_target_iframe]').remove(); + form.removeAttr('target'); }, 1000); form.submit(); } else { From ffe891fdaeb94e157835f3b189986ced180414af Mon Sep 17 00:00:00 2001 From: conory Date: Sun, 12 Jan 2020 00:37:11 +0900 Subject: [PATCH 11/13] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EB=AF=B8?= =?UTF-8?q?=EB=A6=AC=EB=B3=B4=EA=B8=B0=EC=8B=9C=20csrf=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/js/common.js | 1 + modules/document/document.view.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/js/common.js b/common/js/common.js index b7cbdf891..e184ba421 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -745,6 +745,7 @@ function doDocumentPreview(obj) { if(!dummy_obj.length) { jQuery( '
'+ + ''+ ''+ ''+ ''+ diff --git a/modules/document/document.view.php b/modules/document/document.view.php index 288ed5965..202dd92b0 100644 --- a/modules/document/document.view.php +++ b/modules/document/document.view.php @@ -73,7 +73,7 @@ class documentView extends document $obj->content = $content; $obj->module_srl = getModel('module')->getModuleInfoByMid(Context::get('mid'))->module_srl; $content = getModel('editor')->converter($obj, 'document'); - + $content = sprintf('
%s
', Context::get('logged_info')->member_srl, $content); Context::set('content', $content); $this->setTemplatePath($this->module_path.'tpl'); From 68647466823836884b2066834c65d6c7b410ba12 Mon Sep 17 00:00:00 2001 From: conory Date: Sun, 12 Jan 2020 01:30:49 +0900 Subject: [PATCH 12/13] =?UTF-8?q?=EA=B0=99=EC=9D=80=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20URL=EC=9D=80=20=EC=83=88=EC=B0=BD=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=EB=9D=84=EC=9A=B0=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/autolink/autolink.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/autolink/autolink.js b/addons/autolink/autolink.js index ffa687b60..a9034c62e 100644 --- a/addons/autolink/autolink.js +++ b/addons/autolink/autolink.js @@ -40,6 +40,7 @@ content = content.replace(url_regex, function(match, p1, offset, string) { var match; var suffix = ''; + var attribute = ''; if (p1.indexOf('(') < 0 && p1.match(/\)$/)) { p1 = p1.replace(/\)$/, ''); suffix = ')'; @@ -53,7 +54,10 @@ p1 = match[1]; suffix = match[2]; } - return '' + p1 + '' + suffix; + if(!isSameOrigin(location.href, p1)) { + attribute = ' target="_blank"'; + } + return '' + p1 + '' + suffix; }); $(textNode).before(dummy); @@ -96,10 +100,10 @@ $(document).on('click', '.xe_content a', function() { var $this = $(this); var href = $this.attr('href'); - if(!href || /^(?:javascript|mailto):/.test(href)) { + if(!href || /^(?:javascript|mailto):|#/.test(href)) { return; } - if (!$this.attr("target")) { + if (!$this.attr("target") && !isSameOrigin(location.href, href)) { $this.attr("target", "_blank"); } }); From 56aca19fd2082a46beb2421e5ca20773643fe85f Mon Sep 17 00:00:00 2001 From: conory Date: Thu, 16 Jan 2020 21:43:08 +0900 Subject: [PATCH 13/13] =?UTF-8?q?php7.4=EC=97=90=EC=84=9C=20=EC=97=90?= =?UTF-8?q?=EB=94=94=ED=84=B0=20=EC=84=A4=EC=A0=95=EC=9D=84=20=EB=B6=88?= =?UTF-8?q?=EB=9F=AC=EC=98=A4=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=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 getModulePartConfig()는 호환(배열로 접근할 있도록)을 위해 ArrayObject::ARRAY_AS_PROPS 플래그가 설정된 ArrayObject를 반환하고 있는 데 php7.4의 get_object_vars() 함수는 이런 경우를 처리하지 못하는 것으로 확인됨 (빈 배열만 반환) 이 문제에 대해 php측에 제보했으나, 버그가 아니라는 답변을 받은 상태. https://bugs.php.net/bug.php?id=79101 --- modules/editor/editor.model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 37dbeea94..461761683 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -276,7 +276,7 @@ class editorModel extends editor // Convert configuration keys according to type (document or comment). if($type == 'document') { - foreach (get_object_vars($editor_config) as $key => $val) + foreach ((array)$editor_config as $key => $val) { $option->$key = $val; } @@ -290,7 +290,7 @@ class editorModel extends editor } else { - foreach (get_object_vars($editor_config) as $key => $val) + foreach ((array)$editor_config as $key => $val) { $option->$key = $val; }