function update_config_php($db_prefs = false)
{
    global $reg_src, $reg_rep;
    global $dbhost, $dbuname, $dbpass, $dbname, $prefix, $dbtype;
    global $owp_url, $root_path, $HTTP_ENV_VARS;
    add_src_rep("OWP_DB_SERVER", $dbhost);
    add_src_rep("OWP_DB_USERNAME", base64_encode($dbuname));
    add_src_rep("OWP_DB_PASSWORD", base64_encode($dbpass));
    add_src_rep("OWP_DB_DATABASE", $dbname);
    add_src_rep("OWP_DB_PREFIX", $prefix);
    add_src_rep("OWP_DB_TYPE", $dbtype);
    add_src_rep("OWP_HTTP_SERVER", $owp_url);
    add_src_rep("OWP_ROOT_PATH", $root_path);
    if (strstr($HTTP_ENV_VARS["OS"], "Win")) {
        add_src_rep("OWP_SYSTEM", '1');
    } else {
        add_src_rep("OWP_SYSTEM", '0');
    }
    add_src_rep("OWP_ENCODED", '1');
    $ret = modify_file("../includes/config.php", "../includes/config-old.php", $reg_src, $reg_rep);
    if (preg_match("/Error/", $ret)) {
        show_error_info();
    }
}
Пример #2
0
function update_dbconfig_php($args = array())
{
    global $reg_src, $reg_rep;
    if (!$args) {
        return false;
    }
    $dbhost = $args['dbhost'];
    $dbuname = $args['dbuname'];
    $dbpass = $args['dbpass'];
    $dbname = $args['dbname'];
    //$dbtype      = $args['dbtype'];
    $prefix = $args['dbprefix'];
    //$dbtabletype = $args['dbtabletype'];
    $encoded = 1;
    add_src_rep("dbhost", $dbhost);
    add_src_rep("dbuname", base64_encode($dbuname));
    add_src_rep("dbpass", base64_encode($dbpass));
    add_src_rep("dbname", $dbname);
    add_src_rep("prefix", $prefix);
    //add_src_rep("dbtype",      $dbtype);
    //add_src_rep("dbtabletype", $dbtabletype);
    add_src_rep("encoded", '1');
    add_src_rep("pconnect", '0');
    //$ret = modify_file('eveconfig/dbconfig.php', 'eveconfig/dbconfig-old.php', $reg_src, $reg_rep);
    $ret = modify_file('eveconfig/dbconfig.php', '', $reg_src, $reg_rep);
    if (preg_match("/Error/", $ret)) {
        show_error_info();
    }
    return $ret;
}
/** Update the config.php file with the database information. (master function) */
function update_config_php($db_prefs = false)
{
    global $reg_src, $reg_rep;
    global $dbhost, $dbuname, $dbpass, $dbname, $prefix, $dbtype, $dbtabletype;
    global $email, $url, $HTTP_ENV_VARS;
    add_src_rep("dbhost", $dbhost);
    add_src_rep("dbuname", base64_encode($dbuname));
    add_src_rep("dbpass", base64_encode($dbpass));
    add_src_rep("dbname", $dbname);
    add_src_rep("prefix", $prefix);
    add_src_rep("dbtype", $dbtype);
    add_src_rep("dbtabletype", $dbtabletype);
    if (@strstr($HTTP_ENV_VARS["OS"], "Win")) {
        add_src_rep("system", '1');
    } else {
        add_src_rep("system", '0');
    }
    add_src_rep("encoded", '1');
    if ($email) {
        add_src_rep("adminmail", $email);
    }
    $ret = modify_file("config.php", "config-old.php", $reg_src, $reg_rep);
    if (preg_match("/Error/", $ret)) {
        show_error_info();
    }
}