data); $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX); Registry::set('DB_DATABASE', DB_DATABASE); Registry::set('db', $db); if($date1 > 0) { $date_condition = " AND sent >= $date1 "; } if($date2 > 0) { $date_condition .= " AND sent <= $date2 "; } $query = $db->query("select `from` AS email, count(`from`) AS num FROM " . VIEW_MESSAGES . " WHERE `to`=? $date_condition GROUP BY `from` ORDER BY num DESC LIMIT $page_len", array($email)); foreach($query->rows as $q) { $data[] = array( 'num' => $q['num'], EMAIL => $q[EMAIL], 'type' => 'rcvd' ); } $query = $db->query("select `to` AS email, count(`to`) AS num FROM " . VIEW_MESSAGES . " WHERE `from`=? $date_condition GROUP BY `to` ORDER BY num DESC LIMIT $page_len", array($email)); foreach($query->rows as $q) { $data[] = array( 'num' => $q['num'], EMAIL => $q[EMAIL], 'type' => 'sent' ); } array_multisort($data, SORT_DESC); foreach ($data as $q) { 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 "\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"; }