mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 09:32:15 +09:00
issue 2234 if access http protocol instead of https protocol,
redirect to https (only https setting action and https option on) git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11054 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e5a329901f
commit
c059da3138
2 changed files with 41 additions and 4 deletions
|
|
@ -41,6 +41,11 @@ class Context {
|
||||||
* @var object
|
* @var object
|
||||||
*/
|
*/
|
||||||
var $ftp_info = NULL;
|
var $ftp_info = NULL;
|
||||||
|
/**
|
||||||
|
* ssl action cache file
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
var $sslActionCacheFile = './files/cache/sslCacheFile.php';
|
||||||
/**
|
/**
|
||||||
* List of actions to be sent via ssl (it is used by javascript xml handler for ajax)
|
* List of actions to be sent via ssl (it is used by javascript xml handler for ajax)
|
||||||
* @var array
|
* @var array
|
||||||
|
|
@ -118,6 +123,17 @@ class Context {
|
||||||
static $theInstance = null;
|
static $theInstance = null;
|
||||||
if(!$theInstance) $theInstance = new Context();
|
if(!$theInstance) $theInstance = new Context();
|
||||||
|
|
||||||
|
// include ssl action cache file
|
||||||
|
$theInstance->sslActionCacheFile = FileHandler::getRealPath($theInstance->sslActionCacheFile);
|
||||||
|
if(is_readable($theInstance->sslActionCacheFile))
|
||||||
|
{
|
||||||
|
require_once($theInstance->sslActionCacheFile);
|
||||||
|
if(isset($sslActions))
|
||||||
|
{
|
||||||
|
$theInstance->ssl_actions = $sslActions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $theInstance;
|
return $theInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1263,16 +1279,28 @@ class Context {
|
||||||
return new stdClass;
|
return new stdClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register if actions is to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
|
* Register if actions is to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
|
||||||
*
|
*
|
||||||
* @param string $action act name
|
* @param string $action act name
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function addSSLAction($action) {
|
function addSSLAction($action)
|
||||||
|
{
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||||
if(in_array($action, $self->ssl_actions)) return;
|
|
||||||
$self->ssl_actions[] = $action;
|
if(!is_readable($self->sslActionCacheFile))
|
||||||
|
{
|
||||||
|
$buff = '<?php if(!defined("__XE__"))exit;';
|
||||||
|
FileHandler::writeFile($self->sslActionCacheFile, $buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($self->ssl_actions[$action]))
|
||||||
|
{
|
||||||
|
$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
|
||||||
|
FileHandler::writeFile($self->sslActionCacheFile, $sslActionCacheString, 'a');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1293,7 +1321,7 @@ class Context {
|
||||||
*/
|
*/
|
||||||
function isExistsSSLAction($action) {
|
function isExistsSSLAction($action) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||||
return in_array($action, $self->ssl_actions);
|
return isset($self->ssl_actions[$action]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,15 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($this->act) && substr($this->act, 0, 4) == 'disp')
|
||||||
|
{
|
||||||
|
if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
|
||||||
|
{
|
||||||
|
header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// execute addon (before module initialization)
|
// execute addon (before module initialization)
|
||||||
$called_position = 'before_module_init';
|
$called_position = 'before_module_init';
|
||||||
$oAddonController = &getController('addon');
|
$oAddonController = &getController('addon');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue