mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Merge branch 'develop' of github.com:rhymix/rhymix into pr/notify-block
This commit is contained in:
commit
42271b2e3b
12 changed files with 137 additions and 39 deletions
|
|
@ -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 '<a href="' + p1 + '" target="_blank">' + p1 + '</a>' + suffix;
|
||||
if(!isSameOrigin(location.href, p1)) {
|
||||
attribute = ' target="_blank"';
|
||||
}
|
||||
return '<a href="' + p1 + '"' + attribute + '>' + p1 + '</a>' + 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");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ class Context
|
|||
*/
|
||||
private static $_reserved_keys = array(
|
||||
'_rx_ajax_compat' => true,
|
||||
'_rx_ajax_form' => true,
|
||||
'_rx_csrf_token' => true,
|
||||
'_rx_target_iframe' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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()]))
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -941,39 +945,46 @@ 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']))
|
||||
{
|
||||
if($this->error && $this->error !== 'success')
|
||||
$script = '';
|
||||
if(!$oModule->toBool())
|
||||
{
|
||||
ob_end_clean();
|
||||
echo sprintf('<html><head></head><body><script> window.parent.alert(%s); window.parent.remove_iframe(%s); </script></body></html>', 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('<html><head></head><body><script> window.parent.redirect(%s); </script></body></html>', 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('<html><head></head><body><script>%s window.parent.remove_iframe(%s);</script></body></html>', $script, json_encode($_POST['_rx_ajax_form']));
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle redirects.
|
||||
if($_SESSION['XE_VALIDATOR_RETURN_URL'])
|
||||
if($oModule->getRedirectUrl())
|
||||
{
|
||||
if ($_SESSION['is_new_session'])
|
||||
{
|
||||
ob_end_clean();
|
||||
echo sprintf('<html><head><meta charset="UTF-8" /><meta http-equiv="refresh" content="0; url=%s" /></head><body></body></html>', escape($_SESSION['XE_VALIDATOR_RETURN_URL']));
|
||||
echo sprintf('<html><head><meta charset="UTF-8" /><meta http-equiv="refresh" content="0; url=%s" /></head><body></body></html>', 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -157,6 +157,26 @@ 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%;
|
||||
min-width: 250px;
|
||||
max-width: 500px;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
opacity: 0.6;
|
||||
padding: 12px 20px;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 10px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 999999999;
|
||||
}
|
||||
|
||||
/* Debug */
|
||||
#rhymix_debug_button {
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,44 @@
|
|||
}
|
||||
};
|
||||
|
||||
window.rhymix_alert_close = function() {
|
||||
if($('#rhymix_alert').is(':hidden')) {
|
||||
return;
|
||||
}
|
||||
$('#rhymix_alert').fadeOut(500, function() {
|
||||
$(this).empty();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief display alert
|
||||
*/
|
||||
window.rhymix_alert = function(message, redirect_url, delay) {
|
||||
if(!delay) {
|
||||
delay = 2500;
|
||||
}
|
||||
if(!redirect_url) {
|
||||
$('#rhymix_alert').text(message).show();
|
||||
setTimeout(rhymix_alert_close, 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: '' });
|
||||
}
|
||||
$('#rhymix_alert').click(rhymix_alert_close);
|
||||
});
|
||||
|
||||
/* Array for pending debug data */
|
||||
window.rhymix_debug_pending_data = [];
|
||||
|
||||
|
|
@ -531,10 +569,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 +577,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 가 아니면 새창으로 띄움)
|
||||
**/
|
||||
|
|
@ -703,6 +745,7 @@ function doDocumentPreview(obj) {
|
|||
if(!dummy_obj.length) {
|
||||
jQuery(
|
||||
'<form id="previewDocument" target="previewDocument" method="post" action="'+request_uri+'">'+
|
||||
'<input type="hidden" name="_rx_csrf_token" value="' + getCSRFToken() + '" />'+
|
||||
'<input type="hidden" name="module" value="document" />'+
|
||||
'<input type="hidden" name="act" value="dispDocumentPreview" />'+
|
||||
'<input type="hidden" name="mid" value="' + current_mid +'" />'+
|
||||
|
|
|
|||
|
|
@ -376,7 +376,14 @@
|
|||
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 && data.message !== 'success') {
|
||||
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])) {
|
||||
|
|
@ -384,21 +391,27 @@
|
|||
} else {
|
||||
callback_error = null;
|
||||
}
|
||||
// Set _rx_ajax_form flag
|
||||
if (!form.find('input[name=_rx_ajax_form]').size()) {
|
||||
form.append('<input type="hidden" name="_rx_ajax_form" value="json" />');
|
||||
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) {
|
||||
var iframe_id = '_rx_temp_' + (new Date()).getTime();
|
||||
var iframe_id = '_rx_temp_iframe_' + (new Date()).getTime();
|
||||
$('<iframe id="' + iframe_id + '" name="' + iframe_id + '" style="display:none"></iframe>').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('<input type="hidden" name="_rx_target_iframe" value="' + iframe_id + '" />');
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
|
||||
<!-- ETC -->
|
||||
<div id="rhymix_waiting" class="wfsr" cond="!$m">{$lang->msg_call_server}</div>
|
||||
<div id="rhymix_alert"></div>
|
||||
<div id="rhymix_debug_panel"></div>
|
||||
<div id="rhymix_debug_button"></div>
|
||||
|
||||
|
|
|
|||
|
|
@ -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('<div class="document_0_%d xe_content">%s</div>', Context::get('logged_info')->member_srl, $content);
|
||||
Context::set('content', $content);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue