Exemplo n.º 1
0
<?php

$pubc = count(get_posts_list('ACTIVE'));
$drac = count(get_posts_list('DRAFT'));
$trac = count(get_posts_list('INACTIVE'));
$appc = count(get_comments_list('APPROVED'));
$penc = count(get_comments_list('PENDING'));
?>
<aside id="main-navigation">
	<input id="main-controls" name="" type="checkbox">
	<label for="main-controls">
		<p class="top-title">Main Controls</p>
		<section class="nav-wrapper">
            <label class="setting-container">
                <ul>
                    <li><a href="<?php 
echo ADMINURL . '?action=newpost';
?>
">Create new post</a></li>
                </ul>
            </label>
			<input class="side-switch" id="content-switch" name="nav-section" type="radio">
			<label for="content-switch" class="setting-container">
				<p class="setting-title">Posts Manager</p>
				<ul class="setting-options">
					<li><a href="<?php 
echo ADMINURL . '?action=allposts';
?>
">Published Posts (<strong><?php 
echo $pubc;
?>
Exemplo n.º 2
0
function comment_exist($comment_id)
{
    $output = false;
    $comments = get_comments_list();
    $i = 0;
    while ($i < count($comments)) {
        if ($comments[$i]['id'] === (int) $comment_id) {
            $output = true;
            break;
        }
        $i++;
    }
    return $output;
}
Exemplo n.º 3
0
                        <ul>
                            <li><strong>APPROVE</strong> Approve a comment to be published in the post.</li>
                            <li><strong>REPLY</strong> Opens a box to reply to the comment.</li>
                            <li><strong>DELETE</strong>Deletes a comment from the system, approved or pending, no way to retrieve it.</li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
	</header>
    <?php 
echo $alert_msg;
?>
    <section>
        <?php 
$comments = get_comments_list($status);
display_comments_nav($comments);
?>
    </section>
    <!-- REPLY BOX TEMPLATE -->
    <div id="comment-box-template" style="display:none;">
        <form action="<?php 
echo ADMINURL . '?action=adminreplied&status=APPROVED';
?>
" method="POST">
            <input type="hidden" name="user-email" value="" />
            <input type="hidden" name="user-website" value="" />
            <p>
                <span>Replying as:</span><input type="text" name="user-name" value="<?php 
echo empty($user['name']) ? $user['username'] : $user['name'];
?>
function update_commenting($value)
{
    $comments = get_comments_list();
    $posts_file = get_json_content(CONTENTPATH . 'content.json');
    $pps =& $posts_file['posts'];
    $pids = array();
    $flag = false;
    $output = false;
    //Get id of posts already having comments.
    //approved or pending
    if (is_array($comments) && !empty($comments)) {
        foreach ($comments as $cc) {
            if (!empty($cc['postparent'])) {
                array_push($pids, (int) $cc['postparent']);
            }
        }
    }
    $pids = array_values(array_unique($pids));
    //Update comment-enable on posts with no comments
    if (is_array($posts_file) && !empty($posts_file) && !empty($pids)) {
        foreach ($pps as &$p) {
            if (!in_array((int) $p['id'], $pids, true)) {
                $p['comments']['enable'] = $value;
            }
        }
        $flag = true;
    }
    if ($flag === true) {
        if (write_to_json(CONTENTPATH . 'content.json', $posts_file)) {
            $output = true;
        }
    }
    return $output;
}
Exemplo n.º 5
0
    $category_list = get_categories();
    $tpl = "posts_add_tpl.php";
}
// форма добавления и редактирования раздела
if ($_GET['id'] && $_GET['action'] == 'edit_category' || $_GET['action'] == 'add_category') {
    $category_edit = get_category($_GET['id']);
    $tpl = "posts_edit_category_tpl.php";
}
// Вывод списка разделов и категорий
if ($_GET['action'] == 'category') {
    $category_list = get_categories();
    $subcategory_list = get_subcategories();
    $tpl = "posts_list_category_tpl.php";
}
// Форма добавления новой категории
if ($_GET['action'] == 'add_subcategory') {
    $tpl = "posts_add_subcategory_tpl.php";
}
// Вывод комментариев
if ($_GET['action'] == 'comments') {
    $limit = '15';
    page_limit($limit);
    $comments_list = get_comments_list($limit);
    $tpl = "posts_list_comments_tpl.php";
}
// Форма изменения комментария
if ($_GET['action'] == 'edit_comment') {
    $comment = get_comment($_GET['id']);
    $tpl = "posts_edit_comments_tpl.php";
}
include "posts_main_tpl.php";