diff --git a/manager.php b/index.php similarity index 57% rename from manager.php rename to index.php index a895699..fcab710 100644 --- a/manager.php +++ b/index.php @@ -19,12 +19,9 @@ default: function buildStaticPage() { $pd = new Parsedown(); $title = !empty($_POST['title'])?$_POST['title']:TITLE; - $out = outputHTMLHeader($title, true); - $out .= '
';
-  $out .= print_r($_POST, true);
-  $out .= '
'; - $out .= '======'; - foreach($_POST['chosen_files'] as $file) { + $out = getHTMLHeader($title); + $selFiles = json_decode($_POST['chosen_files']); + foreach($selFiles as $file) { if(file_exists($file)) { $md = file_get_contents($file); $out .= '
'; @@ -32,15 +29,17 @@ function buildStaticPage() { $out .= "
"; } } - $out .= outputHTMLFooter(true); + $out .= getHTMLFooter(); $outfile = !empty($_POST['outfile'])?$_POST['outfile']:DEFAULT_FILE; file_put_contents($outfile, $out); + header('Location: '.$outfile); } function showAdminPage() { $out = getHTMLHeader(TITLE) - .'
'."\n" + .''."\n" .'
'."\n" + .' '."\n" .'
'."\n" .' '."\n" .' '."\n" @@ -55,7 +54,7 @@ function showAdminPage() { $base = basename($file, '.md'); $out.=' '."\n" .' '.$base.'' - .''."\n" + .'Add'."\n" .' '."\n"; } $out.=' '."\n" @@ -64,6 +63,7 @@ function showAdminPage() { .'
'."\n" .'
'."\n" .''."\n" .getHTMLFooter(); echo $out; @@ -95,6 +131,14 @@ function getHTMLHeader($title = TITLE) { .' .margin10 {'."\n" .' margin: 10px;'."\n" .' }'."\n" + .' .pure-button-secondary {'."\n" + .' background-color: #0A0;'."\n" + .' color: #FFF;'."\n" + .' }'."\n" + .' .pure-button-warning {'."\n" + .' background-color: #A00;'."\n" + .' color: #FFF;'."\n" + .' }'."\n" .' '."\n" .' '."\n" .' '."\n";