3 // ELGG weblog view page
6 require_once("../../includes.php");
14 global $CFG, $page_owner, $metatags, $PAGE;
17 $metatags .= "<style type=\"text/css\">";
18 $metatags .= str_replace('{{url}}', $CFG->wwwroot
, file_get_contents($CFG->dirroot
. "mod/forum/css"));
19 $metatags .= "</style>";
21 define("context", "forum");
25 $post = $_GET["post"];
28 $where = run("users:access_level_sql_where",$_SESSION['userid']);
30 if (!$post = get_record_select('weblog_posts','('.$where.') AND ident = '.$post)) {
34 $post->title
= __gettext("Access denied or post not found");
35 $post->posted
= time();
37 $post->body
= __gettext("Either this blog post doesn't exist or you don't currently have access privileges to view it.");
42 $profile_id = $post->weblog
;
43 $page_owner = $post->weblog
;
44 $weblog = user_info('username', $post->weblog
);
46 $_SESSION['redirect_url'] = $CFG->wwwroot
. 'mod/forum/forum.php?weblog=' . $weblog;
48 if ((context
== "forum") && run("users:type:get", $profile_id) == "community")
52 $num = count($PAGE->menu_sub
) +
1;
54 $PAGE->menu_sub
[$num]['name'] = "forum:blogview";
55 $PAGE->menu_sub
[$num]['html'] = '<a href="'.$CFG->wwwroot
. 'mod/forum/forum.php?weblog=' . $weblog . '">' . __gettext("Return to Forum") . '</a>';
57 $num = count($PAGE->menu_sub
) +
1;
58 $PAGE->menu_sub
[$num]['name'] = "forum:blogview";
59 $PAGE->menu_sub
[$num]['html'] = "<a href=\"" . $CFG->wwwroot
. $weblog . "/weblog/" . $post->ident
. ".html#new_weblog_comment\" title=\"" . __gettext("Add a comment...") . "\">" . __gettext("Add new comment") . "</a>";
63 templates_page_setup();
65 $time = gmstrftime("%b %d, %y",$post->posted
);
67 <table id=\"forum_table\" cellspacing=\"0\" summary=\"Forum Table\">
69 <th scope=\"col\" class=\"nobg\">" . __gettext("From") . "</th>
70 <th class=\"cent\">" . $post->title
. "</th>
77 <td class=\"cent\" valign=\"top\"><div class=\"user\"><a href=\"" . $CFG->wwwroot
. user_info("username",$post->owner
) . "/" . "\" title=\"" . __gettext("View profile...") . "\"><img src=\"" . $CFG->wwwroot
. "_icon/user/" . $post->icon
. "\"><br>" . user_info("name",$post->owner
) . "</a><br>" . $time . "</div></td>
78 <td>" . run("weblogs:text:process", $post->body
) . "";
80 if (run("permissions:check",array("weblog:edit",$post->owner
)))
82 $Edit = __gettext("Edit");
83 $returnConfirm = __gettext("Are you sure you want to permanently delete this forum post?");
84 $Delete = __gettext("Delete");
85 $body .="<div class=\"edit_delete\">
86 <a href=\"{$CFG->wwwroot}{$weblog}/weblog/edit/{$post->ident}\" title=\"$Edit\"><img src=\"images/edit.gif\" border=0></a>
87 <a href=\"{$CFG->wwwroot}/mod/blog/action_redirection.php?action=delete_weblog_post&delete_post_id={$post->ident}&extension=weblog\" onclick=\"return confirm('$returnConfirm')\" title=\"$Delete\"><img src=\"images/delete.gif\" border=0></a>
99 $select='select * from ' . $CFG->prefix
. 'weblog_comments Where post_id='. $post->ident
. ' ORDER by posted ASC';
101 $comments = get_records_sql($select);
102 $numberofcomments = get_record_sql("select count(*) as numberofcomments from ".$CFG->prefix
."weblog_comments WHERE post_id =" . $post->ident
);
103 $numberofcomments = $numberofcomments->numberofcomments
;
107 if (!empty($comments)){
109 foreach($comments as $comment) {
110 $body .= "<tr><td class=\"cent\" valign=\"top\"><div class=\"user\"><a href=\"" . $CFG->wwwroot
. user_info("username",$comment->owner
) . "/" . "\" title=\"" . __gettext("View profile...") . "\"><img src=\"" . $CFG->wwwroot
. "_icon/user/" . user_info("icon",$comment->owner
) . "/h/67/w/67\"><br>" . $comment->postedname
. "</a><br>" . gmstrftime('%b %d, %y',$comment->posted
) . "</div></td><td>" . run("weblogs:text:process", $comment->body
);
112 if (logged_on
&& ($comment->owner
== $_SESSION['userid'] ||
run("permissions:check",array("weblog:edit",$post->owner
))))
114 $returnConfirm = __gettext("Are you sure you want to permanently delete this forum comment?");
115 $Delete = __gettext("Delete");
116 $body .="<p align=right>
117 <a href=\"{$CFG->wwwroot}mod/blog/action_redirection.php?action=weblog_comment_delete&weblog_comment_delete={$comment->ident}&extension=weblog\" onclick=\"return confirm('$returnConfirm')\" title=\"$Delete\"><img src=\"images/delete.gif\" border=0></a>
124 $body .= "</td></tr>";
130 $body .= "</table><br><a href=\"" . $CFG->wwwroot
. user_info('username',$post->weblog
) . "/weblog/" . $post->ident
. ".html#new_weblog_comment\" title=\"" . __gettext("Add new comment...") . "\">" . __gettext("Add new comment...") . "</a><br><br>";
142 $title = run("profile:display:name") . " :: " . __gettext("Forum") . " :: " . stripslashes($post->title
);
144 $body = templates_draw(array(
145 'context' => 'contentholder',
151 echo templates_page_draw( array(