From 159582fe0e7f2d05c430fc82d40a0324f46a4fe5 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 6 Nov 2012 17:19:30 +0200 Subject: [PATCH] General Core Improvments --- admin/index.php | 3 - boot/defines.php | 117 ++++++++++++++++++++++++ boot/development/defines.php | 117 ++++++++++++++++++++++++ boot/production/defines.php | 117 ++++++++++++++++++++++++ index.php | 4 +- monstra/boot/{hooks.php => actions.php} | 2 +- monstra/boot/defines.php | 35 +------ monstra/boot/shortcodes.php | 8 ++ monstra/bootstrap.php | 38 -------- monstra/engine/core.php | 115 ++++++++++++++++++++++- monstra/engine/site.php | 9 +- 11 files changed, 476 insertions(+), 89 deletions(-) create mode 100644 boot/defines.php create mode 100644 boot/development/defines.php create mode 100644 boot/production/defines.php rename monstra/boot/{hooks.php => actions.php} (75%) create mode 100644 monstra/boot/shortcodes.php diff --git a/admin/index.php b/admin/index.php index d963fb2..70d6be6 100644 --- a/admin/index.php +++ b/admin/index.php @@ -35,9 +35,6 @@ // Admin login if (Request::post('login_submit')) { - // Sleep MONSTRA_LOGIN_SLEEP seconds for blocking Brute Force Attacks - sleep(MONSTRA_LOGIN_SLEEP); - $user = $users->select("[login='" . trim(Request::post('login')) . "']", null); if (count($user) !== 0) { if ($user['login'] == Request::post('login')) { diff --git a/boot/defines.php b/boot/defines.php new file mode 100644 index 0000000..498a4ee --- /dev/null +++ b/boot/defines.php @@ -0,0 +1,117 @@ +'; } \ No newline at end of file + function setMetaGenerator() { echo ''; } \ No newline at end of file diff --git a/monstra/boot/defines.php b/monstra/boot/defines.php index 9879c22..498a4ee 100644 --- a/monstra/boot/defines.php +++ b/monstra/boot/defines.php @@ -5,32 +5,6 @@ * Monstra CMS Defines */ - - /** - * Set gzip output - */ - define('MONSTRA_GZIP', false); - - /** - * Set gzip styles - */ - define('MONSTRA_GZIP_STYLES', false); - - /** - * Set Monstra version - */ - define('MONSTRA_VERSION', '2.0.1'); - - /** - * Set Monstra version id - */ - define('MONSTRA_VERSION_ID', 20001); - - /** - * Set Monstra site url - */ - define('MONSTRA_SITEURL', 'http://monstra.org'); - /** * The filesystem path to the 'monstra' folder */ @@ -109,11 +83,6 @@ * The filesystem path to the 'uploads' folder */ define('UPLOADS', ROOT . DS . 'public' . DS . 'uploads'); - - /** - * Set login sleep value - */ - define('MONSTRA_LOGIN_SLEEP', 1); /** * Set password salt @@ -136,9 +105,9 @@ define('CHECK_MONSTRA_VERSION', true); /** - * Monstra CMS mobile detection + * Set gzip output */ - define('MONSTRA_MOBILE', true); + define('MONSTRA_GZIP', false); /** * Monstra database settings diff --git a/monstra/boot/shortcodes.php b/monstra/boot/shortcodes.php new file mode 100644 index 0000000..c812995 --- /dev/null +++ b/monstra/boot/shortcodes.php @@ -0,0 +1,8 @@ + 'production', + 2 => 'staging', + 3 => 'testing', + 4 => 'development'); + + $root_defines = ROOT . DS . 'boot' . DS . 'defines.php'; + $environment_defines = ROOT . DS . 'boot' . DS . $environments[Core::$environment] . DS . 'defines.php'; + $monstra_defines = ROOT . DS . 'monstra' . DS . 'boot' . DS . 'defines.php'; + + + if (file_exists($root_defines)) { + include $root_defines; + } elseif(file_exists($environment_defines)) { + include $environment_defines; + } elseif(file_exists($monstra_defines)) { + include $monstra_defines; + } else { + throw new RuntimeException("The defines file does not exist."); + } + } + + + /** + * Load Pluggable + */ + protected static function loadPluggable() { + + $environments = array(1 => 'production', + 2 => 'staging', + 3 => 'testing', + 4 => 'development'); + + $root_pluggable = ROOT . DS . 'boot'; + $environment_pluggable = ROOT . DS . 'boot' . DS . $environments[Core::$environment]; + $monstra_pluggable = ROOT . DS . 'monstra' . DS . 'boot'; + + + if (file_exists($root_pluggable . DS . 'filters.php')) { + include $root_pluggable . DS . 'filters.php'; + } elseif(file_exists($environment_pluggable . DS . 'filters.php')) { + include $environment_pluggable . DS . 'filters.php'; + } elseif(file_exists($monstra_pluggable . DS . 'filters.php')) { + include $monstra_pluggable . DS . 'filters.php'; + } else { + throw new RuntimeException("The pluggable file does not exist."); + } + + if (file_exists($root_pluggable . DS . 'actions.php')) { + include $root_pluggable . DS . 'actions.php'; + } elseif(file_exists($environment_pluggable . DS . 'actions.php')) { + include $environment_pluggable . DS . 'actions.php'; + } elseif(file_exists($monstra_pluggable . DS . 'actions.php')) { + include $monstra_pluggable . DS . 'actions.php'; + } else { + throw new RuntimeException("The pluggable file does not exist."); + } + + if (file_exists($root_pluggable . DS . 'shortcodes.php')) { + include $root_pluggable . DS . 'shortcodes.php'; + } elseif(file_exists($environment_pluggable . DS . 'shortcodes.php')) { + include $environment_pluggable . DS . 'shortcodes.php'; + } elseif(file_exists($monstra_pluggable . DS . 'shortcodes.php')) { + include $monstra_pluggable . DS . 'shortcodes.php'; + } else { + throw new RuntimeException("The pluggable file does not exist."); + } + + } + + /** * Exception Handler * @@ -367,6 +471,7 @@ highlight_string('Monstra ' . MONSTRA_VERSION; + return __('Powered by', 'system').' Monstra ' . Core::VERSION; } - } - - - // Add new shortcode {siteurl} - Shortcode::add('siteurl', 'returnSiteUrl'); - function returnSiteUrl() { return Option::get('siteurl'); } \ No newline at end of file + } \ No newline at end of file