changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / spam / antibot_captcha.php
1 <?php
2 /*
3    Graphical captchas help against automated bot attacks. This is almost
4    as user-frustrating as forced account registrations, but can be half
5    disabled after the first successful check.
6    
7    It will embed the to-solve test directly into the .html page by using
8    a data:-URI for the image. This will disturb MSIE, but a workaround is
9    embeded.
10 */
11
12
13 #-- show <checkbox>
14 $ewiki_plugins["edit_form_append"][] = "ewiki_aedit_antibot_checkbox";
15 function ewiki_aedit_antibot_checkbox($id, &$data, $action) {
16    if (!$GLOBALS["ewiki_no_bot"]) {
17       include_once("plugins/lib/captcha.php");
18       return captcha::form();
19    }
20 }
21
22 #-- reject if not checked
23 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_antibot_checkbox";
24 function ewiki_edit_save_antibot_checkbox(&$save, &$data) {
25    global $ewiki_errmsg;
26
27    if (!$GLOBALS["ewiki_no_bot"]) {
28       include_once("plugins/lib/captcha.php");
29       if (!captcha::check()) {
30          $save = NULL;
31          $ewiki_errmsg = "Access Forbidden. You did not successfully pass the captcha.";
32       }
33       else {
34          $GLOBALS["ewiki_no_bot"] = 1;
35       }
36    }
37 }
38
39 ?>