12 parent::__construct($service);
28 if (isset($options[
"uid"])) {
29 $uid = intval($options[
"uid"]);
37 $sql =
" WHERE compte=$uid ";
41 $stmt = $this->db->prepare(
"SELECT * FROM domaines $sql ORDER BY domaine");
44 while ($me = $stmt->fetch(PDO::FETCH_OBJ)) {
45 $result[$me->domaine] = $me;
47 list($offset, $count) = $this->
offsetAndCount($options, count($result));
48 if ($offset != -1 || $count != -1) {
49 $result = array_slice($result, $offset, $count);
59 function get($options) {
62 if (isset($options[
"uid"])) {
63 $cuid = intval($options[
"uid"]);
66 $mandatory = array(
"dom");
68 foreach ($mandatory as
$key) {
69 if (!isset($options[
$key])) {
74 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: " . $missing));
77 $did = $this->dom->get_domain_all($options[
"dom"]);
92 function add($options) {
93 $mandatory = array(
"domain",
"dns");
94 $defaults = array(
"noerase" =>
false,
"force" =>
false,
"isslave" =>
false,
"slavedom" =>
"");
96 foreach ($mandatory as
$key) {
97 if (!isset($options[
$key])) {
102 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: " . $missing));
105 if (!isset($options[
$key])) {
109 if (!$this->isAdmin) {
110 $options[
"noerase"] =
false;
111 $options[
"force"] =
false;
113 $did = $this->dom->add_domain($options[
"domain"], $options[
"dns"], $options[
"noerase"], $options[
"force"], $options[
"isslave"], $options[
"slavedom"]);
128 $mandatory = array(
"domain",
"dns",
"gesmx");
129 $defaults = array(
"force" =>
false,
"ttl" => 86400);
131 foreach ($mandatory as
$key) {
132 if (!isset($options[
$key])) {
133 $missing.=
$key .
" ";
137 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: " . $missing));
140 if (!isset($options[
$key])) {
144 if (!$this->isAdmin) {
145 $options[
"force"] =
false;
147 $did = $this->dom->edit_domain($options[
"domain"], $options[
"dns"], $options[
"gesmx"], $options[
"force"], $options[
"ttl"]);
161 if (!isset($options[
"domain"])) {
162 return new Alternc_Api_Response(array(
"code" => self::ERR_ALTERNC_FUNCTION,
"message" =>
"Missing or invalid argument: DOMAIN"));
164 $result = $this->dom->del_domain($options[
"domain"]);
Any Legacy AlternC Api should use this class as a parent to be able to handle properly the access rig...
alterncLegacyErrorManager()
return a proper Alternc_Api_Response from an error class and error string from AlternC legacy class
offsetAndCount($options, $max)
ensure that offset & count are set properly from $options.
Domain Api of AlternC, used by alternc-api package.
update($options)
API Method from legacy class method dom->edit_domain()
del($options)
API Method from legacy class method dom->del_domain()
find($options)
API Method from legacy class method dom->get_domain_list()
add($options)
API Method from legacy class method dom->add_domain()
Standard Response object for the AlternC API.
if(empty($_POST['key'])||empty($_POST['val'])) $key