WordPress.org

Make WordPress Core

Changes from tags/2.2 at r5480 to tags/2.1.3 at r5468


Ignore:
Location:
tags
Files:
8 added
26 deleted
163 edited

Legend:

Unmodified
Added
Removed
  • tags/2.1.3/readme.html

    r5480 r5468  
    99<h1 id="logo" style="text-align: center">
    1010    <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
    11     <br /> Version 2.2
     11    <br /> Version 2.1
    1212</h1>
    1313<p style="text-align: center">Semantic Personal Publishing Platform</p>
     
    3030<h1>Upgrading</h1>
    3131<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
    32 <h2>Upgrading from any previous WordPress to 2.2:</h2>
     32<h2>Upgrading from any previous WordPress to 2.1:</h2>
    3333<ol>
    3434    <li>Delete your old WP files, saving ones you've modified.</li>
     
    5252        <dd>If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
    5353    <dt><a href="http://codex.wordpress.org/IRC">WordPress IRC Channel</a></dt>
    54         <dd>Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
     54        <dd>Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (irc.freenode.net #wordpress)</dd>
    5555</dl>
    5656
    5757<h1>System Recommendations</h1>
    5858<ul>
    59     <li>PHP version <strong>4.2</strong> or higher.</li>
     59    <li>PHP version <strong>4.1</strong> or higher.</li>
    6060    <li>MySQL version <strong>4.0</strong> or higher.</li>
    6161    <li>... and a link to <a href="http://wordpress.org/">http://wordpress.org</a> on your site.</li>
     
    6464
    6565<h1>Upgrading from another system</h1>
    66 <p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>
     66<p>WordPress can <a href="http://codex.wordpress.org/Importing_from_other_blogging_software">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>
    6767
    68 <h1>XML-RPC and Atom Interface</h1>
    69 <p>You can now post to your WordPress blog with tools like <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>, <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>
     68<h1>XML-RPC Interface</h1>
     69<p>You can now post to your WordPress blog with tools like <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://blogbuddy.sourceforge.net">BlogBuddy</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://www.ubique.ch/wapblogger/">WapBlogger</a> (post from your Wap cellphone!), <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.zempt.com/">Zempt</a>, <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>
    7070
    7171<h1>Post via Email</h1>
  • tags/2.1.3/wp-admin/admin-ajax.php

    r5480 r5468  
    152152    $x->send();
    153153    break;
    154 case 'add-comment' :
    155     if ( !current_user_can( 'edit_post', $id ) )
    156         die('-1');
    157     $search = isset($_POST['s']) ? $_POST['s'] : false;
    158     $start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25;
    159 
    160     list($comments, $total) = _wp_get_comment_list( $search, $start, 1 );
    161 
    162     if ( !$comments )
    163         die('1');
    164     $x = new WP_Ajax_Response();
    165     foreach ( (array) $comments as $comment ) {
    166         get_comment( $comment );
    167         ob_start();
    168             _wp_comment_list_item( $comment->comment_ID );
    169             $comment_list_item = ob_get_contents();
    170         ob_end_clean();
    171         $x->add( array(
    172             'what' => 'comment',
    173             'id' => $comment->comment_ID,
    174             'data' => $comment_list_item
    175         ) );
    176     }
    177     $x->send();
    178     break;
    179154case 'add-meta' :
    180155    if ( !current_user_can( 'edit_post', $id ) )
     
    252227    $_POST['post_category'] = explode(",", $_POST['catslist']);
    253228    if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
    254         unset($_POST['post_category']);
    255 
     229        unset($_POST['post_category']); 
     230   
    256231    if($_POST['post_ID'] < 0) {
    257232        $_POST['temp_ID'] = $_POST['post_ID'];
  • tags/2.1.3/wp-admin/admin-db.php

    r5480 r5468  
    149149    clean_category_cache($cat_ID);
    150150
    151     if ($update)
    152         do_action('edited_category', $cat_ID);
    153     else
    154         do_action('created_category', $cat_ID);
    155    
    156151    return $cat_ID;
    157152}
     
    421416    $wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'");
    422417    return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
    423    
    424     do_action('deleted_link', $link_id);
    425418}
    426419
  • tags/2.1.3/wp-admin/admin-functions.php

    r5480 r5468  
    2323
    2424    // Check for autosave collisions
    25     $temp_id = false;
    2625    if ( isset($_POST['temp_ID']) ) {
    2726        $temp_id = (int) $_POST['temp_ID'];
     
    3534            $_POST['post_ID'] = $draft_ids[$temp_id];
    3635            unset($_POST['temp_ID']);
     36            relocate_children( $temp_id, $_POST['post_ID'] );
    3737            update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
    3838            return edit_post();
     
    113113
    114114    // Reunite any orphaned attachments with their parent
    115     if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
    116         $draft_ids = array();
    117     if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
    118         relocate_children( $draft_temp_id, $post_ID );
    119     if ( $temp_id && $temp_id != $draft_temp_id )
    120         relocate_children( $temp_id, $post_ID );
    121 
    122115    // Update autosave collision detection
    123116    if ( $temp_id ) {
     117        relocate_children( $temp_id, $post_ID );
    124118        $draft_ids[$temp_id] = $post_ID;
    125119        update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
     
    286280    add_meta( $post_ID );
    287281
    288     wp_update_post( $_POST );
    289 
    290     // Reunite any orphaned attachments with their parent
    291     if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
    292         $draft_ids = array();
    293     if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
    294         relocate_children( $draft_temp_id, $post_ID );
     282    wp_update_post( $_POST);
    295283
    296284    // Now that we have an ID we can fix any attachment anchor hrefs
     
    682670            // No selected categories, strange
    683671            $checked_categories[] = $default;
    684         }
     672        }   
    685673    } else {
    686674        $checked_categories[] = $default;
     
    706694function write_nested_categories( $categories ) {
    707695    foreach ( $categories as $category ) {
    708         echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
     696        echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( $category['cat_name'] ), "</label></li>";
    709697
    710698        if ( $category['children'] ) {
     
    738726            // No selected categories, strange
    739727            $checked_categories[] = $default;
    740         }
     728        }   
    741729    } else {
    742730        $checked_categories[] = $default;
     
    769757        $categories = get_categories( 'hide_empty=0' );
    770758
    771     $children = _get_category_hierarchy();
    772 
    773759    if ( $categories ) {
    774760        ob_start();
     
    776762            if ( $category->category_parent == $parent) {
    777763                echo "\t" . _cat_row( $category, $level );
    778                 if ( isset($children[$category->cat_ID]) )
    779                     cat_rows( $category->cat_ID, $level +1, $categories );
     764                cat_rows( $category->cat_ID, $level +1, $categories );
    780765            }
    781766        }
    782767        $output = ob_get_contents();
    783768        ob_end_clean();
    784 
     769       
    785770        $output = apply_filters('cat_rows', $output);
    786771
     
    801786
    802787        if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
    803             $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
     788            $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll of its posts will go into the default category of '%s'\nAll of its bookmarks will go into the default category of '%s'.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
    804789        else
    805790            $edit .= "<td style='text-align:center'>".__( "Default" );
     
    888873    $r .= "</td>\n\t</tr>";
    889874    return $r;
    890 }
    891 
    892 function _wp_get_comment_list( $s = false, $start, $num ) {
    893     global $wpdb;
    894 
    895     $start = (int) $start;
    896     $num = (int) $num;
    897 
    898     if ( $s ) {
    899         $s = $wpdb->escape($s);
    900         $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
    901             (comment_author LIKE '%$s%' OR
    902             comment_author_email LIKE '%$s%' OR
    903             comment_author_url LIKE ('%$s%') OR
    904             comment_author_IP LIKE ('%$s%') OR
    905             comment_content LIKE ('%$s%') ) AND
    906             comment_approved != 'spam'
    907             ORDER BY comment_date DESC LIMIT $start, $num");
    908     } else {
    909         $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" );
    910     }
    911 
    912     $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
    913 
    914     return array($comments, $total);
    915 }
    916 
    917 function _wp_comment_list_item( $id, $alt = 0 ) {
    918     global $authordata, $comment, $wpdb;
    919     $id = (int) $id;
    920     $comment =& get_comment( $id );
    921     $class = '';
    922     $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    923     $comment_status = wp_get_comment_status($comment->comment_ID);
    924     if ( 'unapproved' == $comment_status )
    925         $class .= ' unapproved';
    926     if ( $alt % 2 )
    927         $class .= ' alternate';
    928     echo "<li id='comment-$comment->comment_ID' class='$class'>";
    929 ?>
    930 <p><strong><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
    931 
    932 <?php comment_text() ?>
    933 
    934 <p><?php comment_date(__('M j, g:i A'));  ?> &#8212; [
    935 <?php
    936 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    937     echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>';
    938     echo ' | <a href="' . wp_nonce_url('ocomment.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 . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    939     if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    940         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>';
    941         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>';
    942     }
    943     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, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ";
    944 }
    945 $post = get_post($comment->comment_post_ID);
    946 $post_title = wp_specialchars( $post->post_title, 'double' );
    947 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
    948 ?>
    949  ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
    950         </li>
    951 <?php
    952875}
    953876
     
    12091132            $state = true;
    12101133            foreach ( $markerdata as $n => $markerline ) {
    1211                 if (strpos($markerline, '# BEGIN ' . $marker) !== false)
     1134                if ( strstr( $markerline, "# BEGIN {$marker}" ))
    12121135                    $state = false;
    12131136                if ( $state ) {
     
    12171140                        fwrite( $f, "{$markerline}" );
    12181141                }
    1219                 if (strpos($markerline, '# END ' . $marker) !== false) {
     1142                if ( strstr( $markerline, "# END {$marker}" ) ) {
    12201143                    fwrite( $f, "# BEGIN {$marker}\n" );
    12211144                    if ( is_array( $insertion ))
     
    12551178        $state = false;
    12561179        foreach ( $markerdata as $markerline ) {
    1257             if (strpos($markerline, '# END ' . $marker) !== false)
     1180            if ( strstr( $markerline, "# END {$marker}" ))
    12581181                $state = false;
    12591182            if ( $state )
    12601183                $result[] = $markerline;
    1261             if (strpos($markerline, '# BEGIN ' . $marker) !== false)
     1184            if ( strstr( $markerline, "# BEGIN {$marker}" ))
    12621185                $state = true;
    12631186        }
     
    13821305    if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
    13831306        return false;
    1384 
     1307   
    13851308    if ( empty( $parent) ) {
    13861309        if ( isset( $_wp_menu_nopriv[$pagenow] ) )
     
    13941317                return false;
    13951318            if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
    1396             return false;
     1319            return false;   
    13971320        }
    13981321        return true;
     
    15161439                    $parent_file = $_wp_real_parent_file[$parent_file];
    15171440            return $parent_file;
    1518         }
     1441        }           
    15191442    }
    15201443
     
    15231446        if ( isset( $_wp_real_parent_file[$parent_file] ) )
    15241447            $parent_file = $_wp_real_parent_file[$parent_file];
    1525         return $parent_file;
     1448        return $parent_file;       
    15261449    }
    15271450
     
    17371660    }
    17381661
    1739     return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version);
     1662    return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1] );
    17401663}
    17411664
     
    17541677    if ( $plugins_dir ) {
    17551678        while (($file = $plugins_dir->read() ) !== false ) {
    1756             if ( substr($file, 0, 1) == '.' )
     1679            if ( preg_match( '|^\.+$|', $file ))
    17571680                continue;
    17581681            if ( is_dir( $plugin_root.'/'.$file ) ) {
     
    17601683                if ( $plugins_subdir ) {
    17611684                    while (($subfile = $plugins_subdir->read() ) !== false ) {
    1762                         if ( substr($subfile, 0, 1) == '.' )
     1685                        if ( preg_match( '|^\.+$|', $subfile ))
    17631686                            continue;
    1764                         if ( substr($subfile, -4) == '.php' )
     1687                        if ( preg_match( '|\.php$|', $subfile ))
    17651688                            $plugin_files[] = "$file/$subfile";
    17661689                    }
    17671690                }
    17681691            } else {
    1769                 if ( substr($file, -4) == '.php' )
     1692                if ( preg_match( '|\.php$|', $file ))
    17701693                    $plugin_files[] = $file;
    17711694            }
     
    18321755        ';
    18331756}
    1834 
    1835 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
     1757if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ))
    18361758    add_action( 'admin_footer', 'browse_happy' );
    18371759
     
    18481770function get_importers() {
    18491771    global $wp_importers;
    1850     uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
     1772
    18511773    return $wp_importers;
    18521774}
     
    19721894    // Compute the URL
    19731895    $url = $uploads['url'] . "/$filename";
    1974 
     1896   
    19751897    $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
    19761898
     
    19941916    $size = strtolower( ini_get( 'upload_max_filesize' ) );
    19951917    $bytes = 0;
    1996     if (strpos($size, 'k') !== false)
     1918    if ( strstr( $size, 'k' ) )
    19971919        $bytes = $size * 1024;
    1998     if (strpos($size, 'm') !== false)
     1920    if ( strstr( $size, 'm' ) )
    19991921        $bytes = $size * 1024 * 1024;
    2000     if (strpos($size, 'g') !== false)
     1922    if ( strstr( $size, 'g' ) )
    20011923        $bytes = $size * 1024 * 1024 * 1024;
    20021924?>
    20031925<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
    20041926<p>
    2005 <?php wp_nonce_field('import-upload'); ?>
    20061927<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?> )
    20071928<input type="file" id="upload" name="import" size="25" />
     
    21322053    wp_clearcookie();
    21332054    // Set cookies for new paths.
    2134     wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' ));
     2055    wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' ));   
    21352056}
    21362057
     
    21542075    }
    21552076
    2156     if (function_exists('imageantialias'))
    2157         imageantialias( $dst, true );
    2158    
     2077    imageantialias( $dst, true );
    21592078    imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
    21602079
     
    22762195            // If no filters change the filename, we'll do a default transformation.
    22772196            if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
    2278                 $thumb = preg_replace( '!(\.[^.]+)?$!', '.thumbnail' . '$1', basename( $file ), 1 );
     2197                $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 );
    22792198
    22802199            $thumbpath = str_replace( basename( $file ), $thumb, $file );
  • tags/2.1.3/wp-admin/admin-header.php

    r5480 r5468  
    1414?>
    1515<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    16 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
     16<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    1717<head>
    1818<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
     
    4545<body>
    4646<div id="wphead">
    47 <h1><?php bloginfo('name'); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
     47<h1><?php echo wptexturize(get_option(('blogname'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
    4848</div>
    4949<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div>
  • tags/2.1.3/wp-admin/admin.php

    r5480 r5468  
    55    require_once('../wp-config.php');
    66
    7 if ( get_option('db_version') != $wp_db_version ) {
    8     wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
    9     exit;
    10 }
    11 
     7if ( get_option('db_version') != $wp_db_version )
     8    wp_die(sprintf(__("Your database is out-of-date.  Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
     9   
    1210require_once(ABSPATH . 'wp-admin/admin-functions.php');
    1311require_once(ABSPATH . 'wp-admin/admin-db.php');
  • tags/2.1.3/wp-admin/categories.js

    r5480 r5468  
    33    document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
    44    theList.addComplete = function(what, where, update, transport) {
    5         var name = getNodeValue(transport.responseXML, 'name').unescapeHTML();
     5        var name = getNodeValue(transport.responseXML, 'name');
    66        var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id');
    77        var options = document.forms['addcat'].category_parent.options;
  • tags/2.1.3/wp-admin/categories.php

    r5480 r5468  
    115115<?php if ( current_user_can('manage_categories') ) : ?>
    116116<div class="wrap">
    117 <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong> and links that were only assigned to the deleted category are set to <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category'))), apply_filters('the_category', get_catname(get_option('default_link_category')))) ?></p>
     117<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category.  Instead, posts in the deleted category are set to the category <strong>%s</strong> and links are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p>
    118118</div>
    119119
  • tags/2.1.3/wp-admin/custom-header.php

    • Property svn:eol-style deleted
    r5480 r5468  
    1818    function js_includes() {
    1919        wp_enqueue_script('cropper');
    20         wp_enqueue_script('colorpicker');
     20        wp_enqueue_script('colorpicker');   
    2121    }
    2222
     
    2424
    2525        if ( isset( $_POST['textcolor'] ) ) {
    26             check_admin_referer('custom-header');
    2726            if ( 'blank' == $_POST['textcolor'] ) {
    2827                set_theme_mod('header_textcolor', 'blank');
     
    3332            }
    3433        }
    35         if ( isset($_POST['resetheader']) ) {
    36             check_admin_referer('custom-header');
     34        if ( isset($_POST['resetheader']) )
    3735            remove_theme_mods();
    38         }
    3936    ?>
    4037<script type="text/javascript">
     
    119116        pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
    120117    }
    121 
     118   
    122119    function hide_text() {
    123120        $('name').style.display = 'none';
     
    130127        Event.observe( $('hidetext'), 'click', show_text );
    131128    }
    132 
     129   
    133130    function show_text() {
    134131        $('name').style.display = 'block';
     
    138135        $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
    139136        $('hidetext').value = '<?php _e('Hide Text'); ?>';
    140         Event.stopObserving( $('hidetext'), 'click', show_text );
     137        Event.stopObserving( $('hidetext'), 'click', show_text );   
    141138        Event.observe( $('hidetext'), 'click', hide_text );
    142139    }
     
    161158<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
    162159
    163 <div id="headimg" style="background: url(<?php clean_url(header_image()) ?>) no-repeat;">
     160<div id="headimg" style="background: url(<?php header_image() ?>) no-repeat;">
    164161<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
    165162<div id="desc"><?php bloginfo('description');?></div>
     
    169166<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
    170167<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
    171 <?php wp_nonce_field('custom-header') ?>
    172 <input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
     168<input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
    173169<?php } ?>
    174170
     
    182178<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
    183179<input type="hidden" name="action" value="save" />
    184 <?php wp_nonce_field('custom-header') ?>
    185180<p class="submit">
    186181<input type="submit" value="<?php _e('Upload'); ?> &raquo;" />
     
    195190<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
    196191<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
    197 <?php wp_nonce_field('custom-header'); ?>
    198192<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
    199193</form>
     
    204198
    205199    function step_2() {
    206         check_admin_referer('custom-header');
    207200        $overrides = array('test_form' => false);
    208201        $file = wp_handle_upload($_FILES['import'], $overrides);
     
    230223
    231224        if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
    232             set_theme_mod('header_image', clean_url($url));
     225            set_theme_mod('header_image', $url);
    233226            $header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication
    234227            return $this->finished();
     
    264257<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
    265258<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
    266 <?php wp_nonce_field('custom-header') ?>
    267259<input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" />
    268260</p>
     
    274266
    275267    function step_3() {
    276         check_admin_referer('custom-header');
    277268        if ( $_POST['oitar'] > 1 ) {
    278269            $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
  • tags/2.1.3/wp-admin/edit-category-form.php

    r5480 r5468  
    3636            <th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
    3737            <td>       
    38                 <?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
     38                <?php wp_dropdown_categories('hide_empty=0&name=category_parent&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
    3939            </td>
    4040        </tr>
  • tags/2.1.3/wp-admin/edit-comments.js

    r5480 r5468  
    33    if ( !theCommentList )
    44        return false;
    5 
    6     theExtraCommentList = new listMan('the-extra-comment-list');
    7     if ( theExtraCommentList ) {
    8         theExtraCommentList.showLink = 0;
    9         theExtraCommentList.altOffset = 1;
    10         if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes )
    11             var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
    12         else
    13             var commentNum = 0;
    14         var urlQ   = document.location.href.split('?');
    15         var params = urlQ[1] ? urlQ[1].toQueryParams() : [];
    16         var search = params['s'] ? params['s'] : '';
    17         var page   = params['apage'] ? params['apage'] : 1;
    18     }
    19 
    205    theCommentList.dimComplete = function(what,id,dimClass) {
    216        var m = document.getElementById('awaitmod');
    22         if ( document.getElementById(what + '-' + id).className.match(dimClass) )
    23             m.innerHTML = parseInt(m.innerHTML,10) + 1;
    24         else
    25             m.innerHTML = parseInt(m.innerHTML,10) - 1;
     7        if ( document.getElementById(what + '-' + id).className.match(dimClass) ) m.innerHTML = parseInt(m.innerHTML,10) + 1;
     8        else m.innerHTML = parseInt(m.innerHTML,10) - 1;
    269    }
    27 
    2810    theCommentList.delComplete = function(what,id) {
    2911        var m = document.getElementById('awaitmod');
    30         what = what.split('-')[0];
    31         if ( document.getElementById(what + '-' + id).className.match('unapproved') )
    32             m.innerHTML = parseInt(m.innerHTML,10) - 1;
    33         if ( theExtraCommentList && commentNum ) {
    34             var theMover = theExtraCommentList.theList.childNodes[0];
    35             Element.removeClassName(theMover,'alternate');
    36             theCommentList.theList.appendChild(theMover);
    37             theExtraCommentList.inputData += '&page=' + page;
    38             if ( search )
    39                 theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box
    40             theExtraCommentList.addComplete = function() {
    41                 if ( theExtraCommentList.theList.childNodes )
    42                     var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
    43                 else
    44                     var commentNum = 0;
    45             }
    46             theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request
    47         }
     12        if ( document.getElementById(what + '-' + id).className.match('unapproved') ) m.innerHTML = parseInt(m.innerHTML,10) - 1;
    4813    }
    49 
    5014    if ( theList ) // the post list: edit.php
    5115        theList.delComplete = function() {
  • tags/2.1.3/wp-admin/edit-comments.php

    r5480 r5468  
    7676endif;
    7777
    78 if ( isset( $_GET['apage'] ) )
    79     $page = (int) $_GET['apage'];
    80 else
    81     $page = 1;
    82 $start = $offset = ( $page - 1 ) * 20;
    83 
    84 list($_comments, $total) = _wp_get_comment_list( isset($_GET['s']) ? $_GET['s'] : false, $start, 25 ); // Grab a few extra
    85 
    86 $comments = array_slice($_comments, 0, 20);
    87 $extra_comments = array_slice($_comments, 20);
    88 
    89 $page_links = paginate_links( array(
    90     'base' => 'edit-comments.php?%_%',
    91     'format' => 'apage=%#%',
    92     'total' => ceil($total / 20),
    93     'current' => $page
    94 ));
    95 
    96 if ( $page_links )
    97     echo "<p class='pagenav'>$page_links</p>";
    98 
     78if (isset($_GET['s'])) {
     79    $s = $wpdb->escape($_GET['s']);
     80    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments  WHERE
     81        (comment_author LIKE '%$s%' OR
     82        comment_author_email LIKE '%$s%' OR
     83        comment_author_url LIKE ('%$s%') OR
     84        comment_author_IP LIKE ('%$s%') OR
     85        comment_content LIKE ('%$s%') ) AND
     86        comment_approved != 'spam'
     87        ORDER BY comment_date DESC");
     88} else {
     89    if ( isset( $_GET['apage'] ) )
     90        $page = (int) $_GET['apage'];
     91    else
     92        $page = 1;
     93    $start = $offset = ( $page - 1 ) * 20;
     94
     95    $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, 20" );
     96    $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1'" );
     97}
     98?>
     99<?php if ( $total > 20 ) {
     100$total_pages = ceil( $total / 20 );
     101$r = '';
     102if ( 1 < $page ) {
     103    $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
     104    $r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n";
     105}
     106if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
     107    for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
     108        if ( $page == $page_num ) :
     109            $r .=  "<span>$page_num</span>\n";
     110        else :
     111            $p = false;
     112            if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
     113                $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
     114                $r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n";
     115                $in = true;
     116            elseif ( $in == true ) :
     117                $r .= "...\n";
     118                $in = false;
     119            endif;
     120        endif;
     121    endfor;
     122}
     123if ( ( $page ) * 20 < $total || -1 == $total ) {
     124    $args['apage'] = $page + 1;
     125    $r .=  '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n";
     126}
     127echo "<p class='pagenav'>$r</p>";
     128?>
     129
     130<?php } ?>
     131
     132<?php
    99133if ('view' == $mode) {
    100134    if ($comments) {
    101         $offset = $offset + 1;
    102         $start = " start='$offset'";
    103 
    104         echo "<ol id='the-comment-list' class='commentlist' $start>\n";
     135?>
     136<?php
     137$offset = $offset + 1;
     138$start = " start='$offset'";
     139
     140        echo "<ol id='the-comment-list' class='commentlist' $start>";
    105141        $i = 0;
    106         foreach ( $comments as $comment ) {
    107             get_comment( $comment ); // Cache it
    108             _wp_comment_list_item( $comment->comment_ID, ++$i );
    109         }
    110         echo "</ol>\n\n";
    111 
    112 if ( $extra_comments ) : ?>
    113 <div id="extra-comments" style="display:none">
    114 <ul id="the-extra-comment-list" class="commentlist">
    115 <?php
    116     foreach ( $extra_comments as $comment ) {
    117         get_comment( $comment ); // Cache it
    118         _wp_comment_list_item( $comment->comment_ID, ++$i );
    119     }
    120 ?>
    121 </ul>
    122 </div>
    123 <?php endif; // $extra_comments ?>
     142        foreach ($comments as $comment) {
     143        ++$i; $class = '';
     144        $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
     145            $comment_status = wp_get_comment_status($comment->comment_ID);
     146            if ('unapproved' == $comment_status)
     147                $class .= ' unapproved';
     148            if ($i % 2)
     149                $class .= ' alternate';
     150            echo "<li id='comment-$comment->comment_ID' class='$class'>";
     151?>
     152<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
     153
     154<?php comment_text() ?>
     155
     156<p><?php comment_date('M j, g:i A');  ?> &#8212; [
     157<?php
     158if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
     159    echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>';
     160    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 . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
     161    if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
     162        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>';
     163        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>';
     164    }
     165    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, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ";
     166}
     167$post = get_post($comment->comment_post_ID);
     168$post_title = wp_specialchars( $post->post_title, 'double' );
     169$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
     170?>
     171 | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ]</p>
     172        </li>
     173
     174<?php } // end foreach($comment) ?>
     175</ol>
    124176
    125177<div id="ajax-response"></div>
     
    191243    } // end if ($comments)
    192244}
    193 
    194 if ( $page_links )
    195     echo "<p class='pagenav'>$page_links</p>";
    196 
    197 ?>
     245    ?>
     246<?php if ( $total > 20 ) {
     247$total_pages = ceil( $total / 20 );
     248$r = '';
     249if ( 1 < $page ) {
     250    $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
     251    $r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n";
     252}
     253if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
     254    for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
     255        if ( $page == $page_num ) :
     256            $r .=  "<span>$page_num</span>\n";
     257        else :
     258            $p = false;
     259            if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
     260                $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
     261                $r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n";
     262                $in = true;
     263            elseif ( $in == true ) :
     264                $r .= "...\n";
     265                $in = false;
     266            endif;
     267        endif;
     268    endfor;
     269}
     270if ( ( $page ) * 20 < $total || -1 == $total ) {
     271    $args['apage'] = $page + 1;
     272    $r .=  '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n";
     273}
     274echo "<p class='pagenav'>$r</p>";
     275?>
     276
     277<?php } ?>
    198278
    199279</div>
  • tags/2.1.3/wp-admin/edit-form-advanced.php

    r5480 r5468  
    108108<?php if ( current_user_can('edit_posts') ) : ?>
    109109<fieldset id="posttimestampdiv" class="dbx-box">
    110 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?></h3>
     110<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
    111111<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
    112112</fieldset>
     
    118118?>
    119119<fieldset id="authordiv" class="dbx-box">
    120 <h3 class="dbx-handle"><?php _e('Post Author'); ?></h3>
     120<h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3>
    121121<div class="dbx-content">
    122122<select name="post_author_override" id="post_author_override">
     
    145145
    146146<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
    147 <legend><?php _e('Post') ?>
    148 
    149 <?php if ( 'publish' == $post->post_status ) { ?>
    150 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View &raquo;'); ?></a>
    151 <?php } elseif ( 'edit' == $action ) { ?>
    152 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview &raquo;'); ?></a>
    153 <?php } ?>
    154 </legend>
     147<legend><?php _e('Post') ?></legend>
    155148
    156149    <?php the_editor($post->post_content); ?>
     
    252245
    253246<?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
    254 <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
     247<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
    255248<?php endif; ?>
    256249
  • tags/2.1.3/wp-admin/edit-form-comment.php

    r5480 r5468  
    3333        <legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend>
    3434        <div>
    35           <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" />
     35          <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" />
    3636    </div>
    3737</fieldset>
  • tags/2.1.3/wp-admin/edit-link-form.php

    r5480 r5468  
    2323
    2424    if ('' == $value) {
    25         if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
    26         if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
    27         if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
     25        if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
     26        if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
     27        if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
    2828        if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
    2929    }
  • tags/2.1.3/wp-admin/edit-page-form.php

    r5480 r5468  
    9999<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
    100100<fieldset id="authordiv" class="dbx-box">
    101 <h3 class="dbx-handle"><?php _e('Page Author'); ?></h3>
     101<h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3>
    102102<div class="dbx-content">
    103103<select name="post_author_override" id="post_author_override">
     
    132132
    133133<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
    134 <legend><?php _e('Page Content') ?>
    135 
    136 <?php if ( 'publish' == $post->post_status ) { ?>
    137 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('View &raquo;'); ?></a>
    138 <?php } elseif ( 'edit' == $action ) { ?>
    139 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('Preview &raquo;'); ?></a>
    140 <?php } ?>
    141 </legend>
     134    <legend><?php _e('Page Content') ?></legend>
    142135    <?php the_editor($post->post_content); ?>
    143136</fieldset>
  • tags/2.1.3/wp-admin/edit.php

    r5480 r5468  
    2222        if (0 != $i)
    2323            echo ', ';
    24         $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
     24        $draft->post_title = stripslashes($draft->post_title);
    2525        if ($draft->post_title == '')
    2626            $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
     
    2929        }
    3030    ?>
    31 .</p>
     31    .</p>
    3232<?php } ?>
    3333
     
    3939        if (0 != $i)
    4040            echo ', ';
    41         $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
     41        $draft->post_title = stripslashes($draft->post_title);
    4242        if ($draft->post_title == '')
    4343            $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
     
    6565} else {
    6666    if ( is_single() )
    67         printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
     67        printf(__('Comments on %s'), $post->post_title);
    6868    elseif ( ! is_paged() || get_query_var('paged') == 1 )
    6969        _e('Last 15 Posts');
     
    178178    case 'date':
    179179        ?>
    180         <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
     180        <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(_('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
    181181        <?php
    182182        break;
  • tags/2.1.3/wp-admin/export.php

    r5480 r5468  
    123123    echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
    124124}
    125 
    126 print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
    127 
    128 ?>
    129 
    130 <!--
    131     This is a WordPress eXtended RSS file generated by WordPress as an export of
    132     your blog. It contains information about your blog's posts, comments, and
    133     categories. You may use this file to transfer that content from one site to
    134     another. This file is not intended to serve as a complete backup of your
    135     blog.
    136    
    137     To import this information into a WordPress blog follow these steps:
    138    
    139     1.  Log into that blog as an administrator.
    140     2.  Go to Manage > Import in the blog's admin.
    141     3.  Choose "WordPress" from the list of importers.
    142     4.  Upload this file using the form provided on that page.
    143     5.  You will first be asked to map the authors in this export file to users
    144         on the blog. For each author, you may choose to map an existing user on
    145         the blog or to create a new user.
    146     6.  WordPress will then import each of the posts, comments, and categories
    147         contained in this file onto your blog.
    148 -->
     125?>
     126<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
     127<!-- It contains information about your blog's posts, comments, and categories. -->
     128<!-- You may use this file to transfer that content from one site to another. -->
     129<!-- This file is not intended to serve as a complete backup of your blog. -->
     130
     131<!-- To import this information into a WordPress blog follow these steps. -->
     132<!-- 1. Log into that blog as an administrator. -->
     133<!-- 2. Go to Manage: Import in the blog's admin panels. -->
     134<!-- 3. Choose "WordPress" from the list. -->
     135<!-- 4. Upload this file using the form provided on that page. -->
     136<!-- 5. You will first be asked to map the authors in this export file to users -->
     137<!--    on the blog.  For each author, you may choose to map to an -->
     138<!--    existing user on the blog or to create a new user -->
     139<!-- 6. WordPress will then import each of the posts, comments, and categories -->
     140<!--    contained in this file into your blog -->
    149141
    150142<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
     
    186178<wp:status><?php echo $post->post_status; ?></wp:status>
    187179<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
    188 <wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
    189180<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
    190181<?php
  • tags/2.1.3/wp-admin/import.php

    r5480 r5468  
    1818if ($imports_dir) {
    1919    while (($file = $imports_dir->read()) !== false) {
    20         if ($file{0} == '.') {
     20        if (preg_match('|^\.+$|', $file))
    2121            continue;
    22         } elseif (substr($file, -4) == '.php') {
    23             require_once($import_root . '/' . $file);
    24         }
     22        if (preg_match('|\.php$|', $file))
     23            require_once("$import_root/$file");
    2524    }
    2625}
  • tags/2.1.3/wp-admin/import/blogger.php

    r5480 r5468  
    11<?php
    22
    3 define( 'MAX_RESULTS',        50 ); // How many records per GData query
    4 define( 'MAX_EXECUTION_TIME', 20 ); // How many seconds to let the script run
    5 define( 'STATUS_INTERVAL',     3 ); // How many seconds between status bar updates
    6 
    73class Blogger_Import {
    84
    9     // Shows the welcome screen and the magic auth link.
     5    var $lump_authors = false;
     6    var $import = array();
     7
     8    // Shows the welcome screen and the magic iframe.
    109    function greet() {
    11         $next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&noheader=true';
    12         $auth_url = "https://www.google.com/accounts/AuthSubRequest";
    13         $title = __('Import Blogger');
    14         $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
    15         $prereqs = __('To use this importer, you must have a Google account, an upgraded (New, was Beta) blog, and it must be on blogspot or a custom domain (not FTP).');
    16         $stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.');
    17         $auth = __('Authorize');
    18 
    19         echo "
    20         <div class='wrap'><h2>$title</h2><p>$welcome</p><p>$prereqs</p><p>$stepone</p>
    21             <form action='$auth_url' method='get'>
    22                 <p class='submit' style='text-align:left;'>
    23                     <input type='submit' value='$auth' />
    24                     <input type='hidden' name='scope' value='http://www.blogger.com/feeds/' />
    25                     <input type='hidden' name='session' value='1' />
    26                     <input type='hidden' name='secure' value='0' />
    27                     <input type='hidden' name='next' value='$next_url' />
    28                 </p>
    29             </form>
    30         </div>\n";
    31     }
    32 
    33     function uh_oh($title, $message, $info) {
    34         echo "<div class='wrap'><h2>$title</h2><p>$message</p><pre>$info</pre></div>";
    35     }
    36 
    37     function auth() {
    38         // We have a single-use token that must be upgraded to a session token.
    39         $token = preg_replace( '/[^-_0-9a-zA-Z]/', '', $_GET['token'] );
    40         $headers = array(
    41             "GET /accounts/AuthSubSessionToken HTTP/1.0",
    42             "Authorization: AuthSub token=\"$token\""
    43         );
    44         $request = join( "\r\n", $headers ) . "\r\n\r\n";
    45         $sock = $this->_get_auth_sock( );
    46         if ( ! $sock ) return false;
    47         $response = $this->_txrx( $sock, $request );
    48         preg_match( '/token=([-_0-9a-z]+)/i', $response, $matches );
    49         if ( empty( $matches[1] ) ) {
    50             $this->uh_oh(
    51                 __( 'Authorization failed' ),
    52                 __( 'Something went wrong. If the problem persists, send this info to support:' ),
    53                 htmlspecialchars($response)
    54             );
    55             return false;
    56         }
    57         $this->token = $matches[1];
    58 
    59         wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) );
    60     }
    61 
    62     function get_token_info() {
    63         $headers = array(
    64             "GET /accounts/AuthSubTokenInfo  HTTP/1.0",
    65             "Authorization: AuthSub token=\"$this->token\""
    66         );
    67         $request = join( "\r\n", $headers ) . "\r\n\r\n";
    68         $sock = $this->_get_auth_sock( );
    69         if ( ! $sock ) return;
    70         $response = $this->_txrx( $sock, $request );
    71         return $this->parse_response($response);
    72     }
    73 
    74     function token_is_valid() {
    75         $info = $this->get_token_info();
    76 
    77         if ( $info['code'] == 200 )
    78             return true;
    79 
    80         return false;
    81     }
    82 
    83     function show_blogs($iter = 0) {
    84         if ( empty($this->blogs) ) {
    85             $headers = array(
    86                 "GET /feeds/default/blogs HTTP/1.0",
    87                 "Host: www2.blogger.com",
    88                 "Authorization: AuthSub token=\"$this->token\""
    89             );
    90             $request = join( "\r\n", $headers ) . "\r\n\r\n";
    91             $sock = $this->_get_blogger_sock( );
    92             if ( ! $sock ) return;
    93             $response = $this->_txrx( $sock, $request );
    94 
    95             // Quick and dirty XML mining.
    96             list( $headers, $xml ) = explode( "\r\n\r\n", $response );
    97             $p = xml_parser_create();
    98             xml_parse_into_struct($p, $xml, $vals, $index);
    99             xml_parser_free($p);
    100 
    101             $this->title = $vals[$index['TITLE'][0]]['value'];
    102 
    103             // Give it a few retries... this step often flakes out the first time.
    104             if ( empty( $index['ENTRY'] ) ) {
    105                 if ( $iter < 3 ) {
    106                     return $this->show_blogs($iter + 1);
    107                 } else {
    108                     $this->uh_oh(
    109                         __('Trouble signing in'),
    110                         __('We were not able to gain access to your account. Try starting over.'),
    111                         ''
    112                     );
    113                     return false;
    114                 }
    115             }
    116 
    117             foreach ( $index['ENTRY'] as $i ) {
    118                 $blog = array();
    119                 while ( ( $tag = $vals[$i] ) && ! ( $tag['tag'] == 'ENTRY' && $tag['type'] == 'close' ) ) {
    120                     if ( $tag['tag'] == 'TITLE' ) {
    121                         $blog['title'] = $tag['value'];
    122                     } elseif ( $tag['tag'] == 'SUMMARY' ) {
    123                         $blog['summary'] == $tag['value'];
    124                     } elseif ( $tag['tag'] == 'LINK' ) {
    125                         if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) {
    126                             $parts = parse_url( $tag['attributes']['HREF'] );
    127                             $blog['host'] = $parts['host'];
    128                         } elseif ( $tag['attributes']['REL'] == 'edit' )
    129                             $blog['gateway'] = $tag['attributes']['HREF'];
    130                     }
    131                     ++$i;
    132                 }
    133                 if ( ! empty ( $blog ) ) {
    134                     $blog['total_posts'] = $this->get_total_results('posts', $blog['host']);
    135                     $blog['total_comments'] = $this->get_total_results('comments', $blog['host']);
    136                     $blog['mode'] = 'init';
    137                     $this->blogs[] = $blog;
    138                 }
    139             }
    140 
    141             if ( empty( $this->blogs ) ) {
    142                 $this->uh_oh(
    143                     __('No blogs found'),
    144                     __('We were able to log in but there were no blogs. Try a different account next time.'),
    145                     ''
    146                 );
    147                 return false;
    148             }
    149         }
    150 //echo '<pre>'.print_r($this,1).'</pre>';
    151         $start    = js_escape( __('Import') );
    152         $continue = js_escape( __('Continue') );
    153         $stop     = js_escape( __('Importing...') );
    154         $authors  = js_escape( __('Set Authors') );
    155         $loadauth = js_escape( __('Preparing author mapping form...') );
    156         $authhead = js_escape( __('Final Step: Author Mapping') );
    157         $nothing  = js_escape( __('Nothing was imported. Had you already imported this blog?') );
    158         $title    = __('Blogger Blogs');
    159         $name     = __('Blog Name');
    160         $url      = __('Blog URL');
    161         $action   = __('The Magic Button');
    162         $posts    = __('Posts');
    163         $comments = __('Comments');
    164         $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don\'t worry, you can turn it back off when you\'re done.');
    165 
    166         $interval = STATUS_INTERVAL * 1000;
    167 
    168         foreach ( $this->blogs as $i => $blog ) {
    169             if ( $blog['mode'] == 'init' )
    170                 $value = $start;
    171             elseif ( $blog['mode'] == 'posts' || $blog['mode'] == 'comments' )
    172                 $value = $continue;
    173             else
    174                 $value = $authors;
    175             $blogtitle = js_escape( $blog['title'] );
    176             $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0;
    177             $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0;
    178             $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');';
    179             $pstat = "<div class='ind' id='pind$i'>&nbsp;</div><div id='pstat$i' class='stat'>$pdone/{$blog['total_posts']}</div>";
    180             $cstat = "<div class='ind' id='cind$i'>&nbsp;</div><div id='cstat$i' class='stat'>$cdone/{$blog['total_comments']}</div>";
    181             $rows .= "<tr id='blog$i'><td class='blogtitle'>$blogtitle</td><td class='bloghost'>{$blog['host']}</td><td class='bar'>$pstat</td><td class='bar'>$cstat</td><td class='submit'><input type='submit' id='submit$i' value='$value' /><input type='hidden' name='blog' value='$i' /></td></tr>\n";
    182         }
    183 
    184         echo "<div class='wrap'><h2>$title</h2><noscript>$noscript</noscript><table cellpadding='5px'><thead><td>$name</td><td>$url</td><td>$posts</td><td>$comments</td><td>$action</td></thead>\n$rows</table></form></div>";
    185         echo "
    186         <script type='text/javascript'>
    187             var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'};
    188             var blogs = {};
    189             function blog(i, title, mode, status){
    190                 this.blog   = i;
    191                 this.mode   = mode;
    192                 this.title  = title;
    193                 this.status = status;
    194                 this.button = document.getElementById('submit'+this.blog);
    195             };
    196             blog.prototype = {
    197                 start: function() {
    198                     this.cont = true;
    199                     this.kick();
    200                     this.check();
    201                 },
    202                 kick: function() {
    203                     ++this.kicks;
    204                     var i = this.blog;
    205                     jQuery.post('admin.php?import=blogger&noheader=true',{blog:this.blog},function(text,result){blogs[i].kickd(text,result)});
    206                 },
    207                 check: function() {
    208                     ++this.checks;
    209                     var i = this.blog;
    210                     jQuery.post('admin.php?import=blogger&noheader=true&status=true',{blog:this.blog},function(text,result){blogs[i].checkd(text,result)});
    211                 },
    212                 kickd: function(text, result) {
    213                     if ( result == 'error' ) {
    214                         // TODO: exception handling
    215                         if ( this.cont )
    216                             setTimeout('blogs['+this.blog+'].kick()', 1000);
    217                     } else {
    218                         if ( text == 'done' ) {
    219                             this.stop();
    220                             this.done();
    221                         } else if ( text == 'nothing' ) {
    222                             this.stop();
    223                             this.nothing();
    224                         } else if ( text == 'continue' ) {
    225                             this.kick();
    226                         } else if ( this.mode = 'stopped' )
    227                             jQuery(this.button).attr('value', strings.cont);
    228                     }
    229                     --this.kicks;
    230                 },
    231                 checkd: function(text, result) {
    232                     if ( result == 'error' ) {
    233                         // TODO: exception handling
    234                     } else {
    235                         eval('this.status='+text);
    236                         jQuery('#pstat'+this.blog).empty().append(this.status.p1+'/'+this.status.p2);
    237                         jQuery('#cstat'+this.blog).empty().append(this.status.c1+'/'+this.status.c2);
    238                         this.update();
    239                         if ( this.cont || this.kicks > 0 )
    240                             setTimeout('blogs['+this.blog+'].check()', $interval);
    241                     }
    242                     --this.checks;
    243                 },
    244                 update: function() {
    245                     jQuery('#pind'+this.blog).width(((this.status.p1>0&&this.status.p2>0)?(this.status.p1/this.status.p2*jQuery('#pind'+this.blog).parent().width()):1)+'px');
    246                     jQuery('#cind'+this.blog).width(((this.status.c1>0&&this.status.c2>0)?(this.status.c1/this.status.c2*jQuery('#cind'+this.blog).parent().width()):1)+'px');
    247                 },
    248                 stop: function() {
    249                     this.cont = false;
    250                 },
    251                 done: function() {
    252                     this.mode = 'authors';
    253                     jQuery(this.button).attr('value', strings.authors);
    254                 },
    255                 nothing: function() {
    256                     this.mode = 'nothing';
    257                     jQuery(this.button).remove();
    258                     alert(strings.nothing);
    259                 },
    260                 getauthors: function() {
    261                     if ( jQuery('div.wrap').length > 1 )
    262                         jQuery('div.wrap').gt(0).remove();
    263                     jQuery('div.wrap').empty().append('<h2>$authhead</h2><h3>' + this.title + '</h3>');
    264                     jQuery('div.wrap').append('<p id=\"auth\">$loadauth</p>');
    265                     jQuery('p#auth').load('index.php?import=blogger&noheader=true&authors=1',{blog:this.blog});
    266                 },
    267                 init: function() {
    268                     this.update();
    269                     var i = this.blog;
    270                     jQuery(this.button).bind('click', function(){return blogs[i].click();});
    271                     this.kicks = 0;
    272                     this.checks = 0;
    273                 },
    274                 click: function() {
    275                     if ( this.mode == 'init' || this.mode == 'stopped' || this.mode == 'posts' || this.mode == 'comments' ) {
    276                         this.mode = 'started';
    277                         this.start();
    278                         jQuery(this.button).attr('value', strings.stop);
    279                     } else if ( this.mode == 'started' ) {
    280                         return false; // let it run...
    281                         this.mode = 'stopped';
    282                         this.stop();
    283                         if ( this.checks > 0 || this.kicks > 0 ) {
    284                             this.mode = 'stopping';
    285                             jQuery(this.button).attr('value', strings.stopping);
    286                         } else {
    287                             jQuery(this.button).attr('value', strings.cont);
    288                         }
    289                     } else if ( this.mode == 'authors' ) {
    290                         document.location = 'index.php?import=blogger&authors=1&blog='+this.blog;
    291                         //this.mode = 'authors2';
    292                         //this.getauthors();
    293                     }
    294                     return false;
    295                 }
    296             };
    297             $init
    298             jQuery.each(blogs, function(i, me){me.init();});
    299         </script>\n";
    300     }
    301 
    302     // Handy function for stopping the script after a number of seconds.
    303     function have_time() {
    304         global $importer_started;
    305         if ( time() - $importer_started > MAX_EXECUTION_TIME )
    306             die('continue');
    307         return true;
    308     }
    309 
    310     function get_total_results($type, $host) {
    311         $headers = array(
    312             "GET /feeds/$type/default?max-results=1&start-index=2 HTTP/1.0",
    313             "Host: $host",
    314             "Authorization: AuthSub token=\"$this->token\""
    315         );
    316         $request = join( "\r\n", $headers ) . "\r\n\r\n";
    317         $sock = $this->_get_blogger_sock( $host );
    318         if ( ! $sock ) return;
    319         $response = $this->_txrx( $sock, $request );
    320         $response = $this->parse_response( $response );
    321         $parser = xml_parser_create();
    322         xml_parse_into_struct($parser, $response['body'], $struct, $index);
    323         xml_parser_free($parser);
    324         $total_results = $struct[$index['OPENSEARCH:TOTALRESULTS'][0]]['value'];
    325         return (int) $total_results;
    326     }
    327 
    328     function import_blog($blogID) {
    329         global $importing_blog;
    330         $importing_blog = $blogID;
    331 
    332         if ( isset($_GET['authors']) )
    333             return print($this->get_author_form());
    334 
    335         header('Content-Type: text/plain');
    336 
    337         if ( isset($_GET['status']) )
    338             die($this->get_js_status());
    339 
    340         if ( isset($_GET['saveauthors']) )
    341             die($this->save_authors());
    342 
    343         $blog = $this->blogs[$blogID];
    344         $total_results = $this->get_total_results('posts', $blog['host']);
    345         $this->blogs[$importing_blog]['total_posts'] = $total_results;
    346 
    347         $start_index = $total_results - MAX_RESULTS + 1;
    348 
    349         if ( isset( $this->blogs[$importing_blog]['posts_start_index'] ) )
    350             $start_index = (int) $this->blogs[$importing_blog]['posts_start_index'];
    351         elseif ( $total_results > MAX_RESULTS )
    352             $start_index = $total_results - MAX_RESULTS + 1;
     10        $title = __('Import Old Blogger');
     11        $welcome = __('Howdy! This importer allows you to import posts and comments from your Old Blogger account into your WordPress blog.');
     12        $noiframes = __('This feature requires iframe support.');
     13        $warning = js_escape(__('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?'));
     14        $reset = __('Reset this importer');
     15        $incompat = __('Your web server is not properly configured to use this importer. Please enable the CURL extension for PHP and then reload this page.');
     16
     17        echo "<div class='wrap'><h2>$title</h2><p>$welcome</p>";
     18        echo "<p>" . __('Please note that this importer <em>does not work with new Blogger (using your Google account)</em>.') . "</p>";
     19        if ( function_exists('curl_init') )
     20            echo "<iframe src='admin.php?import=blogger&amp;noheader=true' height='350px' width = '99%'>$noiframes</iframe><p><a href='admin.php?import=blogger&amp;restart=true&amp;noheader=true' onclick='return confirm(\"$warning\")'>$reset</a></p>";
    35321        else
    354             $start_index = 1;
    355 
    356         // This will be positive until we have finished importing posts
    357         if ( $start_index > 0 ) {
    358             // Grab all the posts
    359             $this->blogs[$importing_blog]['mode'] = 'posts';
    360             $query = "start-index=$start_index&max-results=" . MAX_RESULTS;
    361             do {
    362                 $index = $struct = $entries = array();
    363                 $headers = array(
    364                     "GET /feeds/posts/default?$query HTTP/1.0",
    365                     "Host: {$blog['host']}",
    366                     "Authorization: AuthSub token=\"$this->token\""
    367                 );
    368                 $request = join( "\r\n", $headers ) . "\r\n\r\n";
    369                 $sock = $this->_get_blogger_sock( $blog['host'] );
    370                 if ( ! $sock ) return; // TODO: Error handling
    371                 $response = $this->_txrx( $sock, $request );
    372 
    373                 $response = $this->parse_response( $response );
    374 
    375                 // Extract the entries and send for insertion
    376                 preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
    377                 if ( count( $matches[0] ) ) {
    378                     $entries = array_reverse($matches[0]);
    379                     foreach ( $entries as $entry ) {
    380                         $entry = "<feed>$entry</feed>";
    381                         $AtomParser = new AtomParser();
    382                         $AtomParser->parse( $entry );
    383                         $this->import_post($AtomParser->entry);
    384                         unset($AtomParser);
    385                     }
    386                 } else break;
    387 
    388                 // Get the 'previous' query string which we'll use on the next iteration
    389                 $query = '';
    390                 $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
    391                 if ( count( $matches[1] ) )
    392                     foreach ( $matches[1] as $match )
    393                         if ( preg_match('/rel=.previous./', $match) )
    394                             $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );
    395 
    396                 if ( $query ) {
    397                     parse_str($query, $q);
    398                     $this->blogs[$importing_blog]['posts_start_index'] = (int) $q['start-index'];
    399                 } else
    400                     $this->blogs[$importing_blog]['posts_start_index'] = 0;
    401                 $this->save_vars();
    402             } while ( !empty( $query ) && $this->have_time() );
    403         }
    404 
    405         $total_results = $this->get_total_results( 'comments', $blog['host'] );
    406         $this->blogs[$importing_blog]['total_comments'] = $total_results;
    407 
    408         if ( isset( $this->blogs[$importing_blog]['comments_start_index'] ) )
    409             $start_index = (int) $this->blogs[$importing_blog]['comments_start_index'];
    410         elseif ( $total_results > MAX_RESULTS )
    411             $start_index = $total_results - MAX_RESULTS + 1;
     22            echo "<p>$incompat</p>";
     23        echo "</div>\n";
     24    }
     25
     26    // Deletes saved data and redirect.
     27    function restart() {
     28        delete_option('import-blogger');
     29        wp_redirect("admin.php?import=blogger");
     30        die();
     31    }
     32
     33    // Generates a string that will make the page reload in a specified interval.
     34    function refresher($msec) {
     35        if ( $msec )
     36            return "<html><head><script type='text/javascript'>window.onload=setTimeout('window.location.reload()', $msec);</script>\n</head>\n<body>\n";
    41237        else
    413             $start_index = 1;
    414 
    415         if ( $start_index > 0 ) {
    416             // Grab all the comments
    417             $this->blogs[$importing_blog]['mode'] = 'comments';
    418             $query = "start-index=$start_index&max-results=" . MAX_RESULTS;
    419             do {
    420                 $index = $struct = $entries = array();
    421                 $headers = array(
    422                     "GET /feeds/comments/default?$query HTTP/1.0",
    423                     "Host: {$blog['host']}",
    424                     "Authorization: AuthSub token=\"$this->token\""
    425                 );
    426                 $request = join( "\r\n", $headers ) . "\r\n\r\n";
    427                 $sock = $this->_get_blogger_sock( $blog['host'] );
    428                 if ( ! $sock ) return; // TODO: Error handling
    429                 $response = $this->_txrx( $sock, $request );
    430 
    431                 $response = $this->parse_response( $response );
    432 
    433                 // Extract the comments and send for insertion
    434                 preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
    435                 if ( count( $matches[0] ) ) {
    436                     $entries = array_reverse( $matches[0] );
    437                     foreach ( $entries as $entry ) {
    438                         $entry = "<feed>$entry</feed>";
    439                         $AtomParser = new AtomParser();
    440                         $AtomParser->parse( $entry );
    441                         $this->import_comment($AtomParser->entry);
    442                         unset($AtomParser);
    443                     }
    444                 }
    445 
    446                 // Get the 'previous' query string which we'll use on the next iteration
    447                 $query = '';
    448                 $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches);
    449                 if ( count( $matches[1] ) )
    450                     foreach ( $matches[1] as $match )
    451                         if ( preg_match('/rel=.previous./', $match) )
    452                             $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );
    453 
    454                 parse_str($query, $q);
    455 
    456                 $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index'];
    457                 $this->save_vars();
    458             } while ( !empty( $query ) && $this->have_time() );
    459         }
    460         $this->blogs[$importing_blog]['mode'] = 'authors';
    461         $this->save_vars();
    462         if ( !$this->blogs[$importing_blog]['posts_done'] && !$this->blogs[$importing_blog]['comments_done'] )
    463             die('nothing');
    464         do_action('import_done', 'blogger');
    465         die('done');
    466     }
    467 
    468     function convert_date( $date ) {
    469         preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?(Z|[\+|\-][0-9]{2,4}){0,1}#', $date, $date_bits);
    470         $offset = iso8601_timezone_to_offset( $date_bits[7] );
    471         $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
    472         $timestamp -= $offset; // Convert from Blogger local time to GMT
    473         $timestamp += get_option('gmt_offset') * 3600; // Convert from GMT to WP local time
    474         return gmdate('Y-m-d H:i:s', $timestamp);
    475     }
    476 
    477     function no_apos( $string ) {
    478         return str_replace( '&apos;', "'", $string);
    479     }
    480 
    481     function min_whitespace( $string ) {
    482         return preg_replace( '|\s+|', ' ', $string );
    483     }
    484 
    485     function import_post( $entry ) {
    486         global $wpdb, $importing_blog;
    487 
    488         // The old permalink is all Blogger gives us to link comments to their posts.
    489         if ( isset( $entry->draft ) )
    490             $rel = 'self';
    491         else
    492             $rel = 'alternate';
    493         foreach ( $entry->links as $link ) {
    494             if ( $link['rel'] == $rel ) {
    495                 $parts = parse_url( $link['href'] );
    496                 $entry->old_permalink = $parts['path'];
    497                 break;
    498             }
    499         }
    500 
    501         $post_date    = $this->convert_date( $entry->published );
    502         $post_content = trim( addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ) );
    503         $post_title   = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) );
    504         $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
    505 
    506         // Clean up content
    507         $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
    508         $post_content = str_replace('<br>', '<br />', $post_content);
    509         $post_content = str_replace('<hr>', '<hr />', $post_content);
    510 
    511         // Checks for duplicates
    512         if (
    513             isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ||
    514             post_exists( $post_title, $post_content, $post_date )
    515         ) {
    516             ++$this->blogs[$importing_blog]['posts_skipped'];
    517         } else {
    518             $post = compact('post_date', 'post_content', 'post_title', 'post_status');
    519 
    520             $post_id = wp_insert_post($post);
    521 
    522             wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );
    523 
    524             $author = $this->no_apos( strip_tags( $entry->author ) );
    525 
    526             add_post_meta( $post_id, 'blogger_blog', $this->blogs[$importing_blog]['host'], true );
    527             add_post_meta( $post_id, 'blogger_author', $author, true );
    528             add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true );
    529 
    530             $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
    531             ++$this->blogs[$importing_blog]['posts_done'];
    532         }
    533         $this->save_vars();
    534     }
    535 
    536     function import_comment( $entry ) {
    537         global $importing_blog;
    538 
    539         // Drop the #fragment and we have the comment's old post permalink.
    540         foreach ( $entry->links as $link ) {
    541             if ( $link['rel'] == 'alternate' ) {
    542                 $parts = parse_url( $link['href'] );
    543                 $entry->old_permalink = $parts['fragment'];
    544                 $entry->old_post_permalink = $parts['path'];
    545                 break;
    546             }
    547         }
    548 
    549         $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink];
    550         preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches);
    551         $comment_author  = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
    552         $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );
    553         $comment_date    = $this->convert_date( $entry->updated );
    554         $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) );
    555 
    556         // Clean up content
    557         $comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content);
    558         $comment_content = str_replace('<br>', '<br />', $comment_content);
    559         $comment_content = str_replace('<hr>', '<hr />', $comment_content);
    560 
    561         // Checks for duplicates
    562         if (
    563             isset( $this->blogs[$importing_blog]['comments'][$entry->old_permalink] ) ||
    564             comment_exists( $comment_author, $comment_date )
    565         ) {
    566             ++$this->blogs[$importing_blog]['comments_skipped'];
    567         } else {
    568             $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content');
    569 
    570             $comment_id = wp_insert_comment($comment);
    571 
    572             $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id;
    573 
    574             ++$this->blogs[$importing_blog]['comments_done'];
    575         }
    576         $this->save_vars();
    577     }
    578 
    579     function get_js_status($blog = false) {
    580         global $importing_blog;
    581         if ( $blog === false )
    582             $blog = $this->blogs[$importing_blog];
    583         else
    584             $blog = $this->blogs[$blog];
    585         $p1 = isset( $blog['posts_done'] ) ? (int) $blog['posts_done'] : 0;
    586         $p2 = isset( $blog['total_posts'] ) ? (int) $blog['total_posts'] : 0;
    587         $c1 = isset( $blog['comments_done'] ) ? (int) $blog['comments_done'] : 0;
    588         $c2 = isset( $blog['total_comments'] ) ? (int) $blog['total_comments'] : 0;
    589         return "{p1:$p1,p2:$p2,c1:$c1,c2:$c2}";
    590     }
    591 
    592     function get_author_form($blog = false) {
    593         global $importing_blog, $wpdb, $current_user;
    594         if ( $blog === false )
    595             $blog = & $this->blogs[$importing_blog];
    596         else
    597             $blog = & $this->blogs[$blog];
    598 
    599         if ( !isset( $blog['authors'] ) ) {
    600             $post_ids = array_values($blog['posts']);
    601             $authors = (array) $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN (" . join( ',', $post_ids ) . ")");
    602             $blog['authors'] = array_map(null, $authors, array_fill(0, count($authors), $current_user->ID));
    603             $this->save_vars();
    604         }
    605 
    606         $directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user\'s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the "Restart" function below.');
    607         $heading = __('Author mapping');
    608         $blogtitle = "{$blog['title']} ({$blog['host']})";
    609         $mapthis = __('Blogger username');
    610         $tothis = __('WordPress login');
    611         $submit = js_escape( __('Save Changes &raquo;') );
    612 
    613         foreach ( $blog['authors'] as $i => $author )
    614             $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>";
    615 
    616         return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='$importing_blog' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='authorsubmit' value='$submit' /></td></tr></table></form></div>";
    617     }
    618 
    619     function get_user_options($current) {
    620         global $wpdb, $importer_users;
    621         if ( ! isset( $importer_users ) )
    622             $importer_users = (array) get_users_of_blog();
    623 
    624         foreach ( $importer_users as $user ) {
    625             $sel = ( $user->user_id == $current ) ? " selected='selected'" : '';
    626             $options .= "<option value='$user->user_id'$sel>$user->display_name</option>";
    627         }
    628 
    629         return $options;
    630     }
    631 
    632     function save_authors() {
    633         global $importing_blog, $wpdb;
    634         $authors = (array) $_POST['authors'];
    635 
    636         $host = $this->blogs[$importing_blog]['host'];
    637 
    638         // Get an array of posts => authors
    639         $post_ids = (array) $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$host'");
    640         $post_ids = join( ',', $post_ids );
    641         $results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)");
    642         foreach ( $results as $row )
    643             $authors_posts[$row->post_id] = $row->meta_value;
    644 
    645         foreach ( $authors as $author => $user_id ) {
    646             $user_id = (int) $user_id;
    647 
    648             // Skip authors that haven't been changed
    649             if ( $user_id == $this->blogs[$importing_blog]['authors'][$author][1] )
    650                 continue;
    651 
    652             // Get a list of the selected author's posts
    653             $post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
    654             $post_ids = join( ',', $post_ids);
    655 
    656             $wpdb->query("UPDATE $wpdb->posts SET post_author = $user_id WHERE id IN ($post_ids)");
    657             $this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
    658         }
    659         $this->save_vars();
    660 
    661         wp_redirect('edit.php');
    662     }
    663 
    664     function _get_auth_sock() {
    665         // Connect to https://www.google.com
    666         if ( !$sock = @ fsockopen('ssl://www.google.com', 443, $errno, $errstr) ) {
    667             $this->uh_oh(
    668                 __('Could not connect to https://www.google.com'),
    669                 __('There was a problem opening a secure connection to Google. This is what went wrong:'),
    670                 "$errstr ($errno)"
    671             );
    672             return false;
    673         }
    674         return $sock;
    675     }
    676 
    677     function _get_blogger_sock($host = 'www2.blogger.com') {
    678         if ( !$sock = @ fsockopen($host, 80, $errno, $errstr) ) {
    679             $this->uh_oh(
    680                 sprintf( __('Could not connect to %s'), $host ),
    681                 __('There was a problem opening a connection to Blogger. This is what went wrong:'),
    682                 "$errstr ($errno)"
    683             );
    684             return false;
    685         }
    686         return $sock;
    687     }
    688 
    689     function _txrx( $sock, $request ) {
    690         fwrite( $sock, $request );
    691         while ( ! feof( $sock ) )
    692             $response .= @ fread ( $sock, 8192 );
    693         fclose( $sock );
    694         return $response;
    695     }
    696 
    697     function revoke($token) {
    698         $headers = array(
    699             "GET /accounts/AuthSubRevokeToken HTTP/1.0",
    700             "Authorization: AuthSub token=\"$token\""
    701         );
    702         $request = join( "\r\n", $headers ) . "\r\n\r\n";
    703         $sock = $this->_get_auth_sock( );
    704         if ( ! $sock ) return false;
    705         $this->_txrx( $sock, $request );
    706     }
    707 
    708     function restart() {
    709         global $wpdb;
    710         $options = get_option( 'blogger_importer' );
    711 
    712         if ( isset( $options['token'] ) )
    713             $this->revoke( $options['token'] );
    714 
    715         delete_option('blogger_importer');
    716         $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'blogger_author'");
    717         wp_redirect('?import=blogger');
     38            return "<html><head><script type='text/javascript'>window.onload=window.location.reload();</script>\n</head>\n<body>\n";
    71839    }
    71940
     
    74263    }
    74364
     65    // Prints a form for the user to enter Blogger creds.
     66    function login_form($text='') {
     67        echo '<h1>' . __('Log in to Blogger') . "</h1>\n$text\n";
     68        echo '<form method="post" action="admin.php?import=blogger&amp;noheader=true&amp;step=0"><table><tr><td>' . __('Username') . ':</td><td><input type="text" name="user" /></td></tr><tr><td>' . __('Password') . ':</td><td><input type="password" name="pass" /></td><td><input type="submit" value="' . __('Start') . '" /></td></tr></table></form>';
     69        die;
     70    }
     71
     72    // Sends creds to Blogger, returns the session cookies an array of headers.
     73    function login_blogger($user, $pass) {
     74        $_url = 'http://www.blogger.com/login.do';
     75        $params = "username=$user&password=$pass";
     76        $ch = curl_init();
     77        curl_setopt($ch, CURLOPT_POST,1);
     78        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
     79        curl_setopt($ch, CURLOPT_URL,$_url);
     80        curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
     81        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
     82        curl_setopt($ch, CURLOPT_HEADER,1);
     83        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
     84        $response = curl_exec ($ch);
     85
     86        $response = $this->parse_response($response);
     87
     88        sleep(1);
     89
     90        return $response['cookies'];
     91    }
     92
     93    // Requests page from Blogger, returns the response array.
     94    function get_blogger($url, $header = '', $user=false, $pass=false) {
     95        $ch = curl_init();
     96        if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}");
     97        curl_setopt($ch, CURLOPT_URL,$url);
     98        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     99        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     100        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     101        curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
     102        curl_setopt($ch, CURLOPT_HEADER,1);
     103        if (is_array($header)) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     104        $response = curl_exec ($ch);
     105
     106        $response = $this->parse_response($response);
     107        $response['url'] = $url;
     108
     109        if (curl_errno($ch)) {
     110            print curl_error($ch);
     111        } else {
     112            curl_close($ch);
     113        }
     114
     115        return $response;
     116    }
     117
     118    // Posts data to Blogger, returns response array.
     119    function post_blogger($url, $header = false, $paramary = false, $parse=true) {
     120        $params = '';
     121        if ( is_array($paramary) ) {
     122            foreach($paramary as $key=>$value)
     123                if($key && $value != '')
     124                    $params.=$key."=".urlencode(stripslashes($value))."&";
     125        }
     126        if ($user && $pass) $params .= "username=$user&password=$pass";
     127        $params = trim($params,'&');
     128        $ch = curl_init();
     129        curl_setopt($ch, CURLOPT_POST,1);
     130        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
     131        if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}");
     132        curl_setopt($ch, CURLOPT_URL,$url);
     133        curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
     134        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     135        curl_setopt($ch, CURLOPT_HEADER,$parse);
     136        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
     137        if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     138        $response = curl_exec ($ch);
     139
     140        if ($parse) {
     141            $response = $this->parse_response($response);
     142            $response['url'] = $url;
     143            return $response;
     144        }
     145
     146        return $response;
     147    }
     148
     149    // Prints the list of blogs for import.
     150    function show_blogs() {
     151        global $import;
     152        echo '<h1>' . __('Selecting a Blog') . "</h1>\n<ul>";
     153        foreach ( $this->import['blogs'] as $blog ) {
     154            if (9 == $blog['nextstep']) $status = "100%";
     155            elseif (8 == $blog['nextstep']) $status = "90%";
     156            elseif (7 == $blog['nextstep']) $status = "82.5%";
     157            elseif (6 == $blog['nextstep']) $status = "75%";
     158            elseif (5 == $blog['nextstep']) $status = "57%";
     159            elseif (4 == $blog['nextstep']) $status = "28%";
     160            elseif (3 == $blog['nextstep']) $status = "14%";
     161            else $status = "0%";
     162            echo "\t<li><a href='admin.php?import=blogger&amp;noheader=true&amp;blog={$blog['id']}'>{$blog['title']}</a> $status</li>\n";
     163        }
     164        die("</ul>\n");
     165    }
     166
     167    // Publishes.
     168    function publish_blogger($i, $text) {
     169        $head = $this->refresher(2000) . "<h1>$text</h1>\n";
     170        if ( ! strstr($this->import['blogs'][$_GET['blog']]['publish'][$i], 'http') ) {
     171            // First call. Start the publish process with a fresh set of cookies.
     172            $this->import['cookies'] = $this->login_blogger($this->import['user'], $this->import['pass']);
     173            update_option('import-blogger', $this->import);
     174            $paramary = array('blogID' => $_GET['blog'], 'all' => '1', 'republishAll' => 'Republish Entire Blog', 'publish' => '1', 'redirectUrl' => "/publish.do?blogID={$_GET['blog']}&inprogress=true");
     175
     176            $response = $this->post_blogger("http://www.blogger.com/publish.do?blogID={$_GET['blog']}", $this->import['cookies'], $paramary);
     177            if ( $response['code'] == '302' ) {
     178                $url = str_replace('publish.g', 'publish-body.g', $response['header']['Location']);
     179                $this->import['blogs'][$_GET['blog']]['publish'][$i] = $url;
     180                update_option('import-blogger', $this->import);
     181                $response = $this->get_blogger($url, $this->import['cookies']);
     182                preg_match('#<p class="progressIndicator">.*</p>#U', $response['body'], $matches);
     183                $progress = $matches[0];
     184                die($head . $progress);
     185            } else {
     186                $this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
     187                update_option('import-blogger', $this->import);
     188                die($head);
     189            }
     190        } else {
     191            // Subsequent call. Keep checking status until Blogger reports publish complete.
     192            $url = $this->import['blogs'][$_GET['blog']]['publish'][$i];
     193            $response = $this->get_blogger($url, $this->import['cookies']);
     194            if ( preg_match('#<p class="progressIndicator">.*</p>#U', $response['body'], $matches) ) {
     195                $progress = $matches[0];
     196                if ( strstr($progress, '100%') ) {
     197                    $this->set_next_step($i);
     198                    $progress .= '<p>'.__('Moving on...').'</p>';
     199                }
     200                die($head . $progress);
     201            } else {
     202                $this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
     203                update_option('import-blogger', $this->import);
     204                die("$head<p>" . __('Trying again...') . '</p>');
     205            }
     206        }
     207    }
     208
     209    // Sets next step, saves options
     210    function set_next_step($step) {
     211        $this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
     212        update_option('import-blogger', $this->import);
     213    }
     214
     215    // Redirects to next step
     216    function do_next_step() {
     217        wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
     218        die();
     219    }
     220
     221    // Step 0: Do Blogger login, get blogid/title pairs.
     222    function do_login() {
     223        if ( ( ! $this->import['user'] && ! is_array($this->import['cookies']) ) ) {
     224            // The user must provide a Blogger username and password.
     225            if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
     226                $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
     227            }
     228
     229            // Try logging in. If we get an array of cookies back, we at least connected.
     230            $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
     231            if ( !is_array( $this->import['cookies'] ) ) {
     232                $this->login_form(__('Login failed. Please enter your credentials again.'));
     233            }
     234
     235            // Save the password so we can log the browser in when it's time to publish.
     236            $this->import['pass'] = $_POST['pass'];
     237            $this->import['user'] = $_POST['user'];
     238
     239            // Get the Blogger welcome page and scrape the blog numbers and names from it
     240            $response = $this->get_blogger('http://www.blogger.com/home', $this->import['cookies']);
     241            if (! stristr($response['body'], 'signed in as') ) $this->login_form(__('Login failed. Please re-enter your username and password.'));
     242            $blogsary = array();
     243            preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#U', $response['body'], $blogsary);
     244            if ( ! count( $blogsary[1] < 1 ) )
     245                wp_die(__('No blogs found for this user.'));
     246            $this->import['blogs'] = array();
     247            $template = '<MainPage><br /><br /><br /><p>'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. Meanwhile, discover <a href="http://wordpress.org/">a better blogging tool</a>.').'</p><BloggerArchives><a class="archive" href="<$BlogArchiveURL$>"><$BlogArchiveName$></a><br /></BloggerArchives></MainPage><ArchivePage><Blogger><wordpresspost><$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><BlogItemCommentsEnabled><BlogItemComments><wordpresscomment><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$></BlogItemComments></BlogItemCommentsEnabled></Blogger></ArchivePage>';
     248            foreach ( $blogsary[1] as $key => $id ) {
     249                // Define the required Blogger options.
     250                $blog_opts = array(
     251                    'blog-options-basic' => false,
     252                    'blog-options-archiving' => array('archiveFrequency' => 'm'),
     253                    'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'),
     254                    'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'),
     255                    'blog-comments' => array('commentsTimeStampFormat' => '0'),
     256                    'template-edit' => array( 'templateText' =>  str_replace('%title%', trim($blogsary[2][$key]), $template) )
     257                );
     258
     259                // Build the blog options array template
     260                foreach ($blog_opts as $blog_opt => $modify)
     261                    $new_opts["$blog_opt"] = array('backup'=>false, 'modify' => $modify, 'error'=>false);
     262
     263                $this->import['blogs']["$id"] = array(
     264                    'id' => $id,
     265                    'title' => trim($blogsary[2][$key]),
     266                    'options' => $new_opts,
     267                    'url' => false,
     268                    'publish_cookies' => false,
     269                    'published' => false,
     270                    'archives' => false,
     271                    'lump_authors' => false,
     272                    'newusers' => array(),
     273                    'nextstep' => 2
     274                );
     275            }
     276            update_option('import-blogger', $this->import);
     277            wp_redirect("admin.php?import=blogger&noheader=true&step=1");
     278        }
     279        die();
     280    }
     281
     282    // Step 1: Select one of the blogs belonging to the user logged in.
     283    function select_blog() {
     284        if ( is_array($this->import['blogs']) ) {
     285            $this->show_blogs();
     286            die();
     287        } else {
     288            $this->restart();
     289        }
     290    }
     291
     292    // Step 2: Backup the Blogger options pages, updating some of them.
     293    function backup_settings() {
     294        $output.= '<h1>'.__('Backing up Blogger options')."</h1>\n";
     295        $form = false;
     296        foreach ($this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary) {
     297            if ( $blog_opt == $_GET['form'] ) {
     298                // Save the posted form data
     299                $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup'] = $_POST;
     300                update_option('import-blogger',$this->import);
     301
     302                // Post the modified form data to Blogger
     303                if ( $optary['modify'] ) {
     304                    $posturl = "http://www.blogger.com/{$blog_opt}.do";
     305                    $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']);
     306                    if ( 'blog-publishing' == $blog_opt ) {
     307                        if ( $_POST['publishMode'] > 0 ) {
     308                            $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers);
     309                            if ( $response['code'] >= 400 )
     310                                wp_die('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
     311                            $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/';
     312                            sleep(2);
     313                        } else {
     314                            $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $_POST['subdomain'] . '.blogspot.com/';
     315                            update_option('import-blogger', $this->import);
     316                            $output .= "<del><p>$blog_opt</p></del>\n";
     317                            continue;
     318                        }
     319                        $paramary = $optary['modify'];
     320                    } else {
     321                        $paramary = array_merge($_POST, $optary['modify']);
     322                    }
     323                    $response = $this->post_blogger($posturl, $headers, $paramary);
     324                    if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') )
     325                        wp_die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
     326                }
     327                $output .= "<del><p>$blog_opt</p></del>\n";
     328            } elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) {
     329                // This option set has already been backed up.
     330                $output .= "<del><p>$blog_opt</p></del>\n";
     331            } elseif ( ! $form ) {
     332                // This option page needs to be downloaded and given to the browser for submission back to this script.
     333                $response = $this->get_blogger("http://www.blogger.com/{$blog_opt}.g?blogID={$_GET['blog']}", $this->import['cookies']);
     334                $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'] = $response['cookies'];
     335                update_option('import-blogger',$this->import);
     336                $body = $response['body'];
     337                $body = preg_replace("|\<!DOCTYPE.*\<body[^>]*>|ms","",$body);
     338                $body = preg_replace("|/?{$blog_opt}.do|","admin.php?import=blogger&amp;noheader=true&amp;step=2&amp;blog={$_GET['blog']}&amp;form={$blog_opt}",$body);
     339                $body = str_replace("name='submit'","name='supermit'",$body);
     340                $body = str_replace('name="submit"','name="supermit"',$body);
     341                $body = str_replace('</body>','',str_replace('</html>','',$body));
     342                $form = "<div style='height:0px;width:0px;overflow:hidden;'>";
     343                $form.= $body;
     344                $form.= "</div><script type='text/javascript'>forms=document.getElementsByTagName('form');for(i=0;i<forms.length;i++){if(forms[i].action.search('{$blog_opt}')){forms[i].submit();break;}}</script>";
     345                $output.= '<p>'.sprintf(__('<strong>%s</strong> in progress, please wait...'), $blog_opt)."</p>\n";
     346            } else {
     347                $output.= "<p>$blog_opt</p>\n";
     348            }
     349        }
     350        if ( $form )
     351            die($output . $form);
     352
     353        $this->set_next_step(4);
     354        $this->do_next_step();
     355    }
     356
     357    // Step 3: Cancelled :-)
     358
     359    // Step 4: Publish with the new template and settings.
     360    function publish_blog() {
     361        $this->publish_blogger(5, __('Publishing with new template and options'));
     362    }
     363
     364    // Step 5: Get the archive URLs from the new blog.
     365    function get_archive_urls() {
     366        $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']);
     367        if (! strstr($bloghtml['body'], '<a class="archive"') )
     368            wp_die(__('Your Blogger blog did not take the new template or did not respond.'));
     369        preg_match_all('#<a class="archive" href="([^"]*)"#', $bloghtml['body'], $archives);
     370        foreach ($archives[1] as $archive) {
     371            $this->import['blogs'][$_GET['blog']]['archives'][$archive] = false;
     372        }
     373        $this->set_next_step(6);
     374        $this->do_next_step();
     375    }
     376
     377    // Step 6: Get each monthly archive, import it, mark it done.
     378    function get_archive() {
     379        global $wpdb;
     380        $output = '<h2>'.__('Importing Blogger archives into WordPress').'</h2>';
     381        $did_one = false;
     382        $post_array = $posts = array();
     383        foreach ( $this->import['blogs'][$_GET['blog']]['archives'] as $url => $status ) {
     384            $archivename = substr(basename($url),0,7);
     385            if ( $status || $did_one ) {
     386                $foo = 'bar';
     387                // Do nothing.
     388            } else {
     389                // Import the selected month
     390                $postcount = 0;
     391                $skippedpostcount = 0;
     392                $commentcount = 0;
     393                $skippedcommentcount = 0;
     394                $status = __('in progress...');
     395                $this->import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
     396                update_option('import-blogger', $import);
     397                $archive = $this->get_blogger($url);
     398                if ( $archive['code'] > 200 )
     399                    continue;
     400                $posts = explode('<wordpresspost>', $archive['body']);
     401                for ($i = 1; $i < count($posts); $i = $i + 1) {
     402                    $postparts = explode('<wordpresscomment>', $posts[$i]);
     403                    $postinfo = explode('|W|P|', $postparts[0]);
     404                    $post_date = $postinfo[0];
     405                    $post_content = $postinfo[2];
     406                    // Don't try to re-use the original numbers
     407                    // because the new, longer numbers are too
     408                    // big to handle as ints.
     409                    //$post_number = $postinfo[3];
     410                    $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
     411                    $post_author_name = $wpdb->escape(trim($postinfo[1]));
     412                    $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
     413
     414                    if ( $this->lump_authors ) {
     415                        // Ignore Blogger authors. Use the current user_ID for all posts imported.
     416                        $post_author = $GLOBALS['user_ID'];
     417                    } else {
     418                        // Add a user for each new author encountered.
     419                        if (! username_exists($post_author_name) ) {
     420                            $user_login = $wpdb->escape($post_author_name);
     421                            $user_email = $wpdb->escape($post_author_email);
     422                            $user_password = substr(md5(uniqid(microtime())), 0, 6);
     423                            $result = wp_create_user( $user_login, $user_password, $user_email );
     424                            $status.= sprintf(__('Registered user <strong>%s</strong>.'), $user_login);
     425                            $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login;
     426                        }
     427                        $userdata = get_userdatabylogin( $post_author_name );
     428                        $post_author = $userdata->ID;
     429                    }
     430                    $post_date = explode(' ', $post_date);
     431                    $post_date_Ymd = explode('/', $post_date[0]);
     432                    $postyear = $post_date_Ymd[2];
     433                    $postmonth = zeroise($post_date_Ymd[0], 2);
     434                    $postday = zeroise($post_date_Ymd[1], 2);
     435                    $post_date_His = explode(':', $post_date[1]);
     436                    $posthour = zeroise($post_date_His[0], 2);
     437                    $postminute = zeroise($post_date_His[1], 2);
     438                    $postsecond = zeroise($post_date_His[2], 2);
     439
     440                    if (($post_date[2] == 'PM') && ($posthour != '12'))
     441                        $posthour = $posthour + 12;
     442                    else if (($post_date[2] == 'AM') && ($posthour == '12'))
     443                        $posthour = '00';
     444
     445                    $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
     446
     447                    $post_content = addslashes($post_content);
     448                    $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
     449
     450                    $post_title = addslashes($post_title);
     451
     452                    $post_status = 'publish';
     453
     454                    if ( $ID = post_exists($post_title, '', $post_date) ) {
     455                        $post_array[$i]['ID'] = $ID;
     456                        $skippedpostcount++;
     457                    } else {
     458                        $post_array[$i]['post'] = compact('post_author', 'post_content', 'post_title', 'post_category', 'post_author', 'post_date', 'post_status');
     459                        $post_array[$i]['comments'] = false;
     460                    }
     461
     462                    // Import any comments attached to this post.
     463                    if ($postparts[1]) :
     464                    for ($j = 1; $j < count($postparts); $j = $j + 1) {
     465                        $commentinfo = explode('|W|P|', $postparts[$j]);
     466                        $comment_date = explode(' ', $commentinfo[0]);
     467                        $comment_date_Ymd = explode('/', $comment_date[0]);
     468                        $commentyear = $comment_date_Ymd[2];
     469                        $commentmonth = zeroise($comment_date_Ymd[0], 2);
     470                        $commentday = zeroise($comment_date_Ymd[1], 2);
     471                        $comment_date_His = explode(':', $comment_date[1]);
     472                        $commenthour = zeroise($comment_date_His[0], 2);
     473                        $commentminute = zeroise($comment_date_His[1], 2);
     474                        $commentsecond = '00';
     475                        if (($comment_date[2] == 'PM') && ($commenthour != '12'))
     476                            $commenthour = $commenthour + 12;
     477                        else if (($comment_date[2] == 'AM') && ($commenthour == '12'))
     478                            $commenthour = '00';
     479                        $comment_date = "$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
     480                        $comment_author = addslashes(strip_tags($commentinfo[1]));
     481                        if ( strpos($commentinfo[1], 'a href') ) {
     482                            $comment_author_parts = explode('&quot;', htmlentities($commentinfo[1]));
     483                            $comment_author_url = $comment_author_parts[1];
     484                        } else $comment_author_url = '';
     485                        $comment_content = $commentinfo[2];
     486                        $comment_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $comment_content);
     487                        $comment_approved = 1;
     488                        if ( comment_exists($comment_author, $comment_date) ) {
     489                            $skippedcommentcount++;
     490                        } else {
     491                            $comment = compact('comment_author', 'comment_author_url', 'comment_date', 'comment_content', 'comment_approved');
     492                            $post_array[$i]['comments'][$j] = wp_filter_comment($comment);
     493                        }
     494                        $commentcount++;
     495                    }
     496                    endif;
     497                    $postcount++;
     498                }
     499                if ( count($post_array) ) {
     500                    krsort($post_array);
     501                    foreach($post_array as $post) {
     502                        if ( ! $comment_post_ID = $post['ID'] )
     503                            $comment_post_ID = wp_insert_post($post['post']);
     504                        if ( $post['comments'] ) {
     505                            foreach ( $post['comments'] as $comment ) {
     506                                $comment['comment_post_ID'] = $comment_post_ID;
     507                                wp_insert_comment($comment);
     508                            }
     509                        }
     510                    }
     511                }
     512                $status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount,  $skippedpostcount).' '.
     513                    sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcount, $skippedcommentcount).' '.
     514                    ' <strong>'.__('Done').'</strong>';
     515                $import = $this->import;
     516                $import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
     517                update_option('import-blogger', $import);
     518                $did_one = true;
     519            }
     520            $output.= "<p>$archivename $status</p>\n";
     521        }
     522        if ( ! $did_one )
     523            $this->set_next_step(7);
     524        die( $this->refresher(1000) . $output );
     525    }
     526
     527    // Step 7: Restore the backed-up settings to Blogger
     528    function restore_settings() {
     529        $output = '<h1>'.__('Restoring your Blogger options')."</h1>\n";
     530        $did_one = false;
     531        // Restore options in reverse order.
     532        if ( ! $this->import['reversed'] ) {
     533            $this->import['blogs'][$_GET['blog']]['options'] = array_reverse($this->import['blogs'][$_GET['blog']]['options'], true);
     534            $this->import['reversed'] = true;
     535            update_option('import-blogger', $this->import);
     536        }
     537        foreach ( $this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary ) {
     538            if ( $did_one ) {
     539                $output .= "<p>$blog_opt</p>\n";
     540            } elseif ( $optary['restored'] || ! $optary['modify'] ) {
     541                $output .= "<p><del>$blog_opt</del></p>\n";
     542            } else {
     543                $posturl = "http://www.blogger.com/{$blog_opt}.do";
     544                $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']);
     545                if ( 'blog-publishing' == $blog_opt) {
     546                    if ( $optary['backup']['publishMode'] > 0 ) {
     547                        $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers);
     548                        sleep(2);
     549                        if ( $response['code'] >= 400 )
     550                            wp_die('<h1>'.__('Error restoring publishMode').'</h1><p>'.__('Please tell the devs.').'</p>' . addslashes(print_r($response, 1)) );
     551                    }
     552                }
     553                if ( $optary['backup'] != $optary['modify'] ) {
     554                    $response = $this->post_blogger($posturl, $headers, $optary['backup']);
     555                    if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) {
     556                        $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['error'] = true;
     557                        update_option('import-blogger', $this->import);
     558                        $output .= sprintf(__('%s failed. Trying again.'), "<p><strong>$blog_opt</strong> ").'</p>';
     559                    } else {
     560                        $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['restored'] = true;
     561                        update_option('import-blogger', $this->import);
     562                        $output .= sprintf(__('%s restored.'), "<p><strong>$blog_opt</strong> ").'</p>';
     563                    }
     564                }
     565                $did_one = true;
     566            }
     567        }
     568
     569        if ( $did_one ) {
     570            die( $this->refresher(1000) . $output );
     571        } elseif ( $this->import['blogs'][$_GET['blog']]['options']['blog-publishing']['backup']['publishMode'] > 0 ) {
     572            $this->set_next_step(9);
     573        } else {
     574            $this->set_next_step(8);
     575        }
     576
     577        $this->do_next_step();
     578    }
     579
     580    // Step 8: Republish, all back to normal
     581    function republish_blog() {
     582        $this->publish_blogger(9, __('Publishing with original template and options'));
     583    }
     584
    744585    // Step 9: Congratulate the user
    745586    function congrats() {
    746         $blog = (int) $_GET['blog'];
    747587        echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
    748588        if ( count($this->import['blogs']) > 1 )
    749589            echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
    750         if ( $n = count($this->import['blogs'][$blog]['newusers']) )
     590        if ( $n = count($this->import['blogs'][$_GET['blog']]['newusers']) )
    751591            echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
    752         echo '<li>'.__('For security, click the link below to reset this importer.').'</li>';
     592        echo '<li>'.__('For security, click the link below to reset this importer. That will clear your Blogger credentials and options from the database.').'</li>';
    753593        echo '</ul>';
    754594    }
     
    756596    // Figures out what to do, then does it.
    757597    function start() {
    758         if ( isset($_POST['restart']) )
     598        if ( $_GET['restart'] == 'true' ) {
    759599            $this->restart();
    760 
    761         $options = get_option('blogger_importer');
    762 
    763         if ( is_array($options) )
    764             foreach ( $options as $key => $value )
    765                 $this->$key = $value;
    766 
    767         if ( isset( $_REQUEST['blog'] ) ) {
    768             $blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
    769             $blog = (int) $blog;
    770             $this->import_blog( $blog );
    771         } elseif ( isset($_GET['token']) )
    772             $this->auth();
    773         elseif ( $this->token && $this->token_is_valid() )
    774             $this->show_blogs();
    775         else
     600        }
     601
     602        if ( isset($_GET['noheader']) ) {
     603            header('Content-Type: text/html; charset=utf-8');
     604
     605            $this->import = get_option('import-blogger');
     606
     607            if ( false === $this->import ) {
     608                $step = 0;
     609            } elseif ( isset($_GET['step']) ) {
     610                $step = (int) $_GET['step'];
     611            } elseif ( isset($_GET['blog']) && isset($this->import['blogs'][$_GET['blog']]['nextstep']) ) {
     612                $step = $this->import['blogs'][$_GET['blog']]['nextstep'];
     613            } elseif ( is_array($this->import['blogs']) ) {
     614                $step = 1;
     615            } else {
     616                $step = 0;
     617            }
     618//echo "Step $step.";
     619//wp_die('<pre>'.print_r($this->import,1).'</pre');
     620            switch ($step) {
     621                case 0 :
     622                    $this->do_login();
     623                    break;
     624                case 1 :
     625                    $this->select_blog();
     626                    break;
     627                case 2 :
     628                    $this->backup_settings();
     629                    break;
     630                case 3 :
     631                    $this->wait_for_blogger();
     632                    break;
     633                case 4 :
     634                    $this->publish_blog();
     635                    break;
     636                case 5 :
     637                    $this->get_archive_urls();
     638                    break;
     639                case 6 :
     640                    $this->get_archive();
     641                    break;
     642                case 7 :
     643                    $this->restore_settings();
     644                    break;
     645                case 8 :
     646                    $this->republish_blog();
     647                    break;
     648                case 9 :
     649                    $this->congrats();
     650                    break;
     651            }
     652            die;
     653
     654        } else {
    776655            $this->greet();
    777 
    778         $saved = $this->save_vars();
    779 
    780         if ( $saved && !isset($_GET['noheader']) ) {
    781             $restart = __('Restart');
    782             $message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.');
    783             $submit = __('Clear account information');
    784             echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&noheader=true'><p class='submit' style='text-align:left;'><input type='submit' value='$submit' name='restart' /></p></form></div>";
    785         }
    786     }
    787 
    788     function save_vars() {
    789         $vars = get_object_vars($this);
    790         update_option( 'blogger_importer', $vars );
    791 
    792         return !empty($vars);
    793     }
    794 
    795     function admin_head() {
     656        }
     657    }
     658
     659    function Blogger_Import() {
     660        // This space intentionally left blank.
     661    }
     662}
     663
     664$blogger_import = new Blogger_Import();
     665
     666register_importer('blogger', __('Old Blogger'), __('Import posts, comments, and users from an Old Blogger blog'), array ($blogger_import, 'start'));
     667
    796668?>
    797 <style type="text/css">
    798 td { text-align: center; line-height: 2em;}
    799 thead td { font-weight: bold; }
    800 .bar {
    801     width: 200px;
    802     text-align: left;
    803     line-height: 2em;
    804     padding: 0px;
    805 }
    806 .ind {
    807     position: absolute;
    808     background-color: #83B4D8;
    809     width: 1px;
    810     z-index: 9;
    811 }
    812 .stat {
    813     z-index: 10;
    814     position: relative;
    815     text-align: center;
    816 }
    817 .submit {
    818     text-align: center !important;
    819 }
    820 </style>
    821 <?php
    822     }
    823 
    824     function Blogger_Import() {
    825         global $importer_started;
    826         $importer_started = time();
    827         if ( isset( $_GET['import'] ) && $_GET['import'] == 'blogger' ) {
    828             wp_enqueue_script('jquery');
    829             add_action('admin_head', array(&$this, 'admin_head'));
    830         }
    831     }
    832 }
    833 
    834 $blogger_import = new Blogger_Import();
    835 
    836 register_importer('blogger', __('Blogger'), __('Import posts, comments, and users from a Blogger blog'), array ($blogger_import, 'start'));
    837 
    838 class AtomEntry {
    839     var $links = array();
    840     var $categories = array();
    841 }
    842 
    843 class AtomParser {
    844 
    845     var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights');
    846     var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft','author');
    847 
    848     var $depth = 0;
    849     var $indent = 2;
    850     var $in_content;
    851     var $ns_contexts = array();
    852     var $ns_decls = array();
    853     var $is_xhtml = false;
    854     var $skipped_div = false;
    855 
    856     var $entry;
    857 
    858     function AtomParser() {
    859 
    860         $this->entry = new AtomEntry();
    861         $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";');
    862         $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
    863     }
    864 
    865     function parse($xml) {
    866 
    867         global $app_logging;
    868         array_unshift($this->ns_contexts, array());
    869 
    870         $parser = xml_parser_create_ns();
    871         xml_set_object($parser, $this);
    872         xml_set_element_handler($parser, "start_element", "end_element");
    873         xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
    874         xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0);
    875         xml_set_character_data_handler($parser, "cdata");
    876         xml_set_default_handler($parser, "_default");
    877         xml_set_start_namespace_decl_handler($parser, "start_ns");
    878         xml_set_end_namespace_decl_handler($parser, "end_ns");
    879 
    880         $contents = "";
    881 
    882         xml_parse($parser, $xml);
    883 
    884         xml_parser_free($parser);
    885 
    886         return true;
    887     }
    888 
    889     function start_element($parser, $name, $attrs) {
    890 
    891         $tag = array_pop(split(":", $name));
    892 
    893         array_unshift($this->ns_contexts, $this->ns_decls);
    894 
    895         $this->depth++;
    896 
    897         if(!empty($this->in_content)) {
    898             $attrs_prefix = array();
    899 
    900             // resolve prefixes for attributes
    901             foreach($attrs as $key => $value) {
    902                 $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value);
    903             }
    904             $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix)));
    905             if(strlen($attrs_str) > 0) {
    906                 $attrs_str = " " . $attrs_str;
    907             }
    908 
    909             $xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0])));
    910             if(strlen($xmlns_str) > 0) {
    911                 $xmlns_str = " " . $xmlns_str;
    912             }
    913 
    914             // handle self-closing tags (case: a new child found right-away, no text node)
    915             if(count($this->in_content) == 2) {
    916                 array_push($this->in_content, ">");
    917             }
    918          
    919             array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
    920         } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
    921             $this->in_content = array();
    922             $this->is_xhtml = $attrs['type'] == 'xhtml';
    923             array_push($this->in_content, array($tag,$this->depth));
    924         } else if($tag == 'link') {
    925             array_push($this->entry->links, $attrs);
    926         } else if($tag == 'category') {
    927             array_push($this->entry->categories, $attrs['term']);
    928         }
    929 
    930         $this->ns_decls = array();
    931     }
    932 
    933     function end_element($parser, $name) {
    934 
    935         $tag = array_pop(split(":", $name));
    936 
    937         if(!empty($this->in_content)) {
    938             if($this->in_content[0][0] == $tag &&
    939             $this->in_content[0][1] == $this->depth) {
    940                 array_shift($this->in_content);
    941                 if($this->is_xhtml) {
    942                     $this->in_content = array_slice($this->in_content, 2, count($this->in_content)-3);
    943                 }
    944                 $this->entry->$tag = join('',$this->in_content);
    945                 $this->in_content = array();
    946             } else {
    947                 $endtag = $this->ns_to_prefix($name);
    948                 if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) {
    949                     array_push($this->in_content, "/>");
    950                 } else {
    951                     array_push($this->in_content, "</$endtag>");
    952                 }
    953             }
    954         }
    955 
    956         array_shift($this->ns_contexts);
    957 
    958         #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
    959 
    960         $this->depth--;
    961     }
    962 
    963     function start_ns($parser, $prefix, $uri) {
    964         #print str_repeat(" ", $this->depth * $this->indent) . "starting: " . $prefix . ":" . $uri . "\n";
    965         array_push($this->ns_decls, array($prefix,$uri));
    966     }
    967 
    968     function end_ns($parser, $prefix) {
    969         #print str_repeat(" ", $this->depth * $this->indent) . "ending: #" . $prefix . "#\n";
    970     }
    971 
    972     function cdata($parser, $data) {
    973         #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
    974         if(!empty($this->in_content)) {
    975             // handle self-closing tags (case: text node found, need to close element started)
    976             if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
    977                 array_push($this->in_content, ">");
    978             }
    979             array_push($this->in_content, $this->xml_escape($data));
    980         }
    981     }
    982 
    983     function _default($parser, $data) {
    984         # when does this gets called?
    985     }
    986 
    987 
    988     function ns_to_prefix($qname) {
    989         $components = split(":", $qname);
    990         $name = array_pop($components);
    991 
    992         if(!empty($components)) {
    993             $ns = join(":",$components);
    994             foreach($this->ns_contexts as $context) {
    995                 foreach($context as $mapping) {
    996                     if($mapping[1] == $ns && strlen($mapping[0]) > 0) {
    997                         return "$mapping[0]:$name";
    998                     }
    999                 }
    1000             }
    1001         }
    1002         return $name;
    1003     }
    1004 
    1005     function xml_escape($string)
    1006     {
    1007              return str_replace(array('&','"',"'",'<','>'),
    1008                 array('&amp;','&quot;','&apos;','&lt;','&gt;'),
    1009                 $string );
    1010     }
    1011 }
    1012 
    1013 ?>
  • tags/2.1.3/wp-admin/import/dotclear.php

    r5480 r5468  
    148148        echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
    149149        echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
    150         wp_nonce_field('import-dotclear');
    151150        $this->db_form();
    152         echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories &raquo;')).'" /></p>';
     151        echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Categories').' &raquo;" /></p>';
    153152        echo '</form></div>';
    154153    }
     
    560559
    561560        echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
    562         wp_nonce_field('import-dotclear');
    563         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
     561        printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
    564562        echo '</form>';
    565563
     
    573571
    574572        echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
    575         wp_nonce_field('import-dotclear');
    576         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
     573        printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
    577574        echo '</form>';
    578575    }
     
    585582
    586583        echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
    587         wp_nonce_field('import-dotclear');
    588         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
     584        printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
    589585        echo '</form>';
    590586    }
     
    597593
    598594        echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
    599         wp_nonce_field('import-dotclear');
    600         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
     595        printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
    601596        echo '</form>';
    602597    }
     
    610605
    611606        echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
    612         wp_nonce_field('import-dotclear');
    613         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
     607        printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
    614608        echo '</form>';
    615609    }
     
    674668        if ( $step > 0 )
    675669        {
    676             check_admin_referer('import-dotclear');
    677 
    678670            if($_POST['dbuser'])
    679671            {
    680672                if(get_option('dcuser'))
    681673                    delete_option('dcuser');
    682                 add_option('dcuser', sanitize_user($_POST['dbuser'], true));
     674                add_option('dcuser',$_POST['dbuser']);
    683675            }
    684676            if($_POST['dbpass'])
     
    686678                if(get_option('dcpass'))
    687679                    delete_option('dcpass');
    688                 add_option('dcpass', sanitize_user($_POST['dbpass'], true));
     680                add_option('dcpass',$_POST['dbpass']);
    689681            }
    690682
     
    693685                if(get_option('dcname'))
    694686                    delete_option('dcname');
    695                 add_option('dcname', sanitize_user($_POST['dbname'], true));
     687                add_option('dcname',$_POST['dbname']);
    696688            }
    697689            if($_POST['dbhost'])
     
    699691                if(get_option('dchost'))
    700692                    delete_option('dchost');
    701                 add_option('dchost', sanitize_user($_POST['dbhost'], true));
     693                add_option('dchost',$_POST['dbhost']);
    702694            }
    703695            if($_POST['dccharset'])
     
    705697                if(get_option('dccharset'))
    706698                    delete_option('dccharset');
    707                 add_option('dccharset', sanitize_user($_POST['dccharset'], true));
     699                add_option('dccharset',$_POST['dccharset']);
    708700            }
    709701            if($_POST['dbprefix'])
     
    711703                if(get_option('dcdbprefix'))
    712704                    delete_option('dcdbprefix');
    713                 add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true));
     705                add_option('dcdbprefix',$_POST['dbprefix']);
    714706            }
    715707
  • tags/2.1.3/wp-admin/import/greymatter.php

    r5480 r5468  
    3535<input type="hidden" name="import" value="greymatter" />
    3636<input type="hidden" name="step" value="1" />
    37 <?php wp_nonce_field('import-greymatter'); ?>
    3837<h3><?php _e('Second step: GreyMatter details:') ?></h3>
    3938<p><table cellpadding="0">
     
    8988
    9089        if (!chdir($archivespath))
    91             wp_die(__("Wrong path, the path to the GM entries does not exist on the server"));
     90            wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $archivespath));
    9291
    9392        if (!chdir($gmpath))
    94             wp_die(__("Wrong path, the path to the GM files does not exist on the server"));
    95 
    96         $lastentry = (int) $lastentry;
    97 
     93            wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
     94           
    9895        $this->header();
    9996?>
     
    132129        $user_id = wp_insert_user($user_info);
    133130        $this->gmnames[$userdata[0]] = $user_id;
    134 
     131       
    135132        printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
    136133    }
     
    217214                    $user_url=$wpdb->escape("");
    218215                    $user_joindate=$wpdb->escape($user_joindate);
    219 
     216                   
    220217                    $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
    221218                    $user_id = wp_insert_user($user_info);
    222219                    $this->gmnames[$postinfo[1]] = $user_id;
    223 
     220                   
    224221                    echo ': ';
    225222                    printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
    226223                }
    227 
     224           
    228225                if (array_key_exists($postinfo[1], $this->gmnames)) {
    229226                    $post_author = $this->gmnames[$postinfo[1]];
     
    231228                    $post_author = $user_id;
    232229                }
    233 
     230           
    234231                $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
    235232                $post_ID = wp_insert_post($postdata);
     
    301298                break;
    302299            case 1:
    303                 check_admin_referer('import-greymatter');
    304300                $this->import();
    305301                break;
  • tags/2.1.3/wp-admin/import/livejournal.php

    r5480 r5468  
    154154                break;
    155155            case 1 :
    156                 check_admin_referer('import-upload');
    157156                $this->import();
    158157                break;
  • tags/2.1.3/wp-admin/import/mt.php

    r5480 r5468  
    148148        echo '<ol id="authors">';
    149149        echo '<form action="?import=mt&amp;step=2&amp;id=' . $this->id . '" method="post">';
    150         wp_nonce_field('import-mt');
    151150        $j = -1;
    152151        foreach ($authors as $author) {
     
    419418                break;
    420419            case 1 :
    421                 check_admin_referer('import-upload');
    422420                $this->select_authors();
    423421                break;
    424422            case 2:
    425                 check_admin_referer('import-mt');
    426423                $this->import();
    427424                break;
  • tags/2.1.3/wp-admin/import/rss.php

    r5480 r5468  
    157157                break;
    158158            case 1 :
    159                 check_admin_referer('import-upload');
    160159                $this->import();
    161160                break;
  • tags/2.1.3/wp-admin/import/textpattern.php

    r5480 r5468  
    5757        echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
    5858        echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
    59         wp_nonce_field('import-textpattern');
    6059        $this->db_form();
    61         echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories &raquo;')).'" /></p>';
     60        echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Categories').' &raquo;" /></p>';
    6261        echo '</form>';
    6362        echo '</div>';
     
    485484
    486485        echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
    487         wp_nonce_field('import-textpattern');
    488         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
     486        printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
    489487        echo '</form>';
    490488
     
    498496
    499497        echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
    500         wp_nonce_field('import-textpattern');
    501         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
     498        printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
    502499        echo '</form>';
    503500    }
     
    510507
    511508        echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
    512         wp_nonce_field('import-textpattern');
    513         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
     509        printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
    514510        echo '</form>';
    515511    }
     
    522518
    523519        echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
    524         wp_nonce_field('import-textpattern');
    525         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
     520        printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
    526521        echo '</form>';
    527522    }
     
    535530
    536531        echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
    537         wp_nonce_field('import-textpattern');
    538         printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
     532        printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
    539533        echo '</form>';
    540534    }
     
    597591        if ( $step > 0 )
    598592        {
    599             check_admin_referer('import-textpattern');
    600 
    601593            if($_POST['dbuser'])
    602594            {
    603595                if(get_option('txpuser'))
    604596                    delete_option('txpuser');
    605                 add_option('txpuser', sanitize_user($_POST['dbuser'], true));
     597                add_option('txpuser',$_POST['dbuser']);
    606598            }
    607599            if($_POST['dbpass'])
     
    609601                if(get_option('txppass'))
    610602                    delete_option('txppass');
    611                 add_option('txppass',  sanitize_user($_POST['dbpass'], true));
     603                add_option('txppass',$_POST['dbpass']);
    612604            }
    613605
     
    616608                if(get_option('txpname'))
    617609                    delete_option('txpname');
    618                 add_option('txpname',  sanitize_user($_POST['dbname'], true));
     610                add_option('txpname',$_POST['dbname']);
    619611            }
    620612            if($_POST['dbhost'])
     
    622614                if(get_option('txphost'))
    623615                    delete_option('txphost');
    624                 add_option('txphost',  sanitize_user($_POST['dbhost'], true));
     616                add_option('txphost',$_POST['dbhost']);
    625617            }
    626618            if($_POST['dbprefix'])
     
    628620                if(get_option('tpre'))
    629621                    delete_option('tpre');
    630                 add_option('tpre',  sanitize_user($_POST['dbprefix']));
     622                add_option('tpre',$_POST['dbprefix']);
    631623            }
    632624
  • tags/2.1.3/wp-admin/import/wordpress.php

    r5480 r5468  
    44
    55    var $posts = array ();
    6     var $posts_processed = array ();
    7     // Array of arrays. [[0] => XML fragment, [1] => New post ID]
    86    var $file;
    97    var $id;
     
    3634
    3735    function get_tag( $string, $tag ) {
    38         global $wpdb;
    3936        preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
    40         $return = $wpdb->escape( trim( $return[1] ) );
     37        $return = addslashes( trim( $return[1] ) );
    4138        return $return;
    4239    }
     
    6663            $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
    6764            if (!$user_id) { //banging my head against the desk now.
    68                 if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
     65                if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
    6966                    $user_id = wp_create_user($author, $pass);
    7067                    $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
     
    8582    function get_entries() {
    8683        set_magic_quotes_runtime(0);
    87         $importdata = array_map('rtrim', file($this->file)); // Read the file into an array
    88 
    89         $this->posts = array();
    90         $this->categories = array();
    91         $num = 0;
    92         $doing_entry = false;
    93         foreach ($importdata as $importline) {
    94             if ( false !== strpos($importline, '<wp:category>') ) {
    95                 preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
    96                 $this->categories[] = $category[1];
    97                 continue;
    98             }
    99             if ( false !== strpos($importline, '<item>') ) {
    100                 $this->posts[$num] = '';
    101                 $doing_entry = true;
    102                 continue;   
    103             }
    104             if ( false !== strpos($importline, '</item>') ) {
    105                 $num++;
    106                 $doing_entry = false;
    107                 continue;   
    108             }
    109             if ( $doing_entry ) {
    110                 $this->posts[$num] .= $importline . "\n";
    111             }
    112         }
    113 
    114         foreach ($this->posts as $post) {
    115             $post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
    116             if ($post_ID) {
    117                 $this->posts_processed[$post_ID][0] = &$post;
    118                 $this->posts_processed[$post_ID][1] = 0;
    119             }
    120         }
     84        $importdata = file($this->file); // Read the file into an array
     85        $importdata = implode('', $importdata); // squish it
     86        $importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
     87        preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts);
     88        $this->posts = $this->posts[1];
     89        preg_match_all('|<wp:category>(.*?)</wp:category>|is', $importdata, $this->categories);
     90        $this->categories = $this->categories[1];
    12191    }
    12292
     
    181151        echo '<ol id="authors">';
    182152        echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
    183         wp_nonce_field('import-wordpress');
    184153        $j = -1;
    185154        foreach ($authors as $author) {
     
    199168        $file = wp_import_handle_upload();
    200169        if ( isset($file['error']) ) {
     170            $this->header();
    201171            echo '<p>'.__('Sorry, there has been an error.').'</p>';
    202172            echo '<p><strong>' . $file['error'] . '</strong></p>';
     173            $this->footer();
    203174            return;
    204175        }
     
    240211
    241212    function process_posts() {
     213        global $wpdb;
    242214        $i = -1;
    243215        echo '<ol>';
    244 
    245         foreach ($this->posts as $post)
    246             $this->process_post($post);
     216        foreach ($this->posts as $post) {
     217
     218            // There are only ever one of these
     219            $post_title     = $this->get_tag( $post, 'title' );
     220            $post_date      = $this->get_tag( $post, 'wp:post_date' );
     221            $post_date_gmt  = $this->get_tag( $post, 'wp:post_date_gmt' );
     222            $comment_status = $this->get_tag( $post, 'wp:comment_status' );
     223            $ping_status    = $this->get_tag( $post, 'wp:ping_status' );
     224            $post_status    = $this->get_tag( $post, 'wp:status' );
     225            $post_parent    = $this->get_tag( $post, 'wp:post_parent' );
     226            $post_type      = $this->get_tag( $post, 'wp:post_type' );
     227            $guid           = $this->get_tag( $post, 'guid' );
     228            $post_author    = $this->get_tag( $post, 'dc:creator' );
     229
     230            $post_content = $this->get_tag( $post, 'content:encoded' );
     231            $post_content = str_replace(array ('<![CDATA[', ']]>'), '', $post_content);
     232            $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
     233            $post_content = str_replace('<br>', '<br />', $post_content);
     234            $post_content = str_replace('<hr>', '<hr />', $post_content);
     235
     236            preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
     237            $categories = $categories[1];
     238
     239            $cat_index = 0;
     240            foreach ($categories as $category) {
     241                $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
     242                $cat_index++;
     243            }
     244
     245            if ($post_id = post_exists($post_title, '', $post_date)) {
     246                echo '<li>';
     247                printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
     248            } else {
     249                echo '<li>';
     250                printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
     251
     252                $post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
     253
     254                $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'post_type');
     255                $comment_post_ID = $post_id = wp_insert_post($postdata);
     256                // Add categories.
     257                if (0 != count($categories)) {
     258                    wp_create_categories($categories, $post_id);
     259                }
     260            }
     261
     262                // Now for comments
     263                preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
     264                $comments = $comments[1];
     265                $num_comments = 0;
     266                if ( $comments) { foreach ($comments as $comment) {
     267                    $comment_author       = $this->get_tag( $comment, 'wp:comment_author');
     268                    $comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email');
     269                    $comment_author_IP    = $this->get_tag( $comment, 'wp:comment_author_IP');
     270                    $comment_author_url   = $this->get_tag( $comment, 'wp:comment_author_url');
     271                    $comment_date         = $this->get_tag( $comment, 'wp:comment_date');
     272                    $comment_date_gmt     = $this->get_tag( $comment, 'wp:comment_date_gmt');
     273                    $comment_content      = $this->get_tag( $comment, 'wp:comment_content');
     274                    $comment_approved     = $this->get_tag( $comment, 'wp:comment_approved');
     275                    $comment_type         = $this->get_tag( $comment, 'wp:comment_type');
     276                    $comment_parent       = $this->get_tag( $comment, 'wp:comment_parent');
     277
     278                    if ( !comment_exists($comment_author, $comment_date) ) {
     279                        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent');
     280                        wp_insert_comment($commentdata);
     281                        $num_comments++;
     282                    }
     283                } }
     284                if ( $num_comments )
     285                    printf(' '.__('(%s comments)'), $num_comments);
     286
     287                // Now for post meta
     288                preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
     289                $postmeta = $postmeta[1];
     290                if ( $postmeta) { foreach ($postmeta as $p) {
     291                    $key   = $this->get_tag( $p, 'wp:meta_key' );
     292                    $value = $this->get_tag( $p, 'wp:meta_value' );
     293                    add_post_meta( $post_id, $key, $value );
     294                } }
     295
     296            $index++;
     297        }
    247298
    248299        echo '</ol>';
     
    251302
    252303        echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
    253     }
    254  
    255     function process_post($post) {
    256         global $wpdb;
    257 
    258         $post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
    259         if ( $post_ID && !empty($this->posts_processed[$post_ID][1]) ) // Processed already
    260             return 0;
    261      
    262         // There are only ever one of these
    263         $post_title     = $this->get_tag( $post, 'title' );
    264         $post_date      = $this->get_tag( $post, 'wp:post_date' );
    265         $post_date_gmt  = $this->get_tag( $post, 'wp:post_date_gmt' );
    266         $comment_status = $this->get_tag( $post, 'wp:comment_status' );
    267         $ping_status    = $this->get_tag( $post, 'wp:ping_status' );
    268         $post_status    = $this->get_tag( $post, 'wp:status' );
    269         $post_name      = $this->get_tag( $post, 'wp:post_name' );
    270         $post_parent    = $this->get_tag( $post, 'wp:post_parent' );
    271         $menu_order     = $this->get_tag( $post, 'wp:menu_order' );
    272         $post_type      = $this->get_tag( $post, 'wp:post_type' );
    273         $guid           = $this->get_tag( $post, 'guid' );
    274         $post_author    = $this->get_tag( $post, 'dc:creator' );
    275 
    276         $post_content = $this->get_tag( $post, 'content:encoded' );
    277         $post_content = str_replace(array ('<![CDATA[', ']]>'), '', $post_content);
    278         $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
    279         $post_content = str_replace('<br>', '<br />', $post_content);
    280         $post_content = str_replace('<hr>', '<hr />', $post_content);
    281 
    282         preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
    283         $categories = $categories[1];
    284 
    285         $cat_index = 0;
    286         foreach ($categories as $category) {
    287             $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
    288             $cat_index++;
    289         }
    290 
    291         if ($post_id = post_exists($post_title, '', $post_date)) {
    292             echo '<li>';
    293             printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
    294         } else {
    295 
    296             // If it has parent, process parent first.
    297             $post_parent = (int) $post_parent;
    298             if ($parent = $this->posts_processed[$post_parent]) {
    299                 if (!$parent[1]) $this->process_post($parent[0]); // If not yet, process the parent first.
    300                 $post_parent = $parent[1]; // New ID of the parent;
    301             }
    302 
    303             echo '<li>';
    304             printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
    305 
    306             $post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
    307 
    308             $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'post_name', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'menu_order', 'post_type');
    309             $comment_post_ID = $post_id = wp_insert_post($postdata);
    310 
    311             // Memorize old and new ID.
    312             if ( $post_id && $post_ID && $this->posts_processed[$post_ID] )
    313                 $this->posts_processed[$post_ID][1] = $post_id; // New ID.
    314            
    315             // Add categories.
    316             if (count($categories) > 0) {
    317                 $post_cats = array();
    318                 foreach ($categories as $category) {
    319                     $cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'");
    320                     if ($cat_ID == 0) {
    321                         $cat_ID = wp_insert_category(array('cat_name' => $category));
    322                     }
    323                     $post_cats[] = $cat_ID;
    324                 }
    325                 wp_set_post_categories($post_id, $post_cats);
    326             }   
    327         }
    328 
    329         // Now for comments
    330         preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
    331         $comments = $comments[1];
    332         $num_comments = 0;
    333         if ( $comments) { foreach ($comments as $comment) {
    334             $comment_author       = $this->get_tag( $comment, 'wp:comment_author');
    335             $comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email');
    336             $comment_author_IP    = $this->get_tag( $comment, 'wp:comment_author_IP');
    337             $comment_author_url   = $this->get_tag( $comment, 'wp:comment_author_url');
    338             $comment_date         = $this->get_tag( $comment, 'wp:comment_date');
    339             $comment_date_gmt     = $this->get_tag( $comment, 'wp:comment_date_gmt');
    340             $comment_content      = $this->get_tag( $comment, 'wp:comment_content');
    341             $comment_approved     = $this->get_tag( $comment, 'wp:comment_approved');
    342             $comment_type         = $this->get_tag( $comment, 'wp:comment_type');
    343             $comment_parent       = $this->get_tag( $comment, 'wp:comment_parent');
    344 
    345             if ( !comment_exists($comment_author, $comment_date) ) {
    346                 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent');
    347                 wp_insert_comment($commentdata);
    348                 $num_comments++;
    349             }
    350         } }
    351 
    352         if ( $num_comments )
    353             printf(' '.__('(%s comments)'), $num_comments);
    354 
    355         // Now for post meta
    356         preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
    357         $postmeta = $postmeta[1];
    358         if ( $postmeta) { foreach ($postmeta as $p) {
    359             $key   = $this->get_tag( $p, 'wp:meta_key' );
    360             $value = $this->get_tag( $p, 'wp:meta_value' );
    361             $value = stripslashes($value); // add_post_meta() will escape.
    362             add_post_meta( $post_id, $key, $value );
    363         } }
    364304    }
    365305
     
    386326                break;
    387327            case 1 :
    388                 check_admin_referer('import-upload');
    389328                $this->select_authors();
    390329                break;
    391330            case 2:
    392                 check_admin_referer('import-wordpress');
    393331                $this->import();
    394332                break;
  • tags/2.1.3/wp-admin/index.php

    r5480 r5468  
    1616add_action( 'admin_head', 'index_js' );
    1717wp_enqueue_script('prototype');
    18 wp_enqueue_script('interface');
    1918
    2019$title = __('Dashboard');
     
    5150if ( $comments ) {
    5251foreach ($comments as $comment) {
    53     echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>');
     52    echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
    5453    edit_comment_link(__("Edit"), ' <small>(', ')</small>');
    5554    echo '</li>';
     
    6261
    6362<?php
    64 if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
     63if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
    6564?>
    6665<div>
     
    10099<h3><?php _e('Blog Stats'); ?></h3>
    101100<?php
    102 $numposts = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
    103 $numcomms = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
    104 $numcats  = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
     101$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
     102if (0 < $numposts) $numposts = number_format($numposts);
    105103
    106 $post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format($numposts), 'edit.php');
    107 $comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format($numcomms), 'edit-comments.php');
    108 $cat_str  = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format($numcats), 'categories.php');
     104$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
     105if (0 < $numcomms) $numcomms = number_format($numcomms);
     106
     107$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
     108if (0 < $numcats) $numcats = number_format($numcats);
    109109?>
     110<p><?php
     111$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), $numposts, 'edit.php');
     112$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), $numcomms, 'edit-comments.php');
     113$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), $numcats, 'categories.php');
    110114
    111 <p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
     115printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
    112116</div>
    113117
     
    123127    <li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
    124128<?php if ( current_user_can('manage_links') ) : ?>
    125     <li><a href="link-add.php"><?php _e('Add a link to your blogroll'); ?></a></li>
     129    <li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li>
    126130<?php endif; ?>
    127131<?php if ( current_user_can('switch_themes') ) : ?>
  • tags/2.1.3/wp-admin/link-add.php

    r5480 r5468  
    2929<div id="wp-link-bookmarklet"  class="wrap">
    3030<h3><?php _e('Add Link Bookmarklet'); ?></h3>
    31 <p><?php _e('Right click on the following link and choose &#0147;Bookmark This Link...&#0148; or &#0147;Add to Favorites...&#0148; to create a Link This shortcut.'); ?></p>
     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&#8217;re working on it.'); ?></p>
    3232<?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();") ?>
    3333</div>
  • tags/2.1.3/wp-admin/link-import.php

    r5480 r5468  
    1313<?php
    1414switch ($step) {
    15     case 0: {
    16         include_once('admin-header.php');
    17         if ( !current_user_can('manage_links') )
    18             wp_die(__('Cheatin&#8217; uh?'));
     15    case 0:
     16    {
     17        include_once('admin-header.php');
     18        if ( !current_user_can('manage_links') )
     19            wp_die(__('Cheatin&#8217; uh?'));
    1920
    20         $opmltype = 'blogrolling'; // default.
     21        $opmltype = 'blogrolling'; // default.
    2122?>
    2223
    2324<div class="wrap">
    24 
    2525<h2><?php _e('Import your blogroll from another system') ?> </h2>
    2626<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
     
    4141</div>
    4242
     43
    4344</div>
    4445
     
    4950foreach ($categories as $category) {
    5051?>
    51 <option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
     52<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars($category->cat_name); ?></option>
    5253<?php
    5354} // end foreach
     
    6061</div>
    6162<?php
    62         break;
    63     } // end case 0
     63                break;
     64            } // end case 0
    6465
    65     case 1: {
     66    case 1: {
    6667        check_admin_referer('import-bookmarks');
    6768
    68         include_once('admin-header.php');
    69         if ( !current_user_can('manage_links') )
    70             wp_die(__('Cheatin&#8217; uh?'));
     69                include_once('admin-header.php');
     70                if ( !current_user_can('manage_links') )
     71                    wp_die(__('Cheatin&#8217; uh?'));
    7172?>
    7273<div class="wrap">
    7374
    74 <h2><?php _e('Importing...') ?></h2>
     75     <h2><?php _e('Importing...') ?></h2>
    7576<?php
    76         $cat_id = $_POST['cat_id'];
    77         if ( $cat_id == '' || $cat_id == 0 )
    78             $cat_id  = 1;
     77                $cat_id = $_POST['cat_id'];
     78                if (($cat_id == '') || ($cat_id == 0)) {
     79                    $cat_id  = 1;
     80                }
    7981
    80         $opml_url = $_POST['opml_url'];
    81         if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
    82             $blogrolling = true;
    83         } else { // try to get the upload file.
    84             $overrides = array('test_form' => false, 'test_type' => false);
    85             $file = wp_handle_upload($_FILES['userfile'], $overrides);
     82                $opml_url = $_POST['opml_url'];
     83                if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
     84                    $blogrolling = true;
     85                }
     86                else // try to get the upload file.
     87                {
     88                    $overrides = array('test_form' => false, 'test_type' => false);
     89                    $file = wp_handle_upload($_FILES['userfile'], $overrides);
    8690
    87             if ( isset($file['error']) )
    88                 wp_die($file['error']);
     91                    if ( isset($file['error']) )
     92                        wp_die($file['error']);
    8993
    90             $url = $file['url'];
    91             $opml_url = $file['file'];
    92             $blogrolling = false;
    93         }
     94                    $url = $file['url'];
     95                    $opml_url = $file['file'];
     96                    $blogrolling = false;
     97                }
    9498
    95         if ( isset($opml_url) && $opml_url != '' ) {
    96             if ( $blogrolling === true ) {
    97                 $opml = wp_remote_fopen($opml_url);
    98             } else {
    99                 $opml = file_get_contents($opml_url);
    100             }
    101            
    102             include_once('link-parse-opml.php');
     99                if (isset($opml_url) && $opml_url != '') {
     100                    $opml = wp_remote_fopen($opml_url);
     101                    include_once('link-parse-opml.php');
    103102
    104             $link_count = count($names);
    105             for ( $i = 0; $i < $link_count; $i++ ) {
    106                 if ('Last' == substr($titles[$i], 0, 4))
    107                     $titles[$i] = '';
    108                 if ( 'http' == substr($titles[$i], 0, 4) )
    109                     $titles[$i] = '';
    110                 $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
    111                 wp_insert_link($link);
    112                 echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
    113             }
     103                    $link_count = count($names);
     104                    for ($i = 0; $i < $link_count; $i++) {
     105                        if ('Last' == substr($titles[$i], 0, 4))
     106                            $titles[$i] = '';
     107                        if ('http' == substr($titles[$i], 0, 4))
     108                            $titles[$i] = '';
     109                        $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);                       
     110                        wp_insert_link($link);
     111                        echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
     112                    }
    114113?>
     114     <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
     115<?php
     116                } // end if got url
     117                else
     118                {
     119                    echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
     120                } // end else
    115121
    116 <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
    117 
    118 <?php
    119 } // end if got url
    120 else
    121 {
    122     echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
    123 } // end else
    124 
    125 if ( ! $blogrolling )
    126     apply_filters( 'wp_delete_file', $opml_url);
    127     @unlink($opml_url);
     122                if ( ! $blogrolling )
     123                    @unlink($opml_url);
    128124?>
    129125</div>
    130126<?php
    131         break;
    132     } // end case 1
     127                break;
     128            } // end case 1
    133129} // end switch
    134130
  • tags/2.1.3/wp-admin/link-manager.php

    r5480 r5468  
    8181$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
    8282foreach ((array) $categories as $cat)
    83     $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
     83    $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars($cat->cat_name) . "</option>\n";
    8484$select_cat .= "</select>\n";
    8585
     
    132132<?php
    133133    foreach ($links as $link) {
    134         $link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
    135         $link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
     134        $link->link_name = attribute_escape($link->link_name);
     135        $link->link_description = wp_specialchars($link->link_description);
    136136        $link->link_url = clean_url($link->link_url);
    137137        $link->link_category = wp_get_link_cats($link->link_id);
     
    161161                    foreach ($link->link_category as $category) {
    162162                        $cat_name = get_the_category_by_ID($category);
    163                         $cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
     163                        $cat_name = wp_specialchars($cat_name);
    164164                        if ( $cat_id != $category )
    165165                            $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
     
    181181                default:
    182182                    ?>
    183                     <td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
     183                    <td><?php do_action('manage_link_custom_column', $column_name, $id); ?></td>
    184184                    <?php
    185185                    break;
  • tags/2.1.3/wp-admin/menu.php

    r5480 r5468  
    77$menu[0] = array(__('Dashboard'), 'read', 'index.php');
    88
    9 if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false)
     9if ( strstr($_SERVER['REQUEST_URI'], 'edit-pages.php') )
    1010    $menu[5] = array(__('Write'), 'edit_pages', 'page-new.php');
    1111else
    1212    $menu[5] = array(__('Write'), 'edit_posts', 'post-new.php');
    13 if (strpos($_SERVER['REQUEST_URI'], 'page-new.php') !== false)
     13if ( strstr($_SERVER['REQUEST_URI'], 'page-new.php') )
    1414    $menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
    1515else
    1616    $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
    17 
     17   
    1818$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
    1919$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
     
    7070$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php');
    7171
    72 do_action('_admin_menu');
    73 
    7472// Create list of page plugin hook names.
    7573foreach ($menu as $menu_page) {
     
    107105        $_wp_real_parent_file[$old_parent] = $new_parent;
    108106        $menu[$id][2] = $new_parent;
    109 
     107       
    110108        foreach ($submenu[$old_parent] as $index => $data) {
    111109            $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
  • tags/2.1.3/wp-admin/moderation.php

    r5480 r5468  
    122122    <p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
    123123<?php comment_text() ?>
    124 <p><?php comment_date(__('M j, g:i A')); ?> &#8212; [ <?php
     124<p><?php comment_date('M j, g:i A'); ?> &#8212; [ <?php
    125125echo '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';
    126126echo " <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete') . "</a> | "; ?>
  • tags/2.1.3/wp-admin/options-general.php

    r5480 r5468  
    2626<tr valign="top">
    2727<th scope="row"><?php _e('WordPress address (URL):') ?></th>
    28 <td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
     28<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></td>
    2929</tr>
    3030<tr valign="top">
    3131<th scope="row"><?php _e('Blog address (URL):') ?></th>
    32 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></td>
     32<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
    3333</tr>
    3434<tr valign="top">
     
    9898<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    9999<input type="hidden" name="action" value="update" />
    100 <input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
     100<input type="hidden" name="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role" />
    101101</p>
    102102</form>
  • tags/2.1.3/wp-admin/options-head.php

    r5480 r5468  
    11<?php wp_reset_vars(array('action', 'standalone', 'option_group_id')); ?>
     2
     3<br clear="all" />
    24
    35<?php if (isset($_GET['updated'])) : ?>
  • tags/2.1.3/wp-admin/options-misc.php

    r5480 r5468  
    3737
    3838<p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_option('use_linksupdate')); ?> />
    39 <label for="use_linksupdate"><?php _e('Track Links&#8217; Update Times') ?></label></p>
     39<label for="use_linksupdate"><?php _e('Track Bookmarks&#8217; Update Times') ?></label></p>
    4040<p>
    4141<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_option('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label>
  • tags/2.1.3/wp-admin/options-writing.php

    r5480 r5468  
    4242</tr>
    4343<tr valign="top">
    44 <th scope="row"><?php _e('Default link category:') ?></th>
     44<th scope="row"><?php _e('Default bookmark category:') ?></th>
    4545<td><select name="default_link_category" id="default_link_category">
    4646<?php
     
    104104<?php else : ?>
    105105
    106     <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog\'s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?>
     106    <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog\'s <a href="%s">privacy settings</a>'), 'options-privacy.php'); ?>
    107107
    108108<?php endif; ?>
  • tags/2.1.3/wp-admin/options.php

    r5480 r5468  
    7979    }
    8080
    81     return $value;
     81    return $value; 
    8282}
    8383
     
    149149<td>";
    150150
    151     if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
     151    if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
    152152    else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
    153 
     153   
    154154    echo "</td>
    155155    <td>$option->option_description</td>
  • tags/2.1.3/wp-admin/page-new.php

    r5480 r5468  
    55$editing = true;
    66wp_enqueue_script('prototype');
    7 wp_enqueue_script('interface');
    87wp_enqueue_script('autosave');
    98require_once('admin-header.php');
  • tags/2.1.3/wp-admin/page.php

    r5480 r5468  
    5353    if($post->post_status == 'draft') {
    5454        wp_enqueue_script('prototype');
    55         wp_enqueue_script('interface');
    5655        wp_enqueue_script('autosave');
    5756    }
     
    6261
    6362    include('edit-page-form.php');
     63    ?>
     64    <div id='preview' class='wrap'>
     65    <h2 id="preview-post"><?php _e('Page Preview (updated when page is saved)'); ?></h2>
     66        <iframe src="<?php echo clean_url(apply_filters('preview_page_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
     67    </div>
     68    <?php
    6469    break;
    6570
     
    102107
    103108        if ( isset($_POST['save']) )
    104             $location = "page.php?action=edit&post=$page_ID";
     109            $location = "page.php?action=edit&post=$page_ID";       
    105110    } else {
    106111        if ($_POST['save']) {
     
    143148
    144149    $sendback = wp_get_referer();
    145     if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
    146     elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
     150    if (strstr($sendback, 'page.php')) $sendback = get_option('siteurl') .'/wp-admin/page.php';
     151    elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
    147152    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    148153    wp_redirect($sendback);
  • tags/2.1.3/wp-admin/plugin-editor.php

    r5480 r5468  
    3131        fwrite($f, $newcontent);
    3232        fclose($f);
    33 
    34         // Deactivate so we can test it.
    35         $current = get_option('active_plugins');
    36         if ( in_array($file, $current) || isset($_POST['phperror']) ) {
    37             if ( in_array($file, $current) ) {
    38                 array_splice($current, array_search( $file, $current), 1 ); // Array-fu!
    39                 update_option('active_plugins', $current);
    40             }
    41             wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1"));
    42             exit();
    43         }
    4433        wp_redirect("plugin-editor.php?file=$file&a=te");
    4534    } else {
     
    5544    if ( !current_user_can('edit_plugins') )
    5645        wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
    57 
    58     if ( $_GET['liveupdate'] ) {
    59         check_admin_referer('edit-plugin-test_' . $file);
    60         $current = get_option('active_plugins');
    61         $plugin = $file;
    62         if ( validate_file($plugin) )
    63             wp_die(__('Invalid plugin.'));
    64         if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
    65             wp_die(__('Plugin file does not exist.'));
    66         if (!in_array($plugin, $current)) {
    67             wp_redirect("plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
    68             @include(ABSPATH . PLUGINDIR . '/' . $plugin);
    69             $current[] = $plugin;
    70             sort($current);
    71             update_option('active_plugins', $current);
    72         }
    73         wp_redirect("plugin-editor.php?file=$file&a=te");
    74     }
    7546
    7647    require_once('admin-header.php');
     
    9061<?php if (isset($_GET['a'])) : ?>
    9162 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
    92 <?php elseif (isset($_GET['phperror'])) : ?>
    93  <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p></div>
    9463<?php endif; ?>
    9564 <div class="wrap">
    9665    <?php
    97     if ( in_array($file, (array) get_option('active_plugins')) ) {
    98         if (is_writeable($real_file)) {
    99             echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (active)'), $file) . '</h2>';
    100         } else {
    101         echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (active)'), $file) . '</h2>';
    102         }
     66    if (is_writeable($real_file)) {
     67        echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
    10368    } else {
    104         if (is_writeable($real_file)) {
    105             echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (inactive)'), $file) . '</h2>';
    106         } else {
    107         echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file) . '</h2>';
    108         }
     69        echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file) . '</h2>';
    10970    }
    11071    ?>
     
    13091        </div>
    13192<?php if ( is_writeable($real_file) ) : ?>
    132     <?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
    133         <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
    134     <?php } ?>
    13593    <p class="submit">
    13694    <?php
    137         if ( isset($_GET['phperror']) )
    138             echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' value='" . __('Update File and Attempt to Reactivate &raquo;') . "' tabindex='2' />";
    139         else
    140             echo "<input type='submit' name='submit' value='" . __('Update File &raquo;') . "' tabindex='2' />";
     95        echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
    14196    ?>
    14297    </p>
  • tags/2.1.3/wp-admin/plugins.php

    r5480 r5468  
    1212            wp_die(__('Plugin file does not exist.'));
    1313        if (!in_array($plugin, $current)) {
    14             wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error
    15             ob_start();
    16             @include(ABSPATH . PLUGINDIR . '/' . $plugin);
    1714            $current[] = $plugin;
    1815            sort($current);
    1916            update_option('active_plugins', $current);
     17            include(ABSPATH . PLUGINDIR . '/' . $plugin);
    2018            do_action('activate_' . $plugin);
    21             ob_end_clean();
    2219        }
    23         wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
     20        wp_redirect('plugins.php?activate=true');
    2421    } else if ('deactivate' == $_GET['action']) {
    2522        check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
     
    2926        do_action('deactivate_' . trim( $_GET['plugin'] ));
    3027        wp_redirect('plugins.php?deactivate=true');
    31     } elseif ($_GET['action'] == 'deactivate-all') {
    32         check_admin_referer('deactivate-all');
    33         $current = get_option('active_plugins');
    34        
    35         foreach ($current as $plugin) {
    36             array_splice($current, array_search($plugin, $current), 1);
    37             do_action('deactivate_' . $plugin);
    38         }
    39        
    40         update_option('active_plugins', array());
    41         wp_redirect('plugins.php?deactivate-all=true');
    4228    }
    4329    exit;
     
    7359?>
    7460
    75 <?php if ( isset($_GET['error']) ) : ?>
    76     <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p></div>
    77 <?php elseif ( isset($_GET['activate']) ) : ?>
    78     <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
    79 <?php elseif ( isset($_GET['deactivate']) ) : ?>
    80     <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
    81 <?php elseif (isset($_GET['deactivate-all'])) : ?>
    82     <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
     61<?php if (isset($_GET['activate'])) : ?>
     62<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p>
     63</div>
     64<?php endif; ?>
     65<?php if (isset($_GET['deactivate'])) : ?>
     66<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p>
     67</div>
    8368<?php endif; ?>
    8469
     
    132117        if ( $style != '' )
    133118            $style = 'class="' . $style . '"';
    134         if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) )
     119        if ( is_writable(ABSPATH . 'wp-content/plugins/' . $plugin_file) )
    135120            $edit = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
    136121        else
     
    151136?>
    152137
    153 <tr>
    154     <td colspan="3">&nbsp;</td>
    155     <td colspan="2" style="width:12em;"><a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a></td>
    156 </tr>
    157 
    158138</table>
    159139<?php
  • tags/2.1.3/wp-admin/post-new.php

    r5480 r5468  
    55$editing = true;
    66wp_enqueue_script('prototype');
    7 wp_enqueue_script('interface');
    87wp_enqueue_script('autosave');
    98require_once ('./admin-header.php');
  • tags/2.1.3/wp-admin/post.php

    r5480 r5468  
    4848    $post_ID = $p = (int) $_GET['post'];
    4949    $post = get_post($post_ID);
    50 
     50   
    5151    if ( 'page' == $post->post_type ) {
    5252        wp_redirect("page.php?action=edit&post=$post_ID");
     
    6767    include('edit-form-advanced.php');
    6868
     69    ?>
     70    <div id='preview' class='wrap'>
     71    <h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?></h2>
     72        <iframe src="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
     73    </div>
     74    <?php
    6975    break;
    7076
     
    114120            $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
    115121        $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
    116 
     122   
    117123        if ($_POST['save']) {
    118124            $location = "post.php?action=edit&post=$post_ID";
     
    155161
    156162    $sendback = wp_get_referer();
    157     if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
    158     elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
     163    if (strstr($sendback, 'post.php')) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
     164    elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
    159165    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    160166    wp_redirect($sendback);
  • tags/2.1.3/wp-admin/rtl.css

    r5480 r5468  
    1515#wphead h1 { font-size: 2.4em; }
    1616
    17 #postdiv, #titlediv, #guiddiv, #tagdiv { margin: 0 0 0 8px; }
     17#postdiv , #titlediv, #guiddiv { margin: 0 0 0 8px; }
    1818
    1919#ed_toolbar input { margin: 3px 0 2px 2px; }
     
    4343#adminmenu {
    4444    padding: .2em 2em .3em .2em;
    45     height: 28px;
     45    height: 30px;
    4646}
    47 
    48 #adminmenu li { line-height: 160%; }
    4947
    5048#adminmenu a {
     
    5957}
    6058
    61 #submenu, #minisub { padding: 1px 3em 0 2em; }
     59#adminmenu li { line-height: 180%; }
    6260
    63 #submenu { height: 28px; }
     61#submenu, #minisub { padding: 3px 3em 0 2em; }
    6462
    65 #submenu li { line-height: 160%; }
     63#submenu .current {
     64    border-right: 0;
     65    border-left: 2px solid #045290;
     66}
    6667
    6768#submenu a {
     69    padding: .3em .4em .4em .4em;
    6870    margin: 0 0 0 10px;
    6971    display: block;
     
    7173}
    7274
    73 #submenu .current {
    74     border-right: 0;
    75     border-left: 2px solid #045290;
    76 }
     75#submenu li { line-height: 120%; }
    7776
    7877#currenttheme img {
     
    9291}
    9392
    94 #postexcerpt div, #attachmentlinks div {
    95     margin-right: auto;
    96     margin-left: 8px;
    97 }
    98 
    99 * html #postexcerpt .dbx-toggle-open {
     93* html #postexcerpt .dbx-toggle-open, * html #postexcerpt .dbx-toggle-open, #postexcerpt div, #attachmentlinks div {
    10094    padding-right: 0;
    10195    padding-left: 8px;
     
    197191    margin-left: 3px;
    198192}
    199 
    200 a.view-link {
    201     right:auto;
    202     left:5%;
    203     margin-right:0;
    204     margin-left:220px;
    205 }
  • tags/2.1.3/wp-admin/setup-config.php

    r5480 r5468  
    158158        switch (substr($line,0,16)) {
    159159            case "define('DB_NAME'":
    160                 fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line));
     160                fwrite($handle, str_replace("wordpress", $dbname, $line));
    161161                break;
    162162            case "define('DB_USER'":
    163                 fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line));
     163                fwrite($handle, str_replace("'username'", "'$uname'", $line));
    164164                break;
    165165            case "define('DB_PASSW":
    166                 fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line));
     166                fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
    167167                break;
    168168            case "define('DB_HOST'":
  • tags/2.1.3/wp-admin/templates.php

    r5480 r5468  
    5353        wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
    5454
    55     if (strpos($file, 'wp-config.php') !== false)
     55    if ( strstr( $file, 'wp-config.php' ) )
    5656    wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
    5757
  • tags/2.1.3/wp-admin/themes.php

    r5480 r5468  
    2727<div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
    2828<?php elseif ( isset($_GET['activated']) ) : ?>
    29 <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('url') . '/'); ?></p></div>
     29<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div>
    3030<?php endif; ?>
    3131
  • tags/2.1.3/wp-admin/upgrade-functions.php

    r5480 r5468  
    2222    update_option('blog_public', $public);
    2323    $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
    24 
    25     if ( defined('WP_SITEURL') && '' != WP_SITEURL )
    26         $guessurl = WP_SITEURL;
    27     else
    28         $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    29 
     24    $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    3025    update_option('siteurl', $guessurl);
    3126
     
    176171        upgrade_130();
    177172    }
    178    
    179     maybe_disable_automattic_widgets();
    180173
    181174    if ( $wp_current_db_version < 3308 )
     
    660653function __get_option($setting) {
    661654    global $wpdb;
    662    
    663     if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
    664         return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
    665     }
    666    
    667     if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
    668         return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
    669     }
    670    
     655
    671656    $option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
    672657
     
    938923        if ($oldfile == 'index.php') { // Check to make sure it's not a new index
    939924            $index = implode('', file("$oldpath/$oldfile"));
    940             if (strpos($index, 'WP_USE_THEMES') !== false) {
     925            if ( strstr( $index, 'WP_USE_THEMES' ) ) {
    941926                if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
    942927                    return false;
     
    1010995
    1011996        foreach ($stylelines as $line) {
    1012             if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
    1013             elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
    1014             elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
    1015             elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
    1016             elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
    1017             fwrite($f, $line . "\n");
     997            if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
     998            elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
     999            elseif (strstr($line, "Description:")) $line = "Description: Your theme";
     1000            elseif (strstr($line, "Version:")) $line = "Version: 1";
     1001            elseif (strstr($line, "Author:")) $line = "Author: You";
     1002            fwrite($f, "{$line}\n");
    10181003        }
    10191004        fclose($f);
     
    11101095}
    11111096
    1112 function maybe_disable_automattic_widgets() {
    1113     $plugins = __get_option( 'active_plugins' );
    1114    
    1115     foreach ( (array) $plugins as $plugin ) {
    1116         if ( basename( $plugin ) == 'widgets.php' ) {
    1117             array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
    1118             update_option( 'active_plugins', $plugins );
    1119             break;
    1120         }
    1121     }
    1122 }
    1123 
    11241097?>
  • tags/2.1.3/wp-admin/upgrade-schema.php

    r5480 r5468  
    11<?php
    22// Here we keep the DB structure and option values
    3 
    4 $charset_collate = '';
    5 
    6 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
    7     if ( ! empty($wpdb->charset) )
    8         $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    9     if ( ! empty($wpdb->collate) )
    10         $charset_collate .= " COLLATE $wpdb->collate";
    11 }
    123
    134$wp_queries="CREATE TABLE $wpdb->categories (
     
    2314  PRIMARY KEY  (cat_ID),
    2415  KEY category_nicename (category_nicename)
    25 ) $charset_collate;
     16);
    2617CREATE TABLE $wpdb->comments (
    2718  comment_ID bigint(20) unsigned NOT NULL auto_increment,
     
    4334  KEY comment_approved (comment_approved),
    4435  KEY comment_post_ID (comment_post_ID)
    45 ) $charset_collate;
     36);
    4637CREATE TABLE $wpdb->link2cat (
    4738  rel_id bigint(20) NOT NULL auto_increment,
     
    5041  PRIMARY KEY  (rel_id),
    5142  KEY link_id (link_id,category_id)
    52 ) $charset_collate;
     43);
    5344CREATE TABLE $wpdb->links (
    5445  link_id bigint(20) NOT NULL auto_increment,
     
    6960  KEY link_category (link_category),
    7061  KEY link_visible (link_visible)
    71 ) $charset_collate;
     62);
    7263CREATE TABLE $wpdb->options (
    7364  option_id bigint(20) NOT NULL auto_increment,
     
    8475  PRIMARY KEY  (option_id,blog_id,option_name),
    8576  KEY option_name (option_name)
    86 ) $charset_collate;
     77);
    8778CREATE TABLE $wpdb->post2cat (
    8879  rel_id bigint(20) NOT NULL auto_increment,
     
    9182  PRIMARY KEY  (rel_id),
    9283  KEY post_id (post_id,category_id)
    93 ) $charset_collate;
     84);
    9485CREATE TABLE $wpdb->postmeta (
    9586  meta_id bigint(20) NOT NULL auto_increment,
     
    10091  KEY post_id (post_id),
    10192  KEY meta_key (meta_key)
    102 ) $charset_collate;
     93);
    10394CREATE TABLE $wpdb->posts (
    10495  ID bigint(20) unsigned NOT NULL auto_increment,
     
    129120  KEY post_name (post_name),
    130121  KEY type_status_date (post_type,post_status,post_date,ID)
    131 ) $charset_collate;
     122);
    132123CREATE TABLE $wpdb->users (
    133124  ID bigint(20) unsigned NOT NULL auto_increment,
     
    143134  PRIMARY KEY  (ID),
    144135  KEY user_login_key (user_login)
    145 ) $charset_collate;
     136);
    146137CREATE TABLE $wpdb->usermeta (
    147138  umeta_id bigint(20) NOT NULL auto_increment,
     
    152143  KEY user_id (user_id),
    153144  KEY meta_key (meta_key)
    154 ) $charset_collate;";
     145);";
    155146
    156147function populate_options() {
  • tags/2.1.3/wp-admin/upgrade.php

    r5480 r5468  
    99
    1010if (isset($_GET['step']))
    11     $step = (int) $_GET['step'];
     11    $step = $_GET['step'];
    1212else
    1313    $step = 0;
     
    2626<body>
    2727<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
    28 
    29 <?php if ( get_option('db_version') == $wp_db_version ) : ?>
    30 
    31 <h2><?php _e('No Upgrade Required'); ?></h2>
    32 <p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
    33 <h2 class="step"><a href="<?php echo get_option('home'); ?>/"><?php _e('Continue &raquo;'); ?></a></h2>
    34 
    35 <?php else :
    36 switch($step) :
     28<?php
     29switch($step) {
    3730    case 0:
    3831        $goback = clean_url(stripslashes(wp_get_referer()));
    39 ?>
    40 <h2><?php _e('Database Upgrade Required'); ?></h2>
    41 <p><?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?></p>
    42 <p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
     32?>
     33<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p>
    4334<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
    4435<?php
     
    4839
    4940        if ( empty( $_GET['backto'] ) )
    50             $backto = __get_option('home') . '/';
     41            $backto = __get_option('home');
    5142        else
    5243            $backto = clean_url(stripslashes($_GET['backto']));
    5344?>
    54 <h2><?php _e('Upgrade Complete'); ?></h2>
    55     <p><?php _e('Your WordPress database has been successfully upgraded!'); ?></p>
    56     <h2 class="step"><a href="<?php echo $backto; ?>"><?php _e('Continue &raquo;'); ?></a></h2>
     45<h2><?php _e('Step 1'); ?></h2>
     46    <p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"),  $backto); ?></p>
    5747
    5848<!--
     
    6656<?php
    6757        break;
    68 endswitch;
    69 endif;
     58}
    7059?>
    7160</body>
  • tags/2.1.3/wp-admin/upload-functions.php

    r5480 r5468  
    1414    if ( isset($attachment_data['width']) )
    1515        list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
    16 
     16       
    1717    ob_start();
    1818        the_title();
    1919        $post_title = attribute_escape(ob_get_contents());
    2020    ob_end_clean();
    21     $post_content = attribute_escape(apply_filters( 'content_edit_pre', $post->post_content ));
    22 
     21    $post_content = apply_filters( 'content_edit_pre', $post->post_content );
     22   
    2323    $class = 'text';
    2424    $innerHTML = get_attachment_innerHTML( $id, false, $dims );
     
    3636
    3737    if ( $href )
    38         $r .= "<a id='file-link-$id' href='$href' title='$post_title' class='file-link $class'>\n";
     38        $r .= "<a id='file-link-$id' href='" . clean_url($href) ."' title='$post_title' class='file-link $class'>\n";
    3939    if ( $href || $image_src )
    4040        $r .= "\t\t\t$innerHTML";
     
    286286    global $wpdb, $action, $paged;
    287287    $old_vars = compact( 'paged' );
    288 
     288   
    289289    switch ( $action ) :
    290290    case 'edit' :
     
    356356    }
    357357}
    358 
    359 ?>
  • tags/2.1.3/wp-admin/upload.css

    r5480 r5468  
    4545
    4646#upload-menu li #current-tab-nav {
    47     background: #f9fcfe;
    4847    float: left;
    4948    padding: 5px 5px 0 0;
  • tags/2.1.3/wp-admin/upload.php

    r5480 r5468  
    9090    $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
    9191    if ( isset($tab_array[4]) && is_array($tab_array[4]) )
    92         $href = add_query_arg( $tab_array[4], $href );
     92        add_query_arg( $tab_array[4], $href );
    9393    $_href = clean_url( $href);
    9494    $page_links = '';
  • tags/2.1.3/wp-admin/user-edit.php

    r5480 r5468  
    5656    <p><strong><?php _e('User updated.') ?></strong></p>
    5757    <?php if ( $wp_http_referer ) : ?>
    58     <p><a href="users.php"><?php _e('&laquo; Back to Authors and Users'); ?></a></p>
     58    <p><a href="<?php echo clean_url($wp_http_referer); ?>"><?php _e('&laquo; Back to Authors and Users'); ?></a></p>
    5959    <?php endif; ?>
    6060</div>
     
    8383<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
    8484</p>
    85 
    86 <p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></p>
    87 
    88 <p class="submit"><input type="submit" value="<?php _e('Update User &raquo;'); ?>" name="submit" /></p>
    8985
    9086<fieldset>
  • tags/2.1.3/wp-admin/users.php

    r5480 r5468  
    8686                'total' => ceil($this->total_users_for_query / $this->users_per_page),
    8787                'current' => $this->page,
    88                 'prev_text' => __('&laquo; Previous Page'),
    89                 'next_text' => __('Next Page &raquo;'),
     88                'prev_text' => '&laquo; Previous Page',
     89                'next_text' => 'Next Page &raquo;',
    9090                'base' => 'users.php?%_%',
    9191                'format' => 'userspage=%#%',
     
    339339
    340340    <form action="" method="get" name="search" id="search">
    341         <p><input type="text" name="usersearch" id="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php _e('Search Users &raquo;'); ?>" class="button" /></p>
     341        <p><input type="text" name="usersearch" id="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php _e('Search   users &raquo;'); ?>" class="button" /></p>
    342342    </form>
    343343
     
    451451<div class="narrow">
    452452
    453 <?php
    454     if ( get_option('users_can_register') )
    455         echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_option('siteurl').'/wp-register.php') . '</p>';
    456     else
    457         echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), get_option('siteurl').'/wp-admin/options-general.php#users_can_register') . '</p>';
    458 ?>
     453<?php echo '<p>'.sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_option('siteurl').'/wp-register.php').'</p>'; ?>
    459454<form action="#add-new-user" method="post" name="adduser" id="adduser">
    460455<?php wp_nonce_field('add-user') ?>
  • tags/2.1.3/wp-admin/wp-admin.css

    r5480 r5468  
    202202    border: 1px solid #b2b2b2;
    203203    color: #000;
    204     font: 13px Verdana, Arial, Helvetica, sans-serif;
     204    font:  13px Verdana, Arial, Helvetica, sans-serif;
    205205    margin: 1px;
    206206    padding: 3px;
     
    209209#uploading {
    210210    border-style: none;
    211     padding: 0;
     211    padding: 0px;
    212212    margin-bottom: 16px;
    213213    height: 18em;
     
    293293}
    294294
    295 .commentlist li li {
    296     border-bottom: 0px;
    297     padding: 0;
    298 }
    299 
    300295.commentlist p {
    301296    padding: 0;
     
    465460}
    466461
     462
    467463#adminmenu .current, #submenu .current {
    468464    font-weight: bold;
     
    489485    list-style: none;
    490486    text-align: center;
    491     white-space: nowrap;
    492487}
    493488
     
    535530}
    536531
     532
    537533#categorydiv input, #poststatusdiv input, #commentstatusdiv input, #pingstatusdiv input {
    538534    border: none;
     
    541537#postdiv, #titlediv, #guiddiv {
    542538    margin: 0 8px 0 0;
    543     padding: 0;
     539    padding: 0px;
    544540}
    545541
    546542#postdivrich {
    547     margin: 0;
    548     padding: 0;
     543    margin: 0px;
     544    padding: 0px;
    549545}
    550546
    551547#content {
    552     margin: 0;
     548    margin: 0 0 0 0;
    553549    width: 100%;
    554550}
    555551
    556552#postdivrich #content {
    557     padding: 5px;
     553    padding: .7em;
    558554    line-height: 140%;
    559555}
    560556
    561557#titlediv input, #guiddiv input {
    562     margin: 0;
     558    margin: 0px;
    563559    width: 100%;
    564560}
     
    584580#postdivrich #quicktags {
    585581    background: #f0f0ee;
    586     padding: 0;
     582    padding: 0px;
    587583    border: 1px solid #ccc;
    588584    border-bottom: none;
     
    598594
    599595#quicktags #ed_toolbar {
    600     padding: 0 2px;
     596    padding: 0px 2px;
    601597}
    602598
    603599#ed_toolbar input {
    604     background: #fff url( images/fade-butt.png ) repeat-x 0 -2px;
     600    background: #fff url( images/fade-butt.png ) repeat-x 0px -2px;
    605601    margin: 3px 2px 2px;
    606602}
     
    630626#title {
    631627    font-size: 1.7em;
    632     padding: 4px 3px;
     628    padding: 4px;
    633629}
    634630
     
    648644
    649645#excerpt, .attachmentlinks {
    650     margin: 0;
     646    margin: 0px;
    651647    height: 4em;
    652648    width: 100%;
     
    733729    display: block;
    734730    border-bottom: none;
    735     text-indent: -9999px;
     731}
     732
     733#login .hide {
     734    display: none;
    736735}
    737736
     
    816815#postcustom table {
    817816    border: 1px solid #ccc;
    818     margin: 0;
     817    margin: 0px;
    819818    width: 100%;
    820819}
     
    837836
    838837* html #template div {
    839     margin-right: 0;
     838    margin-right: 0px;
    840839}
    841840
     
    892891    letter-spacing: -.05em;
    893892    margin: 0;
    894     font-family: Georgia, "Times New Roman", Times, serif;
     893    font-family: Georgia, "Times New Roman", Times, serif
    895894}
    896895
     
    969968set display:none; */
    970969.zerosize {
    971     height: 0;
    972     width: 0;
    973     margin: 0;
    974     border: 0;
    975     padding: 0;
     970    height: 0px;
     971    width: 0px;
     972    margin: 0px;
     973    border: 0px;
     974    padding: 0px;
    976975    overflow: hidden;
    977976    position: absolute;
     
    980979/* Box stuff */
    981980.dbx-clone {
    982     position: absolute;
    983     visibility: hidden;
     981    position:absolute;
     982    visibility:hidden;
    984983}
    985984.dbx-clone, .dbx-clone .dbx-handle-cursor {
    986     cursor: move !important;
     985    cursor:move !important;
    987986}
    988987.dbx-dummy {
    989     display: block;
    990     width: 0;
    991     height: 0;
    992     overflow: hidden;
     988    display:block;
     989    width:0;
     990    height:0;
     991    overflow:hidden;
    993992}
    994993.dbx-group, .dbx-box, .dbx-handle {
    995     position: relative;
    996     display: block;
     994    position:relative;
     995    display:block;
    997996}
    998997
     
    10021001
    10031002* html #themeselect {
    1004     padding: 0 3px;
     1003    padding: 0px 3px;
    10051004    height: 22px;
    10061005}
     
    10121011*****************************************************************/
    10131012.dbx-box {
    1014     margin: 0;
    1015     padding: 0;
    1016     border: none;
     1013    margin:0;
     1014    padding:0;
     1015    border:none;
    10171016}
    10181017
     
    10221021}
    10231022#moremeta fieldset div {
    1024     margin: 2px 0 0 0;
     1023    margin: 2px 0 0 0px;
    10251024    padding: 7px;
    10261025}
     
    10851084}
    10861085
    1087 #your-profile fieldset input {
     1086#your-profile fieldset input  {
    10881087    width: 100%;
    10891088    font-size: 20px;
     
    11241123/* handles */
    11251124
    1126 .dbx-handle {
     1125.dbx-handle  {
    11271126    background: #2685af;
    11281127    padding: 6px 1em 2px;
     
    11591158    margin-left: 8px;
    11601159    background: url(images/box-bg-right.gif) repeat-y right;
    1161     padding: 10px 10px 15px 0;
     1160    padding: 10px 10px 15px 0px;
    11621161}
    11631162
     
    11921191}
    11931192
     1193
    11941194/* handle cursors */
    11951195.dbx-handle-cursor {
     
    11991199/* toggle images */
    12001200a.dbx-toggle, a.dbx-toggle:visited {
    1201     display: block;
     1201    display:block;
    12021202    overflow: hidden;
    12031203    background-image: url( images/toggle.gif );
    12041204    position: absolute;
    1205     top: 0;
    1206     right: 0;
     1205    top: 0px;
     1206    right: 0px;
    12071207    background-repeat: no-repeat;
    1208     border: 0;
    1209     margin: 0;
    1210     padding: 0;
     1208    border: 0px;
     1209    margin: 0px;
     1210    padding: 0px;
    12111211}
    12121212
     
    12141214    height: 25px;
    12151215    width: 27px;
    1216     background-position: 0 0;
     1216    background-position: 0 0px;
    12171217}
    12181218
     
    12971297
    12981298#edButtons input, #edButtons input:active {
    1299     margin: 0 2px -1px;
     1299    margin: 0px 2px -1px;
    13001300}
    13011301
     
    13061306
    13071307#edButtons input.edButtonBack, #edButtons input.edButtonBack:active {
    1308     background: #fff url( images/fade-butt.png ) repeat-x 0 15px;
     1308    background: #fff url( images/fade-butt.png ) repeat-x 0px 15px;
    13091309    border-bottom: 1px solid #ccc;
    13101310}
     
    13331333    margin: 0 6px;
    13341334}
    1335 
    1336 a.view-link {
    1337     position: absolute;
    1338     right: 5%;
    1339     margin-right: 220px;
    1340     text-decoration:underline;
    1341 }
  • tags/2.1.3/wp-atom.php

    r5480 r5468  
    66}
    77
    8 require (ABSPATH . WPINC . '/feed-atom.php');
     8header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true);
     9$more = 1;
    910
    1011?>
     12<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     13<feed version="0.3"
     14    xmlns="http://purl.org/atom/ns#"
     15    xmlns:dc="http://purl.org/dc/elements/1.1/"
     16    xml:lang="<?php echo get_option('rss_language'); ?>"
     17    <?php do_action('atom_ns'); ?>
     18>
     19    <title><?php bloginfo_rss('name') ?></title>
     20    <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
     21    <tagline><?php bloginfo_rss("description") ?></tagline>
     22    <modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified>
     23    <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright>
     24    <generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
     25    <?php do_action('atom_head'); ?>
     26    <?php while (have_posts()) : the_post(); ?>
     27    <entry>
     28        <author>
     29            <name><?php the_author() ?></name>
     30        </author>
     31        <title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
     32        <link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
     33        <id><?php the_guid(); ?></id>
     34        <modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
     35        <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
     36        <?php the_category_rss('rdf') ?>
     37        <summary type="<?php bloginfo('html_type'); ?>" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
     38<?php if ( !get_option('rss_use_excerpt') ) : ?>
     39        <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
     40<?php endif; ?>
     41<?php rss_enclosure(); ?>
     42<?php do_action('atom_entry'); ?>
     43    </entry>
     44    <?php endwhile ; ?>
     45</feed>
  • tags/2.1.3/wp-blog-header.php

    r5480 r5468  
    33if (! isset($wp_did_header)):
    44if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
    5     if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
     5    if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = '';
    66    else $path = 'wp-admin/';
    77
    8     require_once( dirname(__FILE__) . '/wp-includes/classes.php');
    9     require_once( dirname(__FILE__) . '/wp-includes/functions.php');
    10     require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
    11     wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress &rsaquo; Error");
     8  require_once( dirname(__FILE__) . '/wp-includes/functions.php');
     9  wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress &rsaquo; Error");
    1210}
    1311