<?php
/**
 * @file
 * Code for the ffdn_common feature.
 */

include_once 'ffdn_common.features.inc';




/* *********************************************************************
 * DEFINES, INCLUDES & INIT
 * ********************************************************************/

define('FFDN_CUSTOM_CAPTCHA', "FFDN Custom CAPTCHA");





/* *********************************************************************
 * CAPTCHA
 * ********************************************************************/

/**
 * Implementation of hook_captcha().
 */
function ffdn_common_captcha($op, $captcha_type='') {
  switch ($op) {
    case 'list':
      return array(
        FFDN_CUSTOM_CAPTCHA
      );
    case 'generate':
      if ($captcha_type == FFDN_CUSTOM_CAPTCHA) {
        $captcha = array();
        $captcha['solution'] = 'FFDN';
        $captcha['form']['captcha_response'] = array(
          '#type' => 'textfield',
          '#title' => t("What is the Federation FDN's acronym? (4 letters)"),
          '#description' => t("This is a basic anti-spam system ;)"),
          '#required' => TRUE,
        );
        return $captcha;
      }
      break;
  }
}