fprintf($f, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"); fprintf($f, "<title>Error</title>\n"); fprintf($f, "</head>\n"); fprintf($f, "<body>\n"); fprintf($f, "<p>\n"); fprintf($f, _("File '%s' cannot be shown.") . "<br>\n%s\n", $filename, $message); fprintf($f, "</p>\n"); fprintf($f, "</body>\n"); fprintf($f, "</html>\n"); fclose($f); } $targetFile = "file:///{$targetFile}"; } // Get information of application for uploaded file. require_once 'FileHandler.class.php'; $handler = FileHandler::getFileHandler($targetFile); // create window object and send to nuc $dt = new DateTime(); $date = $dt->format('Y-m-d H:i:s'); $window = array("id" => "", "win_id" => "", "name" => "", "state" => "", "file" => $targetFile, "handler" => $handler, "userid" => "", "date" => $date); //echo "<body onLoad=\"sendToNuc('newWindow=".serialize($window)."')\" /></body>"; $serializedWindow = serialize($window); $sw = urlencode($serializedWindow); // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => CONFIG_CONTROL_FILE . '?newWindow=' . $sw, CURLOPT_USERAGENT => 'PalMA cURL Request')); // Send the request & save response to $resp $resp = curl_exec($curl); // Close request to clear up some resources curl_close($curl);
$fhandler = '/usr/bin/dwb --override-restore'; } else { if ($ftype === 'mpg' || $ftype === 'mpeg' || $ftype === 'avi' || $ftype === 'mp3' || $ftype == "mp4") { $fhandler = '/usr/bin/vlc --no-audio'; } } } } } } } /* alternatively with mime-types // $ftype = mime_content_type($this->UPLOAD_PATH.$file); // if($ftype=='application/pdf') // if($ftype=='image/gif' || $ftype=='image/jpg' || $ftype=='image/png' ) // if($ftype=='html' || $ftype=='url' || $ftype="text/plain") // (...) */ return $fhandler; } } if ($unittest[__FILE__]) { // Run unit test. $dwbHandler = new DwbHandler(); $zathuraHandler = new ZathuraHandler(); echo "DOWNLOAD =" . FileHandler::DOWNLOAD . "\n"; echo "filehandler=" . FileHandler::getFileHandler("test.txt") . "\n"; $handler = ${'dwb' . 'Handler'}; echo "controls =" . $handler->getControls() . "\n"; }