Changeset 489
- Timestamp:
- 01/02/06 17:10:03 (3 years ago)
- Files:
-
- trunk/wp-inst/wp-admin/admin-functions.php (modified) (5 diffs)
- trunk/wp-inst/wp-admin/admin-header.php (modified) (2 diffs)
- trunk/wp-inst/wp-admin/edit-comments.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/execute-pings.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/import/livejournal.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/import/mt.php (modified) (5 diffs)
- trunk/wp-inst/wp-admin/import/rss.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/link-import.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/list-manipulation.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/options-permalink.php (modified) (2 diffs)
- trunk/wp-inst/wp-admin/options.php (modified) (3 diffs)
- trunk/wp-inst/wp-admin/plugins.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/post.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/templates.php (modified) (1 diff)
- trunk/wp-inst/wp-admin/upgrade-functions.php (modified) (2 diffs)
- trunk/wp-inst/wp-includes/cache.php (modified) (5 diffs)
- trunk/wp-inst/wp-includes/classes.php (modified) (10 diffs)
- trunk/wp-inst/wp-includes/comment-functions.php (modified) (1 diff)
- trunk/wp-inst/wp-includes/functions-post.php (modified) (13 diffs)
- trunk/wp-inst/wp-includes/vars.php (modified) (1 diff)
- trunk/wp-inst/wp-login.php (modified) (1 diff)
- trunk/wp-inst/wp-settings.php (modified) (5 diffs)
- trunk/wp-inst/wp-trackback.php (modified) (1 diff)
- trunk/wp-inst/xmlrpc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-inst/wp-admin/admin-functions.php
r477 r489 1250 1250 } 1251 1251 1252 $parent = get_admin_page_parent(); 1252 $hook = get_plugin_page_hook($plugin_page, $pagenow); 1253 1254 $parent = $parent1 = get_admin_page_parent(); 1253 1255 if (empty ($parent)) { 1254 1256 foreach ($menu as $menu_array) { … … 1258 1260 return $menu_array[3]; 1259 1261 } else 1260 if (isset ($plugin_page) && ($plugin_page == $menu_array[2]) ) {1262 if (isset ($plugin_page) && ($plugin_page == $menu_array[2]) && ($hook == $menu_array[3])) { 1261 1263 $title = $menu_array[3]; 1262 1264 return $menu_array[3]; … … 1272 1274 return $submenu_array[3]; 1273 1275 } else 1274 if (isset ($plugin_page) && ($plugin_page == $submenu_array[2]) ) {1276 if (isset ($plugin_page) && ($plugin_page == $submenu_array[2]) && (($parent == $pagenow) || ($parent == $plugin_page) || ($plugin_page == $hook) || (($pagenow == 'admin.php') && ($parent1 != $submenu_array[2])))) { 1275 1277 $title = $submenu_array[3]; 1276 1278 return $submenu_array[3]; … … 1720 1722 1721 1723 // A properly uploaded file will pass this test. There should be no reason to override this one. 1722 if (! is_uploaded_file($file['tmp_name']) )1724 if (! @ is_uploaded_file($file['tmp_name']) ) 1723 1725 return $upload_error_handler($file, __('Specified file failed upload test.')); 1724 1726 … … 1749 1751 $number = ''; 1750 1752 $filename = $file['name']; 1751 while ( file_exists($uploads['path'] . "/$filename") ) 1752 $filename = str_replace("$number.$ext", ++$number . ".$ext", $filename); 1753 if ( empty($ext) ) 1754 $ext = ''; 1755 else 1756 $ext = ".$ext"; 1757 while ( file_exists($uploads['path'] . "/$filename") ) { 1758 if ( '' == "$number$ext" ) 1759 $filename = $filename . ++$number . $ext; 1760 else 1761 $filename = str_replace("$number$ext", ++$number . $ext, $filename); 1762 } 1753 1763 } 1754 1764 1755 1765 // Move the file to the uploads dir 1756 1766 $new_file = $uploads['path'] . "/$filename"; 1757 if ( false === move_uploaded_file($file['tmp_name'], $new_file) )1767 if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) ) 1758 1768 die(printf(__('The uploaded file could not be moved to %s.'), $file['path'])); 1759 1769 trunk/wp-inst/wp-admin/admin-header.php
r483 r489 131 131 function newCatAddIn() { 132 132 if ( !document.getElementById('jaxcat') ) return false; 133 var ajaxcat = document.createElement(' p');133 var ajaxcat = document.createElement('span'); 134 134 ajaxcat.id = 'ajaxcat'; 135 135 … … 205 205 names = myPload( newcat.value ); 206 206 for ( i = 0; i < ids.length; i++ ) { 207 id = ids[i].replace(/[\n\r \l]+/g, "");207 id = ids[i].replace(/[\n\r]+/g, ""); 208 208 if ( id == '-1' ) { 209 209 p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>"; trunk/wp-inst/wp-admin/edit-comments.php
r430 r489 45 45 $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 46 46 if ( current_user_can('edit_post', $post_id) ) : 47 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");47 wp_set_comment_status($comment, "delete"); 48 48 ++$i; 49 49 endif; trunk/wp-inst/wp-admin/execute-pings.php
r475 r489 20 20 } 21 21 // Do Trackbacks 22 while ($trackback = $wpdb->get_row("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft' LIMIT 1")) { 23 echo "Trackback : $trackback->ID<br/>"; 24 do_trackbacks($trackback->ID); 22 $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'"); 23 24 if (is_array($trackbacks) && count($trackbacks)) { 25 foreach ($trackbacks as $trackback ) { 26 echo "Trackback : $trackback->ID<br/>"; 27 do_trackbacks($trackback->ID); 28 } 25 29 } 26 30 } trunk/wp-inst/wp-admin/import/livejournal.php
r205 r489 1 <?php 2 3 class LJ_Import { 4 5 var $file; 6 7 function header() { 8 echo '<div class="wrap">'; 9 echo '<h2>'.__('Import LiveJournal').'</h2>'; 10 } 11 12 function footer() { 13 echo '</div>'; 14 } 15 16 function unhtmlentities($string) { // From php.net for < 4.3 compat 17 $trans_tbl = get_html_translation_table(HTML_ENTITIES); 18 $trans_tbl = array_flip($trans_tbl); 19 return strtr($string, $trans_tbl); 20 } 21 22 function greet() { 23 echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>'; 24 wp_import_upload_form("admin.php?import=livejournal&step=1"); 25 } 26 27 function import_posts() { 28 global $wpdb, $current_user; 29 30 set_magic_quotes_runtime(0); 31 $importdata = file($this->file); // Read the file into an array 32 $importdata = implode('', $importdata); // squish it 33 $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata); 34 35 preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts); 36 $posts = $posts[1]; 37 unset($importdata); 38 echo '<ol>'; 39 foreach ($posts as $post) { 40 flush(); 41 preg_match('|<subject>(.*?)</subject>|is', $post, $post_title); 42 $post_title = $wpdb->escape(trim($post_title[1])); 43 if ( empty($post_title) ) { 44 preg_match('|<itemid>(.*?)</itemid>|is', $post, $post_title); 45 $post_title = $wpdb->escape(trim($post_title[1])); 46 } 47 48 preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date); 49 $post_date = strtotime($post_date[1]); 50 $post_date = gmdate('Y-m-d H:i:s', $post_date); 51 52 preg_match('|<event>(.*?)</event>|is', $post, $post_content); 53 $post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1])); 54 $post_content = $this->unhtmlentities($post_content); 55 56 // Clean up content 57 $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content); 58 $post_content = str_replace('<br>', '<br />', $post_content); 59 $post_content = str_replace('<hr>', '<hr />', $post_content); 60 $post_content = $wpdb->escape($post_content); 61 62 $post_author = $current_user->ID; 63 $post_status = 'publish'; 64 65 echo '<li>'; 66 if ($post_id = post_exists($post_title, $post_content, $post_date)) { 67 printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title)); 68 } else { 69 printf(__('Importing post <i>%s</i>...'), stripslashes($post_title)); 70 $post = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status'); 71 $post_id = wp_insert_post($post); 72 if (!$post_id) { 73 _e("Couldn't get post ID"); 74 echo '</li>'; 75 break; 76 } 77 } 78 79 preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); 80 $comments = $comments[1]; 81 82 if ( $comments ) { 83 $comment_post_ID = $post_id; 84 $num_comments = 0; 85 foreach ($comments as $comment) { 86 preg_match('|<event>(.*?)</event>|is', $comment, $comment_content); 87 $comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1])); 88 $comment_content = $this->unhtmlentities($comment_content); 89 90 // Clean up content 91 $comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content); 92 $comment_content = str_replace('<br>', '<br />', $comment_content); 93 $comment_content = str_replace('<hr>', '<hr />', $comment_content); 94 $comment_content = $wpdb->escape($comment_content); 95 96 preg_match('|<eventtime>(.*?)</eventtime>|is', $comment, $comment_date); 97 $comment_date = trim($comment_date[1]); 98 $comment_date = date('Y-m-d H:i:s', strtotime($comment_date)); 99 100 preg_match('|<name>(.*?)</name>|is', $comment, $comment_author); 101 $comment_author = $wpdb->escape(trim($comment_author[1])); 102 103 preg_match('|<email>(.*?)</email>|is', $comment, $comment_author_email); 104 $comment_author_email = $wpdb->escape(trim($comment_author_email[1])); 105 106 $comment_approved = 1; 107 // Check if it's already there 108 if (!comment_exists($comment_author, $comment_date)) { 109 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved'); 110 $commentdata = wp_filter_comment($commentdata); 111 wp_insert_comment($commentdata); 112 $num_comments++; 113 } 114 } 115 } 116 if ( $num_comments ) 117 printf(__('(%s comments)'), $num_comments); 118 119 echo '</li>'; 120 flush(); 121 ob_flush(); 122 } 123 echo '</ol>'; 124 } 125 126 function import() { 127 $file = wp_import_handle_upload(); 128 if ( isset($file['error']) ) { 129 echo $file['error']; 130 return; 131 } 132 133 $this->file = $file['file']; 134 $this->import_posts(); 135 wp_import_cleanup($file['id']); 136 137 echo '<h3>'; 138 printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); 139 echo '</h3>'; 140 } 141 142 function dispatch() { 143 if (empty ($_GET['step'])) 144 $step = 0; 145 else 146 $step = (int) $_GET['step']; 147 148 $this->header(); 149 150 switch ($step) { 151 case 0 : 152 $this->greet(); 153 break; 154 case 1 : 155 $this->import(); 156 break; 157 } 158 159 $this->footer(); 160 } 161 162 function LJ_Import() { 163 // Nothing. 164 } 165 } 166 167 $livejournal_import = new LJ_Import(); 168 169 register_importer('livejournal', 'LiveJournal', __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch')); 170 ?> trunk/wp-inst/wp-admin/import/mt.php
r487 r489 55 55 ++ $this->j; 56 56 $this->mtnames[$this->j] = $author; //add that new mt author name to an array 57 $user_id = username_exists($this->newauthornames[$ j]); //check if the new author name defined by the user is a pre-existing wp user57 $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user 58 58 if (!$user_id) { //banging my head against the desk now. 59 59 if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname … … 244 244 break; 245 245 case 'ALLOW PINGS' : 246 $p ost_allow_pings = trim($meta[2][0]);247 if ($p ost_allow_pings == 1) {248 $p ost_allow_pings = 'open';246 $ping_status = trim($meta[2][0]); 247 if ($ping_status == 1) { 248 $ping_status = 'open'; 249 249 } else { 250 $p ost_allow_pings = 'closed';250 $ping_status = 'closed'; 251 251 } 252 252 break; … … 291 291 292 292 $comment_post_ID = $post_id; 293 $comment_approved = 1; 293 294 294 295 // Now for comments … … 322 323 // Check if it's already there 323 324 if (!comment_exists($comment_author, $comment_date)) { 324 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content' );325 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved'); 325 326 $commentdata = wp_filter_comment($commentdata); 326 327 wp_insert_comment($commentdata); … … 370 371 // Check if it's already there 371 372 if (!comment_exists($comment_author, $comment_date)) { 372 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_type' );373 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_type', 'comment_approved'); 373 374 $commentdata = wp_filter_comment($commentdata); 374 375 wp_insert_comment($commentdata); trunk/wp-inst/wp-admin/import/rss.php
r460 r489 1 1 <?php 2 3 // Example:4 // define('RSSFILE', '/home/example/public_html/rss.xml');5 define('RSSFILE', 'rss.xml');6 2 7 3 class RSS_Import { trunk/wp-inst/wp-admin/link-import.php
r487 r489 127 127 } // end case 1 128 128 } // end switch 129 130 include('admin-footer.php'); 131 129 132 ?> 130 </body>131 </html>trunk/wp-inst/wp-admin/list-manipulation.php
r471 r489 31 31 case 'delete-page' : 32 32 $id = (int) $_POST['id']; 33 if ( !current_user_can('edit_post', $ post_id) )33 if ( !current_user_can('edit_post', $id) ) { 34 34 die('-1'); 35 } 35 36 36 if ( wp_delete_post($id) ) 37 if ( wp_delete_post($id) ) { 37 38 die('1'); 38 else die('0');39 } else die('0'); 39 40 break; 40 41 case 'delete-cat' : trunk/wp-inst/wp-admin/options-permalink.php
r465 r489 78 78 $category_base = get_settings('category_base'); 79 79 80 generate_page_rewrite_rules();81 82 80 if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) 83 81 $writable = true; … … 90 88 $usingpi = false; 91 89 92 save_mod_rewrite_rules();90 $wp_rewrite->flush_rules(); 93 91 ?> 94 92 trunk/wp-inst/wp-admin/options.php
r452 r489 31 31 32 32 check_admin_referer(); 33 33 34 34 if (!$_POST['page_options']) { 35 35 foreach ($_POST as $key => $value) { 36 $options[] = "$key";36 $options[] = $key; 37 37 } 38 38 } else { … … 55 55 56 56 if( $option == 'blogdescription' || $option == 'blogname' ) 57 $value = wp_filter_post_kses( $value ); 57 if (current_user_can('unfiltered_html') == false) 58 $value = wp_filter_post_kses( $value ); 58 59 59 60 if ( update_option($option, $value) ) … … 66 67 if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) { 67 68 // If home changed, write rewrite rules to new location. 68 save_mod_rewrite_rules();69 $wp_rewrite->flush_rules(); 69 70 // Get currently logged in user and password. 70 71 get_currentuserinfo(); trunk/wp-inst/wp-admin/plugins.php
r469 r489 29 29 header('Location: plugins.php?deactivate=true'); 30 30 } 31 exit; 31 32 } 32 33 trunk/wp-inst/wp-admin/post.php
r472 r489 241 241 242 242 case 'unapprovecomment': 243 244 require_once('./admin-header.php');245 243 246 244 check_admin_referer(); trunk/wp-inst/wp-admin/templates.php
r482 r489 88 88 <?php if ( 'err' == $_GET['a'] ) : ?> 89 89 <div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div> 90 <? else: ?>90 <?php else: ?> 91 91 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> 92 <? endif; ?>92 <?php endif; ?> 93 93 <?php endif; ?> 94 94 <div class="wrap"> trunk/wp-inst/wp-admin/upgrade-functions.php
r469 r489 6 6 // Functions to be called in install and upgrade scripts 7 7 function upgrade_all() { 8 global $wp_current_db_version, $wp_db_version ;8 global $wp_current_db_version, $wp_db_version, $wp_rewrite; 9 9 $wp_current_db_version = __get_option('db_version'); 10 10 … … 35 35 upgrade_160(); 36 36 37 save_mod_rewrite_rules();37 $wp_rewrite->flush_rules(); 38 38 39 39 update_option('db_version', $wp_db_version); trunk/wp-inst/wp-includes/cache.php
r477 r489 54 54 var $cache_dir; 55 55 var $cache_enabled = false; 56 var $expiration_time = 86400;56 var $expiration_time = 900; 57 57 var $flock_filename = 'wp_object_cache.lock'; 58 58 var $cache = array (); … … 206 206 207 207 if (!file_exists($this->cache_dir.$make_dir."index.php")) { 208 $file_perms = $perms & 0000666; 208 209 @ touch($this->cache_dir.$make_dir."index.php"); 210 @ chmod($this->cache_dir.$make_dir."index.php", $file_perms); 209 211 } 210 212 } … … 269 271 // Give the new dirs the same perms as wp-content. 270 272 $stat = stat(ABSPATH.'wp-content'); 271 $dir_perms = $stat['mode'] & 0000777; // Get the permission bits. 273 $dir_perms = $stat['mode'] & 0007777; // Get the permission bits. 274 $file_perms = $dir_perms & 0000666; // Remove execute bits for files. 272 275 273 276 // Make the base cache dir. … … 280 283 if (!file_exists($this->cache_dir."index.php")) { 281 284 @ touch($this->cache_dir."index.php"); 285 @ chmod($this->cache_dir."index.php", $file_perms); 282 286 } 283 287 … … 315 319 } 316 320 } 321 @ chmod($cache_file, $file_perms); 317 322 } 318 323 } trunk/wp-inst/wp-includes/classes.php
r487 r489 382 382 $where .= " AND (ID = '$reqpage')"; 383 383 } elseif ('' != $q['attachment']) { 384 $q['attachment'] = sanitize_title($q['attachment']); 384 $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment']))); 385 $attach_paths = '/' . trim($q['attachment'], '/'); 386 $q['attachment'] = sanitize_title(basename($attach_paths)); 385 387 $q['name'] = $q['attachment']; 386 388 $where .= " AND post_name = '" . $q['attachment'] . "'"; … … 484 486 485 487 $all_cat_ids = get_all_category_ids(); 486 $q['cat'] = 0; 488 $q['cat'] = 0; $partial_match = 0; 487 489 foreach ( $all_cat_ids as $cat_id ) { 488 490 $cat = get_category($cat_id); … … 490 492 $q['cat'] = $cat_id; 491 493 break; 492 } 493 } 494 } elseif ( $cat->category_nicename == $q['category_name'] ) { 495 $partial_match = $cat_id; 496 } 497 } 498 499 //if we don't match the entire hierarchy fallback on just matching the nicename 500 if (!$q['cat'] && $partial_match) { 501 $q['cat'] = $partial_match; 502 } 494 503 495 504 $tables = ", $wpdb->post2cat, $wpdb->categories"; … … 954 963 function page_rewrite_rules() { 955 964 $uris = get_settings('page_uris'); 965 $attachment_uris = get_settings('page_attachment_uris'); 956 966 957 967 $rewrite_rules = array(); 958 968 $page_structure = $this->get_page_permastruct(); 959 if( is_array( $uris ) ) 960 { 961 foreach ($uris as $uri => $pagename) { 962 $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); 963 $rewrite_rules += $this->generate_rewrite_rules($page_structure); 964 } 965 } 969 if( is_array( $attachment_uris ) ) { 970 foreach ($attachment_uris as $uri => $pagename) { 971 $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment='); 972 $rewrite_rules += $this->generate_rewrite_rules($page_structure); 973 } 974 } 975 if( is_array( $uris ) ) { 976 foreach ($uris as $uri => $pagename) { 977 $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); 978 $rewrite_rules += $this->generate_rewrite_rules($page_structure); 979 } 980 } 966 981 967 982 return $rewrite_rules; … … 1226 1241 1227 1242 if ($num_toks) { 1228 $post = 0; 1243 $post = false; 1244 $page = false; 1229 1245 if (strstr($struct, '%postname%') || strstr($struct, '%post_id%') 1230 1246 || strstr($struct, '%pagename%') 1231 1247 || (strstr($struct, '%year%') && strstr($struct, '%monthnum%') && strstr($struct, '%day%') && strstr($struct, '%hour%') && strstr($struct, '%minute') && strstr($struct, '%second%'))) { 1232 $post = 1; 1248 $post = true; 1249 if ( strstr($struct, '%pagename%') ) 1250 $page = true; 1233 1251 $trackbackmatch = $match . $trackbackregex; 1234 1252 $trackbackquery = $trackbackindex . '?' . $query . '&tb=1'; … … 1258 1276 1259 1277 if ($post) { 1260 $rewrite = array($trackbackmatch => $trackbackquery) + $rewrite + 1261 array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery) + 1262 array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery); 1278 $rewrite = array($trackbackmatch => $trackbackquery) + $rewrite; 1279 if ( ! $page ) 1280 $rewrite = $rewrite + array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery); 1281 $rewrite = $rewrite + array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery); 1263 1282 } 1264 1283 } … … 1328 1347 1329 1348 function wp_rewrite_rules() { 1330 $this->matches = 'matches'; 1331 return $this->rewrite_rules(); 1349 $this->rules = get_option('rewrite_rules'); 1350 if ( empty($this->rules) ) { 1351 $this->matches = 'matches'; 1352 $this->rewrite_rules(); 1353 update_option('rewrite_rules', $this->rules); 1354 } 1355 1356 return $this->rules; 1332 1357 } 1333 1358 … … 1385 1410 } 1386 1411 1412 function flush_rules() { 1413 generate_page_rewrite_rules(); 1414 delete_option('rewrite_rules'); 1415 $this->wp_rewrite_rules(); 1416 if ( function_exists('save_mod_rewrite_rules') ) 1417 save_mod_rewrite_rules(); 1418 } 1419 1387 1420 function init() { 1388 1421 $this->permalink_structure = get_settings('permalink_structure'); … … 1462 1495 $home_path = parse_url(get_settings('home')); 1463 1496 $home_path = $home_path['path']; 1497 $home_path = trim($home_path, '/'); 1464 1498 1465 1499 // Trim path info from the end and the leading home path from the … … 1468 1502 // requested permalink. 1469 1503 $req_uri = str_replace($pathinfo, '', $req_uri); 1470 $req_uri = str_replace($home_path, '', $req_uri);1471 1504 $req_uri = trim($req_uri, '/'); 1472 $pathinfo = str_replace($home_path, '', $pathinfo); 1505 $req_uri = preg_replace("|^$home_path|", '', $req_uri); 1506 $req_uri = trim($req_uri, '/'); 1473 1507 $pathinfo = trim($pathinfo, '/'); 1508 $pathinfo = preg_replace("|^$home_path|", '', $pathinfo); 1509 $pathinfo = trim($pathinfo, '/'); 1510 $self = trim($self, '/'); 1511 $self = preg_replace("|^$home_path|", '', $self); 1474 1512 $self = str_replace($home_path, '', $self); 1475 1513 $self = trim($self, '/'); trunk/wp-inst/wp-includes/comment-functions.php
r477 r489 77 77 if ( ! isset($comment_parent) ) 78 78 $comment_parent = 0; 79 if ( ! isset($comment_approved) ) 80 $comment_approved = 1; 79 81 80 82 $result = $wpdb->query("INSERT INTO $wpdb->comments trunk/wp-inst/wp-includes/functions-post.php
r487 r489 7 7 */ 8 8 function wp_insert_post($postarr = array()) { 9 global $wpdb, $ allowedtags, $user_ID;9 global $wpdb, $wp_rewrite, $allowedtags, $user_ID; 10 10 11 11 if ( is_object($postarr) ) … … 122 122 if ($update) { 123 123 $wpdb->query( 124 "UPDATE $wpdb->posts SET124 "UPDATE IGNORE $wpdb->posts SET 125 125 post_author = '$post_author', 126 126 post_date = '$post_date', … … 144 144 } else { 145 145 $wpdb->query( 146 "INSERT I NTO $wpdb->posts146 "INSERT IGNORE INTO $wpdb->posts 147 147 (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) 148 148 VALUES … …
