|
From: Jon O. <jon...@us...> - 2008-02-17 21:28:45
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12349 Modified Files: Tag: core28x template.php Log Message: A couple of fixes/updates, backported from the 2.9.x version. Index: template.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/template.php,v retrieving revision 1.18.2.6 retrieving revision 1.18.2.7 diff -C2 -d -r1.18.2.6 -r1.18.2.7 *** template.php 4 Feb 2008 12:45:08 -0000 1.18.2.6 --- template.php 17 Feb 2008 21:28:41 -0000 1.18.2.7 *************** *** 182,186 **** function load_config($root, $edit_db) { ! global $board_config, $phpbb_root_path, $mx_root_path, $phpEx; // getting mod version from config and comparing with real data $ver = isset($board_config['xs_version']) ? $board_config['xs_version'] : 0; --- 182,186 ---- function load_config($root, $edit_db) { ! global $mx_cache, $board_config, $portal_config, $phpbb_root_path, $mx_root_path, $phpEx; // getting mod version from config and comparing with real data $ver = isset($board_config['xs_version']) ? $board_config['xs_version'] : 0; *************** *** 341,344 **** --- 341,359 ---- /** + * Set custom template location (able to use directory outside of phpBB) + * @access public + */ + function set_custom_template($template_path, $template_name) + { + global $board_config, $phpbb_root_path, $mx_root_path; + + $this->root = $template_path; + $this->cachepath = $mx_root_path . 'cache/ctpl_' . $template_name . '_'; + $this->cachedir = $mx_root_path . XS_DIR_CACHE . '/'; + + return true; + } + + /** * Destroys this template object. Should be called when you're done with it, in order * to clear out the template data so you can load/parse a new template set. *************** *** 419,423 **** function subtemplates_make_filename($filename) { ! global $HTTP_GET_VARS, $HTTP_POST_VARS, $db, $board_config, $images, $theme; global $sub_template_key_image, $sub_templates; global $tree; --- 434,438 ---- function subtemplates_make_filename($filename) { ! global $mx_request_vars, $db, $board_config, $images, $theme; global $sub_template_key_image, $sub_templates; global $tree; *************** *** 444,470 **** $post_id = 0; ! if ( !defined('IN_PRIVMSG') && ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) ) ) { ! $post_id = isset($HTTP_GET_VARS[POST_POST_URL]) ? intval($HTTP_GET_VARS[POST_POST_URL]) : intval($HTTP_POST_VARS[POST_POST_URL]); } ! if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) || isset($HTTP_POST_VARS[POST_TOPIC_URL]) ) { ! $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]) ? intval($HTTP_GET_VARS[POST_TOPIC_URL]) : intval($HTTP_POST_VARS[POST_TOPIC_URL]); } ! if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) ) { ! $forum_id = isset($HTTP_GET_VARS[POST_FORUM_URL]) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]); } ! if ( isset($HTTP_GET_VARS[POST_CAT_URL]) || isset($HTTP_POST_VARS[POST_CAT_URL]) ) { ! $cat_id = isset($HTTP_GET_VARS[POST_CAT_URL]) ? intval($HTTP_GET_VARS[POST_CAT_URL]) : intval($HTTP_POST_VARS[POST_CAT_URL]); } ! if ( isset($HTTP_GET_VARS['selected_id']) || isset($HTTP_POST_VARS['selected_id']) ) { ! $selected_id = isset($HTTP_GET_VARS['selected_id']) ? $HTTP_GET_VARS['selected_id'] : $HTTP_POST_VARS['selected_id']; $type = substr($selected_id, 0, 1); $id = intval(substr($selected_id, 1)); --- 459,485 ---- $post_id = 0; ! if ( !defined('IN_PRIVMSG') && $mx_request_vars->is_request(POST_POST_URL)) { ! $post_id = $mx_request_vars->request(POST_POST_URL, MX_TYPE_INT); } ! if ($mx_request_vars->is_request(POST_TOPIC_URL) ) { ! $topic_id = $mx_request_vars->request(POST_TOPIC_URL, MX_TYPE_INT); } ! if ($mx_request_vars->is_request(POST_FORUM_URL)) { ! $forum_id = $mx_request_vars->request(POST_FORUM_URL, MX_TYPE_INT); } ! if ($mx_request_vars->is_request(POST_CAT_URL)) { ! $cat_id = $mx_request_vars->request(POST_CAT_URL, MX_TYPE_INT); } ! if ($mx_request_vars->is_request('selected_id')) { ! $selected_id = $mx_request_vars->request('selected_id', MX_TYPE_NO_TAGS); $type = substr($selected_id, 0, 1); $id = intval(substr($selected_id, 1)); *************** *** 848,852 **** } // creating cache filename ! if($can_cache) { $this->files_cache2[$handle] = $this->make_filename_cache($this->files[$handle]); --- 863,867 ---- } // creating cache filename ! if($can_cache != '') { $this->files_cache2[$handle] = $this->make_filename_cache($this->files[$handle]); *************** *** 913,917 **** global $lang, $theme, $board_config; ! if ( !defined( 'IN_PHPBB3' ) ) { $template = $theme['template_name']; --- 928,932 ---- global $lang, $theme, $board_config; ! if ( !(PORTAL_BACKEND == 'phpbb3') ) { $template = $theme['template_name']; *************** *** 928,934 **** echo '<!-- template ', $this->files[$handle], ' start -->'; } ! if($filename) { ! include($filename); } else --- 943,949 ---- echo '<!-- template ', $this->files[$handle], ' start -->'; } ! if ($filename) { ! ($include_once) ? include_once($filename) : include($filename); } else *************** *** 936,939 **** --- 951,955 ---- eval($code); } + if($board_config['xs_add_comments'] && $handle) { *************** *** 1483,1487 **** // remove keyword $keyword_str = substr($line, $pos1, $pos2 - $pos1 + 4); ! $params_str = $pos2 == $pos3 ? '' : substr($line, $pos3 + 1, $pos2 - $pos3 - 1); $code_lines[$i] = substr($line, $pos2 + 4); $i--; --- 1499,1503 ---- // remove keyword $keyword_str = substr($line, $pos1, $pos2 - $pos1 + 4); ! $params_str = ($pos2 == $pos3) ? '' : trim(substr($line, $pos3 + 1, $pos2 - $pos3 - 1)); $code_lines[$i] = substr($line, $pos2 + 4); $i--; *************** *** 1959,1962 **** --- 1975,1982 ---- $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[3]) . '[\'' . $varrefs[4] . '\']' : (($varrefs[3]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[4] . '\']' : '$this->vars[\'' . $varrefs[4] . '\']'); } + else if ( $token[0] == '.' ) + { + $token = 'sizeOf( $this->_tpldata[\'' . substr( $token, 1) . '.\'])'; + } break; } |