mail_domain_get_by_domain typo and bad quoting [PATCH INCLUDED]
The remote api function mail_domain_get_by_domain does not work. The first issue is a typo in the empty() check using $domain_id instead of $domain. Second, the author assumed db->quote() provided encapsulating quotes as opposed to simply escaping the provided string. I looked at both the mysql and firebird quote() functions and neither provide encapsulating quotes; so those were added. I also cleaned up the alignment, trailing spaces, and added a docblock. Below is the patch.
BEGIN PATCH
--- /usr/local/ispconfig/interface/lib/classes/remoting.inc.php 2011-04-20 10:21:24.254038245 -0500 +++ ispconfig3_install/interface/lib/classes/remoting.inc.php 2011-04-20 10:20:36.510045149 -0500 @@ -2395,24 +2395,29 @@ 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 Unknown
-
*/
-
}
-
if (!empty($domain_id)) {
-
$domain = $app->db->quote($domain);
-
$sql = "SELECT * FROM mail_domain WHERE domain = $domain";
-
}
-
if (!empty($domain)) {
-
$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 * @param int session id