diff --git a/lib/classes/webserver/class.DomainSSL.php b/lib/classes/webserver/class.DomainSSL.php index 59bafd93..ce1c272f 100644 --- a/lib/classes/webserver/class.DomainSSL.php +++ b/lib/classes/webserver/class.DomainSSL.php @@ -27,20 +27,11 @@ class DomainSSL { */ private $_settings = null; - /** - * internal database object - * - * @var db - */ - private $_db = null; - /** * constructor gets the froxlor settings as array - * and the initialized database object */ - public function __construct(array $settings = null, $db = null) { + public function __construct(array $settings = null) { $this->_settings = $settings; - $this->_db = $db; } /** @@ -54,14 +45,18 @@ class DomainSSL { */ public function setDomainSSLFilesArray(array &$domain = null) { // check if the domain itself has a certificate defined - $dom_certs = $this->_db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` WHERE `domainid` ='".$domain['id']."'"); + $dom_certs_stmt = Database::prepare(" + SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` WHERE `domainid` = :domid + "); + $dom_certs = Database::pexecute_first($dom_certs_stmt, array('domid' => $domain['id'])); + if (!is_array($dom_certs) || !isset($dom_certs['ssl_cert_file']) || $dom_certs['ssl_cert_file'] == '' ) { // maybe its parent? if ($domain['parentdomainid'] != 0) { - $dom_certs = $this->_db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` WHERE `domainid` ='".$domain['parentdomainid']."'"); + $dom_certs = Database::pexecute_first($dom_certs_stmt, array('domid' => $domain['parentdomainid'])); } } diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 0f77897c..307d2107 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -646,7 +646,7 @@ class apache $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings, $this->db); + $dssl = new DomainSSL($this->settings); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 27c0af10..ee5221dd 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -469,7 +469,7 @@ class lighttpd $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings, $this->db); + $dssl = new DomainSSL($this->settings); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 1a50e454..520768f3 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -382,7 +382,7 @@ class nginx $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings, $this->db); + $dssl = new DomainSSL($this->settings); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain);