
Update 10-27. Upon further reading about global variables, it seems they only need to be declared when the string replacement is within a function. After testing deletion of the global intended to encompass if/else replacements occurring within a function file outside of a function, the pages appear to 'function' normally. The additional global on the function pages is apparently unnecessary, therefore I am removing them. Add variable in bl-kernel/boot/init.php that allows User to rename bl-kernel/admin folder. User can then define variable in bl-kernel/boot/init.php and change the foldername itself to effect the rename. Add global $adminfolder as necessary and replace relevant 'admin' strings with $adminfolder. Applies to most of the files in bl-kernel/admin/controllers. Line 9 - Replace Admin string with folder variable: Redirect::page($adminfolder, 'dashboard'); Original: Redirect::page('admin', 'dashboard'); Line 56 - Replace Admin string with folder variable: Redirect::page($adminfolder, $layout['controller']); Original: Redirect::page('admin', $layout['controller']);
81 lines
2.3 KiB
PHP
81 lines
2.3 KiB
PHP
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
// ============================================================================
|
|
// Check role
|
|
// ============================================================================
|
|
|
|
if($Login->role()!=='admin') {
|
|
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
|
|
Redirect::page($adminfolder, 'dashboard');
|
|
}
|
|
|
|
// ============================================================================
|
|
// Functions
|
|
// ============================================================================
|
|
|
|
function setSettings($args)
|
|
{
|
|
global $Site;
|
|
global $Language;
|
|
|
|
// Add slash at the begin and end.
|
|
// This fields are in the settings->advanced mode
|
|
if(isset($args['form-advanced'])) {
|
|
$args['url'] = Text::addSlashes($args['url'],false,true);
|
|
$args['uriPost'] = Text::addSlashes($args['uriPost']);
|
|
$args['uriPage'] = Text::addSlashes($args['uriPage']);
|
|
$args['uriTag'] = Text::addSlashes($args['uriTag']);
|
|
|
|
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
|
|
{
|
|
$args = array();
|
|
}
|
|
}
|
|
|
|
if( $Site->set($args) ) {
|
|
Alert::set($Language->g('the-changes-have-been-saved'));
|
|
}
|
|
else {
|
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Main after POST
|
|
// ============================================================================
|
|
|
|
// ============================================================================
|
|
// POST Method
|
|
// ============================================================================
|
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
{
|
|
setSettings($_POST);
|
|
Redirect::page($adminfolder, $layout['controller']);
|
|
}
|
|
|
|
// ============================================================================
|
|
// Main after POST
|
|
// ============================================================================
|
|
|
|
// Default home page
|
|
$_homePageList = array(''=>$Language->g('Show blog'));
|
|
foreach($pagesParents as $parentKey=>$pageList)
|
|
{
|
|
foreach($pageList as $Page)
|
|
{
|
|
if($parentKey!==NO_PARENT_CHAR) {
|
|
$parentTitle = $pages[$Page->parentKey()]->title().'->';
|
|
}
|
|
else {
|
|
$parentTitle = '';
|
|
}
|
|
|
|
if($Page->published()) {
|
|
$_homePageList[$Page->key()] = $Language->g('Page').': '.$parentTitle.$Page->title();
|
|
}
|
|
}
|
|
}
|