captcha configurable

This commit is contained in:
Claude 2012-06-10 18:45:29 +02:00
parent f533a3d292
commit 5ecbb51bf7
3 changed files with 18 additions and 6 deletions

View File

@ -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

View File

@ -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()

View File

@ -98,10 +98,11 @@
</div>
</div>
<?php if($reply){?>
<?php if($reply){ ?>
<input type="hidden" value="<?php echo $reply; ?>" name="reply" />
<?php }?>
<?php } ?>
<?php if($this->config->item('enable_captcha')){ ?>
<div class="item_group">
<div class="item item_captcha">
<label for="captcha">Spam Protection
@ -111,6 +112,7 @@
<input value="<?php if(isset($captcha_set)){ echo $captcha_set; }?>" type="text" id="captcha" name="captcha" tabindex="2" maxlength="32" />
</div>
</div>
<?php } ?>
<div><button type="submit" value="submit" name="submit">Create</button></div>
<div class="spacer"></div>