function spa_plugins_upload_form()
{
    # Make sure only super admin can upload on multisite
    if (is_multisite() && !is_super_admin()) {
        spa_etext('Access denied - you do not have permission');
        die;
    }
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Upload Plugin') . ' - ' . spa_text('Upload a Simple:Press Plugin'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Upload Plugin'), true, 'upload-plugin');
    echo '<p>' . spa_text('Upload a Simple:Press plugin in .zip format') . '</p>';
    echo '<p>' . spa_text('If you have a plugin in a .zip format, you may upload it here') . '</p>';
    ?>
        	<form method="post" enctype="multipart/form-data" action="<?php 
    echo self_admin_url('update.php?action=upload-sp-plugin');
    ?>
" id="sfpluginuploadform" name="sfpluginuploadform">
                <?php 
    echo sp_create_nonce('forum-plugin_upload');
    ?>
        		<p><input type="file" id="pluginzip" name="pluginzip" /></p>
        		<p><input type="button" class="button-primary" id="saveupload" name="saveupload" value="<?php 
    spa_etext('Upload Now');
    ?>
" onclick="jQuery('#saveupload').attr('disabled', 'disabled'); javascript:document.sfpluginuploadform.submit();" /></p>
        	</form>
<?php 
    spa_paint_close_fieldset();
    do_action('sph_plugins_upload_panel');
    spa_paint_close_panel();
    spa_paint_close_container();
    spa_paint_close_tab();
}
function spa_display_member_roll($members, $text1, $text2)
{
    $out = '';
    $cap = '';
    $first = true;
    $out .= '<fieldset class="sfsubfieldset">';
    $out .= '<legend>' . $text1 . '</legend>';
    if ($members) {
        $out .= '<p><b>' . count($members) . ' ' . spa_text('member(s) in this user group') . '</b></p>';
        for ($x = 0; $x < count($members); $x++) {
            if (strncasecmp($members[$x]->display_name, $cap, 1) != 0) {
                if (!$first) {
                    $out .= '</ul>';
                }
                $cap = substr($members[$x]->display_name, 0, 2);
                if (function_exists('mb_strwidth')) {
                    if (mb_strwidth($cap) == 2) {
                        $cap = substr($cap, 0, 1);
                    }
                } else {
                    $cap = substr($cap, 0, 1);
                }
                $out .= '<p style="clear:both;"></p><hr /><h4>' . strtoupper($cap) . '</h4>';
                $out .= '<ul class="memberlist">';
                $first = false;
            }
            $out .= '<li>' . sp_filter_name_display($members[$x]->display_name) . '</li>';
        }
        $out .= '</ul>';
    } else {
        $out .= $text2;
    }
    $out .= '</fieldset>';
    return $out;
}
function spa_permissions_add_auth_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfauthnew', '');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=permissions-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=newauth';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfauthnew" name="sfauthnew">
<?php 
    echo sp_create_nonce('forum-adminform_authnew');
    spa_paint_open_tab(spa_text('Permissions') . ' - ' . spa_text('Add New Authorization'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Add New Authorization'), 'true', 'create-new-authorization');
    ?>
                    <br /><div class="sfoptionerror">
                    <?php 
    spa_etext('Please note, this will create a new singular authorization.');
    ?>
                    <?php 
    spa_etext('However, by default, it will not be used by anything in core.');
    ?>
                    <?php 
    spa_etext('This authorization could be used for a profile authorization or by a theme or plugin.');
    ?>
                    <?php 
    spa_etext('Please see the popup help for more information.');
    ?>
                    </div><br />
<?php 
    spa_paint_input(spa_text('Authorization name'), 'auth_name', '');
    spa_paint_input(spa_text('Authorization description'), 'auth_desc', '');
    spa_paint_checkbox(spa_text('Activate authorization'), 'auth_active', true);
    spa_paint_checkbox(spa_text('Authorization is ignored for guests'), 'auth_guests', false);
    spa_paint_checkbox(spa_text('Authorization requires enabling (recommend false'), 'auth_enabling', false);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_perm_add_auth_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 Authorization');
    ?>
" />
	</div>
	<?php 
    spa_paint_close_tab();
    ?>
	</form>
	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_download_language_file($item)
{
    global $spPaths;
    $langCode = $_GET['langcode'];
    $homeName = $_GET['textdom'];
    if (isset($_GET['name'])) {
        $itemName = $_GET['name'];
    }
    if ($item == 'corefront' || $item == 'coreadmin') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-core/version-' . $_GET['version'] . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = WP_CONTENT_DIR . '/' . $spPaths['language-sp'] . '/' . $homeName . '-' . $langCode . '.mo';
    }
    if ($item == 'theme') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-themes/' . $itemName . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = WP_CONTENT_DIR . '/' . $spPaths['language-sp-themes'] . '/' . $homeName . '-' . $langCode . '.mo';
    }
    if ($item == 'plugin') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-plugins/' . $itemName . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = WP_CONTENT_DIR . '/' . $spPaths['language-sp-plugins'] . '/' . $homeName . '-' . $langCode . '.mo';
    }
    if (isset($_GET['remove'])) {
        $status = unlink($home);
        $status = !$status;
    } else {
        $status = file_put_contents($home, fopen($url, 'rb'));
    }
    if ($status) {
        echo '<img src="' . SFADMINIMAGES . 'sp_Yes.png" title="' . spa_text('Translation file installed') . '" alt="" style="vertical-align: middle;" />';
    } else {
        echo '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Translation install failed') . '" alt="" style="vertical-align: middle;" />';
    }
}
function spa_toolbox_errorlog_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfclearlog', 'sfreloadel');
    });
