diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2009-02-22 13:15:37 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2009-02-22 13:15:37 -0500 |
commit | eee98526c48b9154cd9e9bc8bc3e07769e6a39ea (patch) | |
tree | 9d8d719a2ccea91de86435ccd985241ddb3fa0cb /pages/comic.php | |
parent | 653c7b3a488488d4b161a8fae41ada5851bf7685 (diff) | |
download | pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.tar.gz pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.tar.bz2 pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.zip |
Rewrote Pillowcase
NOTE: There is a new database schema now, so the database from the testing server has to be copied over to the production server, otherwise this code will fail.
Diffstat (limited to 'pages/comic.php')
-rwxr-xr-x | pages/comic.php | 131 |
1 files changed, 131 insertions, 0 deletions
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 | ?> | ||