Example #1
0
function get_post()
{
    $output = false;
    $id_reg = '/^[0-9]+$/';
    $proceed = false;
    $post = '';
    $header_markup = '';
    $body_markup = '';
    $footer_markup = '';
    $cat = '';
    if (isset($_GET['postid'])) {
        if (post_exist((int) $_GET['postid'])) {
            $post = get_post_data_byID((int) $_GET['postid']);
        }
    } else {
        if (isset($_GET['url'])) {
            $cat = isset($_GET['cat']) ? $_GET['cat'] : '';
            if (postlink_exist($_GET['url'], $cat)) {
                $post = get_post_data_byLINK($_GET['url']);
            }
        }
    }
    if (!empty($post) && is_array($post) && $post['status'] === 'ACTIVE') {
        //Get global settings
        $global_set = get_post_settings();
        $sb = $global_set['socialbar'];
        $sbpos = $sb['socialbarposition'];
        //Get All dependencies driven by conditionals
        //Get social bars
        $sb_markup = '';
        if ($sb['socialbarshow'] === '1') {
            $sb_markup .= '<div class="post-social-container">';
            switch ($global_set['socialbar']['socialbartype']) {
                case 'LIKE':
                    //like_bar();
                    break;
                case 'SHARE':
                    //share_bar();
                    break;
                case 'SHARE_LIKE':
                    //like_bar()
                    //share_bar();
                    break;
            }
            $sb_markup .= '</div>';
        }
        //Get Writter Card
        $author_card = $global_set['allowwritercard'] == '1' ? get_author_card($post['author']['id']) : '';
        //Get Comment thread if any
        $comment_thread = $post['comments']['enable'] == '1' ? display_comment_thread((int) $post['id']) : '';
        //Setup markup driven by conditions
        //Setup the excerpt and header image if any.
        $header_excerpt = '';
        $excerpt_markup = !empty($post['excerpt']) ? '<div class="post-except">' . $post['excerpt'] . '</div>' : '';
        $image_markup = !empty($post['image']) ? sprintf('<figure class="post-header-image"><img src="%1$s" alt="%1$s"></figure>', get_site_url() . '/images/upload/' . $post['image']) : '';
        //Put all the excerpt and header image together
        $header_excerpt .= $image_markup;
        $header_excerpt .= $excerpt_markup;
        //Set post markup by sections: HEADER BODY & FOOTER
        //HEADER
        $h_markup = '<article id="post-%1$s" class="full-post">';
        $h_markup .= '<header class="post-header">';
        $h_markup .= '<h1 class="post-title">%2$s</h1>';
        $h_markup .= '<div class="post-meta">';
        $h_markup .= '<ul>';
        $h_markup .= '<li>Published on: <strong  class="post-meta-date">%3$s</strong></li>';
        $h_markup .= '<li>Written by: <a class="post-meta-author" href="%4$s">%5$s</a></li>';
        $h_markup .= '</ul>';
        $h_markup .= '</div>%7$s %6$s </header>';
        $header_markup = sprintf($h_markup, $post['id'], $post['title'], date('Y-m-d', strtotime($post['date'])), $post['author']['url'], $post['author']['name'], $sbpos === 'TOP' || $sbpos === 'TOP_BOTTOM' ? $sb_markup : '', $header_excerpt);
        //BODY
        $body_markup = sprintf('<div class="post-body-wrapper"><section class="post-body">
                <div class="post-content">
                    %s
                </div>
            </section>', get_content_byFILENAME($post['content']));
        //FOOTER
        $footer_markup = sprintf('</div><footer class="post-footer">
                %1$s <!-- SOCIAL -->
                %2$s <!-- AUTHOR CARD -->
                %3$s <!-- COMMENT THREAD -->
                </footer>
            </article>', $sbpos === 'BOTTOM' || $sbpos === 'TOP_BOTTOM' ? $sb_markup : '', $author_card, $comment_thread);
    }
    $output .= '<div class="article-wrapper">';
    $output .= $header_markup;
    $output .= $body_markup;
    $output .= get_post_sidebar((int) $post['id'], 5);
    $output .= $footer_markup;
    $output .= '</div>';
    if (empty($output)) {
        $output = '<div class="not-found"><h1>SORRY!, The page you are looking for does not exist.</h1></div>';
    }
    echo $output;
    return;
}
Example #2
0
            default:
                claro_die(get_lang('Not allowed'));
        }
    } elseif ($ex instanceof Claro_Input_Exception) {
        $dialogBox->error(get_lang('Unset input variable'));
        $cmd = 'rqPost';
    } else {
        $dialogBox->error(get_lang('Unexpected error'));
        $cmd = 'dialog_only';
    }
}
//TODO handle these with ajax calls
$userInput->setValidator('notification', new Claro_Validator_ValueType('string'));
$notify = $userInput->get('notification', '');
//collect forum-topic-post settings and init some vars
$postSettingList = get_post_settings($postId);
$topicSettingList = get_topic_settings($topicId);
if (false !== $postSettingList && $editMode != 'quote') {
    $forumSettingList = get_forum_settings($postSettingList['forum_id']);
    $topicSettingList = get_topic_settings($postSettingList['topic_id']);
    $topicId = $topicSettingList['topic_id'];
} elseif (false !== $topicSettingList) {
    $forumSettingList = get_forum_settings($topicSettingList['forum_id']);
    $forumId = $forumSettingList['forum_id'];
} else {
    $forumSettingList = get_forum_settings($forumId);
}
$incrementViewCount = 'show' == $cmd ? true : false;
//init anonymity status
if (get_conf('clfrm_anonymity_enabled') == 'TRUE') {
    $anonymityStatus = $forumSettingList['anonymity'];
<?php

renew_session();
//Get global settings
$global_settings = get_post_settings();
$admin_action = '?action=newpost';
$publish_bt = 'publish';
$editor_title = '';
$alert_msg = '';
$url_container = '';
$actual_author = get_user_byname($_SESSION['CLIENT']);
$post_id = '';
$post_date = date('Y-m-d H:i:s', time());
$post_url = '';
$post_title = '';
$post_author = '';
$post_author_id = '';
$post_author_url = '';
$post_excerpt = '';
$post_content = '';
$post_comments = $global_settings['allowcomments'];
$post_image = '';
$post_comment_text = '';
$post_comment_option = '';
$post_comment_hidden = 0;
if (isset($_POST) && !empty($_POST['title'])) {
    $admin_action = '?action=editpost&postid=' . $_POST['id'];
    $image_upload = isset($_FILES) && $_FILES['image']['error'] == 0 ? $_FILES : '';
    // If publish button submitted
    if (isset($_POST['publish']) || isset($_POST['draftnew'])) {
        $draft = isset($_POST['draftnew']) ? true : false;