</script>
<?php 
    $sflog = spa_get_errorlog_data();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Error Log'), true);
    spa_paint_open_fieldset(spa_text('Error Log'), false);
    echo '<p>' . spa_text('Error Logging can be disabled in the Global Options panel') . '<br /></p>';
    echo "<table class='sfhelptext'><tr>";
    echo "<td class='spaErrError spaErrCell'><b>" . spa_text('Error') . '</b></td>';
    echo "<td class='spaErrWarning spaErrCell'><b>" . spa_text('Warning') . '</b></td>';
    echo "<td class='spaErrNotice spaErrCell'><b>" . spa_text('Notice') . '</b></td>';
    echo "<td class='spaErrStrict spaErrCell'><b>" . spa_text('Strict') . '</b></td>';
    echo "</tr><tr>";
    echo "<td class='spaErrCellDesc'>" . spa_text('Errors should be reported to Simple:Press support as they may effect the proper behaviour of your forum') . '</td>';
    echo "<td class='spaErrCellDesc'>" . spa_text('Warnings suggest a code conflict of some type that should be investigated but which will not stop Simple:Press execution') . '</td>';
    echo "<td class='spaErrCellDesc'>" . spa_text('Notices are generally non-important and have no effect on Simple:Press execution. We make every effort to clear these when we are informed of them') . '</td>';
    echo "<td class='spaErrCellDesc'>" . spa_text('If you receive any Strict entries they are non-urgent but please inform Simple:Press support so we can deal with them') . '</td>';
    echo "</tr></table><p>&nbsp;</p>";
    if (!$sflog) {
        echo '<p>' . spa_text('There are no Error Log Entries') . '</p>';
    } else {
        echo "<table class='wp-list-table widefat'>";
        foreach ($sflog as $log) {
            echo '<tr>';
            echo "<td class='sferror " . $log['error_cat'] . "'>" . sp_date('d', $log['error_date']) . ' ' . sp_date('t', $log['error_date']) . ' | ' . $log['error_cat'] . ' | ' . $log['error_count'] . ' | ' . $log['error_type'] . '<hr />';
            echo $log['error_text'] . '</td>';
            echo '</tr>';
        }
        echo '</table>';
    }
    spa_paint_close_fieldset();
    do_action('sph_toolbox_error_panel');
    spa_paint_close_container();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=sfclearlog';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfclearlog" name="sfclearlog">
	<?php 
    echo sp_create_nonce('forum-adminform_clearlog');
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Empty Error Log');
    ?>
" />
	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_toolbox_uninstall_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfuninstallform', '');
    });
