2017-05-09 00:24:15 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Variables
|
|
|
|
// ============================================================================
|
|
|
|
|
2017-07-11 23:53:53 +02:00
|
|
|
// Array with pages, each page is a Page Object
|
2018-08-06 21:46:58 +02:00
|
|
|
// Filtered by pagenumber, number of items per page and sorted by date/position
|
2017-07-13 00:44:39 +02:00
|
|
|
/*
|
|
|
|
array(
|
|
|
|
0 => Page Object,
|
|
|
|
1 => Page Object,
|
|
|
|
...
|
|
|
|
N => Page Object
|
|
|
|
)
|
|
|
|
*/
|
2018-07-17 19:13:01 +02:00
|
|
|
$content = array();
|
2017-05-09 00:24:15 +02:00
|
|
|
|
2017-07-11 23:53:53 +02:00
|
|
|
// Page filtered by the user, is a Page Object
|
2018-07-17 19:13:01 +02:00
|
|
|
$page = false;
|
2017-05-16 00:46:20 +02:00
|
|
|
|
2017-10-21 20:30:20 +02:00
|
|
|
// Array with static content, each item is a Page Object
|
|
|
|
// Order by position
|
|
|
|
/*
|
|
|
|
array(
|
|
|
|
0 => Page Object,
|
|
|
|
1 => Page Object,
|
|
|
|
...
|
|
|
|
N => Page Object
|
|
|
|
)
|
|
|
|
*/
|
2017-10-13 00:15:13 +02:00
|
|
|
$staticContent = $staticPages = buildStaticPages();
|
2017-10-04 23:42:14 +02:00
|
|
|
|
2017-05-09 00:24:15 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Main
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// Execute the scheduler
|
2018-08-03 18:59:23 +02:00
|
|
|
if ($pages->scheduler()) {
|
2018-10-20 13:36:13 +02:00
|
|
|
// Execute plugins with the hook afterPageCreate
|
|
|
|
Theme::plugins('afterPageCreate');
|
|
|
|
|
2017-05-09 00:24:15 +02:00
|
|
|
reindexTags();
|
|
|
|
reindexCategories();
|
2017-06-23 00:41:00 +02:00
|
|
|
|
|
|
|
// Add to syslog
|
2018-06-10 13:54:55 +02:00
|
|
|
$syslog->add(array(
|
2017-10-04 00:00:54 +02:00
|
|
|
'dictionaryKey'=>'content-published-from-scheduler',
|
2017-06-23 00:41:00 +02:00
|
|
|
'notes'=>''
|
|
|
|
));
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 20:30:57 +02:00
|
|
|
// Set home page if the user defined one
|
2018-07-17 19:13:01 +02:00
|
|
|
if ($site->homepage() && $url->whereAmI()==='home') {
|
|
|
|
$pageKey = $site->homepage();
|
2018-08-03 18:59:23 +02:00
|
|
|
if ($pages->exists($pageKey)) {
|
2018-07-17 19:13:01 +02:00
|
|
|
$url->setSlug($pageKey);
|
|
|
|
$url->setWhereAmI('page');
|
2017-07-13 00:44:39 +02:00
|
|
|
}
|
2017-07-11 23:53:53 +02:00
|
|
|
}
|
|
|
|
|
2017-05-09 00:24:15 +02:00
|
|
|
// Build specific page
|
2018-07-17 19:13:01 +02:00
|
|
|
if ($url->whereAmI()==='page') {
|
|
|
|
$content[0] = $page = buildThePage();
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
2018-02-06 18:26:59 +01:00
|
|
|
// Build content by tag
|
2018-07-17 19:13:01 +02:00
|
|
|
elseif ($url->whereAmI()==='tag') {
|
|
|
|
$content = buildPagesByTag();
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
2018-02-06 18:26:59 +01:00
|
|
|
// Build content by category
|
2018-07-17 19:13:01 +02:00
|
|
|
elseif ($url->whereAmI()==='category') {
|
2018-08-20 22:32:14 +02:00
|
|
|
$content = buildPagesByCategory();
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
2018-02-06 18:26:59 +01:00
|
|
|
// Build content for the homepage
|
2018-07-17 19:13:01 +02:00
|
|
|
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
|
|
|
$content = buildPagesForHome();
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|
|
|
|
|
2018-07-17 19:13:01 +02:00
|
|
|
if (isset($content[0])) {
|
|
|
|
$page = $content[0];
|
2017-10-13 23:38:24 +02:00
|
|
|
}
|
|
|
|
|
2018-07-17 19:13:01 +02:00
|
|
|
// If set notFound, create the page 404
|
|
|
|
if ($url->notFound()) {
|
|
|
|
$content[0] = $page = buildErrorPage();
|
2017-05-09 00:24:15 +02:00
|
|
|
}
|