Esempio n. 1
0
 public function executeVerify()
 {
     $this->redirectIf($this->getUser()->isAuthenticated(), 'ucp/index');
     $file = $this->getRequestParameter('file');
     $c = new Criteria();
     $c->add(BlogPeer::FILE, $file);
     $blog = BlogPeer::doSelectOne($c);
     if ($blog && !$blog->getVerified()) {
         $blog_url = $blog->getUrl();
         if ($blog_url[strlen($blog_url) - 1] != '/') {
             $blog_url .= '/';
         }
         $url = $blog_url . $file . '.html';
         $test1 = @fopen($url, 'r') !== false;
         $test2 = false;
         if (!$test1) {
             $contents = file_get_contents($blog_url);
             $test2 = preg_match('/<meta name="verify-phppl" content="' . $file . '" \\/>/im', $contents);
         }
         if ($test1 || $test2) {
             $blog->setVerified(true);
             $blog->save();
             $this->setFlash('verified', true);
             $this->redirect('ucp/index');
         } else {
             $this->url = $url;
             $this->file = $file;
             return sfView::ERROR;
         }
     } else {
         $this->redirect('@homepage');
     }
 }
 public function execute(&$value, &$error)
 {
     $mid = $this->getContext()->getRequest()->getParameter('mid');
     $c = new Criteria();
     $c->add(BlogPeer::MID, $mid);
     $blog = BlogPeer::doSelectOne($c);
     if ($blog) {
         $error = $this->getParameter('msg');
         return false;
     }
     return true;
 }
Esempio n. 3
0
 public function execute(&$value, &$error)
 {
     $login = $value;
     $password = $this->getContext()->getRequest()->getParameter($this->getParameter('password'));
     $api = new LoginAPI(sfConfig::get('app_loginapi_login'), sfConfig::get('app_loginapi_key'), $login, $password);
     switch ($api->getCode()) {
         case LoginAPI::OK:
             $mid = $api->getId();
             break;
         case LoginAPI::NON_EXISTENT:
             $error = $this->getParameter('login_error');
             break;
         case LoginAPI::INACTIVE:
             $error = $this->getParameter('inactive_error');
             break;
         case LoginAPI::INCORRECT_PASSWORD:
             $error = $this->getParameter('password_error');
             break;
         default:
             $error = $this->getParameter('unknown_error');
     }
     if (empty($error)) {
         $c = new Criteria();
         $c->add(BlogPeer::MID, $mid);
         $blog = BlogPeer::doSelectOne($c);
         if ($blog) {
             if ($blog->getVerified()) {
                 $this->getContext()->getUser()->login($blog);
                 return true;
             } else {
                 $error = $this->getParameter('not_verified_error');
             }
         } else {
             $error = $this->getParameter('no_blog_error');
         }
     }
     return false;
 }