WordPress MU

Changeset 804


Ignore:
Timestamp:
11/07/2006 12:37:04 PM (20 years ago)
Author:
donncha
Message:

WP Merge

Location:
trunk
Files:
1 added
38 edited

Legend:

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

    r803 r804  
    123123
    124124        $i = 0;
    125         $search = "# id=(\"|')p(\d+)\\1#i";
     125        $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
    126126        foreach ( $anchor_matches[0] as $anchor ) {
    127127                if ( 0 == preg_match($search, $anchor, $id_matches) )
    128128                        continue;
    129129
    130                 $id = $id_matches[2];
     130                $id = $id_matches[3];
    131131
    132132                // While we have the attachment ID, let's adopt any orphans.
    … …  
    288288// Get an existing post and format it for editing.
    289289function get_post_to_edit($id) {
    290         global $richedit;
    291         $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
    292290
    293291        $post = get_post($id);
    294292
    295         $post->post_content = format_to_edit($post->post_content, $richedit);
     293        $post->post_content = format_to_edit($post->post_content, user_can_richedit());
    296294        $post->post_content = apply_filters('content_edit_pre', $post->post_content);
    297295
    … …  
    351349
    352350function get_comment_to_edit($id) {
    353         global $richedit;
    354         $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
    355 
    356351        $comment = get_comment($id);
    357352
    358         $comment->comment_content = format_to_edit($comment->comment_content, $richedit);
     353        $comment->comment_content = format_to_edit($comment->comment_content, user_can_richedit());
    359354        $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    360355
    … …  
    994989                if ('_' == $entry['meta_key'] { 0 })
    995990                        $style .= ' hidden';
     991
     992                if ( is_serialized($entry['meta_value']) ) {
     993                        if ( is_serialized_string($entry['meta_value']) ) {
     994                                // this is a serialized string, so we should display it
     995                                $entry['meta_value'] = maybe_unserialize($entry['meta_value']);
     996                        } else {
     997                                // this is a serialized array/object so we should NOT display it
     998                                --$count;
     999                                continue;
     1000                        }
     1001                }
     1002
    9961003                $key_js = js_escape($entry['meta_key']);
    9971004                $entry['meta_key'] = wp_specialchars( $entry['meta_key'], true );
    … …  
    10251032function meta_form() {
    10261033        global $wpdb;
     1034        $limit = (int) apply_filters('postmeta_form_limit', 30);
    10271035        $keys = $wpdb->get_col("
    1028                         SELECT meta_key
    1029                         FROM $wpdb->postmeta
    1030                         GROUP BY meta_key
    1031                         ORDER BY meta_id DESC
    1032                         LIMIT 10");
     1036                SELECT meta_key
     1037                FROM $wpdb->postmeta
     1038                GROUP BY meta_key
     1039                ORDER BY meta_id DESC
     1040                LIMIT $limit");
     1041        natcasesort($keys);
    10331042?>
    10341043<h3><?php _e('Add a new custom field:') ?></h3>
    … …  
    10401049        <tr valign="top">
    10411050                <td align="right" width="18%">
    1042 <?php if ($keys) : ?>
     1051<?php if ( $keys ) : ?>
    10431052<select id="metakeyselect" name="metakeyselect" tabindex="7">
    10441053<option value="#NONE#"><?php _e('- Select -'); ?></option>
    10451054<?php
    10461055
    1047         foreach ($keys as $key) {
     1056        foreach ( $keys as $key ) {
    10481057                $key = wp_specialchars($key, 1);
    10491058                echo "\n\t<option value='$key'>$key</option>";
    … …  
    10691078        $metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
    10701079        $metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
    1071         $metavalue = $wpdb->escape(stripslashes(trim($_POST['metavalue'])));
     1080        $metavalue = maybe_serialize(stripslashes((trim($_POST['metavalue']))));
     1081        $metavalue = $wpdb->escape($metavalue);
    10721082
    10731083        if ( ('0' === $metavalue || !empty ($metavalue)) && ((('#NONE#' != $metakeyselect) && !empty ($metakeyselect)) || !empty ($metakeyinput)) ) {
    … …  
    11001110function update_meta($mid, $mkey, $mvalue) {
    11011111        global $wpdb;
     1112        $mvalue = maybe_serialize(stripslashes($mvalue));
     1113        $mvalue = $wpdb->escape($mvalue);
    11021114        $mid = (int) $mid;
    1103 
    11041115        return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
    11051116}
    … …  
    11091120        $mid = (int) $mid;
    11101121
    1111         return $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
     1122        $meta = $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
     1123        if ( is_serialized_string($meta->meta_value) )
     1124                $meta->meta_value = maybe_unserialize($meta->meta_value);
     1125        return $meta;
    11121126}
    11131127
    … …  
    19371951
    19381952function wp_import_upload_form($action) {
     1953        $size = strtolower( ini_get('upload_max_filesize') );
     1954        $bytes = 0;
     1955        if ( strstr( $size, 'k' ) )
     1956                $bytes = $size * 1024;
     1957        if ( strstr( $size, 'm' ) )
     1958                $bytes = $size * 1024 * 1024;
     1959        if ( strstr( $size, 'g' ) )
     1960                $bytes = $size * 1024 * 1024 * 1024;
    19391961?>
    19401962<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
    19411963<p>
    1942 <label for="upload"><?php _e('Choose a file from your computer:'); ?></label> <input type="file" id="upload" name="import" size="25" />
     1964<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf( __('Maximum size: %s'), $size ); ?>)
     1965<input type="file" id="upload" name="import" size="25" />
    19431966<input type="hidden" name="action" value="save" />
     1967<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
    19441968</p>
    19451969<p class="submit">
    … …  
    19972021        <tr>
    19982022                <th scope="row"><?php $thumb ? _e('Thumbnail linked to file') : _e('Image linked to file'); ?></th>
    1999                 <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>
     2023                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid; ?>"><?php echo $icon ?></a></textarea></td>
    20002024        </tr>
    20012025        <tr>
    20022026                <th scope="row"><?php $thumb ? _e('Thumbnail linked to page') : _e('Image linked to file'); ?></th>
    2003                 <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>
     2027                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
    20042028        </tr>
    20052029<?php else : ?>
    … …  
    20102034        <tr>
    20112035                <th scope="row"><?php _e('Link to page') ?></th>
    2012                 <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>
     2036                <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
    20132037        </tr>
    20142038<?php endif; ?>
    … …  
    21402164
    21412165add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);
     2166
     2167function wp_crop_image($src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false) {
     2168        if ( ctype_digit($src_file) ) // Handle int as attachment ID
     2169                $src_file = get_attached_file($src_file);
     2170
     2171        $src = wp_load_image($src_file);
     2172
     2173        if ( !is_resource($src) )
     2174                return $src;
     2175
     2176        $dst = imagecreatetruecolor($dst_w, $dst_h);
     2177
     2178        if ( $src_abs ) {
     2179                $src_w -= $src_x;
     2180                $src_h -= $src_y;
     2181        }
     2182
     2183        imageantialias($dst, true);
     2184        imagecopyresampled($dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
     2185
     2186        if ( !$dst_file )
     2187                $dst_file = str_replace(basename($src_file), 'cropped-'.basename($src_file), $src_file);
     2188
     2189        $dst_file = preg_replace('/\\.[^\\.]+$/', '.jpg', $dst_file);
     2190
     2191        if ( imagejpeg($dst, $dst_file) )
     2192                return $dst_file;
     2193        else
     2194                return false;
     2195}
     2196
     2197function wp_load_image($file) {
     2198        if ( ctype_digit($file) )
     2199                $file = get_attached_file($file);
     2200
     2201        if ( !file_exists($file) )
     2202                return "File '$file' doesn't exist?";
     2203
     2204        $contents = file_get_contents($file);
     2205
     2206        $image = imagecreatefromstring($contents);
     2207
     2208        if ( !is_resource($image) )
     2209                return "File '$file' is not image?";
     2210
     2211        return $image;
     2212}
     2213
    21422214?>
  • trunk/wp-admin/comment.php

    r797 r804  
    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
    19         $comment = (int) $_GET['comment'];
     18        $comment = (int) $_GET['c'];
    2019
    2120        if ( ! $comment = get_comment($comment) )
    … …  
    3130        break;
    3231
    33 case 'confirmdeletecomment':
    34 case 'mailapprovecomment':
     32case 'cdc':
     33case 'mac':
    3534
    3635        require_once('./admin-header.php');
    3736
    38         $comment = (int) $_GET['comment'];
    39         $p = (int) $_GET['p'];
    40         $formaction = 'confirmdeletecomment' == $action ? 'deletecomment' : 'approvecomment';
    41         $nonce_action = 'confirmdeletecomment' == $action ? 'delete-comment_' : 'approve-comment_';
     37        $comment = (int) $_GET['c'];
     38        $formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment';
     39        $nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_';
    4240        $nonce_action .= $comment;
    4341
    … …  
    4644
    4745        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    48                 wp_die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    49 
    50         echo "<div class='wrap'>\n";
    51         if ( 'spam' == $_GET['delete_type'] )
    52                 echo "<p>" . __('<strong>Caution:</strong> You are about to mark the following comment as spam:') . "</p>\n";
    53         elseif ( 'confirmdeletecomment' == $action )
    54                 echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
    55         else
    56                 echo "<p>" . __('<strong>Caution:</strong> You are about to approve the following comment:') . "</p>\n";
    57         echo "<table border='0'>\n";
    58         echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n";
    59         echo "<tr><td>" . __('E-mail:') . "</td><td>$comment->comment_author_email</td></tr>\n";
    60         echo "<tr><td>". __('URL:') . "</td><td>$comment->comment_author_url</td></tr>\n";
    61         echo "<tr><td>". __('Comment:') . "</td><td>$comment->comment_content</td></tr>\n";
    62         echo "</table>\n";
    63         echo "<p>" . __('Are you sure you want to do that?') . "</p>\n";
    64 
    65         echo "<form action='".get_option('siteurl')."/wp-admin/comment.php' method='get'>\n";
    66         wp_nonce_field($nonce_action);
    67         echo "<input type='hidden' name='action' value='$formaction' />\n";
    68         if ( 'spam' == $_GET['delete_type'] )
    69                 echo "<input type='hidden' name='delete_type' value='spam' />\n";
    70         echo "<input type='hidden' name='p' value='$p' />\n";
    71         echo "<input type='hidden' name='comment' value='{$comment->comment_ID}' />\n";
    72         echo "<input type='hidden' name='noredir' value='1' />\n";
    73         echo "<input type='submit' value='" . __('Yes') . "' />";
    74         echo "&nbsp;&nbsp;";
    75         echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_option('siteurl') ."/wp-admin/edit-comments.php';\" />\n";
    76         echo "</form>\n";
    77         echo "</div>\n";
    78 
     46                wp_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
     47?>
     48<div class='wrap'>
     49
     50<div class="narrow">
     51<?php if ( 'spam' == $_GET['dt'] ) { ?>
     52<p><?php _e('<strong>Caution:</strong> You are about to mark the following comment as spam:'); ?></p>
     53<?php } elseif ( 'cdc' == $action ) { ?>
     54<p><?php _e('<strong>Caution:</strong> You are about to delete the following comment:'); ?></p>
     55<?php } else { ?>
     56<p><?php _e('<strong>Caution:</strong> You are about to approve the following comment:'); ?></p>
     57<?php } ?>
     58
     59<p><?php _e('Are you sure you want to do that?'); ?></p>
     60
     61<form action='<?php echo get_option('siteurl'); ?>/wp-admin/comment.php' method='get'>
     62
     63<table width="100%">
     64<tr>
     65<td><input type='button' value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td>
     66<td align="right"><input type='submit' value='<?php _e('Yes'); ?>' /></td>
     67</tr>
     68</table>
     69
     70<?php wp_nonce_field($nonce_action); ?>
     71<input type='hidden' name='action' value='<?php echo $formaction; ?>' />
     72<?php if ( 'spam' == $_GET['dt'] ) { ?>
     73<input type='hidden' name='dt' value='spam' />
     74<?php } ?>
     75<input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' />
     76<input type='hidden' name='c' value='<?php echo $comment->comment_ID; ?>' />
     77<input type='hidden' name='noredir' value='1' />
     78</form>
     79
     80<table class="editform" cellpadding="5">
     81<tr class="alt">
     82<th scope="row"><?php _e('Author:'); ?></th>
     83<td><?php echo $comment->comment_author; ?></td>
     84</tr>
     85<?php if ( $comment->comment_author_email ) { ?>
     86<tr>
     87<th scope="row"><?php _e('E-mail:'); ?></th>
     88<td><?php echo $comment->comment_author_email; ?></td>
     89</tr>
     90<?php } ?>
     91<?php if ( $comment->comment_author_url ) { ?>
     92<tr>
     93<th scope="row"><?php _e('URL:'); ?></th>
     94<td><?php echo $comment->comment_author_url; ?></td>
     95</tr>
     96<?php } ?>
     97<tr>
     98<th scope="row" valign="top"><p><?php _e('Comment:'); ?></p></th>
     99<td><?php echo apply_filters( 'comment_text', $comment->comment_content ); ?></td>
     100</tr>
     101</table>
     102
     103</div>
     104</div>
     105<?php
    79106        break;
    80107
    81108case 'deletecomment':
    82         $comment = (int) $_REQUEST['comment'];
     109        $comment = (int) $_REQUEST['c'];
    83110        check_admin_referer('delete-comment_' . $comment);
    84111
    85         $p = (int) $_REQUEST['p'];
    86112        if ( isset($_REQUEST['noredir']) ) {
    87113                $noredir = true;
    … …  
    90116        }
    91117
    92         $postdata = get_post($p) or
    93                 wp_die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    94 
    95118        if ( ! $comment = get_comment($comment) )
    96119                         wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php'));
    … …  
    99122                wp_die( __('You are not allowed to edit comments on this post.') );
    100123
    101         if ( 'spam' == $_REQUEST['delete_type'] )
     124        if ( 'spam' == $_REQUEST['dt'] )
    102125                wp_set_comment_status($comment->comment_ID, 'spam');
    103126        else
    … …  
    113136
    114137case 'unapprovecomment':
    115         $comment = (int) $_GET['comment'];
     138        $comment = (int) $_GET['c'];
    116139        check_admin_referer('unapprove-comment_' . $comment);
    117        
    118         $p = (int) $_GET['p'];
     140
    119141        if (isset($_GET['noredir'])) {
    120142                $noredir = true;
    … …  
    134156                wp_redirect(wp_get_referer());
    135157        } else {
    136                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     158                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments');
    137159        }
    138160        exit();
    … …  
    140162
    141163case 'approvecomment':
    142         $comment = (int) $_GET['comment'];
     164        $comment = (int) $_GET['c'];
    143165        check_admin_referer('approve-comment_' . $comment);
    144166
    145         $p = (int) $_GET['p'];
    146167        if (isset($_GET['noredir'])) {
    147168                $noredir = true;
    … …  
    165186                wp_redirect(wp_get_referer());
    166187        } else {
    167                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     188                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments');
    168189        }
    169190        exit();
  • trunk/wp-admin/edit-comments.php

    r788 r804  
    119119<?php
    120120if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    121         echo " <a href='comment.php?action=editcomment&amp;comment=".$comment->comment_ID."'>" .  __('Edit') . '</a>';
    122         echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
     121        echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>';
     122        echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    123123        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    124                 echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
    125                 echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
     124                echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
     125                echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    126126        }
    127         echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;delete_type=spam&amp;p=" . $comment->comment_post_ID . "&amp;comment=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ";
     127        echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ";
    128128}
    129129$post = get_post($comment->comment_post_ID);
    … …  
    184184    </td>
    185185    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    186         echo "<a href='comment.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
     186        echo "<a href='comment.php?action=editcomment&amp;c=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
    187187    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    188                 echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape( $comment->comment_author ))  . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
     188                echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape( $comment->comment_author ))  . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
    189189                } ?></td>
    190190  </tr>
  • trunk/wp-admin/edit-form-comment.php

    r797 r804  
    3737</fieldset>
    3838
    39 <fieldset id="<?php echo user_can_richedit() ? 'commentdivrich' : 'commentdiv'; ?>" style="clear: both;">
     39<fieldset style="clear: both;">
    4040        <legend><?php _e('Comment') ?></legend>
    4141        <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
    … …  
    6969                <th scope="row" valign="top"><?php _e('Delete'); $delete_nonce = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); ?>:</th>
    7070                <td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . __("You are about to delete this comment \\n  \'Cancel\' to stop, \'OK\' to delete.") . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
    71                 <input type="hidden" name="comment" value="<?php echo $comment->comment_ID ?>" />
     71                <input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
    7272                <input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
    7373                <input type="hidden" name="noredir" value="1" />
  • trunk/wp-admin/edit-page-form.php

    r789 r804  
    11
    22<div class="wrap">
    3 <h2 id="write-post"><?php _e('Write Page'); ?><?php if ( 0 != $post_ID ) : ?>
    4 <small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
     3<h2 id="write-post"><?php _e('Write Page'); ?></h2>
    54<?php
    65if (0 == $post_ID) {
  • trunk/wp-admin/edit.php

    r793 r804  
    283283<?php
    284284if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    285         echo " <a href='comment.php?action=editcomment&amp;comment=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
     285        echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
    286286        echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    287287        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    … …  
    289289                echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    290290        }
    291         echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;delete_type=spam&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ]";
     291        echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ]";
    292292} // end if any comments to show
    293293?>
  • trunk/wp-admin/import/wordpress.php

    r797 r804  
    5555        function checkauthor($author) {
    5656                global $wpdb;
    57                 //mtnames is an array with the names in the mt import file
    58                 $pass = 'changeme';
    59                 if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
    60                         ++ $this->j;
    61                         $this->mtnames[$this->j] = $author; //add that new mt author name to an array
    62                         $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
    63                         if (!$user_id) { //banging my head against the desk now.
    64                                 if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
    65                                         $user_id = wp_create_user($author, $pass);
    66                                         $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
    67                                 } else {
    68                                         $user_id = wp_create_user($this->newauthornames[$this->j], $pass);
    69                                 }
    70                         } else {
    71                                 return $user_id; // return pre-existing wp username if it exists
    72                         }
    73                 } else {
    74                         $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
    75                         $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
    76                 }
     57               
     58                $map = $_POST['userselect'];
     59
     60                $user_id = username_exists($map[$author]); //use that key to get the value of the author's name from $newauthornames
    7761
    7862                return $user_id;
    … …  
    141125<h2><?php _e('Assign Authors'); ?></h2>
    142126<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
    143 <p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
    144127        <?php
    145128
    … …  
    152135                        ++ $j;
    153136                        echo '<li>Current author: <strong>'.$author.'</strong><br />'.'Map to existing: ';
    154                         $this->users_form($author);
     137                        $this->users_form($j);
    155138                        echo '</li>';
    156139                }
  • trunk/wp-admin/install-rtl.css

    r784 r804  
    11body { font-family: Tahoma, Georgia, "Times New Roman", Times, serif; }
     2
     3ul, ol { padding: 5px 20px 5px 5px; }
     4
     5.step, th { text-align: left; }
  • trunk/wp-admin/link-add.php

    r729 r804  
    1818?>
    1919
    20 <?php if ($_GET['added']) : ?>
     20<?php if ($_GET['added'] && '' != $_POST['link_name']) : ?>
    2121<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
    2222<?php endif; ?>
    … …  
    2727?>
    2828
    29 <div class="wrap">
    30 <?php printf(__('<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you&#8217;re on to your bookmarks! Right now this only works on Mozilla or Netscape, but we&#8217;re working on it.</p>'), "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
     29<div id="wp-link-bookmarklet"  class="wrap">
     30<h3><?php _e('Add Link Bookmarklet'); ?></h3>
     31<p><?php _e('Right click on the following link and choose "Bookmark This Link..." to create an add link shortcut. Right now this only works on Mozilla or Netscape, but we’re working on it.'); ?></p>
     32<?php printf(__('<p><a href="%s" title="Link add bookmarklet">Link This</a></p>'), "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
    3133</div>
    3234
  • trunk/wp-admin/menu-header.php

    r793 r804  
    1414        if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) {
    1515                if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
    16                         echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
     16                        echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    1717                else
    18                         echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
     18                        echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
    1919        }
    2020}
    … …  
    4343if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
    4444        if ( 'admin.php' == $pagenow )
    45                 echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
     45                echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    4646        else
    47                 echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
     47                echo "\n\t<li><a href='{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
    4848 } else {
    49         echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
     49        echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
    5050 }
    5151endforeach;
  • trunk/wp-admin/moderation.php

    r774 r804  
    135135<?php comment_text() ?>
    136136<p><?php comment_date('M j, g:i A'); ?> &#8212; [ <?php
    137 echo '<a href="comment.php?action=editcomment&amp;comment='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';
     137echo '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';
    138138echo " <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete ') . "</a> | "; ?>
    139139<?php
  • trunk/wp-admin/options.php

    r789 r804  
    1212
    1313if( $_GET[ 'adminhash' ] ) {
    14         $new_admin_details = get_option( 'new_admin_email' );
     14        $new_admin_details = get_option( 'adminhash' );
    1515        if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) {
    1616                update_option( "admin_email", $new_admin_details[ 'newemail' ] );
     17                delete_option( "adminhash" );
    1718                delete_option( "new_admin_email" );
    1819        }
    … …  
    2526        switch ($option) {
    2627                case 'admin_email':
     28                case 'new_admin_email':
    2729                        $value = stripslashes($value);
    2830                        $value = sanitize_email($value);
    … …  
    138140<?php
    139141$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
    140 foreach ( (array) $options as $option )
    141         $options_to_update[] = $option->option_name;
    142 $options_to_update = implode(',', $options_to_update);
    143 ?>
    144142
    145 <input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" />
    146 
    147 <?php
    148143foreach ( (array) $options as $option) :
    149         $value = wp_specialchars($option->option_value, 'single');
     144        $disabled = '';
     145        if ( is_serialized($option->option_value) ) {
     146                if ( is_serialized_string($option->option_value) ) {
     147                        // this is a serialized string, so we should display it
     148                        $value = wp_specialchars(maybe_unserialize($option->option_value), 'single');
     149                        $options_to_update[] = $option->option_name;
     150                        $class = 'all-options';
     151                } else {
     152                        $value = 'SERIALIZED DATA';
     153                        $disabled = ' disabled="disabled"';
     154                        $class = 'all-options disabled';
     155                }
     156        } else {
     157                $value = wp_specialchars($option->option_value, 'single');
     158                $options_to_update[] = $option->option_name;
     159                $class = 'all-options';
     160        }
    150161        echo "
    151162<tr>
    … …  
    153164<td>";
    154165
    155         if (stristr($value, "\n")) echo "<textarea class='all-options' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
    156         else echo "<input class='all-options' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' />";
     166        if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
     167        else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
    157168       
    158169        echo "</td>
    … …  
    162173?>
    163174  </table>
    164 <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
     175<?php $options_to_update = implode(',', $options_to_update); ?>
     176<p class="submit"><input type="hidden" name="page_options" value="<?php echo wp_specialchars($options_to_update, true); ?>" /><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
    165177  </form>
    166178</div>
  • trunk/wp-admin/post-new.php

    r789 r804  
    5656<?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?>
    5757<div id="wp-bookmarklet" class="wrap">
    58 <h3><?php _e('WordPress bookmarklet'); ?></h3>
     58<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>
    6060<p>
  • trunk/wp-admin/profile-update.php

    r797 r804  
    1818}
    1919
    20 if ( !isset( $_POST['rich_editing'] ) )
    21         $_POST['rich_editing'] = 'false';
    22 update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true );
     20if ( rich_edit_exists() ) {
     21        if ( !isset( $_POST['rich_editing'] ) )
     22                $_POST['rich_editing'] = 'false';
     23        update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true );
     24}
    2325
    2426if ( isset( $_POST['primary_blog'] ) ) {
  • trunk/wp-admin/profile.php

    r793 r804  
    3737
    3838<p class="submit"><input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" /></p>
     39<div style="clear: both"></div>
    3940
    4041<fieldset>
    … …  
    8990</label></p>
    9091
    91 <p><label><?php _e('Jabber / Google Talk:') ?>
     92<p><label><?php _e('Jabber / Google Talk:') ?><br />
    9293<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
    9394</p>
    … …  
    9697<fieldset>
    9798<legend><?php _e('About Yourself'); ?></legend>
    98 <p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
     99<p class="desc"><?php _e('Share a little biographical information. '); ?></p>
    99100<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
    100101</fieldset>
  • trunk/wp-admin/rtl.css

    r793 r804  
    1 #viewarc, #viewcat, #namediv, #emaildiv, #uridiv, #planetnews li, #login ul li, #your-profile fieldset, .alignleft .available-theme {
    2         float: right
    3 }
     1#viewarc, #viewcat, #namediv, #emaildiv, #uridiv, #planetnews li, #login ul li, #your-profile fieldset,
     2        #footer .logo, .alignleft .available-theme { float: right; }
    43
    5 #templateside, .alignright {
    6         float: left;
    7 }
     4#templateside, .alignright { float: left; }
    85
    9 #login, #send, .widefat th {
    10         text-align: right
    11 }
     6#login #send, .readmore, .widefat th { text-align: right; }
    127
    13 #postcustomsubmit, form#upload th, .submit, .editform th {
    14         text-align: left
    15 }
     8#postcustomsubmit, form#upload th, .submit, .editform th { text-align: left; }
    169
    17 body, td {
    18         font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana;
    19 }
     10#devnews h4, #wphead h1, #your-profile legend, fieldset.options legend,
     11        #planetnews li .post { font-family: Tahoma, Georgia, "Times New Roman", Times, serif; }
    2012
    21 fieldset.options legend {
    22         font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
    23 }
     13#wphead { padding: .8em 2em .8em 19em; }
    2414
    25 textarea, input, select {
    26         font:  13px Tahoma, Verdana, Arial, Helvetica, sans-serif;
    27 }
     15#wphead h1 { font-size: 2.4em; }
    2816
    29 .quicktags, .search {
    30         font: 12px Tahoma, Georgia, "Times New Roman", Times, serif;
    31 }
     17#postdiv , #titlediv, #guiddiv { margin: 0 0 0 8px; }
    3218
    33 .submit input, .submit input:focus, .button {
     19#ed_toolbar input { margin: 3px 0 2px 2px; }
     20
     21#edButtons input, #edButtons input:active { margin: 0px 0 -1px 2px; }
     22
     23body, td { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
     24
     25h2 { font: normal 32px/5px serif; }
     26
     27textarea, input, select { font:  13px Tahoma, Verdana, Arial, Helvetica, sans-serif; }
     28
     29.quicktags, .search { font: 12px Tahoma, Georgia, "Times New Roman", Times, serif; }
     30
     31.updated, .confirm { padding: 0 3em 0 1em; }
     32
     33.submit input, .submit input:focus, .button, .button:focus {
     34        border-left-color: #999;
    3435        border-right-color: #ccc;
    3536}
    3637
    3738.submit input:active, .button:active {
     39        border-left-color: #ccc;
    3840        border-right-color: #999;
    39 }
    40 
    41 .updated, .confirm {
    42         padding: 0 3em 0 1em;
    4341}
    4442
    … …  
    5452}
    5553
    56 #submenu {
    57         height: 21px;
    58         padding: 3px 3em 0 2em;
     54#adminmenu a.current {
     55        border-right: 0;
     56        border-left: 2px solid #4f96c8;
    5957}
    6058
     59#adminmenu li { line-height: 180%; }
     60
     61#submenu, #minisub { padding: 3px 3em 0 2em; }
     62
    6163#submenu .current {
     64        border-right: 0;
    6265        border-left: 2px solid #045290;
    6366}
    6467
    6568#submenu a {
    66         padding: .3em .4em .33em .4em;
     69        padding: .3em .4em .4em .4em;
    6770        margin: 0 0 0 10px;
    6871        display: block;
    … …  
    7073}
    7174
    72 #submenu li {
    73         line-height: 100%;
    74 }
    75 
    76 #postdiv , #titlediv, #guiddiv {
    77         margin: 0 0 0 8px;
    78 }
     75#submenu li { line-height: 120%; }
    7976
    8077#currenttheme img {
    … …  
    8582
    8683#postdiv #quicktags {
    87         padding-right: auto;
     84        padding-right: 0;
    8885        padding-left: 6px;
    8986}
    9087
    91 #quicktags #ed_toolbar {
    92         padding: 0px 0 0 2px;
    93 }
    94 
    95 #ed_toolbar input {
    96         margin: 3px 0 2px 2px;
     88.readmore {
     89        margin-right: auto;
     90        margin-left: 5em;
    9791}
    9892
    9993* html #postexcerpt .dbx-toggle-open, * html #postexcerpt .dbx-toggle-open, #postexcerpt div, #attachmentlinks div {
    100         padding-right: auto;
     94        padding-right: 0;
    10195        padding-left: 8px;
    102 }
    103 
    104 #login h1 {
    105         left: auto;
    106         right: 137px;
    107 }
    108 
    109 #login h1 a {
    110         display: none;
    11196}
    11297
    … …  
    11499        float: right;
    115100        margin-right: auto;
    116         margin-left: 3em;
     101        margin-left: 1em;
    117102}
    118103
    … …  
    137122}
    138123
    139 #wphead {
    140         padding: .8em 2em .8em 19em;
    141 }
    142 
    143 #wphead h1 {
    144         font-size: 2.4em;
    145         font-family: Tahoma, Georgia, "Times New Roman", Times, serif
    146 }
    147 
    148124#zeitgeist {
    149125        float: left;
    … …  
    157133}
    158134
    159 #moremeta fieldset div {
    160         margin: 2px 0px 0 0;
     135#categorydiv ul {
     136        margin-left: auto;
     137        margin-right: 10px;
    161138}
     139
     140#moremeta fieldset div { margin: 2px 0px 0 0; }
     141
    162142#moremeta {
    163143        margin-right: auto;
    … …  
    166146        left: 5%;
    167147}
    168 #categorydiv ul {
    169         margin-left: auto;
    170         margin-right: 10px;
    171 }
    172 
    173 #your-profile legend {
    174         font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
    175 }
    176148
    177149#moremeta .dbx-content {
    178150        background: url(images/box-butt.gif) no-repeat bottom left;
    179         padding-right: auto;
     151        padding-right: 0;
    180152        padding-left: 2px;
    181153}
    182154
    183 #moremeta .dbx-handle {
    184         background: #2685af url(images/box-head.gif) no-repeat left;
    185 }
     155#moremeta .dbx-handle { background: #2685af url(images/box-head.gif) no-repeat left; }
    186156
    187 #moremeta .dbx-box {
    188         background: url(images/box-bg.gif) repeat-y left;
    189 }
     157#moremeta .dbx-box { background: url(images/box-bg.gif) repeat-y left; }
    190158
    191159a.dbx-toggle, a.dbx-toggle:visited {
    … …  
    215183
    216184#postdivrich #edButtons {
    217         padding-left: auto;
     185        padding-left: 0;
    218186        padding-right: 3px;
    219187}
    220188
    221 #edButtons input, #edButtons input:active {
    222         margin: 0px 0 -1px 2px;
     189.page-numbers {
     190        margin-right: auto;
     191        margin-left: 3px;
    223192}
  • trunk/wp-admin/upload-js.php

    r797 r804  
    222222
    223223                        if ( 'none' != link )
    224                                 h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment" ) ) + "' title='" + this.currentImage.title + "'>";
     224                                h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID + "'" ) ) + "' title='" + this.currentImage.title + "'>";
    225225                        if ( display )
    226226                                h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
  • trunk/wp-admin/upload-rtl.css

    r789 r804  
    1 body { font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana; }
     1table { float: right; }
    22
    3 #upload-menu li { margin: 0 .75em 0 0; }
     3#upload-file th, #the-attachment-links textarea { text-align: left; }
     4
     5h2 { margin: 0 0 0 .2em; }
     6
     7#upload-files li { margin: 0 15px 15px 0; }
     8
     9#upload-file-view { padding: 0 75px 0 0; }
     10
     11#upload-menu li {
     12        margin: 0 .75em 0 0;
     13        display: block;
     14        float: right;
     15}
    416
    517#upload-menu .current div {
    … …  
    820}
    921
    10 #upload-file-view { 0 15px 0 0 }
     22#upload-file {
     23        left: auto;
     24        right: 0;
     25}
    1126
    12 #file-title { margin: 0 15px .2em 0; }
     27#file-title {
     28        margin: 0 75px .2em 0;
     29        font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
     30}
    1331
    14 h2 { margin: 0 0 0 .2em; }
     32.back {
     33        left: auto;
     34        right: 14px;
     35}
    1536
    16 #upload-files li { margin: 0 15px 15px 0; }
    17 
    18 table { float: right; }
    19 
    20 #the-attachment-links { float: left; }
    21 
    22 #th { text-align: left; }
     37#uploadoptions td {
     38        padding-left: 0;
     39        padding-right: 1em;
     40}
  • trunk/wp-admin/upload.css

    r797 r804  
    6363}
    6464
    65 #uupload-file th {
     65#upload-file th {
    6666        width: 8em;
    6767}
  • trunk/wp-admin/user-edit.php

    r797 r804  
    163163</label></p>
    164164
    165 <p><label><?php _e('Jabber / Google Talk:') ?>
     165<p><label><?php _e('Jabber / Google Talk:') ?><br />
    166166<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
    167167</p>
  • trunk/wp-admin/wp-admin.css

    r797 r804  
    459459}
    460460
     461input.disabled, textarea.disabled {
     462        background: #ccc;
     463}
     464
    461465#adminmenu {
    462466        background: #83B4D8;
    … …  
    506510        margin: 0;
    507511        padding: 3px 2em 0 3em;
    508         height: 25px;
    509512}
    510513
    … …  
    534537#submenu li {
    535538        line-height: 180%;
     539        height: 25px;
    536540}
    537541
  • trunk/wp-includes/comment.php

    r789 r804  
    200200
    201201        // The author and the admins get respect.
    202         if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') ) ) {
     202        if ( $userdata && is_site_admin( $userdata->user_login ) == false && ( $user_id == $post_author || $user->has_cap('level_9' ) ) ) {
    203203                $approved = 1;
    204204        }
  • trunk/wp-includes/feed.php

    r789 r804  
    2424        $content = get_the_content($more_link_text, $stripteaser, $more_file);
    2525        $content = apply_filters('the_content_rss', $content);
    26         if ($cut && !$encode_html) {
     26        if ( $cut && !$encode_html )
    2727                $encode_html = 2;
    28         }
    29         if ($encode_html == 1) {
     28        if ( 1== $encode_html ) {
    3029                $content = wp_specialchars($content);
    3130                $cut = 0;
    32         } elseif ($encode_html == 0) {
     31        } elseif ( 0 == $encode_html ) {
    3332                $content = make_url_footnote($content);
    34         } elseif ($encode_html == 2) {
     33        } elseif ( 2 == $encode_html ) {
    3534                $content = strip_tags($content);
    3635        }
    37         if ($cut) {
     36        if ( $cut ) {
    3837                $blah = explode(' ', $content);
    39                 if (count($blah) > $cut) {
     38                if ( count($blah) > $cut ) {
    4039                        $k = $cut;
    4140                        $use_dotdotdot = 1;
    … …  
    4443                        $use_dotdotdot = 0;
    4544                }
    46                 for ($i=0; $i<$k; $i++) {
     45                for ( $i=0; $i<$k; $i++ ) {
    4746                        $excerpt .= $blah[$i].' ';
    4847                }
    … …  
    6059
    6160function permalink_single_rss($file = '') {
    62     echo get_permalink();
     61        echo get_permalink();
    6362}
    6463
    … …  
    8887        global $id;
    8988
    90         if ('' != get_option('permalink_structure'))
     89        if ( '' != get_option('permalink_structure') )
    9190                $url = trailingslashit( get_permalink() ) . 'feed/';
    9291        else
    … …  
    9796
    9897function get_author_rss_link($echo = false, $author_id, $author_nicename) {
    99        $auth_ID = $author_id;
    100        $permalink_structure = get_option('permalink_structure');
     98        $auth_ID = $author_id;
     99        $permalink_structure = get_option('permalink_structure');
    101100
    102        if ('' == $permalink_structure) {
    103                                  $link = get_option('home') . '?feed=rss2&amp;author=' . $author_id;
    104        } else {
    105                                  $link = get_author_posts_url($author_id, $author_nicename);
    106                                  $link = $link . "feed/";
    107        }
    108                          
    109                          $link = apply_filters('author_feed_link', $link);
     101        if ( '' == $permalink_structure ) {
     102                $link = get_option('home') . '?feed=rss2&amp;author=' . $author_id;
     103        } else {
     104                $link = get_author_posts_url($author_id, $author_nicename);
     105                $link = $link . "feed/";
     106        }
    110107
    111        if ($echo) echo $link;
    112        return $link;
     108        $link = apply_filters('author_feed_link', $link);
     109
     110        if ( $echo )
     111                echo $link;
     112        return $link;
    113113}
    114114
    115115function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
    116        $permalink_structure = get_option('permalink_structure');
     116        $permalink_structure = get_option('permalink_structure');
    117117
    118        if ('' == $permalink_structure) {
    119                                  $link = get_option('home') . '?feed=rss2&amp;cat=' . $cat_ID;
    120        } else {
    121                                  $link = get_category_link($cat_ID);
    122                                  $link = $link . "feed/";
    123        }
     118        if ( '' == $permalink_structure ) {
     119                $link = get_option('home') . '?feed=rss2&amp;cat=' . $cat_ID;
     120        } else {
     121                $link = get_category_link($cat_ID);
     122                $link = $link . "feed/";
     123        }
    124124
    125                          $link = apply_filters('category_feed_link', $link);
     125        $link = apply_filters('category_feed_link', $link);
    126126
    127        if ($echo) echo $link;
    128        return $link;
     127        if ( $echo )
     128                echo $link;
     129        return $link;
    129130}
    130131
    131132function get_the_category_rss($type = 'rss') {
    132     $categories = get_the_category();
    133     $the_list = '';
    134     foreach ($categories as $category) {
    135         $category->cat_name = convert_chars($category->cat_name);
    136         if ('rdf' == $type) {
    137             $the_list .= "\n\t\t<dc:subject>$category->cat_name</dc:subject>\n";
    138         } else {
    139             $the_list .= "\n\t\t<category>$category->cat_name</category>\n";
    140         }
    141     }
    142     return apply_filters('the_category_rss', $the_list, $type);
     133        $categories = get_the_category();
     134        $the_list = '';
     135        foreach ( (array) $categories as $category ) {
     136                $category->cat_name = convert_chars($category->cat_name);
     137                if ( 'rdf' == $type )
     138                        $the_list .= "\n\t\t<dc:subject>$category->cat_name</dc:subject>\n";
     139                else
     140                        $the_list .= "\n\t\t<category>$category->cat_name</category>\n";
     141        }
     142        return apply_filters('the_category_rss', $the_list, $type);
    143143}
    144144
    … …  
    149149function rss_enclosure() {
    150150        global $id, $post;
    151         if (!empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password)) return;
     151        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
     152                return;
    152153
    153154        $custom_fields = get_post_custom();
    154         if( is_array( $custom_fields ) ) {
    155                 while( list( $key, $val ) = each( $custom_fields ) ) {
    156                         if( $key == 'enclosure' ) {
    157                                 if (is_array($val)) {
    158                                         foreach($val as $enc) {
     155        if ( is_array($custom_fields) ) {
     156                while ( list($key, $val) = each($custom_fields) ) {
     157                        if ( $key == 'enclosure' ) {
     158                                if ( is_array($val) ) {
     159                                        foreach ( (array) $val as $enc ) {
    159160                                                $enclosure = split( "\n", $enc );
    160161                                                print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
  • trunk/wp-includes/formatting.php

    r797 r804  
    286286}
    287287
     288function sanitize_file( $name ) { // Like sanitize_title, but with periods
     289        $name = strtolower( $name );
     290        $name = preg_replace('/&.+?;/', '', $name); // kill entities
     291        $name = str_replace( '_', '-', $name );
     292        $name = preg_replace('/[^a-z0-9\s-.]/', '', $name);
     293        $name = preg_replace('/\s+/', '-', $name);
     294        $name = preg_replace('|-+|', '-', $name);
     295        $name = trim($name, '-');
     296        return $name;
     297}
     298
    288299function sanitize_user( $username, $strict = false ) {
    289300        $raw_username = $username;
    … …  
    596607function make_clickable($ret) {
    597608        $ret = ' ' . $ret;
    598         $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret);
    599         $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret);
    600         $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $ret);
    601         $ret = substr($ret, 1);
     609        // in testing, using arrays here was found to be faster
     610        $ret = preg_replace(
     611                array(
     612                        '#([\s>])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is',
     613                        '#([\s>])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is',
     614                        '#([\s>])([a-z0-9\-_.]+)@([^,< \n\r]+)#i'),
     615                array(
     616                        '$1<a href="$2" rel="nofollow">$2</a>',
     617                        '$1<a href="http://$2" rel="nofollow">$2</a>',
     618                        '$1<a href="mailto:$2@$3">$2@$3</a>'),$ret);
     619        // this one is not in an array because we need it to run last, for cleanup of accidental links within links
     620        $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
    602621        $ret = trim($ret);
    603622        return $ret;
    … …  
    619638                // HTML loop taken from texturize function, could possible be consolidated
    620639                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
    621                 $output = implode('', preg_replace($wp_smiliessearch, $wp_smiliesreplace, $textarr));
     640                $stop = count($textarr);// loop stuff
     641                for ($i = 0; $i < $stop; $i++) {
     642                        $content = $textarr[$i];
     643                        if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
     644                                $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
     645                        }
     646                        $output .= $content;
     647                }
    622648        } else {
    623649                // return default text.
  • trunk/wp-includes/functions.php

    r802 r804  
    157157
    158158function maybe_unserialize($original) {
    159         if ( false !== $gm = @ unserialize($original) )
    160                 return $gm;
    161         else
    162                 return $original;
     159        if ( is_serialized($original) ) // don't attempt to unserialize data that wasn't serialized going in
     160                if ( false !== $gm = @ unserialize($original) )
     161                        return $gm;
     162        return $original;
     163}
     164
     165function is_serialized($data) {
     166        // if it isn't a string, it isn't serialized
     167        if ( !is_string($data) )
     168                return false;
     169        $data = trim($data);
     170        if ( 'N;' == $data )
     171                return true;
     172        if ( !preg_match('/^([adObis]):/', $data, $badions) )
     173                return false;
     174        switch ( $badions[1] ) :
     175        case 'a' :
     176        case 'O' :
     177        case 's' :
     178                if ( preg_match("/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data) )
     179                        return true;
     180                break;
     181        case 'b' :
     182        case 'i' :
     183        case 'd' :
     184                if ( preg_match("/^{$badions[1]}:[0-9.E-]+;\$/", $data) )
     185                        return true;
     186                break;
     187        endswitch;
     188        return false;
     189}
     190
     191function is_serialized_string($data) {
     192        // if it isn't a string, it isn't a serialized string
     193        if ( !is_string($data) )
     194                return false;
     195        $data = trim($data);
     196        if ( preg_match('/^s:[0-9]+:.*;$/s',$data) ) // this should fetch all serialized strings
     197                return true;
     198        return false;
    163199}
    164200
    165201/* Options functions */
    166 
    167 function is_switched( $setting = 'N/A' ) {
    168         global $switched;
    169         if ( $switched == false && defined('WP_INSTALLING') == false && $_REQUEST['nomemcache'] != 'all' && $_REQUEST['nomemcache'] != $setting ) {
    170                 return false;
    171         } else {
    172                 return true;
    173         }
    174 
    175 }
    176202
    177203function get_option($setting) {
    178204        global $wpdb, $switched, $current_blog;
    179205
    180         if ( is_switched() == false ) {
     206        if ( $switched == false && defined('WP_INSTALLING') == false ) {
    181207                $value = wp_cache_get($setting, 'options');
    182208        } else {
    … …  
    267293
    268294        $_newvalue = $newvalue;
    269         if ( is_array($newvalue) || is_object($newvalue) )
    270                 $newvalue = serialize($newvalue);
    271 
    272         wp_cache_set($option_name, $newvalue, 'options');
     295        $newvalue = maybe_serialize($newvalue);
     296
     297        wp_cache_delete($option_name, 'options');
    273298
    274299        $newvalue = $wpdb->escape($newvalue);
    … …  
    290315                return;
    291316
    292         if ( is_array($value) || is_object($value) )
    293                 $value = serialize($value);
    294 
    295         wp_cache_set($name, $value, 'options');
     317        $value = maybe_serialize($value);
     318
     319        wp_cache_delete($name, 'options');
    296320
    297321        $name = $wpdb->escape($name);
    … …  
    311335        wp_cache_delete($name, 'options');
    312336        return true;
     337}
     338
     339function maybe_serialize($data) {
     340        if ( is_string($data) )
     341                $data = trim($data);
     342        elseif ( is_array($data) || is_object($data) )
     343                return serialize($data);
     344        if ( is_serialized($data) )
     345                return serialize($data);
     346        return $data;
    313347}
    314348
    … …  
    569603        update_post_category_cache($post_id_list);
    570604
     605        update_postmeta_cache($post_id_list);
     606}
     607
     608function update_postmeta_cache($post_id_list = '') {
     609        global $wpdb, $post_meta_cache, $blog_id;
     610
     611        // We should validate this comma-separated list for the upcoming SQL query
     612        $post_id_list = preg_replace('|[^0-9,]|', '', $post_id_list);
     613
     614        // we're marking each post as having its meta cached (with no keys... empty array), to prevent posts with no meta keys from being queried again
     615        // any posts that DO have keys will have this empty array overwritten with a proper array, down below
     616        $post_id_array = explode(',', $post_id_list);
     617        foreach ( (array) $post_id_array as $pid )
     618                $post_meta_cache[$blogi_id][$pid] = array();
     619
    571620        // Get post-meta info
    572621        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) ) {
    573622                // Change from flat structure to hierarchical:
    574                 $post_meta_cache[$blog_id] = array();
     623                if ( !isset($post_meta_cache) )
     624                        $post_meta_cache[$blog_id] = array();
     625
    575626                foreach ($meta_list as $metarow) {
    576627                        $mpid = (int) $metarow['post_id'];
    … …  
    656707
    657708        foreach($qs as $k => $v) {
    658                 if ( $v != '' ) {
     709                if ( $v !== FALSE ) {
    659710                        if ( $ret != '' )
    660711                                $ret .= '&';
    661                         $ret .= "$k=$v";
     712                        if ( empty($v) && !preg_match('|[?&]' . preg_quote($k, '|') . '=|', $query) )
     713                                $ret .= $k;
     714                        else
     715                                $ret .= "$k=$v";
    662716                }
    663717        }
    … …  
    681735        if ( is_array($key) ) { // removing multiple keys
    682736                foreach ( (array) $key as $k )
    683                         $query = add_query_arg($k, '', $query);
     737                        $query = add_query_arg($k, FALSE, $query);
    684738                return $query;
    685739        }
    686         return add_query_arg($key, '', $query);
     740        return add_query_arg($key, FALSE, $query);
    687741}
    688742
    … …  
    743797                $text = 'Gone';
    744798
    745         @header("HTTP/1.1 $header $text");
    746         @header("Status: $header $text");
     799        if ( substr(php_sapi_name(), 0, 3) == 'cgi' )
     800                @header("Status: $header $text");
     801        else
     802                @header("HTTP/1.1 $header $text");
    747803}
    748804
    … …  
    11431199?>
    11441200<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    1145 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
     1201<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>>
    11461202<head>
    11471203        <title><?php echo $title ?></title>
    … …  
    12141270        return $input;
    12151271}
    1216 
    12171272?>
  • trunk/wp-includes/general-template.php

    r802 r804  
    339339                if ( !$arcresults ) {
    340340                        $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);
    341                         wp_cache_set( md5('archives' . $type . $limit), $arcresults, 'general', 600 );
     341                        wp_cache_set( md5('archives' . $type . $limit), $arcresults, 'general', 86400 );
    342342                }
    343343                if ( $arcresults ) {
    … …  
    754754        if ( '0' == $current_blog->public )
    755755                echo "<meta name='robots' content='noindex,nofollow' />\n";
     756}
     757
     758function rich_edit_exists() {
     759        global $wp_rich_edit_exists;
     760        if ( !isset($wp_rich_edit_exists) )
     761                $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js');
     762        return $wp_rich_edit_exists;
    756763}
    757764
  • trunk/wp-includes/js/autosave.js.php

    r770 r804  
    33?>
    44var autosaveLast = '';
    5 function autosave_timer() {
    6         autosave();
    7         setTimeout("autosave_timer()", <?php echo apply_filters('autosave_interval', '60000') ?>);
    8 }
    9 
     5var autosavePeriodical;
    106function autosave_start_timer() {
    117        var form = $('post');
    128        autosaveLast = form.post_title.value+form.content.value;
    13         setTimeout("autosave_timer()", <?php echo apply_filters('autosave_start_delay', '60000') ?>);
     9        autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '60'); ?>);
    1410}
    1511addLoadEvent(autosave_start_timer)
    … …  
    8177                autosaveAjax.setVar("content", form.content.value);
    8278        } else {
     79                // Don't run while the TinyMCE spellcheck is on.
    8380                if(tinyMCE.selectedInstance.spellcheckerOn) return;
    8481                tinyMCE.wpTriggerSave();
  • trunk/wp-includes/js/list-manipulation-js.php

    r795 r804  
    5353                                });
    5454                        }
    55                         ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php echo wp_specialchars(__('Jump to new item'), 1); ?></a></p></div>" ) : '');
     55                        ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php _e('Jump to new item'); ?></a></p></div>" ) : '');
    5656                        if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
    5757                                tempObj.addComplete( what, where, update, transport );
  • trunk/wp-includes/link-template.php

    r789 r804  
    245245        }
    246246
    247         $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;comment=$comment->comment_ID";
     247        $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;c=$comment->comment_ID";
    248248        echo $before . "<a href='$location'>$link</a>" . $after;
    249249}
  • trunk/wp-includes/pluggable.php

    r797 r804  
    7979        if ($metavalues) {
    8080                foreach ( $metavalues as $meta ) {
    81                         @ $value = unserialize($meta->meta_value);
    82                         if ($value === FALSE)
    83                                 $value = $meta->meta_value;
     81                        $value = maybe_unserialize($meta->meta_value);
    8482                        $user->{$meta->meta_key} = $value;
    8583
    … …  
    132130        if ($metavalues) {
    133131                foreach ( $metavalues as $meta ) {
    134                         @ $value = unserialize($meta->meta_value);
    135                         if ($value === FALSE)
    136                                 $value = $meta->meta_value;
     132                        $value = maybe_unserialize($meta->meta_value);
    137133                        $user->{$meta->meta_key} = $value;
    138134
    … …  
    230226                wp_clearcookie();
    231227
    232                 wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
     228                wp_redirect(get_option('siteurl') . '/wp-login.php?action=auth&redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
    233229                exit();
    234230        }
    … …  
    268264function wp_redirect($location, $status = 302) {
    269265        global $is_IIS;
     266
     267        $location = apply_filters('wp_redirect', $location, $status);
     268
     269        if ( !$location ) // allows the wp_redirect filter to cancel a redirect
     270                return false;
    270271
    271272        $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
    … …  
    377378        }
    378379        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
    379         $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
    380         $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
     380        $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
     381        $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
    381382
    382383        $admin_email = get_option('admin_email');
    … …  
    434435        $notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
    435436        $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
    436         $notify_message .= sprintf( __('To approve this comment, visit: %s'),  get_option('siteurl').'/wp-admin/comment.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
    437         $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
    438         $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
     437        $notify_message .= sprintf( __('To approve this comment, visit: %s'),  get_option('siteurl')."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\r\n";
     438        $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
     439        $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
    439440        $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";
    440441        $notify_message .= get_option('siteurl') . "/wp-admin/moderation.php\r\n";
  • trunk/wp-includes/plugin.php

    r797 r804  
    1313                        // uncomment if we want to match function AND accepted_args
    1414                        // if ( $filter == array($function, $accepted_args) ) {
    15                         if ( $filter['function'] == $function_to_add ) {
     15                        if ( $filter['function'] == $function_to_add )
    1616                                return true;
    17                         }
    1817                }
    1918        }
    … …  
    3332        merge_filters($tag);
    3433
    35         if ( !isset($wp_filter[$tag]) ) {
     34        if ( !isset($wp_filter[$tag]) )
    3635                return $string;
    37         }
    38         foreach ($wp_filter[$tag] as $priority => $functions) {
     36
     37        foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
    3938                if ( !is_null($functions) ) {
    40                         foreach($functions as $function) {
    41 
     39                        foreach ( (array) $functions as $function ) {
    4240                                $function_name = $function['function'];
    4341                                $accepted_args = $function['accepted_args'];
    44 
    4542                                $the_args = $args;
    4643                                array_unshift($the_args, $string);
    4744                                if ( $accepted_args > 0 )
    4845                                        $the_args = array_slice($the_args, 0, $accepted_args);
    49                                 elseif ( $accepted_args == 0 )
     46                                elseif ( 0 == $accepted_args )
    5047                                        $the_args = NULL;
    51 
    5248                                $string = call_user_func_array($function_name, $the_args);
    5349                        }
    … …  
    5753}
    5854
    59 
    6055function merge_filters($tag) {
    6156        global $wp_filter;
    6257        if ( isset($wp_filter['all']) ) {
    63                 foreach ($wp_filter['all'] as $priority => $functions) {
     58                foreach ( (array) $wp_filter['all'] as $priority => $functions ) {
    6459                        if ( isset($wp_filter[$tag][$priority]) )
    6560                                $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]);
    … …  
    7469}
    7570
    76 
    77 
    7871function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
    7972        global $wp_filter;
    … …  
    8275        if ( isset($wp_filter[$tag]["$priority"]) ) {
    8376                $new_function_list = array();
    84                 foreach($wp_filter[$tag]["$priority"] as $filter) {
    85                         if ( $filter['function'] != $function_to_remove ) {
     77                foreach ( (array) $wp_filter[$tag]["$priority"] as $filter ) {
     78                        if ( $filter['function'] != $function_to_remove )
    8679                                $new_function_list[] = $filter;
    87                         }
    8880                }
    8981                $wp_filter[$tag]["$priority"] = $new_function_list;
    … …  
    116108                return;
    117109
    118         foreach ($wp_filter[$tag] as $priority => $functions) {
     110        foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
    119111                if ( !is_null($functions) ) {
    120                         foreach($functions as $function) {
    121 
     112                        foreach ( (array) $functions as $function ) {
    122113                                $function_name = $function['function'];
    123114                                $accepted_args = $function['accepted_args'];
    … …  
    161152                return;
    162153
    163         foreach ($wp_filter[$tag] as $priority => $functions) {
     154        foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
    164155                if ( !is_null($functions) ) {
    165                         foreach($functions as $function) {
    166 
     156                        foreach( (array) $functions as $function ) {
    167157                                $function_name = $function['function'];
    168158                                $accepted_args = $function['accepted_args'];
    169 
    170159                                if ( $accepted_args > 0 )
    171160                                        $the_args = array_slice($args, 0, $accepted_args);
    172                                 elseif ( $accepted_args == 0 )
     161                                elseif ( 0 == $accepted_args )
    173162                                        $the_args = NULL;
    174163                                else
    … …  
    197186function register_activation_hook($file, $function) {
    198187        $file = plugin_basename($file);
    199 
    200188        add_action('activate_' . $file, $function);
    201189}
    … …  
    203191function register_deactivation_hook($file, $function) {
    204192        $file = plugin_basename($file);
    205 
    206193        add_action('deactivate_' . $file, $function);
    207194}
  • trunk/wp-includes/post.php

    r802 r804  
    230230        }
    231231
    232         $original = $value;
    233         if ( is_array($value) || is_object($value) )
    234                 $value = $wpdb->escape(serialize($value));
     232        $post_meta_cache[$blog_id][$post_id][$key][] = $original;
     233
     234        $value = maybe_serialize($value);
     235        $value = $wpdb->escape($value);
    235236
    236237        $wpdb->query("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES ('$post_id','$key','$value')");
    237 
    238         $post_meta_cache[$blog_id][$post_id][$key][] = $original;
    239238
    240239        return true;
    … …  
    276275        $post_id = (int) $post_id;
    277276
    278         if ( isset($post_meta_cache[$blog_id][$post_id][$key]) ) {
    279                 if ( $single ) {
    280                         return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key][0] );
    281                 } else {
    282                         return maybe_unserialize( $post_meta_cache[$blog_id][$post_id][$key] );
    283                 }
    284         }
    285 
    286         $metalist = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE post_id = '$post_id' AND meta_key = '$key'", ARRAY_N);
    287 
    288         $values = array();
    289         if ( $metalist ) {
    290                 foreach ($metalist as $metarow) {
    291                         $values[] = $metarow[0];
    292                 }
    293         }
     277        if ( !isset($post_meta_cache[$blog_id][$post_id]) )
     278                update_postmeta_cache($post_id);
    294279
    295280        if ( $single ) {
    296                 if ( count($values) ) {
    297                         $return = maybe_unserialize( $values[0] );
    298                 } else {
     281                if ( isset($post_meta_cache[$blog_id][$post_id][$key][0]) )
     282                        return maybe_unserialize($post_meta_cache[$blog_id][$post_id][$key][0]);
     283                else
    299284                        return '';
    300                 }
    301         } else {
    302                 $return = $values;
    303         }
    304 
    305         return maybe_unserialize($return);
     285        }       else {
     286                return maybe_unserialize($post_meta_cache[$blog_id][$post_id][$key]);
     287        }
    306288}
    307289
    … …  
    312294
    313295        $original_value = $value;
    314         if ( is_array($value) || is_object($value) )
    315                 $value = $wpdb->escape(serialize($value));
     296        $value = maybe_serialize($value);
     297        $value = $wpdb->escape($value);
    316298
    317299        $original_prev = $prev_value;
    318         if ( is_array($prev_value) || is_object($prev_value) )
    319                 $prev_value = $wpdb->escape(serialize($prev_value));
     300        $prev_value = maybe_serialize($prev_value);
     301        $prev_value = $wpdb->escape($prev_value);
    320302
    321303        if (! $wpdb->get_var("SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = '$key' AND post_id = '$post_id'") ) {
    … …  
    342324
    343325
    344 function get_post_custom( $post_id = 0 ) {
     326function get_post_custom($post_id = 0) {
    345327        global $id, $post_meta_cache, $wpdb, $blog_id;
    346328
    347         if ( ! $post_id )
     329        if ( !$post_id )
    348330                $post_id = $id;
    349331
    350332        $post_id = (int) $post_id;
    351333
    352         if ( isset($post_meta_cache[$blog_id][$post_id]) )
    353                 return $post_meta_cache[$blog_id][$post_id];
    354 
    355         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) ) {
    356                 // Change from flat structure to hierarchical:
    357                 $post_meta_cache = array();
    358                 foreach ( $meta_list as $metarow ) {
    359                         $mpid = (int) $metarow['post_id'];
    360                         $mkey = $metarow['meta_key'];
    361                         $mval = $metarow['meta_value'];
    362 
    363                         // Force subkeys to be array type:
    364                         if ( !isset($post_meta_cache[$blog_id][$mpid]) || !is_array($post_meta_cache[$blog_id][$mpid]) )
    365                                 $post_meta_cache[$blog_id][$mpid] = array();
    366 
    367                         if ( !isset($post_meta_cache[$blog_id][$mpid]["$mkey"]) || !is_array($post_meta_cache[$blog_id][$mpid]["$mkey"]) )
    368                                 $post_meta_cache[$blog_id][$mpid]["$mkey"] = array();
    369 
    370                         // Add a value to the current pid/key:
    371                         $post_meta_cache[$blog_id][$mpid][$mkey][] = $mval;
    372                 }
    373                 return $post_meta_cache[$blog_id][$mpid];
    374         }
     334        if ( !isset($post_meta_cache[$blog_id][$post_id]) )
     335                update_postmeta_cache($post_id);
     336
     337        return $post_meta_cache[$blog_id][$post_id];
    375338}
    376339
    … …  
    378341        $custom = get_post_custom( $post_id );
    379342
    380         if ( ! is_array($custom) )
     343        if ( !is_array($custom) )
    381344                return;
    382345
    … …  
    980943                        return get_page($page->ID, $output);
    981944        }
     945
     946        return NULL;
     947}
     948
     949function get_page_by_title($page_title, $output = OBJECT) {
     950        global $wpdb;
     951        $page_title = $wpdb->escape($page_title);
     952        $page = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$page_title' AND post_type='page'");
     953        if ( $page )
     954                return get_page($page, $output);
    982955
    983956        return NULL;
    … …  
    13061279
    13071280        if ( $file )
    1308                 add_post_meta($post_ID, '_wp_attached_file', quotemeta( $file ) );
     1281                add_post_meta($post_ID, '_wp_attached_file', $file);
    13091282
    13101283        clean_post_cache($post_ID);
  • trunk/wp-includes/query.php

    r770 r804  
    255255class WP_Query {
    256256        var $query;
    257         var $query_vars;
     257        var $query_vars = array();
    258258        var $queried_object;
    259259        var $queried_object_id;
    … …  
    316316                unset($this->posts);
    317317                unset($this->query);
    318                 unset($this->query_vars);
     318                $this->query_vars = array();
    319319                unset($this->queried_object);
    320320                unset($this->queried_object_id);
    … …  
    744744                // If a search pattern is specified, load the posts that match
    745745                if (!empty($q['s'])) {
    746                         $q['s'] = addslashes_gpc($q['s']);
    747                         $search = ' AND (';
    748                         $q['s'] = preg_replace('/, +/', ' ', $q['s']);
    749                         $q['s'] = str_replace(',', ' ', $q['s']);
    750                         $q['s'] = str_replace('"', ' ', $q['s']);
    751                         $q['s'] = trim($q['s']);
    752                         if ($q['exact']) {
    753                                 $n = '';
    754                         } else {
    755                                 $n = '%';
    756                         }
    757                         if (!$q['sentence']) {
    758                                 $s_array = explode(' ',$q['s']);
    759                                 $q['search_terms'] = $s_array;
    760                                 $search .= '((post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$n.$s_array[0].$n.'\'))';
    761                                 for ( $i = 1; $i < count($s_array); $i = $i + 1) {
    762                                         $search .= ' AND ((post_title LIKE \''.$n.$s_array[$i].$n.'\') OR (post_content LIKE \''.$n.$s_array[$i].$n.'\'))';
    763                                 }
    764                                 $search .= ' OR (post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\')';
    765                                 $search .= ')';
    766                         } else {
    767                                 $search = ' AND ((post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\'))';
    768                         }
     746                        // added slashes screw with quote grouping when done early, so done later
     747                        $q['s'] = stripslashes($q['s']);
     748                        if ($q['sentence']) {
     749                                $q['search_terms'] = array($q['s']);
     750                        }
     751                        else {
     752                                preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q[s], $matches);
     753                                $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
     754                        }
     755                        $n = ($q['exact']) ? '' : '%';
     756                        $searchand = '';
     757                        foreach((array)$q['search_terms'] as $term) {
     758                                $term = addslashes_gpc($term);
     759                                $search .= "{$searchand}((post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}'))";
     760                                $searchand = ' AND ';
     761                        }
     762                        $term = addslashes_gpc($q['s']);
     763                        if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')";
     764                       
     765                        $search = " AND ({$search}) ";
    769766                }
    770767
  • trunk/wp-includes/user.php

    r559 r804  
    115115        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
    116116
    117         if ( is_array($meta_value) || is_object($meta_value) )
    118                 $meta_value = serialize($meta_value);
    119         $meta_value = trim( $meta_value );
     117        // FIXME: usermeta data is assumed to be already escaped
     118        if ( is_string($meta_value) )
     119                $meta_value = stripslashes($meta_value);
     120        $meta_value = maybe_serialize($meta_value);
     121        $meta_value = $wpdb->escape($meta_value);
    120122
    121123        if (empty($meta_value)) {
  • trunk/wp-includes/wpmu-functions.php

    r797 r804  
    419419}
    420420
    421 function get_blogs_of_user( $id ) {
     421function get_blogs_of_user( $id, $all = false ) {
    422422        global $wpdb, $wpmuBaseTablePrefix;
    423423
    … …  
    434434                        preg_match('/wp_(\d+)_capabilities/', $key, $match);
    435435                        $blog = get_blog_details( $match[1] );
    436                         if ( $blog && $blog->deleted == 0 && isset( $blog->domain ) ) {
     436                        if ( $blog && isset( $blog->domain ) && ( $all == false && $blog->deleted == 0 || $all == true ) ) {
    437437                                $blogs[$match[1]]->userblog_id = $match[1];
    438438                                $blogs[$match[1]]->domain      = $blog->domain;
    … …  
    443443
    444444        return $blogs;
     445}
     446
     447function get_active_blog_for_user( $user_id ) { // get an active blog for user - either primary blog or from blogs list
     448        $primary_blog = get_usermeta( $user_id, "primary_blog" );
     449        if( $primary_blog == false ) {
     450                $details = false;
     451        } else {
     452                $details = get_blog_details( $primary_blog );
     453        }
     454
     455        if( ( is_object( $details ) == false ) || ( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) ) {
     456                $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
     457                $ret = false;
     458                if( is_array( $blogs ) && count( $blogs ) > 0 ) {
     459                        foreach( $blogs as $blog_id => $blog ) {
     460                                $details = get_blog_details( $blog_id );
     461                                if( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
     462                                        $ret = $blog;
     463                                        break;
     464                                }
     465                        }
     466                } else {
     467                        $ret = "username only"; // user has no blogs. We can add details for dashboard.wordpress.com here.
     468                }
     469                return $ret;
     470        } else {
     471                return $details;
     472        }
     473}
     474
     475function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
     476        global $wpdb;
     477        if( $blog_id == 0 )
     478                $blog_id = $wpdb->blogid;
     479
     480        $blogs = get_blogs_of_user( $user_id );
     481        if( is_array( $blogs ) ) {
     482                return array_key_exists( $blog_id, $blogs );
     483        } else {
     484                return false;
     485        }
    445486}
    446487
  • trunk/wp-login.php

    r797 r804  
    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, $wp_locale;
     26        global $errors, $error, $wp_locale, $current_site;
    2727
    2828        ?>
    … …  
    134134
    135135        do_action('lost_password');
    136         login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username and e-mail address. You will recieve a new password via e-mail.') . '</p>');
     136        login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username and e-mail address. You will receive a new password via e-mail.') . '</p>');
    137137?>
    138138
    … …  
    264264?>
    265265
    266 <form name="loginform" id="loginform" action="wp-login.php" method="post">
     266<form name="loginform" id="loginform" action="https://<?php echo $current_blog->domain . $current_blog->path ?>wp-login.php" method="post">
    267267        <p>
    268268                <label><?php _e('Username:') ?><br />
  • trunk/wp-settings.php

    r797 r804  
    9191
    9292define('WPINC', 'wp-includes');
    93 if ( !defined('LANGDIR') )
    94         define('LANGDIR', WPINC . '/languages');   // no leading slash, no trailing slash
     93
     94if ( !defined('LANGDIR') ) {
     95        if ( file_exists(ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )
     96                define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash
     97        else
     98                define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
     99}
     100
    95101if ( !defined('PLUGINDIR') )
    96102        define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
  • trunk/xmlrpc.php

    r797 r804  
    135135                global $wpdb;
    136136
    137                 foreach ($array as $k => $v) {
     137                foreach ( (array) $array as $k => $v ) {
    138138                        if (is_array($v)) {
    139139                                $this->escape($array[$k]);
Note: See TracChangeset for help on using the changeset viewer.