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;
|
|
|
|
|
|
|
|
// Add slash at the begin and end.
|
|
|
|
// This fields are in the settings->advanced mode
|
|
|
|
$args['url'] = Text::addSlashes($args['url'],false,true);
|
|
|
|
$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['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('admin', $layout['controller']);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main after POST
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|