--- uniwakka/handlers/page/edit.php	2006-02-07 09:29:16.000000000 -0800
+++ /var/www/html/wiki/handlers/page/edit.php	2006-05-07 21:14:06.000000000 -0700
@@ -33,6 +33,18 @@
 <?php
 //aspell -l --dict-dir=/home/andrear/dict --local-data-dir=/home/andrear/dict -d it -B
 
+if (!function_exists("gen_antispam")) {
+   function gen_antispam() {
+	global $wakka;
+  	return '<div id="antispam">Type "'.$wakka->GetConfigValue("antispam_word").
+		'" here: <input type="text" name="antispam" id="antispamword" value="" /></div>'.
+		'<script type="text/javascript"><![CDATA[
+		document.getElementById("antispamword").value="'.$wakka->GetConfigValue("antispam_word").'";
+		document.getElementById("antispam").style.display="none";
+		]]></script>
+		';
+   }
+}
 
 if ($this->HasAccess("write") && $this->HasAccess("read")  && !preg_match("/^Comment[0-9]+$/", $this->tag) && ($this->GetUser()|| $this->GetConfigValue("private") <> 1))
 {
@@ -64,6 +76,11 @@
 		// only if saving:
 		if ($_POST["submit"] == "Store")
 		{
+			if ($_POST["antispam"] != $this->GetConfigValue("antispam_word")) {
+			  	$_POST["submit"] = "";
+				$error="SPAM Verification Failed";
+			}
+
 			// check for overwriting
 			if ($this->page)
 			{
@@ -157,8 +174,7 @@
 		$output .=
 			$this->FormOpen("edit")."\n".
 			"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
-			"<textarea rows=\"40\" cols=\"60\" name=\"body\" style=\"display:none;\">".$this->valid_xml($this->str2ascii($body))."</textarea>\n";
-
+			"<textarea rows=\"40\" cols=\"60\" name=\"body\" style=\"display:none;\">".$this->valid_xml($this->str2ascii($body))."</textarea>\n".gen_antispam();
 		
 		$output .=
 			"<br />\n".
@@ -204,7 +220,7 @@
 		$output .=
 			$this->FormOpen("edit")."\n".
 			"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
-			"<textarea rows=\"40\" cols=\"60\" name=\"body\" style=\"display:none;\">".$this->valid_xml($this->str2ascii($body))."</textarea>\n";
+			"<textarea rows=\"40\" cols=\"60\" name=\"body\" style=\"display:none;\">".$this->valid_xml($this->str2ascii($body))."</textarea>\n".gen_antispam();
 
 		$output .=
 			 "<br />\n".
@@ -228,7 +244,7 @@
 
 		$output .= $this->FormOpen("edit").
 		"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
-			"<textarea rows=\"40\" cols=\"60\" onkeydown=\"fKeyDown()\" onkeypress=\"return fKeyPress(event)\" name=\"body\" style=\"width: 100%; height: 400px\">".$this->valid_xml($this->str2utf8($body))."</textarea><br />\n".
+			"<textarea rows=\"40\" cols=\"60\" onkeydown=\"fKeyDown()\" onkeypress=\"return fKeyPress(event)\" name=\"body\" style=\"width: 100%; height: 400px\">".$this->valid_xml($this->str2utf8($body))."</textarea><br />\n".gen_antispam().
 			"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" />";
 		if ($this->Getconfigvalue("aspell")) {
 			$output .=  "<input name=\"submit\" type=\"submit\" value=\"SpellCheck\" accesskey=\"s\" />";
