tbrehm
2011-01-04 e9d71f1635dd83b00b1667dbbbdbce8da0058bc7
interface/lib/classes/remoting.inc.php
@@ -1922,7 +1922,14 @@
      $app->remoting_lib->loadFormDef($formdef_file);
      
      //* load the user profile of the client
      $app->remoting_lib->loadUserProfile($reseller_id);
      $app->remoting_lib->loadUserProfile($reseller_id);
      //* load the client template
      if(isset($params['template_master']) and $params['template_master'] > 0)
      {
         $template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master']));
         $params=array_merge($params,$template);
      }
      
      //* Get the SQL query
      $sql = $app->remoting_lib->getSQL($params,'INSERT',0);
@@ -2141,7 +2148,7 @@
         $new_group[] = intval( $group_id);
        }
        $group_list = implode(',', $new_group);
      $sql ="SELECT domain, domain_id, document_root FROM web_domain WHERE ( (sys_userid = $sys_userid  AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR  sys_perm_other LIKE '%r%') AND type = 'vhost'";
      $sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid  AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR  sys_perm_other LIKE '%r%') AND type = 'vhost'";
        $result = $app->db->queryAllRecords($sql);
        if(isset($result)) {
         return $result;
@@ -2237,6 +2244,22 @@
        }
    }
    
   public function mail_domain_get_by_domain($session_id, $domain) {
        global $app;
        if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }
        if (!empty($domain_id)) {
           $domain         = $app->db->quote($domain);
           $sql            = "SELECT * FROM mail_domain WHERE domain = $domain";
           $result         = $app->db->queryAllRecords($sql);
           return          $result;
        }
        return false;
    }
    
   /**
      * Get a list of functions
@@ -2289,25 +2312,23 @@
   /**
    * Get all DNS zone by user 
    *@author   Julio Montoya <gugli100@gmail.com> BeezNest 2010
    */
    /*
     I will update this function
    */
    public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
        global $app;
        if(!$this->checkPerm($session_id, 'dns_zone_get')) {
                //$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                //return false;
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
            return false;
        }        
        if (!empty($client_id) && !empty($server_id)) {
           $server_id      = intval($server_id);
           $client_id      = intval($client_id);
           $sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = '$client_id' AND server_id = $server_id";
           $sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
           $result         = $app->db->queryAllRecords($sql);
           return          $result;
        }
        return false;
    }
    */
    
   /**
    * Changes DNS zone status 
@@ -2325,11 +2346,33 @@
        }        
        if(in_array($status, array('active', 'inactive'))) {                     
          if ($status == 'active') {
             $status = 'Y';
          } else {
             $status = 'N';
          }
           $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
           $app->db->query($sql);
           $result = $app->db->affectedRows();
           return $result;
        } else {
         $this->server->fault('status_undefined', 'The status is not available');
         return false;
        }
    }
    public function mail_domain_set_status($session_id, $primary_id, $status) {
        global $app;
        if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
              $this->server->fault('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 dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
           $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".intval($primary_id);
           $app->db->query($sql);
           $result = $app->db->affectedRows();
           return $result;