Apply fixes from StyleCI

This commit is contained in:
Manish Verma
2016-12-13 13:14:54 +00:00
committed by StyleCI Bot
parent 857d3004eb
commit 88f3df2180
161 changed files with 4729 additions and 3879 deletions

View File

@@ -7,9 +7,10 @@ use Config;
use Exception;
use Schema;
class LibraryController extends Controller {
public static function getFileVersion() {
class LibraryController extends Controller
{
public static function getFileVersion()
{
try {
$app = Config::get('app.version');
if ($app) {
@@ -22,7 +23,8 @@ class LibraryController extends Controller {
}
}
public static function getDatabaseVersion() {
public static function getDatabaseVersion()
{
try {
$database = self::isDatabaseSetup();
if ($database == true) {
@@ -39,7 +41,8 @@ class LibraryController extends Controller {
}
}
public static function isDatabaseSetup() {
public static function isDatabaseSetup()
{
try {
if (Schema::hasTable('settings_system')) {
return true;
@@ -49,28 +52,30 @@ class LibraryController extends Controller {
}
}
public static function encryptByFaveoPublicKey($data) {
public static function encryptByFaveoPublicKey($data)
{
try {
$path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key';
$path = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public.key';
//dd($path);
$key_content = file_get_contents($path);
$public_key = openssl_get_publickey($key_content);
$encrypted = $e = NULL;
openssl_seal($data, $encrypted, $e, array($public_key));
$encrypted = $e = null;
openssl_seal($data, $encrypted, $e, [$public_key]);
$sealed_data = base64_encode($encrypted);
$envelope = base64_encode($e[0]);
$result = ['seal' => $sealed_data, 'envelope' => $envelope];
return json_encode($result);
} catch (Exception $ex) {
throw new Exception($ex->getMessage());
}
}
public static function decryptByFaveoPrivateKey($encrypted) {
public static function decryptByFaveoPrivateKey($encrypted)
{
try {
$encrypted = json_decode($encrypted);
if ($encrypted) {
@@ -78,11 +83,12 @@ class LibraryController extends Controller {
$envelope = $encrypted->envelope;
$input = base64_decode($sealed_data);
$einput = base64_decode($envelope);
$path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key');
$path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key');
$key_content = file_get_contents($path);
$private_key = openssl_get_privatekey($key_content);
$plaintext = NULL;
$plaintext = null;
openssl_open($input, $plaintext, $einput, $private_key);
return $plaintext;
}
} catch (Exception $ex) {
@@ -90,8 +96,8 @@ class LibraryController extends Controller {
}
}
public static function _isCurl() {
public static function _isCurl()
{
return function_exists('curl_version');
}
}