bludit/admin/controllers/settings.php

54 lines
1.6 KiB
PHP
Raw Normal View History

2015-05-05 01:00:01 +00:00
<?php defined('BLUDIT') or die('Bludit CMS.');
2015-05-14 22:07:45 +00:00
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
2015-07-20 00:14:12 -03:00
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
2015-05-14 22:07:45 +00:00
Redirect::page('admin', 'dashboard');
}
2015-05-05 01:00:01 +00:00
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
2015-07-20 00:14:12 -03:00
global $Language;
2015-05-05 01:00:01 +00:00
if(!isset($args['advancedOptions'])) {
$args['advancedOptions'] = 'false';
}
2015-06-26 01:31:53 -03:00
// Add slash at the begin and end.
// This fields are in the settings->advanced mode
if(isset($args['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']);
}
2015-05-05 01:00:01 +00:00
if( $Site->set($args) ) {
2015-07-20 00:14:12 -03:00
Alert::set($Language->g('the-changes-have-been-saved'));
2015-05-05 01:00:01 +00:00
}
else {
2015-07-22 00:15:02 -03:00
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
2015-05-05 01:00:01 +00:00
}
}
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
}
2015-05-14 22:07:45 +00:00
// ============================================================================
// Main
// ============================================================================