diff --git a/core/Federation.php b/core/Federation.php index 4329cbf88..e219026fd 100644 --- a/core/Federation.php +++ b/core/Federation.php @@ -84,8 +84,6 @@ private function downloadStatsCore($detail = '') $grossUser = 0; $grossSilverbullet = 0; $dataArray = []; - $inst_id = 0; - $displayName = ''; $cohesionQuery = [ 'ORGANISATIONS' => "SELECT profile.inst_id AS inst_id, downloads.device_id AS dev_id, sum(downloads.downloads_user) AS dl_user, sum(downloads.downloads_silverbullet) as dl_sb, sum(downloads.downloads_admin) AS dl_admin FROM downloads JOIN profile ON downloads.profile_id=profile.profile_id JOIN institution ON profile.inst_id=institution.inst_id WHERE institution.country = ? GROUP BY profile.inst_id, downloads.device_id", 'PROFILES' => "SELECT profile.inst_id AS inst_id, profile.profile_id AS profile_id, downloads.device_id AS dev_id, sum(downloads.downloads_user) AS dl_user, sum(downloads.downloads_silverbullet) as dl_sb, sum(downloads.downloads_admin) AS dl_admin FROM downloads JOIN profile ON downloads.profile_id=profile.profile_id JOIN institution ON profile.inst_id=institution.inst_id WHERE institution.country = ? GROUP BY profile.inst_id, profile.profile_id, downloads.device_id", @@ -107,7 +105,7 @@ private function downloadStatsCore($detail = '') } else { // this device has stats, but doesn't exist in current config. We don't even know its display name, so display its raw representation $displayName = sprintf(_("(discontinued) %s"), $queryResult->dev_id); } - if (! isset($dataArray[$inst_id])) { + if (!isset($dataArray[$inst_id])) { $dataArray[$inst_id] = []; } if ($detail === 'ORGANISATIONS') { @@ -115,7 +113,7 @@ private function downloadStatsCore($detail = '') } if ($detail === 'PROFILES') { $profile_id = $queryResult->profile_id; - if (! isset($dataArray[$inst_id][$profile_id])) { + if (!isset($dataArray[$inst_id][$profile_id])) { $dataArray[$inst_id][$profile_id] = []; } $dataArray[$inst_id][$profile_id][$displayName] = ["ADMIN" => $queryResult->dl_admin, "SILVERBULLET" => $queryResult->dl_sb, "USER" => $queryResult->dl_user]; @@ -159,20 +157,20 @@ public function downloadStats($format, $detail = '') if ($device == "TOTAL") { continue; } - $retstring .= "
Could not create a new " . common\Entity::$nomenclature_participant . "!
"; + $text = "Could not create a new ".common\Entity::$nomenclature_participant."!
"; echo $text; throw new Exception($text); } @@ -397,8 +395,8 @@ public function requestCertificate($user, $csr, $expiryDays) $reqserial = $newReq->sendRequestToCa($csr, $revocationPin, $expiryDays); $this->loggerInstance->writeAudit($user, "NEW", "Certificate request - NRO: ".$this->tld." - serial: ".$reqserial." - subject: ".$csr['SUBJECT']); $reqQuery = "INSERT INTO federation_servercerts " - . "(federation_id, ca_name, request_serial, distinguished_name, status, revocation_pin) " - . "VALUES (?, 'eduPKI', ?, ?, 'REQUESTED', ?)"; + ."(federation_id, ca_name, request_serial, distinguished_name, status, revocation_pin) " + ."VALUES (?, 'eduPKI', ?, ?, 'REQUESTED', ?)"; $this->databaseHandle->exec($reqQuery, "siss", $this->tld, $reqserial, $csr['SUBJECT'], $revocationPin); } @@ -416,7 +414,7 @@ public function updateCertificateStatus($reqSerial) return; // no update to fetch } $certDetails = openssl_x509_parse($entryInQuestion['CERT']); - $expiry = "20" . $certDetails['validTo'][0] . $certDetails['validTo'][1] . "-" . $certDetails['validTo'][2] . $certDetails['validTo'][3] . "-" . $certDetails['validTo'][4] . $certDetails['validTo'][5]; + $expiry = "20".$certDetails['validTo'][0].$certDetails['validTo'][1]."-".$certDetails['validTo'][2].$certDetails['validTo'][3]."-".$certDetails['validTo'][4].$certDetails['validTo'][5]; openssl_x509_export($entryInQuestion['CERT'], $pem); $updateQuery = "UPDATE federation_servercerts SET status = 'ISSUED', certificate = ?, expiry = ? WHERE ca_name = 'eduPKI' AND request_serial = ?"; $this->databaseHandle->exec($updateQuery, "ssi", $pem, $expiry, $reqSerial);