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&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); } } } }
function spa_resequence_forums($groupid, $parent) { global $sequence; $forums = spa_get_group_forums_by_parent($groupid, $parent); if ($forums) { foreach ($forums as $forum) { $sequence++; spa_bump_forum_seq($forum->forum_id, $sequence); if ($forum->children) { $childlist = array(unserialize($forum->children)); if (count($childlist) > 0) { spa_resequence_forums($groupid, $forum->forum_id); } } } } }