Ejemplo n.º 1
0
function bb_language_switcher($ignore = '')
{
    // builds and displays the language dropdown UI
    global $bb_language_switcher;
    $output = "";
    $current = bb_language_switcher_filter();
    if (empty($bb_language_switcher)) {
        $bb_language_switcher = bb_get_option('bb_language_switcher');
    }
    if (empty($current) && defined('BB_LANG')) {
        $bblang = BB_LANG;
        if (!empty($bblang)) {
            $current = $bblang;
        }
    }
    $output .= '<form id="bb_language_switcher" style="display:inline-block;"><select  style="width:150px;" name="bb_language_switcher" onchange="location.href=\'' . add_query_arg('bblang', '', remove_query_arg('bblang')) . '=\' + this.options[this.selectedIndex].value;">' . "\n" . "<option value=''>Select...</option>";
    foreach ($bb_language_switcher as $value => $description) {
        if ($value == $current) {
            $selected = '" selected="selected"  ';
        } else {
            $selected = '';
        }
        if (empty($value) || $value == " ") {
            $bk = "style='background:#ECE9D8;color:#000;font-weight:bold;' ";
        } else {
            $bk = "";
        }
        // highlight english
        $output .= '	<option ' . $bk . 'value="' . $value . '"' . $selected . '>&nbsp;' . $description . '</option>' . "\n";
        // padding mess for cross-browser
    }
    $output .= "</select></form>\n";
    echo $output;
}
Ejemplo n.º 2
0
 function get($option)
 {
     switch ($option) {
         case 'application_id':
             return bb_get_option('site_id');
             break;
         case 'application_uri':
             return bb_get_uri(null, null, BB_URI_CONTEXT_NONE);
             break;
         case 'cron_uri':
             return bb_get_uri('bb-cron.php', array('check' => BP_Options::get('cron_check')), BB_URI_CONTEXT_nxt_HTTP_REQUEST);
             break;
         case 'nxt_http_version':
             return 'bbPress/' . bb_get_option('version');
             break;
         case 'hash_function_name':
             return 'bb_hash';
             break;
         case 'language_locale':
             return bb_get_locale();
             break;
         case 'language_directory':
             return BB_LANG_DIR;
             break;
         case 'charset':
         case 'gmt_offset':
         case 'timezone_string':
             return bb_get_option($option);
             break;
         default:
             return bb_get_option(BP_Options::prefix() . $option);
             break;
     }
 }
function bb_default_scripts(&$scripts)
{
    $scripts->base_url = bb_get_uri(BB_INC, null, BB_URI_CONTEXT_SCRIPT_SRC);
    $scripts->base_url_admin = bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_SCRIPT_SRC + BB_URI_CONTEXT_BB_ADMIN);
    $scripts->content_url = '';
    // May not work - might need to specify plugin and theme urls
    $scripts->default_version = bb_get_option('version');
    $scripts->default_dirs = array('/bb-admin/js/', '/bb-includes/js/');
    // These are our enqueued scripts
    $scripts->add('topic', $scripts->base_url . 'js/topic.js', array('wp-lists'), '20090602');
    $scripts->add('profile-edit', $scripts->base_url . 'js/profile-edit.js', array('password-strength-meter'), '20080721');
    $scripts->add('admin-forums', $scripts->base_url_admin . 'js/admin-forums.js', array('wp-lists', 'interface'), '20090320');
    $scripts->add('utils', $scripts->base_url_admin . 'js/utils.js', false, '20090102');
    $scripts->add('common', $scripts->base_url_admin . 'js/common.js', array('jquery', 'hoverIntent', 'utils'), '20090517');
    $scripts->add_data('common', 'group', 1);
    $scripts->localize('common', 'commonL10n', array('warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."), 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'));
    $scripts->localize('admin-forums', 'bbSortForumsL10n', array('handleText' => __('drag'), 'saveText' => __('Save Forum Order'), 'editText' => __('Edit Forum Order')));
    // These are non-3rd-party libraries
    $scripts->add('wp-lists', $scripts->base_url . 'js/wp-lists.js', array('wp-ajax-response', 'jquery-color'), '20080826');
    $scripts->localize('wp-lists', 'wpListL10n', array('url' => $scripts->base_url_admin . 'admin-ajax.php'));
    $scripts->add('wp-ajax-response', $scripts->base_url . 'js/wp-ajax-response.js', array('jquery'), '20080316');
    $scripts->localize('wp-ajax-response', 'wpAjax', array('noPerm' => __('You do not have permission to do that.'), 'broken' => __('An unidentified error has occurred.')));
    // jQuery and friends
    $scripts->add('jquery', $scripts->base_url . 'js/jquery/jquery.js', false, '1.4.2');
    $scripts->add('jquery-color', $scripts->base_url . 'js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
    $scripts->add('interface', $scripts->base_url . 'js/jquery/interface.js', array('jquery'), '1.2.3');
    $scripts->add('password-strength-meter', $scripts->base_url . 'js/jquery/password-strength-meter.js', array('jquery'), '20070405');
    $scripts->localize('password-strength-meter', 'pwsL10n', array('short' => __('Too short'), 'bad' => __('Bad'), 'good' => __('Good'), 'strong' => __('Strong')));
    $scripts->add('hoverIntent', $scripts->base_url . 'js/jquery/hoverIntent.js', array('jquery'), '20090102');
    $scripts->add_data('hoverIntent', 'group', 1);
}
Ejemplo n.º 4
0
function get_active_status_renderer_name()
{
    global $status_renderers;
    $active = bb_get_option('topic-icons-active-status-renderer');
    if (isset($active) && isset($status_renderers[$active])) {
        return $active;
    }
    return 'default';
}
Ejemplo n.º 5
0
function thanks_get_voting_phrase($phrase)
{
    global $DEFAULTS;
    $msg = bb_get_option($phrase);
    if (!isset($msg)) {
        $msg = $DEFAULTS[$phrase];
    }
    return $msg;
}
Ejemplo n.º 6
0
function bb_get_bozos($page = 1)
{
    global $bbdb, $bb_last_countable_query;
    $page = (int) $page;
    $limit = (int) bb_get_option('page_topics');
    if (1 < $page) {
        $limit = $limit * ($page - 1) . ", {$limit}";
    }
    $bb_last_countable_query = "SELECT user_id FROM {$bbdb->usermeta} WHERE meta_key='is_bozo' AND meta_value='1' ORDER BY umeta_id DESC LIMIT {$limit}";
    if ($ids = (array) $bbdb->get_col($bb_last_countable_query)) {
        bb_cache_users($ids);
    }
    return $ids;
}
Ejemplo n.º 7
0
/**
 * Plugin Name: Post Notification
 * Plugin Description: Sends an Notification email if there's a new post to an favorite topic. (Modified Version 1.4 with Post Content included in E-Mail)
 * Author: Thomas Klaiber
 * Author URI: http://thomasklaiber.com/
 * Plugin URI: http://thomasklaiber.com/bbpress/post-notification/
 * Version: 1.4
 */
