3 if (isset($parameter)) {
13 //if (!isset($post_authors[$post->owner])) {
17 $stuff = get_record('users','ident',$post->owner
);
19 $author->fullname
= stripslashes($stuff->name
);
21 if ($stuff->icon
== -1 ||
$post->owner
== -1) {
24 $icon = get_record('icons','ident',$stuff->icon
);
25 $author->icon
= $icon->ident
;
28 $post_authors[$post->owner
] = $author;
31 //if (!isset($post->authors[$post->weblog])) {
34 $stuff2 = get_record('users','ident',$post->weblog
);
36 $community->fullname
= stripslashes($stuff2->name
);
38 if (empty($stuff2->icon
) ||
$stuff2->icon
== -1) {
41 $icon = get_record('icons','ident',$stuff2->icon
);
42 $community->icon
= $icon->ident
;
45 $post_authors[$post->weblog
] = $community;
48 $date = gmdate("H:i",$post->posted
);
50 $username = run("users:id_to_name",$post->owner
);
53 // Allow plugins to set special icons
54 $specialicon = run("weblogs:posts:geticon",$post);
56 // If there is no special icon for this post, set to the default
57 if ($specialicon == NULL) {
58 $usericon = $post_authors[$post->owner
]->icon
;
59 if ($usericon == "default.png") {
60 $usericon = $post_authors[$post->weblog
]->icon
;
63 $usericon = $specialicon;
66 // Allow plugins to set the name on the post
67 $specialname = run("weblogs:posts:getname",$post);
68 if (empty($specialname)) {
69 $fullname = $post_authors[$post->owner
]->fullname
;
71 $fullname = $specialname;
73 if ($post->access
!= "PUBLIC") {
74 if ($post->access
== "LOGGED_IN") {
75 $title = "[" . gettext("Logged in users") . "]";
76 } else if (substr_count($post->access
, "user") > 0) {
77 $title = "[" . gettext("Private") . "]";
79 $title = "[" . gettext("Restricted") . "]";
85 $title .= " " . stripslashes($post->title
);
87 if ($post->owner
!= $post->weblog
) {
89 if ($post_authors[$post->owner
]->icon
== -1) {
90 $usericon = $post_authors[$post->weblog
]->icon
;
93 $fullname .= " @ " . $post_authors[$post->weblog
]->fullname
;
94 $username = run("users:id_to_name",$post->weblog
);
97 $body = run("weblogs:text:process",stripslashes($post->body
));
98 $More = gettext("More");
99 $Keywords = gettext("Keywords:");
100 $anyComments = gettext("comment(s)");
101 $body = str_replace("{{more}}","<a href=\"" . url
.$username."/weblog/{$post->ident}.html\">$More ...</a>",$body);
102 $keywords = display_output_field(array("","keywords","weblog","weblog",$post->ident
,$post->owner
));
106 <div
class="weblog_keywords">
108 $Keywords {$keywords}
113 // if ($post->owner == $_SESSION['userid'] && logged_on) {
114 if (run("permissions:check",array("weblog:edit",$post->owner
))) {
115 $Edit = gettext("Edit");
116 $returnConfirm = gettext("Are you sure you want to permanently delete this weblog post?");
117 $Delete = gettext("Delete");
120 <div
class="blog_edit_functions">
122 [<a href
="{$url}_weblog/edit.php?action=edit&weblog_post_id={$post->ident}&owner={$post->owner}">$Edit</a
>]
123 [<a href
="{$url}_weblog/action_redirection.php?action=delete_weblog_post&delete_post_id={$post->ident}" onclick
="return confirm('$returnConfirm')">$Delete</a
>]
130 if (!isset($_SESSION['comment_cache'][$post->ident
]) ||
(time() - $_SESSION['comment_cache'][$post->ident
]->created
> 120)) {
131 $numcomments = count_records('weblog_comments','post_id',$post->ident
);
132 $_SESSION['comment_cache'][$post->ident
]->created
= time();
133 $_SESSION['comment_cache'][$post->ident
]->data
= $numcomments;
135 $numcomments = $_SESSION['comment_cache'][$post->ident
]->data
;
137 $comments = "<a href=\"".url
.$username."/weblog/{$post->ident}.html\">$numcomments $anyComments</a>";
139 if (isset($individual) && ($individual == 1)) {
140 // looking at an individual post and its comments
144 if ($post->ident
> 0) {
145 // if post exists and is visible
147 if ($comments = get_records('weblog_comments','post_id',$post->ident
,'posted ASC')) {
148 foreach($comments as $comment) {
150 if (logged_on
&& ($comment->owner
== $_SESSION['userid'] ||
run("permissions:check", "weblog"))) {
151 $Edit = gettext("Edit");
152 $returnConfirm = gettext("Are you sure you want to permanently delete this weblog comment?");
153 $Delete = gettext("Delete");
154 $commentmenu = <<< END
157 [<a href
="{$url}_weblog/action_redirection.php?action=weblog_comment_delete&weblog_comment_delete={$comment->ident}" onclick
="return confirm('$returnConfirm')">$Delete</a
>]
161 $comment->postedname
= stripslashes($comment->postedname
);
163 // turn commentor name into a link if they're a registered user
164 if ($comment->owner
> 0) {
165 $commentownerusername = run("users:id_to_name",$comment->owner
);
166 $comment->postedname
= '<a href="' . url
. $commentownerusername . '/">' . $comment->postedname
. '</a>';
167 $comment->icon
= '<a href="' . url
. $commentownerusername . '/">' . "<img src=\"" . $CFG->wwwroot
. $commentownerusername . "/icons/" . run("icons:get",$comment->owner
) . "/w/50/h/50/\" border=\"0\" align=\"left\"/></a>";
169 $comment->icon
= "<img src=\"" . $CFG->wwwroot
. "_icons/data/default.png\" width=\"50\" height=\"50\" align=\"left\"/>";
172 $commentsbody .= templates_draw(array(
173 'context' => 'weblogcomment',
174 'postedname' => $comment->postedname
,
175 'body' => run("weblogs:text:process",stripslashes($comment->body
)) . $commentmenu,
176 'posted' => strftime("%A, %e %B %Y, %R %Z",$comment->posted
),
177 'usericon' => $comment->icon
182 $commentsbody = templates_draw(array(
183 'context' => 'weblogcomments',
184 'comments' => $commentsbody
190 $run_result .= templates_draw(array(
191 'context' => 'weblogpost',
193 'username' => $username,
194 'usericon' => $usericon,
196 'fullname' => $fullname,
197 'title' => "<a href=\"".url
.$username."/weblog/{$post->ident}.html\">$title</a>",
198 'comments' => $commentsbody
202 if (logged_on ||
run("users:flags:get",array("publiccomments",$post->owner
))) {
203 $run_result .= run("weblogs:comments:add",$post);
205 $run_result .= "<p>" . gettext("You must be logged in to post a comment.") . "</p>";
208 $run_result .= run("weblogs:interesting:form",$post->ident
);
211 // post is missing or prohibited
213 $run_result .= templates_draw(array(
214 'context' => 'weblogpost',
217 'usericon' => "default.png",
220 'title' => "<a href=\"".url
.$username."/weblog/{$post->ident}.html\">$title</a>",
227 $run_result .= templates_draw(array(
228 'context' => 'weblogpost',
230 'username' => $username,
231 'usericon' => $usericon,
233 'fullname' => $fullname,
234 'title' => "<a href=\"".url
.$username."/weblog/{$post->ident}.html\">$title</a>",
235 'commentslink' => $comments