Changeset 1562
- Timestamp:
- 06/21/2008 05:10:20 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bb-includes/functions.php (modified) (2 diffs)
-
bb-includes/pluggable.php (modified) (3 diffs)
-
bb-settings.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/functions.php
r1561 r1562 1723 1723 1724 1724 if ( false === $r = wp_cache_get( $option, 'bb_option' ) ) { 1725 //if ( defined( 'BB_INSTALLING' )) $bbdb->return_errors();1725 //if ( BB_INSTALLING ) $bbdb->return_errors(); 1726 1726 $row = $bbdb->get_row( $bbdb->prepare( "SELECT meta_value FROM $bbdb->meta WHERE object_type = 'bb_option' AND meta_key = %s", $option ) ); 1727 //if ( defined( 'BB_INSTALLING' )) $bbdb->show_errors();1727 //if ( BB_INSTALLING ) $bbdb->show_errors(); 1728 1728 1729 1729 if ( is_object($row) ) { … … 2528 2528 2529 2529 $uri = false; 2530 if ( function_exists('bb_get_option') && ( !defined('BB_INSTALLING') || !BB_INSTALLING ))2530 if ( function_exists('bb_get_option') && !BB_INSTALLING ) 2531 2531 $uri = bb_get_option('uri'); 2532 2532 -
trunk/bb-includes/pluggable.php
r1504 r1562 50 50 //This is only used at initialization. Use bb_get_current_user_info() (or $bb_current_user global if really needed) to grab user info. 51 51 function bb_current_user() { 52 if ( defined( 'BB_INSTALLING' ))52 if (BB_INSTALLING) 53 53 return false; 54 54 … … 243 243 $salt = BB_SECRET_SALT; 244 244 } else { 245 if (! defined('BB_INSTALLING')) {245 if (!BB_INSTALLING) { 246 246 $salt = bb_get_option('secret'); 247 247 if ( empty($salt) ) { … … 382 382 return false; 383 383 384 if ( defined( 'BB_INSTALLING' )) {384 if (BB_INSTALLING) { 385 385 bb_update_usermeta( $user['ID'], $bbdb->prefix . 'capabilities', array('keymaster' => true) ); 386 386 } else { -
trunk/bb-settings.php
r1561 r1562 1 1 <?php 2 /** 3 * Used to setup and fix common variables and include 4 * the bbPress and BackPress procedural and class libraries. 5 * 6 * You should not have to change this file, some configuration 7 * is possible in bb-config.php 8 * 9 * @package bbPress 10 */ 11 12 13 14 /** 15 * Low level reasons to die 16 */ 17 18 // Die if PHP is not new enough 2 19 if ( version_compare(PHP_VERSION, '4.3', '<') ) 3 20 die(sprintf('Your server is running PHP version %s but bbPress requires at least 4.3', PHP_VERSION) ); 4 21 22 // Die if called directly 23 if ( !defined('BB_PATH') ) 24 die('This file cannot be called directly.'); 25 26 // Die if there is no database table prefix 5 27 if ( !$bb_table_prefix ) 6 28 die('You must specify a table prefix in your <code>bb-config.php</code> file.'); 7 29 8 if ( !defined('BB_PATH') ) 9 die('This file cannot be called directly.'); 10 11 // Turn register globals off 30 31 32 // Modify error reporting levels to exclude PHP notices 33 error_reporting(E_ALL ^ E_NOTICE); 34 35 /** 36 * bb_unregister_GLOBALS() - Turn register globals off 37 * 38 * @access private 39 * @return null Will return null if register_globals PHP directive was disabled 40 */ 12 41 function bb_unregister_GLOBALS() { 13 42 if ( !ini_get('register_globals') ) … … 27 56 } 28 57 } 29 30 58 bb_unregister_GLOBALS(); 31 59 60 61 62 /** 63 * bb_timer_start() - PHP 4 standard microtime start capture 64 * 65 * @access private 66 * @global int $bb_timestart Seconds and Microseconds added together from when function is called 67 * @return bool Always returns true 68 */ 32 69 function bb_timer_start() { 33 70 global $bb_timestart; … … 38 75 bb_timer_start(); 39 76 77 78 79 /** 80 * Whether the server software is IIS or something else 81 * @global bool $is_IIS 82 */ 40 83 $is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0; 84 85 86 87 /** 88 * Stabilise $_SERVER variables in various PHP environments 89 */ 90 41 91 // Fix for IIS, which doesn't set REQUEST_URI 42 92 if ( empty( $_SERVER['REQUEST_URI'] ) ) { 43 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI? 44 45 // Append the query string if it exists and isn't null 46 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) 47 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 48 } 49 50 // Modify error reporting levels 51 error_reporting(E_ALL ^ E_NOTICE); 52 93 94 // IIS Mod-Rewrite 95 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 96 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 97 } 98 // IIS Isapi_Rewrite 99 else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 100 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 101 } 102 else 103 { 104 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 105 if ( isset($_SERVER['PATH_INFO']) ) { 106 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 107 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 108 else 109 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 110 } 111 112 // Append the query string if it exists and isn't null 113 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 114 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 115 } 116 } 117 } 118 119 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 120 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) 121 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 122 123 // Fix for Dreamhost and other PHP as CGI hosts 124 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) 125 unset($_SERVER['PATH_INFO']); 126 127 // Fix empty PHP_SELF 128 $PHP_SELF = $_SERVER['PHP_SELF']; 129 if ( empty($PHP_SELF) ) 130 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 131 132 133 134 /** 135 * Let bbPress know where we are, or aren't 136 */ 137 138 /** 139 * Whether the current script is in the admin area or not 140 */ 53 141 if ( !defined( 'BB_IS_ADMIN' ) ) 54 142 define( 'BB_IS_ADMIN', false ); 143 144 /** 145 * Whether the current script is part of the installation process or not 146 * @since 1.0-beta 147 */ 148 if ( !defined( 'BB_INSTALLING' ) ) 149 define( 'BB_INSTALLING', false ); 150 151 55 152 56 153 // Define the include path … … 71 168 define( 'BB_DATABASE_CLASS', 'BPDB_Multi' ); 72 169 73 function bb_init_bbdb() { 74 global $bbdb; 75 76 $bbdb_class = BB_DATABASE_CLASS; 77 $bbdb =& new $bbdb_class( array( 78 'name' => BBDB_NAME, 79 'user' => BBDB_USER, 80 'password' => BBDB_PASSWORD, 81 'host' => BBDB_HOST, 82 'charset' => defined( 'BBDB_CHARSET' ) ? BBDB_CHARSET : false, 83 'collate' => defined( 'BBDB_COLLATE' ) ? BBDB_COLLATE : false 84 ) ); 85 unset($bbdb_class); 86 87 $bbdb->tables = array( 88 'forums' => false, 89 'meta' => false, 90 'posts' => false, 91 'tagged' => false, // Deprecated 92 'tags' => false, // Deprecated 93 'terms' => false, 94 'term_relationships' => false, 95 'term_taxonomy' => false, 96 'topics' => false, 97 'topicmeta' => false, // Deprecated 98 'users' => false, 99 'usermeta' => false 100 ); 101 } 102 103 bb_init_bbdb(); 104 170 $bbdb_class = BB_DATABASE_CLASS; 171 $bbdb =& new $bbdb_class( array( 172 'name' => BBDB_NAME, 173 'user' => BBDB_USER, 174 'password' => BBDB_PASSWORD, 175 'host' => BBDB_HOST, 176 'charset' => defined( 'BBDB_CHARSET' ) ? BBDB_CHARSET : false, 177 'collate' => defined( 'BBDB_COLLATE' ) ? BBDB_COLLATE : false 178 ) ); 179 unset($bbdb_class); 180 181 $bbdb->tables = array( 182 'forums' => false, 183 'meta' => false, 184 'posts' => false, 185 'tagged' => false, // Deprecated 186 'tags' => false, // Deprecated 187 'terms' => false, 188 'term_relationships' => false, 189 'term_taxonomy' => false, 190 'topics' => false, 191 'topicmeta' => false, // Deprecated 192 'users' => false, 193 'usermeta' => false 194 ); 105 195 106 196 // Define BackPress Database errors if not already done - no internationalisation at this stage … … 172 262 require( BB_COMMUNITIES_INCLUDE ); 173 263 174 if ( ! bb_is_installed() && ( !defined('BB_INSTALLING') || !BB_INSTALLING) ) {264 if ( !BB_INSTALLING && !bb_is_installed() ) { 175 265 $link = preg_replace('|(/bb-admin)?/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'bb-admin/install.php'; 176 266 require( BB_PATH . BB_INC . 'pluggable.php'); … … 182 272 // TODO: consider seperating into external upgrade script for 1.0 183 273 $bbdb->suppress_errors(); 184 if ( ( !defined('BB_INSTALLING') || !BB_INSTALLING )&& !bb_get_option_from_db( 'bb_db_version' ) ) {274 if ( !BB_INSTALLING && !bb_get_option_from_db( 'bb_db_version' ) ) { 185 275 $meta_exists = $bbdb->query("SELECT * FROM $bbdb->meta LIMIT 1"); 186 276 if (!$meta_exists) { … … 208 298 unset($o, $oo); 209 299 210 if ( defined('BB_INSTALLING') && BB_INSTALLING ) 211 foreach ( array('active_plugins') as $i ) 212 $bb->$i = false; 213 unset($i); 300 if ( BB_INSTALLING ) { 301 foreach ( array('active_plugins') as $i ) 302 $bb->$i = false; 303 unset($i); 304 } 214 305 215 306 require( BB_PATH . BB_INC . 'formatting-functions.php'); … … 262 353 } 263 354 // Die if no URI 264 if ( ( !defined('BB_INSTALLING') || !BB_INSTALLING )&& !$bb->uri ) {355 if ( !BB_INSTALLING && !$bb->uri ) { 265 356 bb_die( __('Could not determine site URI') ); 266 357 }
Note: See TracChangeset
for help on using the changeset viewer.