first commit
This commit is contained in:
44
admininistrator/controller/startup/application.php
Normal file
44
admininistrator/controller/startup/application.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Application
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Application extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
// Url
|
||||
$this->registry->set('url', new \Opencart\System\Library\Url($this->config->get('site_url')));
|
||||
|
||||
// Customer
|
||||
$this->registry->set('customer', new \Opencart\System\Library\Cart\Customer($this->registry));
|
||||
|
||||
// Currency
|
||||
$this->registry->set('currency', new \Opencart\System\Library\Cart\Currency($this->registry));
|
||||
|
||||
// Tax
|
||||
$this->registry->set('tax', new \Opencart\System\Library\Cart\Tax($this->registry));
|
||||
|
||||
if ($this->config->get('config_tax_default') == 'shipping') {
|
||||
$this->tax->setShippingAddress((int)$this->config->get('config_country_id'), (int)$this->config->get('config_zone_id'));
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax_default') == 'payment') {
|
||||
$this->tax->setPaymentAddress((int)$this->config->get('config_country_id'), (int)$this->config->get('config_zone_id'));
|
||||
}
|
||||
|
||||
$this->tax->setStoreAddress((int)$this->config->get('config_country_id'), (int)$this->config->get('config_zone_id'));
|
||||
|
||||
// Weight
|
||||
$this->registry->set('weight', new \Opencart\System\Library\Cart\Weight($this->registry));
|
||||
|
||||
// Length
|
||||
$this->registry->set('length', new \Opencart\System\Library\Cart\Length($this->registry));
|
||||
|
||||
// Cart
|
||||
$this->registry->set('cart', new \Opencart\System\Library\Cart\Cart($this->registry));
|
||||
}
|
||||
}
|
55
admininistrator/controller/startup/authorize.php
Normal file
55
admininistrator/controller/startup/authorize.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Authorize
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Authorize extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return object|\Opencart\System\Engine\Action|null
|
||||
*/
|
||||
public function index(): object|null {
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->cookie['authorize'])) {
|
||||
$token = (string)$this->request->cookie['authorize'];
|
||||
} else {
|
||||
$token = '';
|
||||
}
|
||||
|
||||
// Remove any method call for checking ignore pages.
|
||||
$pos = strrpos($route, '.');
|
||||
|
||||
if ($pos !== false) {
|
||||
$route = substr($route, 0, $pos);
|
||||
}
|
||||
|
||||
$ignore = [
|
||||
'common/login',
|
||||
'common/logout',
|
||||
'common/forgotten',
|
||||
'common/authorize'
|
||||
];
|
||||
|
||||
if ($this->config->get('config_security') && !in_array($route, $ignore)) {
|
||||
$this->load->model('user/user');
|
||||
|
||||
$token_info = $this->model_user_user->getAuthorizeByToken($this->user->getId(), $token);
|
||||
|
||||
if (!$token_info || !$token_info['status'] && $token_info['attempts'] <= 2) {
|
||||
return new \Opencart\System\Engine\Action('common/authorize');
|
||||
}
|
||||
|
||||
if ($token_info && !$token_info['status'] && $token_info['attempts'] > 2) {
|
||||
return new \Opencart\System\Engine\Action('common/authorize.unlock');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
85
admininistrator/controller/startup/error.php
Normal file
85
admininistrator/controller/startup/error.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Error
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Error extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
$this->registry->set('log', new \Opencart\System\Library\Log($this->config->get('config_error_filename') ? $this->config->get('config_error_filename') : $this->config->get('error_filename')));
|
||||
|
||||
set_error_handler([$this, 'error']);
|
||||
set_exception_handler([$this, 'exception']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @param string $message
|
||||
* @param string $file
|
||||
* @param string $line
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function error(string $code, string $message, string $file, string $line): bool {
|
||||
switch ($code) {
|
||||
case E_NOTICE:
|
||||
case E_USER_NOTICE:
|
||||
$error = 'Notice';
|
||||
break;
|
||||
case E_WARNING:
|
||||
case E_USER_WARNING:
|
||||
$error = 'Warning';
|
||||
break;
|
||||
case E_ERROR:
|
||||
case E_USER_ERROR:
|
||||
$error = 'Fatal Error';
|
||||
break;
|
||||
default:
|
||||
$error = 'Unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_error_log')) {
|
||||
$sting = 'PHP ' . $error . ': ' . $message . "\n";
|
||||
$sting .= 'File: ' . $file . "\n";
|
||||
$sting .= 'Line: ' . $line . "\n";
|
||||
|
||||
$this->log->write($sting);
|
||||
}
|
||||
|
||||
if ($this->config->get('config_error_display')) {
|
||||
echo '<b>' . $error . '</b>: ' . $message . ' in <b>' . $file . '</b> on line <b>' . $line . '</b>';
|
||||
} else {
|
||||
header('Location: ' . $this->config->get('error_page'));
|
||||
exit();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $e
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exception(\Throwable $e): void {
|
||||
if ($this->config->get('config_error_log')) {
|
||||
$sting = $e->getCode() . ': ' . $e->getMessage() . "\n";
|
||||
$sting .= 'File: ' . $e->getFile() . "\n";
|
||||
$sting .= 'Line: ' . $e->getLine() . "\n";
|
||||
|
||||
$this->log->write($sting);
|
||||
}
|
||||
|
||||
if ($this->config->get('config_error_display')) {
|
||||
echo '<b>' . $e->getMessage() . '</b>: in <b>' . $e->getFile() . '</b> on line <b>' . $e->getLine() . '</b>';
|
||||
} else {
|
||||
header('Location: ' . $this->config->get('error_page'));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
34
admininistrator/controller/startup/event.php
Normal file
34
admininistrator/controller/startup/event.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Event
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Event extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
// Add events from the DB
|
||||
$this->load->model('setting/event');
|
||||
|
||||
$results = $this->model_setting_event->getEvents();
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result['status']) {
|
||||
$part = explode('/', $result['trigger']);
|
||||
|
||||
if ($part[0] == 'admin') {
|
||||
array_shift($part);
|
||||
|
||||
$this->event->register(implode('/', $part), new \Opencart\System\Engine\Action($result['action']), $result['sort_order']);
|
||||
}
|
||||
|
||||
if ($part[0] == 'system') {
|
||||
$this->event->register($result['trigger'], new \Opencart\System\Engine\Action($result['action']), $result['sort_order']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
admininistrator/controller/startup/extension.php
Normal file
36
admininistrator/controller/startup/extension.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Extension
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Extension extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
// Add extension paths from the DB
|
||||
$this->load->model('setting/extension');
|
||||
|
||||
$results = $this->model_setting_extension->getInstalls();
|
||||
|
||||
foreach ($results as $result) {
|
||||
$extension = str_replace(['_', '/'], ['', '\\'], ucwords($result['code'], '_/'));
|
||||
|
||||
// Register controllers, models and system extension folders
|
||||
$this->autoloader->register('Opencart\Admin\Controller\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/admin/controller/');
|
||||
$this->autoloader->register('Opencart\Admin\Model\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/admin/model/');
|
||||
$this->autoloader->register('Opencart\System\Library\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/system/library/');
|
||||
|
||||
// Template directory
|
||||
$this->template->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/admin/view/template/');
|
||||
|
||||
// Language directory
|
||||
$this->language->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/admin/language/');
|
||||
|
||||
// Config directory
|
||||
$this->config->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/system/config/');
|
||||
}
|
||||
}
|
||||
}
|
79
admininistrator/controller/startup/language.php
Normal file
79
admininistrator/controller/startup/language.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Language
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Language extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static array $languages = [];
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
if (isset($this->request->cookie['language'])) {
|
||||
$code = (string)$this->request->cookie['language'];
|
||||
} else {
|
||||
$code = $this->config->get('config_language_admin');
|
||||
}
|
||||
|
||||
$this->load->model('localisation/language');
|
||||
|
||||
self::$languages = $this->model_localisation_language->getLanguages();
|
||||
|
||||
if (isset(self::$languages[$code])) {
|
||||
$language_info = self::$languages[$code];
|
||||
|
||||
// Language
|
||||
if ($language_info['extension']) {
|
||||
$this->language->addPath('extension/' . $language_info['extension'], DIR_EXTENSION . $language_info['extension'] . '/admin/language/');
|
||||
}
|
||||
|
||||
// Set the config language_id key
|
||||
$this->config->set('config_language_id', $language_info['language_id']);
|
||||
$this->config->set('config_language_admin', $language_info['code']);
|
||||
|
||||
$this->load->language('default');
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the language up with default values
|
||||
|
||||
/**
|
||||
* @param $route
|
||||
* @param $prefix
|
||||
* @param $code
|
||||
* @param $output
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function after(&$route, &$prefix, &$code, &$output): void {
|
||||
if (!$code) {
|
||||
$code = $this->config->get('config_language_admin');
|
||||
}
|
||||
|
||||
// Use $this->language->load so it's not triggering infinite loops
|
||||
$this->language->load($route, $prefix, $code);
|
||||
|
||||
if (isset(self::$languages[$code])) {
|
||||
$language_info = self::$languages[$code];
|
||||
|
||||
$path = '';
|
||||
|
||||
if ($language_info['extension']) {
|
||||
$extension = 'extension/' . $language_info['extension'];
|
||||
|
||||
if (oc_substr($route, 0, strlen($extension)) != $extension) {
|
||||
$path = $extension . '/';
|
||||
}
|
||||
}
|
||||
|
||||
// Use $this->language->load so it's not triggering infinite loops
|
||||
$this->language->load($path . $route, $prefix, $code);
|
||||
}
|
||||
}
|
||||
}
|
54
admininistrator/controller/startup/login.php
Normal file
54
admininistrator/controller/startup/login.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Login
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Login extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return object|\Opencart\System\Engine\Action|null
|
||||
*/
|
||||
public function index(): object|null {
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = '';
|
||||
}
|
||||
|
||||
// Remove any method call for checking ignore pages.
|
||||
$pos = strrpos($route, '.');
|
||||
|
||||
if ($pos !== false) {
|
||||
$route = substr($route, 0, $pos);
|
||||
}
|
||||
|
||||
$ignore = [
|
||||
'common/login',
|
||||
'common/forgotten',
|
||||
'common/language'
|
||||
];
|
||||
|
||||
// User
|
||||
$this->registry->set('user', new \Opencart\System\Library\Cart\User($this->registry));
|
||||
|
||||
if (!$this->user->isLogged() && !in_array($route, $ignore)) {
|
||||
return new \Opencart\System\Engine\Action('common/login');
|
||||
}
|
||||
|
||||
$ignore = [
|
||||
'common/login',
|
||||
'common/logout',
|
||||
'common/forgotten',
|
||||
'common/language',
|
||||
'error/not_found',
|
||||
'error/permission'
|
||||
];
|
||||
|
||||
if (!in_array($route, $ignore) && (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token']))) {
|
||||
return new \Opencart\System\Engine\Action('common/login');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
56
admininistrator/controller/startup/notification.php
Normal file
56
admininistrator/controller/startup/notification.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Common;
|
||||
/**
|
||||
* Class Notification
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Notification extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
if (empty($this->request->cookie['notification'])) {
|
||||
$curl = curl_init();
|
||||
|
||||
// Gets the latest information from opencart.com about news, updates and security.
|
||||
curl_setopt($curl, CURLOPT_URL, OPENCART_SERVER . 'index.php?route=api/notification');
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_HEADER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
if ($response) {
|
||||
$notification = json_decode($response, true);
|
||||
} else {
|
||||
$notification = '';
|
||||
}
|
||||
|
||||
if (isset($notification['notification'])) {
|
||||
foreach ($notification['notifications'] as $result) {
|
||||
$notification_info = $this->model_notification->addNotification($result['notification_id']);
|
||||
|
||||
if (!$notification_info) {
|
||||
$this->model_notification->addNotification($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only grab the
|
||||
$option = [
|
||||
'expires' => time() + 3600 * 24 * 7,
|
||||
'path' => $this->config->get('session_path'),
|
||||
'secure' => $this->request->server['HTTPS'],
|
||||
'httponly' => false,
|
||||
'SameSite' => $this->config->get('config_session_samesite')
|
||||
];
|
||||
|
||||
setcookie('notification', true, $option);
|
||||
}
|
||||
}
|
||||
}
|
41
admininistrator/controller/startup/permission.php
Normal file
41
admininistrator/controller/startup/permission.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Permission
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Permission extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return object|\Opencart\System\Engine\Action|null
|
||||
*/
|
||||
public function index(): object|null {
|
||||
if (isset($this->request->get['route'])) {
|
||||
$pos = strrpos($this->request->get['route'], '.');
|
||||
|
||||
if ($pos === false) {
|
||||
$route = $this->request->get['route'];
|
||||
} else {
|
||||
$route = substr($this->request->get['route'], 0, $pos);
|
||||
}
|
||||
|
||||
// We want to ignore some pages from having its permission checked.
|
||||
$ignore = [
|
||||
'common/dashboard',
|
||||
'common/login',
|
||||
'common/logout',
|
||||
'common/forgotten',
|
||||
'common/authorize',
|
||||
'common/language',
|
||||
'error/not_found',
|
||||
'error/permission'
|
||||
];
|
||||
|
||||
if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $route)) {
|
||||
return new \Opencart\System\Engine\Action('error/permission');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
44
admininistrator/controller/startup/sass.php
Normal file
44
admininistrator/controller/startup/sass.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Sass
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Sass extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
* @throws \ScssPhp\ScssPhp\Exception\SassException
|
||||
*/
|
||||
public function index(): void {
|
||||
$files = glob(DIR_APPLICATION . 'view/stylesheet/*.scss');
|
||||
|
||||
if ($files) {
|
||||
foreach ($files as $file) {
|
||||
// Get the filename
|
||||
$filename = basename($file, '.scss');
|
||||
|
||||
$stylesheet = DIR_APPLICATION . 'view/stylesheet/' . $filename . '.css';
|
||||
|
||||
if (!is_file($stylesheet) || !$this->config->get('developer_sass')) {
|
||||
$scss = new \ScssPhp\ScssPhp\Compiler();
|
||||
$scss->setImportPaths(DIR_APPLICATION . 'view/stylesheet/');
|
||||
|
||||
$output = $scss->compileString('@import "' . $filename . '.scss"')->getCss();
|
||||
|
||||
$handle = fopen($stylesheet, 'w');
|
||||
|
||||
flock($handle, LOCK_EX);
|
||||
|
||||
fwrite($handle, $output);
|
||||
|
||||
fflush($handle);
|
||||
|
||||
flock($handle, LOCK_UN);
|
||||
|
||||
fclose($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
admininistrator/controller/startup/session.php
Normal file
41
admininistrator/controller/startup/session.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Session
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Session extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(): void {
|
||||
$session = new \Opencart\System\Library\Session($this->config->get('session_engine'), $this->registry);
|
||||
$this->registry->set('session', $session);
|
||||
|
||||
if (isset($this->request->cookie[$this->config->get('session_name')])) {
|
||||
$session_id = $this->request->cookie[$this->config->get('session_name')];
|
||||
} else {
|
||||
$session_id = '';
|
||||
}
|
||||
|
||||
$session->start($session_id);
|
||||
|
||||
// Update the session lifetime
|
||||
if ($this->config->get('config_session_expire')) {
|
||||
$this->config->set('session_expire', $this->config->get('config_session_expire'));
|
||||
}
|
||||
|
||||
// Require higher security for session cookies
|
||||
$option = [
|
||||
'expires' => $this->config->get('config_session_expire') ? time() + (int)$this->config->get('config_session_expire') : 0,
|
||||
'path' => $this->config->get('session_path'),
|
||||
'secure' => $this->request->server['HTTPS'],
|
||||
'httponly' => false,
|
||||
'SameSite' => $this->config->get('config_session_samesite')
|
||||
];
|
||||
|
||||
setcookie($this->config->get('session_name'), $session->getId(), $option);
|
||||
}
|
||||
}
|
39
admininistrator/controller/startup/setting.php
Normal file
39
admininistrator/controller/startup/setting.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Setting
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Setting extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
$this->load->model('setting/setting');
|
||||
|
||||
// Settings
|
||||
$results = $this->model_setting_setting->getSettings(0);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (!$result['serialized']) {
|
||||
$this->config->set($result['key'], $result['value']);
|
||||
} else {
|
||||
$this->config->set($result['key'], json_decode($result['value'], true));
|
||||
}
|
||||
}
|
||||
|
||||
// Set time zone
|
||||
if ($this->config->get('config_timezone')) {
|
||||
date_default_timezone_set($this->config->get('config_timezone'));
|
||||
|
||||
// Sync PHP and DB time zones.
|
||||
$this->db->query("SET time_zone = '" . $this->db->escape(date('P')) . "'");
|
||||
}
|
||||
|
||||
// Response output compression level
|
||||
if ($this->config->get('config_compression')) {
|
||||
$this->response->setCompression((int)$this->config->get('config_compression'));
|
||||
}
|
||||
}
|
||||
}
|
24
admininistrator/controller/startup/startup.php
Normal file
24
admininistrator/controller/startup/startup.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Opencart\Admin\Controller\Startup;
|
||||
/**
|
||||
* Class Startup
|
||||
*
|
||||
* @package Opencart\Admin\Controller\Startup
|
||||
*/
|
||||
class Startup extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function index(): void {
|
||||
// Load startup actions
|
||||
$this->load->model('setting/startup');
|
||||
|
||||
$results = $this->model_setting_startup->getStartups();
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ((substr($result['action'], 0, 6) == 'admin/') && $result['status']) {
|
||||
$this->load->controller(substr($result['action'], 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user