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.º 2
0
 function get($option)
 {
     switch ($option) {
         case 'application_id':
             return 'glotpress';
             break;
         case 'application_uri':
             return bb_get_uri(null, null, BB_URI_CONTEXT_NONE);
             break;
         case 'cron_uri':
             return '';
             break;
         case 'cron_check':
             return '';
             break;
         case 'charset':
             return 'UTF-8';
             break;
         case 'wp_http_version':
             return 'GlotPress/' . gp_get_option('version');
             break;
         case 'hash_function_name':
             return 'gp_hash';
             break;
         default:
             return gp_get_option(BP_Options::prefix() . $option);
             break;
     }
 }
Ejemplo n.º 3
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;
     }
 }
Ejemplo n.º 4
0
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');
?>

<form class="settings" method="post" action="<?php 
Ejemplo n.º 5
0
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body id="<?php 
bb_location();
?>
">
	<div class="container prepend-top append-bottom">
		<div id="util-login">
		<?php 
if (!bb_is_user_logged_in()) {
    printf(__('<a href="%2$s">Log in</a> | <a href="%1$s">Register</a>'), bb_get_uri('register.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS), bb_get_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS));
} else {
    printf(__('Logged in as %1$s'), bb_get_profile_link(bb_get_current_user_info('name')));
    echo ' | ';
    if ($bb_current_user->has_cap('administrate') || $bb_current_user->has_cap('moderate')) {
        bb_admin_link();
        echo ' | ';
    }
    bb_logout_link();
}
?>
		</div>
		<div id="header" class="prepend-6 span-18">
			<a id="ach-logo" href="http://www.ach.org">ACH</a>
			<h1><a href="<?php 
bb_uri();
Ejemplo n.º 6
0
Plugin Name: BB-Syntax
Plugin URI: http://www.finalwebsites.com/bbpress/geshi-syntax-highlighting.php
Description: This plugin will highlight your code snippets using the PHP class GeSHi. Wrap code blocks with <code>&lt;pre lang="LANGUAGE" line="1"&gt;</code> and <code>&lt;/pre&gt;</code> where <code>LANGUAGE</code> is a GeSHi supported language syntax.  The <code>line</code> attribute is optional. This plugin is a fork from the Wordpress plugin <a href="http://wordpress.org/extend/plugins/wp-syntax/">WP_Syntax</a> by Ryan McGeary.
Author: Olaf Lederer
Version: 0.1.1
Author URI: http://www.finalwebsites.com/
*/
function allow_syntax_tag($tags)
{
    $tags['pre'] = array('lang' => array(), 'line' => array(), 'escaped' => array(), 'style' => array(), 'width' => array());
    return $tags;
}
add_filter('bb_allowed_tags', 'allow_syntax_tag');
include_once "geshi/geshi.php";
if (!defined("BB_PLUGIN_URL")) {
    define("BB_PLUGIN_URL", bb_get_uri() . "/my-plugins");
}
function bb_syntax_head()
{
    $css_url = BB_PLUGIN_URL . "bb-syntax/bb-syntax.css";
    echo "\n" . '<link rel="stylesheet" href="' . $css_url . '" type="text/css" media="screen" />' . "\n";
}
function bb_syntax_code_trim($code)
{
    // special ltrim b/c leading whitespace matters on 1st line of content
    $code = preg_replace("/^\\s*\n/siU", "", $code);
    $code = rtrim($code);
    return $code;
}
function bb_syntax_substitute(&$match)
{
function bb_forum_row($forum_id = 0, $echo = true, $close = false)
{
    global $forum, $forums_count;
    if ($forum_id) {
        $_forum = bb_get_forum($forum_id);
    } else {
        $_forum =& $forum;
    }
    if (!$_forum) {
        return;
    }
    $description = get_forum_description($_forum->forum_id);
    $r = '';
    if ($close) {
        $r .= "\t<li id='forum-{$_forum->forum_id}'" . get_alt_class('forum', 'forum clear list-block') . ">\n";
    }
    $r .= "\t\t<div class='list-block posrel'>\n";
    $r .= "\t\t\t<div class=\"row-title\">" . get_forum_name($_forum->forum_id) . "</div>\n";
    if ($description) {
        $r .= "\t\t\t<p class=\"row-description\">" . get_forum_description($_forum->forum_id) . "</p>\n";
    }
    $r .= "\t\t\t<div class=\"row-actions\"><span>\n";
    $r .= "\t\t\t\t<a class='edit' href='" . get_forum_link() . "'>" . __('View') . "</a>\n";
    if (bb_current_user_can('manage_forums')) {
        $r .= "\t\t\t\t| <a class='edit' href='" . esc_attr(bb_get_uri('bb-admin/forums.php', array('action' => 'edit', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)) . "'>" . __('Edit') . "</a>\n";
    }
    if (bb_current_user_can('delete_forum', $_forum->forum_id) && 1 < $forums_count) {
        $r .= "\t\t\t\t| <a class='delete' href='" . esc_attr(bb_get_uri('bb-admin/forums.php', array('action' => 'delete', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)) . "'>" . __('Delete') . "</a>\n";
    }
    $r .= "\t\t\t</span>&nbsp;</div>\n";
    $r .= "\t\t</div>\n";
    if ($close) {
        $r .= "\t</li>\n";
    }
    if ($echo) {
        echo $r;
    }
    return $r;
}
 /**
  * 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.º 9
0
function bb_ksd_post_delete_link($parts, $args)
{
    if (!bb_current_user_can('moderate')) {
        return $parts;
    }
    $bb_post = bb_get_post(get_post_id($args['post_id']));
    if (2 == $bb_post->post_status) {
        $query = array('id' => $bb_post->post_id, 'status' => 0, 'view' => 'all');
        $display = __('Not Spam');
    } else {
        $query = array('id' => $bb_post->post_id, 'status' => 2);
        $display = __('Spam');
    }
    $uri = bb_get_uri('bb-admin/delete-post.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
    $uri = esc_url(bb_nonce_url($uri, 'delete-post_' . $bb_post->post_id));
    if (!is_array($parts)) {
        $parts = array();
        $before = '';
        $after = '';
    } else {
        $before = $args['last_each']['before'];
        $after = $args['last_each']['after'];
    }
    // Make sure that the last tag in $before gets a class (if it's there)
    if (preg_match('/.*(<[^>]+>)[^<]*/', $before, $_node)) {
        if (preg_match('/class=(\'|")(.*)\\1/U', $_node[1], $_class)) {
            $before = str_replace($_class[0], 'class=' . $_class[1] . 'before-post-spam-link ' . $_class[2] . $_class[1], $before);
        } else {
            $before = preg_replace('/(.*)<([a-z0-9_-]+)(\\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-spam-link"$3$4>$5', $before, 1);
        }
    }
    $parts[] = $before . '<a class="post-spam-link" href="' . $uri . '" >' . $display . '</a>' . $after;
    return $parts;
}
Ejemplo n.º 10
0
function bb_url_to_path($url)
{
    bb_log_deprecated('function', __FUNCTION__, 'no alternative');
    return apply_filters('bb_url_to_path', bb_convert_path_base($url, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), BB_PATH), $url);
}
Ejemplo n.º 11
0
$forums_count = $forums ? count($forums) : 0;
if (isset($_GET['action']) && 'delete' == $_GET['action']) {
    $forum_to_delete = (int) $_GET['id'];
    $deleted_forum = bb_get_forum($forum_to_delete);
    if (!$deleted_forum || $forums_count < 2 || !bb_current_user_can('delete_forum', $forum_to_delete)) {
        bb_safe_redirect(add_query_arg(array('action' => false, 'id' => false)));
        exit;
    }
}
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 
Ejemplo n.º 12
0
<?php 
    foreach ($requested_plugins as $plugin => $plugin_data) {
        $class = ' class="inactive"';
        $action = 'activate';
        $action_class = 'edit';
        $action_text = __('Activate');
        if ($plugin_data['autoload']) {
            $class = ' class="autoload"';
        } elseif (in_array($plugin, $active_plugins)) {
            $class = ' class="active"';
            $action = 'deactivate';
            $action_class = 'delete';
            $action_text = __('Deactivate');
        }
        $href = esc_attr(bb_nonce_url(bb_get_uri('bb-admin/plugins.php', array('plugin_request' => $plugin_request, 'action' => $action, 'plugin' => urlencode($plugin)), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN), $action . '-plugin_' . $plugin));
        $meta = array();
        if ($plugin_data['version']) {
            $meta[] = sprintf(__('Version %s'), $plugin_data['version']);
        }
        if ($plugin_data['author_link']) {
            $meta[] = sprintf(__('By %s'), $plugin_data['author_link']);
        }
        if ($plugin_data['uri']) {
            $meta[] = '<a href="' . $plugin_data['uri'] . '">' . esc_html__('Visit plugin site') . '</a>';
        }
        if (count($meta)) {
            $meta = '<p class="meta">' . join(' | ', $meta) . '</p>';
        } else {
            $meta = '';
        }
Ejemplo n.º 13
0
/**
 * If this page was accessed using SSL, make sure the redirect is a full URL so
 * that we don't end up on an SSL page again (unless the whole site is under SSL)
 */
if (is_ssl() && 0 === strpos($re, '/')) {
    $re = bb_get_uri($re, null, BB_URI_CONTEXT_HEADER);
}
// Clean the redirection destination
if (!empty($re)) {
    $re = esc_url($re);
    $re = esc_attr($re);
    $redirect_to = $re;
}
// Fallback to site root
if (empty($re)) {
    $re = bb_get_uri();
}
/** Handle logout *************************************************************/
// User is logged in
if (bb_is_user_logged_in()) {
    // Logout requested
    if (isset($_GET['logout'])) {
        $_GET['action'] = 'logout';
    }
    // Check logout action
    if (isset($_GET['action']) && 'logout' === $_GET['action']) {
        bb_logout();
    }
    bb_safe_redirect($re);
    exit;
}
Ejemplo n.º 14
0
		//]]>
	</script>
	<div id="bbWrap">
		<div id="bbContent">
			<div id="bbHead">
				<h1><a href="<?php 
bb_uri();
?>
"><span><?php 
bb_option('name');
?>
</span> <em><?php 
_e('Visit Site');
?>
</em></a></h1>
				<div id="bbUserInfo">
					<p>
						<?php 
printf(__('Howdy, %1$s'), bb_get_profile_link(array('text' => bb_get_current_user_info('name'))));
?>
						| <?php 
bb_logout_link(array('redirect' => bb_get_uri(null, null, BB_URI_CONTEXT_HEADER)));
?>
					</p>
				</div>
			</div>

			<div id="bbBody">

<?php 
bb_admin_menu();
Ejemplo n.º 15
0
<div class="topmenu">
	<div class="page">
		<ul>
			<?php 
do_action('gz_profile_menu ');
?>
			<li><a rel="nofollow" href="<?php 
echo bb_get_uri('register.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS);
?>
"><?php 
_e('Register', 'guangzhou');
?>
</a></li>
			<li><a rel="nofollow" href="<?php 
echo bb_get_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS);
?>
"><?php 
_e('Login', 'guangzhou');
?>
</a></li>
		</ul>
	</div>
</div>
Ejemplo n.º 16
0
    ?>
<p><?php 
    printf(__('Your search %s did not return any results. Here are some suggestions:'), '&#8220;<em>' . esc_html($q) . '</em>&#8221;');
    ?>
</p>
<ul id="search-suggestions">
	<li><?php 
    _e('Make sure all words are spelled correctly');
    ?>
</li>
	<li><?php 
    _e('Try different keywords');
    ?>
</li>
	<li><?php 
    _e('Try more general keywords');
    ?>
</li>
</ul>
<?php 
}
?>

<br />
<p><?php 
printf(__('You may also try your <a href="%s">search at Google</a>.'), 'http://google.com/search?q=site:' . bb_get_uri(null, null, BB_URI_CONTEXT_TEXT) . urlencode(' ' . $q));
?>
</p>

<?php 
bb_get_footer();
Ejemplo n.º 17
0
<?php 
}
?>

			</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 
Ejemplo n.º 18
0
<form class="login" method="post" action="<?php 
bb_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS);
?>
">
	<p>
		<?php 
