| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function unregister_GLOBALS() { |
|---|
| 4 |
if ( !ini_get('register_globals') ) |
|---|
| 5 |
return; |
|---|
| 6 |
|
|---|
| 7 |
if ( isset($_REQUEST['GLOBALS']) ) |
|---|
| 8 |
die('GLOBALS overwrite attempt detected'); |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); |
|---|
| 12 |
|
|---|
| 13 |
$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); |
|---|
| 14 |
foreach ( $input as $k => $v ) |
|---|
| 15 |
if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) |
|---|
| 16 |
unset($GLOBALS[$k]); |
|---|
| 17 |
} |
|---|
| 18 |
unregister_GLOBALS(); |
|---|
| 19 |
|
|---|
| 20 |
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); |
|---|
| 21 |
unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories ); |
|---|
| 22 |
|
|---|
| 23 |
if ( ! isset($blog_id) ) |
|---|
| 24 |
$blog_id = 1; |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
if ( empty( $_SERVER['REQUEST_URI'] ) ) { |
|---|
| 28 |
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; |
|---|
| 29 |
|
|---|
| 30 |
// Append the query string if it exists and isn't null |
|---|
| 31 |
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { |
|---|
| 32 |
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|---|
| 33 |
} |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) |
|---|
| 38 |
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
if ( strstr( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) ) |
|---|
| 42 |
unset($_SERVER['PATH_INFO']); |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
$PHP_SELF = $_SERVER['PHP_SELF']; |
|---|
| 46 |
if ( empty($PHP_SELF) ) |
|---|
| 47 |
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); |
|---|
| 48 |
|
|---|
| 49 |
function timer_start() { |
|---|
| 50 |
global $timestart; |
|---|
| 51 |
$mtime = explode(' ', microtime() ); |
|---|
| 52 |
$mtime = $mtime[1] + $mtime[0]; |
|---|
| 53 |
$timestart = $mtime; |
|---|
| 54 |
return true; |
|---|
| 55 |
} |
|---|
| 56 |
timer_start(); |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
if ( defined('WP_CACHE') ) |
|---|
| 64 |
require (ABSPATH . 'wp-content/advanced-cache.php'); |
|---|
| 65 |
|
|---|
| 66 |
define('WPINC', PRIVATE_REL_PATH . 'lib/wp-includes'); |
|---|
| 67 |
require_once (ABSPATH . WPINC . '/wp-db.php'); |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
$wpdb->posts = $table_prefix . 'posts'; |
|---|
| 71 |
$wpdb->users = $table_prefix . 'users'; |
|---|
| 72 |
$wpdb->categories = $table_prefix . 'categories'; |
|---|
| 73 |
$wpdb->post2cat = $table_prefix . 'post2cat'; |
|---|
| 74 |
$wpdb->comments = $table_prefix . 'comments'; |
|---|
| 75 |
$wpdb->links = $table_prefix . 'links'; |
|---|
| 76 |
$wpdb->linkcategories = $table_prefix . 'linkcategories'; |
|---|
| 77 |
$wpdb->options = $table_prefix . 'options'; |
|---|
| 78 |
$wpdb->postmeta = $table_prefix . 'postmeta'; |
|---|
| 79 |
$wpdb->usermeta = $table_prefix . 'usermeta'; |
|---|
| 80 |
$wpdb->blogs = $table_prefix . 'blogs'; |
|---|
| 81 |
$wpdb->postsearch = $table_prefix . 'postsearch'; |
|---|
| 82 |
$wpdb->sessions = $table_prefix . 'sessions'; |
|---|
| 83 |
|
|---|
| 84 |
$wpdb->prefix = $table_prefix; |
|---|
| 85 |
|
|---|
| 86 |
if ( defined('CUSTOM_USER_TABLE') ) |
|---|
| 87 |
$wpdb->users = CUSTOM_USER_TABLE; |
|---|
| 88 |
if ( defined('CUSTOM_USER_META_TABLE') ) |
|---|
| 89 |
$wpdb->usermeta = CUSTOM_USER_META_TABLE; |
|---|
| 90 |
|
|---|
| 91 |
$tableposts = $wpdb->posts; |
|---|
| 92 |
$tableusers = $wpdb->users; |
|---|
| 93 |
$tablecategories = $wpdb->categories; |
|---|
| 94 |
$tablepost2cat = $wpdb->post2cat; |
|---|
| 95 |
$tablecomments = $wpdb->comments; |
|---|
| 96 |
$tablelinks = $wpdb->links; |
|---|
| 97 |
$tablelinkcategories = $wpdb->linkcategories; |
|---|
| 98 |
$tableoptions = $wpdb->options; |
|---|
| 99 |
$tablepostmeta = $wpdb->postmeta; |
|---|
| 100 |
|
|---|
| 101 |
if ( file_exists(ABSPATH . 'wp-content/object-cache.php') ) |
|---|
| 102 |
require (ABSPATH . 'wp-content/object-cache.php'); |
|---|
| 103 |
else |
|---|
| 104 |
require (ABSPATH . WPINC . '/cache.php'); |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
define('DISABLE_CACHE', true); |
|---|
| 108 |
|
|---|
| 109 |
wp_cache_init(); |
|---|
| 110 |
|
|---|
| 111 |
require (ABSPATH . WPINC . '/functions.php'); |
|---|
| 112 |
require (ABSPATH . WPINC . '/default-filters.php'); |
|---|
| 113 |
require_once (ABSPATH . WPINC . '/wp-l10n.php'); |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
require (ABSPATH . WPINC . '/functions-formatting.php'); |
|---|
| 129 |
require (ABSPATH . WPINC . '/functions-post.php'); |
|---|
| 130 |
require (ABSPATH . WPINC . '/capabilities.php'); |
|---|
| 131 |
require (ABSPATH . WPINC . '/classes.php'); |
|---|
| 132 |
require (ABSPATH . WPINC . '/template-functions-general.php'); |
|---|
| 133 |
require (ABSPATH . WPINC . '/template-functions-links.php'); |
|---|
| 134 |
require (ABSPATH . WPINC . '/template-functions-author.php'); |
|---|
| 135 |
require (ABSPATH . WPINC . '/template-functions-post.php'); |
|---|
| 136 |
require (ABSPATH . WPINC . '/template-functions-category.php'); |
|---|
| 137 |
require (ABSPATH . WPINC . '/comment-functions.php'); |
|---|
| 138 |
require (ABSPATH . WPINC . '/feed-functions.php'); |
|---|
| 139 |
require (ABSPATH . WPINC . '/links.php'); |
|---|
| 140 |
require (ABSPATH . WPINC . '/kses.php'); |
|---|
| 141 |
require (ABSPATH . WPINC . '/version.php'); |
|---|
| 142 |
require (PRIVATEROOT . 'lib/functions.php'); |
|---|
| 143 |
require (PRIVATEROOT . 'lib/session.php'); |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
if (!isset($blogdata)){ |
|---|
| 147 |
if (!isset($_REQUEST['b'])) |
|---|
| 148 |
header('Location: '.PORTAL ); |
|---|
| 149 |
else { |
|---|
| 150 |
$blogdata = $wpdb->get_row("SELECT * FROM `$wpdb->blogs` WHERE `slug`='{$_REQUEST['b']}'"); |
|---|
| 151 |
|
|---|
| 152 |
$blog = $blogdata->id; |
|---|
| 153 |
$blogstatus = $blogdata->status; |
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
$blog)) |
|---|
| 157 |
$blog = 'NULL'; |
|---|
| 158 |
|
|---|
| 159 |
strstr($_SERVER['PHP_SELF'], 'install.php')) : |
|---|
| 160 |
|
|---|
| 161 |
$cookiehash = md5(get_settings('siteurl')); |
|---|
| 162 |
define('COOKIEHASH', $cookiehash); |
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
defined('USER_COOKIE') ) |
|---|
| 166 |
define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH); |
|---|
| 167 |
defined('PASS_COOKIE') ) |
|---|
| 168 |
define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH); |
|---|
| 169 |
defined('COOKIEPATH') ) |
|---|
| 170 |
define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) ); |
|---|
| 171 |
defined('SITECOOKIEPATH') ) |
|---|
| 172 |
define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) ); |
|---|
| 173 |
defined('COOKIE_DOMAIN') ) |
|---|
| 174 |
define('COOKIE_DOMAIN', false); |
|---|
| 175 |
|
|---|
| 176 |
ABSPATH . WPINC . '/vars.php'); |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
if (get_settings('hack_file')) { |
|---|
| 180 |
if (file_exists(ABSPATH . '/my-hacks.php')) |
|---|
| 181 |
require(ABSPATH . '/my-hacks.php'); |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
if ( get_settings('active_plugins') || get_settings('active_system_plugins')) { |
|---|
| 185 |
$current_plugins = array_merge(get_settings('active_plugins'), get_settings('active_system_plugins')); |
|---|
| 186 |
if ( is_array($current_plugins) ) { |
|---|
| 187 |
foreach ($current_plugins as $plugin) { |
|---|
| 188 |
if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin)) |
|---|
| 189 |
include_once(ABSPATH . 'wp-content/plugins/' . $plugin); |
|---|
| 190 |
else if ('' != $plugin && file_exists(ABSPATH . 'wp-content/systemplugins/' . $plugin)) |
|---|
| 191 |
include_once(ABSPATH . 'wp-content/systemplugins/' . $plugin); |
|---|
| 192 |
} |
|---|
| 193 |
} |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
require (ABSPATH . WPINC . '/pluggable-functions.php'); |
|---|
| 197 |
|
|---|
| 198 |
if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) |
|---|
| 199 |
wp_cache_postload(); |
|---|
| 200 |
|
|---|
| 201 |
do_action('plugins_loaded'); |
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
if ( get_magic_quotes_gpc() ) { |
|---|
| 205 |
$_GET = stripslashes_deep($_GET ); |
|---|
| 206 |
$_POST = stripslashes_deep($_POST ); |
|---|
| 207 |
$_COOKIE = stripslashes_deep($_COOKIE); |
|---|
| 208 |
$_SERVER = stripslashes_deep($_SERVER); |
|---|
| 209 |
} |
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
$_GET = add_magic_quotes($_GET ); |
|---|
| 213 |
$_POST = add_magic_quotes($_POST ); |
|---|
| 214 |
$_COOKIE = add_magic_quotes($_COOKIE); |
|---|
| 215 |
$_SERVER = add_magic_quotes($_SERVER); |
|---|
| 216 |
|
|---|
| 217 |
$wp_query = new WP_Query(); |
|---|
| 218 |
$wp_rewrite = new WP_Rewrite(); |
|---|
| 219 |
$wp = new WP(); |
|---|
| 220 |
|
|---|
| 221 |
define('TEMPLATEPATH', get_template_directory()); |
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
load_default_textdomain(); |
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
require_once(ABSPATH . WPINC . '/locale.php'); |
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
if ( file_exists(TEMPLATEPATH . "/functions.php") ) |
|---|
| 231 |
include(TEMPLATEPATH . "/functions.php"); |
|---|
| 232 |
|
|---|
| 233 |
function shutdown_action_hook() { |
|---|
| 234 |
do_action('shutdown'); |
|---|
| 235 |
wp_cache_close(); |
|---|
| 236 |
} |
|---|
| 237 |
register_shutdown_function('shutdown_action_hook'); |
|---|
| 238 |
|
|---|
| 239 |
session_start(); |
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
do_action('init'); |
|---|
| 243 |
|
|---|
| 244 |
?> |
|---|