Files
newznab-tmux/public/admin/category-edit.php
T
DariusIII 1aae452c2a Apply fixes from StyleCI
[ci skip] [skip ci]
2018-01-11 10:03:44 +00:00

35 lines
933 B
PHP

<?php
use App\Models\Category;
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'smarty.php';
$page = new AdminPage();
$id = 0;
// set the current action
$action = $_REQUEST['action'] ?? 'view';
switch ($action) {
case 'submit':
$ret = Category::updateCategory($_POST['id'], $_POST['status'], $_POST['description'],
$_POST['disablepreview'], $_POST['minsizetoformrelease'], $_POST['maxsizetoformrelease']);
header('Location:'.WWW_TOP.'/category-list.php');
break;
case 'view':
default:
if (isset($_GET['id'])) {
$page->title = 'Category Edit';
$id = $_GET['id'];
$cat = Category::getById($id);
$page->smarty->assign('category', $cat);
}
break;
}
$page->smarty->assign('status_ids', [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE]);
$page->smarty->assign('status_names', ['Yes', 'No']);
$page->content = $page->smarty->fetch('category-edit.tpl');
$page->render();