[pLog-svn] r1807 - plog/branches/plog-1.0.1/class/action
mark at devel.plogworld.net
mark at devel.plogworld.net
Mon Apr 11 08:09:53 GMT 2005
Author: mark
Date: 2005-04-11 08:09:52 +0000 (Mon, 11 Apr 2005)
New Revision: 1807
Modified:
plog/branches/plog-1.0.1/class/action/defaultaction.class.php
Log:
Solve the bug reported by Jas in Chinese Forum http://forum.plogworld.org.tw/viewtopic.php?t=396 , get the user object from blogInfo instead of username and userid.
Modified: plog/branches/plog-1.0.1/class/action/defaultaction.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/action/defaultaction.class.php 2005-04-11 07:05:16 UTC (rev 1806)
+++ plog/branches/plog-1.0.1/class/action/defaultaction.class.php 2005-04-11 08:09:52 UTC (rev 1807)
@@ -108,11 +108,25 @@
if( isset($category) )
$this->_view->setValue( "category", $category );
+
+ $users = new Users();
+
+ // if we got a user user id, then we should first look up this id
+ // user in the database and see if it exists
+ if( $this->_userId > 0) {
+ $user = $users->getUserInfoFromId( $this->_userName );
+ if( !$user ) {
+ $this->_view = new ErrorView( $this->_blogInfo );
+ $this->_view->setValue( 'message', 'error_incorrect_user_id' );
+ $this->setCommonData();
+ return false;
+ }
+ }
+
// if we got a user name instead of a user id, then we
// should first look up this user in the database and see if
// it exists
if( $this->_userName ) {
- $users = new Users();
$user = $users->getUserInfoFromUsername( $this->_userName );
if( !$user ) {
$this->_view = new ErrorView( $this->_blogInfo );
@@ -125,6 +139,17 @@
$this->_userId = $user->getId();
}
+ // The user object should not get from user_name or user_id, it should
+ // get from blogInfo
+ $ownerId = $this->_blogInfo->getOwner();
+ $user = $users->getUserInfoFromId( $ownerId );
+ if( !$user ) {
+ $this->_view = new ErrorView( $this->_blogInfo );
+ $this->_view->setValue( 'message', 'error_incorrect_owner_id' );
+ $this->setCommonData();
+ return false;
+ }
+
// export the user
if( isset($user) )
$this->_view->setValue( "user", $user );
More information about the pLog-svn
mailing list