From 653a43f2e113f28cc8226392bf9a5c0562a486ad Mon Sep 17 00:00:00 2001 From: Manuel Silvoso Date: Fri, 9 May 2014 22:08:41 +0200 Subject: removed: closing php tags --- config/autoconfigbackup/crypt_acb.php | 1 - 1 file changed, 1 deletion(-) (limited to 'config/autoconfigbackup/crypt_acb.php') diff --git a/config/autoconfigbackup/crypt_acb.php b/config/autoconfigbackup/crypt_acb.php index 49a2147a..b0d8bebd 100644 --- a/config/autoconfigbackup/crypt_acb.php +++ b/config/autoconfigbackup/crypt_acb.php @@ -130,4 +130,3 @@ return strpos(strtolower($str), strtolower($needle)); } -?> \ No newline at end of file -- cgit v1.2.3 From c4f7014bba0bb82b21025afe02f2ec04039e0cf2 Mon Sep 17 00:00:00 2001 From: Manuel Silvoso Date: Wed, 25 Jun 2014 22:32:36 +0200 Subject: Tabs to spaces and merged changes from crypt.php into crypt_acb.php --- config/autoconfigbackup/crypt_acb.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'config/autoconfigbackup/crypt_acb.php') diff --git a/config/autoconfigbackup/crypt_acb.php b/config/autoconfigbackup/crypt_acb.php index b0d8bebd..9f897cb5 100644 --- a/config/autoconfigbackup/crypt_acb.php +++ b/config/autoconfigbackup/crypt_acb.php @@ -31,14 +31,17 @@ function crypt_data($val, $pass, $opt) { $file = tempnam("/tmp", "php-encrypt"); - $fd = fopen("$file.dec", "w"); - fwrite($fd, $val); - fclose($fd); - exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in $file.dec -out $file.enc -k {$pass}"); - $result = file_get_contents("$file.enc"); - exec("rm $file"); - exec("rm $file.dec"); - exec("rm $file.enc"); + file_put_contents("{$file}.dec", $val); + exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in {$file}.dec -out {$file}.enc -k " . escapeshellarg($pass)); + if (file_exists("{$file}.enc")) + $result = file_get_contents("{$file}.enc"); + else { + $result = ""; + log_error("Failed to encrypt/decrypt data!"); + } + @unlink($file); + @unlink("{$file}.dec"); + @unlink("{$file}.enc"); return $result; } -- cgit v1.2.3