@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $setting = Config::get('settings.auth'); |
| 55 | 55 | if(1 || $setting['2step']){ |
| 56 | 56 | return $this->twoStepAuth($loginField,$password); |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | if ($this->checkPass($password,$user->password)) { |
| 59 | 59 | $_SESSION['user']['user_id'] = $user->id; |
| 60 | 60 | $_SESSION['user']['mobile'] = $user->mobile; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'type'=>'success', |
| 63 | 63 | 'message'=> 'Logined', |
| 64 | 64 | ]; |
| 65 | - }else{ |
|
| 65 | + } else{ |
|
| 66 | 66 | return [ |
| 67 | 67 | 'type'=>'error', |
| 68 | 68 | 'message'=> 'password mismatch', |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'type'=>'success', |
| 99 | 99 | 'message'=> 'Logined', |
| 100 | 100 | ]; |
| 101 | - }else{ |
|
| 101 | + } else{ |
|
| 102 | 102 | return [ |
| 103 | 103 | 'type'=>'error', |
| 104 | 104 | 'message'=> 'problem!', |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function user() |
| 19 | 19 | { |
| 20 | - if(!isset($_SESSION['user']) && json_decode($_COOKIE['user'],true) !== null){ |
|
| 21 | - $_SESSION['user'] = json_decode($_COOKIE['user'],true); |
|
| 20 | + if (!isset($_SESSION['user']) && json_decode($_COOKIE['user'], true) !== null) { |
|
| 21 | + $_SESSION['user'] = json_decode($_COOKIE['user'], true); |
|
| 22 | 22 | } |
| 23 | 23 | return UserDataAccess::getUserById(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function hasRole($roleName) |
| 27 | 27 | { |
| 28 | - if(!self::check()){ |
|
| 28 | + if (!self::check()) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | - $userRoles = UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
|
| 31 | + $userRoles = UserDataAccess::getUserRoles(isset($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : 0); |
|
| 32 | 32 | $hasAccess = false; |
| 33 | - foreach ($userRoles as $role){ |
|
| 34 | - if($role->name == $roleName){ |
|
| 33 | + foreach ($userRoles as $role) { |
|
| 34 | + if ($role->name == $roleName) { |
|
| 35 | 35 | $hasAccess = true; |
| 36 | 36 | break; |
| 37 | 37 | } |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function check() |
| 44 | 44 | { |
| 45 | - if(!isset($_SESSION['user']) && json_decode($_COOKIE['user'],true) !== null){ |
|
| 46 | - $_SESSION['user'] = json_decode($_COOKIE['user'],true); |
|
| 45 | + if (!isset($_SESSION['user']) && json_decode($_COOKIE['user'], true) !== null) { |
|
| 46 | + $_SESSION['user'] = json_decode($_COOKIE['user'], true); |
|
| 47 | 47 | } |
| 48 | 48 | return isset($_SESSION['user']['user_id']); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function attempt(string $loginField,string $password) |
|
| 51 | + public function attempt(string $loginField, string $password) |
|
| 52 | 52 | { |
| 53 | 53 | $user = UserDataAccess::getUserLoginField($loginField); |
| 54 | 54 | if (!$user) { |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | ]; |
| 59 | 59 | } |
| 60 | 60 | $setting = Config::get('settings.auth'); |
| 61 | - if(1 || $setting['2step']){ |
|
| 62 | - return $this->twoStepAuth($loginField,$password); |
|
| 63 | - }else{ |
|
| 64 | - if ($this->checkPass($password,$user->password)) { |
|
| 61 | + if (1 || $setting['2step']) { |
|
| 62 | + return $this->twoStepAuth($loginField, $password); |
|
| 63 | + }else { |
|
| 64 | + if ($this->checkPass($password, $user->password)) { |
|
| 65 | 65 | $_SESSION['user']['user_id'] = $user->id; |
| 66 | 66 | $_SESSION['user']['mobile'] = $user->mobile; |
| 67 | 67 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'type'=>'success', |
| 76 | 76 | 'message'=> 'Logined', |
| 77 | 77 | ]; |
| 78 | - }else{ |
|
| 78 | + }else { |
|
| 79 | 79 | return [ |
| 80 | 80 | 'type'=>'error', |
| 81 | 81 | 'message'=> 'password mismatch', |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | |
| 93 | - public function checkPass($password,$database_pass) |
|
| 93 | + public function checkPass($password, $database_pass) |
|
| 94 | 94 | { |
| 95 | - if($database_pass == $password){ |
|
| 95 | + if ($database_pass == $password) { |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | return false; |
@@ -100,10 +100,10 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - public function twoStepAuth(string $loginField,string $password) |
|
| 103 | + public function twoStepAuth(string $loginField, string $password) |
|
| 104 | 104 | { |
| 105 | 105 | $user = UserDataAccess::getUserLoginField($loginField); |
| 106 | - if(UserDataAccess::checkToken($password,$loginField)){ |
|
| 106 | + if (UserDataAccess::checkToken($password, $loginField)) { |
|
| 107 | 107 | $_SESSION['user']['user_id'] = $user->id; |
| 108 | 108 | $_SESSION['user']['mobile'] = $user->mobile; |
| 109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'type'=>'success', |
| 118 | 118 | 'message'=> 'Logined', |
| 119 | 119 | ]; |
| 120 | - }else{ |
|
| 120 | + }else { |
|
| 121 | 121 | return [ |
| 122 | 122 | 'type'=>'error', |
| 123 | 123 | 'message'=> 'problem!', |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | 3 | // Renderer settings |
| 4 | - 'view' => [ |
|
| 5 | - 'blade_template_path' => '../app/View/', // String or array of multiple paths |
|
| 6 | - 'blade_cache_path' => '../app/View/cache', // Mandatory by default, though could probably turn caching off for development |
|
| 7 | - 'template' => 'blade', // template name |
|
| 8 | - ], |
|
| 4 | + 'view' => [ |
|
| 5 | + 'blade_template_path' => '../app/View/', // String or array of multiple paths |
|
| 6 | + 'blade_cache_path' => '../app/View/cache', // Mandatory by default, though could probably turn caching off for development |
|
| 7 | + 'template' => 'blade', // template name |
|
| 8 | + ], |
|
| 9 | 9 | ]; |
| 10 | 10 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if($config['settings']['app']['debug'] && $config['settings']['tracy']['active']) { |
|
| 2 | +if ($config['settings']['app']['debug'] && $config['settings']['tracy']['active']) { |
|
| 3 | 3 | $app->add(new RunTracy\Middlewares\TracyMiddleware($app)); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | 'displayErrorDetails' => true, |
| 6 | 6 | 'addContentLengthHeader' => true, |
| 7 | 7 | 'determineRouteBeforeAppMiddleware' => true, |
| 8 | - 'debug'=>true , |
|
| 8 | + 'debug'=>true, |
|
| 9 | 9 | 'image' => [ |
| 10 | 10 | 'dir' => $APPROOT . '/public/uploads' |
| 11 | 11 | ], |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | 'showSlimEnvironmentPanel' => 1, |
| 10 | 10 | 'showSlimRequestPanel' => 1, |
| 11 | 11 | 'showSlimResponsePanel' => 1, |
| 12 | - 'showSlimContainer' =>1 , |
|
| 12 | + 'showSlimContainer' =>1, |
|
| 13 | 13 | 'showEloquentORMPanel' => 1, |
| 14 | - 'showIdiormPanel' => 1,// > 0 mean you enable logging |
|
| 14 | + 'showIdiormPanel' => 1, // > 0 mean you enable logging |
|
| 15 | 15 | // but show or not panel you decide in browser in panel selector |
| 16 | - 'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name |
|
| 16 | + 'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name |
|
| 17 | 17 | // and also as above show or not panel you decide in browser in panel selector |
| 18 | 18 | 'showProfilerPanel' => 1, |
| 19 | 19 | 'showVendorVersionsPanel' => 1, |
@@ -2,15 +2,15 @@ |
||
| 2 | 2 | return [ |
| 3 | 3 | 'databases'=>[ |
| 4 | 4 | 'db' => [ |
| 5 | - 'driver' => $env(__APP_ROOT__,'DB_DRIVER', 'mysql'), |
|
| 6 | - 'host' => $env(__APP_ROOT__,'DB_HOST', 'localhost'), |
|
| 7 | - 'database' => $env(__APP_ROOT__,'DB_NAME', 'cafesaba'), |
|
| 8 | - 'username' => $env(__APP_ROOT__,'DB_USERNAME', 'root'), |
|
| 9 | - 'password' => $env(__APP_ROOT__,'DB_PASS', ''), |
|
| 10 | - 'charset' => $env(__APP_ROOT__,'DB_CHARSET', 'utf8'), |
|
| 11 | - 'collation' => $env(__APP_ROOT__,'DB_COLLATION', 'utf8_unicode_ci'), |
|
| 12 | - 'prefix' => $env(__APP_ROOT__,'DB_PREFIX', ''), |
|
| 13 | - 'port' => $env(__APP_ROOT__,'DB_PORT', 3306), |
|
| 5 | + 'driver' => $env(__APP_ROOT__, 'DB_DRIVER', 'mysql'), |
|
| 6 | + 'host' => $env(__APP_ROOT__, 'DB_HOST', 'localhost'), |
|
| 7 | + 'database' => $env(__APP_ROOT__, 'DB_NAME', 'cafesaba'), |
|
| 8 | + 'username' => $env(__APP_ROOT__, 'DB_USERNAME', 'root'), |
|
| 9 | + 'password' => $env(__APP_ROOT__, 'DB_PASS', ''), |
|
| 10 | + 'charset' => $env(__APP_ROOT__, 'DB_CHARSET', 'utf8'), |
|
| 11 | + 'collation' => $env(__APP_ROOT__, 'DB_COLLATION', 'utf8_unicode_ci'), |
|
| 12 | + 'prefix' => $env(__APP_ROOT__, 'DB_PREFIX', ''), |
|
| 13 | + 'port' => $env(__APP_ROOT__, 'DB_PORT', 3306), |
|
| 14 | 14 | ], |
| 15 | 15 | ] |
| 16 | 16 | ]; |
| 17 | 17 | \ No newline at end of file |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | use Illuminate\Database\Capsule\Manager as Capsule; |
| 7 | 7 | $env = new \Core\Helpers\Env(); |
| 8 | 8 | $config = include 'databases.php'; |
| 9 | -$capsule = new Capsule; |
|
| 9 | +$capsule = new Capsule; |
|
| 10 | 10 | $capsule->addConnection($config['databases']['db']); |
| 11 | 11 | $capsule->setAsGlobal(); |
| 12 | 12 | $capsule->bootEloquent(); |
| 13 | 13 | $container = new ArrayObject(); |
| 14 | 14 | $container['phpmig.adapter'] = new Adapter\Illuminate\Database($capsule, 'migrations'); |
| 15 | -$container['phpmig.migrations_path'] = 'database/migrations'; |
|
| 15 | +$container['phpmig.migrations_path'] = 'database/migrations'; |
|
| 16 | 16 | $container['phpmig.migrations_template_path'] = 'core/resources/templates/create_migration.txt'; |
| 17 | 17 | return $container; |
| 18 | 18 | \ No newline at end of file |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | 'displayErrorDetails' => true, |
| 6 | 6 | 'app' => [ |
| 7 | 7 | 'log_timer' => true, |
| 8 | - 'debug'=>true , |
|
| 8 | + 'debug'=>true, |
|
| 9 | 9 | 'image' => [ |
| 10 | 10 | 'dir' => __APP_ROOT__ . 'public/uploads' |
| 11 | 11 | ], |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | 'm' => [400,250,70], |
| 11 | 11 | 'l' => [800,600,80], |
| 12 | 12 | 'thumb' => [250, 250,80,true], |
| 13 | - ], |
|
| 13 | + ], |
|
| 14 | 14 | ], |
| 15 | 15 | 'category_photo' => [ |
| 16 | 16 | 'dimensions' => [ |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | 'l' => [800,600,80], |
| 19 | 19 | 'thumb' => [250, 250,80,true], |
| 20 | 20 | 's' => [150, 80,80], |
| 21 | - ], |
|
| 21 | + ], |
|
| 22 | 22 | ], |
| 23 | 23 | 'minquality' => 200 // kamtar az in width va height nemigirim |
| 24 | 24 | ] |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | 'quality' => 100, |
| 8 | 8 | 'user_photo' => [ |
| 9 | 9 | 'dimensions' => [ |
| 10 | - 'm' => [400,250,70], |
|
| 11 | - 'l' => [800,600,80], |
|
| 12 | - 'thumb' => [250, 250,80,true], |
|
| 10 | + 'm' => [400, 250, 70], |
|
| 11 | + 'l' => [800, 600, 80], |
|
| 12 | + 'thumb' => [250, 250, 80, true], |
|
| 13 | 13 | ], |
| 14 | 14 | ], |
| 15 | 15 | 'category_photo' => [ |
| 16 | 16 | 'dimensions' => [ |
| 17 | - 'm' => [400,250,70], |
|
| 18 | - 'l' => [800,600,80], |
|
| 19 | - 'thumb' => [250, 250,80,true], |
|
| 20 | - 's' => [150, 80,80], |
|
| 17 | + 'm' => [400, 250, 70], |
|
| 18 | + 'l' => [800, 600, 80], |
|
| 19 | + 'thumb' => [250, 250, 80, true], |
|
| 20 | + 's' => [150, 80, 80], |
|
| 21 | 21 | ], |
| 22 | 22 | ], |
| 23 | 23 | 'minquality' => 200 // kamtar az in width va height nemigirim |