LE: whitespace fixes

- fix mixed indentations
- remove trailing whitespace
This commit is contained in:
Daniel Reichelt
2016-02-19 14:37:41 +01:00
parent 9ca31c10ae
commit 185178a91e
2 changed files with 16 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
<?php <?php
// Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz> // Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz>
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met: // modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
@@ -12,7 +12,7 @@
// * Neither the name of the <organization> nor the // * Neither the name of the <organization> nor the
// names of its contributors may be used to endorse or promote products // names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission. // derived from this software without specific prior written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -59,10 +59,10 @@ class lescript
$keys = $this->generateKey(); $keys = $this->generateKey();
// Only store the accountkey in production, in staging always generate a new key // Only store the accountkey in production, in staging always generate a new key
if (Settings::Get('system.letsencryptca') == 'production') { if (Settings::Get('system.letsencryptca') == 'production') {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `lepublickey` = :public, `leprivatekey` = :private WHERE `customerid` = :customerid; UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `lepublickey` = :public, `leprivatekey` = :private WHERE `customerid` = :customerid;
"); ");
Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid'])); Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid']));
} }
$this->accountKey = $keys['private']; $this->accountKey = $keys['private'];
$this->postNewReg(); $this->postNewReg();
@@ -77,7 +77,7 @@ class lescript
public function signDomains(array $domains, $domainkey = null) public function signDomains(array $domains, $domainkey = null)
{ {
if (!$this->accountKey) { if (!$this->accountKey) {
throw new \RuntimeException("Account not initiated"); throw new \RuntimeException("Account not initiated");
} }
@@ -166,7 +166,7 @@ class lescript
$count = 0; $count = 0;
do { do {
if(empty($result['status']) || $result['status'] == "invalid") { if(empty($result['status']) || $result['status'] == "invalid") {
@unlink($tokenPath); @unlink($tokenPath);
throw new \RuntimeException("Verification ended with error: ".json_encode($result)); throw new \RuntimeException("Verification ended with error: ".json_encode($result));
} }
$ended = !($result['status'] === "pending"); $ended = !($result['status'] === "pending");

View File

@@ -42,12 +42,12 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($certrow['ssl_redirect'] != 2) if ($certrow['ssl_redirect'] != 2)
{ {
$cronlog->logAction(CRON_ACTION, LOG_DEBUG, "Updating " . $certrow['domain']); $cronlog->logAction(CRON_ACTION, LOG_DEBUG, "Updating " . $certrow['domain']);
if ($certrow['ssl_cert_file']) { if ($certrow['ssl_cert_file']) {
$cronlog->logAction(CRON_ACTION, LOG_DEBUG, "letsencrypt using old key / SAN for " . $certrow['domain']); $cronlog->logAction(CRON_ACTION, LOG_DEBUG, "letsencrypt using old key / SAN for " . $certrow['domain']);
// Parse the old certificate // Parse the old certificate
$x509data = openssl_x509_parse($certrow['ssl_cert_file']); $x509data = openssl_x509_parse($certrow['ssl_cert_file']);
// We are interessted in the old SAN - data // We are interessted in the old SAN - data
$san = explode(', ', $x509data['extensions']['subjectAltName']); $san = explode(', ', $x509data['extensions']['subjectAltName']);
$domains = array(); $domains = array();
@@ -62,20 +62,20 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains[] = 'www.' . $certrow['domain']; $domains[] = 'www.' . $certrow['domain'];
} }
} }
try { try {
// Initialize Lescript with documentroot // Initialize Lescript with documentroot
$le = new lescript($cronlog); $le = new lescript($cronlog);
// Initialize Lescript // Initialize Lescript
$le->initAccount($certrow); $le->initAccount($certrow);
// Request the new certificate (old key may be used) // Request the new certificate (old key may be used)
$return = $le->signDomains($domains, $certrow['ssl_key_file']); $return = $le->signDomains($domains, $certrow['ssl_key_file']);
// We are interessted in the expirationdate // We are interessted in the expirationdate
$newcert = openssl_x509_parse($return['crt']); $newcert = openssl_x509_parse($return['crt']);
// Store the new data // Store the new data
Database::pexecute($updcert_stmt, array( Database::pexecute($updcert_stmt, array(
'id' => $certrow['id'], 'id' => $certrow['id'],
@@ -87,7 +87,7 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
'expirationdate' => date('Y-m-d H:i:s', $newcert['validTo_time_t']) 'expirationdate' => date('Y-m-d H:i:s', $newcert['validTo_time_t'])
) )
); );
if ($certrow['ssl_redirect'] == 3) { if ($certrow['ssl_redirect'] == 3) {
Database::pexecute($upddom_stmt, array( Database::pexecute($upddom_stmt, array(
'domainid' => $certrow['domainid'] 'domainid' => $certrow['domainid']