Changeset 4626
- Timestamp:
- 12/07/2006 03:57:23 AM (19 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 5 edited
-
comment.php (modified) (36 diffs)
-
feed.php (modified) (11 diffs)
-
plugin.php (modified) (2 diffs)
-
registration.php (modified) (7 diffs)
-
vars.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r4495 r4626 4 4 global $wpdb; 5 5 6 if (1 == get_option('comment_moderation')) return false; // If moderation is set to manual 6 if ( 1 == get_option('comment_moderation') ) 7 return false; // If moderation is set to manual 7 8 8 9 if ( preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $comment, $out) >= get_option('comment_max_links') ) 9 10 return false; // Check # of external links 10 11 11 $mod_keys = trim( get_option('moderation_keys'));12 $mod_keys = trim(get_option('moderation_keys')); 12 13 if ( !empty($mod_keys) ) { 13 14 $words = explode("\n", $mod_keys ); … … 17 18 18 19 // Skip empty lines 19 if (empty($word)) { continue; } 20 if ( empty($word) ) 21 continue; 20 22 21 23 // Do some escaping magic so that '#' chars in the … … 44 46 else 45 47 return false; 46 } elseif ( $author != '' && $email != '' ) {48 } elseif ( $author != '' && $email != '' ) { 47 49 $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1"); 48 50 if ( ( 1 == $ok_to_comment ) && … … 55 57 } 56 58 } 57 58 59 return true; 59 60 } 61 60 62 61 63 function get_approved_comments($post_id) { … … 65 67 return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1' ORDER BY comment_date"); 66 68 } 69 67 70 68 71 // Retrieves comment data given a comment ID or comment object. … … 98 101 } 99 102 103 100 104 // Deprecate in favor of get_comment()? 101 105 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries 102 106 global $postc, $id, $commentdata, $wpdb; 103 if ( $no_cache) {107 if ( $no_cache ) { 104 108 $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'"; 105 if (false == $include_unapproved) { 106 $query .= " AND comment_approved = '1'"; 107 } 108 $myrow = $wpdb->get_row($query, ARRAY_A); 109 if ( false == $include_unapproved ) 110 $query .= " AND comment_approved = '1'"; 111 $myrow = $wpdb->get_row($query, ARRAY_A); 109 112 } else { 110 $myrow['comment_ID'] = $postc->comment_ID;111 $myrow['comment_post_ID'] = $postc->comment_post_ID;112 $myrow['comment_author'] = $postc->comment_author;113 $myrow['comment_ID'] = $postc->comment_ID; 114 $myrow['comment_post_ID'] = $postc->comment_post_ID; 115 $myrow['comment_author'] = $postc->comment_author; 113 116 $myrow['comment_author_email'] = $postc->comment_author_email; 114 $myrow['comment_author_url'] = $postc->comment_author_url;115 $myrow['comment_author_IP'] = $postc->comment_author_IP;116 $myrow['comment_date'] = $postc->comment_date;117 $myrow['comment_content'] = $postc->comment_content;118 $myrow['comment_karma'] = $postc->comment_karma;119 $myrow['comment_approved'] = $postc->comment_approved;120 $myrow['comment_type'] = $postc->comment_type;117 $myrow['comment_author_url'] = $postc->comment_author_url; 118 $myrow['comment_author_IP'] = $postc->comment_author_IP; 119 $myrow['comment_date'] = $postc->comment_date; 120 $myrow['comment_content'] = $postc->comment_content; 121 $myrow['comment_karma'] = $postc->comment_karma; 122 $myrow['comment_approved'] = $postc->comment_approved; 123 $myrow['comment_type'] = $postc->comment_type; 121 124 } 122 125 return $myrow; 123 126 } 127 124 128 125 129 function get_lastcommentmodified($timezone = 'server') { … … 129 133 $now = current_time('mysql', 1); 130 134 if ( !isset($cache_lastcommentmodified[$timezone]) ) { 131 switch (strtolower($timezone)) {135 switch ( strtolower($timezone)) { 132 136 case 'gmt': 133 137 $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); … … 147 151 } 148 152 153 149 154 function sanitize_comment_cookies() { 150 155 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) { … … 169 174 } 170 175 } 176 171 177 172 178 function wp_allow_comment($commentdata) { … … 199 205 } 200 206 201 // The author and the admins get respect.202 207 if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') ) ) { 208 // The author and the admins get respect. 203 209 $approved = 1; 204 } 205 206 // Everyone else's comments will be checked. 207 else { 210 } else { 211 // Everyone else's comments will be checked. 208 212 if ( check_comment($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent, $comment_type) ) 209 213 $approved = 1; … … 218 222 } 219 223 224 220 225 function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { 221 226 global $wpdb; … … 224 229 225 230 if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) { 226 foreach ( $chars[1] as $char) {231 foreach ( (array) $chars[1] as $char ) { 227 232 // If it's an encoded char in the normal ASCII set, reject 228 233 if ( 38 == $char ) 229 234 continue; // Unless it's & 230 if ( $char < 128)235 if ( $char < 128 ) 231 236 return true; 232 237 } … … 234 239 235 240 $mod_keys = trim( get_option('blacklist_keys') ); 236 if ( '' == $mod_keys )241 if ( '' == $mod_keys ) 237 242 return false; // If moderation keys are empty 238 243 $words = explode("\n", $mod_keys ); 239 244 240 foreach ( $words as $word) {245 foreach ( (array) $words as $word ) { 241 246 $word = trim($word); 242 247 … … 249 254 250 255 $pattern = "#$word#i"; 251 if ( preg_match($pattern, $author ) ) return true; 252 if ( preg_match($pattern, $email ) ) return true; 253 if ( preg_match($pattern, $url ) ) return true; 254 if ( preg_match($pattern, $comment ) ) return true; 255 if ( preg_match($pattern, $user_ip ) ) return true; 256 if ( preg_match($pattern, $user_agent) ) return true; 257 } 258 256 if ( 257 preg_match($pattern, $author) 258 || preg_match($pattern, $email) 259 || preg_match($pattern, $url) 260 || preg_match($pattern, $comment) 261 || preg_match($pattern, $user_ip) 262 || preg_match($pattern, $user_agent) 263 ) 264 return true; 265 } 259 266 return false; 260 267 } 268 261 269 262 270 function wp_delete_comment($comment_id) { … … 277 285 } 278 286 287 279 288 function wp_get_comment_status($comment_id) { 280 289 global $wpdb; 281 290 282 291 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 283 if ($result == NULL) { 292 293 if ( $result == NULL ) 284 294 return 'deleted'; 285 } else if ($result == '1') {295 elseif ( $result == '1' ) 286 296 return 'approved'; 287 } else if ($result == '0') {297 elseif ( $result == '0' ) 288 298 return 'unapproved'; 289 } else if ($result == 'spam') {299 elseif ( $result == 'spam' ) 290 300 return 'spam'; 291 } else {301 else 292 302 return false; 293 }294 } 303 } 304 295 305 296 306 function wp_get_current_commenter() { … … 311 321 return compact('comment_author', 'comment_author_email', 'comment_author_url'); 312 322 } 323 313 324 314 325 function wp_insert_comment($commentdata) { … … 343 354 } 344 355 356 345 357 function wp_filter_comment($commentdata) { 346 358 $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']); … … 355 367 } 356 368 369 357 370 function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) { 358 371 if ( $block ) // a plugin has already blocked... we'll let that decision stand … … 363 376 } 364 377 378 365 379 function wp_new_comment( $commentdata ) { 366 380 $commentdata = apply_filters('preprocess_comment', $commentdata); … … 374 388 $commentdata['comment_date'] = current_time('mysql'); 375 389 $commentdata['comment_date_gmt'] = current_time('mysql', 1); 376 377 390 378 391 $commentdata = wp_filter_comment($commentdata); … … 397 410 } 398 411 412 399 413 function wp_set_comment_status($comment_id, $comment_status) { 400 global $wpdb;401 402 switch($comment_status) {414 global $wpdb; 415 416 switch ( $comment_status ) { 403 417 case 'hold': 404 418 $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; 405 break;419 break; 406 420 case 'approve': 407 421 $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 408 break;422 break; 409 423 case 'spam': 410 424 $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; 411 break;425 break; 412 426 case 'delete': 413 427 return wp_delete_comment($comment_id); 414 break;428 break; 415 429 default: 416 430 return false; 417 }418 419 if ($wpdb->query($query)) {431 } 432 433 if ( $wpdb->query($query) ) { 420 434 do_action('wp_set_comment_status', $comment_id, $comment_status); 421 435 422 436 $comment = get_comment($comment_id); 423 437 $comment_post_ID = $comment->comment_post_ID; 424 $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");425 if ( is_object( $c) )426 $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'");438 $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); 439 if ( is_object($c) ) 440 $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'"); 427 441 return true; 428 } else {442 } else { 429 443 return false; 430 } 431 } 444 } 445 } 446 432 447 433 448 function wp_update_comment($commentarr) { … … 438 453 439 454 // Escape data pulled from DB. 440 foreach ( $comment as $key => $value)455 foreach ( (array) $comment as $key => $value ) 441 456 $comment[$key] = $wpdb->escape($value); 442 457 … … 453 468 $result = $wpdb->query( 454 469 "UPDATE $wpdb->comments SET 455 comment_content = '$comment_content',456 comment_author = '$comment_author',470 comment_content = '$comment_content', 471 comment_author = '$comment_author', 457 472 comment_author_email = '$comment_author_email', 458 comment_approved = '$comment_approved',459 comment_author_url = '$comment_author_url',460 comment_date = '$comment_date'473 comment_approved = '$comment_approved', 474 comment_author_url = '$comment_author_url', 475 comment_date = '$comment_date' 461 476 WHERE comment_ID = $comment_ID" ); 462 477 463 478 $rval = $wpdb->rows_affected; 464 465 479 wp_update_comment_count($comment_post_ID); 466 467 480 do_action('edit_comment', $comment_ID); 468 469 481 return $rval; 470 482 } 483 471 484 472 485 function wp_update_comment_count($post_id) { … … 481 494 } 482 495 496 483 497 // 484 498 // Ping and trackback functions. … … 498 512 extract(parse_url($url)); 499 513 500 if (!isset($host)) { 501 // Not an URL. This should never happen. 514 if ( !isset($host) ) // Not an URL. This should never happen. 502 515 return false; 503 } 504 505 $path = (!isset($path)) ? '/' : $path; 506 $path .= (isset($query)) ? '?'.$query : ''; 507 $port = (isset($port)) ? $port : 80; 516 517 $path = ( !isset($path) ) ? '/' : $path; 518 $path .= ( isset($query) ) ? '?' . $query : ''; 519 $port = ( isset($port) ) ? $port : 80; 508 520 509 521 // Try to connect to the server at $host 510 522 $fp = @fsockopen($host, $port, $errno, $errstr, 2); 511 if (!$fp) { 512 // Couldn't open a connection to $host; 523 if ( !$fp ) // Couldn't open a connection to $host 513 524 return false; 514 }515 525 516 526 // Send the GET request 517 527 $request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: WordPress/$wp_version \r\n\r\n"; 518 //ob_end_flush();528 // ob_end_flush(); 519 529 fputs($fp, $request); 520 530 521 531 // Let's check for an X-Pingback header first 522 while ( !feof($fp)) {532 while ( !feof($fp) ) { 523 533 $line = fgets($fp, 512); 524 if ( trim($line) == '') {534 if ( trim($line) == '' ) 525 535 break; 526 }527 536 $headers .= trim($line)."\n"; 528 537 $x_pingback_header_offset = strpos(strtolower($headers), $x_pingback_str); 529 if ( $x_pingback_header_offset) {538 if ( $x_pingback_header_offset ) { 530 539 // We got it! 531 540 preg_match('#x-pingback: (.+)#is', $headers, $matches); … … 533 542 return $pingback_server_url; 534 543 } 535 if (strpos(strtolower($headers), 'content-type: ')) {544 if ( strpos(strtolower($headers), 'content-type: ') ) { 536 545 preg_match('#content-type: (.+)#is', $headers, $matches); 537 546 $content_type = trim($matches[1]); … … 539 548 } 540 549 541 if (preg_match('#(image|audio|video|model)/#is', $content_type)) { 542 // Not an (x)html, sgml, or xml page, no use going further 550 if ( preg_match('#(image|audio|video|model)/#is', $content_type) ) // Not an (x)html, sgml, or xml page, no use going further 543 551 return false; 544 } 545 546 while (!feof($fp)) { 552 553 while ( !feof($fp) ) { 547 554 $line = fgets($fp, 1024); 548 555 $contents .= trim($line); 549 556 $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote); 550 557 $pingback_link_offset_squote = strpos($contents, $pingback_str_squote); 551 if ( $pingback_link_offset_dquote || $pingback_link_offset_squote) {558 if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) { 552 559 $quote = ($pingback_link_offset_dquote) ? '"' : '\''; 553 560 $pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote; … … 558 565 $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len); 559 566 // We may find rel="pingback" but an incomplete pingback URL 560 if ($pingback_server_url_len > 0) { 561 // We got it! 567 if ( $pingback_server_url_len > 0 ) // We got it! 562 568 return $pingback_server_url; 563 }564 569 } 565 570 $byte_count += strlen($line); 566 if ( $byte_count > $timeout_bytes) {571 if ( $byte_count > $timeout_bytes ) { 567 572 // It's no use going further, there probably isn't any pingback 568 573 // server to find in this file. (Prevents loading large files.) … … 574 579 return false; 575 580 } 581 576 582 577 583 function do_all_pings() { … … 593 599 $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'"); 594 600 if ( is_array($trackbacks) ) { 595 foreach ( $trackbacks as $trackback ) {601 foreach ( $trackbacks as $trackback ) 596 602 do_trackbacks($trackback->ID); 597 }598 603 } 599 604 … … 613 618 } 614 619 615 if ( empty($post->post_excerpt))620 if ( empty($post->post_excerpt) ) 616 621 $excerpt = apply_filters('the_content', $post->post_content); 617 622 else … … 627 632 $post_title = strip_tags($post_title); 628 633 629 if ($to_ping) : foreach ($to_ping as $tb_ping) : 630 $tb_ping = trim($tb_ping); 631 if ( !in_array($tb_ping, $pinged) ) { 632 trackback($tb_ping, $post_title, $excerpt, $post_id); 633 $pinged[] = $tb_ping; 634 } else { 635 $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'"); 636 } 637 endforeach; endif; 638 } 634 if ( $to_ping ) { 635 foreach ( (array) $to_ping as $tb_ping ) { 636 $tb_ping = trim($tb_ping); 637 if ( !in_array($tb_ping, $pinged) ) { 638 trackback($tb_ping, $post_title, $excerpt, $post_id); 639 $pinged[] = $tb_ping; 640 } else { 641 $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'"); 642 } 643 } 644 } 645 } 646 639 647 640 648 function generic_ping($post_id = 0) { … … 644 652 if ( '' != $services ) { 645 653 $services = explode("\n", $services); 646 foreach ( $services as $service) {654 foreach ( (array) $services as $service ) 647 655 weblog_ping($service); 648 }649 656 } 650 657 651 658 return $post_id; 652 659 } 660 653 661 654 662 function pingback($content, $post_ID) { 655 663 global $wp_version, $wpdb; 656 include_once (ABSPATH . WPINC . '/class-IXR.php');664 include_once(ABSPATH . WPINC . '/class-IXR.php'); 657 665 658 666 // original code by Mort (http://mort.mine.nu:8080) 659 667 $log = debug_fopen(ABSPATH . '/pingback.log', 'a'); 660 668 $post_links = array(); 661 debug_fwrite($log, 'BEGIN ' .date('YmdHis', time())."\n");669 debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n"); 662 670 663 671 $pung = get_pung($post_ID); … … 688 696 // We don't wanna ping first and second types, even if they have a valid <link/> 689 697 690 foreach ($post_links_temp[0] as $link_test) :698 foreach ( $post_links_temp[0] as $link_test ) : 691 699 if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself 692 700 && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. 693 701 $test = parse_url($link_test); 694 if ( isset($test['query']))702 if ( isset($test['query']) ) 695 703 $post_links[] = $link_test; 696 elseif (($test['path'] != '/') && ($test['path'] != ''))704 elseif ( ($test['path'] != '/') && ($test['path'] != '') ) 697 705 $post_links[] = $link_test; 698 706 endif; 699 707 endforeach; 700 708 701 do_action_ref_array('pre_ping', array(&$post_links, &$pung));702 703 foreach ( $post_links as $pagelinkedto){709 do_action_ref_array('pre_ping', array(&$post_links, &$pung)); 710 711 foreach ( (array) $post_links as $pagelinkedto ) { 704 712 debug_fwrite($log, "Processing -- $pagelinkedto\n"); 705 713 $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); 706 714 707 if ( $pingback_server_url) {715 if ( $pingback_server_url ) { 708 716 @ set_time_limit( 60 ); 709 717 // Now, the RPC call … … 732 740 } 733 741 734 function privacy_ping_filter( $sites ) { 742 743 function privacy_ping_filter($sites) { 735 744 if ( '0' != get_option('blog_public') ) 736 745 return $sites; … … 781 790 } 782 791 792 783 793 function weblog_ping($server = '', $path = '') { 784 794 global $wp_version; 785 include_once (ABSPATH . WPINC . '/class-IXR.php');795 include_once(ABSPATH . WPINC . '/class-IXR.php'); 786 796 787 797 // using a timeout of 3 seconds should be enough to cover slow servers -
trunk/wp-includes/feed.php
r4454 r4626 6 6 } 7 7 8 8 9 function bloginfo_rss($show = '') { 9 10 echo get_bloginfo_rss($show); 10 11 } 12 11 13 12 14 function get_the_title_rss() { … … 17 19 } 18 20 21 19 22 function the_title_rss() { 20 23 echo get_the_title_rss(); 21 24 } 25 22 26 23 27 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { … … 43 47 $use_dotdotdot = 0; 44 48 } 45 for ( $i=0; $i<$k; $i++ ) {49 for ( $i=0; $i<$k; $i++ ) 46 50 $excerpt .= $blah[$i].' '; 47 }48 51 $excerpt .= ($use_dotdotdot) ? '...' : ''; 49 52 $content = $excerpt; … … 53 56 } 54 57 58 55 59 function the_excerpt_rss() { 56 60 $output = get_the_excerpt(true); … … 58 62 } 59 63 64 60 65 function permalink_single_rss($file = '') { 61 66 echo get_permalink(); 62 67 } 68 63 69 64 70 function comment_link() { … … 66 72 } 67 73 74 68 75 function get_comment_author_rss() { 69 76 return apply_filters('comment_author_rss', get_comment_author() ); 70 77 } 78 79 71 80 function comment_author_rss() { 72 81 echo get_comment_author_rss(); 73 82 } 83 74 84 75 85 function comment_text_rss() { … … 79 89 } 80 90 91 81 92 function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '') { 82 93 $url = comments_rss($commentsrssfilename); 83 94 echo "<a href='$url'>$link_text</a>"; 84 95 } 96 85 97 86 98 function comments_rss($commentsrssfilename = '') { … … 94 106 return apply_filters('post_comments_feed_link', $url); 95 107 } 108 96 109 97 110 function get_author_rss_link($echo = false, $author_id, $author_nicename) { … … 113 126 } 114 127 128 115 129 function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { 116 130 $permalink_structure = get_option('permalink_structure'); … … 130 144 } 131 145 146 132 147 function get_the_category_rss($type = 'rss') { 133 148 $categories = get_the_category(); … … 143 158 } 144 159 160 145 161 function the_category_rss($type = 'rss') { 146 162 echo get_the_category_rss($type); 147 163 } 164 148 165 149 166 function rss_enclosure() { -
trunk/wp-includes/plugin.php
r4424 r4626 10 10 // check that we don't already have the same filter at the same priority 11 11 if ( isset($wp_filter[$tag]["$priority"]) ) { 12 foreach ($wp_filter[$tag]["$priority"] as $filter) {12 foreach ( $wp_filter[$tag]["$priority"] as $filter ) { 13 13 // uncomment if we want to match function AND accepted_args 14 14 // if ( $filter == array($function, $accepted_args) ) { … … 136 136 foreach ( (array) $wp_filter[$tag] as $priority => $functions ) { 137 137 if ( !is_null($functions) ) { 138 foreach ( (array) $functions as $function ) {138 foreach ( (array) $functions as $function ) { 139 139 $function_name = $function['function']; 140 140 $accepted_args = $function['accepted_args']; -
trunk/wp-includes/registration.php
r4495 r4626 11 11 } 12 12 13 13 14 function email_exists( $email ) { 14 15 global $wpdb; … … 16 17 return $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '$email'"); 17 18 } 19 18 20 19 21 function validate_username( $username ) { … … 26 28 return apply_filters('validate_username', $valid, $username); 27 29 } 30 28 31 29 32 function wp_insert_user($userdata) { … … 124 127 } 125 128 129 126 130 function wp_update_user($userdata) { 127 131 global $wpdb; … … 147 151 // Update the cookies if the password changed. 148 152 $current_user = wp_get_current_user(); 149 if ( $current_user->id == $ID ) {153 if ( $current_user->id == $ID ) { 150 154 if ( isset($plaintext_pass) ) { 151 155 wp_clearcookie(); … … 157 161 } 158 162 159 function wp_create_user( $username, $password, $email = '') { 163 164 function wp_create_user($username, $password, $email = '') { 160 165 global $wpdb; 161 166 162 $user_login = $wpdb->escape( $username);163 $user_email = $wpdb->escape( $email);167 $user_login = $wpdb->escape($username); 168 $user_email = $wpdb->escape($email); 164 169 $user_pass = $password; 165 170 … … 169 174 170 175 171 function create_user( $username, $password, $email) {172 return wp_create_user( $username, $password, $email);176 function create_user($username, $password, $email) { 177 return wp_create_user($username, $password, $email); 173 178 } 174 179 175 176 180 ?> -
trunk/wp-includes/vars.php
r4380 r4626 2 2 3 3 // On which page are we ? 4 if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches)) {4 if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches) ) { 5 5 $pagenow = $self_matches[1]; 6 } else if (strstr($PHP_SELF, '?')) {6 } elseif ( strpos($PHP_SELF, '?') !== false ) { 7 7 $pagenow = explode('/', $PHP_SELF); 8 8 $pagenow = trim($pagenow[(sizeof($pagenow)-1)]); … … 14 14 15 15 // Simple browser detection 16 // We should probably be doing true/false instead of 1/0 here ~ Mark 16 17 $is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0; 17 18 18 if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT'])) {19 if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT']) ) 19 20 $is_lynx = 1; 20 } elseif (preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT'])) { 21 elseif ( preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT']) ) 21 22 $is_gecko = 1; 22 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']))) { 23 elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']) ) 23 24 $is_winIE = 1; 24 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']))) { 25 elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']) ) 25 26 $is_macIE = 1; 26 } elseif (preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT'])) { 27 elseif ( preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) ) 27 28 $is_opera = 1; 28 } elseif ((preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) ) || (preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']))) { 29 elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']) ) 29 30 $is_NS4 = 1; 30 } 31 $is_IE = (($is_macIE) || ($is_winIE));31 32 $is_IE = ( $is_macIE || $is_winIE ); 32 33 33 34 // Server detection … … 38 39 if (!isset($wpsmiliestrans)) { 39 40 $wpsmiliestrans = array( 40 ':mrgreen:' => 'icon_mrgreen.gif',41 ':neutral:' => 'icon_neutral.gif',42 ':twisted:' => 'icon_twisted.gif',43 ':arrow:'=> 'icon_arrow.gif',44 ':shock:'=> 'icon_eek.gif',45 ':smile:'=> 'icon_smile.gif',46 ':???:'=> 'icon_confused.gif',47 ':cool:'=> 'icon_cool.gif',48 ':evil:'=> 'icon_evil.gif',49 ':grin:'=> 'icon_biggrin.gif',50 ':idea:'=> 'icon_idea.gif',51 ':oops:'=> 'icon_redface.gif',52 ':razz:'=> 'icon_razz.gif',53 ':roll:'=> 'icon_rolleyes.gif',54 ':wink:'=> 'icon_wink.gif',55 ':cry:'=> 'icon_cry.gif',56 ':eek:'=> 'icon_surprised.gif',57 ':lol:'=> 'icon_lol.gif',58 ':mad:'=> 'icon_mad.gif',59 ':sad:'=> 'icon_sad.gif',60 '8-)'=> 'icon_cool.gif',61 '8-O'=> 'icon_eek.gif',62 ':-('=> 'icon_sad.gif',63 ':-)'=> 'icon_smile.gif',64 ':-?'=> 'icon_confused.gif',65 ':-D'=> 'icon_biggrin.gif',66 ':-P'=> 'icon_razz.gif',67 ':-o'=> 'icon_surprised.gif',68 ':-x'=> 'icon_mad.gif',69 ':-|'=> 'icon_neutral.gif',70 ';-)'=> 'icon_wink.gif',71 '8)'=> 'icon_cool.gif',72 '8O'=> 'icon_eek.gif',73 ':('=> 'icon_sad.gif',74 ':)'=> 'icon_smile.gif',75 ':?'=> 'icon_confused.gif',76 ':D'=> 'icon_biggrin.gif',77 ':P'=> 'icon_razz.gif',78 ':o'=> 'icon_surprised.gif',79 ':x'=> 'icon_mad.gif',80 ':|'=> 'icon_neutral.gif',81 ';)'=> 'icon_wink.gif',82 ':!:'=> 'icon_exclaim.gif',83 ':?:'=> 'icon_question.gif',41 ':mrgreen:' => 'icon_mrgreen.gif', 42 ':neutral:' => 'icon_neutral.gif', 43 ':twisted:' => 'icon_twisted.gif', 44 ':arrow:' => 'icon_arrow.gif', 45 ':shock:' => 'icon_eek.gif', 46 ':smile:' => 'icon_smile.gif', 47 ':???:' => 'icon_confused.gif', 48 ':cool:' => 'icon_cool.gif', 49 ':evil:' => 'icon_evil.gif', 50 ':grin:' => 'icon_biggrin.gif', 51 ':idea:' => 'icon_idea.gif', 52 ':oops:' => 'icon_redface.gif', 53 ':razz:' => 'icon_razz.gif', 54 ':roll:' => 'icon_rolleyes.gif', 55 ':wink:' => 'icon_wink.gif', 56 ':cry:' => 'icon_cry.gif', 57 ':eek:' => 'icon_surprised.gif', 58 ':lol:' => 'icon_lol.gif', 59 ':mad:' => 'icon_mad.gif', 60 ':sad:' => 'icon_sad.gif', 61 '8-)' => 'icon_cool.gif', 62 '8-O' => 'icon_eek.gif', 63 ':-(' => 'icon_sad.gif', 64 ':-)' => 'icon_smile.gif', 65 ':-?' => 'icon_confused.gif', 66 ':-D' => 'icon_biggrin.gif', 67 ':-P' => 'icon_razz.gif', 68 ':-o' => 'icon_surprised.gif', 69 ':-x' => 'icon_mad.gif', 70 ':-|' => 'icon_neutral.gif', 71 ';-)' => 'icon_wink.gif', 72 '8)' => 'icon_cool.gif', 73 '8O' => 'icon_eek.gif', 74 ':(' => 'icon_sad.gif', 75 ':)' => 'icon_smile.gif', 76 ':?' => 'icon_confused.gif', 77 ':D' => 'icon_biggrin.gif', 78 ':P' => 'icon_razz.gif', 79 ':o' => 'icon_surprised.gif', 80 ':x' => 'icon_mad.gif', 81 ':|' => 'icon_neutral.gif', 82 ';)' => 'icon_wink.gif', 83 ':!:' => 'icon_exclaim.gif', 84 ':?:' => 'icon_question.gif', 84 85 ); 85 86 } 86 87 87 88 88 // generates smilies' search & replace arrays 89 foreach ($wpsmiliestrans as $smiley => $img) {89 foreach ( (array) $wpsmiliestrans as $smiley => $img ) { 90 90 $wp_smiliessearch[] = '/(\s|^)'.preg_quote($smiley, '/').'(\s|$)/'; 91 $smiley_masked = htmlspecialchars( trim($smiley), ENT_QUOTES);91 $smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES); 92 92 $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> "; 93 93 }
Note: See TracChangeset
for help on using the changeset viewer.