diff options
-rw-r--r-- | .hgignore | 3 | ||||
-rw-r--r-- | .htaccess | 7 | ||||
-rwxr-xr-x | admin/.htaccess | 4 | ||||
-rw-r--r-- | admin/add.php | 30 | ||||
-rwxr-xr-x | admin/index.php | 27 | ||||
-rw-r--r-- | admin/login.php | 30 | ||||
-rw-r--r-- | admin/logout.php | 7 | ||||
-rw-r--r-- | admin/main.php | 8 | ||||
-rw-r--r-- | admin/manage.php | 15 | ||||
-rw-r--r-- | admin/remove.php | 10 | ||||
-rw-r--r-- | admin/update.php | 5 | ||||
-rw-r--r-- | archive.php | 23 | ||||
-rw-r--r-- | images/comics/empty | 0 | ||||
-rw-r--r-- | images/template.png (renamed from template.png) | bin | 1196 -> 1196 bytes | |||
-rw-r--r-- | images/title.png (renamed from title.png) | bin | 7599 -> 7599 bytes | |||
-rwxr-xr-x | includes/db.php (renamed from db.php) | 0 | ||||
-rw-r--r-- | includes/footer.php (renamed from footer.php) | 0 | ||||
-rw-r--r-- | includes/functions.php | 35 | ||||
-rw-r--r-- | includes/header.php (renamed from header.php) | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | index.php | 119 | ||||
-rw-r--r-- | pages/about.php (renamed from about.php) | 10 | ||||
-rw-r--r-- | pages/archive.php | 14 | ||||
-rwxr-xr-x | pages/comic.php | 131 | ||||
-rw-r--r-- | pages/contribute.php (renamed from contribute.php) | 70 | ||||
-rwxr-xr-x | style.css | 6 |
25 files changed, 210 insertions, 357 deletions
diff --git a/.hgignore b/.hgignore index 378539b..2db41f3 100644 --- a/.hgignore +++ b/.hgignore | |||
@@ -1,2 +1 @@ | |||
1 | images/ | images/.*\.png | |
2 | moderation/ | ||
diff --git a/.htaccess b/.htaccess index b09d5dc..b79eae1 100644 --- a/.htaccess +++ b/.htaccess | |||
@@ -1,10 +1,11 @@ | |||
1 | RewriteEngine On | 1 | RewriteEngine On |
2 | RewriteRule comic([0-9]+).htm /index.php?id=$1 [QSA,L] | 2 | RewriteRule comic([0-9]+).htm /index.php?area=comic&id=$1 [QSA,L] |
3 | RewriteRule scripts/ / [R] | 3 | RewriteRule pages/ / [R] |
4 | RewriteRule includes/ / [R] | ||
4 | RewriteRule config.php / [R] | 5 | RewriteRule config.php / [R] |
5 | RewriteRule header.php / [R] | 6 | RewriteRule header.php / [R] |
6 | RewriteRule footer.php / [R] | 7 | RewriteRule footer.php / [R] |
7 | RewriteCond %{REQUEST_FILENAME} !.png | 8 | RewriteCond %{REQUEST_FILENAME} !.png |
8 | RewriteRule images/ / [R] | 9 | RewriteRule images/ / [R] |
9 | RewriteCond %{REQUEST_FILENAME} .htm | 10 | RewriteCond %{REQUEST_FILENAME} .htm |
10 | RewriteRule (.+).htm $1.php [QSA] | 11 | RewriteRule (.+).htm /index.php?area=$1 [QSA,L] |
diff --git a/admin/.htaccess b/admin/.htaccess deleted file mode 100755 index d590e40..0000000 --- a/admin/.htaccess +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | RewriteEngine On | ||
2 | RewriteCond %{REQUEST_FILENAME} !index.php | ||
3 | RewriteCond %{REQUEST_FILENAME} !-d | ||
4 | RewriteRule (.*).php /admin/index.php?file=$1 [QSA,L] | ||
diff --git a/admin/add.php b/admin/add.php deleted file mode 100644 index 96a9219..0000000 --- a/admin/add.php +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | $getimage = "SELECT * FROM moderation WHERE id = " . $_GET['id']; | ||
4 | $getimage2 = mysql_query($getimage); | ||
5 | $getimage3 = mysql_fetch_array($getimage2); | ||
6 | |||
7 | $title = $getimage3['title']; | ||
8 | $title = preg_replace('/[^A-Za-z0-9 ]/','',$title); | ||
9 | $title = str_replace(' ', '-', $title); | ||
10 | $title = preg_replace('/-{2,}/','-',$title); | ||
11 | if (substr($title,0,1) == '-') | ||
12 | { | ||
13 | $title = substr($title,1); | ||
14 | } | ||
15 | if (substr($title,strlen($title)-1,1) == '-') | ||
16 | { | ||
17 | $title = substr($title,0,strlen($title)-1); | ||
18 | } | ||
19 | $title = strtolower($title); | ||
20 | rename($_SERVER['DOCUMENT_ROOT'] . '/moderation/' . $getimage3['id'] . '.png', $_SERVER['DOCUMENT_ROOT'] . '/images/' . $title . '.png'); | ||
21 | |||
22 | $insimage = "INSERT INTO pending (title,filename,text,author) VALUES (\"" . $getimage3['title'] . "\",\"" . $title . "\",\"" . $getimage3['text'] . "\",\"" . $getimage3['author'] . "\")"; | ||
23 | $insimage2 = mysql_query($insimage); | ||
24 | |||
25 | $delimage = "DELETE FROM moderation WHERE id = " . $_GET['id']; | ||
26 | $delimage2 = mysql_query($delimage); | ||
27 | |||
28 | ?> | ||
29 | |||
30 | Added comic <?php echo($getimage3['title']); ?>! | ||
diff --git a/admin/index.php b/admin/index.php deleted file mode 100755 index 3a5f6be..0000000 --- a/admin/index.php +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | session_start(); | ||
4 | |||
5 | ob_start(); | ||
6 | |||
7 | include('../header.php'); | ||
8 | |||
9 | if (!isset($_SESSION['username'])) | ||
10 | { | ||
11 | include('login.php'); | ||
12 | } else { | ||
13 | if (!isset($_GET['file'])) | ||
14 | { | ||
15 | $file = 'main.php'; | ||
16 | } else { | ||
17 | $file = basename($_GET['file'] . '.php'); | ||
18 | } | ||
19 | |||
20 | include($file); | ||
21 | } | ||
22 | |||
23 | include('../footer.php'); | ||
24 | |||
25 | ob_end_flush(); | ||
26 | |||
27 | ?> | ||
diff --git a/admin/login.php b/admin/login.php deleted file mode 100644 index f938664..0000000 --- a/admin/login.php +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | if (!isset($_GET['submit'])) | ||
4 | { | ||
5 | |||
6 | ?> | ||
7 | <FORM ACTION="/admin/login.php?submit=" METHOD="POST"> | ||
8 | Username: <INPUT TYPE="text" NAME="user"><BR> | ||
9 | Password: <INPUT TYPE="password" NAME="pass"><BR> | ||
10 | <INPUT TYPE="submit"></FORM> | ||
11 | <?php | ||
12 | |||
13 | } else { | ||
14 | $getconfig = "SELECT * FROM config WHERE name = \"username\" OR name = \"password\" ORDER BY name DESC"; | ||
15 | $getconfig2 = mysql_query($getconfig) or die($getconfig); | ||
16 | $username = mysql_fetch_array($getconfig2); | ||
17 | $password = mysql_fetch_array($getconfig2); | ||
18 | |||
19 | if (($username['value'] == $_POST['user']) && ($password['value'] == md5($_POST['pass']))) | ||
20 | { | ||
21 | $_SESSION['username'] = $_POST['user']; | ||
22 | |||
23 | header('Location: /admin/'); | ||
24 | exit; | ||
25 | } else { | ||
26 | ?><H2>Incorrect login</H2><?php | ||
27 | } | ||
28 | } | ||
29 | |||
30 | ?> | ||
diff --git a/admin/logout.php b/admin/logout.php deleted file mode 100644 index 639e045..0000000 --- a/admin/logout.php +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | unset($_SESSION['username']); | ||
4 | |||
5 | header('Location: /'); | ||
6 | |||
7 | ?> | ||
diff --git a/admin/main.php b/admin/main.php deleted file mode 100644 index aa01262..0000000 --- a/admin/main.php +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | <H2>Admin Panel</H2> | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/post.php">Upload a comic</A></LI> | ||
5 | <LI><A HREF="/admin/manage.php">Manage moderation queue</A></LI> | ||
6 | <LI><A HREF="/admin/update.php">HG Update</A></LI> | ||
7 | <LI><A HREF="/admin/logout.php">Logout</A></LI> | ||
8 | </UL> | ||
diff --git a/admin/manage.php b/admin/manage.php deleted file mode 100644 index 2485520..0000000 --- a/admin/manage.php +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | <UL><?php | ||
2 | |||
3 | $getimages = "SELECT * FROM moderation"; | ||
4 | $getimages2 = mysql_query($getimages); | ||
5 | while ($getimages3 = mysql_fetch_array($getimages2)) | ||
6 | { | ||
7 | ?><LI><?php echo($getimages3['title']); ?> - | ||
8 | <IMG SRC="/moderation/<?php echo($getimages3['id']); ?>.png" ALT="<?php echo($getimages3['text']); ?>" TITLE="<?php echo($getimages3['text']); ?>"> - | ||
9 | <A HREF="/admin/add.php?id=<?php echo($getimages3['id']); ?>">Add to Pending Queue</A> - | ||
10 | <A HREF="/admin/remove.php?id=<?php echo($getimages3['id']); ?>">Remove</A></LI><?php | ||
11 | } | ||
12 | |||
13 | ?></UL> | ||
14 | |||
15 | <A HREF="/admin/">Back to Admin</A> | ||
diff --git a/admin/remove.php b/admin/remove.php deleted file mode 100644 index 824fdee..0000000 --- a/admin/remove.php +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | $delimage = "DELETE FROM moderation WHERE id = " . $_GET['id']; | ||
4 | $delimage2 = mysql_query($delimage); | ||
5 | |||
6 | unlink($_SERVER['DOCUMENT_ROOT'] . '/moderation/' . $_GET['id'] . '.png'); | ||
7 | |||
8 | ?> | ||
9 | |||
10 | Removed comic <?php echo($_GET['id']); ?>! | ||
diff --git a/admin/update.php b/admin/update.php deleted file mode 100644 index c84c2c4..0000000 --- a/admin/update.php +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | system('hg update'); | ||
4 | |||
5 | ?> | ||
diff --git a/archive.php b/archive.php deleted file mode 100644 index 02fffbf..0000000 --- a/archive.php +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | include('header.php'); | ||
4 | |||
5 | ?> <H1>Archive</H1> | ||
6 | |||
7 | <UL ID="archive"> | ||
8 | <?php | ||
9 | |||
10 | $getimages = "SELECT * FROM images ORDER BY id ASC"; | ||
11 | $getimages2 = mysql_query($getimages); | ||
12 | while ($getimages3 = mysql_fetch_array($getimages2)) | ||
13 | { | ||
14 | ?> <LI><A HREF="/comic<?php echo($getimages3['id']); ?>.htm"><?php echo($getimages3['title']); ?></A></LI> | ||
15 | <?php | ||
16 | } | ||
17 | |||
18 | ?> </UL> | ||
19 | <?php | ||
20 | |||
21 | include('footer.php'); | ||
22 | |||
23 | ?> | ||
diff --git a/images/comics/empty b/images/comics/empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/images/comics/empty | |||
diff --git a/template.png b/images/template.png index 77a3ef5..77a3ef5 100644 --- a/template.png +++ b/images/template.png | |||
Binary files differ | |||
diff --git a/title.png b/images/title.png index 951cc5b..951cc5b 100644 --- a/title.png +++ b/images/title.png | |||
Binary files differ | |||
diff --git a/db.php b/includes/db.php index a763283..a763283 100755 --- a/db.php +++ b/includes/db.php | |||
diff --git a/footer.php b/includes/footer.php index da2d072..da2d072 100644 --- a/footer.php +++ b/includes/footer.php | |||
diff --git a/includes/functions.php b/includes/functions.php new file mode 100644 index 0000000..edb666b --- /dev/null +++ b/includes/functions.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | function has_meta($id, $name) | ||
4 | { | ||
5 | $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; | ||
6 | $getmeta2 = mysql_query($getmeta); | ||
7 | $getmeta3 = mysql_fetch_array($getmeta2); | ||
8 | |||
9 | if ($getmeta3['name'] == $name) | ||
10 | { | ||
11 | return true; | ||
12 | } | ||
13 | |||
14 | return false; | ||
15 | } | ||
16 | |||
17 | function get_meta($id, $name) | ||
18 | { | ||
19 | $getmeta = "SELECT * FROM meta WHERE comic_id = " . $id . " AND name = \"" . $name . "\""; | ||
20 | $getmeta2 = mysql_query($getmeta); | ||
21 | $getmeta3 = mysql_fetch_array($getmeta2); | ||
22 | |||
23 | return $getmeta3['value']; | ||
24 | } | ||
25 | |||
26 | function next_comic_id() | ||
27 | { | ||
28 | $getcomic = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1"; | ||
29 | $getcomic2 = mysql_query($getcomic); | ||
30 | $getcomic3 = mysql_fetch_array($getcomic2); | ||
31 | |||
32 | return ($getcomic3['comic_id']+1); | ||
33 | } | ||
34 | |||
35 | ?> | ||
diff --git a/header.php b/includes/header.php index dbbb5bf..0f5b075 100644 --- a/header.php +++ b/includes/header.php | |||
@@ -22,6 +22,7 @@ if (isset($title)) | |||
22 | <?php | 22 | <?php |
23 | 23 | ||
24 | include_once($_SERVER['DOCUMENT_ROOT'] . '/db.php'); | 24 | include_once($_SERVER['DOCUMENT_ROOT'] . '/db.php'); |
25 | include_once($_SERVER['DOCUMENT_ROOT'] . '/functions.php'); | ||
25 | 26 | ||
26 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; | 27 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; |
27 | $getlast2 = mysql_query($getlast); | 28 | $getlast2 = mysql_query($getlast); |
@@ -30,16 +31,18 @@ $getlast3 = mysql_fetch_array($getlast2); | |||
30 | $last = $getlast3['value']; | 31 | $last = $getlast3['value']; |
31 | if ($last != date('md')) | 32 | if ($last != date('md')) |
32 | { | 33 | { |
33 | $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | 34 | $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"; |
34 | $getpending2 = mysql_query($getpending); | 35 | $getpending2 = mysql_query($getpending); |
35 | $getpending3 = mysql_fetch_array($getpending2); | 36 | $getpending3 = mysql_fetch_array($getpending2); |
36 | if (!empty($getpending3)) | 37 | if (!empty($getpending3)) |
37 | { | 38 | { |
38 | $inscomic = "INSERT INTO images (title,filename, text) VALUES (\"" . mysql_real_escape_string($getpending3['title']) . "\",\"" . mysql_real_escape_string($getpending3['filename']) . "\",\"" . mysql_real_escape_string($getpending3['text']) . "\")"; | 39 | $id = next_comic_id(); |
39 | $inscomic2 = mysql_query($inscomic) or die($inscomic); | ||
40 | 40 | ||
41 | $delcomic = "DELETE FROM pending WHERE id = " . $getpending3['id']; | 41 | $setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id']; |
42 | $delcomic2 = mysql_query($delcomic) or die($delcomic); | 42 | $setcomic2 = mysql_query($setcomic) or die($setcomic); |
43 | |||
44 | $insmeta = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"; | ||
45 | $insmeta2 = mysql_query($insmeta) or die($insmeta); | ||
43 | 46 | ||
44 | $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\""; | 47 | $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\""; |
45 | $setconfig2 = mysql_query($setconfig); | 48 | $setconfig2 = mysql_query($setconfig); |
diff --git a/index.php b/index.php index d1178a0..3738020 100755..100644 --- a/index.php +++ b/index.php | |||
@@ -1,123 +1,24 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | include('db.php'); | 3 | include('includes/db.php'); |
4 | include('includes/functions.php'); | ||
4 | 5 | ||
5 | ob_start(); | 6 | ob_start(); |
6 | 7 | ||
7 | if (isset($_GET['id'])) | 8 | $filename = 'pages/' . basename($_GET['area']) . '.php'; |
9 | if (!file_exists($filename)) | ||
8 | { | 10 | { |
9 | $getimage = "SELECT * FROM images WHERE id = " . $_GET['id']; | 11 | $filename = 'pages/comic.php'; |
10 | } else { | ||
11 | $getimage = "SELECT * FROM images ORDER BY id DESC LIMIT 0,1"; | ||
12 | } | 12 | } |
13 | $getimage2 = mysql_query($getimage); | ||
14 | $getimage3 = mysql_fetch_array($getimage2); | ||
15 | 13 | ||
16 | ?> | 14 | include($filename); |
17 | <DIV CLASS="post"> | ||
18 | <DIV CLASS="date" TITLE="<?php echo(date('F jS Y g:i a', strtotime($getimage3['pubDate']))); ?>"> | ||
19 | <?php echo(date('M',strtotime($getimage3['pubDate']))); ?><BR> | ||
20 | <?php echo(date('j',strtotime($getimage3['pubDate']))); ?><BR> | ||
21 | <?php echo(date('Y',strtotime($getimage3['pubDate']))); ?> | ||
22 | |||
23 | </DIV> | ||
24 | |||
25 | <DIV CLASS="title"> | ||
26 | <H2><?php echo($getimage3['title']); ?></H2> | ||
27 | <?php | ||
28 | |||
29 | if ($getimage3['author'] != '') | ||
30 | { | ||
31 | ?> | ||
32 | <CENTER><SMALL>Guest comic by <?php echo($getimage3['author']); ?></SMALL></CENTER> | ||
33 | <?php | ||
34 | } | ||
35 | |||
36 | ?> | ||
37 | </DIV> | ||
38 | </DIV> | ||
39 | |||
40 | <DIV CLASS="image"> | ||
41 | <IMG SRC="/images/<?php echo($getimage3['filename']); ?>" ALT="<?php echo(htmlentities($getimage3['text'])); ?>" TITLE="<?php echo(htmlentities($getimage3['text'])); ?>"> | ||
42 | </DIV> | ||
43 | |||
44 | <DIV CLASS="cleardiv"></DIV> | ||
45 | |||
46 | <UL CLASS="navbar"> | ||
47 | <?php | ||
48 | |||
49 | $id = $getimage3['id']; | ||
50 | |||
51 | $cntimages = "SELECT COUNT(*) FROM images"; | ||
52 | $cntimages2 = mysql_query($cntimages); | ||
53 | $cntimages3 = mysql_fetch_array($cntimages2); | ||
54 | $all = $cntimages3['COUNT(*)']; | ||
55 | |||
56 | if ($id > 2) | ||
57 | { | ||
58 | ?> <LI><A HREF="/comic1.htm">First</a></LI> | ||
59 | <?php | ||
60 | } | ||
61 | |||
62 | if ($id > 1) | ||
63 | { | ||
64 | ?> <LI><A HREF="/comic<?php echo($id-1); ?>.htm">Back</A></LI> | ||
65 | <?php | ||
66 | } | ||
67 | |||
68 | if ($id < $all) | ||
69 | { | ||
70 | if ($id != ($all-1)) | ||
71 | { | ||
72 | ?> <LI><A HREF="/comic<?php echo($id+1); ?>.htm">Next</A></LI> | ||
73 | <?php | ||
74 | ?> <LI><A HREF="/">Today</A></LI> | ||
75 | <?php | ||
76 | } else { | ||
77 | ?> <LI><A HREF="/">Next</A></LI> | ||
78 | <?php | ||
79 | } | ||
80 | } | ||
81 | |||
82 | $cntpending = "SELECT COUNT(*) FROM pending"; | ||
83 | $cntpending2 = mysql_query($cntpending); | ||
84 | $cntpending3 = mysql_fetch_array($cntpending2); | ||
85 | $numpending = $cntpending3['COUNT(*)']; | ||
86 | |||
87 | ?> | ||
88 | </UL> | ||
89 | |||
90 | <DIV CLASS="cleardiv"></DIV> | ||
91 | 15 | ||
92 | <P> | 16 | $doc = ob_get_contents(); |
93 | pillowcase - the result of an obsession with cute, plush objects that talk nonsense | ||
94 | </P> | ||
95 | 17 | ||
96 | <P> | ||
97 | because we luv <A HREF="http://xkcd.com">xkcd</A>, make sure you look for the alt text | ||
98 | </P> | ||
99 | |||
100 | <P> | ||
101 | <?php if ($numpending == 1): ?> | ||
102 | there is 1 comic in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for 1 more day before she starts getting angry emails | ||
103 | <?php elseif ($numpending == 0): ?> | ||
104 | oh dear, there aren't any comics in the pending queue, which means that if Starla doesn't hurry up, there may not be a comic tomorrow | ||
105 | <?php elseif ($numpending > 100): ?> | ||
106 | OMG! There are <?php echo($numpending); ?> comics in the pending queue! Starla, you relax as long as you want! | ||
107 | <?php else: ?> | ||
108 | there are <?php echo($numpending); ?> comics in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for <?php echo($numpending); ?> days before she starts getting angry emails | ||
109 | <?php endif; ?> | ||
110 | </P> | ||
111 | <?php | ||
112 | |||
113 | $contents = ob_get_contents(); | ||
114 | ob_end_clean(); | 18 | ob_end_clean(); |
115 | 19 | ||
116 | $title = $getimage3['title']; | 20 | include('includes/header.php'); |
117 | include('header.php'); | 21 | echo($doc); |
118 | 22 | include('includes/footer.php'); | |
119 | echo($contents); | ||
120 | |||
121 | include('footer.php'); | ||
122 | 23 | ||
123 | ?> | 24 | ?> |
diff --git a/about.php b/pages/about.php index 83b284a..c85544f 100644 --- a/about.php +++ b/pages/about.php | |||
@@ -1,8 +1,3 @@ | |||
1 | <?php | ||
2 | |||
3 | include('header.php'); | ||
4 | |||
5 | ?> | ||
6 | <H1>About</H1> | 1 | <H1>About</H1> |
7 | 2 | ||
8 | <P> | 3 | <P> |
@@ -24,8 +19,3 @@ include('header.php'); | |||
24 | story and providing the first 11 Pillowcase comics with it, Starla went a little Pillowcase-insane and turned it | 19 | story and providing the first 11 Pillowcase comics with it, Starla went a little Pillowcase-insane and turned it |
25 | into a real webcomic. | 20 | into a real webcomic. |
26 | </P> | 21 | </P> |
27 | <?php | ||
28 | |||
29 | include('footer.php'); | ||
30 | |||
31 | ?> | ||
diff --git a/pages/archive.php b/pages/archive.php new file mode 100644 index 0000000..c1cd8ab --- /dev/null +++ b/pages/archive.php | |||
@@ -0,0 +1,14 @@ | |||
1 | <H1>Archive</H1> | ||
2 | |||
3 | <UL ID="archive"> | ||
4 | <?php | ||
5 | |||
6 | $getcomics = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id ASC"; | ||
7 | $getcomics2 = mysql_query($getcomics); | ||
8 | while ($getcomics3 = mysql_fetch_array($getcomics2)) | ||
9 | { | ||
10 | ?> <LI><A HREF="/comic<?php echo($getcomics3['comic_id']); ?>.htm"><?php echo($getcomics3['title']); ?></A></LI> | ||
11 | <?php | ||
12 | } | ||
13 | |||
14 | ?> </UL> | ||
diff --git a/pages/comic.php b/pages/comic.php new file mode 100755 index 0000000..0edd91c --- /dev/null +++ b/pages/comic.php | |||
@@ -0,0 +1,131 @@ | |||
1 | <?php | ||
2 | |||
3 | if (isset($_GET['id'])) | ||
4 | { | ||
5 | $getcomic = "SELECT * FROM comics WHERE comic_id = " . $_GET['id'] . " AND status = \"publish\""; | ||
6 | } else { | ||
7 | $getcomic = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1"; | ||
8 | } | ||
9 | $getcomic2 = mysql_query($getcomic); | ||
10 | $getcomic3 = mysql_fetch_array($getcomic2); | ||
11 | |||
12 | $date = strtotime(get_meta($getcomic3['id'], 'pubDate')); | ||
13 | |||
14 | ?> | ||
15 | <DIV CLASS="post"> | ||
16 | <DIV CLASS="date" TITLE="<?php echo(date('F jS Y g:i a', $date)); ?>"> | ||
17 | <?php echo(date('M', $date)); ?><BR> | ||
18 | <?php echo(date('j', $date)); ?><BR> | ||
19 | <?php echo(date('Y', $date)); ?> | ||
20 | |||
21 | </DIV> | ||
22 | |||
23 | <DIV CLASS="title"> | ||
24 | <H2><?php echo($getcomic3['title']); ?></H2> | ||
25 | <?php | ||
26 | |||
27 | if (has_meta($getcomic3['id'], 'author')) | ||
28 | { | ||
29 | ?> | ||
30 | <CENTER><SMALL>Guest comic by <?php echo(get_meta($getcomic3['id'], 'author')); ?></SMALL></CENTER> | ||
31 | <?php | ||
32 | } | ||
33 | |||
34 | ?> | ||
35 | </DIV> | ||
36 | </DIV> | ||
37 | |||
38 | <DIV CLASS="image"> | ||
39 | <?php | ||
40 | |||
41 | if (has_meta($getcomic3['id'], 'link')) | ||
42 | { | ||
43 | ?> | ||
44 | <A HREF="<?php echo(get_meta($getcomic3['id'], 'link')); ?>"> | ||
45 | <?php | ||
46 | } | ||
47 | ?> | ||
48 | <IMG SRC="/images/comics/<?php echo($getcomic3['filename']); ?>" ALT="<?php echo(htmlentities($getcomic3['text'])); ?>" TITLE="<?php echo(htmlentities($getcomic3['text'])); ?>"> | ||
49 | <?php | ||
50 | |||
51 | if (has_meta($getcomic3['id'], 'link')) | ||
52 | { | ||
53 | ?> | ||
54 | </A> | ||
55 | <?php | ||
56 | } | ||
57 | ?> | ||
58 | </DIV> | ||
59 | |||
60 | <DIV CLASS="cleardiv"></DIV> | ||
61 | |||
62 | <UL CLASS="navbar"> | ||
63 | <?php | ||
64 | |||
65 | $id = $getcomic3['comic_id']; | ||
66 | |||
67 | $cntcomics = "SELECT COUNT(*) FROM comics WHERE status = \"publish\""; | ||
68 | $cntcomics2 = mysql_query($cntcomics); | ||
69 | $cntcomics3 = mysql_fetch_array($cntcomics2); | ||
70 | $all = $cntcomics3['COUNT(*)']; | ||
71 | |||
72 | if ($id > 2) | ||
73 | { | ||
74 | ?> <LI><A HREF="/comic1.htm">First</a></LI> | ||
75 | <?php | ||
76 | } | ||
77 | |||
78 | if ($id > 1) | ||
79 | { | ||
80 | ?> <LI><A HREF="/comic<?php echo($id-1); ?>.htm">Back</A></LI> | ||
81 | <?php | ||
82 | } | ||
83 | |||
84 | if ($id < $all) | ||
85 | { | ||
86 | if ($id != ($all-1)) | ||
87 | { | ||
88 | ?> <LI><A HREF="/comic<?php echo($id+1); ?>.htm">Next</A></LI> | ||
89 | <?php | ||
90 | ?> <LI><A HREF="/">Today</A></LI> | ||
91 | <?php | ||
92 | } else { | ||
93 | ?> <LI><A HREF="/">Next</A></LI> | ||
94 | <?php | ||
95 | } | ||
96 | } | ||
97 | |||
98 | $cntpending = "SELECT COUNT(*) FROM comics WHERE status = \"pending\""; | ||
99 | $cntpending2 = mysql_query($cntpending); | ||
100 | $cntpending3 = mysql_fetch_array($cntpending2); | ||
101 | $numpending = $cntpending3['COUNT(*)']; | ||
102 | |||
103 | ?> | ||
104 | </UL> | ||
105 | |||
106 | <DIV CLASS="cleardiv"></DIV> | ||
107 | |||
108 | <P> | ||
109 | pillowcase - the result of an obsession with cute, plush objects that talk nonsense | ||
110 | </P> | ||
111 | |||
112 | <P> | ||
113 | because we luv <A HREF="http://xkcd.com">xkcd</A>, make sure you look for the alt text | ||
114 | </P> | ||
115 | |||
116 | <P> | ||
117 | <?php if ($numpending == 1): ?> | ||
118 | there is 1 comic in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for 1 more day before she starts getting angry emails | ||
119 | <?php elseif ($numpending == 0): ?> | ||
120 | oh dear, there aren't any comics in the pending queue, which means that if Starla doesn't hurry up, there may not be a comic tomorrow | ||
121 | <?php elseif ($numpending > 100): ?> | ||
122 | OMG! There are <?php echo($numpending); ?> comics in the pending queue! Starla, you relax as long as you want! | ||
123 | <?php else: ?> | ||
124 | there are <?php echo($numpending); ?> comics in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for <?php echo($numpending); ?> days before she starts getting angry emails | ||
125 | <?php endif; ?> | ||
126 | </P> | ||
127 | <?php | ||
128 | |||
129 | $title = $getcomic3['title']; | ||
130 | |||
131 | ?> | ||
diff --git a/contribute.php b/pages/contribute.php index d580a7a..eb99e08 100644 --- a/contribute.php +++ b/pages/contribute.php | |||
@@ -1,10 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | $title = 'Contribute'; | 3 | $title = 'Contribute'; |
4 | include('header.php'); | ||
5 | |||
6 | if (!isset($_GET['submit'])) | ||
7 | { | ||
8 | 4 | ||
9 | ?> | 5 | ?> |
10 | <H1>Contribute</H1> | 6 | <H1>Contribute</H1> |
@@ -15,8 +11,8 @@ if (!isset($_GET['submit'])) | |||
15 | </P> | 11 | </P> |
16 | 12 | ||
17 | <P> | 13 | <P> |
18 | First, of course, you have to actually write the comic. You can <A HREF="/template.png">download the template here</A>. | 14 | First, of course, you have to actually write the comic. You can <A HREF="/images/template.png">download the template |
19 | There are some rules about how you can layout the comic, though. | 15 | here</A>. There are some rules about how you can layout the comic, though. |
20 | 16 | ||
21 | <UL> | 17 | <UL> |
22 | <LI>You are allowed to move around the pillowcase. You are also allowed to make him face the other way, make | 18 | <LI>You are allowed to move around the pillowcase. You are also allowed to make him face the other way, make |
@@ -53,65 +49,3 @@ if (!isset($_GET['submit'])) | |||
53 | <A HREF="http://fourisland.com/fourm/memberlist.php?mode=viewprofile&u=2">contact her</A> with the comic image and | 49 | <A HREF="http://fourisland.com/fourm/memberlist.php?mode=viewprofile&u=2">contact her</A> with the comic image and |
54 | the required details. Thanks! | 50 | the required details. Thanks! |
55 | </P> | 51 | </P> |
56 | <?php | ||
57 | |||
58 | } else { | ||
59 | if ($_POST['title'] != '') | ||
60 | { | ||
61 | if ($_POST['text'] != '') | ||
62 | { | ||
63 | $insimage = "INSERT INTO moderation (title, text, author) VALUES (\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . mysql_real_escape_string($_POST['text']) . "\",\"" . mysql_real_escape_string($_POST['author']) . "\")"; | ||
64 | $insimage2 = mysql_query($insimage) or die($insimage); | ||
65 | |||
66 | $id = mysql_insert_id(); | ||
67 | if ($id != 0) | ||
68 | { | ||
69 | if (move_uploaded_file($_FILES['comic']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/moderation/' . $id . '.png')) | ||
70 | { | ||
71 | ?> | ||
72 | <H1>Contribute</H1> | ||
73 | |||
74 | <P> | ||
75 | You have successfully uploaded a comic! Woo-hoo! Now, Starla will review it and (hopefully) add it to the pending | ||
76 | queue! Good luck! | ||
77 | </P> | ||
78 | <?php | ||
79 | } else { | ||
80 | $delimage = "DELETE FROM moderation WHERE id = " . $id; | ||
81 | $delimage2 = mysql_query($delimage); | ||
82 | |||
83 | ?> | ||
84 | <H1>Contribute</H1> | ||
85 | |||
86 | <P> | ||
87 | Uh oh, due to some unknown reason (are you sure you uploaded an image?), the comic upload failed! That's not good. | ||
88 | Please go back to the form and ensure you filled it in correctly. | ||
89 | </P> | ||
90 | <?php | ||
91 | } | ||
92 | } | ||
93 | } else { | ||
94 | ?> | ||
95 | <H1>Contribute</H1> | ||
96 | |||
97 | <P> | ||
98 | Uh oh, you neglected to add an "alt text" description to your comic upload! That's a required field, so you have to | ||
99 | go back and try filling in the form again. | ||
100 | </P> | ||
101 | <?php | ||
102 | } | ||
103 | } else { | ||
104 | ?> | ||
105 | <H1>Contribute</H1> | ||
106 | |||
107 | <P> | ||
108 | Uh oh, you neglected to add an title to your comic upload! That's a required field, so you have to go back and try | ||
109 | filling in the form again. | ||
110 | </P> | ||
111 | <?php | ||
112 | } | ||
113 | } | ||
114 | |||
115 | include('footer.php'); | ||
116 | |||
117 | ?> | ||
diff --git a/style.css b/style.css index 6894969..0699038 100755 --- a/style.css +++ b/style.css | |||
@@ -76,7 +76,7 @@ div.image { | |||
76 | 76 | ||
77 | div#header h1 { | 77 | div#header h1 { |
78 | text-indent: -9999px; | 78 | text-indent: -9999px; |
79 | background-image: url(/title.png); | 79 | background-image: url(/images/title.png); |
80 | height: 115px; | 80 | height: 115px; |
81 | width: 500px; | 81 | width: 500px; |
82 | } | 82 | } |
@@ -93,3 +93,7 @@ ul#archive { | |||
93 | text-align: center; | 93 | text-align: center; |
94 | padding-left: 0; | 94 | padding-left: 0; |
95 | } | 95 | } |
96 | |||
97 | a img { | ||
98 | border: 0; | ||
99 | } | ||