Project

General

Profile

« Previous | Next » 

Revision 628

Added by thorn almost 17 years ago

Text-CAPTCHA: added description how to input questions and answers.

View differences:

trunk/wb/include/captcha/captchas/text.php
26 26
// Must include code to stop this file being accessed directly
27 27
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
28 28

  
29
global $admin;
29 30
$name = 'text';
30 31
$file = WB_PATH."/temp/.captcha_$name.txt";
31 32

  
......
44 45
while($s = current($content)) {
45 46
	// get question
46 47
	$s=trim(rtrim(rtrim($s,"\n"),"\r")); // remove newline
48
	$s=$admin->strip_slashes($s);
47 49
	if($s=='' OR $s{0}!='?') {
48 50
		next($content);
49 51
		continue;
......
58 60
	// get answer
59 61
	$s=next($content);
60 62
	$s=trim(rtrim(rtrim($s,"\n"),"\r")); // remove newline
63
	$s=$admin->strip_slashes($s);
61 64
	if(isset($s{0}) && $s{0}!='!') continue;
62 65
	$a=substr($s,1);
63 66
	$qa[$lang][$q]=$a;
......
87 90

  
88 91
echo $k;
89 92

  
90
?>
93
?>
trunk/wb/modules/captcha_control/tool.php
53 53

  
54 54
	// save text-captchas
55 55
	if($_POST['captcha_type'] == 'text') {
56
		$text_qa=$admin->add_slashes($_POST['text_qa']);
57
		if($fh = fopen(WB_PATH.'/temp/.captcha_text.txt', 'wb')) {
58
			fwrite($fh, $text_qa);
59
			fclose($fh);
56
		$text_qa=$_POST['text_qa'];
57
		if(strpos($text_qa, '### example ###') === FALSE) {
58
			$text_qa=$admin->add_slashes($text_qa);
59
			if($fh = fopen(WB_PATH.'/temp/.captcha_text.txt', 'wb')) {
60
				fwrite($fh, $text_qa);
61
				fclose($fh);
62
			}
60 63
		}
61 64
	}
62 65
	
......
82 85
			}
83 86
		}
84 87
	}
88
	if($text_qa == '')
89
		$text_qa = $MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'];
85 90

  
86 91
// script to load image
87 92
?>
trunk/wb/modules/captcha_control/languages/EN.php
47 47
$MOD_CAPTCHA_CONTROL['OLD_IMAGE']         = 'Old style (not recommended)';
48 48
$MOD_CAPTCHA_CONTROL['TEXT']              = 'Text-CAPTCHA';
49 49
$MOD_CAPTCHA_CONTROL['CAPTCHA_ENTER_TEXT']= 'Questions and Answers';
50
$MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'] = "Delete this all to add your own entries\nor your changes won't be saved!\n### example ###\nHere you can enter Questions and Answers.\nUse:\n?What's <b>Claudia</b> Schiffer's <b>first name</b>?\n!Claudia\n\n?Question 2\n!Answer 2\n...\nif language doesn't matter.\n\nOr, if language do matter, use:\n?EN:What's <b>Claudia</b> Schiffer's <b>first name</b>?\n!Claudia\n\n?EN:Question 2\n!Answer 2\n\n?DE:Wie ist der <b>Vorname</b> von <b>Claudia</b> Schiffer?\n!Claudia\n...\n### example ###\n";
50 51

  
51 52
$MOD_CAPTCHA['VERIFICATION']           = 'Verification';
52 53
$MOD_CAPTCHA['ADDITION']               = 'add';
trunk/wb/modules/captcha_control/languages/DE.php
50 50
$MOD_CAPTCHA_CONTROL['OLD_IMAGE']         = 'Alter Stil (nicht empfohlen)';
51 51
$MOD_CAPTCHA_CONTROL['TEXT']              = 'Text-CAPTCHA';
52 52
$MOD_CAPTCHA_CONTROL['CAPTCHA_ENTER_TEXT']= 'Fragen und Antworten';
53
$MOD_CAPTCHA_CONTROL['CAPTCHA_TEXT_DESC'] = "Bitte hier alles l&ouml;schen\nsonst werden Ihre &Auml;nderungen nicht gespeichert!\n### Beispiel ###\nHier k&ouml;nnen sie Fragen und Antworten eingeben.\nEntweder:\n?Wie ist der <b>Vorname</b> von <b>Claudia</b> Schiffer?\n!Claudia\n\n?Frage 2\n!Antwort 2\n...\nwenn die Benutzte Sprache egal ist.\n\nOder, wenn die Sprache relevant ist:\n?EN:What's <b>Claudia</b> Schiffer's <b>first name</b>?\n!Claudia\n\n?EN:Question 2\n!Answer 2\n\n?DE:Wie ist der <b>Vorname</b> von <b>Claudia</b> Schiffer?\n!Claudia\n...\n### example ###\n";
53 54

  
54 55
$MOD_CAPTCHA['VERIFICATION']           = 'Pr&uuml;fziffer';
55 56
$MOD_CAPTCHA['ADDITION']               = 'plus';

Also available in: Unified diff