bludit/bl-kernel/admin/controllers/settings-advanced.php

92 lines
2.4 KiB
PHP
Raw Normal View History

2015-10-19 00:45:58 +02:00
<?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('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
global $Language;
global $Syslog;
global $dbPages;
2015-10-19 00:45:58 +02:00
// Add slash at the begin and end
2015-10-19 00:45:58 +02:00
$args['uriPage'] = Text::addSlashes($args['uriPage']);
$args['uriTag'] = Text::addSlashes($args['uriTag']);
2017-05-16 00:46:20 +02:00
$args['uriCategory'] = Text::addSlashes($args['uriCategory']);
2015-10-19 00:45:58 +02:00
if( ($args['uriPage']==$args['uriTag']) ||
($args['uriPage']==$args['uriCategory']) ||
($args['uriTag']==$args['uriCategory'])
) {
2015-10-19 00:45:58 +02:00
$args = array();
}
if( $Site->set($args) ) {
// Add to syslog
$Syslog->add(array(
'dictionaryKey'=>'changes-on-settings',
'notes'=>''
));
// Check actual order by, if different than the new settings sort pages
if( $Site->orderBy()!=ORDER_BY ) {
if( $Site->orderBy()=='date' ) {
$dbPages->sortByDate();
}
else {
$dbPages->sortByPosition();
}
// Save database state
$dbPages->save();
// Re-index categories
reindexCategories();
// Re-index tags
reindextags();
}
// Create an alert
Alert::set( $Language->g('The changes have been saved') );
2015-10-19 00:45:58 +02:00
}
// Redirect
Redirect::page('settings-advanced');
2015-10-19 00:45:58 +02:00
return true;
}
// ============================================================================
// Main after POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
}
// ============================================================================
// Main after POST
// ============================================================================
$allPublishedPages = buildAllpages(true);
2015-10-19 00:45:58 +02:00
2017-07-11 23:53:53 +02:00
// Homepage select options
$homepageOptions = array();
foreach($allPublishedPages as $key=>$page) {
$homepageOptions[$key] = $page->title();
}