// Set param prefix for URLs $param_prefix = 'cmnt_fullview_'; if (!empty($CommentList->param_prefix)) { $param_prefix = $CommentList->param_prefix; } // Get ready for display (runs the query): $CommentList->display_init(); } if ($user_perm_moderate_cmt && $CommentList->result_num_rows) { // We have comments awaiting moderation load_funcs('comments/model/_comment_js.funcs.php'); $nb_blocks_displayed++; $opentrash_link = get_opentrash_link(true, false, array('class' => 'btn btn-default')); $refresh_link = '<span class="floatright">' . action_icon(T_('Refresh comment list'), 'refresh', $admin_url . '?blog=' . $blog, ' ' . T_('Refresh'), 3, 4, array('onclick' => 'startRefreshComments( \'' . request_from() . '\' ); return false;', 'class' => 'btn btn-default')) . '</span> '; $show_statuses_param = $param_prefix . 'show_statuses[]=' . implode('&' . $param_prefix . 'show_statuses[]=', $user_modeartion_statuses); $block_item_Widget->title = $refresh_link . $opentrash_link . T_('Comments awaiting moderation') . ' <a href="' . $admin_url . '?ctrl=comments&blog=' . $Blog->ID . '&' . $show_statuses_param . '" style="text-decoration:none">' . '<span id="badge" class="badge badge-important">' . $CommentList->get_total_rows() . '</span></a>' . get_manual_link('collection-dashboard'); echo '<div class="evo_content_block">'; echo '<div id="comments_block" class="dashboard_comments_block">'; $block_item_Widget->disp_template_replaced('block_start'); echo '<div id="comments_container">'; // GET COMMENTS AWAITING MODERATION (the code generation is shared with the AJAX callback): show_comments_awaiting_moderation($Blog->ID, $CommentList); echo '</div>'; $block_item_Widget->disp_template_raw('block_end'); echo '</div>'; echo '</div>'; } /* * RECENT POSTS awaiting moderation */ $post_moderation_statuses = explode(',', $Blog->get_setting('post_moderation_statuses'));
/** * Show comments awaiting moderation * * @todo fp> move this to a more appropriate place * * @param integer blog ID * @param object CommentList * @param integer limit * @param array comment IDs to exclude * @param boolean TRUE - for script */ function show_comments_awaiting_moderation($blog_ID, $CommentList = NULL, $limit = 5, $comment_IDs = array(), $script = true) { global $current_User, $dispatcher; if (is_null($CommentList)) { // Inititalize CommentList $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog_ID, false, false); $CommentList = new CommentList2($Blog, NULL, 'CommentCache', 'cmnt_fullview_', 'fullview'); $exlude_ID_list = NULL; if (!empty($comment_IDs)) { $exlude_ID_list = '-' . implode(",", $comment_IDs); } $moderation_statuses = explode(',', $Blog->get_setting('moderation_statuses')); // Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $moderation_statuses, 'comment_ID_list' => $exlude_ID_list, 'post_statuses' => array('published', 'community', 'protected'), 'order' => 'DESC', 'comments' => $limit)); // Get ready for display (runs the query): $CommentList->display_init(); } $index = 0; $new_comment_IDs = array(); while ($Comment =& $CommentList->get_next()) { // Loop through comments: $new_comment_IDs[] = $Comment->ID; $index = $index + 1; // Only 5 commens should be visible, set hidden status for the rest $hidden_status = $index > 5 ? ' hidden_comment' : ''; echo '<div id="comment_' . $Comment->ID . '" class="dashboard_post dashboard_post_' . ($CommentList->current_idx % 2 ? 'even' : 'odd') . $hidden_status . '">'; /* OLD: echo '<div class="floatright"><span class="note status_'.$Comment->status.'"><span>'; $Comment->status(); echo '</span></span></div>'; NEW: */ $Comment->format_status(array('template' => '<div class="floatright"><span class="note status_$status$"><span>$status_title$</span></span></div>')); echo $Comment->get_author(array('before' => '<div class="dashboard_comment_avatar">', 'after' => '</div>', 'before_user' => '<div class="dashboard_comment_avatar">', 'after_user' => '</div>', 'link_text' => 'only_avatar', 'link_class' => 'user', 'thumb_size' => 'crop-top-80x80', 'thumb_class' => 'user')); echo '<h3 class="dashboard_comment_title">'; if ($Comment->status !== 'draft' || $Comment->author_user_ID == $current_User->ID) { // Display Comment permalink icon echo $Comment->get_permanent_link('#icon#') . ' '; } echo $Comment->get_title(array('author_format' => '<strong>%s</strong>', 'link_text' => 'login')); $comment_Item =& $Comment->get_Item(); echo ' ' . T_('in response to') . ' <a href="?ctrl=items&blog=' . $comment_Item->get_blog_ID() . '&p=' . $comment_Item->ID . '"><strong>' . $comment_Item->dget('title') . '</strong></a>'; echo '</h3>'; echo '<div class="notes">'; $Comment->rating(array('before' => '<div class="dashboard_rating">', 'after' => '</div> • ')); $Comment->date(); $Comment->author_url_with_actions('', true); $Comment->author_email('', ' • Email: <span class="bEmail">', '</span> • '); $Comment->author_ip('IP: <span class="bIP">', '</span> ', true, true); $Comment->ip_country(); $Comment->spam_karma(' • ' . T_('Spam Karma') . ': %s%', ' • ' . T_('No Spam Karma')); echo '</div>'; $Comment->content('htmlbody', true); echo '<div class="dashboard_action_area">'; // Display edit button if current user has the rights: $redirect_to = NULL; if (!$script) { // Set page, where to redirect, because the function is called from async.php (regenerate_url gives => async.php) global $admin_url; $redirect_to = $admin_url . '?ctrl=dashboard&blog=' . $blog_ID; } echo '<div class="floatleft">'; $Comment->edit_link(' ', ' ', get_icon('edit_button') . ' ' . T_('Edit'), '#', button_class('text_primary') . ' btn-sm w80px', '&', true, $redirect_to); echo '<span class="' . button_class('group') . ' btn-group-sm">'; // Display publish NOW button if current user has the rights: $Comment->publish_link('', '', '#', '#', button_class('text'), '&', true, true); // Display deprecate button if current user has the rights: $Comment->deprecate_link('', '', '#', '#', button_class('text'), '&', true, true); // Display delete button if current user has the rights: $Comment->delete_link('', '', '#', '#', button_class('text'), false, '&', true, true); echo '</span>'; echo '</div>'; // Display Spam Voting system $Comment->vote_spam('', '', '&', true, true, array('button_group_class' => button_class('group') . ' btn-group-sm')); echo '<div class="clear"></div>'; echo '</div>'; echo '</div>'; } if (!$script) { echo '<input type="hidden" id="new_badge" value="' . $CommentList->get_total_rows() . '"/>'; } }