[pLog-svn] r3266 - plog/trunk/class/action

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Apr 20 09:31:15 GMT 2006


Author: jondaley
Date: 2006-04-20 09:31:14 +0000 (Thu, 20 Apr 2006)
New Revision: 3266

Modified:
   plog/trunk/class/action/blogaction.class.php
Log:
added blogdomain checking.  whitespace change makes this look like a bigger change than it is

Modified: plog/trunk/class/action/blogaction.class.php
===================================================================
--- plog/trunk/class/action/blogaction.class.php	2006-04-20 09:20:07 UTC (rev 3265)
+++ plog/trunk/class/action/blogaction.class.php	2006-04-20 09:31:14 UTC (rev 3266)
@@ -149,27 +149,38 @@
          */
         function _getBlogInfo()
         {	
-			// see if we're using subdomains
-			$config =& Config::getConfig();
-			if( $config->getValue( "subdomains_enabled" )) {
+            // see if we're using subdomains
+            $config =& Config::getConfig();
+            if( $config->getValue( "subdomains_enabled" )) {
                 include_once( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
 
-				$subdomainInfo = Subdomains::getSubdomainInfoFromRequest();
+                $subdomainInfo = Subdomains::getSubdomainInfoFromRequest();
+                if( !empty($subdomainInfo["blogdomain"])
+                    && $this->_request->getValue( 'blogDomain' ) == "" )
+                {
+                    $this->_request->setValue( 'blogDomain', $subdomainInfo["blogdomain"] );
+                }
+                if( !empty($subdomainInfo["username"])
+                    && $this->_request->getValue( 'blogUserName' ) == "" )
+                {
+                    $this->_request->setValue( 'blogUserName', $subdomainInfo["username"] );
+                }
+                if( !empty($subdomainInfo["blogname"])
+                    && $this->_request->getValue( 'blogName' ) == "" )
+                {
+                    $this->_request->setValue( 'blogName', $subdomainInfo["blogname"] );
+                }
+            }
 
-				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( 'blogUserName' );
-			
+            $blogDomain = $this->_request->getValue( 'blogDomain' );
+
             // if there is a "blogId" parameter, it takes precedence over the
             // "user" parameter.
-            if( !$blogId && !$blogName ) {
+            if( !$blogId && !$blogName && !$blogDomain) {
             	// check if there was a user parameter
                 if( !empty($userName) ) {
                 	// if so, check to which blogs the user belongs
@@ -190,7 +201,7 @@
                     }
                 }
                 else {
-                    // if there is no user parameter, we take the blogId from the session
+                        // if there is no user parameter, we take the blogId from the session
                     if( $this->_session->getValue('blogId') != '' ) {
                     	$blogId = $this->_session->getValue('blogId');
                     }
@@ -206,13 +217,17 @@
 				include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );			
                 $blogs = new Blogs();
                 $this->_blogInfo = $blogs->getBlogInfo( $blogId );
-                
-                // $this->_blogInfo = $blogs->getBlogInfo( $blogId );
-            } else {
+            }
+            else if($blogName){
 				include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );			
                 $blogs = new Blogs();
                 $this->_blogInfo = $blogs->getBlogInfoByName( $blogName );
             }
+            else{
+				include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );			
+                $blogs = new Blogs();
+                $this->_blogInfo = $blogs->getBlogInfoByDomain( $blogDomain );
+            }
 
             $blogExists = true;
             
@@ -220,11 +235,10 @@
             if( $this->_blogInfo == false ) {
 				$blogExists = false;
             } else {
-	            // non-active blogs shoulnd't be shown either!
+	            // non-active blogs shouldn't be shown either!
 	            if( $this->_blogInfo->getStatus() != BLOG_STATUS_ACTIVE )
 	            	$blogExists = false;
             }
-            
             return $blogExists;
         }
 



More information about the pLog-svn mailing list