Skip to content

Commit

Permalink
bug fix e1
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Jul 28, 2022
1 parent eb6cc4a commit 285fb23
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions interface/main/backup.php
Expand Up @@ -500,8 +500,8 @@ function export_submit(step) {
}

if ($form_step == 1) {
$form_status .= xla('Dumping OpenEMR database') . "...<br />";
echo nl2br($form_status);
$form_status .= xl('Dumping OpenEMR database') . "...||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
if (file_exists($TAR_FILE_PATH)) {
if (! unlink($TAR_FILE_PATH)) {
die(xlt("Couldn't remove old backup file:") . " " . text($TAR_FILE_PATH));
Expand Down Expand Up @@ -546,8 +546,8 @@ function export_submit(step) {
}

if ($form_step == 3) {
$form_status .= xla('Dumping OpenEMR web directory tree') . "...<br />";
echo nl2br($form_status);
$form_status .= xl('Dumping OpenEMR web directory tree') . "...||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
$cur_dir = getcwd();
chdir($webserver_root);

Expand Down Expand Up @@ -588,8 +588,8 @@ function export_submit(step) {
}

if ($form_step == 5) { // create the final compressed tar containing all files
$form_status .= xla('Backup file has been created. Will now send download.') . "<br />";
echo nl2br($form_status);
$form_status .= xl('Backup file has been created. Will now send download.') . "||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
$cur_dir = getcwd();
chdir($BACKUP_DIR);
$file_list = array('.');
Expand Down Expand Up @@ -693,8 +693,8 @@ function export_submit(step) {
}

if ($tables || is_array($_POST['form_sel_lists'] ?? '') || is_array($_POST['form_sel_layouts'] ?? '')) {
$form_status .= xla('Creating export file') . "...<br />";
echo nl2br($form_status);
$form_status .= xl('Creating export file') . "...||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
if (file_exists($EXPORT_FILE)) {
if (! unlink($EXPORT_FILE)) {
die(xlt("Couldn't remove old export file: ") . text($EXPORT_FILE));
Expand Down Expand Up @@ -899,8 +899,8 @@ function export_submit(step) {
}

if ($form_step == 103) {
$form_status .= xla('Done. Will now send download.') . "<br />";
echo nl2br($form_status);
$form_status .= xl('Done. Will now send download.') . "||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
$auto_continue = true;
}

Expand All @@ -919,8 +919,8 @@ function export_submit(step) {
// Process uploaded config file.
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $EXPORT_FILE)) {
$form_status .= xla('Applying') . "...<br />";
echo nl2br($form_status);
$form_status .= xl('Applying') . "...||br-placeholder||";
echo brCustomPlaceholder(text($form_status));
$cmd = escapeshellcmd($mysql_cmd) . " -u " . escapeshellarg($sqlconf["login"]) .
" -p" . escapeshellarg($sqlconf["pass"]) .
" -h " . escapeshellarg($sqlconf["host"]) .
Expand All @@ -941,8 +941,8 @@ function export_submit(step) {
}

if ($form_step == 203) {
$form_status .= xla('Done') . ".";
echo nl2br($form_status);
$form_status .= xl('Done') . ".";
echo brCustomPlaceholder(text($form_status));
}

/// ViSolve : EventLog Backup
Expand Down Expand Up @@ -1026,7 +1026,7 @@ function export_submit(step) {
</table>

<input type='hidden' name='form_step' value='<?php echo attr($form_step); ?>' />
<input type='hidden' name='form_status' value='<?php echo $form_status; ?>' />
<input type='hidden' name='form_status' value='<?php echo attr($form_status); ?>' />

</form>

Expand Down Expand Up @@ -1090,6 +1090,13 @@ function export_submit(step) {
</script>
<?php }

// convert ||br-placeholder|| to <br>
// (this is because the nl2br was not working for a reason I couldn't figure out)
function brCustomPlaceholder(string $str): string
{
return str_replace("||br-placeholder||", "<br />", $str);
}

// Recursive directory remove (like an O/S insensitive "rm -rf dirname")
function obliterate_dir($dir)
{
Expand Down

0 comments on commit 285fb23

Please sign in to comment.