Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3107 → Rev 3108

/web/acc/manager/vnstat/index.php
18,14 → 18,23
*/
 
// Require includes
//require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/smarty/Smarty.class.php';
require __DIR__ . '/includes/utilities.php';
require __DIR__ . '/includes/vnstat.php';
require __DIR__ . '/includes/utilities.php';
require __DIR__ . '/includes/config.php';
require __DIR__ . '/smarty/Smarty.class.php';
 
if (isset($vnstat_config)) {
$vnstat_cmd = $vnstat_bin_dir.' --config '.$vnstat_config;
} else {
$vnstat_cmd = $vnstat_bin_dir;
}
 
if (empty($graph_type)) {
$graph_type = 'linear';
}
 
// Initiaite vnStat class
$vnstat = new vnStat($vnstat_bin_dir);
$vnstat = new vnStat($vnstat_cmd);
 
// Initiate Smarty
$smarty = new Smarty();
51,17 → 60,23
// Assume they mean the first interface
$thisInterface = reset($interface_list);
}
// Add for ALCASAR
$thisInterface = "";
 
$smarty->assign('graph_type', $graph_type);
 
$smarty->assign('current_interface', $thisInterface);
 
// Modify for ALCASAR
// Assign interface options
//$smarty->assign('interface_list', $vnstat->getInterfaces());
$smarty->assign('interface_list', $thisInterface);
$smarty->assign('interface_list', $interface_list);
 
// JsonVersion
$smarty->assign('jsonVersion', $vnstat->getVnstatJsonVersion());
 
// Populate table data
if ($vnstat->getVnstatJsonVersion() > 1) {
$fiveData = $vnstat->getInterfaceData('five', 'table', $thisInterface);
$smarty->assign('fiveTableData', $fiveData);
}
 
$hourlyData = $vnstat->getInterfaceData('hourly', 'table', $thisInterface);
$smarty->assign('hourlyTableData', $hourlyData);
 
75,17 → 90,26
$smarty->assign('top10TableData', $top10Data);
 
// Populate graph data
if ($vnstat->getVnstatJsonVersion() > 1) {
$fiveGraphData = $vnstat->getInterfaceData('five', 'graph', $thisInterface);
$smarty->assign('fiveGraphData', $fiveGraphData);
$smarty->assign('fiveLargestPrefix', $fiveGraphData[0]['delimiter']);
$smarty->assign('fiveBase', $fiveGraphData[0]['base']);
}
 
$hourlyGraphData = $vnstat->getInterfaceData('hourly', 'graph', $thisInterface);
$smarty->assign('hourlyGraphData', $hourlyGraphData);
$smarty->assign('hourlyLargestPrefix', $hourlyGraphData[1]['delimiter']);
$smarty->assign('hourlyLargestPrefix', $hourlyGraphData[0]['delimiter']);
$smarty->assign('hourlyBase', $hourlyGraphData[0]['base']);
 
$dailyGraphData = $vnstat->getInterfaceData('daily', 'graph', $thisInterface);
$smarty->assign('dailyGraphData', $dailyGraphData);
$smarty->assign('dailyLargestPrefix', $dailyGraphData[1]['delimiter']);
$smarty->assign('dailyLargestPrefix', $dailyGraphData[0]['delimiter']);
$smarty->assign('dailyBase', $dailyGraphData[0]['base']);
 
$monthlyGraphData = $vnstat->getInterfaceData('monthly', 'graph', $thisInterface);
$smarty->assign('monthlyGraphData', $monthlyGraphData);
$smarty->assign('monthlyLargestPrefix', $monthlyGraphData[1]['delimiter']);
$smarty->assign('monthlyLargestPrefix', $monthlyGraphData[0]['delimiter']);
 
// Display the page
$smarty->display('templates/site_index.tpl');