aboutsummaryrefslogtreecommitdiffstats
path: root/download.php
blob: 530b52d4e873943a1090f27591b56efc79bf8911 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php session_start(); ?>
<!DOCTYPE html>
<html lang=en>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css">
    <link rel="icon" href="img/site-icon.webp" type="image/x-icon">
    <link rel="stylesheet" href="https://cdn.rawgit.com/xcatliu/simplemde-theme-dark/master/dist/simplemde-theme-dark.min.css
         ">
    <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
    <title>procrastiSlides: great for procratinators who need to get a presentation out, quick! 😆</title>
    <meta name="description" content="create presentations from markdown or plain text! 🤗 procrastiSlides is a simple presentation(s) site that respects your dark mode setting and has responsive web design.
         non-intruisive ads, no tracking, nothing but quick slides from plain text/markdown. 🏫 try copy and pasting your school notes! that might even work 😂">
</head>

<body>
    <div class=banner>
        <h1>📑 procrastiSlides v0.02 🎬</h1>
        <hr />
    </div>
    <p class="centered">this website is inspired from the suckless's presentation tool (<a target="_blank" href="https://tools.suckless.org/sent">sent</a>). it uses pandoc and LaTeX beamer for the backend. <br><br><b>latest feature update:</b> addition of 16:9 themes</p>
    <hr>

    <?php include "includes/nav-header.php"; ?>
    <br>

    <h3 class="centered">🎉 your procrastiSlides .pdf presentation has been generated successfully!!! 🍾
    </h3>

    <h3 class="centered">📂 your download link is below: 🗃
    </h3>
    <div class="centered">
        <?php

        function generatePresentation($templateFile)
        {
            $_SESSION["pres"] = uniqid("pres", true) . ".md";
            $_SESSION["push"] = uniqid("push", true) . ".md";
            $_SESSION["convert"] = uniqid("convert", true) . ".md";
            $_SESSION["filename"] = uniqid("procrastiSlides_", true) . ".pdf";

            $pres = $_SESSION["pres"]; // filename of the template file with metadata
            $push = $_SESSION["push"]; // filename of where the user data is stored
            $convert = $_SESSION["convert"]; // concatenated file to be converted to .pdf
            $filename = $_SESSION["filename"]; // output file name

            $userMarkdown = $_SESSION["user-input"];
            $conversion = "pandoc -f markdown+hard_line_breaks output/'$convert' -t beamer -o output/'$filename' --pdf-engine=xelatex";

            shell_exec("echo '$userMarkdown' > output/'$push'");
            shell_exec("cat $templateFile output/'$push' > output/'$convert'");
            shell_exec($conversion);

            echo "<h2><a href=\"output/$filename\">download presentation</a></h2>";
        }

        if (isset($_POST["90sMakeUpCommercial"])) {
            generatePresentation("output/90sMakeUpCommercial.md");
        } elseif (isset($_POST["chicagoOlives"])) {
            generatePresentation("output/chicagoOlives.md");
        } elseif (isset($_POST["cleanMetropolis"])) {
            generatePresentation("output/cleanMetropolis.md");
        } elseif (isset($_POST["ohioCustard"])) {
            generatePresentation("output/ohioCustard.md");
        } elseif (isset($_POST["raleighAroundMe"])) {
            generatePresentation("output/raleighAroundMe.md");
        } elseif (isset($_POST["earlyCupertino"])) {
            generatePresentation("output/earlyCupertino.md");
        } elseif (isset($_POST["defaultIsKing"])) {
            generatePresentation("output/defaultIsKing.md");
        } elseif (isset($_POST["strengthInNumbers"])) {
            generatePresentation("output/strengthInNumbers.md");
        } elseif (isset($_POST["thatMagazine"])) {
            generatePresentation("output/thatMagazine.md");
        } elseif (isset($_POST["cuppertinoIsh"])) {
            generatePresentation("output/cuppertinoIsh.md");
        } elseif (isset($_POST["lazyProfessor"])) {
            generatePresentation("output/lazyProfessor.md");
        } elseif (isset($_POST["redmond2003"])) {
            generatePresentation("output/redmond2003.md");
        }

        ?>
    </div>
    <br><br>
    <footer>
        <?php include "includes/nav-footer.php"; ?>
    </footer>
</body>

</html>