<?php
/**
 *
 * @category        admin
 * @package         login
 * @author          Ryan Djurovich, WebsiteBaker Project
 * @copyright       WebsiteBaker Org. e.V.
 * @link            http://websitebaker.org/
 * @license         http://www.gnu.org/licenses/gpl.html
 * @platform        WebsiteBaker 2.8.4
 * @requirements    PHP 5.4 and higher
 * @version         $Id: locking.php 2 2017-07-02 15:14:29Z Manuela $
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/settings/locking.php $
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
 *
 */
if (!defined('WB_PATH')) {
    $sStartupFile = dirname(dirname(__DIR__)).'/config.php';
    if (is_readable($sStartupFile)) {
        require($sStartupFile);
    } else {
        throw new Exception(
                            'tried to read a nonexisting or not readable startup file ['
                          . basename(dirname($sStartupFile)).'/'.basename($sStartupFile).']!!'
        );
    }
}
$oDb = $GLOBALS['database'];
$oTrans = Translate::getInstance();
$oTrans->enableAddon(ADMIN_DIRECTORY.'\\settings');

if (!class_exists('admin', false)) {require (WB_PATH.'/framework/class.admin.php');}
$admin = new admin('Start', 'settings', false, false);

if ($admin->get_user_id() == 1) {
    $val = (((int)(defined('SYSTEM_LOCKED') ? SYSTEM_LOCKED : 0)) + 1) % 2;
    db_update_key_value('settings', 'system_locked', $val);
}
// redirect to backend
header('Location: ' . ADMIN_URL . '/index.php');
exit();
