X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=cms.php;h=961a1f5ce7265b3cbb59a973151c14be1197df30;hb=7c68050a90dac5eec6b27f895deb9aeabf49cd47;hp=caa22a11a318d990717318d3804bdd49f1bcb3fe;hpb=16f255160412aa91e0de89ecb6724daf3ebcaca8;p=dylansserver.git diff --git a/cms.php b/cms.php index caa22a1..961a1f5 100644 --- a/cms.php +++ b/cms.php @@ -6,7 +6,6 @@ abstract class cms { protected $db; protected $recaptcha_publickey; protected $recaptcha_privatekey; - protected $scripts; public $title; public $home_link; @@ -70,63 +69,6 @@ abstract class cms { } $statement->free_result(); return $return; - } - - public function display_head($title = "dylansserver", - $home_link = "/") { - $scripts = $this->scripts; - $stylesheets = ""; - $home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylansserver.com&ucn_task=conformance#"; - echo << - - - - - - - $this->title - - $stylesheets - $scripts - - - -
- - -
-END_OF_HEAD; - } - - public function display_contact() { - echo <<

dylan

@psu.edu -
-END_OF_CONTACT; - } - - public function display_close($show_contact = true) { - if ($show_contact) { - $this->display_contact(); - } - echo << -
-
-
- - -END_OF_CLOSE; - ob_flush(); } public function init() { @@ -168,61 +110,7 @@ END_OF_CLOSE; class index extends cms { public function display() { - $this->scripts = ""; - $this->display_head(); - $this->display_exhibits(); - echo ""; - $this->display_close($show_contact = false); + require_once("view/index.php"); } protected function display_exhibits() { @@ -236,11 +124,6 @@ OTHER_PROJECTS; } private function list_projects() { - echo << -

my projects:

- -HEREDOC; $sql = "SELECT title FROM projects ORDER BY rank"; $result = $this->db->query($sql); while ($entry = $result->fetch_object()) { @@ -280,24 +163,6 @@ class page extends cms { public function __construct() { parent::__construct(); $this->page_offset(); - $this->scripts = " - - - - - - "; } private function page_offset() { @@ -320,7 +185,10 @@ class page extends cms { } public function display() { - $this->display_head(); + require_once("view/page.php"); + } + + public function display_notes() { echo "
"; $sql = "SELECT date_posted, title, url, text FROM notes ORDER BY date_posted DESC @@ -347,25 +215,7 @@ class page extends cms { END_NOTE; } echo "
"; - $this->write_navigation(); - $this->display_close(); } - - private function write_navigation() { - echo ""; - } - } @@ -383,30 +233,6 @@ class note extends cms { public $number_of_comments; public function __construct() { - $this->scripts = " - - - - - - "; - - if (isset($_GET['comments'])) { - $this->scripts .= " - - "; - } parent::__construct(); if (isset($_GET['comments'])) { $this->comments_enabled = true; @@ -500,84 +326,17 @@ class note extends cms { $author = $entry['author']; $text = htmlspecialchars($entry['text']); $head = "

" . htmlspecialchars($author) . "

"; - echo << - $head - $text - -END_OF_COMMENT; + echo "
"; + echo $head; + echo $text; + echo "
"; } echo ""; } private function display_comment_form() { $publickey = $this->recaptcha_publickey; - echo << -Recaptcha.create("$publickey", - "recaptcha_div", - { - theme : 'custom', - custom_theme_widget: 'recaptcha_widget', - callback: Recaptcha.focus_response_field - }); - -END_CAPTCHA_STYLE; - require_once('includes/recaptchalib.php'); - $url = $this->url . "verify"; - echo "
"; - echo << -

comment:

- -

name:

- - - -
-
-

what's this say?

-
-
-


-


- -

-

enter the numbers you hear:

- - another? / - audio? / - image?help? - -
-END_OF_FORM; - echo recaptcha_get_html($this->recaptcha_publickey); - if ($this->failed_captcha) { - echo << - reCAPTCHA said you're not human,
- try again? - - - - -END_OF_ERRORS; - } else { - echo << - reCAPTCHA said you're not human,
- try again? - -
- but you didn't write anything!
-
-END_OF_ERRORS; - } - echo << - - -END_OF_FORM; + require_once("view/comment-form.php"); } } @@ -598,7 +357,10 @@ class archive extends cms { } public function display() { - $this->display_head(); + require_once("view/archive.php"); + } + + public function display_notes() { switch (true) { case (isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])): @@ -647,38 +409,26 @@ class archive extends cms { echo ""; } echo ""; - $this->write_navigation(); } else { echo "
"; echo "

sorry, nothing here

"; echo "
Empty set (0.00 sec)
"; } - $this->display_close(); - } - - private function write_navigation() { - echo "
"; - echo ""; } } class rss extends cms { + public function display() { + require_once("view/rss.php"); + } + + public function display_items() { $result = $this->db->query("SELECT date_posted, title, text, url FROM notes ORDER BY date_posted DESC LIMIT 5"); - echo << - - dylansserver.com/notes/rss - http://dylansserver.com/notes - dylansserver.com/notes/rss - -END_OF_ENTRY; while ($entry = $result->fetch_object()) { $title = $entry->title; $date_posted = $entry->date_posted; @@ -694,18 +444,13 @@ END_OF_ENTRY; $description = substr($text, '0', ($end_of_first_sentence + 1)); } } - echo << - $title - $url - $url - $description - -END_OF_ENTRY; + echo ""; + echo " $title"; + echo " $url"; + echo " $url"; + echo " $description"; + echo ""; } - echo ""; - echo ""; - } }