| 239 | | |
|---|
| | 240 | |
|---|
| | 241 | function blog_executive_summary_keyword($vars) { |
|---|
| | 242 | global $CFG; |
|---|
| | 243 | $body = ""; |
|---|
| | 244 | |
|---|
| | 245 | if (!isset($vars[1])) { |
|---|
| | 246 | $blog_posts = 2; |
|---|
| | 247 | } else { |
|---|
| | 248 | $blog_posts = $vars[1]; |
|---|
| | 249 | } |
|---|
| | 250 | |
|---|
| | 251 | $where = run("users:access_level_sql_where",$_SESSION['userid']); |
|---|
| | 252 | |
|---|
| | 253 | if (!isset($vars[2]) || $vars[2] == "all") { |
|---|
| | 254 | $posts = get_records_sql("select * from ".$CFG->prefix."weblog_posts where ($where) order by posted desc limit $blog_posts"); |
|---|
| | 255 | } else { |
|---|
| | 256 | $blog_id = (int) user_info_username('ident',$vars[2]); |
|---|
| | 257 | $posts = get_records_sql("select * from ".$CFG->prefix."weblog_posts where ($where) and weblog = $blog_id order by posted desc limit $blog_posts"); |
|---|
| | 258 | } |
|---|
| | 259 | |
|---|
| | 260 | if (is_array($posts) && !empty($posts)) { |
|---|
| | 261 | foreach($posts as $post) { |
|---|
| | 262 | $body .= "<div class=\"frontpage-blog-executive-summary\">"; |
|---|
| | 263 | $body .= "<div class=\"frontpage-blog-executive-icon\"><img src=\"". user_icon_html($post->weblog,100,true) ."\" align=\"left\" class=\"usericon\" /></div>"; |
|---|
| | 264 | $body .= "<h4>" . $post->title . "</h4>"; |
|---|
| | 265 | $body .= "<p class=\"frontpage-blog-date\">" . strftime("%B %d, %Y",$post->posted) . "</p>"; |
|---|
| | 266 | $postbodyarray = explode(" ", preg_replace( "|\w{3,10}://[\w\.\-_]+(:\d+)?[^\s\"\'<>\(\)\{\}]*|", "", strip_tags($post->body)), 30); |
|---|
| | 267 | $body .= "<p class=\"frontpage-blog-content\">" . implode(" ", array_slice($postbodyarray,0,sizeof($postbodyarray) - 1)) . " ...</p>"; |
|---|
| | 268 | $body .= "<p class=\"frontpage-blog-from\">" . __gettext("From:") . " <a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "\">" . user_info("name",$post->weblog) . "</a> - "; |
|---|
| | 269 | $body .= "<a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "/weblog/" . $post->ident . ".html\">" . __gettext("Read more") . "</a></p>"; |
|---|
| | 270 | $body .= "</div>"; |
|---|
| | 271 | } |
|---|
| | 272 | } |
|---|
| | 273 | |
|---|
| | 274 | return $body; |
|---|
| | 275 | } |
|---|
| | 276 | |
|---|
| | 277 | |
|---|