X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=index.php;h=f15b9999abebbea79042c08f43d9a6969f6c8737;hb=1cf5e32bfd56c0704ca9857e5574ddd0f5edd42c;hp=700f69a182a9cb0d81bd7b72821a8dbc57195337;hpb=f870b65ad60d8ea7456384d38f8db6fd01275990;p=dylansserver.git diff --git a/index.php b/index.php index 700f69a..f15b999 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:

+
+ + +
+

what's this say?

+

enter the numbers you hear:

+(another/audio/Get an image CAPTCHAhelp)

+ +

+
+



+
+FORM; + echo recaptcha_get_html($this->recaptcha_publickey); + if (isset($_GET['verify'])) { + $this->verify(); + } + echo << + + +END_OF_FORM; } } @@ -437,7 +581,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":