Esempio n. 1
0
 public function refreshCaptchaAction()
 {
     $viewModel = new ViewModel();
     $isXmlHttpRequest = false;
     if ($this->request->isXmlHttpRequest()) {
         $isXmlHttpRequest = true;
         $captchaOldId = $this->request->getQuery("captchaOldId");
         $captchaImg = new \ZendVN\Captcha\Image(70, 250, array("wordlen" => 5));
         $captchaID = $captchaImg->getId();
         $imgUrl = $captchaImg->getImgUrl() . $captchaID . $captchaImg->getSuffix();
         //delete old captcha
         $captchaImg->removeOldCaptcha($captchaOldId);
     }
     $viewModel->setTerminal(true);
     $viewModel->setVariables(array("isXmlHttpRequest" => $isXmlHttpRequest, "captchaID" => $captchaID, "imgUrl" => $imgUrl));
     return $viewModel;
 }
 public function refreshCaptchaAction()
 {
     $view = new ViewModel();
     $isXmlHttpRequest = false;
     if ($this->getRequest()->isXmlHttpRequest() == true) {
         $isXmlHttpRequest = true;
         $captchaObj = new \ZendVN\Captcha\Image(150, 50, array('wordlen' => 5, 'fsize' => 25, 'suffix' => '.jpg'));
         $captchaID = $this->getRequest()->getQuery('captchaID');
         $captchaObj->remove($captchaID);
     }
     $view->setVariables(array('isXmlHttpRequest' => $isXmlHttpRequest, 'imageUrl' => $captchaObj->getImgUrl() . $captchaObj->getId() . $captchaObj->getSuffix(), 'captchaID' => $captchaObj->getId()));
     $view->setTerminal(true);
     return $view;
 }