|
From: FlorinCB <ory...@us...> - 2008-09-18 00:43:33
|
Update of /cvsroot/mxbb/mx_music/phpbb2/admin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19367/admin Added Files: admin_mx_config.php Log Message: upgrade --- NEW FILE: admin_mx_config.php --- <?php /** * * @package MX Mod * @version $Id: admin_mx_config.php,v 1.1 2008/09/18 07:43:26 orynider Exp $ * @copyright (c) 2002-2006 mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * @link http://www.mx-publisher.com * */ $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( @file_exists( './../viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { define('MXBB_MODULE', false); define('IN_PHPBB', true); $phpbb_root_path = $module_root_path = './../'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; require_once($mx_mod_path . "includes/functions_required.$phpEx"); @define('IN_PORTAL', true); $mx_root_path = './../'; //include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); require_once($mx_mod_path . "includes/functions_core.$phpEx"); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // // Instatiate the mx_cache class // $mx_cache = new mx_cache(); // // instatiate the mx_request_vars class // $mx_request_vars = new mx_request_vars(); // // instatiate the mx_user class // //$mx_user = new mx_user(); // // Left Pane Paths // $setmodules_admin_path = ''; $setmodules_module_path = "./../"; if (file_exists($phpbb_root_path."modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; } else if (@file_exists($phpbb_root_path."mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; } } else { define( 'IN_PORTAL', 1 ); define( 'MXBB_MODULE', true ); // // Main paths // $mx_root_path = './../../../'; $module_root_path = './../../../modules/mx_linkdb/'; // // Left Pane Paths // $setmodules_root_path = './../'; $setmodules_module_path = 'modules/mx_linkdb/'; $setmodules_admin_path = $setmodules_module_path . 'admin/'; define( 'MXBB_27x', file_exists( $setmodules_root_path . 'mx_login.php' ) ); } if( !empty($setmodules) ) { $file = basename(__FILE__); $module['Mx_Mod']['Configuration'] = $file; return; } // // Let's set the root dir for phpBB // require($phpbb_root_path."admin/pagestart.$phpEx"); require($mx_mod_path . "includes/mx_constants.$phpEx"); @define('PORTAL_TABLE', $table_prefix . 'mx_config'); //Modifyed for mx_mod require_once($mx_mod_path . "includes/functions_styles.$phpEx"); $mx_user = new mx_user(); // instatiate the mx_user class // // Define basic constants // $mx_user->page_id = 51; $mx_user->user_ip = $user_ip; $mx_user->_init_userprefs(); //$mx_user->extend(); // // Get mxBB config settings // $portal_config = $mx_cache->obtain_mxbb_config(); // ********************************************************************** // Read language definition // ********************************************************************** if ( !MXBB_MODULE ) { if (!file_exists($mx_mod_path . "language/lang_" . $board_config['default_lang'] . "/lang_admin.$phpEx")) { include($mx_mod_path . "language/lang_english/lang_admin.$phpEx"); } else { include($mx_mod_path . "language/lang_" . $board_config['default_lang'] . "/lang_admin.$phpEx"); } } // // Begin program proper // $mode = ''; if( isset($HTTP_POST_VARS['submit']) ) { $mode = 'submit'; } // // Pull all config data // $sql = "SELECT * FROM " . PORTAL_TABLE; if(!$result = $db->sql_query($sql)) { message_die(CRITICAL_ERROR, "Could not query music config information", "", __LINE__, __FILE__, $sql); } else { while( $row = $db->sql_fetchrow($result) ) { $config_name = $row['config_name']; $config_value = $row['config_value']; $default_config[$config_name] = $config_value; //$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name]; if( !empty($mode) ) { $new['portal_name'] = $mx_request_vars->post('portal_name', MX_TYPE_NO_TAGS, 'mxBB Portal and CMS'); $new['portal_url'] = $mx_request_vars->post('portal_url', MX_TYPE_NO_TAGS, ''); $new['portal_phpbb_url'] = $mx_request_vars->post('portal_phpbb_url', MX_TYPE_NO_TAGS, ''); $new['default_admin_style'] = $mx_request_vars->post('mx_default_admin_style', MX_TYPE_NO_TAGS, '-1'); $new['default_style'] = $mx_request_vars->post('mx_default_style', MX_TYPE_NO_TAGS, '-1'); $new['override_user_style'] = $mx_request_vars->post('mx_override_user_style', MX_TYPE_NO_TAGS, '1'); $new['overall_header'] = $mx_request_vars->post('overall_header', MX_TYPE_NO_TAGS, 'overall_header.tpl'); $new['overall_footer'] = $mx_request_vars->post('overall_footer', MX_TYPE_NO_TAGS, 'overall_footer.tpl'); $new['main_layout'] = $mx_request_vars->post('main_layout', MX_TYPE_NO_TAGS, 'mx_main_layout.tpl'); $new['navigation_block'] = $mx_request_vars->post('navigation_block', MX_TYPE_INT, '0'); $new['top_phpbb_links'] = $mx_request_vars->post('top_phpbb_links', MX_TYPE_INT, '0'); $new['mx_use_cache'] = $mx_request_vars->post('mx_use_cache', MX_TYPE_INT, '1'); $new['mod_rewrite'] = $mx_request_vars->post('mod_rewrite', MX_TYPE_INT, '0'); $new['portal_status'] = $mx_request_vars->post('portal_status', MX_TYPE_INT, '0'); $new['disabled_message'] = $mx_request_vars->post('disabled_message', MX_TYPE_NO_TAGS, 'Site disabled.'); if( isset($HTTP_POST_VARS['submit']) ) { $sql = "UPDATE " . PORTAL_TABLE . " SET config_value = '" . str_replace("\'", "''", $new[$config_name]) . "' WHERE config_name = '$config_name'"; if( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Failed to update music configuration for $config_name", "", __LINE__, __FILE__, $sql); } } /* $sql = "UPDATE " . PORTAL_TABLE . " SET portal_name = '" . str_replace("\'", "''", $new['portal_name']) . "', portal_url = '" . str_replace("\'", "''", $new['portal_url']) . "', portal_phpbb_url = '" . str_replace("\'", "''", $new['portal_phpbb_url']) . "', default_admin_style = '" . str_replace("\'", "''", $new['default_admin_style']) . "', default_style = '" . str_replace("\'", "''", $new['default_style']) . "', override_user_style = '" . str_replace("\'", "''", $new['override_user_style']) . "', overall_header = '" . str_replace("\'", "''", $new['overall_header']) . "', overall_footer = '" . str_replace("\'", "''", $new['overall_footer']) . "', main_layout = '" . str_replace("\'", "''", $new['main_layout']) . "', navigation_block = '" . str_replace("\'", "''", $new['navigation_block']) . "', top_phpbb_links = '" . str_replace("\'", "''", $new['top_phpbb_links']) . "', mx_use_cache = '" . str_replace("\'", "''", $new['mx_use_cache']) . "', mod_rewrite = '" . str_replace("\'", "''", $new['mod_rewrite']) . "', portal_status = '" . str_replace("\'", "''", $new['portal_status']) . "', disabled_message = '" . str_replace("\'", "''", $new['disabled_message']) . "'"; if( !($db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, "Failed to update portal configuration ", "", __LINE__, __FILE__, $sql); } */ //$mx_cache->put( 'mxbb_config', $new ); $message = $lang['Portal_Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_portal_config'], "<a href=\"" . append_sid("admin_mx_config.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } } } $template->set_filenames(array( 'admin_portal' => 'admin/admin_mx_config.tpl') ); $top_phpbb_links_yes = ( $portal_config['top_phpbb_links'] == 1 ) ? 'checked="checked"' : ''; $top_phpbb_links_no = ( $portal_config['top_phpbb_links'] == 0 ) ? 'checked="checked"' : ''; $mx_use_cache_yes = ( $portal_config['mx_use_cache'] == 1 ) ? 'checked="checked"' : ''; $mx_use_cache_no = ( $portal_config['mx_use_cache'] == 0 ) ? 'checked="checked"' : ''; $mx_mod_rewrite_yes = ( $portal_config['mod_rewrite'] == 1 ) ? 'checked="checked"' : ''; $mx_mod_rewrite_no = ( $portal_config['mod_rewrite'] == 0 ) ? 'checked="checked"' : ''; $mx_portal_status_yes = ( $portal_config['portal_status'] == 1 ) ? 'checked="checked"' : ''; $mx_portal_status_no = ( $portal_config['portal_status'] == 0 ) ? 'checked="checked"' : ''; $disabled_message = $portal_config['disabled_message']; $phpbb_rel_path = substr( "$phpbb_root_path", 3 ); $navigation_block_list = ''; //get_list_formatted('block_list', $portal_config['navigation_block'], 'navigation_block', 'mx_menu_nav.php', false, 'mx_site_nav.php'); $portal_version = $portal_config['portal_version']; $phpbb_version = '2' . $board_config['version']; $phpbb_script_path = $board_config['script_path']; $phpbb_server_name = $board_config['server_name']; // Default to phpBB default $portal_config['default_admin_style'] = $portal_config['default_admin_style'] == -1 ? $board_config['default_style'] : $portal_config['default_admin_style']; $portal_config['default_style'] = $portal_config['default_style'] == -1 ? $board_config['default_style'] : $portal_config['default_style']; $portal_config['override_user_style'] = $portal_config['override_user_style'] == -1 ? $board_config['override_user_style'] : $portal_config['override_user_style']; $style_select = $portal_config['default_style']; //mx_style_select($portal_config['default_style'], 'mx_default_style'); $style_admin_select = $portal_config['default_admin_style']; //mx_style_select($portal_config['default_admin_style'], 'mx_default_admin_style'); $override_user_style_yes = ( $portal_config['override_user_style'] ) ? "checked=\"checked\"" : ""; $override_user_style_no = ( !$portal_config['override_user_style'] ) ? "checked=\"checked\"" : ""; $template->assign_vars(array( "S_CONFIG_ACTION" => append_sid("admin_mx_config.$phpEx"), "L_YES" => $lang['Yes'], "L_NO" => $lang['No'], "L_CONFIGURATION_TITLE" => $lang['Portal_General_Config'], "L_CONFIGURATION_EXPLAIN" => $lang['Portal_General_Config_explain'], "L_GENERAL_SETTINGS" => $lang['Portal_General_settings'], "L_GENERAL_CONFIG_INFO" => $lang['Portal_General_config_info'] . "<br />" . $lang['Portal_General_config_info_explain'], "L_STYLE_SETTINGS" => $lang['Portal_Style_settings'], "L_PORTAL_NAME" => $lang['Portal_Name'], "L_PORTAL_URL" => $lang['Portal_Url'] . "<br />" . $lang['Portal_url_explain'], "L_PORTAL_PHPBB_URL" => $lang['Portal_PHPBB_Url'] . "<br />" . $lang['Phpbb_url_explain'], "L_OVERALL_HEADER" => $lang['Portal_Overall_header'] . "<br />" . $lang['Portal_Overall_header_explain'], "L_OVERALL_FOOTER" => $lang['Portal_Overall_footer'] . "<br />" . $lang['Portal_Overall_footer_explain'], "L_MAIN_LAYOUT" => $lang['Portal_Main_layout'] . "<br />" . $lang['Portal_Main_layout_explain'], "L_NAVIGATION_BLOCK" => $lang['Portal_Navigation_block'] . "<br />" . $lang['Portal_Navigation_block_explain'], "L_SUBMIT" => $lang['Submit'], "L_RESET" => $lang['Reset'], "PORTAL_NAME" => $portal_config['portal_name'], "PORTAL_URL" => $portal_config['portal_url'], "PORTAL_PHPBB_URL" => $portal_config['portal_phpbb_url'], "OVERALL_HEADER" => $portal_config['overall_header'], "OVERALL_FOOTER" => $portal_config['overall_footer'], "MAIN_LAYOUT" => $portal_config['main_layout'], "NAVIGATION_BLOCK" => $navigation_block_list, "L_PHPBB_RELATIVE_PATH" => $lang['Phpbb_path'], "L_PHPBB_RELATIVE_PATH_EXPLAIN" => $lang['Phpbb_path_explain'], "PHPBB_RELATIVE_PATH" => $phpbb_rel_path, "L_PORTAL_VERSION" => $lang['Portal_version'], "PORTAL_VERSION" => $portal_version, "L_PHPBB_INFO" => $lang['PHPBB_info'], "L_PHPBB_SERVER_NAME" => $lang['PHPBB_server_name'], "PHPBB_SERVER_NAME" => $phpbb_server_name, "L_PHPBB_SCRIPT_PATH" => $lang['PHPBB_script_path'], "PHPBB_SCRIPT_PATH" => $phpbb_script_path, "L_PHPBB_VERSION" => $lang['PHPBB_version'], "PHPBB_VERSION" => $phpbb_version, "L_TOP_PHPBB_LINKS" => $lang['Top_phpbb_links'] . "<br />" . $lang['Top_phpbb_links_explain'], "S_TOP_PHPBB_LINKS_YES" => $top_phpbb_links_yes, "S_TOP_PHPBB_LINKS_NO" => $top_phpbb_links_no, "TOP_PHPBB_LINKS" => $portal_config['top_phpbb_links'], "L_MX_USE_CACHE" => $lang['Mx_use_cache'], "L_MX_USE_CACHE_EXPLAIN" => $lang['Mx_use_cache_explain'], "S_MX_USE_CACHE_YES" => $mx_use_cache_yes, "S_MX_USE_CACHE_NO" => $mx_use_cache_no, "MX_USE_CACHE" => $portal_config['mx_use_cache'], "L_DEFAULT_STYLE" => $lang['Default_style'], "L_DEFAULT_ADMIN_STYLE" => $lang['Default_admin_style'], "L_OVERRIDE_STYLE" => $lang['Override_style'], "L_OVERRIDE_STYLE_EXPLAIN" => $lang['Override_style_explain'], "STYLE_SELECT" => $style_select, "ADMIN_STYLE_SELECT" => $style_admin_select, "OVERRIDE_STYLE_YES" => $override_user_style_yes, "OVERRIDE_STYLE_NO" => $override_user_style_no, "L_MX_MOD_REWRITE" => $lang['Mx_mod_rewrite'], "L_MX_MOD_REWRITE_EXPLAIN" => $lang['Mx_mod_rewrite_explain'], "S_MX_MOD_REWRITE_YES" => $mx_mod_rewrite_yes, "S_MX_MOD_REWRITE_NO" => $mx_mod_rewrite_no, "MX_MOD_REWRITE" => $portal_config['mod_rewrite'], "L_PORTAL_STATUS" => $lang['Portal_status'], "L_PORTAL_STATUS_EXPLAIN" => $lang['Portal_status_explain'], "S_PORTAL_STATUS_YES" => $mx_portal_status_yes, "S_PORTAL_STATUS_NO" => $mx_portal_status_no, "L_DISABLED_MESSAGE" => $lang['Disabled_message'], "DISABLED_MESSAGE" => $disabled_message, )); $template->pparse('admin_portal'); include_once('page_footer_admin.' . $phpEx); ?> |