Example #1
0
                    }
                } else {
                    // Show Check table link
                    $tpl->assign_block_vars('ROW.CHECK_TABLE', array());
                }
                if ($enableKeys == $row['Name'] || $enableKeys == "ALL") {
                    $sSql = "ALTER TABLE `" . $databases['Name'][$dbid] . "`.`" . $row['Name'] . "` ENABLE KEYS";
                    $tmp_res = mysqli_query($GLOBALS["___mysqli_ston"], $sSql);
                }
                $res3 = mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW INDEX FROM `' . $databases['Name'][$dbid] . "`.`" . $row['Name'] . "`");
                while ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC)) {
                    if ($row3['Comment'] == "disabled") {
                        $keys_disabled = true;
                        $disabled_keys_found = true;
                    }
                }
                if ($keys_disabled) {
                    $tpl->assign_block_vars('ROW.KEYS_DISABLED', array());
                } else {
                    $tpl->assign_block_vars('ROW.KEYS_ENABLED', array());
                }
            }
        }
        // Output sum-row
        $tpl->assign_block_vars('SUM', array('RECORDS' => number_format($sum_records, 0, ",", "."), 'SIZE' => byte_output($sum_data_length), 'LAST_UPDATE' => $last_update));
        if ($disabled_keys_found) {
            $tpl->assign_block_vars('DISABLED_KEYS_FOUND', array());
        }
    }
    $tpl->pparse('show');
}
Example #2
0
 $dump['data'] .= "\n" . $mysql_commentstring . ' EOB' . "\n\n";
 WriteToDumpFile();
 ExecuteCommand('a');
 chmod($config['paths']['backup'] . $dump['backupdatei'], 0777);
 if ($config['multi_part'] == 1) {
     $out .= "\n" . '<br><div class="backupmsg">';
     $dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], 'part_')) . 'part_';
     $dateiendung = $config['compression'] == 1 ? '.sql.gz' : '.sql';
     clearstatcache();
     for ($i = 1; $i < $dump['part'] - $dump['part_offset']; $i++) {
         $mpdatei = $dateistamm . $i . $dateiendung;
         $sz = byte_output(@filesize($config['paths']['backup'] . $mpdatei));
         $out .= "\n" . $lang['L_FILE'] . ' <a href="' . $config['paths']['backup'] . $mpdatei . '" class="smallblack">' . $mpdatei . ' (' . $sz . ')</a> ' . $lang['L_DUMP_SUCCESSFUL'] . '<br>';
     }
 } else {
     $out .= "\n" . '<div class="backupmsg">' . $lang['L_FILE'] . ' <a href="' . $config['paths']['backup'] . $dump['backupdatei'] . '" class="smallblack">' . $dump['backupdatei'] . ' (' . byte_output(filesize($config['paths']['backup'] . $dump['backupdatei'])) . ')' . '</a>' . $lang['L_DUMP_SUCCESSFUL'] . '<br>';
 }
 $xtime = time() - $xtime;
 $aus = array();
 $aus[] = '<br>' . "\n";
 if ($config['multi_dump'] == 1) {
     WriteLog('Dump \'' . $dump['backupdatei'] . '\' finished.');
     WriteLog('Multidump: ' . count($databases['multi']) . ' Databases in ' . zeit_format($xtime) . '.');
 } else {
     WriteLog('Dump \'' . $dump['backupdatei'] . '\' finished in ' . zeit_format($xtime) . '.');
 }
 if ($config['send_mail'] == 1) {
     DoEmail();
 }
 for ($i = 0; $i < 3; $i++) {
     if ($config['ftp_transfer'][$i] == 1) {
     $cron_dbpraefix = "";
 } else {
     if ($config['cron_samedb'] == 0) {
         $cron_dbname = $databases['db_actual'];
         $cron_dbpraefix = $databases['praefix'][$databases['db_selected_index']];
     } else {
         $cron_dbname = $databases['Name'][$databases['db_actual_cronindex']];
         $cron_dbpraefix = $databases['db_actual_cronpraefix'];
     }
 }
 echo '<p>' . $lang['db'] . ': <strong>' . $cron_dbname . '</strong>';
 echo '&nbsp;&nbsp;&nbsp;' . $lang['praefix'] . ": {$cron_dbpraefix}";
 echo '<br>' . $lang['gzip'] . ": <strong>" . ($config['cron_compression'] == 1 ? $lang['activated'] : $lang['not_activated']);
 echo '</strong>&nbsp;&nbsp;&nbsp;' . $lang['multi_part'] . ": <strong>" . ($config['multi_part'] == 1 ? $lang['yes'] : $lang['no']);
 if ($config['multi_part'] == 1) {
     echo '&nbsp;&nbsp;</strong>' . $lang['multi_part_groesse'] . ": <strong>" . byte_output($config['multipart_groesse']);
 }
 echo '</strong><br>' . $lang['cron_printout'] . ': <strong>' . ($config['cron_printout'] == 1 ? $lang['activated'] : $lang['not_activated']) . '</strong>';
 if ($config['cron_mail'] == 1) {
     $t = $config['email_recipient'] . ($config['cron_mail_dump'] == 1 ? $lang['withattach'] : $lang['withoutattach']);
 }
 echo '<br>' . $lang['send_mail_form'] . ": <strong>" . ($config['cron_mail'] == 1 ? $t : $lang['not_activated']) . '</strong>';
 echo '<br>' . $lang['ftp_transfer'] . ": <strong>" . ($config['cron_ftp'] == 1 ? $lang['activated'] : $lang['not_activated']);
 if ($config['cron_ftp'] == 1) {
     echo ' (Host: ' . $config['ftp_server'][$config['ftp_connectionindex']] . ' Port ' . $config['ftp_port'][$config['ftp_connectionindex']] . ' User: '******'ftp_user'][$config['ftp_connectionindex']] . ' Dir: ' . $config['ftp_dir'][$config['ftp_connectionindex']] . ')<br>';
 }
 echo '</strong></p>';
 //	Einträge für Perl
 echo '<p class="small">' . $lang['perloutput1'] . ':<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $scriptentry . '</strong><br>';
 echo $lang['perloutput2'] . ':<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $scriptref . '</strong><br>';
 echo $lang['perloutput3'] . ':<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $cronref . '</strong></p>';
