migrated DomainSSL-class to new PDO database class, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -27,20 +27,11 @@ class DomainSSL {
|
|||||||
*/
|
*/
|
||||||
private $_settings = null;
|
private $_settings = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* internal database object
|
|
||||||
*
|
|
||||||
* @var db
|
|
||||||
*/
|
|
||||||
private $_db = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor gets the froxlor settings as array
|
* 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->_settings = $settings;
|
||||||
$this->_db = $db;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,14 +45,18 @@ class DomainSSL {
|
|||||||
*/
|
*/
|
||||||
public function setDomainSSLFilesArray(array &$domain = null) {
|
public function setDomainSSLFilesArray(array &$domain = null) {
|
||||||
// check if the domain itself has a certificate defined
|
// 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)
|
if (!is_array($dom_certs)
|
||||||
|| !isset($dom_certs['ssl_cert_file'])
|
|| !isset($dom_certs['ssl_cert_file'])
|
||||||
|| $dom_certs['ssl_cert_file'] == ''
|
|| $dom_certs['ssl_cert_file'] == ''
|
||||||
) {
|
) {
|
||||||
// maybe its parent?
|
// maybe its parent?
|
||||||
if ($domain['parentdomainid'] != 0) {
|
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']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -646,7 +646,7 @@ class apache
|
|||||||
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// 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
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ class lighttpd
|
|||||||
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// 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
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class nginx
|
|||||||
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// 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
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
Reference in New Issue
Block a user