示例#1
0
 public function dispatch()
 {
     # B/C start
     global $registry;
     $registry = $this->registry;
     global $config;
     $config = $this->registry->get('config');
     global $db;
     $db = $this->registry->get('db');
     global $log;
     $log = $this->registry->get('log');
     global $loader;
     $loader = $this->registry->get('load');
     # B/C end
     // Front Controller
     $controller = new Front($this->registry);
     // Maintenance Mode
     $controller->addPreAction(new Action('common/maintenance'));
     // Router
     if (isset($this->request->get['route'])) {
         $action = new Action($this->request->get['route']);
     } else {
         $action = new Action('common/home');
     }
     // Dispatch
     $controller->dispatch($action, new Action('error/not_found'));
     // Set the page cache if enabled
     $this->pagecache->setPage($this->response);
     $this->trigger->fire('post.app.dispatch');
 }
示例#2
0
文件: index.php 项目: siiwi/siiwi.com
$config = new Config();
$config->load('message');
$registry->set('config', $config);
foreach ($_config as $key => $value) {
    $config->set($key, $value);
}
// Database
$db = new \Siiwi\Api\DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);
// Request
$request = new \Siiwi\Api\Request();
$registry->set('request', $request);
// Response
$response = new \Siiwi\Api\Response();
$response->addHeader('Access-Control-Allow-Origin: *');
$response->addHeader('Content-Type: application/json; charset=utf-8');
$response->setCompression($config->get('config_compression'));
$response->setMessage($config->get('api'));
$response->setRequest($request->get['route']);
$registry->set('response', $response);
// Front Controller
$controller = new Front($registry);
// Signature
$controller->addPreAction(new Action('signature/verify'));
// Router
$route = isset($request->get['route']) ? $request->get['route'] : 'common/error';
$action = new Action($route);
// Dispatch
$controller->dispatch($action, new Action('common/error'));
// Output
$response->output();
示例#3
0
 public function dispatch()
 {
     # B/C start
     global $registry;
     $registry = $this->registry;
     global $config;
     $config = $this->registry->get('config');
     global $db;
     $db = $this->registry->get('db');
     global $log;
     $log = $this->registry->get('log');
     # B/C end
     if (!$this->canAccessAdmin()) {
         $catalog = Client::isAdmin() ? HTTPS_CATALOG : HTTPS_SERVER;
         $this->response->redirect($catalog);
     }
     // Front Controller
     $controller = new Front($this->registry);
     // Login
     $controller->addPreAction(new Action('common/login/check'));
     // Permission
     $controller->addPreAction(new Action('error/permission/check'));
     // Router
     if (isset($this->request->get['route'])) {
         $action = new Action($this->request->get['route']);
     } else {
         $action = new Action('common/dashboard');
     }
     // Dispatch
     $controller->dispatch($action, new Action('error/not_found'));
     $this->trigger->fire('post.app.dispatch');
 }
示例#4
0
    setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $request->server['HTTP_HOST']);
}
$config->set('config_language_id', $languages[$code]['language_id']);
$config->set('config_language', $languages[$code]['code']);
// Language
$language = new Language($languages[$code]['directory']);
$language->load($languages[$code]['filename']);
$registry->set('language', $language);
// Customer
$registry->set('customer', new Customer($registry));
// Currency
$registry->set('currency', new Currency($registry));
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Front Controller
$controller = new Front($registry);
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
$route = 'payment/tenpay/callback';
$action = new Action($route);
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#5
0
// Currency
$registry->set('currency', new Sumo\Currency($registry));
// Tax
$registry->set('tax', new Sumo\Tax($registry));
// Weight
$registry->set('weight', new Sumo\Weight($registry));
// Length
$registry->set('length', new Sumo\Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('encryption')));
// Front Controller
$controller = new Front($registry);
// SEO URL's
$controller->addPreAction(new Sumo\Action('common/seo_url'));
// Router
if (!isset($request->get['route']) && isset($request->get['_route_'])) {
    $request->get['route'] = $request->get['_route_'];
}
// Maintenance Mode
$controller->addPreAction(new Sumo\Action('common/maintenance/index'));
if (isset($request->get['route'])) {
    $action = new Sumo\Action(strtolower($request->get['route']));
} else {
    $action = new Sumo\Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Sumo\Action('error/not_found'));
