break; case 'add': case 'doadd': $show = $us->getShow($users->currentUserId(), $rid); if ($show) { $page->show404('Already subscribed'); } else { $db = new DB(); $show = $db->queryOneRow(sprintf("select releasetitle from tvrage where rageID = %d", $rid)); if (!$show) { $page->show404('Seriously?'); } } if ($action == 'doadd') { $category = isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category']) ? $_REQUEST['category'] : array(); $us->addShow($users->currentUserId(), $rid, $category); if (isset($_REQUEST['from'])) { header("Location:" . $_REQUEST['from']); } else { header("Location:" . WWW_TOP . "/myshows"); } } else { $cat = new Category(); $tmpcats = $cat->getChildren(Category::CAT_PARENT_TV, true, $page->userdata["categoryexclusions"]); $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);
break; case 'add': case 'doadd': $show = $us->getShow($users->currentUserId(), $tvinfoID); if ($show) { $page->show404('Already subscribed'); } else { $db = new DB(); $show = $db->queryOneRow(sprintf("select releasetitle from tvinfo where ID = %d", $tvinfoID)); if (!$show) { $page->show404('Seriously?'); } } if ($action == 'doadd') { $category = isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category']) ? $_REQUEST['category'] : array(); $us->addShow($users->currentUserId(), $tvinfoID, $category); if (isset($_REQUEST['from'])) { header("Location:" . $_REQUEST['from']); } else { header("Location:" . WWW_TOP . "/myshows"); } } else { $cat = new Category(); $tmpcats = $cat->getChildren(Category::CAT_PARENT_TV, true, $page->userdata["categoryexclusions"]); $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);