Пример #1
0
 public function __construct(Stor $stor, $width = null)
 {
     $this->type = $stor->getType();
     $this->content = $stor->getContent();
     $this->filename = "var/tempthumb" . generateRandomChars(4, "0123456789");
     if (!isset($width)) {
         $this->width = self::DEFAULT_WIDTH;
     } else {
         $this->width = $width;
     }
     $this->make();
 }
Пример #2
0
    echo "<span style=\"color: red; font-weight: bold; font-size: 24pt;\">400 Bad Request</span><br />";
    echo "<br />";
    echo "Your browser sent a request that could not be understood.";
    exit;
}
if (file_exists("var/tokn/" . $_REQUEST['token'])) {
    $token = new ToknFile($_REQUEST['token']);
    if (file_exists("var/stor/" . $token->getReference())) {
        $stor = new Stor(new StorFromFile("var/stor/" . $token->getReference()));
        header("Content-Disposition: inline");
        header("Content-Type: " . $stor->getType());
        header("Content-Length: " . $stor->getSize());
        $location = 0;
        set_time_limit(0);
        while ($location <= $stor->getSize()) {
            print substr($stor->getContent(), $location, PRINT_CHUNK_SIZE);
            ob_flush();
            flush();
            $location += PRINT_CHUNK_SIZE;
        }
        exit;
    } else {
        header("HTTP/1.1 410 Gone");
        echo "<span style=\"color: red; font-weight: bold; font-size: 24pt;\">410 Gone</span><br />";
        echo "<br />";
        echo "The requested URL is no longer available on this server.";
        exit;
    }
} else {
    header("HTTP/1.1 404 Not Found");
    echo "<span style=\"color: red; font-weight: bold; font-size: 24pt;\">404 Not Found</span><br />";