// Output
$output = $response->output(true);
示例#6
0
$registry->set('request', new Request());
// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$registry->set('response', $response);
// Session
$session = new Session();
$session->start();
$registry->set('session', $session);
// Cache
$registry->set('cache', new Cache('file'));
// Url
$registry->set('url', new Url($_SERVER['HTTP_HOST']));
// Event
$registry->set('event', new Event($registry));
// Language
$registry->set('language', new Language('en-gb'));
// Document
$registry->set('document', new Document());
// Front Controller
$controller = new Front($registry);
// Pre Action
if ($config->has('config_pre_action')) {
    foreach ($config->get('config_pre_action') as $action) {
        $controller->addPreAction(new Action($action));
    }
}
// Dispatch
$controller->dispatch(new Action('action/route'), new Action('error/not_found'));
// Output
$response->output();
示例#7
0
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Login
$controller->addPreAction(new Action('common/login/check'));
// Permission
$controller->addPreAction(new Action('error/permission/check'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#8
0
$config->set('config_language_id', $languages[$config->get('config_admin_language')]['language_id']);
$language = new Language($languages[$config->get('config_admin_language')]['directory']);
$language->load($languages[$config->get('config_admin_language')]['filename']);
$registry->set('language', $language);
// Currency
$currency = new Currency($registry);
// always RU
$currency->set('RUB');
//$symbol_right = trim($currency->getSymbolRight('RUB'));
//$currency->setSymbolRight('RUB', '<span class="ru">&nbsp;&#1041;</span>');
$registry->set('currency', $currency);
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Front Controller
$controller = new Front($registry);
//require_once(DIR_APPLICATION . 'controller/feed/yandex_yml.php');
//$controller = new ControllerFeedYandexYml($registry);
// SEO URL's
if (!($seo_type = $config->get('config_seo_url_type'))) {
    $seo_type = 'seo_url';
}
$controller->addPreAction(new Action('common/' . $seo_type));
$action = new Action('feed/yandex_yml3/savetofile', array(dirname(__FILE__) . '/yandex_yml3.xml'));
$controller->dispatch($action, '');
//$controller->saveToFile(dirname(__FILE__).'/yandex_yml.xml');
示例#9
0
// Url
Registry::set('url', new Url());
// Document
Registry::set('document', new Document());
// Language
$language = new Language($config->get('config_admin_language'));
Registry::set('language', $language);
// Currency
Registry::set('currency', new Currency());
// Weight
Registry::set('weight', new Weight());
// Measurement
Registry::set('measurement', new Measurement());
// User
Registry::set('user', new User());
// Front Controller
$controller = new Front();
// Login
$controller->addPreAction(new Router('common/login/check'));
// Permission
$controller->addPreAction(new Router('common/permission/check'));
// Router
if (isset($request->get['route'])) {
    $action = new Router($request->get['route']);
} else {
    $action = new Router('common/home');
}
// Dispatch
$controller->dispatch($action, new Router('error/not_found'));
// Output
$response->output();
示例#10
0
// Cart
$registry->set('cart', new Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Check Login
$controller->addPreAction(new Action('account/login/check'));
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#11
0
文件: index.php 项目: mif32/opencart
// Currency
$registry->set('currency', new Cart\Currency($registry));
// Weight
$registry->set('weight', new Cart\Weight($registry));
// Length
$registry->set('length', new Cart\Length($registry));
// User
$registry->set('user', new Cart\User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'admin/%'");
foreach ($query->rows as $result) {
    $event->register(substr($result['trigger'], strrpos($result['trigger'], '/') + 1), new Action($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Error Handling
$controller->addPreAction(new Action('event/error'));
// Compile Sass
$controller->addPreAction(new Action('event/sass'));
// Login
$controller->addPreAction(new Action('event/login'));
// Permission
$controller->addPreAction(new Action('event/permission'));
// Dispatch
$controller->dispatch(new Action('event/route'), new Action('error/not_found'));
// Output
$response->output();
示例#12
0
$registry->set('protocol', $protocol);
//security
$registry->set('security', new Security());
//url
$url = new Url(HTTP_SERVER);
$registry->set('url', $url);
// Cache
$cache = new Cache('file');
$registry->set('cache', $cache);
//token
$token = new Token();
$registry->set('token', $token);
//statistik
$statistik = new statistik($registry);
$registry->set('statistik', $statistik);
//click counter
$counter = new counter($registry);
$registry->set('counter', $counter);
//loader
$loader = new loader($registry);
$registry->set('load', $loader);
$front = new Front($registry);
$front->addPreAction(new action('login/check'));
$front->addPreAction(new action('permission/check'));
if (isset($request->get['url'])) {
    $action = new action($request->get['url']);
} else {
    $action = new action('home/index');
}
$front->dispatch($action, new action('error/index'));
$response->output();
示例#13
0
$registry->set('weight', new Cart\Weight($registry));
// Length
$registry->set('length', new Cart\Length($registry));
// Cart
$registry->set('cart', new Cart\Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
// Template Override
$event->register('view/*/before', new Action('event/template'));
// Add events from the DB
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'catalog/%'");
foreach ($query->rows as $result) {
    $event->register(substr($result['trigger'], strpos($result['trigger'], '/') + 1), new Hook($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('event/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('event/seo_url'));
// Error Handling
$controller->addPreAction(new Action('common/error'));
// Dispatch
$controller->dispatch(new Action('event/route'), new Action('error/not_found'));
// Output
$response->output();
示例#14
0
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
$registry->set('merchant', new Merchant($registry));
//OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Login
$controller->addPreAction(new Action('merchant/login/check'));
// Permission
$controller->addPreAction(new Action('error/permission/check'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#15
0
文件: index.php 项目: i92011/opencart
// Length
$registry->set('length', new Cart\Length($registry));
// User
$registry->set('user', new Cart\User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'admin/%'");
foreach ($query->rows as $result) {
    $event->register(substr($result['trigger'], strrpos($result['trigger'], '/') + 1), new Action($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Compile Sass
$controller->addPreAction(new Action('override/sass'));
// Login
$controller->addPreAction(new Action('override/login'));
// Permission
$controller->addPreAction(new Action('override/permission'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#16
0
文件: admin.php 项目: royopa/arastta
 public function dispatch()
 {
     # B/C start
     global $registry;
     $registry = $this->registry;
     global $config;
     $config = $this->registry->get('config');
     global $db;
     $db = $this->registry->get('db');
     global $log;
     $log = $this->registry->get('log');
     # B/C end
     // Front Controller
     $controller = new Front($this->registry);
     // Login
     $controller->addPreAction(new Action('common/login/check'));
     // Permission
     $controller->addPreAction(new Action('error/permission/check'));
     // Router
     if (isset($this->request->get['route'])) {
         $action = new Action($this->request->get['route']);
     } else {
         $action = new Action('common/dashboard');
     }
     // Dispatch
     $controller->dispatch($action, new Action('error/not_found'));
     $this->trigger->fire('post.app.dispatch');
 }
示例#17
0
// Language Autoload
if ($config->has('language_autoload')) {
    foreach ($config->get('language_autoload') as $value) {
        $loader->language($value);
    }
}
// Library Autoload
if ($config->has('library_autoload')) {
    foreach ($config->get('library_autoload') as $value) {
        $loader->library($value);
    }
}
// Model Autoload
if ($config->has('model_autoload')) {
    foreach ($config->get('model_autoload') as $value) {
        $loader->model($value);
    }
}
// Front Controller
$controller = new Front($registry);
// Pre Actions
if ($config->has('action_pre_action')) {
    foreach ($config->get('action_pre_action') as $value) {
        $controller->addPreAction(new Action($value));
    }
}
// Dispatch
$controller->dispatch(new Action($config->get('action_router')), new Action($config->get('action_error')));
// Output
$response->setCompression($config->get('config_compression'));
$response->output();
示例#18
0
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
//OpenBay Pro
$registry->set('openbay', new Openbay($registry));
$registry->set('play', new Play($registry));
$registry->set('ebay', new Ebay($registry));
$registry->set('amazon', new Amazon($registry));
$registry->set('amazonus', new Amazonus($registry));
$registry->set('api_log', new Api_log($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// customer settings override
$controller->addPreAction(new Action('common/customer_settings'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#19
0
文件: index.php 项目: rb2/ocstoreru
foreach ($query->rows as $result) {
    $languages[$result['code']] = $result;
}
$config->set('config_language_id', $languages[$config->get('config_admin_language')]['language_id']);
$language = new Language($languages[$config->get('config_admin_language')]['directory']);
$language->load($languages[$config->get('config_admin_language')]['filename']);
$registry->set('language', $language);
// Currency
$registry->set('currency', new Currency($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
// Front Controller
$controller = new Front($registry);
// Login
$controller->addPreAction(new Action('common/home/login'));
// Permission
$controller->addPreAction(new Action('common/home/permission'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#20
0
$registry->set('user', new User($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new ApiAction('common/maintenance'));
// OAuth access token
//$controller->addPreAction(new ApiAction('oauth2/oauth'));
// Router
if (isset($request->get['route'])) {
    $action = new ApiAction($request->get['route']);
} else {
    $action = new ApiAction('error/not_found');
}
// Dispatch
try {
    $controller->dispatch($action, new ApiAction('error/not_found'));
} catch (ApiException $e) {
    $response->setInterceptOutput(false);
    $response->setHttpResponseCode($e->getHttpResponseCode());
    $response->setOutput(array('errors' => $e->getErrors()));
示例#21
0
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// ocStore features
$registry->set('ocstore', new ocStore($registry));
//  Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
if (!($seo_type = $config->get('config_seo_url_type'))) {
    $seo_type = 'seo_url';
}
$controller->addPreAction(new Action('common/' . $seo_type));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#22
0
    }
    if ($config->get('config_error_display')) {
        echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
    }
    if (true) {
        $loger->write('PHP ' . $error . ':  ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
    }
    return true;
}
// Error Handler
//set_error_handler('error_handler');
//security
$registry->set('security', new Security());
//url
$url = new Url(HTTP_SERVER);
$registry->set('url', $url);
//token
$registry->set('token', new Token());
//statistik
$statistik = new statistik($registry);
$registry->set('statistik', $statistik);
$statistik->update('pageRequests');
$front = new Front($registry);
$front->addPreAction(new action('maintenance/check'));
if (isset($request->get['url'])) {
    $action = new action($request->get['url']);
} else {
    $action = new action('home/index');
}
$front->dispatch($action, new action('error/index'));
$response->output();
// Currency
$registry->set('currency', new Currency($registry));
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
$action = new Action('payment/alipay_guarantee/callback');
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例#24
0
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Mobile Detect
$registry->set('detect', new Mobile_Detect());
// Event
$registry->set('event', new Event($registry));
$event = new Event($registry);
//OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// OneCheckOut
$controller->addPreAction(new Action('onecheckout/checkout/ini'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();