2014-01-31 17:39:04 -05:00
|
|
|
#!/usr/bin/php
|
2014-01-31 17:38:29 -05:00
|
|
|
<?php
|
2017-09-03 09:23:55 -04:00
|
|
|
mb_internal_encoding('utf-8');
|
2014-01-31 17:38:29 -05:00
|
|
|
require dirname(__FILE__) . '/inc/cli.php';
|
|
|
|
|
2014-09-23 21:43:14 -04:00
|
|
|
$variants = array(array("hour", 3600), array("day", 3600*24), array("3 days", 3600*24*3),
|
|
|
|
array("week", 3600*24*7), array("month", 3600*24*7*30));
|
2014-01-31 17:38:29 -05:00
|
|
|
|
|
|
|
printf(" || ");
|
2014-09-23 21:43:14 -04:00
|
|
|
foreach ($variants as $iter) {
|
|
|
|
list($term, $time) = $iter;
|
2014-01-31 17:38:29 -05:00
|
|
|
printf("%8s | ", $term);
|
|
|
|
}
|
|
|
|
print("\n");
|
|
|
|
print(str_repeat('=', 13+11*count($variants)));
|
|
|
|
print("\n");
|
|
|
|
|
|
|
|
|
2017-09-03 09:23:55 -04:00
|
|
|
function mb_str_pad ($input, $pad_length, $pad_string, $pad_type, $encoding="UTF-8") {
|
|
|
|
if (!$encoding) {
|
|
|
|
$diff = strlen($input) - mb_strlen($input);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$diff = strlen($input) - mb_strlen($input, $encoding);
|
|
|
|
}
|
|
|
|
return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-31 17:38:29 -05:00
|
|
|
$q = query("SELECT uri FROM ``boards``");
|
|
|
|
while ($f = $q->fetch()) {
|
2017-09-03 09:23:55 -04:00
|
|
|
$str = $f['uri'];
|
|
|
|
$str = mb_str_pad($str,10," ", STR_PAD_LEFT, "UTF-8");
|
|
|
|
printf("%s || ", $str);
|
2014-09-23 21:43:14 -04:00
|
|
|
foreach ($variants as $iter) {
|
|
|
|
list($term, $time) = $iter;
|
2014-01-31 17:39:50 -05:00
|
|
|
$qq = query(sprintf("SELECT COUNT(*) as count FROM ``posts_%s`` WHERE time > %d", $f['uri'], time()-$time));
|
2014-01-31 17:38:29 -05:00
|
|
|
$c = $qq->fetch()['count'];
|
|
|
|
|
|
|
|
printf("%8d | ", $c);
|
|
|
|
}
|
|
|
|
print("\n");
|
|
|
|
}
|