Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Mar 12, 2024
1 parent c4e548c commit cc3c59d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 18 additions & 0 deletions plib/library/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,22 @@ public static function canIUpdateNewVersionOfApp()
'outdated_domains_ids'=>$outdatedDomainsIds
];
}

public static function checkSsl($domainName)
{
$apiRequest = <<<APICALL
<packet>
<certificate>
<get-pool>
<filter>
<domain-name>$domainName</domain-name>
</filter>
</get-pool>
</certificate>
</packet>
APICALL;
$response = json_decode(json_encode(pm_ApiRpc::getService()->call($apiRequest)), TRUE);


}
}
19 changes: 1 addition & 18 deletions plib/library/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function run() {
}

if ($this->_ssl) {
if (!$this->checkSsl($domain->getName())) {
if (!Modules_Microweber_Helper::checkSsl($domain->getName())) {
$this->addDomainEncryption($domain);
} else {
Modules_Microweber_Log::debug('Domain already have a SSL.');
Expand Down Expand Up @@ -430,23 +430,6 @@ public function run() {

}

private function checkSsl($domainName)
{
try {
$g = @stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
$r = @stream_socket_client("ssl://www." . $domainName . ":443", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, $g);
$cont = @stream_context_get_params($r);
if (isset($cont["options"]["ssl"]["peer_certificate"])) {
return true;
}
} catch (Exception $e) {
return false;
}

return false;
}

private function addDomainEncryption($domain)
{
$artisan = false;
Expand Down

0 comments on commit cc3c59d

Please sign in to comment.