Another Commit
This commit is contained in:
parent
86235fa2ae
commit
3f4485154e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
config.php
|
5
config.example.php
Normal file
5
config.example.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
define("TITLE", "Static File Generator");
|
||||
define("MD_DIR", "MarkdownFiles");
|
||||
define("DEFAULT_FILE", "out.html");
|
||||
?>
|
50
manager.php
50
manager.php
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
require_once('Parsedown.php');
|
||||
|
||||
define("TITLE", "Static File Generator");
|
||||
define("MD_DIR", "MarkdownFiles");
|
||||
if(file_exists('config.php')) {
|
||||
require_once('config.php');
|
||||
} else {
|
||||
require_once('config.example.php');
|
||||
}
|
||||
|
||||
$func = $_GET['f'];
|
||||
switch($func) {
|
||||
@ -31,30 +33,35 @@ function buildStaticPage() {
|
||||
}
|
||||
}
|
||||
$out .= outputHTMLFooter(true);
|
||||
// For now, echo it.
|
||||
echo $out;
|
||||
$outfile = !empty($_POST['outfile'])?$_POST['outfile']:DEFAULT_FILE;
|
||||
file_put_contents($outfile, $out);
|
||||
}
|
||||
|
||||
function showAdminPage() {
|
||||
outputHTMLHeader();
|
||||
echo '<form action="/manager.php?f=build" method="POST">';
|
||||
echo ' <div>';
|
||||
echo ' <select multiple="multiple" name="chosen_files[]">';
|
||||
$out = '<form action="/manager.php?f=build" method="POST">'."\n"
|
||||
.' <div>'."\n"
|
||||
.' <label for="filename">Output File:</label>'."\n"
|
||||
.' <input name="filename" value="worship.html" placeholder="File Name" />'."\n"
|
||||
.' </div>'."\n"
|
||||
.' <div>'."\n"
|
||||
.' <label for="filter">Filter</label>'."\n"
|
||||
.' <input name="filter" value="" placeholder="Filter Files" />'."\n"
|
||||
.' <table>'."\n"
|
||||
.' <thead><th>File</th><th></th></thead>'."\n"
|
||||
.' <tbody>'."\n";
|
||||
foreach(glob(MD_DIR.'/*.md') as $file) {
|
||||
echo ' <option value="'.$file.'">'.basename($file, '.md').'</option>';
|
||||
echo ' <option value="'.$file.'">'.basename($file, '.md').'</option>';
|
||||
echo ' <option value="'.$file.'">'.basename($file, '.md').'</option>';
|
||||
echo ' <option value="'.$file.'">'.basename($file, '.md').'</option>';
|
||||
echo ' <option value="'.$file.'">'.basename($file, '.md').'</option>';
|
||||
$out.=' <tr>'."\n"
|
||||
.' <td>'.basename($file, '.md').'</td><td><button onclick="addSong('.$filename.');">Add</button></td>'."\n"
|
||||
.' </tr>'."\n";
|
||||
}
|
||||
echo ' </select>';
|
||||
echo ' </div>';
|
||||
echo ' <div>';
|
||||
echo ' <label for="filename">Output File:</label>';
|
||||
echo ' <input name="filename" value="" placeholder="File Name" />';
|
||||
echo ' </div>';
|
||||
echo ' <button type="submit">Build</button>';
|
||||
echo '</form>';
|
||||
$out.= ' </tbody>'."\n"
|
||||
.' </table>'."\n"
|
||||
.' </div>'."\n"
|
||||
.' <button type="submit">Build</button>'."\n"
|
||||
.'</form>'."\n"
|
||||
.'<script>'."\n"
|
||||
.'</script>'."\n";
|
||||
outputHTMLFooter();
|
||||
}
|
||||
|
||||
@ -63,6 +70,7 @@ function outputHTMLHeader($title = TITLE, $ret = false) {
|
||||
.'<html lang="en">'."\n"
|
||||
.' <head>'."\n"
|
||||
.' <title>'.$title.'</title>'."\n"
|
||||
.' <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">'."\n"
|
||||
.' </head>'."\n"
|
||||
.' <body>'."\n";
|
||||
if($ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user