Example #4
0
                $tabledata[$i]['records'] = $d[2];
                $tabledata[$i]['size'] = $d[3];
                $tabledata[$i]['update'] = $d[4];
                $tabledata[$i]['engine'] = isset($d[5]) ? $d[5] : '';
                $i++;
            }
            if (substr($line, 0, 6) == '-- EOF') {
                $eof = true;
            }
            if (substr(strtolower($line), 0, 6) == 'create') {
                $eof = true;
            }
        }
        for ($i = 0; $i < sizeof($tabledata); $i++) {
            $klasse = $i % 2 ? 1 : '';
            $tpl->assign_block_vars('ROW', array('CLASS' => 'dbrow' . $klasse, 'ID' => $i, 'NR' => $i + 1, 'TABLENAME' => $tabledata[$i]['name'], 'RECORDS' => $tabledata[$i]['records'], 'SIZE' => byte_output($tabledata[$i]['size']), 'LAST_UPDATE' => $tabledata[$i]['update'], 'TABLETYPE' => $tabledata[$i]['engine']));
        }
    }
    if ($gz) {
        gzclose($fp);
    } else {
        fclose($fp);
    }
}
if (!isset($dk)) {
    $dk = '';
}
$confirm_restore = $lang['L_FM_ALERTRESTORE1'] . ' `' . $databases['db_actual'] . '`  ' . $lang['L_FM_ALERTRESTORE2'] . ' ' . $filename . ' ' . $lang['L_FM_ALERTRESTORE3'];
$tpl->assign_vars(array('PAGETITLE' => $tblr . ' -' . $lang['L_TABLESELECTION'], 'L_NAME' => $lang['L_NAME'], 'L_DATABASE' => $lang['L_DB'], 'DATABASE' => $databases['db_actual'], 'L_LAST_UPDATE' => $lang['L_LASTBUFROM'], 'SEL_DUMP_ENCODING' => $sel_dump_encoding, 'FILENAME' => $filename, 'DUMP_COMMENT' => $dk, 'BUTTON_NAME' => $button_name, 'L_START_BACKUP' => $lang['L_STARTDUMP'], 'L_START_RESTORE' => $lang['L_FM_RESTORE'], 'L_ROWS' => $lang['L_INFO_RECORDS'], 'L_SIZE' => $lang['L_INFO_SIZE'], 'L_TABLE_TYPE' => $lang['L_TABLE_TYPE'], 'L_SELECT_ALL' => $lang['L_SELECTALL'], 'L_DESELECT_ALL' => $lang['L_DESELECTALL'], 'L_RESTORE' => $lang['L_RESTORE'], 'L_NO_MSD_BACKUP' => $lang['L_NOT_SUPPORTED'], 'L_CONFIRM_RESTORE' => $confirm_restore));
$tpl->pparse('show');
ob_end_flush();
Example #5
0
 } else {
     $cron_dbname = $databases['Name'][$config['cron_dbindex']];
     $cron_dbpraefix = $databases['praefix'][$config['cron_dbindex']];
 }
 echo '<table>';
 echo '<tr><td>' . $lang['L_DB'] . ':</td><td><strong>' . $cron_dbname . '</strong></td></tr>';
 if ($cron_dbpraefix > '') {
     echo '<tr><td>' . $lang['L_PRAEFIX'] . ":</td><td><strong>";
     echo $cron_dbpraefix . '</strong></td></tr>';
 }
 echo '<tr><td>' . $lang['L_GZIP'] . ":</td><td><strong>" . ($config['cron_compression'] == 1 ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED']);
 echo '</strong></td></tr>';
 echo '<tr><td>' . $lang['L_MULTI_PART'] . ":</td><td><strong>" . ($config['multi_part'] == 1 ? $lang['L_YES'] : $lang['L_NO']);
 echo '</strong></td></tr>';
 if ($config['multi_part'] == 1) {
     echo '<tr><td>' . $lang['L_MULTI_PART_GROESSE'] . ':</td><td><strong>' . byte_output($config['multipart_groesse']) . '</td></tr>';
 }
 echo '<tr><td>' . $lang['L_CRON_PRINTOUT'] . ':</td><td><strong>' . ($config['cron_printout'] == 1 ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED']) . '</strong></td></tr>';
 if ($config['send_mail'] == 1) {
     $t = $config['email_recipient'] . ($config['send_mail_dump'] == 1 ? $lang['L_WITHATTACH'] : $lang['L_WITHOUTATTACH']);
 }
 echo '<tr><td>' . $lang['L_SEND_MAIL_FORM'] . ':</td><td><strong>' . ($config['send_mail'] == 1 ? $t : $lang['L_NOT_ACTIVATED']) . '</strong></td></tr>';
 for ($x = 0; $x < 3; $x++) {
     if (isset($config['ftp_transfer'][$x]) && $config['ftp_transfer'][$x] > 0) {
         echo table_output($lang['L_FTP_TRANSFER'], sprintf(str_replace('<br>', ' ', $lang['L_FTP_SEND_TO']), $config['ftp_server'][$x], $config['ftp_dir'][$x]), 1, 2);
     }
 }
 //echo '</td></tr>';
 echo '</table>';
 //	Eintraege fuer Perl
 echo '<br><p class="small">' . $lang['L_PERLOUTPUT1'] . ':<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $scriptentry . '</strong><br>';
Example #6
0
function PartListe($f, $nr)
{
    global $config, $lang, $fpath;
    $dateistamm = substr($f, 0, strrpos($f, "part_")) . "part_";
    $dateiendung = substr(strtolower($f), -2) == "gz" ? ".sql.gz" : ".sql";
    $s = "";
    for ($i = 1; $i <= $nr; $i++) {
        if ($i > 1) {
            $s .= "<br>";
        }
        $s .= '<a href="' . $fpath . urlencode($dateistamm . $i . $dateiendung) . '">' . $dateistamm . $i . $dateiendung . '</a>&nbsp;&nbsp;&nbsp;' . byte_output(@filesize($config['paths']['backup'] . $dateistamm . $i . $dateiendung));
        $s .= '&nbsp;<a href="filemanagement.php?action=dl&amp;f=' . urlencode($dateistamm . $i . $dateiendung) . '" title="' . $lang['L_DOWNLOAD_FILE'] . '" alt="' . $lang['L_DOWNLOAD_FILE'] . '"><img src="' . $config['files']['iconpath'] . '/openfile.gif"></a>';
    }
    return $s;
}
Example #7
0
function MD_FreeDiskSpace()
{
    global $lang;
    $dfs = @diskfreespace("../");
    return $dfs ? byte_output($dfs) : $lang['L_NOTAVAIL'];
}
Example #8
0
 $divend = '</div>';
 if ($bb == $spalte) {
     $data = convert_to_utf8(simple_bbcode_conversion($rowval));
 } else {
     if ($showtables == 0) {
         if (isset($fdesc[$rowkey]['type'])) {
             $data = $fdesc[$rowkey]['type'] == 'string' || $fdesc[$rowkey]['type'] == 'blob' ? convert_to_utf8($rowval) : $rowval;
         }
     } else {
         if (isset($temp[$i][$rowkey])) {
             $data = $fdesc[$rowkey]['type'] == 'string' || $fdesc[$rowkey]['type'] == 'blob' ? convert_to_utf8($temp[$i][$rowkey]) : $temp[$i][$rowkey];
         } else {
             $data = '';
         }
         if (in_array($rowkey, $byte_output)) {
             $data = byte_output($data);
         }
     }
 }
 //v($fdesc[$rowkey]);
 if ($showtables == 0) {
     if (is_null($rowval)) {
         $data = '<i>NULL</i>';
     } else {
         $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
     }
 }
 $spalte++;
 $browse_link = '<a href="sql.php?db=' . $db . '&amp;tablename=' . $tablename . '&amp;dbid=' . $dbid . '" title="' . $data . '">';
 $d .= $tabellenansicht == 1 && $rowkey == 'Name' ? $divstart . $browse_link . $icon['browse'] . "</a>&nbsp;" . $browse_link . $data . "</a>{$divend}" : $divstart . $data . $divend;
 $d .= '</td>';
    if ($EXTINFO == "") {
        $tbl_zeile .= '<tr calss="dbrow"><td class="sm" colspan="2">' . $lang['not_supported'] . '</td>';
    } else {
        for ($i = 0; $i < $anzahl_tabellen; $i++) {
            if ($gz) {
                gzseek($fp, $offset);
                $statusline = gzgets($fp, 40960);
                $offset = gztell($fp);
            } else {
                fseek($fp, $offset);
                $statusline = fgets($fp, 5000);
                $offset = ftell($fp);
            }
            $s = explode("|", $statusline);
            $tbl_zeile .= '<tr class="dbrow"><td align="left"><input type="checkbox" class="checkbox" name="chk_tbl" value="' . $s[1] . '">' . $s[1] . '</td>';
            $tbl_zeile .= '<td align="left"><strong>' . $s[2] . '</strong> ' . $lang['datawith'] . ' <strong>' . byte_output($s[3]) . '</strong>, ' . $lang['lastbufrom'] . ' ' . $s[4] . '</td></tr>';
        }
        if ($gz) {
            gzclose($fp);
        } else {
            fclose($fp);
        }
    }
}
$buttons = '<tr><td colspan="2"><table width="100%" border="0"><tr>' . '<td><input type="button" class="Formbutton" onclick="Sel(true);" value="' . $lang['selectall'] . '"></td>' . '<td><input type="button" onclick="Sel(false);" value="' . $lang['deselectall'] . '" class="Formbutton"></td>' . '<td><input type="submit" class="Formbutton" style="width:180px;" name="' . $button_name . '" value="' . $button_caption . '"></td>' . '</tr></table></td></tr>';
echo '<div id="pagetitle">' . $tblr . ' - ' . $lang['tableselection'] . '</div><h6>' . $lang['db'] . ': ' . $databases['db_actual'] . '</h6>';
echo '<div id="content">';
echo '<form name="frm_tbl" action="filemanagement.php" method="post" onSubmit="return chkFormular()">';
echo '<table class="bordersmall">';
echo $buttons;
echo $tbl_zeile;
         $sql['import']['tablecreate'] = 1;
     }
     if ($sql['import']['table'] == "") {
         $aus .= '<span class="error">' . $lang['L_IMPORT_NOTABLE'] . '</span>';
     } else {
         if ($_POST['import_source'] == 0) {
             //Import aus textbox
             $sql['import']['csv'] = explode($sql['import']['endline'], $sql['import']['text']);
         } else {
             if (!isset($_FILES['upfile']['name']) || empty($_FILES['upfile']['name'])) {
                 $aus .= '<span class="error">' . $lang['L_FM_UPLOADFILEREQUEST'] . '</span>';
             } else {
                 $fn = $_FILES['upfile']['tmp_name'];
                 $sql['import']['csv'] = substr($_FILES['upfile']['name'], -3) == ".gz" ? gzfile($fn) : file($fn);
                 $sql['import']['text'] = implode("", $sql['import']['csv']);
                 $aus .= '<span>' . $lang['L_SQL_UPLOADEDFILE'] . '<strong>' . $_FILES['upfile']['name'] . '</strong>&nbsp;&nbsp;&nbsp;' . byte_output(filesize($_FILES['upfile']['tmp_name'])) . '</span>';
             }
         }
         if (is_array($sql['import']['csv'])) {
             $aus .= DoImport();
         } else {
             $aus .= '<br><span class="error">' . $lang['L_CSV_NODATA'] . '</span>';
         }
     }
 }
 $impaus = $aus;
 $impaus .= '<form action="sql.php?db=' . $db . '&amp;dbid=' . $dbid . '&amp;context=4&amp;import=1" method="post" enctype="multipart/form-data">' . $nl;
 $impaus .= '';
 $impaus .= '<a href="sql.php?db=' . $db . '&amp;dbid=' . $dbid . '&amp;context=4">' . $lang['L_EXPORT'] . '</a>';
 $impaus .= '<h6>' . sprintf($lang['L_SQL_IMPORT'], $databases['Name'][$dbid]) . '</h6>';
 $impaus .= '<table class="bordersmall"><tr class="thead"><th>' . $nl;
