1
0
Fork 0

Struggeling with relocating

Dieser Commit ist enthalten in:
DSB 2011-06-10 21:28:27 +00:00
Commit 89ea01c429
301 geänderte Dateien mit 59926 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,46 @@
<?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))
);

Datei anzeigen

@ -0,0 +1,206 @@
<?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.');
$oldConfig = $config['config_file'];
if (isset($_GET['config'])) {
$oldDatabases = $databases;
$databases = array();
if (isset($_POST['save'])) {
unset($_POST['save']);
}
if (getConfig($_GET['config'])) {
$config['config_file'] = $_GET['config'];
$_SESSION['config_file'] = $_GET['config'];
$oldConfig = $_GET['config'];
$msg = '<p class="success">'
. sprintf($lang['L_CONFIG_LOADED'], $config['config_file'])
. '</p>';
} else {
getConfig($oldConfig);
$databases = $oldDatabases;
$msg = '<p class="error">'
. sprintf(
$lang['L_ERROR_LOADING_CONFIGFILE'],
$config['config_file']
) . '</p>';
}
}
if (isset($_GET['config_delete'])) {
$deleteConfig = urldecode($_GET['config_delete']);
if ($deleteConfig == $config['config_file']) {
//actaul configuration was deleted, fall back to mysqldumper-conf
$config['config_file'] = 'mysqldumper';
$_SESSION['config_file'] = $config['config_file'];
getConfig($config['config_file']);
}
$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 = '';
$dbsToBackup = array();
// look up which databases are set to be dumped
prepareDumpProcess();
$dbs = array_keys($dump['databases']);
$dbsToBackup = implode(', ', $dbs);
$tplConfigurationConfigFiles->assign_block_vars(
'ROW',
array(
'ROWCLASS' => $rowclass,
'NR' => $i,
'CONFIG_ID' => sprintf("%03d", $i),
'CONFIG_NAME' => $c,
'CONFIG_NAME_URLENCODED' => urlencode($c),
'DB_HOST' => $config['dbhost'],
'DB_USER' => $config['dbuser'],
'NR_OF_DATABASES' => sizeof($databases),
'DBS_TO_BACKUP' => $dbsToBackup . '&nbsp;',
'ATTACH_BACKUP' =>
$config['email']['attach_backup'] == 1 ?
$lang['L_YES'] : $lang['L_NO']
)
);
if (count($databases) > 0) {
$a = 1;
foreach ($databases as $dbName => $val) {
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.LIST_DBS',
array(
'ROWCLASS' => $a % 2 ? 'dbrow' : 'dbrow1',
'NR' => $a,
'DB_NAME_URLENCODED' => base64_encode($dbName),
'DB_NAME' => $dbName
)
);
$a++;
}
}
// is Multipart used?
if ($config['multi_part'] == 1) {
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.USE_MULTIPART',
array(
'MULTIPART_FILESIZE' =>
byteOutput($config['multipart_groesse'])
)
);
}
// send mail after backup?
if ($config['send_mail'] == 1) {
$recipientsCc = implodeSubarray(
$config['email']['recipient_cc'],
'address'
);
if ($config['email']['recipient_name'] > '') {
$recipient = $config['email']['recipient_name'];
} else {
$recipient = $config['email']['recipient_address'];
}
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.SEND_EMAIL',
array(
'RECIPIENT' => $recipient,
'RECIPIENT_CC' =>
$recipientsCc > '' ? $recipientsCc : $lang['L_NO']
)
);
$bytes = $config['email_maxsize1'] * 1024;
if ($config['email_maxsize2'] == 2) $bytes = $bytes * 1024;
if ($config['email']['attach_backup'] == 1) {
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.SEND_EMAIL.EMAIL_MAX_SIZE',
array(
'SIZE' => byteOutput($bytes)
)
);
}
}
// FTP settings
foreach ($config['ftp'] as $ftp) {
if ($ftp['transfer'] > 0) {
$ftpSettings = sprintf(
$lang['L_FTP_SEND_TO'], $ftp['server'], $ftp['dir']
);
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.SEND_FTP',
array(
'FTP_SETTINGS' => Html::replaceQuotes($ftpSettings)
)
);
}
}
// Show delete-button if it is not the standard config file
if ($c != 'mysqldumper') {
$confirmDelete = sprintf($lang['L_CONFIRM_CONFIGFILE_DELETE'], $c);
$tplConfigurationConfigFiles->assign_block_vars(
'ROW.DELETE_CONFIG',
array(
'CONFIRM_DELETE' => Html::getJsQuote($confirmDelete)
)
);
}
}
unset($databases);
$databases = array();
$_SESSION['config_file'] = $oldConfig;
$config['config_file'] = $oldConfig;
// reload actual configuration
getConfig($oldConfig);

