Current Path : /var/www/html/clients/nsmk.e-nk.ru/application/maxsite/plugins/file_manager/php/ |
Current File : /var/www/html/clients/nsmk.e-nk.ru/application/maxsite/plugins/file_manager/php/file.inc.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); $GLOBALS['fm_allowed_image'] = array(); global $fm_allowed_image; $gd = gd_info(); if($gd) { // IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM. if(imageTypes() && IMG_GIF){$fm_allowed_image['gif'] = true;} if(imageTypes() && IMG_JPG){$fm_allowed_image['jpg'] = true; $fm_allowed_image['jpeg'] = true;} if(imageTypes() && IMG_PNG){$fm_allowed_image['png'] = true;} if(imageTypes() && IMG_WBMP){$fm_allowed_image['bmp'] = true;} if(imageTypes() && IMG_XPM){$fm_allowed_image['xpm'] = true;} } function prepare_task($taskname, $filename) { $ext = pathinfo($filename, PATHINFO_EXTENSION); if (!$ext) $name = $filename; else $name = str_replace(".$ext", '', $filename); switch ($taskname) { case 'image': $filename = $name . ".$ext"; break; case 'mini': $filename = 'mini/' . $name . ".$ext"; break; default: $filename = 'mini/' . $name . "%$taskname%.$ext"; } return $filename; } /* подготовка для отдачи в fm.php */ function get_info_task($taskname, $path, $filename) { global $encoding; $filename = prepare_task($taskname, $filename); if(file_exists($path . $filename)) { $p['dim'] = @getimagesize($path . $filename, &$info); if (!$p['dim']){return false;} $p['filename'] = mb_convert_encoding($filename, "UTF-8", $encoding); $p['filesize'] = filesize($path . $filename); return $p; } else return false; } function getFile($path, $file) { global $encoding; //$ext = preg_replace('/^.*\./', '', $file); $ext = pathinfo($file, PATHINFO_EXTENSION); if (!$ext) $mime=''; else $mime = get_mime_by_extension($file); //if(isset($info["APP13"])) // { // $iptc = iptcparse($info["APP13"]); // $info=$iptc; // } return array('filename' => mb_convert_encoding($file, "UTF-8", $encoding), 'ext' => $ext, 'filesize' => filesize($path . $file), 'mime' => $mime, 'lastmodif' => date("d.m.Y H:i:s", filemtime($path . $file)), 'desc' => ''); }