Project

General

Profile

1 1782 Luisehahne
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         login
6
 * @author          Ryan Djurovich (2004-2009)), WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.9
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
*/
17
if(!defined('WB_PATH'))
18
{
19
	require('../../config.php');
20
	require_once(WB_PATH.'/framework/class.admin.php');
21
}
22
$admin = new admin('Start', 'settings', false, false);
23
24
if($admin->get_user_id() == 1)
25
{
26
	$val = (((int)(defined('SYSTEM_LOCKED') ? SYSTEM_LOCKED : 0)) + 1) % 2;
27
	$sql = 'SELECT COUNT(`setting_id`) FROM `'.TABLE_PREFIX.'settings` WHERE `name` = \'system_locked\'';
28
	if($database->get_one($sql))
29
	{
30
		$sql = 'UPDATE ';
31
		$sql_where = 'WHERE `name` = \'system_locked\'';
32
	} else {
33
		$sql = 'INSERT INTO ';
34
		$sql_where = '';
35
	}
36
	$sql .= '`'.TABLE_PREFIX.'settings` ';
37
	$sql .= 'SET `name` = \'system_locked\', ';
38
	$sql .= '`value` = \''.$val.'\' '.$sql_where;
39
	$database->query($sql);
40
}
41
// redirect to backend
42
header('Location: ' . ADMIN_URL . '/index.php');
43
exit();