function spa_paint_group_forums($groupid, $parent, $parentname, $level)
{
    $space = '<img class="subArrow" src="' . SFADMINIMAGES . 'sp_SubforumLevel.png" alt="" />';
    $forums = spa_get_group_forums_by_parent($groupid, $parent);
    $noMembers = array();
    if ($forums) {
        $noMembers = spa_forums_check_memberships($forums);
        foreach ($forums as $forum) {
            $subforum = $forum->parent;
            $haschild = '';
            if ($forum->children) {
                $childlist = array(unserialize($forum->children));
                if (count($childlist) > 0) {
                    $haschild = $childlist;
                }
            }
            if (empty($forum->forum_icon)) {
                $icon = SPTHEMEICONSURL . 'sp_ForumIcon.png';
            } else {
                $icon = esc_url(SFCUSTOMURL . $forum->forum_icon);
                if (!file_exists(SFCUSTOMDIR . $forum->forum_icon)) {
                    $icon = SPTHEMEICONSURL . 'sp_ForumIcon.png';
                }
            }
            $rowClass = in_array($forum->forum_id, $noMembers) ? ' class="spWarningBG"' : '';
            ?>
			<tr id="forumrow-<?php 
            echo $forum->forum_id;
            ?>
" <?php 
            echo $rowClass;
            ?>
> <!-- display forum information for each forum -->
			<td style="text-align:center;width:2%"><?php 
            echo $forum->forum_id;
            ?>
</td>

			<td style="text-align:center;padding:8px 0px;width:5%"><?php 
            echo '<img src="' . $icon . '" alt="" title="' . spa_text('Current forum icon') . '" />';
            ?>

<?php 
            if ($haschild) {
                ?>
					<br /><img class="parentArrow" src="<?php 
                echo SFADMINIMAGES . 'sp_HasChild.png';
                ?>
" alt="" title="<?php 
                spa_etext('Parent Forum');
                ?>
" />
<?php 
            }
            ?>
			</td>

			<td>
				<div class="sp-half-row-left">
					<?php 
            if ($forum->forum_status) {
                echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_LockedBig.png" alt="" />';
            }
            if ($subforum) {
                ?>
						<?php 
                if ($forum->forum_disabled) {
                    echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_NoWrite.png" alt="" title="' . spa_text('Subforum is disabled') . '" /> ';
                }
                ?>
						<?php 
                echo str_repeat($space, $level - 1);
                ?>
						<img class="subArrow" src="<?php 
                echo SFADMINIMAGES . 'sp_Subforum.png';
                ?>
" alt="" title="<?php 
                spa_etext('Subforum');
                ?>
" />
						<div class='row-title'><strong><?php 
                echo sp_filter_title_display($forum->forum_name);
                ?>
</strong></div><div>(<?php 
                echo spa_text('Subforum of') . ': ' . $parentname . ')';
                ?>
</div><div><?php 
                echo sp_filter_text_display($forum->forum_desc);
                ?>
</div>
                    <?php 
            } else {
                ?>
						<?php 
                if ($forum->forum_disabled) {
                    echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_NoWrite.png" alt="" title="' . spa_text('Forum is disabled') . '" /> ';
                }
                ?>
						<div class='row-title'><strong><?php 
                echo sp_filter_title_display($forum->forum_name);
                ?>
</strong></div><div><?php 
                echo sp_filter_text_display($forum->forum_desc);
                ?>
</div>
                    <?php 
            }
            if (in_array($forum->forum_id, $noMembers)) {
                echo '<p><b>' . spa_text('Warning - There are no usergroups with members that have permission to use this forum') . '</b></p>';
            }
            sp_display_item_stats(SFTOPICS, 'forum_id', $forum->forum_id, spa_text('Topics'));
            echo ' | ';
            sp_display_item_stats(SFPOSTS, 'forum_id', $forum->forum_id, spa_text('Posts'));
            ?>
				</div>
				<div class="sp-half-row-right">
<?php 
            $base = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah');
            $target = "forum-{$forum->forum_id}";
            $image = SFADMINIMAGES;
            ?>
					<input id="sfreloadpb<?php 
            echo $forum->forum_id;
            ?>
" type="button" class="button-secondary" value="<?php 
            echo sp_splice(spa_text('Forum Permissions'), 0);
            ?>
" onclick="spjLoadForm('forumperm', '<?php 
            echo $base;
            ?>
', '<?php 
            echo $target;
            ?>
', '<?php 
            echo $image;
            ?>
', '<?php 
            echo $forum->forum_id;
            ?>
');" />
					<input type="button" class="button-secondary" value="<?php 
            echo sp_splice(spa_text('Edit Forum'), 0);
            ?>
" onclick="spjLoadForm('editforum', '<?php 
            echo $base;
            ?>
', '<?php 
            echo $target;
            ?>
', '<?php 
            echo $image;
            ?>
', '<?php 
            echo $forum->forum_id;
            ?>
');" />
					<input type="button" class="button-secondary" value="<?php 
            echo sp_splice(spa_text('Delete Forum'), 0);
            ?>
" onclick="spjLoadForm('deleteforum', '<?php 
            echo $base;
            ?>
', '<?php 
            echo $target;
            ?>
', '<?php 
            echo $image;
            ?>
', '<?php 
            echo $forum->forum_id;
            ?>
');" />
        	    	<?php 
            if ($forum->forum_disabled) {
                ?>
						<input type="button" class="button-secondary" value="<?php 
                echo sp_splice(spa_text('Enable Forum'), 0);
                ?>
" onclick="spjLoadForm('enableforum', '<?php 
                echo $base;
                ?>
', '<?php 
                echo $target;
                ?>
', '<?php 
                echo $image;
                ?>
', '<?php 
                echo $forum->forum_id;
                ?>
');" />
		            <?php 
            } else {
                ?>
        		        <input type="button" class="button-secondary" value="<?php 
                echo sp_splice(spa_text('Disable Forum'), 0);
                ?>
" onclick="spjLoadForm('disableforum', '<?php 
                echo $base;
                ?>
', '<?php 
                echo $target;
                ?>
', '<?php 
                echo $image;
                ?>
', '<?php 
                echo $forum->forum_id;
                ?>
');" />
		            <?php 
            }
            ?>
	        	</div>
			</td>
			</tr>

			<tr class="sfinline-form">  <!-- This row will hold ahah forms for the current forum -->
    			<td colspan="3" style="padding: 0 10px 0 0;border-bottom:1px solid #dddddd">
                    <div id="forum-<?php 
            echo $forum->forum_id;
            ?>
"></div>
    			</td>
			</tr>
<?php 
            if ($haschild) {
                $newlevel = $level + 1;
                spa_paint_group_forums($groupid, $forum->forum_id, $forum->forum_name, $newlevel);
            }
        }
    }
}
コード例 #2
0
function sp_move_post_popup()
{
    $thispost = sp_esc_int($_GET['pid']);
    $topicid = sp_esc_int($_GET['id']);
    $thispostindex = sp_esc_int($_GET['pix']);
    $thistopic = spdb_table(SFTOPICS, "topic_id={$topicid}", 'row');
    if (empty($thispost) || empty($thistopic)) {
        die;
    }
    $thisforum = spdb_table(SFFORUMS, "forum_id={$thistopic->forum_id}", 'row');
    if (!sp_get_auth('move_posts', $thistopic->forum_id)) {
        if (!is_user_logged_in()) {
            sp_etext('Access denied - are you logged in?');
        } else {
            sp_etext('Access denied - you do not have permission');
        }
        die;
    }
    ?>
	<div id="spMainContainer" class="spForumToolsPopup">
		<div class="spForumToolsHeader">
			<div class="spForumToolsHeaderTitle"><?php 
    echo sp_text('Move post');
    ?>
</div>
		</div>

		<form action="<?php 
    echo sp_build_url($thisforum->forum_slug, $thistopic->topic_slug, 1, 0);
    ?>
" method="post" name="movepostform">

			<input type="hidden" name="postid" value="<?php 
    echo $thispost;
    ?>
" />
			<input type="hidden" name="oldtopicid" value="<?php 
    echo $topicid;
    ?>
" />
			<input type="hidden" name="oldforumid" value="<?php 
    echo $thisforum->forum_id;
    ?>
" />
			<input type="hidden" name="oldpostindex" value="<?php 
    echo $thispostindex;
    ?>
" />

			<fieldset><legend><?php 
    sp_etext('Select Operation');
    ?>
</legend>

				<input type="radio" name="moveop" id="single" value="single" checked="checked" />
				<label for="single">&nbsp;<?php 
    sp_etext('Move this post only');
    ?>
</label><br />

				<input type="radio" name="moveop" id="tostart" value="tostart" />
				<label for="tostart">&nbsp;<?php 
    sp_etext('Move this post and ALL preceding posts');
    ?>
</label><br />

				<input type="radio" name="moveop" id="toend" value="toend" />
				<label for="toend">&nbsp;<?php 
    sp_etext('Move this post and ALL succeeding posts');
    ?>
</label><br />

				<input type="radio" name="moveop" id="select" value="select" />
				<label for="select">&nbsp;<?php 
    sp_etext('Move the posts listed below');
    ?>
:</label><br />

				<label for="idList"><?php 
    sp_etext('Post Numbers to move - separated by commas');
    ?>
</label><br />
				<input type="text" class="spControl" name="idlist" value="<?php 
    echo $thispostindex;
    ?>
," /><br /><br />

				<span>
				<input type="button" class="spSubmit" name="movetonew" value="<?php 
    echo sp_splice(sp_text('Move to a NEW topic'), 2);
    ?>
" onclick="jQuery('#oldtopic').hide(); jQuery('#newtopic').show();" />
				<input type="button" class="spSubmit" name="movetoold" value="<?php 
    echo sp_splice(sp_text('Move to an EXISTING topic'), 2);
    ?>
" onclick="jQuery('#newtopic').hide(); jQuery('#oldtopic').show();" />
				<input type="button" class="spSubmit" name="cancel" value="<?php 
    echo sp_splice(sp_text('Cancel Move'), 0);
    ?>
" onclick="jQuery('#dialog').dialog('close');" />
				</span>

			</fieldset>

			<div id="newtopic" class="spCenter" style="display:none;">
				<p class="spCenter" ><b><?php 
    sp_etext('Move to a NEW topic');
    ?>
</b></p>
				<?php 
    echo sp_render_group_forum_select(false, false, true, true, sp_text('Select forum'), 'forumid', 'spSelect');
    ?>
<br /><br />
				<p class="spCenter"><?php 
    sp_etext('New topic name');
    ?>
</p>
				<input type="text" class="spControl" size="80" name="newtopicname" value="" /><br /><br />
				<?php 
    do_action('sph_move_post_form', $thispost, $topicid);
    ?>
				<input type="submit" class="spSubmit" name="makepostmove1" value="<?php 
    sp_etext('Move');
    ?>
" />
			</div>

			<div id="oldtopic" class="spCenter" style="display:none;">
				<p class="spCenter" ><b><?php 
    sp_etext('Move to a EXISTING topic');
    ?>
</b></p>
				<p class="spCenter" ><?php 
    sp_etext('Click on the Move button below and when the page refreshes navigate to the target topic to complete the move');
    ?>
</p>
				<?php 
    do_action('sph_move_post_form', $thispost, $topicid);
    ?>
				<input type="submit" class="spSubmit" name="makepostmove2" value="<?php 
    sp_etext('Move');
    ?>
" />
			</div>

		</form>

	</div>
<?php 
}
コード例 #3
0
function spa_render_msbox_list($msbox, $uid, $name, $from, $num, $records, $offset, $max, $filter)
{
    $out = '';
    $empty = true;
    $out .= '<div align="center"><strong>' . $from . '</strong><br />';
    $out .= '<select class="msAddControl" multiple="multiple" size="10" id="temp-' . $name . $uid . '" name="temp-' . $name . $uid . '[]">';
    $out .= '</div>';
    if ($records) {
        foreach ($records as $record) {
            $empty = false;
            $out .= '<option value="' . $record->user_id . '">' . sp_filter_name_display($record->display_name) . '</option>' . "\n";
        }
    }
    if ($empty) {
        $out .= '<option disabled="disabled" value="-1">' . spa_text('List is empty') . '</option>';
    }
    $out .= '</select>';
    $out .= '<div align="center">';
    $out .= '<small style="line-height:1.6em;">' . spa_text('Paging Controls') . '</small><br />';
    $out .= '<span id="filter-working"></span>';
    $last = floor($max / $num) * $num;
    if ($last >= $max) {
        $last = $last - $num;
    }
    $disabled = '';
    if ($offset == 0) {
        $disabled = ' disabled="disabled"';
    }
    $site = SFHOMEURL . 'index.php?sp_ahah=multiselect&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;page_msbox=next&amp;msbox={$msbox}&amp;uid={$uid}&amp;name={$name}&amp;from=" . urlencode($from) . "&amp;num={$num}&amp;offset=0&amp;max={$max}&amp;filter={$filter}";
    $out .= '<input type="button"' . $disabled . ' id="firstpage' . $uid . '" class="button-secondary" value="<<" onclick="spjUpdateMultiSelectList(\'' . $site . '\', \'' . $name . $uid . '\');" />';
    $site = SFHOMEURL . 'index.php?sp_ahah=multiselect&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;page_msbox=next&amp;msbox={$msbox}&amp;uid={$uid}&amp;name={$name}&amp;from=" . urlencode($from) . "&amp;num={$num}&amp;offset=" . ($offset - $num) . "&amp;max={$max}&amp;filter={$filter}";
    $out .= '<input type="button"' . $disabled . ' id="prevpage' . $uid . '" class="button-secondary" value="<" onclick="spjUpdateMultiSelectList(\'' . $site . '\', \'' . $name . $uid . '\');" />';
    $out .= '&nbsp;&nbsp;';
    $disabled = '';
    if ($offset + $num >= $max) {
        $disabled = ' disabled="disabled"';
    }
    $site = SFHOMEURL . 'index.php?sp_ahah=multiselect&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;page_msbox=next&amp;msbox={$msbox}&amp;uid={$uid}&amp;name={$name}&amp;from=" . urlencode($from) . "&amp;num={$num}&amp;offset=" . ($offset + $num) . "&amp;max={$max}&amp;filter={$filter}";
    $out .= '<input type="button"' . $disabled . ' id="nextpage' . $uid . '" class="button-secondary" value=">" onclick="spjUpdateMultiSelectList(\'' . $site . '\', \'' . $name . $uid . '\');" />';
    $site = SFHOMEURL . 'index.php?sp_ahah=multiselect&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;page_msbox=next&amp;msbox={$msbox}&amp;uid={$uid}&amp;name={$name}&amp;from=" . urlencode($from) . "&amp;num={$num}&amp;offset={$last}&amp;max={$max}&amp;filter={$filter}";
    $out .= '<input type="button"' . $disabled . ' id="lastpage' . $uid . '" class="button-secondary" value=">>" onclick="spjUpdateMultiSelectList(\'' . $site . '\', \'' . $name . $uid . '\');" />';
    $out .= '<div style="clear:both;padding: 5px 0pt;">';
    $out .= '<input type="button" id="add' . $uid . '" class="button-secondary" value="' . sp_splice(spa_text('Move to Selected List'), 1) . '" onclick="spjTransferSelectList(\'temp-' . $name . $uid . '\', \'' . $name . $uid . '\', \'' . esc_js(spa_text('List is Empty')) . '\', \'' . esc_js(spa_text('Maximum of 400 Users would be exceeded - please reduce the selections')) . '\', \'' . $name . $uid . '\')" />';
    $out .= '<br />';
    $out .= '<input type=text id="list-filter' . $name . $uid . '" name="list-filter' . $name . $uid . '" value="' . $filter . '" class="sfacontrol" size="10" />';
    $gif = SFCOMMONIMAGES . "working.gif";
    $site = SFHOMEURL . 'index.php?sp_ahah=multiselect&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;page_msbox=filter&amp;msbox={$msbox}&amp;uid={$uid}&amp;name={$name}&amp;from=" . urlencode($from) . "&amp;num={$num}&amp;offset=0&amp;max={$max}";
    $out .= '<input type="button" id="filter' . $uid . '" class="button-secondary" value="' . spa_text('Filter') . '" style="margin-top:1px" onclick="spjFilterMultiSelectList(\'' . $site . '\', \'' . $name . $uid . '\', \'' . $gif . '\');" />';
    $out .= '</div>';
    $out .= '</div>';
    return $out;
}
function spa_forums_view_forums_permission_form($forum_id)
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	jQuery('#forumrow-<?php 
    echo $forum_id;
    ?>
').addClass('inForm');
    });
</script>
<?php 
    $forum = spdb_table(SFFORUMS, "forum_id={$forum_id}", 'row');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('View Forum Permissions'), false);
    $perms = sp_get_forum_permissions($forum->forum_id);
    if ($perms) {
        ?>
					<table class="sfmaintable" cellpadding="5" cellspacing="3">
						<tr>
							<td align="center" colspan="3"><strong><?php 
        echo spa_text('Current permission set for forum') . ' ' . sp_filter_title_display($forum->forum_name);
        ?>
</strong></td>
						</tr>
<?php 
        foreach ($perms as $perm) {
            $usergroup = spa_get_usergroups_row($perm->usergroup_id);
            $role = spa_get_role_row($perm->permission_role);
            ?>
						<tr>
							<td class="sflabel"><?php 
            echo sp_filter_title_display($usergroup->usergroup_name);
            ?>
 => <?php 
            echo sp_filter_title_display($role->role_name);
            ?>
</td>
							<td align="center">
<?php 
            $base = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah');
            $target = "curperm-{$perm->permission_id}";
            $image = SFADMINIMAGES;
            ?>
								<input type="button" class="spButton-tall" value="<?php 
            echo sp_splice(spa_text('Edit Permission Set'), 0);
            ?>
" onclick="spjLoadForm('editperm', '<?php 
            echo $base;
            ?>
', '<?php 
            echo $target;
            ?>
', '<?php 
            echo $image;
            ?>
', '<?php 
            echo $perm->permission_id;
            ?>
');" />
								<input type="button" class="spButton-tall" value="<?php 
            echo sp_splice(spa_text('Delete Permission Set'), 0);
            ?>
" onclick="spjLoadForm('delperm', '<?php 
            echo $base;
            ?>
', '<?php 
            echo $target;
            ?>
', '<?php 
            echo $image;
            ?>
', '<?php 
            echo $perm->permission_id;
            ?>
');" />
							</td>
			   			</tr>
						<tr class="sfinline-form"> <!-- This row will hold hidden forms for the current forum permission set -->
						  	<td colspan="3">
								<div id="curperm-<?php 
            echo $perm->permission_id;
            ?>
">
							</td>
						</tr>
					<?php 
        }
        ?>
				<?php 
    } else {
        ?>
					<table class="sfmaintable" cellpadding="5" cellspacing="3">
						<tr>
							<td>
								<?php 
        spa_etext('No permission sets for any usergroup');
        ?>
							</td>
						</tr>
				<?php 
    }
    ?>
			   			<tr>
			   				<td colspan="3" align="center">
<?php 
    $base = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    $target = "newperm-{$forum->forum_id}";
    $image = SFADMINIMAGES;
    ?>
								<input type="button" class="spButton-tall" value="<?php 
    echo sp_splice(spa_text('Add Permission'), 0);
    ?>
" onclick="spjLoadForm('addperm', '<?php 
    echo $base;
    ?>
', '<?php 
    echo $target;
    ?>
', '<?php 
    echo $image;
    ?>
', '<?php 
    echo $forum->forum_id;
    ?>
', 'sfopen');" />
			   				</td>
						</tr>
						<tr class="sfinline-form"> <!-- This row will hold ahah forms for adding a new forum permission set -->
						  	<td colspan="3">
								<div id="newperm-<?php 
    echo $forum->forum_id;
    ?>
">
								</div>
							</td>
						</tr>
					</table>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
	<form>
		<div class="sfform-submit-bar">
		<input type="button" class="button-primary" onclick="javascript:jQuery('#forum-<?php 
    echo $forum->forum_id;
    ?>
').html('');jQuery('#forumrow-<?php 
    echo $forum_id;
    ?>
').removeClass('inForm');" id="sfgroupdel<?php 
    echo $forum->forum_id;
    ?>
" name="forumcancel<?php 
    echo $forum->forum_id;
    ?>
" value="<?php 
    spa_etext('Cancel');
    ?>
" />
		</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>
	<div class="sfform-panel-spacer"></div>
<?php 
}
コード例 #5
0
function sp_NewPostListAdmin($newposts)
{
    global $spVars, $spThisUser, $spGlobals, $spDevice;
    $alt = '';
    $nourl = '';
    if ($newposts) {
        $index = array();
        foreach ($newposts as $newpost) {
            $forumid = $newpost['forum_id'];
            $index[$forumid] = count($newpost['topics']);
        }
        # Set up the autoupdate url (for quicklinks refreshing)
        $updateUrl = SFHOMEURL . 'index.php?sp_ahah=autoupdate&amp;sfnonce=' . wp_create_nonce('forum-ahah');
        # Display section heading
        echo '<div class="spAdminQueueHeader">';
        echo '<a id="newpoststop"></a>';
        $options = sp_get_option('spAdminBar');
        if ($spThisUser->admin || $spThisUser->moderator) {
            $p = $spDevice == 'mobile' && current_theme_supports('sp-theme-responsive') ? SPABIMAGESMOB : SPABIMAGES;
            echo '<form class="sfsubhead" action="' . sp_url() . '" method="post" name="removequeue">';
            echo '<input type="hidden" name="doqueue" value="1" />';
            echo '<p class="spLeft">' . __('New/Unread Posts Management', 'spab') . '</p>';
            echo '<a class="spButton spRight" href="javascript:document.removequeue.submit();">' . sp_paint_icon('', $p, "sp_markRead.png") . __('Empty the Admin Postbag', 'spab') . '</a>';
            echo '</form>';
            $removal = true;
            $canremove = '1';
        }
        echo '</div>';
        # Start actual listing display
        echo '<div class="spInlineSection spMessageSuccess" id="spAdminQueueMsg"></div>';
        # Display new posts heading
        sp_SectionStart('tagClass=spAdminQueueSection', 'AdminQueue');
        echo '<p style="text-align:center" class="spAdminBarTitle">' . __('Forums and Topics', 'spab') . '</p>';
        # Start with main forum header
        foreach ($newposts as $newpost) {
            # Display forum name
            echo '<div id="spAdminQueueForum' . $newpost['forum_id'] . '" class="spAdminQueueForum">';
            sp_ColumnStart('tagClass=spColumnSection spLeft&height=30px&width=9%');
            $icon = !empty($newpost['forum_icon']) ? sp_paint_custom_icon('spRopwIcon', SFCUSTOMURL . $newpost['forum_icon']) : sp_paint_icon('spTowIcon', SPTHEMEICONSURL, 'sp_ForumIcon.png');
            echo $icon;
            sp_ColumnEnd();
            sp_ColumnStart('tagClass=spColumnSection spLeft&height=30px&width=90%');
            echo '<p class="spAdminForum">';
            echo '<a class="spRowName" href="' . sp_build_url($newpost['forum_slug'], '', 1, 0) . '">Forum: ' . $newpost['forum_name'] . '</a>';
            echo '</p>';
            echo '<input type="hidden" id="tcount' . $newpost['forum_id'] . '" value="' . $index[$newpost['forum_id']] . '" />';
            sp_ColumnEnd();
            echo '<div class="spClear"></div>';
            echo '</div>';
            # Now for each topic with new posts
            foreach ($newpost['topics'] as $topic) {
                $postcountmod = 0;
                $postcountord = 0;
                # a quick first pass to load the post count variables and check for spam
                $is_spam = false;
                foreach ($topic['posts'] as $post) {
                    if ($post['post_status'] != 0 ? $postcountmod++ : $postcountord++) {
                    }
                    if ($post['post_status'] == 2) {
                        $is_spam = true;
                    }
                    $lastpost_id = $post['post_id'];
                }
                # Display topics in forum
                $class = $postcountmod ? 'spSubmit spModButton' : 'spSubmit spUnreadButton';
                echo '<div id="spAdminQueueTopic' . $topic['topic_id'] . '" class="spAdminQueueTopic">';
                sp_ColumnStart('tagClass=spColumnSection spLeft&height=30px&width=10%');
                echo "<input type='button' name='openicon" . $topic['topic_id'] . "' class='" . $class . "' value='";
                echo esc_attr(__('View', 'spab'));
                if ($is_spam) {
                    echo "\n" . esc_attr(__('Spam', 'spab'));
                }
                echo "' onclick='spjToggleLayer(\"spAdminQueueThisTopic" . $topic['topic_id'] . "\");' />";
                echo '<input type="hidden" id="pcount' . $topic['topic_id'] . '" value="' . $topic['post_count'] . '" />';
                echo '<input type="hidden" id="pcountmod' . $topic['topic_id'] . '" value="' . $postcountmod . '" />';
                echo '<input type="hidden" id="pcountord' . $topic['topic_id'] . '" value="' . $postcountord . '" />';
                sp_ColumnEnd();
                sp_ColumnStart('tagClass=spColumnSection spLeft&height=30px&width=90%');
                echo '<p>' . sp_get_topic_newpost_url($newpost['forum_slug'], $topic['topic_slug'], $topic['topic_name'], $lastpost_id, $post['post_index']) . '</p>';
                $nourl = '';
                if ($topic['post_count'] == 1) {
                    $note = __('There is 1 new post in this topic', 'spab');
                } else {
                    $note = sprintf(__('There are %s new posts in this topic', 'spab'), $topic['post_count']);
                }
                echo '<p class="spLabelSmall">' . $note . '</p>';
                sp_ColumnEnd();
                echo '<div class="spClear"></div>';
                echo '</div>';
                # Start display of post information
                echo '<div id="spAdminQueuePost' . $topic['topic_id'] . '" class="spAdminQueuePost">';
                echo '<div id="spAdminQueueThisTopic' . $topic['topic_id'] . '" class="spPostSection spInlineSection">';
                echo '<p style="text-align:center" class="spAdminBarTitle">' . __('Post Details', 'spab') . '</p>';
                $pindex = 0;
                $mod_required = false;
                # Start the post display loop
                foreach ($topic['posts'] as $post) {
                    $is_spam = false;
                    if ($pindex > 0) {
                        echo '<hr>';
                    }
                    echo '<div id="spAdminQueueThisPost' . $post['post_id'] . '" class="spAdminQueueThisPost">';
                    $pindex++;
                    $lastpost = $pindex == $topic['post_count'] ? true : false;
                    if ($post['post_status'] != 0) {
                        $mod_required = true;
                        echo '<div class="spAdminQueueMod spRight">' . __('Awaiting moderation', 'spab');
                        if ($post['post_status'] == 2) {
                            $is_spam = true;
                            echo '<br />' . __('Akismet marked as spam', 'spab');
                        }
                        echo '</div>';
                    }
                    echo '<b>' . sp_filter_name_display($post['display_name']) . '</b><br /><small>' . $post['user_type'] . '</small>';
                    echo '<br /><small>' . sprintf(__('Post %s in Topic', 'spab'), $post['post_index']) . '</small>';
                    echo '<hr />' . sp_filter_content_display($post['post_content']) . '</td>';
                    echo '</div>';
                    # Set up the ahah base url
                    $basesite = SFHOMEURL . "index.php?sp_ahah=moderation&amp;sfnonce=" . wp_create_nonce('forum-ahah') . "&amp;pid=" . $post['post_id'] . "&amp;tid=" . $topic['topic_id'] . "&amp;fid=" . $newpost['forum_id'];
                    echo '<div id="spAdminQueueThisPostButtons' . $post['post_id'] . '" class="spAdminQueueThisPostButtons">';
                    echo '<table><tr>';
                    if ($topic['post_count'] == 1) {
                        $label = __('This Post', 'spab');
                    } else {
                        $label = __('All Posts', 'spab');
                    }
                    if ($lastpost) {
                        $site = $basesite . '&amp;action=0&amp;canremove=' . $canremove;
                        if ($mod_required) {
                            if (sp_get_auth('moderate_posts', $newpost['forum_id'])) {
                                $posturl = sp_build_url($newpost['forum_slug'], $topic['topic_slug'], 0, $post['post_id'], $post['post_index']);
                            }
                        } else {
                            $posturl = sp_build_url($newpost['forum_slug'], $topic['topic_slug'], 0, $post['post_id'], $post['post_index']);
                        }
                        if ($mod_required) {
                            $m = $spDevice == 'mobile' ? esc_attr(__("Approve & Load", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s Approved and go to Topic", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="g0-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spabModeratePost(\'' . $posturl . '\', \'' . $site . '\', \'' . $removal . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'9\', \'' . $updateUrl . '\');" /></td>';
                            $m = $spDevice == 'mobile' ? esc_attr(__("Approve & Close", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s Approved and Close", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="a0-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spabModeratePost(\'' . $nourl . '\', \'' . $site . '\', \'' . $removal . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'0\', \'' . $updateUrl . '\');" /></td>';
                            if ($spDevice == 'mobile') {
                                echo '</tr></tr>';
                            }
                            $m = $spDevice == 'mobile' ? esc_attr(__("Approve & Reply", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s Approved and Quick Reply", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="q0-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spjToggleLayer(\'sfqform' . $topic['topic_id'] . '\');" /></td>';
                            $qaction = 0;
                        } else {
                            $site = $basesite . '&amp;action=1&amp;canremove=' . $canremove;
                            $m = $spDevice == 'mobile' ? esc_attr(__("Mark Read & Load", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s as Read and go to Topic", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="g1-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spabModeratePost(\'' . $posturl . '\', \'' . $site . '\', \'' . $removal . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'1\', \'' . $updateUrl . '\');" /></td>';
                            $m = $spDevice == 'mobile' ? esc_attr(__("Mark Read & Close", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s as Read and Close", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="a1-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spabModeratePost(\'' . $nourl . '\', \'' . $site . '\', \'' . $removal . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'1\', \'' . $updateUrl . '\');" /></td>';
                            if ($spDevice == 'mobile') {
                                echo '</tr></tr>';
                            }
                            $m = $spDevice == 'mobile' ? esc_attr(__("Mark Read & Reply", 'spab')) : sp_splice(esc_attr(sprintf(__("Mark %s as Read and Quick Reply", 'spab'), $label)), 2);
                            echo '<td><input type="button" class="spSubmit" name="a1-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spjToggleLayer(\'sfqform' . $topic['topic_id'] . '\');" /></td>';
                            $qaction = 1;
                        }
                    }
                    if ($removal) {
                        $remsite = $basesite . '&amp;action=2&amp;canremove=' . $canremove;
                        $msg = esc_js(__('Are you sure you want to delete this Post?', 'spab'));
                        $m = $spDevice == 'mobile' ? esc_attr(__("Delete Post", 'spab')) : sp_splice(esc_attr(__("Delete this Post", 'spab')), 0);
                        echo '<td><input type="button" class="spSubmit" name="a2-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="javascript: if(confirm(\'' . $msg . '\')) {spabModeratePost(\'' . $nourl . '\', \'' . $remsite . '\', \'' . $removal . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'2\', \'' . $updateUrl . '\');}" /></td>';
                        if ($post['user_type'] == 'Member' && $is_spam) {
                            $actionUrl = SFHOMEURL . 'index.php?sp_ahah=remove-spam&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;postid=' . $post['post_id'] . '&amp;userid=' . $post['user_id'];
                            $updateUrl = SFHOMEURL . 'index.php?sp_ahah=admin-bar-update&amp;target=newposts&amp;sfnonce=' . wp_create_nonce('forum-ahah');
                            echo '</tr></tr>';
                            $m = $spDevice == 'mobile' ? esc_attr(__("Remove Member & All Their Posts", 'spab')) : sp_splice(esc_attr(__("Remove this Member and All their Posts", 'spab')), 2);
                            echo '<td colspan="2"><input type="button" class="spSubmit" name="delSpam-' . $post['post_id'] . '" value="' . $m . '" style="white-space: pre;" onclick="spabRemoveSpam(\'' . $actionUrl . '\', \'' . $updateUrl . '\');" /></td>';
                        }
                    }
                    echo '</tr></table>';
                    # Quick Reply Form
                    if ($lastpost) {
                        $qsavesite = SFHOMEURL . "index.php?sp_ahah=quickreply&amp;sfnonce=" . wp_create_nonce('forum-ahah') . "&amp;tid=" . $topic['topic_id'] . "&amp;fid=" . $newpost['forum_id'];
                        echo '<div id="sfqform' . $topic['topic_id'] . '" class="spInlineSection">';
                        echo '<form action="' . sp_url() . '" method="post" name="addpost' . $topic['topic_id'] . '" onsubmit="return spabSaveQuickReply(this, \'' . $qsavesite . '\', \'' . $site . '\', \'' . $post['post_id'] . '\', \'' . $newpost['forum_id'] . '\', \'' . $topic['topic_id'] . '\', \'' . $post['post_status'] . '\', \'' . $qaction . '\', \'' . $updateUrl . '\')">';
                        echo '<textarea  tabindex="1" class="spControl" name="postitem' . $topic['topic_id'] . '" id="postitem' . $topic['topic_id'] . '" cols="60" rows="8"></textarea>';
                        echo '<br /><input type="submit" tabindex="2" class="spSubmit" id="sfsave' . $topic['topic_id'] . '" name="newpost' . $topic['topic_id'] . '" value="' . esc_attr(__('Save New Post', 'spab')) . '" />';
                        do_action('sph_quickreply_form', $newpost, $topic, $post);
                        echo '</form><br /></div>';
                    }
                    echo '</div>';
                }
                echo '</div>';
                echo '</div>';
            }
        }
        sp_SectionEnd('', 'AdminQueue');
    } else {
        echo '<div class="spMessage">';
        echo __('There are no unread posts', 'spab') . '</div>';
        echo "<div class='spInlineSection' id='spAdminQueueMsg'></div>\n";
    }
}