adding proper DOMAIN find function
This commit is contained in:
parent
cb2ad782b4
commit
dee572ab48
|
@ -11,6 +11,7 @@ class Alternc_Api_Legacyobject {
|
||||||
protected $admin; // m_admin instance
|
protected $admin; // m_admin instance
|
||||||
protected $cuid; // current user id
|
protected $cuid; // current user id
|
||||||
protected $isAdmin; // is it an Admin account?
|
protected $isAdmin; // is it an Admin account?
|
||||||
|
protected $db; // PDO DB access to AlternC's database.
|
||||||
|
|
||||||
const ERR_INVALID_ARGUMENT = 111201;
|
const ERR_INVALID_ARGUMENT = 111201;
|
||||||
const ERR_ALTERNC_FUNCTION = 111202;
|
const ERR_ALTERNC_FUNCTION = 111202;
|
||||||
|
@ -21,6 +22,7 @@ class Alternc_Api_Legacyobject {
|
||||||
throw new \Exception("Bad argument: service is not an Alternc_Api_Service", self::ERR_INVALID_ARGUMENT);
|
throw new \Exception("Bad argument: service is not an Alternc_Api_Service", self::ERR_INVALID_ARGUMENT);
|
||||||
}
|
}
|
||||||
// We store the global $cuid to AlternC legacy classes
|
// We store the global $cuid to AlternC legacy classes
|
||||||
|
$this->db=$service->db;
|
||||||
$this->cuid=$cuid=$service->token->uid;
|
$this->cuid=$cuid=$service->token->uid;
|
||||||
$this->isAdmin=$service->token->isAdmin;
|
$this->isAdmin=$service->token->isAdmin;
|
||||||
// We use the global $admin from AlternC legacy classes
|
// We use the global $admin from AlternC legacy classes
|
||||||
|
|
|
@ -35,10 +35,17 @@ class Alternc_Api_Object_Domain extends Alternc_Api_Legacyobject {
|
||||||
} else {
|
} else {
|
||||||
$uid=$cuid;
|
$uid=$cuid;
|
||||||
}
|
}
|
||||||
$result=$this->dom->get_domain_list($uid);
|
if ($uid!=-1) {
|
||||||
if (!$result) {
|
$sql=" WHERE compte=$uid ";
|
||||||
return $this->alterncLegacyErrorManager();
|
|
||||||
} else {
|
} else {
|
||||||
|
$sql="";
|
||||||
|
}
|
||||||
|
$stmt = $this->db->prepare("SELECT * FROM domaines $sql ORDER BY domaine");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = array();
|
||||||
|
while ($me = $stmt->fetch(PDO::FETCH_OBJ)) {
|
||||||
|
$result[$me->domaine] = $me;
|
||||||
|
}
|
||||||
$offset=-1; $count=-1;
|
$offset=-1; $count=-1;
|
||||||
if (isset($options["count"])) $count=intval($options["count"]);
|
if (isset($options["count"])) $count=intval($options["count"]);
|
||||||
if (isset($options["offset"])) $offset=intval($options["offset"]);
|
if (isset($options["offset"])) $offset=intval($options["offset"]);
|
||||||
|
@ -49,7 +56,6 @@ class Alternc_Api_Object_Domain extends Alternc_Api_Legacyobject {
|
||||||
}
|
}
|
||||||
return new Alternc_Api_Response( array("content" =>$result) );
|
return new Alternc_Api_Response( array("content" =>$result) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** API Method from legacy class method dom->add_domain()
|
/** API Method from legacy class method dom->add_domain()
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class Alternc_Api_Service {
|
class Alternc_Api_Service {
|
||||||
|
|
||||||
|
|
||||||
private $db; // PDO object
|
public $db; // PDO object
|
||||||
private $loggerList; // List of loggers
|
private $loggerList; // List of loggers
|
||||||
private $allowedAuth; // list of allowed authenticators
|
private $allowedAuth; // list of allowed authenticators
|
||||||
public $token; // Token (useful for called classes)
|
public $token; // Token (useful for called classes)
|
||||||
|
|
Loading…
Reference in New Issue