| version 1.136, 2016/01/15 17:26:58 |
version 1.137, 2016/03/07 14:45:34 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/functions.inc.php,v 1.135 2015/11/24 17:21:05 igor Exp $ */ |
/* $Platon: Metafox/functions.inc.php,v 1.136 2016/01/15 17:26:58 igor Exp $ */ |
| |
|
| function ezin_eval($evalcode) /* {{{ */ |
function ezin_eval($evalcode) /* {{{ */ |
| { |
{ |
| Line 2133 function ezin_get_antispam() { |
|
| Line 2133 function ezin_get_antispam() { |
|
| $ret['answer'] = $ezin_cfg['antispam_answer']; |
$ret['answer'] = $ezin_cfg['antispam_answer']; |
| $ret['correct_answer'] = (bool)(strlen($_REQUEST['ezin_antispam']) == 0); |
$ret['correct_answer'] = (bool)(strlen($_REQUEST['ezin_antispam']) == 0); |
| break; |
break; |
| |
case 'timetoken': |
| |
$ret['question'] = ezin_timetoken_generate(); |
| |
$ret['answer'] = '*****'; |
| |
$ret['correct_answer'] = ezin_timetoken_check($_REQUEST['ezin_antispam']); |
| |
break; |
| case 'default': |
case 'default': |
| default: |
default: |
| $ret['question'] = $ezin_cfg['antispam_question']; |
$ret['question'] = $ezin_cfg['antispam_question']; |
| Line 2145 function ezin_get_antispam() { |
|
| Line 2150 function ezin_get_antispam() { |
|
| return $ret; |
return $ret; |
| } |
} |
| |
|
| |
function ezin_timetoken_generate() { |
| |
$trans = array( |
| |
'0' => 'a', |
| |
'1' => 'b', |
| |
'2' => 'c', |
| |
'3' => 'd', |
| |
'4' => 'e', |
| |
'5' => 'f', |
| |
'6' => 'g', |
| |
'7' => 'h', |
| |
'8' => 'i', |
| |
'9' => 'j' |
| |
); |
| |
$str = (string)Time(); |
| |
$str_trans = ''; |
| |
for ($i = 0; $i < strlen($str); $i++) { |
| |
$str_trans .= $trans[substr($str, $i, 1)]; |
| |
} |
| |
$ret = base64_encode($str_trans); |
| |
return $ret; |
| |
} |
| |
|
| |
function ezin_timetoken_check($token) { |
| |
$str_trans = base64_decode($token); |
| |
$trans = array( |
| |
'a' => '0', |
| |
'b' => '1', |
| |
'c' => '2', |
| |
'd' => '3', |
| |
'e' => '4', |
| |
'f' => '5', |
| |
'g' => '6', |
| |
'h' => '7', |
| |
'i' => '8', |
| |
'j' => '9' |
| |
); |
| |
$str = ''; |
| |
for ($i = 0; $i < strlen($str_trans); $i++) { |
| |
$str .= $trans[substr($str_trans, $i, 1)]; |
| |
} |
| |
$time = (int)$str; |
| |
return (strlen($str) > 0 |
| |
&& $time >= (Time() - (30*60)) // 30 minutes |
| |
&& $time <= Time()); |
| |
} |
| |
|
| /* |
/* |
| * dir_app - directory application related functions |
* dir_app - directory application related functions |
| */ |
*/ |