getGameCfgs(); echo "

".get_lang('game_config_setup')."

\n

".get_lang_f("modify_configs_info",SERVER_CONFIG_LOCATION)."

\n
\n

\n

".get_lang('note').": ".get_lang('config_reset_warning')."

\n

\n
\n"; if ( isset($_REQUEST['reconfig']) ) { // Remove any old config files that may have been renamed or removed by developers // Function is defined in helpers.php (add entries to array there) removeOldGameConfigs(); $files = glob(SERVER_CONFIG_LOCATION."*.xml"); if ( empty($files) ) { print_failure(get_lang_f("no_configs_found",SERVER_CONFIG_LOCATION)); return; } /// \todo remove the clear_old hack when the update on duplicate is completed to database. $clear_old = FALSE; if ( isset( $_REQUEST['clear_old']) && $_REQUEST['clear_old'] === 'yes' ) { echo "

".get_lang('resetting_configs').":

"; $clear_old = TRUE; } else { echo "

".get_lang('updating_configs').":

"; } $oldStructure = $db->getCurrentHomeConfigMods(); $db->clearGameCfgs($clear_old); foreach ( $files as $config_file ) { $config = read_server_config($config_file); if ( empty($config) ) { print_failure(get_lang_f("error_when_handling_file",$config_file)); continue; } echo "

".get_lang_f("updating_config_from_file",$config_file)."

"; if ( !$db->addGameCfg($config) ) { print_failure(get_lang_f("error_while_adding_cfg_to_db",$config_file)); continue; } } // Update and remove invalid old game mod ids if($clear_old){ $db->updateOGPGameModsWithNewIDs($oldStructure); } print_success(get_lang('configs_updated_ok')); } $game_cfgs = $db->getGameCfgs(); echo "\n \n \n \n \n \n
\n \n
\n"; if ( isset($_GET['home_cfg_id']) ) { $home_cfg_id = trim($_GET['home_cfg_id']); $cfg_info = $db->getGameCfg($home_cfg_id); if($cfg_info !== FALSE) { $config_file = SERVER_CONFIG_LOCATION.$cfg_info['home_cfg_file']; if ( preg_match( "/_win/", $cfg_info['game_key'] ) ) $os = "(Windows)"; if (preg_match( "/_linux/", $cfg_info['game_key'] ) ) $os = "(Linux)"; if (preg_match( "/64/", $cfg_info['game_key'] ) ) $arch = "(64bit)"; else $arch = ""; if( isset($_GET['delete']) ) { if( $db->delGameCfgAndMods($home_cfg_id) === FALSE ) { print_failure(get_lang_f('failed_to_delete_config_from_db',$cfg_info['game_name'])); $view->refresh('?m=config_games&home_cfg_id='.$home_cfg_id,3); } elseif( unlink($config_file) === FALSE ) { print_failure(get_lang_f('failed_removing_file',$config_file)); $view->refresh('?m=config_games&home_cfg_id='.$home_cfg_id,3); } else { print_success(get_lang_f('removed_game_cfg_from_disk_and_datbase',$cfg_info['game_name']." $os $arch")); $view->refresh('?m=config_games',3); } } else { echo "".get_lang_f('delete_game_config_for',$cfg_info['game_name']." $os $arch")."
"; $configs = read_server_config($config_file); echo "\n"; foreach( $configs as $key => $value ) { echo "\n"; foreach($value as $subkey => $subvalue ) { echo "\n"; list($attributes,$attrvalue)=array(key($subvalue), current($subvalue)); foreach($attrvalue as $attrkey => $attrval) { echo "\n"; } echo ""; foreach($subvalue as $option => $options ) { echo "\n"; } } echo "\n"; } echo "
$key$value
$subkey$subvalue$attrkey$attrval$option$options
\n"; } } } if(isset($_GET['xml_config_creator'])) { echo ""; } else { echo "
"; } } ?>