WordPress MU

Changeset 770


Ignore:
Timestamp:
09/26/2006 03:45:20 PM (20 years ago)
Author:
donncha
Message:

WP Merge to rev 4254

Location:
trunk
Files:
4 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r744 r770  
    798798        <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
    799799    <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    800     <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='" . wp_nonce_url("page.php?action=delete&amp;post=$id", 'delete-page_' . $id) .  "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     800    <td><?php if ( current_user_can('delete_page', $id) ) { echo "<a href='" . wp_nonce_url("page.php?action=delete&amp;post=$id", 'delete-page_' . $id) .  "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    801801  </tr>
    802802
    … …  
    12661266}
    12671267
    1268 function the_quicktags() {
    1269                 echo '
    1270                 <div id="quicktags">
    1271                         ';
    1272                 wp_print_scripts( 'quicktags' );
    1273                 echo '                  <script type="text/javascript">
    1274                                 //<![CDATA[
    1275                                 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();
    1276                                 //]]>
    1277                         </script>
    1278                 </div>
    1279 ';
    1280         echo '
    1281 <script type="text/javascript">
    1282 function edInsertContent(myField, myValue) {
    1283         //IE support
    1284         if (document.selection) {
    1285                 myField.focus();
    1286                 sel = document.selection.createRange();
    1287                 sel.text = myValue;
    1288                 myField.focus();
    1289         }
    1290         //MOZILLA/NETSCAPE support
    1291         else if (myField.selectionStart || myField.selectionStart == "0") {
    1292                 var startPos = myField.selectionStart;
    1293                 var endPos = myField.selectionEnd;
    1294                 myField.value = myField.value.substring(0, startPos)
    1295                               + myValue
    1296                       + myField.value.substring(endPos, myField.value.length);
    1297                 myField.focus();
    1298                 myField.selectionStart = startPos + myValue.length;
    1299                 myField.selectionEnd = startPos + myValue.length;
    1300         } else {
    1301                 myField.value += myValue;
    1302                 myField.focus();
    1303         }
    1304 }
    1305 </script>
    1306 ';
    1307 }
    1308 
    13091268function get_broken_themes() {
    13101269        global $wp_broken_themes;
    … …  
    17371696
    17381697        $wp_plugins = array ();
    1739         $plugin_loc = 'wp-content/plugins';
    1740         $plugin_root = ABSPATH.$plugin_loc;
     1698        $plugin_root = ABSPATH . PLUGINDIR;
    17411699
    17421700        // Files in wp-content/plugins directory
    … …  
    20211979}
    20221980
    2023 function user_can_richedit() {
    2024         if ( 'true' != get_user_option('rich_editing') )
    2025                 return false;
    2026 
    2027         if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
    2028                 return false;
    2029 
    2030         return true; // Best guess
    2031 }
    2032 
    20331981function the_attachment_links($id = false) {
    20341982        $id = (int) $id;
    … …  
    20842032function update_home_siteurl($old_value, $value) {
    20852033        global $wp_rewrite, $user_login, $user_pass_md5;
     2034
     2035        if ( defined("WP_INSTALLING") )
     2036                return;
     2037
    20862038        // If home changed, write rewrite rules to new location.
    20872039        $wp_rewrite->flush_rules();
  • trunk/wp-admin/admin-header.php

    r761 r770  
    1414?>
    1515<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    16 <html xmlns="http://www.w3.org/1999/xhtml">
     16<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    1717<head>
    1818<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
  • trunk/wp-admin/admin.php

    r743 r770  
    6161                }
    6262
    63                 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page") && ! file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page"))
     63                if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && ! file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page"))
    6464                        wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
    6565
    … …  
    7272                        include(ABSPATH . "wp-content/mu-plugins/$plugin_page");
    7373                else
    74                         include(ABSPATH . "wp-content/plugins/$plugin_page");
     74                        include(ABSPATH . PLUGINDIR . "/$plugin_page");
    7575        }
    7676
  • trunk/wp-admin/comment.php

    r729 r770  
    1313case 'editcomment':
    1414        $title = __('Edit Comment');
    15         if ( user_can_richedit() )
    16                 wp_enqueue_script( 'wp_tiny_mce' );
     15
    1716        require_once ('admin-header.php');
    1817
  • trunk/wp-admin/edit-form-advanced.php

    r734 r770  
    105105</fieldset>
    106106
    107 <fieldset class="dbx-box">
     107<fieldset id="poststatusdiv" class="dbx-box">
    108108<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
    109109<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
    … …  
    115115
    116116<?php if ( current_user_can('edit_posts') ) : ?>
    117 <fieldset class="dbx-box">
     117<fieldset id="posttimestampdiv" class="dbx-box">
    118118<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
    119119<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
    … …  
    121121<?php endif; ?>
    122122
    123 <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
     123<?php
     124$authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM
     125if ( $authors && count( $authors ) > 1 ) :
     126?>
    124127<fieldset id="authordiv" class="dbx-box">
    125128<h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3>
    … …  
    207210
    208211<div class="dbx-box-wrapper">
    209 <fieldset class="dbx-box">
     212<fieldset id="trackbacksdiv" class="dbx-box">
    210213<div class="dbx-handle-wrapper">
    211214<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
  • trunk/wp-admin/inline-uploading.php

    r729 r770  
    414414if (!win) win = top;
    415415tinyMCE = win.tinyMCE;
    416 richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );
    417416function sendToEditor(n) {
    418417        o = document.getElementById('div'+n);
    … …  
    424423        h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
    425424        h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
    426         if ( richedit )
     425        if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') )
    427426                win.tinyMCE.execCommand('mceInsertContent', false, h);
    428427        else
  • trunk/wp-admin/menu-header.php

    r729 r770  
    1313   
    1414        if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) {
    15                 if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
     15                if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
    1616                        echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    1717                else
    … …  
    4141$menu_hook = get_plugin_page_hook($item[2], $parent_file);
    4242
    43 if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
     43if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
    4444        if ( 'admin.php' == $pagenow )
    4545                echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
  • trunk/wp-admin/plugin-editor.php

    r729 r770  
    1616
    1717$file = validate_file_to_edit($file, $plugin_files);
    18 $real_file = get_real_file_to_edit("wp-content/plugins/$file");
     18$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
    1919
    2020switch($action) {
    … …  
    4848        require_once('admin-header.php');
    4949
    50         update_recently_edited("wp-content/plugins/$file");
     50        update_recently_edited(PLUGINDIR . "/$file");
    5151
    5252        if (!is_file($real_file))
  • trunk/wp-admin/plugins.php

    r729 r770  
    1717                        sort($current);
    1818                        update_option('active_plugins', $current);
    19                         include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
     19                        include(ABSPATH . PLUGINDIR . '/' . trim( $_GET['plugin'] ));
    2020                        do_action('activate_' . trim( $_GET['plugin'] ));
    2121                }
    … …  
    5050// plugins.
    5151foreach ($check_plugins as $check_plugin) {
    52         if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
     52        if (!file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin)) {
    5353                        $current = get_option('active_plugins');
    5454                        $key = array_search($check_plugin, $current);
    … …  
    131131?>
    132132
    133 <p><?php _e('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p>
     133<p><?php _e(sprintf('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.', PLUGINDIR)); ?></p>
    134134
    135135<h2><?php _e('Get More Plugins'); ?></h2>
    136 <p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p>
     136<p><?php _e(sprintf('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.', PLUGINDIR)); ?></p>
    137137
    138138</div>
  • trunk/wp-admin/post-new.php

    r729 r770  
    5555
    5656<?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?>
    57 <div class="wrap">
     57<div id="wp-bookmarklet" class="wrap">
    5858<h3><?php _e('WordPress bookmarklet'); ?></h3>
    5959<p><?php _e('Right click on the following link and choose "Add to favorites" to create a posting shortcut.'); ?></p>
  • trunk/wp-admin/user-edit.php

    r729 r770  
    1616        $errors = new WP_Error('head', __('You do not have permission to edit this user.'));
    1717
     18$user_id = (int) $user_id;
     19
     20if ( !$user_id )
     21        wp_die(__('Invalid user ID.'));
     22
    1823switch ($action) {
    1924case 'switchposts':
    … …  
    3035
    3136if ( !current_user_can('edit_user', $user_id) )
    32         $errors = new WP_Error('head', __('You do not have permission to edit this user.'));
    33 
    34 if ( !isset($errors) )
    35         $errors = edit_user($user_id);
     37        wp_die(__('You do not have permission to edit this user.'));
     38
     39$errors = edit_user($user_id);
    3640
    3741if( !is_wp_error( $errors ) ) {
    … …  
    4347
    4448default:
     49$profileuser = get_user_to_edit($user_id);
     50
     51if ( !current_user_can('edit_user', $user_id) )
     52                wp_die(__('You do not have permission to edit this user.'));
     53
    4554include ('admin-header.php');
    46 
    47 $profileuser = get_user_to_edit($user_id);
    48 
    49 if ( !current_user_can('edit_user', $user_id) )
    50         if ( !is_wp_error( $errors ) )
    51                 $errors = new WP_Error('head', __('You do not have permission to edit this user.'));
    5255?>
    5356
  • trunk/wp-admin/wp-admin.css

    r761 r770  
    491491}
    492492
    493 #quicktags {
    494         margin-left: -1px;
    495 }
    496 
    497493#currenttheme img {
    498494        float: left;
    … …  
    513509}
    514510
     511#postdivrich #quicktags {
     512        background: #f0f0ee;
     513        padding: 0px;
     514        border: 1px solid #ccc;
     515        border-bottom: none;
     516}
     517#postdiv #quicktags {
     518        padding-right: 6px;
     519}
     520#postdivrich #quicktags {
     521        display: none;
     522}
     523#quicktags #ed_toolbar {
     524        padding: 0px 2px;
     525}
     526
     527#ed_toolbar input {
     528        background: #fff url( images/fade-butt.png ) repeat-x 0px -2px;
     529        margin: 3px 2px 2px;
     530}
     531
    515532#quicktags #ed_strong {
    516533        font-weight: bold;
    … …  
    532549#quicktags #ed_code {
    533550        font-family: "Courier New", Courier, mono;
     551        margin-bottom: 3px;
    534552}
    535553
    … …  
    9881006        margin-bottom: -7px;
    9891007        padding: 6px 1em 0 3px;
     1008        height: 19px;
     1009        font-size: 12px;
    9901010        background: #2685af url(images/box-head-right.gif) no-repeat top right;
    9911011}
    … …  
    11191139        margin-left: 2em;
    11201140}
     1141#postdivrich #edButtons {
     1142        padding-left: 3px;
     1143}
     1144#postdivrich #content, #postdivrich #content:active {
     1145        border: 1px solid #ccc;
     1146}
     1147#edButtons input, #edButtons input:active {
     1148        margin: 0px 2px -1px;
     1149}
     1150#edButtons input.edButtonFore, #edButtons input.edButtonFore:active {
     1151        background: #f0f0ee;
     1152        border-bottom: 1px solid #f0f0ee;
     1153}
     1154#edButtons input.edButtonBack, #edButtons input.edButtonBack:active {
     1155        background: #fff url( images/fade-butt.png ) repeat-x 0px 15px;
     1156        border-bottom: 1px solid #ccc;
     1157}
  • trunk/wp-includes/bookmark-template.php

    r734 r770  
    231231
    232232                        // Display the category name
    233                         echo '  <li id="linkcat-' . $cat->cat_ID . '"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n";
     233                        echo '  <li id="linkcat-' . $cat->cat_ID . '" class="linkcat"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n";
    234234                        // Call get_links() with all the appropriate params
    235235                        get_links($cat->cat_ID, '<li>', "</li>", "\n", true, 'name', false);
    … …  
    341341                        if ( empty($bookmarks) )
    342342                                continue;
    343                         $output .= "<li id=\"linkcat-$cat->cat_ID\">$title_before$cat->cat_name$title_after\n\t<ul>\n";
     343                        $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n";
    344344                        $output .= _walk_bookmarks($bookmarks, $r);
    345345                        $output .= "\n\t</ul>\n</li>\n";
  • trunk/wp-includes/capabilities.php

    r729 r770  
    325325                //echo "post ID: {$args[0]}<br/>";
    326326                $page = get_page($args[0]);
    327                 $page_author_data = get_userdata($post->post_author);
     327                $page_author_data = get_userdata($page->post_author);
    328328                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
    329329                // If the user is the author...
    … …  
    379379                //echo "post ID: {$args[0]}<br/>";
    380380                $page = get_page($args[0]);
    381                 $page_author_data = get_userdata($post->post_author);
     381                $page_author_data = get_userdata($page->post_author);
    382382                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
    383383                // If the user is the author...
  • trunk/wp-includes/classes.php

    r762 r770  
    11<?php
    2 
    3 class retrospam_mgr {
    4         var $spam_words;
    5         var $comments_list;
    6         var $found_comments;
    7 
    8         function retrospam_mgr() {
    9                 global $wpdb;
    10 
    11                 $list = explode("\n", get_option('moderation_keys') );
    12                 $list = array_unique( $list );
    13                 $this->spam_words = $list;
    14 
    15                 $this->comment_list = $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC");
    16         }       // End of class constructor
    17 
    18         function move_spam( $id_list ) {
    19                 global $wpdb;
    20                 $cnt = 0;
    21                 $id_list = explode( ',', $id_list );
    22 
    23                 foreach ( $id_list as $comment ) {
    24                         if ( $wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) {
    25                                 $cnt++;
    26                         }
    27                 }
    28                 echo "<div class='updated'><p> ";
    29                 printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
    30                 echo "</p></div>\n";
    31         }       // End function move_spam
    32 
    33         function find_spam() {
    34                 $in_queue = 0;
    35 
    36                 foreach( $this->comment_list as $comment ) {
    37                         if( $comment->approved == 1 ) {
    38                                 foreach( $this->spam_words as $word ) {
    39                                         $word = trim($word);
    40                                         if ( empty( $word ) )
    41                                                 continue;
    42                                         $fulltext = strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text);
    43                                         if( false !== strpos( $fulltext, strtolower($word) ) ) {
    44                                                 $this->found_comments[] = $comment->ID;
    45                                                 break;
    46                                         }
    47                                 }
    48                         } else {
    49                                 $in_queue++;
    50                         }
    51                 }
    52                 return array( 'found' => $this->found_comments, 'in_queue' => $in_queue );
    53         }       // End function find_spam
    54 
    55         function display_edit_form( $counters ) {
    56                 $numfound = count($counters[found]);
    57                 $numqueue = $counters[in_queue];
    58 
    59                 $body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
    60 
    61                 if ( count($counters[found]) > 0 ) {
    62                         $id_list = implode( ',', $counters[found] );
    63                         $body .= '<p><a href="options-discussion.php?action=retrospam&amp;move=true&amp;ids='.$id_list.'">'. __('Move suspect comments to moderation queue &raquo;') . '</a></p>';
    64 
    65                 }
    66                 $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
    67 
    68                 $foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
    69 
    70                 return $head . $body . $foot;
    71         }       // End function display_edit_form
    72 
    73 }
    742
    753class WP {
    … …  
    11038                        $this->did_permalink = true;
    11139
    112                         $pathinfo = $_SERVER['PATH_INFO'];
     40                        if ( isset($_SERVER['PATH_INFO']) )
     41                                $pathinfo = $_SERVER['PATH_INFO'];
     42                        else
     43                                $pathinfo = '';
    11344                        $pathinfo_array = explode('?', $pathinfo);
    11445                        $pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
    … …  
    11849                        $self = $_SERVER['PHP_SELF'];
    11950                        $home_path = parse_url(get_option('home'));
    120                         $home_path = $home_path['path'];
     51                        if ( isset($home_path['path']) )
     52                                $home_path = $home_path['path'];
     53                        else
     54                                $home_path = '';
    12155                        $home_path = trim($home_path, '/');
    12256
  • trunk/wp-includes/cron.php

    r753 r770  
    103103
    104104        $keys = array_keys( $crons );
    105         if ( $keys[0] > time() )
     105        if ( isset($keys[0]) && $keys[0] > time() )
    106106                return;
    107107
    … …  
    124124        );
    125125        return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
     126}
     127
     128function wp_get_schedule($hook, $args = array()) {
     129        $crons = _get_cron_array();
     130        $key = md5(serialize($args));
     131        if ( empty($crons) )
     132                return false;
     133        foreach ( $crons as $timestamp => $cron ) {
     134                if ( isset( $cron[$hook][$key] ) )
     135                        return $cron[$hook][$key]['schedule'];
     136        }
     137        return false;
    126138}
    127139
  • trunk/wp-includes/general-template.php

    r734 r770  
    127127                        global $wp_version;
    128128                        $output = $wp_version;
     129                        break;
     130                case 'language':
     131                        $output = get_locale();
     132                        $output = str_replace('_', '-', $output);
     133                        break;
     134                case 'text_direction':
     135                        global $wp_locale;
     136                        $output = $wp_locale->text_direction;
    129137                        break;
    130138                case 'name':
    … …  
    737745}
    738746
    739 /**
    740  * Places a textarea according to the current user's preferences, filled with $content.
    741  * Also places a script block that enables tabbing between Title and Content.
    742  *
    743  * @param string Editor contents
    744  * @param string (optional) Previous form field's ID (for tabbing support)
    745  */
     747function user_can_richedit() {
     748        $can = true;
     749
     750        if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
     751                $can = false;
     752
     753        return apply_filters('user_can_richedit', $can);
     754}
     755
    746756function the_editor($content, $id = 'content', $prev_id = 'title') {
    747757        $rows = get_option('default_post_edit_rows');
    … …  
    751761        $rows = "rows='$rows'";
    752762
    753         the_quicktags();
    754 
    755         if ( user_can_richedit() )
     763        if ( user_can_richedit() ) :
    756764                add_filter('the_editor_content', 'wp_richedit_pre');
     765
     766                //      The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
     767        ?>
     768        <style type="text/css">
     769                #postdivrich table, #postdivrich #quicktags {border-top: none;}
     770                #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
     771                #edButtons {border-bottom: 1px solid #ccc;}
     772        </style>
     773        <div id='edButtons' style='display:none;'>
     774                <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
     775                <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' />
     776                <input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' />
     777        </div>
     778        <script type="text/javascript">
     779                if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
     780                        document.getElementById('edButtons').style.display = 'block';
     781        </script>
     782
     783        <?php endif; ?>
     784        <div id="quicktags">
     785        <?php wp_print_scripts( 'quicktags' ); ?>
     786        <script type="text/javascript">edToolbar()</script>
     787        </div>
     788        <script type="text/javascript">
     789                if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
     790                        document.getElementById("quicktags").style.display="none";
     791
     792                function edInsertContent(myField, myValue) {
     793                        //IE support
     794                        if (document.selection) {
     795                                myField.focus();
     796                                sel = document.selection.createRange();
     797                                sel.text = myValue;
     798                                myField.focus();
     799                        }
     800                        //MOZILLA/NETSCAPE support
     801                        else if (myField.selectionStart || myField.selectionStart == "0") {
     802                                var startPos = myField.selectionStart;
     803                                var endPos = myField.selectionEnd;
     804                                myField.value = myField.value.substring(0, startPos)
     805                                              + myValue
     806                                      + myField.value.substring(endPos, myField.value.length);
     807                                myField.focus();
     808                                myField.selectionStart = startPos + myValue.length;
     809                                myField.selectionEnd = startPos + myValue.length;
     810                        } else {
     811                                myField.value += myValue;
     812                                myField.focus();
     813                        }
     814                }
     815        </script>
     816        <?php
    757817
    758818        $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
    … …  
    765825        //<!--
    766826        edCanvas = document.getElementById('<?php echo $id; ?>');
    767         <?php if ( user_can_richedit() ) : ?>
     827        <?php if ( $prev_id && user_can_richedit() ) : ?>
    768828        // This code is meant to allow tabbing from Title to Post (TinyMCE).
    769829        if ( tinyMCE.isMSIE )
    … …  
    772832                                e = e ? e : window.event;
    773833                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    774                                         var i = tinyMCE.selectedInstance;
     834                                        var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
    775835                                        if(typeof i ==  'undefined')
    776836                                                return true;
    777                                         tinyMCE.execCommand("mceStartTyping");
     837                                        tinyMCE.execCommand("mceStartTyping");
    778838                                        this.blur();
    779839                                        i.contentWindow.focus();
    … …  
    787847                                e = e ? e : window.event;
    788848                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    789                                         var i = tinyMCE.selectedInstance;
     849                                        var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
    790850                                        if(typeof i ==  'undefined')
    791851                                                return true;
    792                                         tinyMCE.execCommand("mceStartTyping");
     852                                        tinyMCE.execCommand("mceStartTyping");
    793853                                        this.blur();
    794854                                        i.contentWindow.focus();
    … …  
    808868}
    809869
     870function language_attributes() {
     871        $output = '';
     872        if ( $dir = get_bloginfo('text_direction') )
     873                $output = "dir=\"$dir\"";
     874        if ( $lang = get_bloginfo('language') ) {
     875                if ( $dir ) $output .= ' ';
     876                $output .= "lang=\"$lang\" xml:lang=\"$lang\"";
     877        }
     878
     879        echo $output;
     880}
    810881?>
  • trunk/wp-includes/js/autosave.js.php

    r743 r770  
    7373function autosave() {
    7474        var form = $('post');
     75        var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false;
    7576
    7677        autosaveAjax = new sack();
    7778
    7879        /* Gotta do this up here so we can check the length when tinyMCE is in use */
    79         if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {
     80        if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
    8081                autosaveAjax.setVar("content", form.content.value);
    8182        } else {
    … …  
    111112                autosaveAjax.setVar("excerpt", form.excerpt.value);             
    112113               
    113         if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {
     114        if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
    114115                autosaveAjax.setVar("content", form.content.value);
    115116        } else {
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r723 r770  
    3939                                + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
    4040                                + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
    41                                 + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
    4241                                + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />'
    43                                 + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
     42                                + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
     43                                + '<input type="button" accesskey="v" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
    4444                                + '</div>';
    4545                                return buttons+hiddenControls;
    … …  
    242242                                // Remove anonymous, empty paragraphs.
    243243                                content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
    244        
     244
    245245                                // Handle table badness.
    246246                                content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
    … …  
    249249                                content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
    250250                                content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
    251        
     251
    252252                                // Pretty it up for the source editor.
    253253                                var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
    254254                                content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
    255                                 content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
     255                                content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>');
    256256                                content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
    257257                                content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
    … …  
    295295
    296296                // Get it ready for wpautop.
    297                 content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
    298                 content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
    299                 content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
     297                content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
     298                content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
     299                content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
    300300                content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
    301301
    … …  
    310310                content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
    311311
    312                 // Trim any whitespace
    313                 content = content.replace(new RegExp('^\\s*', ''), '');
     312                // Trim trailing whitespace
    314313                content = content.replace(new RegExp('\\s*$', ''), '');
    315314
    … …  
    469468        }
    470469}
     470
     471function switchEditors(id) {
     472        var inst = tinyMCE.getInstanceById(id);
     473        var qt = document.getElementById('quicktags');
     474        var H = document.getElementById('edButtonHTML');
     475        var P = document.getElementById('edButtonPreview');
     476        var ta = document.getElementById(id);
     477        var pdr = ta.parentNode;
     478
     479        if ( inst ) {
     480                edToggle(H, P);
     481
     482                if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
     483                        // IE rejects the later overflow assignment so we skip this step.
     484                        // Alternate code might be nice. Until then, IE reflows.
     485                } else {
     486                        // Lock the fieldset's height to prevent reflow/flicker
     487                        pdr.style.height = pdr.clientHeight + 'px';
     488                        pdr.style.overflow = 'hidden';
     489                }
     490
     491                // Save the coords of the bottom right corner of the rich editor
     492                var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0];
     493                var y1 = table.offsetTop + table.offsetHeight;
     494
     495                if ( TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height") == null ) {
     496                        var expires = new Date();
     497                        expires.setTime(expires.getTime() + 3600000 * 24 * 30);
     498                        var offset = tinyMCE.isMSIE ? 1 : 2;
     499                        TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires);
     500                }
     501
     502                // Unload the rich editor
     503                inst.triggerSave(false, false);
     504                htm = inst.formElement.value;
     505                tinyMCE.removeMCEControl(id);
     506                document.getElementById(id).value = htm;
     507                --tinyMCE.idCounter;
     508
     509                // Reveal Quicktags and textarea
     510                qt.style.display = 'block';
     511                ta.style.display = 'inline';
     512
     513                // Set the textarea height to match the rich editor
     514                y2 = ta.offsetTop + ta.offsetHeight;
     515                ta.style.height = (ta.clientHeight + y1 - y2) + 'px';
     516
     517                // Tweak the widths
     518                ta.parentNode.style.paddingRight = '2px';
     519
     520                if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
     521                } else {
     522                        // Unlock the fieldset's height
     523                        pdr.style.height = 'auto';
     524                        pdr.style.overflow = 'display';
     525                }
     526        } else {
     527                edToggle(P, H);
     528                edCloseAllTags(); // :-(
     529
     530                if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
     531                } else {
     532                        // Lock the fieldset's height
     533                        pdr.style.height = pdr.clientHeight + 'px';
     534                        pdr.style.overflow = 'hidden';
     535                }
     536
     537                // Hide Quicktags and textarea
     538                qt.style.display = 'none';
     539                ta.style.display = 'none';
     540
     541                // Tweak the widths
     542                ta.parentNode.style.paddingRight = '0px';
     543
     544                // Load the rich editor with formatted html
     545                if ( tinyMCE.isMSIE ) {
     546                        ta.value = wpautop(ta.value);
     547                        tinyMCE.addMCEControl(ta, id);
     548                } else {
     549                        htm = wpautop(ta.value);
     550                        tinyMCE.addMCEControl(ta, id);
     551                        tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm);
     552                }
     553
     554                if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
     555                } else {
     556                        // Unlock the fieldset's height
     557                        pdr.style.height = 'auto';
     558                        pdr.style.overflow = 'display';
     559                }
     560        }
     561}
     562
     563function edToggle(A, B) {
     564        A.className = 'edButtonFore';
     565        B.className = 'edButtonBack';
     566
     567        B.onclick = A.onclick;
     568        A.onclick = null;
     569}
     570
     571function wpautop(pee) {
     572        pee = pee + "\n\n";
     573        pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
     574        pee = pee.replace(new RegExp('(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "\n$1");
     575        pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n");
     576        pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
     577        pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
     578        pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "<p>$1</p>\n");
     579        pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
     580        pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
     581        pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
     582        pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
     583        pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
     584        pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "$1");
     585        pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
     586        pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
     587        pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*<br />', 'gi'), "$1");
     588        pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
     589        pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
     590        //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' "); // Hmm...
     591        return pee;
     592}
  • trunk/wp-includes/js/tinymce/tiny_mce_config.php

    r761 r770  
    2929        $plugins = implode($plugins, ',');
    3030
    31         $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'code', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));
     31        $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));
    3232        $mce_buttons = implode($mce_buttons, ',');
    3333
  • trunk/wp-includes/js/tinymce/tiny_mce_gzip.php

    r618 r770  
    3636
    3737        // Fall back on en.js
    38         if ( empty($text) )
    39                 $text = file_get_contents(realpath(sprintf($path, 'en')));
     38        $file = realpath(sprintf($path, 'en'));
     39        if ( empty($text) && file_exists($file) )
     40                $text = file_get_contents($file);
    4041
    4142        // Send lang file through gettext
  • trunk/wp-includes/l10n.php

    r566 r770  
    11<?php
    2 
    3 if ( defined('WPLANG') && '' != constant('WPLANG') ) {
    4         include_once(ABSPATH . 'wp-includes/streams.php');
    5         include_once(ABSPATH . 'wp-includes/gettext.php');
    6 }
    7 
    82function get_locale() {
    93        global $locale;
    … …  
    7670
    7771        $locale = get_locale();
    78         $mofile = ABSPATH . "wp-includes/languages/$locale.mo";
     72        $mofile = ABSPATH . LANGDIR . "/$locale.mo";
    7973
    8074        load_textdomain('default', $mofile);
    8175}
    8276
    83 function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
     77function load_plugin_textdomain($domain, $path = false) {
    8478        $locale = get_locale();
     79        if ( false === $path )
     80                $path = PLUGINDIR;
    8581
    8682        $mofile = ABSPATH . "$path/$domain-$locale.mo";
  • trunk/wp-includes/link-template.php

    r729 r770  
    483483                preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
    484484                $fromwhere = $matches[1];
    485                 $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
     485                $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT $wpdb->posts.ID) FROM $fromwhere");
    486486                $max_num_pages = ceil($numposts / $posts_per);
    487487        } else {
  • trunk/wp-includes/pluggable.php

    r737 r770  
    264264// http://support.microsoft.com/kb/q176113/
    265265if ( !function_exists('wp_redirect') ) :
    266 function wp_redirect($location) {
     266function wp_redirect($location, $status = 302) {
    267267        global $is_IIS;
    268268
    … …  
    272272        $strip = array('%0d', '%0a');
    273273        $location = str_replace($strip, '', $location);
     274
     275        status_header($status);
    274276
    275277        if ($is_IIS)
    … …  
    295297                $password = md5( md5($password) ); // Double hash the password in the cookie.
    296298
     299        if ( empty($home) )
     300                $cookiepath = COOKIEPATH;
     301        else
     302                $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' );
     303
     304        if ( empty($siteurl) ) {
     305                $sitecookiepath = SITECOOKIEPATH;
     306                $cookiehash = COOKIEHASH;
     307        } else {
     308                $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' );
     309                $cookiehash = md5($siteurl);
     310        }
     311
    297312        if ( $remember )
    298313                $expire = time() + 31536000;
    … …  
    300315                $expire = 0;
    301316
    302         global $base;
    303         setcookie(USER_COOKIE, $username, $expire, $base, COOKIE_DOMAIN);
    304         setcookie(PASS_COOKIE, $password, $expire, $base, COOKIE_DOMAIN);
     317        setcookie(USER_COOKIE, $username, $expire, $cookiepath, COOKIE_DOMAIN);
     318        setcookie(PASS_COOKIE, $password, $expire, $cookiepath, COOKIE_DOMAIN);
     319
     320        if ( $cookiepath != $sitecookiepath ) {
     321                setcookie(USER_COOKIE, $username, $expire, $sitecookiepath, COOKIE_DOMAIN);
     322                setcookie(PASS_COOKIE, $password, $expire, $sitecookiepath, COOKIE_DOMAIN);
     323        }
    305324}
    306325endif;
    … …  
    308327if ( !function_exists('wp_clearcookie') ) :
    309328function wp_clearcookie() {
    310         global $base;
    311         setcookie(USER_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
    312         setcookie(PASS_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
     329        setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
     330        setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
     331        setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
     332        setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
    313333}
    314334endif;
  • trunk/wp-includes/query.php

    r744 r770  
    330330                $this->parse_query('');
    331331        }
     332       
     333        function fill_query_vars($array) {
     334                $keys = array(
     335                        'error'
     336                        , 'm'
     337                        , 'p'
     338                        , 'subpost'
     339                        , 'subpost_id'
     340                        , 'attachment'
     341                        , 'attachment_id'
     342                        , 'name'
     343                        , 'hour'
     344                        , 'static'
     345                        , 'pagename'
     346                        , 'page_id'
     347                        , 'second'
     348                        , 'minute'
     349                        , 'hour'
     350                        , 'day'
     351                        , 'monthnum'
     352                        , 'year'
     353                        , 'w'
     354                        , 'category_name'
     355                        , 'author_name'
     356                        , 'feed'
     357                        , 'tb'
     358                        , 'paged'
     359                        , 'comments_popup'
     360                        , 'preview'
     361                );
     362
     363                foreach ($keys as $key) {
     364                        if ( !isset($array[$key]))
     365                                $array[$key] = '';
     366                }
     367               
     368                return $array;
     369        }
    332370
    333371        // Parse a query string and set query type booleans.
    … …  
    342380                        $this->query_vars = $qv;
    343381                }
    344 
     382               
     383                $qv = $this->fill_query_vars($qv);
     384               
    345385                if ( ! empty($qv['robots']) ) {
    346386                        $this->is_robots = true;
    … …  
    531571                // Shorthand.
    532572                $q = &$this->query_vars;
     573               
     574                $q = $this->fill_query_vars($q);
    533575
    534576                // First let's clear some variables
    … …  
    541583                $limits = '';
    542584                $join = '';
     585                $search = '';
    543586
    544587                if ( !isset($q['post_type']) )
    … …  
    910953
    911954                        if (($q['what_to_show'] == 'posts')) {
    912                                 $q['offset'] = abs(intval($q['offset']));
    913955                                if ( empty($q['offset']) ) {
    914956                                        $pgstrt = '';
    … …  
    916958                                        $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
    917959                                } else { // we're ignoring $page and using 'offset'
     960                                        $q['offset'] = abs(intval($q['offset']));
    918961                                        $pgstrt = $q['offset'] . ', ';
    919962                                        $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
  • trunk/wp-includes/script-loader.php

    r760 r770  
    1616                $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' );
    1717                $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
    18                 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '08152006' );
    19                 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' );
     18                $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' );
     19                $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' );
    2020                $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
    21                 $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4183');
     21                $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206');
    2222                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187');
    2323                $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187');
  • trunk/wp-includes/wp-db.php

    r761 r770  
    284284                if ( $query )
    285285                        $this->query($query);
     286               
     287                if ( !isset($this->last_result[$y]) )
     288                        return null;
    286289
    287290                if ( $output == OBJECT ) {
    … …  
    434437}
    435438
    436 $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
     439if ( ! isset($wpdb) )
     440        $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
    437441?>
  • trunk/wp-settings.php

    r737 r770  
    44
    55// Turn register globals off
    6 function unregister_GLOBALS() {
     6function wp_unregister_GLOBALS() {
    77        if ( !ini_get('register_globals') )
    88                return;
    … …  
    2020}
    2121
    22 unregister_GLOBALS();
     22wp_unregister_GLOBALS();
    2323
    2424unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
    … …  
    8585
    8686define('WPINC', 'wp-includes');
     87if ( !defined('LANGDIR') )
     88        define('LANGDIR', WPINC . '/languages');   // no leading slash, no trailing slash
     89if ( !defined('PLUGINDIR') )
     90        define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
    8791if ( file_exists(ABSPATH . 'wp-content/db.php') )
    8892        require (ABSPATH . 'wp-content/db.php');
Note: See TracChangeset for help on using the changeset viewer.