Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
setApplicationParameter.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * set applicative parameter value
8  *
9  * analyze sub-directories presents in STYLE directory
10  * @subpackage WSH
11  */
12 /**
13  */
14 include_once ("Class.QueryDb.php");
15 $usage = new ApiUsage();
16 
17 $usage->setDefinitionText("set applicative parameter value");
18 $parname = $usage->addRequiredParameter("param", "parameter name"); // parameter name
19 $parval = $usage->addOptionalParameter("value", "parameter value to set"); // parameter value (option)
20 $paruser = GetHttpVars("userid"); // parameter user id (option)
21 $parapp = $usage->addOptionalParameter("appname", "Parameter's application's name"); // parameter app name (option)
22 $usage->verify();
23 
24 $appid = 0;
25 if ($parapp != "") {
26  /* @var Application $core */
27  global $core;
28  $appid = $core->GetIdFromName($parapp);
29 }
30 
32 $param = new QueryDb($dbaccess, "Param");
33 $param->AddQuery("name='$parname'");
34 if ($appid) $param->AddQuery("appid=$appid");
35 $list = $param->Query(0, 2);
36 if ($param->nb == 0) {
37  printf(_("Attribute %s not found\n") , $parname);
38  exit(1);
39 } elseif ($param->nb > 1) {
40  printf(_("Attribute %s found is not alone\nMust precise request with appname arguments\n") , $parname);
41  exit(1);
42 } else {
43  /* @var Param $p */
44  $p = $list[0];
45  $p->val = $parval;
46  $err = $p->modify();
47  if ($err != "") {
48  printf(_("Attribute %s not modified : %s\n") , $parname, $err);
49  exit(1);
50  }
51  else printf(_("Attribute %s modified to %s") , $parname, $parval);
52 }
getDbAccess()
Definition: Lib.Common.php:368
switch($command) exit
Definition: checkVault.php:46
if($parapp!="") $dbaccess
Verify arguments for wsh programs.
$core
Definition: chgpasswd.php:33
← centre documentaire © anakeen