</script>
<?php 
    $sfoptions = spa_get_uninstall_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=toolbox-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=uninstall';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfuninstallform" name="sfuninstall">
	<?php 
    echo sp_create_nonce('forum-adminform_uninstall');
    spa_paint_options_init();
    #== UNINSTALL Tab ==========================================================
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Uninstall'), true);
    spa_paint_open_panel();
    echo '<br /><div class="sfoptionerror">';
    spa_etext('Should you, at any time, decide to remove Simple:Press, check the uninstall option below and then deactivate the Simple Press plugin in the standard WP fashion');
    echo '.<br />';
    spa_etext('If you have initiated uninstall, but changed your mind prior to Simple Press plugin deactivation, you can uncheck the uninstall option and it will be reversed');
    echo '.<br />';
    echo '<br />';
    spa_etext('UNINSTALLING SIMPLE PRESS WILL REMOVE ALL FORUM DATA FROM YOUR DATABASE');
    echo '!<br />';
    echo '<br />';
    spa_etext('UNINSTALLING SIMPLE PRESS WILL REMOVE ALL STORAGE LOCATIONS IF YOU ALSO ENABLE THE STORAGE LOCATUON REMOVAL OPTION');
    echo '!<br />';
    echo '<br />';
    spa_etext('ONCE YOU ENABLE UNINSTALL AND DEACTIVATE THE SIMPLE PRESS PLUGIN, THIS ACTION CAN NOT BE REVERSED');
    echo '!<br />';
    echo '<br />';
    spa_etext('Please note that you will still need to remove the Simple:Press core plugin files manually or use the wp plugin deletion functionalty');
    echo '.<br />';
    echo '</div>';
    spa_paint_open_fieldset(spa_text('Removing Simple:Press'), true, 'uninstall');
    spa_paint_checkbox(spa_text('Uninstall Simple Press - Requires plugin deactivation after enabling option (this will completely remove Simple:Press database entries)'), 'sfuninstall', $sfoptions['sfuninstall']);
    spa_paint_checkbox(spa_text('When uninstalling, completely remove Simple:Press storage locations'), 'removestorage', $sfoptions['removestorage']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_uninstall_panel');
    spa_paint_close_container();
    ?>
	<div class="sfform-submit-bar">
	<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Uninstall');
    ?>
" />
	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_toolbox_environment_form()
{
    #== ENVIRONMENT INFO Tab ==========================================================
    global $wp_version, $wpdb;
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    $theme = wp_get_theme();
    $wp_plugins = get_plugins();
    $sp_plugins = sp_get_plugins();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Environment'), true);
    spa_paint_open_fieldset(spa_text('Environment'), false);
    echo '<div id="sp-environment-data">';
    echo '<table class=:widefat">';
    spa_env_open(spa_text('Simple:Press'));
    spa_env_info(spa_text('Version'), SPVERSION);
    spa_env_info(spa_text('Build'), SPBUILD);
    spa_env_info(spa_text('Release'), SPRELEASE);
    spa_env_close();
    spa_env_open(spa_text('WordPress'));
    spa_env_info(spa_text('Version'), $wp_version);
    spa_env_info(spa_text('Language'), get_bloginfo('language'));
    spa_env_info(spa_text('Character Set'), get_bloginfo('charset'));
    spa_env_info(spa_text('Theme'), $theme->get('Name'));
    spa_env_close();
    spa_env_open(spa_text('PHP'));
    spa_env_info(spa_text('Version'), phpversion());
    spa_env_info(spa_text('Memory'), ini_get('memory_limit'));
    spa_env_info(spa_text('Max Upload'), ini_get('upload_max_filesize'));
    spa_env_info(spa_text('Timeout'), ini_get('user_ini.cache_ttl'));
    spa_env_close();
    spa_env_open(spa_text('MySQL'));
    spa_env_info(spa_text('Version'), $wpdb->db_version());
    spa_env_info(spa_text('Prefix'), $wpdb->prefix);
    spa_env_close();
    spa_env_open(spa_text('Server'));
    spa_env_info(spa_text('Version'), $_SERVER['SERVER_SOFTWARE']);
    spa_env_close();
    spa_env_open(spa_text('WP Plugins'));
    foreach (array_keys($wp_plugins) as $key) {
        if (is_plugin_active($key)) {
            $plugin = $wp_plugins[$key];
            spa_env_list($plugin['Name'], $plugin['Version']);
        }
    }
    spa_env_close();
    spa_env_open(spa_text('SP Plugins'));
    foreach ((array) $sp_plugins as $plugin_file => $plugin_data) {
        if (sp_is_plugin_active($plugin_file)) {
            spa_env_list($plugin_data['Name'], $plugin_data['Version']);
        }
    }
    spa_env_close();
    echo '</table>';
    echo '</div>';
    spa_paint_close_fieldset();
    do_action('sph_toolbox_environment_panel');
    spa_paint_close_container();
    spa_paint_close_tab();
}
function spa_forums_global_rssset_form($id)
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfglobalrssset', 'sfreloadfd');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=globalrssset';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfglobalrssset" name="sfglobalrssset">
<?php 
    echo sp_create_nonce('forum-adminform_globalrssset');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Global RSS Settings'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Globally Enable/Disable RSS Feeds'), false);
    echo '<tr><td colspan="2"><br />';
    echo '<div class="sfoptionerror">';
    spa_etext('Warning: Enabling or disabling RSS feeds from this form will apply that setting to ALL forums and overwrite any existing RSS feed settings. If you wish to individually enable/disable RSS feeds for a single forum, please visit the manage forums admin panel - edit the forum and set the RSS feed status there');
    echo '<br /><br />';
    if ($id == 1) {
        spa_etext('Please press the confirm button below to disable RSS feeds for all forums');
    }
    if ($id == 0) {
        spa_etext('Please press the confirm button below to enable RSS feeds for all forums');
    }
    echo '</div><br />';
    echo '</td></tr>';
    echo '<input type="hidden" name="sfglobalrssset" value="' . $id . '" />';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_forums_rss_panel');
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
			<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Confirm RSS Feed Status');
    ?>
" />
			<input type="button" class="button-primary" onclick="javascript:jQuery('#sfallrss').html('');" id="sfallrsscancel" name="sfallrsscancel" value="<?php 
    spa_etext('Cancel');
    ?>
