Файл: app/functions/app.func.php
Строк: 33
<?php
# Author: Oleg Kulaga (Cyber_Shot);
# Package: WGame Engine;
# Version: 0.1;
if (!defined("APP")) die("Access Denied");
function app_getConfig($module, $param)
{
$query = DB::$dbs->queryFetch("SELECT `param` FROM ". MODULES ." WHERE `module` = ?", [$module]);
if (empty($query))
{
die("Error load settings.");
}
else
{
$array = json_decode($query['param'], true);
}
return data_out($array[$param]);
}
function app_setConfig($module, $param)
{
$query = DB::$dbs->queryFetch("SELECT `param` FROM ". MODULES ." WHERE `module` = ?", [$module]);
if (empty($query))
{
die('Error load settings.');
}
else
{
$array = json_decode($query['param'], true);
if (!empty($query['param']))
{
$upd = array_diff($array, $param);
$upd = array_merge($upd, $param);
}
else
{
$upd = $param;
}
DB::$dbs->query("UPDATE ". MODULES ." SET `param` = ? WHERE `module` = ?", [json_encode($upd), $module]);
}
}
# !NOT-USE
function app_getAllowConfig($module, $param)
{
$query = DB::$dbs->queryFetch("SELECT `allowParam` FROM ". MODULES ." WHERE `module` = ?", [$module]);
if (empty($query))
{
die("Error load settings.");
}
else
{
$array = json_decode($query['allowParam'], true);
}
return data_out($array[$param]);
}
function app_setAllowConfig($module, $config)
{
$query = DB::$dbs->queryFetch("SELECT `allowParam` FROM ". MODULES ." WHERE `module` = ?", [$module]);
if (empty($query))
{
die('Error load settings.');
}
else
{
$array = json_decode($query['allowParam'], true);
if (!empty($query['param']))
{
$upd = array_diff($array, $param);
$upd = array_merge($upd, $param);
}
else
{
$upd = $param;
}
DB::$dbs->query("UPDATE ". MODULES ." SET `allowParam` = ? WHERE `module` = ?", [json_encode($upd), $module]);
}
}