From 5ecbb51bf70a17449e05ef117e288d7c8a5797d6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 10 Jun 2012 18:45:29 +0200 Subject: [PATCH] captcha configurable --- htdocs/application/config/stikked.php | 6 ++++-- htdocs/application/controllers/main.php | 12 ++++++++++-- htdocs/application/views/defaults/paste_form.php | 6 ++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/application/config/stikked.php b/htdocs/application/config/stikked.php index 455eb3f..be3c0fc 100755 --- a/htdocs/application/config/stikked.php +++ b/htdocs/application/config/stikked.php @@ -64,12 +64,14 @@ $config['backup_pass'] = ''; $config['per_page'] = 10; /** - * Disable public pastes + * Anti spam * - * No recent pastes will be displayed. + * private_only: No recent pastes will be displayed. + * enable_captcha: Users must enter a captcha to post. * **/ $config['private_only'] = false; +$config['enable_captcha'] = false; /** * Default language diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index 5bc8e58..9c25ff6 100755 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -424,8 +424,16 @@ class Main extends CI_Controller function _valid_captcha($text) { - $this->form_validation->set_message('_valid_captcha', 'The Captcha is incorrect'); - return $text == $this->db_session->userdata('captcha'); + + if ($this->config->item('enable_captcha')) + { + $this->form_validation->set_message('_valid_captcha', 'The Captcha is incorrect.'); + return $text == $this->db_session->userdata('captcha'); + } + else + { + return true; + } } function get_cm_js() diff --git a/htdocs/application/views/defaults/paste_form.php b/htdocs/application/views/defaults/paste_form.php index d61f97e..d8a5e50 100644 --- a/htdocs/application/views/defaults/paste_form.php +++ b/htdocs/application/views/defaults/paste_form.php @@ -98,10 +98,11 @@ - + - + +config->item('enable_captcha')){ ?>
+