Files
newznab-tmux-NNTmux/public/admin/regex-edit.php
T
DariusIII ace3de8cc3 Apply fixes from StyleCI
[ci skip] [skip ci]
2017-08-31 09:32:13 +00:00

57 lines
1.3 KiB
PHP

<?php
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'smarty.php';
use nntmux\Category;
use nntmux\ReleaseRegex;
$page = new AdminPage();
$category = new Category();
$reg = new ReleaseRegex();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
case 'submit':
if ($_POST['id'] == '') {
$reg->add($_POST);
} else {
$ret = $reg->update($_POST);
}
header('Location:'.WWW_TOP.'/regex-list.php');
break;
case 'addtest':
if (isset($_GET['regex']) && isset($_GET['groupname'])) {
$r = ['groupname'=>$_GET['groupname'], 'regex'=>$_GET['regex'], 'ordinal'=>'1', 'status'=>'1'];
$page->smarty->assign('regex', $r);
}
break;
case 'view':
default:
$page->title = 'Release Regex Add';
if (isset($_GET['id'])) {
$page->title = 'Release Regex Edit';
$id = $_GET['id'];
$r = $reg->getByID($id);
} else {
$r = [];
$r['status'] = 1;
}
$page->smarty->assign('regex', $r);
break;
}
$page->smarty->assign('status_ids', [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE]);
$page->smarty->assign('status_names', ['Yes', 'No']);
$page->smarty->assign('catlist', $category->getForSelect(true));
$page->content = $page->smarty->fetch('regex-edit.tpl');
$page->render();