API16: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
Syntax
static 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
public static 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(); } }
[Edit See Also] SeeAlso:JPath/check
Examples
<CodeExamplesForm />
