mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 01:38:54 +00:00
24fa162413
[ci skip] [skip ci]
64 lines
1.5 KiB
PHP
64 lines
1.5 KiB
PHP
<?php
|
|
|
|
use nntmux\Category;
|
|
use nntmux\Releases;
|
|
|
|
$page = new AdminPage();
|
|
$releases = new Releases(['Settings' => $page->settings]);
|
|
$category = new Category(['Settings' => $page->settings]);
|
|
|
|
// Set the current action.
|
|
$action = $_REQUEST['action'] ?? '';
|
|
|
|
// Request is for id, but guid is actually being provided
|
|
if (isset($_REQUEST['id']) && is_array($_REQUEST['id'])) {
|
|
$id = $_REQUEST['id'];
|
|
//Get info for first guid to populate form
|
|
$rel = $releases->getByGuid($_REQUEST['id'][0]);
|
|
} else {
|
|
$id = $rel = '';
|
|
}
|
|
|
|
$page->smarty->assign('action', $action);
|
|
$page->smarty->assign('idArr', $id);
|
|
|
|
switch ($action) {
|
|
case 'doedit':
|
|
case 'edit':
|
|
$success = false;
|
|
if ($action === 'doedit') {
|
|
$success = $releases->updateMulti(
|
|
$_POST['id'],
|
|
$_POST['category'],
|
|
$_POST['grabs'],
|
|
$_POST['videosid'],
|
|
$_POST['episodesid'],
|
|
$_POST['anidbid'],
|
|
$_POST['imdbid']);
|
|
}
|
|
$page->smarty->assign('release', $rel);
|
|
$page->smarty->assign('success', $success);
|
|
$page->smarty->assign('from', $_POST['from'] ?? '');
|
|
$page->smarty->assign('catlist', $category->getForSelect(false));
|
|
$page->content = $page->smarty->fetch('ajax_release-edit.tpl');
|
|
echo $page->content;
|
|
|
|
break;
|
|
case 'dodelete':
|
|
$is_guid = true;
|
|
if (is_array($_GET['id'])) {
|
|
if (is_numeric($_GET['id'][0])) {
|
|
$is_guid = false;
|
|
}
|
|
} else {
|
|
if (is_numeric($_GET['id'])) {
|
|
$is_guid = false;
|
|
}
|
|
}
|
|
$releases->deleteMultiple($_GET['id'], $is_guid);
|
|
break;
|
|
default:
|
|
$page->show404();
|
|
break;
|
|
}
|