diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-01 21:09:56 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-01 21:09:56 -0400 |
commit | 68056e6d92285e184518bc8c7130bb49767623f3 (patch) | |
tree | c2a24370d8d132f85fb929580078adaf49a3c5fb | |
parent | 116af031a42db23e836633d5298a9595ad0803c7 (diff) |
Move config into one config.php file, add an index file, spit out complete HTML files, use CSSHEADmaster
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | config.php | 3 | ||||
-rw-r--r-- | footer.php | 3 | ||||
-rw-r--r-- | header.php | 7 | ||||
-rw-r--r-- | index.php | 12 | ||||
-rw-r--r-- | make-post.php | 10 | ||||
-rw-r--r-- | style.css | 7 | ||||
-rw-r--r-- | upload-msword.php | 14 | ||||
-rw-r--r-- | upload-org.php | 11 |
9 files changed, 64 insertions, 11 deletions
@@ -64,7 +64,7 @@ polished project. Other Notes ----------- -All of the PHP files have a directory hardcoded into them to either -look for the org-mode files in, or upload them to. I've got it set to -`/home/luke/j1-uploads`. Perhaps one day I'll move that to a single -config file. +Yeah, I did all the bad-practice spitting-out-HTML-from-logic-code +and using globals stuff. This was a quickie hack. It's basically +just one PHP script (at least on the PHP side). Don't worry, my other +projects use MVC and all that. diff --git a/config.php b/config.php new file mode 100644 index 0000000..dfe92e5 --- /dev/null +++ b/config.php @@ -0,0 +1,3 @@ +<?php +global $dir; +$dir = '/home/luke/j1-uploads'; diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..8320e05 --- /dev/null +++ b/footer.php @@ -0,0 +1,3 @@ +<p><a href=".">Back to menu</a></p> +</body> +</html><?php exit(); ?> diff --git a/header.php b/header.php new file mode 100644 index 0000000..45553af --- /dev/null +++ b/header.php @@ -0,0 +1,7 @@ +<?php header('Content-type: text/html; charset=utf-8'); ?><!DOCTYPE html> +<html dir="ltr" lang="en-US"> +<head> + <title><?php global $title; echo $title; ?></title> + <link rel="stylesheet" type="text/css" href="style.css" /> +</head> +<body> diff --git a/index.php b/index.php new file mode 100644 index 0000000..b3587be --- /dev/null +++ b/index.php @@ -0,0 +1,12 @@ +<?php +global $title; +$title = 'Org-Quotes'; +include('header.php'); +?> + <ul> + <li><a href="upload-org.php">Upload quotes from Org-Mode</a></li> + <li><a href="upload-msword.php">Upload quotes from MS Word</a></li> + <li><a href="make-post.php">Make a post from uploaded quotes</a></li> + </ul> +<?php +include('footer.php'); diff --git a/make-post.php b/make-post.php index 200f853..2feff1c 100644 --- a/make-post.php +++ b/make-post.php @@ -1,8 +1,9 @@ <?php -header('Content-type: text/html; charset=utf-8'); -$dir = '/home/luke/j1-uploads'; +require('config.php'); +global $dir; if (!isset($_POST['filename'])) { + include('header.php'); echo '<form method="post" action="make-post.php">'; echo '<ul>'; if ($handle = opendir($dir)) { @@ -19,7 +20,7 @@ if (!isset($_POST['filename'])) { echo '</ul>'; echo '<input type="submit" value="submit" />'; echo '</form>'; - exit(); + include('footer.php'); } $filename = $dir.'/'.rawurlencode($_POST['filename']); @@ -51,6 +52,7 @@ foreach ($lines as $line) { } if (!isset($_POST['q'])) { + include('header.php'); echo '<form method="post" action="make-post.php">'; echo '<input type="hidden" name="filename" value="'.htmlentities($_POST['filename']).'" />'; echo '<textarea name="open"></textarea>'; @@ -93,7 +95,9 @@ if (!isset($_POST['q'])) { } echo '<input type="submit" value="submit" />'; echo '</form>'; + include('footer.php'); } else { + header('Content-type: text/plain; charset=utf-8'); $quotes = array(); foreach ($_POST['q'] as $reporter => $quote_id) { $quote = $reporters[$reporter][$quote_id]; diff --git a/style.css b/style.css new file mode 100644 index 0000000..1c8ccd6 --- /dev/null +++ b/style.css @@ -0,0 +1,7 @@ +input[type=text] { + width: 100%; +} +textarea { + width: 100%; + height: 10em; +}
\ No newline at end of file diff --git a/upload-msword.php b/upload-msword.php index b234381..f2d93bf 100644 --- a/upload-msword.php +++ b/upload-msword.php @@ -1,6 +1,10 @@ <?php -header('Content-type: text/html; charset=utf-8'); -$dir = '/home/luke/j1-uploads'; +require('config.php'); +global $dir; + +global $title; +$title = 'Copy/Paste quotes from MS Word'; +include('header.php'); $set = isset($_POST['word_data']) && isset($_POST['filename']); if ($set) { @@ -23,9 +27,13 @@ if ($set) { } else { ?> <form method="post" action="upload-msword.php"> + Filename: <input type="text" name="filename" /> + Text: <textarea name="word_data"></textarea> <input type="submit" value="upload" /> </form> <?php -}
\ No newline at end of file +} + +include('footer.php'); diff --git a/upload-org.php b/upload-org.php index 40f403f..e752232 100644 --- a/upload-org.php +++ b/upload-org.php @@ -1,5 +1,10 @@ <?php -$dir = '/home/luke/j1-uploads/'; +require('config.php'); +global $dir; + +global $title; +$title = 'Copy/Paste quotes from Org-Mode'; +include('header.php'); $set = isset($_POST['org_data']) && isset($_POST['filename']); if ($set) { @@ -11,8 +16,12 @@ if ($set) { } else { ?> <form method="post" action="upload-msword.php"> + Filename: <input type="text" name="filename" /> + Text: <textarea name="org_data"></textarea> </form> <?php } + +include('footer.php'); |