[Cs-content-commits] SF.net SVN: cs-content:[359] trunk/1.0/contentSystem.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-02-06 16:47:06
|
Revision: 359 http://cs-content.svn.sourceforge.net/cs-content/?rev=359&view=rev Author: crazedsanity Date: 2009-02-06 16:47:03 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Another related to issue #246 where index.inc included invalidly. /contentSystem.class.php: * load_includes(): -- added a local variable, $addIndex -- set $addIndex to true if it can cd() into the final section's dir. -- set $addIndex to false if the code can't cd() into that final dir. -- code that checks for index.inc also checks $addIndex to be true. Modified Paths: -------------- trunk/1.0/contentSystem.class.php Modified: trunk/1.0/contentSystem.class.php =================================================================== --- trunk/1.0/contentSystem.class.php 2009-02-06 15:10:43 UTC (rev 358) +++ trunk/1.0/contentSystem.class.php 2009-02-06 16:47:03 UTC (rev 359) @@ -652,6 +652,7 @@ $this->load_dir_includes($this->baseDir); //okay, now loop through $this->sectionArr & see if we can include anything else. + $addIndex=false; if(($this->fileSystemObj->cd($this->baseDir)) && is_array($this->sectionArr) && count($this->sectionArr) > 0) { @@ -670,8 +671,13 @@ //attempt to cd() into the next directory, or die if we can't. if(!$this->fileSystemObj->cd($mySection)) { //no dice. Break the loop. + $addIndex = false; break; } + else { + //okay, we made it to the final directory; add the magic "index.inc" file if it exists. + $addIndex = true; + } } } @@ -680,7 +686,7 @@ if(isset($lsData['shared.inc']) && is_array($lsData['shared.inc'])) { $this->add_include('shared.inc'); } - if(isset($lsData['index.inc']) && is_array($lsData['index.inc'])) { + if(isset($lsData['index.inc']) && is_array($lsData['index.inc']) && $addIndex==true) { $this->add_include('index.inc'); } }//end load_includes() @@ -877,6 +883,7 @@ private final function add_include($file) { $myFile = $this->fileSystemObj->realcwd .'/'. $file; if(!array_search($myFile, $this->includesList)) { + $this->gfObj->debug_print(__METHOD__ .": adding (". $myFile .")"); $this->includesList[] = $myFile; } }//end add_include() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |