<?php require '../config.php'; dol_include_once('/personnalview/class/ps.class.php'); $put = GETPOST('put'); _put($put); function _put($put) { $PDOdb = new TPDOdb(); switch ($put) { case 'view': $ps = new TPersonnalView(); $ps->loadByElementAction($PDOdb, GETPOST('element'), GETPOST('action')); $ps->element = GETPOST('element'); $ps->action = GETPOST('action'); $ps->TField = GETPOST('TField', 'array'); echo $ps->save($PDOdb); break; } }
/** * Return all put parameters or a single put parameter. * * @param string|null $param * Parameter name to retrieve, or null to get all. * @param mixed $default * Default value to use when the parameter is missing. * @return mixed */ public function fromPut($param = null, $default = null) { $result = _put($param); if (null === $result && null !== $default) { $result = $default; } return $result; /* if (null === $this->putParams) { $request = $this->getController()->getRequest(); $content = $request->getContent(); if ($request->getHeaders('accept')->match('application/json')) { $this->putParams = json_decode($content, true); } else { parse_str($content, $this->putParams); } } if ($param === null) { return $this->putParams; } else { return isset($this->putParams[$param]) ? $this->putParams[$param] : $default; } */ }
$fields = array("emailaddress" => $emailaddress, "displayName" => $displayName, "pwd" => $pwd); if (0 >= $user->createUser($fields)->getUserID()) { throw new Exception("failed to register user", -1); } /* * Function: disable email verification * Date: 2016/03/01 */ //echo json_encode(array("errCode"=>0, "errMessage"=>"an verification email has been sent to your email address")); echo json_encode(array("errCode" => 0, "errMessage" => "\n\t\t\t\t\tuser registered successfully")); } } else { if (is_put()) { $userID = _get('userID', 0); $displayName = _put("displayName", ""); $fullname = _put("fullname", ""); if ($userID <= 0) { throw new Exception("user does not exists", -1); } $auth = Auth::getInstance(); if ($auth->getUserID() != $userID) { throw new Exception("unauthorized", -1); } if ($displayName == "" || $fullname == "") { throw new Exception("missing fields", -1); } $fields = array("displayName" => $displayName, "fullname" => $fullname); $user = new User($userID); $user->updateUser($fields); echo json_encode(array("errCode" => 0)); }
<?php require '../config.php'; if ($conf->of->enabled) { dol_include_once('/of/class/ordre_fabrication_asset.class.php'); } else { if ($conf->asset->enabled) { dol_include_once('/asset/class/ordre_fabrication_asset.class.php'); } } //OLD $get = GETPOST('get', 'alpha'); $put = GETPOST('put', 'alpha'); _put($db, $put); _get($db, $get); function _get(&$db, $case) { global $conf; switch ($case) { case 'logged-status': echo 'ok'; break; case 'tasks': $onlyUseGrid = isset($_REQUEST['gridMode']) && $_REQUEST['gridMode'] == 1 && empty($conf->global->SCRUM_ALLOW_ALL_TASK_IN_GRID) ? true : false; $var = explode('|', GETPOST('status')); $Tab = array(); foreach ($var as $statut) { $Tab = array_merge($Tab, _tasks($db, (int) GETPOST('id_project'), $statut, $onlyUseGrid)); } print json_encode($Tab); break;