" />
		</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_toolbox_changelog_form()
{
    #== CHANGELOG Tab ==========================================================
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Toolbox') . ' - ' . spa_text('Change Log'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Change Log'), false);
    # Display current change log if available or passed log
    if (isset($_POST['clselect'])) {
        $current = $_POST['clselect'];
        $cFile = 'change-log-' . $_POST['clselect'] . '.txt';
    } else {
        $cFile = 'change-log-' . SPBUILD . '.txt';
        $current = 0;
    }
    echo '<div id="sp-changelog-data">';
    $c = wp_remote_get('http://simple-press.com/downloads/simple-press/changelogs/' . $cFile);
    if (is_wp_error($c) || wp_remote_retrieve_response_code($c) != 200) {
        $b = substr($cFile, 11);
        $b = str_replace('.txt', '', $b);
        echo '<p>' . sprintf(spa_text('No change log file found for build %s'), $b) . '</p>';
    } else {
        echo wpautop($c['body']);
    }
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    $c = wp_remote_get('http://simple-press.com/downloads/simple-press/changelogs/log-index.xml');
    if (is_wp_error($c) || wp_remote_retrieve_response_code($c) != 200) {
        echo '<p>' . spa_text('Unable to communicate with Simple Press server') . '</p>';
    } else {
        $l = new SimpleXMLElement($c['body']);
        if (!empty($l)) {
            spa_paint_open_panel();
            spa_paint_open_fieldset(spa_text('Review Change Logs'), false);
            echo '<div id="sp-changelog-list">';
            echo '<form name="loadchangelog" method="post" action="admin.php?page=simple-press/admin/panel-toolbox/spa-toolbox.php&amp;tab=changelog">';
            echo '<select name="clselect" class="wp-core-ui" style="vertical-align:middle;font-weight: normal;font-size:13px;">';
            foreach ($l->log as $i => $x) {
                if ($x->build == $current ? $s = " selected='selected' " : ($s = '')) {
                }
                echo "<option class='wp-core-ui' value='" . $x->build . "' {$s}>" . $x->build . ' (' . $x->version . ') - ' . $x->date . '</option>';
            }
            echo '</select>';
            echo '<input type="submit" class="button-primary" id="gochangelog" name="gochangelog" value="' . spa_text('Display Change Log') . '" />';
            echo '</form>';
            echo '</div>';
            spa_paint_close_fieldset();
            spa_paint_close_panel();
        }
    }
    do_action('sph_toolbox_changelog_panel');
    spa_paint_close_container();
    echo '<div class="sfform-panel-spacer"></div>';
    spa_paint_close_tab();
}
Ejemplo n.º 10
0
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_permissions_reset_perms_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfresetpermissions', 'sfreloadpb');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=permissions-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=resetperms';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfresetpermissions" name="sfresetpermissions">
<?php 
    echo sp_create_nonce('forum-adminform_resetpermissions');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Reset All Permission'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Reset all permissions back to initial state.'), 'true', 'reset-permissions');
    echo '<p>';
    spa_etext('Warning! You are about to reset your permissions back to the install state.');
    echo '</p>';
    echo '<p>';
    spa_etext('This will delete all roles and permissions for your forums. You will have to give your users access to your forums again.');
    echo '</p>';
    echo '<p>';
    echo sprintf(spa_text('Please note that this action %s can NOT be reversed %s'), '<strong>', '</strong>');
    echo '</p>';
    echo '<p>';
    spa_etext('Click on the reset permissions button below to proceed');
    echo '</p>';
    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('Reset Permissions');
    ?>
" />
		</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_forums_remove_perms_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfallpermissionsdel', 'sfreloadfb');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=removeperms';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfallpermissionsdel" name="sfallpermissionsdel">
<?php 
    echo sp_create_nonce('forum-adminform_allpermissionsdelete');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Delete All Permission Sets'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Delete All Forum Permission Sets'), 'true', 'delete-all-forum-permission-sets');
    echo '<p>';
    spa_etext('Warning! You are about to delete all permission sets');
    echo '</p>';
    echo '<p>';
    spa_etext('This will delete all permission sets for all groups and forums');
    echo '</p>';
    echo '<p>';
    echo sprintf(spa_text('Please note that this action %s can NOT be reversed %s'), '<strong>', '</strong>');
    echo '</p>';
    echo '<p>';
    spa_etext('Click on the delete all permission sets button below to proceed');
    echo '</p>';
    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('Delete All Permission Sets');
    ?>
" />
		</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_admins_your_options_form()
{
    global $spThisUser;
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfmyadminoptionsform', 'sfreloadao');
    });
