Core
3.2
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
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
* @package FDL
5
*/
6
/**
7
* Get Values in XML form
8
*
9
* @author Anakeen
10
* @version $Id: setparamu.php,v 1.4 2008/06/10 15:00:14 jerome Exp $
11
* @package FDL
12
* @subpackage FDC
13
*/
14
/**
15
*/
16
17
include_once (
"Class.Param.php"
);
18
/**
19
* set an user attribute value
20
* @param Action &$action current action
21
* @global string $appname Http var : application name of the attribute
22
* @global string $parname Http var : parameters name
23
* @global string $parval Http var : new value
24
*/
25
function
setparamu
(
Action
&
$action
)
26
{
27
header(
'Content-type: text/xml; charset=utf-8'
);
28
$err
=
''
;
29
$mb = microtime();
30
$appname
= GetHttpVars(
"appname"
);
31
$parname
= GetHttpVars(
"parname"
);
32
33
$parval
= GetHttpVars(
"parval"
);
34
35
$action->lay->set(
"warning"
,
""
);
36
37
$appid
= $action->parent->GetIdFromName(
$appname
);
38
39
$pdef =
new
QueryDb
(
""
,
"ParamDef"
);
40
$pdef->AddQuery(
"name='"
. pg_escape_string(
$parname
) .
"'"
);
41
$pdef->AddQuery(
"isuser='Y'"
);
42
$pdef->AddQuery(
"appid=$appid"
);
43
$list
= $pdef->Query(0, 2);
44
if
($pdef->nb == 0) {
45
$err
= sprintf(_(
"Attribute %s not found\n"
) ,
$parname
);
46
} elseif ($pdef->nb > 1) {
47
$err
= sprintf(_(
"Attribute %s found is not alone\nMust precise request with appname arguments\n"
) ,
$parname
);
48
}
else
{
49
50
$param
=
new
QueryDb
(
""
,
"Param"
);
51
$param
->AddQuery(
"name='"
. pg_escape_string(
$parname
) .
"'"
);
52
$param
->AddQuery(
"type='"
.
Param::PARAM_USER
. $action->user->id .
"'"
);
53
$param
->AddQuery(
"appid=$appid"
);
54
$list
=
$param
->Query(0, 1);
55
if
(
$param
->nb == 0) {
56
$p =
new
Param
(
""
);
57
$p->name =
$parname
;
58
$p->type =
Param::PARAM_USER
. $action->user->id;
59
$p->appid =
$appid
;
60
}
else
{
61
$p =
$list
[0];
62
}
63
64
$p->Set($p->name,
$parval
, $p->type, $p->appid);
65
}
66
67
if
(
$err
) $action->lay->set(
"warning"
,
$err
);
68
69
$action->lay->set(
"CODE"
,
"OK"
);
70
$action->lay->set(
"count"
, 1);
71
$action->lay->set(
"delay"
,
microtime_diff
(microtime() , $mb));
72
}
$appname
$appname
Definition:
change_action.php:29
Param
Definition:
Class.Param.php:29
$action
global $action
Definition:
accountRefreshGroup.php:16
$list
$list
Definition:
setApplicationParameter.php:35
Action
Definition:
Class.Action.php:24
Param\PARAM_USER
const PARAM_USER
Definition:
Class.Param.php:34
$parname
$parname
Definition:
getApplicationParameter.php:17
microtime_diff
microtime_diff($a, $b)
Definition:
Lib.Common.php:302
QueryDb
Definition:
Class.QueryDb.php:19
$parval
$parval
Definition:
setApplicationParameter.php:19
setparamu
setparamu(Action &$action)
Definition:
setparamu.php:25
$err
if($file) if($subject==""&&$file) if($subject=="") $err
Definition:
fdl_sendmail.php:78
$param
$param
Definition:
import_size.php:31
$appid
$appid
Definition:
setApplicationParameter.php:24
← centre documentaire
© anakeen