nid) {
case 48380:
$extra = searchquery_list();
break;
}
$node->content['body']['#value'] .= $extra;
}
}
function searchquery_list() {
if ($cache = cache_get('node_48380')) {
return $cache->data;
}
$output .= '
Anonymous users
';
$result = db_query("SELECT message, COUNT(message) AS cnt FROM {watchdog}
WHERE type = 'search' AND uid = 0
GROUP BY message
ORDER BY cnt DESC
LIMIT 300");
while ($s = db_fetch_object($result)) {
preg_match('!(.*?)!', $s->message, $matches);
$output .= '- '. check_plain($matches[1]) .' ('. $s->cnt .')
';
}
$output .= '
';
$output .= 'Authenticated users
';
$result = db_query("SELECT message, COUNT(message) AS cnt FROM {watchdog}
WHERE type = 'search' AND uid != 0
GROUP BY message
ORDER BY cnt
DESC limit 300");
while ($s = db_fetch_object($result)) {
preg_match('!(.*?)!', $s->message, $matches);
$output .= '- '. check_plain($matches[1]) .' ('. $s->cnt .')
';
}
$output .= '
';
cache_set('node_48380', 'cache', $output, 60*60);
return $output;
}