Actions

API16

JPath/check

< API16:JPath

The "API16" 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

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



Examples

Code Examples


Advertisement