__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2023 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\Path;
use Joomla\Filesystem\Exception\FilesystemException;
//no direct access
defined('_JEXEC') or die('Restricted access');
class BuilderMediaHelper
{
public static function isValidImagesPath(string $path): bool
{
$mediaParams = ComponentHelper::getParams('com_media');
$filePath = Path::clean($mediaParams->get('file_path', 'images'));
$fullFilePath = Path::clean(JPATH_ROOT . '/' . $filePath);
return strpos($path, $fullFilePath) === 0;
}
public static function checkForMediaActionBoundary(string $path)
{
try
{
$cleanedPath = Path::check($path);
}
catch (\Exception $e)
{
throw new FilesystemException($e->getMessage());
}
// TODO: Need to check this later
// if (!self::isValidImagesPath($cleanedPath))
// {
// throw new FilesystemException('Invalid path for performing this action.');
// }
return $cleanedPath;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| language.php | File | 23.68 KB | 0664 |
|
| media-helper.php | File | 1.13 KB | 0664 |
|
| sppagebuilder.php | File | 12.27 KB | 0664 |
|