function spa_options_email_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfemailform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_email_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=options-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=email';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfemailform" name="sfemail">
	<?php 
    echo sp_create_nonce('forum-adminform_email');
    spa_paint_options_init();
    #== EMAIL Tab ============================================================
    spa_paint_open_tab(spa_text('Options') . ' - ' . spa_text('Email Settings'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('New User Email'), true, 'new-user-email');
    spa_paint_checkbox(spa_text('Use the Simple:Press new user email version'), 'sfusespfreg', $sfoptions['sfusespfreg']);
    echo '<p><strong>' . spa_text('The following placeholders are available: %USERNAME%, %BLOGNAME%, %SITEURL%, %LOGINURL%, %PWURL%') . '</strong></p>';
    spa_paint_input(spa_text('Email subject line'), 'sfnewusersubject', $sfoptions['sfnewusersubject'], false, true);
    spa_paint_wide_textarea(spa_text('Email message (no html)'), 'sfnewusertext', $sfoptions['sfnewusertext'], $submessage = '', 4);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_email_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Email Address Settings'), true, 'email-address-settings');
    spa_paint_checkbox(spa_text('Use the following email settings'), 'sfmailuse', $sfoptions['sfmailuse']);
    spa_paint_input(spa_text('The senders name'), 'sfmailsender', $sfoptions['sfmailsender'], false, false);
    spa_paint_input(spa_text('The email from name'), 'sfmailfrom', $sfoptions['sfmailfrom'], false, false);
    spa_paint_input(spa_text('The email domain name'), 'sfmaildomain', $sfoptions['sfmaildomain'], false, false);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_email_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Email Options');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_toolbox_toolbox_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sftoolboxform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_toolbox_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=toolbox';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sftoolboxform" name="sftoolbox">
	<?php 
    echo sp_create_nonce('forum-adminform_toolbox');
    spa_paint_options_init();
    #== TOOLBOX Tab ============================================================
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Toolbox'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Current Version/Build'), false);
    $version = spa_text('Version:') . '&nbsp;<strong>' . sp_get_option('sfversion') . '</strong>';
    $build = spa_text('Build:  ') . '&nbsp;<strong>' . sp_get_option('sfbuild') . '</strong>';
    echo $version . '&nbsp;&nbsp;&nbsp;&nbsp;' . $build;
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_toolbox_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Modify Build Number'), true, 'modify-build-number');
    echo '<div class="sfoptionerror">' . spa_text('WARNING: This value should not be changed unless requested by the Simple:Press team in the support forum as it may cause the install/upgrade script to be re-run.') . '</div>';
    spa_paint_input(spa_text('Build number'), "sfbuild", sp_get_option('sfbuild'), false, false);
    spa_paint_checkbox(spa_text('Force upgrade to build number'), "sfforceupgrade", $sfoptions['sfforceupgrade']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_toolbox_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Toolbox');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_admins_global_options_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfadminoptionsform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_admins_global_options_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=admins-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=globaladmin';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfadminoptionsform" name="sfadminoptions">
	<?php 
    echo sp_create_nonce('global-admin_options');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Admins') . " - " . spa_text('Global Admin Options'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Admin Options'), 'true', 'global-options');
    spa_paint_checkbox(spa_text('Display forum statistics in the dashboard'), 'sfdashboardstats', $sfoptions['sfdashboardstats']);
    spa_paint_checkbox(spa_text('Approve all posts in topic in moderation when an admin posts to the topic'), 'sfadminapprove', $sfoptions['sfadminapprove']);
    spa_paint_checkbox(spa_text('Approve all posts in topic in moderation when a moderator posts to the topic'), 'sfmoderapprove', $sfoptions['sfmoderapprove']);
    spa_paint_checkbox(spa_text('Display post/topic edit notices to users'), 'editnotice', $sfoptions['editnotice']);
    spa_paint_checkbox(spa_text('Display post/topic move notices to users'), 'movenotice', $sfoptions['movenotice']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_admins_global_left_panel');
    spa_paint_tab_right_cell();
    do_action('sph_admins_global_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Global Admin Options');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_forums_merge_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfmergeforums', 'sfreloadmf');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mergeforums';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmergeforums" name="sfmergeforums">
<?php 
    echo sp_create_nonce('forum-adminform_mergeforums');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Merge Forums'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Select Source Forum to Merge From'), false);
    ?>
				<div id="forumselect1">
					<?php 
    spa_etext('The source forum selected here will have all sub-forums, topics, posts and references transferred to the forum selected as the target for the merge. It will then be deleted.');
    ?>
<br /><br />
					<select class="sfacontrol" name="source">
						<?php 
    echo sp_render_group_forum_select(false, false, false, true, spa_text('Select Source Forum to Merge From'));
    ?>
					</select>
				</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Select Target Forum to Merge To'), true, 'merge-forums');
    ?>
				<div id="forumselect2">
					<?php 
    spa_etext('The target forum selected here will inherit all sub-forums, topics, posts and references from the source forum. Current permissions for this forum will be retained.');
    ?>
<br /><br />
					<select class="sfacontrol" name="target">
						<?php 
    echo sp_render_group_forum_select(false, false, false, true, spa_text('Select Target Forum to Merge To'));
    ?>
					</select>
				</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_forums_merge_forums_panel');
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
		<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Perform Forum Merge');
    ?>
" />
		</div>
	<?php 
    spa_paint_close_tab();
    ?>
	</form>
	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_toolbox_cron_form()
{
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=cron';
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfcronform', 'sfcron');
    });
</script>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfcronform" name="sfcronform">
	<?php 
    echo sp_create_nonce('forum-adminform_cron');
    $cronData = spa_get_cron_data();
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('CRON Inspector'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('CRON Schedules'), false);
    ?>
                <table class="widefat fixed spMobileTable800">
                    <thead>
                        <tr>
                            <th style='text-align:center'><?php 
    spa_etext('Name');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Description');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Interval');
    ?>
</th>
                        </tr>
                    </thead>
                    <tbody>
<?php 
    $class = 'class ="spMobileTableData"';
    foreach ($cronData->schedules as $name => $schedule) {
        ?>
                        <tr <?php 
        echo $class;
        ?>
>
                            <td data-label='<?php 
        spa_etext('Name');
        ?>
'><?php 
        echo $name;
        ?>
</td>
                            <td data-label='<?php 
        spa_etext('Description');
        ?>
'><?php 
        echo $schedule['display'];
        ?>
</td>
                            <td data-label='<?php 
        spa_etext('Interval');
        ?>
'><?php 
        echo $schedule['interval'];
        ?>
</td>
                        </tr>
<?php 
        $class = strpos($class, 'alternate') === false ? 'class="spMobileTableData alternate"' : 'class="spMobileTableData"';
    }
    ?>
                    </tbody>
                </table>
<?php 
    spa_paint_close_fieldset();
    spa_paint_open_fieldset(spa_text('Active CRON'), false);
    ?>
                <table class="widefat fixed spMobileTable1280">
                    <thead>
                        <tr>
                            <th style='text-align:center'><?php 
    spa_etext('Next Run (date)');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Next Run (timestamp)');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Schedule');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Hook');
    ?>
</th>
                            <th style='text-align:center'><?php 
    spa_etext('Arguments');
    ?>
</th>
                        </tr>
                    </thead>
                    <tbody>
<?php 
    $class = 'class ="spMobileTableData"';
    foreach ($cronData->cron as $time => $cron) {
        foreach ($cron as $hook => $items) {
            foreach ($items as $item) {
                ?>
                                <tr <?php 
                echo $class;
                ?>
>
                                    <td data-label='<?php 
                spa_etext('Next Run (date)');
                ?>
'><?php 
                echo $item['date'];
                ?>
</td>
                                    <td data-label='<?php 
                spa_etext('Next Run (timestamp)');
                ?>
'><?php 
                echo $time;
                ?>
</td>
                                    <td data-label='<?php 
                spa_etext('Schedule');
                ?>
'>
<?php 
                if ($item['schedule']) {
                    echo $cronData->schedules[$item['schedule']]['display'];
                } else {
                    spa_etext('One Time');
                }
                ?>
                                    </td>
                                    <td data-label='<?php 
                spa_etext('Hook');
                ?>
'>
<?php 
                $sph = strncmp('sph_', $hook, 4);
                if ($sph === 0) {
                    echo '<b>';
                }
                echo $hook;
                if ($sph === 0) {
                    echo '</b>';
                }
                ?>
                                    </td>
                                    <td data-label='<?php 
                spa_etext('Arguments');
                ?>
'>
<?php 
                if (count($item['args']) > 0) {
                    foreach ($item['args'] as $arg => $value) {
                        echo $arg . ':' . $value . '<br />';
                    }
                } else {
                    echo '&nbsp;';
                }
                ?>
                                    </td>
                                </tr>
<?php 
                $class = strpos($class, 'alternate') === false ? 'class="spMobileTableData alternate"' : 'class="spMobileTableData"';
            }
        }
    }
    ?>
                    </tbody>
                </table>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_top_cron_panel');
    spa_paint_close_container();
    echo '<div class="sfform-panel-spacer"></div>';
    spa_paint_close_tab();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('CRON Update'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Add CRON'), true, 'cron-add');
    spa_paint_input(spa_text('Next Run Timestamp'), 'add-timestamp', '');
    spa_paint_input(spa_text('Interval'), 'add-interval', '');
    spa_paint_input(spa_text('Hook'), 'add-hook', '');
    spa_paint_input(spa_text('Arguments'), 'add-args', '');
    spa_paint_close_fieldset();
    spa_paint_open_fieldset(spa_text('Run CRON'), true, 'cron-run');
    spa_paint_input(spa_text('Hook to run'), 'run-hook', '');
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_left_cron_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Delete CRON'), true, 'cron-delete');
    spa_paint_input(spa_text('Next Run Timestamp'), 'del-timestamp', '');
    spa_paint_input(spa_text('Hook'), 'del-hook', '');
    spa_paint_input(spa_text('Arguments'), 'del-args', '');
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_right_cron_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update CRON');
    ?>
" />
	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_integration_page_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('wppageform', 'sfreloadpp');
    });
