Beispiel #1
0
function MSD_mysql_connect($encoding = 'utf8', $keycheck_off = false, $actual_table = '')
{
    global $config, $databases;
    $port = isset($config['dbport']) && !empty($config['dbport']) ? ':' . $config['dbport'] : '';
    $socket = isset($config['dbsocket']) && !empty($config['dbsocket']) ? ':' . $config['dbsocket'] : '';
    $config['dbconnection'] = mysql_connect($config['dbhost'] . $port . $socket, $config['dbuser'], $config['dbpass']) or die(SQLError("Database connection error: ", mysql_error()));
    if (!defined('MSD_MYSQL_VERSION')) {
        GetMySQLVersion();
    }
    if (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') {
        get_sql_encodings();
    }
    if ($config['mysql_standard_character_set'] != $encoding) {
        $set_encoding = @mysql_query('SET NAMES \'' . $encoding . '\'', $config['dbconnection']);
        if ($set_encoding === false) {
            $config['mysql_can_change_encoding'] = false;
        } else {
            $config['mysql_can_change_encoding'] = true;
        }
    }
    if ($keycheck_off) {
        mysql_query('SET FOREIGN_KEY_CHECKS=0', $config['dbconnection']);
    }
    return $config['dbconnection'];
}
Beispiel #2
0
function MSD_mysql_connect($encoding = 'utf8', $keycheck_off = false, $actual_table = '')
{
    global $config, $databases;
    if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) {
        return $config['dbconnection'];
    }
    $port = isset($config['dbport']) && !empty($config['dbport']) ? ':' . $config['dbport'] : '';
    $socket = isset($config['dbsocket']) && !empty($config['dbsocket']) ? ':' . $config['dbsocket'] : '';
    $config['dbconnection'] = @mysql_connect($config['dbhost'] . $port . $socket, $config['dbuser'], $config['dbpass']) or die(SQLError("Error establishing a database connection!", mysql_error()));
    if (!defined('MSD_MYSQL_VERSION')) {
        GetMySQLVersion();
    }
    if (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') {
        get_sql_encodings();
    }
    if ($config['mysql_standard_character_set'] != $encoding) {
        $set_encoding = @mysql_query('SET NAMES \'' . $encoding . '\'', $config['dbconnection']);
        if ($set_encoding === false) {
            $config['mysql_can_change_encoding'] = false;
        } else {
            $config['mysql_can_change_encoding'] = true;
        }
    }
    if ($keycheck_off) {
        // only called with this param when restoring
        mysql_query('SET FOREIGN_KEY_CHECKS=0', $config['dbconnection']);
        // also set SQL-Mode NO_AUTO_VALUE_ON_ZERO for magento users
        mysql_query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"', $config['dbconnection']);
    }
    return $config['dbconnection'];
}
Beispiel #3
0
if (isset($_GET['action']) && $_GET['action'] == 'dl') {
    $download = true;
}
include './inc/header.php';
include_once './language/' . $config['language'] . '/lang.php';
include_once './language/' . $config['language'] . '/lang_filemanagement.php';
include_once './language/' . $config['language'] . '/lang_config_overview.php';
include_once './language/' . $config['language'] . '/lang_main.php';
include_once './inc/functions_files.php';
include_once './inc/functions_sql.php';
$msg = '';
$dump = array();
if ($config['auto_delete'] == 1) {
    $msg = AutoDelete();
}
get_sql_encodings();
// get possible sql charsets and also get default charset
//0=Datenbank  1=Struktur
$action = isset($_GET['action']) ? $_GET['action'] : 'files';
$kind = isset($_GET['kind']) ? $_GET['kind'] : 0;
$expand = isset($_GET['expand']) ? $_GET['expand'] : -1;
$selectfile = isset($_POST['selectfile']) ? $_POST['selectfile'] : "";
$destfile = isset($_POST['destfile']) ? $_POST['destfile'] : "";
$compressed = isset($_POST['compressed']) ? $_POST['compressed'] : "";
$dk = isset($_POST['dumpKommentar']) ? get_magic_quotes_gpc() ? stripslashes($_POST['dumpKommentar']) : $_POST['dumpKommentar'] : "";
$dk = str_replace(':', '|', $dk);
// remove : because of statusline
$dump['sel_dump_encoding'] = isset($_POST['sel_dump_encoding']) ? $_POST['sel_dump_encoding'] : get_index($config['mysql_possible_character_sets'], $config['mysql_standard_character_set']);
$dump['dump_encoding'] = isset($config['mysql_possible_character_sets'][$dump['sel_dump_encoding']]) ? $config['mysql_possible_character_sets'][$dump['sel_dump_encoding']] : 0;
if ($action == 'dl') {
    // Download of a backup file wanted
Beispiel #4
0
/**
 * Convert all array elements to UTF-8
 *
 * @param $array
 * @return array
 */
function convert_to_utf8($obj)
{
    global $config;
    $ret = $obj;
    // wenn die Verbindung zur Datenbank nicht auf utf8 steht, dann muessen die Rückgaben in utf8 gewandelt werden,
    // da die Webseite utf8-kodiert ist
    if (!isset($config['mysql_can_change_encoding'])) {
        get_sql_encodings();
    }
    if ($config['mysql_can_change_encoding'] == false && $config['mysql_standard_character_set'] != 'utf8') {
        if (is_array($obj)) {
            foreach ($obj as $key => $val) {
                //echo "<br> Wandle " . $val . " nach ";
                $obj[$key] = utf8_encode($val);
                //echo $obj[$key];
            }
        }
        if (is_string($obj)) {
            $obj = utf8_encode($obj);
        }
        $ret = $obj;
    }
    return $ret;
}