2017-05-09 00:24:15 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Variables
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// Array with all published pages
|
|
|
|
$pages = array();
|
|
|
|
|
2017-06-23 00:41:00 +02:00
|
|
|
// Array with all pages (published, fixed, sticky, draft, scheduled)
|
2017-05-09 00:24:15 +02:00
|
|
|
$allPages = array();
|
|
|
|
|
2017-06-23 00:41:00 +02:00
|
|
|
// Object Page for the page filtered by the user
|
2017-05-09 00:24:15 +02:00
|
|
|
$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
|
2017-05-27 19:46:46 +02:00
|
|
|
$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();
|
2017-06-23 00:41:00 +02:00
|
|
|
|
|
|
|
// Add to syslog
|
|
|
|
$Syslog->add(array(
|
|
|
|
'dictionaryKey'=>'page-published-from-scheduler',
|
|
|
|
'notes'=>''
|
|
|
|
));
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
2017-06-22 23:50:12 +02:00
|
|
|
// The page is not published, still scheduled or draft
|
|
|
|
elseif( $page->scheduled() || $page->draft() ) {
|
2017-05-09 00:24:15 +02:00
|
|
|
$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');
|
2017-06-25 22:54:59 +02:00
|
|
|
$page = buildPage('error');
|
|
|
|
$pages[0] = $page;
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|