Example #1
0
/**
 * Makes a settings page for the plugin
 * 
 * @uses bb_option_form_element() to generate the page
 */
function em_options()
{
    global $em_plugopts;
    if ($_POST['em_opts_submit'] == 1) {
        /* Settings have been received, now save them! */
        bb_check_admin_referer('em-save-chk');
        /* Security Check */
        /* Checks on options, and then save them */
        $em_plugopts['link-tags'] = intval($_POST['link-tags']) == 1 ? 1 : 0;
        $em_plugopts['link-users'] = intval($_POST['link-users']) == 1 ? 1 : 0;
        $em_plugopts['link-user-to'] = $_POST['link-user-to'] == 'website' ? 'website' : 'profile';
        $em_plugopts['reply-link'] = intval($_POST['reply-link']) == 1 ? 1 : 0;
        $em_plugopts['reply-text'] = esc_attr($_POST['reply-text']);
        bb_update_option(EM_OPTIONS, $em_plugopts);
        bb_admin_notice(__('The options were successfully saved!', 'easy-mentions'));
    }
    if ($ver = em_update_check()) {
        /* Check for Updates and if available, then notify */
        bb_admin_notice(sprintf(__('New version (%1$s) of Easy Mentions is available! Please download the latest version from <a href="%2$s">here</a>.', 'easy-mentions'), $ver, 'http://bbpress.org/plugins/topic/easy-mentions/'));
    }
    /* Options in an array to be printed */
    $options = array('link-tags' => array('title' => __('Link the Tags?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-tags'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the tags to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>#tag</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-users' => array('title' => __('Link the Users?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-users'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the users to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>@user</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-user-to' => array('title' => __('Link the user to profile or website?', 'easy-mentions'), 'type' => 'radio', 'value' => $em_plugopts['link-user-to'] == 'website' ? 'website' : 'profile', 'note' => __('If you selected the website option and the user\'s website does not exist, then the user will be linked to his or her profile page.', 'easy-mentions'), 'options' => array('profile' => __('Profile', 'easy-mentions'), 'website' => __('Website', 'easy-mentions'))), 'reply-link' => array('title' => __('Add a reply link below each post?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['reply-link'] == 1 ? '1' : '0', 'note' => sprintf(__('Before checking this option, please verify that there is a post form below the topic on each page. (<a href="%s">Help</a>)', 'easy-mentions'), 'http://bbpress.org/plugins/topic/easy-mentions/faq/'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'reply-text' => array('title' => __('Reply Text', 'easy-mentions'), 'class' => array('long'), 'value' => $em_plugopts['reply-text'] ? stripslashes($em_plugopts['reply-text']) : '<em>Replying to @%%USERNAME%%\'s <a href="%%POSTLINK%%">post</a>:</em>', 'after' => '<div style="clear:both;"></div>' . sprintf(__('Some HTML is allowed. The following keys can also be used:%1$s - Post\'s author\'s name%2$s - Post\'s link', 'after-the-deadline'), '<br /><strong>%%USERNAME%%</strong>', '<br /><strong>%%POSTLINK%%</strong>') . '<br />'));
    if ($em_plugopts['link-users'] != 1) {
        $options['link-user-to']['attributes'] = array('disabled' => 'disabled');
    }
    if ($em_plugopts['reply-link'] != 1) {
        $options['reply-text']['attributes'] = array('disabled' => 'disabled');
    }
    ?>
	
	<h2><?php 
    _e('Easy Mentions', 'easy-mentions');
    ?>
</h2>
	<?php 
    do_action('bb_admin_notices');
    ?>
	<form method="post" class="settings options">
		<fieldset>
			<?php 
    foreach ($options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		</fieldset>
		<fieldset class="submit">
			<?php 
    bb_nonce_field('em-save-chk');
    ?>
			<input type="hidden" name="em_opts_submit" value="1"></input>
			<input class="submit" type="submit" name="submit" value="Save Changes" />
		</fieldset>
		<p><?php 
    printf(__('Happy with the plugin? Why not <a href="%1$s">buy the author a cup of coffee or two</a> or get him something from his <a href="%2$s">wishlist</a>?', 'easy-mentions'), 'http://gaut.am/donate/EM/', 'http://gaut.am/wishlist/');
    ?>
</p>
	</form>
<?php 
}
if ($is_apache && bb_get_option('mod_rewrite') && !bb_get_option('mod_rewrite_writable')) {
    $manual_instructions = true;
}
if (!empty($_GET['notmodrewrite'])) {
    $manual_instructions = false;
    bb_admin_notice(__('<strong>It appears that your server does not support custom permalink structures.</strong>'), 'error');
}
if (!empty($_GET['notapache'])) {
    $manual_instructions = false;
    bb_admin_notice(__('<strong>Rewriting on webservers other than Apache using mod_rewrite is currently unsupported, but we won&#8217;t stop you from trying.</strong>'), 'error');
}
if (!empty($_GET['updated'])) {
    if ($manual_instructions) {
        bb_admin_notice(__('<strong>You should update your .htaccess now.</strong>'));
    } else {
        bb_admin_notice(__('<strong>Permalink structure updated.</strong>'));
    }
}
$permalink_options = array('mod_rewrite' => array('title' => __('Permalink type'), 'type' => 'radio', 'options' => array('0' => sprintf(__('<span>None</span> <code>%s</code>'), bb_get_uri('forums.php', array('id' => 1), BB_URI_CONTEXT_TEXT)), '1' => sprintf(__('<span>Numeric</span> <code>%s</code>'), bb_get_uri('forums/1', null, BB_URI_CONTEXT_TEXT)), 'slugs' => sprintf(__('<span>Name based</span> <code>%s</code>'), bb_get_uri('/forums/first-forum', null, BB_URI_CONTEXT_TEXT)))));
$bb_admin_body_class = ' bb-admin-settings';
bb_get_admin_header();
?>

<div class="wrap">

<h2><?php 
_e('Permalink Settings');
?>
</h2>
<?php 
do_action('bb_admin_notices');
Example #3
0
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    $goback = add_query_arg('updated', 'true', wp_get_referer());
    bb_safe_redirect($goback);
    exit;
}
if (!empty($_GET['updated'])) {
    bb_admin_notice(__('<strong>Settings saved.</strong>'));
}
$reading_options = array('page_topics' => array('title' => __('Items per page'), 'class' => 'short', 'note' => __('Number of topics, posts or tags to show per page.')));
$bb_admin_body_class = ' bb-admin-settings';
bb_get_admin_header();
?>

<div class="wrap">

<h2><?php 
_e('Reading Settings');
?>
</h2>
<?php 
do_action('bb_admin_notices');
?>
Example #4
0
    }
    bb_recount_list();
    foreach ((array) $recount_list as $item) {
        if (isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2])) {
            $message = call_user_func($item[2]);
            if (is_array($message)) {
                $messages[] = $message[1];
            } else {
                $messages[] = $message;
            }
        }
    }
    nxt_cache_flush();
    if (count($messages)) {
        $messages = join('</p>' . "\n" . '<p>', $messages);
        bb_admin_notice($messages);
    }
}
$bb_admin_body_class = ' bb-admin-tools';
bb_get_admin_header();
?>
<h2><?php 
_e('Tools');
?>
</h2>
<?php 
do_action('bb_admin_notices');
?>

