|
From: FlorinCB <ory...@us...> - 2008-09-01 02:14:33
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11410 Modified Files: mx_functions_style.php template.php Log Message: some problems solved with mx_phpbb3, now we have the main index showed with no overall header etc Index: template.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/template.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** template.php 31 Aug 2008 00:49:25 -0000 1.33 --- template.php 1 Sep 2008 02:14:18 -0000 1.34 *************** *** 831,835 **** function set_filename($handle, $filename, $xs_include = false, $quiet = false) { ! global $board_config; $can_cache = $this->use_cache; if(strpos($filename, '..') !== false) --- 831,835 ---- function set_filename($handle, $filename, $xs_include = false, $quiet = false) { ! global $board_config, $module_root_path, $mx_root_path, $phpbb_root_path, $theme, $mx_user, $mx_block; $can_cache = $this->use_cache; if(strpos($filename, '..') !== false) *************** *** 858,873 **** } - if (strpos($this->files[$handle],'overall_header.') && $xs_include && defined('MX_PHPBB3_BLOCK')) - { - //Do not include phpBB3 overall header and footer files using xs_include inside forum integration - $this->files[$handle] = str_replace($filename, 'index.htm', $this->files[$handle]); - } - - if (strpos($this->files[$handle],'overall_footer.') && $xs_include && defined('MX_PHPBB3_BLOCK')) - { - //Do not include phpBB3 overall header and footer files using xs_include inside forum integration - $this->files[$handle] = str_replace($filename, 'index.htm', $this->files[$handle]); - } - // creating cache filename if($can_cache != '') --- 858,861 ---- Index: mx_functions_style.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_style.php,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** mx_functions_style.php 30 Aug 2008 19:04:58 -0000 1.90 --- mx_functions_style.php 1 Sep 2008 02:14:16 -0000 1.91 *************** *** 143,147 **** // $filename2 = substr_count($filename, 'html') ? str_replace(".html", ".tpl", $filename) : str_replace(".tpl", ".html", $filename); ! // // Look at MX-Publisher-Module folder.........................................................................MX-Publisher-module --- 143,147 ---- // $filename2 = substr_count($filename, 'html') ? str_replace(".html", ".tpl", $filename) : str_replace(".tpl", ".html", $filename); ! // // Look at MX-Publisher-Module folder.........................................................................MX-Publisher-module *************** *** 164,167 **** --- 164,168 ---- } } + // *************** *** 344,349 **** --- 345,463 ---- return true; } + + /** + * Assigns template filename for handle. + */ + function set_filename($handle, $filename, $xs_include = false, $quiet = false) + { + global $board_config, $module_root_path, $mx_root_path, $phpbb_root_path, $theme, $mx_user, $mx_block; + $can_cache = $this->use_cache; + if(strpos($filename, '..') !== false) + { + $can_cache = false; + } + $this->files[$handle] = $this->make_filename($filename, $xs_include); + $this->files_cache[$handle] = ''; + $this->files_cache2[$handle] = ''; + // check if we are in admin control panel and override extreme styles mod controls if needed + if(defined('XS_ADMIN_OVERRIDE') && XS_ADMIN_OVERRIDE === true && @function_exists('xs_admin_override')) + { + xs_admin_override(); + } + // checking if we have valid filename + if(!$this->files[$handle]) + { + if($xs_include || $quiet) + { + return false; + } + else + { + die("Template->make_filename(): Error - invalid template $filename"); + } + } + + //Do not include phpBB3 overall header and footer files using xs_include inside forum integration + if ($xs_include && defined('MX_PHPBB3_BLOCK') && $module_root_path) + { + if (strpos($this->files[$handle],'overall_header.')) + { + $filename3 = 'overall_header_plugin.html'; + $filename2 = 'index.htm'; + $this->debug_paths .= '<br>Module'; + $fileSearch = array(); + $fileSearch[] = $style_path; // First check current template + $fileSearch[] = $mx_user->cloned_template_name; // Then check Cloned template + $fileSearch[] = $moduleDefault; // Finally check Default template + $fileSearch[] = './'; // Compatibility with primitive modules + + $this->files[$handle] = $this->doFileSearch($fileSearch, $filename3, $filename2, 'templates/', $module_root_path); + } + + if (strpos($this->files[$handle],'overall_footer.')) + { + $this->files[$handle] = $module_root_path . "templates/index.htm"; //Temp fix + } + } + // creating cache filename + if($can_cache != '') + { + $this->files_cache2[$handle] = $this->make_filename_cache($this->files[$handle]); + if(@file_exists($this->files_cache2[$handle])) + { + $this->files_cache[$handle] = $this->files_cache2[$handle]; + } + } + // checking if tpl and/or php file exists + if(empty($this->files_cache[$handle]) && !@file_exists($this->files[$handle])) + { + // trying to load alternative filename (usually subSilver) + if(!empty($this->tpldef) && !empty($this->tpl) && ($this->tpldef !== $this->tpl)) + { + $this->files[$handle] = ''; + // save old configuration + $root = $this->root; + $tpl_name = $this->tpl; + // set temporary configuration + $this->root = $this->tpldir . $this->tpldef; + $this->tpl = $this->tpldef; + // recursively run set_filename + $res = $this->set_filename($handle, $filename, $xs_include, $quiet); + // restore old configuration + $this->root = $root; + $this->tpl = $tpl_name; + return $res; + } + if($quiet) + { + return false; + } + if($xs_include) + { + if($board_config['xs_warn_includes']) + { + die('Template->make_filename(): Error - included template file not found: ' . $filename); + } + return false; + } + else + { + die('Template->make_filename(): Error - template file not found: ' . $filename); + } + } + // checking if we should recompile cache + if(!empty($this->files_cache[$handle]) && !empty($board_config['xs_auto_recompile'])) + { + $cache_time = @filemtime($this->files_cache[$handle]); + if(@filemtime($this->files[$handle]) > $cache_time || $board_config['xs_template_time'] > $cache_time) + { + // file was changed. don't use cache file (will be recompled if configuration allowes it) + $this->files_cache[$handle] = ''; + } + } + return true; + } } // class mx_Template |