2012-06-19 Sergio Martin <sergio.martin@artica.es>

* include/functions.php: Fixed check referer bug with 
	https when is not forced. Bug #3525494
	Merged from 4.0.2



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6592 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-06-19 11:07:38 +00:00
parent 33d048263e
commit 174f3b0c96
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2012-06-19 Sergio Martin <sergio.martin@artica.es>
* include/functions.php: Fixed check referer bug with
https when is not forced. Bug #3525494
Merged from 4.0.2
2012-06-19 Sergio Martin <sergio.martin@artica.es>
* include/functions_incidents.php: Changed a parameter

View File

@ -37,18 +37,17 @@ function check_refererer() {
// This is done due to problems with HTTP_REFERER var when metarefresh is performed
if ($config["refr"] > 0)
return true;
$url = 'http://';
if ($config['https']) {
$url = 'https://';
}
//Check if the referer have a port (for example when apache run in other port to 80)
if (preg_match('/http(s?):\/\/.*:[0-9]*/', $referer) == 1) {
$url .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $config["homeurl"];
$url = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $config["homeurl"];
}
else {
$url .= $_SERVER['SERVER_NAME'] . $config["homeurl"];
$url = $_SERVER['SERVER_NAME'] . $config["homeurl"];
}
// Remove protocol from referer
$referer = preg_replace('/http(s?):\/\//','',$referer);
if (strpos($referer, $url) === 0) {
return true;