X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;ds=inline;f=index.php;h=f1b2cc1e76b57f2cce5be88fc578e2fcff7745b8;hb=5ce1eece3bc1c171e6923f8864122a6cbd0d093b;hp=c2fb0789087819c79a1e04db6b4dbe7f08b9e63b;hpb=f4e95bddee9079e56f5ffbfe8ede9875b0d7bd49;p=dylansserver.git
diff --git a/index.php b/index.php
index c2fb078..f1b2cc1 100644
--- a/index.php
+++ b/index.php
@@ -40,7 +40,9 @@ abstract class cms {
return 'index';
} else if (isset($_GET['project'])) {
return 'project';
- } else if (isset($_GET['challenge'])) {
+ } else if (isset($_GET['rss'])) {
+ return 'rss';
+ } else if (isset($_GET['challenge'])) {
return 'captcha';
}
}
@@ -86,7 +88,7 @@ abstract class cms {
$this->title
-
+
$stylesheets
$scripts
@@ -133,10 +135,10 @@ END_OF_CLOSE;
class index extends cms {
public function display() {
- $this->scripts = "";
+ $this->scripts = "";
$this->display_head();
$this->display_exhibits();
- echo "";
+ echo "list_projects();
echo <<
@@ -168,7 +170,7 @@ class index extends cms {
- here
+ "/notes/">here [rss]
-
@@ -217,7 +219,7 @@ class project extends index {
WHERE title = ?";
$result = $this->query($sql, "s", $_GET['project']);
if ($result = $result[0]['text']) {
- $text = str_replace("class='exhibit'", "class='exhibit' style='display:block;'", $result);
+ $text = str_replace("class='exhibit'", "class='exhibit'", $result);
echo $text;
echo "";
} else {
@@ -276,10 +278,15 @@ class page extends cms {
$month_posted = $date_posted[1];
$datetime_posted = explode(' ', $date_posted[2]);
$day_posted = $datetime_posted[0];
- echo "";
- echo "
$year_posted/$month_posted/$day_posted/$title
";
- echo $entry['text'];
- echo "
";
+ $text = $entry['text'];
+ echo <<
+
+ $year_posted/$month_posted/$day_posted/$title
+
+ $text
+
+END_NOTE;
}
echo "";
$this->write_navigation();
@@ -288,7 +295,7 @@ class page extends cms {
private function write_navigation() {
echo "";
- echo "
";
+ echo "";
if($this->page > 1){
$previous_page = $this->page - 1;
echo "prev";
@@ -297,7 +304,7 @@ class page extends cms {
$forward_page = $this->page + 1;
echo " next";
}
- echo "
";
+ echo "";
echo "
";
}
@@ -401,7 +408,7 @@ class note extends cms {
private function display_note() {
echo <<
- $this->year_posted/$this->month_posted/$this->day_posted/$this->title
+ $this->year_posted/$this->month_posted/$this->day_posted/$this->title
$this->text
END_OF_NOTE;
@@ -409,16 +416,16 @@ END_OF_NOTE;
private function write_navigation() {
echo <<
+
-
+
END_OF_NAVIGATION;
if (!$this->comments_enabled) {
$this->display_comment_link();
}
echo <<back to notes/
-
+
END_OF_NAVIGATION;
}
@@ -483,20 +490,20 @@ END_CAPTCHA_STYLE;
END_OF_FORM;
echo recaptcha_get_html($this->recaptcha_publickey);
@@ -588,9 +595,9 @@ class archive extends cms {
$datetime_posted = explode(' ', $date_posted[2]);
$day_posted = $datetime_posted[0];
echo "";
- echo "
";
+ echo "";
echo "$year_posted/$month_posted/$day_posted/";
- echo "$title
";
+ echo "
$title";
echo $entry['text'];
echo "
";
}
@@ -598,7 +605,7 @@ class archive extends cms {
$this->write_navigation();
} else {
echo "
";
- echo "sorry, nothing here
";
+ echo "sorry, nothing here";
echo "Empty set (0.00 sec)
";
}
$this->display_close();
@@ -607,15 +614,57 @@ class archive extends cms {
private function write_navigation() {
echo "
";
echo "
";
- echo "
";
// fill me in!
- echo "
";
echo "";
}
}
+class rss extends cms {
+ public function display() {
+ $result = $this->db->query("SELECT date_posted, title, text, url
+ FROM notes ORDER BY date_posted DESC
+ LIMIT 5");
+ echo <<
+
+ dylanstestserver.com/notes/rss
+ http://dylanstestserver.com/notes
+ dylanstestserver.com/notes/rss
+
+END_OF_ENTRY;
+ while ($entry = $result->fetch_object()) {
+ $title = $entry->title;
+ $date_posted = $entry->date_posted;
+ $url = "http://dylanstestserver.com/note/" . $entry->url;
+ $text = $entry->text;
+ $text = strip_tags($text);
+ $end_of_first_sentence = strpos($text, '.');
+ if ($end_of_first_sentence) {
+ $end_of_second_sentence = strpos($text, '.', ($end_of_first_sentence + 1));
+ if ($end_of_second_sentence) {
+ $description = substr($text, '0', ($end_of_second_sentence + 1));
+ } else {
+ $description = substr($text, '0', ($end_of_first_sentence + 1));
+ }
+ }
+ echo <<
+ $title
+ $url
+ $url
+ $description
+
+END_OF_ENTRY;
+ }
+ echo "";
+ echo "";
+
+ }
+}
+
+
class notFound extends Exception {
public function __construct() {
@@ -662,10 +711,13 @@ switch (cms::determine_type()) {
$page = new page;
$page->display();
break;
+ case "rss":
+ $rss = new rss();
+ $rss->display();
case 'archive':
$archive = new archive;
- $archive->display();
- break;
+ $archive->display();
+ break;
case "captcha":
$captcha = new captcha;
$captcha->display();