Example #11
0
 $dump['data'] = "\n" . $mysql_commentstring . ' EOB - End of backup\\n\\n\\n';
 WriteToDumpFile();
 ExecuteCommand('a');
 chmod($config['paths']['backup'] . $dump['backupdatei'], 0755);
 if ($config['multi_part'] == 1) {
     $out .= '<br><div class="backupmsg">';
     $dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], 'part_')) . 'part_';
     $dateiendung = $config['compression'] == 1 ? '.sql.gz' : '.sql';
     clearstatcache();
     for ($i = 1; $i < $dump['part'] - $dump['part_offset']; $i++) {
         $mpdatei = $dateistamm . $i . $dateiendung;
         $sz = byte_output(@filesize($config['paths']['backup'] . $mpdatei));
         $out .= $lang['file'] . ' <a href="' . $config['paths']['backup'] . $mpdatei . '" class="smallblack">' . $mpdatei . ' (' . $sz . ')</a> ' . $lang['dump_successful'] . '<br>';
     }
 } else {
     $out .= '<div class="backupmsg">' . $lang['file'] . ' <a href="' . $config['paths']['backup'] . $dump['backupdatei'] . '" class="smallblack">' . $dump['backupdatei'] . ' (' . byte_output(filesize($config['paths']['backup'] . $dump['backupdatei'])) . ')' . '</a>' . $lang['dump_successful'] . '<br>';
 }
 $backup_ready = 1;
 $xtime = time() - $xtime;
 $aus = array();
 $aus[] = '<br>';
 if ($config['multi_dump'] == 1) {
     WriteLog('Dump \'' . $dump['backupdatei'] . '\' finished.');
     WriteLog('Multidump: ' . count($databases['multi']) . ' Databases in ' . zeit_format($xtime) . '.');
 } else {
     WriteLog('Dump \'' . $dump['backupdatei'] . '\' finished in ' . zeit_format($xtime) . '.');
 }
 if ($config['send_mail'] == 1) {
     DoEmail();
 }
 if ($config['ftp_transfer'] == 1) {
Example #12
0
         $sql['import']['tablecreate'] = 1;
     }
     if ($sql['import']['table'] == "") {
         $aus .= '<span class="error">' . $lang['import_notable'] . '</span>';
     } else {
         if ($_POST['import_source'] == 0) {
             //Import aus textbox
             $sql['import']['csv'] = explode($sql['import']['endline'], $sql['import']['text']);
         } else {
             if (!isset($_FILES['upfile']['name']) || empty($_FILES['upfile']['name'])) {
                 $aus .= '<span class="error">' . $lang['fm_uploadfilerequest'] . '</span>';
             } else {
                 $fn = $_FILES['upfile']['tmp_name'];
                 $sql['import']['csv'] = substr($_FILES['upfile']['name'], -3) == ".gz" ? gzfile($fn) : file($fn);
                 $sql['import']['text'] = implode("", $sql['import']['csv']);
                 $aus .= '<span>' . $lang['sql_uploadedfile'] . '<strong>' . $_FILES['upfile']['name'] . '</strong>&nbsp;&nbsp;&nbsp;' . byte_output(filesize($_FILES['upfile']['tmp_name'])) . '</span>';
             }
         }
         if (is_array($sql['import']['csv'])) {
             $aus .= DoImport();
         } else {
             $aus .= '<br><span class="error">' . $lang['csv_nodata'] . '</span>';
         }
     }
 }
 $impaus = $aus;
 $impaus .= '<form action="sql.php?db=' . $db . '&amp;dbid=' . $dbid . '&amp;context=4&amp;import=1" method="post" enctype="multipart/form-data">' . $nl;
 $impaus .= '';
 $impaus .= '<a href="sql.php?db=' . $db . '&amp;dbid=' . $dbid . '&amp;context=4">' . $lang['export'] . '</a>';
 $impaus .= '<h6>' . sprintf($lang['sql_import'], $databases['Name'][$dbid]) . '</h6>';
 $impaus .= '<table class="bordersmall"><tr class="thead"><th>' . $nl;
