[pLog-svn] r1774 - plog/branches/plog-1.0.1/class/action
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Wed Apr 6 21:56:52 GMT 2005
Author: oscar
Date: 2005-04-06 21:56:52 +0000 (Wed, 06 Apr 2005)
New Revision: 1774
Modified:
plog/branches/plog-1.0.1/class/action/resourceserveraction.class.php
Log:
fixed issue 405 (http://bugs.plogworld.net/view.php?id=405) damn, we have found many more bugs in 1.0 than I ever though :(
Modified: plog/branches/plog-1.0.1/class/action/resourceserveraction.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/action/resourceserveraction.class.php 2005-04-06 21:26:30 UTC (rev 1773)
+++ plog/branches/plog-1.0.1/class/action/resourceserveraction.class.php 2005-04-06 21:56:52 UTC (rev 1774)
@@ -41,42 +41,36 @@
*/
function _getBlogInfo()
{
- $blogId = $this->_config->getValue('default_blog_id');
-
// see if we're using subdomains
$config =& Config::getConfig();
if( $config->getValue( "subdomains_enabled" )) {
- $url = new Url( $config->getValue( "subdomains_base_url"));
- $lp = new LinkParser( $url->getHost());
- $server = HttpVars::getServer();
- $httpHost = $server["HTTP_HOST"];
- $result = $lp->parseLink( $httpHost );
-
- if( $result["username"] != "" && $this->_request->getValue( 'user' ) == "" )
- $this->_request->setValue( 'user', $result["username"] );
- if( $result["blogname"] != "" && $this->_request->getValue( 'blogId' ) == "" )
- $this->_request->setValue( 'blogId', $result["blogname"] );
+ $subdomainInfo = Subdomains::getSubdomainInfoFromRequest();
+
+ if( $subdomainInfo["username"] != "" && $this->_request->getValue( 'blogUserName' ) == "" )
+ $this->_request->setValue( 'blogUserName', $subdomainInfo["username"] );
+ if( $subdomainInfo["blogname"] != "" && $this->_request->getValue( 'blogName' ) == "" )
+ $this->_request->setValue( 'blogName', $subdomainInfo["blogname"] );
}
- $blogId = $this->_request->getValue( 'blogId' );
- $blogName = $this->_request->getValue( 'blogName' );
- $userId = $this->_request->getValue( 'userId' );
- $userName = $this->_request->getValue( 'userName' );
+ $blogId = $this->_request->getValue( 'blogId' );
+ $blogName = $this->_request->getValue( 'blogName' );
+ $userId = $this->_request->getValue( 'userId' );
+ $userName = $this->_request->getValue( 'blogUserName' );
// if there is a "blogId" parameter, it takes precedence over the
// "user" parameter.
- if( !$blogId && !$blogName ) {
+ if( !$blogId && !$blogName ) {
// check if there was a user parameter
- if( $userParam ) {
+ if( !empty($userName) ) {
// if so, check to which blogs the user belongs
$users = new Users();
- $userInfo = $users->getUserInfoFromUsername( $userName );
+ $userInfo = $users->getUserInfoFromUsername( $userName );
// if the user exists and is valid...
if( $userInfo ) {
- $userBlogs = $users->getUsersBlogs( $userInfo->getId());
+ $userBlogs = $users->getUsersBlogs( $userInfo->getId(), BLOG_STATUS_ACTIVE );
// check if he or she belogs to any blog. If he or she does, simply
// get the first one (any better rule for this?)
- if( !empty($userBlogs)) {
+ if( !empty($userBlogs)) {
$blogId = $userBlogs[0]->getId();
}
}
@@ -86,6 +80,10 @@
if( $this->_session->getValue('blogId') != '' ) {
$blogId = $this->_session->getValue('blogId');
}
+ else {
+ // get the default blog id from the database
+ $blogId = $this->_config->getValue('default_blog_id');
+ }
}
}
More information about the pLog-svn
mailing list