| version 1.101, 2012/09/28 18:49:48 |
version 1.102, 2012/10/02 08:25:14 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/functions.inc.php,v 1.100 2012-09-28 16:23:20 igor Exp $ */ |
/* $Platon: Metafox/functions.inc.php,v 1.101 2012-09-28 18:49:48 nepto Exp $ */ |
| |
|
| function ezin_eval($evalcode) /* {{{ */ |
function ezin_eval($evalcode) /* {{{ */ |
| { |
{ |
| Line 1340 function ezin_substitute_basic_propertie |
|
| Line 1340 function ezin_substitute_basic_propertie |
|
| { |
{ |
| global $ezin_sys, $ezin_cfg, $ezin_cgi, $ezin_user; |
global $ezin_sys, $ezin_cfg, $ezin_cgi, $ezin_user; |
| |
|
| |
$antispam = ezin_get_antispam(); |
| |
|
| $tmpl_obj->set(array( |
$tmpl_obj->set(array( |
| // Configuration |
// Configuration |
| 'ezin_name' => @$ezin_cfg['name'], |
'ezin_name' => @$ezin_cfg['name'], |
| Line 1358 function ezin_substitute_basic_propertie |
|
| Line 1360 function ezin_substitute_basic_propertie |
|
| 'ezin_time' => sprintf('%.2f', Platon::get_mtime() - @$ezin_sys['time']['start']), |
'ezin_time' => sprintf('%.2f', Platon::get_mtime() - @$ezin_sys['time']['start']), |
| |
|
| // Antispam |
// Antispam |
| 'ezin_antispam_question' => ezin_check_antispam() ? $ezin_cfg['antispam_question'] : '', |
'ezin_antispam_question' => ezin_check_antispam() ? $antispam['question'] : '', |
| 'ezin_antispam_answer' => ezin_check_antispam() ? $ezin_cfg['antispam_answer'] : '', |
'ezin_antispam_answer' => ezin_check_antispam() ? $antispam['answer'] : '', |
| |
|
| // Ezin software |
// Ezin software |
| 'ezin_software_name' => @$ezin_sys['software']['name'], |
'ezin_software_name' => @$ezin_sys['software']['name'], |
| Line 1687 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1689 function ezin_cgi_parse() /* {{{ */ |
|
| } |
} |
| |
|
| $result = true; |
$result = true; |
| if (ezin_check_antispam('M')) { |
if (!ezin_check_antispam('M')) { |
| $ezin_cgi['message_save_antispam_protection'] = 1; |
$ezin_cgi['message_save_antispam_protection'] = 1; |
| $result = false; |
$result = false; |
| } |
} |
| Line 1766 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1768 function ezin_cgi_parse() /* {{{ */ |
|
| $ezin_save_email = Platon::parse_id_param('ezin_save_email', false); |
$ezin_save_email = Platon::parse_id_param('ezin_save_email', false); |
| $ezin_save_author = Platon::parse_id_param('ezin_save_author', false); |
$ezin_save_author = Platon::parse_id_param('ezin_save_author', false); |
| if (! empty($ezin_save_feedback)) { /* {{{ */ |
if (! empty($ezin_save_feedback)) { /* {{{ */ |
| if (ezin_check_antispam('F')) { |
if (!ezin_check_antispam('F')) { |
| $ezin_cgi['feedback_save_antispam_protection'] = 1; |
$ezin_cgi['feedback_save_antispam_protection'] = 1; |
| $ezin_cgi['feedback_save_error'] = 1; |
$ezin_cgi['feedback_save_error'] = 1; |
| } else { |
} else { |
| Line 1790 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1792 function ezin_cgi_parse() /* {{{ */ |
|
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| if (! empty($ezin_save_email)) { /* {{{ */ |
if (! empty($ezin_save_email)) { /* {{{ */ |
| if (ezin_check_antispam('N')) { |
if (!ezin_check_antispam('N')) { |
| $ezin_cgi['email_save_antispam_protection'] = 1; |
$ezin_cgi['email_save_antispam_protection'] = 1; |
| $ezin_cgi['email_save_error'] = 1; |
$ezin_cgi['email_save_error'] = 1; |
| } else { |
} else { |
| Line 1805 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1807 function ezin_cgi_parse() /* {{{ */ |
|
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| if (! empty($ezin_save_author) && $ezin_cfg['user_create_role_id'] > 0) { /* {{{ */ |
if (! empty($ezin_save_author) && $ezin_cfg['user_create_role_id'] > 0) { /* {{{ */ |
| if (ezin_check_antispam('A')) { |
if (!ezin_check_antispam('A')) { |
| $ezin_cgi['author_save_antispam_protection'] = 1; |
$ezin_cgi['author_save_antispam_protection'] = 1; |
| $ezin_cgi['author_save_error'] = 1; |
$ezin_cgi['author_save_error'] = 1; |
| } else { |
} else { |
| Line 1943 function ezin_check_antispam($flag = '') |
|
| Line 1945 function ezin_check_antispam($flag = '') |
|
| global $ezin_cfg, $ezin_cgi; |
global $ezin_cfg, $ezin_cgi; |
| if (strlen($flag) > 0) { |
if (strlen($flag) > 0) { |
| /* we have flag, so we are going to check answer */ |
/* we have flag, so we are going to check answer */ |
| |
$antispam = ezin_get_antispam(); |
| return (stristr($ezin_cfg['antispam_flags'], $flag) != false |
return (stristr($ezin_cfg['antispam_flags'], $flag) != false |
| && strlen(trim($ezin_cfg['antispam_answer'])) > 0 |
&& $antispam['correct_answer']); |
| && strcasecmp(trim($ezin_cfg['antispam_answer']), trim($_REQUEST['ezin_antispam']))); |
|
| } |
} |
| /* we do not have any flag */ |
/* we do not have any flag */ |
| switch ($ezin_cgi['output']) { |
switch ($ezin_cgi['output']) { |
| Line 1961 function ezin_check_antispam($flag = '') |
|
| Line 1963 function ezin_check_antispam($flag = '') |
|
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function ezin_get_antispam() { |
| |
global $ezin_cfg; |
| |
global $ezin_runtime_cache; |
| |
if (!is_null($ezin_runtime_cache['ezin_get_antispam'])) { |
| |
return $ezin_runtime_cache['ezin_get_antispam']; |
| |
} echo '[antispam]'; |
| |
$ret = array(); |
| |
switch($ezin_cfg['antispam_type']) { |
| |
case 'rotate': |
| |
require_once 'libpub/RotateAntispam/RotateAntispam.php'; |
| |
$opts = array( |
| |
'debug' => false, |
| |
'submit_name' => 'ezin_save_feedback', |
| |
'answer_name' => 'ezin_antispam_answer', |
| |
'image' => 'libpub/RotateAntispam/images/obrazok.png', |
| |
'url' => $ezin_cfg['url'].'libpub/RotateAntispam/RotateAntispam.php' |
| |
); |
| |
$antispam = new RotateAntispam($opts); |
| |
$ret['correct_answer'] = $antispam->correctAnswer(); echo $antispam->getLog(); |
| |
$antispam = new RotateAntispam($opts); |
| |
$ret['question'] = '<script type="text/javascript" src="'.$ezin_cfg['url'].'libpub/RotateAntispam/raphael-min.js"></script>' |
| |
.$antispam->getAntispamHtml(); |
| |
$ret['answer'] = '*****'; |
| |
break; |
| |
case 'default': |
| |
default: |
| |
$ret['question'] = $ezin_cfg['antispam_question']; |
| |
$ret['answer'] = $ezin_cfg['antispam_answer']; |
| |
$ret['correct_answer'] = (bool)(strlen(trim($ezin_cfg['antispam_answer'])) > 0 |
| |
&& strcasecmp(trim($ezin_cfg['antispam_answer']), trim($_REQUEST['ezin_antispam'])) == 0); |
| |
break; |
| |
} |
| |
$ezin_runtime_cache['ezin_get_antispam'] = $ret; |
| |
return $ret; |
| |
} |
| |
|
| /* |
/* |
| * dir_app - directory application related functions |
* dir_app - directory application related functions |
| */ |
*/ |