select(array('list' => $list, 'posts' => array(0, '>=')), 'asof ASC'); $a_points = $o_points->mlists(); if (! $a_points) { $a_points = array(); } $points = count($a_points); if ($points) { $x_int = ($width - $margin) / $points; } else { $x_int = 0; } $highest = 0; foreach ($a_points as $o_point) { $highest = max($highest, $o_point->get('posts')); } if ($highest) { $y_int = ($height * 0.90) / $highest; } else { $y_int = 0; } $height_posts = $height - ($highest * $y_int); $max_posts = $highest; $last_x = $left; if ($points) { $last_y = $height - ($a_points[0]->get('posts') * $y_int); } else { $last_y = 0; } for ($i = 0; $i < $points; $i++) { $o_point = $a_points[$i]; $this_y = $o_point->get('posts') * $y_int; $this_y = $height - $this_y; ImageLine($image, $last_x, $last_y, min($last_x + $x_int, $right - 1), $this_y, $colour_posts); $last_x += $x_int; $last_y = $this_y; } /* * Now do the subscribers */ $highest = 0; foreach ($a_points as $o_point) { $highest = max($highest, $o_point->get('count')); } if ($highest) { $y_int = ($height * 0.90) / $highest; } else { $y_int = 0; } $height_subscribers = $height - ($highest * $y_int); $max_subscribers = $highest; $last_x = $left; if ($points) { $last_y = $height - ($a_points[0]->get('count') * $y_int); } else { $last_y = 0; } for ($i = 0; $i < $points; $i++) { $o_point = $a_points[$i]; $this_y = $height - ($o_point->get('count') * $y_int); ImageLine($image, $last_x, $last_y, min($last_x + $x_int, $right - 1), $this_y, $colour_subscribers); $last_x += $x_int; $last_y = $this_y; } $height_subscribers = $height - ($highest * $y_int); /* * Draw the max-subscriber line across the graph */ ImageLine($image, $left, $height_subscribers, $right - 1, $height_subscribers, $grey); ImageLine($image, 0, $height_subscribers, $left, $height_subscribers, $colour_subscribers); $string = (string)$max_subscribers; $px = $left - 2 - (strlen($string) * ImageFontWidth(0)); ImageString($image, 0, $px, $height_subscribers + 3, $string, $colour_subscribers); ImageLine($image, $left, $height_posts, $right - 1, $height_posts, $grey); ImageLine($image, $right, $height_posts, $right + $margin, $height_posts, $colour_posts); $string = (string)$max_posts; ImageString($image, 0, $right + 2, $height_posts + 3, $string, $colour_posts); return $image; } ?>
\n" . " This information is collected and analysed on a daily basis.\n" . ' This report was generated at ' . strftime('%c', time()) . " and\n" . " covers a total of $total_lists mailing list" . ($total_lists == 1 ? ' ' : 's ') . "across $total_domains domain" . ($total_domains == 1 ? '' : 's') . ".\n" . "
\n" . "\n" . " The graph alongside each list shows the gross activity over the\n" . " last 90 days. The blue line\n" . " represents the number of subscribers to the list, and the red\n" . " line charts the number of posts per day. They are not\n" . " to the same scale. This graph is indicative only, showing\n" . " trends, not exact counts.\n" . "
\n" . " \n"; if ($total_domains != 0) { $per_cell = ceil($total_domains / 3); print "\n" . " Jump to the lists for a domain:\n" . "
\n" . "\n" . " | \n" . "
\n" . " A total of $n list" . ($n == 1 ? '' : 's') . ".\n" . "
\n"; } $mlist = $o_mlist->get('list'); if ($hash) { fputs($stderr, '#'); } $image = chartit($o_db, $mlist, 468, 200); $iname = preg_replace('/[.@]/', '_', $mlist) . '.png'; $fname = $tDirectory . DIRECTORY_SEPARATOR . $iname; if (! $dryRun) { ImagePNG($image, $fname); } $o_sel_mlist = $o_db->select(array('list' => $o_mlist->get('list'))); $subs = $o_mlist->subscriber_count(); $digesters = $o_mlist->digester_count(); $a_subs[$mlist] = $subs + (isset($digesters) ? $digesters : 0); $posts = $o_sel_mlist->total_posts(); $meanposts = sprintf('%.2f', $o_sel_mlist->mean_posts()); $a_meanposts[$mlist] = $meanposts; $days = $o_sel_mlist->post_days(); $days .= ' day' . ($days == 1 ? '' : 's'); $info = $o_mlist->info(true); if ($info) { $list = $o_mlist->get('list'); $domani = $o_mlist->get('domain'); $list = str_replace("@$domain", '', $list); $info = str_replace('<#l#>', $list, $info); $info = str_replace('<#l#>', $list, $info); $info = str_replace('<#h#>', $domain, $info); $info = str_replace('<#h#>', $domain, $info); /* * Try to turn all URLs into links. */ $re_uri = ('\b[-_A-Za-z0-9]+://[-.A-Za-z0-9]+(?::[0-9]+)?' . '(?:/[^\s()^]*)?'); $info = preg_replace('§' . "($re_uri)" . '§', '$1', $info); } $a_posts[$mlist] = $o_mlist->get('posts'); print "\n" . " Traffic statistics cover a total of $days.\n" . "
\n" . "Current subscribers: | \n" . '' . $o_mlist->subscriber_count() . " | \n" . "
Current digest subscribers: | \n" . '' . (isset($digesters) ? $o_mlist->digester_count() : 'No digest available') . " | \n" . "
Total posts ($days): | \n" . "$posts | \n" . "
Mean posts per day: | \n" . "$meanposts | \n" . "
$info | \n"
. "
List | Total posts | $mlist | \n" . "$posts | \n" . " \n"; if ($n++ > 10) { break; } } ?>
---|
List | Posts/day | $mlist | \n" . "$posts | \n" . " \n"; if ($n++ > 10) { break; } } ?>
---|
List | Subscribers | $mlist | \n" . "$subs | \n" . " \n"; if ($n++ > 10) { break; } } ?>
---|
Data collected, analysed, and presented using Perl, MySQL, PHP, and XML.