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

70 lines
1.4 KiB
PHP
Raw Normal View History

2015-03-08 18:02:59 +01:00
<?php defined('BLUDIT') or die('Bludit CMS.');
2015-06-27 00:12:26 +02:00
// ============================================================================
// Variables
// ============================================================================
2015-10-31 23:54:42 +01:00
// Array with all pages.
2015-03-08 18:02:59 +01:00
$pages = array();
2015-10-31 23:54:42 +01:00
2016-05-28 05:18:13 +02:00
$pagesPublished = array();
2015-10-31 23:54:42 +01:00
// Array with all pages, order by parent.
2015-05-05 03:00:01 +02:00
$pagesParents = array(NO_PARENT_CHAR=>array());
2015-03-08 18:02:59 +01:00
2016-05-28 05:18:13 +02:00
$pagesParentsPublished = array();
2015-06-27 00:12:26 +02:00
// ============================================================================
// Main
// ============================================================================
2015-09-10 04:33:31 +02:00
// Search for changes on pages by the user.
2016-05-07 05:10:10 +02:00
if( CLI_MODE ) {
$dbPages->cliMode();
2015-09-10 04:33:31 +02:00
}
2016-01-08 21:12:17 +01:00
// Build specific page.
2015-03-08 18:02:59 +01:00
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
{
2016-01-08 00:43:09 +01:00
$Page = buildPage( $Url->slug() );
2015-03-08 18:02:59 +01:00
2016-01-08 21:12:17 +01:00
// The page doesn't exist.
2015-03-08 18:02:59 +01:00
if($Page===false)
{
$Url->setNotFound(true);
unset($Page);
}
2016-01-08 21:12:17 +01:00
// The page is not published yet.
2015-03-08 18:02:59 +01:00
elseif( !$Page->published() )
{
$Url->setNotFound(true);
unset($Page);
}
}
2016-01-08 21:12:17 +01:00
// Homepage
if( ($Url->whereAmI()==='home') && ($Url->notFound()===false) )
2015-03-08 18:02:59 +01:00
{
2016-01-08 21:12:17 +01:00
// The user defined as homepage a particular page.
if( Text::isNotEmpty( $Site->homepage() ) )
2015-03-08 18:02:59 +01:00
{
$Url->setWhereAmI('page');
2016-01-08 00:43:09 +01:00
$Page = buildPage( $Site->homepage() );
2015-05-05 03:00:01 +02:00
2015-08-14 03:36:03 +02:00
if($Page===false) {
2015-03-08 18:02:59 +01:00
$Url->setWhereAmI('home');
}
}
}
2015-06-03 03:17:09 +02:00
if($Url->notFound())
{
$Url->setWhereAmI('page');
$Page = new Page('error');
}
2015-03-08 18:02:59 +01:00
// Build all pages
2016-01-08 01:00:40 +01:00
$pages = buildAllPages();
2016-05-28 05:18:13 +02:00