[Cs-content-commits] SF.net SVN: cs-content:[381] trunk/1.0/contentSystem.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-05-27 16:06:26
|
Revision: 381 http://cs-content.svn.sourceforge.net/cs-content/?rev=381&view=rev Author: crazedsanity Date: 2009-05-27 16:06:18 +0000 (Wed, 27 May 2009) Log Message: ----------- Fix for if contentSystem starts deeper in the URL (i.e. "/{app}/{content}") NOTE::: the "APPURL" constant is required for this behavior and may not be appropriately named, or may cause invalid assumptions by the developer. /contentSystem.class.php: * clean_url(): -- if "APPURL" is a valid constant, strip that from the beginning of the section string. -- EXAMPLE: if an app that uses cs-content is installed on a server where initial URL is "/apps/project/", set APPURL="/apps/project" so everything beyond that will work. Modified Paths: -------------- trunk/1.0/contentSystem.class.php Modified: trunk/1.0/contentSystem.class.php =================================================================== --- trunk/1.0/contentSystem.class.php 2009-05-27 04:54:31 UTC (rev 380) +++ trunk/1.0/contentSystem.class.php 2009-05-27 16:06:18 UTC (rev 381) @@ -327,7 +327,15 @@ return(NULL); } else { - //check the string to make sure it doesn't begin or end with a "/" + + //if there's an "APPURL" constant, drop that from the section. + if(defined('APPURL') && strlen(constant('APPURL'))) { + $dropThis = preg_replace('/^\//', '', constant('APPURL')); + $dropThis = preg_replace('/\//', '\\/', $dropThis); + $section = preg_replace('/^'. $dropThis .'/', '', $section); + } + + //check the string to make sure it doesn't begin with a "/" if($section[0] == '/') { $section = substr($section, 1, strlen($section)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |