/**
  * Handle request from querystring such as getting image, getting sound, etc.
  */
 public function indexAction()
 {
     $this->captcha = $this->getBotDetectCaptchaInstance();
     if (is_null($this->captcha)) {
         throw new BadRequestHttpException('captcha');
     }
     $commandString = $this->getUrlParameter('get');
     if (!\BDC_StringHelper::HasValue($commandString)) {
         \BDC_HttpHelper::BadRequest('command');
     }
     $command = \BDC_CaptchaHttpCommand::FromQuerystring($commandString);
     switch ($command) {
         case \BDC_CaptchaHttpCommand::GetImage:
             $responseBody = $this->getImage();
             break;
         case \BDC_CaptchaHttpCommand::GetSound:
             $responseBody = $this->getSound();
             break;
         case \BDC_CaptchaHttpCommand::GetValidationResult:
             $responseBody = $this->getValidationResult();
             break;
         default:
             \BDC_HttpHelper::BadRequest('command');
             break;
     }
     // disallow audio file search engine indexing
     header('X-Robots-Tag: noindex, nofollow, noarchive, nosnippet');
     echo $responseBody;
     exit;
 }
 /**
  * Handle request from querystring such as getting image, getting sound, etc.
  */
 public function index()
 {
     $this->autoRender = false;
     if ($this->isGetResourceContentsRequest()) {
         // getting contents of css, js, and gif files.
         $this->getResourceContents();
     } else {
         // getting captcha image, sound, validation result
         if (is_null($this->Captcha)) {
             \BDC_HttpHelper::BadRequest('captcha');
         }
         $commandString = $this->request->query('get');
         if (!\BDC_StringHelper::HasValue($commandString)) {
             \BDC_HttpHelper::BadRequest('command');
         }
         $command = \BDC_CaptchaHttpCommand::FromQuerystring($commandString);
         switch ($command) {
             case \BDC_CaptchaHttpCommand::GetImage:
                 $responseBody = $this->getImage();
                 break;
             case \BDC_CaptchaHttpCommand::GetSound:
                 $responseBody = $this->getSound();
                 break;
             case \BDC_CaptchaHttpCommand::getValidationResult:
                 $responseBody = $this->getValidationResult();
                 break;
             default:
                 \BDC_HttpHelper::BadRequest('command');
         }
         // disallow audio file search engine indexing
         header('X-Robots-Tag: noindex, nofollow, noarchive, nosnippet');
         echo $responseBody;
         exit;
     }
 }