Пример #1
0
function sp_GetWaitingUrl($postlist, $a, $viewLabel, $unreadLabel, $modLabel, $spamLabel, $toolTip)
{
    global $spDevice;
    extract($a, EXTR_SKIP);
    $p = $spDevice == 'mobile' && current_theme_supports('sp-theme-responsive') ? SPABIMAGESMOB : SPABIMAGES;
    $buttonClass = esc_attr($buttonClass);
    $iconClass = esc_attr($iconClass);
    $icon = sp_paint_icon($iconClass, $p, sanitize_file_name($icon));
    $countClass = esc_attr($countClass);
    $viewLabel = sp_filter_title_display($viewLabel);
    $unreadLabel = sp_filter_title_display($unreadLabel);
    $modLabel = sp_filter_title_display($modLabel);
    $spamLabel = sp_filter_title_display($spamLabel);
    $toolTip = esc_attr($toolTip);
    $counts = sp_GetWaitingNumbers($postlist);
    $readcount = $counts['read'];
    $modcount = $counts['mod'];
    $spamcount = $counts['spam'];
    $site = SFHOMEURL . 'index.php?sp_ahah=admin-bar-newposts&sfnonce=' . wp_create_nonce('forum-ahah');
    $site2 = SFHOMEURL . 'index.php?sp_ahah=admin-bar-update&sfnonce=' . wp_create_nonce('forum-ahah') . '&target=newposts';
    $href = 'javascript:void(0)';
    $jscall = ' onclick="spabGetNewPostList(\'' . $site . '\', \'' . $site2 . '\');"';
    # All posts
    $out = "<a rel='nofollow' class='{$buttonClass}' title='{$toolTip}' href='{$href}' {$jscall}>";
    $out .= $icon . $viewLabel;
    $out .= '</a>';
    # Ordinary Posts
    $out .= "<div class='spUnreadCount {$countClass}'>";
    $adminClass = $readcount > 0 ? 'spUnreadUnread' : 'spUnreadRead';
    $out .= "{$unreadLabel}<span id='spUnread'><span class='{$adminClass}'>{$readcount} </span></span>";
    $out .= '</div>';
    $out .= "<div class='spModCount {$countClass}'>";
    $adminClass = $modcount > 0 ? 'spModUnread' : 'spModRead';
    $out .= "{$modLabel}<span id='spNeedModeration'><span class='{$adminClass}'>{$modcount} </span></span>";
    $out .= '</div>';
    $out .= "<div class='spSpamCount {$countClass}'>";
    $adminClass = $spamcount > 0 ? 'spSpamUnread' : 'spSpamRead';
    $out .= "{$spamLabel}<span id='spSpam'><span class='{$adminClass}'>{$spamcount} </span></span>";
    $out .= '</div>';
    return $out;
}
Пример #2
0
$target = isset($_GET['target']) ? $_GET['target'] : '';
if (empty($target)) {
    die;
}
# Update the New Post Counts
if ($target == 'newposts') {
    sp_forum_api_support();
    global $spThisUser;
    if ($spThisUser->admin || $spThisUser->moderator) {
        $item = isset($_GET['item']) ? $_GET['item'] : '';
        if (empty($item)) {
            die;
        }
        include_once SPABLIBDIR . 'sp-admin-bar-components.php';
        $newposts = sp_GetAdminsQueuedPosts();
        $counts = sp_GetWaitingNumbers($newposts);
        if ($item == 'unread') {
            $adminClass = $counts['read'] > 0 ? 'spUnreadUnread' : 'spUnreadRead';
            echo "<span class='{$adminClass}'>{$counts['read']} </span>";
        }
        if ($item == 'mod') {
            $adminClass = $counts['mod'] > 0 ? 'spModUnread' : 'spModRead';
            echo "<span class='{$adminClass}'>{$counts['mod']} </span>";
        }
        if ($item == 'spam') {
            $adminClass = $counts['spam'] > 0 ? 'spSpamUnread' : 'spSpamRead';
            echo "<span class='{$adminClass}'>{$counts['spam']} </span>";
        }
    }
    die;
}