</script>
<?php 
    $sfadminsettings = spa_get_admins_your_options_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=admins-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=youradmin';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmyadminoptionsform" name="sfmyadminoptions">
	<?php 
    echo sp_create_nonce('my-admin_options');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('Admins') . ' - ' . spa_text('Your Admin Options'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Your Admin/Moderator Options'), 'true', 'your-admin-options');
    spa_paint_checkbox(spa_text('Receive email notification on new topic/post'), 'sfnotify', $sfadminsettings['sfnotify']);
    spa_paint_checkbox(spa_text('Receive notification (within forum - not email) on topic/post edits'), 'notify-edited', $sfadminsettings['notify-edited']);
    spa_paint_checkbox(spa_text('Bypass the Simple Press logout redirect'), 'bypasslogout', $sfadminsettings['bypasslogout']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_admins_options_top_panel');
    if ($spThisUser->admin) {
        spa_paint_open_panel();
        spa_paint_open_fieldset(spa_text('Set Your Moderator Options'), 'true', 'set-moderator-options');
        spa_paint_checkbox(spa_text('Grant all moderators the same option settings as above'), 'setmods', $sfadminsettings['setmods']);
        spa_paint_close_fieldset();
        spa_paint_close_panel();
    }
    do_action('sph_admins_options_bottom_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 Your Admin Options');
    ?>
" />
	</div>
<?php 
    spa_paint_close_tab();
    ?>
	</form>
<?php 
}
function sp_retrieve_plugin_help($file)
{
    $file = SFPLUGINDIR . $file;
    if (file_exists($file) == false) {
        return spa_text('No help file can be located');
    }
    $theData = '';
    $fh = fopen($file, 'r');
    do {
        $theData .= fgets($fh);
    } while (!feof($fh));
    fclose($fh);
    return $theData;
}
function spa_themes_css_form()
{
    $css = '';
    $id = 0;
    # get current theme
    $curTheme = sp_get_option('sp_current_theme');
    $rec = sp_get_sfmeta('css', $curTheme['theme']);
    if ($rec) {
        $css = $rec[0]['meta_value'];
        $id = $rec[0]['meta_id'];
    }
    ?>
<script type="text/javascript">
jQuery(document).ready(function() {
	spjAjaxForm('speditcss', '');
});
</script>
<?php 
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=css';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="speditcss" name="speditcss">
	<?php 
    echo sp_create_nonce('forum-adminform_css-editor');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('CSS Editor') . ' - ' . spa_text('Custom Simple:Press Theme CSS'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('CSS Editor'), true, 'css-editor');
    echo '<div>';
    echo '<textarea rows="25" name="spnewcontent" id="spnewcontent" tabindex="1">' . $css . '</textarea>';
    echo '<input type="hidden" name="metaId" value="' . $id . '" />';
    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('Update CSS');
    ?>
" />
    	</div>
<?php 
    spa_paint_close_tab();
    echo '</form>';
}
function spa_usergroups_create_usergroup_form()
{
    global $spPaths;
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfusergroupnew', 'sfreloadub');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=newusergroup';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfusergroupnew" name="sfusergroupnew">
<?php 
    echo sp_create_nonce('forum-adminform_usergroupnew');
    spa_paint_open_tab(spa_text('User Groups') . ' - ' . spa_text('Create New User Group'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Edit User Group'), 'true', 'edit-user-group');
    spa_paint_input(spa_text('User Group Name'), 'usergroup_name', '', false, true);
    spa_paint_input(spa_text('User Group Description'), 'usergroup_desc', '', false, true);
    spa_paint_select_start(spa_text('Select Badge'), 'usergroup_badge', 'usergroup_badge');
    spa_select_icon_dropdown('usergroup_badge', spa_text('Select Badge'), SF_STORE_DIR . '/' . $spPaths['ranks'] . '/', '', false);
    spa_paint_select_end('<small>(' . spa_text('Upload badges on the Components - Forum Ranks admin panel') . ')</small>');
    spa_paint_checkbox(spa_text('Allow members to join usergroup'), 'usergroup_join', false, false, false, false, '<small>' . spa_text('(Indicates that members are allowed to choose to join this usergroup on their profile page)') . '</small>');
    spa_paint_checkbox(spa_text('Is moderator'), 'usergroup_is_moderator', false, false, false, false, '<small>' . spa_text('(Indicates that members of this usergroup are considered Moderators)') . '</small>');
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_usergroup_create_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 User Group');
    ?>
" />
		</div>
		</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
function spa_forums_global_perm_form()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	spjAjaxForm('sfnewglobalpermission', 'sfreloadfb');
    });
</script>
<?php 
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=globalperm';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfnewglobalpermission" name="sfnewglobalpermission">
<?php 
    echo sp_create_nonce('forum-adminform_globalpermissionnew');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Add Global Permission Set'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Add a User Group Permission Set to All Forums'), 'true', 'add-a-user-group-permission-set-to-all-forums');
    spa_paint_select_start(spa_text('Select usergroup'), 'usergroup_id', '');
    spa_display_usergroup_select(false, 0, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Select permission set'), 'role', '');
    spa_display_permission_select(false, 0, false);
    spa_paint_select_end();
    echo '<p>' . spa_text('Caution:  Any current permission sets for the selected usergroup for ANY forum may be overwritten') . '</p>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_forums_global_perm_panel');
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
		<input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Add Global Permission');
    ?>
