|
From: Jon O. <jon...@us...> - 2008-07-09 20:47:57
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16665/includes Modified Files: mx_functions_core.php Log Message: Cleaning up common.php, and moving some backend init methods to the cache class (where all load methods are defined) Removed the template "border graphics" feature, since it has never been used. Js bug in 2 adminCP files. Index: mx_functions_core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_core.php,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** mx_functions_core.php 15 Jun 2008 21:00:01 -0000 1.89 --- mx_functions_core.php 9 Jul 2008 20:47:53 -0000 1.90 *************** *** 197,200 **** --- 197,353 ---- /** + * load_backend + * + * Define Users/Group/Sessions backend, and validate + * Set $portal_config, $phpbb_root_path, $tplEx, $table_prefix & PORTAL_BACKEND + * + */ + function load_backend() + { + global $db, $portal_config, $phpbb_root_path, $mx_root_path; + global $table_prefix, $phpEx, $tplEx; + + // + // Get MX-Publisher config settings + // + $portal_config = $this->obtain_mxbb_config(); + + if ($portal_config['portal_version'] == '') + { + $portal_config = $this->obtain_mxbb_config(false); + } + + $table_prefix = ''; + switch ($portal_config['portal_backend']) + { + case 'internal': + $phpbb_root_path = $mx_root_path . 'includes/shared/phpbb2/'; + str_replace("//", "/", $phpbb_root_path); + $portal_backend_valid_file = true; + $table_prefix = 'phpBB_'; + $tplEx = 'tpl'; + break; + case 'phpbb2': + $phpbb_root_path = $mx_root_path . $portal_config['portal_backend_path']; + str_replace("//", "/", $phpbb_root_path); + $portal_backend_valid_file = @file_exists($phpbb_root_path . "modcp.$phpEx"); + @include_once($phpbb_root_path . 'config.' . $phpEx); + $tplEx = 'tpl'; + $_result = $db->sql_query( "SELECT config_value from " . $table_prefix . "config WHERE config_name = 'cookie_domain'" ); + $portal_backend_valid_db = $db->sql_numrows( $_result ) != 0; + break; + case 'phpbb3': + $phpbb_root_path = $mx_root_path . $portal_config['portal_backend_path']; + str_replace("//", "/", $phpbb_root_path); + $portal_backend_valid_file = @file_exists($phpbb_root_path . "mcp.$phpEx"); + @include_once($phpbb_root_path . 'config.' . $phpEx); + $tplEx = 'html'; + $_result = $db->sql_query( "SELECT config_value from " . $table_prefix . "config WHERE config_name = 'cookie_domain'" ); + $portal_backend_valid_db = $db->sql_numrows( $_result ) != 0; + break; + } + + if (!$portal_backend_valid_file || empty($table_prefix) || !$portal_backend_valid_db) + { + // + // If phpBB setup is bad, revert to standalone. Thus we can access the adminCP ;) + // + define('PORTAL_BACKEND', 'internal'); + $phpbb_root_path = $mx_root_path . 'includes/shared/phpbb2/'; + str_replace("//", "/", $phpbb_root_path); + $tplEx = 'tpl'; + } + else + { + define('PORTAL_BACKEND', $portal_config['portal_backend']); + } + } + + /** + * setup_backend + * + * Define some general backend definitions + * PORTAL_URL, PHPBB_URL, PORTAL_VERSION & $board_config + * + */ + function setup_backend() + { + global $portal_config, $board_config, $phpbb_root_path; + + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($portal_config['script_path'])); + $server_name = trim($portal_config['server_name']); + $server_protocol = ( $portal_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $portal_config['server_port'] <> 80 ) ? ':' . trim($portal_config['server_port']) . '/' : '/'; + + $server_url = $server_protocol . str_replace("//", "/", $server_name . $server_port . $script_name . '/'); //On some server the slash is not added and this trick will fix it + + define('PORTAL_URL', $server_url); + define('PORTAL_VERSION', $portal_config['portal_version']); + + // + // Setup forum wide options, if this fails + // then we output a CRITICAL_ERROR since + // basic forum information is not available + // + switch (PORTAL_BACKEND) + { + case 'internal': + $board_config = array(); + $script_name_phpbb = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim('includes/shared/phpbb2/')) . '/'; + break; + + case 'phpbb2': + if( @file_exists($phpbb_root_path . 'includes/class_config.' . $phpEx) && @file_exists($phpbb_root_path . 'includes/class_groups.' . $phpEx) ) + { + include($mx_root_path . 'includes/mx_functions_ch.'.$phpEx); + } + else + { + // + // Grab phpBB global variables, re-cache if necessary + // - optional parameter to enable/disable cache for config data. If enabled, remember to refresh the MX-Publisher cache whenever updating phpBB config settings + // - true: enable cache, false: disable cache + $board_config = $this->obtain_phpbb_config(false); + } + $script_name_phpbb = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])) . '/'; + break; + + case 'phpbb3': + // + // Grab phpBB global variables, re-cache if necessary + // - optional parameter to enable/disable cache for config data. If enabled, remember to refresh the MX-Publisher cache whenever updating phpBB config settings + // - true: enable cache, false: disable cache + $board_config = $this->obtain_phpbb_config(false); + $script_name_phpbb = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])) . '/'; + break; + } + + $server_url_phpbb = $server_protocol . $server_name . $server_port . $script_name_phpbb; + define('PHPBB_URL', $server_url_phpbb); + } + + /** + * Enter description here... + * + */ + function init_mod_rewrite() + { + global $portal_config, $mx_root_path, $phpEx, $mx_mod_rewrite; + + if ($portal_config['mod_rewrite']) + { + if ( file_exists( $mx_root_path . 'modules/mx_mod_rewrite/includes/rewrite_functions.' . $phpEx ) ) + { + include_once( $mx_root_path . 'modules/mx_mod_rewrite/includes/rewrite_functions.' . $phpEx ); + + if (class_exists('mx_mod_rewrite')) + { + $mx_mod_rewrite = new mx_mod_rewrite(); + } + } + } + } + + /** * Read. * *************** *** 1721,1740 **** /** - * Block border graphics. - * - * This switch allows code within the 'block_border_graphics' temnplate environment. - * - * @access public - */ - function output_border_graphics() - { - global $layouttemplate; - - $layouttemplate->assign_block_vars('layout_column.blocks.graph_border', array( - 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH - )); - } - - /** * Output block stats. * @access public --- 1874,1877 ---- |