Make filter debug modal work on non-saved filter

This commit is contained in:
Isaac Connor 2022-02-15 10:37:14 -05:00
parent b2e0f805bd
commit a149fa37fc
1 changed files with 11 additions and 4 deletions

View File

@ -11,13 +11,20 @@
<?php <?php
require_once('includes/Filter.php'); require_once('includes/Filter.php');
$fid = validInt($_REQUEST['fid']); $fid = validInt($_REQUEST['fid']);
if (!$fid) {
echo '<div class="error">No filter id specified.</div>'; $filter = null;
} else { if ($fid) {
$filter = new ZM\Filter($_REQUEST['fid']); $filter = new ZM\Filter($fid);
if (!$filter->Id()) { if (!$filter->Id()) {
echo '<div class="error">Filter not found for id '.$_REQUEST['fid'].'</div>'; echo '<div class="error">Filter not found for id '.$_REQUEST['fid'].'</div>';
} }
} else {
$filter = new ZM\Filter();
if ( isset($_REQUEST['filter'])) {
$filter->set($_REQUEST['filter']);
} else {
echo '<div class="error">No filter id or contents specified.</div>';
}
} }
?> ?>
<form name="contentForm" id="filterdebugForm" method="post" action="?"> <form name="contentForm" id="filterdebugForm" method="post" action="?">