<form class="settings" method="post" action="<?php 
bb_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
Example #5
0
    }
}
if (isset($_GET['message'])) {
    switch ($_GET['message']) {
        case 'updated':
            bb_admin_notice(__('<strong>Forum Updated.</strong>'));
            break;
        case 'deleted':
            bb_admin_notice(sprintf(__('<strong>Forum deleted.</strong>  You should <a href="%s">recount your site information</a>.'), bb_get_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)));
            break;
    }
}
if (!isset($_GET['action'])) {
    nxt_enqueue_script('admin-forums');
} elseif ('delete' == @$_GET['action']) {
    bb_admin_notice(sprintf(__('Are you sure you want to delete the "<strong>%s</strong>" forum?'), $deleted_forum->forum_name));
}
$bb_admin_body_class = ' bb-admin-forums';
bb_get_admin_header();
?>

<div class="wrap">

<h2><?php 
_e('Forums');
?>
</h2>
<?php 
do_action('bb_admin_notices');
switch (@$_GET['action']) {
    case 'edit':
Example #6
0
    switch ($_GET['message']) {
        case 'error':
            bb_admin_notice(__('<strong>Plugin could not be activated, it produced a Fatal Error</strong>. The error is shown below.'), 'error');
            break;
        case 'activate':
            $plugin_data = bb_get_plugin_data($plugin);
            bb_admin_notice(sprintf(__('<strong>"%s" plugin activated</strong>'), esc_attr($plugin_data['name'])));
            break;
        case 'deactivate':
            $plugin_data = bb_get_plugin_data($plugin);
            bb_admin_notice(sprintf(__('<strong>"%s" plugin deactivated</strong>'), esc_attr($plugin_data['name'])));
            break;
    }
}
if (isset($bb->safemode) && $bb->safemode === true) {
    bb_admin_notice(__('<strong>"Safe mode" is on, all plugins are disabled even if they are listed as active.</strong>'), 'error');
}
$bb_admin_body_class = ' bb-admin-plugins';
bb_get_admin_header();
?>

