Thread: [Phpslash-commit] CVS: phpslash-ft/class slashTemplate.class,1.3,1.4
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2003-03-11 18:44:51
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory sc8-pr-cvs1:/tmp/cvs-serv5089/phpslash-ft/class Modified Files: slashTemplate.class Log Message: recursive set_file Index: slashTemplate.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/slashTemplate.class,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** slashTemplate.class 8 Feb 2003 11:19:33 -0000 1.3 --- slashTemplate.class 11 Mar 2003 18:44:46 -0000 1.4 *************** *** 13,18 **** /** ! * @var psl configuration variables ! */ var $psl; --- 13,18 ---- /** ! * @var psl configuration variables ! */ var $psl; *************** *** 61,84 **** * @param string filename **/ ! function set_file($varname, $filename = "") { if (!is_array($varname)) { ! $filepath = $this->psl['templatedir'] ."/". $filename; ! if(!file_exists($filepath)) { ! if(file_exists($this->psl['templatedir'] ."/skin.ini")) { ! $skin_cfg = parse_ini_file($this->psl['templatedir'] ."/". "skin.ini"); ! $templatedir = substr($this->psl['templatedir'], 0, strrpos($this->psl['templatedir'], "/") ); ! $filepath = $templatedir ."/". $skin_cfg['skin.parent'] ."/". $filename; ! if(!file_exists($filepath)) { ! $this->message = "set_file: set_file: For varname $varname filename $filepath is invalid."; ! // $this->halt($this->message); ! return false; ! } ! } else { $this->message = "set_file: set_file: For varname $varname filename $filepath is invalid."; // $this->halt($this->message); ! return false; } } ! return Template::set_file($varname, $filepath); } else { --- 61,115 ---- * @param string filename **/ ! function set_file($varname, $filename = "", $skin="", $language="") { if (!is_array($varname)) { ! ! // default to the current skin ! if($skin == "") { ! $skin = $this->psl['skin.current']; ! } ! ! // default to the current language ! if($language == "") { ! $language = $this->psl['language.current']; ! } ! ! // assemble the templatedir ! // $templatedir = $this->psl['templatedir.main'] ."/". basename($language) ."/". basename($skin); ! $templatedir = $this->psl['templatedir.main'] ."/". $language ."/". $skin; ! // assemble the filepath ! $filepath = $templatedir ."/". $filename; ! // debug("slashTemplate::set_file::filepath", $filepath); ! ! $status = false; ! ! if( file_exists($filepath)) { ! $status = Template::set_file($varname, $filepath); ! } elseif(!file_exists($templatedir ."/skin.ini")) { ! // no parent skin ! // see if the defaults work ! if(!$this->set_file($varname, $filename, $this->psl['skin.default'], $this->psl['language.default'])) { ! // template isn't in the defaults either - bail out $this->message = "set_file: set_file: For varname $varname filename $filepath is invalid."; // $this->halt($this->message); ! $status = false; ! } ! $status = true; ! } else { ! $skin_cfg = ''; ! $skin_cfg = parse_ini_file($templatedir ."/skin.ini"); ! if(!empty($skin_cfg['skin.parent.language'])) { ! $language = $skin_cfg['skin.parent.language']; ! } ! if($this->set_file($varname, $filename, $skin_cfg['skin.parent'], $language)) { ! $status = true; ! } elseif($this->set_file($varname, $filename, $skin_cfg['skin.parent'], $this->psl['language.default'])) { ! $status = true; } + $status = false; + $this->message = "set_file: set_file: For varname $varname filename $filepath is invalid."; + // $this->halt($this->message); } ! ! // return $status; } else { *************** *** 86,115 **** while(list($v, $f) = each($varname)) { ! ! $filepath = $this->psl['templatedir'] ."/". $f; ! if( file_exists($filepath)) { ! $varname_ary[$v] = $filepath; ! ! } else { ! if(file_exists($this->psl['templatedir'] ."/skin.ini")) { ! $skin_cfg = parse_ini_file($this->psl['templatedir'] ."/". "skin.ini"); ! $templatedir = substr($this->psl['templatedir'], 0, strrpos($this->psl['templatedir'], "/") ); ! $filepath = $templatedir ."/". $skin_cfg['skin.parent'] ."/". $f; ! $varname_ary[$v] = $filepath; ! if(!is_file($filepath)) { ! $this->message = "set_file: set_file: For varname $v filename $filepath is invalid."; ! $this->halt($this->message); ! } ! } else { ! $this->message = "set_file: set_file: For varname $varname filename $filepath is invalid."; ! $this->halt($this->message); ! } ! } } ! return Template::set_file($varname_ary, $filename); } ! // no matches return false. ! return false; } // end of function set_root --- 117,129 ---- while(list($v, $f) = each($varname)) { ! if(!$this->set_file($v, $f)) { ! ! return false; ! } } ! $status = true; } ! return $status; } // end of function set_root *************** *** 118,133 **** // As per template.inc, with added test for windows absolute path function filename($filename) { ! if ($this->debug & 4) { ! echo "<p><b>filename:</b> filename = $filename</p>\n"; ! } ! if (substr($filename, 0, 1) != "/" && substr($filename, 1, 1) != ":") { // Test for Windows absolute path - could use preg_match(/[A-Z]:/i,...) test? ! $filename = $this->root."/".$filename; ! } ! if (!file_exists($filename)) { ! $this->halt("filename: file $filename does not exist."); ! } ! return $filename; ! } } // end of slashTemplate class --- 132,147 ---- // As per template.inc, with added test for windows absolute path function filename($filename) { ! if ($this->debug & 4) { ! echo "<p><b>filename:</b> filename = $filename</p>\n"; ! } ! if (substr($filename, 0, 1) != "/" && substr($filename, 1, 1) != ":") { // Test for Windows absolute path - could use preg_match(/[A-Z]:/i,...) test? ! $filename = $this->root."/".$filename; ! } ! if (!file_exists($filename)) { ! $this->halt("filename: file $filename does not exist."); ! } ! return $filename; ! } } // end of slashTemplate class |