Ejemplo n.º 1
0
if (isset($_GET["_escaped_fragment_"]) || isset($_GET["print"]) || isset($_GET["mobile"])) {
    if (isset($_GET["_escaped_fragment_"])) {
        $fragment = $_GET["_escaped_fragment_"];
    } elseif (isset($_GET["print"])) {
        $fragment = $_GET["print"];
    } elseif (isset($_GET["mobile"])) {
        $fragment = $_GET["mobile"];
    } else {
        $fragment = "";
    }
    try {
        if (preg_match('/^\\/api\\/([^-]+)/', $fragment, $m)) {
            $className = $m[1];
            $json = decode_file("output/" . $className . ".js");
            print_page($className, "<h1>" . $className . "</h1>\n" . $json["html"], $fragment);
        } elseif (preg_match('/^\\/api\\/?$/', $fragment, $m)) {
            print_index_page();
        } elseif (preg_match('/^\\/guide\\/(.+?)(-section-[0-9]+)?$/', $fragment, $m)) {
            $json = decode_file("guides/" . $m[1] . "/README.js");
            print_page($json["title"], '<div class="guide-container" style="padding: 1px">' . $json["guide"] . '</div>', $fragment);
        } elseif (preg_match('/^\\/guide\\/?$/', $fragment, $m)) {
            print_index_page();
        } else {
            print_index_page();
        }
    } catch (Exception $e) {
        print_page($e->getMessage(), $e->getMessage(), $fragment);
    }
} else {
    echo file_get_contents("template.html");
}
Ejemplo n.º 2
0
        $url = $baseReadFileURL . " type=\"{$res["type"]}\"";
        ?>
        <video style="width:100%;height:90%;" controls>
            <source src="<?php 
        echo $url;
        ?>
">
            很抱歉,您的瀏覽器暫時無法預覽影片。
        </video>
        <?php 
    } elseif ($res["type"] == "text/html") {
        header("Content-Type: text/html");
        echo decode_file($id);
    } elseif (preg_match("/text\\/(.*)/i", $res["type"])) {
        header("Content-Type: text/html; charset=utf-8");
        echo "<pre>" . htmlentities(decode_file($id)) . "</pre>";
    } else {
        $officeAppsTypes = ["application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation"];
        foreach ($officeAppsTypes as $key => $value) {
            if ($res["type"] == $value) {
                $token = base64_encode(json_encode([["id" => $id, "time" => time(), "dir" => $res["dir"]]]));
                $url = $config["url"] . "readfile.php?id=" . $id . "&pretoken=" . $token . "&password="******"en">
                    <head>
                        <meta charset="UTF-8">
                        <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
                        <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
                        <link href="css/bootstrap.min.css" rel="stylesheet">
                        <title>Preview document</title>