function notification_new_post($post_id = 0)
{
    global $bbdb, $bb_table_prefix, $topic_id, $bb_current_user;
    $all_users = notification_select_all_users();
    foreach ($all_users as $userdata) {
        if (notification_is_activated($userdata->ID)) {
            if (is_user_favorite($userdata->ID, $topic_id)) {
                //$topic = get_topic($topic_id);
                $message = __("Hello,\n\nA new post on \"%1\$s\" has been added by %2\$s at DHAnswers. \n\nMessage:\n\n%3\$s \n\n%4\$s ");
                mail($userdata->user_email, '[DHAnswers] New Post for Favorite Question', sprintf($message, get_topic_title($topic_id), get_user_name($bb_current_user->ID), strip_tags(get_post_text($post_id)), get_topic_link($topic_id)), 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>');
            }
        }
    }
}
Ejemplo n.º 8
0
function mod_notification_new_post()
{
    global $bbdb, $topic_id, $bb_current_user;
    $all_moderators = notification_select_all_mods();
    $topic = get_topic($topic_id);
    $header = 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>';
    $header .= 'MIME-Version: 1.0' . "\n";
    $header .= 'Content-Type: text/plain; charset="' . BBDB_CHARSET . '"' . "\n";
    $header .= 'Content-Transfer-Encoding: 7bit' . "\n";
    $subject = '[DHAnswers] New Post';
    foreach ($all_moderators as $userdata) {
        if (mod_notification_is_activated($userdata->ID)) {
            $msg = "Hello,\n\nA new post has been added to \"" . $topic->topic_title . "\" at DHAnswers. \n\n" . get_topic_link($topic_id);
            mail($userdata->user_email, $subject, $msg, $header);
        }
    }
}
 public function getStatus($location, $topic)
 {
     global $support_forum;
     if (isset($topic->topic_resolved) && isset($support_forum)) {
         return $this->resolve_support_status($topic->topic_resolved);
     }
     if ($this->is_closed_topic($topic)) {
         return "closed";
     }
     if ($this->is_sticky_topic($location, $topic)) {
         return "sticky";
     }
     $enabled = bb_get_option('support_forum_enabled');
     if (in_array($topic->forum_id, $enabled) && isset($support_forum)) {
         return $this->resolve_support_status(bb_get_option('support_forum_default_status'));
     }
     return "normal";
 }
function bb_language_switcher_debug()
{
    if (!bb_current_user_can('administrate')) {
        return;
    }
    bb_language_switcher_update();
    $bb_language_switcher = bb_get_option('bb_language_switcher');
    $url = bb_get_option('uri') . trim(str_replace(array(trim(BBPATH, "/\\"), "\\"), array("", "/"), BB_LANG_DIR), ' /\\') . '/';
    $count = 0;
    echo "<html><table border='0' cellpadding='1' cellspacing='1' style='font-family:monospace;'>";
    foreach ($bb_language_switcher as $value => $description) {
        if ($value) {
            $count++;
            echo "<tr><td>{$description}</td><td><a href='{$url}{$value}.mo'>{$value}.mo</a></td></tr>";
        }
    }
    echo "</table>\n<br />{$count} language files total";
    exit;
}
Ejemplo n.º 11
0
function thanks_admin_page_process()
{
    global $_POST;
    if (isset($_POST['thanks_option_submit'])) {
        bb_update_option('thanks_voting', $_POST['thanks_voting']);
        bb_update_option('thanks_output_none', $_POST['thanks_output_none']);
        bb_update_option('thanks_output_one', $_POST['thanks_output_one']);
        bb_update_option('thanks_output_many', $_POST['thanks_output_many']);
        bb_update_option('thanks_position', $_POST['thanks_position']);
        bb_update_option('thanks_voters', $_POST['thanks_voters']);
        bb_update_option('thanks_voters_prefix', $_POST['thanks_voters_prefix']);
        bb_update_option('thanks_voters_suffix', $_POST['thanks_voters_suffix']);
    }
    if (isset($_POST['thanks_option_reset'])) {
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
    if (isset($_POST['thanks_remove_all'])) {
        $opt = bb_get_option("thanks_posts");
        for ($i = 0; $i < count($opt); $i++) {
            $post_id = $opt[$i];
            bb_delete_postmeta($post_id, "thanks");
        }
        bb_delete_option("thanks_posts");
        bb_delete_option('thanks_voting');
        bb_delete_option('thanks_output_none');
        bb_delete_option('thanks_output_one');
        bb_delete_option('thanks_output_many');
        bb_delete_option('thanks_success');
        bb_delete_option('thanks_position');
        bb_delete_option('thanks_voters');
        bb_delete_option('thanks_voters_prefix');
        bb_delete_option('thanks_voters_suffix');
    }
}
 /**
  * Retrieve the avatar for a user provided a user ID or email address
  *
  * @since 0.9
  * @param int|string $id_or_email A user ID or email address
  * @param int $size Size of the avatar image
  * @param string $default URL to a default image to use if no avatar is available
  * @param string $alt Alternate text to use in image tag. Defaults to blank
  * @return string <img> tag for the user's avatar
 */
 function bb_get_avatar($id_or_email, $size = 80, $default = '', $alt = false)
 {
     if (!bb_get_option('avatars_show')) {
         return false;
     }
     if (false === $alt) {
         $safe_alt = '';
     } else {
         $safe_alt = esc_attr($alt);
     }
     if (!is_numeric($size)) {
         $size = 80;
     }
     if ($email = bb_get_user_email($id_or_email)) {
         $class = 'photo ';
     } else {
         $class = '';
         $email = $id_or_email;
     }
     if (!$email) {
         $email = '';
     }
     if (empty($default)) {
         $default = bb_get_option('avatars_default');
     }
     if (is_ssl()) {
         $host = 'https://secure.gravatar.com';
     } else {
         $host = 'http://www.gravatar.com';
     }
     switch ($default) {
         case 'logo':
             $default = '';
             break;
         case 'blank':
             $default = bb_get_uri('bb-admin/images/blank.gif', null, BB_URI_CONTEXT_IMG_SRC);
             break;
         case 'monsterid':
         case 'wavatar':
         case 'identicon':
             break;
         case 'default':
         default:
             $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
             // ad516503a11cd5ca435acc9bb6523536 == md5('*****@*****.**')
             break;
     }
     $src = $host . '/avatar/';
     $class .= 'avatar avatar-' . $size;
     if (!empty($email)) {
         $src .= md5(strtolower($email));
     } else {
         $src .= 'd41d8cd98f00b204e9800998ecf8427e';
         // d41d8cd98f00b204e9800998ecf8427e == md5('')
         $class .= ' avatar-noemail';
     }
     $src .= '?s=' . $size;
     $src .= '&amp;d=' . urlencode($default);
     $rating = bb_get_option('avatars_rating');
     if (!empty($rating)) {
         $src .= '&amp;r=' . $rating;
     }
     $avatar = '<img alt="' . $safe_alt . '" src="' . $src . '" class="' . $class . '" style="height:' . $size . 'px; width:' . $size . 'px;" />';
     return apply_filters('bb_get_avatar', $avatar, $id_or_email, $size, $default, $alt);
 }
Ejemplo n.º 13
0
function bb_tag_search($args = '')
{
    global $page, $nxt_taxonomy_object;
    if ($args && is_string($args) && false === strpos($args, '=')) {
        $args = array('search' => $args);
    }
    $defaults = array('search' => '', 'number' => false);
    $args = nxt_parse_args($args);
    if (isset($args['query'])) {
        $args['search'] = $args['query'];
    }
    if (isset($args['tags_per_page'])) {
        $args['number'] = $args['tags_per_page'];
    }
    unset($args['query'], $args['tags_per_page']);
    $args = nxt_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $number = (int) $number;
    $search = trim($search);
    if (strlen($search) < 3) {
        return new nxt_Error('invalid-query', __('Your search term was too short'));
    }
    $number = 0 < $number ? $number : bb_get_option('page_topics');
    if (1 < $page) {
        $offset = (intval($page) - 1) * $number;
    }
    $args = array_merge($args, compact('number', 'offset', 'search'));
    $terms = $nxt_taxonomy_object->get_terms('bb_topic_tag', $args);
    if (is_nxt_error($terms)) {
        return false;
    }
    for ($i = 0; isset($terms[$i]); $i++) {
        _bb_make_tag_compat($terms[$i]);
    }
    return $terms;
}
Ejemplo n.º 14
0
function bb_ksd_stats_page()
{
    if (!bb_get_option('akismet_stats')) {
        return;
    }
    if (function_exists('bb_admin_add_submenu')) {
        bb_admin_add_submenu(__('Akismet Stats'), 'use_keys', 'bb_ksd_stats_display', 'index.php');
    }
}
Ejemplo n.º 15
0
function socialit_public()
{
    if (bb_get_topicmeta(get_topic_id(), 'hide_socialit') == true) {
        echo "\n\n" . '<!-- Social It has been disabled on this page -->' . "\n\n";
    } else {
        global $socialit_plugopts;
        $link = $socialit_plugopts['custom-mods'] == 'yes' ? bb_get_option('uri') . 'socialit-mods/' : SOCIALIT_PLUGPATH;
        echo "\n\n" . '<!-- Start Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n";
        wp_register_style('social-it', $link . 'css/style.css', false, SOCIALIT_VER, 'all');
        wp_print_styles('social-it');
        if ($socialit_plugopts['expand'] || $socialit_plugopts['autocenter'] || $socialit_plugopts['targetopt'] == '_blank') {
            wp_register_script('social-it-public-js', $link . "js/social-it-public.js", array('jquery'), SOCIALIT_VER);
            wp_print_scripts('social-it-public-js');
        }
        echo '<!-- End Of Code Generated By Social It Plugin By www.gaut.am -->' . "\n\n";
    }
}
Ejemplo n.º 16
0
<?php

require_once './bb-load.php';
if (!($q = trim(@$_GET['search']))) {
    $q = trim(@$_GET['q']);
}
$bb_query_form = new BB_Query_Form();
if ($q = stripslashes($q)) {
    $per_page = ceil((int) bb_get_option('page_topics') / 2);
    /* Recent */
    add_filter('bb_recent_search_fields', create_function('$f', 'return $f . ", MAX(post_time) AS post_time";'));
    add_filter('bb_recent_search_group_by', create_function('', 'return "t.topic_id";'));
    $bb_query_form->BB_Query_Form('post', array(), array('order_by' => 'p.post_time', 'count' => true, 'per_page' => $per_page, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author'), 'bb_recent_search');
    $recent = $bb_query_form->results;
    $recent_count = $recent ? $bb_query_form->found_rows : 0;
    /* Relevant */
    $bb_query_form->BB_Query_Form('topic', array('search' => $q), array('per_page' => $per_page, 'count' => true, 'post_status' => 0, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author'), 'bb_relevant_search');
    $relevant = $bb_query_form->results;
    $relevant_count = $relevant ? $bb_query_form->found_rows : 0;
    $search_count = max($recent_count, $relevant_count);
    $q = $bb_query_form->get('search');
}
do_action('do_search', $q);
// Cache topics
// NOT bbdb::prepared
if ($recent) {
    $topic_ids = array();
    foreach ($recent as $bb_post) {
        $topic_ids[] = (int) $bb_post->topic_id;
    }
    $topic_ids = join($topic_ids);
Ejemplo n.º 17
0
 function _filter_sql($bits, $from)
 {
     global $bbdb;
     $q =& $this->query_vars;
     // MySQL 5.1 allows multiple index hints per query - earlier versions only get the first hint
     if ($bits['index_hint']) {
         if (!is_array($bits['index_hint'])) {
             $bits['index_hint'] = array((string) $bits['index_hint']);
         }
         if ($bbdb->has_cap('index_hint_for_any')) {
             // 5.1 <= MySQL
             $_regex = '/\\s*(USE|IGNORE|FORCE)\\s+(INDEX|KEY)\\s+(FOR\\s+(JOIN|ORDER\\s+BY|GROUP\\s+BY)\\s+)?\\(\\s*`?[a-z0-9_]+`?(\\s*,\\s*`?[a-z0-9_]+`?)*\\s*\\)\\s*/i';
         } elseif ($bbdb->has_cap('index_hint_for_join')) {
             // 5.0 <= MySQL < 5.1
             $_regex = '/\\s*(USE|IGNORE|FORCE)\\s+(INDEX|KEY)\\s+(FOR\\s+JOIN\\s+)?\\(\\s*`?[a-z0-9_]+`?(\\s*,\\s*`?[a-z0-9_]+`?)*\\s*\\)\\s*/i';
         } else {
             // MySQL < 5.0
             $_regex = '/\\s*(USE|IGNORE|FORCE)\\s+(INDEX|KEY)\\s+\\(\\s*`?[a-z0-9_]+`?(\\s*,\\s*`?[a-z0-9_]+`?)*\\s*\\)\\s*/i';
         }
         $_index_hint = array();
         foreach ($bits['index_hint'] as $_hint) {
             if (preg_match($_regex, $_hint)) {
                 $_index_hint[] = trim($_hint);
             }
         }
         unset($_regex, $_hint);
         if ($bbdb->has_cap('index_hint_lists')) {
             // 5.1 <= MySQL
             $bits['index_hint'] = join(' ', $_index_hint);
         } else {
             // MySQL < 5.1
             $bits['index_hint'] = isset($_index_hint[0]) ? $_index_hint[0] : '';
         }
         unset($_index_hint);
     }
     $q['order'] = strtoupper($q['order']);
     if ($q['order'] && in_array($q['order'], array('ASC', 'DESC'))) {
         $bits['order_by'] .= " {$q['order']}";
     } else {
         $bits['order_by'] .= " DESC";
     }
     $bits['limit'] = '';
     // When offset and number are provided, skip per_page and limit checks
     if (!empty($q['offset']) && !empty($q['number'])) {
         $bits['limit'] .= $q['offset'] . ", " . $q['number'];
         // Else proceed as normal
     } else {
         if (!$q['per_page']) {
             $q['per_page'] = (int) bb_get_option('page_topics');
         }
         if ($q['per_page'] > 0) {
             if ($q['page'] > 1) {
                 $bits['limit'] .= $q['per_page'] * ($q['page'] - 1) . ", ";
             }
             $bits['limit'] .= $q['per_page'];
         }
     }
     $name = "get_{$this->type}s_";
     // Unfiltered
     $sql_calc_found_rows = $bits['sql_calc_found_rows'];
     unset($bits['sql_calc_found_rows']);
     foreach ($bits as $bit => $value) {
         if ($this->query_id) {
             $value = apply_filters("{$this->query_id}_{$bit}", $value);
         }
         ${$bit} = apply_filters("{$name}{$bit}", $value);
     }
     if ($where) {
         $where = "WHERE {$where}";
     }
     if ($group_by) {
         $group_by = "GROUP BY {$group_by}";
     }
     if ($having) {
         $having = "HAVING {$having}";
     }
     if ($order_by) {
         $order_by = "ORDER BY {$order_by}";
     }
     if ($limit) {
         $limit = "LIMIT {$limit}";
     }
     return "SELECT {$distinct} {$sql_calc_found_rows} {$fields} FROM {$from} {$index_hint} {$join} {$where} {$group_by} {$having} {$order_by} {$limit}";
 }
Ejemplo n.º 18
0
    if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
        bb_check_admin_referer('bbpress-upgrader');
        define('BB_UPGRADING', true);
        $bbdb->hide_errors();
        $messages = bb_upgrade_all();
        $bbdb->show_errors();
        $upgrade_log = array(__('Beginning upgrade&hellip;'));
        if (is_array($messages['messages'])) {
            $upgrade_log = array_merge($upgrade_log, $messages['messages']);
        }
        $upgrade_log[] = '>>> ' . __('Done');
        $error_log = array();
        if (is_array($messages['errors'])) {
            $error_log = $messages['errors'];
        }
        if (bb_get_option('bb_db_version') === bb_get_option_from_db('bb_db_version') && !count($error_log)) {
            $step = 'complete';
        } else {
            $step = 'error';
        }
        nxt_cache_flush();
    }
}
bb_install_header(__('bbPress database upgrade'), false, true);
?>
		<script type="text/javascript" charset="utf-8">
			function toggleAdvanced(toggle, target) {
				var toggleObj = document.getElementById(toggle);
				var targetObj = document.getElementById(target);
				if (toggleObj.checked) {
					targetObj.style.display = 'block';
Ejemplo n.º 19
0
/**
 * Deactivate a single plugin or multiple plugins.
 *
 * The deactivation hook is disabled by the plugin upgrader by using the $silent
 * parameter.
 *
 * @since unknown
 *
 * @param string|array $plugins Single plugin or list of plugins to deactivate.
 * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
 */
function bb_deactivate_plugins($plugins, $silent = false)
{
    $active_plugins = (array) bb_get_option('active_plugins');
    if (!is_array($plugins)) {
        $plugins = array($plugins);
    }
    foreach ($plugins as $plugin) {
        $plugin = bb_plugin_basename(trim($plugin));
        if (!in_array($plugin, $active_plugins)) {
            continue;
        }
        // Remove the deactivated plugin
        array_splice($active_plugins, array_search($plugin, $active_plugins), 1);
        if (!$silent) {
            do_action('bb_deactivate_plugin_' . $plugin);
        }
    }
    bb_update_option('active_plugins', $active_plugins);
}
Ejemplo n.º 20
0
<?php

define('BB_IS_ADMIN', true);
require_once '../bb-load.php';
bb_ssl_redirect();
bb_auth();
if (bb_get_option('bb_db_version') > bb_get_option_from_db('bb_db_version')) {
    bb_safe_redirect('upgrade.php');
    die;
}
require_once BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
$bb_admin_page = bb_find_filename($_SERVER['PHP_SELF']);
$_check_callback = false;
if ($bb_admin_page == 'admin-base.php') {
    $bb_admin_page = (string) @$_GET['plugin'];
    $_check_callback = true;
}
wp_enqueue_script('common');
bb_user_settings();
if (isset($_GET['foldmenu'])) {
    if ($_GET['foldmenu']) {
        bb_update_user_setting('fm', 'f');
    } else {
        bb_delete_user_setting('fm');
    }
    bb_safe_redirect(remove_query_arg('foldmenu', stripslashes($_SERVER['REQUEST_URI'])));
    die;
}
bb_admin_menu_generator();
bb_get_current_admin_menu();
if ($_check_callback) {
Ejemplo n.º 21
0
    }
}
add_action('bb_init', 'bb_contextualise_search_post_text');
add_filter('post_text', 'make_clickable');
add_filter('edit_text', 'bb_code_trick_reverse');
add_filter('edit_text', 'wp_specialchars');
add_filter('edit_text', 'trim', 15);
add_filter('pre_sanitize_with_dashes', 'bb_pre_sanitize_with_dashes_utf8', 10, 3);
add_filter('get_user_link', 'bb_fix_link');
add_filter('sanitize_profile_info', 'esc_html');
add_filter('sanitize_profile_admin', 'esc_html');
add_filter('get_recent_user_replies_fields', 'bb_get_recent_user_replies_fields');
add_filter('get_recent_user_replies_group_by', 'bb_get_recent_user_replies_group_by');
add_filter('sort_tag_heat_map', 'bb_sort_tag_heat_map');
// URLS
if (!bb_get_option('mod_rewrite')) {
    add_filter('bb_stylesheet_uri', 'esc_attr', 1, 9999);
    add_filter('forum_link', 'esc_attr', 1, 9999);
    add_filter('bb_forum_posts_rss_link', 'esc_attr', 1, 9999);
    add_filter('bb_forum_topics_rss_link', 'esc_attr', 1, 9999);
    add_filter('bb_tag_link', 'esc_attr', 1, 9999);
    add_filter('tag_rss_link', 'esc_attr', 1, 9999);
    add_filter('topic_link', 'esc_attr', 1, 9999);
    add_filter('topic_rss_link', 'esc_attr', 1, 9999);
    add_filter('post_link', 'esc_attr', 1, 9999);
    add_filter('post_anchor_link', 'esc_attr', 1, 9999);
    add_filter('user_profile_link', 'esc_attr', 1, 9999);
    add_filter('profile_tab_link', 'esc_attr', 1, 9999);
    add_filter('favorites_link', 'esc_attr', 1, 9999);
    add_filter('view_link', 'esc_attr', 1, 9999);
}
Ejemplo n.º 22
0
        // Open the file for writing - rewrites the whole file
        if ($file_target_handle = fopen($file_target, 'w')) {
            if (fwrite($file_target_handle, $file_target_rules)) {
                $file_target_written = 1;
            }
            // Close the file
            fclose($file_target_handle);
            @chmod($file_target, 0666);
        }
    }
    bb_update_option('mod_rewrite_writable', $file_target_writable);
    $goback = add_query_arg('updated', 'true', $goback);
    bb_safe_redirect($goback);
    exit;
}
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>'));
Ejemplo n.º 23
0
function bb_option_form_element($name = 'name', $args = null)
{
    global $bb_hardcoded;
    $defaults = array('title' => 'title', 'type' => 'text', 'value' => false, 'options' => false, 'message' => false, 'class' => false, 'default' => false, 'before' => '', 'after' => '', 'note' => false, 'attributes' => false, 'disabled' => false);
    $args = nxt_parse_args($args, $defaults);
    $id = str_replace(array('_', '[', ']'), array('-', '-', ''), $name);
    if (false !== strpos($name, '[')) {
        list($option_name, $option_key) = preg_split('/[\\[\\]]/', $name, -1, PREG_SPLIT_NO_EMPTY);
        $option = bb_get_option($option_name);
        $value = false === $args['value'] ? esc_attr($option[$option_key]) : esc_attr($args['value']);
        $hardcoded = isset($bb_hardcoded[$option_name][$option_key]);
    } else {
        $value = false === $args['value'] ? bb_get_form_option($name) : esc_attr($args['value']);
        $hardcoded = isset($bb_hardcoded[$name]);
    }
    $class = $args['class'] ? (array) $args['class'] : array();
    array_unshift($class, $args['type']);
    if ($hardcoded || $args['disabled']) {
        $disabled = ' disabled="disabled"';
    } else {
        $disabled = false;
    }
    if ($args['attributes']) {
        $attributes = array();
        foreach ($args['attributes'] as $k => $v) {
            $attributes[] = "{$k}='{$v}'";
        }
        $attributes = ' ' . join(' ', $attributes);
    } else {
        $attributes = '';
    }
    ?>

		<div id="option-<?php 
    echo $id;
    ?>
"<?php 
    if (!empty($disabled)) {
        echo ' class="disabled"';
    }
    ?>
>
<?php 
    switch ($args['type']) {
        case 'radio':
        case 'checkbox':
        case 'message':
            ?>
			<div class="label">
				<?php 
            echo $args['title'];
            ?>
			</div>

<?php 
            break;
        case 'select':
        default:
            ?>
			<label for="<?php 
            echo $id;
            ?>
">
				<?php 
            echo $args['title'];
            ?>
			</label>

<?php 
            break;
    }
    ?>
			<div class="inputs">

<?php 
    if ($args['before']) {
        echo '<span class="before">' . $args['before'] . '</span>';
    }
    switch ($args['type']) {
        case 'select':
            echo "<select{$disabled} class='" . join(' ', $class) . "' name='{$name}' id='{$id}'{$attributes}>\n";
            if (is_array($args['options'])) {
                foreach ($args['options'] as $option => $label) {
                    echo "\t<option value='{$option}'" . ($value == $option ? " selected='selected'" : '') . ">{$label}</option>\n";
                }
            } elseif (is_string($args['options'])) {
                echo $args['options'] . "\n";
            }
            echo "</select>\n";
            break;
        case 'radio':
        case 'checkbox':
            if (is_array($args['options'])) {
                $_id = 0;
                if ('radio' === $args['type'] && !in_array($value, array_keys($args['options'])) && empty($value)) {
                    $use_first_value = true;
                }
                $type = $args['type'];
                foreach ($args['options'] as $option => $label) {
                    if ($use_first_value) {
                        $use_first_value = false;
                        $value = $option;
                    }
                    if (is_array($label)) {
                        if (isset($label['attributes'])) {
                            $attributes = array();
                            foreach ($label['attributes'] as $k => $v) {
                                $attributes[] = "{$k}='{$v}'";
                            }
                            $attributes = ' ' . join(' ', $attributes);
                        } else {
                            $attributes = '';
                        }
                        if (isset($label['name'])) {
                            $name = $label['name'];
                            $id = str_replace(array('_', '[', ']'), array('-', '-', ''), $name);
                            $hardcoded = isset($bb_hardcoded[$name]);
                        }
                        if (isset($label['value'])) {
                            $_value = $label['value'];
                        } else {
                            $_value = $args['value'];
                        }
                        $value = false === $_value ? bb_get_form_option($name) : esc_attr($_value);
                        $label = $label['label'];
                    }
                    echo "<label class=\"{$type}s\"><input{$disabled} type='{$type}' class='" . join(' ', $class) . "' name='{$name}' id='{$id}-{$_id}' value='{$option}'" . ($value == $option ? " checked='checked'" : '') . "{$attributes} /> {$label}</label>\n";
                    $_id++;
                }
            } elseif (is_string($args['options'])) {
                echo $args['options'] . "\n";
            }
            break;
        case 'message':
            if ($args['message']) {
                echo $args['message'];
            }
            break;
        default:
            echo "<input{$disabled} type='{$args['type']}' class='" . join(' ', $class) . "' name='{$name}' id='{$id}' value='{$value}'{$attributes} />\n";
            break;
    }
    if ($args['after']) {
        echo '<span class="after">' . $args['after'] . '</span>';
    }
    if ($args['note']) {
        foreach ((array) $args['note'] as $note) {
            ?>

				<p><?php 
            echo $note;
            ?>
</p>

<?php 
        }
    }
    ?>

			</div>
		</div>

<?php 
}
Ejemplo n.º 24
0
			</table>
		</div>

		<div class="versions">
			<p class="theme"><a class="button" href="<?php 
bb_uri('bb-admin/themes.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
?>
"><?php 
_e('Change Theme');
?>
</a><?php 
printf(__('Theme <a href="%1$s">%2$s</a>'), bb_get_uri('bb-admin/themes.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN), bb_get_current_theme_data('Name'));
?>
</p>
			<p class="bbpress"><?php 
printf(__('You are using <span class="b">bbPress %s</span>'), bb_get_option('version'));
?>
</p>
		</div>
	</div>

	<div id="dashboard-moderated" class="dashboard">
		<h3><?php 
_e('Recently Moderated Items');
?>
</h3>
		<?php 
if ($objects = bb_get_recently_moderated_objects()) {
    ?>
		<ul class="posts">
			<?php 
Ejemplo n.º 25
0
load_plugin_textdomain('socialit', '/my-plugins/social-it/languages/');
//defines
define('SOCIALIT_OPTIONS', 'SocialIt');
define('SOCIALIT_vNum', '1.4');
define('SOCIALIT_PLUGPATH', bb_get_option('uri') . trim(str_replace(array(trim(BBPATH, "/\\"), "\\"), array("", "/"), dirname(__FILE__)), ' /\\') . '/');
define('SI_BB_VER', (int) bb_get_option('version'));
//requires
require_once 'functions.php';
//social it functions file
require_once 'bookmarks-data.php';
//bookmarks data file
require_once 'mobile.php';
//mobile/bot check file
//requires have to be above the below code as the below code calls $socialit_bookmarks_data which is in bookmarks-data.php file
//load options
$socialit_plugopts = bb_get_option(SOCIALIT_OPTIONS);
if (!$socialit_plugopts) {
    //add defaults to an array
    $socialit_plugopts = array('reloption' => 'nofollow', 'targetopt' => '_blank', 'bgimg-yes' => 'yes', 'bgimg' => 'caring', 'shorty' => 'b2l', 'shortyapi' => array('snip' => array('user' => '', 'key' => ''), 'bitly' => array('user' => '', 'key' => ''), 'supr' => array('chk' => 0, 'user' => '', 'key' => ''), 'trim' => array('chk' => 0, 'user' => '', 'pass' => ''), 'tinyarrow' => array('chk' => 0, 'user' => ''), 'cligs' => array('chk' => 0, 'key' => '')), 'shorturls' => array(), 'topic' => '1', 'bookmark' => array_keys($socialit_bookmarks_data), 'xtrastyle' => '', 'feed' => '0', 'expand' => '1', 'autocenter' => '0', 'ybuzzcat' => 'science', 'ybuzzmed' => 'text', 'twittcat' => 'Internet', 'defaulttags' => 'Forum,Internet', 'warn-choice' => '', 'sfpnonres' => 'yes', 'sfpres' => 'yes', 'sfpnonsup' => 'yes', 'mobile-hide' => 'yes');
    bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
}
/* this part of code will be removed after the release of 1.4 */
if ($socialit_plugopts['shortyapi'] == "1") {
    //means that 1.2 ver was installed, and we have to fix some issues
    $socialit_plugopts['shortyapi'] = array('snip' => array('user' => '', 'key' => ''), 'bitly' => array('user' => '', 'key' => ''), 'supr' => array('chk' => 0, 'user' => '', 'key' => ''), 'trim' => array('chk' => 0, 'user' => '', 'pass' => ''), 'tinyarrow' => array('chk' => 0, 'user' => ''), 'cligs' => array('chk' => 0, 'key' => ''));
    bb_update_option(SOCIALIT_OPTIONS, $socialit_plugopts);
    //update with edited options
}
if ($socialit_plugopts['shorty'] == 'e7t') {
    $socialit_plugopts['shorty'] = 'b2l';
    //now, no more e7t, instead b2l.me
function get_view_link($_view = false, $page = 1, $context = BB_URI_CONTEXT_A_HREF)
{
    global $view, $bb_views;
    if ($_view) {
        $v = bb_slug_sanitize($_view);
    } else {
        $v =& $view;
    }
    if (!$context || !is_integer($context)) {
        $context = BB_URI_CONTEXT_A_HREF;
    }
    if (!array_key_exists($v, $bb_views)) {
        return bb_get_uri(null, null, $context);
    }
    if (bb_get_option('mod_rewrite')) {
        $page = 1 < $page ? '/page/' . $page : '';
        $link = bb_get_uri('view/' . $v . $page, null, $context);
    } else {
        $query = array('view' => $v, 'page' => 1 < $page ? $page : false);
        $link = bb_get_uri('view.php', $query, $context);
    }
    return apply_filters('get_view_link', $link, $v, $page, $context);
}
function bb_update_db_version()
{
    bb_update_option('bb_db_version', bb_get_option('bb_db_version'));
}
Ejemplo n.º 28
0
$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);')))));
$advanced_user_db_options = array('user_bbdb_name' => array('title' => __('User database name'), 'note' => __('The name of the database in which your user tables reside.')), 'user_bbdb_user' => array('title' => __('User database user'), 'note' => __('The database user that has access to that database.')), 'user_bbdb_password' => array('title' => __('User database password'), 'note' => __('That database user\'s password.')), 'user_bbdb_host' => array('title' => __('User database host'), 'note' => __('The domain name or IP address of the server where the database is located. If the database is on the same server as the web site, then this probably should be <strong>localhost</strong>.')), 'user_bbdb_charset' => array('title' => __('User database character set'), 'note' => __('The best choice is <strong>utf8</strong>, but you will need to match the character set which you created the database with.')), 'user_bbdb_collate' => array('title' => __('User database character collation'), 'note' => __('The character collation value set when the user database was created.')));
$custom_table_options = array('custom_user_table' => array('title' => __('User database "user" table'), 'note' => __('The complete table name, including any prefix.')), 'custom_user_meta_table' => array('title' => __('User database "user meta" table'), 'note' => __('The complete table name, including any prefix.')));
$advanced_display = bb_get_option('user_bbdb_advanced') ? 'block' : 'none';
$bb_admin_body_class = ' bb-admin-settings';
bb_get_admin_header();
?>

<div class="wrap">

<h2><?php 
_e('NXTClass Integration Settings');
?>
</h2>
<?php 
do_action('bb_admin_notices');
?>

<form class="settings" method="post" action="<?php 
Ejemplo n.º 29
0
	>
	<channel>
		<title><?php 
echo $title;
?>
</title>
		<link><?php 
echo $link;
?>
</link>
		<description><?php 
echo $description;
?>
</description>
		<language><?php 
echo esc_html(bb_get_option('language'));
?>
</language>
		<pubDate><?php 
echo gmdate('D, d M Y H:i:s +0000');
?>
</pubDate>
		<?php 
bb_generator('rss2');
?>
		<?php 
do_action('bb_rss2_head');
?>
		<atom:link href="<?php 
echo $link_self;
?>
Ejemplo n.º 30
0
 /**
  * Compiles site options into an array suitable to be passed back through the XML-RPC server
  *
  * @since 1.0
  * @return array The site options in an array
  * @param array $options An array of options to fetch and return
  */
 function _getOptions($options)
 {
     $data = array();
     foreach ($options as $option) {
         if (array_key_exists($option, $this->site_options)) {
             $data[$option] = $this->site_options[$option];
             // Is the value static or dynamic?
             if (isset($data[$option]['option'])) {
                 $data[$option]['value'] = bb_get_option($data[$option]['option']);
                 unset($data[$option]['option']);
             }
         }
     }
     return $data;
 }