Skip to content

Commit 9e65f39

Browse files
committed
Rewrite Encryption library with openssl
1 parent 0c1f05c commit 9e65f39

17 files changed

+662
-824
lines changed

app/configs/Bootstrap.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<?php
22

3-
use Illuminate\Database\Capsule\Manager as Capsule;
4-
#use Illuminate\Events\Dispatcher;
5-
#use Illuminate\Container\Container;
63
use Codesleeve\Stapler\Stapler as Stapler;
4+
use Illuminate\Database\Capsule\Manager as Capsule;
75

8-
class Bootstrap extends Seeder {
9-
public static function Eloquent() {
10-
try {
11-
$capsule = new Capsule();
12-
$capsule->addConnection(Config::database());
13-
#$capsule->setEventDispatcher(new Dispatcher(new Container));
14-
$capsule->setAsGlobal();
15-
$capsule->bootEloquent();
16-
return $capsule;
17-
} catch (Exception $exception) {
18-
throw new Exception($exception->getMessage());
19-
}
20-
}
21-
public static function Stapler () {
22-
try {
23-
Stapler::boot();
24-
$config = new Codesleeve\Stapler\Config\NativeConfig;
25-
Stapler::setConfigInstance($config);
26-
$config->set('stapler.base_path', __DIR__.DIRECTORY_SEPARATOR.'../../');
27-
$config->set('filesystem.path',':app_root/:url');
28-
} catch (Exception $exception) {
29-
throw new Exception($exception->getMessage());
30-
}
31-
}
6+
class Bootstrap extends Seeder
7+
{
8+
public static function Eloquent()
9+
{
10+
try {
11+
$capsule = new Capsule();
12+
$capsule->addConnection(Config::database());
13+
$capsule->setAsGlobal();
14+
$capsule->bootEloquent();
15+
return $capsule;
16+
} catch (Exception $exception) {
17+
throw new Exception($exception->getMessage());
18+
}
19+
}
20+
public static function Stapler()
21+
{
22+
try {
23+
Stapler::boot();
24+
$config = new Codesleeve\Stapler\Config\NativeConfig;
25+
Stapler::setConfigInstance($config);
26+
$config->set('stapler.base_path', __DIR__ . DIRECTORY_SEPARATOR . '../../');
27+
$config->set('filesystem.path', ':app_root/:url');
28+
} catch (Exception $exception) {
29+
throw new Exception($exception->getMessage());
30+
}
31+
}
3232
}

app/configs/Config.php

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
<?php
22

3-
if(!defined('MCRYPT_RIJNDAEL_256'))
4-
{
5-
define('MCRYPT_RIJNDAEL_256',0);
3+
if (!defined('MCRYPT_RIJNDAEL_256')) {
4+
define('MCRYPT_RIJNDAEL_256', 0);
65
}
76

8-
if(!defined('MCRYPT_MODE_CBC'))
9-
{
10-
define('MCRYPT_MODE_CBC',0);
7+
if (!defined('MCRYPT_MODE_CBC')) {
8+
define('MCRYPT_MODE_CBC', 0);
119
}
1210

13-
define ("GENERATE_NEW_TOKEN", 2675);
11+
define("GENERATE_NEW_TOKEN", 2675);
1412

15-
define ("DEFAULT_ALLOWED_REQUEST_METHOD", "GET");
13+
define("DEFAULT_ALLOWED_REQUEST_METHOD", "GET");
1614

17-
define ("UNDEFINED", null);
15+
define("UNDEFINED", null);
1816

1917
class Config
2018
{
2119
private static $app = array
22-
(
20+
(
2321
'templates.path' => './app/view',
2422
'mode' => 'development',
2523
'debug' => false,
@@ -35,16 +33,16 @@ class Config
3533
'http.version' => '1.1',
3634
'language' => 'persian',
3735
'IpLocationApiAddress' => 'http://ip-api.com/json/',
38-
'encryptKeySize' => 32,
39-
'encryptSecretKey' => 'bc5b9275bd794ac47581114b66d14d81076',
36+
'cipher' => 'aes-128-cbc',
37+
'encryptSecretKey' => 'f080dd2e74286c45953d934380ebecbaf7708a9dd5580c1b70837106c5380915',
4038
'api_key_regenerate_time' => 60000,
4139
//CROSS DOMAIN REQUEST CONFIGURATION;
4240
'Cross-Domain-Request' => false,
43-
'Access-Control-Allow-Origin' => 'http://localhost:9000',
44-
'Access-Control-Allow-Methods'=>'GET, POST, PUT, DELETE, OPTIONS',
45-
'Access-Control-Allow-Headers'=>'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Token',
46-
'Access-Control-Allow-Credentials'=>'true',
47-
'JSON-Content-Type'=>'application/json; charset=utf-8',
41+
'Access-Control-Allow-Origin' => 'http://localhost:2000',
42+
'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS',
43+
'Access-Control-Allow-Headers' => 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Token',
44+
'Access-Control-Allow-Credentials' => 'true',
45+
'JSON-Content-Type' => 'application/json; charset=utf-8',
4846
);
4947

5048
private static $database = [
@@ -53,32 +51,30 @@ class Config
5351
'database' => '',
5452
'username' => '',
5553
'password' => '',
56-
'prefix' => '',
57-
'charset' => "utf8",
58-
'collation' => "utf8_unicode_ci"
54+
'prefix' => '',
55+
'charset' => "utf8",
56+
'collation' => "utf8_unicode_ci",
5957
];
6058

6159
public static function app($key = null)
6260
{
6361
self::$app['view'] = new \JsonView();
64-
self::$app['webDirectory'] = __DIR__.DIRECTORY_SEPARATOR.'../../web/';
65-
self::$app['rootDirectory'] = __DIR__.DIRECTORY_SEPARATOR.'../../';
66-
self::$app['uploadStorage'] = __DIR__.DIRECTORY_SEPARATOR.'../../web/uploads/';
67-
self::$app['languageDirectory'] = __DIR__.DIRECTORY_SEPARATOR.'../languages/';
68-
self::$app['rulesDirectory'] = __DIR__.DIRECTORY_SEPARATOR.'../rules/';
69-
self::$app['seedsDirectory'] = __DIR__.DIRECTORY_SEPARATOR.'../seeds/';
70-
self::$app['fakerAutoloader'] = __DIR__.DIRECTORY_SEPARATOR.'../../vendor/fzaninotto/faker/src/autoload.php';
71-
if(!is_null($key))
72-
{
62+
self::$app['webDirectory'] = __DIR__ . DIRECTORY_SEPARATOR . '../../web/';
63+
self::$app['rootDirectory'] = __DIR__ . DIRECTORY_SEPARATOR . '../../';
64+
self::$app['uploadStorage'] = __DIR__ . DIRECTORY_SEPARATOR . '../../web/uploads/';
65+
self::$app['languageDirectory'] = __DIR__ . DIRECTORY_SEPARATOR . '../languages/';
66+
self::$app['rulesDirectory'] = __DIR__ . DIRECTORY_SEPARATOR . '../rules/';
67+
self::$app['seedsDirectory'] = __DIR__ . DIRECTORY_SEPARATOR . '../seeds/';
68+
self::$app['fakerAutoloader'] = __DIR__ . DIRECTORY_SEPARATOR . '../../vendor/fzaninotto/faker/src/autoload.php';
69+
if (!is_null($key)) {
7370
return self::$app[$key];
7471
}
7572
return self::$app;
7673
}
7774
public static function database($key = null)
7875
{
79-
self::$database = require __DIR__.DIRECTORY_SEPARATOR."Database.php";
80-
if(!is_null($key))
81-
{
76+
self::$database = require __DIR__ . DIRECTORY_SEPARATOR . "Database.php";
77+
if (!is_null($key)) {
8278
return self::$database[$key];
8379
}
8480
return self::$database;

app/configs/Database.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
<?php
1+
<?php
22
return array
33
(
4-
'driver' => 'mysql',
5-
'host' => '127.0.0.1',
6-
'database' => 'science_access',
7-
'username' => 'root',
8-
'password' => 'root',
9-
'prefix' => '',
10-
'charset' => "utf8",
11-
'collation' => "utf8_unicode_ci"
12-
);
4+
'driver' => 'mysql',
5+
'host' => '127.0.0.1',
6+
'port' => '8889',
7+
'database' => 'firefly',
8+
'username' => 'root',
9+
'password' => 'root',
10+
'prefix' => '',
11+
'charset' => "utf8",
12+
'collation' => "utf8_unicode_ci",
13+
);

0 commit comments

Comments
 (0)