Make WordPress Core


Ignore:
Timestamp:
01/18/2010 10:21:36 PM (15 years ago)
Author:
ryan
Message:

Use cap checks instead of multisite and super admin checks. Add some new caps. Merge cleanup. see #11644.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r12733 r12753  
    371371            $this->show_errors();
    372372
    373                 if( is_multisite() ) {
    374                         $this->charset = 'utf8';
    375                         if( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' ) {
    376                                 $this->collate = constant( 'DB_COLLATE' );
    377                         } else {
    378                                 $this->collate = 'utf8_general_ci';
    379                         }
    380                 }
     373        if ( is_multisite() ) {
     374            $this->charset = 'utf8';
     375            if ( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' )
     376                $this->collate = constant( 'DB_COLLATE' );
     377            else
     378                $this->collate = 'utf8_general_ci';
     379        }
    381380
    382381        if ( defined('DB_CHARSET') )
     
    447446            return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
    448447
    449                 if( is_multisite() ) {
    450                         $old_prefix = '';
    451                 } else {
    452                         $old_prefix = $prefix;
    453                 }
    454         if( isset( $this->base_prefix ) )
     448        if ( is_multisite() )
     449            $old_prefix = '';
     450        else
     451            $old_prefix = $prefix;
     452
     453        if ( isset( $this->base_prefix ) )
    455454            $old_prefix = $this->base_prefix;
    456455        $this->base_prefix = $prefix;
     
    665664            return false;
    666665
    667                 // If there is an error then take note of it
    668                 if( is_multisite() ) {
    669                         $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
    670                         if( defined( 'ERRORLOGFILE' ) )
    671                                 error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
    672                         if( defined( 'DIEONDBERROR' ) )
    673                                 die( $msg );
    674                 } else {
    675                         $str = htmlspecialchars($str, ENT_QUOTES);
    676                         $query = htmlspecialchars($this->last_query, ENT_QUOTES);
    677 
    678                         print "<div id='error'>
    679                         <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
    680                         <code>$query</code></p>
    681                         </div>";
    682                 }
     666        // If there is an error then take note of it
     667        if ( is_multisite() ) {
     668            $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
     669            if ( defined( 'ERRORLOGFILE' ) )
     670                error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
     671            if ( defined( 'DIEONDBERROR' ) )
     672                die( $msg );
     673        } else {
     674            $str = htmlspecialchars($str, ENT_QUOTES);
     675            $query = htmlspecialchars($this->last_query, ENT_QUOTES);
     676
     677            print "<div id='error'>
     678            <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
     679            <code>$query</code></p>
     680            </div>";
     681        }
    683682    }
    684683
     
    740739    function db_connect( $query = "SELECT" ) {
    741740        global $db_list, $global_db_list;
    742         if( is_array( $db_list ) == false )
     741        if ( is_array( $db_list ) == false )
    743742            return true;
    744743
    745         if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
     744        if ( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
    746745            $action = 'global';
    747746            $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
Note: See TracChangeset for help on using the changeset viewer.