summaryrefslogtreecommitdiff
path: root/modules/recaptcha
diff options
context:
space:
mode:
Diffstat (limited to 'modules/recaptcha')
-rw-r--r--modules/recaptcha/controllers/admin_recaptcha.php8
-rw-r--r--modules/recaptcha/helpers/recaptcha_installer.php2
-rw-r--r--modules/recaptcha/libraries/Form_Recaptcha.php17
-rw-r--r--modules/recaptcha/module.info2
-rw-r--r--modules/recaptcha/views/form_recaptcha.html.php12
5 files changed, 19 insertions, 22 deletions
diff --git a/modules/recaptcha/controllers/admin_recaptcha.php b/modules/recaptcha/controllers/admin_recaptcha.php
index a8f85ed9..5813df8b 100644
--- a/modules/recaptcha/controllers/admin_recaptcha.php
+++ b/modules/recaptcha/controllers/admin_recaptcha.php
@@ -21,6 +21,8 @@ class Admin_Recaptcha_Controller extends Admin_Controller {
public function index() {
$form = recaptcha::get_configure_form();
if (request::method() == "post") {
+ // @todo move the "save" part of this into a separate controller function
+ access::verify_csrf();
$old_public_key = module::get_var("recaptcha", "public_key");
$old_private_key = module::get_var("recaptcha", "private_key");
if ($form->validate()) {
@@ -55,10 +57,4 @@ class Admin_Recaptcha_Controller extends Admin_Controller {
$view->content->form = $form;
print $view;
}
-
- public function test() {
- $view = new View("admin_recaptcha_test.html");
- $view->public_key = module::get_var("recaptcha", "public_key");
- print $view;
- }
}
diff --git a/modules/recaptcha/helpers/recaptcha_installer.php b/modules/recaptcha/helpers/recaptcha_installer.php
index 6269c632..f74bf558 100644
--- a/modules/recaptcha/helpers/recaptcha_installer.php
+++ b/modules/recaptcha/helpers/recaptcha_installer.php
@@ -29,7 +29,7 @@ class recaptcha_installer {
recaptcha::check_config();
}
- static function uninstall() {
+ static function deactivate() {
site_status::clear("recaptcha_config");
}
}
diff --git a/modules/recaptcha/libraries/Form_Recaptcha.php b/modules/recaptcha/libraries/Form_Recaptcha.php
index d804fd78..4c0c4997 100644
--- a/modules/recaptcha/libraries/Form_Recaptcha.php
+++ b/modules/recaptcha/libraries/Form_Recaptcha.php
@@ -39,20 +39,9 @@ class Form_Recaptcha_Core extends Form_Input {
"http://recaptcha.net/api/getkey</a>");
}
- $server = "http://api.recaptcha.net";
-
- $options[] = "callback: Recaptcha.focus_response_field";
- $options[] = "lang: \"" . Kohana::config("locale.root_locale") . "\"";
- $options[] = "theme: \"white\"";
- $options = implode(", ", $options);
-
- $html = "<div id=\"gRecaptcha\" />";
- $html .= "<script type=\"text/javascript\" ";
- $html .= "src=\"http://api.recaptcha.net/js/recaptcha_ajax.js\"></script>";
- $html .= "<script type=\"text/javascript\">";
- $html .= "Recaptcha.create(\"$public_key\", \"gRecaptcha\", {" . $options . "});";
- $html .= "</script>";
- return $html;
+ $view = new View("form_recaptcha.html");
+ $view->public_key = $public_key;
+ return $view;
}
/**
diff --git a/modules/recaptcha/module.info b/modules/recaptcha/module.info
index 134ae31c..85397580 100644
--- a/modules/recaptcha/module.info
+++ b/modules/recaptcha/module.info
@@ -1,3 +1,3 @@
name = Recaptcha
-description = "<a href="http://recaptcha.net">Recaptcha</a> displays a graphical verification that protects the input form from abuse from "bots," or automated programs usually written to generate spam."
+description = "<a href='http://recaptcha.net'>Recaptcha</a> displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam."
version = 1
diff --git a/modules/recaptcha/views/form_recaptcha.html.php b/modules/recaptcha/views/form_recaptcha.html.php
new file mode 100644
index 00000000..abdf8428
--- /dev/null
+++ b/modules/recaptcha/views/form_recaptcha.html.php
@@ -0,0 +1,12 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gRecaptcha"></div>
+<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
+<script type="text/javascript">
+ setTimeout(function() {
+ Recaptcha.create(
+ "<?= $public_key ?>",
+ "gRecaptcha",
+ { theme: "white", callback: Recaptcha.focus_response_field });
+ }, 0);
+</script>
+