aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorccesario <carloscesario@gmail.com>2012-06-11 13:30:11 -0300
committerccesario <carloscesario@gmail.com>2012-06-11 13:30:11 -0300
commitef305868daedee0a9f67a2dcfe2bf5779cce5312 (patch)
tree632c5f5330d13e386c02b77eade29d9ec3ac44d6
parent066c6309f567d21e046a999663437c323d39ed77 (diff)
downloadpfsense-packages-ef305868daedee0a9f67a2dcfe2bf5779cce5312.tar.gz
pfsense-packages-ef305868daedee0a9f67a2dcfe2bf5779cce5312.tar.bz2
pfsense-packages-ef305868daedee0a9f67a2dcfe2bf5779cce5312.zip
Enable squid_log_parser.php only to squid program
-rw-r--r--config/squid-reverse/squid_monitor_data.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/config/squid-reverse/squid_monitor_data.php b/config/squid-reverse/squid_monitor_data.php
index fcd5d178..7e27919d 100644
--- a/config/squid-reverse/squid_monitor_data.php
+++ b/config/squid-reverse/squid_monitor_data.php
@@ -42,7 +42,8 @@ require_once("guiconfig.inc");
if ($_POST) {
# Actions
$filter = preg_replace('/(@|!|>|<)/',"",htmlspecialchars($_POST['strfilter']));
- switch (strtolower($_POST['program'])) {
+ $program = strtolower($_POST['program']);
+ switch ($program) {
case 'squid':
// Define log file
$log='/var/squid/logs/access.log';
@@ -138,19 +139,26 @@ function html_autowrap($cont)
// Show Squid Logs
function fetch_log($log){
- global $filter;
+ global $filter,$program;
// Get Data from form post
$lines = $_POST['maxlines'];
if (preg_match("/!/",htmlspecialchars($_POST['strfilter'])))
$grep_arg="-iv";
else
$grep_arg="-i";
+
+ //Check program to execute or no the parser
+ if($program == "squid")
+ $parser = "| php -q squid_log_parser.php";
+ else
+ $parser = "";
+
// Get logs based in filter expression
if($filter != "") {
- exec("tail -2000 {$log} | /usr/bin/grep {$grep_arg} " . escapeshellarg($filter). " | tail -r -n $lines | php -q squid_log_parser.php " , $logarr);
+ exec("tail -2000 {$log} | /usr/bin/grep {$grep_arg} " . escapeshellarg($filter). " | tail -r -n {$lines} {$parser} " , $logarr);
}
else {
- exec("tail -r -n {$lines} {$log} | php -q squid_log_parser.php", $logarr);
+ exec("tail -r -n {$lines} {$log} {$parser}", $logarr);
}
// return logs
return $logarr;