bludit/bl-kernel/boot/rules/69.pages.php

71 lines
1.6 KiB
PHP
Raw Normal View History

2017-05-09 00:24:15 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Variables
// ============================================================================
// Array with all published pages
$pages = array();
// Array with all pages (published, draft, scheduled)
$allPages = array();
// Object Page for the page filtered bye the user
$page = false;
2017-05-16 00:46:20 +02:00
// Array with all page parents published
//$pageParents = array();
// Array with all published pages, the array is a key=>Page-object
$pagesByKey = array();
2017-05-16 00:46:20 +02:00
2017-05-09 00:24:15 +02:00
// ============================================================================
// Main
// ============================================================================
// Execute the scheduler
if( $dbPages->scheduler() ) {
// Reindex tags
reindexTags();
// Reindex categories
reindexCategories();
}
// Build specific page
if( $Url->whereAmI()==='page' ) {
// Build the page
$page = buildPage( $Url->slug() );
// The page doesn't exist
if($page===false) {
$Url->setNotFound(true);
}
// The page is not published
elseif( !$page->published() ) {
$Url->setNotFound(true);
}
2017-05-12 20:18:44 +02:00
else {
$pages[0] = $page;
}
2017-05-09 00:24:15 +02:00
}
elseif( $Url->whereAmI()==='tag' ) {
2017-05-16 00:46:20 +02:00
buildPagesByTag();
2017-05-09 00:24:15 +02:00
}
elseif( $Url->whereAmI()==='category' ) {
2017-05-16 00:46:20 +02:00
buildPagesByCategory();
2017-05-09 00:24:15 +02:00
}
elseif( $Url->whereAmI()==='home' ) {
2017-05-16 00:46:20 +02:00
buildPagesForHome();
2017-05-09 00:24:15 +02:00
}
elseif( $Url->whereAmI()==='admin' ) {
2017-05-16 00:46:20 +02:00
buildPagesForAdmin();
2017-05-09 00:24:15 +02:00
}
2017-05-24 00:48:29 +02:00
// Set page 404 not found
2017-05-09 00:24:15 +02:00
if( $Url->notFound() ) {
$Url->setWhereAmI('page');
$page = new Page('error');
}