function listFile($path) { global $config; $filetype = getFileType($path); if ($filetype == 'text') { $text = file_get_contents($config['files'] . $path); } else { if ($filetype == 'opendocument.text') { require "ophir.php"; $OPHIR_CONF["header"] = 1; $OPHIR_CONF["quote"] = 1; $OPHIR_CONF["list"] = 1; $OPHIR_CONF["table"] = 1; $OPHIR_CONF["footnote"] = 1; $OPHIR_CONF["link"] = 1; $OPHIR_CONF["image"] = 1; $OPHIR_CONF["note"] = 1; $OPHIR_CONF["annotation"] = 1; $text = odt2html($config['files'] . $path); } else { $text = ''; } } return array('type' => 'file', 'filetype' => $filetype, 'mimetype' => system_extension_mime_type($path), 'name' => basename($path), 'path' => $path, 'text' => $text); }
} return isset($exts[$type]) ? $exts[$type] : null; } require_once 'config/settings.php'; if (!Session::getInstance()->getAuthenticationManager()->isAuthenticated()) { header('Location: /'); exit; } $pfile = Request::getSafeGetOrPost('f'); $fileName = StaticConfig::getStreamedContentLocalFolder() . $pfile; if (!file_exists($fileName)) { header('Location: /'); exit; } $fileparts = explode('/', $file); // check no .. in file name header("Content-Type: " . system_extension_mime_type($fileName)); header("Content-Length: " . filesize($fileName)); header("Pragma: no-cache"); header("Expires: 0"); $fp = fopen($fileName, "rb"); //start buffered download while (!feof($fp)) { //reset time limit for big files set_time_limit(0); print fread($fp, 1024 * 8); flush(); ob_flush(); } fclose($fp); exit;