blogs/ 0000755 0000000 0000000 00000000000 11077645205 010671 5 ustar root root blogs/wp-feed.php 0000644 0000000 0000000 00000001225 11077635520 012730 0 ustar root root
blogs/wpmu-settings.php 0000644 0000000 0000000 00000022012 11077635520 014224 0 ustar root root get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) );
if( $current_site != null )
return $current_site;
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) );
if( $current_site != null ) {
$path = '/';
return $current_site;
}
$sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) );
if( $current_site != null )
return $current_site;
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) );
if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
if( count( $sites ) == 1 ) {
$current_site = $sites[0];
die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" );
} else {
die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." );
}
} else {
$path = '/';
}
} else {
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) );
if( $current_site != null )
return $current_site;
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) );
if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
if( count( $sites ) == 1 ) {
$current_site = $sites[0];
die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" );
} else {
die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." );
}
} else {
$path = '/';
}
}
return $current_site;
}
$wpdb->suppress_errors();
$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
if( count( $sites ) == 1 ) {
$current_site = $sites[0];
$path = $current_site->path;
} else {
$current_site = wpmu_current_site();
}
if( constant( 'VHOST' ) == 'yes' ) {
$current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'");
if( $current_blog != null ) {
$current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE id = %d", $current_blog->site_id) );
} else {
$blogname = substr( $domain, 0, strpos( $domain, '.' ) );
}
} else {
$blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );
if( strpos( $blogname, '/' ) )
$blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
if( strpos( " ".$blogname, '?' ) )
$blogname = substr( $blogname, 0, strpos( $blogname, '?' ) );
$blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );
if( $blogname == '' || in_array( $blogname, $blognames ) || is_file( $blogname ) || is_blogname_page( $blogname ) ) {
$current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path) );
} else {
$current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path.$blogname.'/') );
}
}
if( defined( "WP_INSTALLING" ) == false ) {
if( $current_site && $current_blog == null ) {
$current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path) );
}
if( $current_blog == false || $current_site == false )
is_installed();
}
function is_blogname_page( $blogname ) {
global $wpdb, $table_prefix, $domain, $path;
$blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path) );
// is the request for a page of the main blog? We need to cache this information somewhere to save a request
$pages = $wpdb->get_col( "SELECT LOWER(post_name) FROM {$table_prefix}{$blog_id}_posts WHERE post_type='page'" );
if( is_array( $pages ) == false )
return false;
if( in_array( strtolower( $blogname ), $pages ) ) {
return true;
} else {
return false;
}
}
$blog_id = $current_blog->blog_id;
$public = $current_blog->public;
if( $current_blog->site_id == 0 || $current_blog->site_id == '' )
$current_blog->site_id = 1;
$site_id = $current_blog->site_id;
$current_site->site_name = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $site_id) );
if( $current_site->site_name == null )
$current_site->site_name = ucfirst( $current_site->domain );
if( $blog_id == false ) {
// no blog found, are we installing? Check if the table exists.
if ( defined('WP_INSTALLING') ) {
$blog_id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs LIMIT 0,1" );
if( $blog_id == false ) {
// table doesn't exist. This is the first blog
$blog_id = 1;
} else {
// table exists
// don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like.
// default to using the "main" blog.
$blog_id = 1;
}
$current_blog->blog_id = $blog_id;
} else {
$check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
if( $check == false ) {
$msg = ': DB Tables Missing';
} else {
$msg = '';
}
die( "No Blog by that name on this system." . $msg );
}
}
$wpdb->suppress_errors( false );
if( '0' == $current_blog->public ) {
// This just means the blog shouldn't show up in google, etc. Only to registered members
}
function is_installed() {
global $wpdb, $domain, $path;
$base = stripslashes( $base );
if( defined( "WP_INSTALLING" ) == false ) {
$check = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
$msg = "If your blog does not display, please contact the owner of this site.
If you are the owner of this site please check that MySQL is running properly and all tables are error free.
";
if( $check == false ) {
$msg .= "Database Tables Missing. Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really should look at your database now. ";
} else {
$msg .= 'Could Not Find Blog! ';
$msg .= "Searched for " . $domain . $path . " in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right? ";
}
$msg .= " \n
What do I do now?
";
$msg .= "Read the bug report page. Some of the guidelines there may help you figure out what went wrong. ";
$msg .= "If you're still stuck with this message, then check that your database contains the following tables:
$wpdb->blogs
$wpdb->users
$wpdb->usermeta
$wpdb->site
$wpdb->sitemeta
$wpdb->sitecategories
";
$msg .= "If you suspect a problem please report it to the support forums but you must include the information asked for in the WPMU bug reporting guidelines!
";
if( is_file( 'release-info.txt' ) ) {
$msg .= 'Your bug report must include the following text: "';
$info = file( 'release-info.txt' );
$msg .= $info[ 4 ] . '"';
}
die( "
Fatal Error
" . $msg );
}
}
?>
blogs/license.txt 0000644 0000000 0000000 00000035427 11077635520 013066 0 ustar root root GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
blogs/wp-settings.php 0000644 0000000 0000000 00000045274 11077635520 013701 0 ustar root root $v )
if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
$GLOBALS[$k] = NULL;
unset($GLOBALS[$k]);
}
}
wp_unregister_GLOBALS();
unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
/**
* The $blog_id global, which you can change in the config allows you to create a simple
* multiple blog installation using just one WordPress and changing $blog_id around.
*
* @global int $blog_id
* @since 2.0.0
*/
if ( ! isset($blog_id) )
$blog_id = 0;
// Fix for IIS, which doesn't set REQUEST_URI
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
// IIS Mod-Rewrite
if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
}
// IIS Isapi_Rewrite
else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
}
else
{
// Use ORIG_PATH_INFO if there is no PATH_INFO
if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
if ( isset($_SERVER['PATH_INFO']) ) {
if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
else
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
}
// Append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
}
}
// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
// Fix for Dreamhost and other PHP as CGI hosts
if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
unset($_SERVER['PATH_INFO']);
if ( version_compare( '4.3', phpversion(), '>' ) ) {
die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
}
if ( !defined('WP_CONTENT_DIR') )
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
/**
* timer_start() - PHP 4 standard microtime start capture
*
* @access private
* @since 0.71
* @global int $timestart Seconds and Microseconds added together from when function is called
* @return bool Always returns true
*/
function timer_start() {
global $timestart;
$mtime = explode(' ', microtime() );
$mtime = $mtime[1] + $mtime[0];
$timestart = $mtime;
return true;
}
/**
* timer_stop() - Return and/or display the time from the page start to when function is called.
*
* You can get the results and print them by doing:
*
* $nTimePageTookToExecute = timer_stop();
* echo $nTimePageTookToExecute;
*
*
* Or instead, you can do:
*
* timer_stop(1);
*
* which will do what the above does. If you need the result, you can assign it to a variable, but
* most cases, you only need to echo it.
*
* @since 0.71
* @global int $timestart Seconds and Microseconds added together from when timer_start() is called
* @global int $timeend Seconds and Microseconds added together from when function is called
*
* @param int $display Use '0' or null to not echo anything and 1 to echo the total time
* @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
* @return float The "second.microsecond" finished time calculation
*/
function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
global $timestart, $timeend;
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
$r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
if ( $display )
echo $r;
return $r;
}
timer_start();
// Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
if (defined('WP_DEBUG') and WP_DEBUG == true) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
}
// For an advanced caching plugin to use, static because you would only want one
if ( defined('WP_CACHE') )
@include WP_CONTENT_DIR . '/advanced-cache.php';
/**
* Stores the location of the WordPress directory of functions, classes, and core content.
*
* @since 1.0.0
*/
define('WPINC', 'wp-includes');
if ( !defined('WP_LANG_DIR') ) {
/**
* Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
* and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
*
* @since 2.1.0
*/
if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
if (!defined('LANGDIR')) {
// Old static relative path maintained for limited backwards compatibility - won't work in some cases
define('LANGDIR', 'wp-content/languages');
}
} else {
define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
if (!defined('LANGDIR')) {
// Old relative path maintained for backwards compatibility
define('LANGDIR', WPINC . '/languages');
}
}
}
require (ABSPATH . WPINC . '/compat.php');
require (ABSPATH . WPINC . '/functions.php');
require (ABSPATH . WPINC . '/classes.php');
require_wp_db();
if ( !empty($wpdb->error) )
dead_db();
$prefix = $wpdb->set_prefix($table_prefix); // set up global tables
if ( is_wp_error($prefix) )
wp_die(/*WP_I18N_BAD_PREFIX*/'ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
require_once (WP_CONTENT_DIR . '/object-cache.php');
else
require_once (ABSPATH . WPINC . '/cache.php');
wp_cache_init();
if ( function_exists('wp_cache_add_global_groups') ) {
wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
}
if( defined( 'SUNRISE' ) )
include_once( ABSPATH . 'wp-content/sunrise.php' );
require_once ( ABSPATH . 'wpmu-settings.php' );
$wpdb->blogid = $current_blog->blog_id;
$wpdb->siteid = $current_blog->site_id;
$wpdb->set_prefix($table_prefix); // set up blog tables
$table_prefix = $table_prefix . $blog_id . '_';
// Fix empty PHP_SELF
$PHP_SELF = $_SERVER['PHP_SELF'];
if ( empty($PHP_SELF) || ( constant( 'VHOST' ) == 'no' && $current_blog->path != '/' ) )
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
wp_cache_init(); // need to init cache again after blog_id is set
if ( function_exists('wp_cache_add_global_groups') ) { // need to add these again. Yes, it's an ugly hack
wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss'));
wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
}
if( !defined( "UPLOADS" ) )
define( "UPLOADS", "wp-content/blogs.dir/{$wpdb->blogid}/files/" );
require (ABSPATH . WPINC . '/plugin.php');
require (ABSPATH . WPINC . '/default-filters.php');
if( defined( "SHORTINIT" ) && constant( "SHORTINIT" ) == true ) // stop most of WP being loaded, we just want the basics
return false;
include_once(ABSPATH . WPINC . '/streams.php');
include_once(ABSPATH . WPINC . '/gettext.php');
require_once (ABSPATH . WPINC . '/l10n.php');
if ( !is_blog_installed() && !defined('WP_INSTALLING') ) {
die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark
}
require (ABSPATH . WPINC . '/formatting.php');
require (ABSPATH . WPINC . '/capabilities.php');
require (ABSPATH . WPINC . '/query.php');
require (ABSPATH . WPINC . '/theme.php');
require (ABSPATH . WPINC . '/user.php');
require (ABSPATH . WPINC . '/general-template.php');
require (ABSPATH . WPINC . '/link-template.php');
require (ABSPATH . WPINC . '/author-template.php');
require (ABSPATH . WPINC . '/post.php');
require (ABSPATH . WPINC . '/post-template.php');
require (ABSPATH . WPINC . '/category.php');
require (ABSPATH . WPINC . '/category-template.php');
require (ABSPATH . WPINC . '/comment.php');
require (ABSPATH . WPINC . '/comment-template.php');
require (ABSPATH . WPINC . '/rewrite.php');
require (ABSPATH . WPINC . '/feed.php');
require (ABSPATH . WPINC . '/bookmark.php');
require (ABSPATH . WPINC . '/bookmark-template.php');
require (ABSPATH . WPINC . '/kses.php');
require (ABSPATH . WPINC . '/cron.php');
require (ABSPATH . WPINC . '/version.php');
require (ABSPATH . WPINC . '/deprecated.php');
require (ABSPATH . WPINC . '/script-loader.php');
require (ABSPATH . WPINC . '/taxonomy.php');
require (ABSPATH . WPINC . '/update.php');
require (ABSPATH . WPINC . '/canonical.php');
require (ABSPATH . WPINC . '/shortcodes.php');
require (ABSPATH . WPINC . '/media.php');
if ( !defined('WP_CONTENT_URL') )
define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
require_once( ABSPATH . WPINC . '/wpmu-functions.php' );
require (ABSPATH . WPINC . '/wpmu-default-filters.php'); // WPmu Filters
/**
* Allows for the plugins directory to be moved from the default location.
*
* @since 2.6
*/
if ( !defined('WP_PLUGIN_DIR') )
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
if ( !defined('WP_PLUGIN_URL') )
define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
if ( !defined('PLUGINDIR') )
define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
if( !isset($current_site->site_name) )
$current_site->site_name = get_site_option('site_name');
if( $current_site->site_name == false )
$current_site->site_name = ucfirst( $current_site->domain );
// Used to guarantee unique hash cookies
$cookiehash = '';
/**
* Used to guarantee unique hash cookies
* @since 1.5
*/
define('COOKIEHASH', '' );
$wpdb->hide_errors();
if( defined( 'MUPLUGINDIR' ) == false )
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );
if( is_dir( ABSPATH . MUPLUGINDIR ) ) {
if( $dh = opendir( ABSPATH . MUPLUGINDIR ) ) {
while( ( $plugin = readdir( $dh ) ) !== false ) {
if( substr( $plugin, -4 ) == '.php' ) {
include_once( ABSPATH . MUPLUGINDIR . '/' . $plugin );
}
}
}
}
$wpdb->show_errors();
if ( '1' == $current_blog->deleted ) {
header('HTTP/1.1 410 Gone');
graceful_fail(__('This user has elected to delete their account and the content is no longer available.'));
}
if ( '2' == $current_blog->deleted )
graceful_fail( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact %1$s.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
if( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
header('HTTP/1.1 410 Gone');
graceful_fail(__('This blog has been archived or suspended.'));
}
/**
* Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
* @since 2.5
*/
$wp_default_secret_key = 'put your unique phrase here';
if( defined( 'SECRET_KEY' ) )
$wp_default_secret_key = SECRET_KEY;
/**
* It is possible to define this in wp-config.php
* @since 2.0.0
*/
if ( !defined('USER_COOKIE') )
define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
/**
* It is possible to define this in wp-config.php
* @since 2.0.0
*/
if ( !defined('PASS_COOKIE') )
define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
/**
* It is possible to define this in wp-config.php
* @since 2.5
*/
if ( !defined('AUTH_COOKIE') )
define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('SECURE_AUTH_COOKIE') )
define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('LOGGED_IN_COOKIE') )
define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
/**
* It is possible to define this in wp-config.php
* @since 2.3.0
*/
if ( !defined('TEST_COOKIE') )
define('TEST_COOKIE', 'wordpress_test_cookie');
/**
* It is possible to define this in wp-config.php
* @since 1.2.0
*/
if ( !defined('COOKIEPATH') )
define('COOKIEPATH', $current_site->path );
/**
* It is possible to define this in wp-config.php
* @since 1.5.0
*/
if ( !defined('SITECOOKIEPATH') )
define('SITECOOKIEPATH', $current_site->path );
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('ADMIN_COOKIE_PATH') ) {
if( constant( 'VHOST' ) == 'no' ) {
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
} else {
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
}
}
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('PLUGINS_COOKIE_PATH') )
define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );
/**
* It is possible to define this in wp-config.php
* @since 2.0.0
*/
if ( !defined('COOKIE_DOMAIN') )
define('COOKIE_DOMAIN', '.' . $current_site->domain);
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('FORCE_SSL_ADMIN') )
define('FORCE_SSL_ADMIN', false);
force_ssl_admin(FORCE_SSL_ADMIN);
/**
* It is possible to define this in wp-config.php
* @since 2.6
*/
if ( !defined('FORCE_SSL_LOGIN') )
define('FORCE_SSL_LOGIN', false);
force_ssl_login(FORCE_SSL_LOGIN);
/**
* It is possible to define this in wp-config.php
* @since 2.5.0
*/
if ( !defined( 'AUTOSAVE_INTERVAL' ) )
define( 'AUTOSAVE_INTERVAL', 60 );
require (ABSPATH . WPINC . '/vars.php');
if ( get_option('active_plugins') ) {
$current_plugins = get_option('active_plugins');
if ( is_array($current_plugins) ) {
foreach ($current_plugins as $plugin) {
if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
include_once(WP_PLUGIN_DIR . '/' . $plugin);
}
}
}
require (ABSPATH . WPINC . '/pluggable.php');
/*
* In most cases the default internal encoding is latin1, which is of no use,
* since we want to use the mb_ functions for utf-8 strings
*/
if (function_exists('mb_internal_encoding')) {
if (!@mb_internal_encoding(get_option('blog_charset')))
mb_internal_encoding('UTF-8');
}
if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
wp_cache_postload();
do_action('plugins_loaded');
$default_constants = array( 'WP_POST_REVISIONS' => true );
foreach ( $default_constants as $c => $v )
@define( $c, $v ); // will fail if the constant is already defined
unset($default_constants, $c, $v);
// If already slashed, strip.
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep($_GET );
$_POST = stripslashes_deep($_POST );
$_COOKIE = stripslashes_deep($_COOKIE);
}
// Escape with wpdb.
$_GET = add_magic_quotes($_GET );
$_POST = add_magic_quotes($_POST );
$_COOKIE = add_magic_quotes($_COOKIE);
$_SERVER = add_magic_quotes($_SERVER);
do_action('sanitize_comment_cookies');
/**
* WordPress Query object
* @global object $wp_the_query
* @since 2.0.0
*/
$wp_the_query =& new WP_Query();
/**
* Holds the reference to @see $wp_the_query
* Use this global for WordPress queries
* @global object $wp_query
* @since 1.5.0
*/
$wp_query =& $wp_the_query;
/**
* Holds the WordPress Rewrite object for creating pretty URLs
* @global object $wp_rewrite
* @since 1.5.0
*/
$wp_rewrite =& new WP_Rewrite();
/**
* WordPress Object
* @global object $wp
* @since 2.0.0
*/
$wp =& new WP();
do_action('setup_theme');
/**
* Web Path to the current active template directory
* @since 1.5
*/
define('TEMPLATEPATH', get_template_directory());
/**
* Web Path to the current active template stylesheet directory
* @since 2.1
*/
define('STYLESHEETPATH', get_stylesheet_directory());
// Load the default text localization domain.
load_default_textdomain();
/**
* The locale of the blog
* @since 1.5.0
*/
$locale = get_locale();
$locale_file = WP_LANG_DIR . "/$locale.php";
if ( is_readable($locale_file) )
require_once($locale_file);
// Pull in locale data after loading text domain.
require_once(ABSPATH . WPINC . '/locale.php');
/**
* WordPress Locale object for loading locale domain date and various strings.
* @global object $wp_locale
* @since 2.1.0
*/
$wp_locale =& new WP_Locale();
// Load functions for active theme.
if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
include(STYLESHEETPATH . '/functions.php');
if ( file_exists(TEMPLATEPATH . '/functions.php') )
include(TEMPLATEPATH . '/functions.php');
/**
* shutdown_action_hook() - Runs just before PHP shuts down execution.
*
* @access private
* @since 1.2
*/
function shutdown_action_hook() {
do_action('shutdown');
wp_cache_close();
}
register_shutdown_function('shutdown_action_hook');
$wp->init(); // Sets up current user.
// Everything is loaded and initialized.
do_action('init');
?>
blogs/wp-atom.php 0000644 0000000 0000000 00000001054 11077635520 012765 0 ustar root root
blogs/README.txt 0000644 0000000 0000000 00000016724 11077635520 012400 0 ustar root root WordPress Multi User
--------------------
WordPress MU is a multi user version of WordPress.
If you're not comfortable editing PHP code, taking care of a complex
webserver and database system and being pro-active about following
developments of this project then run, don't walk, to
http://wordpress.com/ and sign yourself and your friends up to free blogs.
It's easier in the long run and you'll save yourself a lot of pain
and angst.
Apache
======
Apache must be configured so that mod_rewrite works. Here are
instructions for Apache 2. Apache 1.3 is very similar.
1. Make sure a line like the following appears in your httpd.conf
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
2. In the directive of your virtual host, look for this
line
"AllowOverride None"
and change it to
"AllowOverride FileInfo Options"
3. In the section of the config file for your host there
will be a line defining the hostname. You need to add the following
if you want virtual hosts to work properly:
"ServerAlias *.domain.tld"
Replace domain.tld with whatever your one is, and remove the quotes.
DNS
===
If you want to host blogs of the form http://blog.domain.tld/ where
domain.tld is the domain name of your machine then you must add a
wildcard record to your DNS records.
This usually means adding a "*" hostname record pointing at your
webserver in your DNS configuration tool.
Matt has a more detailed explanation:
http://ma.tt/2003/10/10/wildcard-dns-and-sub-domains/
PHP
===
1. Don't display error messages to the browser. This is almost always
turned off but sometimes when you're testing you turn this on and forget
to reset it.
2. If your PHP is compiled with memory limit checks, the default is 8MB
which is much too small. You should increase this to at least 32MB or 64MB
to avoid PHP out of memory errors. Look for "memory_limit" in your php.ini
file.
3. GLOBAL variables must be turned off. This is one of the first things
any security aware admin will do. These days the default is for it to
be off!
The easiest way of configuring it is via the .htaccess file that is
created during the install. If you haven't installed WPMU yet then edit
the file htaccess.dist in this directory and add these two lines at the
top:
php_flag register_globals 0
php_flag display_errors 0
This is NOT included in that file by default because it doesn't work on
all machines. If it doesn't work on your machine, you'll get a cryptic
"500 internal error" after you install WPMU. To remove the offending lines
just edit the file ".htaccess" in your install directory and you'll see
them at the top. Delete and save the file again.
Read here for how to enable this: http://ie.php.net/configuration.changes
If you don't want to edit your .htaccess file then you need to change your
php.ini. It's beyond the scope of this README to know exactly where it is
on your machine, but if you're on a shared hosted server you probably
don't have access to it as it requires root or administrator privileges
to change.
If you do have root access, try "locate php.ini" or check in:
/etc/php4/apache2/php.ini
/usr/local/lib/php.ini
Once you have opened your php.ini, look for the sections related to
register_globals and display_errors. Make sure both are Off like so:
display_errors = Off
register_globals = Off
You'll have to restart Apache after you modify your php.ini for the
settings to be updated.
4. If you want to restrict blog signups, set the restrict domain email
setting in the admin.
Install
=======
1. Download and unzip the WordPress MU package, if you haven't already.
The unzipped files will be created in a directory named "wordpressmu"
followed by a version number.
2. Create a database for WordPress MU on your web server, as well as a
MySQL user who has all privileges for accessing and modifying it.
3. Place the WordPress MU files in the desired location on your web server:
* If you want to integrate WordPress MU into the root of your
domain (e.g. http://example.com/), move or upload all the files and
directories of the unzipped WordPress MU directory into the root
directory of your web server.
* If you want to have your WordPress MU installation in its own
subdirectory on your web site (e.g. http://example.com/blogs/),
rename the directory wordpressmu to the name you'd like the
subdirectory to have and move or upload it to your web server.
For example if you want the WordPress MU installation in a
subdirectory called "blog", you should rename the directory called
"wordpressmu" to "blogs" and upload it to the root directory of your
web server.
4. Make sure your install directory and the wp-contents directory are
writeable by the webserver.
5. Run the WordPress MU installation script by accessing index.php
in your favorite web browser.
* If you installed WordPress MU in the root directory, you should
visit: http://example.com/index.php
* If you installed WordPress MU in its own subdirectory called
blogs, for example, you should visit: http://example.com/blogs/index.php
(Adapted from http://codex.wordpress.org/Installing_WordPress)
If you're upgrading, skip to the end of this document.
ERROR LOGGING
=============
If you are developing a site based on WPMU it is recommended that you
turn on PHP error logging. Look in your php.ini for the section marked
"Error handling and logging" where you can configure it.
Mysql database errors are logged to the PHP error log if enabled or it
can also send error reports to a file of your choice. After installing,
edit wp-config.php and define a constant, "ERRORLOGFILE", pointing at
your MySQL error log. This file must be writeable by your webserver.
Please don't log to a file visible by your webserver or people may
figure out they can download it.
Example definition:
define( "ERRORLOGFILE", "/tmp/mysql.log" );
UPGRADING
=========
Please see this page for instructions on upgrading your install:
http://codex.wordpress.org/Upgrading_WPMU
PERFORMANCE
===========
WordPress MU has a caching framework which allows third party developers
to create cache engines that improve performance.
There are two types of caching plugins available for WordPress.
1. Object Cache.
These work by storing commonly accessed data in a rapid access storage
container such as RAM or directly on the filesystem.
To install these plugins copy them into your wp-content folder.
Memcached: http://dev.wp-plugins.org/browser/memcached/trunk/
Filesystem: http://neosmart.net/dl.php?id=14
Xcache: http://neosmart.net/dl.php?id=12
eAccelerator: http://neosmart.net/dl.php?id=13
2. Full page cache.
These work by storing complete web pages and are generally faster than
object cache plugins at the expense of less flexibility. On a busy
WordPress MU site these may in fact slow down your server due to
limitations in how the cached files are stored. Clearing out the cached
files on a regular basis will alleviate this problem. YMMV.
WP Super Cache: http://ocaoimh.ie/wp-super-cache/
Support Forum and Bug Reports
=============================
Please read http://codex.wordpress.org/Debugging_WPMU before
asking any questions. Without all the information required there
we'll just ask for it anyway or worse, your request will be ignored.
http://mu.wordpress.org/forums/
Trac is our bug tracking system. Again, please read the above link
before submitting a bug report.
http://trac.mu.wordpress.org/report/1
You can login to both sites using your wordpress.org username and
password.
http://mu.wordpress.org/
blogs/wp-includes/ 0000755 0000000 0000000 00000000000 11077645606 013130 5 ustar root root blogs/wp-includes/kses.php 0000644 0000000 0000000 00000075550 11077635520 014614 0 ustar root root
*
* @package External
* @subpackage KSES
*
* @internal
* *** CONTACT INFORMATION ***
* E-mail: metaur at users dot sourceforge dot net
* Web page: http://sourceforge.net/projects/kses
* Paper mail: Ulf Harnhammar
* Ymergatan 17 C
* 753 25 Uppsala
* SWEDEN
*
* [kses strips evil scripts!]
*/
/**
* You can override this in your my-hacks.php file
* You can also override this in a plugin file. The
* my-hacks.php is deprecated in its usage.
*
* @since 1.2.0
*/
if (!defined('CUSTOM_TAGS'))
define('CUSTOM_TAGS', false);
if (!CUSTOM_TAGS) {
/**
* Kses global for default allowable HTML tags
*
* Can be override by using CUSTOM_TAGS constant
* @global array $allowedposttags
* @since 2.0.0
*/
$allowedposttags = array(
'address' => array(),
'a' => array(
'class' => array (),
'href' => array (),
'id' => array (),
'title' => array (),
'rel' => array (),
'rev' => array (),
'name' => array (),
'target' => array()),
'abbr' => array(
'class' => array (),
'title' => array ()),
'acronym' => array(
'title' => array ()),
'b' => array(),
'big' => array(),
'blockquote' => array(
'id' => array (),
'cite' => array (),
'class' => array(),
'lang' => array(),
'xml:lang' => array()),
'br' => array (
'class' => array ()),
'button' => array(
'disabled' => array (),
'name' => array (),
'type' => array (),
'value' => array ()),
'caption' => array(
'align' => array (),
'class' => array ()),
'cite' => array (
'class' => array(),
'dir' => array(),
'lang' => array(),
'title' => array ()),
'code' => array (
'style' => array()),
'col' => array(
'align' => array (),
'char' => array (),
'charoff' => array (),
'span' => array (),
'dir' => array(),
'style' => array (),
'valign' => array (),
'width' => array ()),
'del' => array(
'datetime' => array ()),
'dd' => array(),
'div' => array(
'align' => array (),
'class' => array (),
'dir' => array (),
'id' => array (),
'lang' => array(),
'style' => array (),
'xml:lang' => array()),
'dl' => array(),
'dt' => array(),
'em' => array(),
'fieldset' => array(),
'font' => array(
'color' => array (),
'face' => array (),
'size' => array ()),
'form' => array(
'action' => array (),
'accept' => array (),
'accept-charset' => array (),
'enctype' => array (),
'method' => array (),
'name' => array (),
'target' => array ()),
'h1' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'h2' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'h3' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'h4' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'h5' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'h6' => array(
'align' => array (),
'style' => array (),
'class' => array ()),
'hr' => array(
'align' => array (),
'class' => array (),
'noshade' => array (),
'size' => array (),
'width' => array ()),
'i' => array(),
'img' => array(
'alt' => array (),
'align' => array (),
'border' => array (),
'class' => array (),
'height' => array (),
'hspace' => array (),
'longdesc' => array (),
'vspace' => array (),
'src' => array (),
'style' => array (),
'width' => array ()),
'ins' => array(
'datetime' => array (),
'cite' => array ()),
'kbd' => array(),
'label' => array(
'for' => array ()),
'legend' => array(
'align' => array ()),
'li' => array (
'align' => array (),
'class' => array ()),
'p' => array(
'class' => array (),
'align' => array (),
'dir' => array(),
'lang' => array(),
'style' => array (),
'xml:lang' => array()),
'pre' => array(
'style' => array(),
'width' => array ()),
'q' => array(
'cite' => array ()),
's' => array(),
'span' => array (
'class' => array (),
'dir' => array (),
'align' => array (),
'lang' => array (),
'style' => array (),
'title' => array (),
'xml:lang' => array()),
'strike' => array(),
'strong' => array(),
'sub' => array(),
'sup' => array(),
'table' => array(
'align' => array (),
'bgcolor' => array (),
'border' => array (),
'cellpadding' => array (),
'cellspacing' => array (),
'class' => array (),
'dir' => array(),
'id' => array(),
'rules' => array (),
'style' => array (),
'summary' => array (),
'width' => array ()),
'tbody' => array(
'align' => array (),
'char' => array (),
'charoff' => array (),
'valign' => array ()),
'td' => array(
'abbr' => array (),
'align' => array (),
'axis' => array (),
'bgcolor' => array (),
'char' => array (),
'charoff' => array (),
'class' => array (),
'colspan' => array (),
'dir' => array(),
'headers' => array (),
'height' => array (),
'nowrap' => array (),
'rowspan' => array (),
'scope' => array (),
'style' => array (),
'valign' => array (),
'width' => array ()),
'textarea' => array(
'cols' => array (),
'rows' => array (),
'disabled' => array (),
'name' => array (),
'readonly' => array ()),
'tfoot' => array(
'align' => array (),
'char' => array (),
'class' => array (),
'charoff' => array (),
'valign' => array ()),
'th' => array(
'abbr' => array (),
'align' => array (),
'axis' => array (),
'bgcolor' => array (),
'char' => array (),
'charoff' => array (),
'class' => array (),
'colspan' => array (),
'headers' => array (),
'height' => array (),
'nowrap' => array (),
'rowspan' => array (),
'scope' => array (),
'valign' => array (),
'width' => array ()),
'thead' => array(
'align' => array (),
'char' => array (),
'charoff' => array (),
'class' => array (),
'valign' => array ()),
'title' => array(),
'tr' => array(
'align' => array (),
'bgcolor' => array (),
'char' => array (),
'charoff' => array (),
'class' => array (),
'style' => array (),
'valign' => array ()),
'tt' => array(),
'u' => array(),
'ul' => array (
'class' => array (),
'style' => array (),
'type' => array ()),
'ol' => array (
'class' => array (),
'start' => array (),
'style' => array (),
'type' => array ()),
'var' => array ());
/**
* Kses allowed HTML elements
*
* @global array $allowedtags
* @since 1.0.0
*/
$allowedtags = array(
'a' => array(
'href' => array (),
'title' => array ()),
'abbr' => array(
'title' => array ()),
'acronym' => array(
'title' => array ()),
'b' => array(),
'blockquote' => array(
'cite' => array ()),
// 'br' => array(),
'cite' => array (),
'code' => array(),
'del' => array(
'datetime' => array ()),
// 'dd' => array(),
// 'dl' => array(),
// 'dt' => array(),
'em' => array (), 'i' => array (),
// 'ins' => array('datetime' => array(), 'cite' => array()),
// 'li' => array(),
// 'ol' => array(),
// 'p' => array(),
'q' => array(
'cite' => array ()),
'strike' => array(),
'strong' => array(),
// 'sub' => array(),
// 'sup' => array(),
// 'u' => array(),
// 'ul' => array(),
);
}
/**
* wp_kses() - Filters content and keeps only allowable HTML elements.
*
* This function makes sure that only the allowed HTML element names,
* attribute names and attribute values plus only sane HTML entities
* will occur in $string. You have to remove any slashes from PHP's
* magic quotes before you call this function.
*
* The default allowed protocols are 'http', 'https', 'ftp', 'mailto',
* 'news', 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This
* covers all common link protocols, except for 'javascript' which
* should not be allowed for untrusted users.
*
* @since 1.0.0
*
* @param string $string Content to filter through kses
* @param array $allowed_html List of allowed HTML elements
* @param array $allowed_protocols Optional. Allowed protocol in links.
* @return string Filtered content with only allowed HTML elements
*/
function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) {
$string = wp_kses_no_null($string);
$string = wp_kses_js_entities($string);
$string = wp_kses_normalize_entities($string);
$allowed_html_fixed = wp_kses_array_lc($allowed_html);
$string = wp_kses_hook($string, $allowed_html_fixed, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols);
}
/**
* wp_kses_hook() - You add any kses hooks here.
*
* There is currently only one kses WordPress hook and it is
* called here. All parameters are passed to the hooks and
* expected to recieve a string.
*
* @since 1.0.0
*
* @param string $string Content to filter through kses
* @param array $allowed_html List of allowed HTML elements
* @param array $allowed_protocols Allowed protocol in links
* @return string Filtered content through 'pre_kses' hook
*/
function wp_kses_hook($string, $allowed_html, $allowed_protocols) {
$string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols);
return $string;
}
/**
* wp_kses_version() - This function returns kses' version number.
*
* @since 1.0.0
*
* @return string Version Number
*/
function wp_kses_version() {
return '0.2.2';
}
/**
* wp_kses_split() - Searches for HTML tags, no matter how malformed
*
* It also matches stray ">" characters.
*
* @since 1.0.0
*
* @param string $string Content to filter
* @param array $allowed_html Allowed HTML elements
* @param array $allowed_protocols Allowed protocols to keep
* @return string Content with fixed HTML tags
*/
function wp_kses_split($string, $allowed_html, $allowed_protocols) {
return preg_replace('%((|$))|(<[^>]*(>|$)|>))%e',
"wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string);
}
/**
* wp_kses_split2() - Callback for wp_kses_split for fixing malformed HTML tags
*
* This function does a lot of work. It rejects some very malformed things
* like <:::>. It returns an empty string, if the element isn't allowed (look
* ma, no strip_tags()!). Otherwise it splits the tag into an element and an
* attribute list.
*
* After the tag is split into an element and an attribute list, it is run
* through another filter which will remove illegal attributes and once
* that is completed, will be returned.
*
* @since 1.0.0
* @uses wp_kses_attr()
*
* @param string $string Content to filter
* @param array $allowed_html Allowed HTML elements
* @param array $allowed_protocols Allowed protocols to keep
* @return string Fixed HTML element
*/
function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
$string = wp_kses_stripslashes($string);
if (substr($string, 0, 1) != '<')
return '>';
# It matched a ">" character
if (preg_match('%^)?$%', $string, $matches)) {
$string = str_replace(array(''), '', $matches[1]);
while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) )
$string = $newstring;
if ( $string == '' )
return '';
// prevent multiple dashes in comments
$string = preg_replace('/--+/', '-', $string);
// prevent three dashes closing a comment
$string = preg_replace('/-$/', '', $string);
return "";
}
# Allow HTML comments
if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
return '';
# It's seriously malformed
$slash = trim($matches[1]);
$elem = $matches[2];
$attrlist = $matches[3];
if (!@isset($allowed_html[strtolower($elem)]))
return '';
# They are using a not allowed HTML element
if ($slash != '')
return "<$slash$elem>";
# No attributes are allowed for closing elements
return wp_kses_attr("$slash$elem", $attrlist, $allowed_html, $allowed_protocols);
}
/**
* wp_kses_attr() - Removes all attributes, if none are allowed for this element
*
* If some are allowed it calls wp_kses_hair() to split them further, and then
* it builds up new HTML code from the data that kses_hair() returns. It also
* removes "<" and ">" characters, if there are any left. One more thing it
* does is to check if the tag has a closing XHTML slash, and if it does, it
* puts one in the returned code as well.
*
* @since 1.0.0
*
* @param string $element HTML element/tag
* @param string $attr HTML attributes from HTML element to closing HTML element tag
* @param array $allowed_html Allowed HTML elements
* @param array $allowed_protocols Allowed protocols to keep
* @return string Sanitized HTML element
*/
function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
# Is there a closing XHTML slash at the end of the attributes?
$xhtml_slash = '';
if (preg_match('%\s/\s*$%', $attr))
$xhtml_slash = ' /';
# Are any attributes allowed at all for this element?
if (@ count($allowed_html[strtolower($element)]) == 0)
return "<$element$xhtml_slash>";
# Split it
$attrarr = wp_kses_hair($attr, $allowed_protocols);
# Go through $attrarr, and save the allowed attributes for this element
# in $attr2
$attr2 = '';
foreach ($attrarr as $arreach) {
if (!@ isset ($allowed_html[strtolower($element)][strtolower($arreach['name'])]))
continue; # the attribute is not allowed
$current = $allowed_html[strtolower($element)][strtolower($arreach['name'])];
if ($current == '')
continue; # the attribute is not allowed
if (!is_array($current))
$attr2 .= ' '.$arreach['whole'];
# there are no checks
else {
# there are some checks
$ok = true;
foreach ($current as $currkey => $currval)
if (!wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval)) {
$ok = false;
break;
}
if ( $arreach['name'] == 'style' ) {
$orig_value = $arreach['value'];
$value = safecss_filter_attr($orig_value, $element);
if ( empty($value) )
continue;
$arreach['value'] = $value;
$arreach['whole'] = str_replace($orig_value, $value, $arreach['whole']);
}
if ($ok)
$attr2 .= ' '.$arreach['whole']; # it passed them
} # if !is_array($current)
} # foreach
# Remove any "<" or ">" characters
$attr2 = preg_replace('/[<>]/', '', $attr2);
return "<$element$attr2$xhtml_slash>";
}
/**
* wp_kses_hair() - Builds an attribute list from string containing attributes.
*
* This function does a lot of work. It parses an attribute list into an array
* with attribute data, and tries to do the right thing even if it gets weird
* input. It will add quotes around attribute values that don't have any quotes
* or apostrophes around them, to make it easier to produce HTML code that will
* conform to W3C's HTML specification. It will also remove bad URL protocols
* from attribute values. It also reduces duplicate attributes by using the
* attribute defined first (foo='bar' foo='baz' will result in foo='bar').
*
* @since 1.0.0
*
* @param string $attr Attribute list from HTML element to closing HTML element tag
* @param array $allowed_protocols Allowed protocols to keep
* @return array List of attributes after parsing
*/
function wp_kses_hair($attr, $allowed_protocols) {
$attrarr = array ();
$mode = 0;
$attrname = '';
# Loop through the whole attribute list
while (strlen($attr) != 0) {
$working = 0; # Was the last operation successful?
switch ($mode) {
case 0 : # attribute name, href for instance
if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) {
$attrname = $match[1];
$working = $mode = 1;
$attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
}
break;
case 1 : # equals sign or valueless ("selected")
if (preg_match('/^\s*=\s*/', $attr)) # equals sign
{
$working = 1;
$mode = 2;
$attr = preg_replace('/^\s*=\s*/', '', $attr);
break;
}
if (preg_match('/^\s+/', $attr)) # valueless
{
$working = 1;
$mode = 0;
if(FALSE === array_key_exists($attrname, $attrarr)) {
$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
}
$attr = preg_replace('/^\s+/', '', $attr);
}
break;
case 2 : # attribute value, a URL after href= for instance
if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
# "value"
{
$thisval = ($attrname=='style') ? $match[1] : wp_kses_bad_protocol($match[1], $allowed_protocols);
if(FALSE === array_key_exists($attrname, $attrarr)) {
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
}
$working = 1;
$mode = 0;
$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
break;
}
if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
# 'value'
{
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
if(FALSE === array_key_exists($attrname, $attrarr)) {
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
}
$working = 1;
$mode = 0;
$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
break;
}
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
# value
{
$thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
if(FALSE === array_key_exists($attrname, $attrarr)) {
$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
}
# We add quotes to conform to W3C's HTML spec.
$working = 1;
$mode = 0;
$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
}
break;
} # switch
if ($working == 0) # not well formed, remove and try again
{
$attr = wp_kses_html_error($attr);
$mode = 0;
}
} # while
if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr))
# special case, for when the attribute list ends with a valueless
# attribute like "selected"
$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
return $attrarr;
}
/**
* wp_kses_check_attr_val() - Performs different checks for attribute values.
*
* The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
* and "valueless" with even more checks to come soon.
*
* @since 1.0.0
*
* @param string $value Attribute value
* @param string $vless Whether the value is valueless or not. Use 'y' or 'n'
* @param string $checkname What $checkvalue is checking for.
* @param mixed $checkvalue What constraint the value should pass
* @return bool Whether check passes (true) or not (false)
*/
function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
$ok = true;
switch (strtolower($checkname)) {
case 'maxlen' :
# The maxlen check makes sure that the attribute value has a length not
# greater than the given value. This can be used to avoid Buffer Overflows
# in WWW clients and various Internet servers.
if (strlen($value) > $checkvalue)
$ok = false;
break;
case 'minlen' :
# The minlen check makes sure that the attribute value has a length not
# smaller than the given value.
if (strlen($value) < $checkvalue)
$ok = false;
break;
case 'maxval' :
# The maxval check does two things: it checks that the attribute value is
# an integer from 0 and up, without an excessive amount of zeroes or
# whitespace (to avoid Buffer Overflows). It also checks that the attribute
# value is not greater than the given value.
# This check can be used to avoid Denial of Service attacks.
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
$ok = false;
if ($value > $checkvalue)
$ok = false;
break;
case 'minval' :
# The minval check checks that the attribute value is a positive integer,
# and that it is not smaller than the given value.
if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
$ok = false;
if ($value < $checkvalue)
$ok = false;
break;
case 'valueless' :
# The valueless check checks if the attribute has a value
# (like ) or not (