diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/pfstat.xml | 108 |
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> |