printf(__('<a href="%1$s">Register</a> or log in - <a href="%2$s">lost password?</a>'), bb_get_uri('register.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS), bb_get_uri('bb-login.php', array('action' => 'lostpassword'), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS));
?>

	</p>
	<div>
		<label>
			<?php 
_e('Username');
?>
<br />
			<input name="log" type="text" id="quick_user_login" size="13" maxlength="40" value="<?php 
if (!is_bool($user_login)) {
    echo $user_login;
}
?>
" tabindex="10" />
		</label>
		<label>
			<?php 
_e('Password');
?>
<br />
			<input name="pwd" type="password" id="quick_password" size="13" maxlength="40" tabindex="11" />
		</label>
		<input name="redirect_to" type="hidden" value="<?php 
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);
}
Ejemplo n.º 20
0
<?php

require 'admin-action.php';
nxt_redirect(bb_get_uri('bb-admin/options-permalinks.php', null, BB_URI_CONTEXT_BB_ADMIN + BB_URI_CONTEXT_HEADER));
Ejemplo n.º 21
0
 /**
  * Returns an array of URLs that pingbacked the given URL
  *
  * @since 1.0
  * @link http://www.aquarionics.com/misc/archives/blogite/0198.html
  * @return array The array of URLs that pingbacked the given topic
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The full URI of the post where the pingback is being sent from
  * @param string $args[1] The full URI of the post where the pingback is being sent to
  *
  * XML-RPC request to get all pingbacks on a topic
  * <methodCall>
  *     <methodName>pingback.ping</methodName>
  *     <params>
  *         <param><value><string>http://example.com/2008/08/post-tobe-queried/</string></value></param>
  *     </params>
  * </methodCall>
  */
 function pingback_extensions_getPingbacks($args)
 {
     do_action('bb_xmlrpc_call', 'pingback.extensions.getPingbacks');
     $this->escape($args);
     // Don't accept arrays of arguments
     if (is_array($args)) {
         $this->error = new IXR_Error(404, __('The requested method only accepts one parameter.'));
         return $this->error;
     } else {
         $url = (string) $args;
     }
     // Tidy up ampersands in the URI
     $url = str_replace('&amp;', '&', $url);
     $url = str_replace('&', '&amp;', $url);
     // Check if the URI is in our site
     if (!bb_match_domains($url, bb_get_uri())) {
         // These are not the droids you are looking for
         $this->error = new IXR_Error(0, __('The specified target URL is not on this domain.'));
         return $this->error;
     }
     // Make sure the specified URI is in fact associated with a topic
     if (!($topic = bb_get_topic_from_uri($url))) {
         $this->error = new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'));
         return $this->error;
     }
     // Grab the posts from the topic
     $query = new BB_Query('post', array('topic_id' => $topic_to->topic_id, 'append_meta' => true), 'get_thread');
     $posts_to = $query->results;
     unset($query);
     // Check for pingbacks in the post meta data
     $pingbacks = array();
     foreach ($posts_to as $post) {
         if (isset($post->pingback_uri)) {
             $pingbacks[] = $post->pingback_uri;
         }
     }
     unset($post);
     // This will return an empty array on failure
     return $pingbacks;
 }
