Changeset 4495
- Timestamp:
- 11/19/2006 07:56:05 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 99 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r2303 r4495 1 <?php 1 <?php 2 2 /* Short and sweet */ 3 3 define('WP_USE_THEMES', true); -
trunk/wp-admin/admin-ajax.php
r4424 r4495 129 129 case 'add-cat' : // From Manage->Categories 130 130 if ( !current_user_can( 'manage_categories' ) ) 131 131 die('-1'); 132 132 if ( !$cat = wp_insert_category( $_POST ) ) 133 133 die('0'); -
trunk/wp-admin/admin-db.php
r4490 r4495 49 49 if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) 50 50 return array($user->id); 51 else 51 else 52 52 return false; 53 53 } … … 97 97 98 98 $cat_name = apply_filters('pre_category_name', $cat_name); 99 99 100 100 if (empty ($category_nicename)) 101 101 $category_nicename = sanitize_title($cat_name); … … 199 199 else 200 200 $cats = array_diff($cats, array($cat_ID)); 201 wp_set_post_categories($post_id, $cats); 201 wp_set_post_categories($post_id, $cats); 202 202 } 203 203 … … 210 210 else 211 211 $cats = array_diff($cats, array($cat_ID)); 212 wp_set_link_cats($link_id, $cats); 213 } 214 212 wp_set_link_cats($link_id, $cats); 213 } 214 215 215 wp_cache_delete($cat_ID, 'category'); 216 216 wp_cache_delete('all_category_ids', 'category'); … … 286 286 function wp_revoke_user($id) { 287 287 $id = (int) $id; 288 288 289 289 $user = new WP_User($id); 290 $user->remove_all_caps(); 290 $user->remove_all_caps(); 291 291 } 292 292 … … 386 386 387 387 // Passed link category list overwrites existing category list if not empty. 388 388 if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) 389 389 && 0 != count($linkdata['link_category']) ) 390 391 else 392 390 $link_cats = $linkdata['link_category']; 391 else 392 $link_cats = $link['link_category']; 393 393 394 394 // Merge old and new fields with new fields overwriting old ones. 395 395 $linkdata = array_merge($link, $linkdata); 396 396 $linkdata['link_category'] = $link_cats; 397 397 398 398 return wp_insert_link($linkdata); … … 403 403 404 404 do_action('delete_link', $link_id); 405 405 406 406 $categories = wp_get_link_cats($link_id); 407 407 if( is_array( $categories ) ) { … … 419 419 global $wpdb; 420 420 421 $sql = "SELECT category_id 422 FROM $wpdb->link2cat 423 WHERE link_id = $link_ID 421 $sql = "SELECT category_id 422 FROM $wpdb->link2cat 423 WHERE link_id = $link_ID 424 424 ORDER BY category_id"; 425 425 … … 442 442 // First the old categories 443 443 $old_categories = $wpdb->get_col(" 444 SELECT category_id 445 FROM $wpdb->link2cat 444 SELECT category_id 445 FROM $wpdb->link2cat 446 446 WHERE link_id = $link_ID"); 447 447 … … 458 458 foreach ($delete_cats as $del) { 459 459 $wpdb->query(" 460 DELETE FROM $wpdb->link2cat 461 WHERE category_id = $del 462 AND link_id = $link_ID 460 DELETE FROM $wpdb->link2cat 461 WHERE category_id = $del 462 AND link_id = $link_ID 463 463 "); 464 464 } … … 471 471 foreach ($add_cats as $new_cat) { 472 472 $wpdb->query(" 473 INSERT INTO $wpdb->link2cat (link_id, category_id) 473 INSERT INTO $wpdb->link2cat (link_id, category_id) 474 474 VALUES ($link_ID, $new_cat)"); 475 475 } 476 476 } 477 477 478 478 // Update category counts. 479 479 $all_affected_cats = array_unique(array_merge($link_categories, $old_categories)); -
trunk/wp-admin/admin-functions.php
r4492 r4495 1140 1140 </select> 1141 1141 <input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/> 1142 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @ 1143 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : 1144 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 1145 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 1142 <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @ 1143 <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : 1144 <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 1145 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> 1146 1146 <?php 1147 1147 if ( $edit ) { … … 1388 1388 } 1389 1389 } 1390 1390 1391 1391 return true; 1392 1392 } -
trunk/wp-admin/bookmarklet.php
r4144 r4495 36 36 $post->post_title = $popuptitle; 37 37 38 38 39 39 $content = wp_specialchars($_REQUEST['content']); 40 40 $popupurl = wp_specialchars($_REQUEST['popupurl']); 41 42 43 44 45 41 if ( !empty($content) ) { 42 $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) ); 43 } else { 44 $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text"; 45 } 46 46 47 47 /* /big funky fixes */ 48 48 49 49 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 78 78 79 79 #wpbookmarklet .wrap { 80 80 border: 0px; 81 81 } 82 82 83 83 #wpbookmarklet #postdiv { 84 84 margin-bottom: 0.5em; 85 85 } 86 86 87 87 #wpbookmarklet #titlediv { 88 88 margin-bottom: 1em; 89 89 } 90 90 -
trunk/wp-admin/categories.php
r4490 r4495 49 49 case 'edit': 50 50 51 52 53 54 51 require_once ('admin-header.php'); 52 $cat_ID = (int) $_GET['cat_ID']; 53 $category = get_category_to_edit($cat_ID); 54 include('edit-category-form.php'); 55 55 56 56 break; -
trunk/wp-admin/custom-fields.js
r4187 r4495 15 15 if ('text' == inputs[i].type) { 16 16 inputs[i].setAttribute('autocomplete', 'off'); 17 17 inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; 18 18 } 19 19 if ('updatemeta' == inputs[i].className) { 20 20 inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; 21 21 } 22 22 } -
trunk/wp-admin/dbx-admin-key-js.php
r4424 r4495 10 10 case 'page.php' : 11 11 case 'page-new.php' : 12 $man = 'pagemeta'; 12 $man = 'pagemeta'; 13 13 break; 14 14 case 'link.php' : -
trunk/wp-admin/edit-category-form.php
r4482 r4495 23 23 <table class="editform" width="100%" cellspacing="2" cellpadding="5"> 24 24 <tr> 25 26 25 <th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th> 26 <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td> 27 27 </tr> 28 28 <tr> -
trunk/wp-admin/edit-comments.php
r4480 r4495 144 144 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 145 145 $comment_status = wp_get_comment_status($comment->comment_ID); 146 if ('unapproved' == $comment_status) 146 if ('unapproved' == $comment_status) 147 147 $class .= ' unapproved'; 148 148 if ($i % 2) … … 154 154 <?php comment_text() ?> 155 155 156 <p><?php comment_date('M j, g:i A'); ?> — [ 156 <p><?php comment_date('M j, g:i A'); ?> — [ 157 157 <?php 158 158 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { … … 182 182 ?> 183 183 <p> 184 184 <strong><?php _e('No comments found.') ?></strong></p> 185 185 186 186 <?php -
trunk/wp-admin/edit-form-advanced.php
r4349 r4495 9 9 10 10 <form name="post" action="post.php" method="post" id="post"> 11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || 12 isset($_GET['popupurl']) ): ?> 11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?> 13 12 <input type="hidden" name="mode" value="bookmarklet" /> 14 13 <?php endif; ?> … … 122 121 <div class="dbx-content"> 123 122 <select name="post_author_override" id="post_author_override"> 124 <?php 123 <?php 125 124 foreach ($authors as $o) : 126 125 $o = get_userdata( $o->ID ); … … 141 140 142 141 <fieldset id="titlediv"> 143 <legend><?php _e('Title') ?></legend> 144 142 <legend><?php _e('Title') ?></legend> 143 <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> 145 144 </fieldset> 146 145 … … 209 208 <div class="dbx-content-wrapper"> 210 209 <div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>) 211 <?php 210 <?php 212 211 if ( ! empty($pings) ) 213 212 echo $pings; … … 228 227 <?php 229 228 $metadata = has_meta($post_ID); 230 list_meta($metadata); 229 list_meta($metadata); 231 230 ?> 232 231 -
trunk/wp-admin/edit-form-comment.php
r4437 r4495 55 55 <th scope="row" valign="top"><?php _e('Comment Status') ?>:</th> 56 56 <td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br /> 57 58 57 <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br /> 58 <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td> 59 59 </tr> 60 60 -
trunk/wp-admin/edit-form.php
r4144 r4495 55 55 <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p> 56 56 57 <p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> 58 57 <p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> 58 <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" /> 59 59 60 60 <?php if ( current_user_can('edit_posts') ) : ?> 61 <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" /> 61 <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" /> 62 62 <?php endif; ?> 63 63 64 64 <?php if ('bookmarklet' != $mode) { 65 66 67 65 echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing »') . '" />'; 66 } ?> 67 <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" /> 68 68 </p> 69 69 -
trunk/wp-admin/edit-link-form.php
r4144 r4495 31 31 ?> 32 32 33 <div class="wrap"> 33 <div class="wrap"> 34 34 <h2><?php echo $heading ?></h2> 35 35 <?php echo $form ?> … … 49 49 50 50 <fieldset class="dbx-box"> 51 <h3 class="dbx-handle"><?php _e('Target') ?></h3> 51 <h3 class="dbx-handle"><?php _e('Target') ?></h3> 52 52 <div class="dbx-content"> 53 53 <label for="link_target_blank" class="selectit"> … … 64 64 65 65 <fieldset class="dbx-box"> 66 <h3 class="dbx-handle"><?php _e('Visible') ?></h3> 66 <h3 class="dbx-handle"><?php _e('Visible') ?></h3> 67 67 <div class="dbx-content"> 68 68 <label for="link_visible_yes" class="selectit"> -
trunk/wp-admin/edit-page-form.php
r4397 r4495 17 17 18 18 if ( 0 != $post_ID && $sendto == get_permalink($post_ID) ) 19 19 $sendto = 'redo'; 20 20 $sendto = wp_specialchars( $sendto ); 21 21 … … 28 28 29 29 if (isset($mode) && 'bookmarklet' == $mode) { 30 30 echo '<input type="hidden" name="mode" value="bookmarklet" />'; 31 31 } 32 32 ?> … … 104 104 <div class="dbx-content"> 105 105 <select name="post_author_override" id="post_author_override"> 106 <?php 106 <?php 107 107 foreach ($authors as $o) : 108 108 $o = get_userdata( $o->ID ); … … 118 118 119 119 <fieldset id="pageorder" class="dbx-box"> 120 <h3 class="dbx-handle"><?php _e('Page Order') ?></h3> 120 <h3 class="dbx-handle"><?php _e('Page Order') ?></h3> 121 121 <div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div> 122 122 </fieldset> … … 169 169 <div id="postcustomstuff" class="dbx-content"> 170 170 <table cellpadding="3"> 171 <?php 171 <?php 172 172 $metadata = has_meta($post_ID); 173 list_meta($metadata); 173 list_meta($metadata); 174 174 ?> 175 175 … … 187 187 188 188 <?php if ('edit' == $action) : 189 $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); 189 $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); 190 190 if ( current_user_can('delete_page', $post->ID) ) ?> 191 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;\""; ?> /> -
trunk/wp-admin/edit-pages.php
r4480 r4495 11 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 »'); ?></a></p> 12 12 13 <form name="searchform" action="" method="get"> 14 <fieldset> 15 16 <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" /> 17 <input type="submit" name="submit" value="<?php _e('Search') ?>" /> 18 13 <form name="searchform" action="" method="get"> 14 <fieldset> 15 <legend><?php _e('Search Pages…') ?></legend> 16 <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" /> 17 <input type="submit" name="submit" value="<?php _e('Search') ?>" /> 18 </fieldset> 19 19 </form> 20 20 … … 54 54 <?php 55 55 } // end if ($posts) 56 ?> 56 ?> 57 57 58 58 <h3><a href="page-new.php"><?php _e('Create New Page »'); ?></a></h3> … … 60 60 </div> 61 61 62 <?php include('admin-footer.php'); ?> 62 <?php include('admin-footer.php'); ?> -
trunk/wp-admin/edit.php
r4491 r4495 13 13 14 14 if ($drafts || $other_drafts) { 15 ?> 15 ?> 16 16 <div class="wrap"> 17 17 <?php if ($drafts) { ?> 18 <p><strong><?php _e('Your Drafts:') ?></strong> 19 18 <p><strong><?php _e('Your Drafts:') ?></strong> 19 <?php 20 20 $i = 0; 21 21 foreach ($drafts as $draft) { … … 28 28 ++$i; 29 29 } 30 ?> 31 .</p> 32 <?php } ?> 33 34 <?php if ($other_drafts) { ?> 35 <p><strong><?php _e('Other’s Drafts:') ?></strong> 36 30 ?> 31 .</p> 32 <?php } ?> 33 34 <?php if ($other_drafts) { ?> 35 <p><strong><?php _e('Other’s Drafts:') ?></strong> 36 <?php 37 37 $i = 0; 38 38 foreach ($other_drafts as $draft) { … … 45 45 ++$i; 46 46 } 47 ?> 48 .</p> 47 ?> 48 .</p> 49 49 50 50 <?php } ?> … … 89 89 <fieldset> 90 90 <legend><?php _e('Browse Month…') ?></legend> 91 91 <select name='m'> 92 92 <?php 93 93 foreach ($arc_result as $arc_row) { … … 128 128 // define the columns to display, the syntax is 'internal name' => 'display name' 129 129 $posts_columns = array( 130 131 132 133 134 135 130 'id' => __('ID'), 131 'date' => __('When'), 132 'title' => __('Title'), 133 'categories' => __('Categories'), 134 'comments' => __('Comments'), 135 'author' => __('Author') 136 136 ); 137 137 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); … … 144 144 ?> 145 145 146 <table class="widefat"> 146 <table class="widefat"> 147 147 <thead> 148 148 <tr> … … 161 161 add_filter('the_title','wp_specialchars'); 162 162 $class = ('alternate' == $class) ? '' : 'alternate'; 163 ?> 163 ?> 164 164 <tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'> 165 165 … … 196 196 case 'comments': 197 197 ?> 198 <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1"> 199 <?php comments_number(__('0'), __('1'), __('%')) ?> 200 198 <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1"> 199 <?php comments_number(__('0'), __('1'), __('%')) ?> 200 </a></td> 201 201 <?php 202 202 break; … … 260 260 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); 261 261 if ($comments) { 262 ?> 263 <h3 id="comments"><?php _e('Comments') ?></h3> 264 <ol id="the-comment-list" class="commentlist"> 262 ?> 263 <h3 id="comments"><?php _e('Comments') ?></h3> 264 <ol id="the-comment-list" class="commentlist"> 265 265 <?php 266 266 $i = 0; … … 270 270 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 271 271 $comment_status = wp_get_comment_status($comment->comment_ID); 272 if ('unapproved' == $comment_status) 272 if ('unapproved' == $comment_status) 273 273 $class .= ' unapproved'; 274 274 if ($i % 2) … … 300 300 }//end if comments 301 301 ?> 302 <?php } ?> 303 </div> 304 <?php 302 <?php } ?> 303 </div> 304 <?php 305 305 include('admin-footer.php'); 306 ?> 306 ?> -
trunk/wp-admin/export.php
r4485 r4495 73 73 74 74 <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"--> 75 <rss version="2.0" 75 <rss version="2.0" 76 76 xmlns:content="http://purl.org/rss/1.0/modules/content/" 77 77 xmlns:wfw="http://wellformedweb.org/CommentAPI/" … … 109 109 <wp:post_type><?php echo $post->post_type; ?></wp:post_type> 110 110 <?php 111 $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); 111 $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); 112 112 if ( $postmeta ) { 113 113 ?> … … 120 120 <?php } ?> 121 121 <?php 122 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); 122 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); 123 123 if ( $comments ) { foreach ( $comments as $c ) { ?> 124 124 <wp:comment> -
trunk/wp-admin/import/blogger.php
r4369 r4495 518 518 } 519 519 $output.= "<p>$archivename $status</p>\n"; 520 520 } 521 521 if ( ! $did_one ) 522 522 $this->set_next_step(7); -
trunk/wp-admin/import/blogware.php
r4424 r4495 21 21 return strtr($string, $trans_tbl); 22 22 } 23 23 24 24 function greet() { 25 25 echo '<div class="narrow">'; … … 31 31 function import_posts() { 32 32 global $wpdb, $current_user; 33 33 34 34 set_magic_quotes_runtime(0); 35 35 $importdata = file($this->file); // Read the file into an array … … 40 40 $posts = $posts[1]; 41 41 unset($importdata); 42 echo '<ol>'; 42 echo '<ol>'; 43 43 foreach ($posts as $post) { 44 44 flush(); … … 103 103 preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); 104 104 $comments = $comments[1]; 105 105 106 106 if ( $comments ) { 107 107 $comment_post_ID = $post_id; … … 158 158 $this->import_posts(); 159 159 wp_import_cleanup($file['id']); 160 160 161 161 echo '<h3>'; 162 162 printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); … … 171 171 172 172 $this->header(); 173 173 174 174 switch ($step) { 175 175 case 0 : … … 180 180 break; 181 181 } 182 182 183 183 $this->footer(); 184 184 } 185 185 186 186 function BW_Import() { 187 // Nothing. 187 // Nothing. 188 188 } 189 189 } -
trunk/wp-admin/import/dotclear.php
r4424 r4495 10 10 if(!function_exists('get_catbynicename')) 11 11 { 12 function get_catbynicename($category_nicename) 12 function get_catbynicename($category_nicename) 13 13 { 14 14 global $wpdb; … … 61 61 // This cries out for a C-implementation to be included in PHP core 62 62 // 63 function valid_1byte($char) { 64 if(!is_int($char)) return false; 65 return ($char & 0x80) == 0x00; 66 } 67 68 function valid_2byte($char) { 69 if(!is_int($char)) return false; 70 return ($char & 0xE0) == 0xC0; 71 } 72 73 function valid_3byte($char) { 74 if(!is_int($char)) return false; 75 return ($char & 0xF0) == 0xE0; 76 } 77 78 function valid_4byte($char) { 79 if(!is_int($char)) return false; 80 return ($char & 0xF8) == 0xF0; 81 } 82 83 function valid_nextbyte($char) { 84 if(!is_int($char)) return false; 85 return ($char & 0xC0) == 0x80; 86 } 87 88 function valid_utf8($string) { 89 $len = strlen($string); 90 $i = 0; 91 while( $i < $len ) { 92 $char = ord(substr($string, $i++, 1)); 93 if(valid_1byte($char)) { // continue 94 continue; 95 } else if(valid_2byte($char)) { // check 1 byte 96 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 97 return false; 98 } else if(valid_3byte($char)) { // check 2 bytes 99 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 100 return false; 101 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 102 return false; 103 } else if(valid_4byte($char)) { // check 3 bytes 104 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 105 return false; 106 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 107 return false; 108 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 109 return false; 110 } // goto next char 111 } 112 return true; // done 113 } 63 64 function valid_1byte($char) { 65 if(!is_int($char)) return false; 66 return ($char & 0x80) == 0x00; 67 } 68 69 function valid_2byte($char) { 70 if(!is_int($char)) return false; 71 return ($char & 0xE0) == 0xC0; 72 } 73 74 function valid_3byte($char) { 75 if(!is_int($char)) return false; 76 return ($char & 0xF0) == 0xE0; 77 } 78 79 function valid_4byte($char) { 80 if(!is_int($char)) return false; 81 return ($char & 0xF8) == 0xF0; 82 } 83 84 function valid_nextbyte($char) { 85 if(!is_int($char)) return false; 86 return ($char & 0xC0) == 0x80; 87 } 88 89 function valid_utf8($string) { 90 $len = strlen($string); 91 $i = 0; 92 while( $i < $len ) { 93 $char = ord(substr($string, $i++, 1)); 94 if(valid_1byte($char)) { // continue 95 continue; 96 } else if(valid_2byte($char)) { // check 1 byte 97 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 98 return false; 99 } else if(valid_3byte($char)) { // check 2 bytes 100 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 101 return false; 102 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 103 return false; 104 } else if(valid_4byte($char)) { // check 3 bytes 105 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 106 return false; 107 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 108 return false; 109 if(!valid_nextbyte(ord(substr($string, $i++, 1)))) 110 return false; 111 } // goto next char 112 } 113 return true; // done 114 } 114 115 115 116 function csc ($s) { … … 152 153 } 153 154 154 function get_dc_cats() 155 function get_dc_cats() 155 156 { 156 157 global $wpdb; … … 187 188 return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name 188 189 FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie 189 190 ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); 190 191 } 191 192 … … 212 213 } 213 214 214 function cat2wp($categories='') 215 function cat2wp($categories='') 215 216 { 216 217 // General Housekeeping … … 222 223 { 223 224 echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; 224 foreach ($categories as $category) 225 foreach ($categories as $category) 225 226 { 226 227 $count++; … … 284 285 ); 285 286 } 286 else 287 else 287 288 { 288 289 $ret_id = wp_insert_user(array( … … 385 386 ); 386 387 } 387 else 388 else 388 389 { 389 390 $ret_id = wp_insert_post(array( … … 461 462 ); 462 463 } 463 else 464 else 464 465 { 465 466 // Insert comments … … 548 549 } 549 550 550 function import_categories() 551 function import_categories() 551 552 { 552 553 // Category Import … … 566 567 { 567 568 // User Import 568 $users = $this->get_dc_users(); 569 $users = $this->get_dc_users(); 569 570 $this->users2wp($users); 570 571 … … 656 657 } 657 658 658 function dispatch() 659 function dispatch() 659 660 { 660 661 … … 665 666 $this->header(); 666 667 667 if ( $step > 0 ) 668 if ( $step > 0 ) 668 669 { 669 670 if($_POST['dbuser']) … … 690 691 if(get_option('dchost')) 691 692 delete_option('dchost'); 692 add_option('dchost',$_POST['dbhost']); 693 add_option('dchost',$_POST['dbhost']); 693 694 } 694 695 if($_POST['dccharset']) … … 696 697 if(get_option('dccharset')) 697 698 delete_option('dccharset'); 698 add_option('dccharset',$_POST['dccharset']); 699 add_option('dccharset',$_POST['dccharset']); 699 700 } 700 701 if($_POST['dbprefix']) … … 702 703 if(get_option('dcdbprefix')) 703 704 delete_option('dcdbprefix'); 704 add_option('dcdbprefix',$_POST['dbprefix']); 705 add_option('dcdbprefix',$_POST['dbprefix']); 705 706 } 706 707 … … 708 709 } 709 710 710 switch ($step) 711 switch ($step) 711 712 { 712 713 default: … … 737 738 } 738 739 739 function Dotclear_Import() 740 function Dotclear_Import() 740 741 { 741 742 // Nothing. -
trunk/wp-admin/import/greymatter.php
r4165 r4495 67 67 return($string); 68 68 } 69 69 70 70 function import() { 71 71 global $wpdb; 72 72 73 73 $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry'); 74 74 for ($i=0; $i<count($wpvarstoreset); $i += 1) { … … 137 137 138 138 chdir($archivespath); 139 139 140 140 for($i = 0; $i <= $lastentry; $i = $i + 1) { 141 141 142 142 $entryfile = ""; 143 143 144 144 if ($i<10000000) { 145 145 $entryfile .= "0"; … … 195 195 $comment_status = 'open'; 196 196 $ping_status = 'closed'; 197 197 198 198 if ($post_ID = post_exists($post_title, '', $post_date)) { 199 199 echo ' '; … … 304 304 305 305 function GM_Import() { 306 // Nothing. 306 // Nothing. 307 307 } 308 308 } -
trunk/wp-admin/import/mt.php
r4370 r4495 56 56 if (!(in_array($author, $this->mtnames))) { //a new mt author name is found 57 57 ++ $this->j; 58 $this->mtnames[$this->j] = $author; //add that new mt author name to an array 58 $this->mtnames[$this->j] = $author; //add that new mt author name to an array 59 59 $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 60 if (!$user_id) { //banging my head against the desk now. 60 if (!$user_id) { //banging my head against the desk now. 61 61 if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname 62 62 $user_id = wp_create_user($author, $pass); … … 400 400 function import() { 401 401 $this->id = (int) $_GET['id']; 402 402 403 403 $this->file = get_attached_file($this->id); 404 404 $this->get_authors_from_post(); -
trunk/wp-admin/import/textpattern.php
r4349 r4495 5 5 if(!function_exists('get_catbynicename')) 6 6 { 7 function get_catbynicename($category_nicename) 7 function get_catbynicename($category_nicename) 8 8 { 9 9 global $wpdb; … … 71 71 72 72 // Get Categories 73 return $txpdb->get_results('SELECT 74 75 76 77 FROM '.$prefix.'txp_category78 WHERE type = "article"',79 73 return $txpdb->get_results('SELECT 74 id, 75 name, 76 title 77 FROM '.$prefix.'txp_category 78 WHERE type = "article"', 79 ARRAY_A); 80 80 } 81 81 … … 91 91 92 92 return $txpdb->get_results('SELECT 93 94 95 96 97 98 93 user_id, 94 name, 95 RealName, 96 email, 97 privs 98 FROM '.$prefix.'txp_users', ARRAY_A); 99 99 } 100 100 … … 107 107 108 108 // Get Posts 109 return $txpdb->get_results('SELECT 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 109 return $txpdb->get_results('SELECT 110 ID, 111 Posted, 112 AuthorID, 113 LastMod, 114 Title, 115 Body, 116 Excerpt, 117 Category1, 118 Category2, 119 Status, 120 Keywords, 121 url_title, 122 comments_count 123 FROM '.$prefix.'textpattern 124 ', ARRAY_A); 125 125 } 126 126 … … 144 144 $prefix = get_option('tpre'); 145 145 146 return $txpdb->get_results('SELECT 147 148 149 150 151 152 153 FROM '.$prefix.'txp_link',154 ARRAY_A);155 } 156 157 function cat2wp($categories='') 146 return $txpdb->get_results('SELECT 147 id, 148 date, 149 category, 150 url, 151 linkname, 152 description 153 FROM '.$prefix.'txp_link', 154 ARRAY_A); 155 } 156 157 function cat2wp($categories='') 158 158 { 159 159 // General Housekeeping … … 165 165 { 166 166 echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; 167 foreach ($categories as $category) 167 foreach ($categories as $category) 168 168 { 169 169 $count++; … … 227 227 ); 228 228 } 229 else 229 else 230 230 { 231 231 $ret_id = wp_insert_user(array( … … 303 303 { 304 304 $ret_id = wp_insert_post(array( 305 306 307 308 309 310 311 312 313 314 315 316 317 318 } 319 else 305 'ID' => $pinfo, 306 'post_date' => $Posted, 307 'post_date_gmt' => $post_date_gmt, 308 'post_author' => $authorid, 309 'post_modified' => $LastMod, 310 'post_modified_gmt' => $post_modified_gmt, 311 'post_title' => $Title, 312 'post_content' => $Body, 313 'post_excerpt' => $Excerpt, 314 'post_status' => $post_status, 315 'post_name' => $url_title, 316 'comment_count' => $comments_count) 317 ); 318 } 319 else 320 320 { 321 321 $ret_id = wp_insert_post(array( 322 323 324 325 326 327 328 329 330 331 332 333 322 'post_date' => $Posted, 323 'post_date_gmt' => $post_date_gmt, 324 'post_author' => $authorid, 325 'post_modified' => $LastMod, 326 'post_modified_gmt' => $post_modified_gmt, 327 'post_title' => $Title, 328 'post_content' => $Body, 329 'post_excerpt' => $Excerpt, 330 'post_status' => $post_status, 331 'post_name' => $url_title, 332 'comment_count' => $comments_count) 333 ); 334 334 } 335 335 $txpposts2wpposts[$ID] = $ret_id; … … 380 380 // Update comments 381 381 $ret_id = wp_update_comment(array( 382 383 384 385 386 387 388 389 390 391 } 392 else 382 'comment_ID' => $cinfo, 383 'comment_post_ID' => $comment_post_ID, 384 'comment_author' => $name, 385 'comment_author_email' => $email, 386 'comment_author_url' => $web, 387 'comment_date' => $posted, 388 'comment_content' => $message, 389 'comment_approved' => $comment_approved) 390 ); 391 } 392 else 393 393 { 394 394 // Insert comments 395 395 $ret_id = wp_insert_comment(array( 396 397 398 399 400 401 402 403 404 396 'comment_post_ID' => $comment_post_ID, 397 'comment_author' => $name, 398 'comment_author_email' => $email, 399 'comment_author_url' => $web, 400 'comment_author_IP' => $ip, 401 'comment_date' => $posted, 402 'comment_content' => $message, 403 'comment_approved' => $comment_approved) 404 ); 405 405 } 406 406 $txpcm2wpcm[$comment_ID] = $ret_id; … … 451 451 ); 452 452 } 453 else 453 else 454 454 { 455 455 $ret_id = wp_insert_link(array( … … 473 473 } 474 474 475 function import_categories() 475 function import_categories() 476 476 { 477 477 // Category Import … … 491 491 { 492 492 // User Import 493 $users = $this->get_txp_users(); 493 $users = $this->get_txp_users(); 494 494 $this->users2wp($users); 495 495 … … 579 579 } 580 580 581 function dispatch() 581 function dispatch() 582 582 { 583 583 … … 588 588 $this->header(); 589 589 590 if ( $step > 0 ) 590 if ( $step > 0 ) 591 591 { 592 592 if($_POST['dbuser']) … … 613 613 if(get_option('txphost')) 614 614 delete_option('txphost'); 615 add_option('txphost',$_POST['dbhost']); 615 add_option('txphost',$_POST['dbhost']); 616 616 } 617 617 if($_POST['dbprefix']) … … 619 619 if(get_option('tpre')) 620 620 delete_option('tpre'); 621 add_option('tpre',$_POST['dbprefix']); 621 add_option('tpre',$_POST['dbprefix']); 622 622 } 623 623 … … 625 625 } 626 626 627 switch ($step) 627 switch ($step) 628 628 { 629 629 default: … … 654 654 } 655 655 656 function Textpattern_Import() 656 function Textpattern_Import() 657 657 { 658 658 // Nothing. -
trunk/wp-admin/import/wordpress.php
r4424 r4495 59 59 if (!(in_array($author, $this->mtnames))) { //a new mt author name is found 60 60 ++ $this->j; 61 $this->mtnames[$this->j] = $author; //add that new mt author name to an array 61 $this->mtnames[$this->j] = $author; //add that new mt author name to an array 62 62 $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 63 if (!$user_id) { //banging my head against the desk now. 63 if (!$user_id) { //banging my head against the desk now. 64 64 if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname 65 65 $user_id = wp_create_user($author, $pass); … … 274 274 function import() { 275 275 $this->id = (int) $_GET['id']; 276 276 277 277 $this->file = get_attached_file($this->id); 278 278 $this->get_authors_from_post(); -
trunk/wp-admin/index.php
r4484 r4495 47 47 48 48 <ul> 49 <?php 49 <?php 50 50 if ( $comments ) { 51 51 foreach ($comments as $comment) { 52 52 echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>'); 53 edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 53 edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 54 54 echo '</li>'; 55 55 } … … 81 81 <?php 82 82 if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) : 83 ?> 83 ?> 84 84 <div> 85 85 <h3><?php _e('Scheduled Entries:') ?></h3> … … 91 91 echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>"; 92 92 } 93 ?> 93 ?> 94 94 </ul> 95 95 </div> … … 100 100 <?php 101 101 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); 102 if (0 < $numposts) $numposts = number_format($numposts); 102 if (0 < $numposts) $numposts = number_format($numposts); 103 103 104 104 $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); -
trunk/wp-admin/install-helper.php
r1429 r4495 10 10 */ 11 11 function maybe_create_table($table_name, $create_ddl) { 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 12 global $wpdb; 13 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 14 if ($table == $table_name) { 15 return true; 16 } 17 } 18 //didn't find it try to create it. 19 $q = $wpdb->query($create_ddl); 20 // we cannot directly tell that whether this succeeded! 21 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 22 if ($table == $table_name) { 23 return true; 24 } 25 } 26 return false; 27 27 } 28 28 … … 34 34 */ 35 35 function maybe_add_column($table_name, $column_name, $create_ddl) { 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 36 global $wpdb, $debug; 37 foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { 38 if ($debug) echo("checking $column == $column_name<br />"); 39 if ($column == $column_name) { 40 return true; 41 } 42 } 43 //didn't find it try to create it. 44 $q = $wpdb->query($create_ddl); 45 // we cannot directly tell that whether this succeeded! 46 foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { 47 if ($column == $column_name) { 48 return true; 49 } 50 } 51 return false; 52 52 } 53 53 … … 60 60 */ 61 61 function maybe_drop_column($table_name, $column_name, $drop_ddl) { 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 62 global $wpdb; 63 foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { 64 if ($column == $column_name) { 65 //found it try to drop it. 66 $q = $wpdb->query($drop_ddl); 67 // we cannot directly tell that whether this succeeded! 68 foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { 69 if ($column == $column_name) { 70 return false; 71 } 72 } 73 } 74 } 75 // else didn't find it 76 return true; 77 77 } 78 78 … … 93 93 */ 94 94 function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 95 global $wpdb, $debug; 96 $diffs = 0; 97 $results = $wpdb->get_results("DESC $table_name"); 98 99 foreach ($results as $row ) { 100 if ($debug > 1) print_r($row); 101 if ($row->Field == $col_name) { 102 // got our column, check the params 103 if ($debug) echo ("checking $row->Type against $col_type\n"); 104 if (($col_type != null) && ($row->Type != $col_type)) { 105 ++$diffs; 106 } 107 if (($is_null != null) && ($row->Null != $is_null)) { 108 ++$diffs; 109 } 110 if (($key != null) && ($row->Key != $key)) { 111 ++$diffs; 112 } 113 if (($default != null) && ($row->Default != $default)) { 114 ++$diffs; 115 } 116 if (($extra != null) && ($row->Extra != $extra)) { 117 ++$diffs; 118 } 119 if ($diffs > 0) { 120 if ($debug) echo ("diffs = $diffs returning false\n"); 121 return false; 122 } 123 return true; 124 } // end if found our column 125 } 126 return false; 127 127 } 128 128 129 129 /* 130 130 echo "<p>testing</p>"; 131 131 echo "<pre>"; 132 132 133 //check_column('wp_links', 'link_description', 'mediumtext'); 133 //check_column('wp_links', 'link_description', 'mediumtext'); 134 134 //if (check_column($wpdb->comments, 'comment_author', 'tinytext')) 135 135 // echo "ok\n"; … … 139 139 if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) 140 140 { 141 142 141 $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; 142 $q = $wpdb->query($ddl); 143 143 } 144 144 if (check_column($wpdb->links, 'link_description', 'varchar(255)')) { 145 145 $res .= $tablename . ' - ok <br />'; 146 146 } else { 147 148 147 $res .= 'There was a problem with ' . $tablename . '<br />'; 148 ++$error_count; 149 149 } 150 150 echo "</pre>"; -
trunk/wp-admin/link-add.php
r4480 r4495 8 8 9 9 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 10 11 12 10 'description', 'visible', 'target', 'category', 'link_id', 11 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 12 'notes', 'linkcheck[]')); 13 13 14 14 wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') ); -
trunk/wp-admin/link-manager.php
r4480 r4495 144 144 echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>"; 145 145 ?> 146 147 146 <td> 147 <?php 148 148 149 149 $cat_names = array(); … … 158 158 ?> 159 159 </td> 160 161 160 <td><?php echo $link->link_rel; ?></td> 161 <td align='center'><?php echo $visible; ?></td> 162 162 <?php 163 163 -
trunk/wp-admin/link-parse-opml.php
r3295 r4495 5 5 // we need to map XML attribute names to our columns 6 6 $opml_map = array('URL' => 'link_url', 7 8 9 10 11 12 7 'HTMLURL' => 'link_url', 8 'TEXT' => 'link_name', 9 'TITLE' => 'link_name', 10 'TARGET' => 'link_target', 11 'DESCRIPTION' => 'link_description', 12 'XMLURL' => 'link_rss' 13 13 ); 14 14 … … 21 21 function startElement($parser, $tagName, $attrs) { 22 22 global $updated_timestamp, $all_links, $map; 23 23 global $names, $urls, $targets, $descriptions, $feeds; 24 24 25 25 if ($tagName == 'OUTLINE') { 26 27 28 29 30 26 foreach (array_keys($map) as $key) { 27 if (isset($attrs[$key])) { 28 $$map[$key] = $attrs[$key]; 29 } 30 } 31 31 32 32 //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n"); 33 33 34 35 36 37 34 // save the data away. 35 $names[] = $link_name; 36 $urls[] = $link_url; 37 $targets[] = $link_target; 38 38 $feeds[] = $link_rss; 39 40 39 $descriptions[] = $link_description; 40 } // end if outline 41 41 } 42 42 … … 56 56 57 57 if (!xml_parse($xml_parser, $opml, true)) { 58 59 60 58 echo(sprintf(__('XML error: %1$s at line %2$s'), 59 xml_error_string(xml_get_error_code($xml_parser)), 60 xml_get_current_line_number($xml_parser))); 61 61 } 62 62 -
trunk/wp-admin/link.php
r4468 r4495 30 30 foreach ($linkcheck as $link_id) { 31 31 $link_id = (int) $link_id; 32 32 33 33 if ( wp_delete_link($link_id) ) 34 34 $deleted++; -
trunk/wp-admin/menu-header.php
r4481 r4495 35 35 ?> 36 36 <ul id="submenu"> 37 <?php 38 foreach ($submenu["$parent_file"] as $item) : 37 <?php 38 foreach ($submenu["$parent_file"] as $item) : 39 39 if ( !current_user_can($item[1]) ) 40 40 continue; … … 66 66 <?php 67 67 68 endif; 68 endif; 69 69 70 70 do_action('admin_notices'); -
trunk/wp-admin/menu.php
r4480 r4495 84 84 } 85 85 } 86 86 87 87 if ( empty($submenu[$parent]) ) 88 88 unset($submenu[$parent]); … … 91 91 // Loop over the top-level menu. 92 92 // Menus for which the original parent is not acessible due to lack of privs will have the next 93 // submenu in line be assigned as the new menu parent. 93 // submenu in line be assigned as the new menu parent. 94 94 foreach ( $menu as $id => $data ) { 95 95 if ( empty($submenu[$data[2]]) ) -
trunk/wp-admin/moderation.php
r4480 r4495 32 32 if ($feelinglucky && 'later' == $value) 33 33 $value = 'delete'; 34 34 switch($value) { 35 35 case 'later': 36 36 // do nothing with that comment … … 42 42 ++$item_deleted; 43 43 break; 44 45 46 47 44 case 'spam': 45 wp_set_comment_status($key, 'spam'); 46 ++$item_spam; 47 break; 48 48 case 'approve': 49 49 wp_set_comment_status($key, 'approve'); … … 53 53 ++$item_approved; 54 54 break; 55 55 } 56 56 } 57 57 … … 86 86 } 87 87 } 88 89 88 if ($spam) { 89 if ('1' == $spam) { 90 90 echo __("1 comment marked as spam") . " <br/>\n"; 91 92 93 94 91 } else { 92 echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n"; 93 } 94 } 95 95 if ($ignored) { 96 96 if ('1' == $ignored) { … … 152 152 </li> 153 153 <?php 154 155 ?> 156 154 } 155 ?> 156 </ol> 157 157 158 158 <div id="ajax-response"></div> 159 159 160 160 <p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments »') ?>" /></p> 161 161 <script type="text/javascript"> 162 162 // <![CDATA[ … … 198 198 </p> 199 199 </noscript> 200 200 </form> 201 201 <?php 202 202 } else { 203 203 // nothing to approve 204 204 echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n"; 205 205 } -
trunk/wp-admin/options-misc.php
r4480 r4495 8 8 9 9 ?> 10 11 <div class="wrap"> 12 <h2><?php _e('Miscellaneous Options') ?></h2> 10 11 <div class="wrap"> 12 <h2><?php _e('Miscellaneous Options') ?></h2> 13 13 <form method="post" action="options.php"> 14 14 <?php wp_nonce_field('update-options') ?> … … 44 44 <p class="submit"> 45 45 <input type="hidden" name="action" value="update" /> 46 <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" /> 46 <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" /> 47 47 <input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /> 48 48 </p> 49 </form> 49 </form> 50 50 </div> 51 51 -
trunk/wp-admin/options-permalink.php
r4480 r4495 145 145 checked="checked" 146 146 <?php } ?> 147 /> 147 /> 148 148 <?php _e('Custom, specify below'); ?> 149 149 </label> -
trunk/wp-admin/options-privacy.php
r4480 r4495 7 7 include('./admin-header.php'); 8 8 ?> 9 9 10 10 <div class="wrap"> 11 11 <h2><?php _e('Privacy Options') ?></h2> 12 <form method="post" action="options.php"> 12 <form method="post" action="options.php"> 13 13 <?php wp_nonce_field('update-options') ?> 14 <table class="optiontable"> 15 <tr valign="top"> 16 <th scope="row"><?php _e('Blog visibility:') ?> </th> 14 <table class="optiontable"> 15 <tr valign="top"> 16 <th scope="row"><?php _e('Blog visibility:') ?> </th> 17 17 <td> 18 18 <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> /> … … 21 21 <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p> 22 22 <?php do_action('blog_privacy_selector'); ?> 23 </td> 23 </td> 24 24 </tr> 25 </table> 25 </table> 26 26 27 27 <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /> 28 <input type="hidden" name="action" value="update" /> 29 <input type="hidden" name="page_options" value="blog_public" /> 28 <input type="hidden" name="action" value="update" /> 29 <input type="hidden" name="page_options" value="blog_public" /> 30 30 </p> 31 31 </form> 32 32 33 </div> 33 </div> 34 34 35 35 <?php include('./admin-footer.php') ?> -
trunk/wp-admin/options-writing.php
r4480 r4495 66 66 <th scope="row"><?php _e('Mail server:') ?></th> 67 67 <td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" /> 68 <label for="mailserver_port"><?php _e('Port:') ?></label> 68 <label for="mailserver_port"><?php _e('Port:') ?></label> 69 69 <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" /> 70 70 </td> … … 114 114 115 115 <p class="submit"> 116 <input type="hidden" name="action" value="update" /> 117 <input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" /> 118 <input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /> 116 <input type="hidden" name="action" value="update" /> 117 <input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" /> 118 <input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /> 119 119 </p> 120 </form> 121 </div> 120 </form> 121 </div> 122 122 123 123 <?php include('./admin-footer.php') ?> -
trunk/wp-admin/plugin-editor.php
r4480 r4495 62 62 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> 63 63 <?php endif; ?> 64 <div class="wrap"> 65 64 <div class="wrap"> 65 <?php 66 66 if (is_writeable($real_file)) { 67 67 echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>'; … … 76 76 if ($plugin_files) : 77 77 ?> 78 79 <?php foreach($plugin_files as $plugin_file) : ?>78 <ul> 79 <?php foreach($plugin_files as $plugin_file) : ?> 80 80 <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li> 81 <?php endforeach; ?>82 81 <?php endforeach; ?> 82 </ul> 83 83 <?php endif; ?> 84 84 </div> 85 <?php if (!$error) { ?> 86 87 88 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>89 <input type="hidden" name="action" value="update" /> 90 <input type="hidden" name="file" value="<?php echo $file ?>" /> 85 <?php if (!$error) { ?> 86 <form name="template" id="template" action="plugin-editor.php" method="post"> 87 <?php wp_nonce_field('edit-plugin_' . $file) ?> 88 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> 89 <input type="hidden" name="action" value="update" /> 90 <input type="hidden" name="file" value="<?php echo $file ?>" /> 91 91 </div> 92 92 <?php if ( is_writeable($real_file) ) : ?> 93 <p class="submit"> 93 <p class="submit"> 94 <?php 95 echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />"; 96 ?> 97 </p> 98 <?php else : ?> 99 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> 100 <?php endif; ?> 101 </form> 94 102 <?php 95 echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";96 ?>97 </p>98 <?php else : ?>99 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>100 <?php endif; ?>101 </form>102 <?php103 103 } else { 104 104 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; 105 105 } 106 106 ?> 107 107 <div class="clear"> </div> 108 </div> 108 </div> 109 109 <?php 110 110 break; 111 111 } 112 112 113 include("admin-footer.php") ?> 113 include("admin-footer.php") ?> -
trunk/wp-admin/post.php
r4349 r4495 16 16 $submenu_file = 'post-new.php'; 17 17 check_admin_referer('add-post'); 18 18 19 19 $post_ID = 'post' == $action ? write_post() : edit_post(); 20 20 … … 90 90 $post_ID = (int) $_POST['post_ID']; 91 91 check_admin_referer('update-post_' . $post_ID); 92 92 93 93 $post_ID = edit_post(); 94 94 -
trunk/wp-admin/profile.php
r4480 r4495 1 <?php 1 <?php 2 2 require_once('admin.php'); 3 3 … … 122 122 <br clear="all" /> 123 123 124 125 126 127 128 129 130 <td><?php 124 <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform"> 125 <?php 126 if(count($profileuser->caps) > count($profileuser->roles)): 127 ?> 128 <tr> 129 <th scope="row"><?php _e('Additional Capabilities:') ?></th> 130 <td><?php 131 131 $output = ''; 132 132 foreach($profileuser->caps as $cap => $value) { -
trunk/wp-admin/setup-config.php
r3673 r4495 3 3 4 4 if (!file_exists('../wp-config-sample.php')) 5 5 die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 6 6 7 7 $configFile = file('../wp-config-sample.php'); … … 83 83 switch($step) { 84 84 case 0: 85 ?> 85 ?> 86 86 87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 88 <ol> 89 <li>Database name</li> 90 <li>Database username</li> 91 92 <li>Database host</li> 93 94 </ol> 87 <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> 88 <ol> 89 <li>Database name</li> 90 <li>Database username</li> 91 <li>Database password</li> 92 <li>Database host</li> 93 <li>Table prefix (if you want to run more than one WordPress in a single database) </li> 94 </ol> 95 95 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p> 96 96 <p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, <a href="setup-config.php?step=1">let’s go</a>! </p> … … 99 99 100 100 case 1: 101 ?> 102 </p> 101 ?> 102 </p> 103 103 <form method="post" action="setup-config.php?step=2"> 104 105 <table> 106 <tr> 107 <th scope="row">Database Name</th> 108 109 <td>The name of the database you want to run WP in. </td> 110 </tr> 111 <tr> 112 <th scope="row">User Name</th> 113 114 <td>Your MySQL username</td> 115 </tr> 116 <tr> 117 <th scope="row">Password</th> 118 119 <td>...and MySQL password.</td> 120 </tr> 121 <tr> 122 <th scope="row">Database Host</th> 123 124 <td>99% chance you won't need to change this value.</td> 125 126 127 128 129 130 </tr> 131 132 133 134 135 </form> 104 <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> 105 <table> 106 <tr> 107 <th scope="row">Database Name</th> 108 <td><input name="dbname" type="text" size="25" value="wordpress" /></td> 109 <td>The name of the database you want to run WP in. </td> 110 </tr> 111 <tr> 112 <th scope="row">User Name</th> 113 <td><input name="uname" type="text" size="25" value="username" /></td> 114 <td>Your MySQL username</td> 115 </tr> 116 <tr> 117 <th scope="row">Password</th> 118 <td><input name="pwd" type="text" size="25" value="password" /></td> 119 <td>...and MySQL password.</td> 120 </tr> 121 <tr> 122 <th scope="row">Database Host</th> 123 <td><input name="dbhost" type="text" size="25" value="localhost" /></td> 124 <td>99% chance you won't need to change this value.</td> 125 </tr> 126 <tr> 127 <th scope="row">Table Prefix</th> 128 <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td> 129 <td>If you want to run multiple WordPress installations in a single database, change this.</td> 130 </tr> 131 </table> 132 <h2 class="step"> 133 <input name="submit" type="submit" value="Submit" /> 134 </h2> 135 </form> 136 136 <?php 137 137 break; … … 139 139 case 2: 140 140 $dbname = trim($_POST['dbname']); 141 142 143 141 $uname = trim($_POST['uname']); 142 $passwrd = trim($_POST['pwd']); 143 $dbhost = trim($_POST['dbhost']); 144 144 $prefix = trim($_POST['prefix']); 145 145 if (empty($prefix)) $prefix = 'wp_'; 146 146 147 148 149 150 151 147 // Test the db connection. 148 define('DB_NAME', $dbname); 149 define('DB_USER', $uname); 150 define('DB_PASSWORD', $passwrd); 151 define('DB_HOST', $dbhost); 152 152 153 154 153 // We'll fail here if the values are no good. 154 require_once('../wp-includes/wp-db.php'); 155 155 $handle = fopen('../wp-config.php', 'w'); 156 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 157 foreach ($configFile as $line_num => $line) { 158 switch (substr($line,0,16)) { 159 case "define('DB_NAME'": 160 fwrite($handle, str_replace("wordpress", $dbname, $line)); 161 break; 162 case "define('DB_USER'": 163 fwrite($handle, str_replace("'username'", "'$uname'", $line)); 164 break; 165 case "define('DB_PASSW": 166 fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); 167 break; 168 case "define('DB_HOST'": 169 fwrite($handle, str_replace("localhost", $dbhost, $line)); 170 break; 171 171 case '$table_prefix =': 172 172 fwrite($handle, str_replace('wp_', $prefix, $line)); 173 173 break; 174 175 176 177 178 174 default: 175 fwrite($handle, $line); 176 } 177 } 178 fclose($handle); 179 179 chmod('../wp-config.php', 0666); 180 ?> 181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 180 ?> 181 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> 182 182 <?php 183 183 break; -
trunk/wp-admin/sidebar.php
r4006 r4495 35 35 } 36 36 .sidebar-categories { 37 38 39 40 37 display: block; 38 height: 6.6em; 39 overflow: auto; 40 background-color: #f4f4f4; 41 41 } 42 42 .sidebar-categories label { 43 43 font-size: 10px; 44 45 44 display: block; 45 width: 90%; 46 46 } 47 47 </style> … … 66 66 </p> 67 67 <p> 68 <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" /> 68 <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" /> 69 69 <?php if ( current_user_can('publish_posts') ) : ?> 70 <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" /> 70 <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" /> 71 71 <?php endif; ?> 72 72 </p> -
trunk/wp-admin/templates.php
r4480 r4495 83 83 <?php endif; ?> 84 84 <?php endif; ?> 85 <div class="wrap"> 85 <div class="wrap"> 86 86 <?php 87 87 if (is_writeable($real_file)) { … … 92 92 ?> 93 93 <div id="templateside"> 94 <?php 95 if ( $recents ) : 94 <?php 95 if ( $recents ) : 96 96 ?> 97 97 <h3><?php _e('Recent'); ?></h3> … … 111 111 $common_files[] = $old_file; 112 112 } ?> 113 114 115 116 117 113 <ul> 114 <?php foreach ($common_files as $common_file) : ?> 115 <li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li> 116 <?php endforeach; ?> 117 </ul> 118 118 </div> 119 119 <?php if (!$error) { ?> 120 <form name="template" id="template" action="templates.php" method="post"> 121 122 <div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea> 123 <input type="hidden" name="action" value="update" /> 124 <input type="hidden" name="file" value="<?php echo $file ?>" /> 125 </div>120 <form name="template" id="template" action="templates.php" method="post"> 121 <?php wp_nonce_field('edit-file_' . $file) ?> 122 <div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea> 123 <input type="hidden" name="action" value="update" /> 124 <input type="hidden" name="file" value="<?php echo $file ?>" /> 125 </div> 126 126 <?php if ( is_writeable($real_file) ) : ?> 127 127 <p class="submit"> 128 128 <?php 129 129 echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />"; … … 133 133 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> 134 134 <?php endif; ?> 135 </form> 136 135 </form> 136 <?php 137 137 } else { 138 138 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; … … 144 144 <h2><?php _e('Other Files') ?></h2> 145 145 146 <p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p> 147 <form name="file" action="templates.php" method="get"> 148 <input type="text" name="file" /> 149 <input type="submit" name="submit" value="<?php _e('Edit file »') ?>" /> 150 </form> 146 <p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p> 147 <form name="file" action="templates.php" method="get"> 148 <input type="text" name="file" /> 149 <input type="submit" name="submit" value="<?php _e('Edit file »') ?>" /> 150 </form> 151 151 152 153 </div> 152 <p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don’t have access to a text editor or FTP client.') ?></p> 153 </div> 154 154 <?php 155 155 -
trunk/wp-admin/theme-editor.php
r4480 r4495 81 81 <?php endif; ?> 82 82 <div class="wrap"> 83 <form name="theme" action="theme-editor.php" method="post"> 83 <form name="theme" action="theme-editor.php" method="post"> 84 84 <?php _e('Select theme to edit:') ?> 85 85 <select name="theme" id="theme"> … … 107 107 ?> 108 108 <div id="templateside"> 109 109 <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3> 110 110 111 111 <?php 112 112 if ($allowed_files) : 113 113 ?> 114 114 <ul> 115 115 <?php foreach($allowed_files as $allowed_file) : ?> 116 116 <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li> 117 117 <?php endforeach; ?> 118 118 </ul> 119 119 <?php endif; ?> 120 </div> 120 </div> 121 121 <?php 122 122 if (!$error) { 123 ?> 124 125 126 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> 127 <input type="hidden" name="action" value="update" /> 128 <input type="hidden" name="file" value="<?php echo $file ?>" /> 129 123 ?> 124 <form name="template" id="template" action="theme-editor.php" method="post"> 125 <?php wp_nonce_field('edit-theme_' . $file . $theme) ?> 126 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> 127 <input type="hidden" name="action" value="update" /> 128 <input type="hidden" name="file" value="<?php echo $file ?>" /> 129 <input type="hidden" name="theme" value="<?php echo $theme ?>" /> 130 130 </div> 131 131 <?php if ( is_writeable($real_file) ) : ?> 132 132 <p class="submit"> 133 133 <?php 134 134 echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />"; … … 138 138 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> 139 139 <?php endif; ?> 140 </form> 141 140 </form> 141 <?php 142 142 } else { 143 143 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; … … 145 145 ?> 146 146 <div class="clear"> </div> 147 </div> 147 </div> 148 148 <?php 149 149 break; 150 150 } 151 151 152 include("admin-footer.php") ?> 152 include("admin-footer.php") ?> -
trunk/wp-admin/themes.php
r4480 r4495 113 113 $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"'; 114 114 echo " 115 116 117 118 115 <tr $theme> 116 <td>$title</td> 117 <td>$description</td> 118 </tr>"; 119 119 } 120 120 ?> -
trunk/wp-admin/update-links.php
r4144 r4495 29 29 $response .= fgets($fs, 1160); // One TCP-IP packet 30 30 fclose($fs); 31 31 32 32 $response = explode("\r\n\r\n", $response, 2); 33 33 $body = trim( $response[1] ); 34 34 $body = str_replace(array("\r\n", "\r"), "\n", $body); 35 35 36 36 $returns = explode("\n", $body); 37 37 38 38 foreach ($returns as $return) : 39 39 $time = $wpdb->escape( substr($return, 0, 19) ); -
trunk/wp-admin/upgrade-functions.php
r4366 r4495 121 121 "), $blog_url, $name, $password); 122 122 123 @wp_mail($email, __('New WordPress Blog'), $message, $message_headers); 123 @wp_mail($email, __('New WordPress Blog'), $message, $message_headers); 124 124 } 125 125 endif; … … 138 138 make_db_current_silent(); 139 139 upgrade_all(); 140 wp_cache_flush(); 140 wp_cache_flush(); 141 141 } 142 142 endif; … … 188 188 if ($posts) { 189 189 foreach($posts as $post) { 190 if ('' == $post->post_name) { 190 if ('' == $post->post_name) { 191 191 $newtitle = sanitize_title($post->post_title); 192 192 $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'"); … … 197 197 $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); 198 198 foreach ($categories as $category) { 199 if ('' == $category->category_nicename) { 199 if ('' == $category->category_nicename) { 200 200 $newtitle = sanitize_title($category->cat_name); 201 201 $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'"); … … 252 252 global $wpdb; 253 253 254 254 // Set user_nicename. 255 255 $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 256 257 if ('' == $user->user_nicename) { 258 259 260 261 256 foreach ($users as $user) { 257 if ('' == $user->user_nicename) { 258 $newname = sanitize_title($user->user_nickname); 259 $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'"); 260 } 261 } 262 262 263 263 $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users"); 264 264 foreach ($users as $row) { 265 265 if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) { 266 266 $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\''); 267 267 } 268 268 } … … 306 306 307 307 function upgrade_130() { 308 309 310 308 global $wpdb; 309 310 // Remove extraneous backslashes. 311 311 $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts"); 312 312 if ($posts) { 313 313 foreach($posts as $post) { 314 315 316 314 $post_content = addslashes(deslash($post->post_content)); 315 $post_title = addslashes(deslash($post->post_title)); 316 $post_excerpt = addslashes(deslash($post->post_excerpt)); 317 317 if ( empty($post->guid) ) 318 318 $guid = get_permalink($post->ID); … … 320 320 $guid = $post->guid; 321 321 322 323 } 324 } 325 326 322 $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'"); 323 } 324 } 325 326 // Remove extraneous backslashes. 327 327 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments"); 328 328 if ($comments) { 329 329 foreach($comments as $comment) { 330 331 332 333 } 334 } 335 336 330 $comment_content = addslashes(deslash($comment->comment_content)); 331 $comment_author = addslashes(deslash($comment->comment_author)); 332 $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'"); 333 } 334 } 335 336 // Remove extraneous backslashes. 337 337 $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links"); 338 338 if ($links) { 339 339 foreach($links as $link) { 340 341 342 343 } 344 } 345 346 347 348 349 350 351 352 353 354 355 356 357 358 340 $link_name = addslashes(deslash($link->link_name)); 341 $link_description = addslashes(deslash($link->link_description)); 342 $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'"); 343 } 344 } 345 346 // The "paged" option for what_to_show is no more. 347 if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') { 348 $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'"); 349 } 350 351 $active_plugins = __get_option('active_plugins'); 352 353 // If plugins are not stored in an array, they're stored in the old 354 // newline separated format. Convert to new format. 355 if ( !is_array( $active_plugins ) ) { 356 $active_plugins = explode("\n", trim($active_plugins)); 357 update_option('active_plugins', $active_plugins); 358 } 359 359 360 360 // Obsolete tables … … 500 500 $now = gmdate('Y-m-d H:i:59'); 501 501 $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); 502 502 503 503 $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'"); 504 504 if ( !empty($posts) ) … … 509 509 // Create categories for link categories if a category with the same 510 510 // name doesn't exist. Create a map of link cat IDs to cat IDs. 511 $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); 511 $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); 512 512 foreach ( $link_cats as $link_cat) { 513 513 if ( $cat_id = category_exists($link_cat->cat_name) ) { … … 528 528 $wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id) 529 529 VALUES ('$link->link_id', '$link_cat')"); 530 } 531 } 532 530 } 531 } 532 533 533 // Set default to the last category we grabbed during the upgrade loop. 534 534 update_option('default_link_category', $default_link_cat); … … 549 549 // General 550 550 function maybe_create_table($table_name, $create_ddl) { 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 551 global $wpdb; 552 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 553 if ($table == $table_name) { 554 return true; 555 } 556 } 557 //didn't find it try to create it. 558 $q = $wpdb->query($create_ddl); 559 // we cannot directly tell that whether this succeeded! 560 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 561 if ($table == $table_name) { 562 return true; 563 } 564 } 565 return false; 566 566 } 567 567 … … 592 592 */ 593 593 function maybe_add_column($table_name, $column_name, $create_ddl) { 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 594 global $wpdb, $debug; 595 foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { 596 if ($debug) echo("checking $column == $column_name<br />"); 597 if ($column == $column_name) { 598 return true; 599 } 600 } 601 //didn't find it try to create it. 602 $q = $wpdb->query($create_ddl); 603 // we cannot directly tell that whether this succeeded! 604 foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { 605 if ($column == $column_name) { 606 return true; 607 } 608 } 609 return false; 610 610 } 611 611 … … 616 616 if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) { 617 617 foreach ($options as $option) { 618 // "When trying to design a foolproof system, 618 // "When trying to design a foolproof system, 619 619 // never underestimate the ingenuity of the fools :)" -- Dougal 620 620 if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); … … 647 647 648 648 function deslash($content) { 649 650 651 652 653 654 655 656 657 658 659 660 661 662 649 // Note: \\\ inside a regex denotes a single backslash. 650 651 // Replace one or more backslashes followed by a single quote with 652 // a single quote. 653 $content = preg_replace("/\\\+'/", "'", $content); 654 655 // Replace one or more backslashes followed by a double quote with 656 // a double quote. 657 $content = preg_replace('/\\\+"/', '"', $content); 658 659 // Replace one or more backslashes with one backslash. 660 $content = preg_replace("/\\\+/", "\\", $content); 661 662 return $content; 663 663 } 664 664 … … 827 827 } 828 828 } 829 // Add the column list to the index create string 829 // Add the column list to the index create string 830 830 $index_string .= ' ('.$index_columns.')'; 831 831 -
trunk/wp-admin/upgrade-schema.php
r4334 r4495 224 224 add_option('upload_path', 'wp-content/uploads'); 225 225 } 226 226 227 227 // 2.0.3 228 228 add_option('secret', md5(uniqid(microtime()))); -
trunk/wp-admin/upgrade.php
r4259 r4495 57 57 break; 58 58 } 59 ?> 59 ?> 60 60 </body> 61 61 </html> -
trunk/wp-admin/user-edit.php
r4480 r4495 187 187 188 188 <br clear="all" /> 189 190 191 192 193 194 195 <td><?php 189 <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform"> 190 <?php 191 if(count($profileuser->caps) > count($profileuser->roles)): 192 ?> 193 <tr> 194 <th scope="row"><?php _e('Additional Capabilities:') ?></th> 195 <td><?php 196 196 $output = ''; 197 197 foreach($profileuser->caps as $cap => $value) { … … 203 203 echo $output; 204 204 ?></td> 205 206 207 208 209 205 </tr> 206 <?php 207 endif; 208 ?> 209 </table> 210 210 <p class="submit"> 211 211 <input type="hidden" name="action" value="update" /> 212 212 <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" /> 213 213 <input type="submit" value="<?php _e('Update User »') ?>" name="submit" /> 214 214 </p> 215 215 </form> -
trunk/wp-admin/wp-admin.css
r4466 r4495 284 284 285 285 .commentlist li { 286 border-bottom: 1px solid #ccc; 286 border-bottom: 1px solid #ccc; 287 287 padding: 1em 1em .2em; 288 288 margin: 0; … … 955 955 956 956 /* A handy div class for hiding controls. 957 958 957 Some browsers will disable them when you 958 set display:none; */ 959 959 .zerosize { 960 960 height: 0px; … … 996 996 997 997 /**************************************************************** 998 avoid padding, margins or borders on dbx-box, 999 to reduce visual discrepancies between it and the clone. 1000 overall, dbx-box is best left as visually unstyled as possible 998 avoid padding, margins or borders on dbx-box, 999 to reduce visual discrepancies between it and the clone. 1000 overall, dbx-box is best left as visually unstyled as possible 1001 1001 *****************************************************************/ 1002 1002 .dbx-box { -
trunk/wp-admin/xfn.js
r3517 r4495 11 11 12 12 function meChecked() { 13 14 15 16 13 var undefined; 14 var eMe = document.getElementById('me'); 15 if (eMe == undefined) return false; 16 else return eMe.checked; 17 17 } 18 18 -
trunk/wp-atom.php
r4465 r4495 12 12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> 13 13 <feed version="0.3" 14 15 16 17 18 14 xmlns="http://purl.org/atom/ns#" 15 xmlns:dc="http://purl.org/dc/elements/1.1/" 16 xml:lang="<?php echo get_option('rss_language'); ?>" 17 <?php do_action('atom_ns'); ?> 18 > 19 19 <title><?php bloginfo_rss('name') ?></title> 20 20 <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> … … 26 26 <?php while (have_posts()) : the_post(); ?> 27 27 <entry> 28 28 <author> 29 29 <name><?php the_author() ?></name> 30 30 </author> … … 34 34 <modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified> 35 35 <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued> 36 <?php the_category_rss('rdf') ?> 36 <?php the_category_rss('rdf') ?> 37 37 <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> 38 38 <?php if ( !get_option('rss_use_excerpt') ) : ?> -
trunk/wp-commentsrss2.php
r4462 r4495 1 <?php 1 <?php 2 2 3 3 if (empty($wp)) { … … 65 65 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> 66 66 <guid><?php comment_link() ?></guid> 67 <?php 67 <?php 68 68 if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { 69 69 ?> … … 75 75 <description><?php comment_text_rss() ?></description> 76 76 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> 77 <?php 78 } // close check for password 77 <?php 78 } // close check for password 79 79 ?> 80 80 </item> 81 <?php 82 } 81 <?php 82 } 83 83 } 84 84 } -
trunk/wp-content/themes/classic/comments-popup.php
r4465 r4495 1 <?php 1 <?php 2 2 /* Don't remove these lines. */ 3 3 add_filter('comment_text', 'popuplinks'); … … 98 98 99 99 <!-- // this is just the end of the motor - don't touch that line either :) --> 100 <?php //} ?> 100 <?php //} ?> 101 101 <p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p> 102 102 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> -
trunk/wp-content/themes/classic/comments.php
r4133 r4495 3 3 <?php return; endif; ?> 4 4 5 <h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?> 5 <h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?> 6 6 <?php if ( comments_open() ) : ?> 7 7 <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">»</a> … … 26 26 <?php endif; ?> 27 27 28 <p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?> 28 <p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?> 29 29 <?php if ( pings_open() ) : ?> 30 30 <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a> -
trunk/wp-content/themes/classic/header.php
r3517 r4495 18 18 19 19 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 20 20 <?php wp_get_archives('type=monthly&format=link'); ?> 21 21 <?php //comments_popup_script(); // off by default ?> 22 22 <?php wp_head(); ?> -
trunk/wp-content/themes/classic/index.php
r3517 r4495 1 <?php 1 <?php 2 2 get_header(); 3 3 ?> … … 16 16 17 17 <div class="feedback"> 18 19 18 <?php wp_link_pages(); ?> 19 <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?> 20 20 </div> 21 21 -
trunk/wp-content/themes/classic/sidebar.php
r4152 r4495 17 17 </li> 18 18 <li id="archives"><?php _e('Archives:'); ?> 19 19 <ul> 20 20 <?php wp_get_archives('type=monthly'); ?> 21 21 </ul> 22 22 </li> 23 23 <li id="meta"><?php _e('Meta:'); ?> 24 24 <ul> 25 25 <?php wp_register(); ?> 26 26 <li><?php wp_loginout(); ?></li> -
trunk/wp-content/themes/default/archive.php
r4166 r4495 41 41 </div> 42 42 43 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 43 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 44 44 45 45 </div> -
trunk/wp-content/themes/default/archives.php
r3706 r4495 12 12 13 13 <h2>Archives by Month:</h2> 14 15 16 14 <ul> 15 <?php wp_get_archives('type=monthly'); ?> 16 </ul> 17 17 18 18 <h2>Archives by Subject:</h2> 19 20 21 19 <ul> 20 <?php wp_list_categories(); ?> 21 </ul> 22 22 23 23 </div> -
trunk/wp-content/themes/default/comments-popup.php
r4465 r4495 1 <?php 1 <?php 2 2 /* Don't remove these lines. */ 3 3 add_filter('comment_text', 'popuplinks'); … … 98 98 99 99 <!-- // this is just the end of the motor - don't touch that line either :) --> 100 <?php //} ?> 100 <?php //} ?> 101 101 <p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p> 102 102 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> -
trunk/wp-content/themes/default/comments.php
r3517 r4495 3 3 die ('Please do not load this page directly. Thanks!'); 4 4 5 6 7 5 if (!empty($post->post_password)) { // if there's a password 6 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 7 ?> 8 8 9 9 <p class="nocomments">This post is password protected. Enter the password to view comments.<p> 10 10 11 12 13 14 11 <?php 12 return; 13 } 14 } 15 15 16 17 16 /* This variable is for alternating comment background */ 17 $oddcomment = 'alt'; 18 18 ?> 19 19 … … 21 21 22 22 <?php if ($comments) : ?> 23 <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> 23 <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> 24 24 25 25 <ol class="commentlist"> … … 51 51 <?php else : // this is displayed if there are no comments so far ?> 52 52 53 <?php if ('open' == $post->comment_status) : ?> 53 <?php if ('open' == $post->comment_status) : ?> 54 54 <!-- If comments are open, but there are no comments. --> 55 55 -
trunk/wp-content/themes/default/footer.php
r3924 r4495 4 4 <!-- If you'd like to support WordPress, having the "powered by" link someone on your blog is the best way, it's our only promotion or advertising. --> 5 5 <p> 6 <?php bloginfo('name'); ?> is proudly powered by 6 <?php bloginfo('name'); ?> is proudly powered by 7 7 <a href="http://wordpress.org/">WordPress</a> 8 8 <br /><a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> -
trunk/wp-content/themes/default/header.php
r4144 r4495 15 15 <style type="text/css" media="screen"> 16 16 17 <?php 17 <?php 18 18 // Checks to see whether it needs a sidebar or not 19 if ( !$withcomments && !is_single() ) { 19 if ( !$withcomments && !is_single() ) { 20 20 ?> 21 21 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } 22 22 <?php } else { // No sidebar ?> 23 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } 23 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } 24 24 <?php } ?> 25 25 -
trunk/wp-content/themes/default/page.php
r4264 r4495 3 3 <div id="content" class="narrowcolumn"> 4 4 5 5 <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 6 6 <div class="post" id="post-<?php the_ID(); ?>"> 7 7 <h2><?php the_title(); ?></h2> … … 13 13 </div> 14 14 </div> 15 15 <?php endwhile; endif; ?> 16 16 <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> 17 17 </div> -
trunk/wp-content/themes/default/sidebar.php
r4171 r4495 25 25 for <?php the_time('F, Y'); ?>.</p> 26 26 27 27 <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 28 28 <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 29 29 for the year <?php the_time('Y'); ?>.</p> 30 30 31 31 <?php /* If this is a monthly archive */ } elseif (is_search()) { ?> 32 32 <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 33 33 for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> -
trunk/wp-content/themes/default/single.php
r4264 r4495 3 3 <div id="content" class="widecolumn"> 4 4 5 5 <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 6 6 7 7 <div class="navigation"> … … 24 24 You'll need to download this plugin, and follow the instructions: 25 25 http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */ 26 /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> 26 /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> 27 27 on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> 28 28 and is filed under <?php the_category(', ') ?>. 29 You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. 29 You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. 30 30 31 31 <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { -
trunk/wp-feed.php
r3638 r4495 2 2 3 3 if (empty($doing_rss)) { 4 5 4 $doing_rss = 1; 5 require(dirname(__FILE__) . '/wp-blog-header.php'); 6 6 } 7 7 -
trunk/wp-includes/bookmark-template.php
r4444 r4495 147 147 148 148 function get_linkrating($link) { 149 149 return apply_filters('link_rating', $link->link_rating); 150 150 } 151 151 -
trunk/wp-includes/bookmark.php
r4219 r4495 20 20 // Deprecate 21 21 function get_link($bookmark_id, $output = OBJECT) { 22 return get_bookmark($bookmark_id, $output); 22 return get_bookmark($bookmark_id, $output); 23 23 } 24 24 … … 51 51 } 52 52 } 53 if (!empty($inclusions)) 53 if (!empty($inclusions)) 54 54 $inclusions .= ')'; 55 55 … … 66 66 } 67 67 } 68 if (!empty($exclusions)) 68 if (!empty($exclusions)) 69 69 $exclusions .= ')'; 70 70 71 71 if ( ! empty($category_name) ) { 72 72 if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") ) … … 88 88 } 89 89 if (!empty($category_query)) { 90 $category_query .= ')'; 90 $category_query .= ')'; 91 91 $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) "; 92 92 } -
trunk/wp-includes/cache.php
r4486 r4495 66 66 67 67 function acquire_lock() { 68 // Acquire a write lock. 68 // Acquire a write lock. 69 69 $this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w'); 70 70 if ( false == $this->mutex) … … 238 238 # Get indexed directory from stack 239 239 $dir = $stack[$index]; 240 240 241 241 $dh = @ opendir($dir); 242 242 if (!$dh) 243 243 return false; 244 244 245 245 while (($file = @ readdir($dh)) !== false) { 246 246 if ($file == '.' or $file == '..') -
trunk/wp-includes/capabilities.php
r4158 r4495 222 222 223 223 function level_reduction($max, $item) { 224 225 226 227 228 229 224 if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) { 225 $level = intval($matches[1]); 226 return max($max, $level); 227 } else { 228 return $max; 229 } 230 230 } 231 231 232 232 function update_user_level_from_caps() { 233 234 235 233 global $wpdb; 234 $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); 235 update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level); 236 236 } 237 237 … … 299 299 if ( 'page' == $post->post_type ) { 300 300 $args = array_merge(array('delete_page', $user_id), $args); 301 return call_user_func_array('map_meta_cap', $args); 301 return call_user_func_array('map_meta_cap', $args); 302 302 } 303 303 $post_author_data = get_userdata($post->post_author); … … 353 353 if ( 'page' == $post->post_type ) { 354 354 $args = array_merge(array('edit_page', $user_id), $args); 355 return call_user_func_array('map_meta_cap', $args); 355 return call_user_func_array('map_meta_cap', $args); 356 356 } 357 357 $post_author_data = get_userdata($post->post_author); … … 403 403 if ( 'page' == $post->post_type ) { 404 404 $args = array_merge(array('read_page', $user_id), $args); 405 return call_user_func_array('map_meta_cap', $args); 405 return call_user_func_array('map_meta_cap', $args); 406 406 } 407 407 -
trunk/wp-includes/category-template.php
r4277 r4495 188 188 } 189 189 190 if ( $show_option_none) { 191 $show_option_none = apply_filters('list_cats', $show_option_none); 190 if ( $show_option_none) { 191 $show_option_none = apply_filters('list_cats', $show_option_none); 192 192 $output .= "\t<option value='-1'>$show_option_none</option>\n"; 193 193 } … … 227 227 228 228 $categories = get_categories($r); 229 229 230 230 $output = ''; 231 231 if ( $title_li && 'list' == $style ) … … 250 250 if ( $title_li && 'list' == $style ) 251 251 $output .= '</ul></li>'; 252 252 253 253 echo apply_filters('list_cats', $output); 254 254 } -
trunk/wp-includes/classes.php
r4483 r4495 13 13 var $matched_query; 14 14 var $did_permalink = false; 15 15 16 16 function add_query_var($qv) { 17 17 $this->public_query_vars[] = $qv; … … 97 97 // Got a match. 98 98 $this->matched_rule = $match; 99 99 100 100 // Trim the query of everything up to the '?'. 101 101 $query = preg_replace("!^.+\?!", '', $query); … … 191 191 ) 192 192 $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT'; 193 else 193 else 194 194 $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; 195 195 $wp_etag = '"' . md5($wp_last_modified) . '"'; … … 198 198 199 199 // Support for Conditional GET 200 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 200 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 201 201 $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); 202 202 else $client_etag = false; … … 322 322 return ''; 323 323 324 return $codes[0]; 324 return $codes[0]; 325 325 } 326 326 … … 338 338 return $this->errors[$code]; 339 339 else 340 return array(); 340 return array(); 341 341 } 342 342 … … 382 382 // A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom 383 383 384 class Walker { 384 class Walker { 385 385 var $tree_type; 386 386 var $db_fields; 387 387 388 388 //abstract callbacks 389 389 function start_lvl($output) { return $output; } … … 391 391 function start_el($output) { return $output; } 392 392 function end_el($output) { return $output; } 393 393 394 394 function walk($elements, $to_depth) { 395 395 $args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = ''; 396 396 397 397 //padding at the end 398 398 $last_element->post_parent = 0; 399 399 $last_element->post_id = 0; 400 400 $elements[] = $last_element; 401 401 402 402 $id_field = $this->db_fields['id']; 403 403 $parent_field = $this->db_fields['parent']; 404 404 405 405 $flat = ($to_depth == -1) ? true : false; 406 406 407 407 foreach ( $elements as $element ) { 408 408 // If flat, start and end the element and skip the level checks. … … 444 444 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 445 445 } 446 446 447 447 while ( $parent = array_shift($parents) ) { 448 448 $depth--; … … 464 464 } 465 465 } 466 466 467 467 // Start the element. 468 468 if ( !$to_depth || ($depth <= $to_depth) ) { … … 472 472 } 473 473 } 474 474 475 475 $previous_element = $element; 476 476 } 477 477 478 478 return $output; 479 479 } … … 483 483 var $tree_type = 'page'; 484 484 var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this 485 485 486 486 function start_lvl($output, $depth) { 487 487 $indent = str_repeat("\t", $depth); … … 489 489 return $output; 490 490 } 491 491 492 492 function end_lvl($output, $depth) { 493 493 $indent = str_repeat("\t", $depth); … … 495 495 return $output; 496 496 } 497 497 498 498 function start_el($output, $page, $depth, $current_page, $show_date, $date_format) { 499 499 if ( $depth ) … … 531 531 532 532 function start_el($output, $page, $depth, $args) { 533 534 535 536 537 538 539 540 541 542 543 533 $pad = str_repeat(' ', $depth * 3); 534 535 $output .= "\t<option value=\"$page->ID\""; 536 if ( $page->ID == $args['selected'] ) 537 $output .= ' selected="selected"'; 538 $output .= '>'; 539 $title = wp_specialchars($page->post_title); 540 $output .= "$pad$title"; 541 $output .= "</option>\n"; 542 543 return $output; 544 544 } 545 545 } … … 548 548 var $tree_type = 'category'; 549 549 var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this 550 550 551 551 function start_lvl($output, $depth, $args) { 552 552 if ( 'list' != $args['style'] ) 553 553 return $output; 554 554 555 555 $indent = str_repeat("\t", $depth); 556 556 $output .= "$indent<ul class='children'>\n"; 557 557 return $output; 558 558 } 559 559 560 560 function end_lvl($output, $depth, $args) { 561 561 if ( 'list' != $args['style'] ) 562 562 return $output; 563 563 564 564 $indent = str_repeat("\t", $depth); 565 565 $output .= "$indent</ul>\n"; 566 566 return $output; 567 567 } 568 568 569 569 function start_el($output, $category, $depth, $args) { 570 570 extract($args); 571 571 572 572 $link = '<a href="' . get_category_link($category->cat_ID) . '" '; 573 573 if ( $use_desc_for_title == 0 || empty($category->category_description) ) … … 577 577 $link .= '>'; 578 578 $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>'; 579 579 580 580 if ( (! empty($feed_image)) || (! empty($feed)) ) { 581 581 $link .= ' '; 582 582 583 583 if ( empty($feed_image) ) 584 584 $link .= '('; 585 585 586 586 $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; 587 587 588 588 if ( !empty($feed) ) { 589 589 $title = ' title="' . $feed . '"'; … … 592 592 $link .= $title; 593 593 } 594 594 595 595 $link .= '>'; 596 596 597 597 if ( !empty($feed_image) ) 598 598 $link .= "<img src='$feed_image' $alt$title" . ' />'; … … 619 619 $output .= "\t$link<br />\n"; 620 620 } 621 622 return $output; 623 } 624 621 622 return $output; 623 } 624 625 625 function end_el($output, $page, $depth, $args) { 626 626 if ( 'list' != $args['style'] ) 627 627 return $output; 628 628 629 629 $output .= "</li>\n"; 630 630 return $output; … … 636 636 var $tree_type = 'category'; 637 637 var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this 638 639 function start_el($output, $category, $depth, $args) { 638 639 function start_el($output, $category, $depth, $args) { 640 640 $pad = str_repeat(' ', $depth * 3); 641 641 642 642 $cat_name = apply_filters('list_cats', $category->cat_name, $category); 643 643 $output .= "\t<option value=\"".$category->cat_ID."\""; … … 653 653 } 654 654 $output .= "</option>\n"; 655 655 656 656 return $output; 657 657 } -
trunk/wp-includes/comment-template.php
r4494 r4495 143 143 144 144 function comments_link( $file = '', $echo = true ) { 145 145 echo get_comments_link(); 146 146 } 147 147 … … 241 241 global $id; 242 242 if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) { 243 echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 244 245 243 echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 244 xmlns:dc="http://purl.org/dc/elements/1.1/" 245 xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> 246 246 <rdf:Description rdf:about="'; 247 247 the_permalink(); … … 266 266 function pings_open() { 267 267 global $post; 268 if ( 'open' == $post->ping_status ) 268 if ( 'open' == $post->ping_status ) 269 269 return true; 270 270 else … … 300 300 301 301 function comments_popup_script($width=400, $height=400, $file='') { 302 302 global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript; 303 303 304 304 if (empty ($file)) { … … 308 308 } 309 309 310 311 312 310 $wpcommentsjavascript = 1; 311 $javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n"; 312 echo $javascript; 313 313 } 314 314 -
trunk/wp-includes/comment.php
r4299 r4495 19 19 if (empty($word)) { continue; } 20 20 21 // Do some escaping magic so that '#' chars in the 21 // Do some escaping magic so that '#' chars in the 22 22 // spam words don't break things: 23 23 $word = preg_quote($word, '#'); 24 24 25 $pattern = "#$word#i"; 25 $pattern = "#$word#i"; 26 26 if ( preg_match($pattern, $author) ) return false; 27 27 if ( preg_match($pattern, $email) ) return false; … … 104 104 $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'"; 105 105 if (false == $include_unapproved) { 106 107 } 108 106 $query .= " AND comment_approved = '1'"; 107 } 108 $myrow = $wpdb->get_row($query, ARRAY_A); 109 109 } else { 110 110 $myrow['comment_ID'] = $postc->comment_ID; … … 158 158 $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); 159 159 $comment_author_email = stripslashes($comment_author_email); 160 $comment_author_email = wp_specialchars($comment_author_email, true); 160 $comment_author_email = wp_specialchars($comment_author_email, true); 161 161 $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; 162 162 } … … 244 244 if ( empty($word) ) { continue; } 245 245 246 // Do some escaping magic so that '#' chars in the 246 // Do some escaping magic so that '#' chars in the 247 247 // spam words don't break things: 248 248 $word = preg_quote($word, '#'); 249 249 250 $pattern = "#$word#i"; 250 $pattern = "#$word#i"; 251 251 if ( preg_match($pattern, $author ) ) return true; 252 252 if ( preg_match($pattern, $email ) ) return true; … … 329 329 $user_id = 0; 330 330 331 $result = $wpdb->query("INSERT INTO $wpdb->comments 331 $result = $wpdb->query("INSERT INTO $wpdb->comments 332 332 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id) 333 VALUES 333 VALUES 334 334 ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id') 335 335 "); … … 398 398 399 399 function wp_set_comment_status($comment_id, $comment_status) { 400 401 402 400 global $wpdb; 401 402 switch($comment_status) { 403 403 case 'hold': 404 404 $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; … … 407 407 $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 408 408 break; 409 410 411 409 case 'spam': 410 $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; 411 break; 412 412 case 'delete': 413 413 return wp_delete_comment($comment_id); … … 415 415 default: 416 416 return false; 417 418 419 417 } 418 419 if ($wpdb->query($query)) { 420 420 do_action('wp_set_comment_status', $comment_id, $comment_status); 421 421 … … 426 426 $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" ); 427 427 return true; 428 428 } else { 429 429 return false; 430 430 } 431 431 } 432 432 … … 583 583 pingback($ping->post_content, $ping->ID); 584 584 } 585 585 586 586 // Do Enclosures 587 587 while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) { … … 706 706 707 707 if ($pingback_server_url) { 708 @ set_time_limit( 60 ); 708 @ set_time_limit( 60 ); 709 709 // Now, the RPC call 710 710 debug_fwrite($log, "Page Linked To: $pagelinkedto \n"); -
trunk/wp-includes/compat.php
r3901 r4495 37 37 38 38 function printr($var, $do_not_echo = false) { 39 // from php.net/print_r user contributed notes 39 // from php.net/print_r user contributed notes 40 40 ob_start(); 41 41 print_r($var); … … 43 43 ob_clean(); 44 44 if (!$do_not_echo) { 45 45 echo "<pre>$code</pre>"; 46 46 } 47 47 ob_end_clean(); … … 58 58 59 59 if (!defined('CASE_LOWER')) { 60 60 define('CASE_LOWER', 0); 61 61 } 62 62 63 63 if (!defined('CASE_UPPER')) { 64 64 define('CASE_UPPER', 1); 65 65 } 66 66 … … 79 79 */ 80 80 if (!function_exists('array_change_key_case')) { 81 82 83 84 85 86 87 81 function array_change_key_case($input, $case = CASE_LOWER) 82 { 83 if (!is_array($input)) { 84 user_error('array_change_key_case(): The argument should be an array', 85 E_USER_WARNING); 86 return false; 87 } 88 88 89 90 91 89 $output = array (); 90 $keys = array_keys($input); 91 $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; 92 92 93 94 95 93 foreach ($keys as $key) { 94 $output[$casefunc($key)] = $input[$key]; 95 } 96 96 97 98 97 return $output; 98 } 99 99 } 100 100 101 101 // From php.net 102 102 if(!function_exists('http_build_query')) { 103 104 105 106 107 108 109 110 111 112 103 function http_build_query( $formdata, $numeric_prefix = null, $key = null ) { 104 $res = array(); 105 foreach ((array)$formdata as $k=>$v) { 106 $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k); 107 if ($key) $tmp_key = $key.'['.$tmp_key.']'; 108 $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) ); 109 } 110 $separator = ini_get('arg_separator.output'); 111 return implode($separator, $res); 112 } 113 113 } 114 114 -
trunk/wp-includes/deprecated.php
r4145 r4495 130 130 131 131 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) 132 133 132 || ($author_data->user_level > $post_author_data->user_level) 133 || ($author_data->user_level >= 10) ) { 134 134 return true; 135 135 } else { … … 200 200 */ 201 201 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', 202 203 204 205 206 207 208 209 210 211 212 213 214 202 $between = " ", $show_images = true, $orderby = 'id', 203 $show_description = true, $show_rating = false, 204 $limit = -1, $show_updated = 0) { 205 global $wpdb; 206 $cat_id = -1; 207 $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); 208 if ($results) { 209 foreach ($results as $result) { 210 $cat_id = $result->cat_ID; 211 } 212 } 213 get_links($cat_id, $before, $after, $between, $show_images, $orderby, 214 $show_description, $show_rating, $limit, $show_updated); 215 215 } 216 216 … … 253 253 // Deprecate in favor of get_linkz(). 254 254 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 255 256 257 258 259 260 261 262 263 264 255 global $wpdb; 256 $cat_id = -1; 257 //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'"); 258 // TODO: Fix me. 259 if ($results) { 260 foreach ($results as $result) { 261 $cat_id = $result->cat_id; 262 } 263 } 264 return get_linkobjects($cat_id, $orderby, $limit); 265 265 } 266 266 … … 302 302 // Deprecate in favor of get_linkz(). 303 303 function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) { 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 304 global $wpdb; 305 306 $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'"; 307 if ($category != -1) { 308 $sql .= " AND link_category = $category "; 309 } 310 if ($orderby == '') 311 $orderby = 'id'; 312 if (substr($orderby,0,1) == '_') { 313 $direction = ' DESC'; 314 $orderby = substr($orderby,1); 315 } 316 if (strcasecmp('rand',$orderby) == 0) { 317 $orderby = 'rand()'; 318 } else { 319 $orderby = " link_" . $orderby; 320 } 321 $sql .= ' ORDER BY ' . $orderby; 322 $sql .= $direction; 323 /* The next 2 lines implement LIMIT TO processing */ 324 if ($limit != -1) 325 $sql .= " LIMIT $limit"; 326 327 $results = $wpdb->get_results($sql); 328 if ($results) { 329 foreach ($results as $result) { 330 $result->link_url = $result->link_url; 331 $result->link_name = $result->link_name; 332 $result->link_description = $result->link_description; 333 $result->link_notes = $result->link_notes; 334 $newresults[] = $result; 335 } 336 } 337 return $newresults; 338 338 } 339 339 … … 360 360 */ 361 361 function get_linksbyname_withrating($cat_name = "noname", $before = '', 362 363 364 365 366 367 362 $after = '<br />', $between = " ", 363 $show_images = true, $orderby = 'id', 364 $show_description = true, $limit = -1, $show_updated = 0) { 365 366 get_linksbyname($cat_name, $before, $after, $between, $show_images, 367 $orderby, $show_description, true, $limit, $show_updated); 368 368 } 369 369 … … 390 390 */ 391 391 function get_links_withrating($category = -1, $before = '', $after = '<br />', 392 393 394 395 396 397 392 $between = " ", $show_images = true, 393 $orderby = 'id', $show_description = true, 394 $limit = -1, $show_updated = 0) { 395 396 get_links($category, $before, $after, $between, $show_images, $orderby, 397 $show_description, true, $limit, $show_updated); 398 398 } 399 399 … … 404 404 */ 405 405 function get_autotoggle($id = 0) { 406 return 0; 406 return 0; 407 407 } 408 408 … … 434 434 $r['title_li'] = ''; 435 435 436 return wp_list_categories($r); 436 return wp_list_categories($r); 437 437 } 438 438 -
trunk/wp-includes/formatting.php
r4451 r4495 66 66 $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 67 67 // Space things out a little 68 $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee); 68 $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee); 69 69 $pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee); 70 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 70 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 71 71 $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 72 $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 73 $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 72 $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 73 $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 74 74 $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 75 75 $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists … … 77 77 $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); 78 78 $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee); 79 $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); 79 $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); 80 80 if ($br) { 81 81 $pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee); … … 87 87 $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); 88 88 89 return $pee; 89 return $pee; 90 90 } 91 91 … … 127 127 128 128 function utf8_uri_encode( $utf8_string ) { 129 $unicode = ''; 130 $values = array(); 131 $num_octets = 1; 132 133 for ($i = 0; $i < strlen( $utf8_string ); $i++ ) { 134 135 $value = ord( $utf8_string[ $i ] ); 136 137 if ( $value < 128 ) { 138 $unicode .= chr($value); 139 } else { 140 if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; 141 142 $values[] = $value; 143 144 if ( count( $values ) == $num_octets ) { 145 if ($num_octets == 3) { 146 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); 147 } else { 148 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); 149 } 150 129 $unicode = ''; 151 130 $values = array(); 152 131 $num_octets = 1; 153 } 154 } 155 } 156 157 return $unicode; 132 133 for ($i = 0; $i < strlen( $utf8_string ); $i++ ) { 134 135 $value = ord( $utf8_string[ $i ] ); 136 137 if ( $value < 128 ) { 138 $unicode .= chr($value); 139 } else { 140 if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; 141 142 $values[] = $value; 143 144 if ( count( $values ) == $num_octets ) { 145 if ($num_octets == 3) { 146 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); 147 } else { 148 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); 149 } 150 151 $values = array(); 152 $num_octets = 1; 153 } 154 } 155 } 156 157 return $unicode; 158 158 } 159 159 … … 340 340 } 341 341 342 function convert_chars($content, $flag = 'obsolete') { 342 function convert_chars($content, $flag = 'obsolete') { 343 343 // Translation of invalid Unicode references range to valid range 344 344 $wp_htmltranswinuni = array( … … 406 406 /* 407 407 balanceTags 408 408 409 409 Balances Tags of string using a modified stack. 410 410 411 411 @param text Text to be balanced 412 412 @return Returns balanced text … … 415 415 @date November 4, 2001 416 416 @license GPL v2.0 417 @notes 418 @changelog 417 @notes 418 @changelog 419 419 --- Modified by Scott Reilly (coffee2code) 02 Aug 2004 420 421 422 423 420 1.2 ***TODO*** Make better - change loop condition to $text 421 1.1 Fixed handling of append/stack pop order of end text 422 Added Cleaning Hooks 423 1.0 First Version 424 424 */ 425 425 function balanceTags($text, $is_comment = 0, $force = false) { … … 447 447 $tag = strtolower(substr($regex[1],1)); 448 448 // if too many closing tags 449 if($stacksize <= 0) { 449 if($stacksize <= 0) { 450 450 $tag = ''; 451 451 //or close to be safe $tag = '/' . $tag; … … 504 504 $newtext .= substr($text,0,$i) . $tag; 505 505 $text = substr($text,$i+$l); 506 } 506 } 507 507 508 508 // Clear Tag Queue … … 553 553 554 554 function trailingslashit($string) { 555 556 557 558 555 if ( '/' != substr($string, -1)) { 556 $string .= '/'; 557 } 558 return $string; 559 559 } 560 560 … … 572 572 function stripslashes_deep($value) 573 573 { 574 575 576 577 578 574 $value = is_array($value) ? 575 array_map('stripslashes_deep', $value) : 576 stripslashes($value); 577 578 return $value; 579 579 } 580 580 … … 732 732 } 733 733 734 function human_time_diff( $from, $to = '' ) { 734 function human_time_diff( $from, $to = '' ) { 735 735 if ( empty($to) ) 736 736 $to = time(); … … 746 746 if ($hours <= 1) 747 747 $since = __('1 hour'); 748 else 748 else 749 749 $since = sprintf( __('%s hours'), $hours ); 750 750 } elseif ($diff >= 86400) { -
trunk/wp-includes/functions.php
r4483 r4495 13 13 if( 'U' == $dateformatstring ) 14 14 return $i; 15 15 16 16 if ( -1 == $i || false == $i ) 17 17 $i = 0; … … 463 463 464 464 if ( $red > 5 ) 465 465 return false; 466 466 467 467 $parts = parse_url( $url ); … … 492 492 $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404 493 493 494 495 496 494 $code = $headers['response']; 495 if ( ('302' == $code || '301' == $code) && isset($headers['location']) ) 496 return wp_get_http_headers( $headers['location'], ++$red ); 497 497 498 498 return $headers; … … 802 802 803 803 function bool_from_yn($yn) { 804 805 804 if ($yn == 'Y') return 1; 805 return 0; 806 806 } 807 807 … … 958 958 } 959 959 960 960 $uploads = array('path' => $dir, 'url' => $url, 'error' => false); 961 961 return apply_filters('upload_dir', $uploads); 962 962 } -
trunk/wp-includes/general-template.php
r4476 r4495 472 472 WHERE post_date > '$thisyear-$thismonth-01' 473 473 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 474 AND post_type = 'post' AND post_status = 'publish' 474 AND post_type = 'post' AND post_status = 'publish' 475 475 ORDER BY post_date ASC 476 476 LIMIT 1"); -
trunk/wp-includes/l10n.php
r4202 r4495 18 18 } 19 19 20 // Return a translated string. 20 // Return a translated string. 21 21 function __($text, $domain = 'default') { 22 22 global $l10n; -
trunk/wp-includes/link-template.php
r4475 r4495 64 64 $author = $authordata->user_nicename; 65 65 $date = explode(" ",date('Y m d H i s', $unixtime)); 66 $rewritereplace = 66 $rewritereplace = 67 67 array( 68 68 $date[0], … … 283 283 $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); 284 284 } 285 $join .= ')'; 285 $join .= ')'; 286 286 } 287 287 … … 316 316 $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); 317 317 } 318 $join .= ')'; 318 $join .= ')'; 319 319 } 320 320 … … 351 351 $format = str_replace('%link', $link, $format); 352 352 353 echo $format; 353 echo $format; 354 354 } 355 355 … … 366 366 $format = str_replace('%link', $link, $format); 367 367 368 echo $format; 368 echo $format; 369 369 } 370 370 … … 374 374 $qstr = wp_specialchars($_SERVER['REQUEST_URI']); 375 375 376 $page_querystring = "paged"; 376 $page_querystring = "paged"; 377 377 $page_modstring = "page/"; 378 378 $page_modregex = "page/?"; … … 493 493 $max_num_pages = $wp_query->max_num_pages; 494 494 $paged = get_query_var('paged'); 495 495 496 496 //only have sep if there's both prev and next results 497 497 if ($paged < 2 || $paged >= $max_num_pages) { -
trunk/wp-includes/pluggable.php
r4432 r4495 47 47 return; 48 48 49 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 49 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 50 50 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { 51 51 wp_set_current_user(0); … … 213 213 function auth_redirect() { 214 214 // Checks if a user is logged in, if not redirects them to the login page 215 if ( (!empty($_COOKIE[USER_COOKIE]) && 215 if ( (!empty($_COOKIE[USER_COOKIE]) && 216 216 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || 217 217 (empty($_COOKIE[USER_COOKIE])) ) { … … 332 332 function wp_notify_postauthor($comment_id, $comment_type='') { 333 333 global $wpdb; 334 334 335 335 $comment = get_comment($comment_id); 336 336 $post = get_post($comment->comment_post_ID); … … 379 379 if ( '' != $comment->comment_author_email ) 380 380 $reply_to = "Reply-To: $comment->comment_author_email"; 381 381 } else { 382 382 $from = "From: \"$comment->comment_author\" <$wp_email>"; 383 383 if ( '' != $comment->comment_author_email ) 384 384 $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; 385 385 } 386 386 387 387 $message_headers = "MIME-Version: 1.0\n" … … 440 440 441 441 @wp_mail($admin_email, $subject, $notify_message); 442 442 443 443 return true; 444 444 } … … 490 490 491 491 $i = ceil(time() / 43200); 492 492 493 493 return substr(wp_hash($i . $action . $uid), -12, 10); 494 494 } -
trunk/wp-includes/post.php
r4425 r4495 167 167 if ( !empty($include) ) { 168 168 $offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include 169 $category = ''; 170 $exclude = ''; 169 $category = ''; 170 $exclude = ''; 171 171 $meta_key = ''; 172 172 $meta_value = ''; … … 182 182 } 183 183 } 184 if (!empty($inclusions)) 185 $inclusions .= ')'; 184 if (!empty($inclusions)) 185 $inclusions .= ')'; 186 186 187 187 $exclusions = ''; … … 197 197 } 198 198 } 199 if (!empty($exclusions)) 199 if (!empty($exclusions)) 200 200 $exclusions .= ')'; 201 201 202 202 $query ="SELECT DISTINCT * FROM $wpdb->posts " ; 203 $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; 204 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 203 $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; 204 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 205 205 $query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ; 206 206 $query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ; … … 401 401 $post_ID = (int) $post_ID; 402 402 403 $sql = "SELECT category_id 404 FROM $wpdb->post2cat 405 WHERE post_id = '$post_ID' 403 $sql = "SELECT category_id 404 FROM $wpdb->post2cat 405 WHERE post_id = '$post_ID' 406 406 ORDER BY category_id"; 407 407 … … 436 436 if($mode == OBJECT) { 437 437 $post->post_category = wp_get_post_categories($postid); 438 } 438 } 439 439 else { 440 440 $post['post_category'] = wp_get_post_categories($postid); … … 636 636 if ( $post_pingback ) 637 637 $result = $wpdb->query(" 638 INSERT INTO $wpdb->postmeta 639 (post_id,meta_key,meta_value)