/**
 * Send e-mail and attach file
 *
 * @param string $file
 * @return boolean
 */
function doEmail($file)
{
    global $config, $dump, $lang, $log;
    include 'lib/phpmailer/php5/class.phpmailer.php';
    include 'inc/classes/helper/Html.php';
    // get some status info from actual file
    $rootpath = $config['paths']['root'] . $config['paths']['backup'];
    $fileInfo = ReadStatusline($file);
    $fileInfo['size'] = @filesize($rootpath . $file);
    $database = $fileInfo['dbname'];
    $tablesSaved = $fileInfo['tables'];
    $recordsSaved = $fileInfo['tables'];
    if (sizeof($_SESSION['email']['filelist']) == 0) {
        // first call after backup -> create file list of all files for each database
        $_SESSION['email']['filelist'] = array();
        foreach ($_SESSION['log']['email'] as $filename) {
            $statusInfo = ReadStatusline($filename);
            if (!isset($_SESSION['email']['filelist'][$statusInfo['dbname']])) {
                $_SESSION['email']['filelist'][$statusInfo['dbname']] = array();
            }
            $_SESSION['email']['filelist'][$statusInfo['dbname']][] = $filename;
        }
    }
    // create file list for specific database
    $filelist = '';
    foreach ($_SESSION['email']['filelist'][$database] as $filename) {
        $phpSelf = $_SERVER['PHP_SELF'];
        $linkToFile = '<a href="' . getServerProtocol() . $_SERVER['HTTP_HOST'] . substr($phpSelf, 0, strrpos($phpSelf, '/')) . '/' . $config['paths']['backup'] . $filename . '">' . $filename . '</a>';
        $filelist .= $linkToFile;
        if ($file == $filename && $config['email']['attach_backup']) {
            $filelist .= ' (' . $lang['L_ATTACHED_AS_FILE'] . ')';
        }
        $filelist .= '<br />' . "\n";
    }
    $mail = new PHPMailer();
    $mail->CharSet = 'utf-8';
    $mail->PlugInDir = 'lib/phpmailer/php5/';
    $mail->From = $config['email']['sender_address'];
    $mail->FromName = $config['email']['sender_name'];
    $mail->AddAddress($config['email']['recipient_address'], $config['email']['recipient_name']);
    // add cc-recipients
    foreach ($config['email']['recipient_cc'] as $recipient) {
        if ($recipient['address'] > '') {
            $mail->AddCC($recipient['address'], $recipient['name']);
        }
    }
    //build subject
    $subject = $lang['L_DUMP_FILENAME'] . ': ' . $file;
    if ($fileInfo['comment'] > '') {
        $subject = $fileInfo['comment'] . ', ' . $subject;
    }
    $mail->Subject = $subject;
    $mail->Timeout = 60;
    // set used mail-method
    $mail->IsMail();
    //defaults to php-mail-function
    if ($config['use_mailer'] == 1) {
        $mail->IsSendmail();
        $mail->Sendmail = $config['sendmail_call'];
    } elseif ($config['use_mailer'] == 2) {
        $mail->IsSMTP();
        //debug
        //$mail->SMTPDebug = PHP_INT_MAX;
        $mail->Host = $config['smtp_server'];
        $mail->Port = $config['smtp_port'];
        // auth?
        if ($config['smtp_useauth']) {
            $mail->SMTPAuth = true;
            $mail->Username = $config['smtp_user'];
            $mail->Password = $config['smtp_pass'];
        }
        //use ssl?
        if ($config['smtp_usessl']) {
            $mail->SMTPSecure = 'tls';
        }
    }
    //build mail body
    $body = '';
    //add attachement?
    if ($config['email']['attach_backup']) {
        //check if file is bigger than allowed max size
        if ($config['email_maxsize'] > 0 && $fileInfo['size'] > $config['email_maxsize']) {
            // attachement too big -> don't attach and paste message to body
            $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, $file . ' (' . byte_output(filesize($config['paths']['backup'] . $file)) . ')<br />');
        } else {
            // add file as attachement
            $mail->AddAttachment($rootpath . $file);
            $body .= sprintf($lang['L_EMAILBODY_ATTACH'], $database, $filelist);
        }
    } else {
        // don't attach backup file according to configuration
        $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, "{$file} (" . byteOutput(filesize($config['paths']['backup'] . $file)) . ")<br />");
    }
    //set body
    $mail->MsgHTML($body);
    //build alternative-body without tags for mail-clients blocking HTML
    $altBody = strip_tags(Html::br2nl($body));
    $mail->AltBody = $altBody;
    $mail->Timeout = 30;
    $ret = $mail->Send();
    if (!$ret) {
        writeToErrorLog('', '', $lang['L_MAILERROR'] . ' -> ' . $mail->ErrorInfo, 0);
        $log->write(Log::PHP, $lang['L_MAILERROR']);
    } else {
        $msg = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email']['recipient_address'];
        $log->write(Log::PHP, $msg);
    }
    return $ret;
}
Example #14
0
                if ($akt_size > 0) {
                    echo '<a href="main.php?action=db&amp;dbid=' . $dbid . '&amp;checkit=' . urlencode($row['Name']) . '#dbid">check</a>';
                } else {
                    echo "-";
                }
            }
            echo '</td></tr>';
            if (isset($row['Update_time'])) {
                if (strtotime($row['Update_time']) > strtotime($last_update)) {
                    $last_update = $row['Update_time'];
                }
            }
            $s1 = $s1 + $row['Rows'];
            $s2 = $s2 + $row['Data_length'] + $row['Index_length'];
        }
        echo '<tr class="dbrowsel"><td colspan="2">' . $lang['info_sum'] . '</td><td style="text-align:right">' . number_format($s1, 0, ",", ".") . '</td><td style="text-align:right">' . byte_output($s2) . '</td><td>' . $last_update . '</td>';
        echo '<td colspan="2">&nbsp;</td></tr></table>';
    }
    $edb = $lang['info_emptydb1'] . ' `' . $databases['Name'][$dbid] . '` ' . $lang['info_emptydb2'];
    $kdb = $lang['info_emptydb1'] . ' `' . $databases['Name'][$dbid] . '` ' . $lang['info_killdb'];
    echo '<form action="main.php?action=db#dbid" method="post">';
    if ($numrows > 0) {
        echo '<input class="Formbutton" type="submit" name="empty' . $dbid . '" value="' . $lang['clear_database'] . '" onclick="if (!confirm(\'' . $edb . '\')) return false;">';
    }
    echo '<input class="Formbutton" type="submit" name="kill' . $dbid . '" value="' . $lang['delete_database'] . '" onclick="if (!confirm(\'' . $kdb . '\')) return false;">';
    if ($numrows > 0) {
        echo '<input class="Formbutton" type="submit" name="optimize' . $dbid . '" value="' . $lang['optimize_databases'] . '">';
        echo '<input class="Formbutton" type="submit" name="check' . $dbid . '" value="' . $lang['check_tables'] . '">';
    }
    echo '</div>';
}
Example #15
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());
Example #16
0
 case 4:
     //SHOW MASTER LOGS
     $msg = "> operating SHOW MASTER LOGS<br>";
     $res = @mysql_query("SHOW MASTER LOGS", $config['dbconnection']);
     $meldung = mysql_error($config['dbconnection']);
     if ($meldung != "") {
         $msg .= '&gt; MySQL-Error: ' . $meldung;
     } else {
         $numrows = mysql_num_rows($res);
         if ($numrows == 0 || $numrows === false) {
             $msg .= '&gt; there are no master log-files';
         } else {
             $msg .= '&gt; there are ' . $numrows . ' logfiles<br>';
             for ($i = 0; $i < $numrows; $i++) {
                 $row = mysql_fetch_row($res);
                 $msg .= '&gt; ' . $row[0] . '&nbsp;&nbsp;&nbsp;' . ($data_dir ? byte_output(@filesize($data_dir . $row[0])) : '') . '<br>';
             }
         }
     }
     break;
 case 5:
     //RESET MASTER
     $msg = "&gt; operating RESET MASTER<br>";
     $res = @mysql_query("RESET MASTER", $config['dbconnection']);
     $meldung = mysql_error($config['dbconnection']);
     if ($meldung != "") {
         $msg .= '&gt; MySQL-Error: ' . $meldung;
     } else {
         $msg .= "&gt; All Masterlogs were deleted.";
     }
     break;
			$aus['conf'].=table_output($lang['L_BACKUP_DBS_PERL'],$text);
		}

		if ($config['multi_part'] == 1) // Multipart
		{
			$aus['conf'].=table_output($lang['L_MULTI_PART'],$lang['L_YES'] . ", " . $lang['L_FILESIZE'] . " " . byte_output($config['multipart_groesse']));
		}

		if ($config['send_mail'] == 1) //Email
		{
			$aus['conf'].=table_output($lang['L_SEND_MAIL_FORM'],$lang['L_YES'] . ", " . $lang['L_EMAIL_ADRESS'] . ": " . $config['email_recipient']);
			if ($config['email_recipient_cc'] > '') $aus['conf'].=table_output($lang['L_EMAIL_CC'],$config['email_recipient_cc']);
			$text=$lang['L_YES'] . ", " . $lang['L_MAX_UPLOAD_SIZE'] . ": ";
			$bytes=$config['email_maxsize1'] * 1024;
			if ($config['email_maxsize2'] == 2) $bytes=$bytes * 1024;
			$text.=byte_output($bytes);
			if ($config['send_mail_dump'] == 1) $aus['conf'].=table_output($lang['L_SEND_MAIL_DUMP'],$text);

		}

		for ($x=0; $x < 3; $x++)
		{
			if (isset($config['ftp_transfer'][$x]) && $config['ftp_transfer'][$x] > 0)
			{
				//$aus['conf'].=table_output($lang['L_FTP'],sprintf($lang['L_FTP_SEND_TO'],$config['ftp_server'][$x],$config['ftp_dir'][$x]),1,2);
				$aus['conf'].=table_output($lang['L_FTP'],sprintf($lang['L_FTP_SEND_TO'],$config['ftp_server'][$x],$config['ftp_dir'][$x]));
			}
		}
		$aus['conf'].='</table></td><td>';
		$aus['conf'].='<a href="config_overview.php?config=' . urlencode($c) . '">' . $icon['edit'] . '</a>';
