예제 #1
0
function listings_count($parentID, $return = false)
{
    $API = new PerchAPI(1.0, 'perch_comments');
    $Comments = new PerchComments_Comments($API);
    $r = $Comments->get_count_for_parent($parentID, 'LIVE');
    if ($return) {
        return $r;
    }
    echo $r;
}
예제 #2
0
<?php

$HTML = $API->get('HTML');
$Form = $API->get('Form');
$message = false;
$Comments = new PerchComments_Comments();
include __DIR__ . '/../PerchComments_Akismet.class.php';
if (!$CurrentUser->has_priv('perch_comments.moderate')) {
    PerchUtil::redirect($API->app_path());
}
if (isset($_GET['id']) && $_GET['id'] != '') {
    $commentID = (int) $_GET['id'];
    $Comment = $Comments->find($commentID);
    $details = $Comment->to_array();
} else {
    $message = $HTML->failure_message('Sorry, that comment could not be found.');
}
$Template = $API->get('Template');
$Template->set('comments/comment.html', 'comments');
$Form->handle_empty_block_generation($Template);
$tags = $Template->find_all_tags_and_repeaters();
$Form->set_required_fields_from_template($Template, $details);
if ($Form->submitted()) {
    $fixed_fields = $Form->receive(array('commentName', 'commentEmail', 'commentHTML', 'commentStatus', 'commentDateTime', 'commentURL'));
    $data = $Form->get_posted_content($Template, $Comments, $Comment);
    $data = array_merge($data, $fixed_fields);
    if ($Comment->commentStatus() != $data['commentStatus']) {
        // status has changed
        $Comment->set_status($data['commentStatus']);
    }
    $Comment->update($data);
예제 #3
0
<?php

include 'PerchComments_Comments.class.php';
include 'PerchComments_Comment.class.php';
$API = new PerchAPI(1, 'perch_comments');
$Lang = $API->get('Lang');
$Comments = new PerchComments_Comments($API);
$comment_count = $Comments->get_count();
$comments = array();
$comments['Pending'] = $Comments->get_count('PENDING');
$comments['Live'] = $Comments->get_count('LIVE');
$comments['Rejected'] = $Comments->get_count('REJECTED');
$comments['Spam'] = $Comments->get_count('SPAM');
?>
<div class="widget">
	<h2>
		<?php 
echo $Lang->get('Comments');
?>
 <span class="note"><?php 
echo PerchUtil::html($comment_count);
?>
</span>
	</h2>
	<div class="bd">
		<?php 
echo '<ul class="mod">';
foreach ($comments as $label => $count) {
    echo '<li>';
    echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/addons/apps/perch_comments/?status=' . strtolower($label)) . '">';
    echo PerchUtil::html($Lang->get($label) . ' (' . $count . ')');
예제 #4
0
<?php

$HTML = $API->get('HTML');
$Paging = $API->get('Paging');
$Paging->set_per_page(20);
$Comments = new PerchComments_Comments($API);
$Form = $API->get('Form');
if ($Form->posted() && $Form->validate()) {
    $comments = $Form->find_items('comment-', true);
    if (PerchUtil::count($comments)) {
        $status = $_POST['commentStatus'];
        foreach ($comments as $commentID) {
            $Comment = $Comments->find($commentID);
            $Comment->set_status($status);
        }
    }
}
$pending_comment_count = $Comments->get_count('PENDING');
$comments = array();
$status = 'pending';
if (isset($_GET['status']) && $_GET['status'] != '') {
    $status = $_GET['status'];
}
$comments = $Comments->get_by_status($status, $Paging);
if ($comments == false) {
    $Comments->attempt_install();
}
예제 #5
0
<?php

$Comments = new PerchComments_Comments($API);
$pending_comment_count = $Comments->get_count('PENDING');
echo $HTML->subnav($CurrentUser, array(array('page' => array('perch_comments', 'perch_comments/edit'), 'label' => 'Moderate', 'priv' => 'perch_comments.moderate')));
예제 #6
0
function perch_comments_delete_old_spam($days)
{
    $API = new PerchAPI(1.0, 'perch_comments');
    $Comments = new PerchComments_Comments($API);
    return $Comments->delete_old_spam($days);
}