Esempio n. 1
0
$login_name = isset($_SERVER["PHP_AUTH_USER"]) ? $_SERVER["PHP_AUTH_USER"] : "******";
$login_pwd = isset($_SERVER["PHP_AUTH_PW"]) ? $_SERVER["PHP_AUTH_PW"] : "guest";
//login und $steam def. in "./includes/login.php"
$steam = new steam_connector($config_server_ip, $config_server_port, $login_name, $login_pwd);
if (!$steam || !$steam->get_login_status()) {
    header("Location: {$config_webserver_ip}/index.html");
    exit;
}
//if ID has been properly specified => download and output
if ($object_path !== 0 && $object_path !== "") {
    $object = steam_factory::path_to_object($steam, $object_path);
    //get object attribs
    $name["OBJ_NAME"] = $object->get_attribute(OBJ_NAME);
    $name["DOC_MIME_TYPE"] = $object->get_attribute(DOC_MIME_TYPE);
    //derive mimetype
    $mimetype = derive_mimetype($name);
    //get content
    $filecontent = $object->download();
    if (empty($filecontent)) {
        //echo "Die Datei " . $object . " kann nicht angezeigt werden";
        header("WWW-Authenticate: Basic realm=\"Test Authentication System\"");
        header("HTTP/1.0 401 Unauthorized");
        exit;
    }
    $length = strlen($filecontent);
    header('Cache-Control: private');
    header('Cache-Control: must-revalidate');
    //header("Accept-Ranges: bytes");
    header("Content-Type: " . $mimetype);
    header("Content-Length: " . $length);
    header("Pragma: public");
Esempio n. 2
0
     $error[] = "error_not_logged_in";
 } else {
     //actions
     switch ($action) {
         case "folder":
             if (trim($_POST["title"]) != "") {
                 $result = steam_factory::create_room($steam, $title, $current_room, $desc);
                 $result->set_attribute("bid:collectiontype", $_POST["collectiontype"]);
             } else {
                 $error[] = "error_title";
             }
             break;
         case "file":
             if (isset($_FILES["file"]) && $_FILES["file"]["name"] != "") {
                 $filecontent = file_get_contents($_FILES["file"]["tmp_name"]);
                 $mimetype = derive_mimetype($_FILES["file"]["name"]);
                 $inventory = $current_room->get_inventory();
                 for ($i = 0; $i < count($inventory); $i++) {
                     if (rawurlencode($_FILES["file"]["name"]) == $inventory[$i]->get_name()) {
                         $result = $inventory[$i];
                         $result->set_content($filecontent);
                         $result->set_attribute("DOC_MIME_TYPE", $mimetype);
                         break;
                     }
                 }
                 //create document
                 if (!$result) {
                     $result = steam_factory::create_document($steam, rawurlencode($_FILES["file"]["name"]), $filecontent, $mimetype, $current_room);
                 }
                 if (trim($_POST["title"]) != "") {
                     $result->set_attribute("OBJ_DESC", $desc);
Esempio n. 3
0
File: get.php Progetto: rolwi/koala
         }
         $tnr_imagecontent = $object->get_thumbnail_data($width, $height, 0, TRUE);
         $result = $steam->buffer_flush();
         $data["mimetype"] = $result[$tnr_imagecontent]["mimetype"];
         $data["lastmodified"] = $result[$tnr_imagecontent]["timestamp"];
         $data["name"] = $result[$tnr_imagecontent]["name"];
         $data["content"] = $result[$tnr_imagecontent]["content"];
         $data["contentsize"] = $result[$tnr_imagecontent]["contentsize"];
         // For debug issues:
         //error_log("get.php: thumbnail name=" . $data["name"] . " width=". $width . " height=" . $height);
     }
 } else {
     //get object attribs
     $data["name"] = $object->get_attribute(OBJ_NAME);
     //derive mimetype
     $data["mimetype"] = derive_mimetype($data["name"]);
     //get content
     try {
         $filecontent = $object->download();
     } catch (steam_exception $se) {
         echo "Es ist ein Fehler aufgetreten.";
         security_log("get.php Fehler aufgetreten: " . $se);
         exit;
     }
     if (empty($filecontent)) {
         //echo "Die Datei " . $object . " kann nicht angezeigt werden";
         header("WWW-Authenticate: Basic realm=\"Test Authentication System\"");
         header("HTTP/1.0 401 Unauthorized");
         exit;
     }
     $data["content"] = $filecontent;