migrated DomainSSL-class to new PDO database class, refs #1287

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-25 09:18:11 +01:00
parent ae4bc4471e
commit 7a3d696c6a
4 changed files with 10 additions and 15 deletions

View File

@@ -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']));
}
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);