protected function _buildEntityFromRequest($db) { $userEntity = new UserEntity(); $error = true; foreach ($db->GetAllColumns() as $row) { if (UrlUtils::ExistRequestParam($row) && strtolower($row) != "dependencies") { $userEntity->{$row} = UrlUtils::GetRequestParam($row); } } return $userEntity; }
public function Execute($method = null) { if ($method == null) { $method = UrlUtils::RequestMethod(); if (UrlUtils::ExistRequestParam("method")) { $method = strtolower(UrlUtils::GetRequestParam("method")); } } $availableMethods = get_class_methods(get_class($this)); $function = "do" . $method; try { if (in_array($function, $availableMethods)) { $this->{$function}(); } else { ApiBase::ReturnError("Invalid method", 405); } } catch (Exception $ex) { ApiBase::ReturnError($ex->getMessage(), 500); } }
<?php require_once dirname(__FILE__) . "/root.php"; require_once __ROOT__ . "/inc/commons/url.php"; require_once __ROOT__ . "/inc/commons/utils.php"; require_once __ROOT__ . "/inc/commons/path.php"; if (!defined('__INSETUP__')) { define('__INSETUP__', "__INSETUP__"); } $applicationPath = UrlUtils::GetUrlDirectory(); if (!UrlUtils::ExistRequestParam("dosetup")) { require_once __ROOT__ . "/inc/setup/_01_accessdataandsettings.php"; } else { if (UrlUtils::GetRequestParam("dosetup", "post") == "importUsers") { require_once __ROOT__ . "/inc/setup/_02_importusers.php"; } else { die("Error"); } }