<?php /** * This file contains all the requires that loads all the library classes. You can require * this class and forget all other require and dependency stuff. * */ namespace Mbcraft\Piol; require_once "PiolObject.php"; require_once "FileSystemUtils.php"; FileSystemUtils::checkPiolRootPath(); require_once "IOException.php"; require_once "__FileSystemElement.php"; require_once "Utils/IniPropertiesUtils.php"; require_once "Utils/JavaXmlPropertiesUtils.php"; require_once "FileReader.php"; require_once "FileWriter.php"; require_once "File.php"; require_once "Dir.php"; require_once "Storage.php"; require_once "StorageDrivers/DataStorage.php"; require_once "StorageDrivers/PropertiesStorage.php"; require_once "StorageDrivers/XMLStorage.php"; require_once "Upload.php"; require_once "UploadUtils.php"; require_once "Cache/ICache.php"; require_once "Cache/FlatDirCache.php"; if (defined("ZipArchive")) { require_once "ZipUtils.php"; }
/** * * Construct a new __FileSystemElement. This element has all the path management and is * always relative to the FileSystemUtils::getPiolRootPath(). * @param string $path The string path. * @throws \Mbcraft\Piol\IOException If something goes wrong. * * @internal */ protected function __construct($path) { FileSystemUtils::checkPiolRootPath(); $path = FileSystemUtils::getCleanedPath($path); if (strpos($path, FileSystemUtils::getPiolRootPath()) === 0) { throw new IOException("Errore : path contenente la root del sito."); } //rimuovo doppi slash e '..' $fp = FileSystemUtils::getPiolRootPath() . $path; //DISABILITATO, IL LINK DEL FRAMEWORK CREA GROSSI PROBLEMI //non posso determinare il path se esco dal FileSystemUtils::getPiolRootPath() (è ovvio) //la chiamata a realpath potrebbe far cambiare sia la seconda parte dell'url che la prima parte //IN QUESTO MODO CREO UNA JAIL ALL'INTERNO DEL SITO. /* if (file_exists($fp)) { $fp = realpath ($fp); if (strpos($path,FileSystemUtils::getPiolRootPath())!==0) $fp = FileSystemUtils::getPiolRootPath(); } */ $this->__full_path = $fp; $this->__full_path = str_replace(DIRECTORY_SEPARATOR, DS, $this->__full_path); $this->__path = substr($fp, strlen(FileSystemUtils::getPiolRootPath()), strlen($fp) - strlen(FileSystemUtils::getPiolRootPath())); $this->__path = str_replace(DIRECTORY_SEPARATOR, DS, $this->__path); }