12 parent::__construct($service);
21 function add($options) {
22 $mandatory = array(
"prefix",
"login",
"pass",
"dir");
24 foreach ($mandatory as
$key) {
25 if (!isset($options[
$key])) {
30 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: " . $missing));
32 $ftpid = $this->ftp->add_ftp($options[
"prefix"], $options[
"login"], $options[
"pass"], $options[
"dir"]);
47 $defaults = array(
"prefix",
"login",
"dir");
48 if (!isset($options[
"id"])) {
49 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: ID"));
51 $id = intval($options[
"id"]);
52 $old = $this->ftp->get_ftp_details(
$id);
54 return new Alternc_Api_Response(array(
"code" => self::ERR_NOT_FOUND,
"message" =>
"FTP Account not found"));
56 foreach ($defaults as
$key) {
57 if (!isset($options[
$key])) {
61 if (!isset($options[
"pass"]))
62 $options[
"pass"] =
"";
63 $result = $this->ftp->put_ftp_details(
$id, $options[
"prefix"], $options[
"login"], $options[
"pass"], $options[
"dir"]);
76 function del($options) {
77 if (!isset($options[
"id"])) {
78 return new Alternc_Api_Response(array(
"code" => self::ERR_ALTERNC_FUNCTION,
"message" =>
"Missing or invalid argument: ID"));
80 $result = $this->ftp->delete_ftp(intval($options[
"id"]));
95 $result = $this->ftp->get_list();
99 list($offset, $count) = $this->
offsetAndCount($options, count($result));
100 if ($offset != -1 || $count != -1) {
101 $result = array_slice($result, $offset, $count);
113 if (!isset($options[
"dir"])) {
114 return new Alternc_Api_Response(array(
"code" => self::ERR_INVALID_ARGUMENT,
"message" =>
"Missing or invalid argument: DIR"));
116 $result = $this->ftp->is_ftp($options[
"dir"]);
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.
Ftp Api of AlternC, used by alternc-api package.
add($options)
API Method from legacy class method ftp->add_ftp()
isFtp($options)
API Method from legacy class method ftp->is_ftp()
del($options)
API Method from legacy class method ftp->del_ftp()
find($options)
API Method from legacy class method ftp->get_list()
update($options)
API Method from legacy class method ftp->put_ftp_details()
Standard Response object for the AlternC API.
if(!isset($is_include)) if(! $key &&! $crt) $id
if(empty($_POST['key'])||empty($_POST['val'])) $key