From 338635dc86736f3cb412681f43d2c2c33d61f124 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Fri, 11 Aug 2017 16:24:26 -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 ++- deactivate.php | 3 ++- defines.php | 6 ++++++ index.php | 12 ++++++------ uninstall.php | 3 ++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/activate.php b/activate.php index 15840bb..1d441e9 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(); } /* diff --git a/deactivate.php b/deactivate.php index e1e6a40..0227a22 100644 --- a/deactivate.php +++ b/deactivate.php @@ -15,7 +15,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(); } /* diff --git a/defines.php b/defines.php index 3863606..af2537b 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_CONTACTS_PLUGIN_NAME', 'Gaslight Media Members Database Contacts'); diff --git a/index.php b/index.php index 8c06c27..186a555 100644 --- a/index.php +++ b/index.php @@ -22,6 +22,12 @@ * @version 1.1.0 */ +// 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 * @@ -57,12 +63,6 @@ define('REQUIRED_GLM_MEMBERS_PLUGIN_MIN_DB_VERSION', '1.0.41'); * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -// 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 9e9bbc6..8f83443 100644 --- a/uninstall.php +++ b/uninstall.php @@ -16,7 +16,8 @@ die('uninstall not configured - See plugin uninstall.php script!'); // 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