function display_post_by_id($postid) { $post = get_post($postid); $title = $post['title']; $content = $post['content']; $user = get_user($post['user']); $name = $user['firstname'] . " " . $user['lastname']; $tags = $post['tags']; $posttime = $post['posttime']; display_post($title, $content, $name, $tags, $posttime); write_edit_post_form($postid); }
// Affichage; unset($_SESSION["new_document_display"]); // On supprime le texte qui a été affiché } } break; case "remove_doc": delete_doc(); break; case "edit_doc": edit_doc(); break; // Affichage des propositions // Affichage des propositions case "display_post": display_post(); break; // Nouvelle proposition // Nouvelle proposition case "new_post": new_post(); break; // Suppression // Suppression case "remove_post": deletion(); break; // Edition // Edition case "edit_post": edition();
} else { // if it returns a non-blank string, it's an error // if it returns true (check with ===) the reply has been posted successfully // if it returns nothing, just show the form $result = post_reply(); if ($result === true) { $postid = mysql_insert_id(); header("Location: index.php?showthread={$threadid}&post={$postid}#post{$postid}"); } else { if ($result != '') { print '<b>The following errors occurred while posting your reply:<br>' . $result . '</b><br>Your post data has been saved.<hr>'; } if (isset($_POST['preview'])) { print "<b>Preview:</b>"; $posttext = getpost($_POST['text'], true, true, false); display_post($s[user], 'Posted', time(), $cmds, $posttext); print "<br>"; } if (isset($_GET['quote'])) { $quoteid = intval($_GET[quote]); $getquote = dbquery("SELECT * FROM posts WHERE id = {$quoteid} AND thread = {$threadid}"); if (dbrows($getquote) != 0) { // ignore the quote if it's an invalid id $quotepost = dbrow($getquote); $quotetime = parsedate($quotepost[postdate]); $quote = "[quote={$quotepost['authorname']} ({$quotetime})]{$quotepost['posttext']}[/quote]\n\n"; } } ?> <b>Replying to <?php echo htmlspecialchars($threadinfo[name]);
<?php // include function libraries include 'include_fns.php'; $postid = $HTTP_GET_VARS['postid']; // get post details $post = get_post($postid); do_html_header($post['title']); // display post display_post($post); // if post has any replies, show the tree view of them if ($post['children']) { echo '<br /><br />'; display_replies_line(); display_tree($HTTP_SESSION_VARS['expanded'], 0, $postid); } do_html_footer(); ?>
foreach ($Posts as $Post) { ?> <?php switch ($i % 3) { case 0: ?> <article class="col-xs-12"> <?php display_post($Post); ?> </article> <?php break; default: ?> <article class="col-xs-6"> <?php display_post($Post); ?> </article> <?php } ?> <?php $i++; } ?> </div> </div> </div>
$posttext = getpost($post[posttext], true, true, false); $cmds = ''; if ($post[editinfo]) { $cmds = " · {$post['editinfo']}"; } if ($s[user][powerlevel] >= $foruminfo[reply_power]) { $cmds .= " · <a href='index.php?m=board&act=postreply&id={$threadid}"e={$post['id']}'>Quote</a>"; } if ($s[user][userid] == $post[userid] || $s[user][powerlevel] >= $foruminfo[mod_power]) { $cmds .= " · <a href='index.php?m=board&act=editpost&id={$post['id']}'>Edit</a>"; } if ($s[user][powerlevel] >= $foruminfo[mod_power]) { $cmds .= " · <a href='#' onClick='if (confirm(\"Are you sure you want to delete this post?\") == true) { window.location = \"index.php?m=board&act=modpost&id={$post['id']}&func=delete\"; }'>Delete</a>"; } print "<a name='post{$post['id']}'></a>"; display_post($post, 'Posted', $post[postdate], $cmds, $posttext); } print "<b>Pages:</b> "; pagination($pagecount, $pagenum, "index.php?showthread={$threadid}"); print "<br><br>"; $can_reply = false; $locked = false; if ($s[user][powerlevel] >= $foruminfo[reply_power] && $threadinfo[locked] == 0) { $can_reply = true; } if ($threadinfo[locked] == 1) { $locked = true; } if ($s[user][powerlevel] >= $foruminfo[mod_power]) { $can_reply = true; }
print "You're not allowed to edit this post.<br><a href='index.php?showthread={$threadid}'>Return to the thread</a>"; } else { // if it returns a non-blank string, it's an error // if it returns true (check with ===) the post has been edited successfully // if it returns nothing, just show the form $result = edit_post(); if ($result === true) { header("Location: index.php?showthread={$threadinfo['id']}&post={$postid}#post{$postid}"); } else { if ($result != '') { print '<b>The following errors occurred while editing your post:<br>' . $result . '</b><br>Your post data has been saved.<hr>'; } if (isset($_POST['preview'])) { print "<b>Preview:</b>"; $posttext = getpost($_POST['text'], true, true, false); display_post($s[user], 'Posted', $postinfo[postdate], $cmds, $posttext); print "<br>"; } if (!isset($_POST['text'])) { $_POST[text] = $postinfo[posttext]; } ?> <b>Editing <?php echo htmlspecialchars($userinfo[username]); ?> 's post in <?php echo $threadinfo[name]; ?> : (<a href='index.php?showthread=<?php echo $threadinfo[id]; ?>
} else { // if it returns a non-blank string, it's an error // if it returns true (check with ===) the PM has been sent successfully // if it returns nothing, just show the form $result = send_pm(); // self-note: I failed here where I should have used ===, I used == if ($result === true) { header("Location: index.php?m=messages&sent=1"); } else { if ($result != '') { print '<b>The following errors occurred while sending your PM:<br>' . $result . '</b><br>Your message has been saved.<hr>'; } if (isset($_POST['preview'])) { print "<b>Preview:</b>"; $posttext = getpost($_POST['text'], true, true, false); display_post($s[user], 'Sent', time(), $cmds, $posttext); print "<br>"; } if (isset($_GET['reply'])) { $quoteid = intval($_GET[reply]); $getquote = dbquery("SELECT pmessages.*, users.username FROM pmessages LEFT JOIN users ON pmessages.sender=users.userid WHERE id = {$quoteid} AND ((sender = {$s[user][userid]} AND exists_sender = 1) or (recipient = {$s[user][userid]} AND exists_recipient = 1))"); if (dbrows($getquote) != 0) { // ignore the quote if it's an invalid id $quotepost = dbrow($getquote); $quotetime = parsedate($quotepost[sentdate]); $quote = "[quote={$quotepost['username']} ({$quotetime})]{$quotepost['text']}[/quote]\n\n"; } } if (isset($_GET['target'])) { $userid = intval($_GET[target]); $getuser = dbquery("SELECT username FROM users WHERE userid = {$userid}");