[pLog-svn] r943 - plog/trunk/class/summary/action

oscar at devel.plogworld.net oscar at devel.plogworld.net
Fri Feb 4 10:40:52 GMT 2005


Author: oscar
Date: 2005-02-04 10:40:52 +0000 (Fri, 04 Feb 2005)
New Revision: 943

Modified:
   plog/trunk/class/summary/action/activeaccountaction.class.php
Log:
fixed issue 211 (http://bugs.plogworld.net/view.php?id=211)


Modified: plog/trunk/class/summary/action/activeaccountaction.class.php
===================================================================
--- plog/trunk/class/summary/action/activeaccountaction.class.php	2005-02-04 08:21:55 UTC (rev 942)
+++ plog/trunk/class/summary/action/activeaccountaction.class.php	2005-02-04 10:40:52 UTC (rev 943)
@@ -1,72 +1,72 @@
-<?php
-
-include_once(PLOG_CLASS_PATH.'class/action/action.class.php');
-include_once(PLOG_CLASS_PATH.'class/data/validator/stringvalidator.class.php');
-include_once(PLOG_CLASS_PATH.'class/dao/users.class.php');
-include_once(PLOG_CLASS_PATH.'class/dao/blogs.class.php');
-include_once(PLOG_CLASS_PATH.'class/summary/view/summarymessageview.class.php');
-
-include_once(PLOG_CLASS_PATH.'class/logger/LogUtil.php');
-
-class ActiveAccountAction extends Action {
-
-    var $username;
-    var $activeCode;
-
-    var $_locale;
-
-    function ActiveAccountAction($actionInfo,$httpRequest){
-        $this->Action($actionInfo,$httpRequest);
-
-        $this->registerFieldValidator("username",new StringValidator());
-        $this->registerFieldValidator("activeCode",new StringValidator());
-
-        $this->_locale = & Locales::getLocale();
-    }
-
-    function perform(){
-        $this->username = $this->_request->getValue("username");
-        $this->activeCode = $this->_request->getValue("activeCode");
-
-        $users = new Users();
-        $userInfo = $users->getUserInfoFromUsername($this->username);
-        
-        if(!$userInfo){
-            $this->_view = new SummaryView( "summaryerror" );
-			$this->_view->setErrorMessage( $this->_locale->tr("error_invalid_user"))
-            return false;
-        }
-
-        //$this->log->debug("user info is ".LogUtil::format($userInfo));
-        
-        $activeCode = $userInfo->getValue("activeCode");
-        if($activeCode != $this->activeCode){
-            $this->log->debug("active code in db is:".$activeCode);
-            $this->log->debug("active code from user is:".$this->activeCode);
-            $this->_view = new SummaryView( "summaryerror", $this->_locale->tr("error_invalid_activation_code"));
-            return false;
-        }
-        
-        // active user
-        $userInfo->setStatus(USER_STATUS_ACTIVE);
-        $users->updateUser($userInfo);
-        $this->log->debug("active user successfully!");
-        // also active the blog that user owned
-        // FIXME: how about other blogs that this user take part in?
-        $blogId = $users->getUserBlogId( $this->username);
-        $blogs = new Blogs();
-        $blog = $blogs->getBlogInfo($blogId);
-        $blog->setStatus(BLOG_STATUS_ACTIVE);
-        $blogs->updateBlog($blogId,$blog);
-		
-		// create the message that we're going to show
-		$message = "<p>".$this->_locale->tr("blog_activated_ok")."</p><p>".
-		           $this->_locale->pr("register_blog_link", $blog->getBlog(), $blogUrl->blogLink())."</p><p>".
-				   $this->_locale->tr("register_blog_admin_link")."</p>";
-
-        $this->_view = new SummaryMessageView($this->_locale->tr("blog_activated_ok"));
-        $this->setCommonData();
-        return true;
-    }
-}
-?>
+<?php
+
+include_once(PLOG_CLASS_PATH.'class/action/action.class.php');
+include_once(PLOG_CLASS_PATH.'class/data/validator/stringvalidator.class.php');
+include_once(PLOG_CLASS_PATH.'class/dao/users.class.php');
+include_once(PLOG_CLASS_PATH.'class/dao/blogs.class.php');
+include_once(PLOG_CLASS_PATH.'class/summary/view/summarymessageview.class.php');
+
+include_once(PLOG_CLASS_PATH.'class/logger/LogUtil.php');
+
+class ActiveAccountAction extends Action {
+
+    var $username;
+    var $activeCode;
+
+    var $_locale;
+
+    function ActiveAccountAction($actionInfo,$httpRequest){
+        $this->Action($actionInfo,$httpRequest);
+
+        $this->registerFieldValidator("username",new StringValidator());
+        $this->registerFieldValidator("activeCode",new StringValidator());
+
+        $this->_locale = & Locales::getLocale();
+    }
+
+    function perform(){
+        $this->username = $this->_request->getValue("username");
+        $this->activeCode = $this->_request->getValue("activeCode");
+
+        $users = new Users();
+        $userInfo = $users->getUserInfoFromUsername($this->username);
+        
+        if(!$userInfo){
+            $this->_view = new SummaryView( "summaryerror" );
+                        $this->_view->setErrorMessage( $this->_locale->tr("error_invalid_user"));
+            return false;
+        }
+
+        //$this->log->debug("user info is ".LogUtil::format($userInfo));
+        
+        $activeCode = $userInfo->getValue("activeCode");
+        if($activeCode != $this->activeCode){
+            $this->log->debug("active code in db is:".$activeCode);
+            $this->log->debug("active code from user is:".$this->activeCode);
+            $this->_view = new SummaryView( "summaryerror", $this->_locale->tr("error_invalid_activation_code"));
+            return false;
+        }
+        
+        // active user
+        $userInfo->setStatus(USER_STATUS_ACTIVE);
+        $users->updateUser($userInfo);
+        $this->log->debug("active user successfully!");
+        // also active the blog that user owned
+        // FIXME: how about other blogs that this user take part in?
+        $blogId = $users->getUserBlogId( $this->username);
+        $blogs = new Blogs();
+        $blog = $blogs->getBlogInfo($blogId);
+        $blog->setStatus(BLOG_STATUS_ACTIVE);
+        $blogs->updateBlog($blogId,$blog);
+		
+		// create the message that we're going to show
+		$message = "<p>".$this->_locale->tr("blog_activated_ok")."</p><p>".
+		           $this->_locale->pr("register_blog_link", $blog->getBlog(), $blogUrl->blogLink())."</p><p>".
+				   $this->_locale->tr("register_blog_admin_link")."</p>";
+
+        $this->_view = new SummaryMessageView($this->_locale->tr("blog_activated_ok"));
+        $this->setCommonData();
+        return true;
+    }
+}
+?>




More information about the pLog-svn mailing list