Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper almost 11 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

locking.php
17 17
if(!defined('WB_PATH'))
18 18
{
19 19
	require('../../config.php');
20
	require_once(WB_PATH.'/framework/class.admin.php');
21 20
}
21
$oDb = WbDatabase::getInstance();
22
$oTrans = Translate::getInstance();
23
$oTrans->enableAddon('admin\\settings');
24

  
22 25
$admin = new admin('Start', 'settings', false, false);
23 26

  
24
if($admin->get_user_id() == 1)
25
{
27
if ($admin->get_user_id() == 1) {
26 28
	$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);
29
	$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);
40 38
}
41 39
// redirect to backend
42 40
header('Location: ' . ADMIN_URL . '/index.php');

Also available in: Unified diff