예제 #1
0
파일: captcha.php 프로젝트: samuell/Core
function spamhurdle_captcha_addon($args)
{
    if (isset($args['spokencaptcha'])) {
        $say = spamhurdles_decrypt($args['spokencaptcha']);
        require_once dirname(__FILE__) . '/../captcha/spoken_captcha.php';
        spamhurdles_spoken_captcha($say);
    } else {
        if (isset($args['imagecaptcha'])) {
            $req = spamhurdles_decrypt($args['imagecaptcha']);
            list($type, $class) = spamhurdles_load_captcha_class($req['type']);
            $captcha = new $class();
            $captcha->generate_image($req['question']);
        }
    }
}
예제 #2
0
파일: api.php 프로젝트: samuell/Core
/**
 * When a form is posted, then this function can be used to retrieved
 * the spam hurdles data from the request. This data should be in the
 * POST data in a field named "spamhurdles_<form id>".
 *
 * @param string $form_id
 *     An identifier for the current form. This must be the same form id
 *     as the one that was used when calling {@link spamhurdles_api_init()}.
 *
 * @return NULL | array
 *    If (valid) spamhurdles data is found in the form, then this data
 *    is returned. Otherwise NULL is returned.
 */
function spamhurdles_api_get_formdata($form_id)
{
    if (!isset($_POST['spamhurdles_' . $form_id])) {
        return NULL;
    }
    $data = spamhurdles_decrypt($_POST['spamhurdles_' . $form_id]);
    if (!is_array($data)) {
        return NULL;
    }
    return $data;
}