コード例 #1
0
ファイル: uploads.php プロジェクト: OptimalInternet/uCore
 static function GetIcon($path)
 {
     $type = utopia::GetMimeType($path);
     if (strpos($type, 'image/') !== 0) {
         return false;
     }
     $path = str_replace(PATH_UPLOADS, PATH_REL_ROOT . 'uploads', $path);
     return $path . '?w=64&h=64';
 }
コード例 #2
0
ファイル: static_ajax.php プロジェクト: OptimalInternet/uCore
 public static function getUpload()
 {
     //$module = utopia::UUIDExists($_GET['uuid']);
     //print_r($module);
     $obj = utopia::GetInstance(utopia::GetCurrentModule());
     $rec = $obj->LookupRecord($_GET['p']);
     //print_r($rec);
     if (!$rec) {
         echo '<h1>404 File Not Found</h1>';
         header('HTTP/1.1 404 File Not Found', true, 404);
         die;
         //	die('<h1>404 File Not Found</h1>');
     }
     list($path, $username, $password) = explode('¦', $rec[$_GET['f']]);
     if ($username) {
         die('auth');
     }
     $path = realpath($path);
     $fileMod = filemtime($path);
     $etag = sha1($fileMod . '-' . filesize($path));
     $cType = utopia::GetMimeType($path);
     utopia::Cache_Check($etag, $cType, basename($path), $fileMod);
     utopia::Cache_Output(file_get_contents($path), $etag, $cType, basename($path), $fileMod);
 }