Skip to content

Commit 0442861

Browse files
committed
[FIX] Errors bkmanager.
1 parent 215e59e commit 0442861

File tree

1 file changed

+24
-36
lines changed

1 file changed

+24
-36
lines changed

manager/actions/bkmanager.static.php

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
$driver = EvolutionCMS()->getDatabase()->getConfig('driver');
2727

2828
if ($mode == 'restore1') {
29-
3029
if (isset($_POST['textarea']) && !empty($_POST['textarea'])) {
3130
$source = trim($_POST['textarea']);
3231
$_SESSION['textarea'] = $source . "\n";
@@ -59,14 +58,10 @@
5958
} elseif ($mode == 'restore2') {
6059
$path = EvolutionCMS()->getConfig('snapshot_path') . $_POST['filename'];
6160
if (file_exists($path)) {
62-
6361
switch ($driver) {
6462
case 'pgsql':
65-
6663
$dump_request = 'PGPASSWORD="'.EvolutionCMS()->getDatabase()->getConfig('password').'" psql --host '.EvolutionCMS()->getDatabase()->getConfig('host').' --username ' . EvolutionCMS()->getDatabase()->getConfig('username') . ' --dbname ' . $dbase . ' < '.$path;
6764
exec($dump_request, $data, $data_second);
68-
69-
7065
break;
7166
default :
7267
import_sql_from_file($path);
@@ -106,7 +101,6 @@
106101

107102
exec($dump_request, $data, $data_second);
108103
dumpSql($tempfile_path);
109-
110104
break;
111105
default:
112106
$dumper = new EvolutionCMS\Support\MysqlDumper($dbase);
@@ -121,7 +115,6 @@
121115
}
122116
break;
123117
}
124-
125118
// MySQLdumper class can be found below
126119
} elseif ($mode == 'snapshot') {
127120
if (!is_dir(rtrim(EvolutionCMS()->getConfig('snapshot_path'), '/'))) {
@@ -187,7 +180,6 @@
187180
break;
188181
}
189182

190-
191183
if ($dumpfinished) {
192184
$_SESSION['result_msg'] = 'snapshot_ok';
193185
header("Location: index.php?a=93");
@@ -217,7 +209,6 @@
217209
}
218210

219211
?>
220-
221212
<script language="javascript">
222213
var actions = {
223214
cancel: function () {
@@ -319,19 +310,19 @@ class="form-check-input"
319310
switch (EvolutionCMS()->getDatabase()->getConfig()['driver']) {
320311
case 'pgsql':
321312
$sql = "SELECT *, tablename as Name
322-
FROM pg_catalog.pg_tables WHERE
313+
FROM pg_catalog.pg_tables WHERE
323314
schemaname != 'information_schema' AND tablename LIKE '%" . $prefix . "%'";
324315

325316
$array = EvolutionCMS()->getDatabase()->makeArray(
326-
EvolutionCMS()->getDatabase()->query($sql)
317+
EvolutionCMS()->getDatabase()->query($sql)
327318
);
328319
break;
329320

330321
case 'mysql':
331322
$sql = 'SHOW TABLE STATUS FROM `' . EvolutionCMS()->getDatabase()->getConfig('database') . '` LIKE "' . $prefix . '%"';
332323

333324
$array = EvolutionCMS()->getDatabase()->makeArray(
334-
EvolutionCMS()->getDatabase()->query($sql)
325+
EvolutionCMS()->getDatabase()->query($sql)
335326
);
336327
break;
337328
default:
@@ -358,8 +349,8 @@ class="form-check-input"
358349

359350
// Enable record deletion for certain tables (TRUNCATE TABLE) if they're not already empty
360351
$truncateable = array(
361-
EvolutionCMS()->getDatabase()->getConfig('prefix') . 'event_log',
362-
EvolutionCMS()->getDatabase()->getConfig('prefix') . 'manager_log',
352+
EvolutionCMS()->getDatabase()->getConfig('prefix') . 'event_log',
353+
EvolutionCMS()->getDatabase()->getConfig('prefix') . 'manager_log',
363354
);
364355
if (EvolutionCMS()->hasPermission('settings') && in_array($db_status['Name'], $truncateable) && $db_status['Rows'] > 0) {
365356
echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode=93&u=' . $db_status['Name'] . '" title="' . $_lang['truncate_table'] . '">' . nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</a>' . '</td>' . "\n";
@@ -453,14 +444,11 @@ class="form-check-input"
453444
}
454445
}
455446

456-
function checked($cond)
457-
{
447+
function checked($cond) {
458448
if ($cond) {
459449
return ' checked';
460450
}
461-
}
462-
463-
?>
451+
} ?>
464452
<p>
465453
<label><input type="radio" name="sel"
466454
onclick="showhide('file');" <?= checked(!isset($_SESSION['console_mode']) || $_SESSION['console_mode'] !== 'text') ?> /> <?= $_lang["bkmgr_run_sql_file_label"] ?>
@@ -522,13 +510,13 @@ class="<?= $_style['icon_save'] ?>"></i> <?= $_lang["bkmgr_snapshot_submit"] ?>
522510
$files = glob($pattern, GLOB_NOCHECK);
523511
$total = ($files[0] !== $pattern) ? count($files) : 0;
524512
$detailFields = array(
525-
'Evolution CMS Version',
526-
'Host',
527-
'Generation Time',
528-
'Server version',
529-
'PHP Version',
530-
'Database',
531-
'Description'
513+
'Evolution CMS Version',
514+
'Host',
515+
'Generation Time',
516+
'Server version',
517+
'PHP Version',
518+
'Database',
519+
'Description'
532520
);
533521
if (is_array($files) && 0 < $total) {
534522
?>
@@ -562,29 +550,29 @@ class="<?= $_style['icon_save'] ?>"></i> <?= $_lang["bkmgr_snapshot_submit"] ?>
562550
$fileLabel = '# ' . $label;
563551
if (strpos($line, $fileLabel) !== false) {
564552
$details[$label] = htmlentities(trim(str_replace(array(
565-
$fileLabel,
566-
':',
567-
'`'
553+
$fileLabel,
554+
':',
555+
'`'
568556
), '', $line)), ENT_QUOTES, ManagerTheme::getCharset());
569557
}
570558
}
571559
$count++;
572560
};
573561
fclose($file);
574562

575-
$tooltip = "Generation Time: " . $details["Generation Time"] . "\n";
576-
$tooltip .= "Server version: " . $details["Server version"] . "\n";
577-
$tooltip .= "PHP Version: " . $details["PHP Version"] . "\n";
578-
$tooltip .= "Host: " . $details["Host"] . "\n";
563+
$tooltip = "Generation Time: " . ($details["Generation Time"] ?? 'Undefined') . "\n<br>";
564+
$tooltip .= "Server version: " . ($details["Server version"] ?? 'Undefined') . "\n<br>";
565+
$tooltip .= "PHP Version: " . ($details["PHP Version"] ?? 'Undefined') . "\n<br>";
566+
$tooltip .= "Host: " . ($details["Host"] ?? 'Undefined') . "\n";
579567
?>
580568
<tr>
581569
<td><?= $filename ?></td>
582570
<td><i class="<?= $_style['icon_question_circle'] ?>"
583571
data-tooltip="<?= $tooltip ?>"></i></td>
584572
<td><?= $filesize ?></td>
585-
<td><?= $details['Description'] ?></td>
586-
<td><?= $details['Evolution CMS Version'] ?></td>
587-
<td><?= $details['Database'] ?></td>
573+
<td><?= ($details['Description'] ?? 'Undefined') ?></td>
574+
<td><?= ($details['Evolution CMS Version'] ?? 'Undefined') ?></td>
575+
<td><?= ($details['Database'] ?? 'Undefined') ?></td>
588576
<td><a href="javascript:;" onclick="confirmRevert('<?= $filename ?>');"
589577
title="<?= $tooltip ?>"><?= $_lang["bkmgr_restore_submit"] ?></a>
590578
</td>

0 commit comments

Comments
 (0)