DBDetailInfo($databases['db_selected_index']); } $cext = $config['cron_extender'] == 0 ? "pl" : "cgi"; $actualUrl = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/") + 1); if (substr($actualUrl, -1) != "/") { $actualUrl .= "/"; } if (substr($actualUrl, 0, 1) != "/") { $actualUrl = "/{$actualUrl}"; } $refdir = substr($config['cron_execution_path'], 0, 1) == "/" ? "" : $actualUrl; $scriptdir = $config['cron_execution_path'] . 'crondump.' . $cext; $sfile = $config['cron_execution_path'] . "perltest.{$cext}"; $simplefile = $config['cron_execution_path'] . "simpletest.{$cext}"; $scriptentry = Realpfad("./") . $config['paths']['config']; $cronabsolute = substr($config['cron_execution_path'], 0, 1) == "/" ? $_SERVER['DOCUMENT_ROOT'] . $scriptdir : Realpfad("./") . $scriptdir; $confabsolute = $config['config_file']; $scriptref = getServerProtocol() . $_SERVER['SERVER_NAME'] . $refdir . $config['cron_execution_path'] . 'crondump.' . $cext . "?config=" . $confabsolute; $cronref = "perl " . $cronabsolute . " -config=" . $confabsolute . " -html_output=0"; //Ausgabe echo headline($lang['L_FM_DUMP_HEADER'] . ' <span class="small">("' . $lang['L_CONFIG_HEADLINE'] . ': ' . $config['config_file'] . '")</span>'); if (!is_writable($config['paths']['backup'])) { die('<span class="error">' . sprintf($lang['L_WRONG_RIGHTS'], 'work/backup', '777') . '</span>'); } echo $msg > '' ? $msg . '<br>' : ''; echo $autodel; //Auswahl echo '<div> <input type="button" value=" ' . $lang['L_DUMP'] . ' PHP " class="Formbutton" onclick="document.getElementById(\'buperl\').style.display=\'none\';document.getElementById(\'buphp\').style.display=\'block\';"> <input type="button" value=" ' . $lang['L_DUMP'] . ' PERL " class="Formbutton" onclick="document.getElementById(\'buphp\').style.display=\'none\';document.getElementById(\'buperl\').style.display=\'block\';">
echo '<a href="install.php?language=' . $language . '&phase=101">' . $lang['L_UI4'] . '</a>'; break; case 101: echo '<h6>' . $lang['L_UI5'] . '</h6>'; $paths = array(); $w = substr($config['paths']['work'], 0, strlen($config['paths']['work']) - 1); if (is_dir($w)) { $res = rec_rmdir($w); } else { $res = 0; } // wurde das Verzeichnis korrekt gelöscht if ($res == 0) { // das Verzeichnis wurde korrekt gelöscht echo '<p>' . $lang['L_UI6'] . '</p>'; echo $lang['L_UI7'] . "<br>\"" . Realpfad("./") . "\"<br> " . $lang['L_MANUELL'] . ".<br><br>"; echo '<a href="../">' . $lang['L_UI8'] . '</a>'; } else { echo '<p class="Warnung">' . $lang['L_UI9'] . '"' . $paths[count($paths) - 1] . '"'; } break; } ?> </div> </body> </html> <?php //eigene Funktionen
function WriteParams($as = 0, $restore_values = false) { // wenn $as=1 wird versucht den aktuellen Index der Datenbank nach dem Einlesen wieder zu ermitteln // auch wenn sich die Indexnummer durch Loeschaktionen geaendert hat global $config, $databases, $config_dontsave; $nl = "\n"; // alte Werte retten if ($as) { if (is_array($restore_values)) { if ($restore_values['cron_dbindex'] < 0) { // Multidump oder "alle Datenbanken" war gewaehlt $config['cron_dbindex'] = $restore_values['cron_dbindex']; } else { //den Index der konkreten Datenbank aus der alten Konfiguration ermitteln $db_names = array(); $db_names = array_flip($databases['Name']); if (isset($db_names[$restore_values['db_actual']])) { // alte Db existiert noch -> Index uebernehmen $databases['db_actual'] = $restore_values['db_actual']; } else { $databases['db_actual'] = $databases['Name'][0]; } //Cron-Index wiederfinden if (isset($db_names[$restore_values['cron_dbindex']])) { $config['cron_dbindex'] = $db_names[$restore_values['cron_dbindex']]; } else { // DB wurde zwischenzeitlich geloescht - sicherheitshalber alle DBs sichern $databases['cron_dbindex'] = -3; } } } } FillMultiDBArrays(); //Parameter zusammensetzen $config['multipart_groesse'] = $config['multipartgroesse1'] * ($config['multipartgroesse2'] == 1 ? 1024 : 1024 * 1024); $param = $pars_all = '<?php ' . $nl; if (!isset($config['email_maxsize'])) { $config['email_maxsize'] = $config['email_maxsize1'] * ($config['email_maxsize2'] == 1 ? 1024 : 1024 * 1024); } if (!isset($config['cron_execution_path'])) { $config['cron_execution_path'] = "msd_cron/"; } if ($as == 0) { $config['paths']['root'] = addslashes(Realpfad("./")); } $config['files']['parameter'] = $config['paths']['config'] . $config['config_file'] . '.php'; $config['files']['iconpath'] = './css/' . $config['theme'] . '/icons/'; foreach ($config as $var => $val) { if (!in_array($var, $config_dontsave)) { if (is_array($val)) { $pars_all .= '$config[\'' . $var . '\']=array();' . $nl; foreach ($val as $var2 => $val2) { if ($config['magic_quotes_gpc'] == 1) { $val2 = stripslashes($val2); } $pars_all .= '$config[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . my_addslashes($val2) . "';{$nl}"; } } else { if ($config['magic_quotes_gpc'] == 1) { $val = stripslashes($val); } if (!in_array($var, $config_dontsave)) { $pars_all .= '$config[\'' . $var . '\'] = \'' . my_addslashes($val) . "';{$nl}"; } } } } foreach ($databases as $var => $val) { if (is_array($val)) { $pars_all .= '$databases[\'' . $var . '\']=array();' . $nl; foreach ($val as $var2 => $val2) { if ($config['magic_quotes_gpc'] == 1 || $as == 1) { $pars_all .= '$databases[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . my_addslashes(stripslashes($val2)) . "';{$nl}"; } else { $pars_all .= '$databases[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . my_addslashes($val2) . "';{$nl}"; } } } else { if ($config['magic_quotes_gpc'] == 0 || $as == 1) { $pars_all .= '$databases[\'' . $var . '\'] = \'' . addslashes($val) . "';{$nl}"; } else { $pars_all .= '$databases[\'' . $var . '\'] = \'' . $val . "';{$nl}"; } } } $param .= '?>'; $pars_all .= '?>'; //Datei öffnen und schreiben $ret = true; $file = $config['paths']['config'] . $config['config_file'] . '.php'; if ($fp = fopen($file, "wb")) { if (!fwrite($fp, $pars_all)) { $ret = false; } if (!fclose($fp)) { $ret = false; } @chmod($file, 0777); } else { $ret = false; } $ret = WriteCronScript($restore_values); return $ret; }
echo '<a href="install.php?language=' . $language . '&phase=101">' . $lang['ui4'] . '</a>'; break; case 101: echo '<h6>' . $lang['ui5'] . '</h6>'; $paths = array(); $w = substr($config['paths']['work'], 0, strlen($config['paths']['work']) - 1); if (is_dir($w)) { $res = rec_rmdir($w); } else { $res = 0; } // wurde das Verzeichnis korrekt gelöscht if ($res == 0) { // das Verzeichnis wurde korrekt gelöscht echo '<p>' . $lang['ui6'] . '</p>'; echo $lang['ui7'] . "<br>\"" . Realpfad("./") . "\"<br> " . $lang['manuell'] . ".<br><br>"; echo '<a href="../">' . $lang['ui8'] . '</a>'; } else { echo '<p class="Warnung">' . $lang['ui9'] . '"' . $paths[count($paths) - 1] . '"'; } break; } ?> </div> </body> </html> <?php //eigene Funktionen
define('MSD_VERSION', '1.24'); } if (!defined('MSD_OS')) { define('MSD_OS', PHP_OS); } if (!defined('MSD_OS_EXT')) { define('MSD_OS_EXT', @php_uname()); } if (!defined('config') || !is_array($config)) { $config = array(); } if (!defined('databases') || !is_array($databases)) { $databases = array(); } //Pfade und Files $config['paths']['root'] = Realpfad('./'); $config['paths']['work'] = 'work/'; $config['paths']['backup'] = $config['paths']['work'] . 'backup/'; $config['paths']['log'] = $config['paths']['work'] . 'log/'; $config['paths']['config'] = $config['paths']['work'] . 'config/'; $config['paths']['perlexec'] = 'msd_cron/'; if (isset($_SESSION['config_file'])) { $config['config_file'] = $_SESSION['config_file']; $config['cron_configurationfile'] = $_SESSION['config_file']; } else { $config['config_file'] = 'mysqldumper'; $_SESSION['config_file'] = 'mysqldumper'; $config['cron_configurationfile'] = 'mysqldumper.conf.php'; } $config['files']['log'] = $config['paths']['log'] . 'mysqldump.log'; $config['files']['perllog'] = $config['paths']['log'] . 'mysqldump_perl.log';
function WriteParams($as = 0, $config, $databases) { global $config_dontsave; $nl = "\n"; FillMultiDBArrays(); //Parameter zusammensetzen $config['multipart_groesse'] = $config['multipartgroesse1'] * ($config['multipartgroesse2'] == 1 ? 1024 : 1024 * 1024); $param = $pars_all = '<?php ' . $nl; if (!isset($config['email_maxsize'])) { $config['email_maxsize'] = $config['email_maxsize1'] * ($config['email_maxsize2'] == 1 ? 1024 : 1024 * 1024); } if (!isset($config['cron_execution_path'])) { $config['cron_execution_path'] = "msd_cron/"; } if ($as == 0) { $config['paths']['root'] = addslashes(Realpfad("./")); } foreach ($config as $var => $val) { if (is_array($val)) { foreach ($val as $var2 => $val2) { if ($config['magic_quotes_gpc'] == 0 || $as == 1) { $pars_all .= '$config[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . addslashes($val2) . "';{$nl}"; } else { $pars_all .= '$config[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . $val2 . "';{$nl}"; } } } else { if ($config['magic_quotes_gpc'] == 0 || $as == 1) { if (!in_array($var, $config_dontsave)) { $pars_all .= '$config[\'' . $var . '\'] = \'' . addslashes($val) . "';{$nl}"; } } else { if (!in_array($var, $config_dontsave)) { $pars_all .= '$config[\'' . $var . '\'] = \'' . $val . "';{$nl}"; } } } } foreach ($databases as $var => $val) { if (is_array($val)) { foreach ($val as $var2 => $val2) { if ($config['magic_quotes_gpc'] == 0 || $as == 1) { $pars_all .= '$databases[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . addslashes($val2) . "';{$nl}"; } else { $pars_all .= '$databases[\'' . $var . '\'][' . (is_int($var2) ? $var2 : "'" . $var2 . "'") . '] = \'' . $val2 . "';{$nl}"; } } } else { if ($config['magic_quotes_gpc'] == 0 || $as == 1) { $pars_all .= '$databases[\'' . $var . '\'] = \'' . addslashes($val) . "';{$nl}"; } else { $pars_all .= '$databases[\'' . $var . '\'] = \'' . $val . "';{$nl}"; } } } $param .= '?>'; $pars_all .= '?>'; //Datei öffnen und schreiben $ret = true; @chmod($config['files']['parameter'], 0777); if ($fp = fopen($config['files']['parameter'], "wb")) { if (!fwrite($fp, $pars_all)) { $ret = false; } if (!fclose($fp)) { $ret = false; } } else { $ret = false; } $ret = WriteCronScript($config, $databases); return $ret; }