Datei anzeigen

@ -0,0 +1,31 @@
<?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
)
);

Datei anzeigen

@ -0,0 +1,69 @@
<?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'])) {
$config['cron_comment'] = $_POST['cron_comment'];
if (isset($_POST['cron_extender'])) {
$config['cron_extender'] = (int) $_POST['cron_extender'];
}
// cron_select_savepath/
if (!isset($_POST['cron_select_savepath'])) {
$_POST['cron_select_savepath'] = $config['config_file'];
}
$config['cron_execution_path'] = $_POST['cron_execution_path'];
if ($config['cron_execution_path'] == '') {
$config['cron_execution_path'] = 'msd_cron/';
}
if (strlen($config['cron_execution_path']) > 1
&& substr($config['cron_execution_path'], -1) != '/') {
$config['cron_execution_path'] .= '/';
}
if (isset($_POST['cron_printout'])) {
$config['cron_printout'] = (int) $_POST['cron_printout'];
}
if (isset($_POST['cron_completelog'])) {
$config['cron_completelog'] = (int) $_POST['cron_completelog'];
}
if (isset($_POST['compression'])) {
$config['cron_compression'] = (int) $_POST['compression'];
}
if (isset($_POST['cron_completelog'])) {
$config['cron_completelog'] = (int) $_POST['cron_completelog'];
}
}
$tplConfigurationCronscript = new MSDTemplate();
$tplConfigurationCronscript->set_filenames(
array('tplConfigurationCronscript' => 'tpl/configuration/cronscript.tpl')
);
$tplConfigurationCronscript->assign_vars(
array(
'ICON_SAVE' => $icon['small']['save'],
'EXTENSION_PL_SELECTED' =>
Html::getChecked($config['cron_extender'], 0),
'EXTENSION_CGI_SELECTED' =>
Html::getChecked($config['cron_extender'], 1),
'EXEC_PATH' => $config['cron_execution_path'],
'CRON_PRINTOUT_ENABLED_SELECTED' =>
Html::getChecked($config['cron_printout'], 1),
'CRON_PRINTOUT_DISABLED_SELECTED' =>
Html::getChecked($config['cron_printout'], 0),
'CRON_COMPLETELOG_ENABLED_SELECTED' =>
Html::getChecked($config['cron_completelog'], 1),
'CRON_COMPLETELOG_DISABLED_SELECTED' =>
Html::getChecked($config['cron_completelog'], 0),
'CRON_COMMENT' =>
htmlspecialchars($config['cron_comment'], ENT_COMPAT, 'UTF-8')
)
);

Datei anzeigen

