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
}
21 2098 darkviper
$oDb = WbDatabase::getInstance();
22
$oTrans = Translate::getInstance();
23
$oTrans->enableAddon('admin\\settings');
24
25 1782 Luisehahne
$admin = new admin('Start', 'settings', false, false);
26
27 2098 darkviper
if ($admin->get_user_id() == 1) {
28 1782 Luisehahne
	$val = (((int)(defined('SYSTEM_LOCKED') ? SYSTEM_LOCKED : 0)) + 1) % 2;
29 2098 darkviper
	$sql = 'SELECT COUNT(`setting_id`) FROM `'.$oDb->TablePrefix.'settings` '
30
         . 'WHERE `name` = \'system_locked\'';
31
    $bUpdate = (bool)$oDb->getOne($sql);
32
    $sql = $bUpdate ? 'UPDATE ' : 'INSERT ';
33
	$sql .= '`'.$oDb->TablePrefix.'settings` '
34
	      . 'SET `name` = \'system_locked\', '
35
	      .     '`value` = '.$val;
36
    $sql .= $bUpdate ? 'WHERE `name` = \'system_locked\'' : '';
37
	$oDb->doQuery($sql);
38 1782 Luisehahne
}
39
// redirect to backend
40
header('Location: ' . ADMIN_URL . '/index.php');
41
exit();