From e776eead0caa02fd0eff6d213b75911e1a6870eb Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sat, 3 Nov 2018 15:59:02 +0100 Subject: [PATCH] refactored util/mailstat.php Signed-off-by: Janos SUTO --- util/mailstat.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/util/mailstat.php b/util/mailstat.php index 887cc234..22f7351c 100644 --- a/util/mailstat.php +++ b/util/mailstat.php @@ -1,5 +1,7 @@ query("select `from` AS email, count(`from`) AS num FROM " . VIEW_ foreach($query->rows as $q) { $data[] = array( 'num' => $q['num'], - 'email' => $q['email'], + EMAIL => $q[EMAIL], 'type' => 'rcvd' ); @@ -92,7 +94,7 @@ $query = $db->query("select `to` AS email, count(`to`) AS num FROM " . VIEW_MESS foreach($query->rows as $q) { $data[] = array( 'num' => $q['num'], - 'email' => $q['email'], + EMAIL => $q[EMAIL], 'type' => 'sent' ); } @@ -101,22 +103,19 @@ foreach($query->rows as $q) { array_multisort($data, SORT_DESC); foreach ($data as $q) { - print $q['num'] . "\t" . $q['type'] . "\t" . $q['email'] . "\n"; + print $q['num'] . "\t" . $q['type'] . "\t" . $q[EMAIL] . "\n"; } function display_help() { global $webuidir; $phpself = basename(__FILE__); - echo("\nUsage: $phpself --webui [PATH] [OPTIONS...]\n\n"); - echo("\t--webui=\"[REQUIRED: path to the Piler WebUI Directory, default: $webuidir]\"\n"); - echo("\t--email=email address to look for conversations\n"); + echo "\nUsage: $phpself --webui [PATH] [OPTIONS...]\n\n"; + echo "\t--webui=\"[REQUIRED: path to the Piler WebUI Directory, default: $webuidir]\"\n"; + echo "\t--email=email address to look for conversations\n"; - echo("\noptions:\n"); - echo("\t-h Prints this help screen and exits\n"); - echo("\t--start=\"Beginning of date range to process, ok values are today, yesterday or DDMMMYYYY...anything php's strtotime can process. Optional, will default to beginning of current day.\"\n"); - echo("\t--stop=\"End of date range, same parameters as above. Optional (will default to end of current day)\"\n\n"); + echo "\noptions:\n"; + echo "\t-h Prints this help screen and exits\n"; + echo "\t--start=\"Beginning of date range to process, ok values are today, yesterday or DDMMMYYYY...anything php's strtotime can process. Optional, will default to beginning of current day.\"\n"; + echo "\t--stop=\"End of date range, same parameters as above. Optional (will default to end of current day)\"\n\n"; } - - -?>