" />
		</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?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 
}
Ejemplo n.º 20
0
function spa_plugins_user_form($admin, $save, $form, $reload)
{
    global $spAPage;
    if ($form) {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function() {
            	jQuery('#sfpluginsuser').ajaxForm({
            		target: '#sfmsgspot',
            		success: function() {
            			<?php 
        if (!empty($reload)) {
            echo "jQuery('#" . $reload . "').click();";
        }
        ?>
            			jQuery('#sfmsgspot').fadeIn();
            			jQuery('#sfmsgspot').fadeOut(6000);
            		}
            	});
            });
        </script>
<?php 
        spa_paint_options_init();
        $ahahURL = SFHOMEURL . 'index.php?sp_ahah=plugins-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;saveform=plugin&amp;func={$save}";
        echo '<form action="' . $ahahURL . '" method="post" id="sfpluginsuser" name="sfpluginsuser">';
        echo sp_create_nonce('forum-adminform_userplugin');
    }
    call_user_func($admin);
    if ($form) {
        ?>
    	<div class="sfform-submit-bar">
<?php 
        echo apply_filters('sph_UpdateBar', '<input type="submit" class="button-primary" value="' . spa_text("Update") . '" />', $reload);
        ?>
    	</div>
        <?php 
        spa_paint_close_tab();
        ?>
        </form>

    	<div class="sfform-panel-spacer"></div>
<?php 
    }
}
function spa_toolbox_log_form()
{
    $sflog = spa_get_log_data();
    #== log Tab ==========================================================
    spa_paint_open_tab(spa_text('Toolbox') . " - " . spa_text('Install Log'), true);
    if (!$sflog) {
        spa_etext("There are no Install Log Entries");
        return;
    }
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Install Log'), false);
    echo "<table class='wp-list-table widefat'><tr>";
    echo '<th>' . spa_text('Version') . '</th>';
    echo "<th class='logDetail'>" . "</th>";
    echo '<th>' . spa_text('Build') . '</th>';
    echo "<th class='logRelease'>" . spa_text('Release') . "</th>";
    echo '<th>' . spa_text('Installed') . '</th>';
    echo "<th class='logBy'>" . spa_text('By') . "</th>";
    echo '</tr>';
    foreach ($sflog as $log) {
        $idVer = 'version' . str_replace('.', '', $log['version']);
        $idQVer = str_replace('.', '-', $log['version']);
        echo '<tr>';
        echo "<td class='sflabel'>" . $log['version'] . "</td>";
        $site = SFHOMEURL . 'index.php?sp_ahah=install-log&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;log=' . $idQVer;
        $gif = SFCOMMONIMAGES . 'working.gif';
        echo '<td class="logDetail"><input type="button" class="logDetail button" value="' . spa_text('Details') . '" onclick="spjLoadAhah(\'' . $site . '\', \'' . $idVer . '\', \'' . $gif . '\');" /></td>';
        echo "<td class='sflabel'>" . $log['build'] . "</td>";
        echo "<td class='sflabel logRelease'>" . $log['release_type'] . "</td>";
        echo "<td class='sflabel'>" . sp_date('d', $log['install_date']) . "</td>";
        echo "<td class='sflabel logBy'>" . sp_filter_name_display($log['display_name']) . "</td>";
        echo '</tr>';
        echo "<tr><td style='display:none;' class='sflabel' id='" . $idVer . "' colspan='6'></td></tr>";
    }
    echo '</table>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_toolbox_install_panel');
    spa_paint_close_container();
    echo '<div class="sfform-panel-spacer"></div>';
    spa_paint_close_tab();
}
Ejemplo n.º 22
0
function sp_retrieve_help($file, $tag, $folder)
{
    $path = SPHELP . 'admin/' . $folder;
    $note = '';
    $lang = spa_get_language_code();
    if (empty($lang) || ($lang = 'en_US')) {
        $lang = 'en';
    }
    $helpfile = $path . $file . '.' . $lang;
    $helpfile = apply_filters('sph_admin_help-' . $file, $helpfile, $tag, $lang);
    if (file_exists($helpfile) == false) {
        $helpfile = str_replace('.' . $lang, '.en', $helpfile);
        if (file_exists($helpfile) == false) {
            return spa_text('No help file can be located');
        } else {
            $note = spa_text('Sorry but a help file can not be found in your language');
        }
    }
    $fh = fopen($helpfile, 'r');
    do {
        $theData = fgets($fh);
        if (feof($fh)) {
            break;
        }
    } while (substr($theData, 0, strlen($tag)) != $tag);
    $theData = '';
    $theEnd = false;
    do {
        if (feof($fh)) {
            break;
        }
        $theLine = fgets($fh);
        if (substr($theLine, 0, 5) == '[end]') {
            $theEnd = true;
        } else {
            $theData .= $theLine;
        }
    } while ($theEnd == false);
    fclose($fh);
    return $note . '<br /><br />' . $theData;
}
Ejemplo n.º 23
0
function spa_paint_featured_images()
{
    global $spPaths;
    $out = '';
    # Open forum images folder and get contents for matching
    $path = SF_STORE_DIR . '/' . $spPaths['forum-images'] . '/';
    $dlist = @opendir($path);
    if (!$dlist) {
        echo '<table><tr><td class="sflabel"><strong>' . spa_text('The forum feauted images folder does not exist') . '</strong></td></tr></table>';
        return;
    }
    # start the table display
    $out .= '<table class="wp-list-table widefat"><tr>';
    $out .= '<th style="width:30%;text-align:center">' . spa_text('Image') . '</th>';
    $out .= '<th style="width:50%;text-align:center">' . spa_text('Filename') . '</th>';
    $out .= '<th style="text-align:center">' . spa_text('Remove') . '</th>';
    $out .= '</tr>';
    $out .= '<tr><td colspan="3">';
    $out .= '<div id="sf-featured-images">';
    while (false !== ($file = readdir($dlist))) {
        if ($file != '.' && $file != '..') {
            $found = false;
            $out .= '<table style="width:100%">';
            $out .= '<tr>';
            $out .= '<td style="text-align:center;width:30%" class="spWFBorder"><img class="sffeaturedimage " src="' . esc_url(SFFEATUREDURL . '/' . $file) . '" alt="" /></td>';
            $out .= '<td style="text-align:center;width:50%"  class="spWFBorder sflabel">';
            $out .= $file;
            $out .= '</td>';
            $out .= '<td style="text-align:center"  class="spWFBorder">';
            $site = esc_url(SFHOMEURL . 'index.php?sp_ahah=forums&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;action=delimage&amp;file={$file}");
            $out .= '<img src="' . SFCOMMONIMAGES . 'delete.png" title="' . spa_text('Delete featured image') . '" alt="" onclick="spjDelRowReload(\'' . $site . '\', \'sfreloadfi\');" />';
            $out .= '</td>';
            $out .= '</tr>';
            $out .= '</table>';
        }
    }
    $out .= '</div>';
    $out .= '</td></tr></table>';
    closedir($dlist);
    echo $out;
}
function spa_paint_avatar_pool()
{
    global $tab, $spPaths;
    $out = '';
    # Open avatar pool folder and get cntents for matching
    $path = SF_STORE_DIR . '/' . $spPaths['avatar-pool'] . '/';
    $dlist = @opendir($path);
    if (!$dlist) {
        echo '<table><tr><td class="sflabel"><strong>' . spa_text('The avatar pool folder does not exist') . '</strong></td></tr></table>';
        return;
    }
    # start the table display
    $out .= '<table class="wp-list-table widefat"><tr>';
    $out .= '<th style="width:30%;text-align:center">' . spa_text('Avatar') . '</th>';
    $out .= '<th style="width:50%;text-align:center">' . spa_text('Filename') . '</th>';
    $out .= '<th style="text-align:center">' . spa_text('Remove') . '</th>';
    $out .= '</tr>';
    $out .= '<tr><td colspan="3">';
    $out .= '<div id="sf-avatar-pool">';
    while (false !== ($file = readdir($dlist))) {
        if ($file != "." && $file != "..") {
            $found = false;
            $out .= '<table style="width:100%">';
            $out .= '<tr>';
            $out .= '<td style="text-align:center;width:30%" class="spWFBorder"><img class="sfavatarpool" src="' . esc_url(SFAVATARPOOLURL . '/' . $file) . '" alt="" /></td>';
            $out .= '<td style="text-align:center;width:50%" class="spWFBorder sflabel">';
            $out .= $file;
            $out .= '</td>';
            $out .= '<td style="text-align:center" class="spWFBorder">';
            $site = esc_url(SFHOMEURL . 'index.php?sp_ahah=profiles&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;action=delavatar&amp;file={$file}");
            $out .= '<img src="' . SFCOMMONIMAGES . 'delete.png" title="' . spa_text('Delete Avatar') . '" alt="" onclick="spjDelRowReload(\'' . $site . '\', \'sfreloadav\');" />';
            $out .= '</td>';
            $out .= '</tr>';
            $out .= '</table>';
        }
    }
    $out .= '</div>';
    $out .= '</td></tr></table>';
    closedir($dlist);
    echo $out;
}
function spa_download_language_file($item)
{
    global $spPaths, $locale;
    $locale = get_locale();
    $langCode = $_GET['langcode'];
    $homeName = $_GET['textdom'];
    if (isset($_GET['name'])) {
        $itemName = $_GET['name'];
    }
    if ($item == 'corefront' || $item == 'coreadmin') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-core/version-' . $_GET['version'] . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = SF_STORE_DIR . '/' . $spPaths['language-sp'] . '/' . $homeName . '-' . $locale . '.mo';
    }
    if ($item == 'theme') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-themes/' . $itemName . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = SF_STORE_DIR . '/' . $spPaths['language-sp-themes'] . '/' . $homeName . '-' . $locale . '.mo';
    }
    if ($item == 'plugin') {
        $url = 'http://glotpress.simple-press.com/projects/simple-press-plugins/' . $itemName . '/' . $homeName . '/' . $langCode . '/default/export-translations?format=mo';
        $home = SF_STORE_DIR . '/' . $spPaths['language-sp-plugins'] . '/' . $homeName . '-' . $locale . '.mo';
    }
    if (isset($_GET['remove'])) {
        $status = unlink($home);
        echo '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Translation file removed') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;' . spa_text('Translation file removed');
        die;
    } else {
        $fData = file_get_contents($url);
    }
    if ($fData == false) {
        $status = false;
    } else {
        $status = file_put_contents($home, $fData);
    }
    if ($status) {
        echo '<img src="' . SFADMINIMAGES . 'sp_Yes.png" title="' . spa_text('Translation file installed') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;' . spa_text('Translation file installed');
    } else {
        echo '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Translation install failed') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;' . spa_text('Install failed - or there is no available translation');
    }
}
 function do_paging()
 {
     if ($this->total_users_for_query > $this->users_per_page) {
         # have to page the results
         $args = array();
         if (!empty($this->search_term)) {
             $args['usersearch'] = urlencode($this->search_term);
         }
         if (!empty($this->role)) {
             $args['role'] = urlencode($this->role);
         }
         $this->paging_text = paginate_links(array('total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => $args));
         if ($this->paging_text) {
             $this->paging_text = sprintf('<span class="displaying-num">' . spa_text('Displaying %1$s - %2$s of %3$s') . '</span>%4$s', number_format_i18n(($this->page - 1) * $this->users_per_page + 1), number_format_i18n(min($this->page * $this->users_per_page, $this->total_users_for_query)), number_format_i18n($this->total_users_for_query), $this->paging_text);
         }
     }
 }
function sp_delete_sp_theme($theme)
{
    $mobileTheme = sp_get_option('sp_mobile_theme');
    $tabletTheme = sp_get_option('sp_tablet_theme');
    $curTheme = sp_get_option('sp_current_theme');
    if ($curTheme['theme'] == $theme) {
        $mess = spa_text('Sorry, cannot delete the active theme');
    } else {
        if ($mobileTheme['theme'] == $theme) {
            $mess = spa_text('Sorry, cannot delete the active mobile theme');
        } else {
            if ($tabletTheme['theme'] == $theme) {
                $mess = spa_text('Sorry, cannot delete the active tablet theme');
            } else {
                sp_remove_dir(SPTHEMEBASEDIR . $theme);
                do_action('sph_delete_' . trim($theme));
                do_action('sph_deleted_sp_theme', trim($theme));
                $mess = spa_text('Theme deleted');
            }
        }
    }
    return $mess;
}
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_paint_help($name, $helpfile, $show = true)
{
    $site = SFHOMEURL . 'index.php?sp_ahah=help&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;file={$helpfile}&amp;item={$name}";
    $title = spa_text('Simple:Press Help');
    $out = '';
    $out .= '<div class="sfhelplink">';
    if ($show) {
        $out .= '<a id="' . $name . '" class="button-secondary sfhelplink" href="javascript:void(null)" onclick="spjDialogAjax(this, \'' . $site . '\', \'' . $title . '\', 600, 0, 0);">';
        $out .= spa_text('Help') . '</a>';
    }
    $out .= '</div>';
    return $out;
}
Ejemplo n.º 30
0
function spa_paint_rank_images()
{
    global $tab, $spPaths;
    # Open badges folder and get cntents for matching
    $path = SF_STORE_DIR . '/' . $spPaths['ranks'] . '/';
    $dlist = @opendir($path);
    if (!$dlist) {
        echo '<table><tr><td class="sflabel"><strong>' . spa_text('The rank badges folder does not exist') . '</strong></td></tr></table>';
        return;
    }
    # start the table display
    $class = 'class ="spMobileTableData"';
    ?>
	<table id="sf-rank-badges" class="widefat fixed spMobileTable800">
		<thead>
			<tr>
				<th style='text-align:center'><?php 
    spa_etext('Badge');
    ?>
</th>
				<th style='text-align:center'><?php 
    spa_etext('Filename');
    ?>
</th>
				<th style='text-align:center'><?php 
    spa_etext('Remove');
    ?>
</th>
			</tr>
		</thead>
		<tbody>
<?php 
    $row = 0;
    while (false !== ($file = readdir($dlist))) {
        $path_info = pathinfo($path . $file);
        $ext = strtolower($path_info['extension']);
        if ($file != '.' && $file != '..' && ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif' || $ext == 'bmp')) {
            $found = false;
            ?>
			<tr id='rank<?php 
            echo $row;
            ?>
' <?php 
            echo $class;
            ?>
>
				<td data-label='<?php 
            spa_etext('Badge');
            ?>
'>
					<img class="sfrankbadge" src="<?php 
            echo esc_url(SFRANKS . '/' . $file);
            ?>
" alt="" />
				</td>
				<td data-label='<?php 
            spa_etext('Filename');
            ?>
'>
					<?php 
            echo $file;
            ?>
				</td>
				<td data-label='<?php 
            spa_etext('Remove');
            ?>
'>
<?php 
            $site = esc_url(SFHOMEURL . 'index.php?sp_ahah=components&amp;sfnonce=' . wp_create_nonce('forum-ahah') . "&amp;action=delbadge&amp;file={$file}");
            echo '<img src="' . SFCOMMONIMAGES . 'delete.png" title="' . spa_text('Delete Rank Badge') . '" alt="" onclick="spjDelRow(\'' . $site . '\', \'rank' . $row . '\');" />';
            ?>
				</td>
			</tr>
<?php 
            $class = strpos($class, 'alternate') === false ? 'class="spMobileTableData alternate"' : 'class="spMobileTableData"';
            $row++;
        }
    }
    echo '</table>';
    echo '<input type="hidden" id="rank-count" name="rank-count" value="' . $row . '" />';
    closedir($dlist);
}