</script>
<?php 
    $sfoptions = spa_get_integration_page_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=integration-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=page';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="wppageform" name="wppage">
	<?php 
    echo sp_create_nonce('forum-adminform_integration');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Integration') . ' - ' . spa_text('Page and Permalink'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('WP Forum Page Details'), true, 'forum-page-details');
    if ($sfoptions['sfpage'] == 0) {
        echo '<tr><td colspan="2"><div class="sfoptionerror">' . spa_text('ERROR: The page slug is either missing or incorrect. The forum will not display until this is corrected') . '</div></td></tr>';
    }
    spa_paint_select_start(spa_text('Select the WP Page to be used to display your forum'), 'slug', 'slug');
    echo spa_create_page_select($sfoptions['sfpage']);
    spa_paint_select_end();
    spa_paint_close_fieldset();
    if ($sfoptions['sfpage'] != 0) {
        $title = spdb_table(SFWPPOSTS, 'ID=' . $sfoptions['sfpage'], 'post_title');
        $template = spdb_table(SFWPPOSTMETA, "meta_key='_wp_page_template' AND post_id=" . $sfoptions['sfpage'], 'meta_value');
        spa_paint_open_fieldset(spa_text('Current WP Forum Page'), false);
        echo '<table class="form-table"><tr>';
        echo '<th>' . spa_text('Forum page ID') . '</th>';
        echo '<th>' . spa_text('Page title') . '</th>';
        echo '<th>' . spa_text('Page template') . '</th>';
        echo '</tr>';
        echo '<tr>';
        echo '<td class="sflabel">' . $sfoptions['sfpage'] . '</td>';
        echo '<td class="sflabel">' . $title . '</td>';
        echo '<td class="sflabel">' . $template . '</td>';
        echo '</tr></table>';
        spa_paint_close_fieldset();
        spa_paint_open_fieldset(spa_text('Update Forum Permalink'), true, 'forum-permalink');
        echo '<p class="sublabel">' . spa_text('Current permalink') . ':<br /></p><div class="subhead" id="adminupresult"><p>' . $sfoptions['sfpermalink'] . '</p></div><br />';
        spa_paint_update_permalink();
        spa_paint_close_fieldset();
    }
    spa_paint_close_panel();
    spa_paint_close_tab();
    spa_paint_spacer();
    spa_paint_open_tab(spa_text('Integration') . ' - ' . spa_text('WordPress and WordPress Theme'), false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Integration Options'), true, 'integration-options');
    spa_paint_checkbox(spa_text('Filter WP list pages'), 'sfwplistpages', $sfoptions['sfwplistpages']);
    spa_paint_checkbox(spa_text('Load javascript in footer'), 'sfscriptfoot', $sfoptions['sfscriptfoot']);
    spa_paint_checkbox(spa_text('Force the strict use of the WP API'), 'sfuseob', $sfoptions['sfuseob']);
    spa_paint_checkbox(spa_text('Run the wptexturize formatting on post content'), 'spwptexturize', $sfoptions['spwptexturize']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Theme Display Options'), true, 'theme-options');
    spa_paint_checkbox(spa_text('Limit forum display to within WP loop'), 'sfinloop', $sfoptions['sfinloop']);
    spa_paint_checkbox(spa_text('Allow multiple loading of forum content'), 'sfmultiplecontent', $sfoptions['sfmultiplecontent']);
    spa_paint_input(spa_text('Compensate (in pixels) for fixed WP theme header'), 'spheaderspace', $sfoptions['spheaderspace'], false, false);
    spa_paint_checkbox(spa_text('Bypass wp_head action complete requirement'), 'sfwpheadbypass', $sfoptions['sfwpheadbypass']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_integration_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update WP Integration');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_forums_edit_group_form($group_id)
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	jQuery('#grouprow-<?php 
    echo $group_id;
    ?>
').addClass('inForm');
    	spjAjaxForm('sfgroupedit<?php 
    echo $group_id;
    ?>
', 'sfreloadfb');
    });
</script>
<?php 
    global $spPaths;
    $group = $group = spdb_table(SFGROUPS, "group_id={$group_id}", 'row');
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=editgroup';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfgroupedit<?php 
    echo $group->group_id;
    ?>
" name="sfgroupedit<?php 
    echo $group->group_id;
    ?>
">
<?php 
    echo sp_create_nonce('forum-adminform_groupedit');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Edit Group'), 'true', 'edit-forum-group');
    ?>
					<input type="hidden" name="group_id" value="<?php 
    echo $group->group_id;
    ?>
" />
					<input type="hidden" name="cgroup_name" value="<?php 
    echo sp_filter_title_display($group->group_name);
    ?>
" />
					<input type="hidden" name="cgroup_desc" value="<?php 
    echo sp_filter_text_edit($group->group_desc);
    ?>
" />
					<input type="hidden" name="cgroup_seq" value="<?php 
    echo $group->group_seq;
    ?>
" />
					<input type="hidden" name="cgroup_icon" value="<?php 
    echo esc_attr($group->group_icon);
    ?>
" />
					<input type="hidden" name="cgroup_rss" value="<?php 
    echo $group->group_rss;
    ?>
" />
					<input type="hidden" name="cgroup_message" value="<?php 
    echo sp_filter_text_edit($group->group_message);
    ?>
" />
<?php 
    spa_paint_input(spa_text('Group Name'), 'group_name', sp_filter_title_display($group->group_name), false, true);
    spa_paint_input(spa_text('Description'), 'group_desc', sp_filter_text_edit($group->group_desc), false, true);
    spa_paint_select_start(spa_text('Select Custom Icon'), 'group_icon', '');
    spa_select_icon_dropdown('group_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $group->group_icon, false);
    spa_paint_select_end();
    spa_paint_input(spa_text('Replacement external RSS URL') . '<br />' . spa_text('Default') . ': <strong>' . sp_get_sfqurl(sp_build_url('', '', 0, 0, 0, 1)) . 'group=' . $group->group_id . '</strong>', 'group_rss', sp_filter_url_display($group->group_rss), false, true);
    spa_paint_wide_textarea('Special group message to be displayed above forums', 'group_message', sp_filter_text_edit($group->group_message));
    do_action('sph_forums_edit_group_panel');
    spa_paint_close_fieldset();
    echo '<div class="sfoptionerror spaceabove">';
    echo sprintf(sp_text('To re-order your Groups, Forums and SubForums use the %s Order Groups and Forums %s option from the Forums Menu'), '<b>', '</b>');
    echo '</div>';
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Default User Group Permissions'), false);
    echo '<strong>' . spa_text('Set default usergroup permission sets for this group') . '</strong><br />';
    echo spa_text('Note - This will not will add or modify any current permissions. It is only a default setting for future forums created in this group.  Existing default usergroup settings will be shown in the drop down menus');
    # Permissions
    $usergroups = spa_get_usergroups_all();
    $roles = sp_get_all_roles();
    foreach ($usergroups as $usergroup) {
        echo '<input type="hidden" name="usergroup_id[]" value="' . $usergroup->usergroup_id . '" />';
        spa_paint_select_start(sp_filter_title_display($usergroup->usergroup_name), 'role[]', '');
        $defrole = spa_get_defpermissions_role($group->group_id, $usergroup->usergroup_id);
        if ($defrole == -1 || $defrole == '') {
            echo '<option value="-1">' . spa_text('Select permission set') . '</option>';
        }
        foreach ($roles as $role) {
            $selected = '';
            if ($defrole == $role->role_id) {
                $selected = 'selected="selected" ';
            }
            echo '<option ' . $selected . 'value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n";
        }
        spa_paint_select_end();
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
		<input type="submit" class="button-primary" id="groupedit<?php 
    echo $group->group_id;
    ?>
" name="groupedit<?php 
    echo $group->group_id;
    ?>
" value="<?php 
    spa_etext('Update Group');
    ?>
" />
		<input type="button" class="button-primary" onclick="javascript:jQuery('#group-<?php 
    echo $group->group_id;
    ?>
').html('');jQuery('#grouprow-<?php 
    echo $group_id;
    ?>
').removeClass('inForm');" id="sfgroupedit<?php 
    echo $group->group_id;
    ?>
" name="groupeditcancel<?php 
    echo $group->group_id;
    ?>
" value="<?php 
    spa_etext('Cancel');
    ?>
" />
		</div>
	</form>

	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_options_content_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfcontentform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_content_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=options-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=content';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfcontentform" name="sfcontent">
	<?php 
    echo sp_create_nonce('forum-adminform_content');
    spa_paint_options_init();
    #== POSTS Tab ============================================================
    spa_paint_open_tab(spa_text('Options') . ' - ' . spa_text('Content Settings'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Date/Time Formatting'), true, 'date-time-formatting');
    spa_paint_input(spa_text('Date display format'), 'sfdates', $sfoptions['sfdates']);
    spa_paint_input(spa_text('Time display format'), 'sftimes', $sfoptions['sftimes']);
    spa_paint_link('http://codex.wordpress.org/Formatting_Date_and_Time', spa_text('Date/Time help'));
    $tz = get_option('timezone_string');
    if (empty($tz)) {
        $tz = spa_text('Unknown');
    }
    echo '&nbsp;' . spa_text('Server timezone set to') . ': ' . $tz;
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Image Enlargement'), true, 'image-enlarging');
    spa_paint_checkbox(spa_text('Use popup image enlargement'), 'sfimgenlarge', $sfoptions['sfimgenlarge']);
    spa_paint_checkbox(spa_text('Constrain popup enlargement to current window size'), 'constrain', $sfoptions['constrain']);
    spa_paint_checkbox(spa_text('Always use image thumbnails'), 'process', $sfoptions['process']);
    spa_paint_input(spa_text('Thumbnail width of images in posts (Minimum 100px)'), 'sfthumbsize', $sfoptions['sfthumbsize']);
    spa_paint_select_start(spa_text('Default image style'), 'style', 'style');
    echo spa_create_imagestyle_select($sfoptions['style']);
    spa_paint_select_end();
    spa_paint_checkbox(spa_text('Force paragraph after an image to start new line'), 'forceclear', $sfoptions['forceclear']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Smileys'), true, 'smileys');
    spa_paint_input(spa_text('Maximum smileys allowed in post (0 = unlimited)'), 'sfmaxsmileys', $sfoptions['sfmaxsmileys']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Spam Posts'), true, 'spam-post');
    spa_paint_checkbox(spa_text('Refuse duplicate post made by member'), 'sfdupemember', $sfoptions['sfdupemember']);
    spa_paint_checkbox(spa_text('Refuse duplicate post made by guest'), 'sfdupeguest', $sfoptions['sfdupeguest']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_content_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Additional Filtering'), true, 'additional-filters');
    spa_paint_checkbox(spa_text('Filter out HTML pre tags'), 'sffilterpre', $sfoptions['sffilterpre']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Post Links Filtering'), true, 'post-links-filtering');
    spa_paint_input(spa_text('Maximum links allowed in post (0 = unlimited)'), 'sfmaxlinks', $sfoptions['sfmaxlinks']);
    spa_paint_checkbox(spa_text('Add nofollow to links'), 'sfnofollow', $sfoptions['sfnofollow']);
    spa_paint_checkbox(spa_text('Open links in new tab/window'), 'sftarget', $sfoptions['sftarget']);
    spa_paint_input(spa_text('URL shortening limit (0 = not shortened)'), 'sfurlchars', $sfoptions['sfurlchars']);
    $submessage = spa_text("If post viewer doesn't have view links permission, this custom message will be displayed instead");
    spa_paint_textarea(spa_text('Hidden links custom message'), 'sfnolinksmsg', $sfoptions['sfnolinksmsg'], $submessage, 3);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Shortcodes Filtering'), true, 'shortcode-filters');
    spa_paint_checkbox(spa_text('Filter WP shortcodes (if disabled ALL WP shortcodes will be passed)'), 'sffiltershortcodes', $sfoptions['sffiltershortcodes']);
    $submessage = spa_text('Enter allowed WP shortcodes (if filtering enabled above) - one shortcode per line.');
    spa_paint_textarea(spa_text('Allowed WP shortcodes in posts'), 'sfshortcodes', $sfoptions['sfshortcodes'], $submessage, 3);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_content_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Content Options');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_options_display_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfdisplayform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_display_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=options-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=display';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfdisplayform" name="sfdisplay">
	<?php 
    echo sp_create_nonce('forum-adminform_display');
    spa_paint_options_init();
    #== GLOBAL Tab ============================================================
    spa_paint_open_tab(spa_text('Options') . ' - ' . spa_text('General Display Settings'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum Page Title'), true, 'forum-page-title');
    spa_paint_checkbox(spa_text('Remove page title completely'), 'sfnotitle', $sfoptions['sfnotitle']);
    spa_paint_input(spa_text('Graphic replacement URL'), 'sfbanner', $sfoptions['sfbanner'], false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum View Formatting'), true, 'topic-view-formatting');
    spa_paint_input(spa_text('Topics to display per page'), 'sfpagedtopics', $sfoptions['sfpagedtopics']);
    spa_paint_checkbox(spa_text('Sort topics by most recent postings (newest first)'), 'sftopicsort', $sfoptions['sftopicsort']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Topic View Formatting'), true, 'post-view-formatting');
    spa_paint_input(spa_text('Posts to display per page'), 'sfpagedposts', $sfoptions['sfpagedposts']);
    spa_paint_checkbox(spa_text('Sort posts newest to oldest'), 'sfsortdesc', $sfoptions['sfsortdesc']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_display_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Integrated Editor Toolbar'), true, 'editor-options-toolbar');
    spa_paint_checkbox(spa_text('Use the integrated editor options toolbar'), 'sftoolbar', $sfoptions['sftoolbar']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Unread Posts'), true, 'unread-posts');
    spa_paint_input(spa_text('Default number of unread posts for users'), 'sfdefunreadposts', $sfoptions['sfdefunreadposts']);
    spa_paint_checkbox(spa_text('Allow users to set number of unread posts in profile'), 'sfusersunread', $sfoptions['sfusersunread']);
    spa_paint_input(spa_text('Max number of unread posts allowed to be set by users'), 'sfmaxunreadposts', $sfoptions['sfmaxunreadposts']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Single Forum Sites'), true, 'single-forum-sites');
    spa_paint_checkbox(spa_text('Skip group view on single forum sites'), 'sfsingleforum', $sfoptions['sfsingleforum']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Display Forum Stats'), true, 'display-forum-statistics');
    spa_paint_input(spa_text('Update interval for stats (in hours)'), 'statsinterval', $sfoptions['statsinterval'], false, false);
    spa_paint_input(spa_text('Display how many top posters'), 'showtopcount', $sfoptions['showtopcount'], false, false);
    spa_paint_input(spa_text('Display how many new users'), 'shownewcount', $sfoptions['shownewcount'], false, false);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_display_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Display Options');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_options_global_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfglobalform', 'sfreloadog');
    });
</script>
<?php 
    global $wp_roles, $tab;
    $sfoptions = spa_get_global_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=options-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=global';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfglobalform" name="sfglobal">
	<?php 
    echo sp_create_nonce('forum-adminform_global');
    spa_paint_options_init();
    #== GLOBAL Tab ============================================================
    spa_paint_open_tab(spa_text('Options') . ' - ' . spa_text('Global Settings'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Lock Down Forum'), true, 'lock-down-forum');
    spa_paint_checkbox(spa_text('Lock the entire forum (read only)'), 'sflockdown', $sfoptions['sflockdown']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('WP Admin Pages Access'), true, 'block-admin');
    spa_paint_checkbox(spa_text('Block user access to WP admin pages'), 'blockadmin', $sfoptions['blockadmin']);
    if ($sfoptions['blockadmin']) {
        $roles = array_keys($wp_roles->role_names);
        if ($roles) {
            echo '<tr><td colspan="2"><p class="subhead">' . spa_text('Allow these WP roles access to the WP admin') . ':</p>';
            echo '<p><strong><small>(' . spa_text('Administrators will always have access') . ')</small></strong></p></td></tr>';
            foreach ($roles as $index => $role) {
                if ($role != 'administrator') {
                    spa_paint_checkbox($role, 'role-' . $index, $sfoptions['blockroles'][$role]);
                }
            }
        }
        spa_paint_input(spa_text('URL to redirect to if blocking admin access'), 'blockredirect', $sfoptions['blockredirect'], false, true);
        spa_paint_checkbox(spa_text("Redirect to user's profile page (overrides URL above)"), 'blockprofile', $sfoptions['blockprofile']);
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Auto Update'), true, 'auto-update');
    spa_paint_checkbox(spa_text('Use auto update'), 'sfautoupdate', $sfoptions['sfautoupdate']);
    spa_paint_input(spa_text('How many seconds before refresh'), 'sfautotime', $sfoptions['sfautotime']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('New Posts/Topics Cache'), true, 'topic-cache');
    spa_paint_input(spa_text('How many new posts to keep in cache list'), 'topiccache', $sfoptions['topiccache']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Flood Control'), true, 'flood-control');
    spa_paint_input(spa_text('Flood control interval (seconds) required between multiple posts from single user (0 disables)'), 'floodcontrol', $sfoptions['floodcontrol']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_global_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('RSS Feeds'), true, 'rss-feeds');
    spa_paint_input(spa_text('Number of recent posts to feed'), 'sfrsscount', $sfoptions['sfrsscount']);
    spa_paint_checkbox(spa_text('Limit feeds to topic names (no post content)'), 'sfrsstopicname', $sfoptions['sfrsstopicname']);
    spa_paint_input(spa_text('Limit to number of words if showing content (0 = all)'), 'sfrsswords', $sfoptions['sfrsswords']);
    spa_paint_checkbox(spa_text('Enable feedkeys for private RSS feeds'), 'sfrssfeedkey', $sfoptions['sfrssfeedkey']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('CSS/JS Combined Caching'), true, 'combined-caches');
    spa_paint_checkbox(spa_text('Enable combining and caching of forum CSS files'), 'combinecss', $sfoptions['combinecss']);
    spa_paint_checkbox(spa_text('Enable combining and caching of forum script (JS) files'), 'combinejs', $sfoptions['combinejs']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Post Editing'), true, 'post-editing');
    ?>
				<?php 
    spa_etext('Select Default Editor');
    ?>
:

<?php 
    if (defined('RICHTEXT')) {
        $checked = $sfoptions['defeditor'] == 1 ? 'checked="checked"' : '';
        ?>
					<label for="sfradio-editor1" class="sflabel radio"><?php 
        echo spa_text('Rich text') . ' (' . RICHTEXTNAME . ')';
        ?>
</label>
					<input type="radio" name="editor" id="sfradio-editor1"  tabindex="<?php 
        echo $tab;
        $tab++;
        ?>
" value="1" <?php 
        echo $checked;
        ?>
 />
<?php 
    }
    if (defined('HTML')) {
        $checked = $sfoptions['defeditor'] == 2 ? 'checked="checked"' : '';
        ?>
					<label for="sfradio-editor2" class="sflabel radio"><?php 
        echo spa_text('HTML') . ' (' . HTMLNAME . ')';
        ?>
</label>
					<input type="radio" name="editor" id="sfradio-editor2"  tabindex="<?php 
        echo $tab;
        $tab++;
        ?>
" value="2" <?php 
        echo $checked;
        ?>
 />
<?php 
    }
    if (defined('BBCODE')) {
        $checked = $sfoptions['defeditor'] == 3 ? 'checked="checked"' : '';
        ?>
					<label for="sfradio-editor3" class="sflabel radio"><?php 
        echo spa_text('bbCode') . ' (' . BBCODENAME . ')';
        ?>
</label>
					<input type="radio" name="editor" id="sfradio-editor3"  tabindex="<?php 
        echo $tab;
        $tab++;
        ?>
" value="3" <?php 
        echo $checked;
        ?>
 />
<?php 
    }
    $checked = $sfoptions['defeditor'] == 4 ? 'checked="checked"' : '';
    ?>
				<label for="sfradio-editor4" class="sflabel radio"><?php 
    echo spa_text('Plain text') . ' (' . PLAINTEXTNAME . ')';
    ?>
</label>
				<input type="radio" name="editor" id="sfradio-editor4"  tabindex="<?php 
    echo $tab;
    $tab++;
    ?>
" value="4" <?php 
    echo $checked;
    ?>
 />
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Error Logging'), true, 'error-log');
    spa_paint_checkbox(spa_text('Disable Error Logging'), 'errorlog', $sfoptions['errorlog']);
    spa_paint_checkbox(spa_text('Disable logging simple Notices only'), 'notices', $sfoptions['notices']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_global_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Global Options');
    ?>
" />
	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_profiles_options_form()
{
    ?>
<script type="text/javascript">
	spjAjaxForm('sfoptionsform', '');
</script>
<?php 
    $sfoptions = spa_get_options_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=profiles-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=options';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfoptionsform" name="sfoptions">
	<?php 
    echo sp_create_nonce('forum-adminform_options');
    spa_paint_options_init();
    #== PROFILE OPTIONS Tab ============================================================
    spa_paint_open_tab(spa_text('Profiles') . ' - ' . spa_text('Profile Options'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Display Name Format'), true, 'display-name-format');
    spa_paint_checkbox(spa_text('Let member choose display name'), 'nameformat', $sfoptions['nameformat']);
    spa_paint_select_start(spa_text('Display name format if member cannot choose') . '<br />' . spa_text('(ignored if member allowed to choose)'), 'fixeddisplayformat', 'fixeddisplayformat');
    echo spa_display_name_format_options($sfoptions['fixeddisplayformat']);
    spa_paint_select_end();
    echo '<tr><td colspan="2"><br /><div class="sfoptionerror">';
    spa_etext('Warning: If you change the display name format, it may take some time on a large number of users to update them to the new format. Please be patient.');
    echo '</div><br />';
    echo '</td></tr>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Personal Photos'), true, 'personal-photos');
    spa_paint_input(spa_text('Maximum number of photos allowed'), 'photosmax', $sfoptions['photosmax'], false, false);
    spa_paint_input(spa_text('Maximum pixel width of photo display'), 'photoswidth', $sfoptions['photoswidth'], false, false);
    spa_paint_input(spa_text('Maximum pixel height of photo display'), 'photosheight', $sfoptions['photosheight'], false, false);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Signature Image Size'), true, 'sig-images');
    echo '<tr><td colspan="2">&nbsp;<u>' . spa_text('If you are allowing signature images (zero = not limited)') . ':</u></td></tr>';
    spa_paint_input(spa_text('Maximum signature width (pixels)'), 'sfsigwidth', $sfoptions['sfsigwidth']);
    spa_paint_input(spa_text('Maximum signature height (pixels)'), 'sfsigheight', $sfoptions['sfsigheight']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('First Forum Visit'), true, 'first-forum-visit');
    spa_paint_checkbox(spa_text('Display profile form on login'), 'firstvisit', $sfoptions['firstvisit']);
    $show_password_fields = apply_filters('show_password_fields', true);
    if ($show_password_fields) {
        spa_paint_checkbox(spa_text('Force password change'), 'forcepw', $sfoptions['forcepw']);
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_options_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Display Profile Mode'), true, 'display-profile-mode');
    $values = array(spa_text('Popup window'), spa_text('Forum profile page'), spa_text('BuddyPress profile'), spa_text('WordPress author page'), spa_text('Other page'), spa_text('Mingle profile'));
    spa_paint_radiogroup(spa_text('Display profile information in'), 'displaymode', $values, $sfoptions['displaymode'], false, true);
    spa_paint_input(spa_text('URL for Other page'), 'displaypage', sp_filter_url_display($sfoptions['displaypage']), false, true);
    spa_paint_input(spa_text('Query String Variable Name'), 'displayquery', sp_filter_title_display($sfoptions['displayquery']), false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Profile Entry Form Mode'), true, 'profile-entry-form-mode');
    $values = array(spa_text('Forum profile form'), spa_text('WordPress profile form'), spa_text('BuddyPress profile'), spa_text('Other form'), spa_text('Mingle profile'));
    spa_paint_radiogroup(spa_text('Enter profile information In'), 'formmode', $values, $sfoptions['formmode'], false, true);
    spa_paint_input(spa_text('URL for Other page'), 'formpage', sp_filter_url_display($sfoptions['formpage']), false, true);
    spa_paint_input(spa_text('Query string variable name'), 'formquery', sp_filter_title_display($sfoptions['formquery']), false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Profile Overview Message'), true, 'profile-message');
    $submessage = spa_text('Text you enter here will be displayed to the User on their profile overview page');
    spa_paint_wide_textarea(spa_text('Profile overview message'), 'sfprofiletext', sp_filter_text_edit($sfoptions['sfprofiletext']), $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_options_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
    	   <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Profile Options');
    ?>
" />
    	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_components_messages_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfmessagesform', '');
    });
</script>
<?php 
    $sfcomps = spa_get_messages_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=components-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=messages';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmessagesform" name="sfmessages">
	<?php 
    echo sp_create_nonce('forum-adminform_messages');
    spa_paint_options_init();
    #== CUSTOM MESSAGES Tab ============================================================
    spa_paint_open_tab(spa_text('Components') . ' - ' . spa_text('Custom Messages'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Custom Message Above Editor'), true, 'editor-message');
    $submessage = spa_text('Text you enter here will be displayed above the editor (new topic and/or new post)');
    spa_paint_wide_textarea(spa_text('Custom message'), 'sfpostmsgtext', $sfcomps['sfpostmsgtext'], $submessage, 4);
    spa_paint_checkbox(spa_text('Display for new topic'), 'sfpostmsgtopic', $sfcomps['sfpostmsgtopic']);
    spa_paint_checkbox(spa_text('Display for new post'), 'sfpostmsgpost', $sfcomps['sfpostmsgpost']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Custom Intro Text in Editor'), true, 'editor-intro');
    $submessage = spa_text('Text you enter here will be displayed inside the editor (new topic only)');
    spa_paint_wide_textarea(spa_text('Custom intro message'), 'sfeditormsg', $sfcomps['sfeditormsg'], $submessage, 4);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_messages_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Sneak Peek Statement'), true, 'sneak-peek');
    $submessage = spa_text('If you are allowing guests to view forum and topic lists, but not see the actual Posts, this message is displayed to encourage them to sign up');
    spa_paint_wide_textarea(spa_text('Sneak peek statement'), 'sfsneakpeek', $sfcomps['sfsneakpeek'], $submessage);
    $submessage = spa_text('Force a redirect to a specific page instead of displaying the sneak peek message.');
    spa_paint_wide_textarea(spa_text('URL to redirect to for sneak peek'), 'sfsneakredirect', $sfcomps['sfsneakredirect'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Admin view statement'), true, 'admin-view');
    $submessage = spa_text('If you are inhibiting usergroups from seeing admin posts, this message is displayed to them');
    spa_paint_wide_textarea(spa_text('Admin view statement'), 'sfadminview', $sfcomps['sfadminview'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('User only view statement'), true, 'user-view');
    $submessage = spa_text('If you are limiting usergroups to only seeing their posts or post from admins and moderators, this message is displayed to them');
    spa_paint_wide_textarea(spa_text('User only view statement'), 'sfuserview', $sfcomps['sfuserview'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_messages_right_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Custom Messages Component');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function spa_themes_mobile_form()
{
    global $spPaths;
    ?>
	<script type="text/javascript">
		jQuery(document).ready(function() {
		spjAjaxForm('sfmobiletheme', 'sfreloadmlist');
		});
	</script>
<?php 
    # get current theme
    $mobileTheme = sp_get_option('sp_mobile_theme');
    if (!isset($mobileTheme['active'])) {
        $mobileTheme['active'] = false;
    }
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mobile';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmobiletheme" name="sfmobiletheme">
	<?php 
    echo sp_create_nonce('forum-adminform_themes');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Mobile Theme Support') . ' - ' . spa_text('Mobile Theme'));
    spa_paint_open_panel();
    spa_paint_spacer();
    echo '<div class="sfoptionerror">';
    echo spa_text('Themes Folder') . ': <b>wp-content/' . $spPaths['themes'] . '</b>';
    echo '</div>';
    spa_paint_open_fieldset(spa_text('Mobile Support'), true, 'mobile-support');
    spa_paint_checkbox(spa_text('Enable mobile theme support'), 'active', $mobileTheme['active']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    if ($mobileTheme['active']) {
        require_once ABSPATH . 'wp-admin/includes/template.php';
        require_once ABSPATH . 'wp-admin/includes/theme.php';
        spa_paint_open_fieldset(spa_text('Mobile Display Options'), true, 'mobile-display');
        spa_paint_checkbox(spa_text('Use alternate WordPress template'), 'usetemplate', $mobileTheme['usetemplate']);
        spa_paint_select_start(spa_text('Alternate page template'), 'pagetemplate', 'pagetemplate');
        echo '<option value="page.php">' . spa_text('Default Template') . '</option>';
        page_template_dropdown($mobileTheme['pagetemplate']);
        spa_paint_select_end();
        spa_paint_checkbox(spa_text('Remove Page Title Completely'), 'notitle', $mobileTheme['notitle']);
        spa_paint_close_fieldset();
    }
    spa_paint_close_panel();
    do_action('sph_themes_mobile_option_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Mobile Component');
    ?>
" />
	</div>
	<?php 
    spa_paint_close_tab();
    ?>
	</form>
	<div class="sfform-panel-spacer"></div>
<?php 
    if ($mobileTheme['active']) {
        # get themes
        $themes = sp_get_themes_list_data();
        # get update version info
        $xml = sp_load_version_xml();
        spa_paint_open_tab(spa_text('Available Themes') . ' - ' . spa_text('Select Simple:Press Mobile Theme'), true);
        spa_paint_open_panel();
        spa_paint_open_fieldset(spa_text('Mobile Theme Management'), true, 'themes');
        ?>
		<h3><?php 
        echo spa_text('Current Mobile Theme');
        ?>
</h3>
		<div class="theme-browser rendered">
		<div class="spThemeContainer">
		<div id="current-theme" class="spTheme">

		<h3 class="theme-name"><?php 
        echo $themes[$mobileTheme['theme']]['Name'];
        ?>
</h3>
		<img src="<?php 
        echo SPTHEMEBASEURL . $mobileTheme['theme'] . '/' . $themes[$mobileTheme['theme']]['Screenshot'];
        ?>
" alt="" />
		<h4>
		<?php 
        echo $themes[$mobileTheme['theme']]['Name'] . ' ' . $themes[$mobileTheme['theme']]['Version'] . ' ' . spa_text('by') . ' <a href="' . $themes[$mobileTheme['theme']]['AuthorURI'] . '" title="' . spa_text('Visit author homepage') . '">' . $themes[$mobileTheme['theme']]['Author'] . '</a>';
        ?>
		</h4>
<?php 
        if (!empty($mobileTheme['parent'])) {
            if (file_exists(SPTHEMEBASEDIR . $mobileTheme['parent'])) {
                echo '<p class="theme-parent">';
                echo spa_text('This theme is a child theme of ') . '<b>' . $mobileTheme['parent'] . '</b>';
                echo '</p>';
            } else {
                echo '<p class="theme-parent">';
                echo '<b>' . spa_text('The specified parent theme') . " '" . $mobileTheme['parent'] . "' " . spa_text('does not exist') . '</b> ';
                echo '</p>';
            }
        }
        ?>
		<p class="description" style="padding: 0;">
		<?php 
        echo $themes[$mobileTheme['theme']]['Description'];
        ?>
		</p>
<?php 
        $overlays = sp_get_overlays(SPTHEMEBASEDIR . $mobileTheme['theme'] . '/styles/overlays');
        # pull in parent overlays if child theme
        if (!empty($mobileTheme['parent'])) {
            $parent_overlays = sp_get_overlays(SPTHEMEBASEDIR . $mobileTheme['parent'] . '/styles/overlays');
            $overlays = array_merge($overlays, $parent_overlays);
        }
        if (!empty($overlays)) {
            ?>
			<script type="text/javascript">
				jQuery(document).ready(function() {
					jQuery('#sftheme-<?php 
            echo esc_js($mobileTheme['theme']);
            ?>
').ajaxForm({
						target: '#sfmsgspot',
						success: function() {
							jQuery('#sfreloadmlist').click();
							jQuery('#sfmsgspot').fadeIn();
							jQuery('#sfmsgspot').fadeOut(6000);
						}
					});
				});
			</script>
			<br>
<?php 
            $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mobile';
            echo '<form action="' . $ahahURL . '" method="post" id="sftheme-' . esc_attr($mobileTheme['theme']) . '" name="sftheme-' . esc_attr($mobileTheme['theme']) . '">';
            echo sp_create_nonce('forum-adminform_themes');
            echo '<input type="hidden" name="active" value="' . $mobileTheme['active'] . '" />';
            echo '<input type="hidden" name="theme" value="' . esc_attr($mobileTheme['theme']) . '" />';
            echo '<input type="hidden" name="style" value="' . esc_attr($themes[$mobileTheme['theme']]['Stylesheet']) . '" />';
            echo '<input type="hidden" name="parent" value="' . esc_attr($mobileTheme['parent']) . '" />';
            $theme_colors = empty($themes[$mobileTheme['theme']]['Colors']) ? '' : explode(',', $themes[$mobileTheme['theme']]['Colors']);
            echo '<input type="hidden" name="default-color" value="' . esc_attr($overlays[0]) . '" />';
            echo spa_text('Select Overlay') . ': ';
            echo '<select name="color-' . esc_attr($mobileTheme['theme']) . '">';
            foreach ($overlays as $overlay) {
                $overlay = trim($overlay);
                $selected = $mobileTheme['color'] == $overlay ? ' selected="selected" ' : '';
                echo '<option' . $selected . ' value="' . esc_attr($overlay) . '">' . esc_html($overlay) . '</option>';
            }
            echo '</select> ';
            echo ' <input type="submit" class="button-secondary action" id="saveit-cur" name="saveit-cur" value="' . spa_text('Update Overlay') . '" />';
            echo '</form>';
        }
        # any upgrade for this theme?  in multisite only main site can update
        if (is_main_site() && $xml) {
            foreach ($xml->themes->theme as $latest) {
                if ($themes[$mobileTheme['theme']]['Name'] == $latest->name) {
                    if (version_compare($latest->version, $themes[$mobileTheme['theme']]['Version'], '>') == 1) {
                        echo '<br />';
                        echo '<p style="padding: 0;">';
                        echo '<strong>' . spa_text('There is an update for the') . ' ' . $themes[$mobileTheme['theme']]['Name'] . ' ' . spa_text('theme') . '.</strong> ';
                        echo spa_text('Version') . ' ' . $latest->version . ' ' . spa_text('is available') . '. ';
                        echo spa_text('For details and to download please visit') . ' ' . SFPLUGHOME . ' ' . spa_text('or') . ' ' . spa_text('go to the') . ' ';
                        echo '<a href="' . self_admin_url('update-core.php') . '" title="" target="_parent">' . spa_text('WordPress updates page') . '</a>';
                        echo '</p>';
                    }
                    break;
                }
            }
        }
        ?>
		</div></div></div>

		<br class="clear" />

		<h3><?php 
        echo spa_text('Available Themes');
        ?>
</h3>
<?php 
        $numThemes = count($themes);
        if ($numThemes > 1) {
            ?>
			<div class="theme-browser rendered">
			<div class="spThemeContainer">
<?php 
            foreach ((array) $themes as $theme_file => $theme_data) {
                # skip cur theme
                if ($theme_file == $mobileTheme['theme']) {
                    continue;
                }
                $theme_desc = $theme_data['Description'];
                $theme_name = $theme_data['Name'];
                $theme_version = $theme_data['Version'];
                $theme_author = $theme_data['Author'];
                $theme_uri = $theme_data['AuthorURI'];
                $theme_style = $theme_data['Stylesheet'];
                $theme_image = SPTHEMEBASEURL . $theme_file . '/' . $theme_data['Screenshot'];
                $theme_overlays = sp_get_overlays(SPTHEMEBASEDIR . $theme_file . '/styles/overlays');
                # pull in parent overlays if child theme
                if (!empty($theme_data['Parent'])) {
                    $parent_overlays = sp_get_overlays(SPTHEMEBASEDIR . $theme_data['Parent'] . '/styles/overlays');
                    $theme_overlays = array_merge($theme_overlays, $parent_overlays);
                }
                ?>
				<div class="spTheme">
				<h3 class="theme-name"><?php 
                echo $theme_name;
                ?>
</h3>
				<img alt="" src="<?php 
                echo $theme_image;
                ?>
" />
				<h4>
				<?php 
                echo $theme_name . ' ' . $theme_version . ' ' . spa_text('by') . ' <a href="' . $theme_uri . '" title="' . spa_text('Visit author homepage') . '">' . $theme_author . '</a>';
                ?>
				</h4>
<?php 
                if (!empty($theme_data['Parent'])) {
                    if (file_exists(SPTHEMEBASEDIR . $theme_data['Parent'])) {
                        echo '<p class="theme-parent">';
                        echo spa_text('This theme is a child theme of ') . '<b>' . $theme_data['Parent'] . '</b>';
                        echo '</p>';
                    } else {
                        echo '<p class="theme-parent">';
                        echo '<b>' . spa_text('The specified parent theme') . " '" . $theme_data['Parent'] . "' " . spa_text('does not exist') . '</b> ';
                        echo '</p>';
                    }
                }
                ?>
				<p class="description" style="padding: 0;">
				<?php 
                echo $theme_desc;
                ?>
				</p>
				<br>
				<div class="action-links">
				<script type="text/javascript">
					jQuery(document).ready(function() {
						spjAjaxForm('sftheme-<?php 
                echo esc_js($theme_file);
                ?>
', 'sfreloadmlist');
					});
				</script>
				<?php 
                $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mobile';
                ?>
				<form action="<?php 
                echo $ahahURL;
                ?>
" method="post" id="sftheme-<?php 
                echo esc_attr($theme_file);
                ?>
" name="sftheme-<?php 
                echo esc_attr($theme_file);
                ?>
">
				<?php 
                echo sp_create_nonce('forum-adminform_themes');
                ?>
				<input type="hidden" name="active" value="<?php 
                echo $mobileTheme['active'];
                ?>
" />
				<input type="hidden" name="theme" value="<?php 
                echo esc_attr($theme_file);
                ?>
" />
				<input type="hidden" name="style" value="<?php 
                echo esc_attr($theme_style);
                ?>
" />
				<input type="hidden" name="parent" value="<?php 
                echo esc_attr($theme_data['Parent']);
                ?>
" />
				<?php 
                $defOverlay = !empty($theme_overlays) ? esc_attr($theme_overlays[0]) : 0;
                ?>
				<input type="hidden" name="default-color" value="<?php 
                echo esc_attr($defOverlay);
                ?>
" />
<?php 
                if ($theme_overlays) {
                    echo spa_text('Select Overlay') . ': ';
                    echo ' <select name="color-' . esc_attr($theme_file) . '" style="margin-bottom:5px;">';
                    foreach ($theme_overlays as $theme_overlay) {
                        $theme_overlay = trim($theme_overlay);
                        $selected = $theme_overlays[0] == $theme_overlay ? ' selected="selected" ' : '';
                        echo '<option' . $selected . ' value="' . esc_attr($theme_overlay) . '">' . esc_html($theme_overlay) . '</option>';
                    }
                    echo '</select> ';
                    echo '<div class="clearboth"></div>';
                }
                ?>
				<input type="submit" class="button-secondary action" id="saveit-<?php 
                echo esc_attr($theme_file);
                ?>
" name="saveit-<?php 
                echo esc_attr($theme_file);
                ?>
" value="<?php 
                echo spa_etext('Activate Mobile Theme');
                ?>
" />
				</form>
				</div>
<?php 
                # any upgrade for this theme?
                if ($xml) {
                    foreach ($xml->themes->theme as $latest) {
                        if ($theme_data['Name'] == $latest->name) {
                            if (version_compare($latest->version, $theme_data['Version'], '>') == 1) {
                                echo '<br />';
                                echo '<div class="plugin-update-tr"><div class="update-message" style="background-color:#fcf3ef;margin-left:10px;">';
                                echo '<strong>' . spa_text('There is an update for the') . ' ' . $theme_data['Name'] . ' ' . spa_text('theme') . '.</strong> ';
                                echo spa_text('Version') . ' ' . $latest->version . ' ' . spa_text('is available') . '. ';
                                echo spa_text('For details and to download please visit') . ' ' . SFPLUGHOME . ' ' . spa_text('or') . ' ' . spa_text('go to the') . ' ';
                                echo '<a href="' . self_admin_url('update-core.php') . '" title="" target="_parent">' . spa_text('WordPress updates page') . '</a>';
                                echo '</div></div>';
                            }
                            break;
                        }
                    }
                }
                echo '</div>';
            }
            echo '</div>';
            echo '</div>';
        } else {
            echo spa_text('No other available themes found');
        }
        do_action('sph_themes_mobile_list_panel');
        spa_paint_close_fieldset();
        spa_paint_close_panel();
        spa_paint_close_container();
        spa_paint_close_tab();
    }
}
spa_paint_open_panel();
echo '<div class="helpAndFAQ">';
spa_paint_open_fieldset(spa_text('Available Plugins'), false);
include 'spa-plugin-links.php';
spa_paint_close_fieldset();
echo '</div>';
spa_paint_close_panel();
spa_paint_spacer();
spa_paint_close_container();
spa_paint_close_tab();
echo '<div class="sfform-panel-spacer"></div>';
spa_paint_open_tab(spa_text('Support and Customisation'));
spa_paint_open_panel();
echo '<div class="helpAndFAQ">';
spa_paint_open_fieldset(spa_text('Premium Support'), false);
include 'spa-support-links.php';
spa_paint_close_fieldset();
echo '</div>';
spa_paint_close_panel();
spa_paint_tab_right_cell();
spa_paint_open_panel();
echo '<div class="helpAndFAQ">';
spa_paint_open_fieldset(spa_text('Customisation Service'), false);
include 'spa-custom-links.php';
spa_paint_close_fieldset();
echo '</div>';
spa_paint_close_panel();
spa_paint_spacer();
spa_paint_close_container();
spa_paint_close_tab();
die;
function spa_components_login_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfloginform', '');
    });
</script>
<?php 
    $sfcomps = spa_get_login_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=components-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=login';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfloginform" name="sflogin">
	<?php 
    echo sp_create_nonce('forum-adminform_login');
    spa_paint_options_init();
    #== LOGIN Tab ============================================================
    spa_paint_open_tab(spa_text('Components') . ' - ' . spa_text('Login And Registration'));
    if (false == get_option('users_can_register')) {
        spa_paint_open_panel();
        spa_paint_open_fieldset(spa_text('Member Registrations'), true, 'no-login');
        echo '<div class="sfoptionerror">';
        spa_etext('Your site is currently not set to allow users to register. Click on the help icon for details of how to turn this on');
        echo '</div>';
        spa_paint_close_fieldset();
        spa_paint_close_panel();
    }
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('User Registration'), true, 'user-registration');
    spa_paint_checkbox(spa_text('Use spam tool on registration form'), 'sfregmath', $sfcomps['sfregmath']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    $submessage = '';
    spa_paint_open_fieldset(spa_text('Login/Registration Redirects'), true, 'login-registration-urls');
    spa_paint_wide_textarea(spa_text('Login redirect'), 'sfloginurl', $sfcomps['sfloginurl'], $submessage);
    spa_paint_wide_textarea(spa_text('Logout redirect'), 'sflogouturl', $sfcomps['sflogouturl'], $submessage);
    spa_paint_wide_textarea(spa_text('Registration redirect'), 'sfregisterurl', $sfcomps['sfregisterurl'], $submessage);
    spa_paint_wide_textarea(spa_text('Login URL in new user email'), 'sfloginemailurl', $sfcomps['sfloginemailurl'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_login_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('RPX 3rd Party Login'), true, 'rpx-login');
    spa_paint_checkbox(spa_text('Enable RPX support'), 'sfrpxenable', $sfcomps['sfrpxenable']);
    echo '<tr><td colspan="2">';
    spa_etext('Please enter your RPX API key. If you haven\'t yet created one, please create one at');
    echo ' <a href="https://rpxnow.com" target="_blank">Janrain</a>';
    echo '</td></tr>';
    spa_paint_input(spa_text('RPX API key'), 'sfrpxkey', $sfcomps['sfrpxkey'], false, true);
    $submessage = spa_text('Force a redirect to a specific page on RPX login.  Leave blank to have SPF/RPX determine redirect location');
    spa_paint_wide_textarea(spa_text('URL to redirect to after RPX login'), 'sfrpxredirect', $sfcomps['sfrpxredirect'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Tracking Timeout'), true, 'tracking-timeout');
    spa_paint_input(spa_text('Tracking Timeout (minutes)'), 'sptimeout', $sfcomps['sptimeout'], false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_login_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
    	   <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Login and Registration Component');
    ?>
" />
    	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_options_members_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfmembersform', 'sfreloadms');
    });
</script>
<?php 
    global $wp_roles;
    $sfoptions = spa_get_members_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=options-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=members';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmembersform" name="sfmembers">
	<?php 
    echo sp_create_nonce('forum-adminform_members');
    spa_paint_options_init();
    #== MEMBERS Tab ============================================================
    spa_paint_open_tab(spa_text('Options') . ' - ' . spa_text('Member Settings'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Member Profiles'), true, 'member-profiles');
    spa_paint_checkbox(spa_text('Disallow members not logged in to post as guests'), 'sfcheckformember', $sfoptions['sfcheckformember']);
    spa_paint_checkbox(spa_text('Allow members to hide their online status'), 'sfhidestatus', $sfoptions['sfhidestatus']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Member Name Linking'), true, 'member-name-linking');
    $values = array(spa_text('Nothing'), spa_text("Member's profile"), spa_text("Member's website"));
    spa_paint_radiogroup(spa_text("Link a member's name when displayed to"), 'namelink', $values, $sfoptions['namelink'], false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Guest Settings'), true, 'guest-settings');
    spa_paint_checkbox(spa_text('Require guests to enter email address'), 'reqemail', $sfoptions['reqemail']);
    spa_paint_checkbox(spa_text('Store guest information in a cookie for subsequent visits'), 'storecookie', $sfoptions['storecookie']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Inactive Members Account Auto Removal'), true, 'user-removal');
    spa_paint_checkbox(spa_text('Enable auto removal of member accounts'), 'sfuserremove', $sfoptions['sfuserremove']);
    spa_paint_checkbox(spa_text('Remove inactive members (if auto removal enabled)'), 'sfuserinactive', $sfoptions['sfuserinactive']);
    spa_paint_checkbox(spa_text('Remove members who have not posted  (if auto removal enabled)'), 'sfusernoposts', $sfoptions['sfusernoposts']);
    spa_paint_input(spa_text('Number of days back to remove inactive members and/or members with no posts (if auto removal enabled)'), 'sfuserperiod', $sfoptions['sfuserperiod']);
    if ($sfoptions['sched']) {
        $msg = spa_text('Users auto removal cron job is scheduled to run daily');
        echo '<tr><td class="message" colspan="2" style="line-height:2em;">&nbsp;<u>' . $msg . '</u></td></tr>';
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Post Counts on Deletion'), true, 'delete-count');
    spa_paint_checkbox(spa_text('Adjust users post count when post deleted'), 'post_count_delete', $sfoptions['post_count_delete']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_members_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Blacklists'), true, 'member-blacklists');
    $submessage = spa_text('Enter a comma separated list of account names to disallow when a user registers');
    spa_paint_wide_textarea(spa_text('Blocked account names'), 'account-name', $sfoptions['account-name'], $submessage);
    $submessage = spa_text('Enter a comma separated list of display names to disallow for users');
    spa_paint_wide_textarea(spa_text('Blocked display names'), 'display-name', $sfoptions['display-name'], $submessage);
    $submessage = spa_text('Enter a comma separated list of guest names to disallow when a guest posts');
    spa_paint_wide_textarea(spa_text('Blocked guest posting names'), 'guest-name', $sfoptions['guest-name'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_options_members_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
            <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Member Options');
    ?>
" />
    	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_profiles_avatars_form()
{
    global $spPaths;
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfavatarsform', 'sfreloadav');

    	jQuery("#sfavataroptions").sortable({
    		placeholder: 'sortable-placeholder',
    		update: function () {
    			jQuery("input#sfavataropts").val(jQuery("#sfavataroptions").sortable('serialize'));
    		}
    	});

    	var button = jQuery('#sf-upload-button'), interval;
    	new AjaxUpload(button,{
    		action: '<?php 
    echo SFUPLOADER;
    ?>
',
    		name: 'uploadfile',
    	    data: {
    		    saveloc : '<?php 
    echo addslashes(SF_STORE_DIR . "/" . $spPaths['avatar-pool'] . '/');
    ?>
'
    	    },
    		onSubmit : function(file, ext){
                /* check for valid extension */
    			if (! (ext && /^(jpg|png|jpeg|gif|JPG|PNG|JPEG|GIF)$/.test(ext))){
    				jQuery('#sf-upload-status').html('<p class="sf-upload-status-fail"><?php 
    echo esc_js(spa_text('Only JPG, PNG or GIF files are allowed!'));
    ?>
</p>');
    				return false;
    			}
    			/* change button text, when user selects file */
    			utext = '<?php 
    echo esc_js(spa_text('Uploading'));
    ?>
';
    			button.text(utext);
    			/* If you want to allow uploading only 1 file at time, you can disable upload button */
    			this.disable();
    			/* Uploding -> Uploading. -> Uploading... */
    			interval = window.setInterval(function(){
    				var text = button.text();
    				if (text.length < 13){
    					button.text(text + '.');
    				} else {
    					button.text(utext);
    				}
    			}, 200);
    		},
    		onComplete: function(file, response){
    			jQuery('#sf-upload-status').html('');
    			button.text('<?php 
    echo esc_js(spa_text('Browse'));
    ?>
');
    			window.clearInterval(interval);
    			/* re-enable upload button */
    			this.enable();
    			/* add file to the list */
    			if (response==="success"){
                    site = "<?php 
    echo SFHOMEURL;
    ?>
index.php?sp_ahah=profiles&amp;sfnonce=<?php 
    echo wp_create_nonce('forum-ahah');
    ?>
&amp;action=delavatar&amp;file=" + file;
    				jQuery('<table style="width:100%"></table>').appendTo('#sf-avatar-pool').html('<tr><td style="width:60%;text-align:center"><img class="sfavatarpool" src="<?php 
    echo SFAVATARPOOLURL;
    ?>
/' + file + '" alt="" /></td><td class="sflabel" style="text-align:center;width:30%">' + file + '</td><td class="sflabel" style="text-align:center;width:9%"><img src="<?php 
    echo SFCOMMONIMAGES;
    ?>
' + 'delete.png' + '" title="<?php 
    echo esc_js(spa_text('Delete Avatar'));
    ?>
" alt="" onclick="spjDelRowReload(\'' + site + '\', \'sfreloadav\');" /></td></tr>');
    				jQuery('#sf-upload-status').html('<p class="sf-upload-status-success"><?php 
    echo esc_js(spa_text('Avatar Uploaded!'));
    ?>
</p>');
    			} else if (response==="invalid"){
    				jQuery('#sf-upload-status').html('<p class="sf-upload-status-fail"><?php 
    echo esc_js(spa_text('Sorry, the file has an invalid format!'));
    ?>
</p>');
    			} else if (response==="exists") {
    				jQuery('#sf-upload-status').html('<p class="sf-upload-status-fail"><?php 
    echo esc_js(spa_text('Sorry, the file already exists!'));
    ?>
</p>');
    			} else {
    				jQuery('#sf-upload-status').html('<p class="sf-upload-status-fail"><?php 
    echo esc_js(spa_text('Error uploading file!!'));
    ?>
</p>');
    			}
    		}
    	});
    });
</script>
<?php 
    $sfoptions = spa_get_avatars_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=profiles-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=avatars';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfavatarsform" name="sfavatars">
	<?php 
    echo sp_create_nonce('forum-adminform_avatars');
    spa_paint_options_init();
    #== PROFILE OPTIONS Tab ============================================================
    spa_paint_open_tab(spa_text('Profiles') . ' - ' . spa_text('Avatars'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Avatar Options'), true, 'avatar-options');
    spa_paint_checkbox(spa_text('Display avatars'), 'sfshowavatars', $sfoptions['sfshowavatars']);
    spa_paint_input(spa_text('Maximum avatar display width (pixels)'), 'sfavatarsize', $sfoptions['sfavatarsize'], false, false);
    spa_paint_checkbox(spa_text('Enable avatar uploading'), 'sfavataruploads', $sfoptions['sfavataruploads']);
    spa_paint_input(spa_text('Maximum avatar upload file size (bytes)'), 'sfavatarfilesize', $sfoptions['sfavatarfilesize'], false, false);
    spa_paint_checkbox(spa_text('Auo resize avatar uploads'), 'sfavatarresize', $sfoptions['sfavatarresize']);
    spa_paint_input(spa_text('Uploaded avatar resize quality (if resizing)'), 'sfavatarresizequality', $sfoptions['sfavatarresizequality'], false, false);
    spa_paint_checkbox(spa_text('Enable avatar pool selection'), 'sfavatarpool', $sfoptions['sfavatarpool']);
    spa_paint_checkbox(spa_text('Enable remote avatars'), 'sfavatarremote', $sfoptions['sfavatarremote']);
    $values = array(spa_text('G - Suitable for all'), spa_text('PG- Suitable for 13 and above'), spa_text('R - Suitable for 17 and above'), spa_text('X - Suitable for all adults'));
    spa_paint_radiogroup(spa_text('Gravatar max rating'), 'sfgmaxrating', $values, $sfoptions['sfgmaxrating'], false, true);
    spa_paint_checkbox(spa_text('Replace WP avatar with SP avatar'), 'sfavatarreplace', $sfoptions['sfavatarreplace']);
    echo '<br /><div class="sfoptionerror">';
    spa_etext('Warning: If you want to replace WP avatars with SP avatars, make sure you dont have WP avatars in your avatar priorities (have it below SP Default Avatars) or you will have a circular reference');
    echo '</div><br />';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_avatar_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Avatar Priorities'), true, 'avatar-priorities');
    spa_etext('Select the avatar dislay priority order by dragging and dropping the buttons below.  The top of the list is the highest priority order.  When an avatar is found for the current priority, it is used.  If none is found, the next priority is checked and so on.  An SP Default Avatar will always be found. Any avatar after the SP Default Avatar is essentially ignored');
    echo '<div>';
    echo '<ul id="sfavataroptions" class="menu">';
    $list = array(0 => spa_text('Gravatars'), 1 => spa_text('WP Avatars'), 2 => spa_text('Uploaded Avatar'), 3 => spa_text('SP Default Avatars'), 4 => spa_text('Avatar Pool'), 5 => spa_text('Remote Avatar'));
    if ($sfoptions['sfavatarpriority']) {
        foreach ($sfoptions['sfavatarpriority'] as $priority) {
            echo '<li id="aitem_' . $priority . '" class="menu-item menu-item-depth-0"><span class="item-name">' . $list[$priority] . '</span></li>';
        }
    }
    echo '</ul>';
    echo '<input type="text" class="inline_edit" size="70" id="sfavataropts" name="sfavataropts" />';
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    spa_paint_close_tab();
    spa_paint_open_nohead_tab(false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Avatar Pool Upload'), true, 'avatar-pool-upload');
    $loc = SF_STORE_DIR . '/' . $spPaths['avatar-pool'] . '/';
    spa_paint_file(spa_text('Select avatar to upload'), 'newavatar', false, true, $loc);
    echo '<table><tr>';
    echo '<td class="sflabel"><small>';
    spa_etext('Please be advised that Admin uploaded avatars for the avatar pool are NOT subject to the user uploaded avatar size limits.  So use caution when picking avatars for your avatar pool');
    echo '</small></td>';
    echo '</tr></table>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Avatar Pool'), true, 'avatar-pool');
    spa_paint_avatar_pool();
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_avatar_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
    	   <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Avatar Options');
    ?>
" />
    	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function sp_barebones_options_form()
{
    if (!sp_current_user_can('SPF Manage Themes')) {
        spa_etext('Access denied - you do not have permission');
        die;
    }
    include_once SPBBADMIN . 'sp-barebones-activate.php';
    sp_barebones_setup(true);
    ?>

<style type="text/css">
	.color-picker { height: 50px; }
</style>

<script type="text/javascript">
	jQuery(document).ready(function($) {
		var colorPickers = $('.color-picker');
		for (e in colorPickers) {
			if (colorPickers[e].id != undefined) {
				var colorPickerID = colorPickers[e].id;
				$('#' + colorPickerID + '-color').farbtastic('#' + colorPickerID);
			}
		}

		$('.fabox').hide();

		$('.color-picker').click(function() {
			$(this).parent().find('.fabox').fadeIn();
		});

		$(document).mousedown(function() {
			$('.fabox').each(function() {
				var display = $(this).css('display');
				if (display == 'block') $(this).fadeOut();
			});
		});
	});

	function spjLoadTestView(url, title) {
		var aWidth = (window.innerWidth-80);
		var aHeight = (window.innerHeight-80);
		spjDialogAjax(this, url, title, aWidth, aHeight, 'center');
	}
</script>

<?php 
    include_once SF_STORE_DIR . '/' . 'sp-custom-settings/sp-barebones-test-settings.php';
    spa_paint_options_init();
    spa_paint_open_tab(__('Barebones Custom Theme Settings', 'spBarebones'), true);
    echo '<br /><div class="sfoptionerror" style="font-size: 13px;">';
    $url = SFHOMEURL . "index.php?sp_ahah=help&amp;file=admin-themes&amp;item=custom-options&amp;sfnonce=" . wp_create_nonce('forum-ahah');
    echo "<input type='button' value='Help' class='button-primary' style='float:right;' onclick='spjDialogAjax(this, \"{$url}\", \"Simple:Press Help\", 600, 0, 0);' />";
    echo "<span style='font-weight:bold';'>";
    spa_etext('Before using this customiser we strongly recommend you click on the help button and familiarise yourself with how it works to avoid inadvertently altering your live forum display');
    echo "</span>";
    echo '.<br />';
    echo '</div>';
    echo "</div>";
    echo '<div class="sp-half-form">';
    spa_paint_open_panel();
    spa_paint_open_fieldset('', false, '', false);
    ?>
			<div>
				<div style="width: 49.5%; float:left;">
					<p>Standard and general unlinked text</p>
					<input id="C1" class="color-picker" type="text" value="<?php 
    echo $ops['C1'];
    ?>
" name="C1" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C1-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
					<div class="clearboth"></div>
				</div>
			</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset('', false, '', false);
    ?>
			<div>
				<div style="width: 49.5%; float:left;">
					<p>Main Headings and<br />Footer Background</p>
					<input id="C3" class="color-picker" type="text" value="<?php 
    echo $ops['C3'];
    ?>
" name="C3" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C3-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>

				<div style="width: 49.5%; float:left;">
					<p>Title rows in<br />index listings</p>
					<input id="C4" class="color-picker" type="text" value="<?php 
    echo $ops['C4'];
    ?>
" name="C4" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C4-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div class="clearboth"></div><hr>
			</div>

			<div>
				<div style="width: 49.5%; float:left;">
					<p>Background of odd rows<br />in index listings</p>
					<input id="C2" class="color-picker" type="text" value="<?php 
    echo $ops['C2'];
    ?>
" name="C2" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C2-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>

				<div style="width: 49.5%; float:right;">
					<p>Background of even rows<br />in index listings</p>
					<input id="C6" class="color-picker" type="text" value="<?php 
    echo $ops['C6'];
    ?>
" name="C6" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C6-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div class="clearboth"></div>
			</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset('', false, '', false);
    spa_paint_input(__('Font Family(s) in CSS format', 'spBarebones'), 'FN', $ops['FN']);
    spa_paint_input(__('Base Font Size (as percentage value)', 'spBarebones'), 'F1', $ops['F1']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset('', false, '', false);
    ?>
			<div>
				<div style="width: 49.5%; float:left;">
					<p>Icon Glyphs</p>
					<input id="C7" class="color-picker" type="text" value="<?php 
    echo $ops['C7'];
    ?>
" name="C7" style="width:60%;font-weight:bold; float:left;" />
					<div class="clearleft"></div>
					<div id="C7-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>

				<div style="width: 49.5%; float:right;">
					<p>Icon Glyphs Hover</p>
					<input id="C8" class="color-picker" type="text" value="<?php 
    echo $ops['C8'];
    ?>
" name="C8" style="width:60%;font-weight:bold; float:left;" />
					<div class="clearleft"></div>
					<div id="C8-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div class="clearboth"></div>
			</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset('', false, '', false);
    ?>
			<div>
				<div style="width: 49.5%; float:left;">
					<p>Primary <br />Link text labels</p>
					<input id="C5" class="color-picker" type="text" value="<?php 
    echo $ops['C5'];
    ?>
" name="C5" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C5-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div style="width: 49.5%; float:left;">
					<p>Primary <br />Link text hover</p>
					<input id="C9" class="color-picker" type="text" value="<?php 
    echo $ops['C9'];
    ?>
" name="C9" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C9-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div class="clearboth"></div><hr>
			</div>

			<div>
				<div style="width: 49.5%; float:left;">
					<p>Secondary <br />Link text labels</p>
					<input id="C10" class="color-picker" type="text" value="<?php 
    echo $ops['C10'];
    ?>
" name="C10" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C10-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div style="width: 49.5%; float:left;">
					<p>Secondary <br />Link text hover</p>
					<input id="C11" class="color-picker" type="text" value="<?php 
    echo $ops['C11'];
    ?>
" name="C11" style="width:60%;font-weight:bold;float:left;" />
					<div class="clearleft"></div>
					<div id="C11-color" class="fabox" style="margin: 0px auto; width: 195px; float:left;"></div>
				</div>
				<div class="clearboth"></div>
			</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
}
function spa_forums_create_group_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfgroupnew', 'sfreloadfb');
    });
</script>
<?php 
    global $spPaths;
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=creategroup';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfgroupnew" name="sfgroupnew">
<?php 
    echo sp_create_nonce('forum-adminform_groupnew');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Create New Group'), false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Create New Group'), 'true', 'create-new-forum-group');
    spa_paint_input(spa_text('Group Name'), 'group_name', '', false, true);
    spa_paint_input(spa_text('Description'), 'group_desc', '', false, true);
    spa_paint_select_start(spa_text('Select Custom Icon'), 'group_icon', '');
    spa_select_icon_dropdown('group_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_wide_textarea('Special group message to be displayed above forums', 'group_message', '');
    do_action('sph_forums_create_group_panel');
    spa_paint_close_fieldset();
    echo '<div class="sfoptionerror spaceabove">';
    echo sprintf(sp_text('To re-order your Groups, Forums and SubForums use the %s Order Groups and Forums %s option from the Forums Menu'), '<b>', '</b>');
    echo '</div>';
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Default User Group Permissions'), false);
    echo '<strong>' . spa_text('Set default usergroup permission sets for this group') . '</strong><br />';
    echo spa_text('Note - This will not add or modify any current permissions. It is only a default setting for future forums created in this group.');
    # Permissions
    $usergroups = spa_get_usergroups_all();
    $roles = sp_get_all_roles();
    foreach ($usergroups as $usergroup) {
        echo '<input type="hidden" name="usergroup_id[]" value="' . $usergroup->usergroup_id . '" />';
        spa_paint_select_start(sp_filter_title_display($usergroup->usergroup_name), 'role[]', '');
        echo '<option value="-1">' . spa_text('Select permission set') . '</option>';
        foreach ($roles as $role) {
            echo '<option value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n";
        }
        spa_paint_select_end();
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
		<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Create New Group');
    ?>
" />
		</div>
		</form>

	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_toolbox_housekeeping_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfindexes', 'sfreloadhk');
    	spjAjaxForm('sfnewpostcleanup', 'sfreloadhk');
    	spjAjaxForm('sftransientcleanup', 'sfreloadhk');
    	spjAjaxForm('sfpostcountcleanup', 'sfreloadhk');
    	spjAjaxForm('sfresetprofiletabs', 'sfreloadhk');
    	spjAjaxForm('sfresetauths', 'sfreloadhk');
    	spjAjaxForm('sfresetplugdata', 'sfreloadhk');
    	spjAjaxForm('sfresetcombined', 'sfreloadhk');
    	spjAjaxForm('sfflushcache', 'sfreloadhk');
    	<?php 
    do_action('sph_toolbox_housekeeping_ajax');
    ?>
    });
</script>
<?php 
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=housekeeping';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfhousekeepingform" name="sfhousekeeping">
	</form>
<?php 
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Housekeeping'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Rebuild Indexes'), true, 'rebuild-indexes');
    echo '<p class="sublabel">' . spa_text("You shouldn't need to rebuild your indexes unless asked to by Simple:Press Support.") . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfindexes" name="sfindexes">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<p class="sublabel"><?php 
    spa_etext('Select forum to have its indexes rebuilt');
    ?>
:<br /><br /></p>
				<select class="wp-core-ui" name="forum_id" >
					<?php 
    echo sp_render_group_forum_select(false, false, false, true, '', '', 'wp-core-ui', 20);
    ?>
				</select>
                <br /><br />
				<input type="submit" class="button-primary" id="saveit1" name="rebuild-fidx" value="<?php 
    spa_etext('Rebuild Forum Indexes');
    ?>
" onclick="jQuery('#riimg').show();"/>
				<img class="sfhidden" id="riimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    echo '<p class="sublabel">' . spa_text('Note: Rebuilding the forum indexes may take some time if you have a large number of topics or posts.') . '</p>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('New Post Cleanup'), true, 'newpost-cleanup');
    echo '<p class="sublabel">' . spa_text('This will reset the New Posts list for users who haven not visited the forum in the specified number of days.') . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfnewpostcleanup" name="sfnewpostcleanup">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>

				<span>Number of Days Since User's Last Visit:
				<input class="wp-core-ui" type="text" value="30" name="sfdays" /></span>
				<br />
				<input type="submit" class="button-primary" id="saveit2" name="clean-newposts" value="<?php 
    spa_etext('Clean New Posts List');
    ?>
"  onclick="jQuery('#npcimg').show();"/>
				<img class="sfhidden" id="npcimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    echo '<p>' . spa_text('Note: Cleaning up the New Post Lists may take some time if you have a large number of users that meet the criteria.') . '</p>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('User Post Count Cleanup'), true, 'post-count-cleanup');
    echo '<p class="sublabel">' . spa_text('This will go through the users and posts database tables and recalculate post counts for all users based on existing posts.') . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfpostcountcleanup" name="sfpostcountcleanup">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
<br />
				<input type="submit" class="button-primary" id="saveit3" name="postcount-cleanup" value="<?php 
    spa_etext('Clean Up Post Counts');
    ?>
"  onclick="jQuery('#pcimg').show();"/>
				<img class="sfhidden" id="pcimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    echo '<p class="sublabel">' . spa_text('Note: Recalculating user post counts may take some time if you have a large number of users and cannot be reversed.') . '</p>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_housekeeping_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Transient Cleanup'), true, 'transient-cleanup');
    echo '<p class="sublabel">' . spa_text('This will clean up expired WP Transients from the WP options table and any expired SP user notices.') . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sftransientcleanup" name="sftransientcleanup">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
<br />
				<input type="submit" class="button-primary" id="saveit4" name="transient-cleanup" value="<?php 
    spa_etext('Clean Up Transients');
    ?>
"  onclick="jQuery('#tcimg').show();"/>
				<img class="sfhidden" id="tcimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Rebuild Default Profile Tabs'), true, 'reset-tabs');
    echo '<p class="sublabel">' . spa_text('This will remove all Profile Tabs and restore to default state.') . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfresetprofiletabs" name="sfresetprofiletabs">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<input type="submit" class="button-primary" id="saveit5" name="reset-tabs" value="<?php 
    spa_etext('Reset Profile Tabs');
    ?>
"  onclick="jQuery('#rdptimg').show();"/>
				<img class="sfhidden" id="rdptimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Reset the Auths Cache'), true, 'reset-auths');
    echo '<p class="sublabel">' . spa_text("This will force a rebuild of each user's auth cache. It does not change any permissions.") . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfresetauths" name="sfresetauths">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<input type="submit" class="button-primary" id="saveit6" name="reset-auths" value="<?php 
    spa_etext('Reset Auths Cache');
    ?>
"  onclick="jQuery('#rtacimg').show();"/>
				<img class="sfhidden" id="rtacimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Reset Users Plugin Data Cache'), true, 'reset-plugin-data');
    echo '<p class="sublabel">' . spa_text("This will force each user's plugin data cache to be cleared.") . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfresetplugdata" name="sfresetplugdata">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<input type="submit" class="button-primary" id="saveit10" name="reset-plugin-data" value="<?php 
    spa_etext('Reset Users Plugin Data');
    ?>
"  onclick="jQuery('#rrpdimg').show();"/>
				<img class="sfhidden" id="rrpdimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Reset combined CSS/JS'), true, 'reset-combined');
    echo '<p class="sublabel">' . spa_text('This will force a rebuild of the combined CSS and JS cache files.') . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfresetcombined" name="sfresetcombined">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<input type="submit" class="button-primary" id="saveit7" name="reset-combinedcss" value="<?php 
    spa_etext('Reset Combined CSS Cache');
    ?>
"  onclick="jQuery('#rtccimg').show();"/>
				<input type="submit" class="button-primary" id="saveit8" name="reset-combinedjs" value="<?php 
    spa_etext('Reset Combined Script Cache');
    ?>
"  onclick="jQuery('#rtccimg').show();"/>
				<img class="sfhidden" id="rtccimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Flush general cache'), true, 'flush-cache');
    echo '<p class="sublabel">' . spa_text("This will force a flushing of the general cache.") . '</p>';
    ?>
				<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfflushcache" name="sfflushcache">
				<?php 
    echo sp_create_nonce('forum-adminform_housekeeping');
    ?>
				<input type="submit" class="button-primary" id="saveit9" name="flushcache" value="<?php 
    spa_etext('Flush General Cache');
    ?>
"  onclick="jQuery('#fcacheimg').show();"/>
				<img class="sfhidden" id="fcacheimg" src="<?php 
    echo SFCOMMONIMAGES . 'working.gif';
    ?>
" alt=""/>
				</form>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_housekeeping_right_panel');
    spa_paint_close_container();
    echo '<div class="sfform-panel-spacer"></div>';
    spa_paint_close_tab();
}
function spa_forums_create_forum_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfforumnew', 'sfreloadfb');
    });
</script>
<?php 
    global $spPaths, $tab;
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=createforum';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfforumnew" name="sfforumnew">
<?php 
    echo sp_create_nonce('forum-adminform_forumnew');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Create New Forum'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Create New Forum'), 'true', 'create-new-forum');
    # check there are groups before proceeding
    if (spdb_count(SFGROUPS) == 0) {
        echo '<br /><div class="sfoptionerror">';
        spa_etext('There are no groups defined');
        echo '<br />' . spa_text('Create new group');
        echo '</div><br />';
        spa_paint_close_fieldset();
        spa_paint_close_panel();
        spa_paint_close_container();
        spa_paint_close_tab();
        echo '</form>';
        return;
    }
    # Select the forum type first
    echo "<div class='sp-form-row'>\n";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('What type of forum are you creating') . ":</div>\n";
    echo "<div class='wp-core-ui sp-radio'>";
    echo '<input type="radio" name="forumtype" id="sfradio1" tabindex="' . $tab . '" value="1" checked="checked" onchange="spjSetForumOptions(\'forum\');" />' . "\n";
    echo '<label for="sfradio1" class="wp-core-ui">' . spa_text('Standard Forum') . '</label><br>' . "\n";
    $tab++;
    # check there are forums before offering subforum creation!
    if (spdb_count(SFFORUMS) != 0) {
        echo '<input type="radio" name="forumtype" id="sfradio2" tabindex="' . $tab . '" value="2" onchange="spjSetForumOptions(\'subforum\');" />' . "\n";
        echo '<label for="sfradio2" class="wp-core-ui">' . spa_text('Sub or child forum') . '</label>' . "\n";
        $tab++;
    }
    echo '</div><div class="clearboth"></div></div>';
    # Now display the two select box options
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    $target = 'fseq';
    echo '<div id="groupselect" style="display:block;">';
    echo "<div class='sp-form-row'>\n";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Select group new forum will belong to') . ":</div>\n";
    echo '<select class="wp-core-ui  sp-input-60" tabindex="' . $tab . '" name="group_id"  onchange="spjSetForumSequence();">';
    echo spa_create_group_select(0, 1);
    echo "</select>\n";
    echo '<div class="clearboth"></div>';
    echo '</div>';
    $tab++;
    echo '</div>';
    echo '<div id="forumselect" style="display:none;">';
    echo "<div class='sp-form-row'>\n";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Select forum new subforum will belong to') . ":</div>\n";
    echo '<select class="wp-core-ui  sp-input-60" tabindex="' . $tab . '" name="forum_id"  onchange="spjSetForumSequence();">';
    echo sp_render_group_forum_select(false, false, false, true);
    echo "</select>\n";
    echo '<div class="clearboth"></div>';
    echo '</div>';
    $tab++;
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    echo '<div class="sfform-panel-spacer"></div>';
    spa_paint_close_tab();
    echo '<div class="sfform-panel-spacer"></div>';
    echo '<div class="sfhidden" id="block1">';
    spa_paint_open_nohead_tab(false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum Details'), false);
    $target = 'thisforumslug';
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    # forum name and slug
    echo "<div class='sp-form-row'>";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Forum Name') . ':</div>';
    echo '<input type="text" class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="forum_name" value="" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'new\');" />';
    echo '<div class="clearboth"></div>';
    echo '</div>';
    $tab++;
    echo "<div class='sp-form-row'>\n";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Forum slug') . ":</div>";
    echo '<input type="text" class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="thisforumslug" id="thisforumslug" value="" disabled="disabled" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'new\');" />';
    echo '<div class="clearboth"></div>';
    echo '</div>';
    $tab++;
    spa_paint_input(spa_text('Description'), 'forum_desc', '', false, true);
    spa_paint_checkbox(spa_text('Locked'), 'forum_status', 0);
    spa_paint_checkbox(spa_text('Disable forum RSS feed so feed will not be generated'), 'forum_private', 0);
    echo '<div class="sfoptionerror spaceabove">';
    echo '<p><b>' . sp_text('Custom Icon Ordering') . '</b></br>';
    echo sp_text('When using custom forum or topic icons and multiple conditions exist, the following precedence is used:') . '</p>';
    echo sp_text('Locked') . '<br />';
    echo sp_text('Pinned') . '<br />';
    echo sp_text('Unread') . '<br />';
    echo sp_text('Custom') . '<br />';
    echo sp_text('Theme Default') . '<br />';
    echo '</div>';
    spa_paint_select_start(spa_text('Custom forum icon'), 'forum_icon', '');
    spa_select_icon_dropdown('forum_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom forum icon when new posts'), 'forum_icon_new', '');
    spa_select_icon_dropdown('forum_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom forum icon when locked'), 'forum_icon_locked', '');
    spa_select_icon_dropdown('forum_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon'), 'topic_icon', '');
    spa_select_icon_dropdown('topic_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when new posts'), 'topic_icon_new', '');
    spa_select_icon_dropdown('topic_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when locked'), 'topic_icon_locked', '');
    spa_select_icon_dropdown('topic_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when pinned'), 'topic_icon_pinned', '');
    spa_select_icon_dropdown('topic_icon_pinned', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', '', false);
    spa_paint_select_end();
    spa_paint_input(spa_text('Custom meta keywords (SEO option must be enabled)'), 'forum_keywords', '', false, true);
    spa_paint_wide_textarea('Special forum message to be displayed above forums', 'forum_message', '');
    spa_paint_close_fieldset();
    echo '<div class="sfoptionerror spaceabove">';
    echo sprintf(sp_text('To re-order your Groups, Forums and SubForums use the %s Order Groups and Forums %s option from the Forums Menu'), '<b>', '</b>');
    echo '</div>';
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Extended Forum Options'), false);
    # As added by plugins
    do_action('sph_forum_create_forum_options');
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Add User Group Permissions'), false);
    echo '<div id="block2" class="sfhidden">';
    echo '<strong>' . spa_text('You can selectively set the permission sets for the forum below. If you want to use the default permissions for the selected group, then do not select anything') . '</strong>';
    # Permissions
    $usergroups = spa_get_usergroups_all();
    $roles = sp_get_all_roles();
    foreach ($usergroups as $usergroup) {
        echo '<input type="hidden" name="usergroup_id[]" value="' . $usergroup->usergroup_id . '" />';
        spa_paint_select_start(sp_filter_title_display($usergroup->usergroup_name), 'role[]', '');
        echo '<option value="-1">' . spa_text('Select permission set') . '</option>';
        foreach ($roles as $role) {
            echo '<option value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n";
        }
        spa_paint_select_end();
    }
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
            <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Create New Forum');
    ?>
" />
		</div>
    	<?php 
    spa_paint_close_tab();
    ?>
        </div>
	</form>
	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_components_seo_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfseoform', 'sfreloadse');
    });
</script>
<?php 
    $sfcomps = spa_get_seo_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=components-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=seo';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfseoform" name="sfseo">
	<?php 
    echo sp_create_nonce('forum-adminform_seo');
    spa_paint_options_init();
    #== EXTENSIONS Tab ============================================================
    spa_paint_open_tab(spa_text('Components') . ' - ' . spa_text('SEO'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Page/Browser Title (SEO)'), true, 'seo-plugin-integration');
    spa_paint_checkbox(spa_text('Overwrite page/browser title with ours'), 'sfseo_overwrite', $sfcomps['sfseo_overwrite']);
    spa_paint_checkbox(spa_text('Include blog name in page/browser title'), 'sfseo_blogname', $sfcomps['sfseo_blogname']);
    spa_paint_checkbox(spa_text('Include page name in page/browser title'), 'sfseo_pagename', $sfcomps['sfseo_pagename']);
    spa_paint_checkbox(spa_text('Display page name on forum home page (Group View) only'), 'sfseo_homepage', $sfcomps['sfseo_homepage']);
    spa_paint_checkbox(spa_text('Include forum name in page/browser title'), 'sfseo_forum', $sfcomps['sfseo_forum']);
    spa_paint_checkbox(spa_text('Include topic name in page/browser title'), 'sfseo_topic', $sfcomps['sfseo_topic']);
    spa_paint_checkbox(spa_text('Exclude forum name in page/browser title on topic views only'), 'sfseo_noforum', $sfcomps['sfseo_noforum']);
    spa_paint_checkbox(spa_text('Include non-forum page view names (ie profile, member list, etc) in page/browser title'), 'sfseo_page', $sfcomps['sfseo_page']);
    spa_paint_input(spa_text('Title separator'), 'sfseo_sep', $sfcomps['sfseo_sep']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Meta Tags Data'), true, 'meta-tags');
    $submessage = spa_text('Text you enter here will entered as a custom meta desciption tag if enabled in the option above');
    spa_paint_wide_textarea(spa_text('Custom meta description'), 'sfdescr', $sfcomps['sfdescr'], $submessage, 3);
    $submessage = spa_text('Enter keywords separated by commas');
    spa_paint_wide_textarea(spa_text('Custom meta keywords'), 'sfkeywords', $sfcomps['sfkeywords'], $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_seo_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Meta Tags Setup'), true, 'meta-setup');
    $values = array(spa_text('Do not add meta description to any forum pages'), spa_text('Use custom meta description on all forum pages'), spa_text('Use custom meta description on main forum page only and use forum description on forum and topic pages'), spa_text('Use custom meta description on main forum page only, use forum description on forum pages and use topic title on topic pages'), spa_text('Use custom meta description on main forum page only, use forum description on forum pages and use first post excerpt (120 chars) on topic pages'));
    spa_paint_radiogroup(spa_text('Select meta description option'), 'sfdescruse', $values, $sfcomps['sfdescruse'], false, true);
    $values = array(spa_text('Do not add meta keywords to any forum pages'), spa_text('Use custom meta keywords (entered in left panel) on all forum pages'), spa_text('Use custom meta keywords for each forum on forum and topic view pages. Custom meta keywords (from left panel) used on other forum pages'));
    spa_paint_radiogroup(spa_text('Select meta keywords option'), 'sfusekeywords', $values, $sfcomps['sfusekeywords'], false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_components_seo_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
        	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update SEO Component');
    ?>
" />
    	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_toolbox_inspector_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfinspectorform', '');
    });
</script>
<?php 
    $ins = spa_get_inspector_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=inspector';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfinspectorform" name="sfinspector">
	<?php 
    echo sp_create_nonce('forum-adminform_inspector');
    spa_paint_options_init();
    #== UNINSTALL Tab ==========================================================
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Data Inspector'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Data Inspector'), true, 'inspect-data');
    echo '<br /><div class="sfoptionerror">';
    spa_etext('Turning any of these options on will cause the data object being used to populate the relevant view or section to be displayed. You are the only user who will be shown these displays');
    echo '.<br />';
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Control Data'), false);
    spa_paint_checkbox(spa_text('spVars'), 'con_spVars', $ins['con_spVars']);
    spa_paint_checkbox(spa_text('spGlobals'), 'con_spGlobals', $ins['con_spGlobals']);
    spa_paint_checkbox(spa_text('spThisUser'), 'con_spThisUser', $ins['con_spThisUser']);
    spa_paint_checkbox(spa_text('spDevice'), 'con_spDevice', $ins['con_spDevice']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Profile View Data'), false);
    spa_paint_checkbox(spa_text('spProfileUser'), 'pro_spProfileUser', $ins['pro_spProfileUser']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Group View Data'), false);
    spa_paint_checkbox(spa_text('spGroupView'), 'gv_spGroupView', $ins['gv_spGroupView']);
    spa_paint_checkbox(spa_text('spThisGroup'), 'gv_spThisGroup', $ins['gv_spThisGroup']);
    spa_paint_checkbox(spa_text('spThisForum'), 'gv_spThisForum', $ins['gv_spThisForum']);
    spa_paint_checkbox(spa_text('spThisForumSubs'), 'gv_spThisForumSubs', $ins['gv_spThisForumSubs']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spGroupView Query SQL'), 'q_spGroupView', $ins['q_spGroupView']);
    spa_paint_checkbox(spa_text('spGroupViewStats Query SQL'), 'q_spGroupViewStats', $ins['q_spGroupViewStats']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum View Data'), false);
    spa_paint_checkbox(spa_text('spForumView'), 'fv_spForumView', $ins['fv_spForumView']);
    spa_paint_checkbox(spa_text('spThisForum'), 'fv_spThisForum', $ins['fv_spThisForum']);
    spa_paint_checkbox(spa_text('spThisForumSubs'), 'fv_spThisForumSubs', $ins['fv_spThisForumSubs']);
    spa_paint_checkbox(spa_text('spThisSubForum'), 'fv_spThisSubForum', $ins['fv_spThisSubForum']);
    spa_paint_checkbox(spa_text('spThisTopic'), 'fv_spThisTopic', $ins['fv_spThisTopic']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spForumView Query SQL'), 'q_spForumView', $ins['q_spForumView']);
    spa_paint_checkbox(spa_text('spForumViewStats Query SQL'), 'q_spForumViewStats', $ins['q_spForumViewStats']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Topic View Data'), false);
    spa_paint_checkbox(spa_text('spTopicView'), 'tv_spTopicView', $ins['tv_spTopicView']);
    spa_paint_checkbox(spa_text('spThisTopic'), 'tv_spThisTopic', $ins['tv_spThisTopic']);
    spa_paint_checkbox(spa_text('spThisPost'), 'tv_spThisPost', $ins['tv_spThisPost']);
    spa_paint_checkbox(spa_text('spThisPostUser'), 'tv_spThisPostUser', $ins['tv_spThisPostUser']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spTopicView Query SQL'), 'q_spTopicView', $ins['q_spTopicView']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Member View Data'), false);
    spa_paint_checkbox(spa_text('spMembersList'), 'mv_spMembersList', $ins['mv_spMembersList']);
    spa_paint_checkbox(spa_text('spThisMemberGroup'), 'mv_spThisMemberGroup', $ins['mv_spThisMemberGroup']);
    spa_paint_checkbox(spa_text('spThisMember'), 'mv_spThisMember', $ins['mv_spThisMember']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spMembersView Query SQL'), 'q_spMembersView', $ins['q_spMembersView']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Topic List View Data'), false);
    spa_paint_checkbox(spa_text('spTopicListView'), 'tlv_spTopicListView', $ins['tlv_spTopicListView']);
    spa_paint_checkbox(spa_text('spThisListTopic'), 'tlv_spThisListTopic', $ins['tlv_spThisListTopic']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spTopicListView Query SQL'), 'q_spTopicListView', $ins['q_spTopicListView']);
    spa_paint_checkbox(spa_text('spTopicListViewNew Query SQL'), 'q_spTopicListViewNew', $ins['q_spTopicListViewNew']);
    spa_paint_checkbox(spa_text('spTopicListViewFirst Query SQL'), 'q_spTopicListViewFirst', $ins['q_spTopicListViewFirst']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Post List View Data'), false);
    spa_paint_checkbox(spa_text('spPostListView'), 'plv_spPostListView', $ins['plv_spPostListView']);
    spa_paint_checkbox(spa_text('spThisListPost'), 'plv_spThisListPost', $ins['plv_spThisListPost']);
    echo '<hr>';
    spa_paint_checkbox(spa_text('spPostListView Query SQL'), 'q_spPostListView', $ins['q_spPostListView']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Search View Data'), false);
    spa_paint_checkbox(spa_text('spSearchView'), 'q_spSearchView', $ins['q_spSearchView']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_insepctor_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Inspector Settings');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}