function spa_themes_list_form()
{
    global $spPaths;
    # get current theme
    $curTheme = sp_get_option('sp_current_theme');
    # get themes
    $themes = sp_get_themes_list_data();
    # get update version info
    $xml = sp_load_version_xml();
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Available Themes') . '- ' . spa_text('Select Simple:Press Theme'), true);
    spa_paint_open_panel();
    spa_paint_spacer();
    echo '<div class="sfoptionerror">';
    echo spa_text('Themes Folder') . ': <b>' . realpath(SF_STORE_DIR . '/' . $spPaths['themes']) . '</b>';
    echo '</div>';
    spa_paint_open_fieldset(spa_text('Theme Management'), true, 'themes');
    ?>
	<h3><?php 
    echo spa_text('Current Theme');
    ?>
</h3>
	<div class="theme-browser rendered">
	<div class="spThemeContainer">
	<div id="current-theme" class="spTheme">
<?php 
    if (file_exists(SPTHEMEBASEDIR . $curTheme['theme'] . '/styles/' . $curTheme['style'])) {
        ?>
			<h3 class="theme-name"><?php 
        echo $themes[$curTheme['theme']]['Name'];
        ?>
</h3>

    		<img src="<?php 
        echo SPTHEMEBASEURL . $curTheme['theme'] . '/' . $themes[$curTheme['theme']]['Screenshot'];
        ?>
" alt="" />
    		<h4>
    			<?php 
        echo $themes[$curTheme['theme']]['Name'] . ' ' . $themes[$curTheme['theme']]['Version'] . ' ' . spa_text('by') . ' <a href="' . $themes[$curTheme['theme']]['AuthorURI'] . '" title="' . spa_text('Visit author homepage') . '">' . $themes[$curTheme['theme']]['Author'] . '</a>';
        ?>
    		</h4>
<?php 
        if (!empty($curTheme['parent'])) {
            if (file_exists(SPTHEMEBASEDIR . $curTheme['parent'])) {
                echo '<p class="theme-parent">';
                echo spa_text('This theme is a child theme of ') . '<b>' . $curTheme['parent'] . '</b>';
                echo '</p>';
            } else {
                echo '<p class="theme-parent">';
                echo '<b>' . spa_text('The specified parent theme') . " '" . $curTheme['parent'] . "' " . spa_text('does not exist') . '</b> ';
                echo '</p>';
            }
        }
        ?>
    		<p class="description" style="padding: 0;">
    			<?php 
        echo $themes[$curTheme['theme']]['Description'];
        ?>
    		</p>
<?php 
        $overlays = sp_get_overlays(SPTHEMEBASEDIR . $curTheme['theme'] . '/styles/overlays');
        # pull in parent overlays if child theme
        if (!empty($curTheme['parent'])) {
            $parent_overlays = sp_get_overlays(SPTHEMEBASEDIR . $curTheme['parent'] . '/styles/overlays');
            $overlays = array_merge($overlays, $parent_overlays);
            $overlays = array_unique($overlays);
        }
        if (!empty($overlays)) {
            ?>
                <script type="text/javascript">
                jQuery(document).ready(function() {
					spjAjaxForm('sftheme-<?php 
            echo esc_js($curTheme['theme']);
            ?>
', 'sfreloadtlist');
                });
                </script>
                <br />
<?php 
            $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=theme';
            echo '<form action="' . $ahahURL . '" method="post" id="sftheme-' . esc_attr($curTheme['theme']) . '" name="sftheme-' . esc_attr($curTheme['theme']) . '">';
            echo sp_create_nonce('forum-adminform_themes');
            echo '<input type="hidden" name="theme" value="' . esc_attr($curTheme['theme']) . '" />';
            echo '<input type="hidden" name="style" value="' . esc_attr($themes[$curTheme['theme']]['Stylesheet']) . '" />';
            echo '<input type="hidden" name="parent" value="' . esc_attr($curTheme['parent']) . '" />';
            echo '<input type="hidden" name="default-color" value="' . esc_attr($overlays[0]) . '" />';
            echo spa_text('Select Overlay') . ': ';
            echo '<select name="color-' . esc_attr($curTheme['theme']) . '">';
            foreach ($overlays as $overlay) {
                $overlay = trim($overlay);
                $selected = $curTheme['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="update" name="update" 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[$curTheme['theme']]['Name'] == $latest->name) {
                    if (version_compare($latest->version, $themes[$curTheme['theme']]['Version'], '>') == 1) {
                        echo '<br />';
                        echo '<p style="padding: 0;">';
                        echo '<strong>' . spa_text('There is an update for the') . ' ' . $themes[$curTheme['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;
                }
            }
        }
    } else {
        echo '<h4>' . spa_text('The current theme stylesheet') . ':<br /><br />' . SPTHEMEBASEDIR . $curTheme['theme'] . '/styles/' . $curTheme['style'] . '<br /><br />' . spa_text('cannot be found. Please correct or select a new theme for proper operation.') . '</h4>';
    }
    ?>
	</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 == $curTheme['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);
            ?>
', 'sfreloadtlist');
	                    });
	                    </script>
	                    <?php 
            $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=theme';
            ?>
                        <?php 
            $msg = esc_js(spa_text('Are you sure you want to delete this Simple Press theme?'));
            ?>
	                	<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="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;
            echo "<input type='hidden' name='default-color' value='{$defOverlay}' />";
            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="activate-<?php 
            echo esc_attr($theme_file);
            ?>
" name="activate" value="<?php 
            echo spa_etext('Activate Theme');
            ?>
" />
	                    <?php 
            if (!is_multisite() || is_super_admin()) {
                ?>
<input type="submit" class="button-secondary action" id="delete-<?php 
                echo esc_attr($theme_file);
                ?>
" name="delete" value="<?php 
                echo spa_etext('Delete Theme');
                ?>
" onclick="javascript: if (confirm('<?php 
                echo $msg;
                ?>
')) {return true;} else {return false;}" /><?php 
            }
            ?>
	                    </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_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_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();
    }
}
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_plugins_list_form()
{
    global $spPaths;
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sppluginsform', 'sfreloadpl');
        /* wp check all logic */
    	jQuery('thead, tfoot').find('.check-column :checkbox').click( function(e) {

    		var c = jQuery(this).prop('checked'),
    			kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
    			toggle = e.shiftKey || kbtoggle;

    		jQuery(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
    		.children().children('.check-column').find(':checkbox')
    		.prop('checked', function() {
    			if ( jQuery(this).is(':hidden') )
    				return false;
    			if ( toggle )
    				return jQuery(this).prop( 'checked' );
    			else if (c)
    				return true;
    			return false;
    		});

    		jQuery(this).closest('table').children('thead,  tfoot').filter(':visible')
    		.children().children('.check-column').find(':checkbox')
    		.prop('checked', function() {
    			if ( toggle )
    				return false;
    			else if (c)
    				return true;
    			return false;
    		});
    	});
    });
</script>
<?php 
    # get plugins
    $plugins = spa_get_plugins_list_data();
    # get update version info
    $xml = sp_load_version_xml();
    # check active plugins
    $invalid = sp_validate_active_plugins();
    if (!empty($invalid)) {
        foreach ($invalid as $plugin_file => $error) {
            echo '<div id="message" class="error"><p>' . sprintf(spa_text('The plugin %1$s has been deactivated due to error: %2$s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>';
        }
    }
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=plugins-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=list';
    $msg = esc_js(spa_text('Are you sure you want to delete the selected Simple Press plugins?'));
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sppluginsform" name="sppluginsform" onsubmit="javascript: if (ActionType.options[ActionType.selectedIndex].value == 'delete-selected' || ActionType2.options[ActionType2.selectedIndex].value == 'delete-selected') {if (confirm('<?php 
    echo $msg;
    ?>
')) {return true;} else {return false;}} else {return true;}">
	<?php 
    echo sp_create_nonce('forum-adminform_plugins');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Available Plugins') . ' - ' . spa_text('Install Simple:Press Plugins'), true);
    spa_paint_open_panel();
    spa_paint_spacer();
    echo '<div class="sfoptionerror">';
    echo spa_text('Plugins Folder') . ': <b>' . realpath(SF_STORE_DIR . '/' . $spPaths['plugins']) . '</b>';
    echo '</div>';
    spa_paint_open_fieldset(spa_text('Plugin Management'), true, 'plugins');
    ?>
	<div class="tablenav top">
		<div class="alignleft actions">
			<select id="ActionType" name="action">
				<option selected="selected" value="-1"><?php 
    echo spa_text('Bulk Actions');
    ?>
</option>
				<option value="activate-selected"><?php 
    echo spa_text('Activate');
    ?>
</option>
				<option value="deactivate-selected"><?php 
    echo spa_text('Deactivate');
    ?>
</option>
				<?php 
    if (!is_multisite() || is_super_admin()) {
        ?>
<option value="delete-selected"><?php 
        echo spa_text('Delete');
        ?>
</option><?php 
    }
    ?>
			</select>
			<input id="doaction" class="button-secondary action" type="submit" value="<?php 
    echo spa_text('Apply');
    ?>
" />
		</div>
		<div class="tablenav-pages one-page">
			<span class="displaying-num"><?php 
    echo count($plugins) . ' ' . spa_text('plugins');
    ?>
</span>
		</div>
	</div>

	<table class="wp-list-table widefat plugins">
        <thead>
		<tr>
			<td id='cb' class='manage-column column-cb check-column'>
				&nbsp;&nbsp;&nbsp;<input type="checkbox" name="cbhead" id="cbhead" />
				<label class="wp-core-ui" for='cbhead'>&nbsp;</label>
			</td>
            <th class='manage-column check-column'></th>
			<th class='manage-column column-name column-primary'>
				<?php 
    spa_etext('Plugin');
    ?>
			</th>
			<th class='manage-column column-description'>
				<?php 
    spa_etext('Description');
    ?>
			</th>
		</tr>
        </thead>

        <tbody class="the-list">
<?php 
    if (empty($plugins)) {
        echo '<tr><td colspan="4">' . spa_text('No plugins found.') . '</td></tr>';
    }
    $disabled = '';
    foreach ((array) $plugins as $plugin_file => $plugin_data) {
        # check for valid folder name
        $path = explode('/', $plugin_file);
        $bad = is_numeric(substr($path[0], -1));
        $is_active = sp_is_plugin_active($plugin_file);
        if ($is_active) {
            $url = SFADMINPLUGINS . '&amp;action=deactivate&amp;plugin=' . esc_attr($plugin_file) . '&amp;title=' . urlencode(esc_attr($plugin_data['Name'])) . '&amp;sfnonce=' . wp_create_nonce('forum-adminform_plugins');
            $actionlink = "<a href='{$url}' title='" . spa_text('Deactivate this Plugin') . "'>" . spa_text('Deactivate') . '</a>';
            $actionlink = apply_filters('sph_plugins_active_buttons', $actionlink, $plugin_file);
            $actionlink .= sp_paint_plugin_tip($plugin_data['Name'], $plugin_file);
            $rowClass = 'active';
            $icon = '<img src="' . SFADMINIMAGES . 'sp_Yes.png" title="' . spa_text('Plugin activated') . '" alt="" style="vertical-align:middle;" />';
        } else {
            if ($bad) {
                $rowClass = 'inactive spWarningBG';
                $actionlink = '';
                $icon = '<img src="' . SFADMINIMAGES . 'sp_NoWrite.png" title="' . spa_text('Warning') . '" alt="" style="vertical-align:middle;" />';
                $disabled = ' disabled="disabled" ';
            } else {
                $url = SFADMINPLUGINS . '&amp;action=activate&amp;plugin=' . esc_attr($plugin_file) . '&amp;title=' . urlencode(esc_attr($plugin_data['Name'])) . '&amp;sfnonce=' . wp_create_nonce('forum-adminform_plugins');
                $actionlink = "<a href='{$url}' title='" . spa_text('Activate this Plugin') . "'>" . spa_text('Activate') . "</a>";
                $url = SFADMINPLUGINS . '&amp;action=delete&amp;plugin=' . esc_attr($plugin_file) . '&amp;title=' . urlencode(esc_attr($plugin_data['Name'])) . '&amp;sfnonce=' . wp_create_nonce('forum-adminform_plugins');
                $msg = esc_js(spa_text('Are you sure you want to delete this Simple Press plugin?'));
                if (!is_multisite() || is_super_admin()) {
                    $actionlink .= ' | <a href="javascript: if (confirm(\'' . $msg . '\')) {window.location=\'' . $url . '\';}" title="' . spa_text('Delete this Plugin') . '">' . spa_text('Delete') . '</a>';
                }
                $actionlink = apply_filters('sph_plugins_inactive_buttons', $actionlink, $plugin_file);
                $rowClass = 'inactive';
                $icon = '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Plugin not activated') . '" alt="" style="vertical-align: middle;" />';
                $disabled = '';
            }
        }
        $description = $plugin_data['Description'];
        $plugin_name = $plugin_data['Name'];
        ?>
        	<tr class='<?php 
        echo $rowClass;
        ?>
'>
        		<th class='manage-column column-cb check-column' scope='row'>
					<?php 
        $thisId = 'checkbox_' . rand(1, 9999999999);
        ?>
					&nbsp;&nbsp;&nbsp;<input id="<?php 
        echo $thisId;
        ?>
" type="checkbox" value="<?php 
        echo $plugin_file;
        ?>
" name="checked[]" <?php 
        echo $disabled;
        ?>
/>
					<label for="<?php 
        echo $thisId;
        ?>
">&nbsp;</label>
				</th>
				<td class='manage-column check-column'>
                	<?php 
        echo $icon;
        ?>
				</td>
        		<td class='manage-column column-name column-primary'>
					<strong><?php 
        echo esc_html($plugin_name);
        ?>
</strong>
	        		<div class="row-actions-visible">
    	   				<span><?php 
        echo str_replace('&nbsp;&nbsp;', '  |  ', $actionlink);
        ?>
</span>
        			</div>
				</td>
        		<td class='manage-column column-description'>
        			<div class='manage-column column-description'>
						<?php 
        echo $description;
        ?>
					</div>
					<div class='<?php 
        echo $rowClass;
        ?>
 second plugin-version-author-uri'>
<?php 
        $plugin_meta = array();
        if (!empty($plugin_data['Version'])) {
            $plugin_meta[] = sprintf(spa_text('Version %s'), $plugin_data['Version']);
        }
        if (!empty($plugin_data['Author'])) {
            $author = $plugin_data['Author'];
            if (!empty($plugin_data['AuthorURI'])) {
                $author = '<a href="' . esc_url($plugin_data['AuthorURI']) . '" title="' . spa_text('Visit author homepage') . '">' . esc_html($plugin_data['Author']) . '</a>';
            }
            $plugin_meta[] = sprintf(spa_text('By %s'), $author);
        }
        if (!empty($plugin_data['PluginURI'])) {
            $plugin_meta[] = '<a href="' . esc_url($plugin_data['PluginURI']) . '" title="' . spa_text('Visit plugin site') . '">' . esc_html(spa_text('Visit plugin site')) . '</a>';
        }
        echo implode(' | ', $plugin_meta);
        ?>
					</div>
				</td>
        	</tr>
<?php 
        # is it bad?
        if ($bad) {
            preg_match('/-?\\s*\\d+$/', $path[0], $fix);
            $suggest = str_replace($fix[0], '', $path[0]);
            ?>
				<tr class='<?php 
            echo $rowClass;
            ?>
'>
					<td colspan="4">
						<div class="sfoptionerror">
							<?php 
            echo sprintf(spa_text('The folder name of this plugin has become corrupted - probably due to multiple downloads. Please remove the %s at the end of the folder name.  The proper folder name should be %s'), "<strong>{$fix['0']}</strong>", "<strong>{$suggest}</strong>");
            ?>
						</div>
					</td>
				</tr>
<?php 
        }
        # any upgrade for this plugin?  in multisite only main site can update
        if (is_main_site() && $xml) {
            foreach ($xml->plugins->plugin as $latest) {
                if ($plugin_data['Name'] == $latest->name) {
                    if (version_compare($latest->version, $plugin_data['Version'], '>') == 1) {
                        ?>
							<tr class="plugin-update-tr">
								<td class="plugin-update colspanchange" colspan="3">
									<div class="update-message">
										<?php 
                        echo spa_text('There is an update for the') . ' ' . $plugin_data['Name'] . ' ' . spa_text('plugin') . '. ';
                        ?>
										<?php 
                        echo spa_text('Version') . ' ' . $latest->version . ' ' . spa_text('is available') . '. ';
                        ?>
										<?php 
                        echo spa_text('For details and to download please visit') . ' ' . SFPLUGHOME . ' ' . spa_text('or') . ' ' . spa_text('go to the') . ' ';
                        ?>
										<?php 
                        echo '<a href="' . self_admin_url('update-core.php') . '" title="" target="_parent">' . spa_text('WordPress updates page') . '</a>';
                        ?>
									</div>
								</td>
							</tr>
<?php 
                    }
                    break;
                }
            }
        }
    }
    do_action('sph_plugins_list_panel');
    ?>
        </tbody>

        <tfoot>
		<tr>
			<td class='manage-column column-cb check-column'>
				&nbsp;&nbsp;&nbsp;<input type="checkbox" name="cbfoot" id="cbfoot" />
				<label class="wp-core-ui" for='cbfoot'>&nbsp;</label>
			</td>
            <th class='manage-column check-column'></th>
			<th class='manage-column column-name column-primary'>
				<?php 
    spa_etext('Plugin');
    ?>
			</th>
			<th class='manage-column column-description'>
				<?php 
    spa_etext('Description');
    ?>
			</th>
		</tr>
        </tfoot>
    </table>

	<div class="tablenav bottom">
		<div class="alignleft actions">
			<select id="ActionType2" name="action2">
				<option selected="selected" value="-1"><?php 
    echo spa_text('Bulk Actions');
    ?>
</option>
				<option value="activate-selected"><?php 
    echo spa_text('Activate');
    ?>
</option>
				<option value="deactivate-selected"><?php 
    echo spa_text('Deactivate');
    ?>
</option>
				<?php 
    if (!is_multisite() || is_super_admin()) {
        ?>
<option value="delete-selected"><?php 
        echo spa_text('Delete');
        ?>
</option><?php 
    }
    ?>
			</select>
			<input id="doaction2" class="button-secondary action" type="submit" value="<?php 
    echo spa_text('Apply');
    ?>
" name="" />
		</div>
		<div class="tablenav-pages one-page">
			<span class="displaying-num"><?php 
    echo count($plugins) . ' ' . spa_text('plugins');
    ?>
</span>
		</div>
	</div>
<?php 
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
	<div class="sfform-panel-spacer"></div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}