X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=index.php;h=e743a3897ac6d06e471cf459b41beef527beff4d;hb=8a98916cf3e32d836493c4f1800aea0b25d7b63f;hp=700f69a182a9cb0d81bd7b72821a8dbc57195337;hpb=f870b65ad60d8ea7456384d38f8db6fd01275990;p=dylansserver.git diff --git a/index.php b/index.php index 700f69a..e743a38 100644 --- a/index.php +++ b/index.php @@ -3,19 +3,23 @@ abstract class cms { private $config_file = '/etc/dylanstestserver.ini'; protected $db; + protected $recaptcha_publickey; + protected $recaptcha_privatekey; public function __construct() { - $config = parse_ini_file($this->config_file); + $config = parse_ini_file($this->config_file, true); $this->db = new mysqli( - $config['domain'], - $config['user'], - $config['password'], - $config['database']); + $config[database]['domain'], + $config[database]['user'], + $config[database]['password'], + $config[database]['database']); if (mysqli_connect_errno()) { echo "Problem connecting to database: "; echo mysqli_connect_error(); exit(); } + $this->recaptcha_publickey = $config[recaptcha]['publickey']; + $this->recaptcha_privatekey = $config[recaptcha]['privatekey']; ob_start(); } @@ -62,8 +66,7 @@ abstract class cms { $home_link = "/") { $scripts = ""; $stylesheets = ""; - if (cms::determine_type() == "index") { - $scripts = " +END_CAPTCHA_STYLE; + require_once('includes/recaptchalib.php'); + // Trailing slash is necessary for reloads to work + $url = $this->url . "verify/"; + echo "
"; + echo << + +

comment:


+
+

name:


+
+

email:


+
+ + +
+
+
Incorrect please try again
+ enter the words above: + enter the numbers you hear: +
+ +
another CAPTCHA?
+ + +
help?
+
+
+FORM; + echo recaptcha_get_html($this->recaptcha_publickey); + if (isset($_GET['verify'])) { + $this->verify(); + } + echo << + + +END_OF_FORM; } } @@ -437,7 +570,11 @@ switch (cms::determine_type()) { $project->display(); break; case "note": - $note = new note; + if (isset($_GET['comments'])) { + $note = new note($comments_enabled = true); + } else { + $note = new note; + } $note->display(); break; case "page":