$htmlMain .= $backupArchive . ' is not a valid Backup-ID'; $htmlTitle = "Backup"; printPage(); exit; } break; case "5": // delete backup $backupArchive = trim($_REQUEST["f"]); if (backupParamCheck($backupArchive)) { backupDelete($backupArchive); buildPage("b"); $htmlMain .= '<br>'; $htmlMain .= '<em>' . $backupArchive . '</em> deleted.'; $htmlMain .= '<br><br>'; $htmlMain .= backupListDisplay(); $htmlTitle = "Backup"; printPage(); exit; } else { buildPage("-b"); $htmlMain .= '<br><br>'; $htmlMain .= '<font color="red"><strong>Backup - Error</strong></font><br><br>'; $htmlMain .= $backupArchive . ' is not a valid Backup-ID'; $htmlTitle = "Backup"; printPage(); exit; } exit; break; }
/** * backup * * @param $action */ function sa_backup($action = "") { global $cfg, $error, $statusImage, $statusMessage, $htmlTitle, $htmlTop, $htmlMain; if ($action == "") { return; } switch ($action) { case "0": // choose backup-type buildPage("b"); $htmlTitle = "Backup - Create"; $htmlMain .= '<br>Select the format and location to save the backup to:<br><br>'; $htmlMain .= '<form name="backupServer" action="' . _FILE_THIS . '" method="post">'; $htmlMain .= '<select name="c">'; $htmlMain .= '<option value="0">none</option>'; $htmlMain .= '<option value="1" selected>gzip</option>'; $htmlMain .= '<option value="2">bzip2</option>'; $htmlMain .= '</select> '; $htmlMain .= '<input type="Hidden" name="b" value="1">'; $htmlMain .= '<input type="submit" value="Backup on Server">'; $htmlMain .= '</form><p>'; $htmlMain .= '<form name="backupClient" action="' . _FILE_THIS . '" method="post">'; $htmlMain .= '<select name="c">'; $htmlMain .= '<option value="0">none</option>'; $htmlMain .= '<option value="1" selected>gzip</option>'; $htmlMain .= '<option value="2">bzip2</option>'; $htmlMain .= '</select> '; $htmlMain .= '<input type="Hidden" name="b" value="2">'; $htmlMain .= '<input type="submit" value="Backup to Client">'; $htmlMain .= '</form><p>'; $htmlMain .= '<br><strong>Notes:</strong><br>"Backup on Server" will save the backup archive to the following path:<br>'; $htmlMain .= '<em>' . tfb_htmlencodekeepspaces($cfg["path"] . _DIR_BACKUP) . '/</em>'; $htmlMain .= '<br><br>'; $htmlMain .= '"Backup to Client" will create the backup archive and prompt you to save in your web browser.<br><br><strong>Please wait</strong> until the backup is complete. Don\'t click stuff while backup archive is being created - you will be informed if something goes wrong so no need to stress it.<br><br>'; $htmlMain .= "<hr><strong>What Data is Backed Up?</strong><br>"; $htmlMain .= "<ul>"; $htmlMain .= "<li>Document root directory structure -<br>all files underneath the webserver document root folder where you installed Torrentflux-b4rt.<br><br></li>"; $htmlMain .= "<li>The Transfers folder directory structure -<br>all files in the .transfers folder located in the path configured in the admin pages 'server' tab.<br><br></li>"; $htmlMain .= "<li>The fluxd folder directory structure -<br>all files in the .fluxd folder located in the path configured in the admin pages 'server' tab.<br><br></li>"; $htmlMain .= "<li>The MRTG folder directory structure -<br>all files in the .mrtg folder located in the path configured in the admin pages 'server' tab.<br><br></li>"; $htmlMain .= "<li>The Torrentflux-b4rt database -<br>the database used to store information used in the day to day running of torrentflux-b4rt.<br><br></li>"; $htmlMain .= "</ul><hr>"; printPage(); exit; case "1": // server-backup buildPage("b"); $htmlTitle = "Backup - Create - Server"; printPageStart(1); echo $htmlMain; $backupArchive = backupCreate(true, tfb_getRequestVar('c')); if ($backupArchive == "") { sendLine('<br>'); sendLine('<font color="red"><strong>Backup - Error</strong></font><br><br>'); sendLine($error); } else { sendLine('<br>'); sendLine('<strong>Backup Created</strong>'); sendLine('<br><br>Archive of backup is <em>' . tfb_htmlencodekeepspaces($backupArchive) . '</em>'); sendLine('<br><br>'); sendLine(backupListDisplay()); } printPageEnd(1); exit; case "2": // client-backup $backupArchive = backupCreate(false, tfb_getRequestVar('c')); if ($backupArchive == "") { buildPage("-b"); $htmlTitle = "Backup - Create - Client"; $htmlMain .= '<br><br>'; $htmlMain .= '<font color="red"><strong>Backup - Error</strong></font><br><br>'; $htmlMain .= $error; printPage(); } else { backupSend($backupArchive, true); } exit; case "3": // backup-list $htmlTitle = "Backup - Backups on Server"; buildPage("b"); $htmlMain .= '<br>'; $htmlMain .= backupListDisplay(); printPage(); exit; case "4": // download backup $backupArchive = tfb_getRequestVar('f'); if (backupParamCheck($backupArchive)) { backupSend($backupArchive, false); } else { buildPage("-b"); $htmlTitle = "Backup - Download"; $htmlMain .= '<br><br>'; $htmlMain .= '<font color="red"><strong>Backup - Error</strong></font><br><br>'; $htmlMain .= tfb_htmlencodekeepspaces($backupArchive) . ' is not a valid Backup-ID'; printPage(); } exit; case "5": // delete backup $backupArchive = tfb_getRequestVar('f'); if (backupParamCheck($backupArchive)) { backupDelete($backupArchive); buildPage("b"); $htmlTitle = "Backup - Delete"; $htmlMain .= '<br>'; $htmlMain .= '<em>' . tfb_htmlencodekeepspaces($backupArchive) . '</em> deleted.'; $htmlMain .= '<br><br>'; $htmlMain .= backupListDisplay(); } else { buildPage("-b"); $htmlTitle = "Backup - Delete"; $htmlMain .= '<br><br>'; $htmlMain .= '<font color="red"><strong>Backup - Error</strong></font><br><br>'; $htmlMain .= tfb_htmlencodekeepspaces($backupArchive) . ' is not a valid Backup-ID'; } printPage(); exit; } exit; }