@ -0,0 +1,174 @@
<?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.');
}
getSqlLibrary();
if (isset($_POST['save'])) {
if (count($databases) > 0) {
$i = 0;
foreach ($databases as $dbName => $val) {
$databases[$dbName]['prefix'] = '';
if (isset($_POST['dbpraefix_' . $i])) {
$databases[$dbName]['prefix'] = $_POST['dbpraefix_' . $i];
}
$databases[$dbName]['command_before_dump'] = '';
if (!empty($_POST['command_before_' . $i])) {
$databases[$dbName]['command_before_dump'] =
getQueryFromSqlLibrary($_POST['command_before_' . $i]);
}
$databases[$dbName]['command_after_dump'] = '';
if (!empty($_POST['command_after_' . $i])) {
$databases[$dbName]['command_after_dump'] =
getQueryFromSqlLibrary($_POST['command_after_' . $i]);
}
if (isset($_POST['db_multidump_' . $i])
&& $_POST['db_multidump_' . $i] == "db_multidump_$i") {
$databases[$dbName]['dump'] = 1;
} else {
$databases[$dbName]['dump'] = 0;
}
$i++;
}
}
if ($config['dbhost'] != $_POST['dbhost']
|| $config['dbuser'] != $_POST['dbuser']
|| $config['dbpass'] != $_POST['dbpass']
|| $config['dbport'] != $_POST['dbport']
|| $config['dbsocket'] != $_POST['dbsocket']) {
//neue Verbindungsparameter
$blendInConnectionParams = true;
//alte Parameter sichern
$old['dbhost'] = $config['dbhost'];
$old['dbuser'] = $config['dbuser'];
$old['dbpass'] = $config['dbpass'];
$old['dbport'] = $config['dbport'];
$old['dbsocket'] = $config['dbsocket'];
//neu setzen
$config['dbhost'] = $_POST['dbhost'];
$config['dbuser'] = $_POST['dbuser'];
$config['dbpass'] = $_POST['dbpass'];
$config['dbport'] = $_POST['dbport'];
$config['dbsocket'] = $_POST['dbsocket'];
$dbo = MsdDbFactory::getAdapter(
$config['dbhost'],
$config['dbuser'],
$config['dbpass'],
$config['dbport'],
$config['dbsocket']
);
// try to connect with new params
$res = $dbo->dbConnect();
if ($res === true) {
// ok - get list of databases
$dbo->getDatabases();
setDefaultConfig();
} else {
//something went wrong - resume old values
$config['dbhost'] = $old['dbhost'];
$config['dbuser'] = $old['dbuser'];
$config['dbpass'] = $old['dbpass'];
$config['dbport'] = $old['dbport'];
$config['dbsocket'] = $old['dbsocket'];
$msg .= '<p class="error">' . $lang['L_WRONG_CONNECTIONPARS'] . ': ' . $res . '</p>';
$saveConfig = false;
$dbo = MsdDbFactory::getAdapter(
$config['dbhost'],
$config['dbuser'],
$config['dbpass'],
$config['dbport'],
$config['dbsocket']
);
}
}
// manual adding of a database
if ($_POST['add_db_manual'] > '') {
$saveConfig = false;
$blendInConnectionParams = true;
$dbToAdd = trim($_POST['add_db_manual']);
$found = false;
// Check if we already have this one in our db list
if (isset($databases[$dbToAdd])) {
$addDbMessage = sprintf($lang['L_DB_IN_LIST'], $dbToAdd);
} 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'] = '';
}
$rowclass = $i % 2 ? 'dbrow' : 'dbrow1';
if ($dbName == $config['db_actual']) {
$rowclass = 'dbrowsel';
}
$tplConfigurationDatabases->assign_block_vars(
'DBS.ROW', array(
'ROWCLASS' => $rowclass,
'ID' => $i,
'NR' => $i + 1,
'DB_NAME' => $dbName,
'DB_MULTIDUMP_ENABLED' => Html::getChecked($val['dump'], 1),
'DB_PREFIX' => $val['prefix'],
'COMMAND_BEFORE_BACKUP_COMBO' => getCommandDumpComboBox(0, $i, $dbName),
'COMMAND_AFTER_BACKUP_COMBO' => getCommandDumpComboBox(1, $i, $dbName))
);
$i++;
}
} else {
$tplConfigurationDatabases->assign_block_vars('NO_DB', array());
}

184
inc/configuration/email.php Normale Datei
Datei anzeigen

