NewsNewsFeaturesDownloadsDevelopmentSupportForumDocumentsAbout Us

ActiveAccountAction 類別 參考文件

類別ActiveAccountAction的繼承圖:

SummaryAction Action Object 全部成員列表

公開方法(Public Methods)

 ActiveAccountAction ($actionInfo, $httpRequest)
 perform ()

公開屬性

 $username
 $activeCode

詳細描述

定義在 activeaccountaction.class.php 檔案之第 10 行.


建構子與解構子說明文件

ActiveAccountAction::ActiveAccountAction actionInfo,
httpRequest
 

定義在 activeaccountaction.class.php 檔案之第 16 行.

參考 Action::registerFieldValidator(), 及 SummaryAction::SummaryAction().

00017     {
00018         $this->SummaryAction($actionInfo,$httpRequest);
00019 
00020         $this->registerFieldValidator("username",new StringValidator());
00021         $this->registerFieldValidator("activeCode",new StringValidator());
00022     }


函式成員說明文件

ActiveAccountAction::perform  ) 
 

Receives the HTTP request from the client as parameter, so that we can extract the parameters and perform our business logic.

The result of this will be a view, which will normally be the output of the processing we just did or for example an error view showing an error message. Once we have completed processing, the controller will call the getView() method to get the resulting view and send it back to the customer.

傳回值:
Returns nothing

依據Action重新實作.

定義在 activeaccountaction.class.php 檔案之第 24 行.

參考 $activeCode, $blogs, $userInfo, $users, 及 SummaryAction::setCommonData().

00024                       {
00025         $this->username = $this->_request->getValue("username");
00026         $this->activeCode = $this->_request->getValue("activeCode");
00027 
00028         $users = new Users();
00029         $userInfo = $users->getUserInfoFromUsername($this->username);
00030         
00031         if(!$userInfo){
00032             $this->_view = new SummaryView( "summaryerror" );
00033                         $this->_view->setErrorMessage( $this->_locale->tr("error_invalid_user"));
00034             return false;
00035         }
00036                 
00037         $activeCode = $userInfo->getValue("activeCode");
00038         if($activeCode != $this->activeCode){
00039             $this->_view = new SummaryView( "summaryerror", $this->_locale->tr("error_invalid_activation_code"));
00040             return false;
00041         }
00042         
00043         // active user
00044         $userInfo->setStatus(USER_STATUS_ACTIVE);
00045         $users->updateUser($userInfo);
00046         // also active the blog that user owned
00047         // FIXME: how about other blogs that this user take part in?
00048         $blogId = $users->getUserBlogId( $this->username);
00049         $blogs = new Blogs();
00050         $blog = $blogs->getBlogInfo($blogId);
00051         $blog->setStatus(BLOG_STATUS_ACTIVE);
00052         $blogs->updateBlog($blogId,$blog);
00053         $blogUrl = $blog->getBlogRequestGenerator();
00054         
00055         // create the message that we're going to show
00056         $message = "<p>".$this->_locale->tr("blog_activated_ok")."</p><p>".
00057                    $this->_locale->pr("register_blog_link", $blog->getBlog(), $blogUrl->blogLink())."</p><p>".
00058                    $this->_locale->tr("register_blog_admin_link")."</p>";
00059 
00060         $this->_view = new SummaryMessageView($message);
00061         $this->setCommonData();
00062         return true;
00063     }


資料成員說明文件

ActiveAccountAction::$activeCode
 

定義在 activeaccountaction.class.php 檔案之第 14 行.

被參考於 perform().

ActiveAccountAction::$username
 

定義在 activeaccountaction.class.php 檔案之第 13 行.


此類別(class) 文件是由下列檔案中產生: