summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--includes/header.php31
-rw-r--r--includes/update.php28
-rw-r--r--index.php1
-rw-r--r--rss.php33
4 files changed, 63 insertions, 30 deletions
diff --git a/includes/header.php b/includes/header.php index a9b93cd..a26f6b9 100644 --- a/includes/header.php +++ b/includes/header.php
@@ -11,6 +11,7 @@ if (isset($title))
11 <HEAD> 11 <HEAD>
12 <TITLE><?php echo($rtitle); ?></TITLE> 12 <TITLE><?php echo($rtitle); ?></TITLE>
13 <LINK REL="stylesheet" HREF="/style.css"> 13 <LINK REL="stylesheet" HREF="/style.css">
14 <LINK REL="alternate" TYPE="application/rss+xml" HREF="/rss.php">
14 </HEAD> 15 </HEAD>
15 16
16 <BODY> 17 <BODY>
@@ -19,34 +20,4 @@ if (isset($title))
19 <A HREF="/"><H1>Pillowcase</H1></A> 20 <A HREF="/"><H1>Pillowcase</H1></A>
20 </DIV> 21 </DIV>
21 22
22<?php
23
24include_once($_SERVER['DOCUMENT_ROOT'] . '/includes/db.php');
25include_once($_SERVER['DOCUMENT_ROOT'] . '/includes/functions.php');
26
27$getlast = "SELECT * FROM config WHERE name = \"lastUpdated\"";
28$getlast2 = mysql_query($getlast);
29$getlast3 = mysql_fetch_array($getlast2);
30
31$last = $getlast3['value'];
32if ($last != date('md'))
33{
34 $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1";
35 $getpending2 = mysql_query($getpending);
36 $getpending3 = mysql_fetch_array($getpending2);
37 if (!empty($getpending3))
38 {
39 $id = next_comic_id();
40
41 $setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id'];
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);
46
47 $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\"";
48 $setconfig2 = mysql_query($setconfig);
49 }
50}
51 23
52?>
diff --git a/includes/update.php b/includes/update.php new file mode 100644 index 0000000..6c8d9ff --- /dev/null +++ b/includes/update.php
@@ -0,0 +1,28 @@
1<?php
2
3$getlast = "SELECT * FROM config WHERE name = \"lastUpdated\"";
4$getlast2 = mysql_query($getlast);
5$getlast3 = mysql_fetch_array($getlast2);
6
7$last = $getlast3['value'];
8if ($last != date('md'))
9{
10 $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1";
11 $getpending2 = mysql_query($getpending);
12 $getpending3 = mysql_fetch_array($getpending2);
13 if (!empty($getpending3))
14 {
15 $id = next_comic_id();
16
17 $setcomic = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id'];
18 $setcomic2 = mysql_query($setcomic) or die($setcomic);
19
20 $insmeta = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")";
21 $insmeta2 = mysql_query($insmeta) or die($insmeta);
22
23 $setconfig = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\"";
24 $setconfig2 = mysql_query($setconfig);
25 }
26}
27
28?>
diff --git a/index.php b/index.php index 3738020..16b051c 100644 --- a/index.php +++ b/index.php
@@ -2,6 +2,7 @@
2 2
3include('includes/db.php'); 3include('includes/db.php');
4include('includes/functions.php'); 4include('includes/functions.php');
5include('includes/update.php');
5 6
6ob_start(); 7ob_start();
7 8
diff --git a/rss.php b/rss.php new file mode 100644 index 0000000..4b710aa --- /dev/null +++ b/rss.php
@@ -0,0 +1,33 @@
1<?php
2
3include('includes/db.php');
4include('includes/update.php');
5
6echo('<?xml version="1.0"?>');
7
8?>
9<rss version="2.0">
10 <channel>
11 <title>Pillowcase</title>
12 <link>http://pillowcase.fourisland.com/</link>
13 <description>pillowcase - the result of an obsession with cute, plush objects that talk nonsense</description>
14 <language>en-us</language>
15<?php
16
17$getitems = "SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,10";
18$getitems2 = mysql_query($getitems);
19while ($getitems3 = mysql_fetch_array($getitems2))
20{
21?>
22 <item>
23 <title><?php echo($getitems3['title']); ?></title>
24 <link>http://pillowcase.fourisland.com/comic<?php echo($getitems3['comic_id']); ?>.htm</link>
25 <description><![CDATA[<IMG SRC="http://pillowcase.fourisland.com/images/comics/<?php echo($getitems3['filename']); ?> ALT="<?php echo($getitems3['title']); ?>"><p><?php echo($getitems3['text']); ?></p>]]></description>
26 <pubDate><?php echo(date('D, d M Y H:i:s O',strtotime($getitems3['pubDate']))); ?></pubDate>
27 </item>
28<?php
29}
30
31?>
32 </channel>
33</rss>