Changeset 1575
- Timestamp:
- 07/02/08 14:53:07 (5 months ago)
- Files:
-
- trunk/bb-admin/admin-functions.php (modified) (3 diffs)
- trunk/bb-admin/admin-header.php (modified) (3 diffs)
- trunk/bb-admin/bb-forum.php (modified) (1 diff)
- trunk/bb-admin/class-install.php (modified) (2 diffs)
- trunk/bb-admin/content-forums.php (modified) (3 diffs)
- trunk/bb-admin/delete-post.php (modified) (1 diff)
- trunk/bb-admin/delete-topic.php (modified) (1 diff)
- trunk/bb-admin/options-general.php (modified) (1 diff)
- trunk/bb-admin/options-wordpress.php (modified) (2 diffs)
- trunk/bb-admin/plugins.php (modified) (1 diff)
- trunk/bb-admin/rewrite-rules.php (modified) (1 diff)
- trunk/bb-admin/site.php (modified) (1 diff)
- trunk/bb-admin/sticky.php (modified) (1 diff)
- trunk/bb-admin/tag-destroy.php (modified) (1 diff)
- trunk/bb-admin/themes.php (modified) (3 diffs)
- trunk/bb-admin/topic-move.php (modified) (1 diff)
- trunk/bb-admin/topic-toggle.php (modified) (1 diff)
- trunk/bb-admin/upgrade.php (modified) (2 diffs)
- trunk/bb-admin/view-ip.php (modified) (1 diff)
- trunk/bb-edit.php (modified) (2 diffs)
- trunk/bb-includes/default-filters.php (modified) (1 diff)
- trunk/bb-includes/deprecated.php (modified) (3 diffs)
- trunk/bb-includes/functions.php (modified) (7 diffs)
- trunk/bb-includes/pluggable.php (modified) (3 diffs)
- trunk/bb-includes/registration-functions.php (modified) (2 diffs)
- trunk/bb-includes/script-loader.php (modified) (1 diff)
- trunk/bb-includes/template-functions.php (modified) (42 diffs)
- trunk/bb-login.php (modified) (1 diff)
- trunk/bb-plugins/akismet.php (modified) (5 diffs)
- trunk/bb-post.php (modified) (1 diff)
- trunk/bb-settings.php (modified) (2 diffs)
- trunk/bb-templates/kakumei/edit-post.php (modified) (1 diff)
- trunk/bb-templates/kakumei/favorites.php (modified) (1 diff)
- trunk/bb-templates/kakumei/forum.php (modified) (2 diffs)
- trunk/bb-templates/kakumei/front-page.php (modified) (1 diff)
- trunk/bb-templates/kakumei/header.php (modified) (1 diff)
- trunk/bb-templates/kakumei/login-form.php (modified) (1 diff)
- trunk/bb-templates/kakumei/login.php (modified) (3 diffs)
- trunk/bb-templates/kakumei/password-reset.php (modified) (1 diff)
- trunk/bb-templates/kakumei/profile-base.php (modified) (1 diff)
- trunk/bb-templates/kakumei/profile-edit.php (modified) (1 diff)
- trunk/bb-templates/kakumei/profile.php (modified) (1 diff)
- trunk/bb-templates/kakumei/register-success.php (modified) (1 diff)
- trunk/bb-templates/kakumei/register.php (modified) (1 diff)
- trunk/bb-templates/kakumei/rss2.php (modified) (2 diffs)
- trunk/bb-templates/kakumei/search-form.php (modified) (1 diff)
- trunk/bb-templates/kakumei/search.php (modified) (2 diffs)
- trunk/bb-templates/kakumei/stats.php (modified) (1 diff)
- trunk/bb-templates/kakumei/tag-single.php (modified) (1 diff)
- trunk/bb-templates/kakumei/tags.php (modified) (1 diff)
- trunk/bb-templates/kakumei/topic.php (modified) (1 diff)
- trunk/bb-templates/kakumei/view.php (modified) (1 diff)
- trunk/edit.php (modified) (1 diff)
- trunk/favorites.php (modified) (1 diff)
- trunk/profile-edit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bb-admin/admin-functions.php
r1546 r1575 168 168 endif; 169 169 if ( $bb_current_submenu && !bb_current_user_can( $bb_current_submenu[1] ) || !bb_current_user_can( $bb_current_menu[1] ) ) { 170 wp_redirect( bb_get_ option( 'uri') );170 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 171 171 exit(); 172 172 } … … 644 644 $r .= "\t\t\t<div class='alignright'>\n"; 645 645 if ( bb_current_user_can( 'manage_forums' ) ) 646 $r .= "\t\t\t\t<a class='edit' href='" . attribute_escape( bb_get_ option('uri') . "bb-admin/content-forums.php?action=edit&id=$_forum->forum_id") . "'>" . __('Edit') . "</a>\n";646 $r .= "\t\t\t\t<a class='edit' href='" . attribute_escape( bb_get_uri('bb-admin/content-forums.php', array('action' => 'edit', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ) . "'>" . __('Edit') . "</a>\n"; 647 647 if ( bb_current_user_can( 'delete_forum', $_forum->forum_id ) && 1 < $forums_count ) 648 $r .= "\t\t\t\t<a class='delete' href='" . attribute_escape( bb_get_ option('uri') . "bb-admin/content-forums.php?action=delete&id=$_forum->forum_id") . "'>" . __('Delete') . "</a>\n";648 $r .= "\t\t\t\t<a class='delete' href='" . attribute_escape( bb_get_uri('bb-admin/content-forums.php', array('action' => 'delete', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ) . "'>" . __('Delete') . "</a>\n"; 649 649 $r .= "\t\t\t</div>\n"; 650 650 $r .= "\t\t\t" . get_forum_name( $_forum->forum_id ) . ' — ' . get_forum_description( $_forum->forum_id ) . "\n\t\t</div>\n"; … … 663 663 $action = $forum_id ? 'update' : 'add'; 664 664 ?> 665 <form method="post" id="<?php echo $action; ?>-forum" action="<?php bb_ option('uri'); ?>bb-admin/bb-forum.php">665 <form method="post" id="<?php echo $action; ?>-forum" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 666 666 <fieldset> 667 667 <table><col /><col style="width: 80%" /> trunk/bb-admin/admin-header.php
r1367 r1575 4 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 5 <title><?php bb_admin_title() ?></title> 6 <link rel="stylesheet" href="<?php bb_ option('uri'); ?>bb-admin/style.css" type="text/css" />6 <link rel="stylesheet" href="<?php bb_uri('bb-admin/style.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_ADMIN); ?>" type="text/css" /> 7 7 <?php if ( 'rtl' == bb_get_option( 'text_direction' ) ) : ?> 8 <link rel="stylesheet" href="<?php bb_ option('uri'); ?>bb-admin/style-rtl.css" type="text/css" />8 <link rel="stylesheet" href="<?php bb_uri('bb-admin/style-rtl.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_ADMIN); ?>" type="text/css" /> 9 9 <?php endif; do_action('bb_admin_print_scripts'); do_action( 'bb_admin_head' ); ?> 10 10 </head> … … 18 18 </h1> 19 19 <div id="bbVisitSite"> 20 <a href="<?php bb_ option('uri'); ?>"><span><?php _e('Visit Site'); ?></span></a>20 <a href="<?php bb_uri(); ?>"><span><?php _e('Visit Site'); ?></span></a> 21 21 </div> 22 22 </div> … … 25 25 <?php printf( __('Howdy, %1$s!'), bb_get_profile_link( array( 'text' => bb_get_current_user_info( 'name' ) ) ) );?> 26 26 | <?php bb_logout_link(); ?> 27 | <a href="http://bbpress.org/forums/"> Forums</a>27 | <a href="http://bbpress.org/forums/">Support forums</a> 28 28 </p> 29 29 </div> trunk/bb-admin/bb-forum.php
r1285 r1575 6 6 7 7 if ( !isset($_POST['action']) ) 8 wp_redirect( bb_get_ option( 'uri' ) . 'bb-admin/content-forums.php');8 wp_redirect( bb_get_uri('bb-admin/content-forums.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN) ); 9 9 10 10 $sent_from = wp_get_referer(); trunk/bb-admin/class-install.php
r1574 r1575 503 503 // The database needs upgrading 504 504 $this->strings[-1]['messages'][0][] = __('bbPress is already installed, but appears to require an upgrade.'); 505 $this->strings[-1]['messages'][0][] = sprintf(__('Perhaps you meant to run the <a href="%s">upgrade script</a> instead?'), bb_get_option('uri') . 'bb-admin/upgrade.php'); 505 $this->strings[-1]['messages'][0][] = sprintf( 506 __('Perhaps you meant to run the <a href="%s">upgrade script</a> instead?'), 507 bb_get_uri('bb-admin/upgrade.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) 508 ); 506 509 $this->step = -1; 507 510 } else { 508 511 // Redirect to the base url 509 bb_safe_redirect(bb_get_ option('uri'));512 bb_safe_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER)); 510 513 die(); 511 514 } … … 1881 1884 $keymaster_email_message = sprintf( 1882 1885 __("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/"), 1883 bb_get_ option( 'uri'),1886 bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), 1884 1887 $data3['keymaster_user_login']['value'], 1885 1888 $data4['keymaster_user_password']['value'] trunk/bb-admin/content-forums.php
r1385 r1575 18 18 break; 19 19 case 'deleted' : 20 bb_admin_notice( sprintf(__('Forum deleted. You should have bbPress <a href="%s">recount your site information</a>.'), bb_get_option( 'uri' ) . 'bb-admin/site.php') ); 20 bb_admin_notice( sprintf( 21 __('Forum deleted. You should have bbPress <a href="%s">recount your site information</a>.'), 22 bb_get_uri('bb-admin/site.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) 23 ) ); 21 24 break; 22 25 endswitch; … … 45 48 </ul> 46 49 47 <form method="post" id="delete-forums" action="<?php bb_ option('uri'); ?>bb-admin/bb-forum.php">50 <form method="post" id="delete-forums" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 48 51 <p> 49 52 <label for="move-topics-delete"><input type="radio" name="move_topics" id="move-topics-delete" value="delete" /> <?php _e('Delete all topics and posts in this forum. <em>This can never be undone.</em>'); ?></label><br /> … … 58 61 <?php bb_nonce_field( 'delete-forums' ); ?> 59 62 </form> 60 <form method="get" action="<?php bb_ option('uri'); ?>bb-admin/bb-forum.php">63 <form method="get" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 61 64 <p class="submit alignleft"> 62 65 <input type="submit" value="<?php _e('« Go back'); ?>" tabindex="10" /> trunk/bb-admin/delete-post.php
r1285 r1575 5 5 6 6 if ( !bb_current_user_can( 'delete_post', $post_id ) ) { 7 wp_redirect( bb_get_ option( 'uri') );7 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 8 8 exit(); 9 9 } trunk/bb-admin/delete-topic.php
r728 r1575 5 5 6 6 if ( !bb_current_user_can( 'delete_topic', $topic_id ) ) { 7 wp_redirect( bb_get_ option( 'uri') );7 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 8 8 exit(); 9 9 } trunk/bb-admin/options-general.php
r1504 r1575 43 43 <h2><?php _e('General Settings'); ?></h2> 44 44 45 <form class="settings" method="post" action="<?php bb_ option('uri'); ?>bb-admin/options-general.php">45 <form class="settings" method="post" action="<?php bb_uri('bb-admin/options-general.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 46 46 <fieldset> 47 47 <div> trunk/bb-admin/options-wordpress.php
r1507 r1575 61 61 </p> 62 62 63 <form class="settings" method="post" action="<?php bb_ option('uri'); ?>bb-admin/options-wordpress.php">63 <form class="settings" method="post" action="<?php bb_uri('bb-admin/options-wordpress.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 64 64 <fieldset> 65 65 <legend><?php _e('Cookies'); ?></legend> … … 317 317 $wpRolesMap = bb_get_option('wp_roles_map'); 318 318 ?> 319 <form class="settings" method="post" action="<?php bb_ option('uri'); ?>bb-admin/options-wordpress.php">319 <form class="settings" method="post" action="<?php bb_uri('bb-admin/options-wordpress.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 320 320 <fieldset> 321 321 <?php trunk/bb-admin/plugins.php
r1299 r1575 143 143 $href = attribute_escape( 144 144 bb_nonce_url( 145 add_query_arg( 145 bb_get_uri( 146 'bb-admin/plugins.php', 146 147 array( 147 148 'action' => $action, 148 149 'plugin' => urlencode($plugin) 149 150 ), 150 bb_get_option( 'uri' ) . 'bb-admin/plugins.php'151 BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN 151 152 ), 152 153 $action . '-plugin_' . $plugin trunk/bb-admin/rewrite-rules.php
r1045 r1575 5 5 6 6 if ( !bb_current_user_can('manage_options') ) { 7 wp_redirect( bb_get_ option( 'uri') );7 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 8 8 exit(); 9 9 } trunk/bb-admin/site.php
r1325 r1575 11 11 pagination oddities.") ?></p> 12 12 13 <form method="post" action="<?php bb_ option('uri'); ?>bb-admin/bb-do-counts.php">13 <form method="post" action="<?php bb_uri('bb-admin/bb-do-counts.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 14 14 <fieldset> 15 15 <legend><?php _e('Choose items to recalculate') ?></legend> trunk/bb-admin/sticky.php
r1287 r1575 10 10 11 11 if ( !bb_current_user_can( 'stick_topic', $topic_id ) ) { 12 wp_redirect( bb_get_ option( 'uri') );12 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 13 13 exit(); 14 14 } trunk/bb-admin/tag-destroy.php
r1140 r1575 16 16 printf(__("Rows deleted from tags table: %d <br />\n"), $destroyed['tags']); 17 17 printf(__("Rows deleted from tagged table: %d <br />\n"), $destroyed['tagged']); 18 printf(__('<a href="%s">Home</a>'), bb_get_ option( 'uri'));18 printf(__('<a href="%s">Home</a>'), bb_get_uri()); 19 19 } else { 20 20 die(printf(__("Something odd happened when attempting to destroy that tag.<br />\n<a href=\"%s\">Try Again?</a>"), wp_get_referer())); trunk/bb-admin/themes.php
r1556 r1575 11 11 if ( isset($_GET['theme']) ) { 12 12 if ( !bb_current_user_can( 'manage_themes' ) ) { 13 wp_redirect( bb_get_ option( 'uri') );13 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 14 14 exit; 15 15 } … … 31 31 } 32 32 do_action( 'bb_activate_theme_' . $theme ); 33 wp_redirect( bb_get_ option( 'uri' ) . 'bb-admin/themes.php?activated&name=' . urlencode($name) );33 wp_redirect( bb_get_uri('bb-admin/themes.php', array('activated' => 1, 'name' => $name ), BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN ) ); 34 34 exit; 35 35 } … … 53 53 $theme_data = file_exists( $theme_directory . 'style.css' ) ? bb_get_theme_data( $theme ) : false; 54 54 $screen_shot = file_exists( $theme_directory . 'screenshot.png' ) ? clean_url( bb_get_theme_uri( $theme ) . 'screenshot.png' ) : false; 55 $activation_url = clean_url( bb_nonce_url( add_query_arg( 'theme', urlencode($theme), bb_get_option( 'uri' ) . 'bb-admin/themes.php' ), 'switch-theme' ) ); 55 $activation_url = bb_get_uri('bb-admin/themes.php', array('theme' => $theme), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN); 56 $activation_url = clean_url( bb_nonce_url( $activation_url, 'switch-theme' ) ); 56 57 ?> 57 58 <li<?php alt_class( 'theme', $class ); ?>> trunk/bb-admin/topic-move.php
r1285 r1575 9 9 10 10 if ( !bb_current_user_can( 'move_topic', $topic_id, $forum_id ) ) { 11 wp_redirect( bb_get_ option( 'uri') );11 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 12 12 exit(); 13 13 } trunk/bb-admin/topic-toggle.php
r1285 r1575 9 9 10 10 if ( !bb_current_user_can( 'close_topic', $topic_id ) ) { 11 wp_redirect( bb_get_ option( 'uri') );11 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 12 12 exit(); 13 13 } trunk/bb-admin/upgrade.php
r1553 r1575 80 80 ?> 81 81 <p class="last"> 82 <?php printf( __('Nothing to upgrade. <a href="%s">Get back to work!</a>'), bb_get_ option( 'uri' ) . 'bb-admin/'); ?>82 <?php printf( __('Nothing to upgrade. <a href="%s">Get back to work!</a>'), bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) ); ?> 83 83 </p> 84 84 <?php … … 115 115 <span class="first">!</span> <?php _e('Your database has been successfully updated.<br />Enjoy!'); ?> 116 116 </p> 117 <form action="<?php bb_ option('uri'); ?>bb-admin/" method="get">117 <form action="<?php bb_uri('bb-admin/', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>" method="get"> 118 118 <label for="upgrade_log_container_toggle"> 119 119 <?php _e('Show upgrade log:'); ?> trunk/bb-admin/view-ip.php
r1299 r1575 3 3 4 4 if ( !bb_current_user_can('view_by_ip') ) { 5 wp_redirect( bb_get_ option( 'uri') );5 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 6 6 exit(); 7 7 } trunk/bb-edit.php
r1339 r1575 9 9 10 10 if ( !$bb_post ) { 11 wp_redirect( bb_get_ option( 'uri') );11 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 12 12 die(); 13 13 } … … 29 29 wp_redirect( get_post_link( $post_id ) ); 30 30 else 31 wp_redirect( bb_get_ option( 'uri') );31 wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) ); 32 32 ?> trunk/bb-includes/default-filters.php
r1535 r1575 75 75 add_filter( 'bb_stylesheet_uri', 'attribute_escape', 1, 9999 ); 76 76 add_filter( 'forum_link', 'attribute_escape', 1, 9999 ); 77 add_filter( 'forum_rss_link', 'attribute_escape', 1, 9999 ); 77 add_filter( 'bb_forum_posts_rss_link', 'attribute_escape', 1, 9999 ); 78 add_filter( 'bb_forum_topics_rss_link', 'attribute_escape', 1, 9999 ); 78 79 add_filter( 'bb_tag_link', 'attribute_escape', 1, 9999 ); 79 80 add_filter( 'tag_rss_link', 'attribute_escape', 1, 9999 ); trunk/bb-includes/deprecated.php
r1553 r1575 535 535 function bb_path_to_url( $path ) { 536 536 bb_log_deprecated('function', __FUNCTION__, 'no alternative'); 537 return apply_filters( 'bb_path_to_url', bb_convert_path_base( $path, BB_PATH, bb_get_ option( 'uri') ), $path );537 return apply_filters( 'bb_path_to_url', bb_convert_path_base( $path, BB_PATH, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT) ), $path ); 538 538 } 539 539 … … 541 541 function bb_url_to_path( $url ) { 542 542 bb_log_deprecated('function', __FUNCTION__, 'no alternative'); 543 return apply_filters( 'bb_url_to_path', bb_convert_path_base( $url, bb_get_ option( 'uri'), BB_PATH ), $url );543 return apply_filters( 'bb_url_to_path', bb_convert_path_base( $url, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT), BB_PATH ), $url ); 544 544 } 545 545 … … 648 648 function forum_rss_link( $forum_id = 0 ) { 649 649 bb_log_deprecated('function', __FUNCTION__, 'bb_get_forum_posts_rss_link'); 650 echo bb_get_forum_posts_rss_link( $forum_id );650 bb_forum_posts_rss_link( $forum_id ); 651 651 } 652 652 trunk/bb-includes/functions.php
r1572 r1575 1715 1715 $r = 0; 1716 1716 break; 1717 case 'uri_ssl': 1718 $r = preg_replace('|^http://|i', 'https://', bb_get_option('uri')); 1717 1719 } 1718 1720 } … … 1763 1765 'description' => '', 1764 1766 'uri' => '', 1767 'uri_ssl' => '', 1765 1768 'from_email' => '', 1766 1769 'secret' => '', … … 1808 1811 function bb_delete_option( $option, $value = '' ) { 1809 1812 return bb_delete_meta( 0, $option, $value, 'option', true ); 1813 } 1814 1815 /** 1816 * BB_URI_CONTEXT_* - Bitwise definitions for bb_uri() and bb_get_uri() contexts 1817 * 1818 * @since 1.0-beta 1819 **/ 1820 define('BB_URI_CONTEXT_HEADER', 1); 1821 define('BB_URI_CONTEXT_TEXT', 2); 1822 define('BB_URI_CONTEXT_A_HREF', 4); 1823 define('BB_URI_CONTEXT_FORM_ACTION', 8); 1824 define('BB_URI_CONTEXT_IMG_SRC', 16); 1825 define('BB_URI_CONTEXT_LINK_STYLESHEET_HREF', 32); 1826 define('BB_URI_CONTEXT_LINK_ALTERNATE_HREF', 64); 1827 define('BB_URI_CONTEXT_SCRIPT_SRC', 128); 1828 //define('BB_URI_CONTEXT_*', 256); // Reserved for future definitions 1829 //define('BB_URI_CONTEXT_*', 512); // Reserved for future definitions 1830 define('BB_URI_CONTEXT_BB_FEED', 1024); 1831 define('BB_URI_CONTEXT_BB_USER_FORMS', 2048); 1832 define('BB_URI_CONTEXT_BB_ADMIN', 4096); 1833 //define('BB_URI_CONTEXT_*', 8192); // Reserved for future definitions 1834 //define('BB_URI_CONTEXT_*', 16384); // Reserved for future definitions 1835 //define('BB_URI_CONTEXT_*', 32768); // Reserved for future definitions 1836 //define('BB_URI_CONTEXT_*', 65536); // Reserved for future definitions 1837 //define('BB_URI_CONTEXT_*', 131072); // Reserved for future definitions 1838 //define('BB_URI_CONTEXT_*', 262144); // Reserved for future definitions 1839 define('BB_URI_CONTEXT_AKISMET', 524288); 1840 1841 /** 1842 * bb_uri() - echo a URI based on the URI setting 1843 * 1844 * @since 1.0-beta 1845 * 1846 * @param $resource string The directory, may include a querystring 1847 * @param $query mixed The query arguments as a querystring or an associative array 1848 * @param $context integer The context of the URI, use BB_URI_CONTEXT_* 1849 * @return void 1850 **/ 1851 function bb_uri($resource = null, $query = null, $context = BB_URI_CONTEXT_A_HREF) { 1852 echo apply_filters('bb_uri', bb_get_uri($resource, $query, $context), $resource, $query, $context); 1853 } 1854 1855 /** 1856 * bb_get_uri() - return a URI based on the URI setting 1857 * 1858 * @since 1.0-beta 1859 * 1860 * @param $resource string The directory, may include a querystring 1861 * @param $query mixed The query arguments as a querystring or an associative array 1862 * @param $context integer The context of the URI, use BB_URI_CONTEXT_* 1863 * @return string The complete URI 1864 **/ 1865 function bb_get_uri($resource = null, $query = null, $context = BB_URI_CONTEXT_A_HREF) { 1866 // If there is a querystring in the resource then extract it 1867 if ($resource && strpos($resource, '?') !== false) { 1868 list($_resource, $_query) = explode('?', trim($resource)); 1869 $resource = $_resource; 1870 $_query = wp_parse_args($_query); 1871 } 1872 1873 // Make sure $_query is an array for array_merge() 1874 if (!$_query) { 1875 $_query = array(); 1876 } 1877 1878 // $query can be an array as well as a string 1879 if ($query) { 1880 if (is_string($query)) { 1881 $query = ltrim(trim($query), '?'); 1882 } 1883 $query = wp_parse_args($query); 1884 } 1885 1886 // Make sure $query is an array for array_merge() 1887 if (!$query) { 1888 $query = array(); 1889 } 1890 1891 // Merge the queries into a single array 1892 $query = array_merge($_query, $query); 1893 1894 // Make sure context is an integer 1895 if (!$context || !is_integer($context)) { 1896 $context = BB_URI_CONTEXT_A_HREF; 1897 } 1898 1899 // Get the base URI 1900 $uri = bb_get_option('uri'); 1901 1902 // Force https when required on user forms 1903 if (($context & BB_URI_CONTEXT_BB_USER_FORMS) && bb_force_ssl_user_forms()) { 1904 $uri = bb_get_option('uri_ssl'); 1905 } 1906 1907 // Force https when required in admin 1908 if (($context & BB_URI_CONTEXT_BB_ADMIN) && bb_force_ssl_admin()) { 1909 $uri = bb_get_option('uri_ssl'); 1910 } 1911 1912 // Add the directory 1913 $uri .= ltrim($resource, '/'); 1914 1915 // Add the query string to the URI 1916 $uri = add_query_arg($query, $uri); 1917 1918 return apply_filters('bb_get_uri', $uri, $resource, $context); 1919 } 1920 1921 /** 1922 * bb_force_ssl_user_forms() - Whether SSL should be forced when sensitive user data is being submitted. 1923 * 1924 * @since 1.0-beta 1925 * 1926 * @param string|bool $force Optional. 1927 * @return bool True if forced, false if not forced. 1928 **/ 1929 function bb_force_ssl_user_forms($force = '') { 1930 static $forced; 1931 1932 if ( '' != $force ) { 1933 $old_forced = $forced; 1934 $forced = $force; 1935 return $old_forced; 1936 } 1937 1938 return $forced; 1939 } 1940 1941 /** 1942 * bb_force_ssl_admin() - Whether SSL should be forced when using the admin area. 1943 * 1944 * @since 1.0-beta 1945 * 1946 * @param string|bool $force Optional. 1947 * @return bool True if forced, false if not forced. 1948 **/ 1949 function bb_force_ssl_admin($force = '') { 1950 static $forced; 1951 1952 if ( '' != $force ) { 1953 $old_forced = $forced; 1954 $forced = $force; 1955 return $old_forced; 1956 } 1957 1958 return $forced; 1810 1959 } 1811 1960 … … 2533 2682 2534 2683 $uri = false; 2535 if ( function_exists('bb_get_option') && !BB_INSTALLING ) 2536 $uri = bb_get_option('uri'); 2684 if ( function_exists('bb_get_uri') && !BB_INSTALLING ) { 2685 $uri = bb_get_uri(); 2686 $uri_stylesheet = bb_get_uri('bb-admin/install.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_INSTALLER); 2687 $uri_stylesheet_rtl = bb_get_uri('bb-admin/install-rtl.css', null, BB_URI_CONTEXT_LINK_STYLESHEET_HREF + BB_URI_CONTEXT_BB_INSTALLER); 2688 $uri_logo = bb_get_uri('bb-admin/images/install-logo.gif', null, BB_URI_CONTEXT_IMG_SRC + BB_URI_CONTEXT_BB_INSTALLER); 2689 } 2537 2690 2538 if (!$uri) 2691 if (!$uri) { 2539 2692 $uri = preg_replace('|(/bb-admin)?/[^/]+?$|', '/', $_SERVER['PHP_SELF']); 2693 $uri_stylesheet = $uri . 'bb-admin/install.css'; 2694 $uri_stylesheet_rtl = $uri . 'bb-admin/install-rtl.css'; 2695 $uri_logo = $uri . 'bb-admin/images/install-logo.gif'; 2696 } 2540 2697 2541 2698 header('Content-Type: text/html; charset=utf-8'); … … 2547 2704 <title><?php echo $title; ?></title> 2548 2705 <meta name="robots" content="noindex, nofollow" /> 2549 <link rel="stylesheet" href="<?php echo $uri ; ?>bb-admin/install.css" type="text/css" />2706 <link rel="stylesheet" href="<?php echo $uri_stylesheet; ?>" type="text/css" /> 2550 2707 <?php 2551 2708 if ( function_exists( 'bb_get_option' ) && 'rtl' == bb_get_option( 'text_direction' ) ) { 2552 2709 ?> 2553 <link rel="stylesheet" href="<?php echo $uri ; ?>bb-admin/install-rtl.css" type="text/css" />2710 <link rel="stylesheet" href="<?php echo $uri_stylesheet_rtl; ?>" type="text/css" /> 2554 2711 <?php 2555 2712 } … … 2559 2716 <div id="container"> 2560 2717 <div class="logo"> 2561 <img src="<?php echo $uri ; ?>bb-admin/images/install-logo.gif" alt="bbPress Installation" />2718 <img src="<?php echo $uri_logo; ?>" alt="bbPress Installation" /> 2562 2719 </div> 2563 2720 <?php … … 2592 2749 <p><?php echo $message; ?></p> 2593 2750 <?php 2594 if ($uri = bb_get_ option('uri')) {2751 if ($uri = bb_get_uri()) { 2595 2752 ?> 2596 2753 <p class="last"><?php printf( __('Back to <a href="%s">%s</a>.'), $uri, bb_get_option( 'name' ) ); ?></p> trunk/bb-includes/pluggable.php
r1562 r1575 5 5 if ( !wp_validate_auth_cookie() ) { 6 6 nocache_headers(); 7 header('Location: ' . bb_get_ option('uri'));7 header('Location: ' . bb_get_uri(null, null, BB_URI_CONTEXT_HEADER)); 8 8 exit(); 9 9 } … … 192 192 193 193 $lp = parse_url($location); 194 $wpp = parse_url(bb_get_ option('uri'));194 $wpp = parse_url(bb_get_uri()); 195 195 196 196 $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : ''); 197 197 198 198 if ( isset($lp['host']) && !in_array($lp['host'], $allowed_hosts) ) 199 $location = bb_get_ option('uri');199 $location = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); 200 200 201 201 wp_redirect($location, $status); … … 412 412 if (!count(preg_grep('/^from:\s/im', $headers))) { 413 413 if (!$from = bb_get_option('from_email')) 414 if ($uri_parsed = parse_url(bb_get_ option('uri')))414 if ($uri_parsed = parse_url(bb_get_uri())) 415 415 if ($uri_parsed['host']) 416 416 $from = 'bbpress@' . trim(preg_replace('/^www./i', '', $uri_parsed['host'])); trunk/bb-includes/registration-functions.php
r1509 r1575 83 83 bb_update_usermeta( $user->ID, 'newpwdkey', $resetkey ); 84 84 85 $message = sprintf( __("If you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!"), bb_get_option('uri') . "bb-reset-password.php?key=$resetkey" ); 85 $message = sprintf( 86 __("If you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!"), 87 bb_get_uri( 88 'bb-reset-password.php', 89 array('key' => $resetkey), 90 BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_BB_USER_FORMS 91 ) 92 ); 86 93 87 94 return bb_mail( bb_get_user_email( $user->ID ), bb_get_option('name') . ': ' . __('Password Reset'), $message ); … … 165 172 bb_get_user_email( $user->ID ), 166 173 bb_get_option('name') . ': ' . __('Password'), 167 sprintf( $message, $user->user_login, $pass, bb_get_option('uri'))174 sprintf($message, $user->user_login, $pass, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT)) 168 175 ); 169 176 } trunk/bb-includes/script-loader.php
r1544 r1575 2 2 3 3 function bb_default_scripts( &$scripts ) { 4 $scripts->base_url = bb_get_option( 'uri' ); 4 $scripts->base_url = bb_get_uri(BB_INC, null, BB_URI_CONTEXT_SCRIPT_SRC); 5 $scripts->base_url_admin = bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_SCRIPT_SRC + BB_URI_CONTEXT_BB_ADMIN); 5 6 $scripts->default_version = bb_get_option( 'version' ); 6 7 7 $scripts->add( 'fat', $scripts->base_url . BB_INC. 'js/fat.js', array('add-load-event'), '1.0-RC1_3660' );8 $scripts->add( 'prototype', $scripts->base_url . BB_INC. 'js/prototype.js', false, '1.5.0' );9 $scripts->add( 'wp-ajax', $scripts->base_url . BB_INC. 'js/wp-ajax-js.php', array('prototype'), '2.1-beta2' );10 $scripts->add( 'listman', $scripts->base_url . BB_INC. 'js/list-manipulation-js.php', array('add-load-event', 'wp-ajax', 'fat'), '440' );11 $scripts->add( 'wp-ajax-response', $scripts->base_url . BB_INC .'js/wp-ajax-response.js', array('jquery'), '20080316' );8 $scripts->add( 'fat', $scripts->base_url . 'js/fat.js', array('add-load-event'), '1.0-RC1_3660' ); 9 $scripts->add( 'prototype', $scripts->base_url . 'js/prototype.js', false, '1.5.0' ); 10 $scripts->add( 'wp-ajax', $scripts->base_url . 'js/wp-ajax-js.php', array('prototype'), '2.1-beta2' ); 11 $scripts->add( 'listman', $scripts->base_url . 'js/list-manipulation-js.php', array('add-load-event', 'wp-ajax', 'fat'), '440' ); 12 $scripts->add( 'wp-ajax-response', $scripts->base_url . 'js/wp-ajax-response.js', array('jquery'), '20080316' ); 12 13 $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 13 14 'noPerm' => __('You do not have permission to do that.'), 14 15 'broken' => __('An unidentified error has occurred.') 15 16 ) ); 16 $scripts->add( 'wp-lists', $scripts->base_url . BB_INC. 'js/wp-lists.js', array('wp-ajax-response','jquery-color'), '20080411' );17 $scripts->add( 'wp-lists', $scripts->base_url . 'js/wp-lists.js', array('wp-ajax-response','jquery-color'), '20080411' ); 17 18 $scripts->localize( 'wp-lists', 'wpListL10n', array( 18 'url' => "{$scripts->base_url}bb-admin/admin-ajax.php"19 'url' => $scripts->base_url_admin . 'admin-ajax.php' 19 20 ) ); 20 $scripts->add( 'topic', $scripts->base_url . BB_INC. 'js/topic.js', array('wp-lists'), '20080506' );21 $scripts->add( 'jquery', $scripts->base_url . BB_INC. 'js/jquery/jquery.js', false, '1.1.3.1');22 $scripts->add( 'interface', $scripts->base_url . BB_INC. 'js/jquery/interface.js', array('jquery'), '1.2.3');23 $scripts->add( 'jquery-color', $scripts->base_url . BB_INC. 'js/jquery/jquery.color.js', array('jquery'), '2.0-4561' );24 $scripts->add( 'add-load-event', $scripts->base_url . BB_INC. 'js/add-load-event.js' );25 $scripts->add( 'content-forums', $scripts->base_url . 'bb-admin/js/content-forums.js', array('listman', 'interface'), '20080309' );21 $scripts->add( 'topic', $scripts->base_url . 'js/topic.js', array('wp-lists'), '20080506' ); 22 $scripts->add( 'jquery', $scripts->base_url . 'js/jquery/jquery.js', false, '1.1.3.1'); 23 $scripts->add( 'interface', $scripts->base_url . 'js/jquery/interface.js', array('jquery'), '1.2.3'); 24 $scripts->add( 'jquery-color', $scripts->bas