public function __construct($options) { $path = FileManagerUtility::getPath(); $this->options = array_merge(array('directory' => '../Demos/Files', 'baseURL' => '', 'assetBasePath' => '../Assets', 'id3Path' => $path . '/Assets/getid3/getid3.php', 'mimeTypesPath' => $path . '/MimeTypes.ini', 'dateFormat' => 'j M Y - H:i', 'maxUploadSize' => 1024 * 1024 * 3, 'upload' => false, 'destroy' => false, 'safe' => true, 'filter' => null, 'suggestedMaxImageDimension' => array('width' => 800, 'height' => 600)), $options); $this->basedir = realpath($this->options['directory']); $this->basename = pathinfo($this->basedir, PATHINFO_BASENAME) . '/'; $this->path = realpath($this->options['directory'] . '/../'); $this->length = strlen($this->path); header('Expires: Fri, 01 Jan 1990 00:00:00 GMT'); header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); $this->get = $_GET; $this->post = $_POST; }
public function __construct($options) { $path = FileManagerUtility::getPath(); $this->options = array_merge(array('directory' => 'Files/', 'assetBasePath' => '../', 'thumbnailPath' => $path . '/../Thumbs/', 'mimeTypesPath' => $path . '/MimeTypes.ini', 'dateFormat' => 'j M Y - H:i', 'maxUploadSize' => 2600 * 2600 * 3, 'maxImageSize' => 1024, 'upload' => true, 'destroy' => true, 'safe' => true, 'chmod' => 0777), $options); $this->options['thumbnailPath'] = FileManagerUtility::getRealPath($this->options['thumbnailPath']); $this->options['assetBasePath'] = FileManagerUtility::getRealPath($this->options['assetBasePath']); $this->basedir = $_SERVER['DOCUMENT_ROOT'] . FileManagerUtility::getRealPath($this->options['directory']); $this->basename = pathinfo($this->basedir, PATHINFO_BASENAME) . '/'; $this->length = strlen($this->basedir); $this->listType = isset($_POST['type']) && $_POST['type'] == 'list' ? 'list' : 'thumb'; $this->filter = isset($_POST['filter']) && !empty($_POST['filter']) ? $_POST['filter'] . '/' : ''; if (!is_dir($this->options['thumbnailPath'])) { @mkdir($path, $this->options['chmod'], true); } // create thumb folder if not existing header('Expires: Fri, 01 Jan 1990 00:00:00 GMT'); header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); $this->get = $_GET; $this->post = $_POST; }
protected function getAllowedMimeTypes() { $filter = $this->options['filter']; if (!$filter) { return null; } if (!FileManagerUtility::endsWith($filter, '/')) { return array($filter); } static $mimes; if (!$mimes) { $mimes = parse_ini_file(FileManagerUtility::getPath() . '/MimeTypes.ini'); } foreach ($mimes as $mime) { if (FileManagerUtility::startsWith($mime, $filter)) { $mimeTypes[] = strtolower($mime); } } return $mimeTypes; }