3 //let's include the basic stuff
4 require_once("includes.php");
7 if (!$CFG->walledgarden
) {
9 $limit = optional_param('limit',3,PARAM_INT
);
11 // query the database directly:
12 $posts = get_records_sql('SELECT wp.ident, u.name, u.username, wp.body, wp.title, wp.ident as postid, wp.posted
13 FROM '.$CFG->prefix
.'weblog_posts wp
14 LEFT JOIN '.$CFG->prefix
.'users u ON u.ident = wp.weblog
15 WHERE wp.access = "PUBLIC"
16 ORDER BY wp.posted DESC LIMIT ' . $limit);
18 foreach ($posts as $post) {
20 $body = strip_tags($post->body
);
21 $body = preg_replace( "|\w{3,10}://[\w\.\-_]+(:\d+)?[^\s\"\'<>\(\)\{\}]*|", "", $body);
22 $date = date("D, d M Y",$post->posted
);
25 <p
><b
><a href
="{$CFG->wwwroot}{$post->username}/weblog/{$post->postid}.html">{$post->title
}</a
></b
><br
/>{$date}</p
>