From: Chuck Scott Date: Tue, 30 Jul 2019 18:43:27 +0000 (-0400) Subject: Moved provider site addresses to defines.php and other updates and fixes. X-Git-Tag: v3.0.0^2~8 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=e8002c4d96e148d0569c276e1081cf856bdf3db2;p=WP-Plugins%2Fglm-serverstats.git Moved provider site addresses to defines.php and other updates and fixes. --- diff --git a/classes/serverBandwidthSupport.php b/classes/serverBandwidthSupport.php index 21087c5..75a894c 100755 --- a/classes/serverBandwidthSupport.php +++ b/classes/serverBandwidthSupport.php @@ -142,6 +142,9 @@ class glmServerStatsBandwidthSupport trigger_error('GLM Usage: bandwidthDataConnect() - '.$this->connectError, E_USER_NOTICE); } else { + // Get global send percentage - Notify if above this + $this->threshold = $config['send_percent'] - 0; + if (!$website) { $website = $config['website']; } @@ -360,7 +363,7 @@ class glmServerStatsBandwidthSupport if ($this->bwdb == false) { return false; } -//This one done + // Get stats for yesterday in Megabytes for traffic and Gigabytes for Storage $yesterday = date('Y-m-d 0:0:0.0', strtotime(date('Y-m-d')." - 1day")); $today = date('Y-m-d 0:0:0.0'); @@ -898,6 +901,7 @@ class glmServerStatsBandwidthSupport // For each website retrieved foreach ($websites as $site) { + $mesg = ''; // If targets had exceeded target @@ -922,7 +926,7 @@ class glmServerStatsBandwidthSupport '; // If customer contact provided - if (trim($site['cust_contact']) != '' && $sendToCustContact) { + if ($sendAll || (trim($site['cust_contact']) != '' && $sendToCustContact)) { $numbReportingWithContactEmail++; @@ -1044,6 +1048,16 @@ class glmServerStatsBandwidthSupport public function sendHtmlEmail( $to, $from, $subject, $mesg, $forceDisplay = false ) { + if (trim($to) == '') { + + if (!$forceDisplay) { + echo '
E-Mail Not Sent - No "To:" address!'; + return; + } + $to = "( *** E-Mail Address Not Supplied - This E-Mail would not have been sent. *** )"; + + } + // On development servers, force display if (GLM_SERVERSTATS_PLUGIN_HOST == 'DEVELOPMENT') { $forceDisplay = true; diff --git a/defines.php b/defines.php index 7e6286b..a5a4cb0 100755 --- a/defines.php +++ b/defines.php @@ -5,6 +5,11 @@ * Set standard defined parameters */ +// 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'); +define('GLM_SERVERSTATS_PROVIDER_2', 'www.gaslightmedia.com'); + + define('GLM_SERVERSTATS_CONTACT_EMAIL', "plugins.gaslightmedia.com"); // Set to true to add more debug messages to the error log diff --git a/setup/commonHooks.php b/setup/commonHooks.php index e66a9db..7a65fdf 100644 --- a/setup/commonHooks.php +++ b/setup/commonHooks.php @@ -37,7 +37,7 @@ * 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, '192.168.44.82') !== false || strpos(GLM_SERVERSTATS_SITE_BASE_URL, 'www.gaslightmedia.com') !== false)); + return ((strpos(GLM_SERVERSTATS_SITE_BASE_URL, GLM_SERVERSTATS_PROVIDER_1) !== false || strpos(GLM_SERVERSTATS_SITE_BASE_URL, GLM_SERVERSTATS_PROVIDER_2) !== false)); }, 10, 2 diff --git a/views/adminServerStats.html b/views/adminServerStats.html index ca6425e..5d79c6c 100755 --- a/views/adminServerStats.html +++ b/views/adminServerStats.html @@ -47,18 +47,13 @@ font-size: 1.2rem; } .graphContainer { - position: relative; } .graphContainer .graphTitle { - position: absolute; - top: -10px; - width: 100%; - margin-top: 10px; - font-weight: bold; font-size: 1.1rem; + font-weight: bold; + margin-bottom: 10px; } .graph { - margin-top: 20px; } @@ -133,8 +128,13 @@ {if $selectedSite}
- Send usage E-mail for site selected above -   Display usage E-mail for site selected above + Send: + Send usage E-mail for site selected above +    + Review: + Display usage E-mail for site selected above +    + Display usage E-mail for all sites above threashold percentage
{/if} @@ -198,7 +198,8 @@ 'field' => 'cust_contact', 'value' => {$settings.cust_contact}, 'label' => 'Customer Contact E-Mail', - 'required' => true + 'required' => false, + 'helpText' => 'Leave empty to prevent any E-mail from being sent for this site.' ]} {include file="ui/f6/text.html"} @@ -335,8 +336,11 @@ text-align: left; vertical-align: top; padding: 0px; + margin: 0px; } .glmbw-table tr { + margin-bottom: 0px; + padding-bottom: 0px; } .glmbw-image { max-width: 90%; @@ -348,15 +352,34 @@ font-size: 1em; text-align: center; } + #key-line { + margin: 0px; + padding: 0px; + } + #print-date { + font-size: 1em; + padding: 0px; + margin: 0px; + } + .graphContainer { + } + .graphContainer .graphTitle { + font-weight: bold; + margin-bottom: 5px; + } + .graph { + } +
- + +
 TrafficTarget% of TargetStoragetarget% of Target
 TrafficTarget% of TargetStoragetarget% of Target
Yesterday: @@ -397,35 +420,35 @@ {$serverStats.trafficDiff.diskPercent|string_format:"%.0f"}%
- -

+ +

Color Key: Target, Storage, Incoming, Outgoing, Total

+
Monthly traffic totals for the past year. The dotted line is our current/planned billing level.
-
+
Montlhy maximum disk space used for past year. The dotted line is our current/planned billing level.
-
+
Detail traffic for past 24 hours.
-
+
Daily traffic for past two months.
-
diff --git a/views/adminServerStatsConfig.html b/views/adminServerStatsConfig.html index 447ad0c..b88f7db 100755 --- a/views/adminServerStatsConfig.html +++ b/views/adminServerStatsConfig.html @@ -156,7 +156,7 @@ 'field' => 'show_notifications', 'value' => {!empty($show_notifications)}, 'label' => 'Customer Notiifications', - 'helpText' => 'Turn this on to have general Gaslight Media messages displayed on this site.', + 'helpText' => 'Turn this on to have general Gaslight Media messages displayed on this site.' ]} {include file="ui/f6/checkbox.html"}