bludit/kernel/boot/admin.php

66 lines
2.0 KiB
PHP
Raw Normal View History

2015-05-05 03:00:01 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
$layout = array(
'controller'=>null,
'view'=>null,
'template'=>'index.php',
'slug'=>null,
2015-07-07 00:22:03 +02:00
'parameters'=>null,
'title'=>'Bludit'
2015-05-05 03:00:01 +02:00
);
// Get the view, controller, and the parameters from the URL.
$explodeSlug = $Url->explodeSlug();
$layout['controller'] = $layout['view'] = $layout['slug'] = $explodeSlug[0];
unset($explodeSlug[0]);
$layout['parameters'] = implode('/', $explodeSlug);
2015-05-15 00:07:45 +02:00
// Disable Magic Quotes
// Thanks, http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting
if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) )
{
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
$_COOKIE = array_map('stripslashes', $_COOKIE);
}
2015-05-05 03:00:01 +02:00
// AJAX
if( $Login->isLogged() && ($layout['slug']==='ajax') )
{
// Boot rules
// Ajax doesn't needs load rules
// Load AJAX file
if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') )
include(PATH_AJAX.$layout['parameters'].'.php');
}
// ADMIN AREA
else
{
// Boot rules
include(PATH_RULES.'70.build_posts.php');
include(PATH_RULES.'70.build_pages.php');
2015-07-03 22:44:26 +02:00
include(PATH_RULES.'80.plugins.php');
2015-05-05 03:00:01 +02:00
include(PATH_RULES.'99.header.php');
2015-07-20 05:14:12 +02:00
include(PATH_RULES.'99.paginator.php');
2015-05-05 03:00:01 +02:00
if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') )
{
$layout['controller'] = 'login';
$layout['view'] = 'login';
$layout['template'] = 'login.php';
}
// Admin theme init.php
2015-06-22 00:01:07 +02:00
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') )
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php');
2015-05-05 03:00:01 +02:00
// Load controller
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') )
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
// Load view and theme
2015-06-22 00:01:07 +02:00
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.$layout['template']) )
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']);
2015-05-31 03:06:55 +02:00
}