@ -0,0 +1,184 @@
<?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.');
//add new cc-recipient
if ($action == 'add_recipient_cc') {
$index = 0;
if (isset($_POST['email_recipient_cc'])) {
$index = count($_POST['email_recipient_cc']);
}
$_POST['email_recipient_cc'][$index]['name'] = '';
$_POST['email_recipient_cc'][$index]['address'] = '';
$_POST['save'] = true;
}
// delete cc-recipient
if ($action == 'delete_recipient_cc') {
$index = (int) $_GET['cc'];
unset($_POST['email_recipient_cc'][$index]);
if (isset($config['email']['recipient_cc'][$index])) {
unset($config['email']['recipient_cc'][$index]);
}
$_POST['save'] = true;
}
if (isset($_POST['save'])) {
if (isset($_POST['send_mail'])) {
$config['send_mail'] = (int) $_POST['send_mail'];
}
if (!is_array($config['email'])) {
$config['email'] = array();
}
if (isset($_POST['email_recipient_address'])) {
$config['email']['recipient_address'] =
$_POST['email_recipient_address'];
}
if (isset($_POST['email_recipient_name'])) {
$config['email']['recipient_name'] = $_POST['email_recipient_name'];
}
$config['email']['recipient_cc'] = array();
if (isset($_POST['email_recipient_cc'])) {
$i = 0;
foreach ($_POST['email_recipient_cc'] as $key => $val) {
$config['email']['recipient_cc'][$i] = array();
$config['email']['recipient_cc'][$i]['name'] = $val['name'];
$config['email']['recipient_cc'][$i]['address'] = $val['address'];
$i++;
}
}
if (isset($_POST['email_sender_name'])) {
$config['email']['sender_name'] = $_POST['email_sender_name'];
}
if (isset($_POST['email_sender_address'])) {
$config['email']['sender_address'] = $_POST['email_sender_address'];
}
if (isset($_POST['attach_backup'])) {
$config['email']['sender_address'] = $_POST['attach_backup'];
}
if (isset($_POST['email_maxsize1'])) {
$config['email_maxsize1'] = floatval($_POST['email_maxsize1']);
}
if (isset($_POST['email_maxsize2'])) {
$config['email_maxsize2'] = $_POST['email_maxsize2'];
}
$config['email_maxsize'] = $config['email_maxsize1']
* (($config['email_maxsize2'] == 1) ? 1024 : 1024 * 1024);
if (isset($_POST['use_mailer'])) {
$config['use_mailer'] = $_POST['use_mailer'];
}
if (isset($_POST['sendmail_call'])) {
$config['sendmail_call'] = $_POST['sendmail_call'];
}
if (isset($_POST['smtp_server'])) {
$config['smtp_server'] = $_POST['smtp_server'];
}
if (isset($_POST['smtp_user'])) {
$config['smtp_user'] = $_POST['smtp_user'];
}
if (isset($_POST['smtp_pass'])) {
$config['smtp_pass'] = $_POST['smtp_pass'];
}
if (isset($_POST['smtp_useauth'])) {
$config['smtp_useauth'] = $_POST['smtp_useauth'];
}
if (isset($_POST['smtp_usessl'])) {
$config['smtp_usessl'] = $_POST['smtp_usessl'];
}
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'])
)
);
}
}

44
inc/configuration/footer.php Normale Datei
Datei anzeigen

@ -0,0 +1,44 @@
<?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.');
// 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()
);
}

156
inc/configuration/ftp.php Normale Datei
Datei anzeigen

