[pLog-svn] r1886 - plog/branches/plog-1.0.1/class/net

oscar at devel.plogworld.net oscar at devel.plogworld.net
Wed Apr 20 18:16:14 GMT 2005


Author: oscar
Date: 2005-04-20 18:16:14 +0000 (Wed, 20 Apr 2005)
New Revision: 1886

Modified:
   plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php
Log:
when using "search engine friendly" URLs and subdomains are enabled, we will not add the blog id or username after the url becuse it is redundant and it looks ugly.

Modified: plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php	2005-04-20 14:28:20 UTC (rev 1885)
+++ plog/branches/plog-1.0.1/class/net/prettyrequestgenerator.class.php	2005-04-20 18:16:14 UTC (rev 1886)
@@ -152,27 +152,33 @@
          */
         function blogLink( $blogInfo = null )
         {
-			$config =& Config::getConfig();
-			$disableApacheErrorHandler = $config->getValue( "disable_apache_error_handler" );
-			if( $disableApacheErrorHandler )
-				$path = "/blog/";
-			else
-				$path = "/";
+          $config =& Config::getConfig();          
+          // if subdomains are enabled, there is no need to do much more here... 
+          if( $config->getValue( "subdomains_enabled" )) {
+            $link = $this->getBaseUrl();
+          }
+          else {
+                // if not, we need some additional logic
+    			$disableApacheErrorHandler = $config->getValue( "disable_apache_error_handler" );
+    			if( $disableApacheErrorHandler )
+    				$path = "/blog/";
+    			else
+    				$path = "/";
 				
 		
-            if( $blogInfo == null ) {
-                if( $config->getValue( "pretty_urls_force_use_username" )) {
-                    $users = new Users();
-                    $userInfo = $users->getUserInfoFromId( $this->_blogInfo->getOwner());
-                    $link = $this->getBaseUrl().$path.$userInfo->getUsername();
+                if( $blogInfo == null ) {
+                    if( $config->getValue( "pretty_urls_force_use_username" )) {
+                        $userInfo = $this->_blogInfo->getOwnerInfo();
+                        $link = $this->getBaseUrl().$path.$userInfo->getUsername();
+                    }
+                    else {
+                	   $link = $this->getBaseUrl().$path.$this->_blogInfo->getId();
+                    }
                 }
                 else {
-            	   $link = $this->getBaseUrl().$path.$this->_blogInfo->getId();
+                	$link = $this->getBaseUrl().$path.$blogInfo->getId();
                 }
             }
-            else {
-            	$link = $this->getBaseUrl().$path.$blogInfo->getId();
-            }
 
             return $link;
         }
@@ -373,4 +379,4 @@
             die();
         }
     }
-?>
+?>
\ No newline at end of file




More information about the pLog-svn mailing list