From: Chuck Scott Date: Tue, 6 Nov 2018 21:15:32 +0000 (-0500) Subject: Fixed incorrect site name being used by ajax E-Mail process. X-Git-Tag: v2.0.1^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=9a919e30a862cf26e0f1e46a91c92e04060ef912;p=WP-Plugins%2Fglm-serverstats.git Fixed incorrect site name being used by ajax E-Mail process. --- diff --git a/classes/serverBandwidthSupport.php b/classes/serverBandwidthSupport.php index 02abd78..9dde346 100755 --- a/classes/serverBandwidthSupport.php +++ b/classes/serverBandwidthSupport.php @@ -138,6 +138,7 @@ class glmServerStatsBandwidthSupport if (!$website) { $website = $config['website']; } + // If there was an error connecting if (!$res) { $this->connectError = mysqli_connect_error(); @@ -148,7 +149,7 @@ class glmServerStatsBandwidthSupport $settings = $this->bandwidthGetWebsiteSettingsFromName($website); // Save them in class parameters - $this->website = $config['website']; + $this->website = $website; $this->siteId = $settings['websitepk']; $this->target = $settings['target']; $this->disk_target = $settings['disk_target']; @@ -456,6 +457,7 @@ class glmServerStatsBandwidthSupport COALESCE ( SUM(B.total)/1000000, 0 ) as data_total, COALESCE ( MAX(R.diskusage)/1000000, 0 ) as storage FROM bytes B, rollup R + WHERE B.websitefk = ".$this->siteId." AND R.websitefk = ".$this->siteId." AND B.time BETWEEN '$yesterday' AND '$today' @@ -775,6 +777,7 @@ class glmServerStatsBandwidthSupport { return ($this->connected && (strpos(GLM_SERVERSTATS_SITE_BASE_URL, '192.168.44.80') !== false || strpos(GLM_SERVERSTATS_SITE_BASE_URL, 'www.gaslightmedia.com') !== false)); + return; } @@ -953,10 +956,8 @@ class glmServerStatsBandwidthSupport "Reply-To: $from" ]; wp_mail( $to, $subject, $msg, $header ); + echo "Sent"; } - - - } diff --git a/models/adminServerStats.php b/models/adminServerStats.php index 1ab3f10..2315704 100755 --- a/models/adminServerStats.php +++ b/models/adminServerStats.php @@ -111,8 +111,8 @@ class adminServerStats extends glmServerStatsBandwidthSupport array( 'target' => FILTER_VALIDATE_FLOAT, 'disk_target' => FILTER_VALIDATE_FLOAT, - 'glm_contact' => FILTER_VALIDATE_EMAIL, - 'cust_contact' => FILTER_VALIDATE_EMAIL + 'glm_contact' => FILTER_SANITIZE_STRING, + 'cust_contact' => FILTER_SANITIZE_STRING ) ); $sql = " diff --git a/models/ajaxServerUsageTargetCheck.php b/models/ajaxServerUsageTargetCheck.php index df0c115..db637d4 100755 --- a/models/ajaxServerUsageTargetCheck.php +++ b/models/ajaxServerUsageTargetCheck.php @@ -41,16 +41,15 @@ class ajaxServerUsageTargetCheck extends glmServerStatsBandwidthSupport public function __construct() { - // Connect to Bandwidth Database selected in the Configure page - $this->bandwidthDataConnect(); - // Use default website unless another is specified by an admin user. $websiteIn = filter_input( INPUT_GET, 'website', FILTER_SANITIZE_STRING); if (current_user_can('administrator') && $websiteIn) { - $this->website = trim($websiteIn); - $this->siteId = $this->bandwidthGetWebsiteID($this->website); + $this->website = $websiteIn; } + // Connect to Bandwidth Database selected in the Configure page + $this->bandwidthDataConnect($this->website); + } /*