define('GLM_SERVERSTATS_DATABASE_PASSWORD', ',Wv4W*~^bL_vF3F4PbGsS');
// PROVIDER ENABLED ADDRESSES - If base URL matches one of these, site is considered the "Provider" site.
-define('GLM_SERVERSTATS_PROVIDER_1', '192.168.44.82'); // Development System
-define('GLM_SERVERSTATS_PROVIDER_2', 'www.gaslightmedia.com'); // Home Site where sites are configured and reported
+define('GLM_SERVERSTATS_PROVIDER', 'www.gaslightmedia.com:192.168.44.82:localhost'); // Development System
// Check if debug enabled
if (GLM_SERVERSTATS_PLUGIN_DEBUG) {
// Set Website hostname - but override if development system
$hostname = $urlParts['host'];
-if ($hostname == GLM_SERVERSTATS_PROVIDER_1) {
+$provider1Hosts = explode(':', GLM_SERVERSTATS_PROVIDER);
+if (in_array($hostname, $provider1Hosts)) {
// Must be on development system, so use data for GLM site
+ define('GLM_SERVERSTATS_PLUGIN_IS_PROVIDER', true);
define('GLM_SERVERSTATS_PLUGIN_HOSTNAME', 'www.gaslightmedia.com');
} else {
+ define('GLM_SERVERSTATS_PLUGIN_IS_PROVIDER', false);
define('GLM_SERVERSTATS_PLUGIN_HOSTNAME', $urlParts['host']);
}
-
+echo GLM_SERVERSTATS_PLUGIN_HOSTNAME;
$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only
// Enable to display smarty template debug.
define('GLM_SERVERSTATS_PLUGIN_VIEW_PATH', GLM_SERVERSTATS_PLUGIN_PATH.'/views');
// Update Server
-define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
+// define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
+define('GLM_SERVERSTATS_PLUGIN_UPDATE_SERVER', 'https://192.168.44.82/update_server');
// Other
define('GLM_SERVERSTATS_PLUGIN_THRESHOLD_OPTION', 'glmServerStatsThreshold');
// Connect to bandwidth database and get all settings for this site
$bwdb = false;
$websiteSettings = bandwidthDataConnect(GLM_SERVERSTATS_PLUGIN_HOSTNAME);
-if (!$websiteSettings) {
- wp_die('FAILURE: Unable to connect to GLM Bandwidth database. Please check connection settings in defines.php of this plugin.');
-}
// If this is an admin request
if (is_admin()) {
*/
function bandwidthDataConnect($website = false)
{
+ // Check that we have a good website name
+ if (empty($website)) {
+ trigger_error('GLM Usage: bandwidthDataConnect() - No Website name provided!', E_USER_NOTICE);
+ return false;
+ }
+
// Moved msqli_init() to here to be compatible with activation
global $bwdb;
$bwdb = mysqli_init();
* and be able to connect to the server usage statistics database.
*/
add_filter('glm-serverstats-is-provider', function() {
- return ((strpos(GLM_SERVERSTATS_SITE_BASE_URL, GLM_SERVERSTATS_PROVIDER_1) !== false || strpos(GLM_SERVERSTATS_SITE_BASE_URL, GLM_SERVERSTATS_PROVIDER_2) !== false) && current_user_can( 'administrator' ));
+ return (GLM_SERVERSTATS_PLUGIN_IS_PROVIDER && current_user_can( 'administrator' ));
},
10,
2
</style>
{if !$haveStats}
- <h3 class="glm-error">This application has not been configured. Please ask Gaslight Media this for your Website.</h3>
- <p><b>Error:</b> {$connectError}</p>
+ <h3 class="glm-error">This Website is not known to this plugin!</h3>
+ <p>
+ <ul>
+ <li>Is this plugin being run on a Website that is not listed in the "bandwidth" database?</li>
+ <li>Is this plugin being run on a development site not listed in the GLM_SERVERSTATS_PROVIDER defined parameter in "defines.php"?</li>
+ <li>Is there a problem with the "bandwidth" database Connection settings in the "defines.php" file?</li>
+ <li>There may be other problems. Please check error log.</li>
+ </ul>
+ </p>
{else}
{if apply_filters('glm-serverstats-is-provider', false)}