Beispiel #1
0
function xfac_option_getConfig()
{
    static $config = null;
    if ($config === null) {
        $config = array();
        switch (xfac_option_getWorkingMode()) {
            case 'network':
                $config['root'] = get_site_option('xfac_root');
                $config['clientId'] = get_site_option('xfac_client_id');
                $config['clientSecret'] = get_site_option('xfac_client_secret');
                break;
            case 'blog':
            default:
                $config['root'] = get_option('xfac_root');
                $config['clientId'] = get_option('xfac_client_id');
                $config['clientSecret'] = get_option('xfac_client_secret');
                break;
        }
        if (empty($config['root']) or empty($config['clientId']) or empty($config['clientSecret'])) {
            $config = false;
        } else {
            $config['version'] = intval(get_option('xfac_version'));
        }
    }
    return $config;
}
Beispiel #2
0
function xfac_getTableAuth()
{
    global $wpdb;
    if (xfac_option_getWorkingMode() === 'network') {
        return $wpdb->base_prefix . 'xfac_auth';
    } else {
        return $wpdb->prefix . 'xfac_auth';
    }
}
Beispiel #3
0
function xfac_whitelist_options($whitelist_options)
{
    if (xfac_option_getWorkingMode() === 'blog') {
        $whitelist_options['xfac'][] = 'xfac_root';
        $whitelist_options['xfac'][] = 'xfac_client_id';
        $whitelist_options['xfac'][] = 'xfac_client_secret';
    }
    $config = xfac_option_getConfig();
    $meta = xfac_option_getMeta($config);
    if (!empty($meta['linkIndex'])) {
        $whitelist_options['xfac'][] = 'xfac_tag_forum_mappings';
        $whitelist_options['xfac'][] = 'xfac_sync_post_wp_xf';
        $whitelist_options['xfac'][] = 'xfac_sync_post_wp_xf_excerpt';
        $whitelist_options['xfac'][] = 'xfac_sync_post_wp_xf_link';
        $whitelist_options['xfac'][] = 'xfac_sync_post_xf_wp';
        $whitelist_options['xfac'][] = 'xfac_sync_post_xf_wp_publish';
        $whitelist_options['xfac'][] = 'xfac_search_index_post';
        $whitelist_options['xfac'][] = 'xfac_sync_comment_wp_xf';
        $whitelist_options['xfac'][] = 'xfac_sync_comment_wp_xf_as_guest';
        $whitelist_options['xfac'][] = 'xfac_sync_comment_xf_wp';
        $whitelist_options['xfac'][] = 'xfac_sync_comment_xf_wp_as_guest';
        $whitelist_options['xfac'][] = 'xfac_search_index_comment';
        $whitelist_options['xfac'][] = 'xfac_sync_avatar_xf_wp';
        $whitelist_options['xfac'][] = 'xfac_bypass_users_can_register';
        $whitelist_options['xfac'][] = 'xfac_sync_password';
        $whitelist_options['xfac'][] = 'xfac_sync_login';
        $whitelist_options['xfac'][] = 'xfac_sync_user_wp_xf';
        $whitelist_options['xfac'][] = 'xfac_sync_user_wp_xf_as_admin';
        $whitelist_options['xfac'][] = 'xfac_sync_user_wp_xf_password';
        $whitelist_options['xfac'][] = 'xfac_sync_role';
        $whitelist_options['xfac'][] = 'xfac_sync_role_wp_xf';
        $whitelist_options['xfac'][] = 'xfac_top_bar_forums';
        $whitelist_options['xfac'][] = 'xfac_top_bar_notifications';
        $whitelist_options['xfac'][] = 'xfac_top_bar_conversations';
        $whitelist_options['xfac'][] = 'xfac_top_bar_replace';
        $whitelist_options['xfac'][] = 'xfac_top_bar_always';
        $whitelist_options['xfac'][] = 'xfac_xf_guest_account';
        $whitelist_options['xfac'][] = 'xfac_xf_admin_account';
    }
    // always show advanced sections
    $whitelist_options['xfac'][] = 'xfac_server_ip';
    return $whitelist_options;
}
Beispiel #4
0
}
?>
    </h2>

    <form method="post" action="options.php">
        <?php 
settings_fields($tab);
?>

        <table class="form-table">

            <?php 
if ($tab == 'xfac_api') {
    ?>
                <?php 
    if (xfac_option_getWorkingMode() === 'network') {
        ?>
                    <tr valign="top">
                        <th scope="row"><label for="xfac_root"><?php 
        _e('API Root', 'xenforo-api-consumer');
        ?>
</label>
                        </th>
                        <td>
                            <input name="xfac_root" type="text" id="xfac_root"
                                   value="<?php 
        echo esc_attr($config['root']);
        ?>
" class="regular-text"
                                   disabled="disabled"/>
                        </td>