} break; case 'add': case 'doadd': $show = $us->getShow($page->users->currentUserId(), $videoId); if ($show) { $page->show404('Already subscribed'); } else { $show = $tv->getByVideoID($videoId); if (!$show) { $page->show404('Seriously?'); } } if ($action == 'doadd') { $category = isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category']) ? $_REQUEST['category'] : array(); $us->addShow($page->users->currentUserId(), $videoId, $category); if (isset($_REQUEST['from'])) { header("Location:" . WWW_TOP . $_REQUEST['from']); } else { header("Location:" . WWW_TOP . "/myshows"); } } else { $cat = new Category(['Settings' => $page->settings]); $tmpcats = $cat->getChildren(Category::CAT_PARENT_TV); $categories = array(); foreach ($tmpcats as $c) { $categories[$c['id']] = $c['title']; } $page->smarty->assign('type', 'add'); $page->smarty->assign('cat_ids', array_keys($categories)); $page->smarty->assign('cat_names', $categories);