Ticket #2405: fix_trailing_tabs_2006-02-12_07.51.00_GMT.diff
File fix_trailing_tabs_2006-02-12_07.51.00_GMT.diff, 196.6 KB (added by , 19 years ago) |
---|
-
wp-login.php
28 28 $redirect_to = 'wp-login.php'; 29 29 if ( isset($_REQUEST['redirect_to']) ) 30 30 $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']); 31 31 32 32 wp_redirect($redirect_to); 33 33 exit(); 34 34 … … 139 139 $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7); 140 140 $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'"); 141 141 wp_cache_delete($user->ID, 'users'); 142 wp_cache_delete($user->user_login, 'userlogins'); 142 wp_cache_delete($user->user_login, 'userlogins'); 143 143 $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; 144 144 $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; 145 145 $message .= get_settings('siteurl') . "/wp-login.php\r\n"; … … 190 190 191 191 if ( $user_login && $user_pass ) { 192 192 $user = new WP_User(0, $user_login); 193 193 194 194 // If the user can't edit posts, send them to their profile. 195 195 if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) ) 196 196 $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; 197 197 198 198 if ( wp_login($user_login, $user_pass, $using_cookie) ) { 199 199 if ( !$using_cookie ) 200 200 wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); … … 202 202 wp_redirect($redirect_to); 203 203 exit; 204 204 } else { 205 if ( $using_cookie ) 205 if ( $using_cookie ) 206 206 $error = __('Your session has expired.'); 207 207 } 208 208 } -
wp-includes/class-snoopy.php
39 39 class Snoopy 40 40 { 41 41 /**** Public variables ****/ 42 42 43 43 /* user definable vars */ 44 44 45 45 var $host = "www.php.net"; // host name we are connecting to … … 48 48 var $proxy_port = ""; // proxy port to use 49 49 var $proxy_user = ""; // proxy user to use 50 50 var $proxy_pass = ""; // proxy password to use 51 51 52 52 var $agent = "Snoopy v1.2.3"; // agent we masquerade as 53 53 var $referer = ""; // referer info to pass 54 54 var $cookies = array(); // array of cookies to pass … … 66 66 var $passcookies = true; // pass set cookies back through redirects 67 67 // NOTE: this currently does not respect 68 68 // dates, domains or paths. 69 69 70 70 var $user = ""; // user for http authentication 71 71 var $pass = ""; // password for http authentication 72 72 73 73 // http accept types 74 74 var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; 75 75 76 76 var $results = ""; // where the content is put 77 77 78 78 var $error = ""; // error messages sent here 79 79 var $response_code = ""; // response code returned from server 80 80 var $headers = array(); // headers returned from server sent here … … 100 100 // library functions built into php, 101 101 // as these functions are not stable 102 102 // as of this Snoopy release. 103 104 /**** Private variables ****/ 105 103 104 /**** Private variables ****/ 105 106 106 var $_maxlinelen = 4096; // max line length (headers) 107 107 108 108 var $_httpmethod = "GET"; // default http request method 109 109 var $_httpversion = "HTTP/1.0"; // default http request version 110 110 var $_submit_method = "POST"; // default submit method … … 114 114 var $_redirectdepth = 0; // increments on an http redirect 115 115 var $_frameurls = array(); // frame src urls 116 116 var $_framedepth = 0; // increments on frame depth 117 117 118 118 var $_isproxy = false; // set if using a proxy server 119 119 var $_fp_timeout = 30; // timeout for socket connection 120 120 … … 129 129 130 130 function fetch($URI) 131 131 { 132 132 133 133 //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); 134 134 $URI_PARTS = parse_url($URI); 135 135 if (!empty($URI_PARTS["user"])) … … 140 140 $URI_PARTS["query"] = ''; 141 141 if (empty($URI_PARTS["path"])) 142 142 $URI_PARTS["path"] = ''; 143 143 144 144 switch(strtolower($URI_PARTS["scheme"])) 145 145 { 146 146 case "http": … … 160 160 // no proxy, send only the path 161 161 $this->_httprequest($path, $fp, $URI, $this->_httpmethod); 162 162 } 163 163 164 164 $this->_disconnect($fp); 165 165 166 166 if($this->_redirectaddr) … … 183 183 { 184 184 $frameurls = $this->_frameurls; 185 185 $this->_frameurls = array(); 186 186 187 187 while(list(,$frameurl) = each($frameurls)) 188 188 { 189 189 if($this->_framedepth < $this->maxframes) … … 194 194 else 195 195 break; 196 196 } 197 } 197 } 198 198 } 199 199 else 200 200 { 201 201 return false; 202 202 } 203 return true; 203 return true; 204 204 break; 205 205 case "https": 206 206 if(!$this->curl_path) … … 254 254 else 255 255 break; 256 256 } 257 } 258 return true; 257 } 258 return true; 259 259 break; 260 260 default: 261 261 // not a valid protocol 262 262 $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; 263 263 return false; 264 264 break; 265 } 265 } 266 266 return true; 267 267 } 268 268 … … 280 280 function submit($URI, $formvars="", $formfiles="") 281 281 { 282 282 unset($postdata); 283 283 284 284 $postdata = $this->_prepare_post_body($formvars, $formfiles); 285 285 286 286 $URI_PARTS = parse_url($URI); 287 287 if (!empty($URI_PARTS["user"])) 288 288 $this->user = $URI_PARTS["user"]; … … 312 312 // no proxy, send only the path 313 313 $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); 314 314 } 315 315 316 316 $this->_disconnect($fp); 317 317 318 318 if($this->_redirectaddr) 319 319 { 320 320 /* url was redirected, check if we've hit the max depth */ 321 321 if($this->maxredirs > $this->_redirectdepth) 322 { 322 { 323 323 if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 324 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 325 324 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 325 326 326 // only follow redirect if it's on this site, or offsiteok is true 327 327 if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) 328 328 { … … 341 341 { 342 342 $frameurls = $this->_frameurls; 343 343 $this->_frameurls = array(); 344 344 345 345 while(list(,$frameurl) = each($frameurls)) 346 { 346 { 347 347 if($this->_framedepth < $this->maxframes) 348 348 { 349 349 $this->fetch($frameurl); … … 352 352 else 353 353 break; 354 354 } 355 } 356 355 } 356 357 357 } 358 358 else 359 359 { 360 360 return false; 361 361 } 362 return true; 362 return true; 363 363 break; 364 364 case "https": 365 365 if(!$this->curl_path) … … 386 386 { 387 387 /* url was redirected, check if we've hit the max depth */ 388 388 if($this->maxredirs > $this->_redirectdepth) 389 { 389 { 390 390 if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) 391 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 391 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); 392 392 393 393 // only follow redirect if it's on this site, or offsiteok is true 394 394 if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) … … 410 410 $this->_frameurls = array(); 411 411 412 412 while(list(,$frameurl) = each($frameurls)) 413 { 413 { 414 414 if($this->_framedepth < $this->maxframes) 415 415 { 416 416 $this->fetch($frameurl); … … 419 419 else 420 420 break; 421 421 } 422 } 423 return true; 422 } 423 return true; 424 424 break; 425 425 426 426 default: 427 427 // not a valid protocol 428 428 $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; 429 429 return false; 430 430 break; 431 } 431 } 432 432 return true; 433 433 } 434 434 … … 442 442 function fetchlinks($URI) 443 443 { 444 444 if ($this->fetch($URI)) 445 { 445 { 446 446 if($this->lastredirectaddr) 447 447 $URI = $this->lastredirectaddr; 448 448 if(is_array($this->results)) … … 470 470 471 471 function fetchform($URI) 472 472 { 473 473 474 474 if ($this->fetch($URI)) 475 { 475 { 476 476 477 477 if(is_array($this->results)) 478 478 { … … 481 481 } 482 482 else 483 483 $this->results = $this->_stripform($this->results); 484 484 485 485 return true; 486 486 } 487 487 else 488 488 return false; 489 489 } 490 491 490 491 492 492 /*======================================================================*\ 493 493 Function: fetchtext 494 494 Purpose: fetch the text from a web page, stripping the links … … 499 499 function fetchtext($URI) 500 500 { 501 501 if($this->fetch($URI)) 502 { 502 { 503 503 if(is_array($this->results)) 504 504 { 505 505 for($x=0;$x<count($this->results);$x++) … … 523 523 function submitlinks($URI, $formvars="", $formfiles="") 524 524 { 525 525 if($this->submit($URI,$formvars, $formfiles)) 526 { 526 { 527 527 if($this->lastredirectaddr) 528 528 $URI = $this->lastredirectaddr; 529 529 if(is_array($this->results)) … … 557 557 function submittext($URI, $formvars = "", $formfiles = "") 558 558 { 559 559 if($this->submit($URI,$formvars, $formfiles)) 560 { 560 { 561 561 if($this->lastredirectaddr) 562 562 $URI = $this->lastredirectaddr; 563 563 if(is_array($this->results)) … … 581 581 return false; 582 582 } 583 583 584 585 584 585 586 586 /*======================================================================*\ 587 587 Function: set_submit_multipart 588 588 Purpose: Set the form submission content type to … … 593 593 $this->_submit_type = "multipart/form-data"; 594 594 } 595 595 596 596 597 597 /*======================================================================*\ 598 598 Function: set_submit_normal 599 599 Purpose: Set the form submission content type to … … 604 604 $this->_submit_type = "application/x-www-form-urlencoded"; 605 605 } 606 606 607 608 609 607 608 609 610 610 /*======================================================================*\ 611 611 Private functions 612 612 \*======================================================================*/ 613 614 613 614 615 615 /*======================================================================*\ 616 616 Function: _striplinks 617 617 Purpose: strip the hyperlinks from an html document … … 620 620 \*======================================================================*/ 621 621 622 622 function _striplinks($document) 623 { 623 { 624 624 preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href= 625 625 ([\"\'])? # find single or double quote 626 626 (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching 627 627 # quote, otherwise match up to next space 628 628 'isx",$document,$links); 629 630 629 630 631 631 // catenate the non-empty matches from the conditional subpattern 632 632 633 633 while(list($key,$val) = each($links[2])) 634 634 { 635 635 if(!empty($val)) 636 636 $match[] = $val; 637 } 638 637 } 638 639 639 while(list($key,$val) = each($links[3])) 640 640 { 641 641 if(!empty($val)) 642 642 $match[] = $val; 643 } 644 643 } 644 645 645 // return the links 646 646 return $match; 647 647 } … … 654 654 \*======================================================================*/ 655 655 656 656 function _stripform($document) 657 { 657 { 658 658 preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); 659 659 660 660 // catenate the matches 661 661 $match = implode("\r\n",$elements[0]); 662 662 663 663 // return the links 664 664 return $match; 665 665 } 666 666 667 668 667 668 669 669 /*======================================================================*\ 670 670 Function: _striptext 671 671 Purpose: strip the text from an html document … … 675 675 676 676 function _striptext($document) 677 677 { 678 678 679 679 // I didn't use preg eval (//e) since that is only available in PHP 4.0. 680 680 // so, list your entities one by one here. I included some of the 681 681 // more common ones. 682 682 683 683 $search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript 684 684 "'<[\/\!]*?[^<>]*?>'si", // strip out html tags 685 685 "'([\r\n])[\s]+'", // strip out white space … … 728 728 "Ü", 729 729 "ß", 730 730 ); 731 731 732 732 $text = preg_replace($search,$replace,$document); 733 733 734 734 return $text; 735 735 } 736 736 … … 744 744 745 745 function _expandlinks($links,$URI) 746 746 { 747 747 748 748 preg_match("/^[^\?]+/",$URI,$match); 749 749 750 750 $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); … … 752 752 $match_part = parse_url($match); 753 753 $match_root = 754 754 $match_part["scheme"]."://".$match_part["host"]; 755 755 756 756 $search = array( "|^http://".preg_quote($this->host)."|i", 757 757 "|^(\/)|i", 758 758 "|^(?!http://)(?!mailto:)|i", 759 759 "|/\./|", 760 760 "|/[^\/]+/\.\./|" 761 761 ); 762 762 763 763 $replace = array( "", 764 764 $match_root."/", 765 765 $match."/", 766 766 "/", 767 767 "/" 768 ); 769 768 ); 769 770 770 $expandedLinks = preg_replace($search,$replace,$links); 771 771 772 772 return $expandedLinks; … … 779 779 $fp the current open file pointer 780 780 $URI the full URI 781 781 $body body contents to send if any (POST) 782 Output: 782 Output: 783 783 \*======================================================================*/ 784 784 785 785 function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") 786 786 { 787 787 $cookie_headers = ''; 788 788 if($this->passcookies && $this->_redirectaddr) 789 789 $this->setcookies(); 790 790 791 791 $URI_PARTS = parse_url($URI); 792 792 if(empty($url)) 793 793 $url = "/"; 794 $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; 794 $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; 795 795 if(!empty($this->agent)) 796 796 $headers .= "User-Agent: ".$this->agent."\r\n"; 797 797 if(!empty($this->host) && !isset($this->rawheaders['Host'])) { … … 805 805 if(!empty($this->referer)) 806 806 $headers .= "Referer: ".$this->referer."\r\n"; 807 807 if(!empty($this->cookies)) 808 { 808 { 809 809 if(!is_array($this->cookies)) 810 810 $this->cookies = (array)$this->cookies; 811 811 812 812 reset($this->cookies); 813 813 if ( count($this->cookies) > 0 ) { 814 814 $cookie_headers .= 'Cookie: '; … … 831 831 $headers .= "; boundary=".$this->_mime_boundary; 832 832 $headers .= "\r\n"; 833 833 } 834 if(!empty($body)) 834 if(!empty($body)) 835 835 $headers .= "Content-length: ".strlen($body)."\r\n"; 836 if(!empty($this->user) || !empty($this->pass)) 836 if(!empty($this->user) || !empty($this->pass)) 837 837 $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; 838 838 839 839 //add proxy auth headers 840 if(!empty($this->proxy_user)) 840 if(!empty($this->proxy_user)) 841 841 $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; 842 842 843 843 844 844 $headers .= "\r\n"; 845 845 846 846 // set the read timeout if needed 847 847 if ($this->read_timeout > 0) 848 848 socket_set_timeout($fp, $this->read_timeout); 849 849 $this->timed_out = false; 850 850 851 851 fwrite($fp,$headers.$body,strlen($headers.$body)); 852 852 853 853 $this->_redirectaddr = false; 854 854 unset($this->headers); 855 855 856 856 while($currentHeader = fgets($fp,$this->_maxlinelen)) 857 857 { 858 858 if ($this->read_timeout > 0 && $this->_check_timeout($fp)) … … 860 860 $this->status=-100; 861 861 return false; 862 862 } 863 863 864 864 if($currentHeader == "\r\n") 865 865 break; 866 866 867 867 // if a header begins with Location: or URI:, set the redirect 868 868 if(preg_match("/^(Location:|URI:)/i",$currentHeader)) 869 869 { … … 883 883 else 884 884 $this->_redirectaddr = $matches[2]; 885 885 } 886 886 887 887 if(preg_match("|^HTTP/|",$currentHeader)) 888 888 { 889 889 if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) 890 890 { 891 891 $this->status= $status[1]; 892 } 892 } 893 893 $this->response_code = $currentHeader; 894 894 } 895 895 896 896 $this->headers[] = $currentHeader; 897 897 } 898 898 … … 910 910 $this->status=-100; 911 911 return false; 912 912 } 913 913 914 914 // check if there is a a redirect meta tag 915 915 916 916 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 917 917 918 918 { 919 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 919 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 920 920 } 921 921 922 922 // have we hit our frame depth and is there frame src to fetch? … … 932 932 // no framed content 933 933 else 934 934 $this->results = $results; 935 935 936 936 return true; 937 937 } 938 938 … … 942 942 Input: $url the url to fetch 943 943 $URI the full URI 944 944 $body body contents to send if any (POST) 945 Output: 945 Output: 946 946 \*======================================================================*/ 947 947 948 948 function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") 949 949 { 950 950 if($this->passcookies && $this->_redirectaddr) 951 951 $this->setcookies(); 952 952 953 $headers = array(); 954 953 $headers = array(); 954 955 955 $URI_PARTS = parse_url($URI); 956 956 if(empty($url)) 957 957 $url = "/"; 958 958 // GET ... header not needed for curl 959 //$headers[] = $http_method." ".$url." ".$this->_httpversion; 959 //$headers[] = $http_method." ".$url." ".$this->_httpversion; 960 960 if(!empty($this->agent)) 961 961 $headers[] = "User-Agent: ".$this->agent; 962 962 if(!empty($this->host)) … … 969 969 if(!empty($this->referer)) 970 970 $headers[] = "Referer: ".$this->referer; 971 971 if(!empty($this->cookies)) 972 { 972 { 973 973 if(!is_array($this->cookies)) 974 974 $this->cookies = (array)$this->cookies; 975 975 976 976 reset($this->cookies); 977 977 if ( count($this->cookies) > 0 ) { 978 978 $cookie_str = 'Cookie: '; … … 995 995 else 996 996 $headers[] = "Content-type: $content_type"; 997 997 } 998 if(!empty($body)) 998 if(!empty($body)) 999 999 $headers[] = "Content-length: ".strlen($body); 1000 if(!empty($this->user) || !empty($this->pass)) 1000 if(!empty($this->user) || !empty($this->pass)) 1001 1001 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); 1002 1002 1003 1003 for($curr_header = 0; $curr_header < count($headers); $curr_header++) { 1004 1004 $safer_header = strtr( $headers[$curr_header], "\"", " " ); 1005 1005 $cmdline_params .= " -H \"".$safer_header."\""; 1006 1006 } 1007 1007 1008 1008 if(!empty($body)) 1009 1009 $cmdline_params .= " -d \"$body\""; 1010 1010 1011 1011 if($this->read_timeout > 0) 1012 1012 $cmdline_params .= " -m ".$this->read_timeout; 1013 1013 1014 1014 $headerfile = tempnam($temp_dir, "sno"); 1015 1015 1016 1016 $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access 1017 1017 exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return); 1018 1018 1019 1019 if($return) 1020 1020 { 1021 1021 $this->error = "Error: cURL could not retrieve the document, error $return."; 1022 1022 return false; 1023 1023 } 1024 1025 1024 1025 1026 1026 $results = implode("\r\n",$results); 1027 1027 1028 1028 $result_headers = file("$headerfile"); 1029 1029 1030 1030 $this->_redirectaddr = false; 1031 1031 unset($this->headers); 1032 1032 1033 1033 for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) 1034 1034 { 1035 1035 1036 1036 // if a header begins with Location: or URI:, set the redirect 1037 1037 if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) 1038 1038 { … … 1052 1052 else 1053 1053 $this->_redirectaddr = $matches[2]; 1054 1054 } 1055 1055 1056 1056 if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) 1057 1057 $this->response_code = $result_headers[$currentHeader]; 1058 1058 … … 1060 1060 } 1061 1061 1062 1062 // check if there is a a redirect meta tag 1063 1063 1064 1064 if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) 1065 1065 { 1066 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 1066 $this->_redirectaddr = $this->_expandlinks($match[1],$URI); 1067 1067 } 1068 1068 1069 1069 // have we hit our frame depth and is there frame src to fetch? … … 1081 1081 $this->results = $results; 1082 1082 1083 1083 unlink("$headerfile"); 1084 1084 1085 1085 return true; 1086 1086 } 1087 1087 … … 1089 1089 Function: setcookies() 1090 1090 Purpose: set cookies for a redirection 1091 1091 \*======================================================================*/ 1092 1092 1093 1093 function setcookies() 1094 1094 { 1095 1095 for($x=0; $x<count($this->headers); $x++) … … 1099 1099 } 1100 1100 } 1101 1101 1102 1102 1103 1103 /*======================================================================*\ 1104 1104 Function: _check_timeout 1105 1105 Purpose: checks whether timeout has occurred … … 1123 1123 Purpose: make a socket connection 1124 1124 Input: $fp file pointer 1125 1125 \*======================================================================*/ 1126 1126 1127 1127 function _connect(&$fp) 1128 1128 { 1129 1129 if(!empty($this->proxy_host) && !empty($this->proxy_port)) 1130 1130 { 1131 1131 $this->_isproxy = true; 1132 1132 1133 1133 $host = $this->proxy_host; 1134 1134 $port = $this->proxy_port; 1135 1135 } … … 1138 1138 $host = $this->host; 1139 1139 $port = $this->port; 1140 1140 } 1141 1141 1142 1142 $this->status = 0; 1143 1143 1144 1144 if($fp = fsockopen( 1145 1145 $host, 1146 1146 $port, … … 1176 1176 Purpose: disconnect a socket connection 1177 1177 Input: $fp file pointer 1178 1178 \*======================================================================*/ 1179 1179 1180 1180 function _disconnect($fp) 1181 1181 { 1182 1182 return(fclose($fp)); 1183 1183 } 1184 1184 1185 1185 1186 1186 /*======================================================================*\ 1187 1187 Function: _prepare_post_body 1188 1188 Purpose: Prepare post body according to encoding type … … 1190 1190 $formfiles - form upload files 1191 1191 Output: post body 1192 1192 \*======================================================================*/ 1193 1193 1194 1194 function _prepare_post_body($formvars, $formfiles) 1195 1195 { 1196 1196 settype($formvars, "array"); … … 1199 1199 1200 1200 if (count($formvars) == 0 && count($formfiles) == 0) 1201 1201 return; 1202 1202 1203 1203 switch ($this->_submit_type) { 1204 1204 case "application/x-www-form-urlencoded": 1205 1205 reset($formvars); … … 1215 1215 1216 1216 case "multipart/form-data": 1217 1217 $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); 1218 1218 1219 1219 reset($formvars); 1220 1220 while(list($key,$val) = each($formvars)) { 1221 1221 if (is_array($val) || is_object($val)) { … … 1230 1230 $postdata .= "$val\r\n"; 1231 1231 } 1232 1232 } 1233 1233 1234 1234 reset($formfiles); 1235 1235 while (list($field_name, $file_names) = each($formfiles)) { 1236 1236 settype($file_names, "array"); -
wp-includes/wp-l10n.php
14 14 // WPLANG is defined in wp-config. 15 15 if (defined('WPLANG')) 16 16 $locale = WPLANG; 17 17 18 18 if (empty($locale)) 19 19 $locale = 'en_US'; 20 20 … … 76 76 77 77 $locale = get_locale(); 78 78 $mofile = ABSPATH . "wp-includes/languages/$locale.mo"; 79 79 80 80 load_textdomain('default', $mofile); 81 81 } 82 82 83 83 function load_plugin_textdomain($domain, $path = 'wp-content/plugins') { 84 84 $locale = get_locale(); 85 85 86 86 $mofile = ABSPATH . "$path/$domain-$locale.mo"; 87 87 load_textdomain($domain, $mofile); 88 88 } 89 89 90 90 function load_theme_textdomain($domain) { 91 91 $locale = get_locale(); 92 92 93 93 $mofile = get_template_directory() . "/$locale.mo"; 94 94 load_textdomain($domain, $mofile); 95 95 } -
wp-includes/cache.php
103 103 104 104 if ( ! $this->acquire_lock() ) 105 105 return false; 106 106 107 107 $this->rm_cache_dir(); 108 108 $this->cache = array (); 109 109 $this->dirty_objects = array (); 110 110 $this->non_existant_objects = array (); 111 111 112 112 $this->release_lock(); 113 113 114 114 return true; … … 248 248 while (($file = @ readdir($dh)) !== false) { 249 249 if ($file == '.' or $file == '..') 250 250 continue; 251 251 252 252 if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file)) 253 253 $stack[] = $dir . DIRECTORY_SEPARATOR . $file; 254 254 else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file)) … … 354 354 if (@ copy($temp_file, $cache_file)) 355 355 @ unlink($temp_file); 356 356 else 357 $errors++; 357 $errors++; 358 358 } 359 359 @ chmod($cache_file, $file_perms); 360 360 } … … 363 363 $this->dirty_objects = array(); 364 364 365 365 $this->release_lock(); 366 366 367 367 if ( $errors ) 368 368 return false; 369 369 -
wp-includes/template-functions-post.php
211 211 // Force subkeys to be array type: 212 212 if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) ) 213 213 $post_meta_cache[$mpid] = array(); 214 214 215 215 if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) ) 216 216 $post_meta_cache[$mpid]["$mkey"] = array(); 217 217 -
wp-includes/wp-db.php
16 16 class wpdb { 17 17 18 18 var $show_errors = true; 19 var $num_queries = 0; 19 var $num_queries = 0; 20 20 var $last_query; 21 21 var $col_info; 22 22 var $queries; … … 75 75 76 76 // ==================================================================== 77 77 // Format a string correctly for safe insert under all PHP conditions 78 78 79 79 function escape($string) { 80 80 return addslashes( $string ); // Disable rest for now, causing problems 81 81 if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) … … 101 101 <code>$this->last_query</code></p> 102 102 </div>"; 103 103 } else { 104 return false; 104 return false; 105 105 } 106 106 } 107 107 … … 111 111 function show_errors() { 112 112 $this->show_errors = true; 113 113 } 114 114 115 115 function hide_errors() { 116 116 $this->show_errors = false; 117 117 } … … 142 142 // Perform the query via std mysql_query function.. 143 143 if (SAVEQUERIES) 144 144 $this->timer_start(); 145 145 146 146 $this->result = @mysql_query($query, $this->dbh); 147 147 ++$this->num_queries; 148 148 … … 159 159 $this->rows_affected = mysql_affected_rows(); 160 160 // Take note of the insert_id 161 161 if ( preg_match("/^\\s*(insert|replace) /i",$query) ) { 162 $this->insert_id = mysql_insert_id($this->dbh); 162 $this->insert_id = mysql_insert_id($this->dbh); 163 163 } 164 164 // Return number of rows affected 165 165 $return_val = $this->rows_affected; … … 179 179 180 180 // Log number of rows the query returned 181 181 $this->num_rows = $num_rows; 182 182 183 183 // Return number of rows selected 184 184 $return_val = $this->num_rows; 185 185 } … … 293 293 $this->time_start = $mtime[1] + $mtime[0]; 294 294 return true; 295 295 } 296 296 297 297 function timer_stop($precision = 3) { 298 298 $mtime = microtime(); 299 299 $mtime = explode(' ', $mtime); … … 305 305 function bail($message) { // Just wraps errors in a nice header and footer 306 306 if ( !$this->show_errors ) 307 307 return false; 308 header( 'Content-Type: text/html; charset=utf-8'); 308 header( 'Content-Type: text/html; charset=utf-8'); 309 309 echo <<<HEAD 310 310 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 311 311 <html xmlns="http://www.w3.org/1999/xhtml"> … … 325 325 margin-right: 25%; 326 326 padding: .2em 2em; 327 327 } 328 328 329 329 h1 { 330 330 color: #006; 331 331 font-size: 18px; 332 332 font-weight: lighter; 333 333 } 334 334 335 335 h2 { 336 336 font-size: 16px; 337 337 } 338 338 339 339 p, li, dt { 340 340 line-height: 140%; 341 341 padding-bottom: 2px; 342 342 } 343 343 344 344 ul, ol { 345 345 padding: 5px 5px 5px 20px; 346 346 } -
wp-includes/template-loader.php
31 31 exit; 32 32 } else if ( is_category() && $template = get_category_template()) { 33 33 include($template); 34 exit; 34 exit; 35 35 } else if ( is_author() && $template = get_author_template() ) { 36 36 include($template); 37 37 exit; -
wp-includes/functions-formatting.php
32 32 $curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl); 33 33 $curl = preg_replace("/ \(tm\)/i", ' ™', $curl); 34 34 $curl = str_replace("''", '”', $curl); 35 35 36 36 $curl = preg_replace('/(\d+)x(\d+)/', "$1×$2", $curl); 37 37 38 38 } elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) { … … 74 74 $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee); 75 75 $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee); 76 76 $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); 77 77 78 78 return $pee; 79 79 } 80 80 … … 239 239 chr(197).chr(190) => 'z', chr(197).chr(191) => 's', 240 240 // Euro Sign 241 241 chr(226).chr(130).chr(172) => 'E'); 242 242 243 243 $string = strtr($string, $chars); 244 244 } else { 245 245 // Assume ISO-8859-1 if not UTF-8 … … 374 374 function funky_javascript_fix($text) { 375 375 // Fixes for browsers' javascript bugs 376 376 global $is_macIE, $is_winIE; 377 377 378 378 if ( $is_winIE || $is_macIE ) 379 379 $text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text); 380 380 381 381 return $text; 382 382 } 383 383 … … 401 401 1.0 First Version 402 402 */ 403 403 function balanceTags($text, $is_comment = 0) { 404 404 405 405 if ( get_option('use_balanceTags') == 0) 406 406 return $text; 407 407 -
wp-includes/js/tw-sack.js
32 32 this.failed = true; 33 33 } 34 34 }; 35 35 36 36 this.setVar = function(name, value){ 37 37 if (this.URLString.length < 3){ 38 38 this.URLString = name + "=" + value; … … 40 40 this.URLString += "&" + name + "=" + value; 41 41 } 42 42 } 43 43 44 44 this.encVar = function(name, value){ 45 45 var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value); 46 46 return varString; 47 47 } 48 48 49 49 this.encodeURLString = function(string){ 50 50 varArray = string.split('&'); 51 51 for (i = 0; i < varArray.length; i++){ … … 57 57 } 58 58 return varArray.join('&'); 59 59 } 60 60 61 61 this.runResponse = function(){ 62 62 eval(this.response); 63 63 } 64 64 65 65 this.runAJAX = function(urlstring){ 66 66 this.responseStatus = new Array(2); 67 67 if(this.failed && this.AjaxFailedAlert){ -
wp-includes/js/fat.js
31 31 if (!duration) duration = 3000; 32 32 if (!from || from=="#") from = "#FFFF33"; 33 33 if (!to) to = this.get_bgcolor(id); 34 34 35 35 var frames = Math.round(fps * (duration / 1000)); 36 36 var interval = duration / frames; 37 37 var delay = interval; 38 38 var frame = 0; 39 39 40 40 if (from.length < 7) from += from.substr(1,3); 41 41 if (to.length < 7) to += to.substr(1,3); 42 42 43 43 var rf = parseInt(from.substr(1,2),16); 44 44 var gf = parseInt(from.substr(3,2),16); 45 45 var bf = parseInt(from.substr(5,2),16); 46 46 var rt = parseInt(to.substr(1,2),16); 47 47 var gt = parseInt(to.substr(3,2),16); 48 48 var bt = parseInt(to.substr(5,2),16); 49 49 50 50 var r,g,b,h; 51 51 while (frame < frames) 52 52 { … … 54 54 g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames)); 55 55 b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames)); 56 56 h = this.make_hex(r,g,b); 57 57 58 58 setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay); 59 59 60 60 frame++; -
wp-includes/js/quicktags.js
205 205 else { 206 206 return false; // tag not found 207 207 } 208 } 208 } 209 209 210 210 function edCloseAllTags() { 211 211 var count = edOpenTags.length; -
wp-includes/js/colorpicker.js
139 139 } 140 140 function AnchorPosition_getWindowOffsetLeft (el) { 141 141 return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; 142 } 142 } 143 143 function AnchorPosition_getPageOffsetTop (el) { 144 144 var ot=el.offsetTop; 145 145 while((el=el.offsetParent) != null) { ot += el.offsetTop; } … … 434 434 this.populated = false; 435 435 this.visible = false; 436 436 this.autoHideEnabled = false; 437 437 438 438 this.contents = ""; 439 439 this.url=""; 440 440 this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no"; … … 556 556 window.ColorPicker_targetInput = inputobj; 557 557 this.show(linkname); 558 558 } 559 559 560 560 // This function runs when you move your mouse over a color block, if you have a newer browser 561 561 function ColorPicker_highlightColor(c) { 562 562 var thedoc = (arguments.length>1)?arguments[1]:window.document; … … 579 579 else { 580 580 var divname = arguments[0]; 581 581 } 582 582 583 583 if (divname != "") { 584 584 var cp = new PopupWindow(divname); 585 585 } … … 590 590 591 591 // Object variables 592 592 cp.currentValue = "#FFFFFF"; 593 593 594 594 // Method Mappings 595 595 cp.writeDiv = ColorPicker_writeDiv; 596 596 cp.highlightColor = ColorPicker_highlightColor; -
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
87 87 // Is selection a image 88 88 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { 89 89 flag = getAttrib(focusElm, 'class'); 90 90 91 91 if (flag != 'mce_plugin_wordpress_more') // Not a wordpress 92 92 return true; 93 93 94 94 action = "update"; 95 95 } 96 96 97 97 html = '' 98 98 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' 99 99 + ' width="100%" height="10px" ' … … 105 105 var flag = ""; 106 106 var template = new Array(); 107 107 var altPage = tinyMCE.getLang('lang_wordpress_more_alt'); 108 108 109 109 // Is selection a image 110 110 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { 111 111 flag = getAttrib(focusElm, 'name'); 112 112 113 113 if (flag != 'mce_plugin_wordpress_page') // Not a wordpress 114 114 return true; 115 115 116 116 action = "update"; 117 117 } 118 118 119 119 html = '' 120 120 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' 121 121 + ' width="100%" height="10px" ' … … 131 131 132 132 function TinyMCE_wordpress_cleanup(type, content) { 133 133 switch (type) { 134 134 135 135 case "insert_to_editor": 136 136 var startPos = 0; 137 137 var altMore = tinyMCE.getLang('lang_wordpress_more_alt'); … … 178 178 179 179 if (attribs['class'] == "mce_plugin_wordpress_more") { 180 180 endPos += 2; 181 181 182 182 var embedHTML = '<!--more-->'; 183 183 184 184 // Insert embed/object chunk 185 185 chunkBefore = content.substring(0, startPos); 186 186 chunkAfter = content.substring(endPos); … … 188 188 } 189 189 if (attribs['class'] == "mce_plugin_wordpress_page") { 190 190 endPos += 2; 191 191 192 192 var embedHTML = '<!--nextpage-->'; 193 193 194 194 // Insert embed/object chunk 195 195 chunkBefore = content.substring(0, startPos); 196 196 chunkAfter = content.substring(endPos); … … 221 221 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n'); 222 222 content = content.replace(new RegExp('^\\s*', ''), ''); 223 223 content = content.replace(new RegExp('\\s*$', ''), ''); 224 224 225 225 break; 226 226 } 227 227 -
wp-includes/js/tinymce/tiny_mce.js
353 353 354 354 if (inst.formElement == formElement) { 355 355 var doc = inst.getDoc(); 356 356 357 357 tinyMCE._setHTML(doc, inst.formElement.value); 358 358 359 359 if (!tinyMCE.isMSIE) -
wp-includes/js/tinymce/wp-mce-help.php
93 93 c = d('content'+i.toString()); 94 94 t = d('tab'+i.toString()); 95 95 if ( n == i ) { 96 c.className = ''; 96 c.className = ''; 97 97 t.className = 'current'; 98 98 } else { 99 99 c.className = 'hidden'; -
wp-includes/js/tinymce/themes/advanced/jscripts/image.js
61 61 62 62 function resetImageData() { 63 63 var formObj = document.forms[0]; 64 formObj.width.value = formObj.height.value = ""; 64 formObj.width.value = formObj.height.value = ""; 65 65 } 66 66 67 67 function updateImageData() { -
wp-includes/capabilities.php
34 34 $this->role_names[$role] = $display_name; 35 35 return $this->role_objects[$role]; 36 36 } 37 37 38 38 function remove_role($role) { 39 39 if ( ! isset($this->role_objects[$role]) ) 40 40 return; 41 41 42 42 unset($this->role_objects[$role]); 43 43 unset($this->role_names[$role]); 44 44 unset($this->roles[$role]); 45 45 46 46 update_option($this->role_key, $this->roles); 47 47 } 48 48 … … 70 70 function is_role($role) 71 71 { 72 72 return isset($this->role_names[$role]); 73 } 73 } 74 74 } 75 75 76 76 class WP_Role { … … 150 150 $this->caps = array(); 151 151 $this->get_role_caps(); 152 152 } 153 153 154 154 function get_role_caps() { 155 155 global $wp_roles; 156 156 157 157 if ( ! isset($wp_roles) ) 158 158 $wp_roles = new WP_Roles(); 159 159 … … 169 169 } 170 170 $this->allcaps = array_merge($this->allcaps, $this->caps); 171 171 } 172 172 173 173 function add_role($role) { 174 174 $this->caps[$role] = true; 175 175 update_usermeta($this->id, $this->cap_key, $this->caps); 176 176 $this->get_role_caps(); 177 177 $this->update_user_level_from_caps(); 178 178 } 179 179 180 180 function remove_role($role) { 181 181 if ( empty($this->roles[$role]) || (count($this->roles) <= 1) ) 182 182 return; … … 184 184 update_usermeta($this->id, $this->cap_key, $this->caps); 185 185 $this->get_role_caps(); 186 186 } 187 187 188 188 function set_role($role) { 189 189 foreach($this->roles as $oldrole) 190 190 unset($this->caps[$oldrole]); … … 203 203 return $max; 204 204 } 205 205 } 206 206 207 207 function update_user_level_from_caps() { 208 208 global $table_prefix; 209 209 $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); 210 210 update_usermeta($this->id, $table_prefix.'user_level', $this->user_level); 211 211 } 212 212 213 213 function add_cap($cap, $grant = true) { 214 214 $this->caps[$cap] = $grant; 215 215 update_usermeta($this->id, $this->cap_key, $this->caps); … … 220 220 unset($this->caps[$cap]); 221 221 update_usermeta($this->id, $this->cap_key, $this->caps); 222 222 } 223 223 224 224 //has_cap(capability_or_role_name) or 225 225 //has_cap('edit_post', post_id) 226 226 function has_cap($cap) { 227 227 if ( is_numeric($cap) ) 228 228 $cap = $this->translate_level_to_cap($cap); 229 229 230 230 $args = array_slice(func_get_args(), 1); 231 231 $args = array_merge(array($cap, $this->id), $args); 232 232 $caps = call_user_func_array('map_meta_cap', $args); … … 345 345 break; 346 346 case 'read_post': 347 347 $post = get_post($args[0]); 348 348 349 349 if ( 'private' != $post->post_status ) { 350 350 $caps[] = 'read'; 351 break; 351 break; 352 352 } 353 353 354 354 $author_data = get_userdata($user_id); 355 355 $post_author_data = get_userdata($post->post_author); 356 356 if ($user_id == $post_author_data->ID) -
wp-includes/functions-post.php
31 31 $post_name = apply_filters('name_save_pre', $post_name); 32 32 $comment_status = apply_filters('comment_status_pre', $comment_status); 33 33 $ping_status = apply_filters('ping_status_pre', $ping_status); 34 34 35 35 // Make sure we set a valid category 36 36 if (0 == count($post_category) || !is_array($post_category)) { 37 37 $post_category = array(get_option('default_category')); … … 59 59 } else { 60 60 $post_name = sanitize_title($post_name); 61 61 } 62 63 62 63 64 64 // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now 65 65 if (empty($post_date)) { 66 66 if ( 'draft' != $post_status ) … … 150 150 (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) 151 151 VALUES 152 152 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); 153 $post_ID = $wpdb->insert_id; 153 $post_ID = $wpdb->insert_id; 154 154 } 155 155 156 156 if ( empty($post_name) && 'draft' != $post_status ) { … … 177 177 $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'"); 178 178 do_action('private_to_published', $post_ID); 179 179 } 180 180 181 181 do_action('edit_post', $post_ID); 182 182 } 183 183 … … 251 251 $update = false; 252 252 if ( !empty($ID) ) { 253 253 $update = true; 254 $post_ID = $ID; 254 $post_ID = $ID; 255 255 } 256 256 257 257 // Create a valid post name. … … 259 259 $post_name = sanitize_title($post_title); 260 260 else 261 261 $post_name = sanitize_title($post_name); 262 262 263 263 if (empty($post_date)) 264 264 $post_date = current_time('mysql'); 265 265 if (empty($post_date_gmt)) … … 332 332 (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) 333 333 VALUES 334 334 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); 335 $post_ID = $wpdb->insert_id; 335 $post_ID = $wpdb->insert_id; 336 336 } 337 337 338 338 if ( empty($post_name) ) { 339 339 $post_name = sanitize_title($post_title, $post_ID); 340 340 $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" ); … … 352 352 } else { 353 353 do_action('add_attachment', $post_ID); 354 354 } 355 355 356 356 return $post_ID; 357 357 } 358 358 … … 395 395 global $wpdb; 396 396 397 397 $post = get_post($postid, $mode); 398 398 399 399 // Set categories 400 400 if($mode == OBJECT) { 401 401 $post->post_category = wp_get_post_cats('',$postid); … … 428 428 $postarr = get_object_vars($postarr); 429 429 430 430 // First, get all of the original fields 431 $post = wp_get_single_post($postarr['ID'], ARRAY_A); 431 $post = wp_get_single_post($postarr['ID'], ARRAY_A); 432 432 433 433 // Escape data pulled from DB. 434 434 $post = add_magic_quotes($post); … … 449 449 450 450 // Merge old and new fields with new fields overwriting old ones. 451 451 $postarr = array_merge($post, $postarr); 452 $postarr['post_category'] = $post_cats; 452 $postarr['post_category'] = $post_cats; 453 453 if ( $clear_date ) { 454 454 $postarr['post_date'] = ''; 455 455 $postarr['post_date_gmt'] = ''; … … 470 470 if ( 'publish' == $post->post_status ) 471 471 return; 472 472 473 return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id)); 473 return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id)); 474 474 } 475 475 476 476 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 477 477 global $wpdb; 478 478 479 479 $sql = "SELECT category_id 480 480 FROM $wpdb->post2cat 481 481 WHERE post_id = $post_ID … … 494 494 // If $post_categories isn't already an array, make it one: 495 495 if (!is_array($post_categories) || 0 == count($post_categories)) 496 496 $post_categories = array(get_option('default_category')); 497 497 498 498 $post_categories = array_unique($post_categories); 499 499 500 500 // First the old categories … … 502 502 SELECT category_id 503 503 FROM $wpdb->post2cat 504 504 WHERE post_id = $post_ID"); 505 505 506 506 if (!$old_categories) { 507 507 $old_categories = array(); 508 508 } else { … … 532 532 VALUES ($post_ID, $new_cat)"); 533 533 } 534 534 } 535 535 536 536 // Update category counts. 537 537 $all_affected_cats = array_unique(array_merge($post_categories, $old_categories)); 538 538 foreach ( $all_affected_cats as $cat_id ) { 539 539 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); 540 540 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 541 wp_cache_delete($cat_id, 'category'); 541 wp_cache_delete($cat_id, 'category'); 542 542 } 543 543 } // wp_set_post_cats() 544 544 … … 568 568 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'"); 569 569 570 570 $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); 571 571 572 572 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid"); 573 573 574 574 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid"); … … 595 595 // Get the name of a category from its ID 596 596 function get_cat_name($cat_id) { 597 597 global $wpdb; 598 598 599 599 $cat_id -= 0; // force numeric 600 600 $name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id"); 601 601 602 602 return $name; 603 603 } 604 604 605 605 // Get the ID of a category from its name 606 606 function get_cat_ID($cat_name='General') { 607 607 global $wpdb; 608 608 609 609 $cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); 610 610 611 611 return $cid?$cid:1; // default to cat 1 … … 639 639 640 640 // import postdata as variables 641 641 extract($postdata); 642 642 643 643 // form an excerpt 644 644 $excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content); 645 645 646 646 if (strlen($excerpt) > 255) { 647 647 $excerpt = substr($excerpt,0,252) . '...'; 648 648 } 649 649 650 650 $trackback_urls = explode(',', $tb_list); 651 651 foreach($trackback_urls as $tb_url) { 652 652 $tb_url = trim($tb_url); … … 684 684 // Do some escaping magic so that '#' chars in the 685 685 // spam words don't break things: 686 686 $word = preg_quote($word, '#'); 687 687 688 688 $pattern = "#$word#i"; 689 689 if ( preg_match($pattern, $author ) ) return true; 690 690 if ( preg_match($pattern, $email ) ) return true; … … 693 693 if ( preg_match($pattern, $user_ip ) ) return true; 694 694 if ( preg_match($pattern, $user_agent) ) return true; 695 695 } 696 696 697 697 if ( isset($_SERVER['REMOTE_ADDR']) ) { 698 698 if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true; 699 699 } … … 722 722 $wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'"); 723 723 return; 724 724 } 725 725 726 726 if (empty($post->post_excerpt)) 727 727 $excerpt = apply_filters('the_content', $post->post_content); 728 728 else … … 812 812 813 813 function generate_page_uri_index() { 814 814 global $wpdb; 815 815 816 816 //get pages in order of hierarchy, i.e. children after parents 817 817 $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'")); 818 818 //now reverse it, because we need parents after children for rewrite rules to work properly … … 822 822 $page_attachment_uris = array(); 823 823 824 824 if ($posts) { 825 825 826 826 foreach ($posts as $id => $post) { 827 827 828 828 // URI => page name … … 839 839 } 840 840 841 841 update_option('page_uris', $page_uris); 842 842 843 843 if ( $page_attachment_uris ) 844 844 update_option('page_attachment_uris', $page_attachment_uris); 845 845 } … … 903 903 return true; 904 904 } else { 905 905 if ( is_dir(dirname($target)) ) 906 return false; 906 return false; 907 907 } 908 908 909 909 // If the above failed, attempt to create the parent node, then try again. … … 954 954 return array('error' => "Empty filename"); 955 955 956 956 $upload = wp_upload_dir(); 957 957 958 958 if ( $upload['error'] !== false ) 959 959 return $upload; 960 960 … … 972 972 else 973 973 $filename = str_replace("$number$ext", ++$number . $ext, $filename); 974 974 } 975 975 976 976 $new_file = $upload['path'] . "/$filename"; 977 977 if ( ! wp_mkdir_p( dirname($new_file) ) ) { 978 978 $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); … … 982 982 $ifp = @ fopen($new_file, 'wb'); 983 983 if ( ! $ifp ) 984 984 return array('error' => "Could not write file $new_file."); 985 985 986 986 $success = @ fwrite($ifp, $bits); 987 987 fclose($ifp); 988 988 // Set correct file permissions -
wp-includes/classes.php
53 53 $this->is_admin = false; 54 54 $this->is_attachment = false; 55 55 } 56 56 57 57 function init () { 58 58 unset($this->posts); 59 59 unset($this->query); … … 63 63 $this->post_count = 0; 64 64 $this->current_post = -1; 65 65 $this->in_the_loop = false; 66 66 67 67 $this->init_query_flags(); 68 68 } 69 69 … … 97 97 $qv['attachment'] = $qv['subpost']; 98 98 if ( '' != $qv['subpost_id'] ) 99 99 $qv['attachment_id'] = $qv['subpost_id']; 100 100 101 101 if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { 102 102 $this->is_single = true; 103 103 $this->is_attachment = true; … … 226 226 if ('' != $qv['comments_popup']) { 227 227 $this->is_comments_popup = true; 228 228 } 229 229 230 230 //if we're previewing inside the write screen 231 231 if ('' != $qv['preview']) { 232 232 $this->is_preview = true; … … 247 247 248 248 function set_404() { 249 249 $this->init_query_flags(); 250 $this->is_404 = true; 250 $this->is_404 = true; 251 251 } 252 252 253 253 function get($query_var) { 254 254 if (isset($this->query_vars[$query_var])) { 255 255 return $this->query_vars[$query_var]; … … 268 268 do_action('pre_get_posts', array(&$this)); 269 269 270 270 // Shorthand. 271 $q = $this->query_vars; 271 $q = $this->query_vars; 272 272 273 273 // First let's clear some variables 274 274 $whichcat = ''; … … 306 306 $q['page'] = trim($q['page'], '/'); 307 307 $q['page'] = (int) $q['page']; 308 308 } 309 309 310 310 $add_hours = intval(get_settings('gmt_offset')); 311 311 $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); 312 312 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; … … 372 372 $page_paths = '/' . trim($q['pagename'], '/'); 373 373 $q['pagename'] = sanitize_title(basename($page_paths)); 374 374 $q['name'] = $q['pagename']; 375 375 376 376 $where .= " AND (ID = '$reqpage')"; 377 377 } elseif ('' != $q['attachment']) { 378 378 $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment']))); … … 489 489 $partial_match = $cat_id; 490 490 } 491 491 } 492 492 493 493 //if we don't match the entire hierarchy fallback on just matching the nicename 494 494 if (!$q['cat'] && $partial_match) { 495 495 $q['cat'] = $partial_match; 496 } 496 } 497 497 498 498 $tables = ", $wpdb->post2cat, $wpdb->categories"; 499 499 $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) "; … … 541 541 $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); 542 542 $whichauthor .= ' AND (post_author = '.intval($q['author']).')'; 543 543 } 544 544 545 545 $where .= $search.$whichcat.$whichauthor; 546 546 547 547 if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) { … … 572 572 } 573 573 574 574 //$now = gmdate('Y-m-d H:i:59'); 575 575 576 576 //only select past-dated posts, except if a logged in user is viewing a single: then, if they 577 577 //can edit the post, we let them through 578 578 //if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) { … … 593 593 $where .= " OR post_status = 'future'"; 594 594 else 595 595 $distinct = 'DISTINCT'; 596 596 597 597 if ( is_user_logged_in() ) 598 598 $where .= " OR post_author = $user_ID AND post_status = 'private')"; 599 599 else 600 $where .= ')'; 600 $where .= ')'; 601 601 } 602 602 603 603 // Apply filters on where and join prior to paging so that any … … 680 680 if ($this->post_count > 0) { 681 681 $this->post = $this->posts[0]; 682 682 } 683 683 684 684 // Save any changes made to the query vars. 685 685 $this->query_vars = $q; 686 686 return $this->posts; … … 841 841 $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>'; 842 842 843 843 $foot .= '<p><a href="options-discussion.php">' . __('« Return to Discussion Options page.') . '</a></p></div>'; 844 844 845 845 return $head . $body . $foot; 846 846 } // End function display_edit_form 847 847 … … 922 922 return false; 923 923 else 924 924 return true; 925 } 925 } 926 926 927 927 function using_index_permalinks() { 928 928 if (empty($this->permalink_structure)) { … … 942 942 return true; 943 943 else 944 944 return false; 945 } 945 } 946 946 947 947 function preg_index($number) { 948 948 $match_prefix = '$'; … … 987 987 $this->date_structure = ''; 988 988 return false; 989 989 } 990 990 991 991 // The date permalink must have year, month, and day separated by slashes. 992 992 $endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%'); 993 993 … … 1070 1070 $this->category_structure = $this->category_base . '/'; 1071 1071 1072 1072 $this->category_structure .= '%category%'; 1073 1073 1074 1074 return $this->category_structure; 1075 1075 } 1076 1076 … … 1153 1153 // If the tag already exists, replace the existing pattern and query for 1154 1154 // that tag, otherwise add the new tag, pattern, and query to the end of 1155 1155 // the arrays. 1156 $position = array_search($tag, $this->rewritecode); 1156 $position = array_search($tag, $this->rewritecode); 1157 1157 if (FALSE !== $position && NULL !== $position) { 1158 1158 $this->rewritereplace[$position] = $pattern; 1159 $this->queryreplace[$position] = $query; 1159 $this->queryreplace[$position] = $query; 1160 1160 } else { 1161 1161 $this->rewritecode[] = $tag; 1162 1162 $this->rewritereplace[] = $pattern; … … 1174 1174 1175 1175 $trackbackregex = 'trackback/?$'; 1176 1176 $pageregex = 'page/?([0-9]{1,})/?$'; 1177 1177 1178 1178 $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); 1179 1179 preg_match_all('/%.+?%/', $permalink_structure, $tokens); 1180 1180 … … 1304 1304 // Date 1305 1305 $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct()); 1306 1306 $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite); 1307 1307 1308 1308 // Root 1309 1309 $root_rewrite = $this->generate_rewrite_rules($this->root . '/'); 1310 1310 $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite); … … 1372 1372 $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . 1373 1373 "RewriteCond %{REQUEST_FILENAME} -d\n" . 1374 1374 "RewriteRule ^.*$ - [S=$num_rules]\n"; 1375 1375 1376 1376 foreach ($rewrite as $match => $query) { 1377 1377 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 1378 1378 $match = str_replace('.+?', '.+', $match); … … 1382 1382 if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { 1383 1383 //nada. 1384 1384 } 1385 1385 1386 1386 if (strstr($query, $this->index)) { 1387 1387 $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; 1388 1388 } else { … … 1413 1413 1414 1414 function init() { 1415 1415 $this->permalink_structure = get_settings('permalink_structure'); 1416 $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%')); 1416 $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%')); 1417 1417 $this->root = ''; 1418 1418 if ($this->using_index_permalinks()) { 1419 1419 $this->root = $this->index . '/'; … … 1493 1493 // Trim path info from the end and the leading home path from the 1494 1494 // front. For path info requests, this leaves us with the requesting 1495 1495 // filename, if any. For 404 requests, this leaves us with the 1496 // requested permalink. 1496 // requested permalink. 1497 1497 $req_uri = str_replace($pathinfo, '', $req_uri); 1498 1498 $req_uri = trim($req_uri, '/'); 1499 1499 $req_uri = preg_replace("|^$home_path|", '', $req_uri); … … 1562 1562 1563 1563 if (isset($error)) 1564 1564 unset($error); 1565 1565 1566 1566 if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) 1567 1567 unset($query_vars); 1568 1568 1569 1569 $this->did_permalink = false; 1570 1570 } 1571 1571 } … … 1619 1619 // If string is empty, return 0. If not, attempt to parse into a timestamp 1620 1620 $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; 1621 1621 1622 // Make a timestamp for our most recent modification... 1622 // Make a timestamp for our most recent modification... 1623 1623 $wp_modified_timestamp = strtotime($wp_last_modified); 1624 1624 1625 1625 if ( ($client_last_modified && $client_etag) ? -
wp-includes/template-functions-links.php
271 271 return null; 272 272 273 273 $current_post_date = $post->post_date; 274 274 275 275 $join = ''; 276 276 if ( $in_same_cat ) { 277 277 $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id "; … … 437 437 if ( $permalink ) 438 438 $qstr = trailingslashit($qstr); 439 439 $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr ); 440 440 441 441 // showing /page/1/ or ?paged=1 is redundant 442 442 if ( 1 === $pagenum ) { 443 443 $qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style -
wp-includes/pluggable-functions.php
62 62 return false; 63 63 64 64 $user = wp_cache_get($user_id, 'users'); 65 65 66 66 if ( $user ) 67 67 return $user; 68 68 … … 93 93 $user->user_lastname = $user->last_name; 94 94 if ( isset($user->description) ) 95 95 $user->user_description = $user->description; 96 96 97 97 wp_cache_add($user_id, $user, 'users'); 98 98 wp_cache_add($user->user_login, $user, 'userlogins'); 99 99 100 100 return $user; 101 101 } 102 102 endif; … … 114 114 115 115 if ( empty( $user_login ) ) 116 116 return false; 117 117 118 118 $userdata = wp_cache_get($user_login, 'userlogins'); 119 119 if ( $userdata ) 120 120 return $userdata; … … 202 202 if ( !function_exists('is_user_logged_in') ) : 203 203 function is_user_logged_in() { 204 204 global $current_user; 205 205 206 206 if ( $current_user->id == 0 ) 207 207 return false; 208 208 return true; … … 216 216 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || 217 217 (empty($_COOKIE[USER_COOKIE])) ) { 218 218 nocache_headers(); 219 219 220 220 header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); 221 221 exit(); 222 222 } … … 303 303 $comment_author_domain = gethostbyaddr($comment->comment_author_IP); 304 304 305 305 $blogname = get_settings('blogname'); 306 306 307 307 if ( empty( $comment_type ) ) $comment_type = 'comment'; 308 308 309 309 if ('comment' == $comment_type) { 310 310 $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; 311 311 $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; … … 407 407 if ( !function_exists('wp_new_user_notification') ) : 408 408 function wp_new_user_notification($user_id, $plaintext_pass = '') { 409 409 $user = new WP_User($user_id); 410 410 411 411 $user_login = stripslashes($user->user_login); 412 412 $user_email = stripslashes($user->user_email); 413 413 414 414 $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; 415 415 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 416 416 $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 417 417 418 418 @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); 419 419 420 420 if ( empty($plaintext_pass) ) … … 423 423 $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 424 424 $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; 425 425 $message .= get_settings('siteurl') . "/wp-login.php\r\n"; 426 426 427 427 wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); 428 428 429 429 } 430 430 endif; 431 431 -
wp-includes/comment-functions.php
41 41 42 42 $commentdata['comment_date'] = current_time('mysql'); 43 43 $commentdata['comment_date_gmt'] = current_time('mysql', 1); 44 45 44 45 46 46 $commentdata = wp_filter_comment($commentdata); 47 47 48 48 $commentdata['comment_approved'] = wp_allow_comment($commentdata); … … 230 230 231 231 if ( !isset($comment_count_cache[$post_id]) ) 232 232 $comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'"); 233 233 234 234 return apply_filters('get_comments_number', $comment_count_cache[$post_id]); 235 235 } 236 236 … … 277 277 function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { 278 278 global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb; 279 279 global $comment_count_cache; 280 280 281 281 if (! is_single() && ! is_page()) { 282 282 if ( !isset($comment_count_cache[$id]) ) 283 283 $comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';"); 284 284 285 285 $number = $comment_count_cache[$id]; 286 286 287 287 if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) { 288 288 echo $none; 289 289 return; … … 344 344 345 345 function get_comment_author_email() { 346 346 global $comment; 347 return apply_filters('get_comment_author_email', $comment->comment_author_email); 347 return apply_filters('get_comment_author_email', $comment->comment_author_email); 348 348 } 349 349 350 350 function comment_author_email() { … … 616 616 // Debug 617 617 debug_fwrite($log, 'Post contents:'); 618 618 debug_fwrite($log, $content."\n"); 619 619 620 620 // Step 2. 621 621 // Walking thru the links array 622 622 // first we get rid of links pointing to sites, not to specific files … … 658 658 659 659 // when set to true, this outputs debug messages by itself 660 660 $client->debug = false; 661 661 662 662 if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) 663 663 add_ping( $post_ID, $pagelinkedto ); 664 664 else … … 769 769 $post = & get_post($id); 770 770 if ( 'attachment' == $post->post_status ) 771 771 return true; 772 } 772 } 773 773 return false; 774 774 } 775 775 … … 795 795 796 796 if ($wpdb->query($query)) { 797 797 do_action('wp_set_comment_status', $comment_id, $comment_status); 798 798 799 799 $comment = get_comment($comment_id); 800 800 $comment_post_ID = $comment->comment_post_ID; 801 801 $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" ); … … 809 809 810 810 function wp_get_comment_status($comment_id) { 811 811 global $wpdb; 812 812 813 813 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 814 814 if ($result == NULL) { 815 815 return 'deleted'; … … 845 845 // Do some escaping magic so that '#' chars in the 846 846 // spam words don't break things: 847 847 $word = preg_quote($word, '#'); 848 848 849 849 $pattern = "#$word#i"; 850 850 if ( preg_match($pattern, $author) ) return false; 851 851 if ( preg_match($pattern, $email) ) return false; -
wp-includes/functions.php
22 22 return false; 23 23 } 24 24 $i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4)); 25 25 26 26 if ( -1 == $i || false == $i ) 27 27 $i = 0; 28 28 … … 304 304 305 305 function get_user_option( $option, $user = 0 ) { 306 306 global $wpdb, $current_user; 307 307 308 308 if ( empty($user) ) 309 309 $user = $current_user; 310 310 else … … 657 657 $curpage = get_page($curpage->post_parent); 658 658 $path = '/' . $curpage->post_name . $path; 659 659 } 660 660 661 661 $page->fullpath = $path; 662 662 663 663 return $page; … … 726 726 wp_cache_add($_page->ID, $_page, 'pages'); 727 727 } 728 728 } 729 729 730 730 if (!isset($_page->fullpath)) { 731 731 $_page = set_page_path($_page); 732 732 wp_cache_replace($_page->ID, $_page, 'pages'); … … 751 751 $curcat = get_category($curcat->category_parent); 752 752 $path = '/' . $curcat->category_nicename . $path; 753 753 } 754 754 755 755 $cat->fullpath = $path; 756 756 757 757 return $cat; … … 777 777 778 778 if ( !isset($_category->fullpath) ) { 779 779 $_category = set_category_path($_category); 780 wp_cache_replace($_category->cat_ID, $_category, 'category'); 780 wp_cache_replace($_category->cat_ID, $_category, 'category'); 781 781 } 782 782 783 783 if ( $output == OBJECT ) { … … 830 830 831 831 function get_all_category_ids() { 832 832 global $wpdb; 833 833 834 834 if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { 835 835 $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); 836 836 wp_cache_add('all_category_ids', $cat_ids, 'category'); 837 837 } 838 838 839 839 return $cat_ids; 840 840 } 841 841 842 842 function get_all_page_ids() { 843 843 global $wpdb; 844 844 845 845 if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { 846 846 $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); 847 847 wp_cache_add('all_page_ids', $page_ids, 'pages'); 848 848 } 849 849 850 850 return $page_ids; 851 851 } 852 852 … … 1416 1416 1417 1417 if ( empty($dogs) ) 1418 1418 return; 1419 1419 1420 1420 foreach ($dogs as $catt) 1421 1421 $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id); 1422 1422 } … … 1523 1523 1524 1524 function is_preview() { 1525 1525 global $wp_query; 1526 1526 1527 1527 return $wp_query->is_preview; 1528 1528 } 1529 1529 … … 2175 2175 2176 2176 function wp($query_vars = '') { 2177 2177 global $wp; 2178 2178 2179 2179 $wp->main($query_vars); 2180 2180 } 2181 2181 … … 2245 2245 if ( is_array($meta_value) || is_object($meta_value) ) 2246 2246 $meta_value = serialize($meta_value); 2247 2247 $meta_value = trim( $meta_value ); 2248 2248 2249 2249 if (empty($meta_value)) { 2250 2250 delete_usermeta($user_id, $meta_key); 2251 2251 } … … 2258 2258 } else if ( $cur->meta_value != $meta_value ) { 2259 2259 $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); 2260 2260 } else { 2261 return false; 2261 return false; 2262 2262 } 2263 2263 2264 2264 $user = get_userdata($user_id); 2265 2265 wp_cache_delete($user_id, 'users'); 2266 2266 wp_cache_delete($user->user_login, 'userlogins'); 2267 2267 2268 2268 return true; 2269 2269 } 2270 2270 … … 2282 2282 $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'"); 2283 2283 else 2284 2284 $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); 2285 2285 2286 2286 $user = get_userdata($user_id); 2287 2287 wp_cache_delete($user_id, 'users'); 2288 2288 wp_cache_delete($user->user_login, 'userlogins'); 2289 2289 2290 2290 return true; 2291 2291 } 2292 2292 -
wp-includes/rss-functions.php
30 30 var $inimage = false; 31 31 var $current_field = ''; 32 32 var $current_namespace = false; 33 33 34 34 //var $ERROR = ""; 35 35 36 36 var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); 37 37 38 38 function MagpieRSS ($source) { 39 39 40 40 # if PHP xml isn't compiled in, die 41 41 # 42 42 if ( !function_exists('xml_parser_create') ) 43 43 trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" ); 44 44 45 45 $parser = @xml_parser_create(); 46 46 47 47 if ( !is_resource($parser) ) 48 48 trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php"); 49 49 50 50 51 51 $this->parser = $parser; 52 52 53 53 # pass in parser, and a reference to this object 54 54 # setup handlers 55 55 # 56 56 xml_set_object( $this->parser, $this ); 57 57 xml_set_element_handler($this->parser, 58 58 'feed_start_element', 'feed_end_element' ); 59 59 60 60 xml_set_character_data_handler( $this->parser, 'feed_cdata' ); 61 61 62 62 $status = xml_parse( $this->parser, $source ); 63 63 64 64 if (! $status ) { 65 65 $errorcode = xml_get_error_code( $this->parser ); 66 66 if ( $errorcode != XML_ERROR_NONE ) { … … 72 72 $this->error( $errormsg ); 73 73 } 74 74 } 75 75 76 76 xml_parser_free( $this->parser ); 77 77 78 78 $this->normalize(); 79 79 } 80 80 81 81 function feed_start_element($p, $element, &$attrs) { 82 82 $el = $element = strtolower($element); 83 83 $attrs = array_change_key_case($attrs, CASE_LOWER); 84 84 85 85 // check for a namespace, and split if found 86 86 $ns = false; 87 87 if ( strpos( $element, ':' ) ) { … … 90 90 if ( $ns and $ns != 'rdf' ) { 91 91 $this->current_namespace = $ns; 92 92 } 93 93 94 94 # if feed type isn't set, then this is first element of feed 95 95 # identify feed from root element 96 96 # … … 110 110 } 111 111 return; 112 112 } 113 113 114 114 if ( $el == 'channel' ) 115 115 { 116 116 $this->inchannel = true; … … 119 119 { 120 120 $this->initem = true; 121 121 if ( isset($attrs['rdf:about']) ) { 122 $this->current_item['about'] = $attrs['rdf:about']; 122 $this->current_item['about'] = $attrs['rdf:about']; 123 123 } 124 124 } 125 125 126 126 // if we're in the default namespace of an RSS feed, 127 127 // record textinput or image fields 128 128 elseif ( … … 132 132 { 133 133 $this->intextinput = true; 134 134 } 135 135 136 136 elseif ( 137 137 $this->feed_type == RSS and 138 138 $this->current_namespace == '' and … … 140 140 { 141 141 $this->inimage = true; 142 142 } 143 143 144 144 # handle atom content constructs 145 145 elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) 146 146 { … … 148 148 if ($el == 'content' ) { 149 149 $el = 'atom_content'; 150 150 } 151 151 152 152 $this->incontent = $el; 153 154 153 154 155 155 } 156 156 157 157 // if inside an Atom content construct (e.g. content or summary) field treat tags as text 158 158 elseif ($this->feed_type == ATOM and $this->incontent ) 159 159 { … … 162 162 array_map('map_attrs', 163 163 array_keys($attrs), 164 164 array_values($attrs) ) ); 165 165 166 166 $this->append_content( "<$element $attrs_str>" ); 167 167 168 168 array_unshift( $this->stack, $el ); 169 169 } 170 170 171 171 // Atom support many links per containging element. 172 172 // Magpie treats link elements of type rel='alternate' 173 173 // as being equivalent to RSS's simple link element. … … 181 181 else { 182 182 $link_el = 'link_' . $attrs['rel']; 183 183 } 184 184 185 185 $this->append($link_el, $attrs['href']); 186 186 } 187 187 // set stack[0] to current element … … 189 189 array_unshift($this->stack, $el); 190 190 } 191 191 } 192 193 192 194 193 194 195 195 function feed_cdata ($p, $text) { 196 196 197 197 if ($this->feed_type == ATOM and $this->incontent) 198 198 { 199 199 $this->append_content( $text ); … … 203 203 $this->append($current_el, $text); 204 204 } 205 205 } 206 206 207 207 function feed_end_element ($p, $el) { 208 208 $el = strtolower($el); 209 209 210 210 if ( $el == 'item' or $el == 'entry' ) 211 211 { 212 212 $this->items[] = $this->current_item; … … 222 222 $this->inimage = false; 223 223 } 224 224 elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) 225 { 225 { 226 226 $this->incontent = false; 227 227 } 228 228 elseif ($el == 'channel' or $el == 'feed' ) … … 245 245 else { 246 246 array_shift( $this->stack ); 247 247 } 248 248 249 249 $this->current_namespace = false; 250 250 } 251 251 252 252 function concat (&$str1, $str2="") { 253 253 if (!isset($str1) ) { 254 254 $str1=""; 255 255 } 256 256 $str1 .= $str2; 257 257 } 258 258 259 259 function append_content($text) { 260 260 if ( $this->initem ) { 261 261 $this->concat( $this->current_item[ $this->incontent ], $text ); … … 264 264 $this->concat( $this->channel[ $this->incontent ], $text ); 265 265 } 266 266 } 267 267 268 268 // smart append - field and namespace aware 269 269 function append($el, $text) { 270 270 if (!$el) { … … 306 306 $this->concat( 307 307 $this->channel[ $el ], $text ); 308 308 } 309 309 310 310 } 311 311 } 312 312 313 313 function normalize () { 314 314 // if atom populate rss fields 315 315 if ( $this->is_atom() ) { … … 320 320 $item['description'] = $item['summary']; 321 321 if ( isset($item['atom_content'])) 322 322 $item['content']['encoded'] = $item['atom_content']; 323 323 324 324 $this->items[$i] = $item; 325 } 325 } 326 326 } 327 327 elseif ( $this->is_rss() ) { 328 328 $this->channel['tagline'] = $this->channel['description']; … … 332 332 $item['summary'] = $item['description']; 333 333 if ( isset($item['content']['encoded'] ) ) 334 334 $item['atom_content'] = $item['content']['encoded']; 335 335 336 336 $this->items[$i] = $item; 337 337 } 338 338 } 339 339 } 340 340 341 341 function is_rss () { 342 342 if ( $this->feed_type == RSS ) { 343 return $this->feed_version; 343 return $this->feed_version; 344 344 } 345 345 else { 346 346 return false; 347 347 } 348 348 } 349 349 350 350 function is_atom() { 351 351 if ( $this->feed_type == ATOM ) { 352 352 return $this->feed_version; … … 378 378 function fetch_rss ($url) { 379 379 // initialize constants 380 380 init(); 381 381 382 382 if ( !isset($url) ) { 383 383 // error("fetch_rss called without a url"); 384 384 return false; 385 385 } 386 386 387 387 // if cache is disabled 388 388 if ( !MAGPIE_CACHE_ON ) { 389 389 // fetch file, and parse it … … 403 403 // 2. if there is a hit, make sure its fresh 404 404 // 3. if cached obj fails freshness check, fetch remote 405 405 // 4. if remote fails, return stale object, or error 406 406 407 407 $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); 408 408 409 409 if (MAGPIE_DEBUG and $cache->ERROR) { 410 410 debug($cache->ERROR, E_USER_WARNING); 411 411 } 412 413 412 413 414 414 $cache_status = 0; // response of check_cache 415 415 $request_headers = array(); // HTTP headers to send with fetch 416 416 $rss = 0; // parsed RSS object 417 417 $errormsg = 0; // errors, if any 418 418 419 419 if (!$cache->ERROR) { 420 420 // return cache HIT, MISS, or STALE 421 421 $cache_status = $cache->check_cache( $url ); … … 432 432 return $rss; 433 433 } 434 434 } 435 435 436 436 // else attempt a conditional get 437 437 438 438 // setup headers 439 439 if ( $cache_status == 'STALE' ) { 440 440 $rss = $cache->get( $url ); … … 443 443 $request_headers['If-Last-Modified'] = $rss->last_modified; 444 444 } 445 445 } 446 446 447 447 $resp = _fetch_remote_file( $url, $request_headers ); 448 448 449 449 if (isset($resp) and $resp) { 450 450 if ($resp->status == '304' ) { 451 451 // we have the most current copy … … 483 483 else { 484 484 $errormsg = "Unable to retrieve RSS file for unknown reasons."; 485 485 } 486 486 487 487 // else fetch failed 488 488 489 489 // attempt to return cached object 490 490 if ($rss) { 491 491 if ( MAGPIE_DEBUG ) { … … 493 493 } 494 494 return $rss; 495 495 } 496 496 497 497 // else we totally failed 498 // error( $errormsg ); 499 498 // error( $errormsg ); 499 500 500 return false; 501 501 502 502 } // end if ( !MAGPIE_CACHE_ON ) { 503 503 } // end fetch_rss() 504 504 … … 511 511 if (is_array($headers) ) { 512 512 $client->rawheaders = $headers; 513 513 } 514 514 515 515 @$client->fetch($url); 516 516 return $client; 517 517 … … 519 519 520 520 function _response_to_rss ($resp) { 521 521 $rss = new MagpieRSS( $resp->results ); 522 523 // if RSS parsed successfully 522 523 // if RSS parsed successfully 524 524 if ( $rss and !$rss->ERROR) { 525 525 526 526 // find Etag, and Last-Modified 527 527 foreach($resp->headers as $h) { 528 528 // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" … … 533 533 $field = $h; 534 534 $val = ""; 535 535 } 536 536 537 537 if ( $field == 'ETag' ) { 538 538 $rss->etag = $val; 539 539 } 540 540 541 541 if ( $field == 'Last-Modified' ) { 542 542 $rss->last_modified = $val; 543 543 } 544 544 } 545 546 return $rss; 545 546 return $rss; 547 547 } // else construct error message 548 548 else { 549 549 $errormsg = "Failed to parse RSS file."; 550 550 551 551 if ($rss) { 552 552 $errormsg .= " (" . $rss->ERROR . ")"; 553 553 } 554 554 // error($errormsg); 555 555 556 556 return false; 557 557 } // end if ($rss and !$rss->error) 558 558 } … … 569 569 else { 570 570 define('MAGPIE_INITALIZED', 1); 571 571 } 572 572 573 573 if ( !defined('MAGPIE_CACHE_ON') ) { 574 574 define('MAGPIE_CACHE_ON', 1); 575 575 } … … 585 585 if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { 586 586 define('MAGPIE_CACHE_FRESH_ONLY', 0); 587 587 } 588 588 589 589 if ( !defined('MAGPIE_DEBUG') ) { 590 590 define('MAGPIE_DEBUG', 0); 591 591 } 592 592 593 593 if ( !defined('MAGPIE_USER_AGENT') ) { 594 594 $ua = 'WordPress/' . $wp_version; 595 595 596 596 if ( MAGPIE_CACHE_ON ) { 597 597 $ua = $ua . ')'; 598 598 } 599 599 else { 600 600 $ua = $ua . '; No cache)'; 601 601 } 602 602 603 603 define('MAGPIE_USER_AGENT', $ua); 604 604 } 605 605 606 606 if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { 607 607 define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout 608 608 } 609 609 610 610 // use gzip encoding to fetch rss files if supported? 611 611 if ( !defined('MAGPIE_USE_GZIP') ) { 612 define('MAGPIE_USE_GZIP', true); 612 define('MAGPIE_USE_GZIP', true); 613 613 } 614 614 } 615 615 … … 641 641 var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored 642 642 var $MAX_AGE = 43200; // when are files stale, default twelve hours 643 643 var $ERROR = ''; // accumulate error messages 644 644 645 645 function RSSCache ($base='', $age='') { 646 646 if ( $base ) { 647 647 $this->BASE_CACHE = $base; … … 649 649 if ( $age ) { 650 650 $this->MAX_AGE = $age; 651 651 } 652 652 653 653 } 654 654 655 655 /*=======================================================================*\ 656 656 Function: set 657 657 Purpose: add an item to the cache, keyed on url 658 658 Input: url from wich the rss file was fetched 659 Output: true on sucess 659 Output: true on sucess 660 660 \*=======================================================================*/ 661 661 function set ($url, $rss) { 662 662 global $wpdb; 663 663 $cache_option = 'rss_' . $this->file_name( $url ); 664 664 $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts'; 665 665 666 666 if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_option'") ) 667 667 add_option($cache_option, '', '', 'no'); 668 668 if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_timestamp'") ) 669 669 add_option($cache_timestamp, '', '', 'no'); 670 670 671 671 update_option($cache_option, $rss); 672 672 update_option($cache_timestamp, time() ); 673 673 674 674 return $cache_option; 675 675 } 676 676 677 677 /*=======================================================================*\ 678 678 Function: get 679 679 Purpose: fetch an item from the cache 680 680 Input: url from wich the rss file was fetched 681 Output: cached object on HIT, false on MISS 682 \*=======================================================================*/ 681 Output: cached object on HIT, false on MISS 682 \*=======================================================================*/ 683 683 function get ($url) { 684 684 $this->ERROR = ""; 685 685 $cache_option = 'rss_' . $this->file_name( $url ); 686 686 687 687 if ( ! get_option( $cache_option ) ) { 688 688 $this->debug( 689 689 "Cache doesn't contain: $url (cache option: $cache_option)" 690 690 ); 691 691 return 0; 692 692 } 693 693 694 694 $rss = get_option( $cache_option ); 695 695 696 696 return $rss; 697 697 } 698 698 … … 701 701 Purpose: check a url for membership in the cache 702 702 and whether the object is older then MAX_AGE (ie. STALE) 703 703 Input: url from wich the rss file was fetched 704 Output: cached object on HIT, false on MISS 705 \*=======================================================================*/ 704 Output: cached object on HIT, false on MISS 705 \*=======================================================================*/ 706 706 function check_cache ( $url ) { 707 707 $this->ERROR = ""; 708 708 $cache_option = $this->file_name( $url ); … … 729 729 730 730 /*=======================================================================*\ 731 731 Function: serialize 732 \*=======================================================================*/ 732 \*=======================================================================*/ 733 733 function serialize ( $rss ) { 734 734 return serialize( $rss ); 735 735 } 736 736 737 737 /*=======================================================================*\ 738 738 Function: unserialize 739 \*=======================================================================*/ 739 \*=======================================================================*/ 740 740 function unserialize ( $data ) { 741 741 return unserialize( $data ); 742 742 } 743 743 744 744 /*=======================================================================*\ 745 745 Function: file_name 746 746 Purpose: map url to location in cache 747 747 Input: url from wich the rss file was fetched 748 748 Output: a file name 749 \*=======================================================================*/ 749 \*=======================================================================*/ 750 750 function file_name ($url) { 751 751 return md5( $url ); 752 752 } 753 753 754 754 /*=======================================================================*\ 755 755 Function: error 756 756 Purpose: register error 757 \*=======================================================================*/ 757 \*=======================================================================*/ 758 758 function error ($errormsg, $lvl=E_USER_WARNING) { 759 759 // append PHP's error message if track_errors enabled 760 760 if ( isset($php_errormsg) ) { … … 776 776 } 777 777 778 778 function parse_w3cdtf ( $date_str ) { 779 779 780 780 # regex to match wc3dtf 781 781 $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; 782 782 783 783 if ( preg_match( $pat, $date_str, $match ) ) { 784 784 list( $year, $month, $day, $hours, $minutes, $seconds) = 785 785 array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); 786 786 787 787 # calc epoch for current date assuming GMT 788 788 $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); 789 789 790 790 $offset = 0; 791 791 if ( $match[10] == 'Z' ) { 792 792 # zulu time, aka GMT … … 794 794 else { 795 795 list( $tz_mod, $tz_hour, $tz_min ) = 796 796 array( $match[8], $match[9], $match[10]); 797 797 798 798 # zero out the variables 799 799 if ( ! $tz_hour ) { $tz_hour = 0; } 800 800 if ( ! $tz_min ) { $tz_min = 0; } 801 801 802 802 $offset_secs = (($tz_hour*60)+$tz_min)*60; 803 803 804 804 # is timezone ahead of GMT? then subtract offset 805 805 # 806 806 if ( $tz_mod == '+' ) { 807 807 $offset_secs = $offset_secs * -1; 808 808 } 809 810 $offset = $offset_secs; 809 810 $offset = $offset_secs; 811 811 } 812 812 $epoch = $epoch + $offset; 813 813 return $epoch; … … 829 829 echo htmlentities($item['title']); 830 830 echo "</a><br />\n"; 831 831 echo "</li>\n"; 832 } 832 } 833 833 echo "</ul>"; 834 834 } 835 835 else { -
wp-includes/registration-functions.php
23 23 $valid = true; 24 24 25 25 if ( $name != $username ) 26 $valid = false; 26 $valid = false; 27 27 28 return apply_filters('validate_username', $valid, $username); 28 return apply_filters('validate_username', $valid, $username); 29 29 } 30 30 31 31 function wp_insert_user($userdata) { … … 41 41 // Password is not hashed when creating new user. 42 42 $user_pass = md5($user_pass); 43 43 } 44 44 45 45 $user_login = sanitize_user($user_login, true); 46 46 47 47 if ( empty($user_nicename) ) … … 49 49 50 50 if ( empty($display_name) ) 51 51 $display_name = $user_login; 52 52 53 53 if ( empty($nickname) ) 54 54 $nickname = $user_login; 55 55 56 56 if ( empty($user_registered) ) 57 57 $user_registered = gmdate('Y-m-d H:i:s'); 58 58 … … 70 70 $wpdb->query( $query ); 71 71 $user_id = $wpdb->insert_id; 72 72 } 73 73 74 74 update_usermeta( $user_id, 'first_name', $first_name); 75 75 update_usermeta( $user_id, 'last_name', $last_name); 76 76 update_usermeta( $user_id, 'nickname', $nickname ); … … 91 91 92 92 wp_cache_delete($user_id, 'users'); 93 93 wp_cache_delete($user_login, 'userlogins'); 94 94 95 95 if ( $update ) 96 96 do_action('profile_update', $user_id); 97 97 else 98 98 do_action('user_register', $user_id); 99 100 return $user_id; 99 100 return $user_id; 101 101 } 102 102 103 103 function wp_update_user($userdata) { 104 104 global $wpdb, $current_user; 105 105 106 106 $ID = (int) $userdata['ID']; 107 107 108 108 // First, get all of the original fields 109 $user = get_userdata($ID); 109 $user = get_userdata($ID); 110 110 111 111 // Escape data pulled from DB. 112 112 $user = add_magic_quotes(get_object_vars($user)); … … 121 121 $userdata = array_merge($user, $userdata); 122 122 $user_id = wp_insert_user($userdata); 123 123 124 // Update the cookies if the password changed. 124 // Update the cookies if the password changed. 125 125 if( $current_user->id == $ID ) { 126 126 if ( isset($plaintext_pass) ) { 127 127 wp_clearcookie(); 128 128 wp_setcookie($userdata['user_login'], $plaintext_pass); 129 129 } 130 130 } 131 131 132 132 return $user_id; 133 133 } 134 134 135 135 function wp_create_user( $username, $password, $email = '') { 136 136 global $wpdb; 137 137 138 138 $user_login = $wpdb->escape( $username ); 139 139 $user_email = $wpdb->escape( $email ); 140 140 $user_pass = $password; … … 145 145 146 146 147 147 function create_user( $username, $password, $email ) { 148 return wp_create_user( $username, $password, $email ); 148 return wp_create_user( $username, $password, $email ); 149 149 } 150 150 151 151 -
xmlrpc.php
577 577 $post_category[] = get_cat_ID($cat); 578 578 } 579 579 } 580 580 581 581 // We've got all the data -- post it: 582 582 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping'); 583 583 … … 623 623 $catnames = $content_struct['categories']; 624 624 625 625 $post_category = array(); 626 626 627 627 if (is_array($catnames)) { 628 628 foreach ($catnames as $cat) { 629 629 $post_category[] = get_cat_ID($cat); … … 861 861 logIO('O', '(MW) Could not write file '.$name); 862 862 return new IXR_Error(500, 'Could not write file '.$name); 863 863 } 864 864 865 865 return array('url' => $upload['url']); 866 866 } 867 867 … … 995 995 foreach($categories as $cat) { 996 996 $catids[] = $cat['categoryId']; 997 997 } 998 998 999 999 wp_set_post_cats('', $post_ID, $catids); 1000 1000 1001 1001 return true; … … 1199 1199 $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need 1200 1200 1201 1201 $p = explode( "\n\n", $linea ); 1202 1202 1203 1203 $sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/"; 1204 1204 $sem_regexp_fix = "\\\\$1"; 1205 1205 $link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom ); 1206 1206 1207 1207 $finished = false; 1208 1208 foreach ( $p as $para ) { 1209 1209 if ( $finished ) … … 1238 1238 1239 1239 wp_new_comment($commentdata); 1240 1240 do_action('pingback_post', $wpdb->insert_id); 1241 1241 1242 1242 return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; 1243 1243 } 1244 1244 -
wp-mail.php
81 81 } 82 82 $date_arr = explode(' ', $ddate); 83 83 $date_time = explode(':', $date_arr[3]); 84 84 85 85 $ddate_H = $date_time[0]; 86 86 $ddate_i = $date_time[1]; 87 87 $ddate_s = $date_time[2]; 88 88 89 89 $ddate_m = $date_arr[1]; 90 90 $ddate_d = $date_arr[0]; 91 91 $ddate_Y = $date_arr[2]; -
wp-content/plugins/wp-db-backup.php
36 36 } 37 37 38 38 function wpdbBackup() { 39 39 40 40 add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); 41 41 42 42 $this->backup_dir = trailingslashit($this->backup_dir); 43 43 $this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); 44 44 45 45 if (isset($_POST['do_backup'])) { 46 46 switch($_POST['do_backup']) { 47 47 case 'backup': … … 49 49 break; 50 50 case 'fragments': 51 51 add_action('admin_menu', array(&$this, 'fragment_menu')); 52 break; 52 break; 53 53 } 54 54 } elseif (isset($_GET['fragment'] )) { 55 55 add_action('init', array(&$this, 'init')); … … 59 59 add_action('admin_menu', array(&$this, 'admin_menu')); 60 60 } 61 61 } 62 62 63 63 function init() { 64 64 global $user_level; 65 65 get_currentuserinfo(); … … 68 68 69 69 if (isset($_GET['backup'])) { 70 70 $via = isset($_GET['via']) ? $_GET['via'] : 'http'; 71 71 72 72 $this->backup_file = $_GET['backup']; 73 73 74 74 switch($via) { 75 75 case 'smtp': 76 76 case 'email': … … 101 101 102 102 die(); 103 103 } 104 104 105 105 function build_backup_script() { 106 106 global $table_prefix, $wpdb; 107 107 108 108 $datum = date("Ymd_B"); 109 109 $backup_filename = DB_NAME . "_$table_prefix$datum.sql"; 110 110 if ($this->gzip()) $backup_filename .= '.gz'; 111 111 112 112 echo "<div class='wrap'>"; 113 113 //echo "<pre>" . print_r($_POST, 1) . "</pre>"; 114 114 echo '<h2>' . __('Backup') . '</h2> … … 143 143 } 144 144 145 145 function backup(table, segment) { 146 var fram = document.getElementById("backuploader"); 146 var fram = document.getElementById("backuploader"); 147 147 fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '"; 148 148 } 149 149 150 150 var curStep = 0; 151 151 152 152 function nextStep() { 153 153 backupStep(curStep); 154 154 curStep++; 155 155 } 156 156 157 157 function finishBackup() { 158 var fram = document.getElementById("backuploader"); 158 var fram = document.getElementById("backuploader"); 159 159 setMeter(100); 160 160 '; 161 161 … … 179 179 setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '"); 180 180 '; 181 181 } 182 182 183 183 echo ' 184 184 } 185 185 186 186 function backupStep(step) { 187 187 switch(step) { 188 188 case 0: backup("", 0); break; 189 189 '; 190 190 191 191 $also_backup = array(); 192 192 if (isset($_POST['other_tables'])) { 193 193 $also_backup = $_POST['other_tables']; … … 210 210 $step_count++; 211 211 } 212 212 echo "case {$step_count}: finishBackup(); break;"; 213 213 214 214 echo ' 215 215 } 216 216 if(step != 0) setMeter(100 * step / ' . $step_count . '); … … 224 224 225 225 function backup_fragment($table, $segment, $filename) { 226 226 global $table_prefix, $wpdb; 227 227 228 228 echo "$table:$segment:$filename"; 229 229 230 230 if($table == '') { 231 231 $msg = __('Creating backup file...'); 232 232 } else { … … 236 236 $msg = sprintf(__('Backing up table \\"%s\\"...'), $table); 237 237 } 238 238 } 239 239 240 240 echo '<script type="text/javascript"><!--// 241 241 var msg = "' . $msg . '"; 242 242 window.parent.setProgress(msg); 243 243 '; 244 244 245 245 if (is_writable(ABSPATH . $this->backup_dir)) { 246 246 $this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a'); 247 247 if(!$this->fp) { … … 249 249 $this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.'); 250 250 } 251 251 else { 252 if($table == '') { 252 if($table == '') { 253 253 //Begin new backup of MySql 254 254 $this->stow("# WordPress MySQL database backup\n"); 255 255 $this->stow("#\n"); … … 266 266 $this->stow("# --------------------------------------------------------\n"); 267 267 $this->stow("# Table: " . $this->backquote($table) . "\n"); 268 268 $this->stow("# --------------------------------------------------------\n"); 269 } 269 } 270 270 $this->backup_table($table, $segment); 271 271 } 272 272 } … … 276 276 } 277 277 278 278 if($this->fp) $this->close($this->fp); 279 279 280 280 if($this->backup_errors) { 281 281 foreach($this->backup_errors as $error) { 282 282 echo "window.parent.addError('$error');\n"; … … 294 294 //--></script> 295 295 '; 296 296 } 297 297 298 298 die(); 299 299 } 300 300 … … 304 304 if (isset($_POST['other_tables'])) { 305 305 $also_backup = $_POST['other_tables']; 306 306 } 307 307 308 308 $core_tables = $_POST['core_tables']; 309 309 $this->backup_file = $this->db_backup($core_tables, $also_backup); 310 310 if (FALSE !== $backup_file) { … … 318 318 $this->backup_complete = true; 319 319 } 320 320 } 321 321 322 322 /////////////////////////////// 323 323 function admin_menu() { 324 324 add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu')); … … 387 387 fclose($fp); 388 388 } 389 389 } 390 390 391 391 ////////////// 392 392 function stow($query_line) { 393 393 if ($this->gzip()) { … … 402 402 } 403 403 } 404 404 } 405 405 406 406 function backup_error($err) { 407 407 if(count($this->backup_errors) < 20) { 408 408 $this->backup_errors[] = $err; … … 410 410 $this->backup_errors[] = __('Subsequent errors have been omitted from this log.'); 411 411 } 412 412 } 413 413 414 414 ///////////////////////////// 415 415 function backup_table($table, $segment = 'none') { 416 416 global $wpdb; 417 417 418 418 /* 419 419 Taken partially from phpMyAdmin and partially from 420 420 Alain Wolf, Zurich - Switzerland 421 421 Website: http://restkultur.ch/personal/wolf/scripts/db_backup/ 422 422 423 423 Modified by Scott Merril (http://www.skippy.net/) 424 424 to use the WordPress $wpdb object 425 425 */ … … 429 429 backup_errors(__('Error getting table details') . ": $table"); 430 430 return FALSE; 431 431 } 432 432 433 433 if(($segment == 'none') || ($segment == 0)) { 434 434 // 435 435 // Add SQL statement to drop existing table … … 439 439 $this->stow("#\n"); 440 440 $this->stow("\n"); 441 441 $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n"); 442 442 443 443 // 444 444 //Table structure 445 445 // Comment in SQL-file … … 448 448 $this->stow("# Table structure of table " . $this->backquote($table) . "\n"); 449 449 $this->stow("#\n"); 450 450 $this->stow("\n"); 451 451 452 452 $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N); 453 453 if (FALSE === $create_table) { 454 454 $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table)); 455 455 $this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n"); 456 456 } 457 457 $this->stow($create_table[0][1] . ' ;'); 458 458 459 459 if (FALSE === $table_structure) { 460 460 $this->backup_error(sprintf(__("Error getting table structure of %s"), $table)); 461 461 $this->stow("#\n# Error getting table structure of $table!\n#\n"); 462 462 } 463 463 464 464 // 465 465 // Comment in SQL-file 466 466 $this->stow("\n\n"); … … 468 468 $this->stow('# Data contents of table ' . $this->backquote($table) . "\n"); 469 469 $this->stow("#\n"); 470 470 } 471 471 472 472 if(($segment == 'none') || ($segment >= 0)) { 473 473 $ints = array(); 474 474 foreach ($table_structure as $struct) { … … 481 481 $ints[strtolower($struct->Field)] = "1"; 482 482 } 483 483 } 484 485 484 485 486 486 // Batch by $row_inc 487 487 488 488 if($segment == 'none') { 489 489 $row_start = 0; 490 490 $row_inc = ROWS_PER_SEGMENT; … … 492 492 $row_start = $segment * ROWS_PER_SEGMENT; 493 493 $row_inc = ROWS_PER_SEGMENT; 494 494 } 495 496 do { 495 496 do { 497 497 if ( !ini_get('safe_mode')) @set_time_limit(15*60); 498 498 $table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A); 499 499 … … 503 503 fwrite($fp, "#\n# Error getting table contents fom $table!\n#\n"); 504 504 } 505 505 */ 506 507 $entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES ('; 506 507 $entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES ('; 508 508 // \x08\\x09, not required 509 509 $search = array("\x00", "\x0a", "\x0d", "\x1a"); 510 510 $replace = array('\0', '\n', '\r', '\Z'); … … 524 524 } 525 525 } while((count($table_data) > 0) and ($segment=='none')); 526 526 } 527 528 527 528 529 529 if(($segment == 'none') || ($segment < 0)) { 530 530 // Create footer/closing comment in SQL-file 531 531 $this->stow("\n"); … … 534 534 $this->stow("# --------------------------------------------------------\n"); 535 535 $this->stow("\n"); 536 536 } 537 537 538 538 } // end backup_table() 539 539 540 540 function return_bytes($val) { 541 541 $val = trim($val); 542 542 $last = strtolower($val{strlen($val)-1}); … … 549 549 case 'k': 550 550 $val *= 1024; 551 551 } 552 552 553 553 return $val; 554 554 } 555 555 556 556 //////////////////////////// 557 557 function db_backup($core_tables, $other_tables) { 558 558 global $table_prefix, $wpdb; 559 559 560 560 $datum = date("Ymd_B"); 561 561 $wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql"; 562 562 if ($this->gzip()) { 563 563 $wp_backup_filename .= '.gz'; 564 564 } 565 565 566 566 if (is_writable(ABSPATH . $this->backup_dir)) { 567 567 $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename); 568 568 if(!$this->fp) { … … 573 573 $this->backup_error(__('The backup directory is not writeable!')); 574 574 return false; 575 575 } 576 576 577 577 //Begin new backup of MySql 578 578 $this->stow("# WordPress MySQL database backup\n"); 579 579 $this->stow("#\n"); … … 581 581 $this->stow("# Hostname: " . DB_HOST . "\n"); 582 582 $this->stow("# Database: " . $this->backquote(DB_NAME) . "\n"); 583 583 $this->stow("# --------------------------------------------------------\n"); 584 584 585 585 if ( (is_array($other_tables)) && (count($other_tables) > 0) ) 586 586 $tables = array_merge($core_tables, $other_tables); 587 587 else 588 588 $tables = $core_tables; 589 589 590 590 foreach ($tables as $table) { 591 591 // Increase script execution time-limit to 15 min for every table. 592 592 if ( !ini_get('safe_mode')) @set_time_limit(15*60); … … 596 596 $this->stow("# --------------------------------------------------------\n"); 597 597 $this->backup_table($table); 598 598 } 599 599 600 600 $this->close($this->fp); 601 601 602 602 if (count($this->backup_errors)) { 603 603 return false; 604 604 } else { 605 605 return $wp_backup_filename; 606 606 } 607 607 608 608 } //wp_db_backup 609 609 610 610 /////////////////////////// 611 611 function deliver_backup ($filename = '', $delivery = 'http', $recipient = '') { 612 612 if ('' == $filename) { return FALSE; } 613 613 614 614 $diskfile = ABSPATH . $this->backup_dir . $filename; 615 615 if ('http' == $delivery) { 616 616 if (! file_exists($diskfile)) { … … 640 640 $headers = "MIME-Version: 1.0\n"; 641 641 $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n"; 642 642 $headers .= 'From: ' . get_settings('admin_email') . "\n"; 643 643 644 644 $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); 645 645 // Add a multipart boundary above the plain message 646 646 $message = "This is a multi-part message in MIME format.\n\n" . … … 648 648 "Content-Type: text/plain; charset=\"utf-8\"\n" . 649 649 "Content-Transfer-Encoding: 7bit\n\n" . 650 650 $message . "\n\n"; 651 651 652 652 // Add file attachment to the message 653 653 $message .= "--{$boundary}\n" . 654 654 "Content-Type: application/octet-stream;\n" . … … 658 658 "Content-Transfer-Encoding: base64\n\n" . 659 659 $data . "\n\n" . 660 660 "--{$boundary}--\n"; 661 661 662 662 if (function_exists('wp_mail')) { 663 663 wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); 664 664 } else { 665 665 mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); 666 666 } 667 667 668 668 unlink($diskfile); 669 669 } 670 670 return; 671 671 } 672 672 673 673 //////////////////////////// 674 674 function backup_menu() { 675 675 global $table_prefix, $wpdb; 676 676 $feedback = ''; 677 677 $WHOOPS = FALSE; 678 678 679 679 // did we just do a backup? If so, let's report the status 680 680 if ( $this->backup_complete ) { 681 681 $feedback = '<div class="updated"><p>' . __('Backup Successful') . '!'; … … 698 698 } 699 699 $feedback .= '</p></div>'; 700 700 } 701 701 702 702 if (count($this->backup_errors)) { 703 703 $feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>"; 704 704 foreach($this->backup_errors as $error) { … … 706 706 } 707 707 $feedback .= "</pre></div>"; 708 708 } 709 709 710 710 // did we just save options for wp-cron? 711 711 if ( (function_exists('wp_cron_init')) && isset($_POST['wp_cron_backup_options']) ) { 712 712 update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE); … … 716 716 } 717 717 $feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>'; 718 718 } 719 719 720 720 // Simple table name storage 721 721 $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta'); 722 722 // Apply WP DB prefix to table names 723 723 $wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names); 724 724 725 725 $other_tables = array(); 726 726 $also_backup = array(); 727 728 // Get complete db table list 727 728 // Get complete db table list 729 729 $all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N); 730 730 $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables); 731 731 // Get list of WP tables that actually exist in this DB (for 1.6 compat!) 732 732 $wp_backup_default_tables = array_intersect($all_tables, $wp_table_names); 733 733 // Get list of non-WP tables 734 734 $other_tables = array_diff($all_tables, $wp_backup_default_tables); 735 735 736 736 if ('' != $feedback) { 737 737 echo $feedback; 738 738 } … … 749 749 $WHOOPS = TRUE; 750 750 } 751 751 } 752 752 753 753 if ( !is_writable( ABSPATH . $this->backup_dir) ) { 754 754 echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>"; 755 755 } … … 781 781 echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>'; 782 782 echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> '; 783 783 echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />'; 784 784 785 785 // Check DB dize. 786 786 $table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME)); 787 787 $core_size = $db_size = 0; 788 788 foreach($table_status as $table) { 789 789 $table_size = $table->Data_length - $table->Data_free; 790 790 if(in_array($table->Name, $wp_backup_default_tables)) { 791 $core_size += $table_size; 791 $core_size += $table_size; 792 792 } 793 793 $db_size += $table_size; 794 794 } 795 795 $mem_limit = ini_get('memory_limit'); 796 796 $mem_limit = $this->return_bytes($mem_limit); 797 797 $mem_limit = ($mem_limit == 0) ? 8*1024*1024 : $mem_limit - 2000000; 798 798 799 799 if (! $WHOOPS) { 800 800 echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>'; 801 801 echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>'; … … 804 804 } 805 805 echo '</fieldset>'; 806 806 echo '</form>'; 807 807 808 808 // this stuff only displays if wp_cron is installed 809 809 if (function_exists('wp_cron_init')) { 810 810 echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>'; … … 850 850 echo '</fieldset>'; 851 851 } 852 852 // end of wp_cron section 853 853 854 854 echo '</div>'; 855 855 856 856 }// end wp_backup_menu() 857 857 858 858 ///////////////////////////// 859 859 function wp_cron_daily() { 860 860 861 861 $schedule = intval(get_option('wp_cron_backup_schedule')); 862 862 if (0 == $schedule) { 863 863 // Scheduled backup is disabled 864 864 return; 865 865 } 866 866 867 867 global $table_prefix, $wpdb; 868 868 869 869 $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta'); … … 872 872 $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables); 873 873 $core_tables = array_intersect($all_tables, $wp_table_names); 874 874 $other_tables = get_option('wp_cron_backup_tables'); 875 875 876 876 $recipient = get_option('wp_cron_backup_recipient'); 877 877 878 878 $backup_file = $this->db_backup($core_tables, $other_tables); 879 879 if (FALSE !== $backup_file) { 880 880 $this->deliver_backup ($backup_file, 'smtp', $recipient); 881 881 } 882 882 883 883 return; 884 884 } // wp_cron_db_backup 885 885 } -
wp-content/themes/classic/sidebar.php
11 11 </ul> 12 12 </li> 13 13 <li id="search"> 14 <label for="s"><?php _e('Search:'); ?></label> 14 <label for="s"><?php _e('Search:'); ?></label> 15 15 <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 16 16 <div> 17 17 <input type="text" name="s" id="s" size="15" /><br /> -
wp-content/themes/classic/comments-popup.php
103 103 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> 104 104 <script type="text/javascript"> 105 105 <!-- 106 document.onkeypress = function esc(e) { 106 document.onkeypress = function esc(e) { 107 107 if(typeof(e) == "undefined") { e=event; } 108 108 if (e.keyCode == 27) { self.close(); } 109 109 } -
wp-content/themes/classic/index.php
5 5 <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 6 6 7 7 <?php the_date('','<h2>','</h2>'); ?> 8 8 9 9 <div class="post" id="post-<?php the_ID(); ?>"> 10 10 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> 11 11 <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div> 12 12 13 13 <div class="storycontent"> 14 14 <?php the_content(__('(more...)')); ?> 15 15 </div> 16 16 17 17 <div class="feedback"> 18 18 <?php wp_link_pages(); ?> 19 19 <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?> -
wp-content/themes/classic/header.php
5 5 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 6 6 7 7 <title><?php bloginfo('name'); ?><?php wp_title(); ?></title> 8 8 9 9 <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> 10 10 11 11 <style type="text/css" media="screen"> … … 15 15 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> 16 16 <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> 17 17 <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> 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 ?> -
wp-content/themes/default/style.css
14 14 15 15 The CSS, XHTML and design is released under GPL: 16 16 http://www.opensource.org/licenses/gpl-license.php 17 18 17 18 19 19 *** REGARDING IMAGES *** 20 20 All CSS that involves the use of images, can be found in the 'index.php' file. 21 21 This is to ease installation inside subdirectories of a server. … … 59 59 .widecolumn { 60 60 line-height: 1.6em; 61 61 } 62 62 63 63 .narrowcolumn .postmetadata { 64 64 text-align: center; 65 65 } … … 132 132 .commentlist li, #commentform input, #commentform textarea { 133 133 font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif; 134 134 } 135 135 136 136 .commentlist li { 137 137 font-weight: bold; 138 138 } … … 164 164 small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike { 165 165 color: #777; 166 166 } 167 167 168 168 code { 169 169 font: 1.1em 'Courier New', Courier, Fixed; 170 170 } … … 184 184 color: #147; 185 185 text-decoration: underline; 186 186 } 187 187 188 188 #wp-calendar #prev a { 189 189 font-size: 9pt; 190 190 } … … 219 219 width: 760px; 220 220 border: 1px solid #959596; 221 221 } 222 222 223 223 #header { 224 224 padding: 0; 225 225 margin: 0 auto; … … 246 246 margin: 5px 0 0 150px; 247 247 width: 450px; 248 248 } 249 249 250 250 .post { 251 251 margin: 0 0 40px; 252 252 text-align: justify; … … 339 339 thought?!) align the image to the right. And using 'class="centered', 340 340 will of course center the image. This is much better than using 341 341 align="center", being much more futureproof (and valid) */ 342 342 343 343 img.centered { 344 344 display: block; 345 345 margin-left: auto; 346 346 margin-right: auto; 347 347 } 348 348 349 349 img.alignright { 350 350 padding: 4px; 351 351 margin: 0 0 2px 7px; … … 361 361 .alignright { 362 362 float: right; 363 363 } 364 364 365 365 .alignleft { 366 366 float: left 367 367 } … … 405 405 list-style-type: none; 406 406 list-style-image: none; 407 407 } 408 408 409 409 #sidebar ul, #sidebar ul ol { 410 410 margin: 0; 411 411 padding: 0; -
wp-content/themes/default/archives.php
20 20 <?php wp_list_cats(); ?> 21 21 </ul> 22 22 23 </div> 23 </div> 24 24 25 25 <?php get_footer(); ?> -
wp-content/themes/default/search.php
5 5 <?php if (have_posts()) : ?> 6 6 7 7 <h2 class="pagetitle">Search Results</h2> 8 8 9 9 <div class="navigation"> 10 10 <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> 11 11 <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> … … 13 13 14 14 15 15 <?php while (have_posts()) : the_post(); ?> 16 16 17 17 <div class="post"> 18 18 <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3> 19 19 <small><?php the_time('l, F jS, Y') ?></small> 20 20 21 21 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 22 22 </div> 23 23 24 24 <?php endwhile; ?> 25 25 26 26 <div class="navigation"> 27 27 <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> 28 28 <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> 29 29 </div> 30 30 31 31 <?php else : ?> 32 32 33 33 <h2 class="center">No posts found. Try a different search?</h2> 34 34 <?php include (TEMPLATEPATH . '/searchform.php'); ?> 35 35 36 36 <?php endif; ?> 37 37 38 38 </div> 39 39 40 40 <?php get_sidebar(); ?> -
wp-content/themes/default/index.php
3 3 <div id="content" class="narrowcolumn"> 4 4 5 5 <?php if (have_posts()) : ?> 6 6 7 7 <?php while (have_posts()) : the_post(); ?> 8 8 9 9 <div class="post" id="post-<?php the_ID(); ?>"> 10 10 <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> 11 11 <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> 12 12 13 13 <div class="entry"> 14 14 <?php the_content('Read the rest of this entry »'); ?> 15 15 </div> 16 16 17 17 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 18 18 </div> 19 19 20 20 <?php endwhile; ?> 21 21 22 22 <div class="navigation"> 23 23 <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> 24 24 <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> 25 25 </div> 26 26 27 27 <?php else : ?> 28 28 29 29 <h2 class="center">Not Found</h2> -
wp-content/themes/default/functions.php
57 57 $color = kubrick_header_color(); 58 58 if ( false === $color ) 59 59 return 'white'; 60 60 61 61 return $color; 62 62 } 63 63 … … 100 100 } 101 101 } 102 102 } else { 103 103 104 104 if ( isset($_REQUEST['headerimage']) ) { 105 105 if ( '' == $_REQUEST['headerimage'] ) 106 106 delete_option('kubrick_header_image'); 107 107 else 108 108 update_option('kubrick_header_image', $_REQUEST['headerimage']); 109 109 } 110 110 111 111 if ( isset($_REQUEST['fontcolor']) ) { 112 112 if ( '' == $_REQUEST['fontcolor'] ) 113 113 delete_option('kubrick_header_color'); 114 114 else 115 115 update_option('kubrick_header_color', $_REQUEST['fontcolor']); 116 116 } 117 117 118 118 if ( isset($_REQUEST['fontdisplay']) ) { 119 119 if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] ) 120 120 delete_option('kubrick_header_display'); … … 268 268 font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; 269 269 font-size: 1.2em; 270 270 text-align: center; 271 } 271 } 272 272 #kubrick-header #header { 273 273 text-decoration: none; 274 274 color: <?php echo kubrick_header_color_string(); ?>; -
wp-content/themes/default/sidebar.php
1 1 <div id="sidebar"> 2 2 <ul> 3 3 4 4 <li> 5 5 <?php include (TEMPLATEPATH . '/searchform.php'); ?> 6 6 </li> … … 15 15 <?php /* If this is a 404 page */ if (is_404()) { ?> 16 16 <?php /* If this is a category archive */ } elseif (is_category()) { ?> 17 17 <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p> 18 18 19 19 <?php /* If this is a yearly archive */ } elseif (is_day()) { ?> 20 20 <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 21 21 for the day <?php the_time('l, F jS, Y'); ?>.</p> 22 22 23 23 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 24 24 <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives 25 25 for <?php the_time('F, Y'); ?>.</p> … … 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 echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> … … 52 52 </ul> 53 53 </li> 54 54 55 <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> 55 <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> 56 56 <?php get_links_list(); ?> 57 57 58 58 <li><h2>Meta</h2> 59 59 <ul> 60 60 <?php wp_register(); ?> … … 66 66 </ul> 67 67 </li> 68 68 <?php } ?> 69 69 70 70 </ul> 71 71 </div> 72 72 -
wp-content/themes/default/page.php
7 7 <h2><?php the_title(); ?></h2> 8 8 <div class="entrytext"> 9 9 <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> 10 10 11 11 <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> 12 12 13 13 </div> 14 14 </div> 15 15 <?php endwhile; endif; ?> -
wp-content/themes/default/links.php
Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
13 13 <?php get_links_list(); ?> 14 14 </ul> 15 15 16 </div> 16 </div> 17 17 18 18 <?php get_footer(); ?> -
wp-content/themes/default/single.php
1 1 <?php get_header(); ?> 2 2 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"> 8 8 <div class="alignleft"><?php previous_post_link('« %link') ?></div> 9 9 <div class="alignright"><?php next_post_link('%link »') ?></div> 10 10 </div> 11 11 12 12 <div class="post" id="post-<?php the_ID(); ?>"> 13 13 <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2> 14 14 15 15 <div class="entrytext"> 16 16 <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?> 17 17 18 18 <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> 19 19 20 20 <p class="postmetadata alt"> 21 21 <small> 22 22 This entry was posted … … 27 27 on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> 28 28 and is filed under <?php the_category(', ') ?>. 29 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)) { 32 32 // Both Comments and Pings are open ?> 33 33 You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site. 34 34 35 35 <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { 36 36 // Only Pings are Open ?> 37 37 Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site. 38 38 39 39 <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { 40 40 // Comments are open, Pings are not ?> 41 41 You can skip to the end and leave a response. Pinging is currently not allowed. 42 42 43 43 <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { 44 44 // Neither Comments, nor Pings are open ?> 45 Both comments and pings are currently closed. 46 45 Both comments and pings are currently closed. 46 47 47 <?php } edit_post_link('Edit this entry.','',''); ?> 48 48 49 49 </small> 50 50 </p> 51 51 52 52 </div> 53 53 </div> 54 54 55 55 <?php comments_template(); ?> 56 56 57 57 <?php endwhile; else: ?> 58 58 59 59 <p>Sorry, no posts matched your criteria.</p> 60 60 61 61 <?php endif; ?> 62 62 63 63 </div> 64 64 65 65 <?php get_footer(); ?> -
wp-content/themes/default/archive.php
5 5 <?php if (have_posts()) : ?> 6 6 7 7 <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 8 <?php /* If this is a category archive */ if (is_category()) { ?> 8 <?php /* If this is a category archive */ if (is_category()) { ?> 9 9 <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2> 10 10 11 11 <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 12 12 <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> 13 13 14 14 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 15 15 <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2> 16 16 17 17 <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 18 18 <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2> 19 19 20 20 <?php /* If this is a search */ } elseif (is_search()) { ?> 21 21 <h2 class="pagetitle">Search Results</h2> 22 22 23 23 <?php /* If this is an author archive */ } elseif (is_author()) { ?> 24 24 <h2 class="pagetitle">Author Archive</h2> 25 25 … … 38 38 <div class="post"> 39 39 <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3> 40 40 <small><?php the_time('l, F jS, Y') ?></small> 41 41 42 42 <div class="entry"> 43 43 <?php the_content() ?> 44 44 </div> 45 45 46 46 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 47 47 48 48 </div> 49 49 50 50 <?php endwhile; ?> 51 51 52 52 <div class="navigation"> 53 53 <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> 54 54 <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> 55 55 </div> 56 56 57 57 <?php else : ?> 58 58 59 59 <h2 class="center">Not Found</h2> 60 60 <?php include (TEMPLATEPATH . '/searchform.php'); ?> 61 61 62 62 <?php endif; ?> 63 63 64 64 </div> 65 65 66 66 <?php get_sidebar(); ?> -
wp-content/themes/default/comments.php
5 5 if (!empty($post->post_password)) { // if there's a password 6 6 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie 7 7 ?> 8 8 9 9 <p class="nocomments">This post is password protected. Enter the password to view comments.<p> 10 10 11 11 <?php 12 12 return; 13 13 } … … 39 39 40 40 </li> 41 41 42 <?php /* Changes every other comment to a different class */ 42 <?php /* Changes every other comment to a different class */ 43 43 if ('alt' == $oddcomment) $oddcomment = ''; 44 44 else $oddcomment = 'alt'; 45 45 ?> … … 52 52 53 53 <?php if ('open' == $post->comment_status) : ?> 54 54 <!-- If comments are open, but there are no comments. --> 55 55 56 56 <?php else : // comments are closed ?> 57 57 <!-- If comments are closed. --> 58 58 <p class="nocomments">Comments are closed.</p> 59 59 60 60 <?php endif; ?> 61 61 <?php endif; ?> 62 62 -
wp-content/themes/default/comments-popup.php
103 103 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> 104 104 <script type="text/javascript"> 105 105 <!-- 106 document.onkeypress = function esc(e) { 106 document.onkeypress = function esc(e) { 107 107 if(typeof(e) == "undefined") { e=event; } 108 108 if (e.keyCode == 27) { self.close(); } 109 109 } -
wp-content/themes/default/header.php
16 16 /* To accomodate differing install paths of WordPress, images are referred only here, 17 17 and not in the wp-layout.css file. If you prefer to use only CSS for colors and what 18 18 not, then go right ahead and delete the following lines, and the image files. */ 19 20 body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } 19 20 body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } 21 21 <?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?> 22 22 #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } 23 23 <?php } else { // No sidebar ?> … … 28 28 29 29 /* Because the template is slightly different, size-wise, with images, this needs to be set here 30 30 If you don't want to use the template's images, you can also delete the following two lines. */ 31 31 32 32 #header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; } 33 33 #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } 34 34 -
wp-content/themes/default/attachment.php
1 1 <?php get_header(); ?> 2 2 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"> 8 8 <div class="alignleft"> </div> 9 9 <div class="alignright"> </div> … … 16 16 <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p> 17 17 18 18 <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?> 19 19 20 20 <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> 21 21 22 22 <p class="postmetadata alt"> 23 23 <small> 24 24 This entry was posted … … 29 29 on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> 30 30 and is filed under <?php the_category(', ') ?>. 31 31 You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. 32 32 33 33 <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { 34 34 // Both Comments and Pings are open ?> 35 35 You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site. 36 36 37 37 <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { 38 38 // Only Pings are Open ?> 39 39 Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site. 40 40 41 41 <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { 42 42 // Comments are open, Pings are not ?> 43 43 You can skip to the end and leave a response. Pinging is currently not allowed. 44 44 45 45 <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { 46 46 // Neither Comments, nor Pings are open ?> 47 Both comments and pings are currently closed. 48 47 Both comments and pings are currently closed. 48 49 49 <?php } edit_post_link('Edit this entry.','',''); ?> 50 50 51 51 </small> 52 52 </p> 53 53 54 54 </div> 55 55 </div> 56 56 57 57 <?php comments_template(); ?> 58 58 59 59 <?php endwhile; else: ?> 60 60 61 61 <p>Sorry, no attachments matched your criteria.</p> 62 62 63 63 <?php endif; ?> 64 64 65 65 </div> 66 66 67 67 <?php get_footer(); ?> -
wp-register.php
14 14 15 15 $user_login = sanitize_user( $_POST['user_login'] ); 16 16 $user_email = $_POST['user_email']; 17 17 18 18 $errors = array(); 19 19 20 20 if ( $user_login == '' ) 21 21 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); 22 22 … … 45 45 else 46 46 wp_new_user_notification($user_id, $password); 47 47 } 48 48 49 49 if ( 0 == count($errors) ) { 50 50 51 51 ?> … … 53 53 <html xmlns="http://www.w3.org/1999/xhtml"> 54 54 <head> 55 55 <title>WordPress » <?php _e('Registration Complete') ?></title> 56 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 56 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 57 57 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" /> 58 58 <style type="text/css"> 59 59 .submit { -
readme.html
16 16 margin-right: 25%; 17 17 padding: .2em 2em; 18 18 } 19 19 20 20 h1 { 21 21 color: #006; 22 22 font-size: 18px; 23 23 font-weight: lighter; 24 24 } 25 25 26 26 h2 { 27 27 font-size: 16px; 28 28 } 29 29 30 30 p, li, dt { 31 31 line-height: 140%; 32 32 padding-bottom: 2px; -
wp-commentsrss2.php
56 56 $title = apply_filters('the_title', $title); 57 57 $title = apply_filters('the_title_rss', $title); 58 58 printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 59 } else { 60 printf(__('by: %s'), get_comment_author_rss()); 59 } else { 60 printf(__('by: %s'), get_comment_author_rss()); 61 61 } ?></title> 62 62 <link><?php comment_link() ?></link> 63 63 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> -
wp-settings.php
9 9 10 10 // Variables that shouldn't be unset 11 11 $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); 12 12 13 13 $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); 14 14 foreach ( $input as $k => $v ) 15 15 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) … … 27 27 // Fix for IIS, which doesn't set REQUEST_URI 28 28 if ( empty( $_SERVER['REQUEST_URI'] ) ) { 29 29 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI? 30 30 31 31 // Append the query string if it exists and isn't null 32 32 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 33 33 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; -
wp-admin/menu-header.php
13 13 14 14 if ( current_user_can($item[1]) ) { 15 15 if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") ) 16 echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; 16 echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; 17 17 else 18 18 echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; 19 19 } -
wp-admin/users.php
4 4 5 5 $title = __('Users'); 6 6 $parent_file = 'profile.php'; 7 7 8 8 $action = $_REQUEST['action']; 9 9 $update = ''; 10 10 … … 32 32 $user = new WP_User($id); 33 33 $user->set_role($_POST['new_role']); 34 34 } 35 35 36 36 header('Location: users.php?update=' . $update); 37 37 38 38 break; … … 49 49 die(__('You can’t delete users.')); 50 50 51 51 $userids = $_POST['users']; 52 52 53 53 $update = 'del'; 54 54 foreach ($userids as $id) { 55 55 if($id == $current_user->id) { … … 132 132 133 133 case 'adduser': 134 134 check_admin_referer(); 135 135 136 136 $errors = add_user(); 137 137 138 138 if(count($errors) == 0) { 139 139 header('Location: users.php?update=add'); 140 140 die(); 141 141 } 142 142 143 143 default: 144 144 145 145 include ('admin-header.php'); 146 146 147 147 $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;"); 148 148 149 149 foreach($userids as $userid) { 150 150 $tmp_user = new WP_User($userid); 151 151 $roles = $tmp_user->roles; 152 152 $role = array_shift($roles); 153 153 $roleclasses[$role][$tmp_user->user_login] = $tmp_user; 154 } 155 154 } 155 156 156 ?> 157 157 158 158 <?php … … 198 198 <?php 199 199 endif; 200 200 ?> 201 201 202 202 <form action="" method="post" name="updateusers" id="updateusers"> 203 203 <div class="wrap"> 204 204 <h2><?php _e('User List by Role'); ?></h2> … … 250 250 echo '</td>'; 251 251 echo '</tr>'; 252 252 } 253 253 254 254 ?> 255 256 255 256 257 257 <?php 258 258 } 259 259 ?> -
wp-admin/edit-comments.php
88 88 if ($i % 2) 89 89 $class .= ' alternate'; 90 90 echo "<li id='comment-$comment->comment_ID' class='$class'>"; 91 ?> 91 ?> 92 92 <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 93 93 94 94 <?php comment_text() ?> 95 95 96 96 <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); … … 118 118 ?> 119 119 <p> 120 120 <strong><?php _e('No comments found.') ?></strong></p> 121 121 122 122 <?php 123 123 } // end if ($comments) 124 124 } elseif ('edit' == $mode) { -
wp-admin/list-manipulation.php
54 54 55 55 if ( !$comment = get_comment($id) ) 56 56 die('0'); 57 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 57 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 58 58 die('-1'); 59 59 60 60 if ( wp_delete_comment($comment->comment_ID) ) { … … 77 77 die('0'); 78 78 } 79 79 break; 80 endswitch; 80 endswitch; 81 81 ?> -
wp-admin/edit-form-ajax-cat.php
17 17 18 18 foreach ($names as $cat_name) { 19 19 $cat_name = trim( $cat_name ); 20 20 21 21 if ( !$category_nicename = sanitize_title($cat_name) ) 22 22 continue; 23 23 if ( $already = category_exists($cat_name) ) { 24 24 $ids[] = (string) $already; 25 25 continue; 26 26 } 27 27 28 28 $new_cat_id = wp_create_category($cat_name); 29 29 30 30 $ids[] = (string) $new_cat_id; 31 31 } 32 32 -
wp-admin/wp-admin.css
872 872 .dbx-handle-cursor { 873 873 cursor: move; 874 874 } 875 875 876 876 /* toggle images */ 877 877 a.dbx-toggle, a.dbx-toggle:visited { 878 878 display:block; -
wp-admin/xfn.js
38 38 39 39 var aInputs = document.getElementsByTagName('input'); 40 40 41 for (var i = 0; i < aInputs.length; i++) { 41 for (var i = 0; i < aInputs.length; i++) { 42 42 aInputs[i].onclick = aInputs[i].onkeyup = upit; 43 43 } 44 44 } -
wp-admin/plugins.php
3 3 4 4 if ( isset($_GET['action']) ) { 5 5 check_admin_referer(); 6 6 7 7 if ('activate' == $_GET['action']) { 8 8 $current = get_settings('active_plugins'); 9 9 if (!in_array($_GET['plugin'], $current)) { … … 36 36 // empty array. 37 37 if ( !is_array($check_plugins) ) { 38 38 $check_plugins = array(); 39 update_option('active_plugins', $check_plugins); 39 update_option('active_plugins', $check_plugins); 40 40 } 41 41 42 42 // If a plugin file does not exist, remove it from the list of active … … 91 91 function sort_plugins($plug1, $plug2) { 92 92 return strnatcasecmp($plug1['Name'], $plug2['Name']); 93 93 } 94 94 95 95 uksort($plugins, 'sort_plugins'); 96 96 97 97 foreach($plugins as $plugin_file => $plugin_data) { -
wp-admin/cat-js.php
67 67 var id = 0; 68 68 var ids = new Array(); 69 69 var names = new Array(); 70 70 71 71 ids = myPload( ajaxCat.response ); 72 72 names = myPload( newcat.value ); 73 73 for ( i = 0; i < ids.length; i++ ) { … … 80 80 p.innerHTML = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>"; 81 81 return; 82 82 } 83 83 84 84 var exists = document.getElementById('category-' + id); 85 85 86 86 if (exists) { 87 87 var moveIt = exists.parentNode; 88 88 var container = moveIt.parentNode; … … 100 100 newLabel.setAttribute('for', 'category-' + id); 101 101 newLabel.id = 'new-category-' + id; 102 102 newLabel.className = 'selectit fade'; 103 103 104 104 var newCheck = document.createElement('input'); 105 105 newCheck.type = 'checkbox'; 106 106 newCheck.value = id; 107 107 newCheck.name = 'post_category[]'; 108 108 newCheck.id = 'category-' + id; 109 109 newLabel.appendChild(newCheck); 110 110 111 111 var newLabelText = document.createTextNode(' ' + names[i]); 112 112 newLabel.appendChild(newLabelText); 113 113 114 114 catDiv.insertBefore(newLabel, catDiv.firstChild); 115 115 newCheck.checked = 'checked'; 116 116 117 117 Fat.fade_all(); 118 118 newLabel.className = 'selectit'; 119 119 } -
wp-admin/post.php
71 71 die ( __('You are not allowed to edit this post.') ); 72 72 73 73 $post = get_post_to_edit($post_ID); 74 74 75 75 if ($post->post_type == 'page') 76 76 include('edit-page-form.php'); 77 77 else … … 130 130 $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']); 131 131 132 132 $post = & get_post($post_id); 133 134 if ( !current_user_can('edit_post', $post_id) ) 133 134 if ( !current_user_can('edit_post', $post_id) ) 135 135 die( __('You are not allowed to delete this post.') ); 136 136 137 137 if ( $post->post_type == 'attachment' ) { … … 161 161 if ( ! $comment = get_comment($comment) ) 162 162 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 163 163 164 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 164 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 165 165 die( __('You are not allowed to edit comments on this post.') ); 166 166 167 167 $comment = get_comment_to_edit($comment); … … 180 180 if ( ! $comment = get_comment($comment) ) 181 181 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 182 182 183 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 183 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 184 184 die( __('You are not allowed to delete comments on this post.') ); 185 185 186 186 echo "<div class='wrap'>\n"; … … 223 223 if ( ! $comment = get_comment($comment) ) 224 224 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 225 225 226 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 226 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 227 227 die( __('You are not allowed to edit comments on this post.') ); 228 228 229 229 wp_set_comment_status($comment->comment_ID, "delete"); … … 252 252 if ( ! $comment = get_comment($comment) ) 253 253 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 254 254 255 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 255 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 256 256 die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 257 257 258 258 wp_set_comment_status($comment->comment_ID, "hold"); … … 272 272 if ( ! $comment = get_comment($comment) ) 273 273 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 274 274 275 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 275 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 276 276 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 277 277 278 278 if ('1' != $comment->comment_approved) { … … 298 298 if ( ! $comment = get_comment($comment) ) 299 299 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 300 300 301 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 301 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 302 302 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 303 303 304 304 wp_set_comment_status($comment->comment_ID, "approve"); -
wp-admin/edit.php
93 93 <legend><?php _e('Browse Month…') ?></legend> 94 94 <select name='m'> 95 95 <?php 96 foreach ($arc_result as $arc_row) { 96 foreach ($arc_result as $arc_row) { 97 97 $arc_year = $arc_row->yyear; 98 98 $arc_month = $arc_row->mmonth; 99 99 100 100 if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] ) 101 101 $default = 'selected="selected"'; 102 102 else 103 103 $default = null; 104 104 105 105 echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">'; 106 106 echo $month[zeroise($arc_month, 2)] . " $arc_year"; 107 107 echo "</option>\n"; … … 157 157 foreach($posts_columns as $column_name=>$column_display_name) { 158 158 159 159 switch($column_name) { 160 160 161 161 case 'id': 162 162 ?> 163 163 <th scope="row"><?php echo $id ?></th> -
wp-admin/theme-editor.php
66 66 break; 67 67 68 68 default: 69 69 70 70 require_once('admin-header.php'); 71 71 if ( !current_user_can('edit_themes') ) 72 72 die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>'); 73 73 74 74 update_recently_edited($file); 75 75 76 76 if (!is_file($real_file)) 77 77 $error = 1; 78 78 79 79 if (!$error && filesize($real_file) > 0) { 80 80 $f = fopen($real_file, 'r'); 81 81 $content = fread($f, filesize($real_file)); -
wp-admin/upgrade.php
27 27 margin-right: 20%; 28 28 padding: .2em 2em; 29 29 } 30 30 31 31 h1 { 32 32 color: #006; 33 33 font-size: 18px; 34 34 font-weight: lighter; 35 35 } 36 36 37 37 h2 { 38 38 font-size: 16px; 39 39 } 40 40 41 41 p, li, dt { 42 42 line-height: 140%; 43 43 padding-bottom: 2px; … … 73 73 <h2 class="step"><a href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress »'); ?></a></h2> 74 74 <?php 75 75 break; 76 76 77 77 case 1: 78 78 wp_cache_flush(); 79 79 make_db_current_silent(); -
wp-admin/admin.php
53 53 if ( $page_hook ) { 54 54 if (! isset($_GET['noheader'])) 55 55 require_once(ABSPATH . '/wp-admin/admin-header.php'); 56 56 57 57 do_action($page_hook); 58 58 } else { 59 59 if ( validate_file($plugin_page) ) { 60 60 die(__('Invalid plugin page')); 61 61 } 62 62 63 63 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) 64 64 die(sprintf(__('Cannot load %s.'), $plugin_page)); 65 65 66 66 if (! isset($_GET['noheader'])) 67 67 require_once(ABSPATH . '/wp-admin/admin-header.php'); 68 68 69 69 include(ABSPATH . "wp-content/plugins/$plugin_page"); 70 70 } 71 71 72 72 include(ABSPATH . 'wp-admin/admin-footer.php'); 73 73 74 74 exit(); 75 75 } else if (isset($_GET['import'])) { 76 76 77 77 $importer = $_GET['import']; 78 78 79 79 if ( validate_file($importer) ) { 80 80 die(__('Invalid importer.')); 81 81 } 82 82 83 83 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) 84 84 die(__('Cannot load importer.')); 85 85 86 86 include(ABSPATH . "wp-admin/import/$importer.php"); 87 87 88 88 $parent_file = 'import.php'; 89 89 $title = __('Import'); 90 90 91 91 if (! isset($_GET['noheader'])) 92 92 require_once(ABSPATH . 'wp-admin/admin-header.php'); 93 93 … … 97 97 kses_init_filters(); // Always filter imported data with kses. 98 98 99 99 call_user_func($wp_importers[$importer][2]); 100 100 101 101 include(ABSPATH . 'wp-admin/admin-footer.php'); 102 102 103 103 exit(); -
wp-admin/options.php
28 28 29 29 case 'update': 30 30 $any_changed = 0; 31 31 32 32 check_admin_referer(); 33 33 34 34 if (!$_POST['page_options']) { … … 52 52 $value = trim(stripslashes($_POST[$option])); 53 53 if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) 54 54 $value = 'closed'; 55 55 56 56 if( $option == 'blogdescription' || $option == 'blogname' ) 57 57 if (current_user_can('unfiltered_html') == false) 58 58 $value = wp_filter_post_kses( $value ); 59 59 60 60 if (update_option($option, $value) ) { 61 61 $any_changed++; 62 62 } -
wp-admin/upgrade-functions.php
20 20 if ( !empty($template) ) 21 21 $wp_current_db_version = 2541; 22 22 } 23 23 24 24 populate_options(); 25 25 26 26 if ( $wp_current_db_version < 2541 ) { … … 29 29 upgrade_110(); 30 30 upgrade_130(); 31 31 } 32 32 33 33 if ( $wp_current_db_version < 3308 ) 34 34 upgrade_160(); 35 35 … … 37 37 upgrade_210(); 38 38 39 39 $wp_rewrite->flush_rules(); 40 40 41 41 update_option('db_version', $wp_db_version); 42 42 } 43 43 … … 54 54 } 55 55 } 56 56 } 57 57 58 58 $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); 59 59 foreach ($categories as $category) { 60 60 if ('' == $category->category_nicename) { … … 77 77 else: 78 78 $catwhere = ''; 79 79 endif; 80 80 81 81 $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere"); 82 82 if ($allposts) : 83 83 foreach ($allposts as $post) { … … 111 111 112 112 function upgrade_110() { 113 113 global $wpdb; 114 114 115 115 // Set user_nicename. 116 116 $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 117 117 foreach ($users as $user) { … … 280 280 $id = $wpdb->escape( $id ); 281 281 $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'"); 282 282 endif; 283 283 284 284 // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. 285 285 $caps = get_usermeta( $user->ID, $table_prefix . 'capabilities'); 286 286 if ( empty($caps) || defined('RESET_CAPS') ) { … … 288 288 $role = translate_level_to_role($level); 289 289 update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) ); 290 290 } 291 291 292 292 endforeach; 293 293 $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' ); 294 294 $wpdb->hide_errors(); 295 295 foreach ( $old_user_fields as $old ) 296 296 $wpdb->query("ALTER TABLE $wpdb->users DROP $old"); 297 297 $wpdb->show_errors(); 298 298 299 299 if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts 300 300 $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); 301 301 foreach ( $categories as $cat_id ) { … … 321 321 post_mime_type = '$object->post_type', 322 322 post_type = '' 323 323 WHERE ID = $object->ID"); 324 324 325 325 $meta = get_post_meta($object->ID, 'imagedata', true); 326 326 if ( ! empty($meta['file']) ) 327 327 add_post_meta($object->ID, '_wp_attached_file', $meta['file']); … … 335 335 if ( $wp_current_db_version < 3506 ) { 336 336 // Update status and type. 337 337 $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); 338 338 339 339 if ( ! empty($posts) ) foreach ($posts as $post) { 340 340 $status = $post->post_status; 341 341 $type = 'post'; … … 345 345 $type = 'page'; 346 346 } else if ( 'attachment' == $status ) { 347 347 $status = 'inherit'; 348 $type = 'attachment'; 348 $type = 'attachment'; 349 349 } 350 350 351 351 $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'"); 352 352 } 353 353 } 354 354 355 355 if ( $wp_current_db_version < 3513 ) { 356 populate_roles_210(); 356 populate_roles_210(); 357 357 } 358 358 } 359 359 … … 477 477 478 478 function dbDelta($queries, $execute = true) { 479 479 global $wpdb; 480 480 481 481 // Seperate individual queries into an array 482 482 if( !is_array($queries) ) { 483 483 $queries = explode( ';', $queries ); 484 484 if('' == $queries[count($queries) - 1]) array_pop($queries); 485 485 } 486 486 487 487 $cqueries = array(); // Creation Queries 488 488 $iqueries = array(); // Insertion Queries 489 489 $for_update = array(); 490 490 491 491 // Create a tablename index for an array ($cqueries) of queries 492 492 foreach($queries as $qry) { 493 493 if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { … … 506 506 else { 507 507 // Unrecognized query type 508 508 } 509 } 509 } 510 510 511 511 // Check to see which tables and fields exist 512 512 if($tables = $wpdb->get_col('SHOW TABLES;')) { … … 525 525 $flds = explode("\n", $qryline); 526 526 527 527 //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>"; 528 528 529 529 // For every field line specified in the query 530 530 foreach($flds as $fld) { 531 531 // Extract the field name 532 532 preg_match("|^([^ ]*)|", trim($fld), $fvals); 533 533 $fieldname = $fvals[1]; 534 534 535 535 // Verify the found field name 536 536 $validfield = true; 537 537 switch(strtolower($fieldname)) … … 547 547 break; 548 548 } 549 549 $fld = trim($fld); 550 550 551 551 // If it's a valid field, add it to the field array 552 552 if($validfield) { 553 553 $cfields[strtolower($fieldname)] = trim($fld, ", \n"); 554 554 } 555 555 } 556 556 557 557 // Fetch the table column structure from the database 558 558 $tablefields = $wpdb->get_results("DESCRIBE {$table};"); 559 559 560 560 // For every field in the table 561 foreach($tablefields as $tablefield) { 561 foreach($tablefields as $tablefield) { 562 562 // If the table field exists in the field array... 563 563 if(array_key_exists(strtolower($tablefield->Field), $cfields)) { 564 564 // Get the field type from the query … … 571 571 $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; 572 572 $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; 573 573 } 574 574 575 575 // Get the default value from the array 576 576 //echo "{$cfields[strtolower($tablefield->Field)]}<br>"; 577 577 if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) { … … 598 598 $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; 599 599 $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname; 600 600 } 601 601 602 602 // Index stuff goes here 603 603 // Fetch the table index structure from the database 604 604 $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};"); 605 605 606 606 if($tableindices) { 607 607 // Clear the index array 608 608 unset($index_ary); … … 631 631 } 632 632 $index_columns = ''; 633 633 // For each column in the index 634 foreach($index_data['columns'] as $column_data) { 634 foreach($index_data['columns'] as $column_data) { 635 635 if($index_columns != '') $index_columns .= ','; 636 636 // Add the field to the column list string 637 637 $index_columns .= $column_data['fieldname']; -
wp-admin/list-manipulation.js
51 51 listItems.splice(pos,1); 52 52 recolorList(pos); 53 53 ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement); 54 54 55 55 } 56 56 } 57 57 … … 63 63 } 64 64 } 65 65 return pos; 66 } 66 } 67 67 68 68 function getListItems() { 69 69 if (list) return; -
wp-admin/admin-functions.php
6 6 7 7 if ( 'page' == $_POST['post_type'] ) { 8 8 if ( !current_user_can('edit_pages') ) 9 die(__('You are not allowed to create pages on this blog.')); 9 die(__('You are not allowed to create pages on this blog.')); 10 10 } else { 11 11 if ( !current_user_can('edit_posts') ) 12 12 die(__('You are not allowed to create posts or drafts on this blog.')); … … 30 30 } 31 31 32 32 if ($_POST['post_author'] != $_POST['user_ID']) { 33 if ( 'page' == $_POST['post_type'] ) { 33 if ( 'page' == $_POST['post_type'] ) { 34 34 if ( !current_user_can('edit_others_pages') ) 35 35 die(__('You cannot create pages as this user.')); 36 36 } else { 37 37 if ( !current_user_can('edit_others_posts') ) 38 38 die(__('You cannot post as this user.')); 39 39 40 40 } 41 41 } 42 42 … … 52 52 53 53 if ( 'page' == $_POST['post_type'] ) { 54 54 if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages')) 55 $_POST['post_status'] = 'draft'; 55 $_POST['post_status'] = 'draft'; 56 56 } else { 57 57 if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) 58 58 $_POST['post_status'] = 'draft'; … … 140 140 141 141 if ( 'page' == $_POST['post_type'] ) { 142 142 if ( !current_user_can('edit_page', $post_ID) ) 143 die(__('You are not allowed to edit this page.')); 143 die(__('You are not allowed to edit this page.')); 144 144 } else { 145 145 if ( !current_user_can('edit_post', $post_ID) ) 146 146 die(__('You are not allowed to edit this post.')); … … 163 163 } 164 164 165 165 if ($_POST['post_author'] != $_POST['user_ID']) { 166 if ( 'page' == $_POST['post_type'] ) { 166 if ( 'page' == $_POST['post_type'] ) { 167 167 if ( !current_user_can('edit_others_pages') ) 168 168 die(__('You cannot edit pages as this user.')); 169 169 } else { 170 170 if ( !current_user_can('edit_others_posts') ) 171 171 die(__('You cannot edit posts as this user.')); 172 172 173 173 } 174 174 } 175 175 … … 185 185 186 186 if ( 'page' == $_POST['post_type'] ) { 187 187 if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages')) 188 $_POST['post_status'] = 'draft'; 188 $_POST['post_status'] = 'draft'; 189 189 } else { 190 190 if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts')) 191 191 $_POST['post_status'] = 'draft'; … … 217 217 foreach ($_POST['meta'] as $key => $value) 218 218 update_meta($key, $value['key'], $value['value']); 219 219 } 220 220 221 221 if ($_POST['deletemeta']) { 222 222 foreach ($_POST['deletemeta'] as $key => $value) 223 223 delete_meta($key); … … 464 464 465 465 function get_link_to_edit($link_id) { 466 466 $link = get_link($link_id); 467 467 468 468 $link->link_url = wp_specialchars($link->link_url, 1); 469 469 $link->link_name = wp_specialchars($link->link_name, 1); 470 470 $link->link_description = wp_specialchars($link->link_description); 471 471 $link->link_notes = wp_specialchars($link->link_notes); 472 472 $link->link_rss = wp_specialchars($link->link_rss); 473 473 474 474 return $link; 475 475 } 476 476 … … 479 479 $link->link_url = wp_specialchars($_GET['linkurl'], 1); 480 480 else 481 481 $link->link_url = ''; 482 482 483 483 if ( isset($_GET['name']) ) 484 484 $link->link_name = wp_specialchars($_GET['name'], 1); 485 485 else 486 486 $link->link_name = ''; 487 487 488 488 return $link; 489 489 } 490 490 491 491 function add_link() { 492 return edit_link(); 492 return edit_link(); 493 493 } 494 494 495 495 function edit_link($link_id = '') { … … 502 502 $_POST['link_image'] = wp_specialchars($_POST['link_image']); 503 503 $_POST['link_rss'] = wp_specialchars($_POST['link_rss']); 504 504 $auto_toggle = get_autotoggle($_POST['link_category']); 505 505 506 506 // if we are in an auto toggle category and this one is visible then we 507 507 // need to make the others invisible before we add this new one. 508 508 // FIXME Add category toggle func. … … 577 577 $result[$cat]['cat_name'] = get_the_category_by_ID($cat); 578 578 } 579 579 } 580 580 581 581 usort($result, 'sort_cats'); 582 582 583 583 return $result; … … 615 615 if ( current_user_can('manage_categories') ) { 616 616 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; 617 617 $default_cat_id = get_option('default_category'); 618 618 619 619 if ($category->cat_ID != $default_cat_id) 620 620 $edit .= "<td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category "%s". All of its posts will go to the default category.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; 621 621 else … … 699 699 700 700 function link_category_dropdown($fieldname, $selected = 0) { 701 701 global $wpdb; 702 702 703 703 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 704 704 echo "\n<select name='$fieldname' size='1'>\n"; 705 705 foreach ($results as $row) { … … 1834 1834 <input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" /> 1835 1835 </div> 1836 1836 </form> 1837 <?php 1837 <?php 1838 1838 } 1839 1839 1840 1840 function wp_import_handle_upload() { -
wp-admin/templates.php
60 60 default: 61 61 62 62 require_once('./admin-header.php'); 63 63 64 64 if ( ! current_user_can('edit_files') ) 65 65 die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>'); 66 66 … … 71 71 72 72 if (!is_file($real_file)) 73 73 $error = true; 74 74 75 75 if (!$error) { 76 76 $f = @ fopen($real_file, 'r'); 77 77 if ( $f ) { … … 88 88 <div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div> 89 89 <?php else: ?> 90 90 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> 91 <?php endif; ?> 91 <?php endif; ?> 92 92 <?php endif; ?> 93 93 <div class="wrap"> 94 94 <?php -
wp-admin/moderation.php
115 115 } 116 116 117 117 ?> 118 118 119 119 <div class="wrap"> 120 120 121 121 <?php -
wp-admin/user-edit.php
2 2 require_once('admin.php'); 3 3 4 4 $title = __('Edit User'); 5 $parent_file = 'profile.php'; 5 $parent_file = 'profile.php'; 6 6 $submenu_file = 'users.php'; 7 7 8 8 $wpvarstoreset = array('action', 'redirect', 'profile', 'user_id'); -
wp-admin/page-new.php
14 14 if ( current_user_can('edit_pages') ) { 15 15 $action = 'post'; 16 16 get_currentuserinfo(); 17 17 18 18 $post = get_default_post_to_edit(); 19 19 $post->post_type = 'page'; 20 20 -
wp-admin/setup-config.php
103 103 </form> 104 104 <?php 105 105 break; 106 106 107 107 case 2: 108 108 $dbname = trim($_POST['dbname']); 109 109 $uname = trim($_POST['uname']); -
wp-admin/link-manager.php
128 128 check_admin_referer(); 129 129 130 130 add_link(); 131 131 132 132 header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true'); 133 133 break; 134 134 } // end Add … … 137 137 { 138 138 139 139 check_admin_referer(); 140 140 141 141 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) 142 142 $cat_id = $links_show_cat_id; 143 143 … … 149 149 150 150 $link_id = (int) $_POST['link_id']; 151 151 edit_link($link_id); 152 152 153 153 setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600); 154 154 wp_redirect($this_file); 155 155 break; … … 165 165 $link_id = (int) $_GET['link_id']; 166 166 167 167 wp_delete_link($link_id); 168 168 169 169 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) 170 170 $cat_id = $links_show_cat_id; 171 171 … … 184 184 include_once ('admin-header.php'); 185 185 if ( !current_user_can('manage_links') ) 186 186 die(__('You do not have sufficient permissions to edit the links for this blog.')); 187 187 188 188 $link_id = (int) $_GET['link_id']; 189 189 190 190 if ( !$link = get_link_to_edit($link_id) ) 191 191 die( __('Link not found.') ); 192 192 193 193 include('edit-link-form.php'); 194 194 break; 195 195 } // end linkedit … … 370 370 ?> 371 371 <tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>> 372 372 <td><strong><?php echo $link->link_name; ?></strong><br /> 373 <?php 373 <?php 374 374 echo sprintf(__('Description: %s'), $link->link_description) . "</td>"; 375 375 echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>"; 376 376 echo <<<LINKS -
wp-admin/install.php
33 33 margin-right: 20%; 34 34 padding: .2em 2em; 35 35 } 36 36 37 37 h1 { 38 38 color: #006; 39 39 font-size: 18px; 40 40 font-weight: lighter; 41 41 } 42 42 43 43 h2 { 44 44 font-size: 16px; 45 45 } 46 46 47 47 p, li, dt { 48 48 line-height: 140%; 49 49 padding-bottom: 2px; … … 127 127 } else if (!is_email($admin_email)) { 128 128 die (__("<strong>ERROR</strong>: the e-mail address isn't correct")); 129 129 } 130 130 131 131 ?> 132 132 <h1><?php _e('Second Step'); ?></h1> 133 133 <p><?php _e('Now we’re going to create the database tables and fill them with some default data.'); ?></p> -
wp-admin/bookmarklet.php
25 25 26 26 $popuptitle = wp_specialchars(stripslashes($popuptitle)); 27 27 $text = wp_specialchars(stripslashes(urldecode($text))); 28 28 29 29 $popuptitle = funky_javascript_fix($popuptitle); 30 30 $text = funky_javascript_fix($text); 31 31 32 32 $post_title = wp_specialchars($_REQUEST['post_title']); 33 33 if (!empty($post_title)) 34 34 $post->post_title = stripslashes($post_title); 35 35 else 36 36 $post->post_title = $popuptitle; 37 37 38 38 39 39 $content = wp_specialchars($_REQUEST['content']); 40 40 $popupurl = wp_specialchars($_REQUEST['popupurl']); -
wp-admin/admin-db.php
14 14 $level_key = $wpdb->prefix . 'user_level'; 15 15 16 16 $editable = get_editable_user_ids( $user_id ); 17 17 18 18 if( !$editable ) { 19 19 $other_drafts = ''; 20 20 } else { … … 42 42 43 43 function get_editable_user_ids( $user_id, $exclude_zeros = true ) { 44 44 global $wpdb; 45 45 46 46 $user = new WP_User( $user_id ); 47 47 48 48 if ( ! $user->has_cap('edit_others_posts') ) { 49 49 if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) 50 50 return array($user->id); … … 57 57 $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'"; 58 58 if ( $exclude_zeros ) 59 59 $query .= " AND meta_value != '0'"; 60 60 61 61 return $wpdb->get_col( $query ); 62 62 } 63 63 … … 111 111 } else { 112 112 $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'"); 113 113 } 114 114 115 115 if ( $category_nicename == '' ) { 116 116 $category_nicename = sanitize_title($cat_name, $cat_ID ); 117 117 $wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" ); … … 242 242 243 243 function get_link($link_id, $output = OBJECT) { 244 244 global $wpdb; 245 245 246 246 $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'"); 247 247 248 248 if ( $output == OBJECT ) { … … 258 258 259 259 function wp_insert_link($linkdata) { 260 260 global $wpdb, $current_user; 261 261 262 262 extract($linkdata); 263 263 264 264 $update = false; … … 266 266 $update = true; 267 267 268 268 if ( empty($link_rating) ) 269 $link_rating = 0; 269 $link_rating = 0; 270 270 271 271 if ( empty($link_target) ) 272 $link_target = ''; 272 $link_target = ''; 273 273 274 274 if ( empty($link_visible) ) 275 275 $link_visible = 'Y'; 276 276 277 277 if ( empty($link_owner) ) 278 278 $link_owner = $current_user->id; 279 279 … … 292 292 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); 293 293 $link_id = $wpdb->insert_id; 294 294 } 295 295 296 296 if ( $update ) 297 297 do_action('edit_link', $link_id); 298 298 else … … 305 305 global $wpdb; 306 306 307 307 $link_id = (int) $linkdata['link_id']; 308 308 309 309 $link = get_link($link_id, ARRAY_A); 310 310 311 311 // Escape data pulled from DB. 312 312 $link = add_magic_quotes($link); 313 313 314 314 // Merge old and new fields with new fields overwriting old ones. 315 315 $linkdata = array_merge($link, $linkdata); 316 316 … … 321 321 global $wpdb; 322 322 323 323 do_action('delete_link', $link_id); 324 return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); 324 return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); 325 325 } 326 326 327 327 function post_exists($title, $content = '', $post_date = '') { -
wp-admin/options-permalink.php
41 41 42 42 var aInputs = document.getElementsByTagName('input'); 43 43 44 for (var i = 0; i < aInputs.length; i++) { 44 for (var i = 0; i < aInputs.length; i++) { 45 45 aInputs[i].onclick = aInputs[i].onkeyup = upit; 46 46 } 47 47 } … … 64 64 $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); 65 65 $wp_rewrite->set_permalink_structure($permalink_structure); 66 66 } 67 67 68 68 if ( isset($_POST['category_base']) ) { 69 69 $category_base = $_POST['category_base']; 70 70 if (! empty($category_base) ) … … 72 72 $wp_rewrite->set_category_base($category_base); 73 73 } 74 74 } 75 75 76 76 $permalink_structure = get_settings('permalink_structure'); 77 77 $category_base = get_settings('category_base'); 78 78 … … 141 141 checked="checked" 142 142 <?php } ?> 143 143 /> 144 <?php _e('Custom, specify below'); ?> 144 <?php _e('Custom, specify below'); ?> 145 145 </label> 146 146 <br /> 147 147 </p> -
wp-admin/plugin-editor.php
52 52 break; 53 53 54 54 default: 55 55 56 56 require_once('admin-header.php'); 57 57 if ( !current_user_can('edit_plugins') ) 58 58 die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>'); 59 59 60 60 update_recently_edited("wp-content/plugins/$file"); 61 61 62 62 if (!is_file($real_file)) 63 63 $error = 1; 64 64 65 65 if (!$error) { 66 66 $f = fopen($real_file, 'r'); 67 67 $content = fread($f, filesize($real_file)); -
wp-admin/import/livejournal.php
18 18 $trans_tbl = array_flip($trans_tbl); 19 19 return strtr($string, $trans_tbl); 20 20 } 21 21 22 22 function greet() { 23 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 24 wp_import_upload_form("admin.php?import=livejournal&step=1"); … … 26 26 27 27 function import_posts() { 28 28 global $wpdb, $current_user; 29 29 30 30 set_magic_quotes_runtime(0); 31 31 $importdata = file($this->file); // Read the file into an array 32 32 $importdata = implode('', $importdata); // squish it … … 35 35 preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts); 36 36 $posts = $posts[1]; 37 37 unset($importdata); 38 echo '<ol>'; 38 echo '<ol>'; 39 39 foreach ($posts as $post) { 40 40 flush(); 41 41 preg_match('|<subject>(.*?)</subject>|is', $post, $post_title); … … 78 78 79 79 preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); 80 80 $comments = $comments[1]; 81 81 82 82 if ( $comments ) { 83 83 $comment_post_ID = $post_id; 84 84 $num_comments = 0; … … 134 134 $this->file = $file['file']; 135 135 $this->import_posts(); 136 136 wp_import_cleanup($file['id']); 137 137 138 138 echo '<h3>'; 139 139 printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); 140 140 echo '</h3>'; … … 147 147 $step = (int) $_GET['step']; 148 148 149 149 $this->header(); 150 150 151 151 switch ($step) { 152 152 case 0 : 153 153 $this->greet(); … … 156 156 $this->import(); 157 157 break; 158 158 } 159 159 160 160 $this->footer(); 161 161 } 162 162 163 163 function LJ_Import() { 164 // Nothing. 164 // Nothing. 165 165 } 166 166 } 167 167 -
wp-admin/import/dotclear.php
7 7 function get_catbynicename($category_nicename) 8 8 { 9 9 global $wpdb; 10 10 11 11 $cat_id -= 0; // force numeric 12 12 $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); 13 13 14 14 return $name; 15 15 } 16 16 } … … 135 135 { 136 136 echo '</div>'; 137 137 } 138 138 139 139 function greet() 140 140 { 141 141 echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>'; … … 153 153 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 154 154 set_magic_quotes_runtime(0); 155 155 $prefix = get_option('tpre'); 156 156 157 157 // Get Categories 158 158 return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A); 159 159 } 160 160 161 161 function get_dc_users() 162 162 { 163 163 global $wpdb; … … 165 165 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 166 166 set_magic_quotes_runtime(0); 167 167 $prefix = get_option('tpre'); 168 168 169 169 // Get Users 170 170 171 171 return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A); 172 172 } 173 173 174 174 function get_dc_posts() 175 175 { 176 176 // General Housekeeping 177 177 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 178 178 set_magic_quotes_runtime(0); 179 179 $prefix = get_option('tpre'); 180 180 181 181 // Get Posts 182 182 return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name 183 183 FROM dc_post INNER JOIN dc_categorie 184 184 ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A); 185 185 } 186 186 187 187 function get_dc_comments() 188 188 { 189 189 global $wpdb; … … 191 191 $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 192 192 set_magic_quotes_runtime(0); 193 193 $prefix = get_option('tpre'); 194 194 195 195 // Get Comments 196 196 return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A); 197 197 } 198 198 199 199 function get_dc_links() 200 200 { 201 201 //General Housekeeping … … 205 205 206 206 return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A); 207 207 } 208 208 209 209 function cat2wp($categories='') 210 210 { 211 211 // General Housekeeping … … 220 220 { 221 221 $count++; 222 222 extract($category); 223 223 224 224 // Make Nice Variables 225 225 $name = $wpdb->escape($cat_libelle_url); 226 226 $title = $wpdb->escape(csc ($cat_libelle)); … … 236 236 } 237 237 $dccat2wpcat[$id] = $ret_id; 238 238 } 239 239 240 240 // Store category translation for future use 241 241 add_option('dccat2wpcat',$dccat2wpcat); 242 242 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>'; … … 245 245 echo __('No Categories to Import!'); 246 246 return false; 247 247 } 248 248 249 249 function users2wp($users='') 250 250 { 251 251 // General Housekeeping 252 252 global $wpdb; 253 253 $count = 0; 254 254 $dcid2wpid = array(); 255 255 256 256 // Midnight Mojo 257 257 if(is_array($users)) 258 258 { … … 261 261 { 262 262 $count++; 263 263 extract($user); 264 264 265 265 // Make Nice Variables 266 266 $name = $wpdb->escape(csc ($name)); 267 267 $RealName = $wpdb->escape(csc ($user_pseudo)); 268 268 269 269 if($uinfo = get_userdatabylogin($name)) 270 270 { 271 271 272 272 $ret_id = wp_insert_user(array( 273 273 'ID' => $uinfo->ID, 274 274 'user_login' => $user_id, … … 289 289 ); 290 290 } 291 291 $dcid2wpid[$user_id] = $ret_id; 292 292 293 293 // Set Dotclear-to-WordPress permissions translation 294 294 295 295 // Update Usermeta Data 296 296 $user = new WP_User($ret_id); 297 297 $wp_perms = $user_level + 1; … … 302 302 else if(3 <= $wp_perms) { $user->set_role('contributor'); } 303 303 else if(2 <= $wp_perms) { $user->set_role('contributor'); } 304 304 else { $user->set_role('subscriber'); } 305 305 306 306 update_usermeta( $ret_id, 'wp_user_level', $wp_perms); 307 307 update_usermeta( $ret_id, 'rich_editing', 'false'); 308 308 update_usermeta( $ret_id, 'first_name', csc ($user_prenom)); 309 309 update_usermeta( $ret_id, 'last_name', csc ($user_nom)); 310 310 }// End foreach($users as $user) 311 311 312 312 // Store id translation array for future use 313 313 add_option('dcid2wpid',$dcid2wpid); 314 315 314 315 316 316 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>'; 317 317 return true; 318 318 }// End if(is_array($users) 319 319 320 320 echo __('No Users to Import!'); 321 321 return false; 322 322 323 323 }// End function user2wp() 324 324 325 325 function posts2wp($posts='') 326 326 { 327 327 // General Housekeeping … … 338 338 { 339 339 $count++; 340 340 extract($post); 341 341 342 342 // Set Dotclear-to-WordPress status translation 343 343 $stattrans = array(0 => 'draft', 1 => 'publish'); 344 344 $comment_status_map = array (0 => 'closed', 1 => 'open'); 345 345 346 346 //Can we do this more efficiently? 347 347 $uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1; 348 348 $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; … … 356 356 $post_excerpt = $wpdb->escape ($post_excerpt); 357 357 $post_content = $wpdb->escape ($post_content); 358 358 $post_status = $stattrans[$post_pub]; 359 359 360 360 // Import Post data into WordPress 361 361 362 362 if($pinfo = post_exists($Title,$post_content)) 363 363 { 364 364 $ret_id = wp_insert_post(array( … … 397 397 ); 398 398 } 399 399 $dcposts2wpposts[$post_id] = $ret_id; 400 400 401 401 // Make Post-to-Category associations 402 402 $cats = array(); 403 403 if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; } … … 407 407 } 408 408 // Store ID translation for later use 409 409 add_option('dcposts2wpposts',$dcposts2wpposts); 410 410 411 411 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; 412 return true; 412 return true; 413 413 } 414 414 415 415 function comments2wp($comments='') 416 416 { 417 417 // General Housekeeping … … 419 419 $count = 0; 420 420 $dccm2wpcm = array(); 421 421 $postarr = get_option('dcposts2wpposts'); 422 422 423 423 // Magic Mojo 424 424 if(is_array($comments)) 425 425 { … … 428 428 { 429 429 $count++; 430 430 extract($comment); 431 431 432 432 // WordPressify Data 433 433 $comment_ID = ltrim($comment_id, '0'); 434 434 $comment_post_ID = $postarr[$post_id]; … … 437 437 $email = $wpdb->escape($comment_email); 438 438 $web = "http://".$wpdb->escape($comment_site); 439 439 $message = $wpdb->escape(textconv ($comment_content)); 440 440 441 441 if($cinfo = comment_exists($name, $comment_dt)) 442 442 { 443 443 // Update comments … … 472 472 $dccm2wpcm[$comment_ID] = $ret_id; 473 473 } 474 474 // Store Comment ID translation for future use 475 add_option('dccm2wpcm', $dccm2wpcm); 476 475 add_option('dccm2wpcm', $dccm2wpcm); 476 477 477 // Associate newly formed categories with posts 478 478 get_comment_count($ret_id); 479 480 479 480 481 481 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>'; 482 482 return true; 483 483 } 484 484 echo __('No Comments to Import!'); 485 485 return false; 486 486 } 487 487 488 488 function links2wp($links='') 489 489 { 490 490 // General Housekeeping 491 491 global $wpdb; 492 492 $count = 0; 493 493 494 494 // Deal with the links 495 495 if(is_array($links)) 496 496 { … … 499 499 { 500 500 $count++; 501 501 extract($link); 502 502 503 503 if ($title != "") { 504 504 if ($cinfo = link_cat_exists (csc ($title))) { 505 505 $category = $cinfo; … … 511 511 } else { 512 512 $linkname = $wpdb->escape(csc ($label)); 513 513 $description = $wpdb->escape(csc ($title)); 514 514 515 515 if($linfo = link_exists($linkname)) { 516 516 $ret_id = wp_insert_link(array( 517 517 'link_id' => $linfo, … … 540 540 echo __('No Links to Import!'); 541 541 return false; 542 542 } 543 543 544 544 function import_categories() 545 { 546 // Category Import 545 { 546 // Category Import 547 547 $cats = $this->get_dc_cats(); 548 548 $this->cat2wp($cats); 549 549 add_option('dc_cats', $cats); 550 551 552 550 551 552 553 553 echo '<form action="admin.php?import=dotclear&step=2" method="post">'; 554 554 printf('<input type="submit" name="submit" value="%s" />', __('Import Users')); 555 555 echo '</form>'; 556 556 557 557 } 558 558 559 559 function import_users() 560 560 { 561 561 // User Import 562 562 $users = $this->get_dc_users(); 563 563 $this->users2wp($users); 564 564 565 565 echo '<form action="admin.php?import=dotclear&step=3" method="post">'; 566 566 printf('<input type="submit" name="submit" value="%s" />', __('Import Posts')); 567 567 echo '</form>'; 568 568 } 569 569 570 570 function import_posts() 571 571 { 572 572 // Post Import 573 573 $posts = $this->get_dc_posts(); 574 574 $this->posts2wp($posts); 575 575 576 576 echo '<form action="admin.php?import=dotclear&step=4" method="post">'; 577 577 printf('<input type="submit" name="submit" value="%s" />', __('Import Comments')); 578 578 echo '</form>'; 579 579 } 580 580 581 581 function import_comments() 582 582 { 583 583 // Comment Import 584 584 $comments = $this->get_dc_comments(); 585 585 $this->comments2wp($comments); 586 586 587 587 echo '<form action="admin.php?import=dotclear&step=5" method="post">'; 588 588 printf('<input type="submit" name="submit" value="%s" />', __('Import Links')); 589 589 echo '</form>'; 590 590 } 591 591 592 592 function import_links() 593 593 { 594 594 //Link Import 595 595 $links = $this->get_dc_links(); 596 596 $this->links2wp($links); 597 597 add_option('dc_links', $links); 598 598 599 599 echo '<form action="admin.php?import=dotclear&step=6" method="post">'; 600 600 printf('<input type="submit" name="submit" value="%s" />', __('Finish')); 601 601 echo '</form>'; 602 602 } 603 603 604 604 function cleanup_dcimport() 605 605 { 606 606 delete_option('tpre'); … … 617 617 delete_option('dccharset'); 618 618 $this->tips(); 619 619 } 620 620 621 621 function tips() 622 622 { 623 623 echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>'; … … 636 636 echo '</ul>'; 637 637 echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>'; 638 638 } 639 639 640 640 function db_form() 641 641 { 642 642 echo '<ul>'; … … 648 648 printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:')); 649 649 echo '</ul>'; 650 650 } 651 651 652 652 function dispatch() 653 653 { 654 654 … … 657 657 else 658 658 $step = (int) $_GET['step']; 659 659 $this->header(); 660 660 661 661 if ( $step > 0 ) 662 662 { 663 663 if($_POST['dbuser']) 664 664 { 665 665 if(get_option('dcuser')) 666 delete_option('dcuser'); 666 delete_option('dcuser'); 667 667 add_option('dcuser',$_POST['dbuser']); 668 668 } 669 669 if($_POST['dbpass']) 670 670 { 671 671 if(get_option('dcpass')) 672 delete_option('dcpass'); 672 delete_option('dcpass'); 673 673 add_option('dcpass',$_POST['dbpass']); 674 674 } 675 675 676 676 if($_POST['dbname']) 677 677 { 678 678 if(get_option('dcname')) 679 delete_option('dcname'); 679 delete_option('dcname'); 680 680 add_option('dcname',$_POST['dbname']); 681 681 } 682 682 if($_POST['dbhost']) … … 690 690 if(get_option('dccharset')) 691 691 delete_option('dccharset'); 692 692 add_option('dccharset',$_POST['dccharset']); 693 } 693 } 694 694 if($_POST['dbprefix']) 695 695 { 696 696 if(get_option('tpre')) 697 697 delete_option('tpre'); 698 698 add_option('tpre',$_POST['dbprefix']); 699 } 699 } 700 700 701 701 702 702 } … … 726 726 $this->cleanup_dcimport(); 727 727 break; 728 728 } 729 729 730 730 $this->footer(); 731 731 } 732 732 733 733 function Dotclear_Import() 734 734 { 735 // Nothing. 735 // Nothing. 736 736 } 737 737 } 738 738 -
wp-admin/import/mt.php
379 379 } 380 380 if ( $num_pings ) 381 381 printf(__('(%s pings)'), $num_pings); 382 382 383 383 echo "</li>"; 384 384 } 385 385 flush(); … … 420 420 } 421 421 422 422 function MT_Import() { 423 // Nothing. 423 // Nothing. 424 424 } 425 425 } 426 426 -
wp-admin/import/blogger.php
135 135 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 136 136 if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 137 137 $response = curl_exec ($ch); 138 138 139 139 if ($parse) { 140 140 $response = $this->parse_response($response); 141 141 $response['url'] = $url; 142 142 return $response; 143 143 } 144 144 145 145 return $response; 146 146 } 147 147 … … 210 210 $this->import['blogs'][$_GET['blog']]['nextstep'] = $step; 211 211 update_option('import-blogger', $this->import); 212 212 } 213 213 214 214 // Redirects to next step 215 215 function do_next_step() { 216 216 header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); … … 224 224 if ( ! ( $_POST['user'] && $_POST['pass'] ) ) { 225 225 $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>'); 226 226 } 227 228 // Try logging in. If we get an array of cookies back, we at least connected. 227 228 // Try logging in. If we get an array of cookies back, we at least connected. 229 229 $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']); 230 230 if ( !is_array( $this->import['cookies'] ) ) { 231 231 $this->login_form(__('Login failed. Please enter your credentials again.')); 232 232 } 233 233 234 234 // Save the password so we can log the browser in when it's time to publish. 235 235 $this->import['pass'] = $_POST['pass']; 236 236 $this->import['user'] = $_POST['user']; … … 395 395 update_option('import-blogger', $import); 396 396 $archive = $this->get_blogger($url); 397 397 if ( $archive['code'] > 200 ) 398 continue; 398 continue; 399 399 $posts = explode('<wordpresspost>', $archive['body']); 400 400 for ($i = 1; $i < count($posts); $i = $i + 1) { 401 401 $postparts = explode('<wordpresscomment>', $posts[$i]); … … 409 409 $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3]; 410 410 $post_author_name = $wpdb->escape(trim($postinfo[1])); 411 411 $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org'; 412 412 413 413 if ( $this->lump_authors ) { 414 414 // Ignore Blogger authors. Use the current user_ID for all posts imported. 415 415 $post_author = $GLOBALS['user_ID']; … … 435 435 $posthour = zeroise($post_date_His[0], 2); 436 436 $postminute = zeroise($post_date_His[1], 2); 437 437 $postsecond = zeroise($post_date_His[2], 2); 438 438 439 439 if (($post_date[2] == 'PM') && ($posthour != '12')) 440 440 $posthour = $posthour + 12; 441 441 else if (($post_date[2] == 'AM') && ($posthour == '12')) 442 442 $posthour = '00'; 443 443 444 444 $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; 445 445 446 446 $post_content = addslashes($post_content); 447 447 $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;) 448 448 449 449 $post_title = addslashes($post_title); 450 450 451 451 $post_status = 'publish'; 452 452 453 453 if ( $ID = post_exists($post_title, '', $post_date) ) { 454 454 $post_array[$i]['ID'] = $ID; 455 455 $skippedpostcount++; … … 597 597 if ( $_GET['restart'] == 'true' ) { 598 598 $this->restart(); 599 599 } 600 600 601 601 if ( isset($_GET['noheader']) ) { 602 602 $this->import = get_settings('import-blogger'); 603 603 … … 647 647 break; 648 648 } 649 649 die; 650 650 651 651 } else { 652 652 $this->greet(); 653 653 } -
wp-admin/import/textpattern.php
7 7 function get_catbynicename($category_nicename) 8 8 { 9 9 global $wpdb; 10 10 11 11 $cat_id -= 0; // force numeric 12 12 $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); 13 13 14 14 return $name; 15 15 } 16 16 } … … 49 49 { 50 50 echo '</div>'; 51 51 } 52 52 53 53 function greet() 54 54 { 55 55 echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>'; … … 67 67 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); 68 68 set_magic_quotes_runtime(0); 69 69 $prefix = get_option('tpre'); 70 70 71 71 // Get Categories 72 72 return $txpdb->get_results('SELECT 73 73 id, … … 77 77 WHERE type = "article"', 78 78 ARRAY_A); 79 79 } 80 80 81 81 function get_txp_users() 82 82 { 83 83 global $wpdb; … … 85 85 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); 86 86 set_magic_quotes_runtime(0); 87 87 $prefix = get_option('tpre'); 88 88 89 89 // Get Users 90 90 91 91 return $txpdb->get_results('SELECT 92 92 user_id, 93 93 name, … … 96 96 privs 97 97 FROM '.$prefix.'txp_users', ARRAY_A); 98 98 } 99 99 100 100 function get_txp_posts() 101 101 { 102 102 // General Housekeeping 103 103 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); 104 104 set_magic_quotes_runtime(0); 105 105 $prefix = get_option('tpre'); 106 106 107 107 // Get Posts 108 108 return $txpdb->get_results('SELECT 109 109 ID, … … 122 122 FROM '.$prefix.'textpattern 123 123 ', ARRAY_A); 124 124 } 125 125 126 126 function get_txp_comments() 127 127 { 128 128 global $wpdb; … … 130 130 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); 131 131 set_magic_quotes_runtime(0); 132 132 $prefix = get_option('tpre'); 133 133 134 134 // Get Comments 135 135 return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A); 136 136 } 137 137 138 138 function get_txp_links() 139 139 { 140 140 //General Housekeeping 141 141 $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); 142 142 set_magic_quotes_runtime(0); 143 143 $prefix = get_option('tpre'); 144 144 145 145 return $txpdb->get_results('SELECT 146 146 id, 147 147 date, … … 152 152 FROM '.$prefix.'txp_link', 153 153 ARRAY_A); 154 154 } 155 155 156 156 function cat2wp($categories='') 157 157 { 158 158 // General Housekeeping … … 167 167 { 168 168 $count++; 169 169 extract($category); 170 171 170 171 172 172 // Make Nice Variables 173 173 $name = $wpdb->escape($name); 174 174 $title = $wpdb->escape($title); 175 175 176 176 if($cinfo = category_exists($name)) 177 177 { 178 178 $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title)); … … 183 183 } 184 184 $txpcat2wpcat[$id] = $ret_id; 185 185 } 186 186 187 187 // Store category translation for future use 188 188 add_option('txpcat2wpcat',$txpcat2wpcat); 189 189 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>'; … … 192 192 echo __('No Categories to Import!'); 193 193 return false; 194 194 } 195 195 196 196 function users2wp($users='') 197 197 { 198 198 // General Housekeeping 199 199 global $wpdb; 200 200 $count = 0; 201 201 $txpid2wpid = array(); 202 202 203 203 // Midnight Mojo 204 204 if(is_array($users)) 205 205 { … … 208 208 { 209 209 $count++; 210 210 extract($user); 211 211 212 212 // Make Nice Variables 213 213 $name = $wpdb->escape($name); 214 214 $RealName = $wpdb->escape($RealName); 215 215 216 216 if($uinfo = get_userdatabylogin($name)) 217 217 { 218 218 219 219 $ret_id = wp_insert_user(array( 220 220 'ID' => $uinfo->ID, 221 221 'user_login' => $name, … … 236 236 ); 237 237 } 238 238 $txpid2wpid[$user_id] = $ret_id; 239 239 240 240 // Set Textpattern-to-WordPress permissions translation 241 241 $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0'); 242 242 243 243 // Update Usermeta Data 244 244 $user = new WP_User($ret_id); 245 245 if('10' == $transperms[$privs]) { $user->set_role('administrator'); } … … 249 249 if('3' == $transperms[$privs]) { $user->set_role('contributor'); } 250 250 if('2' == $transperms[$privs]) { $user->set_role('contributor'); } 251 251 if('0' == $transperms[$privs]) { $user->set_role('subscriber'); } 252 252 253 253 update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] ); 254 254 update_usermeta( $ret_id, 'rich_editing', 'false'); 255 255 }// End foreach($users as $user) 256 256 257 257 // Store id translation array for future use 258 258 add_option('txpid2wpid',$txpid2wpid); 259 260 259 260 261 261 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>'; 262 262 return true; 263 263 }// End if(is_array($users) 264 264 265 265 echo __('No Users to Import!'); 266 266 return false; 267 267 268 268 }// End function user2wp() 269 269 270 270 function posts2wp($posts='') 271 271 { 272 272 // General Housekeeping … … 283 283 { 284 284 $count++; 285 285 extract($post); 286 286 287 287 // Set Textpattern-to-WordPress status translation 288 288 $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish'); 289 289 290 290 //Can we do this more efficiently? 291 291 $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1; 292 292 $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; … … 295 295 $Body = $wpdb->escape($Body); 296 296 $Excerpt = $wpdb->escape($Excerpt); 297 297 $post_status = $stattrans[$Status]; 298 298 299 299 // Import Post data into WordPress 300 300 301 301 if($pinfo = post_exists($Title,$Body)) 302 302 { 303 303 $ret_id = wp_insert_post(array( … … 332 332 ); 333 333 } 334 334 $txpposts2wpposts[$ID] = $ret_id; 335 335 336 336 // Make Post-to-Category associations 337 337 $cats = array(); 338 338 if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; } … … 343 343 } 344 344 // Store ID translation for later use 345 345 add_option('txpposts2wpposts',$txpposts2wpposts); 346 346 347 347 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; 348 return true; 348 return true; 349 349 } 350 350 351 351 function comments2wp($comments='') 352 352 { 353 353 // General Housekeeping … … 355 355 $count = 0; 356 356 $txpcm2wpcm = array(); 357 357 $postarr = get_option('txpposts2wpposts'); 358 358 359 359 // Magic Mojo 360 360 if(is_array($comments)) 361 361 { … … 364 364 { 365 365 $count++; 366 366 extract($comment); 367 367 368 368 // WordPressify Data 369 369 $comment_ID = ltrim($discussid, '0'); 370 370 $comment_post_ID = $postarr[$parentid]; … … 373 373 $email = $wpdb->escape($email); 374 374 $web = $wpdb->escape($web); 375 375 $message = $wpdb->escape($message); 376 376 377 377 if($cinfo = comment_exists($name, $posted)) 378 378 { 379 379 // Update comments … … 405 405 $txpcm2wpcm[$comment_ID] = $ret_id; 406 406 } 407 407 // Store Comment ID translation for future use 408 add_option('txpcm2wpcm', $txpcm2wpcm); 409 408 add_option('txpcm2wpcm', $txpcm2wpcm); 409 410 410 // Associate newly formed categories with posts 411 411 get_comment_count($ret_id); 412 413 412 413 414 414 echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>'; 415 415 return true; 416 416 } 417 417 echo __('No Comments to Import!'); 418 418 return false; 419 419 } 420 420 421 421 function links2wp($links='') 422 422 { 423 423 // General Housekeeping 424 424 global $wpdb; 425 425 $count = 0; 426 426 427 427 // Deal with the links 428 428 if(is_array($links)) 429 429 { … … 432 432 { 433 433 $count++; 434 434 extract($link); 435 435 436 436 // Make nice vars 437 437 $category = $wpdb->escape($category); 438 438 $linkname = $wpdb->escape($linkname); 439 439 $description = $wpdb->escape($description); 440 440 441 441 if($linfo = link_exists($linkname)) 442 442 { 443 443 $ret_id = wp_insert_link(array( … … 470 470 echo __('No Links to Import!'); 471 471 return false; 472 472 } 473 473 474 474 function import_categories() 475 { 476 // Category Import 475 { 476 // Category Import 477 477 $cats = $this->get_txp_cats(); 478 478 $this->cat2wp($cats); 479 479 add_option('txp_cats', $cats); 480 481 482 480 481 482 483 483 echo '<form action="admin.php?import=textpattern&step=2" method="post">'; 484 484 printf('<input type="submit" name="submit" value="%s" />', __('Import Users')); 485 485 echo '</form>'; 486 486 487 487 } 488 488 489 489 function import_users() 490 490 { 491 491 // User Import 492 492 $users = $this->get_txp_users(); 493 493 $this->users2wp($users); 494 494 495 495 echo '<form action="admin.php?import=textpattern&step=3" method="post">'; 496 496 printf('<input type="submit" name="submit" value="%s" />', __('Import Posts')); 497 497 echo '</form>'; 498 498 } 499 499 500 500 function import_posts() 501 501 { 502 502 // Post Import 503 503 $posts = $this->get_txp_posts(); 504 504 $this->posts2wp($posts); 505 505 506 506 echo '<form action="admin.php?import=textpattern&step=4" method="post">'; 507 507 printf('<input type="submit" name="submit" value="%s" />', __('Import Comments')); 508 508 echo '</form>'; 509 509 } 510 510 511 511 function import_comments() 512 512 { 513 513 // Comment Import 514 514 $comments = $this->get_txp_comments(); 515 515 $this->comments2wp($comments); 516 516 517 517 echo '<form action="admin.php?import=textpattern&step=5" method="post">'; 518 518 printf('<input type="submit" name="submit" value="%s" />', __('Import Links')); 519 519 echo '</form>'; 520 520 } 521 521 522 522 function import_links() 523 523 { 524 524 //Link Import 525 525 $links = $this->get_txp_links(); 526 526 $this->links2wp($links); 527 527 add_option('txp_links', $links); 528 528 529 529 echo '<form action="admin.php?import=textpattern&step=6" method="post">'; 530 530 printf('<input type="submit" name="submit" value="%s" />', __('Finish')); 531 531 echo '</form>'; 532 532 } 533 533 534 534 function cleanup_txpimport() 535 535 { 536 536 delete_option('tpre'); … … 546 546 delete_option('txphost'); 547 547 $this->tips(); 548 548 } 549 549 550 550 function tips() 551 551 { 552 552 echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>'; … … 565 565 echo '</ul>'; 566 566 echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>'; 567 567 } 568 568 569 569 function db_form() 570 570 { 571 571 echo '<ul>'; … … 576 576 printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):')); 577 577 echo '</ul>'; 578 578 } 579 579 580 580 function dispatch() 581 581 { 582 582 … … 585 585 else 586 586 $step = (int) $_GET['step']; 587 587 $this->header(); 588 588 589 589 if ( $step > 0 ) 590 590 { 591 591 if($_POST['dbuser']) 592 592 { 593 593 if(get_option('txpuser')) 594 delete_option('txpuser'); 594 delete_option('txpuser'); 595 595 add_option('txpuser',$_POST['dbuser']); 596 596 } 597 597 if($_POST['dbpass']) 598 598 { 599 599 if(get_option('txppass')) 600 delete_option('txppass'); 600 delete_option('txppass'); 601 601 add_option('txppass',$_POST['dbpass']); 602 602 } 603 603 604 604 if($_POST['dbname']) 605 605 { 606 606 if(get_option('txpname')) 607 delete_option('txpname'); 607 delete_option('txpname'); 608 608 add_option('txpname',$_POST['dbname']); 609 609 } 610 610 if($_POST['dbhost']) … … 618 618 if(get_option('tpre')) 619 619 delete_option('tpre'); 620 620 add_option('tpre',$_POST['dbprefix']); 621 } 621 } 622 622 623 623 624 624 } … … 648 648 $this->cleanup_txpimport(); 649 649 break; 650 650 } 651 651 652 652 $this->footer(); 653 653 } 654 654 655 655 function Textpattern_Import() 656 656 { 657 // Nothing. 657 // Nothing. 658 658 } 659 659 } 660 660 -
wp-admin/import/rss.php
19 19 $trans_tbl = array_flip($trans_tbl); 20 20 return strtr($string, $trans_tbl); 21 21 } 22 22 23 23 function greet() { 24 24 echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>'; 25 25 wp_import_upload_form("admin.php?import=rss&step=1"); … … 27 27 28 28 function get_posts() { 29 29 global $wpdb; 30 30 31 31 set_magic_quotes_runtime(0); 32 32 $datalines = file($this->file); // Read the file into an array 33 33 $importdata = implode('', $datalines); // squish it … … 134 134 $this->get_posts(); 135 135 $this->import_posts(); 136 136 wp_import_cleanup($file['id']); 137 137 138 138 echo '<h3>'; 139 139 printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); 140 140 echo '</h3>'; … … 147 147 $step = (int) $_GET['step']; 148 148 149 149 $this->header(); 150 150 151 151 switch ($step) { 152 152 case 0 : 153 153 $this->greet(); … … 156 156 $this->import(); 157 157 break; 158 158 } 159 159 160 160 $this->footer(); 161 161 } 162 162 163 163 function RSS_Import() { 164 // Nothing. 164 // Nothing. 165 165 } 166 166 } 167 167 -
wp-admin/categories.php
27 27 28 28 if ( !current_user_can('manage_categories') ) 29 29 die (__('Cheatin’ uh?')); 30 30 31 31 wp_insert_category($_POST); 32 32 33 33 header('Location: categories.php?message=1#addcat'); … … 96 96 case 'editedcat': 97 97 if ( !current_user_can('manage_categories') ) 98 98 die (__('Cheatin’ uh?')); 99 99 100 100 wp_update_category($_POST); 101 101 102 102 header('Location: categories.php?message=3'); -
wp-admin/themes.php
3 3 4 4 if ( isset($_GET['action']) ) { 5 5 check_admin_referer(); 6 6 7 7 if ('activate' == $_GET['action']) { 8 8 if ( isset($_GET['template']) ) 9 9 update_option('template', $_GET['template']); 10 10 11 11 if ( isset($_GET['stylesheet']) ) 12 12 update_option('stylesheet', $_GET['stylesheet']); 13 13 14 14 do_action('switch_theme', get_current_theme()); 15 15 16 16 header('Location: themes.php?activated=true'); 17 17 exit; 18 18 } … … 102 102 </tr> 103 103 <?php 104 104 $theme = ''; 105 105 106 106 $theme_names = array_keys($broken_themes); 107 107 natcasesort($theme_names); 108 108 -
wp-admin/upgrade-schema.php
257 257 add_role('author', __('Author')); 258 258 add_role('contributor', __('Contributor')); 259 259 add_role('subscriber', __('Subscriber')); 260 260 261 261 // Add caps for Administrator role 262 262 $role = get_role('administrator'); 263 263 $role->add_cap('switch_themes'); … … 290 290 $role->add_cap('level_2'); 291 291 $role->add_cap('level_1'); 292 292 $role->add_cap('level_0'); 293 293 294 294 // Add caps for Editor role 295 295 $role = get_role('editor'); 296 296 $role->add_cap('moderate_comments'); … … 312 312 $role->add_cap('level_2'); 313 313 $role->add_cap('level_1'); 314 314 $role->add_cap('level_0'); 315 315 316 316 // Add caps for Author role 317 317 $role = get_role('author'); 318 318 $role->add_cap('upload_files'); … … 323 323 $role->add_cap('level_2'); 324 324 $role->add_cap('level_1'); 325 325 $role->add_cap('level_0'); 326 326 327 327 // Add caps for Contributor role 328 328 $role = get_role('contributor'); 329 329 $role->add_cap('edit_posts'); 330 330 $role->add_cap('read'); 331 331 $role->add_cap('level_1'); 332 332 $role->add_cap('level_0'); 333 333 334 334 // Add caps for Subscriber role 335 335 $role = get_role('subscriber'); 336 336 $role->add_cap('read'); … … 354 354 $role->add_cap('delete_others_posts'); 355 355 $role->add_cap('delete_published_posts'); 356 356 } 357 358 $role = get_role('author'); 357 358 $role = get_role('author'); 359 359 if ( ! empty($role) ) { 360 360 $role->add_cap('delete_posts'); 361 $role->add_cap('delete_published_posts'); 361 $role->add_cap('delete_published_posts'); 362 362 } 363 363 364 $role = get_role('contributor'); 364 $role = get_role('contributor'); 365 365 if ( ! empty($role) ) { 366 366 $role->add_cap('delete_posts'); 367 367 }