Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Moved site maintenance and comming soon template redirect to base controller to show maintenance only for users while allowing admin users to see live site

givanza171772a55a4
diff --git a/system/core/startup.php b/system/core/startup.php
index 4ca9b87..fc47267 100755
--- a/system/core/startup.php
+++ b/system/core/startup.php
@@ -52,14 +52,13 @@ define('DIR_CACHE', DIR_ROOT . join(DS, ['storage', 'cache']) . DS);
define('DIR_PLUGINS', DIR_ROOT . 'plugins' . DS);
define('DIR_COMPILED_TEMPLATES', DIR_STORAGE . 'compiled-templates' . DS);
define('DIR_BACKUP', DIR_STORAGE . 'backup' . DS);
-define('DIR_THEMES', DIR_ROOT . join(DS, ['public', 'themes']));
+define('DIR_THEMES', DIR_ROOT . join(DS, ['public', 'themes']) . DS);
+define('DIR_PUBLIC', DIR_ROOT . 'public' . DS);
if (APP == 'app') {
define('DIR_THEME', DIR_ROOT . join(DS, ['public', 'themes']) . DS);
- define('DIR_PUBLIC', DIR_ROOT . 'public' . DS);
} else {
define('DIR_THEME', DIR_ROOT . 'public' . DS . APP . DS);
- define('DIR_PUBLIC', DIR_ROOT . 'public' . DS);
}
define('DIR_APP', DIR_ROOT . APP . DS);
@@ -231,6 +230,9 @@ function exceptionToArray($exception, $file = false) {
function exceptionHandler($exception) {
$message = exceptionToArray($exception, $exception->getFile());
+ //check if error is generated by a plugin and disable it
+ pluginErrorCheck($message['file']);
+
return FrontController::notFound(false, $message, 500);
//pluginErrorCheck($file);
echo '<b>Exception:</b><pre>';
@@ -250,9 +252,12 @@ function vErrorHandler($errno, $errstr, $errfile, $errline) {
switch ($errno) {
case E_USER_WARNING:
case E_WARNING:
+ /*
throw new \Exception($errstr, $errno);
//throw new \Exception($errstr, $errno, 0, $errfile, $errline);
+ return true;
break;
+ */
case E_USER_NOTICE:
break;
@@ -268,11 +273,12 @@ function vErrorHandler($errno, $errstr, $errfile, $errline) {
pluginErrorCheck($errfile);
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
+ return true;
//return FrontController::notFound(false, $errstr, 500);
}
/* Don't execute PHP internal error handler */
- return true;
+ return false;
}
function pluginErrorCheck($file) {
@@ -281,7 +287,7 @@ function pluginErrorCheck($file) {
logError("'$plugin' plugin triggers fatal error.");
if (DISABLE_PLUGIN_ON_ERORR) {
- logError(\Vvveb\__("Disabling '%s' plugin.", $plugin));
+ logError(sprintf(\Vvveb\__('Disabling "%s" plugin.'), $plugin));
Plugins::deactivate($plugin);
}
}
@@ -329,16 +335,6 @@ if (defined('DB_ENGINE')) {
define('DIR_SQL', DIR_APP . 'sql' . DS . DB_ENGINE . DS);
}
-function initEcommerce($site) {
- //set default taxes
- if (isset($site['country_id'])) {
- $tax = \Vvveb\System\Cart\Tax::getInstance();
- $tax->setRegionRules($site['country_id'], $site['region_id'], 'store');
- }
-
- return;
-}
-
function start() {
//start session
//Session :: getInstance();
@@ -350,15 +346,7 @@ function start() {
//load plugins first for APP
if (APP == 'app') {
- if (isset($site['state']) && $site['state'] != 'live') {
- $view = View::getInstance();
- $template = Sites::getStates()[$site['state']]['template'];
- $view->template($template);
-
- return $view->render();
- }
Plugins :: loadPlugins(SITE_ID);
- //initEcommerce($site);
}
//define('DIR_THEME', DIR_ROOT . 'public/themes/'. THEME .'/');