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

oscar at devel.plogworld.net oscar at devel.plogworld.net
Fri Apr 1 19:45:17 GMT 2005


Author: oscar
Date: 2005-04-01 19:45:17 +0000 (Fri, 01 Apr 2005)
New Revision: 1681

Modified:
   plog/branches/plog-1.0.1/class/net/customurlhandler.class.php
   plog/branches/plog-1.0.1/class/net/linkparser.class.php
Log:
this should hopefully solve issue http://bugs.plogworld.net/view.php?id=369 regarding overlapping in custom urls... I have now modified the regexp that parses incoming urls so that it takes the whole string instead of just part of it (by adding "^" to the regexp)

Modified: plog/branches/plog-1.0.1/class/net/customurlhandler.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/customurlhandler.class.php	2005-04-01 19:29:04 UTC (rev 1680)
+++ plog/branches/plog-1.0.1/class/net/customurlhandler.class.php	2005-04-01 19:45:17 UTC (rev 1681)
@@ -4,6 +4,7 @@
 	include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
 	include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
 	include_once( PLOG_CLASS_PATH."class/net/linkformatmatcher.class.php" );
+    include_once( PLOG_CLASS_PATH."class/net/url.class.php" );	
 
 	/**
 	 * \ingroup Net
@@ -31,21 +32,32 @@
 		{
 			$this->Object();
 			
+			// we need to figure out the full server path so that we can generate proper
+			// regexps for the url parsing. This should get rid of issues like
+			// http://bugs.plogworld.net/view.php?id=369
+			// The base url will be one or another depending
+            $config =& Config::getConfig();
+            if( $config->getValue( "subdomains_enabled" ))
+                $url = new Url( $config->getValue( "subdomains_base_url" ));
+            else
+                $url = new Url( $config->getValue( "base_url" ));
+            $path = $url->getPath();
+			
 			// intialize the array we're going to use
 			$config =& Config::getConfig();
             $this->_indexName = $config->getValue("script_name");
-			$this->_formats = Array( "permalink_format" => $config->getValue( "permalink_format" ),
-									 "category_link_format" => $config->getValue( "category_link_format" ),
-									 "blog_link_format" => $config->getValue( "blog_link_format" ),
-									 "archive_link_format" => $config->getValue( "archive_link_format" ),
-									 "user_posts_link_format" => $config->getValue( "user_posts_link_format" ),
-									 "post_trackbacks_link_format" => $config->getValue( "post_trackbacks_link_format" ),
-									 "template_link_format" => $config->getValue( "template_link_format" ),
-									 "album_link_format" => $config->getValue( "album_link_format" ),
-									 "resource_link_format" => $config->getValue( "resource_link_format" ),
-									 "resource_download_link_format" => $config->getValue( "resource_download_link_format" ),
-									 "resource_preview_link_format" => $config->getValue( "resource_preview_link_format" ),
-									 "resource_medium_size_preview_link_format" => $config->getValue( "resource_medium_size_preview_link_format" ));
+			$this->_formats = Array( "permalink_format" => $path.$config->getValue( "permalink_format" ),
+									 "category_link_format" => $path.$config->getValue( "category_link_format" ),
+									 "blog_link_format" => $path.$config->getValue( "blog_link_format" ),
+									 "archive_link_format" => $path.$config->getValue( "archive_link_format" ),
+									 "user_posts_link_format" => $path.$config->getValue( "user_posts_link_format" ),
+									 "post_trackbacks_link_format" => $path.$config->getValue( "post_trackbacks_link_format" ),
+									 "template_link_format" => $path.$config->getValue( "template_link_format" ),
+									 "album_link_format" => $path.$config->getValue( "album_link_format" ),
+									 "resource_link_format" => $path.$config->getValue( "resource_link_format" ),
+									 "resource_download_link_format" => $path.$config->getValue( "resource_download_link_format" ),
+									 "resource_preview_link_format" => $path.$config->getValue( "resource_preview_link_format" ),
+									 "resource_medium_size_preview_link_format" => $path.$config->getValue( "resource_medium_size_preview_link_format" ));
 			
 			// if the url did not match any of the current settings, then let's try to parse it as an old
 			// "search engine friendly" url

Modified: plog/branches/plog-1.0.1/class/net/linkparser.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/net/linkparser.class.php	2005-04-01 19:29:04 UTC (rev 1680)
+++ plog/branches/plog-1.0.1/class/net/linkparser.class.php	2005-04-01 19:45:17 UTC (rev 1681)
@@ -57,7 +57,7 @@
         function parseLink( $url )
         {
             $uri = $url;
-                
+            
             global $urlRewriteTags;
             $rewritecode = array_keys( $urlRewriteTags );
             $rewritereplace = array_values( $urlRewriteTags );
@@ -66,6 +66,7 @@
             $matchre = str_replace( "/", "/", $this->_linkFormat );
             $matchre = str_replace( "$", "\$", $matchre );
             $matchre = str_replace( $rewritecode, $rewritereplace, $matchre );
+            $matchre = "^".$matchre;
         
             // Extract the key values from the uri:
             $count = preg_match("#$matchre#",$uri,$values);




More information about the pLog-svn mailing list