public static function post__answer__by__ajax($tab, $frm) { //-- global $configs; //-- //-- $tmp_data = '<br><br><hr><pre>' . 'GET:' . '<br>' . Smart::escape_html(print_r(SmartFrameworkSecurity::FilterGetPostCookieVars($_GET), 1)) . '<hr>' . 'POST:' . '<br>' . Smart::escape_html(print_r(SmartFrameworkSecurity::FilterGetPostCookieVars($_POST), 1)) . '</pre>'; //-- //-- if (SmartCaptchaFormCheck::verify(self::captcha_form_name(), self::captcha_mode(), false) == 1) { // verify but do not clear yet $captcha_ok = true; } else { $captcha_ok = false; } //end if else //-- //-- if (strlen($frm['date']) > 0) { //-- if ($captcha_ok !== true) { //-- $code = 'ERROR'; $title = 'CAPTCHA verification FAILED ...'; $desc = 'Please enter a valid captcha value:' . $tmp_data; $redir = ''; $div_id = ''; $div_htm = ''; //-- } else { //-- $code = 'OK'; $title = 'Captcha validation OK ... The page or just the Captcha will be refreshed depending if TextArea is filled or not ...'; $desc = 'Form sent successful:' . $tmp_data; //-- if (strlen($frm['text_area_1']) <= 0) { $redir = SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.main&time=' . time() . '&tab=' . rawurlencode($tab); $div_id = ''; $div_htm = ''; } else { $redir = ''; $div_id = 'answer_ajax'; $div_htm = '<script>$("#smart__CaptchaFrm__img").attr("src", "' . Smart::escape_js(SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.captcha&time=' . time()) . '");</script><table border="0" bgcolor="#DDEEFF" width="100%"><tr><td><h1>OK, form sent on: ' . date('Y-m-d H:i:s') . '</h1></td></tr><tr><td><div align="center"><img src="lib/core/img/q_completed.png"></div></td></tr><tr><td><hr><b>Here is the content of the text area:</b><br><pre>' . Smart::escape_html($frm['text_area_1']) . '</pre></td></tr></table>'; } //end if else //-- SmartCaptchaFormCheck::clear(self::captcha_form_name(), self::captcha_mode()); // everything OK, so clear captcha //-- } //end if else //-- } else { //-- $code = 'ERROR'; $title = 'CAPTCHA NOT Checked yet ...'; $desc = 'Please fill the Date field ...' . $tmp_data; //-- if (strlen($frm['text_area_1']) > 0) { $redir = SMART_FRAMEWORK_TESTUNIT_BASE_URL . 'testunit.main&time=' . time() . '&tab=' . rawurlencode($tab); } else { $redir = ''; } //end if else //-- $div_id = ''; $div_htm = ''; //-- } //end if else //-- //-- $out = SmartComponents::post_answer_by_ajax($code, $title, $desc, $redir, $div_id, $div_htm); //-- //-- return $out; //-- }