mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 17:58:59 +00:00
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
require_once './config.php';
|
|
|
|
$page = new AdminPage();
|
|
$regexes = new Regexes(['Settings' => $page->settings, 'Table_Name' => 'collection_regexes']);
|
|
|
|
// Set the current action.
|
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
|
|
|
|
switch($action) {
|
|
case 'submit':
|
|
if ($_POST["group_regex"] == "") {
|
|
$page->smarty->assign('error', "Group regex must not be empty!");
|
|
break;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
$page->smarty->assign('status_ids', array(Category::STATUS_ACTIVE,Category::STATUS_INACTIVE));
|
|
$page->smarty->assign('status_names', array( 'Yes', 'No'));
|
|
|
|
$page->content = $page->smarty->fetch('collection_regexes-edit.tpl');
|
|
$page->render(); |