@ -0,0 +1,156 @@
<?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.');
}
// will hold connection result if ftp connection should be checked
$ftpConnectionCheck = array();
if (isset($_POST['save'])) {
if (!is_array($config['ftp'])) {
$config['ftp'] = array();
}
// add ftp connection
if (!isset($_POST['ftp'])) {
$_POST['ftp'] = array();
}
if (isset($_POST['ftp_add_new_connection'])) {
$_POST['ftp'][count($_POST['ftp'])] = array();
}
foreach ($_POST['ftp'] as $key => $val) {
// set default values if this connection is a new one
if (!isset($config['ftp'][$key]) || !is_array($config['ftp'][$key])) {
$config['ftp'][$key] = array();
}
if (!isset($config['ftp'][$key]['server'])) {
$config['ftp'][$key]['server'] = '';
}
if (!isset($config['ftp'][$key]['transfer'])) {
$config['ftp'][$key]['transfer'] = 0;
}
if (!isset($config['ftp'][$key]['timeout'])) {
$config['ftp'][$key]['timeout'] = 10;
}
if (!isset($config['ftp'][$key]['ssl'])) {
$config['ftp'][$key]['ssl'] = 0;
}
if (!isset($config['ftp'][$key]['mode'])) {
$config['ftp'][$key]['mode'] = 0;
}
if (!isset($config['ftp'][$key]['port'])) {
$config['ftp'][$key]['port'] = 21;
}
if (!isset($config['ftp'][$key]['user'])) {
$config['ftp'][$key]['user'] = '';
}
if (!isset($config['ftp'][$key]['pass'])) {
$config['ftp'][$key]['pass'] = '';
}
if (!isset($config['ftp'][$key]['dir'])) {
$config['ftp'][$key]['dir'] = '/';
}
if (isset($val['transfer'])) {
$config['ftp'][$key]['transfer'] = (int) $val['transfer'];
}
if (isset($val['server'])) {
$config['ftp'][$key]['server'] = (string) $val['server'];
}
if (isset($val['timeout'])) {
$config['ftp'][$key]['timeout'] = (int) $val['timeout'];
}
if (isset($val['ssl'])) {
$config['ftp'][$key]['ssl'] = (int) $val['ssl'];
}
if (isset($val['mode'])) {
$config['ftp'][$key]['mode'] = (int) $val['mode'];
}
if (isset($val['port'])) {
$config['ftp'][$key]['port'] = (int) $val['port'];
}
if (isset($val['user'])) {
$config['ftp'][$key]['user'] = (string) $val['user'];
}
if (isset($val['pass'])) {
$config['ftp'][$key]['pass'] = (string) $val['pass'];
}
if (isset($val['dir'])) {
$config['ftp'][$key]['dir'] = (string) $val['dir'];
}
if ($config['ftp'][$key]['dir'] == ''
|| (strlen($config['ftp'][$key]['dir']) > 1
&& substr($config['ftp'][$key]['dir'], -1) != '/')) {
$config['ftp'][$key]['dir'] .= '/';
}
if (isset($_POST['ftp'][$key]['test'])) {
$ftpConnectionCheck[$key] = testFTP($key);
// don't save values - we just want to test the ftp connection data
$saveConfig = false;
}
}
}
if (isset($_GET['del_ftp'])) {
$index = intval($_GET['del_ftp']);
if (isset($config['ftp'][$index])) {
unset($config['ftp'][$index]);
}
sort($config['ftp']);
}
$tplConfigurationFtp = new MSDTemplate();
$tplConfigurationFtp->set_filenames(
array('tplConfigurationFtp' => 'tpl/configuration/ftp.tpl')
);
$tplConfigurationFtp->assign_vars(
array(
'ICON_ADD' => $icon['plus'],
'ICON_DELETE' => $icon['delete'],
'ICON_SAVE' => $icon['small']['save']
)
);
foreach ($config['ftp'] as $key => $val) {
// if ftp extension is not loaded -> disable ftp transfer
if (!extension_loaded('ftp')) {
$config['ftp'][$key]['transfer'] = 0;
}
$tplConfigurationFtp->assign_block_vars(
'FTP',
array(
'NR' => $key + 1,
'ID' => $key,
'FTP_DISABLED' => Html::getDisabled(!extension_loaded("ftp"), true),
'FTP_ENABLED_SELECTED' => Html::getChecked($val['transfer'], 1),
'FTP_DISABLED_SELECTED' => Html::getChecked($val['transfer'], 0),
'FTP_FIELDS_DISABLED' => Html::getDisabled($val['transfer'], 0),
'FTP_TIMEOUT' => $val['timeout'],
'FTP_PASSIVE_MODE_SELECTED' => Html::getChecked($val['mode'], 1),
'FTP_SSL_DISABLED' =>
Html::getDisabled(extension_loaded('openssl'), false),
'FTP_SSL_ENABLED_SELECTED' => Html::getChecked($val['ssl'], 1),
'FTP_SERVER' => $config['ftp'][$key]['server'],
'FTP_PORT' => $val['port'],
'FTP_USER' => Html::replaceQuotes($val['user']),
'FTP_PASSWORD' => Html::replaceQuotes($val['pass']),
'FTP_DIRECTORY' => $val['dir'],
'FTP_CONFIRM_DELETE' =>
Html::replaceQuotes($lang['L_FTP_CONFIRM_DELETE'])
)
);
if (isset($ftpConnectionCheck[$key])) {
$tplConfigurationFtp->assign_block_vars(
'FTP.CHECK', array('RESULT' => $ftpConnectionCheck[$key])
);
}
}

