if (count($argv) < 2) { printf("\n usage:\n \n %s <ZendTo preferences.php file> <email address>\n \n The ZendTo preferences.php file path should be canonical, not relative.\n Alternatively, do\n export ZENDTOPREFS=<full file path of preferences.php>\n %s <email address>\n\n If no email address is provided, the summary is displayed on stdout.\n\n", $argv[0], $argv[0]); return 0; } if (!preg_match('/^\\/.+/', $argv[1])) { echo "ERROR: You must provide a canonical path to the preferences.php file.\n"; return 1; } include $argv[1]; include_once NSSDROPBOX_LIB_DIR . "Smartyconf.php"; include_once NSSDROPBOX_LIB_DIR . "NSSDropoff.php"; if ($theDropbox = new NSSDropbox($NSSDROPBOX_PREFS)) { // // Get all drop-offs for the past 24 hours: // $newDropoffs = NSSDropoff::dropoffsCreatedToday($theDropbox); $totalFiles = 0; $totalBytes = 0.0; if ($newDropoffs && ($iMax = count($newDropoffs))) { $i = 0; $message = "Dropoff summary for " . timestampForTime(time() - 24 * 60 * 60) . " - " . timestampForTime(time()) . " :\n\n"; $message .= "=========================================================================================\n"; $message .= sprintf("%-18s %22s %s\n", "Claim ID", "Total Files & Size", "Sender"); $message .= "=========================================================================================\n"; while ($i < $iMax) { // Get a file list: $files = $newDropoffs[$i]->files(); if ($files && ($fileCount = $files['totalFiles'])) { $totalFiles += $fileCount; $totalBytes += floatval($files['totalBytes']); $message .= sprintf("[%s] %3d file%s %10s %s <%s>\n", $newDropoffs[$i]->claimID(), $fileCount, $fileCount != 1 ? "s" : " ", NSSFormattedMemSize($files['totalBytes']), $newDropoffs[$i]->senderName(), $newDropoffs[$i]->senderEmail());