WordPress.org

Make WordPress Core

Changes in trunk [4431:3503]


Ignore:
Location:
trunk
Files:
23 added
84 deleted
155 edited

Legend:

Unmodified
Added
Removed
  • trunk/readme.html

    r4431 r3503  
    22<html xmlns="http://www.w3.org/1999/xhtml">
    33<head>
    4     <title>WordPress &rsaquo; ReadMe</title>
    5     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    6     <link rel="stylesheet" href="wp-admin/install.css" type="text/css" />
     4<title>WordPress &rsaquo; ReadMe</title>
     5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     6<style type="text/css" media="screen">
     7    <!--
     8    html {
     9        background: #eee;
     10    }
     11    body {
     12        background: #fff;
     13        color: #000;
     14        font-family: Georgia, "Times New Roman", Times, serif;
     15        margin-left: 25%;
     16        margin-right: 25%;
     17        padding: .2em 2em;
     18    }
     19   
     20    h1 {
     21        color: #006;
     22        font-size: 18px;
     23        font-weight: lighter;
     24    }
     25   
     26    h2 {
     27        font-size: 16px;
     28    }
     29   
     30    p, li, dt {
     31        line-height: 140%;
     32        padding-bottom: 2px;
     33    }
     34
     35    ul, ol {
     36        padding: 5px 5px 5px 20px;
     37    }
     38    -->
     39    </style>
    740</head>
    841<body>
    9 <h1 id="logo" style="text-align: center">
    10     <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
    11     <br /> Version 2.1-ALPHA
    12 </h1>
    13 <p style="text-align: center">Semantic Personal Publishing Platform</p>
    14 
     42<h1 style="text-align: center"><img alt="WordPress" src="http://wordpress.org/images/wordpress.gif" /> <br />
     43    Version 2.0</h1>
     44<p style="text-align: center"> Semantic Personal Publishing Platform </p>
    1545<h1>First Things First</h1>
    1646<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I'm proud to be a part of. Thousands of hours have gone into WordPress, and we're dedicated to making it better every day. Thank you for making it part of your world.</p>
    1747<p style="text-align: right;">&#8212; Matt Mullenweg </p>
    1848
    19 <h1>Installation: Famous 5-minute install</h1>
     49<h1 id="installation">Installation: Famous 5-minute install</h1>
    2050<ol>
    2151    <li>Unzip the package in an empty directory</li>
     
    3969<h2>Template Changes</h2>
    4070<p>If you have customized your templates you will probably have to make some changes to them. If you're converting your 1.2 or earlier templates, <a href="http://codex.wordpress.org/Upgrade_1.2_to_1.5">we've created a special guide for you</a>. </p>
    41 
    4271<h1>Online Resources</h1>
    4372<p>If you have any questions that aren't addressed in this document, please take advantage of WordPress' numerous online resources:</p>
    4473<dl>
    4574    <dt><a href="http://codex.wordpress.org/">The WordPress Codex </a></dt>
    46         <dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available. </dd>
     75    <dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available. </dd>
    4776    <dt><a href="http://wordpress.org/development/">The Development Blog</a></dt>
    48         <dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often. </dd>
     77    <dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often. </dd>
    4978    <dt><a href="http://planet.wordpress.org/">WordPress Planet </a></dt>
    50         <dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web. </dd>
     79    <dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web. </dd>
    5180    <dt><a href="http://wordpress.org/support/">WordPress Support Forums</a></dt>
    52         <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>
     81    <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>
    5382    <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 amoung people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (irc.freenode.net #wordpresss) </dd>
     83    <dd>Finally, there is an online chat channel that is used for discussion amoung people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (irc.freenode.net #wordpresss) </dd>
    5584</dl>
    5685
    57 <h1>System Recommendations</h1>
     86<h1 id="requirements">System Recommendations</h1>
    5887<ul>
    5988    <li>PHP version <strong>4.1</strong> or higher</li>
     
    6695<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>
    6796
    68 <h1>XML-RPC Interface</h1>
     97<h1 id="templates">XML-RPC Interface</h1>
    6998<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>
    7099
    71100<h1>Post via Email</h1>
    72 <p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL.</p>
    73 <p>Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address dicrete. The script will <i>delete</i> emails that are successfully posted.</p>
     101<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL. </p>
     102<p> Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address dicrete. The script will <i>delete</i> emails that are successfully posted. </p>
     103<h1 id="roles">User Roles </h1>
    74104
    75 <h1>User Roles</h1>
    76105<p>We've eliminated user levels in order to make way for the much more flexible roles system introduced in 2.0. You can <a href="http://codex.wordpress.org/Roles_and_Capabilities">read more about Roles and Capabilities on the Codex</a>.</p>
    77106
  • trunk/wp-admin/admin-db.php

    r4431 r3503  
    44    global $wpdb;
    55    $user_id = (int) $user_id;
    6     $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
     6    $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
    77    $query = apply_filters('get_users_drafts', $query);
    88    return $wpdb->get_results( $query );
     
    1515
    1616    $editable = get_editable_user_ids( $user_id );
    17 
     17   
    1818    if( !$editable ) {
    1919        $other_drafts = '';
    2020    } else {
    2121        $editable = join(',', $editable);
    22         $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
     22        $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
    2323    }
    2424
     
    3535    } else {
    3636        $editable = join(',', $editable);
    37         $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
     37        $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable)" );
    3838    }
    3939
     
    4343function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
    4444    global $wpdb;
    45 
     45   
    4646    $user = new WP_User( $user_id );
    47 
     47   
    4848    if ( ! $user->has_cap('edit_others_posts') ) {
    4949        if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
     
    5858    if ( $exclude_zeros )
    5959        $query .= " AND meta_value != '0'";
    60 
     60       
    6161    return $wpdb->get_col( $query );
    6262}
     
    8484
    8585    extract($catarr);
    86 
    87     if( trim( $cat_name ) == '' )
    88         return 0;
    8986
    9087    $cat_ID = (int) $cat_ID;
     
    9693        $update = false;
    9794
    98     $cat_name = apply_filters('pre_category_name', $cat_name);
    99    
     95    $cat_name = wp_specialchars($cat_name);
     96
    10097    if (empty ($category_nicename))
    10198        $category_nicename = sanitize_title($cat_name);
    10299    else
    103100        $category_nicename = sanitize_title($category_nicename);
    104     $category_nicename = apply_filters('pre_category_nicename', $category_nicename);
    105101
    106102    if (empty ($category_description))
    107103        $category_description = '';
    108     $category_description = apply_filters('pre_category_description', $category_description);
    109 
    110     $category_parent = (int) $category_parent;
    111     if ( empty($category_parent) || !get_category( $category_parent ) || $category_parent == $cat_ID )
     104
     105    if (empty ($category_parent))
    112106        $category_parent = 0;
    113107
    114     if ( isset($posts_private) )
    115         $posts_private = (int) $posts_private;
    116     else
    117         $posts_private = 0;
    118 
    119     if ( isset($links_private) )
    120         $links_private = (int) $links_private;
    121     else
    122         $links_private = 0;
    123 
    124108    if (!$update) {
    125         $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");
     109        $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent')");
    126110        $cat_ID = $wpdb->insert_id;
    127111    } else {
    128         $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");
    129     }
    130 
     112        $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'");
     113    }
     114   
    131115    if ( $category_nicename == '' ) {
    132116        $category_nicename = sanitize_title($cat_name, $cat_ID );
     
    170154
    171155    // Don't delete the default cat.
    172     if ( $cat_ID == get_option('default_category') )
     156    if (1 == $cat_ID)
    173157        return 0;
    174158
    175     if ( $cat_ID == get_option('default_link_category') )
    176         return 0;
    177 
    178159    $category = get_category($cat_ID);
    179160
     
    181162
    182163    // Delete the category.
    183     if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") )
    184         return 0;
     164    $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
    185165
    186166    // Update children to point to new parent.
    187167    $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
    188168
    189     // Only set posts and links to the default category if they're not in another category already.
    190     $default_cat = get_option('default_category');
    191     $posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'");
    192     if ( is_array($posts) ) foreach ($posts as $post_id) {
    193         $cats = wp_get_post_categories($post_id);
    194         if ( 1 == count($cats) )
    195             $cats = array($default_cat);
    196         else
    197             $cats = array_diff($cats, array($cat_ID));
    198         wp_set_post_categories($post_id, $cats);
    199     }
    200 
    201     $default_link_cat = get_option('default_link_category');
    202     $links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'");
    203     if ( is_array($links) ) foreach ($links as $link_id) {
    204         $cats = wp_get_link_cats($link_id);
    205         if ( 1 == count($cats) )
    206             $cats = array($default_link_cat);
    207         else
    208             $cats = array_diff($cats, array($cat_ID));
    209         wp_set_link_cats($link_id, $cats);
    210     }
    211    
     169    // TODO: Only set categories to general if they're not in another category already
     170    $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
     171
    212172    wp_cache_delete($cat_ID, 'category');
    213173    wp_cache_delete('all_category_ids', 'category');
     
    234194
    235195    if ($post_id)
    236         wp_set_post_categories($post_id, $cat_ids);
     196        wp_set_post_cats('', $post_id, $cat_ids);
    237197
    238198    return $cat_ids;
     
    270230
    271231    // FINALLY, delete user
    272     do_action('delete_user', $id);
    273 
    274232    $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
    275233    $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
     
    278236    wp_cache_delete($user->user_login, 'userlogins');
    279237
     238    do_action('delete_user', $id);
     239
    280240    return true;
    281241}
    282242
    283 function wp_revoke_user($id) {
    284     $id = (int) $id;
    285    
    286     $user = new WP_User($id);
    287     $user->remove_all_caps();   
     243function get_link($link_id, $output = OBJECT) {
     244    global $wpdb;
     245   
     246    $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
     247
     248    if ( $output == OBJECT ) {
     249        return $link;
     250    } elseif ( $output == ARRAY_A ) {
     251        return get_object_vars($link);
     252    } elseif ( $output == ARRAY_N ) {
     253        return array_values(get_object_vars($link));
     254    } else {
     255        return $link;
     256    }
    288257}
    289258
    290259function wp_insert_link($linkdata) {
    291260    global $wpdb, $current_user;
    292 
     261   
    293262    extract($linkdata);
    294263
    295264    $update = false;
    296 
    297265    if ( !empty($link_id) )
    298266        $update = true;
    299267
    300     if( trim( $link_name ) == '' )
    301         return 0;
    302     $link_name = apply_filters('pre_link_name', $link_name);
    303 
    304     if( trim( $link_url ) == '' )
    305         return 0;
    306     $link_url = apply_filters('pre_link_url', $link_url);
    307 
    308268    if ( empty($link_rating) )
    309         $link_rating = 0;
    310     else
    311         $link_rating = (int) $link_rating;
    312 
    313     if ( empty($link_image) )
    314         $link_image = '';
    315     $link_image = apply_filters('pre_link_image', $link_image);
     269        $link_rating = 0;   
    316270
    317271    if ( empty($link_target) )
    318         $link_target = '';
    319     $link_target = apply_filters('pre_link_target', $link_target);
     272        $link_target = ''; 
    320273
    321274    if ( empty($link_visible) )
    322275        $link_visible = 'Y';
    323     $link_visibile = preg_replace('/[^YNyn]/', '', $link_visible);
    324 
     276       
    325277    if ( empty($link_owner) )
    326278        $link_owner = $current_user->id;
    327     else
    328         $link_owner = (int) $link_owner;
    329279
    330280    if ( empty($link_notes) )
    331281        $link_notes = '';
    332     $link_notes = apply_filters('pre_link_notes', $link_notes);
    333 
    334     if ( empty($link_description) )
    335         $link_description = '';
    336     $link_description = apply_filters('pre_link_description', $link_description);
    337 
    338     if ( empty($link_rss) )
    339         $link_rss = '';
    340     $link_rss = apply_filters('pre_link_rss', $link_rss);
    341 
    342     if ( empty($link_rel) )
    343         $link_rel = '';
    344     $link_rel = apply_filters('pre_link_rel', $link_rel);
    345 
    346     // Make sure we set a valid category
    347     if (0 == count($link_category) || !is_array($link_category)) {
    348         $link_category = array(get_option('default_link_category'));
    349     }
    350282
    351283    if ( $update ) {
    352284        $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
    353285            link_name='$link_name', link_image='$link_image',
    354             link_target='$link_target',
     286            link_target='$link_target', link_category='$link_category',
    355287            link_visible='$link_visible', link_description='$link_description',
    356288            link_rating='$link_rating', link_rel='$link_rel',
     
    358290            WHERE link_id='$link_id'");
    359291    } else {
    360         $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
     292        $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
    361293        $link_id = $wpdb->insert_id;
    362294    }
    363 
    364     wp_set_link_cats($link_id, $link_category);
    365 
     295   
    366296    if ( $update )
    367297        do_action('edit_link', $link_id);
     
    376306
    377307    $link_id = (int) $linkdata['link_id'];
    378 
     308   
    379309    $link = get_link($link_id, ARRAY_A);
    380 
     310   
    381311    // Escape data pulled from DB.
    382312    $link = add_magic_quotes($link);
    383 
    384     // Passed link category list overwrites existing category list if not empty.
    385     if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
    386              && 0 != count($linkdata['link_category']) )
    387         $link_cats = $linkdata['link_category'];
    388     else
    389         $link_cats = $link['link_category'];
    390 
     313   
    391314    // Merge old and new fields with new fields overwriting old ones.
    392315    $linkdata = array_merge($link, $linkdata);
    393     $linkdata['link_category'] = $link_cats;
    394316
    395317    return wp_insert_link($linkdata);
     
    400322
    401323    do_action('delete_link', $link_id);
    402    
    403     $categories = wp_get_link_cats($link_id);
    404     if( is_array( $categories ) ) {
    405         foreach ( $categories as $category ) {
    406             $wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'");
    407             wp_cache_delete($category, 'category');
    408         }
    409     }
    410 
    411     $wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'");
    412     return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
    413 }
    414 
    415 function wp_get_link_cats($link_ID = 0) {
    416     global $wpdb;
    417 
    418     $sql = "SELECT category_id
    419         FROM $wpdb->link2cat
    420         WHERE link_id = $link_ID
    421         ORDER BY category_id";
    422 
    423     $result = $wpdb->get_col($sql);
    424 
    425     if ( !$result )
    426         $result = array();
    427 
    428     return array_unique($result);
    429 }
    430 
    431 function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
    432     global $wpdb;
    433     // If $link_categories isn't already an array, make it one:
    434     if (!is_array($link_categories) || 0 == count($link_categories))
    435         $link_categories = array(get_option('default_link_category'));
    436 
    437     $link_categories = array_unique($link_categories);
    438 
    439     // First the old categories
    440     $old_categories = $wpdb->get_col("
    441         SELECT category_id
    442         FROM $wpdb->link2cat
    443         WHERE link_id = $link_ID");
    444 
    445     if (!$old_categories) {
    446         $old_categories = array();
    447     } else {
    448         $old_categories = array_unique($old_categories);
    449     }
    450 
    451     // Delete any?
    452     $delete_cats = array_diff($old_categories,$link_categories);
    453 
    454     if ($delete_cats) {
    455         foreach ($delete_cats as $del) {
    456             $wpdb->query("
    457                 DELETE FROM $wpdb->link2cat
    458                 WHERE category_id = $del
    459                     AND link_id = $link_ID
    460                 ");
    461         }
    462     }
    463 
    464     // Add any?
    465     $add_cats = array_diff($link_categories, $old_categories);
    466 
    467     if ($add_cats) {
    468         foreach ($add_cats as $new_cat) {
    469             $wpdb->query("
    470                 INSERT INTO $wpdb->link2cat (link_id, category_id)
    471                 VALUES ($link_ID, $new_cat)");
    472         }
    473     }
    474    
    475     // Update category counts.
    476     $all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
    477     foreach ( $all_affected_cats as $cat_id ) {
    478         $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->link2cat, $wpdb->links WHERE $wpdb->links.link_id = $wpdb->link2cat.link_id AND category_id = '$cat_id'");
    479         $wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'");
    480         wp_cache_delete($cat_id, 'category');
    481     }
    482 }   // wp_set_link_cats()
     324    return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
     325}
    483326
    484327function post_exists($title, $content = '', $post_date = '') {
  • trunk/wp-admin/admin-footer.php

    r4431 r3503  
    11
    2 <div id="footer">
    3 <p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
    4 <p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br />
    5 <?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?></p>
     2<div id="footer"><p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
     3<p>
     4<a href="http://codex.wordpress.org/"><?php _e('Documentation'); ?></a> &#8212; <a href="http://wordpress.org/support/"><?php _e('Support Forums'); ?></a> <br />
     5<?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), number_format(timer_stop(), 2)); ?>
     6</p>
     7
    68</div>
    79<?php do_action('admin_footer', ''); ?>
    810<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
     11
     12<?php
     13if ( (substr(php_sapi_name(), 0, 3) == 'cgi') && spawn_pinger() ) {
     14    echo '<iframe id="pingcheck" src="' . get_settings('siteurl') .'/wp-admin/execute-pings.php?time=' . time() . '" style="border:none;width:1px;height:1px;"></iframe>';
     15}
     16?>
     17
    918</body>
    1019</html>
  • trunk/wp-admin/admin-functions.php

    r4431 r3503  
    11<?php
    22
     3// Creates a new post from the "Write Post" form using $_POST information.
    34function write_post() {
    4     $result = wp_write_post();
    5     if( is_wp_error($result) )
    6         wp_die( $result->get_error_message() );
    7     else
    8         return $result;
    9 }
    10 
    11 // Creates a new post from the "Write Post" form using $_POST information.
    12 function wp_write_post() {
    135    global $user_ID;
    146
    15     if ( 'page' == $_POST['post_type'] ) {
    16         if ( !current_user_can('edit_pages') )
    17             return new WP_Error('edit_pages', __('You are not allowed to create pages on this blog.'));
    18     } else {
    19         if ( !current_user_can('edit_posts') )
    20             return new WP_Error('edit_posts', __('You are not allowed to create posts or drafts on this blog.'));
    21     }
     7    if (!current_user_can('edit_posts'))
     8        die(__('You are not allowed to create posts or drafts on this blog.'));
    229
    2310    // Rename.
     
    2916    if (!empty ($_POST['post_author_override'])) {
    3017        $_POST['post_author'] = (int) $_POST['post_author_override'];
    31     } else {
     18    } else
    3219        if (!empty ($_POST['post_author'])) {
    3320            $_POST['post_author'] = (int) $_POST['post_author'];
     
    3623        }
    3724
    38     }
    39 
    40     if ($_POST['post_author'] != $_POST['user_ID']) {
    41         if ( 'page' == $_POST['post_type'] ) {
    42             if ( !current_user_can('edit_others_pages') )
    43                 return new WP_Error('edit_others_pages', __('You cannot create pages as this user.'));
    44         } else {
    45             if ( !current_user_can('edit_others_posts') )
    46                 return new WP_Error('edit_others_posts', __('You cannot post as this user.'));
    47 
    48         }
    49     }
     25    if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
     26        die(__('You cannot post as this user.'));
    5027
    5128    // What to do based on which button they pressed
     
    5835    if ('' != $_POST['advanced'])
    5936        $_POST['post_status'] = 'draft';
    60 
    61     if ( 'page' == $_POST['post_type'] ) {
    62         if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages'))
    63             $_POST['post_status'] = 'draft';
    64     } else {
    65         if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
    66             $_POST['post_status'] = 'draft';
    67     }
    68 
    69     if (!isset ($_POST['comment_status']))
    70         $_POST['comment_status'] = 'closed';
    71 
    72     if (!isset ($_POST['ping_status']))
    73         $_POST['ping_status'] = 'closed';
    74 
    75     if (!empty ($_POST['edit_date'])) {
    76         $aa = $_POST['aa'];
    77         $mm = $_POST['mm'];
    78         $jj = $_POST['jj'];
    79         $hh = $_POST['hh'];
    80         $mn = $_POST['mn'];
    81         $ss = $_POST['ss'];
    82         $jj = ($jj > 31) ? 31 : $jj;
    83         $hh = ($hh > 23) ? $hh -24 : $hh;
    84         $mn = ($mn > 59) ? $mn -60 : $mn;
    85         $ss = ($ss > 59) ? $ss -60 : $ss;
    86         $_POST['post_date'] = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss);
    87         $_POST['post_date_gmt'] = get_gmt_from_date($_POST['post_date']);
    88     }
    89 
    90     // Create the post.
    91     $post_ID = wp_insert_post($_POST);
    92     add_meta($post_ID);
    93 
    94     // Reunite any orphaned attachments with their parent
    95     if ( $_POST['temp_ID'] )
    96         relocate_children($_POST['temp_ID'], $post_ID);
    97 
    98     // Now that we have an ID we can fix any attachment anchor hrefs
    99     fix_attachment_links($post_ID);
    100 
    101     return $post_ID;
    102 }
    103 
    104 // Move child posts to a new parent
    105 function relocate_children($old_ID, $new_ID) {
    106     global $wpdb;
    107     $old_ID = (int) $old_ID;
    108     $new_ID = (int) $new_ID;
    109     return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID");
    110 }
    111 
    112 // Replace hrefs of attachment anchors with up-to-date permalinks.
    113 function fix_attachment_links($post_ID) {
    114     global $wp_rewrite;
    115 
    116     $post = & get_post($post_ID, ARRAY_A);
    117 
    118     $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
    119 
    120     // See if we have any rel="attachment" links
    121     if ( 0 == preg_match_all($search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER) )
    122         return;
    123 
    124     $i = 0;
    125     $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
    126     foreach ( $anchor_matches[0] as $anchor ) {
    127         if ( 0 == preg_match($search, $anchor, $id_matches) )
    128             continue;
    129 
    130         $id = $id_matches[3];
    131 
    132         // While we have the attachment ID, let's adopt any orphans.
    133         $attachment = & get_post($id, ARRAY_A);
    134         if ( ! empty($attachment) && ! is_object(get_post($attachment['post_parent'])) ) {
    135             $attachment['post_parent'] = $post_ID;
    136             // Escape data pulled from DB.
    137             $attachment = add_magic_quotes($attachment);
    138             wp_update_post($attachment);
    139         }
    140 
    141         $post_search[$i] = $anchor;
    142         $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
    143         ++$i;
    144     }
    145 
    146     $post['post_content'] = str_replace($post_search, $post_replace, $post['post_content']);
    147 
    148     // Escape data pulled from DB.
    149     $post = add_magic_quotes($post);
    150 
    151     return wp_update_post($post);
    152 }
    153 
    154 // Update an existing post with values provided in $_POST.
    155 function edit_post() {
    156     global $user_ID;
    157 
    158     $post_ID = (int) $_POST['post_ID'];
    159 
    160     if ( 'page' == $_POST['post_type'] ) {
    161         if ( !current_user_can('edit_page', $post_ID) )
    162             wp_die(__('You are not allowed to edit this page.'));
    163     } else {
    164         if ( !current_user_can('edit_post', $post_ID) )
    165             wp_die(__('You are not allowed to edit this post.'));
    166     }
    167 
    168     // Rename.
    169     $_POST['ID'] = (int) $_POST['post_ID'];
    170     $_POST['post_content'] = $_POST['content'];
    171     $_POST['post_excerpt'] = $_POST['excerpt'];
    172     $_POST['post_parent'] = $_POST['parent_id'];
    173     $_POST['to_ping'] = $_POST['trackback_url'];
    174 
    175     if (!empty ($_POST['post_author_override'])) {
    176         $_POST['post_author'] = (int) $_POST['post_author_override'];
    177     } else
    178         if (!empty ($_POST['post_author'])) {
    179             $_POST['post_author'] = (int) $_POST['post_author'];
    180         } else {
    181             $_POST['post_author'] = (int) $_POST['user_ID'];
    182         }
    183 
    184     if ($_POST['post_author'] != $_POST['user_ID']) {
    185         if ( 'page' == $_POST['post_type'] ) {
    186             if ( !current_user_can('edit_others_pages') )
    187                 wp_die(__('You cannot edit pages as this user.'));
    188         } else {
    189             if ( !current_user_can('edit_others_posts') )
    190                 wp_die(__('You cannot edit posts as this user.'));
    191 
    192         }
    193     }
    194 
    195     // What to do based on which button they pressed
    196     if ('' != $_POST['saveasdraft'])
     37    if ('' != $_POST['savepage'])
     38        $_POST['post_status'] = 'static';
     39
     40    if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
    19741        $_POST['post_status'] = 'draft';
    198     if ('' != $_POST['saveasprivate'])
    199         $_POST['post_status'] = 'private';
    200     if ('' != $_POST['publish'])
    201         $_POST['post_status'] = 'publish';
    202     if ('' != $_POST['advanced'])
    203         $_POST['post_status'] = 'draft';
    204 
    205     if ( 'page' == $_POST['post_type'] ) {
    206         if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages'))
    207             $_POST['post_status'] = 'draft';
    208     } else {
    209         if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts'))
    210             $_POST['post_status'] = 'draft';
    211     }
    212 
    213     if (!isset ($_POST['comment_status']))
    214         $_POST['comment_status'] = 'closed';
    215 
    216     if (!isset ($_POST['ping_status']))
    217         $_POST['ping_status'] = 'closed';
     42
     43    if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
     44        die(__('This user cannot edit pages.'));
    21845
    21946    if (!empty ($_POST['edit_date'])) {
     
    23259    }
    23360
     61    // Create the post.
     62    $post_ID = wp_insert_post($_POST);
     63    add_meta($post_ID);
     64
     65    // Reunite any orphaned attachments with their parent
     66    if ( $_POST['temp_ID'] )
     67        relocate_children($_POST['temp_ID'], $post_ID);
     68
     69    // Now that we have an ID we can fix any attachment anchor hrefs
     70    fix_attachment_links($post_ID);
     71
     72    return $post_ID;
     73}
     74
     75// Move child posts to a new parent
     76function relocate_children($old_ID, $new_ID) {
     77    global $wpdb;
     78    $old_ID = (int) $old_ID;
     79    $new_ID = (int) $new_ID;
     80    return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID");
     81}
     82
     83// Replace hrefs of attachment anchors with up-to-date permalinks.
     84function fix_attachment_links($post_ID) {
     85    global $wp_rewrite;
     86
     87    $post = & get_post($post_ID);
     88
     89    $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
     90
     91    // See if we have any rel="attachment" links
     92    if ( 0 == preg_match_all($search, $post->post_content, $anchor_matches, PREG_PATTERN_ORDER) )
     93        return;
     94
     95    $i = 0;
     96    $search = "# id=(\"|')p(\d+)\\1#i";
     97    foreach ( $anchor_matches[0] as $anchor ) {
     98        if ( 0 == preg_match($search, $anchor, $id_matches) )
     99            continue;
     100
     101        $id = $id_matches[2];
     102
     103        // While we have the attachment ID, let's adopt any orphans.
     104        $attachment = & get_post($id);
     105        if ( ! is_object(get_post($attachment->post_parent)) ) {
     106            $attachment->post_parent = $post_ID;
     107            wp_update_post($attachment);
     108        }
     109
     110        $post_search[$i] = $anchor;
     111        $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
     112        ++$i;
     113    }
     114
     115    $post->post_content = str_replace($post_search, $post_replace, $post->post_content);
     116
     117    return wp_update_post($post);
     118}
     119
     120// Update an existing post with values provided in $_POST.
     121function edit_post() {
     122    global $user_ID;
     123
     124    $post_ID = (int) $_POST['post_ID'];
     125
     126    if (!current_user_can('edit_post', $post_ID))
     127        die(__('You are not allowed to edit this post.'));
     128
     129    // Rename.
     130    $_POST['ID'] = (int) $_POST['post_ID'];
     131    $_POST['post_content'] = $_POST['content'];
     132    $_POST['post_excerpt'] = $_POST['excerpt'];
     133    $_POST['post_parent'] = $_POST['parent_id'];
     134    $_POST['to_ping'] = $_POST['trackback_url'];
     135
     136    if (!empty ($_POST['post_author_override'])) {
     137        $_POST['post_author'] = (int) $_POST['post_author_override'];
     138    } else
     139        if (!empty ($_POST['post_author'])) {
     140            $_POST['post_author'] = (int) $_POST['post_author'];
     141        } else {
     142            $_POST['post_author'] = (int) $_POST['user_ID'];
     143        }
     144
     145    if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
     146        die(__('You cannot post as this user.'));
     147
     148    // What to do based on which button they pressed
     149    if ('' != $_POST['saveasdraft'])
     150        $_POST['post_status'] = 'draft';
     151    if ('' != $_POST['saveasprivate'])
     152        $_POST['post_status'] = 'private';
     153    if ('' != $_POST['publish'])
     154        $_POST['post_status'] = 'publish';
     155    if ('' != $_POST['advanced'])
     156        $_POST['post_status'] = 'draft';
     157    if ('' != $_POST['savepage'])
     158        $_POST['post_status'] = 'static';
     159
     160    if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
     161        $_POST['post_status'] = 'draft';
     162
     163    if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
     164        die(__('This user cannot edit pages.'));
     165
     166    if (!isset ($_POST['comment_status']))
     167        $_POST['comment_status'] = 'closed';
     168
     169    if (!isset ($_POST['ping_status']))
     170        $_POST['ping_status'] = 'closed';
     171
     172    if (!empty ($_POST['edit_date'])) {
     173        $aa = $_POST['aa'];
     174        $mm = $_POST['mm'];
     175        $jj = $_POST['jj'];
     176        $hh = $_POST['hh'];
     177        $mn = $_POST['mn'];
     178        $ss = $_POST['ss'];
     179        $jj = ($jj > 31) ? 31 : $jj;
     180        $hh = ($hh > 23) ? $hh -24 : $hh;
     181        $mn = ($mn > 59) ? $mn -60 : $mn;
     182        $ss = ($ss > 59) ? $ss -60 : $ss;
     183        $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
     184        $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
     185    }
     186
    234187    // Meta Stuff
    235188    if ($_POST['meta']) {
     
    237190            update_meta($key, $value['key'], $value['value']);
    238191    }
    239 
     192   
    240193    if ($_POST['deletemeta']) {
    241194        foreach ($_POST['deletemeta'] as $key => $value)
     
    260213
    261214    if (!current_user_can('edit_post', $comment_post_ID))
    262         wp_die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
     215        die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
    263216
    264217    $_POST['comment_author'] = $_POST['newcomment_author'];
     
    288241// Get an existing post and format it for editing.
    289242function get_post_to_edit($id) {
     243    global $richedit;
     244    $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
    290245
    291246    $post = get_post($id);
    292247
    293     $post->post_content = format_to_edit($post->post_content, user_can_richedit());
     248    $post->post_content = format_to_edit($post->post_content, $richedit);
    294249    $post->post_content = apply_filters('content_edit_pre', $post->post_content);
    295250
     
    300255    $post->post_title = apply_filters('title_edit_pre', $post->post_title);
    301256
    302     $post->post_password = format_to_edit($post->post_password);
    303 
    304     if ($post->post_type == 'page')
     257    if ($post->post_status == 'static')
    305258        $post->page_template = get_post_meta($id, '_wp_page_template', true);
    306259
     
    334287
    335288    $post->post_status = 'draft';
    336     $post->comment_status = get_option('default_comment_status');
    337     $post->ping_status = get_option('default_ping_status');
    338     $post->post_pingback = get_option('default_pingback_flag');
    339     $post->post_category = get_option('default_category');
     289    $post->comment_status = get_settings('default_comment_status');
     290    $post->ping_status = get_settings('default_ping_status');
     291    $post->post_pingback = get_settings('default_pingback_flag');
     292    $post->post_category = get_settings('default_category');
    340293    $post->post_content = apply_filters('default_content', $post_content);
    341294    $post->post_title = apply_filters('default_title', $post_title);
     
    349302
    350303function get_comment_to_edit($id) {
     304    global $richedit;
     305    $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
     306
    351307    $comment = get_comment($id);
    352308
    353     $comment->comment_content = format_to_edit($comment->comment_content, user_can_richedit());
     309    $comment->comment_content = format_to_edit($comment->comment_content, $richedit);
    354310    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    355311
     
    367323}
    368324
    369 function wp_dropdown_roles( $default = false ) {
    370     global $wp_roles;
    371     $r = '';
    372     foreach($wp_roles->role_names as $role => $name)
    373         if ( $default == $role ) // Make default first in list
    374             $p = "\n\t<option selected='selected' value='$role'>$name</option>";
    375         else
    376             $r .= "\n\t<option value='$role'>$name</option>";
    377     echo $p . $r;
    378 }
    379 
    380 
    381 function get_user_to_edit($user_id) {
    382     $user = new WP_User($user_id);
    383     $user->user_login = wp_specialchars($user->user_login, 1);
    384     $user->user_email = wp_specialchars($user->user_email, 1);
    385     $user->user_url = wp_specialchars($user->user_url, 1);
    386     $user->first_name = wp_specialchars($user->first_name, 1);
    387     $user->last_name = wp_specialchars($user->last_name, 1);
    388     $user->display_name = wp_specialchars($user->display_name, 1);
    389     $user->nickname = wp_specialchars($user->nickname, 1);
    390     $user->aim = wp_specialchars($user->aim, 1);
    391     $user->yim = wp_specialchars($user->yim, 1);
    392     $user->jabber = wp_specialchars($user->jabber, 1);
    393     $user->description = wp_specialchars($user->description);
    394 
    395     return $user;
    396 }
    397 
    398325// Creates a new user from the "Users" form using $_POST information.
    399326
    400327function add_user() {
    401     if ( func_num_args() ) { // The hackiest hack that ever did hack
    402         global $current_user, $wp_roles;
    403         $user_id = func_get_arg(0);
    404 
    405         if (isset ($_POST['role'])) {
    406             if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users')) {
    407                 $user = new WP_User($user_id);
    408                 $user->set_role($_POST['role']);
    409             }
    410         }
    411     } else {
    412         add_action('user_register', 'add_user'); // See above
    413         return edit_user();
    414     }
     328    return edit_user();
    415329}
    416330
    417331function edit_user($user_id = 0) {
    418332    global $current_user, $wp_roles, $wpdb;
     333
    419334    if ($user_id != 0) {
    420335        $update = true;
     
    436351        $pass2 = $_POST['pass2'];
    437352
    438     if (isset ($_POST['role']) && current_user_can('edit_users')) {
     353    if (isset ($_POST['role'])) {
    439354        if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
    440355            $user->role = $_POST['role'];
     
    456371        $user->display_name = wp_specialchars(trim($_POST['display_name']));
    457372    if (isset ($_POST['description']))
    458         $user->description = trim($_POST['description']);
     373        $user->description = wp_specialchars(trim($_POST['description']));
    459374    if (isset ($_POST['jabber']))
    460375        $user->jabber = wp_specialchars(trim($_POST['jabber']));
     
    464379        $user->yim = wp_specialchars(trim($_POST['yim']));
    465380
    466     $errors = new WP_Error();
     381    $errors = array ();
    467382
    468383    /* checking that username has been typed */
    469384    if ($user->user_login == '')
    470         $errors->add('user_login', __('<strong>ERROR</strong>: Please enter a username.'));
     385        $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
    471386
    472387    /* checking the password has been typed twice */
    473     do_action_ref_array('check_passwords', array ($user->user_login, & $pass1, & $pass2));
     388    do_action('check_passwords', array ($user->user_login, & $pass1, & $pass2));
    474389
    475390    if (!$update) {
    476391        if ($pass1 == '' || $pass2 == '')
    477             $errors->add('pass', __('<strong>ERROR</strong>: Please enter your password twice.'));
     392            $errors['pass'] = __('<strong>ERROR</strong>: Please enter your password twice.');
    478393    } else {
    479394        if ((empty ($pass1) && !empty ($pass2)) || (empty ($pass2) && !empty ($pass1)))
    480             $errors->add('pass', __("<strong>ERROR</strong>: you typed your new password only once."));
     395            $errors['pass'] = __("<strong>ERROR</strong>: you typed your new password only once.");
    481396    }
    482397
    483398    /* Check for "\" in password */
    484399    if( strpos( " ".$pass1, "\\" ) )
    485         $errors->add('pass', __('<strong>ERROR</strong>: Passwords may not contain the character "\\".'));
     400        $errors['pass'] = __('<strong>ERROR</strong>: Passwords may not contain the character "\\".');
    486401
    487402    /* checking the password has been typed twice the same */
    488403    if ($pass1 != $pass2)
    489         $errors->add('pass', __('<strong>ERROR</strong>: Please type the same password in the two password fields.'));
     404        $errors['pass'] = __('<strong>ERROR</strong>: Please type the same password in the two password fields.');
    490405
    491406    if (!empty ($pass1))
     
    493408
    494409    if ( !validate_username($user->user_login) )
    495         $errors->add('user_login', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.'));
     410        $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.');
    496411
    497412    if (!$update && username_exists($user->user_login))
    498         $errors->add('user_login', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
     413        $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
    499414
    500415    /* checking e-mail address */
    501416    if (empty ($user->user_email)) {
    502         $errors->add('user_email', __("<strong>ERROR</strong>: please type an e-mail address"));
     417        $errors['user_email'] = __("<strong>ERROR</strong>: please type an e-mail address");
    503418    } else
    504419        if (!is_email($user->user_email)) {
    505             $errors->add('user_email', __("<strong>ERROR</strong>: the email address isn't correct"));
    506         }
    507 
    508     if ( $errors->get_error_codes() )
     420            $errors['user_email'] = __("<strong>ERROR</strong>: the email address isn't correct");
     421        }
     422
     423    if (count($errors) != 0)
    509424        return $errors;
    510425
     
    515430        wp_new_user_notification($user_id);
    516431    }
    517     return $user_id;
     432
     433    return $errors;
    518434}
    519435
     
    521437function get_link_to_edit($link_id) {
    522438    $link = get_link($link_id);
    523 
     439   
    524440    $link->link_url = wp_specialchars($link->link_url, 1);
    525441    $link->link_name = wp_specialchars($link->link_name, 1);
    526     $link->link_image = wp_specialchars($link->link_image, 1);
    527     $link->link_description = wp_specialchars($link->link_description, 1);
     442    $link->link_description = wp_specialchars($link->link_description);
    528443    $link->link_notes = wp_specialchars($link->link_notes);
    529     $link->link_rss = wp_specialchars($link->link_rss, 1);
    530     $link->link_rel = wp_specialchars($link->link_rel, 1);
    531     $link->post_category = $link->link_category;
    532 
     444    $link->link_rss = wp_specialchars($link->link_rss);
     445   
    533446    return $link;
    534447}
     
    539452    else
    540453        $link->link_url = '';
    541 
     454   
    542455    if ( isset($_GET['name']) )
    543456        $link->link_name = wp_specialchars($_GET['name'], 1);
    544457    else
    545458        $link->link_name = '';
    546 
    547     $link->link_visible = 'Y';
    548 
     459       
    549460    return $link;
    550461}
    551462
    552463function add_link() {
    553     return edit_link();
     464    return edit_link(); 
    554465}
    555466
    556467function edit_link($link_id = '') {
    557468    if (!current_user_can('manage_links'))
    558         wp_die(__("Cheatin' uh ?"));
     469        die(__("Cheatin' uh ?"));
    559470
    560471    $_POST['link_url'] = wp_specialchars($_POST['link_url']);
     
    563474    $_POST['link_image'] = wp_specialchars($_POST['link_image']);
    564475    $_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
    565     $_POST['link_category'] = $_POST['post_category'];
     476    $auto_toggle = get_autotoggle($_POST['link_category']);
     477   
     478    // if we are in an auto toggle category and this one is visible then we
     479    // need to make the others invisible before we add this new one.
     480    // FIXME Add category toggle func.
     481    //if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
     482    //  $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
     483    //}
    566484
    567485    if ( !empty($link_id) ) {
     
    595513function return_categories_list($parent = 0) {
    596514    global $wpdb;
    597     return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC");
     515    return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC LIMIT 100");
    598516}
    599517
     
    603521
    604522function get_nested_categories($default = 0, $parent = 0) {
    605     global $post_ID, $link_id, $mode, $wpdb;
     523    global $post_ID, $mode, $wpdb;
    606524
    607525    if ($post_ID) {
     
    616534            $checked_categories[] = $default;
    617535        }
    618     } else if ($link_id) {
    619         $checked_categories = $wpdb->get_col("
    620              SELECT category_id
    621              FROM $wpdb->categories, $wpdb->link2cat
    622              WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id'
    623              ");
    624 
    625         if (count($checked_categories) == 0) {
    626             // No selected categories, strange
    627             $checked_categories[] = $default;
    628         }   
     536
    629537    } else {
    630538        $checked_categories[] = $default;
     
    642550        }
    643551    }
    644 
     552   
    645553    usort($result, 'sort_cats');
    646554
     
    650558function write_nested_categories($categories) {
    651559    foreach ($categories as $category) {
    652         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>\n";
    653 
    654         if ( $category['children'] ) {
    655             echo "<ul>\n";
     560        echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
     561
     562        if (isset ($category['children'])) {
     563            echo "\n<span class='cat-nest'>\n";
    656564            write_nested_categories($category['children']);
    657             echo "</ul>\n";
     565            echo "</span>\n";
    658566        }
    659567    }
     
    664572}
    665573
    666 function return_link_categories_list($parent = 0) {
    667     global $wpdb;
    668     return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC");
    669 }
    670 
    671 function get_nested_link_categories( $default = 0, $parent = 0 ) {
    672     global $post_ID, $link_id, $mode, $wpdb;
    673 
    674     if ($link_id) {
    675         $checked_categories = $wpdb->get_col("
    676              SELECT category_id
    677              FROM $wpdb->categories, $wpdb->link2cat
    678              WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id'
    679              ");
    680 
    681         if (count($checked_categories) == 0) {
    682             // No selected categories, strange
    683             $checked_categories[] = $default;
    684         }   
    685     } else {
    686         $checked_categories[] = $default;
    687     }
    688 
    689     $cats = return_link_categories_list($parent);
    690     $result = array ();
    691 
    692     if (is_array($cats)) {
    693         foreach ($cats as $cat) {
    694             $result[$cat]['children'] = get_nested_link_categories($default, $cat);
    695             $result[$cat]['cat_ID'] = $cat;
    696             $result[$cat]['checked'] = in_array($cat, $checked_categories);
    697             $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
    698         }
    699     }
    700 
    701     usort($result, 'sort_cats');
    702 
    703     return $result;
    704 }
    705 
    706 function dropdown_link_categories($default = 0) {
    707     write_nested_categories(get_nested_link_categories($default));
    708 }
    709 
    710574// Dandy new recursive multiple category stuff.
    711575function cat_rows($parent = 0, $level = 0, $categories = 0) {
     576    global $wpdb, $class;
     577
    712578    if (!$categories)
    713         $categories = get_categories('hide_empty=0');
     579        $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
    714580
    715581    if ($categories) {
    716582        foreach ($categories as $category) {
    717583            if ($category->category_parent == $parent) {
    718                 echo "\t" . _cat_row( $category, $level );
     584                $category->cat_name = wp_specialchars($category->cat_name);
     585                $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
     586                $pad = str_repeat('&#8212; ', $level);
     587                if ( current_user_can('manage_categories') ) {
     588                    $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
     589                    $default_cat_id = get_option('default_category');
     590                   
     591                    if ($category->cat_ID != $default_cat_id)
     592                        $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
     593                    else
     594                        $edit .= "<td style='text-align:center'>".__("Default");
     595                }
     596                else
     597                    $edit = '';
     598
     599                $class = ('alternate' == $class) ? '' : 'alternate';
     600                echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
     601                                <td>$category->category_description</td>
     602                                <td>$count</td>
     603                                <td>$edit</td>
     604                                </tr>";
    719605                cat_rows($category->cat_ID, $level +1, $categories);
    720606            }
     
    725611}
    726612
    727 function _cat_row( $category, $level, $name_override = false ) {
    728     global $class;
    729 
    730     $pad = str_repeat('&#8212; ', $level);
    731     if ( current_user_can('manage_categories') ) {
    732         $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
    733         $default_cat_id = get_option('default_category');
    734         $default_link_cat_id = get_option('default_link_category');
    735 
    736         if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
    737             $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, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
    738         else
    739             $edit .= "<td style='text-align:center'>".__("Default");
    740     } else
    741         $edit = '';
    742 
    743     $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
    744 
    745     $category->category_count = number_format( $category->category_count );
    746     $category->link_count = number_format( $category->link_count );
    747     return "<tr id='cat-$category->cat_ID'$class>
    748         <th scope='row' style='text-align: center'>$category->cat_ID</th>
    749         <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td>
    750         <td>$category->category_description</td>
    751         <td align='center'>$category->category_count</td>
    752         <td align='center'>$category->link_count</td>
    753         <td>$edit</td>\n\t</tr>\n";
    754 }
    755 
    756 function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
     613function page_rows($parent = 0, $level = 0, $pages = 0) {
    757614    global $wpdb, $class, $post;
    758 
    759615    if (!$pages)
    760         $pages = get_pages('sort_column=menu_order');
    761 
    762     if (! $pages)
    763         return false;
    764 
    765     foreach ($pages as $post) {
    766         setup_postdata($post);
    767         if ( $hierarchy && ($post->post_parent != $parent) )
    768             continue;
    769 
    770         $post->post_title = wp_specialchars($post->post_title);
    771         $pad = str_repeat('&#8212; ', $level);
    772         $id = $post->ID;
    773         $class = ('alternate' == $class) ? '' : 'alternate';
     616        $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
     617
     618    if ($pages) {
     619        foreach ($pages as $post) {
     620            start_wp();
     621            if ($post->post_parent == $parent) {
     622                $post->post_title = wp_specialchars($post->post_title);
     623                $pad = str_repeat('&#8212; ', $level);
     624                $id = $post->ID;
     625                $class = ('alternate' == $class) ? '' : 'alternate';
    774626?>
    775627  <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
    776     <th scope="row" style="text-align: center"><?php echo $post->ID; ?></th>
     628    <th scope="row"><?php echo $post->ID; ?></th>
    777629    <td>
    778       <?php echo $pad; ?><?php the_title() ?>
    779       <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?>
     630      <?php echo $pad; ?><?php the_title() ?>
    780631    </td>
    781632    <td><?php the_author() ?></td>
    782633    <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
    783634    <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
    784     <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    785     <td><?php if ( current_user_can('delete_page', $id) ) { echo "<a href='" . wp_nonce_url("page.php?action=delete&amp;post=$id", 'delete-page_' . $id) .  "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     635    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
     636    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    786637  </tr>
    787638
    788639<?php
    789         if ( $hierarchy) page_rows($id, $level + 1, $pages);
    790     }
    791 }
    792 
    793 function user_row( $user_object, $style = '' ) {
    794     if ( !(is_object($user_object) && is_a($user_object, 'WP_User')) )
    795         $user_object = new WP_User( (int) $user_object );
    796     $email = $user_object->user_email;
    797     $url = $user_object->user_url;
    798     $short_url = str_replace('http://', '', $url);
    799     $short_url = str_replace('www.', '', $short_url);
    800     if ('/' == substr($short_url, -1))
    801         $short_url = substr($short_url, 0, -1);
    802     if (strlen($short_url) > 35)
    803         $short_url =  substr($short_url, 0, 32).'...';
    804     $numposts = get_usernumposts($user_object->ID);
    805     $r = "<tr id='user-$user_object->ID'$style>
    806         <td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
    807         <td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
    808         <td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
    809         <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
    810         <td><a href='$url' title='website: $url'>$short_url</a></td>";
    811     $r .= "\n\t\t<td align='center'>";
    812     if ($numposts > 0) {
    813         $r .= "<a href='edit.php?author=$user_object->ID' title='" . __('View posts by this author') . "' class='edit'>";
    814         $r .= sprintf(__('View %1$s %2$s'), $numposts, __ngettext('post', 'posts', $numposts));
    815     }
    816     $r .= "</td>\n\t\t<td>";
    817     $edit_link = add_query_arg('wp_http_referer', wp_specialchars(urlencode(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id=$user_object->ID");
    818     if ( current_user_can('edit_user', $user_object->ID) )
    819         $r .= "<a href='$edit_link' class='edit'>".__('Edit')."</a>";
    820     $r .= "</td>\n\t</tr>";
    821     return $r;
     640
     641                page_rows($id, $level +1, $pages);
     642            }
     643        }
     644    } else {
     645        return false;
     646    }
    822647}
    823648
    824649function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) {
    825     global $wpdb;
    826     if (!$categories)
    827         $categories = get_categories('hide_empty=0');
    828 
     650    global $wpdb, $bgcolor;
     651    if (!$categories) {
     652        $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
     653    }
    829654    if ($categories) {
    830655        foreach ($categories as $category) {
    831656            if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
     657                $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
    832658                $pad = str_repeat('&#8211; ', $level);
    833659                $category->cat_name = wp_specialchars($category->cat_name);
     
    844670}
    845671
     672function link_category_dropdown($fieldname, $selected = 0) {
     673    global $wpdb;
     674   
     675    $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
     676    echo "\n<select name='$fieldname' size='1'>\n";
     677    foreach ($results as $row) {
     678        echo "\n\t<option value='$row->cat_id'";
     679        if ($row->cat_id == $selected)
     680            echo " selected='selected'";
     681        echo ">$row->cat_id : " . wp_specialchars($row->cat_name);
     682        if ($row->auto_toggle == 'Y')
     683            echo ' (auto toggle)';
     684        echo "</option>";
     685    }
     686    echo "\n</select>\n";
     687}
     688
    846689function wp_create_thumbnail($file, $max_side, $effect = '') {
    847690
     
    934777        return $error;
    935778    } else {
    936         apply_filters( 'wp_create_thumbnail', $thumbpath );
    937779        return $thumbpath;
    938780    }
     
    954796    global $post_ID;
    955797    // Exit if no meta
    956     if (!$meta) {
    957         echo '<tbody id="the-list"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS
     798    if (!$meta)
    958799        return;
    959     }
    960800    $count = 0;
    961801?>
    962     <thead>
     802<table id='meta-list' cellpadding="3">
    963803    <tr>
    964804        <th><?php _e('Key') ?></th>
     
    966806        <th colspan='2'><?php _e('Action') ?></th>
    967807    </tr>
    968     </thead>
    969808<?php
    970     $r ="\n\t<tbody id='the-list'>";
     809
     810
    971811    foreach ($meta as $entry) {
    972812        ++ $count;
     
    977817        if ('_' == $entry['meta_key'] { 0 })
    978818            $style .= ' hidden';
    979 
    980         if ( is_serialized($entry['meta_value']) ) {
    981             if ( is_serialized_string($entry['meta_value']) ) {
    982                 // this is a serialized string, so we should display it
    983                 $entry['meta_value'] = maybe_unserialize($entry['meta_value']);
    984             } else {
    985                 // this is a serialized array/object so we should NOT display it
    986                 --$count;
    987                 continue;
    988             }
    989         }
    990 
    991         $key_js = js_escape($entry['meta_key']);
    992         $entry['meta_key'] = wp_specialchars( $entry['meta_key'], true );
    993         $entry['meta_value'] = wp_specialchars( $entry['meta_value'], true );
    994         $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
    995         $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
    996         $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
    997         $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />";
    998         $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
    999         $r .= sprintf(__("You are about to delete the &quot;%s&quot; custom field on this post.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), $key_js);
    1000         $r .= "' );\" class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>";
    1001         $r .= "\n\t</tr>";
    1002     }
    1003     echo $r;
    1004     echo "\n\t</tbody>";
     819        echo "
     820            <tr class='$style'>
     821                <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
     822                <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>
     823                <td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />
     824                <input name='deletemeta[{$entry['meta_id']}]' type='submit' class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>
     825            </tr>
     826        ";
     827    }
     828    echo "
     829        </table>
     830    ";
    1005831}
    1006832
     
    1020846function meta_form() {
    1021847    global $wpdb;
    1022     $limit = (int) apply_filters('postmeta_form_limit', 30);
    1023848    $keys = $wpdb->get_col("
    1024         SELECT meta_key
    1025         FROM $wpdb->postmeta
    1026         GROUP BY meta_key
    1027         ORDER BY meta_id DESC
    1028         LIMIT $limit");
    1029     natcasesort($keys);
     849            SELECT meta_key
     850            FROM $wpdb->postmeta
     851            GROUP BY meta_key
     852            ORDER BY meta_id DESC
     853            LIMIT 10");
    1030854?>
    1031855<h3><?php _e('Add a new custom field:') ?></h3>
    1032 <table id="newmeta" cellspacing="3" cellpadding="3">
     856<table cellspacing="3" cellpadding="3">
    1033857    <tr>
    1034858<th colspan="2"><?php _e('Key') ?></th>
     
    1037861    <tr valign="top">
    1038862        <td align="right" width="18%">
    1039 <?php if ( $keys ) : ?>
     863<?php if ($keys) : ?>
    1040864<select id="metakeyselect" name="metakeyselect" tabindex="7">
    1041865<option value="#NONE#"><?php _e('- Select -'); ?></option>
    1042866<?php
    1043867
    1044     foreach ( $keys as $key ) {
    1045         $key = wp_specialchars($key, 1);
     868    foreach ($keys as $key) {
    1046869        echo "\n\t<option value='$key'>$key</option>";
    1047870    }
     
    1055878
    1056879</table>
    1057 <p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
     880<p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
    1058881<?php
    1059882
     
    1062885function add_meta($post_ID) {
    1063886    global $wpdb;
    1064     $post_ID = (int) $post_ID;
    1065887
    1066888    $metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
    1067889    $metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
    1068     $metavalue = maybe_serialize(stripslashes((trim($_POST['metavalue']))));
    1069     $metavalue = $wpdb->escape($metavalue);
     890    $metavalue = $wpdb->escape(stripslashes(trim($_POST['metavalue'])));
    1070891
    1071892    if ( ('0' === $metavalue || !empty ($metavalue)) && ((('#NONE#' != $metakeyselect) && !empty ($metakeyselect)) || !empty ($metakeyinput)) ) {
     
    1073894        // input for the key have data, the input takes precedence:
    1074895
    1075         if ('#NONE#' != $metakeyselect)
     896        if ('#NONE#' != $metakeyselect)
    1076897            $metakey = $metakeyselect;
    1077898
     
    1084905                        VALUES ('$post_ID','$metakey','$metavalue')
    1085906                    ");
    1086         return $wpdb->insert_id;
    1087     }
    1088     return false;
     907    }
    1089908} // add_meta
    1090909
    1091910function delete_meta($mid) {
    1092911    global $wpdb;
    1093     $mid = (int) $mid;
    1094 
    1095     return $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
     912
     913    $result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
    1096914}
    1097915
    1098916function update_meta($mid, $mkey, $mvalue) {
    1099917    global $wpdb;
    1100     $mvalue = maybe_serialize(stripslashes($mvalue));
    1101     $mvalue = $wpdb->escape($mvalue);
    1102     $mid = (int) $mid;
     918
    1103919    return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
    1104920}
    1105921
    1106 function get_post_meta_by_id($mid) {
    1107     global $wpdb;
    1108     $mid = (int) $mid;
    1109 
    1110     $meta = $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
    1111     if ( is_serialized_string($meta->meta_value) )
    1112         $meta->meta_value = maybe_unserialize($meta->meta_value);
    1113     return $meta;
    1114 }
    1115 
    1116922function touch_time($edit = 1, $for_post = 1) {
    1117     global $wp_locale, $post, $comment;
     923    global $month, $post, $comment;
    1118924
    1119925    if ( $for_post )
     
    1122928    echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__('Edit timestamp').'</label></legend>';
    1123929
    1124     $time_adj = time() + (get_option('gmt_offset') * 3600);
     930    $time_adj = time() + (get_settings('gmt_offset') * 3600);
    1125931    $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
    1126932    $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
     
    1131937    $ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj);
    1132938
    1133     echo "<select name=\"mm\" onchange=\"edit_date.checked=true\">\n";
     939    echo "<select name=\"mm\">\n";
    1134940    for ($i = 1; $i < 13; $i = $i +1) {
    1135941        echo "\t\t\t<option value=\"$i\"";
    1136942        if ($i == $mm)
    1137             echo ' selected="selected"';
    1138         echo '>' . $wp_locale->get_month($i) . "</option>\n";
     943            echo " selected='selected'";
     944        if ($i < 10) {
     945            $ii = "0".$i;
     946        } else {
     947            $ii = "$i";
     948        }
     949        echo ">".$month["$ii"]."</option>\n";
    1139950    }
    1140951?>
    1141952</select>
    1142 <input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/>
    1143 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
    1144 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
    1145 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
    1146 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
     953<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
     954<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
     955<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
     956<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
     957<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
    1147958<?php
    1148959    if ( $edit ) {
    1149960        _e('Existing timestamp');
    1150         //echo ': ' . $wp_locale->get_month($mm) . "$jj, $aa @ $hh:$mn";
    1151         echo sprintf(__(': %1$s %2$s, %3$s @ %4$s:%5$s'), $wp_locale->get_month($mm), $jj, $aa, $hh, $mn);
     961        echo ": {$month[$mm]} $jj, $aa @ $hh:$mn";
    1152962    }
    1153963?>
     
    1174984        if ($markerdata) {
    1175985            $state = true;
    1176             foreach ($markerdata as $n => $markerline) {
     986            foreach ($markerdata as $markerline) {
    1177987                if (strstr($markerline, "# BEGIN {$marker}"))
    1178988                    $state = false;
    1179                 if ($state) {
    1180                     if ( $n + 1 < count($markerdata) )
    1181                         fwrite($f, "{$markerline}\n");
    1182                     else
    1183                         fwrite($f, "{$markerline}");
    1184                 }
     989                if ($state)
     990                    fwrite($f, "{$markerline}\n");
    1185991                if (strstr($markerline, "# END {$marker}")) {
    1186992                    fwrite($f, "# BEGIN {$marker}\n");
     
    12651071}
    12661072
     1073function the_quicktags() {
     1074    // Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
     1075    if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
     1076        echo '
     1077        <div id="quicktags">
     1078            <script src="../wp-includes/js/quicktags.js" type="text/javascript"></script>
     1079            <script type="text/javascript">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script>
     1080        </div>
     1081';
     1082    else echo '
     1083<script type="text/javascript">
     1084function edInsertContent(myField, myValue) {
     1085    //IE support
     1086    if (document.selection) {
     1087        myField.focus();
     1088        sel = document.selection.createRange();
     1089        sel.text = myValue;
     1090        myField.focus();
     1091    }
     1092    //MOZILLA/NETSCAPE support
     1093    else if (myField.selectionStart || myField.selectionStart == "0") {
     1094        var startPos = myField.selectionStart;
     1095        var endPos = myField.selectionEnd;
     1096        myField.value = myField.value.substring(0, startPos)
     1097                      + myValue
     1098                      + myField.value.substring(endPos, myField.value.length);
     1099        myField.focus();
     1100        myField.selectionStart = startPos + myValue.length;
     1101        myField.selectionEnd = startPos + myValue.length;
     1102    } else {
     1103        myField.value += myValue;
     1104        myField.focus();
     1105    }
     1106}
     1107</script>
     1108';
     1109}
     1110
     1111function validate_current_theme() {
     1112    $theme_loc = 'wp-content/themes';
     1113    $theme_root = ABSPATH.$theme_loc;
     1114
     1115    $template = get_settings('template');
     1116    $stylesheet = get_settings('stylesheet');
     1117
     1118    if (($template != 'default') && (!file_exists("$theme_root/$template/index.php"))) {
     1119        update_option('template', 'default');
     1120        update_option('stylesheet', 'default');
     1121        do_action('switch_theme', 'Default');
     1122        return false;
     1123    }
     1124
     1125    if (($stylesheet != 'default') && (!file_exists("$theme_root/$stylesheet/style.css"))) {
     1126        update_option('template', 'default');
     1127        update_option('stylesheet', 'default');
     1128        do_action('switch_theme', 'Default');
     1129        return false;
     1130    }
     1131
     1132    return true;
     1133}
     1134
    12671135function get_broken_themes() {
    12681136    global $wp_broken_themes;
     
    13091177function parent_dropdown($default = 0, $parent = 0, $level = 0) {
    13101178    global $wpdb, $post_ID;
    1311     $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order");
     1179    $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order");
    13121180
    13131181    if ($items) {
     
    13371205    global $menu;
    13381206    global $submenu;
    1339     global $_wp_menu_nopriv;
    1340     global $_wp_submenu_nopriv;
    1341     global $plugin_page;
    13421207
    13431208    $parent = get_admin_page_parent();
    1344     /*echo "pa: $parent pn: $pagenow pp: $plugin_page<br/>";
    1345     echo "<pre>";
    1346     print_r($_wp_menu_nopriv);
    1347     print_r($_wp_submenu_nopriv);
    1348     echo "</pre>";*/
    1349     if ( isset($_wp_submenu_nopriv[$parent][$pagenow]) )
    1350         return false;
    1351 
    1352     if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$parent][$plugin_page]) )
    1353         return false;
    1354    
    1355     if ( empty($parent) ) {
    1356         if ( isset($_wp_menu_nopriv[$pagenow]) )
    1357             return false;
    1358         if ( isset($_wp_submenu_nopriv[$pagenow][$pagenow]) )
    1359             return false;
    1360         if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$pagenow][$plugin_page]) )
    1361             return false;
    1362         foreach (array_keys($_wp_submenu_nopriv) as $key) {
    1363             if ( isset($_wp_submenu_nopriv[$key][$pagenow]) )
     1209
     1210    foreach ($menu as $menu_array) {
     1211        //echo "parent array: " . $menu_array[2];
     1212        if ($menu_array[2] == $parent) {
     1213            if (!current_user_can($menu_array[1])) {
    13641214                return false;
    1365             if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$key][$plugin_page]) )
    1366             return false;   
    1367         }
    1368         return true;
     1215            } else {
     1216                break;
     1217            }
     1218        }
    13691219    }
    13701220
     
    13721222        foreach ($submenu[$parent] as $submenu_array) {
    13731223            if ($submenu_array[2] == $pagenow) {
    1374                 if (current_user_can($submenu_array[1]))
     1224                if (!current_user_can($submenu_array[1])) {
     1225                    return false;
     1226                } else {
    13751227                    return true;
    1376                 else
    1377                     return false;
    1378             }
    1379         }
    1380     }
    1381 
    1382     foreach ($menu as $menu_array) {
    1383         if ($menu_array[2] == $parent) {
    1384             if (current_user_can($menu_array[1]))
    1385                 return true;
    1386             else
    1387                 return false;
    1388         }
    1389     }
    1390    
     1228                }
     1229            }
     1230        }
     1231    }
     1232
    13911233    return true;
    13921234}
     
    14451287    global $pagenow;
    14461288    global $plugin_page;
    1447     global $_wp_real_parent_file;
    1448     global $_wp_menu_nopriv;
    1449     global $_wp_submenu_nopriv;
    1450 
    1451     if ( !empty ($parent_file) ) {
    1452         if ( isset($_wp_real_parent_file[$parent_file]) )
    1453             $parent_file = $_wp_real_parent_file[$parent_file];
    1454 
     1289
     1290    if (isset ($parent_file) && !empty ($parent_file)) {
    14551291        return $parent_file;
    14561292    }
     
    14601296            if ($parent_menu[2] == $plugin_page) {
    14611297                $parent_file = $plugin_page;
    1462                 if ( isset($_wp_real_parent_file[$parent_file]) )
    1463                     $parent_file = $_wp_real_parent_file[$parent_file];
    1464                 return $parent_file;
    1465             }
    1466         }
    1467         if ( isset($_wp_menu_nopriv[$plugin_page]) ) {
    1468             $parent_file = $plugin_page;
    1469             if ( isset($_wp_real_parent_file[$parent_file]) )
    1470                     $parent_file = $_wp_real_parent_file[$parent_file];
    1471             return $parent_file;
    1472         }           
    1473     }
    1474 
    1475     if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$pagenow][$plugin_page]) ) {
    1476         $parent_file = $pagenow;
    1477         if ( isset($_wp_real_parent_file[$parent_file]) )
    1478             $parent_file = $_wp_real_parent_file[$parent_file];
    1479         return $parent_file;       
     1298                return $plugin_page;
     1299            }
     1300        }
    14801301    }
    14811302
    14821303    foreach (array_keys($submenu) as $parent) {
    14831304        foreach ($submenu[$parent] as $submenu_array) {
    1484             if ( isset($_wp_real_parent_file[$parent]) )
    1485                 $parent = $_wp_real_parent_file[$parent];
    14861305            if ($submenu_array[2] == $pagenow) {
    14871306                $parent_file = $parent;
     
    15181337    global $submenu;
    15191338    global $menu;
    1520     global $_wp_real_parent_file;
    1521     global $_wp_submenu_nopriv;
    1522     global $_wp_menu_nopriv;
    1523 
     1339
     1340    $parent = plugin_basename($parent);
    15241341    $file = plugin_basename($file);
    1525 
    1526     $parent = plugin_basename($parent);
    1527     if ( isset($_wp_real_parent_file[$parent]) )
    1528         $parent = $_wp_real_parent_file[$parent];
    1529 
    1530     if ( !current_user_can($access_level) ) {
    1531         $_wp_submenu_nopriv[$parent][$file] = true;
    1532         return false;
    1533     }
    15341342
    15351343    // If the parent doesn't already have a submenu, add a link to the parent
     
    15371345    // parent file someone is trying to link back to the parent manually.  In
    15381346    // this case, don't automatically add a link back to avoid duplication.
    1539     if (!isset ($submenu[$parent]) && $file != $parent  ) {
     1347    if (!isset ($submenu[$parent]) && $file != $parent) {
    15401348        foreach ($menu as $parent_menu) {
    1541             if ( $parent_menu[2] == $parent && current_user_can($parent_menu[1]) ) {
     1349            if ($parent_menu[2] == $parent) {
    15421350                $submenu[$parent][] = $parent_menu;
    15431351            }
     
    15891397    switch ($code) {
    15901398        case 1 :
    1591             wp_die(__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
     1399            die(__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
    15921400
    15931401        case 2 :
    1594             wp_die(__('Sorry, can&#8217;t call files with their real path.'));
     1402            die(__('Sorry, can&#8217;t call files with their real path.'));
    15951403
    15961404        case 3 :
    1597             wp_die(__('Sorry, that file cannot be edited.'));
     1405            die(__('Sorry, that file cannot be edited.'));
    15981406    }
    15991407}
    16001408
    16011409function get_home_path() {
    1602     $home = get_option('home');
    1603     if ($home != '' && $home != get_option('siteurl')) {
     1410    $home = get_settings('home');
     1411    if ($home != '' && $home != get_settings('siteurl')) {
    16041412        $home_path = parse_url($home);
    16051413        $home_path = $home_path['path'];
     
    16331441        return $wp_file_descriptions[basename($file)];
    16341442    }
    1635     elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
    1636         $template_data = implode('', file( ABSPATH . $file ));
     1443    elseif (file_exists(ABSPATH.$file)) {
     1444        $template_data = implode('', file(ABSPATH.$file));
    16371445        if (preg_match("|Template Name:(.*)|i", $template_data, $name))
    16381446            return $name[1];
     
    16651473    preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri);
    16661474    if (preg_match("|Version:(.*)|i", $plugin_data, $version))
    1667         $version = trim($version[1]);
     1475        $version = $version[1];
    16681476    else
    16691477        $version = '';
    16701478
    1671     $description = wptexturize(trim($description[1]));
     1479    $description = wptexturize($description[1]);
    16721480
    16731481    $name = $plugin_name[1];
     
    16751483    $plugin = $name;
    16761484    if ('' != $plugin_uri[1] && '' != $name) {
    1677         $plugin = '<a href="' . trim($plugin_uri[1]) . '" title="'.__('Visit plugin homepage').'">'.$plugin.'</a>';
     1485        $plugin = '<a href="'.$plugin_uri[1].'" title="'.__('Visit plugin homepage').'">'.$plugin.'</a>';
    16781486    }
    16791487
    16801488    if ('' == $author_uri[1]) {
    1681         $author = trim($author_name[1]);
    1682     } else {
    1683         $author = '<a href="' . trim($author_uri[1]) . '" title="'.__('Visit author homepage').'">' . trim($author_name[1]) . '</a>';
     1489        $author = $author_name[1];
     1490    } else {
     1491        $author = '<a href="'.$author_uri[1].'" title="'.__('Visit author homepage').'">'.$author_name[1].'</a>';
    16841492    }
    16851493
     
    16951503
    16961504    $wp_plugins = array ();
    1697     $plugin_root = ABSPATH . PLUGINDIR;
     1505    $plugin_loc = 'wp-content/plugins';
     1506    $plugin_root = ABSPATH.$plugin_loc;
    16981507
    16991508    // Files in wp-content/plugins directory
     
    17201529    }
    17211530
    1722     if ( !$plugins_dir || !$plugin_files )
     1531    if (!$plugins_dir || !$plugin_files) {
    17231532        return $wp_plugins;
    1724 
    1725     foreach ( $plugin_files as $plugin_file ) {
    1726         if ( !is_readable("$plugin_root/$plugin_file") )
     1533    }
     1534
     1535    sort($plugin_files);
     1536
     1537    foreach ($plugin_files as $plugin_file) {
     1538        if ( !is_readable("$plugin_root/$plugin_file"))
    17271539            continue;
    17281540
    17291541        $plugin_data = get_plugin_data("$plugin_root/$plugin_file");
    17301542
    1731         if ( empty ($plugin_data['Name']) )
     1543        if (empty ($plugin_data['Name'])) {
    17321544            continue;
     1545        }
    17331546
    17341547        $wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
    17351548    }
    1736 
    1737     uasort($wp_plugins, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
    17381549
    17391550    return $wp_plugins;
     
    18441655        __("Failed to write file to disk."));
    18451656
     1657    // Accepted MIME types are set here as PCRE. Override with $override['mimes'].
     1658    $mimes = apply_filters('upload_mimes', array (
     1659        'jpg|jpeg|jpe' => 'image/jpeg',
     1660        'gif' => 'image/gif',
     1661        'png' => 'image/png',
     1662        'bmp' => 'image/bmp',
     1663        'tif|tiff' => 'image/tiff',
     1664        'ico' => 'image/x-icon',
     1665        'asf|asx|wax|wmv|wmx' => 'video/asf',
     1666        'avi' => 'video/avi',
     1667        'mov|qt' => 'video/quicktime',
     1668        'mpeg|mpg|mpe' => 'video/mpeg',
     1669        'txt|c|cc|h' => 'text/plain',
     1670        'rtx' => 'text/richtext',
     1671        'css' => 'text/css',
     1672        'htm|html' => 'text/html',
     1673        'mp3|mp4' => 'audio/mpeg',
     1674        'ra|ram' => 'audio/x-realaudio',
     1675        'wav' => 'audio/wav',
     1676        'ogg' => 'audio/ogg',
     1677        'mid|midi' => 'audio/midi',
     1678        'wma' => 'audio/wma',
     1679        'rtf' => 'application/rtf',
     1680        'js' => 'application/javascript',
     1681        'pdf' => 'application/pdf',
     1682        'doc' => 'application/msword',
     1683        'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
     1684        'wri' => 'application/vnd.ms-write',
     1685        'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
     1686        'mdb' => 'application/vnd.ms-access',
     1687        'mpp' => 'application/vnd.ms-project',
     1688        'swf' => 'application/x-shockwave-flash',
     1689        'class' => 'application/java',
     1690        'tar' => 'application/x-tar',
     1691        'zip' => 'application/zip',
     1692        'gz|gzip' => 'application/x-gzip',
     1693        'exe' => 'application/x-msdownload'
     1694    ));
     1695
    18461696    // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
    18471697    $test_form = true;
     
    18711721        return $upload_error_handler($file, __('Specified file failed upload test.'));
    18721722
    1873     // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
     1723    // A correct MIME type will pass this test.
    18741724    if ( $test_type ) {
    1875         $wp_filetype = wp_check_filetype($file['name'], $mimes);
    1876 
    1877         extract($wp_filetype);
     1725        $type = false;
     1726        $ext = false;
     1727        foreach ($mimes as $ext_preg => $mime_match) {
     1728            $ext_preg = '![^.]\.(' . $ext_preg . ')$!i';
     1729            if ( preg_match($ext_preg, $file['name'], $ext_matches) ) {
     1730                $type = $mime_match;
     1731                $ext = $ext_matches[1];
     1732            }
     1733        }
    18781734
    18791735        if ( !$type || !$ext )
     
    19021758                $filename = str_replace("$number$ext", ++$number . $ext, $filename);
    19031759        }
    1904         $filename = str_replace($ext, '', $filename);
    1905         $filename = sanitize_title_with_dashes($filename) . $ext;
    19061760    }
    19071761
     
    19091763    $new_file = $uploads['path'] . "/$filename";
    19101764    if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) )
    1911         wp_die(printf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
     1765        die(printf(__('The uploaded file could not be moved to %s.'), $file['path']));
    19121766
    19131767    // Set correct file permissions
     
    19181772    // Compute the URL
    19191773    $url = $uploads['url'] . "/$filename";
    1920    
    1921     $return = apply_filters( 'wp_handle_upload', array('file' => $new_file, 'url' => $url, 'type' => $type) );
    1922 
    1923     return $return;
     1774
     1775    return array('file' => $new_file, 'url' => $url, 'type' => $type);
    19241776}
    19251777
     
    19381790
    19391791function wp_import_upload_form($action) {
    1940     $size = strtolower( ini_get('upload_max_filesize') );
    1941     $bytes = 0;
    1942     if ( strstr( $size, 'k' ) )
    1943         $bytes = $size * 1024;
    1944     if ( strstr( $size, 'm' ) )
    1945         $bytes = $size * 1024 * 1024;
    1946     if ( strstr( $size, 'g' ) )
    1947         $bytes = $size * 1024 * 1024 * 1024;
    19481792?>
    1949 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
    1950 <p>
    1951 <label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf( __('Maximum size: %s'), $size ); ?>)
    1952 <input type="file" id="upload" name="import" size="25" />
     1793<script type="text/javascript">
     1794function cancelUpload() {
     1795o = document.getElementById('uploadForm');
     1796o.method = 'GET';
     1797o.action.value = 'view';
     1798o.submit();
     1799}
     1800</script>
     1801<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo $action ?>">
     1802<label for="upload"><?php _e('File:'); ?></label><input type="file" id="upload" name="import" />
    19531803<input type="hidden" name="action" value="save" />
    1954 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
    1955 </p>
    1956 <p class="submit">
    1957 <input type="submit" value="<?php _e('Upload file and import'); ?> &raquo;" />
    1958 </p>
     1804<div id="buttons">
     1805<input type="submit" value="<?php _e('Import'); ?>" />
     1806<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
     1807</div>
    19591808</form>
    1960 <?php
     1809<?php   
    19611810}
    19621811
     
    19691818
    19701819    $url = $file['url'];
    1971     $file = addslashes( $file['file'] );
     1820    $file = $file['file'];
    19721821    $filename = basename($file);
    19731822
     
    19861835}
    19871836
     1837function user_can_richedit() {
     1838    if ( 'true' != get_user_option('rich_editing') )
     1839        return false;
     1840
     1841    if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
     1842        return false;
     1843
     1844    return true; // Best guess
     1845}
     1846
    19881847function the_attachment_links($id = false) {
    19891848    $id = (int) $id;
    19901849    $post = & get_post($id);
    19911850
    1992     if ( $post->post_type != 'attachment' )
     1851    if ( $post->post_status != 'attachment' )
    19931852        return false;
    19941853
    19951854    $icon = get_attachment_icon($post->ID);
    1996     $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
    1997     $thumb = isset($attachment_data['thumb']);
     1855
    19981856?>
    1999 <form id="the-attachment-links">
    2000 <table>
    2001     <col />
    2002     <col class="widefat" />
    2003     <tr>
    2004         <th scope="row"><?php _e('URL') ?></th>
    2005         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo $post->guid ?></textarea></td>
    2006     </tr>
     1857<p><?php _e('Text linked to file') ?><br />
     1858<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></p>
     1859<p><?php _e('Text linked to subpost') ?><br />
     1860<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></p>
    20071861<?php if ( $icon ) : ?>
    2008     <tr>
    2009         <th scope="row"><?php $thumb ? _e('Thumbnail linked to file') : _e('Image linked to file'); ?></th>
    2010         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid; ?>"><?php echo $icon ?></a></textarea></td>
    2011     </tr>
    2012     <tr>
    2013         <th scope="row"><?php $thumb ? _e('Thumbnail linked to page') : _e('Image linked to file'); ?></th>
    2014         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
    2015     </tr>
    2016 <?php else : ?>
    2017     <tr>
    2018         <th scope="row"><?php _e('Link to file') ?></th>
    2019         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid);  ?></a></textarea></td>
    2020     </tr>
    2021     <tr>
    2022         <th scope="row"><?php _e('Link to page') ?></th>
    2023         <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
    2024     </tr>
     1862<p><?php _e('Thumbnail linked to file') ?><br />
     1863<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></p>
     1864<p><?php _e('Thumbnail linked to subpost') ?><br />
     1865<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></p>
    20251866<?php endif; ?>
    2026 </table>
    2027 </form>
    20281867<?php
    20291868}
     
    20381877}
    20391878
    2040 function wp_reset_vars($vars) {
    2041     for ($i=0; $i<count($vars); $i += 1) {
    2042         $var = $vars[$i];
    2043         global $$var;
    2044 
    2045         if (!isset($$var)) {
    2046             if (empty($_POST["$var"])) {
    2047                 if (empty($_GET["$var"]))
    2048                     $$var = '';
    2049                 else
    2050                     $$var = $_GET["$var"];
    2051             } else {
    2052                 $$var = $_POST["$var"];
    2053             }
    2054         }
    2055     }
    2056 }
    2057 
    2058 // If siteurl or home changed, reset cookies and flush rewrite rules.
    2059 function update_home_siteurl($old_value, $value) {
    2060     global $wp_rewrite, $user_login, $user_pass_md5;
    2061 
    2062     if ( defined("WP_INSTALLING") )
    2063         return;
    2064 
    2065     // If home changed, write rewrite rules to new location.
    2066     $wp_rewrite->flush_rules();
    2067     // Clear cookies for old paths.
    2068     wp_clearcookie();
    2069     // Set cookies for new paths.
    2070     wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl'));
    2071 }
    2072 
    2073 add_action('update_option_home', 'update_home_siteurl', 10, 2);
    2074 add_action('update_option_siteurl', 'update_home_siteurl', 10, 2);
    2075 
    2076 function wp_crop_image($src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false) {
    2077     if ( ctype_digit($src_file) ) // Handle int as attachment ID
    2078         $src_file = get_attached_file($src_file);
    2079 
    2080     $src = wp_load_image($src_file);
    2081 
    2082     if ( !is_resource($src) )
    2083         return $src;
    2084 
    2085     $dst = imagecreatetruecolor($dst_w, $dst_h);
    2086 
    2087     if ( $src_abs ) {
    2088         $src_w -= $src_x;
    2089         $src_h -= $src_y;
    2090     }
    2091 
    2092     imageantialias($dst, true);
    2093     imagecopyresampled($dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    2094 
    2095     if ( !$dst_file )
    2096         $dst_file = str_replace(basename($src_file), 'cropped-'.basename($src_file), $src_file);
    2097 
    2098     $dst_file = preg_replace('/\\.[^\\.]+$/', '.jpg', $dst_file);
    2099 
    2100     if ( imagejpeg($dst, $dst_file) )
    2101         return $dst_file;
    2102     else
    2103         return false;
    2104 }
    2105 
    2106 function wp_load_image($file) {
    2107     if ( ctype_digit($file) )
    2108         $file = get_attached_file($file);
    2109 
    2110     if ( !file_exists($file) )
    2111         return "File '$file' doesn't exist?";
    2112 
    2113     $contents = file_get_contents($file);
    2114 
    2115     $image = imagecreatefromstring($contents);
    2116 
    2117     if ( !is_resource($image) )
    2118         return "File '$file' is not image?";
    2119 
    2120     return $image;
    2121 }
    2122 
    21231879?>
  • trunk/wp-admin/admin-header.php

    r4431 r3503  
    1 <?php
     1<?php 
    22@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    33if (!isset($_GET["page"])) require_once('admin.php');
    44if ( $editing ) {
    5     wp_enqueue_script( array("dbx-admin-key?pagenow=$pagenow",'admin-custom-fields') );
    6     if ( current_user_can('manage_categories') )
    7         wp_enqueue_script( 'ajaxcat' );
    8     if ( user_can_richedit() )
    9         wp_enqueue_script( 'wp_tiny_mce' );
     5    $dbx_js = true;
     6    $cat_js = true;
    107}
    11 
    12 get_admin_page_title();
    13 
     8if ( $list_js || $cat_js )
     9    $sack_js = true;
    1410?>
     11<?php get_admin_page_title(); ?>
    1512<!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 language_attributes(); ?>>
     13<html xmlns="http://www.w3.org/1999/xhtml">
    1714<head>
    18 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
     15<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
    1916<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
    20 <link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
    21 <?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
    22 <link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
    23 <?php endif; ?>
     17<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
    2418<script type="text/javascript">
    2519//<![CDATA[
     
    2721//]]>
    2822</script>
     23<script type="text/javascript" src="../wp-includes/js/fat.js"></script>
     24<?php if ( $xfn_js ) { ?>
     25<script type="text/javascript" src="xfn.js"></script>
     26<?php } ?>
     27<?php if ( $sack_js ) { ?>
     28<script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
     29<?php } ?>
     30<?php if ( $list_js ) { ?>
     31<script type="text/javascript" src="list-manipulation.js"></script>
     32<?php } ?>
     33<?php if ( $dbx_js ) { ?>
     34<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
     35<script type="text/javascript">
     36//<![CDATA[
     37addLoadEvent( function() {
     38<?php switch ( $pagenow ) : case 'post.php' : ?>
     39var manager = new dbxManager('postmeta');
     40<?php break; case 'page-new.php' : ?>
     41var manager = new dbxManager('pagemeta');
     42<?php break; endswitch; ?>
     43});
     44//]]>
     45</script>
     46<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
     47<?php } ?>
     48<?php if ( $editing && user_can_richedit() ) { ?>
     49<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script>
     50<?php } ?>
     51<?php if ( $cat_js ) { ?>
     52<script type="text/javascript" src="cat-js.php"></script>
     53<?php } ?>
    2954<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?>
    3055<style type="text/css">* html { overflow-x: hidden; }</style>
    31 <?php endif;
    32 if ( isset($page_hook) )
    33     do_action('admin_print_scripts-' . $page_hook);
    34 else if ( isset($plugin_page) )
    35     do_action('admin_print_scripts-' . $plugin_page);
    36 do_action('admin_print_scripts');
    37 
    38 if ( isset($page_hook) )
    39     do_action('admin_head-' . $page_hook);
    40 else if ( isset($plugin_page) )
    41     do_action('admin_head-' . $plugin_page);
    42 do_action('admin_head');
    43 ?>
     56<?php endif; ?>
     57<?php do_action('admin_head'); ?>
    4458</head>
    4559<body>
    4660<div id="wphead">
    47 <h1><?php echo wptexturize(get_option(('blogname'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
     61<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('home') . '/'; ?>"><?php _e('View site') ?> &raquo;</a>)</span></h1>
    4862</div>
    49 <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>
     63<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('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 Account'); ?></a>] </p></div>
    5064
    5165<?php
  • trunk/wp-admin/admin.php

    r4431 r3503  
    66
    77if ( 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'));
     8    die (sprintf(__("Your database is out-of-date.  Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
    99   
    1010require_once(ABSPATH . 'wp-admin/admin-functions.php');
    1111require_once(ABSPATH . 'wp-admin/admin-db.php');
    12 require_once(ABSPATH . WPINC . '/registration.php');
     12require_once(ABSPATH . WPINC . '/registration-functions.php');
    1313
    1414auth_redirect();
     
    1818update_category_cache();
    1919
    20 wp_get_current_user();
     20get_currentuserinfo();
    2121
    22 $posts_per_page = get_option('posts_per_page');
    23 $what_to_show = get_option('what_to_show');
    24 $date_format = get_option('date_format');
    25 $time_format = get_option('time_format');
     22$posts_per_page = get_settings('posts_per_page');
     23$what_to_show = get_settings('what_to_show');
     24$date_format = get_settings('date_format');
     25$time_format = get_settings('time_format');
    2626
    27 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
     27$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
     28for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     29    $wpvar = $wpvarstoreset[$i];
     30    if (!isset($$wpvar)) {
     31        if (empty($_POST["$wpvar"])) {
     32            if (empty($_GET["$wpvar"])) {
     33                $$wpvar = '';
     34            } else {
     35                $$wpvar = $_GET["$wpvar"];
     36            }
     37        } else {
     38            $$wpvar = $_POST["$wpvar"];
     39        }
     40    }
     41}
    2842
    29 wp_enqueue_script( 'fat' );
    30 
    31 $editing = false;
    32 
    33 if (isset($_GET['page'])) {
    34     $plugin_page = stripslashes($_GET['page']);
    35     $plugin_page = plugin_basename($plugin_page);
    36 }
     43$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
    3744
    3845require(ABSPATH . '/wp-admin/menu.php');
    3946
    4047// Handle plugin admin pages.
    41 if (isset($plugin_page)) {
     48if (isset($_GET['page'])) {
     49    $plugin_page = stripslashes($_GET['page']);
     50    $plugin_page = plugin_basename($plugin_page);
    4251    $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
    4352
    4453    if ( $page_hook ) {
    45         do_action('load-' . $page_hook);
    4654        if (! isset($_GET['noheader']))
    4755            require_once(ABSPATH . '/wp-admin/admin-header.php');
    48 
     56       
    4957        do_action($page_hook);
    5058    } else {
    5159        if ( validate_file($plugin_page) ) {
    52             wp_die(__('Invalid plugin page'));
     60            die(__('Invalid plugin page'));
    5361        }
    54 
    55         if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page"))
    56             wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
    57 
    58         do_action('load-' . $plugin_page);
     62       
     63        if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
     64            die(sprintf(__('Cannot load %s.'), $plugin_page));
    5965
    6066        if (! isset($_GET['noheader']))
    6167            require_once(ABSPATH . '/wp-admin/admin-header.php');
    62 
    63         include(ABSPATH . PLUGINDIR . "/$plugin_page");
     68       
     69        include(ABSPATH . "wp-content/plugins/$plugin_page");
    6470    }
    65 
     71   
    6672    include(ABSPATH . 'wp-admin/admin-footer.php');
    6773
    6874    exit();
    6975} else if (isset($_GET['import'])) {
    70 
     76   
    7177    $importer = $_GET['import'];
    7278
    73     if ( ! current_user_can('import') )
    74         wp_die(__('You are not allowed to import.'));
    75 
    7679    if ( validate_file($importer) ) {
    77         wp_die(__('Invalid importer.'));
     80        die(__('Invalid importer.'));
    7881    }
    79 
     82       
    8083    if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
    81         wp_die(__('Cannot load importer.'));
    82 
     84        die(__('Cannot load importer.'));
     85   
    8386    include(ABSPATH . "wp-admin/import/$importer.php");
    8487
    85     $parent_file = 'edit.php';
    86     $submenu_file = 'import.php';
     88    $parent_file = 'import.php';
    8789    $title = __('Import');
    88 
     90   
    8991    if (! isset($_GET['noheader']))
    9092        require_once(ABSPATH . 'wp-admin/admin-header.php');
     
    9698
    9799    call_user_func($wp_importers[$importer][2]);
    98 
     100           
    99101    include(ABSPATH . 'wp-admin/admin-footer.php');
    100102
    101103    exit();
    102 } else {
    103     do_action("load-$pagenow");
    104104}
    105105
  • trunk/wp-admin/bookmarklet.php

    r4431 r3503  
    44
    55if ( ! current_user_can('edit_posts') )
    6     wp_die(__('Cheatin&#8217; uh?'));
     6    die ("Cheatin' uh?");
    77
    88if ('b' == $a):
     
    2626$popuptitle = wp_specialchars(stripslashes($popuptitle));
    2727$text       = wp_specialchars(stripslashes(urldecode($text)));
    28 
     28   
    2929$popuptitle = funky_javascript_fix($popuptitle);
    3030$text       = funky_javascript_fix($text);
    31 
     31   
    3232$post_title = wp_specialchars($_REQUEST['post_title']);
    3333if (!empty($post_title))
     
    3535else
    3636    $post->post_title = $popuptitle;
    37 
     37   
    3838 
    3939$content  = wp_specialchars($_REQUEST['content']);
     
    5151<head>
    5252<title><?php bloginfo('name') ?> &rsaquo; Bookmarklet &#8212; WordPress</title>
    53 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
     53<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
    5454<link rel="stylesheet" href="wp-admin.css" type="text/css" />
    5555
  • trunk/wp-admin/cat-js.php

    r4431 r3503  
    11<?php
    2 require_once('../wp-config.php');
    3 cache_javascript_headers();
     2require_once('admin.php');
     3header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
    44?>
    5 addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
     5var ajaxCat = new sack();
     6var newcat;
     7 
     8function newCatAddIn() {
     9    if ( !document.getElementById('jaxcat') ) return false;
     10    var ajaxcat = document.createElement('span');
     11    ajaxcat.id = 'ajaxcat';
     12
     13    newcat = document.createElement('input');
     14    newcat.type = 'text';
     15    newcat.name = 'newcat';
     16    newcat.id = 'newcat';
     17    newcat.size = '16';
     18    newcat.setAttribute('autocomplete', 'off');
     19    newcat.onkeypress = ajaxNewCatKeyPress;
     20
     21    var newcatSub = document.createElement('input');
     22    newcatSub.type = 'button';
     23    newcatSub.name = 'Button';
     24    newcatSub.id = 'catadd';
     25    newcatSub.value = '<?php echo addslashes(__('Add')); ?>';
     26    newcatSub.onclick = ajaxNewCat;
     27
     28    ajaxcat.appendChild(newcat);
     29    ajaxcat.appendChild(newcatSub);
     30    document.getElementById('jaxcat').appendChild(ajaxcat);
     31
     32    howto = document.createElement('span');
     33    howto.innerHTML = '<?php echo addslashes(__('Separate multiple categories with commas.')); ?>';
     34    howto.id = 'howto';
     35    ajaxcat.appendChild(howto);
     36}
     37
    638addLoadEvent(newCatAddIn);
    7 function newCatAddIn() {
    8     var jaxcat = $('jaxcat');
    9     if ( !jaxcat )
     39
     40function getResponseElement() {
     41    var p = document.getElementById('ajaxcatresponse');
     42    if (!p) {
     43        p = document.createElement('span');
     44        document.getElementById('jaxcat').appendChild(p);
     45        p.id = 'ajaxcatresponse';
     46    }
     47    return p;
     48}
     49
     50function newCatLoading() {
     51    var p = getResponseElement();
     52    p.innerHTML = '<?php echo addslashes(__('Sending Data...')); ?>';
     53}
     54
     55function newCatLoaded() {
     56    var p = getResponseElement();
     57    p.innerHTML = '<?php echo addslashes(__('Data Sent...')); ?>';
     58}
     59
     60function newCatInteractive() {
     61    var p = getResponseElement();
     62    p.innerHTML = '<?php echo addslashes(__('Processing Request...')); ?>';
     63}
     64
     65function newCatCompletion() {
     66    var p = getResponseElement();
     67    var id    = 0;
     68    var ids   = new Array();
     69    var names = new Array();
     70   
     71    ids   = myPload( ajaxCat.response );
     72    names = myPload( newcat.value );
     73    for ( i = 0; i < ids.length; i++ ) {
     74        id = ids[i].replace(/[\n\r]+/g, "");
     75        if ( id == '-1' ) {
     76            p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>";
     77            return;
     78        }
     79        if ( id == '0' ) {
     80            p.innerHTML = "<?php echo addslashes(__('That category name is invalid.  Try something else.')); ?>";
     81            return;
     82        }
     83       
     84        var exists = document.getElementById('category-' + id);
     85       
     86        if (exists) {
     87            var moveIt = exists.parentNode;
     88            var container = moveIt.parentNode;
     89            container.removeChild(moveIt);
     90            container.insertBefore(moveIt, container.firstChild);
     91            moveIt.id = 'new-category-' + id;
     92            exists.checked = 'checked';
     93            var nowClass = moveIt.className;
     94            moveIt.className = nowClass + ' fade';
     95            Fat.fade_all();
     96            moveIt.className = nowClass;
     97        } else {
     98            var catDiv = document.getElementById('categorychecklist');
     99            var newLabel = document.createElement('label');
     100            newLabel.setAttribute('for', 'category-' + id);
     101            newLabel.id = 'new-category-' + id;
     102            newLabel.className = 'selectit fade';
     103   
     104            var newCheck = document.createElement('input');
     105            newCheck.type = 'checkbox';
     106            newCheck.value = id;
     107            newCheck.name = 'post_category[]';
     108            newCheck.id = 'category-' + id;
     109            newLabel.appendChild(newCheck);
     110   
     111            var newLabelText = document.createTextNode(' ' + names[i]);
     112            newLabel.appendChild(newLabelText);
     113   
     114            catDiv.insertBefore(newLabel, catDiv.firstChild);
     115            newCheck.checked = 'checked';
     116   
     117            Fat.fade_all();
     118            newLabel.className = 'selectit';
     119        }
     120        newcat.value = '';
     121    }
     122    p.parentNode.removeChild(p);
     123//  var id = parseInt(ajaxCat.response, 10);
     124}
     125
     126function ajaxNewCatKeyPress(e) {
     127    if (!e) {
     128        if (window.event) {
     129            e = window.event;
     130        } else {
     131            return;
     132        }
     133    }
     134    if (e.keyCode == 13) {
     135        ajaxNewCat();
     136        e.returnValue = false;
     137        e.cancelBubble = true;
    10138        return false;
    11     jaxcat.update('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php _e('Add'); ?>"/><span id="howto"><?php _e('Separate multiple categories with commas.'); ?></span></span>');
    12     $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
    13     $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
     139    }
    14140}
     141
     142function ajaxNewCat() {
     143    var newcat = document.getElementById('newcat');
     144    var split_cats = new Array(1);
     145    var catString = '';
     146
     147    catString = 'ajaxnewcat=' + encodeURIComponent(newcat.value);
     148    ajaxCat.requestFile = 'edit-form-ajax-cat.php';
     149    ajaxCat.method = 'GET';
     150    ajaxCat.onLoading = newCatLoading;
     151    ajaxCat.onLoaded = newCatLoaded;
     152    ajaxCat.onInteractive = newCatInteractive;
     153    ajaxCat.onCompletion = newCatCompletion;
     154    ajaxCat.runAJAX(catString);
     155}
     156
     157function myPload( str ) {
     158    var fixedExplode = new Array();
     159    var comma = new String(',');
     160    var count = 0;
     161    var currentElement = '';
     162
     163    for( x=0; x < str.length; x++) {
     164        andy = str.charAt(x);
     165        if ( comma.indexOf(andy) != -1 ) {
     166            currentElement = currentElement.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // trim
     167            fixedExplode[count] = currentElement;
     168            currentElement = "";
     169            count++;
     170        } else {
     171            currentElement += andy;
     172        }
     173    }
     174
     175    if ( currentElement != "" )
     176        fixedExplode[count] = currentElement;
     177    return fixedExplode;
     178}
  • trunk/wp-admin/categories.php

    r4431 r3503  
    44$title = __('Categories');
    55$parent_file = 'edit.php';
     6$list_js = true;
    67
    7 wp_reset_vars(array('action', 'cat'));
     8$wpvarstoreset = array('action','cat');
     9for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     10    $wpvar = $wpvarstoreset[$i];
     11    if (!isset($$wpvar)) {
     12        if (empty($_POST["$wpvar"])) {
     13            if (empty($_GET["$wpvar"])) {
     14                $$wpvar = '';
     15            } else {
     16                $$wpvar = $_GET["$wpvar"];
     17            }
     18        } else {
     19            $$wpvar = $_POST["$wpvar"];
     20        }
     21    }
     22}
    823
    924switch($action) {
     
    1126case 'addcat':
    1227
    13     check_admin_referer('add-category');
     28    if ( !current_user_can('manage_categories') )
     29        die (__('Cheatin&#8217; uh?'));
     30   
     31    wp_insert_category($_POST);
    1432
    15     if ( !current_user_can('manage_categories') )
    16         wp_die(__('Cheatin&#8217; uh?'));
    17 
    18     if( wp_insert_category($_POST ) ) {
    19         wp_redirect('categories.php?message=1#addcat');
    20     } else {
    21         wp_redirect('categories.php?message=4#addcat');
    22     }
     33    header('Location: categories.php?message=1#addcat');
    2334break;
    2435
    2536case 'delete':
    26     $cat_ID = (int) $_GET['cat_ID'];
    27     check_admin_referer('delete-category_' .  $cat_ID);
     37
     38    check_admin_referer();
    2839
    2940    if ( !current_user_can('manage_categories') )
    30         wp_die(__('Cheatin&#8217; uh?'));
     41        die (__('Cheatin&#8217; uh?'));
    3142
     43    $cat_ID = (int) $_GET['cat_ID'];
    3244    $cat_name = get_catname($cat_ID);
    3345
    34     // Don't delete the default cats.
    35     if ( $cat_ID == get_option('default_category') )
    36         wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    37 
    38     if ( $cat_ID == get_option('default_link_category') )
    39         wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
     46    if ( 1 == $cat_ID )
     47        die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    4048
    4149    wp_delete_category($cat_ID);
    4250
    43     wp_redirect('categories.php?message=2');
     51    header('Location: categories.php?message=2');
    4452
    4553break;
     
    5058    $cat_ID = (int) $_GET['cat_ID'];
    5159    $category = get_category_to_edit($cat_ID);
    52     include('edit-category-form.php');
     60    ?>
     61
     62<div class="wrap">
     63 <h2><?php _e('Edit Category') ?></h2>
     64 <form name="editcat" action="categories.php" method="post">
     65      <table class="editform" width="100%" cellspacing="2" cellpadding="5">
     66        <tr>
     67          <th width="33%" scope="row"><?php _e('Category name:') ?></th>
     68          <td width="67%"><input name="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /> <input type="hidden" name="action" value="editedcat" />
     69<input type="hidden" name="cat_ID" value="<?php echo $category->cat_ID ?>" /></td>
     70        </tr>
     71        <tr>
     72            <th scope="row"><?php _e('Category slug:') ?></th>
     73            <td><input name="category_nicename" type="text" value="<?php echo wp_specialchars($category->category_nicename); ?>" size="40" /></td>
     74        </tr>
     75        <tr>
     76            <th scope="row"><?php _e('Category parent:') ?></th>
     77            <td>       
     78            <select name='category_parent'>
     79      <option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
     80      <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
     81      </select></td>
     82        </tr>
     83        <tr>
     84            <th scope="row"><?php _e('Description:') ?></th>
     85            <td><textarea name="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->category_description, 1); ?></textarea></td>
     86        </tr>
     87        </table>
     88      <p class="submit"><input type="submit" name="submit" value="<?php _e('Edit category') ?> &raquo;" /></p>
     89 </form>
     90 <p><a href="categories.php"><?php _e('&laquo; Return to category list'); ?></a></p>
     91</div>
     92    <?php
    5393
    5494break;
    5595
    5696case 'editedcat':
    57     $cat_ID = (int) $_POST['cat_ID'];
    58     check_admin_referer('update-category_' . $cat_ID);
    59 
    6097    if ( !current_user_can('manage_categories') )
    61         wp_die(__('Cheatin&#8217; uh?'));
    62 
     98        die (__('Cheatin&#8217; uh?'));
     99   
    63100    wp_update_category($_POST);
    64101
    65     wp_redirect('categories.php?message=3');
     102    header('Location: categories.php?message=3');
    66103break;
    67104
    68105default:
    69106
    70 wp_enqueue_script( 'admin-categories' );
    71107require_once ('admin-header.php');
    72108
     
    74110$messages[2] = __('Category deleted.');
    75111$messages[3] = __('Category updated.');
    76 $messages[4] = __('Category not added.');
    77112?>
    78113
     
    87122    <h2><?php _e('Categories') ?> </h2>
    88123<?php endif; ?>
    89 <table class="widefat">
    90     <thead>
     124<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
    91125    <tr>
    92         <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
     126        <th scope="col"><?php _e('ID') ?></th>
    93127        <th scope="col"><?php _e('Name') ?></th>
    94128        <th scope="col"><?php _e('Description') ?></th>
    95         <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
    96         <th scope="col" width="90" style="text-align: center"><?php _e('Bookmarks') ?></th>
    97         <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
     129        <th scope="col"><?php _e('# Posts') ?></th>
     130        <th colspan="2"><?php _e('Action') ?></th>
    98131    </tr>
    99     </thead>
    100     <tbody id="the-list">
    101132<?php
    102133cat_rows();
    103134?>
    104     </tbody>
    105135</table>
     136
     137<div id="ajax-response"></div>
    106138
    107139</div>
     
    109141<?php if ( current_user_can('manage_categories') ) : ?>
    110142<div class="wrap">
    111 <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and bookmarks in that category.  Instead, posts in the deleted category are set to the category <strong>%s</strong> and bookmarks are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p>
     143<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(get_option('default_category'))) ?></p>
    112144</div>
    113145
    114 <?php include('edit-category-form.php'); ?>
     146<div class="wrap">
     147    <h2><?php _e('Add New Category') ?></h2>
     148    <form name="addcat" id="addcat" action="categories.php" method="post">
     149       
     150        <p><?php _e('Name:') ?><br />
     151        <input type="text" name="cat_name" value="" /></p>
     152        <p><?php _e('Category parent:') ?><br />
     153        <select name='category_parent' class='postform'>
     154        <option value='0'><?php _e('None') ?></option>
     155        <?php wp_dropdown_cats(0); ?>
     156        </select></p>
     157        <p><?php _e('Description: (optional)') ?> <br />
     158        <textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
     159        <p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
     160    </form>
     161</div>
    115162<?php endif; ?>
    116163
     
    120167
    121168include('admin-footer.php');
    122 
    123169?>
  • trunk/wp-admin/edit-comments.php

    r4431 r3503  
    44$title = __('Edit Comments');
    55$parent_file = 'edit.php';
    6 wp_enqueue_script( 'admin-comments' );
     6$list_js = true;
    77
    88require_once('admin-header.php');
     
    2424    }
    2525}
    26 
    27 function getNumChecked(form)
    28 {
    29     var num = 0;
    30     for (i = 0, n = form.elements.length; i < n; i++) {
    31         if(form.elements[i].type == "checkbox") {
    32             if(form.elements[i].checked == true)
    33                 num++;
    34         }
    35     }
    36     return num;
    37 }
    3826//-->
    3927</script>
    4028<div class="wrap">
    4129<h2><?php _e('Comments'); ?></h2>
    42 <form name="searchform" action="" method="get" id="editcomments">
     30<form name="searchform" action="" method="get">
    4331  <fieldset>
    4432  <legend><?php _e('Show Comments That Contain...') ?></legend>
     
    4634  <input type="submit" name="submit" value="<?php _e('Search') ?>"  /> 
    4735  <input type="hidden" name="mode" value="<?php echo $mode; ?>" />
    48   <?php _e('(Searches within comment text, e-mail, URL, and IP address.)') ?>
     36  <?php _e('(Searches within comment text, e-mail, URI, and IP address.)') ?>
    4937  </fieldset>
    5038</form>
     
    5240<?php
    5341if ( !empty( $_POST['delete_comments'] ) ) :
    54     check_admin_referer('bulk-comments');
    55 
    5642    $i = 0;
    5743    foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
    5844        $comment = (int) $comment;
    5945        $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
    60         // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
    61         if ( current_user_can('edit_post', $post_id) ) {
    62             if ( !empty( $_POST['spam_button'] ) )
    63                 wp_set_comment_status($comment, 'spam');
    64             else
    65                 wp_set_comment_status($comment, 'delete');
     46        $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
     47        if ( current_user_can('edit_post', $post_id) ) :
     48            wp_set_comment_status($comment, "delete");
    6649            ++$i;
    67         }
     50        endif;
    6851    endforeach;
    69     echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
    70     if ( !empty( $_POST['spam_button'] ) )
    71         printf(__('%s comments marked as spam.'), $i);
    72     else
    73         printf(__('%s comments deleted.'), $i);
    74     echo '</p></div>';
     52    echo "<div class='wrap'><p>" . sprintf(__('%s comments deleted.'), $i) . "</p></div>";
    7553endif;
    7654
     
    10078            $start = '';
    10179
    102         echo "<ol id='the-comment-list' class='commentlist' $start>";
     80        echo "<ol id='the-list' class='commentlist' $start>";
    10381        $i = 0;
    10482        foreach ($comments as $comment) {
     
    11189                $class .= ' alternate';
    11290            echo "<li id='comment-$comment->comment_ID' class='$class'>";
    113 ?>
    114 <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>
     91?>     
     92        <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
     93       
     94        <?php comment_text() ?>
    11595
    116 <?php comment_text() ?>
    117 
    118 <p><?php comment_date('M j, g:i A');  ?> &#8212; [
    119 <?php
    120 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    121     echo " <a href='comment.php?action=editcomment&amp;comment=".$comment->comment_ID."'>" .  __('Edit') . '</a>';
    122     echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    123     if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    124         echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
    125         echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    126     }
    127     echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;delete_type=spam&amp;p=" . $comment->comment_post_ID . "&amp;comment=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ";
    128 }
    129 $post = get_post($comment->comment_post_ID);
    130 $post_title = wp_specialchars( $post->post_title, 'double' );
    131 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
    132 ?>
    133  | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ]</p>
     96        <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); 
     97            if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
     98                echo " | <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
     99                echo " | <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\">" . __('Delete Comment') . "</a> &#8212; ";
     100            } // end if any comments to show
     101            // Get post title
     102            if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
     103                $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID");
     104                $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
     105                ?> <a href="post.php?action=edit&amp;post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post &#8220;%s&#8221;'), stripslashes($post_title)); ?></a>
     106                <?php } ?>
     107             | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
    134108        </li>
    135109
    136 <?php } // end foreach($comment) ?>
     110<?php } // end foreach ?>
    137111</ol>
    138112
     
    140114
    141115<?php
    142     } else { //no comments to show
     116    } else {
    143117
    144118        ?>
    145119        <p>
    146120        <strong><?php _e('No comments found.') ?></strong></p>
    147 
     121       
    148122        <?php
    149123    } // end if ($comments)
     
    151125
    152126    if ($comments) {
    153         echo '<form name="deletecomments" id="deletecomments" action="" method="post"> ';
    154         wp_nonce_field('bulk-comments');
    155         echo '<table class="widefat">
    156 <thead>
     127        echo '<form name="deletecomments" id="deletecomments" action="" method="post">
     128        <table width="100%" cellpadding="3" cellspacing="3">
    157129  <tr>
    158     <th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById(\'deletecomments\'));" /></th>
     130    <th scope="col">*</th>
    159131    <th scope="col">' .  __('Name') . '</th>
    160132    <th scope="col">' .  __('E-mail') . '</th>
    161133    <th scope="col">' . __('IP') . '</th>
    162134    <th scope="col">' . __('Comment Excerpt') . '</th>
    163     <th scope="col" colspan="3" style="text-align: center">' .  __('Actions') . '</th>
    164   </tr>
    165 </thead>';
     135    <th scope="col" colspan="3">' .  __('Actions') . '</th>
     136  </tr>';
    166137        foreach ($comments as $comment) {
    167138        $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    168         $comment_status = wp_get_comment_status($comment->comment_ID);
    169139        $class = ('alternate' == $class) ? '' : 'alternate';
    170         $class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
    171140?>
    172   <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
     141  <tr class='<?php echo $class; ?>'>
    173142    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
    174143    <td><?php comment_author_link() ?></td>
     
    176145    <td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
    177146    <td><?php comment_excerpt(); ?></td>
    178     <td>
    179         <?php if ('unapproved' == $comment_status) { ?>
    180             (Unapproved)
    181         <?php } else { ?>
    182             <a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
    183         <?php } ?>
    184     </td>
     147    <td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
    185148    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    186     echo "<a href='comment.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
     149    echo "<a href='post.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
    187150    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    188         echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape( $comment->comment_author ))  . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
    189         } ?></td>
     151            echo "<a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\"    class='delete'>" . __('Delete') . "</a>"; } ?></td>
    190152  </tr>
    191153        <?php
    192154        } // end foreach
    193155    ?></table>
    194 <p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php _e("Please select some comments to delete"); ?>'); return false } return confirm('<?php printf(__("You are about to delete %s comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete."), "' + numchecked + '"); ?>')" />
    195             <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p>
     156    <p><a href="javascript:;" onclick="checkAll(document.getElementById('deletecomments')); return false; "><?php _e('Invert Checkbox Selection') ?></a></p>
     157            <p class="submit"><input type="submit" name="Submit" value="<?php _e('Delete Checked Comments') ?> &raquo;" onclick="return confirm('<?php _e("You are about to delete these comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete.") ?>')" /> </p>
    196158  </form>
    197 <div id="ajax-response"></div>
    198159<?php
    199160    } else {
  • trunk/wp-admin/edit-form-advanced.php

    r4431 r3503  
    1515
    1616<div class="wrap">
     17<h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
     18 <small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
    1719<?php
    1820
     
    2022    $form_action = 'post';
    2123    $temp_ID = -1 * time();
    22     $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
    23     wp_nonce_field('add-post');
     24    $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
    2425} else {
    2526    $form_action = 'editpost';
    26     $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
    27     wp_nonce_field('update-post_' .  $post_ID);
     27    $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
    2828}
    2929
     
    3838    $already_pinged = explode("\n", trim($post->pinged));
    3939    foreach ($already_pinged as $pinged_url) {
    40         $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
     40        $pings .= "\n\t<li>$pinged_url</li>";
    4141    }
    4242    $pings .= '</ul>';
     
    5050
    5151<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
    52 <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
    53 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
     52<input type="hidden" name="action" value="<?php echo $form_action ?>" />
    5453<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
    55 <input type="hidden" id="post_type" name="post_type" value="post" />
    5654
    5755<?php echo $form_extra ?>
     
    6967<div id="moremeta">
    7068<div id="grabit" class="dbx-group">
    71 
    72 <fieldset id="categorydiv" class="dbx-box">
    73 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
    74 <div class="dbx-content">
    75 <p id="jaxcat"></p>
    76 <ul id="categorychecklist"><?php dropdown_categories(); ?></ul></div>
    77 </fieldset>
    7869
    7970<fieldset id="commentstatusdiv" class="dbx-box">
     
    8980
    9081<fieldset id="passworddiv" class="dbx-box">
    91 <h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
     82<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
    9283<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
    9384</fieldset>
    9485
    9586<fieldset id="slugdiv" class="dbx-box">
    96 <h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
     87<h3 class="dbx-handle"><?php _e('Post slug') ?></h3>
    9788<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
    9889</fieldset>
    9990
    100 <fieldset id="poststatusdiv" class="dbx-box">
     91<fieldset id="categorydiv" class="dbx-box">
     92<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
     93<div class="dbx-content">
     94<p id="jaxcat"></p>
     95<div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
     96</fieldset>
     97
     98<fieldset class="dbx-box">
    10199<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
    102100<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
    103 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
     101<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
    104102<?php endif; ?>
    105103      <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
     
    108106
    109107<?php if ( current_user_can('edit_posts') ) : ?>
    110 <fieldset id="posttimestampdiv" class="dbx-box">
     108<fieldset class="dbx-box">
    111109<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
    112110<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
     
    114112<?php endif; ?>
    115113
    116 <?php
    117 $authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM
    118 if ( $authors && count( $authors ) > 1 ) :
    119 ?>
     114<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
    120115<fieldset id="authordiv" class="dbx-box">
    121 <h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3>
     116<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
    122117<div class="dbx-content">
    123118<select name="post_author_override" id="post_author_override">
     
    148143<legend><?php _e('Post') ?></legend>
    149144
    150     <?php the_editor($post->post_content); ?>
    151 </fieldset>
     145<?php
     146 $rows = get_settings('default_post_edit_rows');
     147 if (($rows < 3) || ($rows > 100)) {
     148     $rows = 12;
     149 }
     150?>
     151<?php the_quicktags(); ?>
     152
     153<div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
     154</fieldset>
     155
     156<script type="text/javascript">
     157<!--
     158edCanvas = document.getElementById('content');
     159<?php if ( user_can_richedit() ) : ?>
     160// This code is meant to allow tabbing from Title to Post (TinyMCE).
     161if ( tinyMCE.isMSIE )
     162    document.getElementById('title').onkeydown = function (e)
     163        {
     164            e = e ? e : window.event;
     165            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     166                var i = tinyMCE.selectedInstance;
     167                if(typeof i ==  'undefined')
     168                    return true;
     169                                tinyMCE.execCommand("mceStartTyping");
     170                this.blur();
     171                i.contentWindow.focus();
     172                e.returnValue = false;
     173                return false;
     174            }
     175        }
     176else
     177    document.getElementById('title').onkeypress = function (e)
     178        {
     179            e = e ? e : window.event;
     180            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     181                var i = tinyMCE.selectedInstance;
     182                if(typeof i ==  'undefined')
     183                    return true;
     184                                tinyMCE.execCommand("mceStartTyping");
     185                this.blur();
     186                i.contentWindow.focus();
     187                e.returnValue = false;
     188                return false;
     189            }
     190        }
     191<?php endif; ?>
     192//-->
     193</script>
    152194
    153195<?php echo $form_pingback ?>
     
    155197
    156198
    157 <p class="submit">
    158 <span id="autosave"></span>
    159 <?php echo $saveasdraft; ?>
    160 <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
     199<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
    161200<?php
    162201if ('publish' != $post->post_status || 0 == $post_ID) {
     
    171210if ( !empty($_REQUEST['popupurl']) )
    172211    echo wp_specialchars($_REQUEST['popupurl']);
    173 else if ( url_to_postid(wp_get_referer()) == $post_ID )
     212else if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
    174213    echo 'redo';
    175214else
    176     echo wp_specialchars(wp_get_referer());
     215    echo wp_specialchars($_SERVER['HTTP_REFERER']);
    177216?>" /></p>
    178217
     
    182221if (current_user_can('upload_files')) {
    183222    $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
    184     $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
     223    $uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID";
    185224    $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
    186225    if ( false != $uploading_iframe_src )
    187         echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
     226        echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
    188227}
    189228?>
     
    191230<div id="advancedstuff" class="dbx-group" >
    192231
    193 <div class="dbx-box-wrapper">
    194232<fieldset id="postexcerpt" class="dbx-box">
    195 <div class="dbx-handle-wrapper">
    196233<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
    197 </div>
    198 <div class="dbx-content-wrapper">
    199234<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
    200 </div>
    201 </fieldset>
    202 </div>
    203 
    204 <div class="dbx-box-wrapper">
    205 <fieldset id="trackbacksdiv" class="dbx-box">
    206 <div class="dbx-handle-wrapper">
     235</fieldset>
     236
     237<fieldset class="dbx-box">
    207238<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
    208 </div>
    209 <div class="dbx-content-wrapper">
    210239<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
    211240<?php
     
    214243?>
    215244</div>
    216 </div>
    217 </fieldset>
    218 </div>
    219 
    220 <div class="dbx-box-wrapper">
     245</fieldset>
     246
    221247<fieldset id="postcustom" class="dbx-box">
    222 <div class="dbx-handle-wrapper">
    223248<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
    224 </div>
    225 <div class="dbx-content-wrapper">
    226249<div id="postcustomstuff" class="dbx-content">
    227 <table cellpadding="3">
    228 <?php
    229 $metadata = has_meta($post_ID);
    230 list_meta($metadata);
    231 ?>
    232 
    233 </table>
    234 <?php
     250<?php
     251if($metadata = has_meta($post_ID)) {
     252?>
     253<?php
     254    list_meta($metadata);
     255?>
     256<?php
     257}
    235258    meta_form();
    236259?>
    237 <div id="ajax-response"></div>
    238 </div>
    239 </div>
    240 </fieldset>
    241 </div>
     260</div>
     261</fieldset>
    242262
    243263<?php do_action('dbx_post_advanced'); ?>
     
    245265</div>
    246266
    247 <?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
    248 <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
     267<?php if ('edit' == $action) : ?>
     268<input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), addslashes($post->post_title) ) . "')\""; ?> />
    249269<?php endif; ?>
    250270
  • trunk/wp-admin/edit-form-comment.php

    r4431 r3503  
    66?>
    77
    8 <form name="post" action="comment.php" method="post" id="post">
    9 <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
     8<form name="post" action="post.php" method="post" id="post">
    109<div class="wrap">
    1110<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
     
    1918</script>
    2019<fieldset id="namediv">
    21     <legend><label for="name"><?php _e('Name:') ?></label></legend>
     20    <legend><?php _e('Name:') ?></legend>
    2221    <div>
    23       <input type="text" name="newcomment_author" size="25" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" />
     22      <input type="text" name="newcomment_author" size="22" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" />
    2423    </div>
    2524</fieldset>
    2625<fieldset id="emaildiv">
    27         <legend><label for="email"><?php _e('E-mail:') ?></label></legend>
     26        <legend><?php _e('E-mail:') ?></legend>
    2827        <div>
    29           <input type="text" name="newcomment_author_email" size="20" value="<?php echo $comment->comment_author_email ?>" tabindex="2" id="email" />
     28          <input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email ?>" tabindex="2" id="email" />
    3029    </div>
    3130</fieldset>
    3231<fieldset id="uridiv">
    33         <legend><label for="URL"><?php _e('URL:') ?></label></legend>
     32        <legend><?php _e('URI:') ?></legend>
    3433        <div>
    3534          <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" />
     
    3938<fieldset style="clear: both;">
    4039        <legend><?php _e('Comment') ?></legend>
    41     <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
     40<?php the_quicktags(); ?>
     41
     42<?php
     43 $rows = get_settings('default_post_edit_rows');
     44 if (($rows < 3) || ($rows > 100)) {
     45     $rows = 10;
     46 }
     47?>
     48<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div>
    4249</fieldset>
    4350
     51<script type="text/javascript">
     52<!--
     53edCanvas = document.getElementById('content');
     54<?php if ( user_can_richedit() ) : ?>
     55// This code is meant to allow tabbing from Author URL to Post (TinyMCE).
     56if ( tinyMCE.isMSIE )
     57    document.getElementById('newcomment_author_url').onkeydown = function (e)
     58        {
     59            e = e ? e : window.event;
     60            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     61                var i = tinyMCE.selectedInstance;
     62                if(typeof i ==  'undefined')
     63                    return true;
     64                                tinyMCE.execCommand("mceStartTyping");
     65                this.blur();
     66                i.contentWindow.focus();
     67                e.returnValue = false;
     68                return false;
     69            }
     70        }
     71else
     72    document.getElementById('newcomment_author_url').onkeypress = function (e)
     73        {
     74            e = e ? e : window.event;
     75            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     76                var i = tinyMCE.selectedInstance;
     77                if(typeof i ==  'undefined')
     78                    return true;
     79                                tinyMCE.execCommand("mceStartTyping");
     80                this.blur();
     81                i.contentWindow.focus();
     82                e.returnValue = false;
     83                return false;
     84            }
     85        }
     86<?php endif; ?>
     87//-->
     88</script>
     89
    4490<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
    45   <input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
     91  <input name="referredby" type="hidden" id="referredby" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
    4692</p>
    4793
     
    61107<?php if ( current_user_can('edit_posts') ) : ?>
    62108    <tr>
    63         <th scope="row" valign="top"><?php _e('Edit time'); ?>:</th>
    64         <td><?php touch_time(('editcomment' == $action), 0); ?> </td>
     109        <th scope="row"><?php _e('Edit time'); ?>:</th>
     110        <td><?php touch_time(('editcomment' == $action), 0); ?></td>
    65111    </tr>
    66112<?php endif; ?>
    67113
    68114    <tr>
    69         <th scope="row" valign="top"><?php _e('Delete'); $delete_nonce = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); ?>:</th>
    70         <td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . __("You are about to delete this comment \\n  \'Cancel\' to stop, \'OK\' to delete.") . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
    71         <input type="hidden" name="comment" value="<?php echo $comment->comment_ID ?>" />
    72         <input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
    73         <input type="hidden" name="noredir" value="1" />
    74     </td>
     115        <th scope="row"><?php _e('Delete'); ?>:</th>
     116        <td><p><a class="delete" href="post.php?action=confirmdeletecomment&amp;noredir=true&amp;comment=<?php echo $comment->comment_ID; ?>&amp;p=<?php echo $comment->comment_post_ID; ?>"><?php _e('Delete comment') ?></a></p></td>
    75117    </tr>
    76118</table>
  • trunk/wp-admin/edit-form.php

    r4431 r3503  
    3535<?php the_quicktags(); ?>
    3636<?php
    37  $rows = get_option('default_post_edit_rows');
     37 $rows = get_settings('default_post_edit_rows');
    3838 if (($rows < 3) || ($rows > 100)) {
    3939     $rows = 10;
     
    5252<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />
    5353
    54 <p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
     54<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
    5555    <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
    5656
     
    6565      echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing &raquo;') . '" />';
    6666  } ?>
    67   <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
     67  <input name="referredby" type="hidden" id="referredby" value="<?php if (isset($_SERVER['HTTP_REFERER'])) echo urlencode($_SERVER['HTTP_REFERER']); ?>" />
    6868</p>
    6969
  • trunk/wp-admin/edit-link-form.php

    r4431 r3503  
    11<?php
    22if ( ! empty($link_id) ) {
    3     $heading = __('Edit Link');
     3    $editing = true;
     4    $heading = __('Edit a link:');
    45    $submit_text = __('Save Changes &raquo;');
    5     $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
    6     $nonce_action = 'update-bookmark_' . $link_id;
     6    $form = '<form action="" method="post" name="editlink" id="editlink">';
    77} else {
    8     $heading = __('Add Link');
     8    $editing = false;
     9    $heading = __('<strong>Add</strong> a link:');
    910    $submit_text = __('Add Link &raquo;');
    10     $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
    11     $nonce_action = 'add-bookmark';
     11    $form = '<form name="addlink" method="post" action="link-manager.php">';
    1212}
    1313
     
    2929    }
    3030}
     31
    3132?>
    3233
    3334<div class="wrap">
    34 <h2><?php echo $heading ?></h2>
    35 <?php echo $form ?>
    36 <?php wp_nonce_field($nonce_action); ?>
    37 
    38 <div id="poststuff">
    39 <div id="moremeta">
    40 <div id="grabit" class="dbx-group">
    41 
    42 <fieldset id="categorydiv" class="dbx-box">
    43 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
    44 <div class="dbx-content">
    45 <p id="jaxcat"></p>
    46 <ul id="categorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
    47 </div>
    48 </fieldset>
    49 
    50 <fieldset class="dbx-box">
    51 <h3 class="dbx-handle"><?php _e('Target') ?></h3>
    52 <div class="dbx-content">
    53 <label for="link_target_blank" class="selectit">
    54 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
    55 <code>_blank</code></label>
    56 <label for="link_target_top" class="selectit">
    57 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
    58 <code>_top</code></label>
    59 <label for="link_target_none" class="selectit">
    60 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
    61 <?php _e('none') ?></label>
    62 </div>
    63 </fieldset>
    64 
    65 <fieldset class="dbx-box">
    66 <h3 class="dbx-handle"><?php _e('Visible') ?></h3>
    67 <div class="dbx-content">
    68 <label for="link_visible_yes" class="selectit">
    69 <input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
    70 <?php _e('Yes') ?></label>
    71 <label for="link_visible_no" class="selectit">
    72 <input id="link_visible_no" type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
    73 <?php _e('No') ?></label>
    74 </div>
    75 </fieldset>
    76 
    77 </div>
    78 </div>
    79 
    80 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    81 <tr>
    82 <th scope="row" valign="top"><label for="link_name"><?php _e('Name:') ?></label></th>
    83 <td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
    84 </tr>
    85 <tr>
    86 <th width="20%" scope="row" valign="top"><label for="link_url"><?php _e('Address:') ?></label></th>
    87 <td width="80%"><input type="text" name="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td>
    88 </tr>
    89 <tr>
    90 <th scope="row" valign="top"><label for="link_description"><?php _e('Description:') ?></label></th>
    91 <td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
    92 </tr>
    93 </table>
    94 
    95 <p class="submit">
    96 <input type="submit" name="submit" value="<?php echo $submit_text ?>" />
    97 </p>
    98 
    99 <div id="advancedstuff" class="dbx-group" >
    100 
    101 <fieldset id="xfn" class="dbx-box">
    102 <h3 class="dbx-handle"><?php _e('Link Relationship (XFN)') ?></h3>
    103 <div class="dbx-content">
    104 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    105     <tr>
    106         <th width="20%" scope="row"><?php _e('rel:') ?></th>
    107         <td width="80%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
    108     </tr>
    109     <tr>
    110         <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
    111         <td>
    112             <table cellpadding="3" cellspacing="5">
    113                 <tr>
    114                     <th scope="row"> <?php _e('identity') ?> </th>
    115                     <td>
    116                         <label for="me">
    117                         <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
    118                         <?php _e('another web address of mine') ?></label>
    119                     </td>
    120                 </tr>
    121                 <tr>
    122                     <th scope="row"> <?php _e('friendship') ?> </th>
    123                     <td>
    124                         <label for="contact">
    125                         <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
    126                         <label for="acquaintance">
    127                         <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
    128                         <label for="friend">
    129                         <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
    130                         <label for="friendship">
    131                         <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
    132                     </td>
    133                 </tr>
    134                 <tr>
    135                     <th scope="row"> <?php _e('physical') ?> </th>
    136                     <td>
    137                         <label for="met">
    138                         <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
    139                         <?php _e('met') ?></label>
    140                     </td>
    141                 </tr>
    142                 <tr>
    143                     <th scope="row"> <?php _e('professional') ?> </th>
    144                     <td>
    145                         <label for="co-worker">
    146                         <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
    147                         <?php _e('co-worker') ?></label>
    148                         <label for="colleague">
    149                         <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
    150                         <?php _e('colleague') ?></label>
    151                     </td>
    152                 </tr>
    153                 <tr>
    154                     <th scope="row"> <?php _e('geographical') ?> </th>
    155                     <td>
    156                         <label for="co-resident">
    157                         <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
    158                         <?php _e('co-resident') ?></label>
    159                         <label for="neighbor">
    160                         <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
    161                         <?php _e('neighbor') ?></label>
    162                         <label for="geographical">
    163                         <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
    164                         <?php _e('none') ?></label>
    165                     </td>
    166                 </tr>
    167                 <tr>
    168                     <th scope="row"> <?php _e('family') ?> </th>
    169                     <td>
    170                         <label for="child">
    171                         <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
    172                         <?php _e('child') ?></label>
    173                         <label for="kin">
    174                         <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
    175                         <?php _e('kin') ?></label>
    176                         <label for="parent">
    177                         <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
    178                         <?php _e('parent') ?></label>
    179                         <label for="sibling">
    180                         <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
    181                         <?php _e('sibling') ?></label>
    182                         <label for="spouse">
    183                         <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
    184                         <?php _e('spouse') ?></label>
    185                         <label for="family">
    186                         <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
    187                         <?php _e('none') ?></label>
    188                     </td>
    189                 </tr>
    190                 <tr>
    191                     <th scope="row"> <?php _e('romantic') ?> </th>
    192                     <td>
    193                         <label for="muse">
    194                         <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
    195                         <?php _e('muse') ?></label>
    196                         <label for="crush">
    197                         <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
    198                         <?php _e('crush') ?></label>
    199                         <label for="date">
    200                         <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
    201                         <?php _e('date') ?></label>
    202                         <label for="romantic">
    203                         <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
    204                         <?php _e('sweetheart') ?></label>
    205                     </td>
    206                 </tr>
    207             </table>
    208         </td>
    209     </tr>
    210 </table>
    211 </div>
    212 </fieldset>
    213 
    214 <fieldset id="advanced" class="dbx-box">
    215 <h3 class="dbx-handle"><?php _e('Advanced') ?></h3>
    216 <div class="dbx-content">
    217 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    218     <tr>
    219         <th width="20%" scope="row"><?php _e('Image Address:') ?></th>
    220         <td width="80%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
    221     </tr>
    222     <tr>
    223         <th scope="row"><?php _e('RSS Address:') ?> </th>
    224         <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
    225     </tr>
    226     <tr>
    227         <th scope="row"><?php _e('Notes:') ?></th>
    228         <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
    229     </tr>
    230     <tr>
    231         <th scope="row"><?php _e('Rating:') ?></th>
    232         <td><select name="link_rating" size="1">
    233         <?php
    234             for ($r = 0; $r < 10; $r++) {
    235                 echo('            <option value="'.$r.'" ');
    236                 if ($link->link_rating == $r)
    237                     echo 'selected="selected"';
    238                 echo('>'.$r.'</option>');
    239             }
    240         ?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
    241         </td>
    242     </tr>
     35  <?php echo $form ?>
     36  <h2><?php echo $heading ?></h2>
     37<fieldset class="options">
     38    <legend><?php _e('Basics') ?></legend>
     39        <table class="editform" width="100%" cellspacing="2" cellpadding="5">
     40         <tr>
     41           <th width="33%" scope="row"><?php _e('URI:') ?></th>
     42           <td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td>
     43         </tr>
     44         <tr>
     45           <th scope="row"><?php _e('Link Name:') ?></th>
     46           <td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
     47         </tr>
     48         <tr>
     49            <th scope="row"><?php _e('Short description:') ?></th>
     50            <td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
     51            </tr>
     52        <tr>
     53           <th scope="row"><?php _e('Category:') ?></th>
     54           <td><?php link_category_dropdown('link_category', $link->link_category); ?></td>
     55         </tr>
    24356</table>
    24457</fieldset>
     58       <p class="submit">
     59       <input type="submit" name="submit" value="<?php echo $submit_text ?>" />
     60       </p>
     61    <fieldset class="options">
     62        <legend><?php _e('Link Relationship (XFN)') ?></legend>
     63        <table class="editform" width="100%" cellspacing="2" cellpadding="5">
     64            <tr>
     65                <th width="33%" scope="row"><?php _e('rel:') ?></th>
     66                <td width="67%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
     67            </tr>
     68            <tr>
     69                <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
     70                <td>
     71                    <table cellpadding="3" cellspacing="5">
     72              <tr>
     73              <th scope="row"> <?php _e('identity') ?> </th>
     74              <td>
     75                <label for="me">
     76                <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
     77          <?php _e('another web address of mine') ?></label>
     78              </td>
     79            </tr>
     80            <tr>
     81              <th scope="row"> <?php _e('friendship') ?> </th>
     82              <td>
     83                <label for="contact">
     84                <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
     85                <label for="acquaintance">
     86                <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
     87                <label id="friend">
     88                <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
     89                <label for="friendship">
     90                <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
     91              </td>
     92            </tr>
     93            <tr>
     94              <th scope="row"> <?php _e('physical') ?> </th>
     95              <td>
     96                <label for="met">
     97                <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
     98          <?php _e('met') ?></label>
     99              </td>
     100            </tr>
     101            <tr>
     102              <th scope="row"> <?php _e('professional') ?> </th>
     103              <td>
     104                <label for="co-worker">
     105                <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
     106          <?php _e('co-worker') ?></label>
     107                <label for="colleague">
     108                <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
     109          <?php _e('colleague') ?></label>
     110              </td>
     111            </tr>
     112            <tr>
     113              <th scope="row"> <?php _e('geographical') ?> </th>
     114              <td>
     115                <label for="co-resident">
     116                <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
     117          <?php _e('co-resident') ?></label>
     118                <label for="neighbor">
     119                <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
     120          <?php _e('neighbor') ?></label>
     121                <label for="geographical">
     122                <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
     123          <?php _e('none') ?></label>
     124              </td>
     125            </tr>
     126            <tr>
     127              <th scope="row"> <?php _e('family') ?> </th>
     128              <td>
     129                <label for="child">
     130                <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
     131          <?php _e('child') ?></label>
     132                <label for="kin">
     133                <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
     134          <?php _e('kin') ?></label>
     135                <label for="parent">
     136                <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
     137          <?php _e('parent') ?></label>
     138                <label for="sibling">
     139                <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
     140          <?php _e('sibling') ?></label>
     141                <label for="spouse">
     142                <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
     143          <?php _e('spouse') ?></label>
     144                <label for="family">
     145                <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
     146          <?php _e('none') ?></label>
     147              </td>
     148            </tr>
     149            <tr>
     150              <th scope="row"> <?php _e('romantic') ?> </th>
     151              <td>
     152                <label for="muse">
     153                <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
     154         <?php _e('muse') ?></label>
     155                <label for="crush">
     156                <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
     157         <?php _e('crush') ?></label>
     158                <label for="date">
     159                <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
     160         <?php _e('date') ?></label>
     161                <label for="romantic">
     162                <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
     163         <?php _e('sweetheart') ?></label>
     164              </td>
     165            </tr>
     166        </table>
     167          </td>
     168            </tr>
     169</table>
     170</fieldset>
     171       <p class="submit">
     172       <input type="submit" name="submit" value="<?php echo $submit_text ?>" />
     173       </p>
     174<fieldset class="options">
     175        <legend><?php _e('Advanced') ?></legend>
     176        <table class="editform" width="100%" cellspacing="2" cellpadding="5">
     177         <tr>
     178           <th width="33%" scope="row"><?php _e('Image URI:') ?></th>
     179           <td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
     180         </tr>
     181<tr>
     182           <th scope="row"><?php _e('RSS URI:') ?> </th>
     183           <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
     184         </tr>
     185         <tr>
     186           <th scope="row"><?php _e('Notes:') ?></th>
     187           <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
     188         </tr>
     189         <tr>
     190           <th scope="row"><?php _e('Rating:') ?></th>
     191           <td><select name="link_rating" size="1">
     192<?php
     193    for ($r = 0; $r < 10; $r++) {
     194      echo('            <option value="'.$r.'" ');
     195      if ($link->link_rating == $r)
     196        echo 'selected="selected"';
     197      echo('>'.$r.'</option>');
     198    }
     199?>
     200           </select>
     201         &nbsp;<?php _e('(Leave at 0 for no rating.)') ?> </td>
     202         </tr>
     203         <tr>
     204           <th scope="row"><?php _e('Target') ?></th>
     205           <td><label>
     206          <input type="radio" name="link_target" value="_blank"   <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
     207          <code>_blank</code></label><br />
     208<label>
     209<input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
     210<code>_top</code></label><br />
     211<label>
     212<input type="radio" name="link_target" value=""     <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
     213<?php _e('none') ?></label><br />
     214<?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
     215         </tr>
     216         <tr>
     217           <th scope="row"><?php _e('Visible:') ?></th>
     218           <td><label>
     219             <input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
     220<?php _e('Yes') ?></label><br /><label>
     221<input type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
     222<?php _e('No') ?></label></td>
     223         </tr>
     224</table>
     225</fieldset>
     226<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
     227<?php if ( $editing ) : ?>
     228          <input type="hidden" name="action" value="editlink" />
     229          <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
     230          <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
     231          <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
     232<?php else: ?>
     233        <input type="hidden" name="action" value="Add" />
     234<?php endif; ?>
     235</form>
    245236</div>
    246 
    247 <?php if ( $link_id ) : ?>
    248 <input type="hidden" name="action" value="save" />
    249 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
    250 <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
    251 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
    252 <?php else: ?>
    253 <input type="hidden" name="action" value="add" />
    254 <?php endif; ?>
    255 </div>
    256 </form>
    257 </div>
  • trunk/wp-admin/edit-page-form.php

    r4431 r3503  
    11
    22<div class="wrap">
    3 <h2 id="write-post"><?php _e('Write Page'); ?></h2>
     3<h2 id="write-post"><?php _e('Write Page'); ?><?php if ( 0 != $post_ID ) : ?>
     4<small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
    45<?php
    56if (0 == $post_ID) {
    67    $form_action = 'post';
    7     $nonce_action = 'add-page';
    88    $temp_ID = -1 * time();
    9     $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
     9    $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
    1010} else {
    1111    $form_action = 'editpost';
    12     $nonce_action = 'update-page_' . $post_ID;
    13     $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
    14 }
    15 
    16 $sendto = wp_get_referer();
     12    $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
     13}
     14
     15$sendto = $_SERVER['HTTP_REFERER'];
    1716
    1817if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
     
    2221?>
    2322
    24 <form name="post" action="page.php" method="post" id="post">
    25 
    26 <?php
    27 wp_nonce_field($nonce_action);
    28 
     23<form name="post" action="post.php" method="post" id="post">
     24
     25<?php
    2926if (isset($mode) && 'bookmarklet' == $mode) {
    3027    echo '<input type="hidden" name="mode" value="bookmarklet" />';
     
    3229?>
    3330<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
    34 <input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
    35 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
     31<input type="hidden" name="action" value='<?php echo $form_action ?>' />
    3632<?php echo $form_extra ?>
    37 <input type="hidden" id="post_type" name="post_type" value="page" />
     33<input type="hidden" name="post_status" value="static" />
    3834
    3935<script type="text/javascript">
    40 // <![CDATA[
     36<!--
    4137function focusit() { // focus on first input field
    4238    document.post.title.focus();
    4339}
    4440addLoadEvent(focusit);
    45 // ]]>
     41//-->
    4642</script>
    4743<div id="poststuff">
     
    6056</fieldset>
    6157
    62 <fieldset class="dbx-box">
    63 <h3 class="dbx-handle"><?php _e('Page Status') ?></h3>
    64 <div class="dbx-content"><?php if ( current_user_can('publish_pages') ) : ?>
    65 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
    66 <?php endif; ?>
    67       <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
    68       <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
    69 </fieldset>
    70 
    7158<fieldset id="passworddiv" class="dbx-box">
    72 <h3 class="dbx-handle"><?php _e('Page Password') ?></h3>
     59<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
    7360<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
    7461</fieldset>
     
    8471
    8572<?php if ( 0 != count( get_page_templates() ) ) { ?>
    86 <fieldset id="pagetemplate" class="dbx-box">
     73<fieldset id="pageparent" class="dbx-box">
    8774<h3 class="dbx-handle"><?php _e('Page Template:') ?></h3>
    8875<div class="dbx-content"><p><select name="page_template">
     
    9582
    9683<fieldset id="slugdiv" class="dbx-box">
    97 <h3 class="dbx-handle"><?php _e('Page Slug') ?></h3>
     84<h3 class="dbx-handle"><?php _e('Post slug') ?></h3>
    9885<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
    9986</fieldset>
     
    10188<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
    10289<fieldset id="authordiv" class="dbx-box">
    103 <h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3>
     90<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
    10491<div class="dbx-content">
    10592<select name="post_author_override" id="post_author_override">
     
    135122<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
    136123    <legend><?php _e('Page Content') ?></legend>
    137     <?php the_editor($post->post_content); ?>
    138 </fieldset>
     124<?php
     125 $rows = get_settings('default_post_edit_rows');
     126 if (($rows < 3) || ($rows > 100)) {
     127     $rows = 10;
     128 }
     129?>
     130<?php the_quicktags(); ?>
     131
     132<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
     133</fieldset>
     134
     135<script type="text/javascript">
     136<!--
     137edCanvas = document.getElementById('content');
     138<?php if ( user_can_richedit() ) : ?>
     139// This code is meant to allow tabbing from Title to Post (TinyMCE).
     140if ( tinyMCE.isMSIE )
     141    document.getElementById('title').onkeydown = function (e)
     142        {
     143            e = e ? e : window.event;
     144            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     145                var i = tinyMCE.selectedInstance;
     146                if(typeof i ==  'undefined')
     147                    return true;
     148                                tinyMCE.execCommand("mceStartTyping");
     149                this.blur();
     150                i.contentWindow.focus();
     151                e.returnValue = false;
     152                return false;
     153            }
     154        }
     155else
     156    document.getElementById('title').onkeypress = function (e)
     157        {
     158            e = e ? e : window.event;
     159            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     160                var i = tinyMCE.selectedInstance;
     161                if(typeof i ==  'undefined')
     162                    return true;
     163                                tinyMCE.execCommand("mceStartTyping");
     164                this.blur();
     165                i.contentWindow.focus();
     166                e.returnValue = false;
     167                return false;
     168            }
     169        }
     170<?php endif; ?>
     171//-->
     172</script>
    139173
    140174<p class="submit">
    141 <span id="autosave"></span>
    142 <input name="save" type="submit" id="save" tabindex="3" value="<?php _e('Save and Continue Editing'); ?>" />
    143 <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
    144 <?php
    145 if ('publish' != $post->post_status || 0 == $post_ID):
    146 ?>
    147 <?php if ( current_user_can('publish_pages') ) : ?>
    148     <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
    149 <?php endif; endif;?>
     175<?php if ( $post_ID ) : ?>
     176<input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/>
     177<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Save') : _e('Create New Page') ?> &raquo;" />
     178<?php else : ?>
     179<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> &raquo;" />
     180<?php endif; ?>
    150181<input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" />
    151182</p>
     
    156187if (current_user_can('upload_files')) {
    157188    $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
    158     $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
     189    $uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID";
    159190    $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
    160191    if ( false != $uploading_iframe_src )
    161         echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
     192        echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
    162193}
    163194?>
     
    168199<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
    169200<div id="postcustomstuff" class="dbx-content">
    170 <table cellpadding="3">
    171201<?php
    172 $metadata = has_meta($post_ID);
    173 list_meta($metadata);
    174 ?>
    175 
    176 </table>
    177 <?php
     202if($metadata = has_meta($post_ID)) {
     203?>
     204<?php
     205    list_meta($metadata);
     206?>
     207<?php
     208}
    178209    meta_form();
    179210?>
    180211</div>
    181 <div id="ajax-response"></div>
    182212</fieldset>
    183213
     
    186216</div>
    187217
    188 <?php if ('edit' == $action) :
    189     $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
    190     if ( current_user_can('delete_page', $post->ID) ) ?>
    191         <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
    192 <?php endif; ?>
    193 </div>
    194 
     218<?php if ('edit' == $action) : ?>
     219        <input name="deletepost" class="delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $wpdb->escape($post->post_title) ) . "')\""; ?> />
     220<?php endif; ?>
    195221</form>
    196222
    197223</div>
     224
     225</div>
  • trunk/wp-admin/edit-pages.php

    r4431 r3503  
    33$title = __('Pages');
    44$parent_file = 'edit.php';
    5 wp_enqueue_script( 'listman' );
     5$list_js = true;
    66require_once('admin-header.php');
    77?>
     
    99<div class="wrap">
    1010<h2><?php _e('Page Management'); ?></h2>
    11 <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
     11<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page'); ?> &raquo;</a></p>
    1212
    1313<form name="searchform" action="" method="get">
     
    2020
    2121<?php
    22 wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1');
    2322
    24 if ( $_GET['s'] )
    25     $all = false;
     23$show_post_type = 'page';
     24
     25if ( isset($_GET['s']) )
     26    wp();
    2627else
    27     $all = true;
     28    $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
    2829
    2930if ($posts) {
    3031?>
    31 <table class="widefat">
    32   <thead>
    33   <tr>
    34     <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
    35     <th scope="col"><?php _e('Title') ?></th>
     32<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
     33  <tr>
     34    <th scope="col"><?php _e('ID') ?></th>
     35    <th scope="col"><?php _e('Title') ?></th>
    3636    <th scope="col"><?php _e('Owner') ?></th>
    3737    <th scope="col"><?php _e('Updated') ?></th>
    38     <th scope="col" colspan="3" style="text-align: center"><?php _e('Action'); ?></th>
     38    <th scope="col"></th>
     39    <th scope="col"></th>
     40    <th scope="col"></th>
     41  </tr>
     42<?php
     43if ( isset($_GET['s']) ) {
     44foreach ( $posts as $post ) :
     45    $class = ('alternate' != $class) ? 'alternate' : ''; ?>
     46  <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
     47    <th scope="row"><?php echo $post->ID; ?></th>
     48    <td>
     49      <?php echo $pad; ?><?php the_title() ?>
     50    </td>
     51    <td><?php the_author() ?></td>
     52    <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
     53    <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
     54    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
     55    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    3956  </tr>
    40   </thead>
    41   <tbody id="the-list">
    4257<?php
    43 page_rows(0, 0, $posts, $all);
     58endforeach;
     59} else {
     60    page_rows();
     61}
    4462?>
    45   </tbody>
    46 </table>
     63</table>
    4764
    4865<div id="ajax-response"></div>
     
    5673?>
    5774
    58 <h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3>
     75<h3><a href="page-new.php"><?php _e('Create New Page'); ?> &raquo;</a></h3>
    5976
    6077</div>
  • trunk/wp-admin/edit.php

    r4431 r3503  
    44$title = __('Posts');
    55$parent_file = 'edit.php';
    6 wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
     6$list_js = true;
    77require_once('admin-header.php');
    88
     
    5656<h2>
    5757<?php
    58 
    59 wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
     58$what_to_show = 'posts';
     59$posts_per_page = 15;
     60$posts_per_archive_page = -1;
     61
     62wp();
    6063
    6164if ( is_month() ) {
     
    7477</h2>
    7578
    76 <form name="searchform" id="searchform" action="" method="get">
     79<form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;">
    7780  <fieldset>
    7881  <legend><?php _e('Search Posts&hellip;') ?></legend>
    7982  <input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" />
    80   <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />
     83  <input type="submit" name="submit" value="<?php _e('Search') ?>" />
    8184  </fieldset>
    8285</form>
    8386
    84 <?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
     87<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
    8588
    8689if ( count($arc_result) ) { ?>
    8790
    88 <form name="viewarc" id="viewarc" action="" method="get">
     91<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
    8992    <fieldset>
    9093    <legend><?php _e('Browse Month&hellip;') ?></legend>
    9194    <select name='m'>
    9295    <?php
    93         foreach ($arc_result as $arc_row) {
    94             if ( $arc_row->yyear == 0 )
    95                 continue;
    96             $arc_row->mmonth = zeroise($arc_row->mmonth, 2);
    97 
    98             if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] )
     96        foreach ($arc_result as $arc_row) {         
     97            $arc_year  = $arc_row->yyear;
     98            $arc_month = $arc_row->mmonth;
     99           
     100            if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
    99101                $default = 'selected="selected"';
    100102            else
    101103                $default = null;
    102 
    103             echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
    104             echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
     104           
     105            echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
     106            echo $month[zeroise($arc_month, 2)] . " $arc_year";
    105107            echo "</option>\n";
    106108        }
    107109    ?>
    108110    </select>
    109         <input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
     111        <input type="submit" name="submit" value="<?php _e('Show Month') ?>" />
    110112    </fieldset>
    111113</form>
     
    113115<?php } ?>
    114116
    115 <form name="viewcat" id="viewcat" action="" method="get">
    116     <fieldset>
    117     <legend><?php _e('Browse Category&hellip;') ?></legend>
    118     <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
    119     <input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" />
    120     </fieldset>
    121 </form>
    122 
    123 <?php do_action('restrict_manage_posts'); ?>
    124 
    125117<br style="clear:both;" />
    126118
    127119<?php
     120
    128121// define the columns to display, the syntax is 'internal name' => 'display name'
    129122$posts_columns = array(
     
    144137?>
    145138
    146 <table class="widefat">
    147     <thead>
     139<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
    148140    <tr>
    149141
     
    153145
    154146    </tr>
    155     </thead>
    156     <tbody id="the-list">
    157147<?php
    158148if ($posts) {
    159149$bgcolor = '';
    160150foreach ($posts as $post) { start_wp();
    161 add_filter('the_title','wp_specialchars');
    162151$class = ('alternate' == $class) ? '' : 'alternate';
    163152?>
     
    169158
    170159    switch($column_name) {
    171 
     160   
    172161    case 'id':
    173162        ?>
    174         <th scope="row" style="text-align: center"><?php echo $id ?></th>
     163        <th scope="row"><?php echo $id ?></th>
    175164        <?php
    176165        break;
     
    196185    case 'comments':
    197186        ?>
    198         <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
     187        <td><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
    199188      <?php comments_number(__('0'), __('1'), __('%')) ?>
    200189      </a></td>
     
    222211    case 'control_delete':
    223212        ?>
    224         <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title()) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     213        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    225214        <?php
    226215        break;
     
    244233<?php
    245234} // end if ($posts)
    246 ?>
    247     </tbody>
     235?>
    248236</table>
    249237
     
    261249    if ($comments) {
    262250    ?>
    263 <h3 id="comments"><?php _e('Comments') ?></h3>
    264 <ol id="the-comment-list" class="commentlist">
    265 <?php
    266 $i = 0;
     251<h3><?php _e('Comments') ?></h3>
     252<ol id="comments">
     253<?php
    267254foreach ($comments as $comment) {
    268 
    269         ++$i; $class = '';
    270         $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
    271             $comment_status = wp_get_comment_status($comment->comment_ID);
    272             if ('unapproved' == $comment_status)
    273                 $class .= ' unapproved';
    274             if ($i % 2)
    275                 $class .= ' alternate';
    276             echo "<li id='comment-$comment->comment_ID' class='$class'>";
    277 ?>
    278 <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>
    279 
    280 <?php comment_text() ?>
    281 
    282 <p><?php comment_date('M j, g:i A');  ?> &#8212; [
    283 <?php
    284 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    285     echo " <a href='comment.php?action=editcomment&amp;comment=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
    286     echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
    287     if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    288         echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
    289         echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
    290     }
    291     echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;delete_type=spam&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> ]";
    292 } // end if any comments to show
    293 ?>
    294 </p>
    295         </li>
    296 
     255$comment_status = wp_get_comment_status($comment->comment_ID);
     256?>
     257
     258<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
     259  <?php comment_date('Y-n-j') ?>
     260  @
     261  <?php comment_time('g:m:s a') ?>
     262  <?php
     263            if ( current_user_can('edit_post', $post->ID) ) {
     264                echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" .  __('Edit') . "</a>";
     265                echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
     266                if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
     267                    if ('approved' == wp_get_comment_status($comment->comment_ID)) {
     268                        echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
     269                    } else {
     270                        echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
     271                    }
     272                }
     273                echo "]";
     274            } // end if any comments to show
     275            ?>
     276  <br />
     277  <strong>
     278  <?php comment_author() ?>
     279  (
     280  <?php comment_author_email_link() ?>
     281  /
     282  <?php comment_author_url_link() ?>
     283  )</strong> (IP:
     284  <?php comment_author_IP() ?>
     285  )
     286  <?php comment_text() ?>
     287
     288</li>
     289<!-- /comment -->
    297290<?php //end of the loop, don't delete
    298291        } // end foreach
  • trunk/wp-admin/import.php

    r4431 r3503  
    22require_once ('admin.php');
    33$title = __('Import');
    4 $parent_file = 'edit.php';
     4$parent_file = 'import.php';
    55require_once ('admin-header.php');
    66?>
     
    3131} else {
    3232?>
    33 <table class="widefat">
     33<table width="100%" cellpadding="3" cellspacing="3">
    3434
    3535<?php
     
    3737    foreach ($importers as $id => $data) {
    3838        $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
    39         $action = "<a href='admin.php?import=$id' title='".wptexturize(strip_tags($data[1]))."'>{$data[0]}</a>";
     39        $action = "<a href='admin.php?import=$id' title='{$data[1]}'>{$data[0]}</a>";
    4040
    4141        if ($style != '')
     
    4343        echo "
    4444            <tr $style>
    45                 <td class='import-system'>$action</td>
    46                 <td class='desc'>{$data[1]}</td>
     45                <td class=\"togl\">$action</td>
     46                <td class=\"desc\">{$data[1]}</td>
    4747            </tr>";
    4848    }
  • trunk/wp-admin/import/blogger.php

    r4431 r3503  
    2626    function restart() {
    2727        delete_option('import-blogger');
    28         wp_redirect("admin.php?import=blogger");
     28        header("Location: admin.php?import=blogger");
    2929        die();
    3030    }
     
    136136        if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    137137        $response = curl_exec ($ch);
    138 
     138   
    139139        if ($parse) {
    140140            $response = $this->parse_response($response);
     
    142142            return $response;
    143143        }
    144 
     144   
    145145        return $response;
    146146    }
     
    211211        update_option('import-blogger', $this->import);
    212212    }
    213 
     213   
    214214    // Redirects to next step
    215215    function do_next_step() {
    216         wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
     216        header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
    217217        die();
    218218    }
     
    225225                $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>');
    226226            }
    227 
    228             // Try logging in. If we get an array of cookies back, we at least connected.
     227       
     228            // Try logging in. If we get an array of cookies back, we at least connected.       
    229229            $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
    230230            if ( !is_array( $this->import['cookies'] ) ) {
    231231                $this->login_form(__('Login failed. Please enter your credentials again.'));
    232232            }
    233 
     233           
    234234            // Save the password so we can log the browser in when it's time to publish.
    235235            $this->import['pass'] = $_POST['pass'];
     
    242242            preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#U', $response['body'], $blogsary);
    243243            if ( ! count( $blogsary[1] < 1 ) )
    244                 wp_die(__('No blogs found for this user.'));
     244                die(__('No blogs found for this user.'));
    245245            $this->import['blogs'] = array();
    246246            $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>';
     
    274274            }
    275275            update_option('import-blogger', $this->import);
    276             wp_redirect("admin.php?import=blogger&noheader=true&step=1");
     276            header("Location: admin.php?import=blogger&noheader=true&step=1");
    277277        }
    278278        die();
     
    307307                            $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers);
    308308                            if ( $response['code'] >= 400 )
    309                                 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>');
     309                                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>');
    310310                            $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/';
    311311                            sleep(2);
     
    322322                    $response = $this->post_blogger($posturl, $headers, $paramary);
    323323                    if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') )
    324                         wp_die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
     324                        die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
    325325                }
    326326                $output .= "<del><p>$blog_opt</p></del>\n";
     
    342342                $form.= $body;
    343343                $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>";
    344                 $output.= '<p>'.sprintf(__('<strong>%s</strong> in progress, please wait...'), $blog_opt)."</p>\n";
     344                $output.= '<p>'.sprintf('<strong>%s</strong> in progress, please wait...', $blog_opt)."</p>\n";
    345345            } else {
    346346                $output.= "<p>$blog_opt</p>\n";
     
    365365        $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']);
    366366        if (! strstr($bloghtml['body'], '<a class="archive"') )
    367             wp_die(__('Your Blogger blog did not take the new template or did not respond.'));
     367            die(__('Your Blogger blog did not take the new template or did not respond.'));
    368368        preg_match_all('#<a class="archive" href="([^"]*)"#', $bloghtml['body'], $archives);
    369369        foreach ($archives[1] as $archive) {
     
    396396                $archive = $this->get_blogger($url);
    397397                if ( $archive['code'] > 200 )
    398                     continue;
     398                    continue;   
    399399                $posts = explode('<wordpresspost>', $archive['body']);
    400400                for ($i = 1; $i < count($posts); $i = $i + 1) {
     
    410410                    $post_author_name = $wpdb->escape(trim($postinfo[1]));
    411411                    $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
    412 
     412   
    413413                    if ( $this->lump_authors ) {
    414414                        // Ignore Blogger authors. Use the current user_ID for all posts imported.
     
    421421                            $user_password = substr(md5(uniqid(microtime())), 0, 6);
    422422                            $result = wp_create_user( $user_login, $user_password, $user_email );
    423                             $status.= sprintf(__('Registered user <strong>%s</strong>.'), $user_login);
     423                            $status.= sprintf('Registered user <strong>%s</strong>.', $user_login);
    424424                            $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login;
    425425                        }
     
    436436                    $postminute = zeroise($post_date_His[1], 2);
    437437                    $postsecond = zeroise($post_date_His[2], 2);
    438 
     438   
    439439                    if (($post_date[2] == 'PM') && ($posthour != '12'))
    440440                        $posthour = $posthour + 12;
    441441                    else if (($post_date[2] == 'AM') && ($posthour == '12'))
    442442                        $posthour = '00';
    443 
     443   
    444444                    $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
    445 
     445   
    446446                    $post_content = addslashes($post_content);
    447447                    $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
    448 
     448   
    449449                    $post_title = addslashes($post_title);
    450 
     450           
    451451                    $post_status = 'publish';
    452 
     452   
    453453                    if ( $ID = post_exists($post_title, '', $post_date) ) {
    454454                        $post_array[$i]['ID'] = $ID;
     
    510510                }
    511511                $status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount,  $skippedpostcount).' '.
    512                     sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcount, $skippedcommentcount).' '.
     512                    sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcoun, $skippedcommentcount).' '.
    513513                    ' <strong>'.__('Done').'</strong>';
    514514                $import = $this->import;
     
    547547                        sleep(2);
    548548                        if ( $response['code'] >= 400 )
    549                             wp_die('<h1>'.__('Error restoring publishMode').'</h1><p>'.__('Please tell the devs.').'</p>' . addslashes(print_r($response, 1)) );
     549                            die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
    550550                    }
    551551                }
     
    598598            $this->restart();
    599599        }
    600 
     600       
    601601        if ( isset($_GET['noheader']) ) {
    602             header('Content-Type: text/html; charset=utf-8');
    603 
    604             $this->import = get_option('import-blogger');
     602            $this->import = get_settings('import-blogger');
    605603
    606604            if ( false === $this->import ) {
     
    616614            }
    617615//echo "Step $step.";
    618 //wp_die('<pre>'.print_r($this->import,1).'</pre');
     616//die('<pre>'.print_r($this->import,1).'</pre');
    619617            switch ($step) {
    620618                case 0 :
     
    650648            }
    651649            die;
    652 
     650           
    653651        } else {
    654652            $this->greet();
     
    663661$blogger_import = new Blogger_Import();
    664662
    665 register_importer('blogger', __('Blogger and Blog*Spot'), __('Import <strong>posts and comments</strong> from your Blogger account'), array ($blogger_import, 'start'));
     663register_importer('blogger', 'Blogger', __('Import posts and comments from a Blogger account'), array ($blogger_import, 'start'));
    666664
    667665?>
  • trunk/wp-admin/import/dotclear.php

    • Property svn:eol-style deleted
    r4431 r3503  
    11<?php
    2 /*
    3  * Dotclear import plugin
    4  * by Thomas Quinot - http://thomas.quinot.org/
    5  */
    6 
    72/**
    83    Add These Functions to make our lives easier
     
    138    {
    149    global $wpdb;
    15 
     10   
    1611    $cat_id -= 0;   // force numeric
    1712    $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
    18 
     13   
    1914    return $name;
    2015    }
     
    133128    {
    134129        echo '<div class="wrap">';
    135         echo '<h2>'.__('Import DotClear').'</h2>';
     130        echo '<h2>'.__('Import Dotclear').'</h2>';
    136131        echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
    137132    }
     
    141136        echo '</div>';
    142137    }
    143 
     138   
    144139    function greet()
    145140    {
    146         echo '<div class="narrow"><p&