aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pfstat.xml
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-10-09 17:11:15 +0000
committerColin Smith <colin@pfsense.org>2005-10-09 17:11:15 +0000
commitdadfceb224e638604ab3fa8043d2475763141ac5 (patch)
treec3b07b3681c759f929f51f473bebf8b1585b2e1b /packages/pfstat.xml
parenta0cb9388ff0e76467e2ec973103efac6a62a2712 (diff)
downloadpfsense-packages-dadfceb224e638604ab3fa8043d2475763141ac5.tar.gz
pfsense-packages-dadfceb224e638604ab3fa8043d2475763141ac5.tar.bz2
pfsense-packages-dadfceb224e638604ab3fa8043d2475763141ac5.zip
Move sync_package_pfstat() into global functions. Second part of ticket #595.
Diffstat (limited to 'packages/pfstat.xml')
-rw-r--r--packages/pfstat.xml108
1 files changed, 52 insertions, 56 deletions
diff --git a/packages/pfstat.xml b/packages/pfstat.xml
index 00231b30..90aff5fa 100644
--- a/packages/pfstat.xml
+++ b/packages/pfstat.xml
@@ -206,61 +206,61 @@
</rowhelper>
</field>
</fields>
+ <custom_php_global_functions>
+ function sync_package_pfstat() {
+ conf_mount_rw();
+ config_lock();
+ global $config;
+ $fout = fopen("/usr/local/etc/pfstat.conf","w");
+ if($config['installedpackages']['pfstat']['config'] != "") {
+ foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) {
+ $leftgraphtext = "";
+ $rightgraphtext = "";
+ $isfirstleft = 0;
+ $isfirstright = 0;
+ $fromclassification = $rowhelper['fromclassification'];
+ $imagename = $rowhelper['imagename'];
+ $pos = strrpos($imagename, ".jpg");
+ if ($pos === false) {
+ $imagename .= ".jpg";
+ }
+ $from = $rowhelper['from'];
+ $graphsizewidth = $rowhelper['graphsizewidth'];
+ $graphsizeheight = $rowhelper['graphsizeheight'];
+ foreach($rowhelper['row'] as $row) {
+ if($row['location'] == "left") {
+ if($isfirstleft == 1) $leftgraphtext .= ",\n";
+ $leftgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance'];
+ $isfirstleft = 1;
+ } else {
+ if($isfirstright == 1) $rightgraphtext .= ",\n";
+ $rightgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance'];
+ $isfirstright = 1;
+ }
+ }
+ fwrite($fout, "image \"/usr/local/www/pfstat/" . $imagename ."\" { \n");
+ if($from == "") $from = "30";
+ fwrite($fout, "from " . $from . " " . $fromclassification . " to now \n");
+ fwrite($fout, "width " . $graphsizewidth . " height " . $graphsizeheight . " \n");
+ if($leftgraphtext != "") {
+ fwrite($fout, " left \n");
+ fwrite($fout, " " . $leftgraphtext . "\n");
+ }
+ if($rightgraphtext != "") {
+ fwrite($fout, " right \n");
+ fwrite($fout, " " . $rightgraphtext . "\n");
+ }
+ fwrite($fout, "}\n\n");
+ }
+ }
+ fclose($fout);
+ conf_mount_ro();
+ config_unlock();
+ }
+ </custom_php_global_functions>
<custom_php_command_before_form>
- function sync_package_pfstat() {
- conf_mount_rw();
- config_lock();
- global $config;
- $fout = fopen("/usr/local/etc/pfstat.conf","w");
- if($config['installedpackages']['pfstat']['config'] != "") {
- foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) {
- $leftgraphtext = "";
- $rightgraphtext = "";
- $isfirstleft = 0;
- $isfirstright = 0;
- $fromclassification = $rowhelper['fromclassification'];
- $imagename = $rowhelper['imagename'];
- $pos = strrpos($imagename, ".jpg");
- if ($pos === false) {
- $imagename .= ".jpg";
- }
- $from = $rowhelper['from'];
- $graphsizewidth = $rowhelper['graphsizewidth'];
- $graphsizeheight = $rowhelper['graphsizeheight'];
- foreach($rowhelper['row'] as $row) {
- if($row['location'] == "left") {
- if($isfirstleft == 1) $leftgraphtext .= ",\n";
- $leftgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance'];
- $isfirstleft = 1;
- } else {
- if($isfirstright == 1) $rightgraphtext .= ",\n";
- $rightgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance'];
- $isfirstright = 1;
- }
- }
- fwrite($fout, "image \"/usr/local/www/pfstat/" . $imagename ."\" { \n");
- if($from == "") $from = "30";
- fwrite($fout, "from " . $from . " " . $fromclassification . " to now \n");
- fwrite($fout, "width " . $graphsizewidth . " height " . $graphsizeheight . " \n");
- if($leftgraphtext != "") {
- fwrite($fout, " left \n");
- fwrite($fout, " " . $leftgraphtext . "\n");
- }
- if($rightgraphtext != "") {
- fwrite($fout, " right \n");
- fwrite($fout, " " . $rightgraphtext . "\n");
- }
- fwrite($fout, "}\n\n");
- }
- }
- fclose($fout);
- conf_mount_ro();
- config_unlock();
- }
sync_package_pfstat();
</custom_php_command_before_form>
- <custom_add_php_command_late>
- </custom_add_php_command_late>
<custom_php_resync_config_command>
sync_package_pfstat();
</custom_php_resync_config_command>
@@ -273,8 +273,4 @@
unlink_if_exists("/usr/local/etc/pfstat");
rmdir_recursive("/usr/local/www/pfstat");
</custom_php_deinstall_command>
- <!--
- <custom_php_install_command>
- </custom_php_install_command>
- -->
</packagegui>