API15:JPath/check
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
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
<CodeExamplesForm />