<div class="wrap">

	<h2><?php 
_e('Manage Plugins');
?>
</h2>
	<?php 
do_action('bb_admin_notices');
?>
Example #7
0
function bb_ksd_configuration_page_process()
{
    if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update-akismet-settings') {
        bb_check_admin_referer('options-akismet-update');
        $goback = remove_query_arg(array('invalid-akismet', 'updated-akismet'), wp_get_referer());
        if (!isset($_POST['akismet_stats'])) {
            $_POST['akismet_stats'] = false;
        }
        if (true === (bool) $_POST['akismet_stats']) {
            bb_update_option('akismet_stats', 1);
        } else {
            bb_delete_option('akismet_stats');
        }
        if ($_POST['akismet_key']) {
            $value = stripslashes_deep(trim($_POST['akismet_key']));
            if ($value) {
                if (bb_akismet_verify_key($value)) {
                    bb_update_option('akismet_key', $value);
                } else {
                    $goback = add_query_arg('invalid-akismet', 'true', $goback);
                    bb_safe_redirect($goback);
                    exit;
                }
            } else {
                bb_delete_option('akismet_key');
            }
        } else {
            bb_delete_option('akismet_key');
        }
        $goback = add_query_arg('updated-akismet', 'true', $goback);
        bb_safe_redirect($goback);
        exit;
    }
    if (!empty($_GET['updated-akismet'])) {
        bb_admin_notice(__('<strong>Settings saved.</strong>'));
    }
    if (!empty($_GET['invalid-akismet'])) {
        bb_admin_notice(__('<strong>The key you attempted to enter is invalid. Reverting to previous setting.</strong>'), 'error');
    }
    global $bb_admin_body_class;
    $bb_admin_body_class = ' bb-admin-settings';
}
Example #8
0
<?php

require_once 'admin.php';
if (!empty($_GET['message'])) {
    switch ((string) $_GET['message']) {
        case 'undeleted':
            bb_admin_notice(__('<strong>Topic undeleted.</strong>'));
            break;
        case 'deleted':
            bb_admin_notice(__('<strong>Topic deleted.</strong>'));
            break;
        case 'opened':
            bb_admin_notice(__('<strong>Topic opened.</strong>'));
            break;
        case 'closed':
            bb_admin_notice(__('<strong>Topic closed.</strong>'));
            break;
    }
}
$bb_admin_body_class = ' bb-admin-topics';
bb_get_admin_header();
if (!bb_current_user_can('browse_deleted')) {
    die(__("Now how'd you get here?  And what did you think you'd being doing?"));
}
//This should never happen.
add_filter('topic_link', 'bb_make_link_view_all');
add_filter('topic_last_post_link', 'bb_make_link_view_all');
$topic_query_vars = array('topic_status' => 'normal', 'open' => 'open', 'count' => true, 'per_page' => 20);
if (isset($_POST['search']) && $_POST['search']) {
    $topic_query_vars['post_status'] = 'all';
} elseif (isset($_GET['search']) && $_GET['search']) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    $goback = add_query_arg('updated', 'true', wp_get_referer());
    bb_safe_redirect($goback);
    exit;
}
if (!empty($_GET['updated'])) {
    bb_admin_notice('<strong>' . __('Settings saved.') . '</strong>');
}
$reading_options = array('page_topics' => array('title' => __('Items per page'), 'class' => 'short', 'note' => __('Number of topics, posts or tags to show per page.')), 'name_link_profile' => array('title' => __('Link name to'), 'type' => 'radio', 'options' => array(0 => __('Website'), 1 => __('Profile')), 'note' => __('What should the user\'s name link to on the topic page? The user\'s title would automatically get linked to the option you don\'t choose. By default, the user\'s name is linked to his/her website.')));
$bb_admin_body_class = ' bb-admin-settings';
bb_get_admin_header();
?>

