Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
setparamu.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5
* @package FDL
6
*/
7
/**
8
* Get Values in XML form
9
*
10
* @author Anakeen 2006
11
* @version $Id: setparamu.php,v 1.4 2008/06/10 15:00:14 jerome Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage FDC
15
*/
16
/**
17
*/
18
19
include_once (
"Class.Param.php"
);
20
/**
21
* set an user attribute value
22
* @param Action &$action current action
23
* @global appname Http var : application name of the attribute
24
* @global parname Http var : parameters name
25
* @global parval Http var : new value
26
*/
27
function
setparamu
(&
$action
)
28
{
29
header(
'Content-type: text/xml; charset=utf-8'
);
30
31
$mb = microtime();
32
$appname
=
GetHttpVars
(
"appname"
);
33
$parname
=
GetHttpVars
(
"parname"
);
34
35
$parval
=
GetHttpVars
(
"parval"
);
36
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
37
38
$action
->lay->set(
"warning"
,
""
);
39
40
$appid =
$action
->parent->GetIdFromName(
$appname
);
41
42
$pdef =
new
QueryDb
(
""
,
"ParamDef"
);
43
$pdef->AddQuery(
"name='"
. pg_escape_string(
$parname
) .
"'"
);
44
$pdef->AddQuery(
"isuser='Y'"
);
45
$pdef->AddQuery(
"appid=$appid"
);
46
$list
= $pdef->Query(0, 2);
47
if
($pdef->nb == 0) {
48
$err
= sprintf(_(
"Attribute %s not found\n"
) ,
$parname
);
49
} elseif ($pdef->nb > 1) {
50
$err
= sprintf(_(
"Attribute %s found is not alone\nMust precise request with appname arguments\n"
) ,
$parname
);
51
}
else
{
52
53
$param
=
new
QueryDb
(
""
,
"Param"
);
54
$param
->AddQuery(
"name='"
. pg_escape_string(
$parname
) .
"'"
);
55
$param
->AddQuery(
"type='"
.
PARAM_USER
.
$action
->user->id .
"'"
);
56
$param
->AddQuery(
"appid=$appid"
);
57
$list
=
$param
->Query(0, 1);
58
if
(
$param
->nb == 0) {
59
$p =
new
Param
(
""
);
60
$p->name =
$parname
;
61
$p->type =
PARAM_USER
.
$action
->user->id;
62
$p->appid = $appid;
63
}
else
{
64
$p =
$list
[0];
65
}
66
67
$p->Set($p->name,
$parval
, $p->type, $p->appid);
68
}
69
70
if
(
$err
)
$action
->lay->set(
"warning"
,
$err
);
71
72
$action
->lay->set(
"CODE"
,
"OK"
);
73
$action
->lay->set(
"count"
, 1);
74
$action
->lay->set(
"delay"
,
microtime_diff
(microtime() , $mb));
75
}
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase