Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
420 florian 1
<?php
2
 
3
define('HASHCASH_FORM_ACTION', 'wp-comments-post.php');
4
define('HASHCASH_SECRET_FILE', realpath(dirname(__FILE__) . '/') . '/wp-hashcash.key');
5
define('HASHCASH_FORM_ID', 'ACEditor');
6
define('HASHCASH_FORM_CLASS', 'page');
7
define('HASHCASH_REFRESH', 60*60*4);
8
define('HASHCASH_IP_EXPIRE', 60*60*24*7);
9
define('HASHCASH_VERSION', 3.2);
10
 
11
// Produce random unique strings
12
function hashcash_random_string($l, $exclude = array()) {
13
	// Sanity check
14
	if($l < 1){
15
		return '';
16
	}
17
 
18
	$str = '';
19
	while(in_array($str, $exclude) || strlen($str) < $l){
20
		$str = '';
21
		while(strlen($str) < $l){
22
			$str .= chr(rand(65, 90) + rand(0, 1) * 32);
23
		}
24
	}
25
 
26
	return $str;
27
}
28
 
29
// looks up the secret key
30
function hashcash_field_value(){
31
	if(function_exists('file_get_contents')){
32
		return file_get_contents(HASHCASH_SECRET_FILE);
33
	} else {
34
		$fp = fopen(HASHCASH_SECRET_FILE, 'r');
35
		$data = fread($fp, @filesize(HASHCASH_SECRET_FILE));
36
		fclose($fp);
37
		return $data;
38
	}
39
}
40
 
41
// Returns a phrase representing the product
42
function hashcash_verbage(){
43
 
44
	$phrase = 'Protection anti-spam active';
45
 
46
	return $phrase;
47
}
48
 
49
?>