* Gets host, user, password, and database name from a WP option
* that was saved by the configure page.
*
+ * @param string website Specified Website name - Optional
+ *
* @return string Error message. If blank, then no error.
*/
- public function bandwidthDataConnect()
+ public function bandwidthDataConnect($website = false)
{
$this->connected = false;
$config['db_name']
);
+ if (!$website) {
+ $website = $config['website'];
+ }
// If there was an error connecting
if (!$res) {
$this->connectError = mysqli_connect_error();
$this->connected = true;
// Get Website Settings
- $settings = $this->bandwidthGetWebsiteSettingsFromName($config['website']);
+ $settings = $this->bandwidthGetWebsiteSettingsFromName($website);
// Save them in class parameters
$this->website = $config['website'];
*/
public function __construct()
{
+ $websiteSelected = false;
- // 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);
+ if (current_user_can('administrator')) {
+ $websiteSelected = filter_input( INPUT_GET, 'selected_site', FILTER_SANITIZE_STRING);
}
+ // Connect to Bandwidth Database selected in the Configure page
+ $this->bandwidthDataConnect($websiteSelected);
}
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);
- }
-
}
/*
public function model()
{
+ $websiteSelected = filter_input( INPUT_GET, 'selected_site', FILTER_SANITIZE_STRING);
+
+ // Connect to Bandwidth Database selected in the Configure page
+ $this->bandwidthDataConnect($websiteSelected);
+
$graphType = $_REQUEST['graphType'];
// Set reference Date
<h3>Select a site to display</h3>
<p>
Sort by:
- <input type="radio" name="site_sort" {if $site_sort == 'target_percent'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=target_percent&selected_site={$selectedSite}';">Percent of Target
- <input type="radio" name="site_sort" {if $site_sort == 'data_total'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=data_total&selected_site={$selectedSite}';">Total Traffic
- <input type="radio" name="site_sort" {if $site_sort == 'site_name'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=site_name&selected_site={$selectedSite}';">Site Name
+ <input type="radio" name="site_sort" value="target_percent" {if $site_sort == 'target_percent'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=target_percent&selected_site={$selectedSite}';">Percent of Target
+ <input type="radio" name="site_sort" value="data_total" {if $site_sort == 'data_total'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=data_total&selected_site={$selectedSite}';">Total Traffic
+ <input type="radio" name="site_sort" value="site_name" {if $site_sort == 'site_name'} checked="checked"{/if} onClick="location.href='{$thisUrl}?page={$thisPage}&site_sort=site_name&selected_site={$selectedSite}';">Site Name
</p>
<div class="pickContainer">
<pre class="pseudoPickTitles">Website Last Month Target % of Target </pre>
$('#twoDayImg').attr('src', '{$assetsUrl}/graph.png');
$('#twoMonthImg').attr('src', '{$assetsUrl}/graph.png');
$('#twoYearImg').attr('src', '{$assetsUrl}/graph.png');
- $('#twoDayImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&website={$selectedSite}&graphType=oneDay&refDate=' + d);
- $('#twoMonthImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&website={$selectedSite}&graphType=twoMonth&refDate=' + d);
- $('#twoYearImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&website={$selectedSite}&graphType=twoYear&refDate=' + d);
- $('#twoYearStorageImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&website={$selectedSite}&graphType=twoYearStorage&refDate=' + d);
+ $('#twoDayImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&selected_site={$selectedSite}&graphType=oneDay&refDate=' + d);
+ $('#twoMonthImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&selected_site={$selectedSite}&graphType=twoMonth&refDate=' + d);
+ $('#twoYearImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&selected_site={$selectedSite}&graphType=twoYear&refDate=' + d);
+ $('#twoYearStorageImg').attr('src', '{$ajaxUrl}?action=glm_server_stats&glm_action=ajaxServerBandwidthGraphs&selected_site={$selectedSite}&graphType=twoYearStorage&refDate=' + d);
}
$(".graph-print").click(function(){
popX: 200, // popup window screen X position
popY: 200, //popup window screen Y position
popTitle: 'Server Usage', // popup window title element
- popClose: false, // popup window close after printing
+ popClose: true, // popup window close after printing
extraCss: '', // Comma separated list of extra css to include
extraHead: '', // Comma separated list of extra elements to be appended to head tag
strict: false // strict or loose Transitional html 4.01 document standard or undefined to not include at all only for popup option