21 private static $cache = array();
25 private static function &getAction()
37 self::$cache = array();
63 self::getParameter(
'a');
64 if (!isset(self::$cache[$appName])) {
65 $sql = sprintf(
"select paramv.name,paramv.val from paramv, application where application.name='%s' and application.id=paramv.appid and paramv.type !~ '^U';", pg_escape_string($appName));
68 foreach (
$r as $values) {
69 $t[$values[
"name"]] = $values[
"val"];
72 $sql = sprintf(
"select paramv.name,paramv.val from paramv, application where application.name='%s' and application.id=paramv.appid and paramv.type = 'U%d';", pg_escape_string($appName) , $uid);
75 foreach (
$r as $values) {
76 $t[$values[
"name"]] = $values[
"val"];
78 self::$cache[$appName] = $t;
80 return isset(self::$cache[$appName][$name]) ? self::$cache[$appName][$name] : null;
93 $sql = sprintf(
"select paramdef.*, application.name as appname from paramdef, application where paramdef.isglob='Y' and application.id=paramdef.appid and paramdef.name='%s';", pg_escape_string($name));
96 throw new \Dcp\PMGT\Exception(
"PMGT0003", $name);
112 $sql = sprintf(
"select paramdef.*, application.name as appname from paramdef, application where application.id = paramdef.appid and paramdef.name='%s';", pg_escape_string($name));
116 throw new \Dcp\PMGT\Exception(
"PMGT0001", $name, $appName);
118 if (
$r[
"appname"] == $appName) {
119 $appId =
$r[
"appid"];
121 $sql = sprintf(
"select application.id from application where application.name='%s'", pg_escape_string($appName));
124 throw new \Dcp\PMGT\Exception(
"PMGT0006", $name, $appName);
142 $sql = sprintf(
"select paramdef.*, application.name as appname from paramdef, application where application.name in ('%s',(select childof from application where name='%s')) and application.id=paramdef.appid and paramdef.name = '%s' and isuser='Y';", pg_escape_string($appName) , pg_escape_string($appName) , pg_escape_string($name));
145 throw new \Dcp\PMGT\Exception(
"PMGT0004", $name, $appName);
147 if (
$r[
"appname"] == $appName) {
148 $appId =
$r[
"appid"];
150 $sql = sprintf(
"select application.id from application where application.name='%s'", pg_escape_string($appName));
153 throw new \Dcp\PMGT\Exception(
"PMGT0006", $name, $appName);
157 self::setUserApplicationTypeParameter($userId, $appName, $appId,
$r[
"name"],
$value);
171 $sql = sprintf(
"select paramdef.*, application.name as appname from paramdef, application where application.id=paramdef.appid and paramdef.name = '%s' and isuser='Y' and isglob='Y';", pg_escape_string($name));
174 throw new \Dcp\PMGT\Exception(
"PMGT0007", $name);
178 self::setUserApplicationTypeParameter($userId,
$r[
"appname"],
$r[
"appid"],
$r[
"name"],
$value);
180 private static function setApplicationTypeParameter(
$type, $appName, $appId, $name,
$value)
182 $a = self::getAction();
184 $p =
$a->parent->param;
192 throw new \Dcp\PMGT\Exception(
"PMGT0002", $name, $appName,
$err);
194 if (isset(self::$cache[$appName][$name])) self::$cache[$appName][$name] =
$value;
196 $a = self::getAction();
198 private static function setUserApplicationTypeParameter($userId, $appName, $appId, $name,
$value)
200 $a = self::getAction();
202 $p =
$a->parent->param;
207 simpleQuery(
'', sprintf(
"select id from users where id=%d and accounttype='U'", $userId) , $uid,
true,
true);
209 throw new \Dcp\PMGT\Exception(
"PMGT0008", $name, $appName, $userId);
214 throw new \Dcp\PMGT\Exception(
"PMGT0005", $name, $appName,
$err);
216 if (isset(self::$cache[$appName][$name])) self::$cache[$appName][$name] =
$value;
static setUserApplicationParameter($appName, $name, $value, $userId=null)
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
static getParameter($name)
static setGlobalParameter($name, $value)
static getApplicationParameter($appName, $name)
static setGlobalUserParameter($name, $value, $userId=null)
getParam($name, $def="")
must be in core or global type
deprecatedFunction($msg= '')
static setApplicationParameter($appName, $name, $value)
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err