Example #1
0
<?php

if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$releases = new Releases();
$contents = new Contents();
$category = new Category();
$error = false;
// Array with all the possible poster wall types.
$startTypes = array('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 = array();
// 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.
    if (!isset($_REQUEST['t'])) {