API15:JPath/check
From Joomla! Documentation
Description
Checks for snooping outside of the file system root
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
check($path)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | $path A file system path to check |
Returns
string A cleaned version of the path
Defined in
libraries/joomla/filesystem/path.php
Importing
jimport( 'joomla.filesystem.path' );
Source Body
function check($path)
{
if (strpos($path, '..') !== false) {
JError::raiseError( 20, 'JPath::check Use of relative paths not permitted'); // don't translate
jexit();
}
$path = JPath::clean($path);
if (strpos($path, JPath::clean(JPATH_ROOT)) !== 0) {
JError::raiseError( 20, 'JPath::check Snooping out of bounds @ '.$path); // don't translate
jexit();
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples