[pLog-svn] r1807 - plog/branches/plog-1.0.1/class/action
Mark Wu
markplace at gmail.com
Mon Apr 11 08:33:37 GMT 2005
Hi Oscar:
I fix the issue that $user object does not exist in template pages when use
userid instead of username in custom url ...
And, I assume the $user (actually) should be blogowner, therefore I get it
from blogInfo->getOwner() instead get it from username and userid.
And, each post author can get through $post->getUserInfo(), ... So, I think
this should be enough those template editor who want to put onwer or user
information in template pages.
Mark
-----Original Message-----
From: plog-svn-bounces at devel.plogworld.net
[mailto:plog-svn-bounces at devel.plogworld.net] On Behalf Of
mark at devel.plogworld.net
Sent: Monday, April 11, 2005 4:10 PM
To: plog-svn at devel.plogworld.net
Subject: [pLog-svn] r1807 - plog/branches/plog-1.0.1/class/action
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 );
_______________________________________________
pLog-svn mailing list
pLog-svn at devel.plogworld.net
http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list