Actions

API15

JPath/check

From Joomla! Documentation

< API15:JPath
Revision as of 17:21, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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

[Edit Descripton]

Description:JPath/check

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();
        }
}

[Edit See Also] SeeAlso:JPath/check

Examples

<CodeExamplesForm />