Ejemplo n.º 22
0
/**
 * Sends an email with the user's new password
 *
 * {@internal Missing Long Description}}
 *
 * @since 0.7.2
 * @global bbdb $bbdb {@internal Not used}}
 *
 * @param int|string $user
 * @param string $pass
 * @return bool
 */
function bb_send_pass($user, $pass)
{
    if (!($user = bb_get_user($user))) {
        return false;
    }
    $message = sprintf(__("Your username is: %1\$s \nYour password is: %2\$s \nYou can now log in: %3\$s \n\nEnjoy!"), $user->user_login, $pass, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT));
    $message = apply_filters('bb_send_pass_message', $message, $user, $pass);
    $subject = sprintf(__('%s: Password'), bb_get_option('name'));
    $subject = apply_filters('bb_send_pass_subject', $subject, $user);
    return bb_mail(bb_get_user_email($user->ID), $subject, $message);
}
Ejemplo n.º 23
0
function bb_die($message, $title = '', $header = 0)
{
    global $bb_locale;
    if ($header && !headers_sent()) {
        status_header($header);
    }
    if (function_exists('is_nxt_error') && is_nxt_error($message)) {
        if (empty($title)) {
            $error_data = $message->get_error_data();
            if (is_array($error_data) && isset($error_data['title'])) {
                $title = $error_data['title'];
            }
        }
        $errors = $message->get_error_messages();
        switch (count($errors)) {
            case 0:
                $message = '';
                break;
            case 1:
                $message = "<p>{$errors[0]}</p>";
                break;
            default:
                $message = "<ul>\n\t\t<li>" . join("</li>\n\t\t<li>", $errors) . "</li>\n\t</ul>";
                break;
        }
    } elseif (is_string($message)) {
        $message = bb_autop($message);
    }
    if (empty($title)) {
        $title = __('bbPress &rsaquo; Error');
    }
    bb_install_header($title);
    ?>
	<?php 
    echo $message;
    if ($uri = bb_get_uri()) {
        ?>
	<p class="last"><?php 
        printf(__('Back to <a href="%s">%s</a>.'), $uri, bb_get_option('name'));
        ?>
</p>
<?php 
    }
    bb_install_footer();
    die;
}
Ejemplo n.º 24
0
 /**
  * Finalises the installation by creating the database and writing all the supplied data to the database.
  *
  * @return void
  **/
 function process_form_finalise_installation()
 {
     require_once BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php';
     require_once BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
     $this->inject_form_values_into_data(2);
     $this->inject_form_values_into_data(3);
     $data2 =& $this->data[2]['form'];
     $data3 =& $this->data[3]['form'];
     $data4 =& $this->data[4]['form'];
     $error_log = array();
     $installation_log = array();
     // Check the referer
     bb_check_admin_referer('bbpress-installer');
     $installation_log[] = __('Referrer is OK, beginning installation&hellip;');
     global $bbdb;
     // Setup user table variables and constants if available
     if ($data2['toggle_2_2']['value']) {
         $installation_log[] = '>>> ' . __('Setting up custom user table constants');
         global $bb;
         global $bb_table_prefix;
         if (!empty($data2['wp_table_prefix']['value'])) {
             $bb->wp_table_prefix = $data2['wp_table_prefix']['value'];
         }
         if (!empty($data2['user_bbdb_name']['value'])) {
             $bb->user_bbdb_name = $data2['user_bbdb_name']['value'];
         }
         if (!empty($data2['user_bbdb_user']['value'])) {
             $bb->user_bbdb_user = $data2['user_bbdb_user']['value'];
         }
         if (!empty($data2['user_bbdb_password']['value'])) {
             $bb->user_bbdb_password = $data2['user_bbdb_password']['value'];
         }
         if (!empty($data2['user_bbdb_host']['value'])) {
             $bb->user_bbdb_host = $data2['user_bbdb_host']['value'];
         }
         if (!empty($data2['user_bbdb_charset']['value'])) {
             $bb->user_bbdb_charset = preg_replace('/[^a-z0-9_-]/i', '', $data2['user_bbdb_charset']['value']);
         }
         if (!empty($data2['user_bbdb_collate']['value'])) {
             $bb->user_bbdb_collate = preg_replace('/[^a-z0-9_-]/i', '', $data2['user_bbdb_collate']['value']);
         }
         bb_set_custom_user_tables();
         // Add custom user database if required
         if (isset($bb->custom_databases['user'])) {
             $bbdb->add_db_server('user', $bb->custom_databases['user']);
         }
         // Add custom tables if required
         if (isset($bb->custom_tables)) {
             $bbdb->tables = array_merge($bbdb->tables, $bb->custom_tables);
             if (is_wp_error($bbdb->set_prefix($bb_table_prefix))) {
                 die(__('Your user table prefix may only contain letters, numbers and underscores.'));
             }
         }
     }
     // Create the database
     $installation_log[] = "\n" . __('Step 1 - Creating database tables');
     if (!$this->database_tables_are_installed()) {
         // Hide db errors
         $bbdb->hide_errors();
         // Install the database
         $alterations = bb_install();
         // Show db errors
         $bbdb->show_errors();
         if (isset($alterations['errors']) && is_array($alterations['errors'])) {
             $error_log = array_merge($error_log, $alterations['errors']);
         }
         if (isset($alterations['messages']) && is_array($alterations['messages'])) {
             $installation_log = array_merge($installation_log, $alterations['messages']);
         }
         if (!$this->database_tables_are_installed()) {
             $installation_log[] = '>>> ' . __('Database installation failed!!!');
             $installation_log[] = '>>>>>> ' . __('Halting installation!');
             $error_log[] = __('Database installation failed!!!');
             $this->step_status[4] = 'incomplete';
             $this->strings[4]['h2'] = __('Installation failed!');
             $this->strings[4]['messages']['error'][] = __('The database failed to install. You may need to replace bbPress with a fresh copy and start again.');
             $data4['installation_log']['value'] = join("\n", $installation_log);
             $data4['error_log']['value'] = join("\n", $error_log);
             return 'incomplete';
         }
     } else {
         $installation_log[] = '>>> ' . __('Database is already installed!!!');
     }
     // Integration settings passed from step 2
     // These are already validated provided that the referer checks out
     $installation_log[] = "\n" . __('Step 2 - WordPress integration (optional)');
     if ($data2['toggle_2_0']['value']) {
         if ($data2['toggle_2_1']['value']) {
             bb_update_option('wp_siteurl', $data2['wp_siteurl']['value']);
             $installation_log[] = '>>> ' . __('WordPress address (URL):') . ' ' . $data2['wp_siteurl']['value'];
             bb_update_option('wp_home', $data2['wp_home']['value']);
             $installation_log[] = '>>> ' . __('Blog address (URL):') . ' ' . $data2['wp_home']['value'];
             $config_result = $this->write_lines_to_file(BB_PATH . 'bb-config.php', false, array("define( 'BB_AUTH_KEY" => array("'" . BB_AUTH_KEY . "'", "'" . $data2['wp_auth_key']['value'] . "'"), "define( 'BB_SECURE_A" => array("'" . BB_SECURE_AUTH_KEY . "'", "'" . $data2['wp_secure_auth_key']['value'] . "'"), "define( 'BB_LOGGED_I" => array("'" . BB_LOGGED_IN_KEY . "'", "'" . $data2['wp_logged_in_key']['value'] . "'")));
             switch ($config_result) {
                 case 1:
                     $installation_log[] = '>>> ' . __('WordPress cookie keys set.');
                     break;
                 default:
                     $error_log[] = '>>> ' . __('WordPress cookie keys not set.');
                     $error_log[] = '>>>>>> ' . __('Your "bb-config.php" file was not writable.');
                     $error_log[] = '>>>>>> ' . __('You will need to manually re-define "BB_AUTH_KEY", "BB_SECURE_AUTH_KEY" and "BB_LOGGED_IN_KEY" in your "bb-config.php" file.');
                     $installation_log[] = '>>> ' . __('WordPress cookie keys not set.');
                     break;
             }
             if (!empty($data2['wp_auth_salt']['value'])) {
                 bb_update_option('bb_auth_salt', $data2['wp_auth_salt']['value']);
                 $installation_log[] = '>>> ' . __('WordPress "auth" cookie salt set from input.');
             }
             if (!empty($data2['wp_secure_auth_salt']['value'])) {
                 bb_update_option('bb_secure_auth_salt', $data2['wp_secure_auth_salt']['value']);
                 $installation_log[] = '>>> ' . __('WordPress "secure auth" cookie salt set from input.');
             }
             if (!empty($data2['wp_logged_in_salt']['value'])) {
                 bb_update_option('bb_logged_in_salt', $data2['wp_logged_in_salt']['value']);
                 $installation_log[] = '>>> ' . __('WordPress "logged in" cookie salt set from input.');
             }
         }
         if ($data2['toggle_2_2']['value']) {
             if (!bb_get_option('bb_auth_salt') || !bb_get_option('bb_secure_auth_salt') || !bb_get_option('bb_logged_in_salt')) {
                 $installation_log[] = '>>> ' . __('Fetching missing WordPress cookie salts.');
                 $_prefix = $bb->wp_table_prefix;
                 if (!empty($data2['wordpress_mu_primary_blog_id']['value'])) {
                     $_prefix .= $data2['wordpress_mu_primary_blog_id']['value'] . '_';
                 }
                 if (isset($bb->custom_databases['user'])) {
                     $bbdb->tables['options'] = array('user', $_prefix . 'options');
                 } else {
                     $bbdb->tables['options'] = $_prefix . 'options';
                 }
                 unset($_prefix);
                 $bbdb->set_prefix($bb_table_prefix);
                 if (!bb_get_option('bb_auth_salt')) {
                     $wp_auth_salt = $bbdb->get_var("SELECT `option_value` FROM {$bbdb->options} WHERE `option_name` = 'auth_salt' LIMIT 1");
                     if ($wp_auth_salt) {
                         bb_update_option('bb_auth_salt', $wp_auth_salt);
                         $installation_log[] = '>>>>>> ' . __('WordPress "auth" cookie salt set.');
                     } else {
                         $error_log[] = '>>> ' . __('WordPress "auth" cookie salt not set.');
                         $error_log[] = '>>>>>> ' . __('Could not fetch "auth" cookie salt from the WordPress options table.');
                         $error_log[] = '>>>>>> ' . __('You will need to manually define the "auth" cookie salt in your database.');
                         $installation_log[] = '>>>>>> ' . __('WordPress "auth" cookie salt not set.');
                     }
                 }
                 if (!bb_get_option('bb_secure_auth_salt')) {
                     $wp_secure_auth_salt = $bbdb->get_var("SELECT `option_value` FROM {$bbdb->options} WHERE `option_name` = 'secure_auth_salt' LIMIT 1");
                     if ($wp_secure_auth_salt) {
                         bb_update_option('bb_secure_auth_salt', $wp_secure_auth_salt);
                         $installation_log[] = '>>>>>> ' . __('WordPress "secure auth" cookie salt set.');
                     } else {
                         // This cookie salt is sometimes empty so don't error
                         $installation_log[] = '>>>>>> ' . __('WordPress "secure auth" cookie salt not set.');
                     }
                 }
                 if (!bb_get_option('bb_logged_in_salt')) {
                     $wp_logged_in_salt = $bbdb->get_var("SELECT `option_value` FROM {$bbdb->options} WHERE `option_name` = 'logged_in_salt' LIMIT 1");
                     if ($wp_logged_in_salt) {
                         bb_update_option('bb_logged_in_salt', $wp_logged_in_salt);
                         $installation_log[] = '>>>>>> ' . __('WordPress "logged in" cookie salt set.');
                     } else {
                         $error_log[] = '>>> ' . __('WordPress "logged in" cookie salt not set.');
                         $error_log[] = '>>>>>> ' . __('Could not fetch "logged in" cookie salt from the WordPress options table.');
                         $error_log[] = '>>>>>> ' . __('You will need to manually define the "logged in" cookie salt in your database.');
                         $installation_log[] = '>>>>>> ' . __('WordPress "logged in" cookie salt not set.');
                     }
                 }
             }
             if (!empty($data2['wp_table_prefix']['value'])) {
                 bb_update_option('wp_table_prefix', $data2['wp_table_prefix']['value']);
                 $installation_log[] = '>>> ' . __('User database table prefix:') . ' ' . $data2['wp_table_prefix']['value'];
             }
             if (!empty($data2['wordpress_mu_primary_blog_id']['value'])) {
                 bb_update_option('wordpress_mu_primary_blog_id', $data2['wordpress_mu_primary_blog_id']['value']);
                 $installation_log[] = '>>> ' . __('WordPress MU primary blog ID:') . ' ' . $data2['wordpress_mu_primary_blog_id']['value'];
             }
             if ($data2['toggle_2_3']['value']) {
                 if (!empty($data2['user_bbdb_name']['value'])) {
                     bb_update_option('user_bbdb_name', $data2['user_bbdb_name']['value']);
                     $installation_log[] = '>>> ' . __('User database name:') . ' ' . $data2['user_bbdb_name']['value'];
                 }
                 if (!empty($data2['user_bbdb_user']['value'])) {
                     bb_update_option('user_bbdb_user', $data2['user_bbdb_user']['value']);
                     $installation_log[] = '>>> ' . __('User database user:'******' ' . $data2['user_bbdb_user']['value'];
                 }
                 if (!empty($data2['user_bbdb_password']['value'])) {
                     bb_update_option('user_bbdb_password', $data2['user_bbdb_password']['value']);
                     $installation_log[] = '>>> ' . __('User database password:'******' ' . $data2['user_bbdb_password']['value'];
                 }
                 if (!empty($data2['user_bbdb_host']['value'])) {
                     bb_update_option('user_bbdb_host', $data2['user_bbdb_host']['value']);
                     $installation_log[] = '>>> ' . __('User database host:') . ' ' . $data2['user_bbdb_host']['value'];
                 }
                 if (!empty($data2['user_bbdb_charset']['value'])) {
                     bb_update_option('user_bbdb_charset', $data2['user_bbdb_charset']['value']);
                     $installation_log[] = '>>> ' . __('User database character set:') . ' ' . $data2['user_bbdb_charset']['value'];
                 }
                 if (!empty($data2['user_bbdb_collate']['value'])) {
                     bb_update_option('user_bbdb_collate', $data2['user_bbdb_collate']['value']);
                     $installation_log[] = '>>> ' . __('User database collation:') . ' ' . $data2['user_bbdb_collate']['value'];
                 }
                 if (!empty($data2['custom_user_table']['value'])) {
                     bb_update_option('custom_user_table', $data2['custom_user_table']['value']);
                     $installation_log[] = '>>> ' . __('User database "user" table:') . ' ' . $data2['custom_user_table']['value'];
                 }
                 if (!empty($data2['custom_user_meta_table']['value'])) {
                     bb_update_option('custom_user_meta_table', $data2['custom_user_meta_table']['value']);
                     $installation_log[] = '>>> ' . __('User database "user meta" table:') . ' ' . $data2['custom_user_meta_table']['value'];
                 }
             }
         }
     } else {
         $installation_log[] = '>>> ' . __('Integration not enabled');
     }
     // Site settings passed from step 3
     // These are already validated provided that the referer checks out
     $installation_log[] = "\n" . __('Step 3 - Site settings');
     bb_update_option('name', $data3['name']['value']);
     $installation_log[] = '>>> ' . __('Site name:') . ' ' . $data3['name']['value'];
     bb_update_option('uri', $data3['uri']['value']);
     $installation_log[] = '>>> ' . __('Site address (URL):') . ' ' . $data3['uri']['value'];
     bb_update_option('from_email', $data3['keymaster_user_email']['value']);
     $installation_log[] = '>>> ' . __('From email address:') . ' ' . $data3['keymaster_user_email']['value'];
     // Create the key master
     $keymaster_created = false;
     switch ($data3['keymaster_user_type']['value']) {
         case 'new':
             // Check to see if the user login already exists
             if ($keymaster_user = bb_get_user($data3['keymaster_user_login']['value'], array('by' => 'login'))) {
                 // The keymaster is an existing bbPress user
                 $installation_log[] = '>>> ' . __('Key master could not be created!');
                 $installation_log[] = '>>>>>> ' . __('That login is already taken!');
                 $error_log[] = __('Key master could not be created!');
                 if ($keymaster_user->bb_capabilities['keymaster']) {
                     // The existing user is a key master - continue
                     $bb_current_user = bb_set_current_user($keymaster_user->ID);
                     $installation_log[] = '>>>>>> ' . __('Existing key master entered!');
                     $data4['keymaster_user_password']['value'] = __('Your bbPress password');
                     $data3['keymaster_user_email']['value'] = $keymaster_user->user_email;
                     bb_update_option('from_email', $keymaster_user->user_email);
                     $installation_log[] = '>>>>>> ' . __('Re-setting admin email address.');
                     $keymaster_created = true;
                 } else {
                     // The existing user is a non-key master user - halt installation
                     $installation_log[] = '>>>>>> ' . __('Existing user without key master role entered!');
                     $installation_log[] = '>>>>>>>>> ' . __('Halting installation!');
                     $this->step_status[4] = 'incomplete';
                     $this->strings[4]['h2'] = __('Installation failed!');
                     $this->strings[4]['messages']['error'][] = __('The key master could not be created. An existing user was found with that user login.');
                     $data4['installation_log']['value'] = join("\n", $installation_log);
                     $data4['error_log']['value'] = join("\n", $error_log);
                     return 'incomplete';
                 }
                 break;
             }
             // Helper function to let us know the password that was created
             global $keymaster_password;
             function bb_get_keymaster_password($user_id, $pass)
             {
                 global $keymaster_password;
                 $keymaster_password = $pass;
             }
             add_action('bb_new_user', 'bb_get_keymaster_password', 10, 2);
             // Create the new user (automattically given key master role when BB_INSTALLING is true)
             if ($keymaster_user_id = bb_new_user($data3['keymaster_user_login']['value'], $data3['keymaster_user_email']['value'], '')) {
                 $bb_current_user = bb_set_current_user($keymaster_user_id);
                 $data4['keymaster_user_password']['value'] = $keymaster_password;
                 $installation_log[] = '>>> ' . __('Key master created');
                 $installation_log[] = '>>>>>> ' . __('Username:'******' ' . $data3['keymaster_user_login']['value'];
                 $installation_log[] = '>>>>>> ' . __('Email address:') . ' ' . $data3['keymaster_user_email']['value'];
                 $installation_log[] = '>>>>>> ' . __('Password:'******' ' . $data4['keymaster_user_password']['value'];
                 $keymaster_created = true;
             } else {
                 $installation_log[] = '>>> ' . __('Key master could not be created!');
                 $installation_log[] = '>>>>>> ' . __('Halting installation!');
                 $error_log[] = __('Key master could not be created!');
                 $this->step_status[4] = 'incomplete';
                 $this->strings[4]['h2'] = __('Installation failed!');
                 $this->strings[4]['messages']['error'][] = __('The key master could not be created. You may need to replace bbPress with a fresh copy and start again.');
                 $data4['installation_log']['value'] = join("\n", $installation_log);
                 $data4['error_log']['value'] = join("\n", $error_log);
                 return 'incomplete';
             }
             break;
         case 'old':
             if ($keymaster_user = bb_get_user($data3['keymaster_user_login']['value'], array('by' => 'login'))) {
                 // The keymaster is an existing bbPress or WordPress user
                 $bb_current_user = bb_set_current_user($keymaster_user->ID);
                 $bb_current_user->set_role('keymaster');
                 $data4['keymaster_user_password']['value'] = __('Your existing password');
                 $installation_log[] = '>>> ' . __('Key master role assigned to existing user');
                 $installation_log[] = '>>>>>> ' . __('Username:'******' ' . $data3['keymaster_user_login']['value'];
                 $installation_log[] = '>>>>>> ' . __('Email address:') . ' ' . $data3['keymaster_user_email']['value'];
                 $installation_log[] = '>>>>>> ' . __('Password:'******' ' . $data4['keymaster_user_password']['value'];
                 $keymaster_created = true;
             } else {
                 $installation_log[] = '>>> ' . __('Key master role could not be assigned to existing user!');
                 $installation_log[] = '>>>>>> ' . __('Halting installation!');
                 $error_log[] = __('Key master could not be created!');
                 $this->step_status[4] = 'incomplete';
                 $this->strings[4]['h2'] = __('Installation failed!');
                 $this->strings[4]['messages']['error'][] = __('The key master could not be assigned. You may need to replace bbPress with a fresh copy and start again.');
                 $data4['installation_log']['value'] = join("\n", $installation_log);
                 $data4['error_log']['value'] = join("\n", $error_log);
                 return 'incomplete';
             }
             break;
     }
     // Don't create an initial forum if any forums already exist
     if (!$bbdb->get_results('SELECT `forum_id` FROM `' . $bbdb->forums . '` LIMIT 1;')) {
         if ($this->language != BB_LANG) {
             global $locale, $l10n;
             $locale = BB_LANG;
             unset($l10n['default']);
             bb_load_default_textdomain();
         }
         $description = __('Just another bbPress community');
         bb_update_option('description', $description);
         if ($this->language != BB_LANG) {
             $locale = $this->language;
             unset($l10n['default']);
             bb_load_default_textdomain();
         }
         $installation_log[] = '>>> ' . __('Description:') . ' ' . $description;
         if ($forum_id = bb_new_forum(array('forum_name' => $data3['forum_name']['value']))) {
             $installation_log[] = '>>> ' . __('Forum name:') . ' ' . $data3['forum_name']['value'];
             if ($this->language != BB_LANG) {
                 $locale = BB_LANG;
                 unset($l10n['default']);
                 bb_load_default_textdomain();
             }
             $topic_title = __('Your first topic');
             $topic_id = bb_insert_topic(array('topic_title' => $topic_title, 'forum_id' => $forum_id, 'tags' => 'bbPress'));
             $post_text = __('First Post!  w00t.');
             bb_insert_post(array('topic_id' => $topic_id, 'post_text' => $post_text));
             if ($this->language != BB_LANG) {
                 $locale = $this->language;
                 unset($l10n['default']);
                 bb_load_default_textdomain();
             }
             $installation_log[] = '>>>>>> ' . __('Topic:') . ' ' . $topic_title;
             $installation_log[] = '>>>>>>>>> ' . __('Post:') . ' ' . $post_text;
         } else {
             $installation_log[] = '>>> ' . __('Forum could not be created!');
             $error_log[] = __('Forum could not be created!');
         }
     } else {
         $installation_log[] = '>>> ' . __('There are existing forums in this database.');
         $installation_log[] = '>>>>>> ' . __('No new forum created.');
         $error_log[] = __('Forums already exist!');
     }
     if (defined('BB_PLUGIN_DIR') && BB_PLUGIN_DIR && !file_exists(BB_PLUGIN_DIR)) {
         // Just suppress errors as this is not critical
         if (@mkdir(BB_PLUGIN_DIR, 0750)) {
             $installation_log[] = '>>> ' . sprintf(__('Making plugin directory at %s.'), BB_PLUGIN_DIR);
         }
     }
     if (defined('BB_THEME_DIR') && BB_THEME_DIR && !file_exists(BB_THEME_DIR)) {
         // Just suppress errors as this is not critical
         if (@mkdir(BB_THEME_DIR, 0750)) {
             $installation_log[] = '>>> ' . sprintf(__('Making theme directory at %s.'), BB_THEME_DIR);
         }
     }
     if ($keymaster_created) {
         $keymaster_email_message = sprintf(__("Your new bbPress site has been successfully set up at:\n\n%1\$s\n\nYou can log in to the key master account with the following information:\n\nUsername: %2\$s\nPassword: %3\$s\n\nWe hope you enjoy your new forums. Thanks!\n\n--The bbPress Team\nhttp://bbpress.org/"), bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), $data3['keymaster_user_login']['value'], $data4['keymaster_user_password']['value']);
         if (bb_mail($data3['keymaster_user_email']['value'], __('New bbPress installation'), $keymaster_email_message)) {
             $installation_log[] = '>>> ' . __('Key master email sent');
         } else {
             $installation_log[] = '>>> ' . __('Key master email not sent!');
             $error_log[] = __('Key master email not sent!');
         }
     }
     if (count($error_log)) {
         $this->strings[4]['h2'] = __('Installation completed with some errors!');
         $this->strings[4]['messages']['error'][] = __('Your installation completed with some minor errors. See the error log below for more specific information.');
         $installation_log[] = "\n" . __('There were some errors encountered during installation!');
     } else {
         $this->strings[4]['messages']['message'][] = __('Your installation completed successfully.');
         $installation_log[] = "\n" . __('Installation complete!');
     }
     $this->step_status[4] = 'complete';
     $data4['installation_log']['value'] = join("\n", $installation_log);
     $data4['error_log']['value'] = join("\n", $error_log);
     return 'complete';
 }
Ejemplo n.º 25
0
<?php

require_once 'admin.php';
if (!bb_current_user_can('manage_forums')) {
    bb_die(__("You don't have the authority to mess with the forums."));
}
if (!isset($_POST['action'])) {
    nxt_redirect(bb_get_uri('bb-admin/forums.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN));
    exit;
}
$sent_from = nxt_get_referer();
switch ($_POST['action']) {
    case 'add':
        if (!isset($_POST['forum_name']) || '' === $_POST['forum_name']) {
            bb_die(__('Bad forum name.  Go back and try again.'));
        }
        bb_check_admin_referer('add-forum');
        if (false !== bb_new_forum($_POST)) {
            bb_safe_redirect($sent_from);
            exit;
        } else {
            bb_die(__('The forum was not added'));
        }
        break;
    case 'update':
        bb_check_admin_referer('update-forum');
        if (!($forums = bb_get_forums())) {
            bb_die(__('No forums to update!'));
        }
        if ((int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name']) {
            bb_update_forum($_POST);
Ejemplo n.º 26
0
<?php

require 'admin.php';
if (!bb_current_user_can('manage_tags')) {
    bb_die(__('You are not allowed to manage tags.'));
}
$tag_id = (int) $_POST['id'];
bb_check_admin_referer('destroy-tag_' . $tag_id);
$old_tag = bb_get_tag($tag_id);
if (!$old_tag) {
    bb_die(__('Tag not found.'));
}
if ($destroyed = bb_destroy_tag($tag_id)) {
    printf(__("Rows deleted from tags table: %d <br />\n"), $destroyed['tags']);
    printf(__("Rows deleted from tagged table: %d <br />\n"), $destroyed['tagged']);
    printf(__('<a href="%s">Home</a>'), bb_get_uri());
} else {
    die(printf(__("Something odd happened when attempting to destroy that tag.<br />\n<a href=\"%s\">Try Again?</a>"), wp_get_referer()));
}
Ejemplo n.º 27
0
<?php

require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
if (!$topic) {
    bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('close_topic', $topic_id)) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('close-topic_' . $topic_id);
if (topic_is_open($topic_id)) {
    bb_close_topic($topic_id);
    $message = 'closed';
} else {
    bb_open_topic($topic_id);
    $message = 'opened';
}
if ($sendto = nxt_get_referer()) {
    $sendto = remove_query_arg('message', $sendto);
    $sendto = add_query_arg('message', $message, $sendto);
} else {
    $sendto = get_topic_link($topic_id);
}
bb_safe_redirect($sendto);
exit;
Ejemplo n.º 28
0
            }
            $posts = array();
            foreach ($topics as $topic) {
                $posts[] = bb_get_first_post($topic->topic_id);
            }
            $title = esc_html(sprintf(__('%1$s &raquo; Recent Topics'), bb_get_option('name')));
            $link = bb_get_uri();
            $link_self = bb_get_topics_rss_link();
            break;
            // Get latest posts by default
        // Get latest posts by default
        case 'all-posts':
        default:
            if (!($posts = bb_get_latest_posts(35))) {
                die;
            }
            $title = esc_html(sprintf(__('%1$s &raquo; Recent Posts'), bb_get_option('name')));
            $link = bb_get_uri();
            $link_self = bb_get_posts_rss_link();
            break;
    }
}
bb_send_304($posts[0]->post_time);
if (!($description = esc_html(bb_get_option('description')))) {
    $description = $title;
}
$title = apply_filters('bb_title_rss', $title, $feed);
$description = apply_filters('bb_description_rss', $description, $feed);
$posts = apply_filters('bb_posts_rss', $posts, $feed);
$link_self = apply_filters('bb_link_self_rss', $link_self, $feed);
bb_load_template('rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed);
Ejemplo n.º 29
0
        ?>
</span>
								<textarea id="upgrade_log" class="short"><?php 
        echo join("\n", $upgrade_log);
        ?>
</textarea>
							</label>
						</fieldset>
					</div>
					<fieldset class="buttons">
						<label for="upgrade_next" class="back">
							<input class="button" id="upgrade_back" type="button" value="<?php 
        _e('&laquo; Go back to forums');
        ?>
" onclick="location.href='<?php 
        echo esc_js(bb_get_uri());
        ?>
'; return false;" />
						</label>
						<label for="upgrade_next" class="forward">
							<input class="button" id="upgrade_next" type="submit" value="<?php 
        _e('Try again');
        ?>
" />
						</label>
					</fieldset>
				</form>
			</div>
		</div>
<?php 
        break;
Ejemplo n.º 30
0
<form class="login" method="post" action="<?php 
bb_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS);
?>
">
		<?php 
printf(__('<div class="header-button ask-link"><a href="%2$s">Ask a Question</a></div>'), bb_get_uri('register.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS), bb_get_uri('bb-login.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_USER_FORMS));
?>
</form>