mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-05 13:39:23 +01:00
improved version of in_docroot, allows for pathnames starting like the docroot
This commit is contained in:
parent
62a6e8fd34
commit
7381cb74d0
@ -102,7 +102,7 @@
|
|||||||
|
|
||||||
// test if the files-dir is inside the document-root, and refuse working if so
|
// test if the files-dir is inside the document-root, and refuse working if so
|
||||||
//
|
//
|
||||||
if (strstr($this->basedir,PHPGW_SERVER_ROOT) || strstr($this->basedir,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']))
|
if ($this->in_docroot($this->basedir))
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->phpgw_header();
|
$GLOBALS['phpgw']->common->phpgw_header();
|
||||||
if ($GLOBALS['phpgw_info']['flags']['noheader'])
|
if ($GLOBALS['phpgw_info']['flags']['noheader'])
|
||||||
@ -157,6 +157,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function in_docroot
|
||||||
|
@abstract test if $path lies within the webservers document-root
|
||||||
|
*/
|
||||||
|
function in_docroot($path)
|
||||||
|
{
|
||||||
|
$docroots = array(PHPGW_SERVER_ROOT,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']);
|
||||||
|
|
||||||
|
foreach ($docroots as $docroot)
|
||||||
|
{
|
||||||
|
$len = strlen($docroot);
|
||||||
|
|
||||||
|
if ($docroot == substr($path,0,$len))
|
||||||
|
{
|
||||||
|
$rest = substr($path,$len);
|
||||||
|
|
||||||
|
if (!strlen($rest) || $rest[0] == DIRECTORY_SEPARATOR)
|
||||||
|
{
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function set_relative
|
@function set_relative
|
||||||
@abstract Set path relativity
|
@abstract Set path relativity
|
||||||
|
Loading…
Reference in New Issue
Block a user