/web/acc/manager/vnstat/alcasar.txt |
---|
2,53 → 2,3 |
code initial : https://github.com/alexandermarston/vnstat-dashboard |
Fork exploité : https://github.com/tomangert/vnstat-dashboard |
-------------------------------------------------- |
diff index.php index.php.orig |
21,22c21 |
< //require __DIR__ . '/vendor/autoload.php'; |
< require __DIR__ . '/smarty/Smarty.class.php'; |
--- |
> require __DIR__ . '/vendor/autoload.php'; |
54,55c53 |
< // Add for ALCASAR |
< $thisInterface = ""; |
--- |
> |
59d56 |
< // Modify for ALCASAR |
61,62c58 |
< //$smarty->assign('interface_list', $vnstat->getInterfaces()); |
< $smarty->assign('interface_list', $thisInterface); |
--- |
> $smarty->assign('interface_list', $vnstat->getInterfaces()); |
--------------------------------------------------- |
diff module_footer.tpl module_footer.tpl.orig |
3c3,4 |
< <span class="text-muted">Generated by 'vnstat-dashboard' |
--- |
> <span class="text-muted">Copyright (C) {$year} Alexander Marston - |
> <a href="https://github.com/alexandermarston/vnstat-dashboard">vnstat-dashboard</a> |
----------------------------------------------------- |
diff module_header.tpl module_header.tpl.orig |
12a17,33 |
> <nav class="navbar sticky-top navbar-light bg-light"> |
> <div class="container"> |
> <a class="navbar-brand" href="#">Network Traffic ({$current_interface})</a> |
> |
> <div class="dropdown"> |
> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
> Interface Selection |
> </button> |
> |
> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> |
> {foreach from=$interface_list item=value} |
> <a class="dropdown-item" href="?i={$value}">{$value}</a> |
> {/foreach} |
> </div> |
> </div> |
> </div> |
> </nav> |
/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'); |
/web/acc/manager/vnstat/index.php.orig |
---|
19,12 → 19,22 |
// Require includes |
require __DIR__ . '/vendor/autoload.php'; |
require __DIR__ . '/includes/utilities.php'; |
require __DIR__ . '/includes/vnstat.php'; |
require __DIR__ . '/includes/utilities.php'; |
require __DIR__ . '/includes/config.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,13 → 61,22 |
$thisInterface = reset($interface_list); |
} |
$smarty->assign('graph_type', $graph_type); |
$smarty->assign('current_interface', $thisInterface); |
// Assign interface options |
$smarty->assign('interface_list', $vnstat->getInterfaces()); |
$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); |
71,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'); |
/web/acc/manager/vnstat/templates/module_footer.tpl |
---|
4,7 → 4,7 |
</span> |
</div> |
</footer> |
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> |
<script type="text/javascript" src="/js/gstatic-loader.js"></script> |
<script src="/js/jquery.slim.min.js"></script> |
<script src="/js/bootstrap.min.js"></script> |
{include file="module_graph_js.tpl"} |
/web/acc/manager/vnstat/templates/module_header.tpl |
---|
5,7 → 5,7 |
<meta charset="UTF-8"> |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
<!-- Bootstrap CSS --> |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> |
<link rel="stylesheet" href="/css/bootstrap.min.css"> |
<!-- Custom CSS --> |
<link rel="stylesheet" href="./assets/css/style.css"> |
</head> |