$page->smarty->assign('cat_selected', array()); $page->smarty->assign('video', $videoId); $page->smarty->assign('show', $show); $page->content = $page->smarty->fetch('myshows-add.tpl'); $page->render(); } break; case 'edit': case 'doedit': $show = $us->getShow($page->users->currentUserId(), $videoId); if (!$show) { $page->show404(); } if ($action == 'doedit') { $category = isset($_REQUEST['category']) && is_array($_REQUEST['category']) && !empty($_REQUEST['category']) ? $_REQUEST['category'] : array(); $us->updateShow($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', 'edit'); $page->smarty->assign('cat_ids', array_keys($categories)); $page->smarty->assign('cat_names', $categories);