use nzedb\Category; use nzedb\Contents; use nzedb\Releases; if (!$page->users->isLoggedIn()) { $page->show403(); } $releases = new Releases(['Settings' => $page->settings]); $contents = new Contents(['Settings' => $page->settings]); $category = new Category(['Settings' => $page->settings]); $error = false; // Array with all the possible poster wall types. $startTypes = ['Books', 'Console', 'Movies', 'XXX', 'Audio', 'PC', 'TV']; // Array that will contain the poster wall types (the above array minus whatever they have disabled in admin). $types = []; // Get the names of all enabled parent categories. $categories = $category->getEnabledParentNames(); // Loop through our possible ones and check if they are in the enabled categories. if (count($categories) > 0) { foreach ($categories as $pType) { if (in_array($pType['title'], $startTypes)) { $types[] = $pType['title']; } } } else { $error = "No categories are enabled!"; } if (count($types) === 0) { $error = 'No categories enabled for the new poster wall. Possible choices are: ' . implode(', ', $startTypes) . '.'; } if (!$error) { // Check if the user did not pass the required t parameter, set it to the first type.