Example #1
0
                    header('Content-Type: application/octet-stream');
                    header('Content-Type: application/download');
                    header('Content-Transfer-Encoding: binary');
            }
            header("Content-Type: {$content_type}");
            header("Content-Disposition: {$content_disposition}; filename={$name}.{$ext}");
            header('Content-Length: ' . filesize("{$ROOT}/{$path}"));
            @readfile("{$ROOT}/{$path}");
        }
    } else {
        if (isset($_GET['action']) && $_GET['action'] != "") {
            // Action with no params
            $action = $_GET['action'];
            switch ($action) {
                case 'list':
                    $args['filelist'] = File::ListAll();
                    include "views/{$action}.view.php";
                    break;
                case 'show':
                    Error::generate('notice', 'Invalid file ID', Error::$FLAGS['single']);
                    header("Location: {$PAGE_REL_URL}");
                    break;
                default:
                    Error::generate('suspicious', "Invalid action {$action} in /file/");
                    header("Location: {$PAGE_REL_URL}");
            }
        } else {
            include "views/index.view.php";
        }
    }
}
Example #2
0
 public static function GetAvatar($id)
 {
     $defaultAvatar = "/images/navigation/bulbasaur.png";
     $avatar = File::ListAll($id, 2);
     if ($avatar) {
         return '/file/get?id=' . $avatar[0]['id'];
     } else {
         return $defaultAvatar;
     }
 }