Example #18
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');
Example #19
0
    $perlbutton2 = '<td><input class="Formbutton" type="button" onclick="location.href=\'log.php?r=2\'" value="Perl-Complete Log"></td>';
}
//anzeigen
echo '<form action="log.php" method="post"><table><tr>';
echo '<td><input class="Formbutton" type="button" onclick="location.href=\'log.php?r=0\'" value="PHP-Log"></td>';
echo "\n" . $errorbutton . "\n" . $perlbutton . "\n" . $perlbutton2 . "\n";
echo '</tr></table><br>';
//Status Logfiles
echo '<div align="left"><table class="bdr"><tr><td><table><tr><td valign="top"><strong>' . $lang['L_LOGFILEFORMAT'] . '</strong><br><br>' . ($config['logcompression'] == 1 ? '<img src="' . $config['files']['iconpath'] . 'gz.gif" width="32" height="32" alt="compressed" align="left">' : '<img src="' . $icon['blank'] . '" width="32" height="32" alt="" align="left">');
echo '' . ($config['logcompression'] == 1 ? $lang['L_COMPRESSED'] : $lang['L_NOTCOMPRESSED']) . '</td>';
echo '<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign="top" align="right">';
echo '<a href="' . $loginfo['log'] . '">' . substr($loginfo['log'], strrpos($loginfo['log'], "/") + 1) . '</a><br>';
echo $loginfo['errorlog_size'] > 0 ? '<a href="' . $loginfo['errorlog'] . '">' . substr($loginfo['errorlog'], strrpos($loginfo['errorlog'], "/") + 1) . '</a><br>' : substr($loginfo['errorlog'], strrpos($loginfo['errorlog'], "/") + 1) . '<br>';
echo $loginfo['perllog_size'] > 0 ? '<a href="' . $loginfo['perllog'] . '">' . substr($loginfo['perllog'], strrpos($loginfo['perllog'], "/") + 1) . '</a><br>' : substr($loginfo['perllog'], strrpos($loginfo['perllog'], "/") + 1) . '<br>';
echo $loginfo['perllogcomplete_size'] > 0 ? '<a href="' . $loginfo['perllogcomplete'] . '">' . substr($loginfo['perllogcomplete'], strrpos($loginfo['perllogcomplete'], "/") + 1) . '</a><br>' : substr($loginfo['perllogcomplete'], strrpos($loginfo['perllogcomplete'], "/") + 1) . '<br>';
echo '<strong>total</strong></td><td valign="top" align="right">' . byte_output($loginfo['log_size']) . '<br>' . byte_output($loginfo['errorlog_size']) . '<br>' . byte_output($loginfo['perllog_size']) . '<br>' . byte_output($loginfo['perllogcomplete_size']) . '<br><strong>' . byte_output($loginfo['log_totalsize']) . '</strong></td>';
echo '</tr><tr><td colspan="3" align="center"><a class="small" href="log.php?r=' . $r . '&amp;revers=0">' . $lang['L_NOREVERSE'] . '</a>&nbsp;&nbsp;&nbsp;<a class="small" href="log.php?r=' . $r . '&amp;revers=1">' . $lang['L_REVERSE'] . '</a></td></tr></table></td></tr></table></div>';
$out = '';
if ($r != 2) {
    $out .= '<pre>';
}
if (file_exists($lfile)) {
    $zeilen = $config['logcompression'] == 1 ? gzfile($lfile) : file($lfile);
    if ($r == 30) {
        echo '<pre>' . print_r($zeilen, true) . '</pre>';
        exit;
    }
    if ($revers == 1) {
        $zeilen = array_reverse($zeilen);
    }
    foreach ($zeilen as $zeile) {
Example #20
0
function DoEmail()
{
    global $config, $dump, $databases, $email, $lang, $out, $REMOTE_ADDR;
    $header = "";
    if ($config['cron_use_sendmail'] == 1) {
        //sendmail
        if (ini_get("sendmail_path") != $config['cron_sendmail']) {
            @ini_set("SMTP", $config['cron_sendmail']);
        }
        if (ini_get("sendmail_from") != $config['email_sender']) {
            @ini_set("SMTP", $config['email_sender']);
        }
    } else {
        //SMTP
    }
    if (ini_get("SMTP") != $config['cron_smtp']) {
        @ini_set("SMTP", $config['cron_smtp']);
    }
    if (ini_get("smtp_port") != 25) {
        @ini_set("smtp_port", 25);
    }
    if ($config['multi_part'] == 0) {
        $file = $dump['backupdatei'];
        $file_name = strpos("/", $file) ? substr($file, strrpos("/", $file)) : $file;
        $file_type = filetype($config['paths']['backup'] . $file);
        $file_size = filesize($config['paths']['backup'] . $file);
        if ($config['email_maxsize'] > 0 && $file_size > $config['email_maxsize'] || $config['send_mail_dump'] == 0) {
            //anhang zu gross
            $subject = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y H:i", time());
            $header .= "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "X-Mailer: PHP/" . phpversion() . "\n";
            $header .= "X-Sender-IP: {$REMOTE_ADDR}\n";
            $header .= "Content-Type: text/html; charset=utf-8\n";
            if ($config['send_mail_dump'] != 0) {
                $msg_body = sprintf(addslashes($lang['L_EMAILBODY_TOOBIG']), byte_output($config['email_maxsize']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")<br>");
            } else {
                $msg_body = sprintf(addslashes($lang['L_EMAILBODY_NOATTACH']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")");
            }
            include_once './inc/functions.php';
            $msg_body .= '<a href="' . getServerProtocol() . $_SERVER['HTTP_HOST'] . substr($_SERVER["PHP_SELF"], 0, strrpos($_SERVER["PHP_SELF"], "/")) . '/' . $config['paths']['backup'] . $file . '">' . $file . '</a>';
            $email_log = "Email sent to '" . $config['email_recipient'] . "'";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`<br>";
        } else {
            //alles ok, anhang generieren
            $msg_body = sprintf(addslashes($lang['L_EMAILBODY_ATTACH']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")");
            $subject = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y", time());
            $fp = fopen($config['paths']['backup'] . $file, "r");
            $contents = fread($fp, $file_size);
            $encoded_file = chunk_split(base64_encode($contents));
            fclose($fp);
            $header .= "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "Content-type: multipart/mixed; ";
            $header .= "boundary=\"Message-Boundary\"\n";
            $header .= "Content-transfer-encoding: 7BIT\n";
            $header .= "X-attachments: {$file_name}";
            $body_top = "--Message-Boundary\n";
            $body_top .= "Content-type: text/html; charset=utf-8\n";
            $body_top .= "Content-transfer-encoding: 7BIT\n";
            $body_top .= "Content-description: Mail message body\n\n";
            $msg_body = $body_top . $msg_body;
            $msg_body .= "\n\n--Message-Boundary\n";
            $msg_body .= "Content-type: {$file_type}; name=\"{$file}\"\n";
            $msg_body .= "Content-Transfer-Encoding: BASE64\n";
            $msg_body .= "Content-disposition: attachment; filename=\"{$file}\"\n\n";
            $msg_body .= "{$encoded_file}\n";
            $msg_body .= "--Message-Boundary--\n";
            $email_log = "Email was sent to '" . $config['email_recipient'] . "' with '" . $dump['backupdatei'] . "'.";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`" . $lang['L_WITH'] . "`" . $dump['backupdatei'] . "`.<br>";
        }
    } else {
        //Multipart
        $mp_sub = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y", time());
        $subject = $mp_sub;
        $header .= "FROM:" . $config['email_sender'] . "\n";
        if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
            $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
        }
        $header .= "MIME-version: 1.0\n";
        $header .= "X-Mailer: PHP/" . phpversion() . "\n";
        $header .= "X-Sender-IP: {$REMOTE_ADDR}\n";
        $header .= "Content-Type: text/html; charset=utf-8";
        $dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], "part_")) . "part_";
        $dateiendung = $config['compression'] == 1 ? ".sql.gz" : ".sql";
        $mpdatei = array();
        $mpfiles = "";
        for ($i = 1; $i < $dump['part'] - $dump['part_offset']; $i++) {
            $mpdatei[$i - 1] = $dateistamm . $i . $dateiendung;
            $sz = byte_output(@filesize($config['paths']['backup'] . $mpdatei[$i - 1]));
            $mpfiles .= $mpdatei[$i - 1] . " (" . $sz . ")<br>";
        }
        $msg_body = $config['send_mail_dump'] == 1 ? sprintf(addslashes($lang['L_EMAILBODY_MP_ATTACH']), $databases['Name'][$dump['dbindex']], $mpfiles) : sprintf(addslashes($lang['L_EMAILBODY_MP_NOATTACH']), $databases['Name'][$dump['dbindex']], $mpfiles);
        $email_log = "Email was sent to '" . $config['email_recipient'] . "'";
        $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`<br>";
    }
    if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) {
        $out .= '<span class="success">' . $email_out . '</span>';
        WriteLog("{$email_log}");
    } else {
        $out .= '<span class="error">' . $lang['L_MAILERROR'] . '</span><br>';
        WriteLog("Email to '" . $config['email_recipient'] . "' failed !");
        ErrorLog("Email ", $databases['Name'][$dump['dbindex']], 'Subject: ' . stripslashes($subject), $lang['L_MAILERROR']);
        $dump['errors']++;
    }
    if (isset($mpdatei) && $config['send_mail_dump'] == 1) {
        // && ($config['email_maxsize']==0 || ($config['email_maxsize']>0 && $config['multipartgroesse2']<=$config['email_maxsize']))) {
        for ($i = 0; $i < count($mpdatei); $i++) {
            $file_name = $mpdatei[$i];
            $file_type = filetype($config['paths']['backup'] . $mpdatei[$i]);
            $file_size = filesize($config['paths']['backup'] . $mpdatei[$i]);
            $fp = fopen($config['paths']['backup'] . $mpdatei[$i], "r");
            $contents = fread($fp, $file_size);
            $encoded_file = chunk_split(base64_encode($contents));
            fclose($fp);
            $subject = $mp_sub . "  [Part " . ($i + 1) . " / " . count($mpdatei) . "]";
            $header = "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "Content-type: multipart/mixed; ";
            $header .= "boundary=\"Message-Boundary\"\n";
            $header .= "Content-transfer-encoding: 7BIT\n";
            $header .= "X-attachments: {$file_name}";
            $body_top = "--Message-Boundary\n";
            $body_top .= "Content-type: text/html; charset=utf-8\n";
            $body_top .= "Content-transfer-encoding: 7BIT\n";
            $body_top .= "Content-description: Mail message body\n\n";
            $msg_body = $body_top . addslashes($lang['L_EMAIL_ONLY_ATTACHMENT'] . $lang['L_EMAILBODY_FOOTER']);
            $msg_body .= "\n\n--Message-Boundary\n";
            $msg_body .= "Content-type: {$file_type}; name=\"" . $mpdatei[$i] . "\"\n";
            $msg_body .= "Content-Transfer-Encoding: BASE64\n";
            $msg_body .= "Content-disposition: attachment; filename=\"" . $mpdatei[$i] . "\"\n\n";
            $msg_body .= "{$encoded_file}\n";
            $msg_body .= "--Message-Boundary--\n";
            $email_log = "Email with {$mpdatei[$i]} was sent to '" . $config['email_recipient'] . "'";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`" . $lang['L_WITH'] . "`" . $mpdatei[$i] . "`.<br>";
            if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) {
                $out .= '<span class="success">' . $email_out . '</span>';
                WriteLog("{$email_log}");
            } else {
                $out .= '<span class="error">' . $lang['L_MAILERROR'] . '</span><br>';
                WriteLog("Email to '" . $config['email_recipient'] . "' failed !");
                ErrorLog("Email ", $databases['Name'][$dump['dbindex']], 'Subject: ' . stripslashes($subject), $lang['L_MAILERROR']);
                $dump['errors']++;
            }
        }
    }
}
function PartListe($f, $nr)
{
    global $config;
    $dateistamm = substr($f, 0, strrpos($f, "part_")) . "part_";
    $dateiendung = substr(strtolower($f), -2) == "gz" ? ".sql.gz" : ".sql";
    $s = "";
    for ($i = 1; $i <= $nr; $i++) {
        if ($i > 1) {
            $s .= "<br>";
        }
        $s .= '<a href="' . $config['paths']['backup'] . $dateistamm . $i . $dateiendung . '">' . $dateistamm . $i . $dateiendung . '</a>&nbsp;&nbsp;&nbsp;' . byte_output(@filesize($config['paths']['backup'] . $dateistamm . $i . $dateiendung));
    }
    return $s;
}