WordPress.org

WordPress MU

Changeset 797


Ignore:
Timestamp:
10/09/06 11:39:17 (8 years ago)
Author:
donncha
Message:

WP Merge - needs testing.

Location:
trunk
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-activate.php

    r596 r797  
    2626    if ( empty($_GET['key']) && empty($_POST['key']) ) { 
    2727?> 
    28 <h2>Activation Key Required</h2> 
     28<h2><?php _e('Activation Key Required') ?></h2> 
    2929<form name="activateform" id="activateform" method="post" action="/wp-activate.php"> 
    3030<table border="0" width="100%" cellpadding="9"> 
    3131<tr> 
    32 <th valign="top">Activation Key:</th> 
     32<th valign="top"><?php _e('Activation Key:') ?></th> 
    3333<td><input name="key" type="text" id="key" value="" /></td> 
    3434</tr> 
    3535<tr> 
    3636<th scope="row"  valign="top">&nbsp;</th> 
    37 <td><input id="submit" type="submit" name="Submit" class="submit" value="Activate &raquo;" /></td> 
     37<td><input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Activate &raquo;') ?>" /></td> 
    3838</tr> 
    3939</table> 
  • trunk/wp-admin/admin-functions.php

    r789 r797  
    19851985 
    19861986    $icon = get_attachment_icon($post->ID); 
    1987  
     1987    $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true ); 
     1988    $thumb = isset($attachment_data['thumb']); 
    19881989?> 
    19891990<form id="the-attachment-links"> 
    19901991<table> 
     1992    <col /> 
     1993    <col class="widefat" /> 
    19911994    <tr> 
    1992         <th scope="row"><?php _e('Text linked to file') ?></th> 
    1993         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></td> 
    1994     </tr> 
    1995     <tr> 
    1996         <th scope="row"><?php _e('Text linked to subpost') ?></th> 
    1997         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></td> 
     1995        <th scope="row"><?php _e('URL') ?></th> 
     1996        <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo $post->guid ?></textarea></td> 
    19981997    </tr> 
    19991998<?php if ( $icon ) : ?> 
    20001999    <tr> 
    2001         <th scope="row"><?php _e('Thumbnail linked to file') ?></th> 
    2002         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></td> 
     2000        <th scope="row"><?php $thumb ? _e('Thumbnail linked to file') : _e('Image linked to file'); ?></th> 
     2001        <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid; ?>" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td> 
    20032002    </tr> 
    20042003    <tr> 
    2005         <th scope="row"><?php _e('Thumbnail linked to subpost') ?></th> 
     2004        <th scope="row"><?php $thumb ? _e('Thumbnail linked to page') : _e('Image linked to file'); ?></th> 
    20062005        <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></td> 
     2006    </tr> 
     2007<?php else : ?> 
     2008    <tr> 
     2009        <th scope="row"><?php _e('Link to file') ?></th> 
     2010        <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid);  ?></a></textarea></td> 
     2011    </tr> 
     2012    <tr> 
     2013        <th scope="row"><?php _e('Link to page') ?></th> 
     2014        <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td> 
    20072015    </tr> 
    20082016<?php endif; ?> 
  • trunk/wp-admin/comment.php

    r784 r797  
    1313case 'editcomment': 
    1414    $title = __('Edit Comment'); 
    15  
     15    if ( user_can_richedit() ) 
     16        wp_enqueue_script( 'wp_tiny_mce' ); 
    1617    require_once ('admin-header.php'); 
    1718 
  • trunk/wp-admin/edit-category-form.php

    r567 r797  
    3030            <th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th> 
    3131            <td>         
    32             <select name='category_parent' id='category_parent'> 
    33       <option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option> 
    34       <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?> 
    35       </select></td> 
     32                <?php wp_dropdown_categories('hide_empty=0&name=category_parent&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?> 
     33            </td> 
    3634        </tr> 
    3735        <tr> 
  • trunk/wp-admin/edit-form-comment.php

    r788 r797  
    3737</fieldset> 
    3838 
    39 <fieldset style="clear: both;"> 
     39<fieldset id="<?php echo user_can_richedit() ? 'commentdivrich' : 'commentdiv'; ?>" style="clear: both;"> 
    4040        <legend><?php _e('Comment') ?></legend> 
    4141    <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?> 
  • trunk/wp-admin/export.php

    r793 r797  
    2020</p> 
    2121</form> 
     22<p><?php _e('If you are considering moving your blog to another host we recommend a number of <a href="http://wordpress.org/hosting/">hosting services</a>.'); ?></p> 
    2223</div> 
    2324</div> 
  • trunk/wp-admin/import/mt.php

    r793 r797  
    5353        global $wpdb; 
    5454        //mtnames is an array with the names in the mt import file 
    55         $pass = 'changeme'; 
    56         if (!(in_array($author, $this->mtnames))) { //a new mt author name is found 
    57             ++ $this->j; 
    58             $this->mtnames[$this->j] = $author; //add that new mt author name to an array  
    59             $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 
    60             if (!$user_id) { //banging my head against the desk now.  
    61                 if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname 
    62                     $user_id = wp_create_user($author, $pass); 
    63                     $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. 
    64                 } else { 
    65                     $user_id = wp_create_user($this->newauthornames[$this->j], $pass); 
    66                 } 
    67             } else { 
    68                 return $user_id; // return pre-existing wp username if it exists 
    69             } 
    70         } else { 
    71             $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array 
    72             $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames 
    73         } 
     55        $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array 
     56        $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames 
    7457 
    7558        return $user_id; 
     
    11396        $selectnames = array (); 
    11497 
    115         foreach ($_POST['user'] as $key => $line) { 
    116             $newname = trim(stripslashes($line)); 
    117             if ($newname == '') 
    118                 $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form. 
    119             array_push($formnames, "$newname"); 
    120         } // $formnames is the array with the form entered names 
    121  
    12298        foreach ($_POST['userselect'] as $user => $key) { 
    12399            $selected = trim(stripslashes($key)); 
     
    151127        foreach ($authors as $author) { 
    152128            ++ $j; 
    153             echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />'); 
     129            echo '<li><i>'.$author.'</i><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">'; 
    154130            $this->users_form($j); 
    155131            echo '</li>'; 
    156132        } 
    157133 
    158         echo '<input type="submit" value="'.__('Submit').'">'.'<br/>'; 
     134        echo '<input type="submit" value="Submit">'.'<br/>'; 
    159135        echo '</form>'; 
    160136        echo '</ol></div>'; 
     
    165141        $file = wp_import_handle_upload(); 
    166142        if ( isset($file['error']) ) { 
    167             $this->header(); 
    168             echo '<p>'.__('Sorry, there has been an error').'.</p>'; 
    169             echo '<p><strong>' . $file['error'] . '</strong></p>'; 
    170             $this->footer(); 
     143            echo $file['error']; 
    171144            return; 
    172145        } 
     
    200173                // We want the excerpt 
    201174                preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt); 
    202                 $post_excerpt = $wpdb->escape(trim($excerpt[1])); 
     175                $excerpt = $wpdb->escape(trim($excerpt[1])); 
    203176                $post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post); 
    204177 
     
    337310                } 
    338311                if ( $num_comments ) 
    339                     printf(' '.__('(%s comments)'), $num_comments); 
     312                    printf(__(' (%s comments)'), $num_comments); 
    340313 
    341314                // Finally the pings 
     
    385358                } 
    386359                if ( $num_pings ) 
    387                     printf(' '.__('(%s pings)'), $num_pings); 
     360                    printf(__(' (%s pings)'), $num_pings); 
    388361 
    389362                echo "</li>"; 
  • trunk/wp-admin/import/wordpress.php

    r793 r797  
    2727    function greet() { 
    2828        echo '<div class="narrow">'; 
    29         echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts and comments into this blog.').'</p>'; 
     29        echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, comments, custom fields, and categories into this blog.').'</p>'; 
    3030        wp_import_upload_form("admin.php?import=wordpress&amp;step=1"); 
    3131        echo '</div>'; 
     
    151151        foreach ($authors as $author) { 
    152152            ++ $j; 
    153             echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />'); 
    154             $this->users_form($j); 
     153            echo '<li>Current author: <strong>'.$author.'</strong><br />'.'Map to existing: '; 
     154            $this->users_form($author); 
    155155            echo '</li>'; 
    156156        } 
     
    309309$wp_import = new WP_Import(); 
    310310 
    311 register_importer('wordpress', 'WordPress', __('Import posts from a WordPress export file'), array ($wp_import, 'dispatch')); 
     311register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, and categories</strong> from a WordPress export file'), array ($wp_import, 'dispatch')); 
    312312 
    313313?> 
  • trunk/wp-admin/options-privacy.php

    r766 r797  
    2323<br /> 
    2424<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> /> 
    25     <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal folks') ?></label> 
     25    <label for="blog-norobots"><?php _e( 'I would like to block search engines, but allow normal visitors' ); ?></label> 
    2626<?php do_action('blog_privacy_selector'); ?> 
    2727</td> 
  • trunk/wp-admin/options-reading.php

    r761 r797  
    66 
    77include('admin-header.php'); 
     8 
     9// Sanity checks 
     10if ( 'page' == get_option('show_on_front') ) { 
     11    $front_page = get_option('page_on_front'); 
     12    if ( empty($front_page) ) { 
     13        update_option('show_on_front', 'posts'); 
     14        delete_option('page_for_posts'); 
     15        delete_option('page_on_front'); 
     16    } 
     17} 
    818?> 
    919 
  • trunk/wp-admin/page.php

    r793 r797  
    4646    $page_ID = $post_ID = $p = (int) $_GET['post']; 
    4747    $post = get_post_to_edit($page_ID); 
     48    if( $post->post_type == 'post' ) { 
     49        header( "Location: " . str_replace( "page.php", "post.php", $_SERVER[ 'REQUEST_URI' ] ) ); 
     50        die(); 
     51    } 
    4852    if($post->post_status == 'draft') { 
    4953        wp_enqueue_script('prototype'); 
    5054        wp_enqueue_script('autosave'); 
    51     } 
    52     if( $post->post_type == 'post' ) { 
    53         header( "Location: " . str_replace( "page.php", "post.php", $_SERVER[ 'REQUEST_URI' ] ) ); 
    54         die(); 
    5555    } 
    5656    require_once('admin-header.php'); 
  • trunk/wp-admin/profile-update.php

    r638 r797  
    2222update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true ); 
    2323 
     24if ( isset( $_POST['primary_blog'] ) ) { 
     25    $primary_blog = (int) $_POST['primary_blog']; 
     26    update_user_option( $current_user->id, 'primary_blog', $primary_blog, true ); 
     27} 
     28 
    2429do_action('personal_options_update'); 
    2530 
  • trunk/wp-admin/themes.php

    r738 r797  
    7070<div id="currenttheme"> 
    7171<?php if ( $ct->screenshot ) : ?> 
    72 <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> 
     72<img src="../<?php echo $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> 
    7373<?php endif; ?> 
    74 <h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3> 
     74<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, '', $ct->author) ; ?></h3> 
    7575<p><?php echo $ct->description; ?></p> 
    7676</div> 
     
    9999?> 
    100100<div class="available-theme"> 
    101 <h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3> 
     101<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title"; ?></a></h3> 
    102102 
    103103<a href="<?php echo $activate_link; ?>" class="screenshot"> 
    104104<?php if ( $screenshot ) : ?> 
    105 <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> 
     105<img src="../<?php echo $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> 
    106106<?php endif; ?> 
    107107</a> 
  • trunk/wp-admin/upgrade-functions.php

    r789 r797  
    513513        if ( !empty($posts) ) 
    514514            foreach ( $posts as $post ) 
    515                 wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', $post->ID); 
     515                wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID)); 
    516516    } 
    517517    if ( $wp_current_db_version < 3570 ) { 
     
    687687    // Create a tablename index for an array ($cqueries) of queries 
    688688    foreach($queries as $qry) { 
    689         if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { 
     689        if(preg_match("|CREATE TABLE (?:IF NOT EXISTS )?([^ ]*)|", $qry, $matches)) { 
    690690            $cqueries[strtolower($matches[1])] = $qry; 
    691691            $for_update[$matches[1]] = 'Created table '.$matches[1]; 
  • trunk/wp-admin/upgrade.php

    r784 r797  
    4747            $wpdb->query( "INSERT INTO wp_blog_versions ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" ); 
    4848        } 
    49  
    5049?>  
    5150<h2><?php _e('Step 1'); ?></h2>  
  • trunk/wp-admin/upload-functions.php

    r793 r797  
    1717        $image_src = explode('"', $image_src); 
    1818        $image_src = $image_src[1]; 
     19        $image_rel = wp_make_link_relative($image_src); 
    1920        $class = 'image'; 
    20         $innerHTML = '&nbsp;' . $innerHTML; 
     21        $innerHTML = '&nbsp;' . str_replace($image_src, $image_rel, $innerHTML); 
     22        $image_base = str_replace($image_rel, '', $image_src); 
    2123    } 
     24 
     25    $src_base = get_the_guid(); 
     26    $src = wp_make_link_relative( $src_base ); 
     27    $src_base = str_replace($src, '', $src_base); 
    2228 
    2329    $r = ''; 
     
    3036        $r .= "</a>\n"; 
    3137    $r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n"; 
    32     $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='" . get_the_guid() . "' />\n"; 
    33  
    34     if ( $image_src ) 
    35         $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_src' />\n"; 
     38    $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n"; 
     39    $r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n"; 
     40 
     41    if ( isset($attachment_data['thumb']) ) { 
     42        $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$image_rel' />\n"; 
     43        $r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$image_base' />\n"; 
     44    } elseif ( $image_rel ) 
     45        $r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='1' />\n"; 
    3646    if ( isset($width) ) { 
    3747        $r .= "\t\t\t\t<input type='hidden' name='attachment-width-$id' id='attachment-width-$id' value='$width' />\n"; 
     
    4656 
    4757function wp_upload_view() { 
    48     global $style, $post_id; 
     58    global $style, $post_id, $style; 
    4959    $id = get_the_ID(); 
    5060    $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true ); 
     
    5262    <div id="upload-file"> 
    5363        <div id="file-title"> 
    54             <h2><?php if ( !isset($attachment_data['width']) ) 
     64            <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 
    5565                    echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 
    5666                the_title(); 
    57                 if ( !isset($attachment_data['width']) ) 
     67                if ( !isset($attachment_data['width']) && 'inline' != $style ) 
    5868                    echo '</a>'; 
    5969            ?></h2> 
     
    6979 
    7080        <div id="upload-file-view" class="alignleft"> 
    71 <?php       if ( isset($attachment_data['width']) ) 
     81<?php       if ( isset($attachment_data['width']) && 'inline' != $style ) 
    7282            echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 
    7383        echo wp_upload_display( array(171, 128) ); 
    74         if ( isset($attachment_data['width']) ) 
     84        if ( isset($attachment_data['width']) && 'inline' != $style ) 
    7585            echo '</a>'; ?> 
    7686        </div> 
    7787        <?php the_attachment_links( $id ); ?> 
    7888    </div> 
    79 <?php       echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' )  . "' /></form>\n"; 
     89<?php   echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' )  . "' /></form>\n"; 
    8090} 
    8191 
     
    92102?> 
    93103        <div id="file-title"> 
    94             <h2><?php if ( !isset($attachment_data['width']) ) 
     104            <h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style ) 
    95105                    echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 
    96106                the_title(); 
    97                 if ( !isset($attachment_data['width']) ) 
     107                if ( !isset($attachment_data['width']) && 'inline' != $style ) 
    98108                    echo '</a>'; 
    99109            ?></h2> 
     
    109119 
    110120    <div id="upload-file-view" class="alignleft"> 
    111 <?php       if ( isset($attachment_data['width']) ) 
     121<?php       if ( isset($attachment_data['width']) && 'inline' != $style ) 
    112122            echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>"; 
    113123        echo wp_upload_display( array(171, 128) ); 
    114         if ( isset($attachment_data['width']) ) 
     124        if ( isset($attachment_data['width']) && 'inline' != $style ) 
    115125            echo '</a>'; ?> 
    116126    </div> 
    117127<?php   endif; ?> 
    118         <table> 
    119 <?php   if ( !$id ): ?> 
     128        <table><col /><col class="widefat" /> 
     129<?php   if ( $id ): ?> 
    120130            <tr> 
    121                 <th scope="row"><label for="upload"><?php _e('File:'); ?></label></th> 
     131                <th scope="row"><label for="url"><?php _e('URL'); ?></label></th> 
     132                <td><input type="text" id="url" class="readonly" value="<?php the_guid(); ?>" readonly="readonly" /></td> 
     133            </tr> 
     134<?php   else : ?> 
     135            <tr> 
     136                <th scope="row"><label for="upload"><?php _e('File'); ?></label></th> 
    122137                <td><input type="file" id="upload" name="image" /></td> 
    123138            </tr> 
    124139<?php   endif; ?> 
    125140            <tr> 
    126                 <th scope="row"><label for="post_title"><?php _e('Title:'); ?></label></th> 
     141                <th scope="row"><label for="post_title"><?php _e('Title'); ?></label></th> 
    127142                <td><input type="text" id="post_title" name="post_title" value="<?php echo $attachment->post_title; ?>" /></td> 
    128143            </tr> 
    129144            <tr> 
    130                 <th scope="row"><label for="post_content"><?php _e('Description:'); ?></label></th> 
     145                <th scope="row"><label for="post_content"><?php _e('Description'); ?></label></th> 
    131146                <td><textarea name="post_content" id="post_content"><?php echo $attachment->post_content; ?></textarea></td> 
    132147            </tr> 
    133             <tr id="buttons"> 
    134                 <th></th> 
    135                 <td> 
     148            <tr id="buttons" class="submit"> 
     149                <td colspan='2'> 
     150<?php   if ( $id ) : ?> 
     151                    <input type="submit" name="delete" id="delete" class="delete alignleft" value="<?php _e('Delete File'); ?>" /> 
     152<?php   endif; ?> 
    136153                    <input type="hidden" name="from_tab" value="<?php echo $tab; ?>" /> 
    137154                    <input type="hidden" name="action" value="<?php echo $id ? 'save' : 'upload'; ?>" /> 
     
    144161                    <div class="submit"> 
    145162                        <input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> &raquo;" /> 
    146 <?php   if ( $id ) : ?> 
    147                         <input type="submit" name="delete" class="delete" value="<?php _e('Delete'); ?>" /> 
    148 <?php   endif; ?> 
    149163                    </div> 
    150164                </td> 
     
    350364    if ( 'inline' == @$_GET['style'] ) { 
    351365        echo "<style type='text/css'>\n"; 
    352         echo "\tbody { height: 14em; overflow: hidden; }\n"; 
     366        echo "\tbody { height: 15em; overflow: hidden; }\n"; 
    353367        echo "\t#upload-content { overflow-y: auto; }\n"; 
    354368        echo "\t#upload-file { position: absolute; }\n"; 
  • trunk/wp-admin/upload-js.php

    r793 r797  
    3838                return; 
    3939            var thumbEl = $('attachment-thumb-url-' + id); 
    40             if ( thumbEl ) 
     40            this.currentImage.isImage = true; 
     41            if ( thumbEl ) { 
    4142                this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value ); 
    42             else 
     43                this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value ); 
     44            } else { 
    4345                this.currentImage.thumb = false; 
     46                var isImageEl = $('attachment-is-image-' + id); 
     47                if ( !isImageEl ) 
     48                    this.currentImage.isImage = false; 
     49            } 
    4450            this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value ); 
     51            this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value ); 
    4552            this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value ); 
    4653            this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value ); 
     
    6673                params.ID = ''; 
    6774                params.action = ''; 
    68                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='Browse your files' class='back'>&laquo; Back</a>"; 
     75                h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>"; 
    6976            } else { 
    7077                h += "<a href='#' onclick='theFileList.cancelView()'  title='Browse your files' class='back'>&laquo; Back</a>"; 
    7178            } 
    7279            h += "<div id='file-title'>" 
    73             if ( !this.currentImage.thumb ) 
    74                 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 
     80            if ( !this.currentImage.isImage ) 
     81                h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 
    7582            else 
    7683                h += "<h2>" + this.currentImage.title + "</h2>"; 
     
    8087            h += '</div>' 
    8188            h += "<div id='upload-file-view' class='alignleft'>"; 
    82             if ( this.currentImage.thumb ) 
    83                 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>"; 
    84             else 
     89            if ( this.currentImage.isImage ) { 
     90                h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>"; 
     91                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
     92                h += "</a>"; 
     93            } else 
    8594                h += '&nbsp;'; 
    8695            h += "</div>"; 
     
    120129            if ( this.postID ) 
    121130                action += '&amp;post_id=' + this.postID; 
     131 
    122132            h += "<form id='upload-file' method='post' action='" + action + "'>"; 
    123133            if ( this.ID ) { 
     
    130140            } 
    131141            h += "<div id='file-title'>" 
    132             if ( !this.currentImage.thumb ) 
    133                 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 
     142            if ( !this.currentImage.isImage ) 
     143                h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 
    134144            else 
    135145                h += "<h2>" + this.currentImage.title + "</h2>"; 
     
    139149            h += '</div>' 
    140150            h += "<div id='upload-file-view' class='alignleft'>"; 
    141             if ( this.currentImage.thumb ) 
    142                 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>"; 
    143             else 
     151            if ( this.currentImage.isImage ) { 
     152                h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>"; 
     153                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
     154                h += "</a>"; 
     155            } else 
    144156                h += '&nbsp;'; 
    145157            h += "</div>"; 
    146158 
    147159 
    148             h += "<table><tr>" 
    149             h += "<th scope='row'><label for='post_title'>Title:</label></th>"; 
     160            h += "<table><col /><col class='widefat' /><tr>" 
     161            h += "<th scope='row'><label for='url'>URL</label></th>"; 
     162            h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 
     163            h += "</tr><tr>"; 
     164            h += "<th scope='row'><label for='post_title'>Title</label></th>"; 
    150165            h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 
    151166            h += "</tr><tr>"; 
    152             h += "<th scope='row'><label for='post_content'>Description:</label></th>"; 
     167            h += "<th scope='row'><label for='post_content'>Description</label></th>"; 
    153168            h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 
    154             h += "</tr><tr id='buttons'><th><input type='button' name='delete' class='delete button' value='Delete' onclick='theFileList.deleteFile(" + id + ");' /></th><td>"; 
     169            h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='Delete File' onclick='theFileList.deleteFile(" + id + ");' />"; 
    155170            h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 
    156171            h += "<input type='hidden' name='action' id='action-value' value='save' />"; 
    157172            h += "<input type='hidden' name='ID' value='" + id + "' />"; 
    158173            h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 
    159             h += "<div class='submit'><input type='submit' value='Save &raquo;' />"; 
    160             h += "</div></td></tr></table></form>"; 
     174            h += "<div class='submit'><input type='submit' value='Save &raquo;' /></div>"; 
     175            h += "</td></tr></table></form>"; 
    161176 
    162177            new Insertion.Top('upload-content', h); 
     
    203218            if ( displayEl ) 
    204219                display = displayEl.value; 
     220            else if ( this.currentImage.isImage ) 
     221                display = 'full'; 
    205222 
    206223            if ( 'none' != link ) 
    207                 h += "<a href='" + ( 'file' == link ? this.currentImage.src : this.currentImage.page ) + "' title='" + this.currentImage.title + "'>"; 
     224                h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment" ) ) + "' title='" + this.currentImage.title + "'>"; 
    208225            if ( display ) 
    209                 h += "<img src='" + ( 'thumb' == display ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' />"; 
     226                h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />"; 
    210227            else 
    211228                h += this.currentImage.title; 
     
    221238            else 
    222239                win.edInsertContent(win.edCanvas, h); 
    223             this.cancelView(); 
     240            if ( !this.ID ) 
     241                this.cancelView(); 
    224242            return false; 
    225243        }, 
  • trunk/wp-admin/upload.css

    r793 r797  
    5858    top: 0; 
    5959    left: 0; 
    60     width: 45em; 
     60    width: 95%; 
    6161    height: 100%; 
    6262    background: #f9fcfe; 
    6363} 
    64 #upload-file th { 
     64 
     65#uupload-file th { 
    6566    width: 8em; 
    6667} 
     
    6869form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; } 
    6970 
    70 form#upload-file div.submit input { width: auto; } 
     71form#upload-file .submit input { width: auto; } 
    7172 
    7273#upload-file-view { padding: 0 0 0 75px; } 
     
    135136#upload-files a.file-link img { vertical-align: middle; } 
    136137 
    137 #the-attachment-links { float: right; } 
    138  
    139138#the-attachment-links textarea { 
    140139    font-size: 10px; 
     
    174173    width: 300px; 
    175174} 
     175 
     176input.readonly { background-color: #ddd; } 
  • trunk/wp-admin/upload.php

    r793 r797  
    1414 
    1515do_action( "upload_files_$tab" ); 
     16 
     17add_action( 'admin_head', 'wp_upload_admin_head' ); 
    1618 
    1719$pid = 0; 
  • trunk/wp-admin/user-edit.php

    r770 r797  
    3737    wp_die(__('You do not have permission to edit this user.')); 
    3838 
     39$cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); 
    3940$errors = edit_user($user_id); 
     41if( $cap == null ) 
     42    $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$wpmuBaseTablePrefix}{$wpdb->blogid}_capabilities' AND meta_value = 'a:0:{}'" ); 
    4043 
    4144if( !is_wp_error( $errors ) ) { 
  • trunk/wp-admin/users.php

    r793 r797  
    220220        } 
    221221    } 
    222     $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities'"); 
     222    $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities' ORDER BY user_login"); 
    223223    $user_dropdown = '<select name="reassign_user">'; 
    224224    foreach ( (array) $all_logins as $login ) 
  • trunk/wp-admin/wp-admin.css

    r793 r797  
    5252    display: block; 
    5353    height: 60px; 
     54    overflow: hidden; 
    5455} 
    5556 
     
    170171    font: normal 32px/5px serif; 
    171172    margin: 5px 10px; 
     173} 
     174 
     175h2 small.quickjump { 
     176    display: block; 
     177    text-align: right; 
     178} 
     179 
     180h2 small.quickjump a { 
     181    text-decoration: none; 
     182    border-bottom: 0; 
     183    font-size: 15px; 
     184    background: #f0f8ff; 
     185    padding: 5px 10px; 
    172186} 
    173187 
     
    206220    padding: 0px; 
    207221    margin-bottom: 16px; 
    208     height: 16em; 
     222    height: 17em; 
    209223    width: 100%; 
    210224/*  overflow-y: hidden;*/ 
     
    575589} 
    576590 
    577 #postdivrich #quicktags { 
     591#postdivrich #quicktags, #commentdivrich #quicktags { 
    578592    background: #f0f0ee; 
    579593    padding: 0px; 
     
    649663    clear: both; 
    650664    text-align: center; 
    651     width: 500px; 
    652     margin: auto; 
    653     height: 100px; 
    654665} 
    655666 
     
    675686    padding: 20px 50px 0; 
    676687    width: 325px; 
     688    _width:  390px; 
     689} 
     690 
     691#login form { 
     692    _width: 325px; 
     693    _margin: 0 auto; 
    677694} 
    678695 
     
    697714    font-weight: normal; 
    698715    font-size: 1.1em; 
     716    _width: 325px; 
     717    _margin: 0 auto 15px; 
    699718} 
    700719 
     
    720739} 
    721740 
     741#register #login h2 {  
     742    border-bottom: 1px solid #1e6491; 
     743    padding-bottom:  15px; 
     744    color: #fff; 
     745    text-align: left; 
     746    font-weight: normal; 
     747    font-size: 1.7em; 
     748    font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana; 
     749    letter-spacing:  -1px; 
     750    margin:  15px 0 0; 
     751    _width: 325px; 
     752    _padding: 15px 0; 
     753    _margin:  10px auto 5px; 
     754} 
     755 
    722756#login input { 
    723757    padding: 4px; 
     
    728762    list-style: none; 
    729763    margin: 0 -50px; 
     764    _margin:  10px auto 0; 
    730765    padding: 10px 50px 25px;; 
     766    _padding: 0 0 5px 30px; 
    731767} 
    732768 
     
    739775} 
    740776 
     777#login ul {display: inline-block;} 
     778 
     779/* Hides from IE-mac \*/ 
     780* html #login ul {height: 1%;} 
     781#login ul {display: block;} 
     782/* End hide from IE-mac */ 
     783 
    741784#login ul li { 
    742785    float: left; 
     
    752795    padding: 4px 1px 5px; 
    753796    width: 160px; 
     797} 
     798 
     799#register #login ul li a {  
     800    width: 106px; 
    754801} 
    755802 
     
    12831330} 
    12841331 
    1285 #postdivrich #content, #postdivrich #content:active { 
     1332#postdivrich #content, #postdivrich #content:active, #commentdivrich #content, #commentdivrich #content:active { 
    12861333    border: 1px solid #ccc; 
    12871334} 
     
    12991346    background: #fff url( images/fade-butt.png ) repeat-x 0px 15px; 
    13001347    border-bottom: 1px solid #ccc; 
     1348} 
     1349 
     1350#postdivrich .switched table, #postdivrich #quicktags, #commentdivrich .switched table, #commentdivrich #quicktags { 
     1351    border-top: none; 
     1352} 
     1353 
     1354#postdivrich #quicktags, #commentdivrich #quicktags { 
     1355    border-bottom: none; 
     1356    padding-bottom: 2px; 
     1357    margin-bottom: -1px; 
     1358} 
     1359 
     1360#edButtons { 
     1361    border-bottom: 1px solid #ccc 
    13011362} 
    13021363 
  • trunk/wp-content/blogs.php

    r783 r797  
    99) { 
    1010    header("HTTP/1.1 404 Not Found"); 
    11     die('404 &#8212; File not found.'); 
     11    graceful_fail('404 &#8212; File not found.'); 
    1212} 
    1313 
     
    6969endif; 
    7070 
     71 
    7172$file = $_GET[ 'file' ]; 
     73 
    7274$file = constant( "ABSPATH" ) . constant( "UPLOADS" ) . $file; 
    73  
    7475if ( !is_file( $file ) ) { 
    7576    header("HTTP/1.1 404 Not Found"); 
    76     die('404 &#8212; File not found.'); 
     77    graceful_fail('404 &#8212; File not found.'); 
    7778} 
    7879 
     
    8182if ( in_array( preg_replace( '|.*\.(.*)$|', '$1', $file ), $never ) ) { 
    8283    header("HTTP/1.1 404 Not Found"); 
    83     die('404 &#8212; File not found.'); 
     84    graceful_fail('404 &#8212; File not found.'); 
    8485} 
    8586 
  • trunk/wp-content/mu-plugins/pluggable.php

    r661 r797  
    4343        return false; 
    4444    } else { 
    45         $primary_blog = get_usermeta( $login->ID, "primary_blog" ); 
    46         if( $primary_blog ) { 
     45        if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $login->ID, "primary_blog" ) ) ) { 
    4746            $details = get_blog_details( $primary_blog ); 
    48             if( is_object( $details ) ) { 
    49                 if( $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { 
    50                     $error = __('<strong>Error</strong>: Blog suspended.'); 
    51                     return false; 
    52                 } 
     47            if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { 
     48                $error = __('<strong>Error</strong>: Blog suspended.'); 
     49                return false; 
    5350            } 
    5451        } 
     
    7370    $user = wp_cache_get($user_id, 'users'); 
    7471    $user_level = $wpmuBaseTablePrefix . $wpdb->blogid . '_user_level'; 
    75     if( $user->$user_level != '' || $user->user_level != '' ) { 
    76         if( $user && is_site_admin( $user->user_login ) == true ) { 
    77             $user->$user_level = 10; 
    78             $user->user_level = 10; 
    79             $cap_key = $wpdb->prefix . 'capabilities'; 
    80             $user->{$cap_key} = array( 'administrator' => '1' ); 
    81             return $user; 
    82         } elseif ( $user ) 
    83             return $user; 
     72    if ( $user && is_site_admin( $user->user_login ) ) { 
     73        $user->$user_level = 10; 
     74        $user->user_level = 10; 
     75        $cap_key = $wpdb->prefix . 'capabilities'; 
     76        $user->{$cap_key} = array( 'administrator' => '1' ); 
     77        return $user; 
     78    } elseif ( $user ) { 
     79        return $user; 
    8480    } 
    8581 
  • trunk/wp-content/themes/classic/sidebar.php

    r524 r797  
    44 
    55<ul> 
    6     <?php wp_list_pages(); ?> 
    7     <?php get_links_list(); ?> 
    8  <li id="categories"><?php _e('Categories:'); ?> 
    9     <ul> 
    10     <?php wp_list_cats(); ?> 
    11     </ul> 
    12  </li> 
     6<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : ?> 
     7 
     8</ul> 
     9 
     10</div> 
     11 
     12<?php return; ?> 
     13 
     14<?php endif; ?> 
     15 
     16    <?php wp_list_pages('title_li=' . __('Pages:')); ?> 
     17    <?php wp_list_bookmarks('title_after=&title_before='); ?> 
     18    <?php wp_list_categories('title_li=' . __('Categories:')); ?> 
    1319 <li id="search"> 
    1420   <label for="s"><?php _e('Search:'); ?></label> 
  • trunk/wp-content/themes/default/sidebar.php

    r734 r797  
    22        <ul> 
    33 
     4<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : ?> 
     5 
     6        </ul> 
     7    </div> 
     8<?php return; ?> 
     9 
     10<?php endif; ?> 
     11             
    412            <li> 
    513                <?php include (TEMPLATEPATH . '/searchform.php'); ?> 
     
    2533            for <?php the_time('F, Y'); ?>.</p> 
    2634 
    27       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
     35                <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
    2836            <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 
    2937            for the year <?php the_time('Y'); ?>.</p> 
    3038 
    31          <?php /* If this is a monthly archive */ } elseif (is_search()) { ?> 
     39            <?php /* If this is a monthly archive */ } elseif (is_search()) { ?> 
    3240            <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 
    3341            for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> 
     
    3947            </li> 
    4048 
    41             <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?> 
     49            <?php wp_list_pages('title_li=<h2>Pages</h2>&sort_column=post_title&sort_order=ASC'); ?> 
    4250 
    4351            <li><h2>Archives</h2> 
  • trunk/wp-cron.php

    r753 r797  
    1818            $schedule = $args['schedule']; 
    1919            if ($schedule != false) { 
    20                 $new_args = array_merge( array($timestamp, $schedule, $hook), $args['args']); 
     20                $new_args = array($timestamp, $schedule, $hook, $args['args']); 
    2121                call_user_func_array('wp_reschedule_event', $new_args); 
    2222            } 
  • trunk/wp-includes/bookmark-template.php

    r788 r797  
    320320        'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 
    321321        'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', 
    322         'category_orderby' => 'name', 'category_order' => 'ASC'); 
     322        'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat'); 
    323323    $r = array_merge($defaults, $r); 
    324324    extract($r); 
    325325 
    326326    $output = ''; 
     327 
     328    if ( is_array($class) ) 
     329        $class = trim(join(' ', $class)); 
    327330 
    328331    if ( $categorize ) { 
     
    334337            if ( empty($bookmarks) ) 
    335338                continue; 
    336             $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n"; 
     339            $output .= "<li id='linkcat-$cat->cat_ID' class='$class'>$title_before$cat->cat_name$title_after\n\t<ul>\n"; 
    337340            $output .= _walk_bookmarks($bookmarks, $r); 
    338341            $output .= "\n\t</ul>\n</li>\n"; 
     
    343346         
    344347        if ( !empty($bookmarks) ) { 
    345             $output .= "<li id='linkuncat' class='linkcat'>$title_before$title_li$title_after\n\t<ul>\n"; 
     348            $output .= "<li id='linkuncat' class='$class'>$title_before$title_li$title_after\n\t<ul>\n"; 
    346349            $output .= _walk_bookmarks($bookmarks, $r); 
    347350            $output .= "\n\t</ul>\n</li>\n"; 
  • trunk/wp-includes/category-template.php

    r789 r797  
    6161 
    6262function get_the_category($id = false) { 
    63 global $post, $category_cache; 
     63global $post, $category_cache, $blog_id; 
    6464 
    6565    if ( !$id ) 
    6666        $id = $post->ID; 
    6767 
    68     if ( !isset($category_cache[$id]) ) 
     68    if ( !isset($category_cache[$blog_id][$id]) ) 
    6969        update_post_category_cache($id); 
    7070 
    71     $categories = $category_cache[$id]; 
     71    $categories = $category_cache[$blog_id][$id]; 
    7272 
    7373    if ( !empty($categories) ) 
     
    141141 
    142142function in_category($category) { // Check if the current post is in the given category 
    143     global $category_cache, $post; 
    144  
    145     if ( isset( $category_cache[$post->ID][$category] ) ) 
     143    global $category_cache, $post, $blog_id; 
     144 
     145    if ( isset( $category_cache[$blog_id][$post->ID][$category] ) ) 
    146146        return true; 
    147147    else 
  • trunk/wp-includes/cron.php

    r789 r797  
    11<?php 
    22 
    3 function wp_schedule_single_event( $timestamp, $hook ) { 
    4     $args = array_slice( func_get_args(), 2 ); 
     3function wp_schedule_single_event( $timestamp, $hook, $args = array()) { 
    54    $crons = _get_cron_array(); 
    65    $key = md5(serialize($args)); 
     
    109} 
    1110 
    12 function wp_schedule_event( $timestamp, $recurrence, $hook ) { 
    13     $args = array_slice( func_get_args(), 3 ); 
     11function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) { 
    1412    $crons = _get_cron_array(); 
    1513    $schedules = wp_get_schedules(); 
     
    2220} 
    2321 
    24 function wp_reschedule_event( $timestamp, $recurrence, $hook ) { 
    25     $args = array_slice( func_get_args(), 3 ); 
     22function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) { 
    2623    $crons = _get_cron_array(); 
    2724    $schedules = wp_get_schedules(); 
  • trunk/wp-includes/default-filters.php

    r788 r797  
    146146add_filter('mce_plugins', '_mce_load_rtl_plugin'); 
    147147add_filter('mce_buttons', '_mce_add_direction_buttons'); 
     148add_filter('tiny_mce_config_url', '_mce_config_url'); 
    148149 
    149150// Actions 
     
    153154add_action('wp_head', 'noindex', 1); 
    154155add_action('wp_head', 'wp_print_scripts'); 
    155 if(!defined('DOING_CRON')) 
     156if(!defined('DOING_CRON') && !strstr( $_SERVER['REQUEST_URI'], 'wp-cron.php' ) ) 
    156157    add_action('init', 'wp_cron'); 
    157158add_action('do_feed_rdf', 'do_feed_rdf', 10, 1); 
  • trunk/wp-includes/formatting.php

    r793 r797  
    619619        // HTML loop taken from texturize function, could possible be consolidated 
    620620        $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between 
    621         $stop = count($textarr);// loop stuff 
    622         for ($i = 0; $i < $stop; $i++) { 
    623             $content = $textarr[$i]; 
    624             if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag 
    625                 $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content); 
    626             } 
    627             $output .= $content; 
    628         } 
     621        $output = implode('', preg_replace($wp_smiliessearch, $wp_smiliesreplace, $textarr)); 
    629622    } else { 
    630623        // return default text. 
     
    10711064} 
    10721065 
    1073 function wp_make_link_relative( $link, $base = '' ) { 
    1074     if ( !$base ) 
    1075         $base = get_option( 'home' ); 
    1076     if ( 0 === strpos($link, $base) ) 
    1077         $link = substr_replace($link, '', 0, strlen($base)); 
    1078     return $link; 
    1079 } 
     1066function wp_make_link_relative( $link ) { 
     1067    return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link ); 
     1068} 
     1069 
    10801070?> 
  • trunk/wp-includes/functions.php

    r774 r797  
    107107 
    108108function get_lastpostdate($timezone = 'server') { 
    109     global $cache_lastpostdate, $pagenow, $wpdb; 
     109    global $cache_lastpostdate, $pagenow, $wpdb, $blog_id; 
    110110    $add_seconds_blog = get_option('gmt_offset') * 3600; 
    111111    $add_seconds_server = date('Z'); 
    112     if ( !isset($cache_lastpostdate[$timezone]) ) { 
     112    if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) { 
    113113        switch(strtolower($timezone)) { 
    114114            case 'gmt': 
     
    122122                break; 
    123123        } 
    124         $cache_lastpostdate[$timezone] = $lastpostdate; 
    125     } else { 
    126         $lastpostdate = $cache_lastpostdate[$timezone]; 
     124        $cache_lastpostdate[$blog_id][$timezone] = $lastpostdate; 
     125    } else { 
     126        $lastpostdate = $cache_lastpostdate[$blog_id][$timezone]; 
    127127    } 
    128128    return $lastpostdate; 
     
    130130 
    131131function get_lastpostmodified($timezone = 'server') { 
    132     global $cache_lastpostmodified, $pagenow, $wpdb; 
     132    global $cache_lastpostmodified, $pagenow, $wpdb, $blog_id; 
    133133    $add_seconds_blog = get_option('gmt_offset') * 3600; 
    134134    $add_seconds_server = date('Z'); 
    135     if ( !isset($cache_lastpostmodified[$timezone]) ) { 
     135    if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) { 
    136136        switch(strtolower($timezone)) { 
    137137            case 'gmt': 
     
    149149            $lastpostmodified = $lastpostdate; 
    150150        } 
    151         $cache_lastpostmodified[$timezone] = $lastpostmodified; 
    152     } else { 
    153         $lastpostmodified = $cache_lastpostmodified[$timezone]; 
     151        $cache_lastpostmodified[$blog_id][$timezone] = $lastpostmodified; 
     152    } else { 
     153        $lastpostmodified = $cache_lastpostmodified[$blog_id][$timezone]; 
    154154    } 
    155155    return $lastpostmodified; 
     
    205205            wp_cache_set($setting, ($value=='')?'emptystringindb':$value, 'options'); 
    206206        } else { 
    207             wp_cache_set($setting, 'novalueindb', 'options', 5); 
     207            wp_cache_set($setting, 'novalueindb', 'options'); 
    208208            return false; 
    209209        } 
     
    492492 
    493493function update_post_cache(&$posts) { 
    494     global $post_cache; 
     494    global $post_cache, $blog_id; 
    495495 
    496496    if ( !$posts ) 
     
    498498 
    499499    for ($i = 0; $i < count($posts); $i++) { 
    500         $post_cache[$posts[$i]->ID] = &$posts[$i]; 
     500        $post_cache[$blog_id][$posts[$i]->ID] = &$posts[$i]; 
    501501    } 
    502502} 
    503503 
    504504function clean_post_cache($id) { 
    505     global $post_cache; 
    506  
    507     if ( isset( $post_cache[$id] ) ) 
    508         unset( $post_cache[$id] ); 
     505    global $post_cache, $blog_id; 
     506 
     507    if ( isset( $post_cache[$blog_id][$id] ) ) 
     508        unset( $post_cache[$blog_id][$id] ); 
    509509} 
    510510 
    511511function update_page_cache(&$pages) { 
    512     global $page_cache; 
     512    global $page_cache, $blog_id; 
    513513 
    514514    if ( !$pages ) 
     
    516516 
    517517    for ($i = 0; $i < count($pages); $i++) { 
    518         $page_cache[$pages[$i]->ID] = &$pages[$i]; 
     518        $page_cache[$blog_id][$pages[$i]->ID] = &$pages[$i]; 
    519519        wp_cache_add($pages[$i]->ID, $pages[$i], 'pages'); 
    520520    } 
     
    523523 
    524524function clean_page_cache($id) { 
    525     global $page_cache, $wpdb; 
    526  
    527     if ( isset( $page_cache[$id] ) ) 
    528         unset( $page_cache[$id] ); 
     525    global $page_cache, $wpdb, $blog_id; 
     526 
     527    if ( isset( $page_cache[$blog_id][$id] ) ) 
     528        unset( $page_cache[$blog_id][$id] ); 
    529529 
    530530    $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='page'"); 
     
    534534 
    535535function update_post_category_cache($post_ids) { 
    536     global $wpdb, $category_cache; 
     536    global $wpdb, $category_cache, $blog_id; 
    537537 
    538538    if ( empty($post_ids) ) 
     
    548548 
    549549    foreach ($dogs as $catt) 
    550         $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id); 
     550        $category_cache[$blog_id][$catt->post_id][$catt->category_id] = &get_category($catt->category_id); 
    551551} 
    552552 
    553553function update_post_caches(&$posts) { 
    554554    global $post_cache, $category_cache, $post_meta_cache; 
    555     global $wpdb; 
     555    global $wpdb, $blog_id; 
    556556 
    557557    // No point in doing all this work if we didn't match any posts. 
     
    562562    for ($i = 0; $i < count($posts); $i++) { 
    563563        $post_id_array[] = $posts[$i]->ID; 
    564         $post_cache[$posts[$i]->ID] = &$posts[$i]; 
     564        $post_cache[$blog_id][$posts[$i]->ID] = &$posts[$i]; 
    565565    } 
    566566 
     
    572572    if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN($post_id_list) ORDER BY post_id, meta_key", ARRAY_A) ) { 
    573573        // Change from flat structure to hierarchical: 
    574         $post_meta_cache = array(); 
     574        $post_meta_cache[$blog_id] = array(); 
    575575        foreach ($meta_list as $metarow) { 
    576576            $mpid = $metarow['post_id']; 
     
    579579 
    580580            // Force subkeys to be array type: 
    581             if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) ) 
    582                 $post_meta_cache[$mpid] = array(); 
    583             if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) ) 
    584                 $post_meta_cache[$mpid]["$mkey"] = array(); 
     581            if ( !isset($post_meta_cache[$blog_id][$mpid]) || !is_array($post_meta_cache[$blog_id][$mpid]) ) 
     582                $post_meta_cache[$blog_id][$mpid] = array(); 
     583            if ( !isset($post_meta_cache[$blog_id][$mpid]["$mkey"]) || !is_array($post_meta_cache[$blog_id][$mpid]["$mkey"]) ) 
     584                $post_meta_cache[$blog_id][$mpid]["$mkey"] = array(); 
    585585 
    586586            // Add a value to the current pid/key: 
    587             $post_meta_cache[$mpid][$mkey][] = $mval; 
     587            $post_meta_cache[$blog_id][$mpid][$mkey][] = $mval; 
    588588        } 
    589589    } 
     
    813813    global $current_blog; 
    814814    do_action('do_robotstxt'); 
     815 
    815816    if ( '0' == $current_blog->public ) { 
    816817        echo "User-agent: *\n"; 
     
    11281129 
    11291130function wp_die($message, $title = '') { 
     1131    global $wp_locale; 
     1132 
    11301133    header('Content-Type: text/html; charset=utf-8'); 
    11311134 
     
    11341137 
    11351138    if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) 
    1136         $logo_src = 'images/wordpress-logo.png'; 
     1139        $admin_dir = ''; 
    11371140    else 
    1138         $logo_src = 'wp-admin/images/wordpress-logo.png'; 
     1141        $admin_dir = 'wp-admin/'; 
    11391142 
    11401143?> 
    11411144<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    1142 <html xmlns="http://www.w3.org/1999/xhtml"> 
     1145<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 
    11431146<head> 
    11441147    <title><?php echo $title ?></title> 
    11451148    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    1146     <style media="screen" type="text/css"> 
    1147     <!-- 
    1148     html { 
    1149         background: #eee; 
    1150     } 
    1151     body { 
    1152         background: #fff; 
    1153         color: #000; 
    1154         font-family: Georgia, "Times New Roman", Times, serif; 
    1155         margin-left: 25%; 
    1156         margin-right: 25%; 
    1157         padding: .2em 2em; 
    1158     } 
    1159  
    1160     h1 { 
    1161         color: #006; 
    1162         font-size: 18px; 
    1163         font-weight: lighter; 
    1164     } 
    1165  
    1166     h2 { 
    1167         font-size: 16px; 
    1168     } 
    1169  
    1170     p, li, dt { 
    1171         line-height: 140%; 
    1172         padding-bottom: 2px; 
    1173     } 
    1174  
    1175     ul, ol { 
    1176         padding: 5px 5px 5px 20px; 
    1177     } 
    1178     #logo { 
    1179         margin-bottom: 2em; 
    1180     } 
    1181     --> 
    1182     </style> 
     1149    <link rel="stylesheet" href="<?php echo $admin_dir; ?>install.css" type="text/css" /> 
     1150<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?> 
     1151    <link rel="stylesheet" href="<?php echo $admin_dir; ?>install-rtl.css" type="text/css" /> 
     1152<?php endif; ?> 
    11831153</head> 
    11841154<body> 
    1185     <h1 id="logo"><img alt="WordPress" src="<?php echo $logo_src; ?>" /></h1> 
     1155    <h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1> 
    11861156    <p><?php echo $message; ?></p> 
    11871157</body> 
     
    11921162} 
    11931163 
     1164function _mce_config_url($url) { 
     1165    global $wp_locale; 
     1166 
     1167    if ( 'rtl' == $wp_locale->text_direction ) 
     1168        $url = add_query_arg('mce_text_direction', 'rtl', $url); 
     1169 
     1170    return $url; 
     1171} 
     1172 
    11941173function _mce_set_direction() { 
    11951174    global $wp_locale; 
    11961175 
    1197     if ('rtl' == $wp_locale->text_direction) { 
     1176    if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] ) 
     1177        $dir = 'rtl'; 
     1178    else 
     1179        $dir = $wp_locale->text_direction; 
     1180 
     1181    if ( 'rtl' == $dir ) { 
    11981182        echo 'directionality : "rtl" ,'; 
    11991183        echo 'theme_advanced_toolbar_align : "right" ,'; 
     
    12041188    global $wp_locale; 
    12051189 
    1206     if ('rtl' == $wp_locale->text_direction) 
     1190    if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] ) 
     1191        $dir = 'rtl'; 
     1192    else 
     1193        $dir = $wp_locale->text_direction; 
     1194 
     1195    if ( 'rtl' == $dir ) 
    12071196        $input[] = 'directionality'; 
    12081197 
     
    12131202    global $wp_locale; 
    12141203 
    1215     if ('rtl' == $wp_locale->text_direction) { 
     1204    if ( isset($_GET['mce_text_direction']) && 'rtl' == $_GET['mce_text_direction'] ) 
     1205        $dir = 'rtl'; 
     1206    else 
     1207        $dir = $wp_locale->text_direction; 
     1208 
     1209    if ( 'rtl' == $dir ) { 
    12161210        $new_buttons = array('separator', 'ltr', 'rtl'); 
    12171211        $input = array_merge($input, $new_buttons); 
  • trunk/wp-includes/general-template.php

    r789 r797  
    207207 
    208208    $prefix = ''; 
    209     if ( isset($title) ) 
     209    if ( !empty($title) ) 
    210210        $prefix = " $sep "; 
    211211 
     
    334334 
    335335    if ( 'monthly' == $type ) { 
    336         $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 
     336        $arcresults = wp_cache_get( md5('archives' . $type . $limit), 'general'); 
     337        if ( !$arcresults ) { 
     338            $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 
     339            wp_cache_set( md5('archives' . $type . $limit), $arcresults, 'general', 600 ); 
     340        } 
    337341        if ( $arcresults ) { 
    338342            $afterafter = $after; 
     
    453457                $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); 
    454458    } else { 
    455         $thisyear = gmdate('Y', current_time('timestamp') + get_option('gmt_offset') * 3600); 
    456         $thismonth = gmdate('m', current_time('timestamp') + get_option('gmt_offset') * 3600); 
     459        $thisyear = gmdate('Y', current_time('timestamp')); 
     460        $thismonth = gmdate('m', current_time('timestamp')); 
    457461    } 
    458462 
     
    759763} 
    760764 
     765function user_can_switchedit() { 
     766    $can = true; 
     767 
     768    $ua = $_SERVER['HTTP_USER_AGENT']; 
     769 
     770    if ( 
     771        !user_can_richedit() || 
     772        (   // Mozilla Test 
     773            strstr($ua, 'Mozilla/5.0') && 
     774            !strstr($ua, 'ompatible') && 
     775            !strstr($ua, 'irefox') 
     776        ) 
     777    ) 
     778        $can = false; 
     779 
     780    return apply_filters('user_can_switchedit', $can); 
     781} 
     782 
    761783function the_editor($content, $id = 'content', $prev_id = 'title') { 
    762784    $rows = get_option('default_post_edit_rows'); 
     
    769791        add_filter('the_editor_content', 'wp_richedit_pre'); 
    770792 
    771         //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 
     793    if ( user_can_switchedit() ) : 
    772794    ?> 
    773     <style type="text/css"> 
    774         #postdivrich table, #postdivrich #quicktags {border-top: none;} 
    775         #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} 
    776         #edButtons {border-bottom: 1px solid #ccc;} 
    777     </style> 
    778795    <div id='edButtons' style='display:none;'> 
    779796        <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> 
     
    786803    </script> 
    787804 
    788     <?php endif; ?> 
     805    <?php endif; endif; ?> 
    789806    <div id="quicktags"> 
    790807    <?php wp_print_scripts( 'quicktags' ); ?> 
     
    821838    <?php 
    822839 
    823     $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); 
     840    $class = user_can_switchedit() ? 'switched' : 'unswitched'; 
     841 
     842    $the_editor = apply_filters('the_editor', "<div class='$class'><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); 
    824843    $the_editor_content = apply_filters('the_editor_content', $content); 
    825844 
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js

    r550 r797  
    1818    document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'))); 
    1919    resizeInputs(); 
     20 
     21    if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) { 
     22        setWrap('soft'); 
     23        document.forms[0].wraped.checked = true; 
     24    } 
    2025} 
    2126 
  • trunk/wp-includes/js/tinymce/tiny_mce_config.php

    r770 r797  
    3232    $mce_buttons = implode($mce_buttons, ','); 
    3333 
     34    if ( !user_can_switchedit() ) 
     35        $mce_buttons = str_replace('wp_help', 'wp_help,code', $mce_buttons); 
     36 
    3437    $mce_buttons_2 = apply_filters('mce_buttons_2', array()); 
    3538    $mce_buttons_2 = implode($mce_buttons_2, ','); 
     
    6366    theme_advanced_path_location : "bottom", 
    6467    theme_advanced_resizing : true, 
     68    theme_advanced_source_editor_wrap : true, 
    6569    browsers : "<?php echo $mce_browsers; ?>", 
    6670    dialog_type : "modal", 
  • trunk/wp-includes/l10n.php

    r773 r797  
    77 
    88    // WPLANG is defined in wp-config. 
    9     if (defined('WPLANG')) 
     9    if ( defined('WPLANG') && '' != WPLANG ) 
    1010        $locale = WPLANG; 
     11    else if ( is_admin() ) 
     12        $locale = get_user_lang_code(); 
     13    else 
     14        $locale = get_blog_lang_code(); 
    1115 
    1216    if (empty($locale)) 
    13         $locale = 'en_US'; 
     17        $locale = 'en'; 
    1418 
    1519    $locale = apply_filters('locale', $locale); 
  • trunk/wp-includes/pluggable.php

    r789 r797  
    227227             (empty($_COOKIE[USER_COOKIE])) ) { 
    228228        nocache_headers(); 
     229 
     230        wp_clearcookie(); 
    229231 
    230232        wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); 
  • trunk/wp-includes/plugin.php

    r789 r797  
    101101 
    102102function do_action($tag, $arg = '') { 
    103     global $wp_filter; 
     103    global $wp_filter, $wp_actions; 
     104 
    104105    $args = array(); 
    105106    if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this) 
     
    133134        } 
    134135    } 
     136 
     137    if ( is_array($wp_actions) ) 
     138        $wp_actions[] = $tag; 
     139    else 
     140        $wp_actions = array($tag); 
     141} 
     142 
     143// Returns the number of times an action has been done 
     144function did_action($tag) { 
     145    global $wp_actions; 
     146 
     147    return count(array_keys($wp_actions, $tag)); 
    135148} 
    136149 
    137150function do_action_ref_array($tag, $args) { 
    138     global $wp_filter; 
     151    global $wp_filter, $wp_actions; 
     152 
     153    if ( !is_array($wp_actions) ) 
     154        $wp_actions = array($tag); 
     155    else 
     156        $wp_actions[] = $tag; 
    139157 
    140158    merge_filters($tag); 
  • trunk/wp-includes/post-template.php

    r789 r797  
    350350    $file = get_post_meta($post->ID, '_wp_attached_file', true); 
    351351 
     352    $exts = array('jpg', 'gif', 'png'); 
     353 
    352354    if ( !$fullsize && !empty($imagedata['thumb']) 
    353355            && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) 
     
    360362        $class = 'attachmentthumb'; 
    361363 
    362     } elseif ( substr($mime, 0, 6) == 'image/' 
     364    } elseif ( ( substr($mime, 0, 6) == 'image/' || 'import' == $mime && in_array(substr($file, -3), $exts) ) 
    363365            && file_exists($file) ) { 
    364366 
     
    375377 
    376378        $types = array(substr($mime, 0, strpos($mime, '/')), substr($mime, strpos($mime, '/') + 1), str_replace('/', '_', $mime)); 
    377         $exts = array('jpg', 'gif', 'png'); 
    378379        foreach ($types as $type) { 
    379380            foreach ($exts as $ext) { 
  • trunk/wp-includes/post.php

    r763 r797  
    1010 
    1111function &get_children($post = 0, $output = OBJECT) { 
    12     global $post_cache, $wpdb; 
     12    global $post_cache, $wpdb, $blog_id; 
    1313 
    1414    if ( empty($post) ) { 
     
    3131    if ( $children ) { 
    3232        foreach ( $children as $key => $child ) { 
    33             $post_cache[$child->ID] =& $children[$key]; 
     33            $post_cache[$blog_id][$child->ID] =& $children[$key]; 
    3434            $kids[$child->ID] =& $children[$key]; 
    3535        } 
     
    7373// Handles post caching. 
    7474function &get_post(&$post, $output = OBJECT) { 
    75     global $post_cache, $wpdb; 
     75    global $post_cache, $wpdb, $blog_id; 
    7676 
    7777    if ( empty($post) ) { 
     
    8383        if ( 'page' == $post->post_type ) 
    8484            return get_page($post, $output); 
    85         if ( !isset($post_cache[$post->ID]) ) 
    86             $post_cache[$post->ID] = &$post; 
    87         $_post = & $post_cache[$post->ID]; 
     85        if ( !isset($post_cache[$blog_id][$post->ID]) ) 
     86            $post_cache[$blog_id][$post->ID] = &$post; 
     87        $_post = & $post_cache[$blog_id][$post->ID]; 
    8888    } else { 
    8989        if ( $_post = wp_cache_get($post, 'pages') ) 
    9090            return get_page($_post, $output); 
    91         elseif ( isset($post_cache[$post]) ) 
    92             $_post = & $post_cache[$post]; 
     91        elseif ( isset($post_cache[$blog_id][$post]) ) 
     92            $_post = & $post_cache[$blog_id][$post]; 
    9393        else { 
    9494            $query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1"; 
     
    9696            if ( 'page' == $_post->post_type ) 
    9797                return get_page($_post, $output); 
    98             $post_cache[$post] = & $_post; 
     98            $post_cache[$blog_id][$post] = & $_post; 
    9999        } 
    100100    } 
    101101 
    102102    if ( defined('WP_IMPORTING') ) 
    103         unset($post_cache); 
     103        unset($post_cache[$blog_id]); 
    104104 
    105105    if ( $output == OBJECT ) { 
     
    220220 
    221221function add_post_meta($post_id, $key, $value, $unique = false) { 
    222     global $wpdb, $post_meta_cache; 
     222    global $wpdb, $post_meta_cache, $blog_id; 
    223223 
    224224    if ( $unique ) { 
     
    235235    $wpdb->query("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES ('$post_id','$key','$value')"); 
    236236 
    237     $post_meta_cache['$post_id'][$key][] = $original; 
     237    $post_meta_cache[$blog_id]['$post_id'][$key][] = $original; 
    238238 
    239239    return true; 
     
    241241 
    242242function delete_post_meta($post_id, $key, $value = '') { 
    243     global $wpdb, $post_meta_cache; 
     243    global $wpdb, $post_meta_cache, $blog_id; 
    244244 
    245245    if ( empty($value) ) { 
     
    257257        $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$post_id' 
    258258AND meta_key = '$key'"); 
    259         unset($post_meta_cache['$post_id'][$key]); 
     259        unset($post_meta_cache[$blog_id]['$post_id'][$key]); 
    260260    } else { 
    261261        $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$post_id' 
    262262AND meta_key = '$key' AND meta_value = '$value'"); 
    263         $cache_key = $post_meta_cache['$post_id'][$key]; 
     263        $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key]; 
    264264        if ($cache_key) foreach ( $cache_key as $index => $data ) 
    265265            if ( $data == $value ) 
    266                 unset($post_meta_cache['$post_id'][$key][$index]); 
    267     } 
    268  
    269     unset($post_meta_cache['$post_id'][$key]); 
     266                unset($post_meta_cache[$blog_id]['$post_id'][$key][$index]); 
     267    } 
     268 
     269    unset($post_meta_cache[$blog_id]['$post_id'][$key]); 
    270270 
    271271    return true; 
     
    273273 
    274274function get_post_meta($post_id, $key, $single = false) { 
    275     global $wpdb, $post_meta_cache; 
    276  
    277     if ( isset($post_meta_cache[$post_id][$key]) ) { 
     275    global $wpdb, $post_meta_cache, $blog_id; 
     276 
     277    if ( isset($post_meta_cache[$blog_id][$post_id][$key]) ) { 
    278278        if ( $single ) { 
    279             return maybe_unserialize( $post_meta_cache[$post_id][$key][0] ); 
     279            return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key][0] ); 
    280280        } else { 
    281             return maybe_unserialize( $post_meta_cache[$post_id][$key] ); 
     281            return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key] ); 
    282282        } 
    283283    } 
     
    306306 
    307307function update_post_meta($post_id, $key, $value, $prev_value = '') { 
    308     global $wpdb, $post_meta_cache; 
     308    global $wpdb, $post_meta_cache, $blog_id; 
    309309 
    310310    $original_value = $value; 
     
    324324        $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE 
    325325meta_key = '$key' AND post_id = '$post_id'"); 
    326         $cache_key = $post_meta_cache['$post_id'][$key]; 
     326        $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key]; 
    327327        if ( !empty($cache_key) ) 
    328328            foreach ($cache_key as $index => $data) 
    329                 $post_meta_cache['$post_id'][$key][$index] = $original_value; 
     329                $post_meta_cache[$blog_id]['$post_id'][$key][$index] = $original_value; 
    330330    } else { 
    331331        $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE 
    332332meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'"); 
    333         $cache_key = $post_meta_cache['$post_id'][$key]; 
     333        $cache_key = $post_meta_cache[$blog_id]['$post_id'][$key]; 
    334334        if ( !empty($cache_key) ) 
    335335            foreach ($cache_key as $index => $data) 
    336336                if ( $data == $original_prev ) 
    337                     $post_meta_cache['$post_id'][$key][$index] = $original_value; 
     337                    $post_meta_cache[$blog_id]['$post_id'][$key][$index] = $original_value; 
    338338    } 
    339339 
     
    343343 
    344344function get_post_custom( $post_id = 0 ) { 
    345     global $id, $post_meta_cache, $wpdb; 
     345    global $id, $post_meta_cache, $wpdb, $blog_id; 
    346346 
    347347    if ( ! $post_id ) 
    348348        $post_id = $id; 
    349349 
    350     if ( isset($post_meta_cache[$post_id]) ) 
    351         return $post_meta_cache[$post_id]; 
     350    if ( isset($post_meta_cache[$blog_id][$post_id]) ) 
     351        return $post_meta_cache[$blog_id][$post_id]; 
    352352 
    353353    if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = '$post_id' ORDER BY post_id, meta_key", ARRAY_A) ) { 
     
    360360 
    361361            // Force subkeys to be array type: 
    362             if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) ) 
    363                 $post_meta_cache[$mpid] = array(); 
    364  
    365             if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) ) 
    366                 $post_meta_cache[$mpid]["$mkey"] = array(); 
     362            if ( !isset($post_meta_cache[$blog_id][$mpid]) || !is_array($post_meta_cache[$blog_id][$mpid]) ) 
     363                $post_meta_cache[$blog_id][$mpid] = array(); 
     364 
     365            if ( !isset($post_meta_cache[$blog_id][$mpid]["$mkey"]) || !is_array($post_meta_cache[$blog_id][$mpid]["$mkey"]) ) 
     366                $post_meta_cache[$blog_id][$mpid]["$mkey"] = array(); 
    367367 
    368368            // Add a value to the current pid/key: 
    369             $post_meta_cache[$mpid][$mkey][] = $mval; 
    370         } 
    371         return $post_meta_cache[$mpid]; 
     369            $post_meta_cache[$blog_id][$mpid][$mkey][] = $mval; 
     370        } 
     371        return $post_meta_cache[$blog_id][$mpid]; 
    372372    } 
    373373} 
     
    699699    // Schedule publication. 
    700700    if ( 'future' == $post_status ) 
    701         wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', $post_ID); 
     701        wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($post_ID)); 
    702702         
    703703    do_action('save_post', $post_ID); 
     
    909909// Handles page caching. 
    910910function &get_page(&$page, $output = OBJECT) { 
    911     global $wpdb; 
     911    global $wpdb, $blog_id; 
    912912 
    913913    if ( empty($page) ) { 
     
    927927            $_page = & $GLOBALS['page']; 
    928928            wp_cache_add($_page->ID, $_page, 'pages'); 
    929         } elseif ( isset($_page) && $_page == $GLOBALS['post_cache'][$page] ) { 
     929        } elseif ( isset($_page) && $_page == $GLOBALS['post_cache'][$blog_id][$page] ) { 
    930930            return get_post($page, $output); 
    931931        } elseif ( isset($_page) && $_page == wp_cache_get($page, 'pages') ) { 
     
    983983 
    984984function &get_page_children($page_id, $pages) { 
    985     global $page_cache; 
     985    global $page_cache, $blog_id; 
    986986 
    987987    if ( empty($pages) ) 
    988         $pages = &$page_cache; 
     988        $pages = &$page_cache[$blog_id]; 
    989989 
    990990    $page_list = array(); 
  • trunk/wp-includes/script-loader.php

    r789 r797  
    1818        $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006a' ); 
    1919        $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 
    20         $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '09212006' ); 
     20        $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061006' ); 
    2121        $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); 
    2222        $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4211'); 
     
    3636            $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' ); 
    3737            $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 
    38             $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), mt_rand() ); 
     38            $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '4355b' ); 
    3939        } 
    4040    } 
  • trunk/wp-includes/vars.php

    r789 r797  
    8888// generates smilies' search & replace arrays 
    8989foreach($wpsmiliestrans as $smiley => $img) { 
    90     $wp_smiliessearch[] = '/(\s|^)?'.preg_quote($smiley, '/').'(\b|\s)/'; 
     90    $wp_smiliessearch[] = '/(\s|^|[^<])?'.preg_quote($smiley, '/').'(\b|\s|$)/'; 
    9191    $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES); 
    9292    $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> "; 
  • trunk/wp-includes/wpmu-functions.php

    r785 r797  
    1 <?PHP 
     1<?php 
    22/* 
    33    Helper functions for WPMU 
     
    164164 
    165165function get_blog_details( $id, $all = true ) { 
    166     global $wpdb, $wpmuBaseTablePrefix; 
     166    global $wpdb; 
    167167 
    168168    $details = wp_cache_get( $id, 'blog-details' ); 
     
    178178    if( $all == true ) { 
    179179        $wpdb->hide_errors(); 
     180        switch_to_blog($id); 
    180181        $details->blogname   = get_blog_option($id, 'blogname'); 
    181182        $details->siteurl    = get_blog_option($id, 'siteurl'); 
    182183        $details->post_count = get_blog_option($id, 'post_count'); 
     184        restore_current_blog(); 
    183185        $wpdb->show_errors(); 
    184186 
     
    289291 
    290292function get_blog_option( $id, $key, $default='na' ) { 
    291     global $wpdb, $wpmuBaseTablePrefix, $blog_id, $switched; 
    292  
    293     $current_blog_id = $blog_id; 
    294     $current_options_table = $wpdb->options; 
    295     $wpdb->options = $wpmuBaseTablePrefix . $id . "_options"; 
    296     $blog_id = $id; 
    297     if ($id != $current_blog_id) 
    298         $switched = true; 
     293    switch_to_blog($id); 
    299294    $opt = get_option( $key ); 
    300     $switched = false; 
    301     $blog_id = $current_blog_id; 
    302     $wpdb->options = $current_options_table; 
     295    restore_current_blog(); 
    303296 
    304297    return $opt; 
     
    306299 
    307300function add_blog_option( $id, $key, $value ) { 
    308     global $wpdb, $wpmuBaseTablePrefix, $blog_id; 
    309  
    310     $current_blog_id = $blog_id; 
    311     $current_options_table = $wpdb->options; 
    312     $wpdb->options = $wpmuBaseTablePrefix . $id . "_options"; 
    313     $blog_id = $id; 
    314     $opt = add_option( $key, $value ); 
    315     $blog_id = $current_blog_id; 
    316     $wpdb->options = $current_options_table; 
     301    switch_to_blog($id); 
     302    add_option( $key, $value ); 
     303    restore_current_blog(); 
    317304} 
    318305 
    319306 
    320307function update_blog_option( $id, $key, $value ) { 
    321     global $wpdb, $wpmuBaseTablePrefix, $blog_id; 
    322  
    323     $current_blog_id = $blog_id; 
    324     $current_options_table = $wpdb->options; 
    325     $wpdb->options = $wpmuBaseTablePrefix . $id . "_options"; 
    326     $blog_id = $id; 
     308    switch_to_blog($id); 
    327309    $opt = update_option( $key, $value ); 
    328     $blog_id = $current_blog_id; 
    329     $wpdb->options = $current_options_table; 
     310    restore_current_blog(); 
    330311    refresh_blog_details( $id ); 
    331312} 
    332313 
    333314function switch_to_blog( $new_blog ) { 
    334     global $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $table_prefix, $cache_settings, $category_cache, $cache_categories, $post_cache, $wp_object_cache, $blog_id, $switched, $wp_roles, $current_user; 
     315    global $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user; 
     316 
     317    if ( empty($new_blog) ) 
     318        $new_blog = $blog_id; 
     319 
     320    if ( empty($switched_stack) ) 
     321        $switched_stack = array(); 
     322 
     323    $switched_stack[] = $blog_id; 
     324 
     325    if ( $new_blog == $blog_id ) 
     326        return; 
    335327 
    336328    // backup 
     
    346338    $tmpoldblogdetails[ 'postmeta' ]       = $wpdb->postmeta; 
    347339    $tmpoldblogdetails[ 'prefix' ]         = $wpdb->prefix; 
    348     $tmpoldblogdetails[ 'cache_settings' ] = $cache_settings; 
    349     $tmpoldblogdetails[ 'category_cache' ] = $category_cache; 
    350     $tmpoldblogdetails[ 'cache_categories' ] = $cache_categories; 
    351340    $tmpoldblogdetails[ 'table_prefix' ] = $table_prefix; 
    352     $tmpoldblogdetails[ 'post_cache' ]     = $post_cache; 
    353     $tmpoldblogdetails[ 'wp_object_cache' ] = $wp_object_cache; 
    354341    $tmpoldblogdetails[ 'blog_id' ] = $blog_id; 
    355342 
     
    369356    $blog_id = $new_blog; 
    370357 
    371     $cache_settings = array(); 
    372     unset( $cache_settings ); 
    373     unset( $category_cache ); 
    374     unset( $cache_categories ); 
    375     unset( $post_cache ); 
    376     //unset( $wp_object_cache ); 
    377     //$wp_object_cache = new WP_Object_Cache(); 
    378     //$wp_object_cache->cache_enabled = false; 
    379     wp_cache_flush(); 
    380     wp_cache_close(); 
    381358    if( is_object( $wp_roles ) ) { 
    382359        $wpdb->hide_errors(); 
     
    387364        $current_user->_init_caps(); 
    388365    } 
    389     wp_cache_init(); 
    390366 
    391367    do_action('switch_blog', $blog_id, $tmpoldblogdetails[ 'blog_id' ]); 
     
    395371 
    396372function restore_current_blog() { 
    397     global $table_prefix, $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $cache_settings, $category_cache, $cache_categories, $post_cache, $wp_object_cache, $blog_id, $switched, $wp_roles; 
     373    global $table_prefix, $tmpoldblogdetails, $wpdb, $wpmuBaseTablePrefix, $blog_id, $switched, $switched_stack, $wp_roles, $current_user; 
     374 
     375    if ( !$switched ) 
     376        return; 
     377 
     378    $blog = array_pop($switched_stack); 
     379 
     380    if ( $blog_id == $blog ) 
     381        return; 
     382 
    398383    // backup 
    399384    $wpdb->blogid = $tmpoldblogdetails[ 'blogid' ]; 
     
    408393    $wpdb->postmeta = $tmpoldblogdetails[ 'postmeta' ]; 
    409394    $wpdb->prefix = $tmpoldblogdetails[ 'prefix' ]; 
    410     $cache_settings = $tmpoldblogdetails[ 'cache_settings' ]; 
    411     $category_cache = $tmpoldblogdetails[ 'category_cache' ]; 
    412     $cache_categories = $tmpoldblogdetails[ 'cache_categories' ]; 
    413395    $table_prefix = $tmpoldblogdetails[ 'table_prefix' ]; 
    414     $post_cache      = $tmpoldblogdetails[ 'post_cache' ]; 
    415     $wp_object_cache = $tmpoldblogdetails[ 'wp_object_cache' ]; 
    416396    $prev_blog_id = $blog_id; 
    417397    $blog_id = $tmpoldblogdetails[ 'blog_id' ]; 
    418398    unset( $tmpoldblogdetails ); 
    419     wp_cache_flush(); 
    420     wp_cache_close(); 
     399 
    421400    if( is_object( $wp_roles ) ) { 
    422401        $wpdb->hide_errors(); 
     
    424403        $wpdb->show_errors(); 
    425404    } 
    426     wp_cache_init(); 
    427  
     405    if ( is_object( $current_user ) ) { 
     406        $current_user->_init_caps(); 
     407    } 
    428408    do_action('switch_blog', $blog_id, $prev_blog_id); 
    429409 
     
    454434            preg_match('/wp_(\d+)_capabilities/', $key, $match); 
    455435            $blog = get_blog_details( $match[1] ); 
    456             if ( $blog && isset( $blog->domain ) ) { 
     436            if ( $blog && $blog->deleted == 0 && isset( $blog->domain ) ) { 
    457437                $blogs[$match[1]]->userblog_id = $match[1]; 
    458438                $blogs[$match[1]]->domain      = $blog->domain; 
     
    615595    if( $post == false ) { 
    616596        $post = $wpdb->get_row( "SELECT * FROM {$wpmuBaseTablePrefix}{$blog_id}_posts WHERE ID = '{$post_id}'" ); 
    617         wp_cache_set( $key, $post, "site-options", 30 ); 
     597        wp_cache_set( $key, $post, "site-options", 120 ); 
    618598    } 
    619599 
     
    623603 
    624604function add_user_to_blog( $blog_id, $user_id, $role ) { 
    625     global $wpdb; 
    626  
    627     $switch = false; 
    628  
    629     if ( empty($blog_id) ) 
    630         $blog_id = $wpdb->blogid; 
    631  
    632     if ( $blog_id != $wpdb->blogid ) { 
    633         $switch = true; 
    634         switch_to_blog($blog_id); 
    635     } 
     605    switch_to_blog($blog_id); 
    636606 
    637607    $user = new WP_User($user_id); 
     
    657627    do_action('add_user_to_blog', $user_id, $role, $blog_id); 
    658628 
    659     if ( $switch ) 
    660         restore_current_blog(); 
     629    restore_current_blog(); 
    661630} 
    662631 
    663632function remove_user_from_blog($user_id, $blog_id = '') { 
    664633    global $wpdb; 
    665     if ( empty($blog_id) ) 
    666         $blog_id = $wpdb->blogid; 
    667  
    668     $blog_id = (int) $blog_id; 
    669  
    670     if ( $blog_id != $wpdb->blogid ) { 
    671         $switch = true; 
    672         switch_to_blog($blog_id); 
    673     } 
     634 
     635    switch_to_blog($blog_id); 
    674636 
    675637    $user_id = (int) $user_id; 
     
    705667    } 
    706668 
    707     if ( $switch ) 
    708         restore_current_blog(); 
     669    restore_current_blog(); 
    709670} 
    710671 
     
    824785 
    825786function wpmu_validate_user_signup($user_name, $user_email) { 
    826     global $wpdb; 
     787    global $wpdb, $current_site; 
    827788 
    828789    $errors = new WP_Error(); 
     
    10711032 
    10721033    if ( $signup->active ) 
    1073         return new WP_Error('already_active', __('The blog is already active.')); 
    1074  
     1034        return new WP_Error('already_active', __('The blog is already active.'), $signup); 
     1035 
     1036    $meta = unserialize($signup->meta); 
    10751037    $user_login = $wpdb->escape($signup->user_login); 
    10761038    $user_email = $wpdb->escape($signup->user_email); 
     
    10811043    if ( ! $user_id ) 
    10821044        $user_id = wpmu_create_user($user_login, $password, $user_email); 
     1045    else 
     1046        $user_already_exists = true; 
    10831047 
    10841048    if ( ! $user_id ) 
    1085         return new WP_Error('create_user', __('Could not create user')); 
     1049        return new WP_Error('create_user', __('Could not create user'), $signup); 
    10861050 
    10871051    $now = current_time('mysql', true); 
     
    10891053    if ( empty($signup->domain) ) { 
    10901054        $wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'"); 
     1055        if ( isset($user_already_exists) ) 
     1056            return new WP_Error('user_already_exists', __('That username is already activated.'), $signup); 
    10911057        wpmu_welcome_user_notification($user_id, $password, $meta); 
    10921058        do_action('wpmu_activate_user', $user_id, $password, $meta); 
     
    10941060    } 
    10951061 
    1096     $meta = unserialize($signup->meta); 
    10971062    $blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta); 
    10981063 
    10991064    // TODO: What to do if we create a user but cannot create a blog? 
    1100     if ( is_wp_error($blog_id) ) 
     1065    if ( is_wp_error($blog_id) ) { 
     1066        // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and 
     1067        // setting the activation flag.  Let's just set the active flag and instruct the user to reset their password. 
     1068        if ( 'blog_taken' == $blog_id->get_error_code() ) { 
     1069            $blog_id->add_data($signup); 
     1070            $wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'"); 
     1071            error_log("Blog $blog_id failed to complete activation.", 0);    
     1072        } 
     1073 
    11011074        return $blog_id; 
     1075    } 
    11021076 
    11031077    $wpdb->query("UPDATE $wpdb->signups SET active = '1', activated = '$now' WHERE activation_key = '$key'"); 
     
    11231097    if ( email_exists($email) ) 
    11241098        return false; 
    1125  
    11261099 
    11271100    $user_id = wp_create_user( $user_name, $password, $email ); 
  • trunk/wp-login.php

    r791 r797  
    2424// Rather than duplicating this HTML all over the place, we'll stick it in function 
    2525function login_header($title = 'Login', $message = '') { 
    26     global $errors, $error; 
     26    global $errors, $error, $wp_locale; 
    2727 
    2828    ?> 
    2929<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    30 <html xmlns="http://www.w3.org/1999/xhtml"> 
     30<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 
    3131<head> 
    3232    <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title> 
    3333    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 
    3434    <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> 
     35<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?> 
     36    <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" /> 
     37<?php endif; ?> 
    3538    <!--[if IE]><style type="text/css">#login h1 a { margin-top: 35px; } #login ul { padding-bottom: 65px; }</style><![endif]--><!-- Curse you, IE! --> 
    3639    <script type="text/javascript"> 
     
    4447<body> 
    4548 
    46 <div id="login"> 
    47 <h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1> 
     49<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1> 
    4850<?php 
    4951    if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n"; 
     
    211213 
    212214    if ( $_POST ) { 
    213         $user_login = $_POST['user_login']; 
     215        $user_login = $_POST['log']; 
    214216        $user_login = sanitize_user( $user_login ); 
    215         $user_pass  = $_POST['user_pass']; 
     217        $user_pass  = $_POST['pwd']; 
    216218        $rememberme = $_POST['rememberme']; 
    217219    } else { 
     
    265267    <p> 
    266268        <label><?php _e('Username:') ?><br /> 
    267         <input type="text" name="user_login" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label> 
     269        <input type="text" name="log" id="user_login" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="20" tabindex="10" /></label> 
    268270    </p> 
    269271    <p> 
    270272        <label><?php _e('Password:') ?><br /> 
    271         <input type="password" name="user_pass" id="user_pass" class="input" value="" size="20" tabindex="20" /></label> 
     273        <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label> 
    272274    </p> 
    273275<?php do_action('login_form'); ?> 
  • trunk/wp-settings.php

    r789 r797  
    100100    require_once (ABSPATH . WPINC . '/wp-db.php'); 
    101101 
    102 // Table names 
    103102$wpdb->blogs        = $table_prefix . 'blogs'; 
    104103$wpdb->users        = $table_prefix . 'users'; 
  • trunk/wp-signup.php

    r776 r797  
    2828function show_blog_form($blog_id = '', $blog_title = '', $errors = '') { 
    2929    global $current_site; 
     30    $locale = get_locale(); 
    3031 
    3132    // Blog name/Username 
     
    106107 
    107108    print '<input name="user_name" type="text" id="user_name" value="'.$user_name.'" maxlength="50" style="width:50%; font-size: 30px;" /><br />'; 
    108     print __('(Must be at least 4 characters, letters and numbers only.)') . '</td> </tr>'; 
     109    _e('(Must be at least 4 characters, letters and numbers only.)'); echo '</td> </tr>'; 
    109110 
    110111    // User Email 
     
    119120?><p><strong><?php echo $errmsg ?></strong></p><?php 
    120121    } 
    121     print ' 
    122     <input name="user_email" type="text" id="user_email" value="'.wp_specialchars($user_email, 1).'" maxlength="200" /><br /> ' . __('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') . '</td> 
    123     </tr>'; 
    124  
     122    ?> 
     123    <input name="user_email" type="text" id="user_email" value="<?php  echo wp_specialchars($user_email, 1) ?>" maxlength="200" /><br /><?php _e('(We&#8217;ll send your password to this address, so <strong>triple-check it</strong>.)') ?></td> 
     124    </tr> 
     125    <?php 
    125126    if ( $errmsg = $errors->get_error_message('generic') ) 
    126127        print '<tr class="error"> <th colspan="2">'.$errmsg.'</th> </tr>'; 
     
    148149 
    149150    if ( $errors->get_error_code() ) { 
    150         print '<p>'.__('There was a problem, please correct the form below and try again.').'</p>'; 
    151     } 
    152  
    153 ?> 
    154 <?php printf(__("<p>Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly.</p>"), $current_user->display_name) ?> 
     151        echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>"; 
     152    } 
     153 
     154?> 
     155<p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p> 
    155156<?php 
    156157    $blogs = get_blogs_of_user($current_user->ID); 
     
    166167<form name="setupform" id="setupform" method="post" action="wp-signup.php"> 
    167168<input type="hidden" name="stage" value="gimmeanotherblog"> 
     169<?php do_action( "signup_hidden_fields" ); ?> 
    168170<table border="0" width="100%" cellpadding="9"> 
    169171<?php 
  • trunk/xmlrpc.php

    r789 r797  
    156156        $this->escape($args); 
    157157 
    158       $user_login = $args[1]; 
    159       $user_pass  = $args[2]; 
    160  
    161       if (!$this->login_pass_ok($user_login, $user_pass)) { 
    162         return $this->error; 
    163       } 
    164  
    165       set_current_user(0, $user_login); 
    166       $is_admin = current_user_can('level_8'); 
    167  
    168       $struct = array( 
    169         'isAdmin'  => $is_admin, 
    170         'url'      => get_option('home') . '/', 
    171         'blogid'   => '1', 
    172         'blogName' => get_option('blogname') 
    173       ); 
    174  
    175       return array($struct); 
     158        $user_login = $args[1]; 
     159        $user_pass  = $args[2]; 
     160 
     161        if (!$this->login_pass_ok($user_login, $user_pass)) 
     162            return $this->error; 
     163 
     164        $user = set_current_user(0, $user_login); 
     165 
     166        $blogs = (array) get_blogs_of_user($user->ID); 
     167 
     168        $struct = array(); 
     169 
     170        foreach ( $blogs as $blog ) { 
     171            $blog_id = $blog->userblog_id; 
     172             
     173            switch_to_blog($blog_id); 
     174 
     175            $is_admin = current_user_can('level_8'); 
     176 
     177            $struct[] = array( 
     178                'isAdmin'  => $is_admin, 
     179                'url'      => get_settings('home') . '/', 
     180                'blogid'   => $blog_id, 
     181                'blogName' => get_settings('blogname') 
     182            ); 
     183        } 
     184 
     185        return $struct; 
    176186    } 
    177187 
     
    833843            return $this->error; 
    834844        } 
     845 
     846        if ( $upload_err = apply_filters( "pre_upload_error", false ) ) 
     847            return new IXR_Error(500, $upload_err); 
    835848 
    836849        $upload = wp_upload_bits($name, $type, $bits); 
     
    12081221        $comment_post_ID = (int) $post_ID; 
    12091222        $comment_author = $title; 
    1210         $this->escape($comment_author); 
     1223        $wpdb->escape($comment_author); 
    12111224        $comment_author_url = $pagelinkedfrom; 
    12121225        $comment_content = $context; 
    1213         $this->escape($comment_content); 
     1226        $wpdb->escape($comment_content); 
    12141227        $comment_type = 'pingback'; 
    12151228 
    12161229        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type'); 
    12171230 
    1218         wp_new_comment($commentdata); 
    1219         do_action('pingback_post', $wpdb->insert_id); 
     1231        $comment_ID = wp_new_comment($commentdata); 
     1232        do_action('pingback_post', $comment_ID); 
    12201233 
    12211234        return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; 
Note: See TracChangeset for help on using the changeset viewer.