Quellcode durchsuchen

Vérification relatives à l'existence des fichiers de conf (payplug, mailjet)

dev
Guillaume Bourgeois vor 5 Jahren
Ursprung
Commit
024f5ceeda
2 geänderte Dateien mit 24 neuen und 20 gelöschten Zeilen
  1. +2
    -2
      common/config/main.php
  2. +22
    -18
      common/models/Producer.php

+ 2
- 2
common/config/main.php Datei anzeigen

@@ -46,14 +46,14 @@ return [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'laboiteapain',
'name' => 'distrib',
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'path' => '/',
]
],
'session' => [
'class' => 'yii\web\Session',
'name' => 'PHPLABOITEAPAINSESSID',
'name' => 'PHPDISTRIBSESSID',
'cookieParams' => [
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'httpOnly' => true,

+ 22
- 18
common/models/Producer.php Datei anzeigen

@@ -440,12 +440,14 @@ class Producer extends ActiveRecordCommon
*/
public function getSecretKeyPayplug()
{
$handle = fopen($this->getFilenameSecretKeyPayplug(), "r") ;
$filesize = filesize($this->getFilenameSecretKeyPayplug()) ;
if($handle && $filesize) {
$secretKey = fread($handle, $filesize);
fclose($handle);
return $secretKey ;
if(file_exists($this->getFilenameSecretKeyPayplug())) {
$handle = fopen($this->getFilenameSecretKeyPayplug(), "r") ;
$filesize = filesize($this->getFilenameSecretKeyPayplug()) ;
if($handle && $filesize) {
$secretKey = fread($handle, $filesize);
fclose($handle);
return $secretKey ;
}
}
return '' ;
@@ -454,18 +456,20 @@ class Producer extends ActiveRecordCommon
public function getApiKeyMailjet($type = 'private')
{
$filename = '../../common/config/mailjet/api.key' ;
$handle = fopen($filename, "r") ;
$filesize = filesize($filename) ;
if($handle && $filesize) {
$apiKeys = fread($handle, $filesize);
fclose($handle);
$apiKeysArray = explode(':', $apiKeys) ;
if(count($apiKeysArray) == 2) {
if($type == 'private') {
return $apiKeysArray[1] ;
}
else {
return $apiKeysArray[0] ;
if(file_exists($filename)) {
$handle = fopen($filename, "r") ;
$filesize = filesize($filename) ;
if($handle && $filesize) {
$apiKeys = fread($handle, $filesize);
fclose($handle);
$apiKeysArray = explode(':', $apiKeys) ;
if(count($apiKeysArray) == 2) {
if($type == 'private') {
return $apiKeysArray[1] ;
}
else {
return $apiKeysArray[0] ;
}
}
}
}

Laden…
Abbrechen
Speichern