<?php

// insert a new record
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => './tpl/sqlbrowser/sql_record_insert_inputmask.tpl'));
$sqledit = "SHOW FIELDS FROM `{$tablename}`";
$res = MSD_query($sqledit);
$num = mysql_numrows($res);
$feldnamen = "";
for ($x = 0; $x < $num; $x++) {
    $row = mysql_fetch_object($res);
    $feldnamen .= $row->Field . '|';
    $tpl->assign_block_vars('ROW', array('CLASS' => $x % 2 ? 1 : 2, 'FIELD_NAME' => $row->Field, 'FIELD_ID' => correct_post_index($row->Field)));
    $type = strtoupper($row->Type);
    if (strtoupper($row->Null) == 'YES') {
        //field is nullable
        $tpl->assign_block_vars('ROW.IS_NULLABLE', array());
    }
    if (in_array($type, array('BLOB', 'TEXT'))) {
        $tpl->assign_block_vars('ROW.IS_TEXTAREA', array());
    } else {
        $tpl->assign_block_vars('ROW.IS_TEXTINPUT', array());
    }
}
$tpl->assign_vars(array('HIDDEN_FIELDS' => FormHiddenParams(), 'FIELDNAMES' => substr($feldnamen, 0, strlen($feldnamen) - 1), 'SQL_STATEMENT' => my_quotes($sql['sql_statement'])));
$tpl->pparse('show');
    $del = @unlink('./' . $config['paths']['config'] . $deleteConfig . '.php');
    if ($del) {
        // delete Perl config file
        $delFile = $config['paths']['config'] . $deleteConfig . '.conf.php';
        $del = @unlink('./' . $delFile);
    }
    if ($del === false) {
        $msg = '<p class="error">' . sprintf($lang['L_ERROR_DELETING_CONFIGFILE'], $deleteConfig) . '</p>';
    } else {
        $msg = '<p class="success">' . sprintf($lang['L_SUCCESS_DELETING_CONFIGFILE'], $deleteConfig) . '</p>';
    }
    $sel = 'configs';
}
$tplConfigurationConfigFiles = new MSDTemplate();
$tplConfigurationConfigFiles->set_filenames(array('tplConfigurationConfigFiles' => 'tpl/configuration/configFiles.tpl'));
$tplConfigurationConfigFiles->assign_vars(array('ICON_SAVE' => $icon['small']['save'], 'ICON_SEARCH' => $icon['search'], 'ICON_EDIT' => $icon['edit'], 'ICON_DELETE' => $icon['delete']));
$i = 0;
$configs = getConfigFilenames();
// iterate config files and print settings to screen
foreach ($configs as $c) {
    $i++;
    unset($databases);
    $databases = array();
    getConfig($c);
    $rowclass = $i % 2 ? 'dbrow' : 'dbrow1';
    if ($oldConfig == $c) {
        $rowclass = 'dbrowsel';
        // highlight active configuration
    }
    // Generate configuration output
    $outputstringMultisettings = '';
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
/*
 * Fetch and check _GET variables
 */
$db = isset($_GET['db']) ? base64_decode($_GET['db']) : $config['db_actual'];
$tablename = isset($_GET['tablename']) ? base64_decode($_GET['tablename']) : '';
$dbo->selectDb($db);
$tableInfos = $dbo->getTableColumns($tablename, $db);
$tplSqlbrowserTableEditTable = new MSDTemplate();
$tplSqlbrowserTableEditTable->set_filenames(array('tplSqlbrowserTableEditTable' => 'tpl/sqlbrowser/table/edit_table.tpl'));
$tplSqlbrowserTableEditTable->assign_vars(array('DB' => $db, 'TABLE' => $tablename));
$sumSize = 0;
$i = 0;
foreach ($tableInfos as $key => $tableInfo) {
    if ($key != 'primary_keys') {
        $type = $tableInfo['Type'];
        $typeTemp = array();
        // ENUM-/SET-Handling
        if (strpos($type, 'enum') !== false || strpos($type, 'set') !== false) {
            $toBeReplaced = array('set(', 'enum(', ')', '\'');
            $typeTemp = str_replace($toBeReplaced, '', $type);
            $typeTemp = explode(',', $typeTemp);
            sort($typeTemp);
            if (strpos($type, 'enum') !== false) {
                $type = 'enum';
            } else {
    }
    if (isset($_POST['sqlboxsize'])) {
        $config['interface_sqlboxsize'] = (int) $_POST['sqlboxsize'];
    }
    if (isset($_POST['theme'])) {
        $config['theme'] = (string) $_POST['theme'];
    }
    // make sure that the theme exists! If not fall back to standard theme
    if (!is_dir('./css/' . $config['theme']) || !is_readable('./css/' . $config['theme'])) {
        $config['theme'] = 'msd';
    }
    if (isset($_POST['notification_position'])) {
        $config['notification_position'] = $_POST['notification_position'];
    }
    if (isset($_POST['interface_table_compact'])) {
        $config['interface_table_compact'] = (int) $_POST['interface_table_compact'];
    }
    if (isset($_POST['resultsPerPage'])) {
        $config['resultsPerPage'] = (int) $_POST['resultsPerPage'];
    }
    if (isset($_POST['refresh_processlist'])) {
        $config['refresh_processlist'] = (int) $_POST['refresh_processlist'];
    }
    if ($config['refresh_processlist'] < 2) {
        $config['refresh_processlist'] = 2;
    }
}
$tplConfigurationInterface = new MSDTemplate();
$tplConfigurationInterface->set_filenames(array('tplConfigurationInterface' => 'tpl/configuration/interface.tpl'));
$tplConfigurationInterface->assign_vars(array('ICON_SAVE' => $icon['small']['save'], 'SEL_LANGUAGES' => getLanguageCombo(), 'LINK_DOWNLOAD_LANGUAGE_PACKS' => 'http://forum.mysqldumper.de/downloads.php?cat=9', 'LANGUAGE' => $config['language'], 'SERVER_CAPTION' => $config['interface_server_caption'], 'INTERFACE_SERVER_CAPTION_ACTIVATED' => Html::getChecked($config['interface_server_caption'], 1), 'INTERFACE_SERVER_CAPTION_DISABLED' => Html::getDisabled($config['interface_server_caption'], 0), 'SERVER_CAPTION_POS_MAINFRAME_SELECTED' => Html::getChecked($config['interface_server_caption_position'], 1), 'SERVER_CAPTION_POS_MENUE_SELECTED' => Html::getChecked($config['interface_server_caption_position'], 0), 'SEL_THEME' => getThemes(), 'LINK_DOWNLOAD_THEMES' => 'http://forum.mysqldumper.de/downloads.php?cat=3', 'SQLBOX_HEIGHT' => intval($config['interface_sqlboxsize']), 'RESULTS_PER_PAGE' => intval($config['resultsPerPage']), 'SEL_NOTIFICATION_POSITION' => Html::getOptionlist($positions, $config['notification_position']), 'REFRESH_PROCESSLIST' => (int) $config['refresh_processlist'], 'SQL_GRID_TYPE_COMPACT_SELECTED' => $config['interface_table_compact'] == 1 ? ' checked="checked"' : '', 'SQL_GRID_TYPE_NORMAL_SELECTED' => $config['interface_table_compact'] == 0 ? ' checked="checked"' : ''));
    die('No direct access.');
}
$selectedFilter = -1;
if (isset($_POST['filter_selected'])) {
    $selectedFilter = $_POST['filter_selected'];
}
$vars = array();
$res = $dbo->query('SHOW VARIABLES', MsdDbFactory::ARRAY_ASSOC);
$numrows = @sizeof($res);
foreach ($res as $row) {
    $vars[$row['Variable_name']] = $row['Value'];
}
$filter = getPrefixArray($vars);
$tplSqlbrowserGeneralMysqlVariables = new MSDTemplate();
$tplSqlbrowserGeneralMysqlVariables->set_filenames(array('tplSqlbrowserGeneralMysqlVariables' => 'tpl/sqlbrowser/general/mysqlVariables.tpl'));
$tplSqlbrowserGeneralMysqlVariables->assign_vars(array('SEL_FILTER' => Html::getOptionlist($filter, $selectedFilter)));
if (count($vars) == 0) {
    $tpl->assign_block_vars('NO_VALUES', array());
} else {
    $i = 0;
    foreach ($vars as $name => $val) {
        if ($selectedFilter != '-1' && substr($name, 0, strlen($selectedFilter)) != $selectedFilter) {
            continue;
        }
        if (is_numeric($val)) {
            if (strpos($name, 'time') === false) {
                $val = String::formatNumber($val);
            } else {
                $val = getTimeFormat($val);
            }
        }
/**
 * This file is part of MySQLDumper released under the GNU/GPL 2 license
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
// special div selected? DIV with this id will be shown e.g after pressing
// the save button
$sel = isset($_POST['sel']) ? $_POST['sel'] : 'db';
if (isset($_GET['sel'])) {
    $sel = $_GET['sel'];
}
$tplConfigurationFooter = new MSDTemplate();
$tplConfigurationFooter->set_filenames(array('tplConfigurationFooter' => 'tpl/configuration/footer.tpl'));
$tplConfigurationFooter->assign_vars(array('SELECTED_DIV' => $sel, 'NOTIFICATION_POSITION' => $config['notification_position']));
//output notification message if we have one
if ($msg > '') {
    $tplConfigurationFooter->assign_block_vars('MESSAGE', array('TEXT' => Html::getJsQuote($msg, true)));
}
// if something went wrong with the change of a user or no database was found
// -> blend in connection params and let the user correct it
if (isset($blendInConnectionParams) && $blendInConnectionParams || count($databases) == 0) {
    $tplConfigurationFooter->assign_block_vars('SWITCH_TO_CONNECTION_PARAMETER', array());
}
<?php

/**
 * This file is part of MySQLDumper released under the GNU/GPL 2 license
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
if (isset($_POST['save'])) {
    if (!is_array($config['auto_delete'])) {
        $config['auto_delete'] = array();
        $config['auto_delete']['activated'] = 0;
        $config['auto_delete']['max_backup_files'] = 3;
    }
    if (isset($_POST['auto_delete'])) {
        $config['auto_delete']['activated'] = (int) $_POST['auto_delete'];
    }
    if (isset($_POST['max_backup_files'])) {
        $config['auto_delete']['max_backup_files'] = (int) $_POST['max_backup_files'];
    }
}
$tplConfigurationAutodelete = new MSDTemplate();
$tplConfigurationAutodelete->set_filenames(array('tplConfigurationAutodelete' => 'tpl/configuration/autodelete.tpl'));
$tplConfigurationAutodelete->assign_vars(array('ICON_SAVE' => $icon['small']['save'], 'AUTODELETE_ENABLED_SELECTED' => Html::getChecked($config['auto_delete']['activated'], 1), 'AUTODELETE_DISABLED_SELECTED' => Html::getChecked($config['auto_delete']['activated'], 0), 'MAX_BACKUP_FILES' => (int) $config['auto_delete']['max_backup_files'], 'MAX_BACKUP_FILES_DISABLED' => Html::getDisabled($config['auto_delete']['activated'], 0)));
        $res = $dbo->query($query, MsdDbFactory::SIMPLE);
        if (true === $res) {
            $tplSqlbrowserDbOperation->assign_block_vars('ROW', array('ROWCLASS' => $index % 2 ? 'dbrow' : 'dbrow1', 'NR' => $index + 1, 'DBNAME' => $associatedDatabase[$index], 'ACTION' => $actionOutput, 'QUERY' => $query));
        } else {
            $tplSqlbrowserDbOperation->assign_block_vars('ERROR', array('ROWCLASS' => $index % 2 ? 'dbrow' : 'dbrow1', 'NR' => $index + 1, 'DBNAME' => $associatedDatabase[$index], 'ACTION' => $actionOutput, 'QUERY' => $query, 'ERROR' => mysql_error($config['dbconnection'])));
        }
        $i++;
    }
    if ($do == 'db_delete') {
        setDefaultConfig();
    }
}
//list databases
$tplSqlbrowserDbListDatabases = new MSDTemplate();
$tplSqlbrowserDbListDatabases->set_filenames(array('tplSqlbrowserDbListDatabases' => 'tpl/sqlbrowser/db/list_databases.tpl'));
$tplSqlbrowserDbListDatabases->assign_vars(array('ICON_DB' => $icon['db'], 'ICON_VIEW' => $icon['view'], 'ICON_EDIT' => $icon['edit'], 'ICON_DELETE' => $icon['delete'], 'ICON_PLUS' => $icon['plus'], 'ICON_MINUS' => $icon['minus'], 'ICON_TRUNCATE' => $icon['truncate'], 'CONFIRM_TRUNCATE_DATABASES' => Html::getJsQuote($lang['L_CONFIRM_TRUNCATE_DATABASES'], true), 'CONFIRM_DROP_DATABASES' => Html::getJsQuote($lang['L_CONFIRM_DROP_DATABASES'], true)));
$i = 0;
foreach ($databases as $dbName => $val) {
    $rowclass = $i % 2 ? 'dbrow' : 'dbrow1';
    if ($dbName == $config['db_actual']) {
        $rowclass = "dbrowsel";
    }
    //does the database exist?
    if (!$dbo->selectDb($dbName, true)) {
        // no -> show message "doesn't exist"
        $tplSqlbrowserDbListDatabases->assign_block_vars('DB_NOT_FOUND', array('ROWCLASS' => $rowclass, 'NR' => $i + 1, 'DB_NAME' => $dbName, 'DB_ID' => $i));
        // if this happens the list is not accurate
        // -> reload db-list to remove deleted dbs
        setDefaultConfig();
    } else {
        // yes, db exists -> show nr of tables
$refdir = substr($config['cron_execution_path'], 0, 1) == '/' ? '' : $url;
$scriptdir = $config['cron_execution_path'] . 'crondump.' . $cext;
$perlModultest = $config['cron_execution_path'] . "perltest.{$cext}";
$perlSimpletest = $config['cron_execution_path'] . "simpletest.{$cext}";
$scriptentry = myRealpath('./') . $config['paths']['config'];
$cronabsolute = myRealpath('./') . $scriptdir;
if (substr($config['cron_execution_path'], 0, 1) == '/') {
    $cronabsolute = $_SERVER['DOCUMENT_ROOT'] . $scriptdir;
}
$confabsolute = $config['config_file'];
$perlHttpCall = getServerProtocol() . $serverName . $refdir;
$perlHttpCall .= $config['cron_execution_path'] . 'crondump.' . $cext;
$perlHttpCall .= '?config=' . $confabsolute;
$perlCrontabCall = 'perl ' . $cronabsolute . ' -config=' . $confabsolute;
$perlCrontabCall .= ' -html_output=0';
$tplDumpPrepare->assign_vars(array('SESSION_ID' => session_id(), 'CONFIG_FILE' => $config['config_file'], 'POSSIBLE_DUMP_ENCODINGS' => Html::getOptionlist($charsetsDescription, 'utf8'), 'DBS_TO_BACKUP' => $dbsToBackup, 'TABLES_TOTAL' => $dump['tables_total'], 'RECORDS_TOTAL' => String::formatNumber(intval($dump['records_total'])), 'DATASIZE_TOTAL' => byteOutput($dump['datasize_total']), 'NR_OF_DBS' => count($dump['databases']), 'DUMP_COMMENT' => Html::replaceQuotes($dump['comment']), 'PERL_TEST' => $perlSimpletest, 'PERL_MODULTEST' => $perlModultest, 'PERL_HTTP_CALL' => $perlHttpCall, 'PERL_CRONTAB_CALL' => $perlCrontabCall, 'PERL_ABSOLUTE_PATH_OF_CONFIGDIR' => $scriptentry, 'TIMESTAMP' => time()));
if (count($dump['databases']) == 1 && $config['db_actual'] == $dbsToBackup) {
    $tplDumpPrepare->assign_block_vars('TABLESELECT', array());
}
if ($config['compression'] == 1) {
    $tplDumpPrepare->assign_block_vars('GZIP_ACTIVATED', array());
} else {
    $tplDumpPrepare->assign_block_vars('GZIP_NOT_ACTIVATED', array());
}
if ($config['multi_part'] == 1) {
    $tplDumpPrepare->assign_block_vars('MULTIPART', array('SIZE' => byteOutput($config['multipart_groesse'])));
} else {
    $tplDumpPrepare->assign_block_vars('NO_MULTIPART', array());
}
if ($config['send_mail'] == 1) {
    $tplDumpPrepare->assign_block_vars('SEND_MAIL', array('RECIPIENT' => $config['email']['recipient_address']));
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => './tpl/sqlbrowser/sql_record_update_inputmask.tpl'));
$target = $mode == "searchedit" ? '?mode=searchedit' : '?mode=update';
// jump back to search hit list after saving
$fields = getExtendedFieldInfo($db, $tablename);
$sqledit = "SELECT * FROM `{$tablename}` WHERE " . $recordkey;
$res = MSD_query($sqledit);
$record = mysqli_fetch_array($res, MYSQLI_ASSOC);
// get the record
$num = sizeof($record);
// get the nr of fields of the record
// iterate fields
$x = 0;
$fieldnames = '';
foreach ($record as $field => $fieldvalue) {
    $fieldnames .= $field . '|';
    $tpl->assign_block_vars('ROW', array('CLASS' => $x % 2 ? 1 : 2, 'FIELD_NAME' => $field, 'FIELD_VALUE' => my_quotes($fieldvalue), 'FIELD_ID' => correct_post_index($field)));
    if ('YES' == $fields[$field]['null']) {
        //field is nullable - precheck checkbox if value is null
        $tpl->assign_block_vars('ROW.IS_NULLABLE', array('NULL_CHECKED' => is_null($fieldvalue) ? ' checked="checked"' : ''));
    }
    $type = strtoupper($fields[$field]['type']);
    if (in_array($type, array('BLOB', 'TEXT'))) {
        $tpl->assign_block_vars('ROW.IS_TEXTAREA', array());
    } else {
        $tpl->assign_block_vars('ROW.IS_TEXTINPUT', array());
    }
    $x++;
}
$tpl->assign_vars(array('HIDDEN_FIELDS' => FormHiddenParams(), 'FIELDNAMES' => substr($fieldnames, 0, strlen($fieldnames) - 1), 'SQL_STATEMENT' => my_quotes($sql['sql_statement']), 'RECORDKEY' => my_quotes($recordkey), 'TARGET' => $target));
$tpl->pparse('show');
// we need to save this before the Ajax-Requests starts, so we are doing it here
// although it is done in dump.php
$_SESSION['dump'] = $dump;
// checks after first dump-prepare if we need to head over to table selection
// or if we can start the backup process
if (!isset($_POST['tableselect'])) {
    // nothing to select - start dump action
    $action = 'do_dump';
} else {
    // yes, we need to show the table-selection, but first save commetn and
    // encoding that was set before
    $tplDumpSelectTables = new MSDTemplate();
    $tplDumpSelectTables->set_filenames(array('tplDumpSelectTables' => 'tpl/dump/selectTables.tpl'));
    $dbo->selectDb($dump['db_actual']);
    $tables = $dbo->getTableStatus();
    $i = 0;
    foreach ($tables as $tableName => $row) {
        $klasse = $i % 2 ? 1 : '';
        $tableSize = byteOutput($row['Data_length'] + $row['Index_length']);
        $tableType = $row['Engine'];
        $nrOfRecords = String::formatNumber($row['Rows']);
        if (substr($row['Comment'], 0, 4) == 'VIEW' && $row['Engine'] == '') {
            $tableType = 'View';
            $tableSize = '-';
            $nrOfRecords = '-';
        }
        $tplDumpSelectTables->assign_block_vars('ROW', array('CLASS' => 'dbrow' . $klasse, 'ID' => $i, 'NR' => $i + 1, 'TABLENAME' => $tableName, 'TABLETYPE' => $tableType, 'RECORDS' => $nrOfRecords, 'SIZE' => $tableSize, 'LAST_UPDATE' => $row['Update_time']));
        $i++;
    }
    $tplDumpSelectTables->assign_vars(array('PAGETITLE' => $lang['L_TABLESELECTION'], 'SESSION_ID' => session_id(), 'DATABASE' => $config['db_actual'], 'ICON_OK' => $icon['ok'], 'ICON_DELETE' => $icon['delete'], 'ICON_DB' => $icon['db'], 'L_NO_MSD_BACKUP' => $lang['L_NOT_SUPPORTED']));
}
/*
 * Fetch and check _GET variables
 */
$validModes = array('VIEW', 'EDIT', 'NEW');
$db = isset($_GET['db']) ? base64_decode($_GET['db']) : $config['db_actual'];
$tablename = isset($_GET['tablename']) ? base64_decode($_GET['tablename']) : '';
$rowKey = isset($_GET['key']) ? base64_decode($_GET['key']) : '';
$mode = 'VIEW';
if (isset($_GET['do'])) {
    $mode = strtoupper((string) $_GET['do']);
}
if (!in_array($mode, $validModes)) {
    $mode = 'VIEW';
}
$tableInfos = getExtendedFieldInfo($db, $tablename);
$tplSqlbrowserTableShowTabledataEntry->assign_vars(array('DB_NAME' => $db, 'TABLE_NAME' => $tablename, 'DB_NAME_URLENCODED' => base64_encode($db), 'TABLE_NAME_URLENCODED' => base64_encode($tablename)));
$row = array();
if ($mode == 'VIEW' || $mode == 'EDIT') {
    $dbo->selectDb($db);
    $query = "SELECT * FROM `{$tablename}` WHERE {$rowKey}";
    $row = $dbo->query($query, MsdDbFactory::ARRAY_ASSOC);
    if (false === $row || !isset($row[0])) {
        //TODO clean error handling
        echo "<h2>Keine Datensätze gefunden!</h2>";
        obend(true);
        exit;
    } elseif (count($row) > 1) {
        // TODO clean error handling
        echo "<h2>Mehrere Datensätze gefunden!</h2>";
    }
    $row = $row[0];
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
include './inc/define_icons.php';
$hta = '';
$tplHomeProtectionEdit = new MSDTemplate();
$tplHomeProtectionEdit->set_filenames(array('tplHomeProtectionEdit' => 'tpl/home/protection_edit.tpl'));
if (isset($_POST['hta_content'])) {
    if ($fp = fopen('./.htaccess', 'w')) {
        if (fwrite($fp, $_POST['hta_content'])) {
            $tplHomeProtectionEdit->assign_block_vars('HTA_SAVED_SUCCESSFULLY', array());
        } else {
            $tplHomeProtectionEdit->assign_block_vars('HTA_SAVED_UNSUCCESSFULLY', array());
        }
        fclose($fp);
    } else {
        $tplHomeProtectionEdit->assign_block_vars('ERROR_OPENING_HTACCESS', array());
    }
}
if (file_exists('./.htaccess') && is_readable('./.htaccess')) {
    $hta = implode('', file('./.htaccess'));
} else {
    $tplHomeProtectionEdit->assign_block_vars('ERROR_OPENING_HTACCESS', array());
}
$tplHomeProtectionEdit->assign_vars(array('HTA_CONTENT' => htmlspecialchars($hta, ENT_COMPAT, 'UTF-8'), 'ICON_SEARCH' => $icon['search'], 'ICON_OPEN_FILE' => $icon['small']['open_file'], 'ICON_SAVE' => $icon['small']['save'], 'ICON_DELETE' => $icon['delete'], 'ICON_ARROW_LEFT' => $icon['arrow_left']));
include './inc/runtime.php';
include './inc/mysql.php';
include './inc/functions/functions_global.php';
include './lib/template.php';
include './inc/functions/functions_restore.php';
include './lib/json.php';
obstart(true);
include './inc/functions/functions_sql.php';
$tplSqlbrowserTableShowTabledataEntry = new MSDTemplate();
$tplSqlbrowserTableShowTabledataEntry->set_filenames(array('tpl_sqlbrowser_table_show_tabledata' => './tpl/sqlbrowser/table/edit_field.tpl'));
/*
 * Fetch and check _GET variables
 */
$validModes = array('new');
$db = isset($_GET['db']) ? base64_decode($_GET['db']) : $config['db_actual'];
$tablename = isset($_GET['tablename']) ? base64_decode($_GET['tablename']) : '';
$fieldname = isset($_GET['fieldname']) ? base64_decode($_GET['fieldname']) : '';
$rowKey = isset($_GET['key']) ? base64_decode($_GET['key']) : '';
$mode = 'new';
if (isset($_GET['do']) && in_array($_GET['do'], $validModes)) {
    $mode = $_GET['do'];
}
$tableInfos = getExtendedFieldInfo($db, $tablename);
$tplSqlbrowserTableShowTabledataEntry->assign_vars(array('MODE' => $mode));
$row = array();
if ($mode == 'EDIT') {
    //TODO implement :)
}
$tplSqlbrowserTableShowTabledataEntry->assign_block_vars('FOOTER_' . $mode, array());
$tplSqlbrowserTableShowTabledataEntry->pparse('tpl_sqlbrowser_table_show_tabledata');
obend(true);
Exemple #15
0
}
$tpl->pparse('show');
//list tables of selected database
if (isset($_GET['dbid'])) {
    $disabled_keys_found = false;
    // Output list of tables of the selected database
    $tpl = new MSDTemplate();
    $tpl->set_filenames(array('show' => 'tpl/home/databases_list_tables.tpl'));
    $dbid = $_GET['dbid'];
    $numrows = 0;
    $res = @mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `" . $databases['Name'][$dbid] . "`");
    (bool) mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid]);
    if ($res) {
        $numrows = mysqli_num_rows($res);
    }
    $tpl->assign_vars(array('DB_NAME' => $databases['Name'][$dbid], 'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]), 'DB_ID' => $dbid, 'TABLE_COUNT' => $numrows, 'ICONPATH' => $config['files']['iconpath']));
    $numrows = intval($numrows);
    if ($numrows > 1) {
        $tpl->assign_block_vars('MORE_TABLES', array());
    } elseif ($numrows == 1) {
        $tpl->assign_block_vars('1_TABLE', array());
    } elseif ($numrows == 0) {
        $tpl->assign_block_vars('NO_TABLE', array());
    }
    if ($numrows > 0) {
        $last_update = "2000-01-01 00:00:00";
        $sum_records = $sum_data_length = '';
        for ($i = 0; $i < $numrows; $i++) {
            $row = mysqli_fetch_array($res, MYSQLI_ASSOC);
            // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
            $sql_2 = "SELECT count(*) as `count_records` FROM `" . $databases['Name'][$dbid] . "`.`" . $row['Name'] . "`";
    $p = (string) $_POST['p'];
}
$action = isset($_GET['action']) ? (string) $_GET['action'] : '';
if (isset($_POST['action'])) {
    $action = (string) $_POST['action'];
}
$dbo = null;
$log = new Log();
if ($action != 'dl') {
    // don't send HTML-Header if download of file is started
    obstart();
    $tplGlobalHeader = new MSDTemplate();
    $tplGlobalHeader->set_filenames(array('tplGlobalHeader' => 'tpl/globalHeader.tpl'));
    $language = explode('_', $config['language'], 2);
    $language = $language[0];
    $tplGlobalHeader->assign_vars(array('LANGUAGE' => $language, 'MSD_VERSION' => MSD_VERSION, 'THEME' => $config['theme'], 'DIRECTION' => 'ltr'));
}
// in some cases (config changed, reload database list, etc.) the menu must be
// rendered before the content
// is handled to update parameters that are used
if (isset($_POST['selected_config']) || isset($_GET['config']) || isset($_GET['dbrefresh']) || isset($_POST['dbindex']) || isset($_GET['dbindex'])) {
    include './inc/menu.php';
}
switch ($p) {
    case 'dump':
        include './inc/dump.php';
        break;
    case 'restore':
        include './inc/restore.php';
        break;
    case 'files':
    $type = 2;
}
// we are on a Win-System; pre-select encryption type
if (isset($_POST['type'])) {
    $type = intval($_POST['type']);
}
$username = isset($_POST['username']) ? $_POST['username'] : '';
$userpass1 = isset($_POST['userpass1']) ? $_POST['userpass1'] : '';
$userpass2 = isset($_POST['userpass2']) ? $_POST['userpass2'] : '';
header('Pragma: no-cache');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: -1");
header('Content-Type: text/html; charset=UTF-8');
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => './tpl/home/protection_create.tpl'));
$tpl->assign_vars(array('THEME' => $config['theme'], 'HEADLINE' => headline($lang['L_HTACC_CREATE'])));
if (isset($_POST['username'])) {
    // Form submitted
    if ($username == '') {
        $error[] = $lang['L_HTACC_NO_USERNAME'];
    }
    if ($userpass1 != $userpass2 || $userpass1 == '') {
        $error[] = $lang['L_PASSWORDS_UNEQUAL'];
    }
    if (sizeof($error) == 0) {
        $realm = 'MySQLDumper';
        $htaccess = "AuthName \"" . $realm . "\"\nAuthType Basic\nAuthUserFile \"" . $config['paths']['root'] . ".htpasswd\"\nrequire valid-user\n";
        switch ($type) {
            // Crypt
            case 0:
                $userpass = crypt($userpass1);
Exemple #18
0
    if ($filename != '.' && $filename != '..' && !is_dir($config['paths']['backup'] . $filename)) {
        $files[] = $filename;
        $Sum_Files++;
        $Sum_Size += filesize($config['paths']['backup'] . $filename);
        $ft = filectime($config['paths']['backup'] . $filename);
        if (!isset($Last_BU[2]) || isset($Last_BU[2]) && $ft > $Last_BU[2]) {
            $Last_BU[0] = $filename;
            $Last_BU[1] = date("d.m.Y H:i", $ft);
            $Last_BU[2] = $ft;
        }
    }
}
$directory_warnings = DirectoryWarnings();
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => 'tpl/home/home.tpl'));
$tpl->assign_vars(array('THEME' => $config['theme'], 'MSD_VERSION' => MSD_VERSION, 'OS' => MSD_OS, 'OS_EXT' => MSD_OS_EXT, 'MYSQL_VERSION' => MSD_MYSQL_VERSION, 'PHP_VERSION' => PHP_VERSION, 'MEMORY' => byte_output($config['php_ram'] * 1024 * 1024), 'MAX_EXECUTION_TIME' => $config['max_execution_time'], 'PHP_EXTENSIONS' => $config['phpextensions'], 'SERVER_NAME' => $_SERVER['SERVER_NAME'], 'MSD_PATH' => $config['paths']['root'], 'DB' => $databases['db_actual'], 'NR_OF_BACKUP_FILES' => $Sum_Files, 'SIZE_BACKUPS' => byte_output($Sum_Size), 'FREE_DISKSPACE' => MD_FreeDiskSpace()));
if ($directory_warnings > '') {
    $tpl->assign_block_vars('DIRECTORY_WARNINGS', array('MSG' => $directory_warnings));
}
if ($config['disabled'] > '') {
    $tpl->assign_block_vars('DISABLED_FUNCTIONS', array('PHP_DISABLED_FUNCTIONS' => str_replace(',', ', ', $config['disabled'])));
}
// Zlib is buggy from version 4.3.0 upto 4.3.2, so lets check for these versions
if (version_compare(PHP_VERSION, '4.3.0', '>=') && version_compare(PHP_VERSION, '4.3.2', '<=')) {
    $tpl->assign_block_vars('ZLIBBUG', array());
}
if (!extension_loaded('ftp')) {
    $tpl->assign_block_vars('NO_FTP', array());
}
if (!$config['zlib']) {
    $tpl->assign_block_vars('NO_ZLIB', array());
/**
 * This file is part of MySQLDumper released under the GNU/GPL 2 license
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
include './language/lang_list.php';
$langOld = $config['language'];
// define template
$tplMenu = new MSDTemplate();
$tplMenu->set_filenames(array('tplMenu' => 'tpl/menu/menu.tpl'));
$tplMenu->assign_vars(array('PAGE' => $p, 'ACTION_SET' => $action > '' ? '&amp;action=' . $action : '', 'MSD_VERSION' => MSD_VERSION . ' (' . MSD_VERSION_SUFFIX . ')', 'CONFIG_HOMEPAGE' => $config['homepage'], 'CONFIG_THEME' => $config['theme'], 'CONFIG_FILE' => $config['config_file']));
// set picture according to mode
if ($config['msd_mode'] == 0) {
    $tplMenu->assign_block_vars('MSD_MODE_EASY', array());
} else {
    $tplMenu->assign_block_vars('MSD_MODE_EXPERT', array());
}
if (isset($_POST['selected_config']) || isset($_GET['config'])) {
    // Configuration was switched in menu frame
    if (isset($_POST['selected_config'])) {
        $newConfig = $_POST['selected_config'];
    }
    if (is_readable($config['paths']['config'] . $newConfig . '.php')) {
        clearstatcache();
        unset($databases);
        $databases = array();
Exemple #20
0
<?php

if (!@ob_start("ob_gzhandler")) {
    @ob_start();
}
include_once './inc/header.php';
include './inc/template.php';
$lang_old = $config['language'];
$config_refresh = '';
// define template
$tpl = new MSDTemplate();
$tpl->set_filenames(array('header' => 'tpl/menu/header.tpl', 'footer' => 'tpl/menu/footer.tpl', 'content' => 'tpl/menu/content.tpl'));
$tpl->assign_vars(array('MSD_VERSION' => MSD_VERSION, 'CONFIG_HOMEPAGE' => $config['homepage'], 'CONFIG_THEME' => $config['theme']));
if (isset($_POST['selected_config']) || isset($_GET['config'])) {
    if (isset($_POST['selected_config'])) {
        $new_config = $_POST['selected_config'];
    }
    // Configuration was switched in content frame?
    if (isset($_GET['config'])) {
        $new_config = $_GET['config'];
    }
    // restore the last active menuitem
    if (is_readable($config['paths']['config'] . $new_config . '.php')) {
        clearstatcache();
        unset($databases);
        $databases = array();
        if (read_config($new_config)) {
            $config['config_file'] = $new_config;
            $_SESSION['config_file'] = $new_config;
            //$config['config_file'];
            $config_refresh = '
    $_SESSION['restore'] = $restore;
    $logMsg = sprintf($lang['L_START_RESTORE_DB_FILE'], $config['db_actual'], $restore['filename']);
    $log->write(Log::PHP, $logMsg);
} else {
    $config = $_SESSION['config'];
    $databases = $_SESSION['databases'];
    $restore = $_SESSION['restore'];
}
// tables to create
$tablesDone = 0;
if ($restore['table_ready'] > 0) {
    $tablesDone = $restore['table_ready'];
}
if ($restore['tables_total'] > 0) {
    $tablesToDo = $restore['tables_total'];
} else {
    $tablesToDo = $lang['L_UNKNOWN'];
}
if ($restore['tables_total'] > 0) {
    $tablesToCreate = sprintf($lang['L_RESTORE_TABLES_COMPLETED'], $tablesDone, $tablesToDo);
} else {
    $tablesToCreate = sprintf($lang['L_RESTORE_TABLES_COMPLETED0'], $tablesDone);
}
$tplRestore = new MSDTemplate();
$tplRestore->set_filenames(array('tplRestore' => 'tpl/restore/restore.tpl'));
$restoringDb = sprintf($lang['L_RESTORE_DB'], $config['db_actual'], $config['dbhost']);
$tplRestore->assign_vars(array('SESSION_ID' => session_id(), 'ICONPATH' => $config['files']['iconpath'], 'ICON_PLUS' => $icon['plus'], 'DB_ON_SERVER' => $restoringDb, 'FILENAME' => $restore['filename'], 'CHARSET' => $restore['dump_encoding'], 'TABLES_TO_CREATE' => $tablesToCreate, 'NOTIFICATION_POSITION' => $config['notification_position']));
if ($restore['part'] > 0) {
    $tplRestore->assign_block_vars('MULTIPART', array('PART' => $restore['part']));
}
$_SESSION['restore'] = $restore;
<?php

/**
 * This file is part of MySQLDumper released under the GNU/GPL 2 license
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
$tplSqlbrowserTopnav = new MSDTemplate();
$tplSqlbrowserTopnav->set_filenames(array('tplSqlbrowserTopnav' => 'tpl/sqlbrowser/nav/topnav_general.tpl'));
$tplSqlbrowserTopnav->assign_vars(array('ICON_DB' => $icon['db'], 'ICON_VIEW' => $icon['view'], 'ICON_EDIT' => $icon['edit']));
Exemple #23
0
    echo '<p align="center"><a href="main.php">&lt;&lt; Home</a></p>';
    phpinfo();
    echo '<p align="center"><a href="main.php">&lt;&lt; Home</a></p>';
    exit;
}
if (isset($_POST['htaccess']) || $action == 'schutz') {
    include './inc/home/protection_create.php';
}
if ($action == 'edithtaccess') {
    include './inc/home/protection_edit.php';
}
if ($action == 'deletehtaccess') {
    include './inc/home/protection_delete.php';
}
// Output headnavi
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => 'tpl/home/headnavi.tpl'));
$tpl->assign_vars(array('HEADER' => MSDHeader(), 'HEADLINE' => headline('Home')));
$tpl->pparse('show');
MSD_mysql_connect();
if ($action == 'status') {
    include './inc/home/home.php';
} elseif ($action == 'db') {
    include './inc/home/databases.php';
} elseif ($action == 'sys') {
    include './inc/home/system.php';
} elseif ($action == 'vars') {
    include './inc/home/mysql_variables.php';
}
echo MSDFooter();
ob_end_flush();
        } else {
            $dbo = MsdDbFactory::getAdapter($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbport'], $config['dbsocket']);
            try {
                $dbo->selectDb($dbToAdd, true);
                addDatabaseToConfig($dbToAdd);
                $saveConfig = true;
            } catch (Exception $e) {
                $addDbMessage = $lang['L_ERROR'] . ': (' . $e->getCode() . ') ';
                $addDbMessage .= $e->getMessage();
            }
        }
    }
}
$tplConfigurationDatabases = new MSDTemplate();
$tplConfigurationDatabases->set_filenames(array('tplConfigurationDatabases' => 'tpl/configuration/databases.tpl'));
$tplConfigurationDatabases->assign_vars(array('ICON_SAVE' => $icon['small']['save'], 'DB_HOST' => $config['dbhost'], 'DB_USER' => $config['dbuser'], 'DB_PASS' => $config['dbpass'], 'DB_PORT' => $config['dbport'], 'DB_SOCKET' => $config['dbsocket'], 'ICON_EDIT' => $icon['edit'], 'ICON_DOWN' => $icon['arrow_down'], 'ICON_PLUS' => $icon['plus'], 'ICON_MINUS' => $icon['minus']));
if (isset($addDbMessage) && $addDbMessage > '') {
    $tplConfigurationDatabases->assign_block_vars('MANUAL_DB_ADD', array('MESSAGE' => $addDbMessage));
}
//Wenn Datenbanken vorhanden sind
if (count($databases) > 0) {
    $dbCount = count($databases);
    $tplConfigurationDatabases->assign_block_vars('DBS', array('DB_COUNT' => $dbCount));
    $i = 0;
    foreach ($databases as $dbName => $val) {
        if (!isset($val['dump'])) {
            $val['dump'] = 0;
        }
        if (!isset($val['prefix'])) {
            $val['prefix'] = '';
        }
Exemple #25
0
//Start SQL-Box
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => $config['paths']['root'] . './tpl/sqlbrowser/sqlbox.tpl'));
if (isset($_GET['readfile']) && $_GET['readfile'] == 1) {
    $tpl->assign_block_vars('SQLUPLOAD', array('POSTTARGET' => $params, 'LANG_OPENSQLFILE' => $lang['L_SQL_OPENFILE'], 'LANG_OPENSQLFILE_BUTTON' => $lang['L_SQL_OPENFILE_BUTTON'], 'LANG_SQL_MAXSIZE' => $lang['L_MAX_UPLOAD_SIZE'], 'MAX_FILESIZE' => $config['upload_max_filesize']));
}
if (isset($_POST['submit_openfile'])) {
    //open file
    if (!isset($_FILES['upfile']['name']) || empty($_FILES['upfile']['name'])) {
        $aus .= '<span class="error">' . $lang['L_FM_UPLOADFILEREQUEST'] . '</span>';
    } else {
        $fn = $_FILES['upfile']['tmp_name'];
        if (strtolower(substr($_FILES['upfile']['name'], -3)) == ".gz") {
            $read__user_sqlfile = gzfile($fn);
        } else {
            $read__user_sqlfile = file($fn);
        }
        $aus .= '<span>geladenes File: <strong>' . $_FILES['upfile']['name'] . '</strong>&nbsp;&nbsp;&nbsp;' . byte_output(filesize($_FILES['upfile']['tmp_name'])) . '</span>';
        $sql_loaded = implode("", $read__user_sqlfile);
    }
}
// Sind SQL-Befehle in der SQLLib vorhanden?
$sqlcombo = SQL_ComboBox();
if ($sqlcombo > '') {
    $tpl->assign_block_vars('SQLCOMBO', array('SQL_COMBOBOX' => $sqlcombo));
}
$tpl->assign_vars(array('LANG_SQL_WARNING' => $lang['L_SQL_WARNING'], 'ICONPATH' => $config['files']['iconpath'], 'MYSQL_REF' => $mysql_help_ref, 'BOXSIZE' => $config['interface_sqlboxsize'], 'BOXCONTENT' => isset($sql_loaded) ? $sql_loaded : $sql['sql_statement'] . $sql['order_statement'], 'LANG_SQL_BEFEHLE' => $lang['L_SQL_BEFEHLE'], 'TABLE_COMBOBOX' => Table_ComboBox(), 'LANG_SQL_EXEC' => $lang['L_SQL_EXEC'], 'LANG_RESET' => $lang['L_RESET'], 'PARAMS' => $params, 'DB' => $databases['Name'][$dbid], 'DBID' => $dbid, 'TABLENAME' => $tablename, 'ICON_SEARCH' => $icon['search'], 'ICON_UPLOAD' => $icon['upload'], 'ICON_MYSQL_HELP' => $icon['mysql_help'], 'MYSQL_HELP' => $lang['L_TITLE_MYSQL_HELP'], 'DBID' => $databases['db_selected_index'], 'LANG_TOOLBOX' => $lang['L_TOOLS_TOOLBOX'], 'LANG_TOOLS' => $lang['L_TOOLS'], 'LANG_DB' => $lang['L_DB'], 'LANG_TABLE' => $lang['L_TABLE'], 'LANG_SQL_TABLEVIEW' => $lang['L_SQL_TABLEVIEW'], 'LANG_BACK_TO_DB_OVERVIEW' => $lang['L_SQL_BACKDBOVERVIEW']));
if ($tablename > '') {
    $tpl->assign_block_vars('TABLE_SELECTED', array());
}
$tpl->pparse('show');
    }
    if (isset($_POST['smtp_port'])) {
        $config['smtp_port'] = (int) $_POST['smtp_port'];
    }
    if (isset($_POST['smtp_pop3_server'])) {
        $config['smtp_pop3_server'] = (string) $_POST['smtp_pop3_server'];
    }
    if (isset($_POST['smtp_pop3_port'])) {
        $config['smtp_pop3_port'] = (int) $_POST['smtp_pop3_port'];
    }
}
// backwards compatibilty with older configurations
if (!isset($config['email_maxsize1'])) {
    $config['email_maxsize1'] = 0;
}
if (!isset($config['email_maxsize2'])) {
    $config['email_maxsize2'] = 1;
}
$tplConfigurationEmail = new MSDTemplate();
$tplConfigurationEmail->set_filenames(array('tplConfigurationEmail' => 'tpl/configuration/email.tpl'));
$tplConfigurationEmail->assign_vars(array('ICON_SAVE' => $icon['small']['save'], 'ICON_PLUS' => $icon['plus'], 'ICON_DELETE' => $icon['delete'], 'SEND_MAIL_ENABLED_SELECTED' => Html::getChecked($config['send_mail'], 1), 'EMAIL_DISABLED' => Html::getDisabled($config['send_mail'], 0), 'SEND_MAIL_DISABLED_SELECTED' => Html::getChecked($config['send_mail'], 0), 'EMAIL_RECIPIENT_NAME' => Html::replaceQuotes($config['email']['recipient_name']), 'EMAIL_RECIPIENT_ADDRESS' => Html::replaceQuotes($config['email']['recipient_address']), 'EMAIL_SENDER_NAME' => Html::replaceQuotes($config['email']['sender_name']), 'EMAIL_SENDER_ADDRESS' => Html::replaceQuotes($config['email']['sender_address']), 'ATTACH_BACKUP_ENABLED_SELECTED' => Html::getChecked($config['email']['attach_backup'], 1), 'ATTACH_BACKUP_DISABLED_SELECTED' => Html::getChecked($config['email']['attach_backup'], 0), 'MAXSIZE_DISABLED' => Html::getDisabled($config['email']['attach_backup'], 0), 'EMAIL_MAXSIZE' => $config['email_maxsize1'], 'EMAIL_UNIT_SIZE_KB_SELECTED' => Html::getSelected($config['email_maxsize2'], 1), 'EMAIL_UNIT_SIZE_MB_SELECTED' => Html::getSelected($config['email_maxsize2'], 2), 'EMAIL_USE_PHPMAIL_SELECTED' => Html::getChecked($config['use_mailer'], 0), 'EMAIL_USE_SENDMAIL_SELECTED' => Html::getChecked($config['use_mailer'], 1), 'EMAIL_USE_SMTP_SELECTED' => Html::getChecked($config['use_mailer'], 2), 'SENDMAIL_CALL' => Html::replaceQuotes($config['sendmail_call']), 'SMTP_SERVER' => $config['smtp_server'], 'SMTP_USER' => $config['smtp_user'], 'SMTP_PASS' => $config['smtp_pass'], 'SMTP_AUTH_DISABLED' => Html::getDisabled($config['smtp_useauth'], 0), 'SMTP_AUTH_SELECTED' => Html::getChecked($config['smtp_useauth'], 1), 'SMTP_AUTH_NOT_SELECTED' => Html::getChecked($config['smtp_useauth'], 0), 'SMTP_SSL_SELECTED' => Html::getChecked($config['smtp_usessl'], 1), 'SMTP_SSL_NOT_SELECTED' => Html::getChecked($config['smtp_usessl'], 0), 'SMTP_PORT' => $config['smtp_port'], 'SMTP_POP3_SERVER' => $config['smtp_pop3_server'], 'SMTP_POP3_PORT' => $config['smtp_pop3_port']));
if ($config['smtp_useauth'] == 0) {
    $tplConfigurationEmail->assign_block_vars('HIDE_SMTP_AUTH_FIELDS', array());
}
if (is_array($config['email']['recipient_cc']) && sizeof($config['email']['recipient_cc']) > 0) {
    foreach ($config['email']['recipient_cc'] as $key => $val) {
        $confirmRecDelete = sprintf($lang['L_CONFIRM_RECIPIENT_DELETE'], $val['name'] . ' ' . $val['address']);
        $confirmRecDelete = Html::replaceQuotes($confirmRecDelete);
        $tplConfigurationEmail->assign_block_vars('EMAIL_RECIPIENT_CC', array('NR' => $key, 'CONFIRM_RECIPIENT_DELETE' => $confirmRecDelete, 'EMAIL_RECIPIENT_CC_NAME' => Html::replaceQuotes($val['name']), 'EMAIL_RECIPIENT_CC_ADDRESS' => Html::replaceQuotes($val['address'])));
    }
}
 #### Pimped
 if (!isset($config['dbpass'])) {
     $config['dbpass'] = $db_pass;
 }
 #### Pimped
 ############################### <-- Pimped
 if (!isset($config['dbport'])) {
     $config['dbport'] = '';
 }
 if (!isset($config['dbsocket'])) {
     $config['dbsocket'] = '';
 }
 if (!isset($config['dbmanual'])) {
     $config['dbmanual'] = '';
 }
 $tpl->assign_vars(array('LANGUAGE' => $config['language'], 'ICON_SAVE' => $icon['small']['save']));
 if (isset($_POST['dbconnect'])) {
     // get inputs
     $config['dbhost'] = $_POST['dbhost'];
     $config['dbuser'] = $_POST['dbuser'];
     $config['dbpass'] = $_POST['dbpass'];
     $config['dbmanual'] = $_POST['dbmanual'];
     if ((int) $_POST['dbport'] > 0) {
         $config['dbport'] = (int) $_POST['dbport'];
     } else {
         $config['dbport'] = 3306;
     }
     $config['dbsocket'] = $_POST['dbsocket'];
     include './inc/classes/db/MsdDbFactory.php';
     $dbo = MsdDbFactory::getAdapter($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbport'], $config['dbsocket']);
     $connectMsg = $dbo->dbConnect();
$error = array();
$type = 0;
// default encryption type set to crypt()
if (strtoupper(substr(MSD_OS, 0, 3)) == 'WIN') {
    $type = 2;
    // we are on a Win-System; pre-select encryption type
}
if (isset($_POST['type'])) {
    $type = (int) $_POST['type'];
}
$username = isset($_POST['username']) ? $_POST['username'] : '';
$userpassOne = isset($_POST['userpass1']) ? $_POST['userpass1'] : '';
$userpassConfirm = isset($_POST['userpass2']) ? $_POST['userpass2'] : '';
$tplHomeProtectionCreate = new MSDTemplate();
$tplHomeProtectionCreate->set_filenames(array('tplHomeProtectionCreate' => 'tpl/home/protection_create.tpl'));
$tplHomeProtectionCreate->assign_vars(array('THEME' => $config['theme']));
if (isset($_POST['username'])) {
    // Form submitted
    if ($username == '') {
        $error[] = $lang['L_HTACC_NO_USERNAME'];
    }
    if ($userpassOne != $userpassConfirm || $userpassOne == '') {
        $error[] = $lang['L_PASSWORDS_UNEQUAL'];
    }
    if (sizeof($error) == 0) {
        $realm = 'MySQLDumper';
        $htaccess = "AuthName \"" . $realm . "\"\nAuthType Basic\nAuthUserFile \"" . $config['paths']['root'] . ".htpasswd\"\nrequire valid-user\n";
        switch ($type) {
            // Crypt
            case 0:
                $userpass = crypt($userpassOne);
<?php

/**
 * This file is part of MySQLDumper released under the GNU/GPL 2 license
 * http://www.mysqldumper.net
 *
 * @package         MySQLDumper
 * @version         SVN: $rev: 1207 $
 * @author          $Author$
 * @lastmodified    $Date$
 */
if (!defined('MSD_VERSION')) {
    die('No direct access.');
}
$tplConfigurationConfigMenu = new MSDTemplate();
$tplConfigurationConfigMenu->set_filenames(array('tplConfigurationConfigMenu' => 'tpl/configuration/config_menu.tpl'));
$msdMode = $lang['L_MODE_EXPERT'];
if ($config['msd_mode'] == 0) {
    $msdMode = $lang['L_MODE_EASY'];
}
$tplConfigurationConfigMenu->assign_vars(array('CONFIGURATION_NAME' => $config['config_file'], 'ICON_SAVE' => $icon['small']['save'], 'ICON_OPEN_FILE' => $icon['small']['open_file'], 'MSD_MODE' => $msdMode));
$table_options = '';
if ($anzahl_tabellen > 0) {
    for ($i = 0; $i < $anzahl_tabellen; $i++) {
        if (isset($tables[$i])) {
            $table_options .= '<option value="' . $i . '"';
            if ($i == $table_selected || $tables[$i] == $tablename) {
                $table_options .= ' selected';
                $table_selected = $i;
            }
            $table_options .= '>' . $tables[$i] . '</option>' . "\n";
        }
    }
}
$tpl = new MSDTemplate();
$tpl->set_filenames(array('show' => './tpl/sqlbrowser/mysql_search.tpl'));
$tpl->assign_vars(array('DB_NAME_URLENCODED' => urlencode($db), 'LANG_SQLSEARCH' => $lang['L_SQL_SEARCH'], 'LANG_SQL_SEARCHWORDS' => $lang['L_SQL_SEARCHWORDS'], 'SUCHBEGRIFFE' => $suchbegriffe, 'LANG_START_SQLSEARCH' => $lang['L_START_SQL_SEARCH'], 'LANG_RESET_SEARCHWORDS' => $lang['L_RESET_SEARCHWORDS'], 'LANG_SEARCH_OPTIONS' => $lang['L_SEARCH_OPTIONS'], 'AND_SEARCH' => $suchart == 'AND' ? ' checked' : '', 'OR_SEARCH' => $suchart == 'OR' ? ' checked' : '', 'CONCAT_SEARCH' => $suchart == 'CONCAT' ? ' checked' : '', 'TABLE_OPTIONS' => $table_options, 'LANG_SEARCH_OPTIONS_AND' => $lang['L_SEARCH_OPTIONS_AND'], 'LANG_SEARCH_OPTIONS_OR' => $lang['L_SEARCH_OPTIONS_OR'], 'LANG_SEARCH_OPTIONS_CONCAT' => $lang['L_SEARCH_OPTIONS_CONCAT'], 'LANG_SEARCH_IN_TABLE' => $lang['L_SEARCH_IN_TABLE']));
$max_treffer = 20;
$treffer = mysql_search($db, $table_selected, $suchbegriffe, $suchart, $offset, $max_treffer + 1);
if (is_array($treffer) && isset($treffer[0])) {
    $search_message = sprintf($lang['L_SEARCH_RESULTS'], $suchbegriffe, $tables[$table_selected]);
    $anzahl_treffer = count($treffer);
    // Blaettern-Buttons
    $tpl->assign_block_vars('HITS', array('LANG_SEARCH_RESULTS' => $search_message, 'LAST_OFFSET' => $offset - $max_treffer, 'BACK_BUTTON_DISABLED' => $offset > 0 ? '' : ' disabled', 'NEXT_OFFSET' => $offset + $max_treffer, 'NEXT_BUTTON_DISABLED' => $anzahl_treffer != $max_treffer + 1 ? ' disabled' : '', 'LANG_ACCESS_KEYS' => $lang['L_SEARCH_ACCESS_KEYS']));
    // Ausgabe der Treffertabelle
    $anzahl_felder = sizeof($treffer[0]);
    // Ausgabe der Tabellenueberschrift/ Feldnamen
    foreach ($treffer[0] as $key => $val) {
        $tpl->assign_block_vars('HITS.TABLEHEAD', array('KEY' => $key));
    }
    // Ausgabe der Daten
    $zeige_treffer = sizeof($treffer);