3 if (isset($parameter)) {
12 if (!isset($post_authors[$post->owner
])) {
16 $stuff = db_query("select users.* from users where ident = ".$post->owner
);
19 $author->fullname
= stripslashes($stuff->name
);
21 if ($stuff->icon
== -1 ||
$post->owner
== -1) {
22 $author->icon
= "default.png";
24 $icon = db_query("select filename from icons where ident = ".$stuff->icon
);
25 $author->icon
= $icon[0]->filename
;
28 $post_authors[$post->owner
] = $author;
31 if (!isset($post->authors
[$post->weblog
])) {
34 $stuff2 = db_query("select users.* from users where ident = ".$post->weblog
);
37 $community->fullname
= stripslashes($stuff2->name
);
39 if ($stuff2->icon
== -1) {
40 $community->icon
= "default.png";
42 $icon = db_query("select filename from icons where ident = ".$stuff2->icon
);
43 $community->icon
= $icon[0]->filename
;
46 $post_authors[$post->weblog
] = $community;
49 $date = gmdate("H:i",$post->posted
);
50 $username = run("users:id_to_name",$post->owner
);
51 $usericon = $post_authors[$post->owner
]->icon
;
52 if ($usericon == "default.png") {
53 $usericon = $post_authors[$post->weblog
]->icon
;
55 $fullname = $post_authors[$post->owner
]->fullname
;
56 $title = stripslashes($post->title
);
58 if ($post->owner
!= $post->weblog
) {
60 if ($post_authors[$post->owner
]->icon
== -1) {
61 $usericon = $post_authors[$post->weblog
]->icon
;
63 $fullname .= " @ " . $post_authors[$post->weblog
]->fullname
;
64 $username = run("users:id_to_name",$post->weblog
);
67 $body = run("weblogs:text:process",stripslashes($post->body
));
68 $More = gettext("More");
69 $Keywords = gettext("Keywords:");
70 $anyComments = gettext("comment(s)");
71 $body = str_replace("{{more}}","<a href=\"" . url
. "/".$username."/weblog/{$post->ident}.html\">$More ...</a>",$body);
72 $keywords = run("display:output_field", array("","keywords","weblog","weblog",$post->ident
,$post->owner
));
75 <div
class="weblog_keywords">
82 // if ($post->owner == $_SESSION['userid'] && logged_on) {
83 if (run("permissions:check",array("weblog:edit",$post->owner
))) {
84 $Edit = gettext("Edit");
85 $returnConfirm = gettext("Are you sure you want to permanently delete this weblog post?");
86 $Delete = gettext("Delete");
89 <div
class="blog_edit_functions">
91 [<a href
="{$url}_weblog/edit.php?action=edit&weblog_post_id={$post->ident}&owner={$post->owner}">$Edit</a
>]
92 [<a href
="{$url}_weblog/action_redirection.php?action=delete_weblog_post&delete_post_id={$post->ident}" onClick
="return confirm('$returnConfirm')">$Delete</a
>]
99 if (!isset($_SESSION['comment_cache'][$post->ident
]) ||
(time() - $_SESSION['comment_cache'][$post->ident
]->created
> 120)) {
100 $numcomments = db_query("select count(ident) as numcomments from weblog_comments where post_id = " . $post->ident
);
101 $_SESSION['comment_cache'][$post->ident
]->created
= time();
102 $_SESSION['comment_cache'][$post->ident
]->data
= $numcomments[0]->numcomments
;
104 $numcomments = $_SESSION['comment_cache'][$post->ident
]->data
;
106 $comments = "<a href=\"".url
.$username."/weblog/{$post->ident}.html\">$numcomments $anyComments</a>";
108 if (isset($individual) && ($individual == 1)) {
109 // looking at an individual post and its comments
113 if ($post->ident
> 0) {
114 // if post exists and is visible
116 $comments = db_query("select * from weblog_comments where post_id = " . $post->ident
. " order by posted asc");
118 if (sizeof($comments) > 0) {
119 foreach($comments as $comment) {
121 if (logged_on
&& ($comment->owner
== $_SESSION['userid'] ||
$post->owner
== $_SESSION['userid'])) {
122 $Edit = gettext("Edit");
123 $returnConfirm = gettext("Are you sure you want to permanently delete this weblog comment?");
124 $Delete = gettext("Delete");
125 $commentmenu = <<< END
127 [<a href
="{$url}_weblog/action_redirection.php?action=weblog_comment_delete&weblog_comment_delete={$comment->ident}" onClick
="return confirm('$returnConfirm')">$Delete</a
>]
131 $comment->postedname
= stripslashes($comment->postedname
);
133 // turn commentor name into a link if they're a registered user
134 if ($comment->owner
> 0) {
135 $commentownerusername = run("users:id_to_name",$comment->owner
);
136 $comment->postedname
= '<a href="' . url
. $commentownerusername . '/">' . $comment->postedname
. '</a>';
139 $commentsbody .= run("templates:draw", array(
140 'context' => 'weblogcomment',
141 'postedname' => $comment->postedname
,
142 'body' => run("weblogs:text:process",stripslashes($comment->body
)) . $commentmenu,
143 'posted' => strftime("%A, %e %B %Y, %R %Z",$comment->posted
)
148 $commentsbody = run("templates:draw", array(
149 'context' => 'weblogcomments',
150 'comments' => $commentsbody
156 $run_result .= run("templates:draw", array(
157 'context' => 'weblogpost',
159 'username' => $username,
160 'usericon' => $usericon,
162 'fullname' => $fullname,
164 'comments' => $commentsbody
168 if (logged_on ||
run("users:flags:get",array("publiccomments",$post->owner
))) {
169 $run_result .= run("weblogs:comments:add",$post);
171 $run_result .= "<p>" . gettext("You must be logged in to post a comment.") . "</p>";
175 // post is missing or prohibited
177 $run_result .= run("templates:draw", array(
178 'context' => 'weblogpost',
181 'usericon' => "default.png",
192 $run_result .= run("templates:draw", array(
193 'context' => 'weblogpost',
195 'username' => $username,
196 'usericon' => $usericon,
198 'fullname' => $fullname,
200 'commentslink' => $comments