From 9a34101febc4351ba7323338aa796f5752ac6057 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Fri, 11 Aug 2017 16:20:18 -0400 Subject: [PATCH] Updated check for all common plugin PHP files being called directly and now sending user to /assets/404.html --- activate.php | 3 ++- config.php | 6 ++++++ deactivate.php | 3 ++- defines.php | 6 ++++++ index.php | 11 ++++++----- uninstall.php | 3 ++- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/activate.php b/activate.php index 3a0069e8..d554fc7d 100644 --- a/activate.php +++ b/activate.php @@ -16,7 +16,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } // Load glmPluginSupport class diff --git a/config.php b/config.php index 4d58bf57..22c2502b 100644 --- a/config.php +++ b/config.php @@ -5,6 +5,12 @@ * Get plugin configuration */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + // Get plugin configuration $configData = parse_ini_file(GLM_MEMBERS_PLUGIN_PATH.'/config/plugin.ini', true); $config = $configData['common']; diff --git a/deactivate.php b/deactivate.php index d0397b08..352e8f06 100644 --- a/deactivate.php +++ b/deactivate.php @@ -16,7 +16,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } // Load glmPluginSupport class diff --git a/defines.php b/defines.php index 204f41f2..b3bd2c50 100644 --- a/defines.php +++ b/defines.php @@ -5,6 +5,12 @@ * Set standard defined parameters */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + // NOTE: Plugin & Database versions are defined in "/glm-member-db.php". define('GLM_MEMBERS_SITE_TITLE', get_bloginfo( 'name' )); diff --git a/index.php b/index.php index b3aeebc1..87c7433b 100644 --- a/index.php +++ b/index.php @@ -22,6 +22,12 @@ * @version 2.10.7 */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + /* * Plugin and Database Versions * @@ -191,11 +197,6 @@ if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) * ******************************************************************************** */ -// Check that we're being called by WordPress. -if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); -} - /* * * Some initial setup and tests diff --git a/uninstall.php b/uninstall.php index 876dcc5c..306fa641 100644 --- a/uninstall.php +++ b/uninstall.php @@ -16,7 +16,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } //if uninstall not called from WordPress exit -- 2.17.1