";
- echo "
$year_posted/$month_posted/$day_posted/$title
";
- if (!$this->comments_enabled) {
- $this->display_comment_link();
- }
- echo $entry['text'];
+ echo "
$this->year_posted/$this->month_posted/$this->day_posted/$this->title
";
+ echo $this->text;
}
private function write_navigation() {
- echo "
";
- echo "
";
- echo "
";
- echo "notes/";
- echo "
";
- echo "
";
+ echo <<
+
+
+END_OF_NAVIGATION;
+ if ($this->failed_captcha) {
+ echo "sorry, reCAPTCHA said you're not human.
";
+ }
+ if (!$this->comments_enabled) {
+ $this->display_comment_link();
+ }
+ echo <<notes/
+
+
+END_OF_NAVIGATION;
}
private function display_comment_link() {
- $url = $this->url . 'comments/';
- echo "";
+ if ($this->number_of_comments > 0) {
+ $anchor_text = "comments ($this->number_of_comments)";
+ } else {
+ $anchor_text = "comment?";
+ }
+ if (substr($this->url, (strlen($this->url)-1), strlen($this->url)) == '/') {
+ $url = $this->url . 'comments/';
+ } else {
+ $url = $this->url . '/comments/';
+ }
+ echo "";
}
private function display_comments() {
echo "";
}
private function display_comment_form() {
- // Trailing slash is necessary for reloads to work
- $url = $this->url . "verify/";
- echo "";
+ // Trailing slash is necessary for reloads to work
+ $url = $this->url . "verify";
+ echo "
+
+END_OF_FORM;
}
}
@@ -504,6 +597,19 @@ class notFound extends Exception {
}
}
+class captcha extends cms {
+ public function display() {
+ $challenge = $_GET['challenge'];
+ $response = $_GET['response'];
+ $remoteip = $_SERVER['REMOTE_ADDR'];
+ $curl = curl_init('http://api-verify.recaptcha.net/verify?');
+ curl_setopt ($curl, CURLOPT_POST, 4);
+ curl_setopt ($curl, CURLOPT_POSTFIELDS, "privatekey=$this->recaptcha_privatekey&remoteip=$remoteip&challenge=$challenge&response=$response");
+ $result = curl_exec ($curl);
+ curl_close ($curl);
+ }
+}
+
## now actually do something:
switch (cms::determine_type()) {
case "index":
@@ -530,6 +636,10 @@ switch (cms::determine_type()) {
$archive = new archive;
$archive->display();
break;
+ case "captcha":
+ $captcha = new captcha;
+ $captcha->display();
+ break;
}
?>