<div class="wrap">

<h2><?php 
_e('Reading Settings');
?>
</h2>
<?php 
do_action('bb_admin_notices');
?>
Example #10
0
require_once 'admin.php';
do_action($bb_admin_page . '_pre_head');
bb_get_admin_header();
?>

<div class="wrap">

<?php 
if (is_callable($bb_admin_page)) {
    call_user_func($bb_admin_page);
} else {
    ?>

<h2><?php 
    _e('Page not found');
    ?>
</h2>
<?php 
    bb_admin_notice(__('There is no administration page at the requested address. Please check the address you entered and try again.'), 'error');
    do_action('bb_admin_notices');
    ?>

<?php 
}
?>

</div>

<?php 
bb_get_admin_footer();
Example #11
0
    exit;
}
if (!empty($_GET['message'])) {
    $message_count = isset($_GET['count']) ? (int) $_GET['count'] : 1;
    switch ((string) $_GET['message']) {
        case 'undeleted':
            bb_admin_notice(sprintf(_n('<strong>Topic undeleted.</strong>', '<strong>%s topics undeleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'deleted':
            bb_admin_notice(sprintf(_n('<strong>Topic deleted.</strong>', '<strong>%s topics deleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'opened':
            bb_admin_notice(sprintf(_n('<strong>Topic opened.</strong>', '<strong>%s topics opened.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'closed':
            bb_admin_notice(sprintf(_n('<strong>Topic closed.</strong>', '<strong>%s topics closed.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
    }
}
$bb_admin_body_class = ' bb-admin-topics';
bb_get_admin_header();
if (!bb_current_user_can('browse_deleted')) {
    die(__("Now how'd you get here?  And what did you think you'd being doing?"));
}
//This should never happen.
add_filter('topic_link', 'bb_make_link_view_all');
add_filter('topic_last_post_link', 'bb_make_link_view_all');
$topic_query_vars = array('topic_status' => 'normal', 'open' => 'open', 'count' => true, 'per_page' => 20);
if (isset($_POST['search']) && $_POST['search']) {
    $topic_query_vars['post_status'] = 'all';
} elseif (isset($_GET['search']) && $_GET['search']) {
Example #12
0
<?php 
    }
    ?>
			<p class="location"><?php 
    printf(__('All of this theme\'s files are located in the "%s" themes directory.'), $theme_data['Location']);
    ?>
</p>
		</div>
	</td>
<?php 
    if (3 === $position || 0 === $position) {
        echo '</tr>';
    }
}
if (isset($bb->safemode) && $bb->safemode === true) {
    bb_admin_notice(__('<strong>"Safe mode" is on, the default theme will be used instead of the active theme indicated below.</strong>'), 'error');
}
$bb_admin_body_class = ' bb-admin-appearance';
bb_get_admin_header();
?>

<h2><?php 
_e('Manage Themes');
?>
</h2>
<?php 
do_action('bb_admin_notices');
?>

<h3 class="themes"><?php 
_e('Current Theme');
Example #13
0
function li_configuration_page_process()
{
    if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update-li-settings') {
        bb_check_admin_referer('options-liconnect-update');
        $li_app_id = trim($_POST['li_app_id']);
        $li_secret = trim($_POST['li_secret']);
        bb_update_option('li_app_id', $li_app_id);
        bb_update_option('li_secret', $li_secret);
        if (!isset($_POST['li_displayname_from']) || $_POST['li_displayname_from'] < 0 || $_POST['li_displayname_from'] > 2) {
            $_POST['li_displayname_from'] = 0;
        }
        bb_update_option('li_displayname_from', intval($_POST['li_displayname_from']));
        if (!isset($_POST['li_get_jquery']) || true !== (bool) $_POST['li_get_jquery']) {
            bb_delete_option('li_get_jquery');
        } else {
            bb_update_option('li_get_jquery', 1);
        }
        if (!isset($_POST['li_allow_useredit']) || true !== (bool) $_POST['li_allow_useredit']) {
            bb_delete_option('li_allow_useredit');
        } else {
            bb_update_option('li_allow_useredit', 1);
        }
        if (!isset($_POST['li_request_email']) || true !== (bool) $_POST['li_request_email']) {
            bb_delete_option('li_request_email');
        } else {
            bb_update_option('li_request_email', 1);
        }
        if (!isset($_POST['li_hide_post_login']) || true !== (bool) $_POST['li_hide_post_login']) {
            bb_delete_option('li_hide_post_login');
        } else {
            bb_update_option('li_hide_post_login', 1);
        }
        bb_admin_notice(__('Configuration saved.'));
    }
}
Example #14
0
function nospamuser_admin_parse()
{
    bb_check_admin_referer('nospamuser-admin');
    $settings = bb_get_option('nospamuser-settings');
    $success = array();
    $error = array();
    if ($_POST['days'] != $settings['days']) {
        if ((int) $_POST['days'] > 0) {
            $settings['days'] = $_POST['days'];
            $success[] = __('Maximum days', 'nospamuser');
        } else {
            $error[] = __('Maximum days', 'nospamuser');
        }
    }
    if ($_POST['min_occur'] != $settings['min_occur']) {
        if ((int) $_POST['min_occur'] > 0) {
            $settings['min_occur'] = $_POST['min_occur'];
            $success[] = __('Minimum frequency', 'nospamuser');
        } else {
            $error[] = __('Minimum frequency', 'nospamuser');
        }
    }
    if ($_POST['max_occur'] != $settings['max_occur']) {
        if ((int) $_POST['max_occur'] > 0) {
            $settings['max_occur'] = $_POST['max_occur'];
            $success[] = __('Maximum frequency', 'nospamuser');
        } else {
            $error[] = __('Maximum frequency', 'nospamuser');
        }
    }
    if ($_POST['api_key'] != $settings['api_key']) {
        // There's not a way I know of to check this.
        $settings['api_key'] = $_POST['api_key'];
        $success[] = __('Stop Forum Spam API key', 'nospamuser');
    }
    if ($_POST['recaptcha_mode'] != $settings['recaptcha_mode']) {
        if (in_array($_POST['recaptcha_mode'], array('aggressive', 'adaptive', 'friendly'))) {
            $settings['recaptcha_mode'] = $_POST['recaptcha_mode'];
            $success[] = __('reCAPTCHA mode', 'nospamuser');
        } else {
            $error[] = __('reCAPTCHA mode', 'nospamuser');
        }
    }
    if ($_POST['recaptcha_pub'] != $settings['recaptcha_pub']) {
        // There's not a way I know of to check this.
        $settings['recaptcha_pub'] = $_POST['recaptcha_pub'];
        $success[] = __('reCAPTCHA public key', 'nospamuser');
    }
    if ($_POST['recaptcha_priv'] != $settings['recaptcha_priv']) {
        // There's not a way I know of to check this.
        $settings['recaptcha_priv'] = $_POST['recaptcha_priv'];
        $success[] = __('reCAPTCHA private key', 'nospamuser');
    }
    if ((int) $_POST['stats-public'] != $settings['stats-public']) {
        $settings['stats-public'] = (int) $_POST['stats-public'];
        $success[] = __('Public statistics', 'nospamuser');
    }
    if ($success) {
        bb_update_option('nospamuser-settings', $settings);
        bb_admin_notice(__('The following settings were updated successfully:', 'nospamuser') . '</p><ul><li>' . implode('</li><li>', $success) . '</li></ul>', 'updated');
    }
    if ($error) {
        bb_admin_notice(__('The following settings had errors and were not updated:', 'nospamuser') . '</p><ul><li>' . implode('</li><li>', $error) . '</li></ul>', 'error');
    }
}
Example #15
0
if (!empty($_GET['message'])) {
    switch ((string) $_GET['message']) {
        case 'undeleted':
            bb_admin_notice(__('<strong>Post undeleted.</strong>'));
            break;
        case 'deleted':
            bb_admin_notice(__('<strong>Post deleted.</strong>'));
            break;
        case 'spammed':
            bb_admin_notice(__('<strong>Post spammed.</strong>'));
            break;
        case 'unspammed-normal':
            bb_admin_notice(__('<strong>Post removed from spam.</strong> It is now a normal post.'));
            break;
        case 'unspammed-deleted':
            bb_admin_notice(__('<strong>Post removed from spam.</strong> It is now a deleted post.'));
            break;
    }
}
$ip_available = false;
if (bb_current_user_can('view_by_ip')) {
    $ip_available = true;
} elseif (isset($_GET['poster_ip'])) {
    unset($_GET['poster_ip']);
}
$bb_admin_body_class = ' bb-admin-posts';
bb_get_admin_header();
if (!bb_current_user_can('browse_deleted')) {
    die(__("Now how'd you get here?  And what did you think you'd being doing?"));
}
//This should never happen.
Example #16
0
    $message_count = isset($_GET['count']) ? (int) $_GET['count'] : 1;
    switch ((string) $_GET['message']) {
        case 'undeleted':
            bb_admin_notice(sprintf(_n('<strong>Post undeleted.</strong>', '<strong>%s posts undeleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'deleted':
            bb_admin_notice(sprintf(_n('<strong>Post deleted.</strong>', '<strong>%s posts deleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'spammed':
            bb_admin_notice(sprintf(_n('<strong>Post spammed.</strong>', '<strong>%s posts spammed.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'unspammed-normal':
            bb_admin_notice(sprintf(_n('<strong>Post removed from spam.</strong> It is now a normal post.', '<strong>%s posts removed from spam.</strong> They are now normal posts.', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'unspammed-deleted':
            bb_admin_notice(sprintf(_n('<strong>Post removed from spam.</strong> It is now a deleted post.', '<strong>%s posts removed from spam.</strong> They are nowdeleted posts.', $message_count), bb_number_format_i18n($message_count)));
            break;
    }
}
$ip_available = false;
if (bb_current_user_can('view_by_ip')) {
    $ip_available = true;
} elseif (isset($_GET['poster_ip'])) {
    unset($_GET['poster_ip']);
}
$bb_admin_body_class = ' bb-admin-posts';
bb_get_admin_header();
if (!bb_current_user_can('browse_deleted')) {
    die(__("Now how'd you get here?  And what did you think you'd being doing?"));
}
//This should never happen.
Example #17
0
            }
        }
    }
    if ($action == 'update-users') {
        bb_apply_nxt_role_map_to_orphans();
    }
    $goback = add_query_arg('updated', $action, nxt_get_referer());
    bb_safe_redirect($goback);
    exit;
}
switch (@$_GET['updated']) {
    case 'update-users':
        bb_admin_notice(__('<strong>User role mapping saved.</strong>'));
        break;
    case 'update-options':
        bb_admin_notice(__('<strong>User integration settings saved.</strong>'));
        break;
}
$bb_role_names[''] = _c('none|no bbPress role');
$bb_role_names = array_merge($bb_role_names, array_map(create_function('$a', 'return sprintf( _c( "bbPress %s|bbPress role" ), $a );'), $nxt_roles->get_names()));
$nxtRoles = array('administrator' => __('NXTClass Administrator'), 'editor' => __('NXTClass Editor'), 'author' => __('NXTClass Author'), 'contributor' => __('NXTClass Contributor'), 'subscriber' => __('NXTClass Subscriber'));
$nxtRoles = apply_filters('role_map_nxt_roles', $nxtRoles);
$cookie_options = array('nxt_siteurl' => array('title' => __('NXTClass address (URL)'), 'class' => 'long', 'note' => __('This value should exactly match the <strong>NXTClass address (URL)</strong> setting in your NXTClass general settings.')), 'nxt_home' => array('title' => __('Blog address (URL)'), 'class' => 'long', 'note' => __('This value should exactly match the <strong>Blog address (URL)</strong> setting in your NXTClass general settings.')), 'bb_auth_salt' => array('title' => __('NXTClass "auth" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "auth_salt" in your NXTClass site. Look for the option labeled "auth_salt" in <a href="#" id="getAuthSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>.')), 'bb_secure_auth_salt' => array('title' => __('NXTClass "secure auth" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "secure_auth_salt" in your NXTClass site. Look for the option labeled "secure_auth_salt" in <a href="#" id="getSecureAuthSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>. Sometimes this value is not set in NXTClass, in that case you can leave this setting blank as well.')), 'bb_logged_in_salt' => array('title' => __('NXTClass "logged in" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "logged_in_salt" in your NXTClass site. Look for the option labeled "logged_in_salt" in <a href="#" id="getLoggedInSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>.')));
foreach (array('bb_auth_salt', 'bb_secure_auth_salt', 'bb_logged_in_salt') as $salt_constant) {
    if (defined(strtoupper($salt_constant))) {
        $cookie_options[$salt_constant]['note'] = array(sprintf(__('You have defined the "%s" constant which locks this setting.'), strtoupper($salt_constant)), $cookie_options[$salt_constant]['note']);
        $cookie_options[$salt_constant]['value'] = constant(strtoupper($salt_constant));
        $bb_hardcoded[$salt_constant] = true;
    }
}
$user_db_options = array('nxt_table_prefix' => array('title' => __('User database table prefix'), 'note' => __('If your bbPress and NXTClass sites share the same database, then this is the same value as <code>$table_prefix</code> in your NXTClass <code>nxt-config.php</code> file. It is usually <strong>nxt_</strong>.')), 'nxtclass_mu_primary_blog_id' => array('title' => __('NXTClass MU primary blog ID'), 'note' => __('If you are integrating with a NXTClass MU site you need to specify the primary blog ID for that site. It is usually <strong>1</strong>. You should probably leave this blank if you are integrating with a standard NXTClass site')), 'user_bbdb_advanced' => array('title' => __('Show advanced database settings'), 'type' => 'checkbox', 'options' => array(1 => array('label' => __('If your bbPress and NXTClass site do not share the same database, then you will need to add advanced settings.'), 'attributes' => array('onclick' => 'toggleAdvanced(this);')))));
Example #18
0
<?php

require_once 'admin.php';
// Get all errors and print as notice
if (isset($_GET['created'])) {
    bb_admin_notice(__('<strong>User Created.</strong>'));
}
if (isset($_GET['updated'])) {
    bb_admin_notice(__('<strong>User Updated.</strong>'));
}
if (isset($_GET['action']) || isset($_GET['user_id']) && ('edit' == $_GET['action'] || 'create' == $_GET['action'])) {
    $edit_user = bb_get_user(bb_get_user_id($_GET['user_id']));
    $user_fields = bb_manage_user_fields($edit_user);
    $bb_admin_body_class = 'bb-admin-user-manage';
    bb_get_admin_header();
    ?>

	<div class="wrap">
		<h2><?php 
    _e('Edit user');
    ?>
</h2>

		<?php 
    do_action('bb_admin_notices');
    ?>

		<form class="settings" method="post" action="">
			<fieldset>
				<?php 
    foreach ($user_fields as $field => $args) {
 function query()
 {
     if ($_results = bb_get_ids_by_role($this->role, 0, $this->page, $this->users_per_page)) {
         $this->results = bb_get_user($_results);
         $this->total_users_for_query = bb_count_last_query();
     } else {
         $this->search_errors = new nxt_Error('no_matching_users_found', __('<strong>No matching users were found!</strong>'));
     }
     if (is_nxt_error($this->search_errors)) {
         bb_admin_notice($this->search_errors);
     }
 }
function bb_anon_settings_page_process()
{
    if (isset($_POST['bb_anon_submit_options'])) {
        $anon_id = bb_get_option('bb_anon_user_id');
        $user = new BP_User($anon_id);
        if ($_POST['bb_anon_write_topics'] == Y) {
            bb_update_option('bb_anon_write_topics', "Y");
            //$user->add_cap('write_topics');
        } else {
            bb_update_option('bb_anon_write_topics', "N");
            //$user->remove_cap('write_topics');
        }
        $goback = add_query_arg('bb-anon-options-updated', 'true', wp_get_referer());
        bb_safe_redirect($goback);
    }
    if (isset($_GET['bb-anon-options-updated'])) {
        bb_admin_notice(__('Options Updated.'));
    }
}