Newer
Older
/**
* Fetch the mail_domain record for the provided domain.
* @param int session_id
* @param string the fully qualified domain (or subdomain)
* @return array array of arrays corresponding to the mail_domain table's records
* @author till, benlake
*/
public function mail_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($domain)) {
$sql = "SELECT * FROM mail_domain WHERE domain = ?";
$result = $app->db->queryAllRecords($sql, $domain);
return $result;
}
return false;
}
public function mail_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE mail_domain SET active = ? WHERE domain_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new ISPConfigRemoteException('status_undefined', 'The status is not available');
//** quota functions -----------------------------------------------------------------------------------
public function mailquota_get_by_user($session_id, $client_id)
{
global $app;
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'mailquota_get_by_user')) {
throw new ISPConfigRemoteException('permission_denied', 'You do not have the permissions to access this function.');
return $app->quota_lib->get_mailquota_data($client_id, false);