Example #1
0
require_once "lib/postdisplay.php";
printHeader("Title", "Keywords", "Description", "allposts");
$post_id = null;
if (isset($_GET['postid'])) {
    $post_id = $_GET['postid'];
    if (isset($_GET['commentid']) and $_GET['commentid'] != '') {
        $show_comments = get_comment_ancestor_set($_GET['commentid']);
    } else {
        $show_comments = array();
    }
    display_post_by_id($post_id);
    echo "<p class=\"postReplyLink\"><a href=\"javascript:void(0);\" onclick=\"javascript:togglePostReplyVisibility('{$post_id}');\">Add a new comment</a></p>\n";
    //echo "<p class=\"postReplyCommentForm\">";
    write_post_reply_form($post_id);
    // Only display comments header if post has comments
    if (post_has_comments($post_id)) {
        $orderby = "posttime";
        $descending = true;
        $ordering = "oldestfirst";
        if (isset($_GET['ordering'])) {
            $ordering = $_GET['ordering'];
            switch ($_GET['ordering']) {
                case "newestfirst":
                    $orderby = "posttime";
                    $descending = true;
                    break;
                case "oldestfirst":
                    $orderby = "posttime";
                    $descending = false;
                    break;
                case "mostinsightful":
            //Get requested post, must typecast id to int.
            $post = get_post_data_byID((int) $_GET['postid']);
            $post_id = $post['id'];
            $post_title = $post['title'];
            $post_date = $post['date'];
            $post_url = $post['url'];
            $post_author = $post['author']['name'];
            $post_author_id = $post['author']['id'];
            $post_author_url = $post['author']['url'];
            $post_excerpt = $post['excerpt'];
            $post_image = isset($post['image']) && !empty($post['image']) ? sprintf('<figure><img src="%1$s" alt="%2$s"/></figure>', UPLOADURL . $post['image'], $post['image']) : '<p>No image found, try uploading one.</p>';
            $post_content = get_post_content_byID($post_id);
            $post_comments = $post['comments']['enable'];
            $post_comment_option = post_has_comments((int) $post['id']) ? 'disabled' : '';
            $post_comment_hidden = post_has_comments((int) $post['id']) ? '1' : '0';
            $post_comment_text = post_has_comments((int) $post['id']) ? '<p>Users have posted comments in this post, you cannot change this option.</p>' : '';
        }
    }
}
?>
<article id="post-editor" class="container ibs-body">
	<header>
		<h1>POST EDITOR</h1>
        <div class="tips-wrapper">
            <input class="tip-launcher" id="quick-tips" type="checkbox"/>
		    <label class="tip-l-box" for="quick-tips">
                <h4>Quick Tips</h4>
            </label>
            <div class="quick-tips-box mat-refresh">
                <ul>
                    <li><strong>PUBLISH BUTTON</strong> Will automatically publish your post for all the world to see.</li>