|
From: Jon O. <jon...@us...> - 2008-07-11 21:23:53
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2159/includes Modified Files: mx_functions_core.php page_header.php page_tail.php Log Message: New object, mx_backend() Index: page_header.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/page_header.php,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** page_header.php 3 Jul 2008 17:52:09 -0000 1.55 --- page_header.php 11 Jul 2008 21:23:17 -0000 1.56 *************** *** 93,255 **** // Generate logged in/logged out status // ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! case 'phpbb2': ! ! if ( $userdata['session_logged_in'] ) ! { ! $is_logged = true; ! $u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id']; ! $l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]'; ! } ! else ! { ! $is_logged = false; ! $u_login_logout = 'login.'.$phpEx; ! $l_login_logout = $lang['Login']; ! } ! ! $s_last_visit = ( $userdata['session_logged_in'] ) ? phpBB2::create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : ''; ! ! // ! // Obtain number of new private messages ! // if user is logged in ! // ! if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) ) ! { ! if ( $userdata['user_new_privmsg'] ) ! { ! $l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms']; ! $l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']); ! ! if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] ) ! { ! $sql = "UPDATE " . USERS_TABLE . " ! SET user_last_privmsg = " . $userdata['user_lastvisit'] . " ! WHERE user_id = " . $userdata['user_id']; ! if ( !$db->sql_query($sql) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql); ! } ! ! $s_privmsg_new = 1; ! $icon_pm = $images['pm_new_msg']; ! } ! else ! { ! $s_privmsg_new = 0; ! $icon_pm = $images['pm_no_new_msg']; ! } ! $mx_priv_msg = $lang['Private_Messages'] . ' (' . $userdata['user_new_privmsg'] . ')'; ! } ! else ! { ! $l_privmsgs_text = $lang['No_new_pm']; ! ! $s_privmsg_new = 0; ! $icon_pm = $images['pm_no_new_msg']; ! $mx_priv_msg = $lang['Private_Messages']; ! } ! ! if ( $userdata['user_unread_privmsg'] ) ! { ! $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms']; ! $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']); ! } ! else ! { ! $l_privmsgs_text_unread = $lang['No_unread_pm']; ! } ! } ! else ! { ! $icon_pm = $images['pm_no_new_msg']; ! $l_privmsgs_text = $lang['Login_check_pm']; ! $l_privmsgs_text_unread = ''; ! $s_privmsg_new = 0; ! $mx_priv_msg = $lang['Private_Messages']; ! } ! ! break; ! ! case 'phpbb3': ! ! if ( $mx_user->data['user_id'] != 1 ) ! { ! $is_logged = true; ! $u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $mx_user->data['session_id']; ! $l_login_logout = $lang['Logout'] . ' [ ' . $mx_user->data['username'] . ' ]'; ! } ! else ! { ! $is_logged = false; ! $u_login_logout = 'login.'.$phpEx; ! $l_login_logout = $lang['Login']; ! } ! $s_last_visit = ( $mx_user->data['session_logged_in'] ) ? phpBB2::create_date($board_config['default_dateformat'], $mx_user->data['user_lastvisit'], $board_config['board_timezone']) : ''; ! ! // ! // Obtain number of new private messages ! // if user is logged in ! // ! if ( ($mx_user->data['session_logged_in']) && (empty($gen_simple_header)) ) ! { ! if ( $mx_user->data['user_new_privmsg'] ) ! { ! $l_message_new = ( $mx_user->data['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms']; ! $l_privmsgs_text = sprintf($l_message_new, $mx_user->data['user_new_privmsg']); ! ! if ( $mx_user->data['user_last_privmsg'] > $mx_user->data['user_lastvisit'] ) ! { ! $sql = "UPDATE " . USERS_TABLE . " ! SET user_last_privmsg = " . $mx_user->data['user_lastvisit'] . " ! WHERE user_id = " . $mx_user->data['user_id']; ! if ( !$db->sql_query($sql) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql); ! } ! ! $s_privmsg_new = 1; ! $icon_pm = $images['pm_new_msg']; ! } ! else ! { ! $s_privmsg_new = 0; ! $icon_pm = $images['pm_no_new_msg']; ! } ! $mx_priv_msg = $lang['Private_Messages'] . ' (' . $mx_user->data['user_new_privmsg'] . ')'; ! } ! else ! { ! $l_privmsgs_text = $lang['No_new_pm']; ! ! $s_privmsg_new = 0; ! $icon_pm = $images['pm_no_new_msg']; ! $mx_priv_msg = $lang['Private_Messages']; ! } ! ! if ( $mx_user->data['user_unread_privmsg'] ) ! { ! $l_message_unread = ( $mx_user->data['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms']; ! $l_privmsgs_text_unread = sprintf($l_message_unread, $mx_user->data['user_unread_privmsg']); ! } ! else ! { ! $l_privmsgs_text_unread = $lang['No_unread_pm']; ! } ! } ! else ! { ! $icon_pm = $images['pm_no_new_msg']; ! $l_privmsgs_text = $lang['Login_check_pm']; ! $l_privmsgs_text_unread = ''; ! $s_privmsg_new = 0; ! $mx_priv_msg = $lang['Private_Messages']; ! } ! ! break; ! } ! // --- 93,97 ---- // Generate logged in/logged out status // ! $mx_backend->page_header('generate_login_logout_stats'); // *************** *** 294,297 **** --- 136,142 ---- } + // + // Search box + // $search_page_id_pafiledb = get_page_id('dload.' . $phpEx, true); $search_page_id_kb = get_page_id('kb.' . $phpEx, true); *************** *** 340,375 **** } - // Definitions of main navigation links - switch (PORTAL_BACKEND) - { - case 'internal': - case 'phpbb2': - $u_register = 'profile.'.$phpEx.'?mode=register' ; - $u_profile = 'profile.'.$phpEx.'?mode=editprofile'; - $u_privatemsgs = 'privmsg.'.$phpEx.'?folder=inbox'; - $u_privatemsgs_popup = 'privmsg.'.$phpEx.'?mode=newpm'; - $u_search = 'search.'.$phpEx; - $u_memberlist = 'memberlist.'.$phpEx; - $u_modcp = 'modcp.'.$phpEx; - $u_faq = 'faq.'.$phpEx; - $u_viewonline = 'viewonline.'.$phpEx; - $u_group_cp = 'groupcp.'.$phpEx; - $u_sendpassword = mx3_append_sid("{$phpbb_root_path}profile.$phpEx", 'mode=sendpassword'); - break; - case 'phpbb3': - $u_register = 'ucp.'.$phpEx.'?mode=register'; - $u_profile = 'ucp.'.$phpEx; - $u_privatemsgs = 'ucp.'.$phpEx.'?i=pm&folder=inbox'; - $u_privatemsgs_popup ='ucp.'.$phpEx.'?i=pm&mode=popup'; - $u_search = 'search.'.$phpEx; - $u_memberlist = 'memberlist.'.$phpEx; - $u_modcp = 'mcp.'.$phpEx; - $u_faq = 'faq.'.$phpEx; - $u_viewonline = 'viewonline.'.$phpEx; - $u_group_cp = 'ucp.'.$phpEx.'?i=167'; - $u_sendpassword = ($board_config['email_enable']) ? mx3_append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : ''; - break; - } - $useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); --- 185,188 ---- *************** *** 378,394 **** 'SITE_DESCRIPTION' => $board_config['site_desc'], 'PAGE_TITLE' => $mx_page->page_title, - 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'CURRENT_TIME' => sprintf($lang['Current_time'], phpBB2::create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), - 'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], phpBB2::create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])), - 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, - 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, - 'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new, - - 'PRIVMSG_IMG' => $icon_pm, 'L_USERNAME' => $lang['Username'], 'L_PASSWORD' => $lang['Password'], - 'L_LOGIN_LOGOUT' => $l_login_logout, 'L_LOGIN' => $lang['Login'], 'L_LOG_ME_IN' => $lang['Log_me_in'], --- 191,199 ---- *************** *** 398,402 **** 'L_PROFILE' => $lang['Profile'], 'L_SEARCH' => $lang['Search'], - 'L_PRIVATEMSGS' => $mx_priv_msg, 'L_WHO_IS_ONLINE' => $lang['Who_is_Online'], 'L_MEMBERLIST' => $lang['Memberlist'], --- 203,206 ---- *************** *** 414,430 **** 'U_SEARCH_NEW' => mx_append_sid(PHPBB_URL .'search.'.$phpEx.'?search_id=newposts'), - 'U_REGISTER' => mx_append_sid(PHPBB_URL . $u_register), - 'U_PROFILE' => mx_append_sid(PHPBB_URL . $u_profile), - 'U_PRIVATEMSGS' => mx_append_sid(PHPBB_URL . $u_privatemsgs), - 'U_PRIVATEMSGS_POPUP' => mx_append_sid(PHPBB_URL . $u_privatemsgs_popup), - 'U_SEARCH' => mx_append_sid(PHPBB_URL . $u_search), - 'U_MEMBERLIST' =>mx_append_sid(PHPBB_URL . $u_memberlist), - 'U_MODCP' => mx_append_sid(PHPBB_URL . $u_modcp), - 'U_FAQ' => mx_append_sid(PHPBB_URL . $u_faq), - 'U_VIEWONLINE' => mx_append_sid(PHPBB_URL . $u_viewonline), - 'U_LOGIN_LOGOUT' => mx_append_sid(PORTAL_URL . $u_login_logout), - 'U_GROUP_CP' => mx_append_sid(PHPBB_URL . $u_group_cp), - 'U_SEND_PASSWORD' => $u_sendpassword, - 'LOGO' => $images['mx_logo'], 'THEME_GRAPHICS' => $images['theme_graphics'], --- 218,221 ---- *************** *** 529,544 **** 'IS_ADMIN' => $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN, - // Backend - 'PHPBB' => PORTAL_BACKEND != 'internal', - - // Show phpbb stats? - 'PHPBB_STATS' => $mx_page->phpbb_stats && PORTAL_BACKEND != 'internal', - // Allow autologin? - 'ALLOW_AUTOLOGIN' => !$userdata['session_logged_in'] && (!isset($board_config['allow_autologin']) || $board_config['allow_autologin']) && PORTAL_BACKEND != 'internal', - // phpBB PM - 'ENABLE_PM_POPUP' => $userdata['session_logged_in'] && !empty($userdata['user_popup_pm']) && PORTAL_BACKEND != 'internal', - // Do NOT set basedir when in EDIT mode 'SET_BASE' => !$mx_request_vars->is_request('portalpage'), // Additional css for gecko browsers 'GECKO' => strstr($useragent, 'Gecko'), --- 320,326 ---- 'IS_ADMIN' => $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN, // Do NOT set basedir when in EDIT mode 'SET_BASE' => !$mx_request_vars->is_request('portalpage'), + // Additional css for gecko browsers 'GECKO' => strstr($useragent, 'Gecko'), *************** *** 547,619 **** // ! // Login box & swithes for logged in users? ! // ! /* ! if ( !$userdata['session_logged_in'] ) ! { ! $layouttemplate->assign_block_vars('switch_user_logged_out', array()); ! ! // ! // Allow autologin? ! // ! if (!isset($board_config['allow_autologin']) || $board_config['allow_autologin'] ) ! { ! $layouttemplate->assign_block_vars('switch_allow_autologin', array()); ! $layouttemplate->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array()); ! } ! ! // ! // Show phpbb stats? ! // ! if ( $mx_page->phpbb_stats ) ! { ! $layouttemplate->assign_block_vars('phpbb_stats', array()); ! $layouttemplate->assign_block_vars('phpbb_stats.switch_user_logged_out', array()); ! } ! } ! else ! { ! $layouttemplate->assign_block_vars('switch_user_logged_in', array()); ! ! if ( !empty($userdata['user_popup_pm']) ) ! { ! $layouttemplate->assign_block_vars('switch_enable_pm_popup', array()); ! } ! ! // ! // Show phpbb stats? ! // ! if ( $mx_page->phpbb_stats ) ! { ! $layouttemplate->assign_block_vars('phpbb_stats', array()); ! $layouttemplate->assign_block_vars('phpbb_stats.switch_user_logged_in', array()); ! } ! } ! ! // ! // Handy switch for Admin ! // ! if ( $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN ) ! { ! $layouttemplate->assign_block_vars('is_admin', array()); ! } ! ! // ! // Do NOT set basedir when in EDIT mode ! // ! if ( !$mx_request_vars->is_request('portalpage')) ! { ! $layouttemplate->assign_block_vars('switch_set_base', array()); ! } ! ! // ! // Determine if user have gecko/opera browser // ! $useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); ! if ( strstr($useragent, 'Gecko') ) ! { ! $layouttemplate->assign_block_vars('switch_gecko', array()); ! } ! */ // --- 329,335 ---- // ! // Definitions of main navigation links // ! $mx_backend->page_header('generate_nav_links'); // Index: page_tail.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/page_tail.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** page_tail.php 16 Jun 2008 10:46:38 -0000 1.38 --- page_tail.php 11 Jul 2008 21:23:17 -0000 1.39 *************** *** 107,110 **** --- 107,113 ---- } + $mx_backend->page_tail('generate_backend_version'); + + /* switch (PORTAL_BACKEND) { *************** *** 121,129 **** break; } $template->assign_vars(array( - 'PHPBB_BACKEND' => PORTAL_BACKEND != 'internal', 'U_PORTAL_ROOT_PATH' => PORTAL_URL, - 'U_PHPBB_ROOT_PATH' => PHPBB_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'MXBB_EXTRA' => $mxbb_footer_text, --- 124,131 ---- break; } + */ $template->assign_vars(array( 'U_PORTAL_ROOT_PATH' => PORTAL_URL, 'TEMPLATE_ROOT_PATH' => TEMPLATE_ROOT_PATH, 'MXBB_EXTRA' => $mxbb_footer_text, *************** *** 132,136 **** 'POWERED_BY' => $lang['Powered_by'], 'MX_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? PORTAL_VERSION : '', - 'PHPBB_VERSION' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? $current_phpbb_version : '', 'ADMIN_LINK' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? '<a href="' . $u_acp . '?sid=' . $userdata['session_id'] . '">' . $l_acp . '</a><br />' : '', 'L_ACP' => ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) ? $l_acp : '', --- 134,137 ---- Index: mx_functions_core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_core.php,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** mx_functions_core.php 10 Jul 2008 23:40:53 -0000 1.93 --- mx_functions_core.php 11 Jul 2008 21:23:16 -0000 1.94 *************** *** 55,204 **** { /** - * Enter description here... - * - * @access public - * @param boolean $use_cache - * @return unknown - */ - function obtain_phpbb_config($use_cache = true) - { - global $db; - - if (($config = $this->get('phpbb_config')) && ($use_cache) ) - { - return $config; - } - else - { - $sql = "SELECT * - FROM " . CONFIG_TABLE; - - if ( !( $result = $db->sql_query( $sql ) ) ) - { - if (!function_exists('mx_message_die')) - { - die("Couldnt query config information, Allso this hosting or server is using a cache optimizer not compatible with MX-Publisher or just lost connection to database wile query."); - } - else - { - mx_message_die( GENERAL_ERROR, 'Couldnt query config information', '', __LINE__, __FILE__, $sql ); - } - } - - while ( $row = $db->sql_fetchrow($result) ) - { - $config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); - - if ($use_cache) - { - $this->put('phpbb_config', $config); - } - - return ( $config ); - } - } - - /** - * Get MX-Publisher config data - * - * @access public - * @return unknown - */ - function obtain_mxbb_config($use_cache = true) - { - global $db; - - if ( ($config = $this->get('mxbb_config')) && ($use_cache) ) - { - return $config; - } - else - { - $sql = "SELECT * - FROM " . PORTAL_TABLE . " - WHERE portal_id = '1'"; - - if ( !( $result = $db->sql_query( $sql ) ) ) - { - if (!function_exists('mx_message_die')) - { - die("Couldnt query portal configuration, Allso this hosting or server is using a cache optimizer not compatible with MX-Publisher or just lost connection to database wile query."); - } - else - { - mx_message_die( GENERAL_ERROR, 'Couldnt query portal configuration', '', __LINE__, __FILE__, $sql ); - } - } - $row = $db->sql_fetchrow( $result ); - foreach ( $row as $config_name => $config_value ) - { - $config[$config_name] = trim( $config_value ); - } - $db->sql_freeresult( $result ); - $this->put('mxbb_config', $config); - - return ( $config ); - } - } - - /** - * Obtain cfg file data - * - * @param unknown_type $theme - * @return unknown - */ - function obtain_cfg_items($theme) - { - global $board_config, $phpbb_root_path; - - $parsed_items = array( - 'theme' => array(), - 'template' => array(), - 'imageset' => array() - ); - - foreach ($parsed_items as $key => $parsed_array) - { - $parsed_array = $this->get('_cfg_' . $key . '_' . $theme[$key . '_path']); - - if ($parsed_array === false) - { - $parsed_array = array(); - } - - $reparse = false; - $filename = $phpbb_root_path . 'styles/' . $theme[$key . '_path'] . '/' . $key . '/' . $key . '.cfg'; - - if (!file_exists($filename)) - { - continue; - } - - if (!isset($parsed_array['filetime']) || (($board_config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) - { - $reparse = true; - } - - // Re-parse cfg file - if ($reparse) - { - $parsed_array = mx_parse_cfg_file($filename); - $parsed_array['filetime'] = @filemtime($filename); - - $this->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array); - } - $parsed_items[$key] = $parsed_array; - } - - return $parsed_items; - } - - /** * load_backend * * Define Users/Group/Sessions backend, and validate ! * Set $portal_config, $phpbb_root_path, $tplEx, $table_prefix & PORTAL_BACKEND * */ --- 55,62 ---- { /** * load_backend * * Define Users/Group/Sessions backend, and validate ! * Set $portal_config, $phpbb_root_path, $tplEx, $table_prefix & PORTAL_BACKEND/$mx_backend * */ *************** *** 207,210 **** --- 65,69 ---- global $db, $portal_config, $phpbb_root_path, $mx_root_path; global $mx_table_prefix, $table_prefix, $phpEx, $tplEx; + global $mx_backend; // *************** *** 218,255 **** } ! $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'); --- 77,97 ---- } ! // ! // Load backend ! // ! include_once($mx_root_path . 'includes/sessions/'.$portal_config['portal_backend'].'/core.' . $phpEx); ! // ! // Instantiate the mx_backend class ! // ! $mx_backend = new mx_backend(); ! ! // ! // Validate backend ! // ! if (!$mx_backend->validate_backend()) { // ! // If backend setup is bad, revert to standalone/internal. Thus we can access the adminCP ;) // define('PORTAL_BACKEND', 'internal'); *************** *** 270,459 **** /** ! * 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); - - // - // Now sync Configs - // In phpBB mode, we rely on native phpBB configs, thus we need to sync mxp and phpbb settings - // - $this->sync_configs(); - } - - /** - * Sync Configs - * @access private - */ - function sync_configs() - { - global $portal_config, $board_config; - - foreach ($portal_config as $key => $value) - { - $do = true; - switch ($key) - { - // - // Keep phpBB cookies/sessions - // - case 'cookie_domain': - case 'cookie_name': - case 'cookie_path': - case 'cookie_secure': - case 'session_length': - case 'allow_autologin': - case 'max_autologin_time': - case 'max_login_attempts': - case 'login_reset_time': - - if (PORTAL_BACKEND != 'internal') - { - $do = false; - } - break; - - // - // Keep phpBB stats - // - case 'record_online_users': - case 'record_online_date': - - if (PORTAL_BACKEND != 'internal') - { - $do = false; - } - break; - - // - // Keep portal settings - // - case 'default_style': - case 'override_user_style': - case 'default_lang': - - // - // Keep portal settings - // - case 'allow_html': - case 'allow_html_tags': - case 'allow_bbcode': - case 'allow_smilies': - case 'smilies_path': - - // - // Keep portal settings - // - case 'board_email': - case 'board_email_sig': - case 'smtp_delivery': - case 'smtp_host': - case 'smtp_username': - case 'smtp_password': - case 'smtp_auth_method': - - // - // Keep portal settings - // - case 'default_dateformat': - case 'board_timezone': - case 'gzip_compress': - - // - // Keep portal settings - // - case 'portal_id': - case 'portal_status': - case 'disabled_message': - case 'script_path': - case 'mx_use_cache': - case 'mod_rewrite': - case 'default_admin_style': - case 'overall_header': - case 'overall_footer': - case 'main_layout': - case 'navigation_block': - case 'top_phpbb_links': - case 'portal_version': - case 'portal_recached': - case 'portal_backend': - case 'portal_startdate': - case 'rand_seed': - - break; - - // Rename config keys and get internal sitename/sitedesc - // - case 'portal_name': - - $key = 'sitename'; - break; - - case 'portal_desc': - - $key = 'site_desc'; - break; } ! ! if ($do) { ! $board_config[$key] = $value; } } } --- 112,154 ---- /** ! * Get MX-Publisher config data * + * @access public + * @return unknown */ ! function obtain_mxbb_config($use_cache = true) { ! global $db; ! if ( ($config = $this->get('mxbb_config')) && ($use_cache) ) { ! return $config; ! } ! else ! { ! $sql = "SELECT * ! FROM " . PORTAL_TABLE . " ! WHERE portal_id = '1'"; ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! if (!function_exists('mx_message_die')) { ! die("Couldnt query portal configuration, Allso this hosting or server is using a cache optimizer not compatible with MX-Publisher or just lost connection to database wile query."); } else { ! mx_message_die( GENERAL_ERROR, 'Couldnt query portal configuration', '', __LINE__, __FILE__, $sql ); } } ! $row = $db->sql_fetchrow( $result ); ! foreach ( $row as $config_name => $config_value ) { ! $config[$config_name] = trim( $config_value ); } + $db->sql_freeresult( $result ); + $this->put('mxbb_config', $config); + + return ( $config ); } } *************** *** 479,502 **** function load_file($file = '', $force_shared = false) { ! global $mx_root_path, $phpbb_root_path, $phpEx; ! if (PORTAL_BACKEND == 'internal' || $force_shared) ! { ! $backend = in_array($force_shared, array('internal', 'phpbb2', 'phpbb3')) ? $force_shared : PORTAL_BACKEND; ! switch ($backend) ! { ! case 'internal': ! case 'phpbb2': ! $path = $mx_root_path . 'includes/shared/phpbb2/includes/'; ! break; ! case 'phpbb3': ! $path = $mx_root_path . 'includes/shared/phpbb3/includes/'; ! break; ! } ! } ! else ! { ! $path = $phpbb_root_path . 'includes/'; ! } if (file_exists($path . $file.'.'.$phpEx)) --- 174,180 ---- function load_file($file = '', $force_shared = false) { ! global $mx_root_path, $phpbb_root_path, $phpEx, $mx_backend; ! $path = $mx_backend->_load_file($force_shared); if (file_exists($path . $file.'.'.$phpEx)) |