Commit e28ff3f3 authored by Pablo Rauzy's avatar Pablo Rauzy
Browse files

rebuild only what's necessary when rearranging menus

parent be02dbe3
......@@ -750,14 +750,20 @@ elseif (isset($_GET['settings'])) {
// Pages management
elseif (isset($_GET['pages'])) {
$ok = $db->exec("begin transaction");
$modgrp = array();
foreach ($_POST['files'] as $f => $file) {
$file = $db->escapeString($file);
$ord = $db->escapeString($_POST['ords'][$f]);
$group = $db->escapeString($_POST['groups'][$f]);
$title = $db->escapeString(htmlspecialchars($_POST['titles'][$f], ENT_HTML5 | ENT_QUOTES, 'UTF-8'));
if ($db->querySingle("select 1 from pages where file='$file' and ord='$ord' and title='$title' and grp='$group'")) continue;
$oldgrp = $db->querySingle("select grp from pages where file='$file'");
$ok = $ok && $db->exec("update pages set ord='$ord', title='$title', grp='$group' where file='$file'");
$modgrp[$group] = true;
$modgrp[$oldgrp] = true;
$ok = $ok && $db->exec("update pages set status='mod' where status='pub'");
$modgrp = implode(', ', array_keys($modgrp));
$ok = $ok && $db->exec("update pages set status='mod' where status='pub' and grp in ($modgrp)");
if (!$ok || !$db->exec("commit")) {
inform(array('An error occurred while updating your menu.'), 'pages');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment