Skip to content

Commit

Permalink
Small optimizations & Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
DaRock committed Jan 26, 2020
1 parent 10a3fa8 commit d18802d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,25 @@ check Laravel requirements because they may differ depending on the used version
4. `cd core/`
5. `composer update`
6. `php artisan key:generate`
7. `php artisan migrate:install`
8. `php artisan migrate`
7. `php artisan migrate`
8. `php artisan opencore:register-routes`
9. copy OpenCart extension files from core/opencart-module/(2.x|3.x)/upload to you OpenCart root folder
10. go to OpenCart admin panel / extensions / extensions / modules, find OpenCore module and install it
11. click on the OpenCore icon from admin / left column / section "System Requirements" and make sure there's nothing marked with red
12. Optional: in order to enable Developer & Example modules you need to access admin / user / user groups section and add permission for them

Enjoy!

## Update

1. `cd core/`
2. `git update`
3. `composer update`
4. `php artisan migrate`
5. `php artisan opencore:register-routes`
6. copy OpenCart extension files from core/opencart-module/(2.x|3.x)/upload to you OpenCart root folder
7. Optional: go to OpenCart / extensions / modules, disable and then re-enable the OpenCore module

## How does it works ?

Let's take this file from OpenCart system: `/admin/controller/common/header.php`
Expand Down Expand Up @@ -109,6 +119,7 @@ MIT license. Please see the [license file](LICENSE) for more information.

## TODO

* create a console command for faster instalation / update
* force paginator->appends to automatically add token/user_token param for admin requests only
* when enabling a module the permission must be added automatically for the user who made the action
* Example & Developer modules should be disabled by default
Expand Down
4 changes: 2 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
//App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Expand All @@ -195,7 +195,7 @@
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
//'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
Expand Down
20 changes: 7 additions & 13 deletions support/Opencart/Startup.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,34 +147,28 @@ public function checkOpenCoreRoute()

$requestMethod = $_SERVER['REQUEST_METHOD'];
if (!empty($allowed_routes[$requestMethod])) {
if (in_array($this->route, $allowed_routes[$requestMethod])) {
return true;
}

foreach ($allowed_routes[$requestMethod] as $route) {
if (preg_match_all('/\{(.*?)\??\}/', $route, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
foreach ($matches[0] as $match) {
$remainingUri = substr($this->route, $match[1], strlen($this->route));
$getSamePartFromRoute = strtok($remainingUri, '/');
$route = substr_replace($route, $getSamePartFromRoute, $match[1], strlen($match[0]));
}
}

if ($route === $this->route) {
return true;
if ($route === $this->route) {
return true;
}
}
}
}

return false;
}

/**
* Run function
*
* @execute Framewrok
*/
public function run()
{
Framework::getInstance()->run();
}

/**
* Framework Response function
*/
Expand Down

0 comments on commit d18802d

Please sign in to comment.