JPath/check
From Joomla! Documentation
< API15:JPathRevision as of 17:21, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Checks for snooping outside of the file system root
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<n...)
Revision as of 17:21, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Checks for snooping outside of the file system root
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<n...)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Checks for snooping outside of the file system root
Template:Description:JPath/check
Syntax[edit]
check($path)
Parameter Name | Default Value | Description |
---|---|---|
$path | $path A file system path to check |
Returns[edit]
string A cleaned version of the path
Defined in[edit]
libraries/joomla/filesystem/path.php
Importing[edit]
jimport( 'joomla.filesystem.path' );
Source Body[edit]
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] Template:SeeAlso:JPath/check
Examples[edit]
<CodeExamplesForm />