From 9e0f11846e9451409348c9f18b139630b9c848e2 Mon Sep 17 00:00:00 2001
From: latham <latham@ispconfig3>
Date: Fri, 6 May 2011 14:15:17 +0000
Subject: [PATCH] Remoting API SQL error and typo
 http://bugtracker.ispconfig.org/index.php?do=details&task_id=1601&project=3

Thanks Ben Lake
---
 interface/lib/classes/remoting.inc.php | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index ce9aa4a2e..eaedbc069 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -2450,24 +2450,29 @@ class remoting {
 			return false;
         }
     }
-    
+
+    /**
+    * 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')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
             return false;
         }        
-        if (!empty($domain_id)) {
+        if (!empty($domain)) {
         	$domain      	= $app->db->quote($domain);        	
-    	    $sql            = "SELECT * FROM mail_domain WHERE domain = $domain";
+    	    $sql            = "SELECT * FROM mail_domain WHERE domain = '$domain'";
         	$result         = $app->db->queryAllRecords($sql);
         	return          $result;
         }
         return false;
     }
-    
-    
-    
+
 	/**
    	* Get a list of functions
    	* @param 	int		session id
-- 
GitLab