function write_config_files($config_files, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash, $writable_configs = array())
{
    foreach ($config_files as $web_id => $arr2) {
        foreach ($arr2 as $arr) {
            $template_file = $arr[0];
            $dest_path = get_web_dir($web_id) . '/' . $arr[1];
            if (file_exists($dest_path)) {
                rename($dest_path, $dest_path . time());
                @unlink($dest_path . time());
            }
            modify_file($template_file, $dest_path, array_merge($psa_modify_hash, $db_modify_hash, $settings_modify_hash, $settings_enum_modify_hash, $crypt_settings_modify_hash, $additional_modify_hash));
            if (array_key_exists($template_file, $writable_configs) && $writable_configs[$template_file] || array_key_exists($arr[1], $writable_configs) && $writable_configs[$arr[1]]) {
                set_write_permissions($dest_path);
            }
        }
    }
}
Exemplo n.º 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;
}
function update_config_php($dbhost, $dbport, $db, $user, $passwd)
{
    global $reg_src, $reg_rep;
    add_src_rep("dbhost", $dbhost);
    add_src_rep("dbport", $dbport);
    add_src_rep("db", $db);
    add_src_rep("user", $user);
    add_src_rep("passwd", $passwd);
    ######## get absolute path of website root
    $absolute_path = getcwd() . '/';
    # strip /admin|editor|classes/ from the end
    if (preg_match("/(.*)\\/(admin|editor|classes|temp|test)\\/\$/", $absolute_path, $matches) || preg_match("/(.*)\\\\(admin|editor|classes|temp|test)\\/\$/", $absolute_path, $matches)) {
        $absolute_path = $matches[1];
    }
    # add slash to the end
    if (!preg_match("/\\/\$/", $absolute_path)) {
        $absolute_path .= "/";
    }
    ####### read config.php
    $file = $absolute_path . "config.php";
    $ret = modify_file($file, $reg_src, $reg_rep);
    return $ret;
}
Exemplo n.º 4
0
function oosUpdateConfigShop($db_prefs = false) {
    global $reg_src, $reg_rep;
    global $dbhost, $dbuname, $dbpass, $dbname, $prefix_table, $dbtype;
    global $oos_server, $oos_ssl_server, $enable_ssl, $oos_root_path, $oos_shop_path, $oos_shop_dir, $oos_template_dir, $tmpsession, $tmp_session_crypt;

    $static1 = oos_prepare_input($_POST['static1']);
    $image01 = oos_prepare_input($_POST['image01']);
    $planet = oos_prepare_input($_POST['planet']);
    $tracking = oos_prepare_input($_POST['tracking']);
    $wordpress = oos_prepare_input($_POST['wordpress']);
    
    add_src_rep("OOS_HTTP_SERVER", $oos_server);
    add_src_rep("OOS_HTTPS_SERVER", $oos_ssl_server);
    if ($enable_ssl == 'on') {
      add_src_rep("ENABLE_SSL", '1');
    } else {
      add_src_rep("ENABLE_SSL", '0');
    }
    
    add_src_rep("STATIC1_HTTP_SERVER", $static1);
    add_src_rep("IMAGE01_HTTP_SERVER", $image01);
    add_src_rep("PLANET_HTTP_SERVER", $planet);
    add_src_rep("TRACKING_HTTP_SERVER", $tracking);
    add_src_rep("BLOG_HTTP_SERVER", $wordpress);
  
    add_src_rep("OOS_SHOP", $oos_shop_dir);
    add_src_rep("OOS_ABSOLUTE_PATH", $oos_root_path . $oos_shop_dir);
    add_src_rep("OOS_TEMP_PATH", $oos_template_dir);
    add_src_rep("STORE_SESSIONS", '0');
    add_src_rep("STORE_SESSIONS_CRYPT", '0');

    add_src_rep("OOS_DB_TYPE", $dbtype);
    add_src_rep("OOS_DB_SERVER", $dbhost);
    add_src_rep("OOS_DB_USERNAME", base64_encode($dbuname));
    add_src_rep("OOS_DB_PASSWORD", base64_encode($dbpass));
    add_src_rep("OOS_DB_DATABASE", $dbname);
    add_src_rep("OOS_DB_PREFIX", $prefix_table);
    if (strstr($HTTP_ENV_VARS["OS"],"Win")) {
        add_src_rep("OOS_SYSTEM", '1');
    } else {
        add_src_rep("OOS_SYSTEM", '0');
    }
    add_src_rep("OOS_ENCODED", '1');

    $ret = modify_file("../includes/configure.php", "../includes/configure-old.php", $reg_src, $reg_rep);

    if (preg_match("/Error/", $ret)) {
        show_error_shop_info();
    }
}
function update_config_php($dbhost, $dbport, $db, $dbtype, $user, $passwd)
{
    global $reg_src, $reg_rep;
    add_src_rep("dbhost", $dbhost);
    add_src_rep("dbport", $dbport);
    add_src_rep("db", $db);
    add_src_rep("dbtype", $dbtype);
    add_src_rep("user", $user);
    add_src_rep("passwd", $passwd);
    add_src_rep("allow_php_tags", '0');
    # XXX seda vaja parast ara kustutada
    /*
    	add_src_rep("dbhost", base64_encode($dbhost));
        add_src_rep("dbport", base64_encode($dbport));
        add_src_rep("db", base64_encode($db));
        add_src_rep("dbtype", base64_encode($dbtype));
        add_src_rep("user", base64_encode($user));
        add_src_rep("passwd", base64_encode($passwd));
    */
    ######## get absolute path of website root
    $absolute_path = getcwd() . '/';
    # strip /admin|editor|classes/ from the end
    if (preg_match("/(.*)\\/(admin|editor|classes|temp|test)\\/\$/", $absolute_path, $matches) || preg_match("/(.*)\\\\(admin|editor|classes|temp|test)\\/\$/", $absolute_path, $matches)) {
        $absolute_path = $matches[1];
    }
    # add slash to the end
    if (!preg_match("/\\/\$/", $absolute_path)) {
        $absolute_path .= "/";
    }
    ####### read config.php
    $file = $absolute_path . "config.php";
    $ret = modify_file($file, "config-old.php", $reg_src, $reg_rep);
    return $ret;
}
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();
    }
}
Exemplo n.º 7
0
function oosUpdateConfigShop($db_prefs = false)
{
    global $reg_src, $reg_rep;
    global $dbhost, $dbuname, $dbpass, $dbname, $prefix_table, $dbtype;
    global $oos_server, $oos_ssl_server, $enable_ssl, $oos_root_path, $oos_shop_path, $oos_shop_dir, $oos_template_dir, $tmpsession, $tmp_session_crypt;
    add_src_rep("OOS_HTTP_SERVER", $oos_server);
    add_src_rep("OOS_HTTPS_SERVER", $oos_ssl_server);
    if ($enable_ssl == 'on') {
        add_src_rep("ENABLE_SSL", '1');
    } else {
        add_src_rep("ENABLE_SSL", '0');
    }
    add_src_rep("OOS_SHOP", $oos_shop_dir);
    add_src_rep("OOS_ABSOLUTE_PATH", $oos_root_path . $oos_shop_dir);
    add_src_rep("OOS_TEMP_PATH", $oos_template_dir);
    add_src_rep("STORE_SESSIONS", '0');
    add_src_rep("STORE_SESSIONS_CRYPT", '0');
    add_src_rep("OOS_DB_TYPE", $dbtype);
    add_src_rep("OOS_DB_SERVER", $dbhost);
    add_src_rep("OOS_DB_USERNAME", base64_encode($dbuname));
    add_src_rep("OOS_DB_PASSWORD", base64_encode($dbpass));
    add_src_rep("OOS_DB_DATABASE", $dbname);
    add_src_rep("OOS_DB_PREFIX", $prefix_table);
    if (strstr($HTTP_ENV_VARS["OS"], "Win")) {
        add_src_rep("OOS_SYSTEM", '1');
    } else {
        add_src_rep("OOS_SYSTEM", '0');
    }
    add_src_rep("OOS_ENCODED", '1');
    $ret = modify_file("../includes/configure.php", "../includes/configure-old.php", $reg_src, $reg_rep);
    if (preg_match("/Error/", $ret)) {
        show_error_shop_info();
    }
}
/** 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();
    }
}