aboutsummaryrefslogtreecommitdiffstats
path: root/download.php
blob: 5cd683b8e6884bbd4908ba30d50815fe147b0242 (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
<?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 v0.01</title>
      <meta name="description" content="Hello World! Only a simple coffee site (but respects your dark mode setting and has responsive web design). No ads, no tracking, nothing but basic coffee and good service.">
   </head>
   <body>
      <div class=banner>
         <h1>πŸ“‘ procrastiSlides v0.01 🎬</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>)
        and Luke Smith's <a target="_blank" href="https://youtu.be/dum7q6UXiCE">video</a> on creating presentations using markdown and LaTeX beamer.
      We would like to personally thank them for all the educational resources (for suckless, it's the source code πŸ˜‚) that they have shared with the open
    souce community throughout the years… <b>πŸ™Œ Thank you! πŸ€—</b> </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

        if(isset($_POST['compile']))
        {
          $_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']; // concatanated file to be converted to .pdf
          $filename = $_SESSION['filename']; // output file name


          $userMarkdown = $_POST['user-input'];
          $_SESSION['user-input'] = $_POST['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 output/pres.md output/'$push' > output/'$convert'");
          shell_exec($conversion);
          // sleep(1); ?>

          <h2><a href="output/<?php echo $_SESSION['filename']; ?>">download presentation</a></h2>

         <?php } ?>

      </div>


         <br><br>
      <footer>

        <?php include "includes/nav-footer.php" ?>

      </footer>
   </body>
</html>