예제 #1
0
파일: content.php 프로젝트: sebst3r/nZEDb
if (isset($_GET["id"])) {
    $contentid = $_GET["id"];
}
$request = false;
if (isset($_REQUEST['page'])) {
    $request = $_REQUEST['page'];
}
if ($contentid == 0 && $request == 'content') {
    $content = $contents->getAllButFront();
    $page->smarty->assign('front', false);
    $page->meta_title = 'Contents page';
    $page->meta_keywords = 'contents';
    $page->meta_description = 'This is the contents page.';
} else {
    if ($contentid != 0 && $request !== false) {
        $content = array($contents->getByID($contentid, $role));
        $page->smarty->assign('front', false);
        $page->meta_title = 'Contents page';
        $page->meta_keywords = 'contents';
        $page->meta_description = 'This is the contents page.';
    } else {
        $content = $contents->getFrontPage();
        $index = $contents->getIndex();
        $page->smarty->assign('front', true);
        $page->meta_title = $index->title;
        $page->meta_keywords = $index->metakeywords;
        $page->meta_description = $index->metadescription;
    }
}
if ($content == null) {
    $page->show404();
예제 #2
0
    case 'submit':
        // Validate and add or update.
        $returnid = 0;
        if (!isset($_POST["id"]) || $_POST["id"] == "") {
            $returnid = $contents->add($_POST);
        } else {
            $content = $contents->update($_POST);
            $returnid = $content->id;
        }
        header("Location:content-add.php?id=" . $returnid);
        break;
    case 'view':
    default:
        if (isset($_GET["id"])) {
            $page->title = "Content Edit";
            $id = $_GET["id"];
            $content = $contents->getByID($id, Users::ROLE_ADMIN);
            $page->smarty->assign('content', $content);
        }
        break;
}
$page->smarty->assign('status_ids', [1, 0]);
$page->smarty->assign('status_names', ['Enabled', 'Disabled']);
$page->smarty->assign('yesno_ids', [1, 0]);
$page->smarty->assign('yesno_names', ['Yes', 'No']);
$contenttypelist = ["1" => "Useful Link", "2" => "Article", "3" => "Homepage"];
$page->smarty->assign('contenttypelist', $contenttypelist);
$rolelist = ["0" => "Everyone", "1" => "Logged in Users", "2" => "Admins"];
$page->smarty->assign('rolelist', $rolelist);
$page->content = $page->smarty->fetch('content-add.tpl');
$page->render();