Exemplo n.º 1
0
     $returnText .= $action($collection_id, $package_id);
     break;
 case 'links_editLink':
     $returnText .= links_editLink($collection_id, $package_id, $link_coll, $link_type, $link_pack, $link_part, $link_id, $loc4msg, $what);
     break;
 case 'get_file':
     $icon = DCTL_APPS_PATH . 'img' . SYS_PATH_SEP . 'missing.gif';
     $fPath = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP . $url;
     if (is_file($fPath)) {
         $mime = getMIME($fPath);
         $ext = strtolower(substr($fPath, -3, 3));
         if (isImage($mime, $ext)) {
             $icon = $fPath;
         }
     }
     $iconMime = image2MIME($icon);
     if ($iconMime == false) {
         $iconMime = "image/jpeg";
     }
     header("Content-type: {$iconMime}", true);
     readfile($icon);
     break;
 case 'load_preview':
     $fPath = preg_replace('%' . HOST_BASE_PATH . '%', FS_BASE_PATH, $url, 1);
     if (is_file($fPath)) {
         $big = $fPath;
         $med = str_ireplace(DCTL_MEDIA_BIG, DCTL_MEDIA_MED, $fPath);
         $sml = str_ireplace(DCTL_MEDIA_BIG, DCTL_MEDIA_SML, $fPath);
         if (!is_file($med) || !is_file($sml)) {
             createPreview($big);
         }
Exemplo n.º 2
0
function getMIME($file)
{
    //If mime magic is installed
    if (function_exists("mime_content_type")) {
        $mime = mime_content_type($file);
    } else {
        $mime = image2MIME($file);
        if ($mime == false) {
            $mime = "text/plain";
        }
    }
    return strtolower($mime);
}