146
inc/configuration/general.php Normale Datei
Datei anzeigen

@ -0,0 +1,146 @@
<?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 (isset($_POST['msd_mode'])) {
$config['msd_mode'] = (int) $_POST['msd_mode'];
}
if (isset($_POST['compression'])) {
$config['compression'] = (int) $_POST['compression'];
}
if (isset($_POST['minspeed'])) {
$config['minspeed'] = (int) $_POST['minspeed'];
}
if ($config['minspeed'] < 50) $config['minspeed'] = 50;
if (isset($_POST['maxspeed'])) {
$config['maxspeed'] = (int) $_POST['maxspeed'];
}
if ($config['maxspeed'] < $config['minspeed']) {
$config['maxspeed'] = $config['minspeed'] * 2;
}
if (isset($_POST['stop_with_error'])) {
$config['stop_with_error'] = (int) $_POST['stop_with_error'];
}
if (isset($_POST['multi_part'])) {
$config['multi_part'] = (int) $_POST['multi_part'];
}
if (isset($_POST['multipartgroesse1'])) {
$config['multipartgroesse1'] =
floatval(str_replace(',', '.', $_POST['multipartgroesse1']));
}
if (isset($_POST['multipartgroesse2'])) {
$config['multipartgroesse2'] = (int) $_POST['multipartgroesse2'];
}
if ($config['multipartgroesse1'] < 100
&& $config['multipartgroesse2'] == 1) {
$config['multipartgroesse1'] = 100;
}
if ($config['multipartgroesse1'] < 1 && $config['multipartgroesse2'] == 2) {
$config['multipartgroesse1'] = 1;
}
// if compression changes -> delete old log file
$oldlogcompression = $config['logcompression'];
if (isset($_POST['logcompression'])) {
$config['logcompression'] = $_POST['logcompression'];
} else {
$config['logcompression'] = 0;
}
// if zlib-extension is not installed de-activate compression
// for log and dump file automatically
if (!$config['zlib']) {
$config['logcompression'] = 0;
$config['compression'] = 0;
}
// max size of logfiles
if (isset($_POST['log_maxsize1'])) {
$config['log_maxsize1'] = (int) $_POST['log_maxsize1'];
}
if (isset($_POST['log_maxsize2'])) {
$config['log_maxsize2'] = (int) $_POST['log_maxsize2'];
}
if ($config['log_maxsize1'] < 1) {
$config['log_maxsize1'] = 1;
}
if ($config['log_maxsize1'] < 100 && $config['log_maxsize2'] == 1) {
$config['log_maxsize1'] = 100;
}
if ($config['log_maxsize2'] == 1) {
$config['log_maxsize'] = 1024 * $config['log_maxsize1']; // kB
} else {
$config['log_maxsize'] = 1024 * 1024 * $config['log_maxsize1']; // MB
}
if (isset($_POST['empty_db_before_restore'])) {
$config['empty_db_before_restore'] =
(int) $_POST['empty_db_before_restore'];
}
if (isset($_POST['optimize_tables'])) {
$config['optimize_tables_beforedump'] = (int) $_POST['optimize_tables'];
}
//if we are not in mode expert -> reset hidden settings to safe defaults
if ($config['msd_mode'] == 0) {
$config['empty_db_before_restore'] = 0;
}
}
$tplConfigurationGeneral = new MSDTemplate();
$tplConfigurationGeneral->set_filenames(
array('tplConfigurationGeneral' => 'tpl/configuration/general.tpl')
);
if ($config['msd_mode'] > 0) {
$tplConfigurationGeneral->assign_block_vars('MODE_EXPERT', array());
}
$logGz = !$config['zlib'] ? '' : Html::getChecked($config['logcompression'], 1);
$tplConfigurationGeneral->assign_vars(
array(
'ICON_SAVE' => $icon['small']['save'],
'MSD_MODE_EASY_SELECTED' => Html::getChecked($config['msd_mode'], 0),
'MSD_MODE_EXPERT_SELECTED' => Html::getChecked($config['msd_mode'], 1),
'GZ_DISABLED' => Html::getDisabled($config['zlib'], 0),
'LOG_GZ_SELECTED' => $logGz,
'LOG_MAXSIZE1' => $config['log_maxsize1'],
'LOG_UNIT_KB_SELECTED' => Html::getSelected($config['log_maxsize2'], 1),
'LOG_UNIT_MB_SELECTED' => Html::getSelected($config['log_maxsize2'], 2),
'PHP_MEMORY_LIMIT' => $config['memory_limit'],
'MIN_SPEED' => $config['minspeed'],
'MAX_SPEED' => $config['maxspeed'],
'DUMP_GZ_ENABLED_SELECTED' =>
Html::getChecked($config['compression'], 1),
'DUMP_GZ_DISABLED_SELECTED' =>
Html::getChecked($config['compression'], 0),
'MULTIPART_ENABLED_SELECTED' =>
Html::getChecked($config['multi_part'], 1),
'MULTIPART_DISABLED_SELECTED' =>
Html::getChecked($config['multi_part'], 0),
'MULTIPART_FILE_SIZE' => $config['multipartgroesse1'],
'MULTIPART_DISABLED' => Html::getDisabled($config['multi_part'], 0),
'MULTIPART_FILE_SIZE_DISABLED' =>
Html::getDisabled($config['multi_part'], 0),
'MULTIPART_FILE_UNIT_KB_SELECTED' =>
Html::getSelected($config['multipartgroesse2'], 1),
'MULTIPART_FILE_UNIT_MB_SELECTED' =>
Html::getSelected($config['multipartgroesse2'], 2),
'OPTIMIZE_TABLES_ENABLED_SELECTED' =>
Html::getChecked($config['optimize_tables_beforedump'], 1),
'OPTIMIZE_TABLES_DISABLED_SELECTED' =>
Html::getChecked($config['optimize_tables_beforedump'], 0),
'TRUNCATE_DB_ENABLED_SELECTED' =>
Html::getChecked($config['empty_db_before_restore'], 1),
'TRUNCATE_DB_DISABLED_SELECTED' =>
Html::getChecked($config['empty_db_before_restore'], 0),
'STOP_ON_ERROR_ENABLED_SELECTED' =>
Html::getChecked($config['stop_with_error'], 1),
'STOP_ON_ERROR_DISABLED_SELECTED' =>
Html::getChecked($config['stop_with_error'], 0)
)
);

Datei anzeigen

@ -0,0 +1,100 @@
<?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.');
//define position-array for notification window
$positions = array(
'tl' => $lang['L_POSITION_TL'],
'tc' => $lang['L_POSITION_TC'],
'tr' => $lang['L_POSITION_TR'],
'ml' => $lang['L_POSITION_ML'],
'mc' => $lang['L_POSITION_MC'],
'mr' => $lang['L_POSITION_MR'],
'bl' => $lang['L_POSITION_BL'],
'bc' => $lang['L_POSITION_BC'],
'br' => $lang['L_POSITION_BR']
);
if (isset($_POST['save'])) {
if (isset($_POST['interface_server_caption'])) {
$config['interface_server_caption'] = 1;
} else {
$config['interface_server_caption'] = 0;
}
if (isset($_POST['interface_server_caption_position_1'])) {
$config['interface_server_caption_position'] = 1;
} else {
$config['interface_server_caption_position'] = 0;
}
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"' : ''
)
);