Breaking News

Whats Hot

\n”;

$output .= “

\n”;

/* ************** Hottest of all time *************************/
$list_length = 15;
$sql = “SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.totalcount > 0 THEN a.totalcount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => (‘?q=node/’.$mynode->nid),
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ************** Hottest of today *************************/
$list_length = 15;
$sql = “SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.daycount > 0 THEN a.daycount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => (‘?q=node/’.$mynode->nid),
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ************** Hottest of last week *************************/
$list_length = 15;
$sql = “SELECT title, path, MAX(timestamp) AS min_time, COUNT(*) AS rec_cnt FROM accesslog WHERE path LIKE ‘%book/%’ OR path LIKE ‘%node/%’ OR path LIKE ‘%image/%’ GROUP BY title, path ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => $mynode->path,
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ******* end of container ************ */

$output .= “

\n”;

$output .= “

\n”;

$output .= “

Hottest:

of all time\n”;

$output .= “
of today\n”;

$output .= “
of last weeks\n”;

$output .= “

Larger boxes indicate more popular items.\n”;
$output .= “
Darker boxes indicate older items.

\n”;
$output .= “

\n”;

print $output;
?>

\n”;

$output .= “

\n”;

/* ************** Hottest of all time *************************/
$list_length = 15;
$sql = “SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.totalcount > 0 THEN a.totalcount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => (‘?q=node/’.$mynode->nid),
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ************** Hottest of today *************************/
$list_length = 15;
$sql = “SELECT b.title, a.nid, b.created AS min_time, CASE WHEN a.daycount > 0 THEN a.daycount ELSE 1 END AS rec_cnt FROM node_counter a LEFT JOIN node b ON a.nid = b.nid ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => (‘?q=node/’.$mynode->nid),
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ************** Hottest of last week *************************/
$list_length = 15;
$sql = “SELECT title, path, MAX(timestamp) AS min_time, COUNT(*) AS rec_cnt FROM accesslog WHERE path LIKE ‘%book/%’ OR path LIKE ‘%node/%’ OR path LIKE ‘%image/%’ GROUP BY title, path ORDER BY rec_cnt DESC LIMIT $list_length”;
$all_nodes = array();
$result = db_query($sql);
$i=0;
$max_time_all = 19000101;
$min_time_all = 99991231;
$max_rec_cnt_all = 0;
$min_rec_cnt_all = 999999999;
$rec_cnt_all = 0;
while ($mynode = db_fetch_object($result)) {
$i += 1;
$all_nodes[$i] = array(
‘title’ => $mynode->title,
‘path’ => $mynode->path,
‘min_time’ => format_date($mynode->min_time,’custom’, ‘Ymd’)+0,
‘rec_cnt’ => $mynode->rec_cnt
);
$rec_cnt_all += $mynode->rec_cnt;
if ( $all_nodes[$i][‘min_time’] > $max_time_all ) $max_time_all = $all_nodes[$i][‘min_time’];
if ( $all_nodes[$i][‘min_time’] $max_rec_cnt_all ) $max_rec_cnt_all = $all_nodes[$i][‘rec_cnt’];
if ( $all_nodes[$i][‘rec_cnt’] rec_cnt_all = $rec_cnt_all \n”;
//$output .= “
max_time_all = $max_time_all \n”;
//$output .= “
min_time_all = $min_time_all \n”;
//$output .= “
max_rec_cnt_all = $max_rec_cnt_all \n”;
//$output .= “
min_rec_cnt_all = $min_rec_cnt_all \n”;
$output .= “

\n”;
$sum_rec_cnt = 0;
$myitems = array();
$i=1;
foreach ($all_nodes as $mynode) {
$myitems[$i] = $mynode;
$i += 1;
$sum_rec_cnt += $mynode[‘rec_cnt’];
if ( ($sum_rec_cnt+$mynode[‘rec_cnt’])/$rec_cnt_all > $ratio ) {
if ( $d_y-$a_y “;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_y-$a_y));
}
// set the target area
$a_x += $width;
}
else {
// drawing area
$width = round( ($sum_rec_cnt/$rec_cnt_all) * ($d_y-$a_y) );
$pos=$a_x;
foreach($myitems as $node) {
$output .= “

“;
$output .= ““. $node[‘title’] .”“;
$output .= “

\n”;
$pos += round(($node[‘rec_cnt’]/$sum_rec_cnt)*($d_x-$a_x));
}
// set the target area
$a_y += $width;
}
// reset algorithm
$i = 1;
$rec_cnt_all -= $sum_rec_cnt;
$sum_rec_cnt = 0;
unset($myitems);
$myitems = array();
}
}
$output .= “

\n”;

/* ******* end of container ************ */

$output .= “

\n”;

$output .= “

\n”;

$output .= “

Hottest:

of all time\n”;

$output .= “
of today\n”;

$output .= “
of last weeks\n”;

$output .= “

Larger boxes indicate more popular items.\n”;
$output .= “
Darker boxes indicate older items.

\n”;
$output .= “

\n”;

print $output;
?>