function Global_Init()
{
    //session_start();
    Load_Configs();
    if (!strnatcasecmp(trim($GLOBALS['db']['type']), "LB")) {
        require_once 'inc/dbmodule_LB.php';
    }
    if (!strnatcasecmp(trim($GLOBALS['db']['type']), "GD")) {
        require_once 'inc/dbmodule_GD.php';
    }
    //echo "GLOBALS: <BR>"; print_r($GLOBALS['db']); echo "<BR>";
    $source_db_ok = SQL_DB_OK("source");
    if ($source_db_ok['error'] === false) {
        $GLOBALS['db']['s_resource'] = @mysql_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server. : " . mysql_error());
        @mysql_selectdb($GLOBALS['db']['s_base']) or die("Could not connect to Source database [" . $GLOBALS['db']['s_base'] . "] : " . mysql_error());
        $GLOBALS['db']['x_resource'] = @mysql_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray  MySQL Server. : " . mysql_error());
        @mysql_selectdb($GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database [" . $GLOBALS['db']['x_base'] . "] : " . mysql_error());
        $GLOBALS['db']['s_link'] = mysqli_connect($GLOBALS['db']['s_host'], $GLOBALS['db']['s_user'], $GLOBALS['db']['s_pass'], $GLOBALS['db']['s_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to Source MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['s_link']));
        mysqli_select_db($GLOBALS['db']['s_link'], $GLOBALS['db']['s_base']) or die("Could not connect to Source database (multilink) [" . $GLOBALS['db']['s_base'] . "] : " . mysqli_error($GLOBALS['db']['s_link']));
        $GLOBALS['db']['x_link'] = mysqli_connect($GLOBALS['db']['x_host'], $GLOBALS['db']['x_user'], $GLOBALS['db']['x_pass'], $GLOBALS['db']['x_base']) or die($_SERVER["SCRIPT_FILENAME"] . "Could not connect to X-Ray MySQL Server (multilink). : " . mysqli_error($GLOBALS['db']['x_link']));
        mysqli_select_db($GLOBALS['db']['x_link'], $GLOBALS['db']['x_base']) or die("Could not connect to X-Ray database (multilink) [" . $GLOBALS['db']['x_base'] . "] : " . mysqli_error($GLOBALS['db']['x_link']));
    } else {
        $config_error .= $source_db_ok['message'] . "<BR>";
    }
    //	array_key_exists('form', $_POST) && $_POST['form']!="" ? $_GET = $_POST : NULL;
    //	array_key_exists('force', $_GET) && $_GET['force']!="" ? $_POST = $_GET : NULL;
    if (count($_GET) > 0) {
        $_POST = $_GET;
    }
    //	if($_POST['form']!=""){$_GET = $_POST;}
    //	if($_GET['force']!=""){$_POST = $_GET;}
    if (!FixOutput_Bool($GLOBALS['config_settings']['settings']['first_setup'], true, false, true)) {
        $GLOBALS['worlds'] = Get_Worlds_Enabled();
    }
}
Beispiel #2
0
                Do_Auth(true);
                $config_success .= "<BR><BR>SETUP COMPLETE: You have successfully configured X-Ray Detective.<BR>";
            } else {
                $config_error['message'] .= "ERROR: There was a problem writing to the Settings config file.<BR>";
            }
        }
    }
    if (!$setup_submit_ok && $config_error['message'] == "") {
        $config_error['message'] .= "ERROR: An unknown error occurred. Cannot continue to next step of installation.<BR>";
    }
}
if (!$_SESSION['first_setup'] || $setup_stage_tab == 2) {
    // Attempt to populate the X-Ray Worlds table before loading the Worlds configuration page
    $Find_Worlds_array = Find_WorldTables_Valid();
    $Worlds_all_array = Get_Worlds_All();
    $Worlds_enabled_array = Get_Worlds_Enabled();
    foreach ($Find_Worlds_array as $new_world_index => &$new_world_item) {
        $new_world_item["table_name"] = preg_replace('/^' . $GLOBALS['db']['s_prefix'] . '/', '', $new_world_item["table_name"]);
        $new_world_item["table_name"] = preg_replace('/^' . "lb-" . '/', '', $new_world_item["table_name"]);
        $new_world_item["table_name"] = preg_replace('/' . "_nether" . '$/', '', $new_world_item["table_name"]);
        $new_world_item["table_name"] = preg_replace('/' . "_the_end" . '$/', '', $new_world_item["table_name"]);
        // Remove worlds already existing in world table, only insert brand new ones
        foreach ($Worlds_all_array as $old_world_index => $old_world_item) {
            if ($new_world_item['table_name'] == $old_world_item['worldname']) {
                unset($Find_Worlds_array[$new_world_index]);
            }
        }
    }
    // Rebase array keys, to fix missing sequential values (1,2,3,5) => (1,2,3,4)
    $Find_Worlds_array = array_values($Find_Worlds_array);
    if (count($Find_Worlds_array) > 0) {