예제 #1
0
     }
     if ($_POST["regex"] == "") {
         $page->smarty->assign('error', "Regex cannot be empty");
         break;
     }
     if ($_POST['description'] == '') {
         $_POST['description'] = '';
     }
     if (!is_numeric($_POST['ordinal']) || $_POST['ordinal'] < 0) {
         $page->smarty->assign('error', "Ordinal must be a number, 0 or higher.");
         break;
     }
     if ($_POST["id"] == "") {
         $regexes->addRegex($_POST);
     } else {
         $regexes->updateRegex($_POST);
     }
     header("Location:" . WWW_TOP . "/collection_regexes-list.php");
     break;
 case 'view':
 default:
     if (isset($_GET["id"])) {
         $page->title = "Collections Regex Edit";
         $id = $_GET["id"];
         $r = $regexes->getRegexByID($id);
     } else {
         $page->title = "Collections Regex Add";
         $r = ['status' => 1];
     }
     $page->smarty->assign('regex', $r);
     break;