Compare commits

..

183 Commits
2.3.3 ... 2.2.3

Author SHA1 Message Date
ryan
31cbc32eec 2.2.3
git-svn-id: http://svn.automattic.com/wordpress/tags/2.2.3@6063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-07 20:21:59 +00:00
ryan
9bd6651300 2.2.3 bump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-07 19:19:48 +00:00
ryan
8093fb3e91 Better determination. fixes #4748 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-07 19:19:26 +00:00
ryan
5528dd0af1 Don't skip sanitization if 404. Add wp_title display filters.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-05 03:13:16 +00:00
ryan
c845b0a1d8 Unset no_filter. Props xknown. fixes #4720
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-03 16:28:19 +00:00
ryan
a48ea12857 Fix how wp_filter array is keyed. Props santosj/darkdragon. fixes #3875 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@6014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-09-03 14:59:58 +00:00
markjaquith
10dd4de758 Roll back [5986], [5988], [5989]. We are in a char class, so no escaping needed. Props mdawaffe. see #4873
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-30 18:13:48 +00:00
markjaquith
a003f037e0 Better %0d/%0a sanitization for wp_redirect() from hakre. fixes #4819 for 2.2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-30 17:46:58 +00:00
markjaquith
00d289772d Escape special chars in regex. Props eightize and Otto42. fixes #4873 for 2.2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-30 17:38:47 +00:00
westi
fd1fc3f93c Globalise wp_version so Magpie can use it. props Nazgul, hakre. Fixes #3996 for 2.2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-28 20:21:39 +00:00
westi
4de37d45c9 Enable plugins to override the cockney replace array, fixes #4804 for 2.2.3 props andihit
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-23 21:05:27 +00:00
westi
5db0caf904 Fix plugin basename for Windows servers. Fixes #3002 for 2.2.x props Ozh
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-23 18:11:44 +00:00
ryan
f80a41e447 Don't allow private query vars in url_to_postid
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-23 16:10:43 +00:00
ryan
4b9fb9ed0c Don't die with type
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-23 15:52:23 +00:00
ryan
f09d565459 Sanitize a few options
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-22 18:00:48 +00:00
ryan
f6d340da08 mt_allow_pings fix. Props Joseph Scott and Allan Odgaard. fixes #4770 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-20 18:18:46 +00:00
ryan
062d072c1c Formatting cleanups from johnjosephbachir. fixes #4775 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-19 22:26:25 +00:00
ryan
bfe79aacdd Use dc:creator instead of author for rss2 comment feeds. Props lexhair, Otto42. fixes #4704 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-16 18:35:11 +00:00
ryan
da56b898e8 Pass args as array instead of query string.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-16 18:01:24 +00:00
ryan
e8b6613471 RTL fixes from mani_monaj. fixes #4729
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-13 17:20:12 +00:00
matt
7e3a60399f Version bumps.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-05 05:39:35 +00:00
markjaquith
c9d4d9c0a7 Roll back export portion of #4452 for 2.2.x, see #4452, see #4686
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-03 14:51:20 +00:00
markjaquith
3ea3be0691 Sanitize cat_id, fixes #4692 for 2.2.x, thanks g30rg3x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-02 15:10:25 +00:00
markjaquith
c8ceeac23f Absolute numbers where we will never allow negatives, fixes #4692 for 2.2.x, thanks g30rg3x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-02 14:58:15 +00:00
markjaquith
33b295b2b3 More upload escaping. Props Brian Layman. fixes #4689 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-01 20:58:38 +00:00
markjaquith
eb35c91c6c Sanitize option names in options.php, use current escaping functions. for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-01 19:25:15 +00:00
markjaquith
113de8f97b add_option()/update_option() should pass the option name to get_option() pre-escaped. fixes #4690 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-01 19:14:28 +00:00
markjaquith
77a94e8c13 attribute_escape() in upload form action. Props Nazgul. fixes #4689 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-08-01 17:21:08 +00:00
markjaquith
1e03ffb3d4 Use "home," not "siteurl" for widget dropdown category URLs. Props Pastinakel. fixes #4683 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-07-30 16:23:45 +00:00
markjaquith
816e5dc069 Use CDATA escaping/unescaping for comment_author. props tellyworth. fixes #4452 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-07-30 16:08:30 +00:00
ryan
85e538c36d Don't return before doing actions. Props nbachiyski. fixes #4629 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-07-13 18:30:06 +00:00
markjaquith
b10d4e3ade Properly unset notoptions cache in add_option() so that get_option() and update_option() work on the same load. fixes #4429 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-07-07 04:08:04 +00:00
ryan
231a8a10ab Don't richedit for comments. Props Joseph Scott. fixes #4587 for 2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-07-05 20:12:07 +00:00
markjaquith
60c9345dd8 Fix stylesheet-based themes. props dougal. fixes #4522
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-27 22:45:52 +00:00
markjaquith
7f0e860479 Check post type after upload. Props Alexander Concha
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-26 20:47:17 +00:00
rob1n
856d4bb2a8 Update the message too. Thanks, Lloyd. fixes #4510
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-22 22:14:17 +00:00
rob1n
2fd0d47c6d Check for PHP 4.2 or greater in 2.2 branch. fixes #4510
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-22 21:48:36 +00:00
ryan
296ccd1317 js_escape improvements from Alexander Concha. Catches &#39 &#039 ' ' ' ' &#x000027 etc.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-19 22:47:01 +00:00
ryan
4c6fc7b9b5 Protect _wp_page_template too.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-19 22:42:19 +00:00
ryan
942b046b36 Protect _wp_page_template too.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-19 22:40:59 +00:00
ryan
00f680d59d Accept 'open' and 'closed' as valid values for mt_allow_comments and mt_allow_pings in XML-RPC. Props Joseph Scott. For 2.2. see #4469
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-19 19:37:05 +00:00
ryan
fda8f02c9b Bump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-18 17:47:33 +00:00
ryan
442687e500 Prevent editing of protected meta keys.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-18 16:30:07 +00:00
ryan
43f26d2927 escape before extracting. Props Alexander Concha.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-18 00:19:15 +00:00
rob1n
fa3bd8e93e Add missing </em>. Props johnbillion. fixes #4479
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-16 17:52:08 +00:00
ryan
4944eebb7a Bump ver
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-16 02:35:45 +00:00
ryan
5d334e880a Use EXTR_SKIP when extracting. For 2.2. See #4468
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-15 17:45:21 +00:00
ryan
f3612d4293 wp_parse_str() from mdawaffe. fixes #4467
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-15 17:35:56 +00:00
rob1n
69c8191502 Fix reference to ocomment.php. Props alanjcastonguay and Lloyd. fixes #4471
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-15 16:54:17 +00:00
markjaquith
f67057dc71 use FALSE to designate lack of user-supplied URL in *_query_arg() funcs. fixes #4465 for 2.2.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-14 05:12:59 +00:00
markjaquith
8d1a3315e4 only strip question marks from the RIGHT side of the query string. fixes #4464. see #4462
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-14 03:38:51 +00:00
markjaquith
feae504eda remove &paged=1 *before* we HTML entitize the link. fixes #4462
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-14 02:58:04 +00:00
ryan
1869c08c31 Add sanitize_user()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-13 16:27:03 +00:00
rob1n
5da8b7a7ac Don't include HTML in gettext call. Props nbachiyski and Nazgul. fixes #4437
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-12 21:48:55 +00:00
ryan
9c928324b1 escapeshellarg the sender
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-11 23:18:24 +00:00
ryan
0de0707ffe attribute_escape REQUEST_URI
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-11 22:40:08 +00:00
rob1n
fc913b4113 Maintain "Page order" for consistency. fixes #4431
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-11 21:11:40 +00:00
rob1n
33c26d9a7d Revert multiple category stuff. see #4285
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-09 00:59:14 +00:00
rob1n
86f4f82e5e Fix <!--generator--> line's time format. Props macbis. fixes #4424 for 2.3 and 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 23:06:10 +00:00
rob1n
7cec58d66e Some more multiple category widget stuff. see #4285
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 22:50:37 +00:00
rob1n
07bc0a6632 2.2 RC 1.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 17:35:33 +00:00
rob1n
c327680cee Check the user before overwriting the attachment. Props xknown and Joseph Scott. fixes #4422
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 17:06:58 +00:00
rob1n
cb975258ca Add support for multiple instances of the category widget. see #4285
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 14:49:30 +00:00
rob1n
d987e188d7 Revert [5639] for 2.2 branch, it's causing problems. see #4296
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-08 14:27:44 +00:00
ryan
5fbb3a3baa Remove comment_text filter from get_comment_to_edit. fixes #4403 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-05 14:41:29 +00:00
ryan
ac55c4bdd7 Add 'edit_posts' capability check to metaWeblog.newPost. Props Joseph Scott and Wei-Yeh Lee. fixes #4404 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-04 18:31:21 +00:00
ryan
074f490576 Verbump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-04 18:23:54 +00:00
ryan
6eb6101300 Run comment_text filter before format_to_edit() when getting a comment to edit. fixes #4403 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-04 17:46:02 +00:00
rob1n
ba59f6ea8f wp_mail() rewrite that handles HTML mail. fixes #4296
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-02 03:18:24 +00:00
rob1n
84f62dd1a4 Fix a strpos typo. fixes #4390
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-01 23:10:03 +00:00
rob1n
e8eda36825 Fix wp_title single post title filters. Props jhodgdon. fixes #3755
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-01 22:54:46 +00:00
markjaquith
fb7c000820 get_bloginfo("comments_atom_url") now works properly. fixes #4382 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-31 22:45:12 +00:00
markjaquith
c16ae810d6 correct "type" in Atom comments feed alternate links. fixes #4381 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-31 22:14:42 +00:00
rob1n
48ae0ff7ca Add option to exclude pages to pages widget. see #4259
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-31 01:57:10 +00:00
rob1n
cbd9294a83 Check that tinyMCE is defined. Props johnbillion. fixes #4257 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-31 01:31:04 +00:00
markjaquith
a4779fe395 sort by cat_ID for category permalinks, by name for get_the_category(). fixes #4335 for 2.2. Props Erik Barzeski for the find.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-29 04:56:44 +00:00
markjaquith
9074d62a78 Int casting and misc escaping for 2.2 Props g30rg3x. fixes #4333 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-29 04:37:35 +00:00
rob1n
14f5c0289c Apply [5570] to 2.2. fixes #4357
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-29 02:50:37 +00:00
rob1n
bd01e62afc Fix Atom feeds' categories. fixes #4307
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-25 15:55:30 +00:00
ryan
952087c2df RSD link fixes from Joseph Scott. fixes #4329 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-24 17:10:09 +00:00
rob1n
efa6212e7f Use selected() to clean that up. Thanks Mark. fixes #4291
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-24 00:29:51 +00:00
rob1n
bbb325e0c1 Fix bloginfo() filtering when it comes to links. Props Nazgul. fixes #4116
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-23 14:58:32 +00:00
rob1n
4f26da7350 Run the i through the parseInt to avoid IE 7 errors. fixes #4268
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 22:52:29 +00:00
rob1n
4678e74496 Run it through the filter. see #4259
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 22:36:56 +00:00
ryan
a8b6e530c6 Remove the_content filter from widget text. see #4259
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 21:31:37 +00:00
markjaquith
49e362f72e explicitly state Zulu time for desktop editors. Props Erik Barzeski and Joseph Scott. fixes #4314 for trunk
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 19:58:00 +00:00
markjaquith
3c0b16429e Prevent current author from claiming authorship of posts from other authors when editing via desktop client. Props Erik Barzeski. fixes #4315 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 19:53:33 +00:00
rob1n
2045553de4 Don't show title if user leaves it blank. see #4259
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-22 00:25:44 +00:00
rob1n
27026ab17d Fix accidental typo. fixes #4300
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 22:58:22 +00:00
rob1n
7f4475bedb Don't call is_wp_error() in wp_die() if it hasn't been defined yet. fixes #4308
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 22:50:32 +00:00
ryan
9d81575599 Fix theme template field. fixes #4310 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 20:11:27 +00:00
ryan
6317b80f81 Check if is_array before unsetting array index. fixes #4306
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 16:38:53 +00:00
rob1n
1b8ddc740f Pass text widget text through format_to_edit. Props Ryan. fixes #4302
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 13:13:22 +00:00
rob1n
48a8abb534 Fix wp-ajax.js addArg's hashes. Props technosailor. fixes #4277
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 12:56:39 +00:00
rob1n
377df0d7a9 Keep editing mode when paging through comments. fixes #4300
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-21 12:52:44 +00:00
rob1n
70cf7bb6a2 Doh. fixes #4292
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 23:44:37 +00:00
rob1n
39e02a871d Apply [5471] to 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 22:13:56 +00:00
ryan
9cc55c3312 Fix widget admin layout for IE7. Props Denis-de-Bernardy. fixes #4264 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 17:23:50 +00:00
rob1n
b6aed2a86d Check for switch_themes, not edit_themes. Props Denis de Bernardy. fixes #4292
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 04:38:51 +00:00
rob1n
ac6890d106 Don't fail when the user don't set WP-Cache up correctly. Props Denis de Bernardy. fixes #4293
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 04:32:28 +00:00
rob1n
d6dba8fab8 Select the option if it's set to that. fixes #4291
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 04:26:02 +00:00
ryan
3d8f9289cb Fix tinymce colorpicker. Props azaozz. fixes #4288 for 2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-19 00:10:57 +00:00
rob1n
24298eb78f Texturize and autop the text widgets, and allow pages to be sorted by a specified field. Props Denis de Bernardy. see #4259
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-18 02:29:11 +00:00
ryan
55b780320b Restore crack-headed arg passing to register_sidebar_widget(). fixes #4275
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-16 17:48:31 +00:00
rob1n
b8314bc5aa Fix some attribute misnamings. Props Erunafailaro. fixes #4274
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-16 17:37:55 +00:00
ryan
ab32166864 Let's Getz it on.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-15 21:57:56 +00:00
ryan
81a13c27f5 Add nonce to avoid AYS when restoring image header.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-15 16:47:07 +00:00
ryan
dc5e0fe929 Theme screenshot fix from mdawaffe. fixes #4266 for 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-14 23:30:05 +00:00
ryan
f45b44194e Allow sidebar names to be passed to dynamic_sidebar(). fixes #4258 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-14 05:12:52 +00:00
ryan
e9a0c47a63 More Kubrick custom color header i18n from nbachiyski. fixes #4256 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-13 18:45:58 +00:00
ryan
edeb3e0868 Kubrick custin color header i18n from nbachiyski. fixes #4256 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-13 17:56:16 +00:00
ryan
79e3d24c60 RC2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-12 22:37:24 +00:00
ryan
fa3e76d676 Flush all output buffers during shutdown to avoid PHP 5 bustage. fixes #3354 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-12 22:37:07 +00:00
ryan
a885d5be4f Return proper protocol. fixes #3886 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-12 21:58:38 +00:00
rob1n
99346e897a Seeing double. Good spot momo360modena. fixes #4251 for 2.1, 2.2 and 2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-12 19:47:47 +00:00
matt
bdbafbe8a9 The config file has been deliberately CRLF since [2370] to recognize that most people will be editing this file in a crappy windows editor.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-12 18:29:27 +00:00
ryan
3eaa92b8c5 Revert debug cruft accidentally committed with [5452]. Bad Ryan
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-11 21:41:53 +00:00
ryan
182c409c58 Fix for PHP version 5.2.2 where isn't set. fixes #4248 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-11 21:40:15 +00:00
rob1n
c3fc60a2ee Let WebKit 420 and above in for TinyMCE. fixes #4241 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-11 01:00:30 +00:00
ryan
9532679648 Escapage
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-11 00:55:59 +00:00
ryan
65ffc78548 Handle local and remote blogroll imports. Props apokalyptik. fixes #4243 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 21:21:37 +00:00
ryan
76ad2cc5e6 Left, right, dragChange, hop. s/left/right/. Props Lawrence Pit. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 21:18:01 +00:00
ryan
ec0efa21b5 Use correct var. Props charismabiz. fixes #4246 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 21:07:51 +00:00
ryan
cc6a998e20 Cast to array to avoid warning.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 16:31:49 +00:00
ryan
c22a4ed9f1 Var is an object var. Add missing this.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 02:30:58 +00:00
ryan
1f0a61fd73 Don't preg_match_all when processing items. fixes #4239 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-10 00:05:03 +00:00
ryan
2795b2e9d2 Obey show_post_count for dropdown.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-09 21:54:04 +00:00
ryan
b1a9963671 Include plugin.php before calling wp_die. fixes #4238 for 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-09 16:17:41 +00:00
rob1n
cfb41a5ad1 *Bump*. 2.2-RC1.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-09 01:40:10 +00:00
ryan
0e212e9a85 Make sure wp_actions is set before counting.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-08 17:59:32 +00:00
ryan
765fc389ce Don't send header from wp_die() if admin header already sent. fixes #4234 for 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-07 23:24:09 +00:00
ryan
72045b52b8 Fix did_action to properly account for actions that have no callbacks attached.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-07 23:22:28 +00:00
ryan
a78ebdcccb Add nonces to importers
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-07 15:57:15 +00:00
ryan
ef3400be6e attribute_escape for widgets. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-07 02:16:03 +00:00
ryan
061bad455b Make sure Widgets menu comes after Themes. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-06 20:35:51 +00:00
ryan
68866e9571 Fix widget registration back compat by splitting API. Fix feed widget. For 2.2. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-06 07:07:36 +00:00
ryan
2240947c82 Resurrect wp_parse_args() for 2.2.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-05 17:09:45 +00:00
rob1n
c973ad1d0e Add in missing delimiter. fixes #4226 for 2.0, 2.2 and 2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-05 02:51:20 +00:00
rob1n
8382333b7f Don't set URL options if WP_HOME and or WP_SITEURL are defined. Props filosofo. fixes #4199
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-05 00:19:25 +00:00
rob1n
f2e57bf305 Use WP_HOME and WP_SITEURL in upgrading. Props filosofo. fixes #4211
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-05 00:17:05 +00:00
ryan
2e7433967d eol-style everywhere
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-04 21:48:43 +00:00
ryan
e0c548de57 Set eol-style
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-04 21:27:10 +00:00
ryan
dd3e81b07c Do a cap check at the top of widgets since it won't always inherit the menu cap check.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-04 17:52:57 +00:00
ryan
d7a6781cc6 Add 'Select' text to the dropdowns. Props Joseph Scott.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-04 02:24:23 +00:00
rob1n
aa19ffe126 Load order fixed.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-03 00:52:14 +00:00
rob1n
6f2a4b74a9 Don't show Widgets admin page if core widgets aren't enabled. fixes #4218
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-03 00:43:57 +00:00
rob1n
6ecf459918 Don't double encode gzip output if gzip is already set in php.ini. Props welcomb. fixes #4205 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-02 02:36:44 +00:00
ryan
5a547001ee Call get_option('siteurl') outside the loop to save a few dozen get_option calls. Props andissimo.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-02 00:32:38 +00:00
ryan
e2e4ea32da Fix inline uploader page links. Props mdawaffe. fixes #4217 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-01 23:34:00 +00:00
ryan
5964d5f48a Remove wp_ prefix from default widget class names. For back compat.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-01 22:52:14 +00:00
ryan
b7cfc5c173 Set eol-style
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-01 17:45:32 +00:00
rob1n
276c2f7b94 New way of loading widgets that works with PHP 5. Thanks to filosofo for testing. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-01 01:58:18 +00:00
rob1n
67bd2acaf9 Move widget stuff around. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-05-01 01:13:06 +00:00
ryan
a4c00744ff Widget registration fixes from Andy. For 2.2. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 20:02:15 +00:00
ryan
41a9ec3b9a When using the traditional list view of the categories,
make sure the wp_list_categories() doesn't add in another title. This
was causing a second Categories to show up on the category widget.  Props Jospeh Scott

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 17:46:38 +00:00
ryan
73d48439f8 Fix typo breaking recent comment cache deletion for widgets.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 16:45:44 +00:00
ryan
041af31c32 Remove debug
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 03:47:34 +00:00
ryan
407b07f2a7 Don't use deprecated category API.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 03:33:13 +00:00
rob1n
77fb8f7ac6 Bring back old behavior for sidebar ID's. Props filosofo. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-30 02:35:28 +00:00
rob1n
0003f83892 Check basename(). see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-29 21:00:54 +00:00
rob1n
79bfe4e9d0 Automattically deactivate Automattic Widgets, if activated. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-29 20:53:29 +00:00
rob1n
4143d41188 Move widgets' JS into the <head> of widgets.php. Should fix text/rss widget controls. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-29 20:16:26 +00:00
ryan
5a58316eb0 Fix widget control registration where id is not passed in.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-28 17:04:39 +00:00
ryan
4bbdc94490 Create widget id from widget name when id not specified.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-28 06:08:45 +00:00
ryan
f59d101bd8 Kick widgets init from init hook.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-28 00:36:04 +00:00
ryan
e3748ee830 Some widgets gettext.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-28 00:29:53 +00:00
rob1n
800477a81b Add widgets-rtl.css into 2.2. Props Sewar. fixes #4185
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-27 20:49:52 +00:00
rob1n
e159d212e8 Widgets RTL CSS, and a few little widget bugfixes. Props Sewar. fixes #4185
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-27 00:51:19 +00:00
ryan
6cbf98b1b7 Fix text and rss widget registration. fixes #4202 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-26 17:49:53 +00:00
ryan
a822a3cf5c Add dropdown option to archives and categories widgets. Props Joseph Scott. fixes #4194 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-26 17:17:11 +00:00
rob1n
13dd0b74e7 Links widget fixes from Otto42. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-26 03:43:59 +00:00
rob1n
11675fb3fc WordPress.com -> .org and change widgetize link to Automattic's site for now. We still need to make a Codex page, just to make it more "WordPressy."
Props foolswisdom. fixes #4200


git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-26 02:13:18 +00:00
ryan
9fadff8d4b Remove rel_type ref
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-25 18:54:29 +00:00
rob1n
15d3bf89ce Variable name fix. Props filosofo. For 2.2. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-25 03:06:19 +00:00
ryan
6298c5b93c Update widgets to latet bits. For 2.2. see #4169
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-24 23:46:57 +00:00
ryan
8bffc54b84 Use GMT in XML-RPC dateCreated fields. Props Joseph Scott. fixes #4158 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-24 23:40:21 +00:00
ryan
bb55b9ecc0 Set eol-style on new files.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-24 18:39:44 +00:00
ryan
bac405380f Fix variable collission in _get_cat_children. For 2.2. see #3985
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-23 20:31:47 +00:00
rob1n
fb198a068a Widgets support. fixes #4169 for 2.2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-22 23:27:40 +00:00
rob1n
e1127ba7ba Bump 2.2 version in readme.html. Props spencerp. fixes #4175
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-21 02:20:09 +00:00
rob1n
c6684fd4aa Properly close the paragraph. Props zeo. fixes #4171 for both 2.2 and 2.3
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-20 03:52:41 +00:00
markjaquith
a9b5bc0f13 Roll tags out of 2.2 -- reverts [5272], [5271], [5257], [5254], [5253], [5251], [5250], [5243], [5235], [5234], [5232], [5231], [5229], [5228], [5217], [5216], [5215], [5213], half of [5210], [5209], [5205], [5203], [5201], [5196], [5184], [5168], [5163], [5162], [5150], [5149], [5148], [5147], [5113], [5112], [5111], and [5110]
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-19 22:26:52 +00:00
ryan
bcbe992d05 2.2 branch
git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-04-19 04:04:22 +00:00
235 changed files with 12430 additions and 19821 deletions

View File

@@ -3,12 +3,12 @@
<head>
<title>WordPress &rsaquo; ReadMe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="wp-admin/css/install.css" type="text/css" />
<link rel="stylesheet" href="wp-admin/install.css" type="text/css" />
</head>
<body>
<h1 id="logo" style="text-align: center">
<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
<br /> Version 2.3
<br /> Version 2.2
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
@@ -29,7 +29,7 @@
<h1>Upgrading</h1>
<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
<h2>Upgrading from any previous WordPress to 2.3:</h2>
<h2>Upgrading from any previous WordPress to 2.2:</h2>
<ol>
<li>Delete your old WP files, saving ones you've modified.</li>
<li>Upload the new files.</li>

View File

@@ -1,6 +1,7 @@
<?php
require_once('../wp-config.php');
require_once('includes/admin.php');
require_once('admin-functions.php');
require_once('admin-db.php');
define('DOING_AJAX', true);
@@ -125,28 +126,6 @@ case 'add-category' : // On the Fly
}
$x->send();
break;
case 'add-link-category' : // On the Fly
if ( !current_user_can( 'manage_categories' ) )
die('-1');
$names = explode(',', $_POST['newcat']);
$x = new WP_Ajax_Response();
foreach ( $names as $cat_name ) {
$cat_name = trim($cat_name);
if ( !$slug = sanitize_title($cat_name) )
die('0');
if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) {
$cat_id = wp_insert_term( $cat_name, 'link_category' );
$cat_id = $cat_id['term_id'];
}
$cat_name = wp_specialchars(stripslashes($cat_name));
$x->add( array(
'what' => 'link-category',
'id' => $cat_id,
'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>"
) );
}
$x->send();
break;
case 'add-cat' : // From Manage->Categories
if ( !current_user_can( 'manage_categories' ) )
die('-1');
@@ -204,11 +183,8 @@ case 'add-meta' :
$now = current_time('timestamp', 1);
if ( $pid = wp_insert_post( array(
'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
) ) ) {
if ( is_wp_error( $pid ) )
return $pid;
) ) )
$mid = add_meta( $pid );
}
else
die('0');
} else if ( !$mid = add_meta( $id ) ) {

525
wp-admin/admin-db.php Normal file
View File

@@ -0,0 +1,525 @@
<?php
function get_users_drafts( $user_id ) {
global $wpdb;
$user_id = (int) $user_id;
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
$query = apply_filters('get_users_drafts', $query);
return $wpdb->get_results( $query );
}
function get_others_drafts( $user_id ) {
global $wpdb;
$user = get_userdata( $user_id );
$level_key = $wpdb->prefix . 'user_level';
$editable = get_editable_user_ids( $user_id );
if( !$editable ) {
$other_drafts = '';
} else {
$editable = join(',', $editable);
$other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
}
return apply_filters('get_others_drafts', $other_drafts);
}
function get_editable_authors( $user_id ) {
global $wpdb;
$editable = get_editable_user_ids( $user_id );
if( !$editable ) {
return false;
} else {
$editable = join(',', $editable);
$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
}
return apply_filters('get_editable_authors', $authors);
}
function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
global $wpdb;
$user = new WP_User( $user_id );
if ( ! $user->has_cap('edit_others_posts') ) {
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
return array($user->id);
else
return false;
}
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
if ( $exclude_zeros )
$query .= " AND meta_value != '0'";
return $wpdb->get_col( $query );
}
function get_author_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
return $wpdb->get_col( $query );
}
function get_nonauthor_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
return $wpdb->get_col( $query );
}
function wp_insert_category($catarr) {
global $wpdb;
extract($catarr, EXTR_SKIP);
if( trim( $cat_name ) == '' )
return 0;
$cat_ID = (int) $cat_ID;
// Are we updating or creating?
if (!empty ($cat_ID))
$update = true;
else
$update = false;
$cat_name = apply_filters('pre_category_name', $cat_name);
if (empty ($category_nicename))
$category_nicename = sanitize_title($cat_name);
else
$category_nicename = sanitize_title($category_nicename);
$category_nicename = apply_filters('pre_category_nicename', $category_nicename);
if (empty ($category_description))
$category_description = '';
$category_description = apply_filters('pre_category_description', $category_description);
$category_parent = (int) $category_parent;
if ( empty($category_parent) || !get_category( $category_parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $category_parent) ) )
$category_parent = 0;
if ( isset($posts_private) )
$posts_private = (int) $posts_private;
else
$posts_private = 0;
if ( isset($links_private) )
$links_private = (int) $links_private;
else
$links_private = 0;
if (!$update) {
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");
$cat_ID = (int) $wpdb->insert_id;
} else {
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");
}
if ( $category_nicename == '' ) {
$category_nicename = sanitize_title($cat_name, $cat_ID );
$wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" );
}
// Keep in mind when using this filter and altering the cat_ID that the two queries above
// have already taken place with the OLD cat_ID
// Also note that you may have post2cat entries with the old cat_ID if this is an update
if ($update) {
do_action('edit_category', $cat_ID);
} else {
do_action('create_category', $cat_ID);
do_action('add_category', $cat_ID);
}
$cat_ID = apply_filters('cat_id_filter', $cat_ID, $update);
clean_category_cache($cat_ID);
if ($update)
do_action('edited_category', $cat_ID);
else
do_action('created_category', $cat_ID);
return $cat_ID;
}
function wp_update_category($catarr) {
global $wpdb;
$cat_ID = (int) $catarr['cat_ID'];
if( $cat_ID == $catarr['category_parent'] )
return false;
// First, get all of the original fields
$category = get_category($cat_ID, ARRAY_A);
// Escape data pulled from DB.
$category = add_magic_quotes($category);
// Merge old and new fields with new fields overwriting old ones.
$catarr = array_merge($category, $catarr);
return wp_insert_category($catarr);
}
function wp_delete_category($cat_ID) {
global $wpdb;
$cat_ID = (int) $cat_ID;
$default_cat = get_option('default_category');
$default_link_cat = get_option('default_link_category');
// Don't delete either of the default cats
if ( $cat_ID == $default_cat || $cat_ID == $default_link_cat )
return 0;
$category = get_category($cat_ID);
$parent = $category->category_parent;
// Delete the category
if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") )
return 0;
// Update children to point to new parent
$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
// Only set posts and links to the default category if they're not in another category already
$posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'");
foreach ( (array) $posts as $post_id ) {
$cats = wp_get_post_categories($post_id);
if ( 1 == count($cats) )
$cats = array($default_cat);
else
$cats = array_diff($cats, array($cat_ID));
wp_set_post_categories($post_id, $cats);
}
$links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'");
foreach ( (array) $links as $link_id ) {
$cats = wp_get_link_cats($link_id);
if ( 1 == count($cats) )
$cats = array($default_link_cat);
else
$cats = array_diff($cats, array($cat_ID));
wp_set_link_cats($link_id, $cats);
}
clean_category_cache($cat_ID);
do_action('delete_category', $cat_ID);
return 1;
}
function wp_create_category($cat_name) {
$cat_array = compact('cat_name');
return wp_insert_category($cat_array);
}
function wp_create_categories($categories, $post_id = '') {
$cat_ids = array ();
foreach ($categories as $category) {
if ($id = category_exists($category))
$cat_ids[] = $id;
else
if ($id = wp_create_category($category))
$cat_ids[] = $id;
}
if ($post_id)
wp_set_post_categories($post_id, $cat_ids);
return $cat_ids;
}
function category_exists($cat_name) {
global $wpdb;
if (!$category_nicename = sanitize_title($cat_name))
return 0;
return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
}
function wp_delete_user($id, $reassign = 'novalue') {
global $wpdb;
$id = (int) $id;
$user = get_userdata($id);
if ($reassign == 'novalue') {
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
if ($post_ids) {
foreach ($post_ids as $post_id)
wp_delete_post($post_id);
}
// Clean links
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
} else {
$reassign = (int) $reassign;
$wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
$wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
}
// FINALLY, delete user
do_action('delete_user', $id);
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
wp_cache_delete($id, 'users');
wp_cache_delete($user->user_login, 'userlogins');
return true;
}
function wp_revoke_user($id) {
$id = (int) $id;
$user = new WP_User($id);
$user->remove_all_caps();
}
function wp_insert_link($linkdata) {
global $wpdb, $current_user;
extract($linkdata, EXTR_SKIP);
$update = false;
if ( !empty($link_id) )
$update = true;
$link_id = (int) $link_id;
if( trim( $link_name ) == '' )
return 0;
$link_name = apply_filters('pre_link_name', $link_name);
if( trim( $link_url ) == '' )
return 0;
$link_url = apply_filters('pre_link_url', $link_url);
if ( empty($link_rating) )
$link_rating = 0;
else
$link_rating = (int) $link_rating;
if ( empty($link_image) )
$link_image = '';
$link_image = apply_filters('pre_link_image', $link_image);
if ( empty($link_target) )
$link_target = '';
$link_target = apply_filters('pre_link_target', $link_target);
if ( empty($link_visible) )
$link_visible = 'Y';
$link_visibile = preg_replace('/[^YNyn]/', '', $link_visible);
if ( empty($link_owner) )
$link_owner = $current_user->id;
else
$link_owner = (int) $link_owner;
if ( empty($link_notes) )
$link_notes = '';
$link_notes = apply_filters('pre_link_notes', $link_notes);
if ( empty($link_description) )
$link_description = '';
$link_description = apply_filters('pre_link_description', $link_description);
if ( empty($link_rss) )
$link_rss = '';
$link_rss = apply_filters('pre_link_rss', $link_rss);
if ( empty($link_rel) )
$link_rel = '';
$link_rel = apply_filters('pre_link_rel', $link_rel);
// Make sure we set a valid category
if (0 == count($link_category) || !is_array($link_category)) {
$link_category = array(get_option('default_link_category'));
}
if ( $update ) {
$wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
link_name='$link_name', link_image='$link_image',
link_target='$link_target',
link_visible='$link_visible', link_description='$link_description',
link_rating='$link_rating', link_rel='$link_rel',
link_notes='$link_notes', link_rss = '$link_rss'
WHERE link_id='$link_id'");
} else {
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = (int) $wpdb->insert_id;
}
wp_set_link_cats($link_id, $link_category);
if ( $update )
do_action('edit_link', $link_id);
else
do_action('add_link', $link_id);
return $link_id;
}
function wp_update_link($linkdata) {
global $wpdb;
$link_id = (int) $linkdata['link_id'];
$link = get_link($link_id, ARRAY_A);
// Escape data pulled from DB.
$link = add_magic_quotes($link);
// Passed link category list overwrites existing category list if not empty.
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
&& 0 != count($linkdata['link_category']) )
$link_cats = $linkdata['link_category'];
else
$link_cats = $link['link_category'];
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata);
$linkdata['link_category'] = $link_cats;
return wp_insert_link($linkdata);
}
function wp_delete_link($link_id) {
global $wpdb;
do_action('delete_link', $link_id);
$categories = wp_get_link_cats($link_id);
if( is_array( $categories ) ) {
foreach ( $categories as $category ) {
$wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'");
wp_cache_delete($category, 'category');
do_action('edit_category', $cat_id);
}
}
$wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'");
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
do_action('deleted_link', $link_id);
return true;
}
function wp_get_link_cats($link_ID = 0) {
global $wpdb;
$sql = "SELECT category_id
FROM $wpdb->link2cat
WHERE link_id = $link_ID
ORDER BY category_id";
$result = $wpdb->get_col($sql);
if ( !$result )
$result = array();
return array_unique($result);
}
function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
global $wpdb;
// If $link_categories isn't already an array, make it one:
if (!is_array($link_categories) || 0 == count($link_categories))
$link_categories = array(get_option('default_link_category'));
$link_categories = array_unique($link_categories);
// First the old categories
$old_categories = $wpdb->get_col("
SELECT category_id
FROM $wpdb->link2cat
WHERE link_id = '$link_ID'");
if (!$old_categories) {
$old_categories = array();
} else {
$old_categories = array_unique($old_categories);
}
// Delete any?
$delete_cats = array_diff($old_categories,$link_categories);
if ($delete_cats) {
foreach ($delete_cats as $del) {
$del = (int) $del;
$wpdb->query("
DELETE FROM $wpdb->link2cat
WHERE category_id = '$del'
AND link_id = '$link_ID'
");
}
}
// Add any?
$add_cats = array_diff($link_categories, $old_categories);
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$new_cat = (int) $new_cat;
if ( !empty($new_cat) )
$wpdb->query("
INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ('$link_ID', '$new_cat')");
}
}
// Update category counts.
$all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
foreach ( $all_affected_cats as $cat_id ) {
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->link2cat, $wpdb->links WHERE $wpdb->links.link_id = $wpdb->link2cat.link_id AND category_id = '$cat_id'");
$wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'");
wp_cache_delete($cat_id, 'category');
do_action('edit_category', $cat_id);
}
} // wp_set_link_cats()
function post_exists($title, $content = '', $post_date = '') {
global $wpdb;
if (!empty ($post_date))
$post_date = "AND post_date = '$post_date'";
if (!empty ($title))
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
else
if (!empty ($content))
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
return 0;
}
function comment_exists($comment_author, $comment_date) {
global $wpdb;
return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
}
?>

View File

@@ -1,13 +1,10 @@
<div id="footer">
<p><?php
$upgrade = apply_filters( 'update_footer', '' );
echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>').' | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>').' '.$upgrade;
?></p>
<p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br />
<?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?></p>
</div>
<?php do_action('admin_footer', ''); ?>
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
</body>
</html>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
if (!isset($_GET["page"])) require_once('admin.php');
if ( $editing ) {
wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields') );
@@ -17,7 +17,10 @@ get_admin_page_title();
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php echo wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
<?php wp_admin_css(); ?>
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php endif; ?>
<script type="text/javascript">
//<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
@@ -39,16 +42,16 @@ else if ( isset($plugin_page) )
do_action('admin_head');
?>
</head>
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
<body>
<div id="wphead">
<h1><?php bloginfo('name'); ?> <span id="viewsite">(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
<h1><?php bloginfo('name'); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
</div>
<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div>
<?php
require(ABSPATH . 'wp-admin/menu-header.php');
require(ABSPATH . '/wp-admin/menu-header.php');
if ( $parent_file == 'options-general.php' ) {
require(ABSPATH . 'wp-admin/options-head.php');
require(ABSPATH . '/wp-admin/options-head.php');
}
?>

View File

@@ -1,6 +1,4 @@
<?php
define('WP_ADMIN', TRUE);
if ( defined('ABSPATH') )
require_once( ABSPATH . 'wp-config.php');
else
@@ -11,7 +9,9 @@ if ( get_option('db_version') != $wp_db_version ) {
exit;
}
require_once(ABSPATH . 'wp-admin/includes/admin.php');
require_once(ABSPATH . 'wp-admin/admin-functions.php');
require_once(ABSPATH . 'wp-admin/admin-db.php');
require_once(ABSPATH . WPINC . '/registration.php');
auth_redirect();
@@ -37,7 +37,7 @@ if (isset($_GET['page'])) {
$plugin_page = plugin_basename($plugin_page);
}
require(ABSPATH . 'wp-admin/menu.php');
require(ABSPATH . '/wp-admin/menu.php');
// Handle plugin admin pages.
if (isset($plugin_page)) {
@@ -46,7 +46,7 @@ if (isset($plugin_page)) {
if ( $page_hook ) {
do_action('load-' . $page_hook);
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
require_once(ABSPATH . '/wp-admin/admin-header.php');
do_action($page_hook);
} else {
@@ -60,7 +60,7 @@ if (isset($plugin_page)) {
do_action('load-' . $plugin_page);
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
require_once(ABSPATH . '/wp-admin/admin-header.php');
include(ABSPATH . PLUGINDIR . "/$plugin_page");
}
@@ -79,15 +79,10 @@ if (isset($plugin_page)) {
wp_die(__('Invalid importer.'));
}
// Allow plugins to define importers as well
if (! is_callable($wp_importers[$importer][2]))
{
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
{
wp_die(__('Cannot load importer.'));
}
include(ABSPATH . "wp-admin/import/$importer.php");
}
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
wp_die(__('Cannot load importer.'));
include(ABSPATH . "wp-admin/import/$importer.php");
$parent_file = 'edit.php';
$submenu_file = 'import.php';
@@ -96,7 +91,7 @@ if (isset($plugin_page)) {
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
define('WP_IMPORTING', true);

View File

@@ -51,7 +51,7 @@ if ( !empty($content) ) {
<head>
<title><?php bloginfo('name') ?> &rsaquo; Bookmarklet &#8212; WordPress</title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<?php wp_admin_css(); ?>
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<style type="text/css">
<!--

View File

@@ -4,8 +4,7 @@ function newCatAddIn() {
var jaxcat = $('jaxcat');
if ( !jaxcat )
return false;
// These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>');
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>');
$('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
$('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
}

View File

@@ -36,6 +36,9 @@ case 'delete':
if ( $cat_ID == get_option('default_category') )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
if ( $cat_ID == get_option('default_link_category') )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one for links"), $cat_name));
wp_delete_category($cat_ID);
wp_redirect('categories.php?message=2');
@@ -60,9 +63,9 @@ case 'editedcat':
wp_die(__('Cheatin&#8217; uh?'));
if ( wp_update_category($_POST) )
wp_redirect('categories.php?message=3');
wp_redirect('categories.php?message=3');
else
wp_redirect('categories.php?message=5');
wp_redirect('categories.php?message=5');
exit;
break;
@@ -96,6 +99,7 @@ $messages[5] = __('Category not updated.');
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
<th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
</tr>
</thead>
@@ -110,12 +114,10 @@ cat_rows();
<?php if ( current_user_can('manage_categories') ) : ?>
<div class="wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong> and links that were only assigned to the deleted category are set to <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category'))), apply_filters('the_category', get_catname(get_option('default_link_category')))) ?></p>
</div>
<?php include('edit-category-form.php'); ?>
<?php endif; ?>
<?php

View File

@@ -91,7 +91,7 @@ case 'mac':
<?php if ( $comment->comment_author_url ) { ?>
<tr>
<th scope="row"><?php _e('URL:'); ?></th>
<td><a href='<?php echo $comment->comment_author_url; ?>'><?php echo $comment->comment_author_url; ?></a></td>
<td><?php echo $comment->comment_author_url; ?></td>
</tr>
<?php } ?>
<tr>
@@ -155,7 +155,7 @@ case 'unapprovecomment':
if ((wp_get_referer() != "") && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p=' . (int) $comment->comment_post_ID.'&c=1#comments');
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments');
}
exit();
break;
@@ -185,7 +185,7 @@ case 'approvecomment':
if ((wp_get_referer() != "") && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p=' . (int) $comment->comment_post_ID.'&c=1#comments');
wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments');
}
exit();
break;

View File

@@ -1,12 +0,0 @@
html {
direction: ltr;
}
#uploadoptions, table {
direction: rtl;
}
td {
padding: 1px 6px 0;
}
.submit {
text-align: left;
}

View File

@@ -1,38 +0,0 @@
.dropzone,
#palettediv,
.handle,
.controlform {
direction: rtl;
text-align: justify;
}
.dropzone {
float: right;
margin-left: 10px;
margin-right: auto;
width: 240px;
}
* html .dropzone ul {
margin-right: 0;
}
* .handle, #lastmodule span {
border-left: 1px solid #e8e8e8;
border-right: 1px solid #f2f2f2;
}
* .popper {
right: auto;
left: 3px;
}
#palettediv .module, #lastmodule {
margin-right: auto;
margin-left: 10px;
float: right;
}
#palettediv ul {
padding: 0 10px 0 0;
margin-right: 0;
width: 100%;
}
.placemat {
margin-right: 0;
float: right;
}

View File

@@ -160,7 +160,7 @@ Event.observe( window, 'load', hide_text );
<h2><?php _e('Your Header Image'); ?></h2>
<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
<div id="headimg" style="background-image: url(<?php clean_url(header_image()) ?>);">
<div id="headimg" style="background: url(<?php clean_url(header_image()) ?>) no-repeat;">
<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
<div id="desc"><?php bloginfo('description');?></div>
</div>
@@ -169,7 +169,7 @@ Event.observe( window, 'load', hide_text );
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
<?php wp_nonce_field('custom-header') ?>
<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes &raquo;'); ?>" /></form>
<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
<?php } ?>
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
@@ -183,7 +183,7 @@ Event.observe( window, 'load', hide_text );
<input type="hidden" name="action" value="save" />
<?php wp_nonce_field('custom-header') ?>
<p class="submit">
<input type="submit" value="<?php _e('Upload &raquo;'); ?>" />
<input type="submit" value="<?php _e('Upload'); ?> &raquo;" />
</p>
</form>

View File

@@ -21,26 +21,26 @@ if ( ! empty($cat_ID) ) {
<div id="ajax-response"></div>
<?php echo $form ?>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
<input type="hidden" name="cat_ID" value="<?php echo $category->cat_ID ?>" />
<?php wp_nonce_field($nonce_action); ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /></td>
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->cat_name); ?>" size="40" /></td>
</tr>
<tr>
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /></td>
<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->category_nicename); ?>" size="40" /></td>
</tr>
<tr>
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
<td>
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
<td>
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea></td>
<td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->category_description); ?></textarea></td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>

View File

@@ -39,14 +39,14 @@ function getNumChecked(form)
</script>
<div class="wrap">
<h2><?php _e('Comments'); ?></h2>
<form name="searchform" action="" method="get" id="editcomments">
<fieldset>
<legend><?php _e('Show Comments That Contain...') ?></legend>
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
<form name="searchform" action="" method="get" id="editcomments">
<fieldset>
<legend><?php _e('Show Comments That Contain...') ?></legend>
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
<?php _e('(Searches within comment text, e-mail, URL, and IP address.)') ?>
</fieldset>
</fieldset>
</form>
<p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p>
<?php
@@ -88,7 +88,7 @@ $comments = array_slice($_comments, 0, 20);
$extra_comments = array_slice($_comments, 20);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
'total' => ceil($total / 20),
'current' => $page
@@ -151,22 +151,21 @@ if ( $extra_comments ) : ?>
</tr>
</thead>';
foreach ($comments as $comment) {
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
$class = ('alternate' == $class) ? '' : 'alternate';
$class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
?>
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
<td style="text-align: center"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<td><?php comment_author_link() ?></td>
<td><?php comment_author_email_link() ?></td>
<td><a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=edit"><?php comment_author_IP() ?></a></td>
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
<td><?php comment_excerpt(); ?></td>
<td>
<?php if ('unapproved' == $comment_status) {
_e('Unapproved');
} else { ?>
<?php if ('unapproved' == $comment_status) { ?>
(Unapproved)
<?php } else { ?>
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
<?php } ?>
</td>
@@ -176,7 +175,7 @@ if ( $extra_comments ) : ?>
echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'. \n 'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
} ?></td>
</tr>
<?php
<?php
} // end foreach
?></table>
<p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php echo js_escape(__("Please select some comments to delete")); ?>'); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to delete %s comments permanently \n 'Cancel' to stop, 'OK' to delete.")), "' + numchecked + '"); ?>')" />

View File

@@ -1,6 +1,6 @@
<?php
if ( isset($_GET['message']) )
$_GET['message'] = (int) $_GET['message'];
$_GET['message'] = (int) $_GET['message'];
$messages[1] = __('Post updated');
$messages[2] = __('Custom field updated');
$messages[3] = __('Custom field deleted.');
@@ -57,7 +57,7 @@ if (empty($post->post_status)) $post->post_status = 'draft';
<input type="hidden" id="post_type" name="post_type" value="post" />
<?php echo $form_extra ?>
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
<?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
<script type="text/javascript">
function focusit() {
// focus on first input field
@@ -84,28 +84,26 @@ addLoadEvent(focusit);
<input name="advanced_view" type="hidden" value="1" />
<label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label>
<?php _e('Allow Comments') ?></label>
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
</div>
</fieldset>
<fieldset id="passworddiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
<h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div>
</fieldset>
<fieldset id="slugdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div>
</fieldset>
<fieldset id="poststatusdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
<div class="dbx-content">
<?php if ( current_user_can('publish_posts') ) : ?>
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
<div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
<?php endif; ?>
<label for="post_status_pending" class="selectit"><input id="post_status_pending" name="post_status" type="radio" value="pending" <?php checked($post->post_status, 'pending'); ?> /> <?php _e('Pending Review') ?></label>
<label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
</fieldset>
@@ -117,16 +115,23 @@ addLoadEvent(focusit);
</fieldset>
<?php endif; ?>
<?php
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
<?php
$authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM
if ( $authors && count( $authors ) > 1 ) :
?>
<fieldset id="authordiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Author'); ?></h3>
<div class="dbx-content">
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
<select name="post_author_override" id="post_author_override">
<?php
foreach ($authors as $o) :
$o = get_userdata( $o->ID );
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
else $selected = '';
echo "<option value='" . (int) $o->ID . "' $selected>" . wp_specialchars( $o->display_name ) . "</option>";
endforeach;
?>
</select>
</div>
</fieldset>
<?php endif; ?>
@@ -157,27 +162,21 @@ if ( $authors && count( $authors ) > 1 ) :
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
<fieldset id="tagdiv">
<legend><?php _e('Tags (separate multiple tags with commas: cats, pet food, dogs)'); ?></legend>
<div><input type="text" name="tags_input" class="tags-input" id="tags-input" size="30" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></div>
</fieldset>
<p class="submit">
<span id="autosave"></span>
<?php echo $saveasdraft; ?>
<input type="submit" name="submit" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
<?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
<input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
<?php
if ('publish' != $post->post_status || 0 == $post_ID) {
?>
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?>
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish'); ?>" />
<?php endif; ?>
<?php
}
?>
<input name="referredby" type="hidden" id="referredby" value="<?php
<input name="referredby" type="hidden" id="referredby" value="<?php
if ( !empty($_REQUEST['popupurl']) )
echo clean_url(stripslashes($_REQUEST['popupurl']));
else if ( url_to_postid(wp_get_referer()) == $post_ID )
@@ -194,7 +193,7 @@ if (current_user_can('upload_files')) {
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
}
?>

View File

@@ -6,7 +6,6 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
?>
<form name="post" action="comment.php" method="post" id="post">
<h2><?php echo $toprow_title; ?></h2>
<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
<div class="wrap">
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
@@ -33,7 +32,7 @@ addLoadEvent(focusit);
<fieldset id="uridiv">
<legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend>
<div>
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="2" />
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
</div>
</fieldset>
@@ -54,21 +53,21 @@ addLoadEvent(focusit);
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> tabindex="4" /> <?php _e('Approved') ?></label> &nbsp;
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> tabindex="4" /> <?php _e('Moderated') ?></label> &nbsp;
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> tabindex="4" /> <?php _e('Spam') ?></label></td>
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
</tr>
<?php if ( current_user_can('edit_posts') ) : ?>
<tr>
<th scope="row" valign="top"><?php _e('Edit time'); ?>:</th>
<td><?php touch_time(('editcomment' == $action), 0, 5); ?> </td>
<td><?php touch_time(('editcomment' == $action), 0); ?> </td>
</tr>
<?php endif; ?>
<tr>
<th scope="row" valign="top">&nbsp;</th>
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '" . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) . "'; return true; } return false;\""; ?> />
<th scope="row" valign="top"><?php _e('Delete'); $delete_nonce = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); ?>:</th>
<td><input name="deletecomment" class="button delete" type="submit" id="deletecomment" tabindex="10" value="<?php _e('Delete this comment') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true; } return false;\""; ?> />
<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
<input type="hidden" name="noredir" value="1" />

View File

@@ -20,18 +20,19 @@ addLoadEvent(focusit);
<div id="poststuff">
<fieldset id="titlediv">
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
</fieldset>
<fieldset id="categorydiv">
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
<div><?php dropdown_categories($post->post_category); ?></div>
</fieldset>
<br />
<fieldset id="postdiv">
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
<?php the_quicktags(); ?>
<?php
$rows = get_option('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {

View File

@@ -1,93 +0,0 @@
<?php
require_once('admin.php');
$title = __('Categories');
$parent_file = 'link-manager.php';
//wp_enqueue_script( 'admin-categories' ); TODO: Fix AJAX
require_once ('admin-header.php');
$messages[1] = __('Category added.');
$messages[2] = __('Category deleted.');
$messages[3] = __('Category updated.');
$messages[4] = __('Category not added.');
$messages[5] = __('Category not updated.');
function link_cat_row($category) {
global $class;
if ( current_user_can( 'manage_categories' ) ) {
$edit = "<a href='link-category.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
$default_cat_id = (int) get_option( 'default_link_category' );
if ( $category->term_id != $default_cat_id )
$edit .= "<td><a href='" . wp_nonce_url( "link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_term_field( 'name', $default_cat_id, 'link_category' ))) . "' );\" class='delete'>".__( 'Delete' )."</a>";
else
$edit .= "<td style='text-align:center'>".__( "Default" );
} else {
$edit = '';
}
$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
$category->count = number_format_i18n( $category->count );
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
return "<tr id='cat-$category->term_id'$class>
<th scope='row' style='text-align: center'>$category->term_id</th>
<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
<td>$category->description</td>
<td align='center'>$count</td>
<td>$edit</td>\n\t</tr>\n";
}
?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>
<div class="wrap">
<?php if ( current_user_can('manage_categories') ) : ?>
<h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
<?php else : ?>
<h2><?php _e('Categories') ?> </h2>
<?php endif; ?>
<table class="widefat">
<thead>
<tr>
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$categories = get_terms( 'link_category', 'hide_empty=0' );
if ( $categories ) {
$output = '';
foreach ( $categories as $category ) {
$category = sanitize_term($category, 'link_category', 'display');
$output .= link_cat_row($category);
}
$output = apply_filters('cat_rows', $output);
echo $output;
unset($category);
}
?>
</tbody>
</table>
</div>
<?php if ( current_user_can('manage_categories') ) : ?>
<div class="wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?></p>
</div>
<?php include('edit-link-category-form.php'); ?>
<?php endif; ?>
<?php include('admin-footer.php'); ?>

View File

@@ -1,43 +0,0 @@
<?php
if ( ! empty($cat_ID) ) {
$heading = __('Edit Category');
$submit_text = __('Edit Category &raquo;');
$form = '<form name="editcat" id="editcat" method="post" action="link-category.php">';
$action = 'editedcat';
$nonce_action = 'update-link-category_' . $cat_ID;
do_action('edit_link_category_form_pre', $category);
} else {
$heading = __('Add Category');
$submit_text = __('Add Category &raquo;');
$form = '<form name="addcat" id="addcat" method="post" action="link-category.php">';
$action = 'addcat';
$nonce_action = 'add-link-category';
do_action('add_link_category_form_pre', $category);
}
?>
<div class="wrap">
<h2><?php echo $heading ?></h2>
<div id="ajax-response"></div>
<?php echo $form ?>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
<?php wp_nonce_field($nonce_action); ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row" valign="top"><label for="name"><?php _e('Category name:') ?></label></th>
<td width="67%"><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td>
</tr>
<tr>
<th scope="row" valign="top"><label for="slug"><?php _e('Category slug:') ?></label></th>
<td><input name="slug" id="slug" type="text" value="<?php echo $category->slug; ?>" size="40" /></td>
</tr>
<tr>
<th scope="row" valign="top"><label for="description"><?php _e('Description: (optional)') ?></label></th>
<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
<?php do_action('edit_link_category_form', $category); ?>
</form>
</div>

View File

@@ -43,7 +43,7 @@ function xfn_check($class, $value = '', $type = 'check') {
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content">
<p id="jaxcat"></p>
<ul id="linkcategorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
<ul id="categorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
</div>
</fieldset>
@@ -80,15 +80,15 @@ function xfn_check($class, $value = '', $type = 'check') {
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th scope="row" valign="top"><label for="link_name"><?php _e('Name:') ?></label></th>
<td><input type="text" name="link_name" id="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
<td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th width="20%" scope="row" valign="top"><label for="link_url"><?php _e('Address:') ?></label></th>
<td width="80%"><input type="text" name="link_url" id="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td>
<td width="80%"><input type="text" name="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row" valign="top"><label for="link_description"><?php _e('Description:') ?></label></th>
<td><input type="text" name="link_description" id="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
<td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
</tr>
</table>
@@ -241,7 +241,6 @@ function xfn_check($class, $value = '', $type = 'check') {
</td>
</tr>
</table>
</div>
</fieldset>
</div>

View File

@@ -170,7 +170,7 @@ if (current_user_can('upload_files')) {
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
}
?>

View File

@@ -4,74 +4,31 @@ $title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script( 'listman' );
require_once('admin-header.php');
$post_stati = array( // array( adj, noun )
'publish' => array(__('Published'), __('Published pages')),
'draft' => array(__('Draft'), __('Draft pages')),
'private' => array(__('Private'), __('Private pages'))
);
$post_status_label = __('Pages');
$post_status_q = '';
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
$post_status_label = $post_stati[$_GET['post_status']][1];
$post_status_q = '&post_status=' . $_GET['post_status'];
}
?>
<div class="wrap">
<h2><?php
// Use $_GET instead of is_ since they can override each other
$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : '';
$h2_author = '';
if ( isset($_GET['author']) && $_GET['author'] ) {
$author_user = get_userdata( (int) $_GET['author'] );
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
}
printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search );
?></h2>
<h2><?php _e('Page Management'); ?></h2>
<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
<form name="searchform" id="searchform" action="" method="get">
<fieldset><legend><?php _e('Search Terms&hellip;') ?></legend>
<input type="text" name="s" id="s" value="<?php echo attribute_escape( stripslashes( $_GET['s'] ) ); ?>" size="17" />
<form name="searchform" action="" method="get">
<fieldset>
<legend><?php _e('Search Pages&hellip;') ?></legend>
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
</fieldset>
<fieldset><legend><?php _e('Page Type&hellip;'); ?></legend>
<select name='post_status'>
<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
<?php foreach ( $post_stati as $status => $label ) : ?>
<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<?php $editable_ids = get_editable_user_ids( $user_ID ); if ( $editable_ids && count( $editable_ids ) > 1 ) : ?>
<fieldset><legend><?php _e('Author&hellip;'); ?></legend>
<?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
</fieldset>
<?php endif; ?>
<input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" />
</form>
<br style="clear:both;" />
<?php
wp("post_type=page&orderby=menu_order&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc");
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
$all = !( $h2_search || $post_status_q );
if ( $_GET['s'] )
$all = false;
else
$all = true;
if ($posts) {
?>
<table class="widefat">
<table class="widefat">
<thead>
<tr>
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
@@ -82,7 +39,9 @@ if ($posts) {
</tr>
</thead>
<tbody id="the-list">
<?php page_rows(0, 0, $posts, $all); ?>
<?php
page_rows(0, 0, $posts, $all);
?>
</tbody>
</table>
@@ -91,7 +50,7 @@ if ($posts) {
<?php
} else {
?>
<p><?php _e('No pages found.') ?></p>
<p><?php _e('No pages yet.') ?></p>
<?php
} // end if ($posts)
?>

View File

@@ -1,118 +0,0 @@
<?php if ( ! defined('ABSPATH') ) die(); ?>
<table class="widefat">
<thead>
<tr>
<?php foreach($posts_columns as $column_display_name) { ?>
<th scope="col"><?php echo $column_display_name; ?></th>
<?php } ?>
</tr>
</thead>
<tbody id="the-list">
<?php
if ( have_posts() ) {
$bgcolor = '';
add_filter('the_title','wp_specialchars');
while (have_posts()) : the_post();
$class = ('alternate' == $class) ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
?>
<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'>
<?php
foreach($posts_columns as $column_name=>$column_display_name) {
switch($column_name) {
case 'id':
?>
<th scope="row" style="text-align: center"><?php echo $id ?></th>
<?php
break;
case 'modified':
?>
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
<?php
break;
case 'date':
?>
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_date) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
<?php
break;
case 'title':
?>
<td><?php the_title() ?>
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
<?php
break;
case 'categories':
?>
<td><?php the_category(','); ?></td>
<?php
break;
case 'comments':
?>
<td style="text-align: center">
<?php
$left = get_pending_comments_num( $post->ID );
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
if ( $left )
echo '<strong>';
comments_number("<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('%') . '</a>');
if ( $left )
echo '</strong>';
?>
</td>
<?php
break;
case 'author':
?>
<td><?php the_author() ?></td>
<?php
break;
case 'control_view':
?>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
<?php
break;
case 'control_edit':
?>
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<?php
break;
case 'control_delete':
?>
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<?php
break;
default:
?>
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
<?php
break;
}
}
?>
</tr>
<?php
endwhile;
} else {
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No posts found.') ?></td>
</tr>
<?php
} // end if ( have_posts() )
?>
</tbody>
</table>

View File

@@ -6,58 +6,134 @@ $parent_file = 'edit.php';
wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
require_once('admin-header.php');
$_GET['m'] = (int) $_GET['m'];
$_GET['cat'] = (int) $_GET['cat'];
$post_stati = array( // array( adj, noun )
'publish' => array(__('Published'), __('Published posts')),
'future' => array(__('Scheduled'), __('Scheduled posts')),
'pending' => array(__('Pending Review'), __('Pending posts')),
'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
'private' => array(__('Private'), __('Private posts'))
);
$_GET['m'] = (int) $_GET['m'];
$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
$drafts = get_users_drafts( $user_ID );
$other_drafts = get_others_drafts( $user_ID);
$post_status_q = '';
$post_status_label = __('Posts');
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
$post_status_label = $post_stati[$_GET['post_status']][1];
$post_status_q = '&post_status=' . $_GET['post_status'];
}
if ($drafts || $other_drafts) {
?>
<div class="wrap">
<?php if ($drafts) { ?>
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
$i = 0;
foreach ($drafts as $draft) {
if (0 != $i)
echo ', ';
$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
if ($draft->post_title == '')
$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
++$i;
}
?>
.</p>
<?php } ?>
<?php if ($other_drafts) { ?>
<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
<?php
$i = 0;
foreach ($other_drafts as $draft) {
if (0 != $i)
echo ', ';
$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
if ($draft->post_title == '')
$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
++$i;
}
?>
.</p>
<?php } ?>
</div>
<?php } ?>
<div class="wrap">
<h2>
<?php
if ( 'pending' === $_GET['post_status'] ) {
$order = 'ASC';
$orderby = 'modified';
} elseif ( 'draft' === $_GET['post_status'] ) {
$order = 'DESC';
$orderby = 'modified';
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
if ( is_month() ) {
single_month_title(' ');
} elseif ( is_search() ) {
printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
} else {
$order = 'DESC';
$orderby = 'date';
if ( is_single() )
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
elseif ( ! is_paged() || get_query_var('paged') == 1 )
_e('Last 15 Posts');
else
_e('Previous Posts');
}
?>
</h2>
wp("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
<form name="searchform" id="searchform" action="" method="get">
<fieldset>
<legend><?php _e('Search Posts&hellip;') ?></legend>
<input type="text" name="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />
</fieldset>
</form>
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
if ( count($arc_result) ) { ?>
<form name="viewarc" id="viewarc" action="" method="get">
<fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<?php
foreach ($arc_result as $arc_row) {
if ( $arc_row->yyear == 0 )
continue;
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] )
$default = 'selected="selected"';
else
$default = null;
echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
echo "</option>\n";
}
?>
</select>
<input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
</fieldset>
</form>
<?php } ?>
<form name="viewcat" id="viewcat" action="" method="get">
<fieldset>
<legend><?php _e('Browse Category&hellip;') ?></legend>
<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
<input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" />
</fieldset>
</form>
<?php do_action('restrict_manage_posts'); ?>
<br style="clear:both;" />
<?php
// define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array();
$posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>';
if ( 'draft' === $_GET['post_status'] )
$posts_columns['modified'] = __('Modified');
elseif ( 'pending' === $_GET['post_status'] )
$posts_columns['modified'] = __('Submitted');
else
$posts_columns['date'] = __('When');
$posts_columns['title'] = __('Title');
$posts_columns['categories'] = __('Categories');
if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
$posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>';
$posts_columns['author'] = __('Author');
$posts_columns = array(
'id' => '<div style="text-align: center">' . __('ID') . '</div>',
'date' => __('When'),
'title' => __('Title'),
'categories' => __('Categories'),
'comments' => '<div style="text-align: center">' . __('Comments') . '</div>',
'author' => __('Author')
);
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
// you can not edit these at the moment
@@ -67,100 +143,109 @@ $posts_columns['control_delete'] = '';
?>
<h2><?php
if ( is_single() ) {
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
} else {
if ( $post_listing_pageable && !is_archive() && !is_search() )
$h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
else
$h2_noun = $post_status_label;
// Use $_GET instead of is_ since they can override each other
$h2_author = '';
$_GET['author'] = (int) $_GET['author'];
if ( $_GET['author'] != 0 ) {
if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
$h2_author = ' ' . __('by other authors');
} else {
$author_user = get_userdata( get_query_var( 'author' ) );
$h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
}
}
$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : '';
$h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : '';
$h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
printf( _c( '%1$s%2$s%3$s%4$s%5$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month );
}
?></h2>
<form name="searchform" id="searchform" action="" method="get">
<fieldset><legend><?php _e('Search terms&hellip;'); ?></legend>
<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" />
</fieldset>
<fieldset><legend><?php _e('Status&hellip;'); ?></legend>
<select name='post_status'>
<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
<?php foreach ( $post_stati as $status => $label ) : if ( !in_array($status, $avail_post_stati) ) continue; ?>
<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<?php
$editable_ids = get_editable_user_ids( $user_ID );
if ( $editable_ids && count( $editable_ids ) > 1 ) :
?>
<fieldset><legend><?php _e('Author&hellip;'); ?></legend>
<?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
</fieldset>
<?php
endif;
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
$arc_result = $wpdb->get_results( $arc_query );
$month_count = count($arc_result);
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
<fieldset><legend><?php _e('Month&hellip;') ?></legend>
<select name='m'>
<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
<?php
foreach ($arc_result as $arc_row) {
if ( $arc_row->yyear == 0 )
continue;
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
$default = ' selected="selected"';
else
$default = '';
echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
echo "</option>\n";
}
?>
</select>
</fieldset>
<table class="widefat">
<thead>
<tr>
<?php foreach($posts_columns as $column_display_name) { ?>
<th scope="col"><?php echo $column_display_name; ?></th>
<?php } ?>
<fieldset><legend><?php _e('Category&hellip;') ?></legend>
<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
</fieldset>
<input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" />
</form>
</tr>
</thead>
<tbody id="the-list">
<?php
if ($posts) {
$bgcolor = '';
while (have_posts()) : the_post();
add_filter('the_title','wp_specialchars');
$class = ('alternate' == $class) ? '' : 'alternate';
?>
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<?php do_action('restrict_manage_posts'); ?>
<?php
<br style="clear:both;" />
foreach($posts_columns as $column_name=>$column_display_name) {
<?php include( 'edit-post-rows.php' ); ?>
switch($column_name) {
case 'id':
?>
<th scope="row" style="text-align: center"><?php echo $id ?></th>
<?php
break;
case 'date':
?>
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
<?php
break;
case 'title':
?>
<td><?php the_title() ?>
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
<?php
break;
case 'categories':
?>
<td><?php the_category(','); ?></td>
<?php
break;
case 'comments':
?>
<td style="text-align: center">
<?php comments_number(__('0'), "<a href='edit.php?p=$id&amp;c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('%') . '</a>') ?>
</td>
<?php
break;
case 'author':
?>
<td><?php the_author() ?></td>
<?php
break;
case 'control_view':
?>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
<?php
break;
case 'control_edit':
?>
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<?php
break;
case 'control_delete':
?>
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<?php
break;
default:
?>
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
<?php
break;
}
}
?>
</tr>
<?php
endwhile;
} else {
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No posts found.') ?></td>
</tr>
<?php
} // end if ($posts)
?>
</tbody>
</table>
<div id="ajax-response"></div>
@@ -170,12 +255,10 @@ if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?
</div>
<?php
if ( 1 == count($posts) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
if ($comments) {
update_comment_cache($comments);
?>
<h3 id="comments"><?php _e('Comments') ?></h3>
<ol id="the-comment-list" class="commentlist">
@@ -184,8 +267,7 @@ $i = 0;
foreach ($comments as $comment) {
++$i; $class = '';
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
if ('unapproved' == $comment_status)
$class .= ' unapproved';
@@ -193,22 +275,22 @@ foreach ($comments as $comment) {
$class .= ' alternate';
echo "<li id='comment-$comment->comment_ID' class='$class'>";
?>
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=edit"><?php comment_author_IP() ?></a></p>
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?>
<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [
<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [
<?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
}
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
}
?> ]
?>
</p>
</li>
@@ -219,5 +301,6 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
?>
<?php } ?>
</div>
<?php include('admin-footer.php'); ?>
<?php
include('admin-footer.php');
?>

View File

@@ -25,7 +25,7 @@ require_once ('admin-header.php');
<select name="author">
<option value="all" selected="selected"><?php _e('All'); ?></option>
<?php
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
foreach ( $authors as $id ) {
$o = get_userdata( $id );
echo "<option value='$o->ID'>$o->display_name</option>";
@@ -45,15 +45,13 @@ foreach ( $authors as $id ) {
<?php
function export_wp() {
global $wpdb, $post_ids, $post;
do_action('export_wp');
global $wpdb, $posts, $post;
$filename = 'wordpress.' . date('Y-m-d') . '.xml';
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=$filename");
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
$where = '';
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
@@ -61,18 +59,16 @@ if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
$where = " WHERE post_author = '$author_id' ";
}
// grab a snapshot of post IDs, just in case it changes during the export
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
$categories = (array) get_categories('get=all');
$tags = (array) get_tags('get=all');
$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id");
function wxr_missing_parents($categories) {
if ( !is_array($categories) || empty($categories) )
return array();
foreach ( $categories as $category )
$parents[$category->term_id] = $category->parent;
$parents[$category->cat_ID] = $category->category_parent;
$parents = array_unique(array_diff($parents, array_keys($parents)));
@@ -83,7 +79,7 @@ function wxr_missing_parents($categories) {
}
while ( $parents = wxr_missing_parents($categories) ) {
$found_parents = get_categories("include=" . join(', ', $parents));
$found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")");
if ( is_array($found_parents) && count($found_parents) )
$categories = array_merge($categories, $found_parents);
else
@@ -94,8 +90,8 @@ while ( $parents = wxr_missing_parents($categories) ) {
$pass = 0;
$passes = 1000 + count($categories);
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
$cats[$cat->term_id] = $cat;
if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) {
$cats[$cat->cat_ID] = $cat;
} else {
$categories[] = $cat;
}
@@ -114,72 +110,42 @@ function wxr_cdata($str) {
}
function wxr_cat_name($c) {
if ( empty($c->name) )
if ( empty($c->cat_name) )
return;
echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
}
function wxr_category_description($c) {
if ( empty($c->description) )
if ( empty($c->category_description) )
return;
echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
}
function wxr_tag_name($t) {
if ( empty($t->name) )
return;
echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
}
function wxr_tag_description($t) {
if ( empty($t->description) )
return;
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
}
function wxr_post_taxonomy() {
$categories = get_the_category();
$tags = get_the_tags();
$cat_names = array();
$tag_names = array();
$the_list = '';
$filter = 'rss';
if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
}
if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
}
echo $the_list;
}
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
<!-- It contains information about your blog's posts, comments, and categories. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your blog. -->
<!-- To import this information into a WordPress blog follow these steps. -->
<!-- 1. Log into that blog as an administrator. -->
<!-- 2. Go to Manage: Import in the blog's admin panels. -->
<!-- 3. Choose "WordPress" from the list. -->
<!-- 4. Upload this file using the form provided on that page. -->
<!-- 5. You will first be asked to map the authors in this export file to users -->
<!-- on the blog. For each author, you may choose to map to an -->
<!-- existing user on the blog or to create a new user -->
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
<!-- contained in this file into your blog -->
<!--
This is a WordPress eXtended RSS file generated by WordPress as an export of
your blog. It contains information about your blog's posts, comments, and
categories. You may use this file to transfer that content from one site to
another. This file is not intended to serve as a complete backup of your
blog.
To import this information into a WordPress blog follow these steps:
1. Log into that blog as an administrator.
2. Go to Manage > Import in the blog's admin.
3. Choose "WordPress" from the list of importers.
4. Upload this file using the form provided on that page.
5. You will first be asked to map the authors in this export file to users
on the blog. For each author, you may choose to map an existing user on
the blog or to create a new user.
6. WordPress will then import each of the posts, comments, and categories
contained in this file onto your blog.
-->
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"-->
<rss version="2.0"
@@ -197,27 +163,16 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
<language><?php echo get_option('rss_language'); ?></language>
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
<wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
<?php endforeach; endif; ?>
<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
<wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
<?php endforeach; endif; ?>
<?php do_action('rss2_head'); ?>
<?php if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true; // Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ( $next_posts = array_splice($post_ids, 0, 20) ) {
$where = "WHERE ID IN (".join(',', $next_posts).")";
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
foreach ($posts as $post) {
setup_postdata($post); ?>
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<item>
<title><?php the_title_rss() ?></title>
<link><?php the_permalink_rss() ?></link>
<link><?php permalink_single_rss() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php wxr_post_taxonomy() ?>
<?php the_category_rss() ?>
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
@@ -248,7 +203,7 @@ $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
@@ -261,7 +216,7 @@ if ( $comments ) { foreach ( $comments as $c ) { ?>
</wp:comment>
<?php } } ?>
</item>
<?php } } } ?>
<?php } } ?>
</channel>
</rss>
<?php

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

View File

@@ -14,9 +14,9 @@ require_once ('admin-header.php');
// Load all importers so that they can register.
$import_loc = 'wp-admin/import';
$import_root = ABSPATH.$import_loc;
$imports_dir = @ opendir($import_root);
$imports_dir = @ dir($import_root);
if ($imports_dir) {
while (($file = readdir($imports_dir)) !== false) {
while (($file = $imports_dir->read()) !== false) {
if ($file{0} == '.') {
continue;
} elseif (substr($file, -4) == '.php') {
@@ -24,7 +24,6 @@ if ($imports_dir) {
}
}
}
@closedir($imports_dir);
$importers = get_importers();

View File

@@ -84,7 +84,7 @@ class Blogger_Import {
if ( empty($this->blogs) ) {
$headers = array(
"GET /feeds/default/blogs HTTP/1.0",
"Host: www.blogger.com",
"Host: www2.blogger.com",
"Authorization: AuthSub token=\"$this->token\""
);
$request = join( "\r\n", $headers ) . "\r\n\r\n";
@@ -380,9 +380,7 @@ class Blogger_Import {
$entry = "<feed>$entry</feed>";
$AtomParser = new AtomParser();
$AtomParser->parse( $entry );
$result = $this->import_post($AtomParser->entry);
if ( is_wp_error( $result ) )
return $result;
$this->import_post($AtomParser->entry);
unset($AtomParser);
}
} else break;
@@ -511,17 +509,15 @@ class Blogger_Import {
$post_content = str_replace('<hr>', '<hr />', $post_content);
// Checks for duplicates
if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) {
++$this->blogs[$importing_blog]['posts_skipped'];
} elseif ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
$this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id;
if (
isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ||
post_exists( $post_title, $post_content, $post_date )
) {
++$this->blogs[$importing_blog]['posts_skipped'];
} else {
$post = compact('post_date', 'post_content', 'post_title', 'post_status');
$post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) )
return $post_id;
wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id );
@@ -535,7 +531,6 @@ class Blogger_Import {
++$this->blogs[$importing_blog]['posts_done'];
}
$this->save_vars();
return;
}
function import_comment( $entry ) {
@@ -772,9 +767,7 @@ class Blogger_Import {
if ( isset( $_REQUEST['blog'] ) ) {
$blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog'];
$blog = (int) $blog;
$result = $this->import_blog( $blog );
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import_blog( $blog );
} elseif ( isset($_GET['token']) )
$this->auth();
elseif ( $this->token && $this->token_is_valid() )
@@ -922,11 +915,11 @@ class AtomParser {
if(count($this->in_content) == 2) {
array_push($this->in_content, ">");
}
array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}");
} else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) {
$this->in_content = array();
$this->is_xhtml = $attrs['type'] == 'xhtml';
$this->is_xhtml = $attrs['type'] == 'xhtml';
array_push($this->in_content, array($tag,$this->depth));
} else if($tag == 'link') {
array_push($this->entry->links, $attrs);
@@ -942,7 +935,7 @@ class AtomParser {
$tag = array_pop(split(":", $name));
if(!empty($this->in_content)) {
if($this->in_content[0][0] == $tag &&
if($this->in_content[0][0] == $tag &&
$this->in_content[0][1] == $this->depth) {
array_shift($this->in_content);
if($this->is_xhtml) {
@@ -1005,14 +998,14 @@ class AtomParser {
}
}
}
}
}
return $name;
}
function xml_escape($string)
{
return str_replace(array('&','"',"'",'<','>'),
array('&amp;','&quot;','&apos;','&lt;','&gt;'),
return str_replace(array('&','"',"'",'<','>'),
array('&amp;','&quot;','&apos;','&lt;','&gt;'),
$string );
}
}

View File

@@ -91,9 +91,6 @@ class BW_Import {
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
$post_id = wp_insert_post($postdata);
if ( is_wp_error( $post_id ) ) {
return $post_id;
}
if (!$post_id) {
_e("Couldn't get post ID");
echo '</li>';
@@ -158,9 +155,7 @@ class BW_Import {
}
$this->file = $file['file'];
$result = $this->import_posts();
if ( is_wp_error( $result ) )
return $result;
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
@@ -181,9 +176,7 @@ class BW_Import {
$this->greet();
break;
case 1 :
$result = $this->import();
if ( is_wp_error( $result ) )
$result->get_error_message();
$this->import();
break;
}

View File

@@ -1,115 +0,0 @@
<?php
class BunnyTags_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Bunny&#8217;s Technorati Tags').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
}
function footer() {
echo '</div>';
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This imports tags from an existing Bunny&#8217;s Technorati Tags installation into this blog using the new WordPress native tagging structure.').'</p>';
echo '<p>'.__('This is suitable for Bunny&#8217;s Technorati Tags version 0.6.').'</p>';
echo '<p><strong>'.__('All existing Bunny&#8217;s Technorati Tags will be removed after import.').'</strong></p>';
echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
echo '<form action="admin.php?import=btt&amp;step=1" method="post">';
wp_nonce_field('import-btt');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Tags &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function dispatch() {
if ( empty($_GET['step']) )
$step = 0;
else
$step = abs(intval($_GET['step']));
// load the header
$this->header();
switch ( $step ) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-btt');
$this->check_post_keyword( true );
break;
case 2 :
check_admin_referer('import-btt');
$this->check_post_keyword( false );
break;
case 3:
$this->done();
break;
}
// load the footer
$this->footer();
}
function check_post_keyword($precheck = true) {
global $wpdb;
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Bunny&#8217;s Technorati Tags&#8230;').'</h3></p>';
// import Bunny's Keywords tags
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'tags'");
if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>';
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
if ( $post_meta->meta_value != '' ) {
$post_keys = explode(' ', $post_meta->meta_value);
foreach ( $post_keys as $keyword ) {
$keyword = addslashes(trim(str_replace('+',' ',$keyword)));
if ( '' != $keyword ) {
echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
if ( !$precheck )
wp_add_post_tags($post_meta->post_id, $keyword);
}
}
}
if ( !$precheck )
delete_post_meta($post_meta->post_id, 'tags');
}
echo '</ul>';
}
echo '<form action="admin.php?import=btt&amp;step='.($precheck? 2:3).'" method="post">';
wp_nonce_field('import-btt');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function done() {
echo '<div class="narrow">';
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
echo '</div>';
}
function BunnyTags_Import() {
}
}
// create the import object
$btt_import = new BunnyTags_Import();
// add it to the import page!
register_importer('btt', 'Bunny&#8217;s Technorati Tags', __('Import Bunny&#8217;s Technorati Tags into the new native tagging structure.'), array($btt_import, 'dispatch'));
?>

View File

@@ -7,6 +7,18 @@
/**
Add These Functions to make our lives easier
**/
if(!function_exists('get_catbynicename'))
{
function get_catbynicename($category_nicename)
{
global $wpdb;
$cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
return $name;
}
}
if(!function_exists('get_comment_count'))
{
@@ -17,6 +29,15 @@ if(!function_exists('get_comment_count'))
}
}
if(!function_exists('link_cat_exists'))
{
function link_cat_exists($catname)
{
global $wpdb;
return $wpdb->get_var('SELECT cat_id FROM '.$wpdb->linkcategories.' WHERE cat_name = "'.$wpdb->escape($catname).'"');
}
}
if(!function_exists('link_exists'))
{
function link_exists($linkname)
@@ -109,19 +130,19 @@ function textconv ($s) {
**/
class Dotclear_Import {
function header()
function header()
{
echo '<div class="wrap">';
echo '<h2>'.__('Import DotClear').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
}
function footer()
function footer()
{
echo '</div>';
}
function greet()
function greet()
{
echo '<div class="narrow"><p>'.__('Howdy! This importer allows you to extract posts from a DotClear database into your blog. Mileage may vary.').'</p>';
echo '<p>'.__('Your DotClear Configuration settings are as follows:').'</p>';
@@ -364,8 +385,6 @@ class Dotclear_Import {
'ping_status' => $comment_status_map[$post_open_tb],
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
if ( is_wp_error( $ret_id ) )
return $ret_id;
}
else
{
@@ -384,17 +403,12 @@ class Dotclear_Import {
'ping_status' => $comment_status_map[$post_open_tb],
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
if ( is_wp_error( $ret_id ) )
return $ret_id;
}
$dcposts2wpposts[$post_id] = $ret_id;
// Make Post-to-Category associations
$cats = array();
$category1 = get_category_by_slug($post_cat_name);
$category1 = $category1->term_id;
if($cat1 = $category1) { $cats[1] = $cat1; }
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
}
@@ -495,11 +509,12 @@ class Dotclear_Import {
extract($link);
if ($title != "") {
if ($cinfo = is_term(csc ($title), 'link_category')) {
$category = $cinfo['term_id'];
if ($cinfo = link_cat_exists (csc ($title))) {
$category = $cinfo;
} else {
$category = wp_insert_term($wpdb->escape (csc ($title)), 'link_category');
$category = $category['term_id'];
$wpdb->query ("INSERT INTO $wpdb->linkcategories (cat_name) VALUES ('".
$wpdb->escape (csc ($title))."')");
$category = $wpdb->insert_id;
}
} else {
$linkname = $wpdb->escape(csc ($label));
@@ -566,9 +581,7 @@ class Dotclear_Import {
{
// Post Import
$posts = $this->get_dc_posts();
$result = $this->posts2wp($posts);
if ( is_wp_error( $result ) )
return $result;
$this->posts2wp($posts);
echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
wp_nonce_field('import-dotclear');
@@ -716,9 +729,7 @@ class Dotclear_Import {
$this->import_users();
break;
case 3 :
$result = $this->import_posts();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import_posts();
break;
case 4 :
$this->import_comments();

View File

@@ -233,8 +233,6 @@ class GM_Import {
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
$post_ID = wp_insert_post($postdata);
if ( is_wp_error( $post_ID ) )
return $post_ID;
}
$c=count($entry);
@@ -289,7 +287,6 @@ class GM_Import {
<p><?php _e('Completed GreyMatter import!') ?></p>
<?php
$this->footer();
return;
}
function dispatch() {
@@ -304,9 +301,7 @@ class GM_Import {
break;
case 1:
check_admin_referer('import-greymatter');
$result = $this->import();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import();
break;
}
}

View File

@@ -1,178 +0,0 @@
<?php
class JeromesKeyword_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Jerome&#8217;s Keywords').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
}
function footer() {
echo '</div>';
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This imports tags from an existing Jerome&#8217;s Keywords installation into this blog using the new WordPress native tagging structure.').'</p>';
echo '<p>'.__('This is suitable for Jerome&#8217;s Keywords version 1.x and 2.0a.').'</p>';
echo '<p><strong>'.__('All existing Jerome&#8217;s Keywords will be removed after import.').'</strong></p>';
echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
echo '<form action="admin.php?import=jkw&amp;step=1" method="post">';
wp_nonce_field('import-jkw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Version 1.x &raquo;').'" /></p>';
echo '</form>';
echo '<form action="admin.php?import=jkw&amp;step=3" method="post">';
wp_nonce_field('import-jkw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Import Version 2.0a &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function dispatch() {
if ( empty($_GET['step']) )
$step = 0;
else
$step = abs(intval($_GET['step']));
// load the header
$this->header();
switch ( $step ) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-jkw');
$this->check_V1_post_keyword( true );
break;
case 2 :
check_admin_referer('import-jkw');
$this->check_V1_post_keyword( false );
break;
case 3 :
check_admin_referer('import-jkw');
$this->check_V2_post_keyword( true );
break;
case 4 :
check_admin_referer('import-jkw');
$this->check_V2_post_keyword( false );
break;
case 5:
check_admin_referer('import-jkw');
$this->cleanup_V2_import();
break;
case 6:
$this->done();
break;
}
// load the footer
$this->footer();
}
function check_V1_post_keyword($precheck = true) {
global $wpdb;
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';
// import Jerome's Keywords tags
$metakeys = $wpdb->get_results("SELECT post_id, meta_id, meta_key, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'keywords'");
if ( !is_array($metakeys)) {
echo '<p>' . __('No Tags Found!') . '</p>';
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
if ( $post_meta->meta_value != '' ) {
$post_keys = explode(',', $post_meta->meta_value);
foreach ( $post_keys as $keyword ) {
$keyword = addslashes(trim($keyword));
if ( '' != $keyword ) {
echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
if ( !$precheck )
wp_add_post_tags($post_meta->post_id, $keyword);
}
}
}
if ( !$precheck )
delete_post_meta($post_meta->post_id, 'keywords');
}
echo '</ul>';
}
echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 2:6).'" method="post">';
wp_nonce_field('import-jkw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function check_V2_post_keyword($precheck = true) {
global $wpdb;
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading Jerome&#8217;s Keywords Tags&#8230;').'</h3></p>';
// import Jerome's Keywords tags
$tablename = $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1);
$metakeys = $wpdb->get_results("SELECT post_id, tag_name FROM $tablename");
if ( !is_array($metakeys) ) {
echo '<p>' . __('No Tags Found!') . '</p>';
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
$keyword = addslashes(trim($post_meta->tag_name));
if ( $keyword != '' ) {
echo '<li>' . $post_meta->post_id . '&nbsp;-&nbsp;' . $keyword . '</li>';
if ( !$precheck )
wp_add_post_tags($post_meta->post_id, $keyword);
}
}
echo '</ul>';
}
echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 4:5).'" method="post">';
wp_nonce_field('import-jkw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Next &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function cleanup_V2_import() {
global $wpdb;
/* options from V2.0a (jeromes-keywords.php) */
$options = array('version', 'keywords_table', 'query_varname', 'template', 'meta_always_include', 'meta_includecats', 'meta_autoheader', 'search_strict', 'use_feed_cats', 'post_linkformat', 'post_tagseparator', 'post_includecats', 'post_notagstext', 'cloud_linkformat', 'cloud_tagseparator', 'cloud_includecats', 'cloud_sortorder', 'cloud_displaymax', 'cloud_displaymin', 'cloud_scalemax', 'cloud_scalemin');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . substr(get_option('jkeywords_keywords_table'), 1, -1));
foreach ( $options as $o )
delete_option('jkeywords_' . $o);
$this->done();
}
function done() {
echo '<div class="narrow">';
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
echo '</div>';
}
function JeromesKeyword_Import() {
}
}
// create the import object
$jkw_import = new JeromesKeyword_Import();
// add it to the import page!
register_importer('jkw', 'Jerome&#8217;s Keywords', __('Import Jerome&#8217;s Keywords into the new native tagging structure.'), array($jkw_import, 'dispatch'));
?>

View File

@@ -49,7 +49,7 @@ class LJ_Import {
preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
$post_date = strtotime($post_date[1]);
$post_date = date('Y-m-d H:i:s', $post_date);
$post_date = gmdate('Y-m-d H:i:s', $post_date);
preg_match('|<event>(.*?)</event>|is', $post, $post_content);
$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
@@ -71,8 +71,6 @@ class LJ_Import {
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
$post_id = wp_insert_post($postdata);
if ( is_wp_error( $post_id ) )
return $post_id;
if (!$post_id) {
_e("Couldn't get post ID");
echo '</li>';
@@ -134,9 +132,7 @@ class LJ_Import {
}
$this->file = $file['file'];
$result = $this->import_posts();
if ( is_wp_error( $result ) )
return $result;
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
@@ -158,9 +154,7 @@ class LJ_Import {
break;
case 1 :
check_admin_referer('import-upload');
$result = $this->import();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import();
break;
}

View File

@@ -22,18 +22,9 @@ class MT_Import {
$this->header();
?>
<div class="narrow">
<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click "Upload file and import," or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>
<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, choose a file to upload and click Upload file and import.'); ?></p>
<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
<form method="post" action="<?php echo add_query_arg('step', 1); ?>" class="import-upload-form">
<?php wp_nonce_field('import-upload'); ?>
<p>
<input type="hidden" name="upload_type" value="ftp" />
<?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
<p class="submit">
<input type="submit" value="<?php echo attribute_escape(__('Import mt-export.txt &raquo;')); ?>" />
</p>
</form>
<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
</div>
<?php
$this->footer();
@@ -84,27 +75,25 @@ class MT_Import {
return $user_id;
}
function get_entries() {
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
$this->posts = explode("--MT-ENTRY--", $importdata);
}
function get_mt_authors() {
$temp = array();
$authors = array();
$handle = fopen($this->file, 'r');
if ( $handle == null )
return false;
$in_comment = false;
while ( $line = fgets($handle) ) {
$line = trim($line);
if ( 'COMMENT:' == $line )
$in_comment = true;
else if ( '-----' == $line )
$in_comment = false;
if ( $in_comment || 0 !== strpos($line,"AUTHOR:") )
continue;
$temp[] = trim( substr($line, strlen("AUTHOR:")) );
$temp = array ();
$i = -1;
foreach ($this->posts as $post) {
if ('' != trim($post)) {
++ $i;
preg_match("|AUTHOR:(.*)|", $post, $thematch);
$thematch = trim($thematch[1]);
array_push($temp, "$thematch"); //store the extracted author names in a temporary array
}
}
//we need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
@@ -116,8 +105,6 @@ class MT_Import {
array_push($authors, "$next");
}
fclose($handle);
return $authors;
}
@@ -151,7 +138,7 @@ class MT_Import {
?>
<div class="wrap">
<h2><?php _e('Assign Authors'); ?></h2>
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin\'s entries.'); ?></p>
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
<p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
<?php
@@ -169,20 +156,14 @@ class MT_Import {
echo '</li>';
}
echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
echo '<input type="submit" value="'.__('Submit').'">'.'<br/>';
echo '</form>';
echo '</ol></div>';
}
function select_authors() {
if ( $_POST['upload_type'] === 'ftp' ) {
$file['file'] = ABSPATH . 'wp-content/mt-export.txt';
if ( !file_exists($file['file']) )
$file['error'] = __('<code>mt-export.txt</code> does not exist');
} else {
$file = wp_import_handle_upload();
}
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
$this->header();
echo '<p>'.__('Sorry, there has been an error').'.</p>';
@@ -193,235 +174,237 @@ class MT_Import {
$this->file = $file['file'];
$this->id = (int) $file['id'];
$this->get_entries();
$this->mt_authors_form();
}
function save_post(&$post, &$comments, &$pings) {
// Reset the counter
set_time_limit(30);
$post = get_object_vars($post);
$post = add_magic_quotes($post);
$post = (object) $post;
if ( $post_id = post_exists($post->post_title, '', $post->post_date) ) {
echo '<li>';
printf(__('Post <i>%s</i> already exists.'), stripslashes($post->post_title));
} else {
echo '<li>';
printf(__('Importing post <i>%s</i>...'), stripslashes($post->post_title));
if ( '' != trim( $post->extended ) )
$post->post_content .= "\n<!--more-->\n$post->extended";
$post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor
$post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) )
return $post_id;
// Add categories.
if ( 0 != count($post->categories) ) {
wp_create_categories($post->categories, $post_id);
}
}
$num_comments = 0;
foreach ( $comments as $comment ) {
$comment = get_object_vars($comment);
$comment = add_magic_quotes($comment);
if ( !comment_exists($comment['comment_author'], $comment['comment_date'])) {
$comment['comment_post_ID'] = $post_id;
$comment = wp_filter_comment($comment);
wp_insert_comment($comment);
$num_comments++;
}
}
if ( $num_comments )
printf(' '.__('(%s comments)'), $num_comments);
$num_pings = 0;
foreach ( $pings as $ping ) {
$ping = get_object_vars($ping);
$ping = add_magic_quotes($ping);
if ( !comment_exists($ping['comment_author'], $ping['comment_date'])) {
$ping['comment_content'] = "<strong>{$ping['title']}</strong>\n\n{$ping['comment_content']}";
$ping['comment_post_ID'] = $post_id;
$ping = wp_filter_comment($ping);
wp_insert_comment($ping);
$num_pings++;
}
}
if ( $num_pings )
printf(' '.__('(%s pings)'), $num_pings);
echo "</li>";
//ob_flush();flush();
}
function process_posts() {
global $wpdb;
$handle = fopen($this->file, 'r');
if ( $handle == null )
return false;
$context = '';
$post = new StdClass();
$comment = new StdClass();
$comments = array();
$ping = new StdClass();
$pings = array();
$i = -1;
echo "<div class='wrap'><ol>";
foreach ($this->posts as $post) {
if ('' != trim($post)) {
++ $i;
unset ($post_categories);
while ( $line = fgets($handle) ) {
$line = trim($line);
// Take the pings out first
preg_match("|(-----\n\nPING:.*)|s", $post, $pings);
$post = preg_replace("|(-----\n\nPING:.*)|s", '', $post);
if ( '-----' == $line ) {
// Finishing a multi-line field
if ( 'comment' == $context ) {
$comments[] = $comment;
$comment = new StdClass();
} else if ( 'ping' == $context ) {
$pings[] = $ping;
$ping = new StdClass();
}
$context = '';
} else if ( '--------' == $line ) {
// Finishing a post.
$context = '';
$result = $this->save_post($post, $comments, $pings);
if ( is_wp_error( $result ) )
return $result;
$post = new StdClass;
$comment = new StdClass();
$ping = new StdClass();
$comments = array();
$pings = array();
} else if ( 'BODY:' == $line ) {
$context = 'body';
} else if ( 'EXTENDED BODY:' == $line ) {
$context = 'extended';
} else if ( 'EXCERPT:' == $line ) {
$context = 'excerpt';
} else if ( 'KEYWORDS:' == $line ) {
$context = 'keywords';
} else if ( 'COMMENT:' == $line ) {
$context = 'comment';
} else if ( 'PING:' == $line ) {
$context = 'ping';
} else if ( 0 === strpos($line, "AUTHOR:") ) {
$author = trim( substr($line, strlen("AUTHOR:")) );
if ( '' == $context )
$post->post_author = $author;
else if ( 'comment' == $context )
$comment->comment_author = $author;
} else if ( 0 === strpos($line, "TITLE:") ) {
$title = trim( substr($line, strlen("TITLE:")) );
if ( '' == $context )
$post->post_title = $title;
else if ( 'ping' == $context )
$ping->title = $title;
} else if ( 0 === strpos($line, "STATUS:") ) {
$status = trim( substr($line, strlen("STATUS:")) );
if ( empty($status) )
$status = 'publish';
$post->post_status = $status;
} else if ( 0 === strpos($line, "ALLOW COMMENTS:") ) {
$allow = trim( substr($line, strlen("ALLOW COMMENTS:")) );
if ( $allow == 1 )
$post->comment_status = 'open';
else
$post->comment_status = 'closed';
} else if ( 0 === strpos($line, "ALLOW PINGS:") ) {
$allow = trim( substr($line, strlen("ALLOW PINGS:")) );
if ( $allow == 1 )
$post->ping_status = 'open';
else
$post->ping_status = 'closed';
} else if ( 0 === strpos($line, "CATEGORY:") ) {
$category = trim( substr($line, strlen("CATEGORY:")) );
if ( '' != $category )
$post->categories[] = $category;
} else if ( 0 === strpos($line, "PRIMARY CATEGORY:") ) {
$category = trim( substr($line, strlen("PRIMARY CATEGORY:")) );
if ( '' != $category )
$post->categories[] = $category;
} else if ( 0 === strpos($line, "DATE:") ) {
$date = trim( substr($line, strlen("DATE:")) );
$date = strtotime($date);
$date = date('Y-m-d H:i:s', $date);
$date_gmt = get_gmt_from_date($date);
if ( '' == $context ) {
$post->post_modified = $date;
$post->post_modified_gmt = $date_gmt;
$post->post_date = $date;
$post->post_date_gmt = $date_gmt;
} else if ( 'comment' == $context ) {
$comment->comment_date = $date;
} else if ( 'ping' == $context ) {
$ping->comment_date = $date;
}
} else if ( 0 === strpos($line, "EMAIL:") ) {
$email = trim( substr($line, strlen("EMAIL:")) );
if ( 'comment' == $context )
$comment->comment_author_email = $email;
else
$ping->comment_author_email = '';
} else if ( 0 === strpos($line, "IP:") ) {
$ip = trim( substr($line, strlen("IP:")) );
if ( 'comment' == $context )
$comment->comment_author_IP = $ip;
else
$ping->comment_author_IP = $ip;
} else if ( 0 === strpos($line, "URL:") ) {
$url = trim( substr($line, strlen("URL:")) );
if ( 'comment' == $context )
$comment->comment_author_url = $url;
else
$ping->comment_author_url = $url;
} else if ( 0 === strpos($line, "BLOG NAME:") ) {
$blog = trim( substr($line, strlen("BLOG NAME:")) );
$ping->comment_author = $blog;
} else {
// Processing multi-line field, check context.
// Then take the comments out
preg_match("|(-----\nCOMMENT:.*)|s", $post, $comments);
$post = preg_replace("|(-----\nCOMMENT:.*)|s", '', $post);
$line .= "\n";
if ( 'body' == $context ) {
$post->post_content .= $line;
} else if ( 'extended' == $context ) {
$post->extended .= $line;
} else if ( 'excerpt' == $context ) {
$post->post_excerpt .= $line;
} else if ( 'comment' == $context ) {
$comment->comment_content .= $line;
} else if ( 'ping' == $context ) {
$ping->comment_content .= $line;
// We ignore the keywords
$post = preg_replace("|(-----\nKEYWORDS:.*)|s", '', $post);
// We want the excerpt
preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
$post_excerpt = $wpdb->escape(trim($excerpt[1]));
$post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
// We're going to put extended body into main body with a more tag
preg_match("|-----\nEXTENDED BODY:(.*)|s", $post, $extended);
$extended = trim($extended[1]);
if ('' != $extended)
$extended = "\n<!--more-->\n$extended";
$post = preg_replace("|(-----\nEXTENDED BODY:.*)|s", '', $post);
// Now for the main body
preg_match("|-----\nBODY:(.*)|s", $post, $body);
$body = trim($body[1]);
$post_content = $wpdb->escape($body.$extended);
$post = preg_replace("|(-----\nBODY:.*)|s", '', $post);
// Grab the metadata from what's left
$metadata = explode("\n", $post);
foreach ($metadata as $line) {
preg_match("/^(.*?):(.*)/", $line, $token);
$key = trim($token[1]);
$value = trim($token[2]);
// Now we decide what it is and what to do with it
switch ($key) {
case '' :
break;
case 'AUTHOR' :
$post_author = $value;
break;
case 'TITLE' :
$post_title = $wpdb->escape($value);
break;
case 'STATUS' :
// "publish" and "draft" enumeration items match up; no change required
$post_status = $value;
if (empty ($post_status))
$post_status = 'publish';
break;
case 'ALLOW COMMENTS' :
$post_allow_comments = $value;
if ($post_allow_comments == 1) {
$comment_status = 'open';
} else {
$comment_status = 'closed';
}
break;
case 'CONVERT BREAKS' :
$post_convert_breaks = $value;
break;
case 'ALLOW PINGS' :
$ping_status = trim($meta[2][0]);
if ($ping_status == 1) {
$ping_status = 'open';
} else {
$ping_status = 'closed';
}
break;
case 'PRIMARY CATEGORY' :
if (! empty ($value) )
$post_categories[] = $wpdb->escape($value);
break;
case 'CATEGORY' :
if (! empty ($value) )
$post_categories[] = $wpdb->escape($value);
break;
case 'DATE' :
$post_modified = strtotime($value);
$post_modified = date('Y-m-d H:i:s', $post_modified);
$post_modified_gmt = get_gmt_from_date("$post_modified");
$post_date = $post_modified;
$post_date_gmt = $post_modified_gmt;
break;
default :
// echo "\n$key: $value";
break;
} // end switch
} // End foreach
// Let's check to see if it's in already
if ($post_id = post_exists($post_title, '', $post_date)) {
echo '<li>';
printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
} else {
echo '<li>';
printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
$post_id = wp_insert_post($postdata);
// Add categories.
if (0 != count($post_categories)) {
wp_create_categories($post_categories, $post_id);
}
}
$comment_post_ID = (int) $post_id;
$comment_approved = 1;
// Now for comments
$comments = explode("-----\nCOMMENT:", $comments[0]);
$num_comments = 0;
foreach ($comments as $comment) {
if ('' != trim($comment)) {
// Author
preg_match("|AUTHOR:(.*)|", $comment, $comment_author);
$comment_author = $wpdb->escape(trim($comment_author[1]));
$comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment);
preg_match("|EMAIL:(.*)|", $comment, $comment_author_email);
$comment_author_email = $wpdb->escape(trim($comment_author_email[1]));
$comment = preg_replace('|(\n?EMAIL:.*)|', '', $comment);
preg_match("|IP:(.*)|", $comment, $comment_author_IP);
$comment_author_IP = trim($comment_author_IP[1]);
$comment = preg_replace('|(\n?IP:.*)|', '', $comment);
preg_match("|URL:(.*)|", $comment, $comment_author_url);
$comment_author_url = $wpdb->escape(trim($comment_author_url[1]));
$comment = preg_replace('|(\n?URL:.*)|', '', $comment);
preg_match("|DATE:(.*)|", $comment, $comment_date);
$comment_date = trim($comment_date[1]);
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
$comment = preg_replace('|(\n?DATE:.*)|', '', $comment);
$comment_content = $wpdb->escape(trim($comment));
$comment_content = str_replace('-----', '', $comment_content);
// Check if it's already there
if (!comment_exists($comment_author, $comment_date)) {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
$commentdata = wp_filter_comment($commentdata);
wp_insert_comment($commentdata);
$num_comments++;
}
}
}
if ( $num_comments )
printf(' '.__('(%s comments)'), $num_comments);
// Finally the pings
// fix the double newline on the first one
$pings[0] = str_replace("-----\n\n", "-----\n", $pings[0]);
$pings = explode("-----\nPING:", $pings[0]);
$num_pings = 0;
foreach ($pings as $ping) {
if ('' != trim($ping)) {
// 'Author'
preg_match("|BLOG NAME:(.*)|", $ping, $comment_author);
$comment_author = $wpdb->escape(trim($comment_author[1]));
$ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping);
preg_match("|IP:(.*)|", $ping, $comment_author_IP);
$comment_author_IP = trim($comment_author_IP[1]);
$ping = preg_replace('|(\n?IP:.*)|', '', $ping);
preg_match("|URL:(.*)|", $ping, $comment_author_url);
$comment_author_url = $wpdb->escape(trim($comment_author_url[1]));
$ping = preg_replace('|(\n?URL:.*)|', '', $ping);
preg_match("|DATE:(.*)|", $ping, $comment_date);
$comment_date = trim($comment_date[1]);
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
$ping = preg_replace('|(\n?DATE:.*)|', '', $ping);
preg_match("|TITLE:(.*)|", $ping, $ping_title);
$ping_title = $wpdb->escape(trim($ping_title[1]));
$ping = preg_replace('|(\n?TITLE:.*)|', '', $ping);
$comment_content = $wpdb->escape(trim($ping));
$comment_content = str_replace('-----', '', $comment_content);
$comment_content = "<strong>$ping_title</strong>\n\n$comment_content";
$comment_type = 'trackback';
// Check if it's already there
if (!comment_exists($comment_author, $comment_date)) {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_type', 'comment_approved');
$commentdata = wp_filter_comment($commentdata);
wp_insert_comment($commentdata);
$num_pings++;
}
}
}
if ( $num_pings )
printf(' '.__('(%s pings)'), $num_pings);
echo "</li>";
}
}
echo '</ol>';
wp_import_cleanup($this->id);
do_action('import_done', 'mt');
echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3></div>';
}
function import() {
$this->id = (int) $_GET['id'];
if ( $this->id == 0 )
$this->file = ABSPATH . 'wp-content/mt-export.txt';
else
$this->file = get_attached_file($this->id);
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$result = $this->process_posts();
if ( is_wp_error( $result ) )
return $result;
$this->get_entries();
$this->process_posts();
}
function dispatch() {
@@ -440,9 +423,7 @@ class MT_Import {
break;
case 2:
check_admin_referer('import-mt');
$result = $this->import();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import();
break;
}
}
@@ -455,4 +436,4 @@ class MT_Import {
$mt_import = new MT_Import();
register_importer('mt', __('Movable Type and TypePad'), __('Import posts and comments from a Movable Type or Typepad blog'), array ($mt_import, 'dispatch'));
?>
?>

View File

@@ -110,8 +110,6 @@ class RSS_Import {
_e('Post already imported');
} else {
$post_id = wp_insert_post($post);
if ( is_wp_error( $post_id ) )
return $post_id;
if (!$post_id) {
_e("Couldn't get post ID");
return;
@@ -137,9 +135,7 @@ class RSS_Import {
$this->file = $file['file'];
$this->get_posts();
$result = $this->import_posts();
if ( is_wp_error( $result ) )
return $result;
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
@@ -161,9 +157,7 @@ class RSS_Import {
break;
case 1 :
check_admin_referer('import-upload');
$result = $this->import();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import();
break;
}

View File

@@ -1,155 +0,0 @@
<?php
class STP_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Simple Tagging').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
}
function footer() {
echo '</div>';
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This imports tags from an existing Simple Tagging 1.6.2 installation into this blog using the new WordPress native tagging structure.').'</p>';
echo '<p>'.__('This has not been tested on any other versions of Simple Tagging. Mileage may vary.').'</p>';
echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 4-step program to help you kick that nasty Simple Tagging habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
echo '<form action="admin.php?import=stp&amp;step=1" method="post">';
wp_nonce_field('import-stp');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 1 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function dispatch () {
if ( empty( $_GET['step'] ) ) {
$step = 0;
} else {
$step = (int) $_GET['step'];
}
// load the header
$this->header();
switch ( $step ) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-stp');
$this->import_posts();
break;
case 2:
check_admin_referer('import-stp');
$this->import_t2p();
break;
case 3:
check_admin_referer('import-stp');
$this->cleanup_import();
break;
}
// load the footer
$this->footer();
}
function import_posts ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading STP Post Tags&#8230;').'</h3></p>';
// read in all the STP tag -> post settings
$posts = $this->get_stp_posts();
// if we didn't get any tags back, that's all there is folks!
if ( !is_array($posts) ) {
echo '<p>' . __('No posts were found to have tags!') . '</p>';
return false;
}
else {
// if there's an existing entry, delete it
if ( get_option('stpimp_posts') ) {
delete_option('stpimp_posts');
}
add_option('stpimp_posts', $posts);
$count = count($posts);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
}
echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
wp_nonce_field('import-stp');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 2 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function import_t2p ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
// run that funky magic!
$tags_added = $this->tag2post();
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>';
echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
wp_nonce_field('import-stp');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 3 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function get_stp_posts ( ) {
global $wpdb;
// read in all the posts from the STP post->tag table: should be wp_post2tag
$posts_query = "SELECT post_id, tag_name FROM " . $wpdb->prefix . "stp_tags";
$posts = $wpdb->get_results($posts_query);
return $posts;
}
function tag2post ( ) {
global $wpdb;
// get the tags and posts we imported in the last 2 steps
$posts = get_option('stpimp_posts');
// null out our results
$tags_added = 0;
// loop through each post and add its tags to the db
foreach ( $posts as $this_post ) {
$the_post = (int) $this_post->post_id;
$the_tag = $wpdb->escape($this_post->tag_name);
// try to add the tag
wp_add_post_tags($the_post, $the_tag);
$tags_added++;
}
// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
return $tags_added;
}
function cleanup_import ( ) {
delete_option('stpimp_posts');
$this->done();
}
function done ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
echo '<p>' . __('OK, so we lied about this being a 4-step program! You&#8217;re done!') . '</p>';
echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';
echo '</div>';
}
function STP_Import ( ) {
// Nothing.
}
}
// create the import object
$stp_import = new STP_Import();
// add it to the import page!
register_importer('stp', 'Simple Tagging', __('Import Simple Tagging tags into the new native tagging structure.'), array($stp_import, 'dispatch'));
?>

View File

@@ -2,6 +2,18 @@
/**
Add These Functions to make our lives easier
**/
if(!function_exists('get_catbynicename'))
{
function get_catbynicename($category_nicename)
{
global $wpdb;
$cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
return $name;
}
}
if(!function_exists('get_comment_count'))
{
@@ -26,14 +38,14 @@ if(!function_exists('link_exists'))
**/
class Textpattern_Import {
function header()
function header()
{
echo '<div class="wrap">';
echo '<h2>'.__('Import Textpattern').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
}
function footer()
function footer()
{
echo '</div>';
}
@@ -305,8 +317,6 @@ class Textpattern_Import {
'post_name' => $url_title,
'comment_count' => $comments_count)
);
if ( is_wp_error( $ret_id ) )
return $ret_id;
}
else
{
@@ -323,19 +333,13 @@ class Textpattern_Import {
'post_name' => $url_title,
'comment_count' => $comments_count)
);
if ( is_wp_error( $ret_id ) )
return $ret_id;
}
$txpposts2wpposts[$ID] = $ret_id;
// Make Post-to-Category associations
$cats = array();
$category1 = get_category_by_slug($Category1);
$category1 = $category1->term_id;
$category2 = get_category_by_slug($Category2);
$category2 = $category1->term_id;
if($cat1 = $category1) { $cats[1] = $cat1; }
if($cat2 = $category2) { $cats[2] = $cat2; }
if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
if($cat2 = get_catbynicename($Category2)) { $cats[2] = $cat2; }
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
}
@@ -502,9 +506,7 @@ class Textpattern_Import {
{
// Post Import
$posts = $this->get_txp_posts();
$result = $this->posts2wp($posts);
if ( is_wp_error( $result ) )
return $result;
$this->posts2wp($posts);
echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
wp_nonce_field('import-textpattern');
@@ -557,11 +559,11 @@ class Textpattern_Import {
{
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>';
echo '<h3>'.__('Users').'</h3>';
echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn&#8217;t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn\'t have that login in Textpattern, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
echo '<h3>'.__('Preserving Authors').'</h3>';
echo '<p>'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
echo '<h3>'.__('Textile').'</h3>';
echo '<p>'.__('Also, since you&#8217;re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You&#8217;ll want it.').'</p>';
echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>. Trust me... You\'ll want it.').'</p>';
echo '<h3>'.__('WordPress Resources').'</h3>';
echo '<p>'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'</p>';
echo '<ul>';
@@ -569,7 +571,7 @@ class Textpattern_Import {
echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
echo '</ul>';
echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">login</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>';
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
}
function db_form()
@@ -644,9 +646,7 @@ class Textpattern_Import {
$this->import_users();
break;
case 3 :
$result = $this->import_posts();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import_posts();
break;
case 4 :
$this->import_comments();

View File

@@ -1,276 +0,0 @@
<?php
class UTW_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Ultimate Tag Warrior').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
}
function footer() {
echo '</div>';
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This imports tags from an existing Ultimate Tag Warrior 3 installation into this blog using the new WordPress native tagging structure.').'</p>';
echo '<p>'.__('This has not been tested on any other versions of Ultimate Tag Warrior. Mileage may vary.').'</p>';
echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
echo '<form action="admin.php?import=utw&amp;step=1" method="post">';
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 1 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function dispatch () {
if ( empty( $_GET['step'] ) ) {
$step = 0;
} else {
$step = (int) $_GET['step'];
}
if ( $step > 1 )
check_admin_referer('import-utw');
// load the header
$this->header();
switch ( $step ) {
case 0 :
$this->greet();
break;
case 1 :
$this->import_tags();
break;
case 2 :
$this->import_posts();
break;
case 3:
$this->import_t2p();
break;
case 4:
$this->cleanup_import();
break;
}
// load the footer
$this->footer();
}
function import_tags ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading UTW Tags&#8230;').'</h3></p>';
$tags = $this->get_utw_tags();
// if we didn't get any tags back, that's all there is folks!
if ( !is_array($tags) ) {
echo '<p>' . __('No Tags Found!') . '</p>';
return false;
}
else {
// if there's an existing entry, delete it
if ( get_option('utwimp_tags') ) {
delete_option('utwimp_tags');
}
add_option('utwimp_tags', $tags);
$count = count($tags);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
echo '<p>' . __('The following tags were found:') . '</p>';
echo '<ul>';
foreach ( $tags as $tag_id => $tag_name ) {
echo '<li>' . $tag_name . '</li>';
}
echo '</ul>';
echo '<br />';
echo '<p>' . __('If you don&#8217;t want to import any of these tags, you should delete them from the UTW tag management page and then re-run this import.') . '</p>';
}
echo '<form action="admin.php?import=utw&amp;step=2" method="post">';
wp_nonce_field('import-utw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 2 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function import_posts ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Reading UTW Post Tags&#8230;').'</h3></p>';
// read in all the UTW tag -> post settings
$posts = $this->get_utw_posts();
// if we didn't get any tags back, that's all there is folks!
if ( !is_array($posts) ) {
echo '<p>' . __('No posts were found to have tags!') . '</p>';
return false;
}
else {
// if there's an existing entry, delete it
if ( get_option('utwimp_posts') ) {
delete_option('utwimp_posts');
}
add_option('utwimp_posts', $posts);
$count = count($posts);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
}
echo '<form action="admin.php?import=utw&amp;step=3" method="post">';
wp_nonce_field('import-utw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 3 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function import_t2p ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Adding Tags to Posts&#8230;').'</h3></p>';
// run that funky magic!
$tags_added = $this->tag2post();
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were added!'), $tags_added ) . '<br /></p>';
echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
wp_nonce_field('import-utw');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 4 &raquo;').'" /></p>';
echo '</form>';
echo '</div>';
}
function get_utw_tags ( ) {
global $wpdb;
// read in all the tags from the UTW tags table: should be wp_tags
$tags_query = "SELECT tag_id, tag FROM " . $wpdb->prefix . "tags";
$tags = $wpdb->get_results($tags_query);
// rearrange these tags into something we can actually use
foreach ( $tags as $tag ) {
$new_tags[$tag->tag_id] = $tag->tag;
}
return $new_tags;
}
function get_utw_posts ( ) {
global $wpdb;
// read in all the posts from the UTW post->tag table: should be wp_post2tag
$posts_query = "SELECT tag_id, post_id FROM " . $wpdb->prefix . "post2tag";
$posts = $wpdb->get_results($posts_query);
return $posts;
}
function tag2post ( ) {
// get the tags and posts we imported in the last 2 steps
$tags = get_option('utwimp_tags');
$posts = get_option('utwimp_posts');
// null out our results
$tags_added = 0;
// loop through each post and add its tags to the db
foreach ( $posts as $this_post ) {
$the_post = (int) $this_post->post_id;
$the_tag = (int) $this_post->tag_id;
// what's the tag name for that id?
$the_tag = $tags[$the_tag];
// screw it, just try to add the tag
wp_add_post_tags($the_post, $the_tag);
$tags_added++;
}
// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
return $tags_added;
}
function cleanup_import ( ) {
delete_option('utwimp_tags');
delete_option('utwimp_posts');
$this->done();
}
function done ( ) {
echo '<div class="narrow">';
echo '<p><h3>'.__('Import Complete!').'</h3></p>';
echo '<p>' . __('OK, so we lied about this being a 5-step program! You&#8217;re done!') . '</p>';
echo '<p>' . __('Now wasn&#8217;t that easy?') . '</p>';
echo '</div>';
}
function UTW_Import ( ) {
// Nothing.
}
}
// create the import object
$utw_import = new UTW_Import();
// add it to the import page!
register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into the new native tagging structure.'), array($utw_import, 'dispatch'));
?>

View File

@@ -44,7 +44,7 @@ class WP_Import {
function users_form($n) {
global $wpdb, $testing;
$users = $wpdb->get_results("SELECT user_login FROM $wpdb->users ORDER BY user_login");
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo $n; ?>]">
<option value="#NONE#">- Select -</option>
<?php
@@ -85,52 +85,39 @@ class WP_Import {
function get_entries() {
set_magic_quotes_runtime(0);
$importdata = array_map('rtrim', file($this->file)); // Read the file into an array
$this->posts = array();
$this->categories = array();
$this->tags = array();
$num = 0;
$doing_entry = false;
$fp = fopen($this->file, 'r');
if ($fp) {
while ( !feof($fp) ) {
$importline = rtrim(fgets($fp));
if ( false !== strpos($importline, '<wp:category>') ) {
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
$this->categories[] = $category[1];
continue;
}
if ( false !== strpos($importline, '<wp:tag>') ) {
preg_match('|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag);
$this->tags[] = $tag[1];
continue;
}
if ( false !== strpos($importline, '<item>') ) {
$this->posts[$num] = '';
$doing_entry = true;
continue;
}
if ( false !== strpos($importline, '</item>') ) {
$num++;
$doing_entry = false;
continue;
}
if ( $doing_entry ) {
$this->posts[$num] .= $importline . "\n";
}
foreach ($importdata as $importline) {
if ( false !== strpos($importline, '<wp:category>') ) {
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
$this->categories[] = $category[1];
continue;
}
foreach ($this->posts as $post) {
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ($post_ID) {
$this->posts_processed[$post_ID][0] = &$post;
$this->posts_processed[$post_ID][1] = 0;
}
if ( false !== strpos($importline, '<item>') ) {
$this->posts[$num] = '';
$doing_entry = true;
continue;
}
if ( false !== strpos($importline, '</item>') ) {
$num++;
$doing_entry = false;
continue;
}
if ( $doing_entry ) {
$this->posts[$num] .= $importline . "\n";
}
}
fclose($fp);
foreach ($this->posts as $post) {
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ($post_ID) {
$this->posts_processed[$post_ID][0] = &$post;
$this->posts_processed[$post_ID][1] = 0;
}
}
}
@@ -203,7 +190,7 @@ class WP_Import {
echo '</li>';
}
echo '<input type="submit" value="Submit">'.'<br />';
echo '<input type="submit" value="Submit">'.'<br/>';
echo '</form>';
echo '</ol>';
@@ -226,7 +213,7 @@ class WP_Import {
function process_categories() {
global $wpdb;
$cat_names = (array) get_terms('category', 'fields=names');
$cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories");
while ( $c = array_shift($this->categories) ) {
$cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));
@@ -252,36 +239,12 @@ class WP_Import {
}
}
function process_tags() {
global $wpdb;
$tag_names = (array) get_terms('post_tag', 'fields=names');
while ( $c = array_shift($this->tags) ) {
$tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));
// If the category exists we leave it alone
if ( in_array($tag_name, $tag_names) )
continue;
$slug = $this->get_tag( $c, 'wp:tag_slug' );
$description = $this->get_tag( $c, 'wp:tag_description' );
$tagarr = compact('slug', 'description');
$tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr);
}
}
function process_posts() {
$i = -1;
echo '<ol>';
foreach ($this->posts as $post) {
$result = $this->process_post($post);
if ( is_wp_error( $result ) )
return $result;
}
foreach ($this->posts as $post)
$this->process_post($post);
echo '</ol>';
@@ -289,14 +252,14 @@ class WP_Import {
echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
}
function process_post($post) {
global $wpdb;
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ( $post_ID && !empty($this->posts_processed[$post_ID][1]) ) // Processed already
return 0;
// There are only ever one of these
$post_title = $this->get_tag( $post, 'title' );
$post_date = $this->get_tag( $post, 'wp:post_date' );
@@ -316,15 +279,6 @@ class WP_Import {
$post_content = str_replace('<br>', '<br />', $post_content);
$post_content = str_replace('<hr>', '<hr />', $post_content);
preg_match_all('|<category domain="tag">(.*?)</category>|is', $post, $tags);
$tags = $tags[1];
$tag_index = 0;
foreach ($tags as $tag) {
$tags[$tag_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $tag)));
$tag_index++;
}
preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
$categories = $categories[1];
@@ -342,11 +296,7 @@ class WP_Import {
// If it has parent, process parent first.
$post_parent = (int) $post_parent;
if ($parent = $this->posts_processed[$post_parent]) {
if (!$parent[1]) {
$result = $this->process_post($parent[0]); // If not yet, process the parent first.
if ( is_wp_error( $result ) )
return $result;
}
if (!$parent[1]) $this->process_post($parent[0]); // If not yet, process the parent first.
$post_parent = $parent[1]; // New ID of the parent;
}
@@ -357,49 +307,23 @@ class WP_Import {
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'post_name', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'menu_order', 'post_type');
$comment_post_ID = $post_id = wp_insert_post($postdata);
if ( is_wp_error( $post_id ) )
return $post_id;
// Memorize old and new ID.
if ( $post_id && $post_ID && $this->posts_processed[$post_ID] )
$this->posts_processed[$post_ID][1] = $post_id; // New ID.
// Add categories.
if (count($categories) > 0) {
$post_cats = array();
foreach ($categories as $category) {
$slug = sanitize_term_field('slug', $category, 0, 'category', 'db');
$cat = get_term_by('slug', $slug, 'category');
$cat_ID = 0;
if ( ! empty($cat) )
$cat_ID = $cat->term_id;
$cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'");
if ($cat_ID == 0) {
$category = $wpdb->escape($category);
$cat_ID = wp_insert_category(array('cat_name' => $category));
}
$post_cats[] = $cat_ID;
}
wp_set_post_categories($post_id, $post_cats);
}
// Add tags.
if (count($tags) > 0) {
$post_tags = array();
foreach ($tags as $tag) {
$slug = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
$tag_obj = get_term_by('slug', $slug, 'post_tag');
$tag_id = 0;
if ( ! empty($tag_obj) )
$tag_id = $tag_obj->term_id;
if ( $tag_id == 0 ) {
$tag = $wpdb->escape($tag);
$tag_id = wp_insert_term($tag, 'post_tag');
$tag_id = $tag_id['term_id'];
}
$post_tags[] = $tag_id;
}
wp_set_post_tags($post_id, $post_tags);
}
}
}
// Now for comments
@@ -446,10 +370,7 @@ class WP_Import {
$this->get_authors_from_post();
$this->get_entries();
$this->process_categories();
$this->process_tags();
$result = $this->process_posts();
if ( is_wp_error( $result ) )
return $result;
$this->process_posts();
}
function dispatch() {
@@ -469,9 +390,7 @@ class WP_Import {
break;
case 2:
check_admin_referer('import-wordpress');
$result = $this->import();
if ( is_wp_error( $result ) )
echo $result->get_error_message();
$this->import();
break;
}
$this->footer();

View File

@@ -1,212 +0,0 @@
<?php
class WP_Categories_to_Tags {
var $categories_to_convert = array();
var $all_categories = array();
function header() {
print '<div class="wrap">';
print '<h2>' . __('Convert Categories to Tags') . '</h2>';
}
function footer() {
print '</div>';
}
function populate_all_categories() {
global $wpdb;
$categories = get_categories('get=all');
foreach ( $categories as $category ) {
if ( !tag_exists($wpdb->escape($category->name)) )
$this->all_categories[] = $category;
}
}
function welcome() {
$this->populate_all_categories();
print '<div class="narrow">';
if (count($this->all_categories) > 0) {
print '<p>' . __('Howdy! This converter allows you to selectively convert existing categories to tags. To get started, check the checkboxes of the categories you wish to be converted, then click the Convert button.') . '</p>';
print '<p>' . __('Keep in mind that if you convert a category with child categories, those child categories get their parent setting removed, so they\'re in the root.') . '</p>';
$this->categories_form();
} else {
print '<p>'.__('You have no categories to convert!').'</p>';
}
print '</div>';
}
function categories_form() {
print '<form action="admin.php?import=wp-cat2tag&amp;step=2" method="post">';
wp_nonce_field('import-cat2tag');
print '<ul style="list-style:none">';
$hier = _get_term_hierarchy('category');
foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' );
if ((int) $category->parent == 0) {
print '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
if (isset($hier[$category->term_id])) {
$this->_category_children($category, $hier);
}
print '</li>';
}
}
print '</ul>';
print '<p class="submit"><input type="submit" name="submit" value="' . __('Convert &raquo;') . '" /></p>';
print '</form>';
}
function _category_children($parent, $hier) {
print '<ul style="list-style:none">';
foreach ($hier[$parent->term_id] as $child_id) {
$child =& get_category($child_id);
print '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
if (isset($hier[$child->term_id])) {
$this->_category_children($child, $hier);
}
print '</li>';
}
print '</ul>';
}
function _category_exists($cat_id) {
global $wpdb;
$cat_id = (int) $cat_id;
$maybe_exists = category_exists($cat_id);
if ( $maybe_exists ) {
return true;
} else {
return false;
}
}
function convert_them() {
global $wpdb;
if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
print '<div class="narrow">';
print '<p>' . sprintf(__('Uh, oh. Something didn\'t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
print '</div>';
return;
}
if ( empty($this->categories_to_convert) )
$this->categories_to_convert = $_POST['cats_to_convert'];
$hier = _get_term_hierarchy('category');
print '<ul>';
foreach ( (array) $this->categories_to_convert as $cat_id) {
$cat_id = (int) $cat_id;
print '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
if (!$this->_category_exists($cat_id)) {
_e('Category doesn\'t exist!');
} else {
$category =& get_category($cat_id);
if ( tag_exists($wpdb->escape($category->name)) ) {
_e('Category is already a tag.');
print '</li>';
continue;
}
// If the category is the default, leave category in place and create tag.
if ( get_option('default_category') == $category->term_id ) {
$id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
foreach ( $posts as $post ) {
if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
clean_post_cache($post);
}
} else {
$tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
if ( $tt_ids ) {
$posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
foreach ( (array) $posts as $post )
clean_post_cache($post);
}
// Change the category to a tag.
$wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
$terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
foreach ( (array) $terms as $term )
clean_category_cache($term);
// Set all parents to 0 (root-level) if their parent was the converted tag
$wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
}
// Clean the cache
clean_category_cache($category->term_id);
_e('Converted successfully.');
}
print '</li>';
}
print '</ul>';
}
function init() {
$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
$this->header();
if (!current_user_can('manage_categories')) {
print '<div class="narrow">';
print '<p>' . __('Cheatin&#8217; uh?') . '</p>';
print '</div>';
} else {
if ( $step > 1 )
check_admin_referer('import-cat2tag');
switch ($step) {
case 1 :
$this->welcome();
break;
case 2 :
$this->convert_them();
break;
}
}
$this->footer();
}
function WP_Categories_to_Tags() {
// Do nothing.
}
}
$wp_cat2tag_importer = new WP_Categories_to_Tags();
register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
?>

View File

@@ -1,19 +0,0 @@
<?php
require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
require_once(ABSPATH . 'wp-admin/includes/comment.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
require_once(ABSPATH . 'wp-admin/includes/import.php');
require_once(ABSPATH . 'wp-admin/includes/misc.php');
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
require_once(ABSPATH . 'wp-admin/includes/post.php');
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
require_once(ABSPATH . 'wp-admin/includes/template.php');
require_once(ABSPATH . 'wp-admin/includes/theme.php');
require_once(ABSPATH . 'wp-admin/includes/user.php');
require_once(ABSPATH . 'wp-admin/includes/update.php');
require_once(ABSPATH . WPINC . '/registration.php');
?>

View File

@@ -1,177 +0,0 @@
<?php
function add_link() {
return edit_link();
}
function edit_link( $link_id = '' ) {
if (!current_user_can( 'manage_links' ))
wp_die( __( 'Cheatin&#8217; uh?' ));
$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
$_POST['link_url'] = clean_url($_POST['link_url']);
$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
$_POST['link_rss'] = clean_url($_POST['link_rss']);
if ( !empty( $link_id ) ) {
$_POST['link_id'] = $link_id;
return wp_update_link( $_POST);
} else {
return wp_insert_link( $_POST);
}
}
function get_default_link_to_edit() {
if ( isset( $_GET['linkurl'] ) )
$link->link_url = clean_url( $_GET['linkurl']);
else
$link->link_url = '';
if ( isset( $_GET['name'] ) )
$link->link_name = attribute_escape( $_GET['name']);
else
$link->link_name = '';
$link->link_visible = 'Y';
return $link;
}
function wp_delete_link($link_id) {
global $wpdb;
do_action('delete_link', $link_id);
wp_delete_object_term_relationships($link_id, 'link_category');
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
do_action('deleted_link', $link_id);
return true;
}
function wp_get_link_cats($link_id = 0) {
$cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
return array_unique($cats);
}
function get_link_to_edit( $link_id ) {
return get_link( $link_id, OBJECT, 'edit' );
}
function wp_insert_link($linkdata) {
global $wpdb, $current_user;
$defaults = array('link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
$linkdata = wp_parse_args($linkdata, $defaults);
$linkdata = sanitize_bookmark($linkdata, 'db');
extract($linkdata, EXTR_SKIP);
$update = false;
if ( !empty($link_id) )
$update = true;
if ( trim( $link_name ) == '' )
return 0;
if ( trim( $link_url ) == '' )
return 0;
if ( empty($link_rating) )
$link_rating = 0;
if ( empty($link_image) )
$link_image = '';
if ( empty($link_target) )
$link_target = '';
if ( empty($link_visible) )
$link_visible = 'Y';
if ( empty($link_owner) )
$link_owner = $current_user->id;
if ( empty($link_notes) )
$link_notes = '';
if ( empty($link_description) )
$link_description = '';
if ( empty($link_rss) )
$link_rss = '';
if ( empty($link_rel) )
$link_rel = '';
// Make sure we set a valid category
if (0 == count($link_category) || !is_array($link_category)) {
$link_category = array(get_option('default_link_category'));
}
if ( $update ) {
$wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
link_name='$link_name', link_image='$link_image',
link_target='$link_target',
link_visible='$link_visible', link_description='$link_description',
link_rating='$link_rating', link_rel='$link_rel',
link_notes='$link_notes', link_rss = '$link_rss'
WHERE link_id='$link_id'");
} else {
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = (int) $wpdb->insert_id;
}
wp_set_link_cats($link_id, $link_category);
if ( $update )
do_action('edit_link', $link_id);
else
do_action('add_link', $link_id);
return $link_id;
}
function wp_set_link_cats($link_id = 0, $link_categories = array()) {
// If $link_categories isn't already an array, make it one:
if (!is_array($link_categories) || 0 == count($link_categories))
$link_categories = array(get_option('default_link_category'));
$link_categories = array_map('intval', $link_categories);
$link_categories = array_unique($link_categories);
wp_set_object_terms($link_id, $link_categories, 'link_category');
} // wp_set_link_cats()
function wp_update_link($linkdata) {
global $wpdb;
$link_id = (int) $linkdata['link_id'];
$link = get_link($link_id, ARRAY_A);
// Escape data pulled from DB.
$link = add_magic_quotes($link);
// Passed link category list overwrites existing category list if not empty.
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
&& 0 != count($linkdata['link_category']) )
$link_cats = $linkdata['link_category'];
else
$link_cats = $link['link_category'];
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata);
$linkdata['link_category'] = $link_cats;
return wp_insert_link($linkdata);
}
?>

View File

@@ -1,68 +0,0 @@
<?php
function comment_exists($comment_author, $comment_date) {
global $wpdb;
return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
}
function edit_comment() {
global $user_ID;
$comment_ID = (int) $_POST['comment_ID'];
$comment_post_ID = (int) $_POST['comment_post_ID'];
if (!current_user_can( 'edit_post', $comment_post_ID ))
wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
$_POST['comment_author'] = $_POST['newcomment_author'];
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
$_POST['comment_approved'] = $_POST['comment_status'];
$_POST['comment_content'] = $_POST['content'];
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
wp_update_comment( $_POST);
}
function get_comment_to_edit( $id ) {
if ( !$comment = get_comment($id) )
return false;
$comment->comment_ID = (int) $comment->comment_ID;
$comment->comment_post_ID = (int) $comment->comment_post_ID;
$comment->comment_content = format_to_edit( $comment->comment_content );
$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);
$comment->comment_author = format_to_edit( $comment->comment_author );
$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
$comment->comment_author_url = clean_url($comment->comment_author_url);
$comment->comment_author_url = format_to_edit( $comment->comment_author_url );
return $comment;
}
function get_pending_comments_num( $post_id ) {
global $wpdb;
$post_id = (int) $post_id;
$pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
return $pending;
}
?>

View File

@@ -1,192 +0,0 @@
<?php
$wp_file_descriptions = array ('index.php' => __( 'Main Index Template' ), 'style.css' => __( 'Stylesheet' ), 'comments.php' => __( 'Comments' ), 'comments-popup.php' => __( 'Popup Comments' ), 'footer.php' => __( 'Footer' ), 'header.php' => __( 'Header' ), 'sidebar.php' => __( 'Sidebar' ), 'archive.php' => __( 'Archives' ), 'category.php' => __( 'Category Template' ), 'page.php' => __( 'Page Template' ), 'search.php' => __( 'Search Results' ), 'single.php' => __( 'Single Post' ), '404.php' => __( '404 Template' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ),
// Deprecated files
'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
function get_file_description( $file ) {
global $wp_file_descriptions;
if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
return $wp_file_descriptions[basename( $file )];
}
elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
$template_data = implode( '', file( ABSPATH . $file ) );
if ( preg_match( "|Template Name:(.*)|i", $template_data, $name ))
return $name[1];
}
return basename( $file );
}
function get_home_path() {
$home = get_option( 'home' );
if ( $home != '' && $home != get_option( 'siteurl' ) ) {
$home_path = parse_url( $home );
$home_path = $home_path['path'];
$root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
$home_path = trailingslashit( $root.$home_path );
} else {
$home_path = ABSPATH;
}
return $home_path;
}
function get_real_file_to_edit( $file ) {
if ('index.php' == $file || '.htaccess' == $file ) {
$real_file = get_home_path().$file;
} else {
$real_file = ABSPATH.$file;
}
return $real_file;
}
function validate_file( $file, $allowed_files = '' ) {
if ( false !== strpos( $file, '..' ))
return 1;
if ( false !== strpos( $file, './' ))
return 1;
if (':' == substr( $file, 1, 1 ))
return 2;
if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
return 3;
return 0;
}
function validate_file_to_edit( $file, $allowed_files = '' ) {
$file = stripslashes( $file );
$code = validate_file( $file, $allowed_files );
if (!$code )
return $file;
switch ( $code ) {
case 1 :
wp_die( __('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
case 2 :
wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
case 3 :
wp_die( __('Sorry, that file cannot be edited.' ));
}
}
// array wp_handle_upload ( array &file [, array overrides] )
// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
// overrides: an associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
// On success, returns an associative array of file attributes.
// On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
function wp_handle_upload( &$file, $overrides = false ) {
// The default error handler.
if (! function_exists( 'wp_handle_upload_error' ) ) {
function wp_handle_upload_error( &$file, $message ) {
return array( 'error'=>$message );
}
}
// You may define your own function and pass the name in $overrides['upload_error_handler']
$upload_error_handler = 'wp_handle_upload_error';
// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
$action = 'wp_handle_upload';
// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
$upload_error_strings = array( false,
__( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
__( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
__( "The uploaded file was only partially uploaded." ),
__( "No file was uploaded." ),
__( "Missing a temporary folder." ),
__( "Failed to write file to disk." ));
// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
$test_form = true;
$test_size = true;
// If you override this, you must provide $ext and $type!!!!
$test_type = true;
// Install user overrides. Did we mention that this voids your warranty?
if ( is_array( $overrides ) )
extract( $overrides, EXTR_OVERWRITE );
// A correct form post will pass this test.
if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
return $upload_error_handler( $file, __( 'Invalid form submission.' ));
// A successful upload will pass this test. It makes no sense to override this one.
if ( $file['error'] > 0 )
return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
// A non-empty file will pass this test.
if ( $test_size && !($file['size'] > 0 ) )
return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
// A properly uploaded file will pass this test. There should be no reason to override this one.
if (! @ is_uploaded_file( $file['tmp_name'] ) )
return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
if ( $test_type ) {
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
extract( $wp_filetype );
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
if ( !$ext )
$ext = ltrim(strrchr($file['name'], '.'), '.');
}
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
return $upload_error_handler( $file, $uploads['error'] );
// Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
if ( isset( $unique_filename_callback ) && function_exists( $unique_filename_callback ) ) {
$filename = $unique_filename_callback( $uploads['path'], $file['name'] );
} else {
$number = '';
$filename = str_replace( '#', '_', $file['name'] );
$filename = str_replace( array( '\\', "'" ), '', $filename );
if ( empty( $ext) )
$ext = '';
else
$ext = ".$ext";
while ( file_exists( $uploads['path'] . "/$filename" ) ) {
if ( '' == "$number$ext" )
$filename = $filename . ++$number . $ext;
else
$filename = str_replace( "$number$ext", ++$number . $ext, $filename );
}
$filename = str_replace( $ext, '', $filename );
$filename = sanitize_title_with_dashes( $filename ) . $ext;
}
// Move the file to the uploads dir
$new_file = $uploads['path'] . "/$filename";
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
wp_die( printf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));
// Set correct file permissions
$stat = stat( dirname( $new_file ));
$perms = $stat['mode'] & 0000666;
@ chmod( $new_file, $perms );
// Compute the URL
$url = $uploads['url'] . "/$filename";
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return $return;
}
?>

View File

@@ -1,192 +0,0 @@
<?php
function get_udims( $width, $height) {
if ( $height <= 96 && $width <= 128 )
return array( $width, $height);
elseif ( $width / $height > 4 / 3 )
return array( 128, (int) ($height / $width * 128 ));
else
return array( (int) ($width / $height * 96 ), 96 );
}
function wp_create_thumbnail( $file, $max_side, $effect = '' ) {
// 1 = GIF, 2 = JPEG, 3 = PNG
if ( file_exists( $file ) ) {
$type = getimagesize( $file );
// if the associated function doesn't exist - then it's not
// handle. duh. i hope.
if (!function_exists( 'imagegif' ) && $type[2] == 1 ) {
$error = __( 'Filetype not supported. Thumbnail not created.' );
}
elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {
$error = __( 'Filetype not supported. Thumbnail not created.' );
}
elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {
$error = __( 'Filetype not supported. Thumbnail not created.' );
} else {
// create the initial copy from the original file
if ( $type[2] == 1 ) {
$image = imagecreatefromgif( $file );
}
elseif ( $type[2] == 2 ) {
$image = imagecreatefromjpeg( $file );
}
elseif ( $type[2] == 3 ) {
$image = imagecreatefrompng( $file );
}
if ( function_exists( 'imageantialias' ))
imageantialias( $image, TRUE );
$image_attr = getimagesize( $file );
// figure out the longest side
if ( $image_attr[0] > $image_attr[1] ) {
$image_width = $image_attr[0];
$image_height = $image_attr[1];
$image_new_width = $max_side;
$image_ratio = $image_width / $image_new_width;
$image_new_height = $image_height / $image_ratio;
//width is > height
} else {
$image_width = $image_attr[0];
$image_height = $image_attr[1];
$image_new_height = $max_side;
$image_ratio = $image_height / $image_new_height;
$image_new_width = $image_width / $image_ratio;
//height > width
}
$thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
@ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );
// If no filters change the filename, we'll do a default transformation.
if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
$thumb = preg_replace( '!(\.[^.]+)?$!', '.thumbnail' . '$1', basename( $file ), 1 );
$thumbpath = str_replace( basename( $file ), $thumb, $file );
// move the thumbnail to its final destination
if ( $type[2] == 1 ) {
if (!imagegif( $thumbnail, $thumbpath ) ) {
$error = __( "Thumbnail path invalid" );
}
}
elseif ( $type[2] == 2 ) {
if (!imagejpeg( $thumbnail, $thumbpath ) ) {
$error = __( "Thumbnail path invalid" );
}
}
elseif ( $type[2] == 3 ) {
if (!imagepng( $thumbnail, $thumbpath ) ) {
$error = __( "Thumbnail path invalid" );
}
}
}
} else {
$error = __( 'File not found' );
}
if (!empty ( $error ) ) {
return $error;
} else {
return apply_filters( 'wp_create_thumbnail', $thumbpath );
}
}
function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
if ( ctype_digit( $src_file ) ) // Handle int as attachment ID
$src_file = get_attached_file( $src_file );
$src = wp_load_image( $src_file );
if ( !is_resource( $src ))
return $src;
$dst = imagecreatetruecolor( $dst_w, $dst_h );
if ( $src_abs ) {
$src_w -= $src_x;
$src_h -= $src_y;
}
if (function_exists('imageantialias'))
imageantialias( $dst, true );
imagecopyresampled( $dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
if ( !$dst_file )
$dst_file = str_replace( basename( $src_file ), 'cropped-'.basename( $src_file ), $src_file );
$dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file );
if ( imagejpeg( $dst, $dst_file ) )
return $dst_file;
else
return false;
}
function wp_generate_attachment_metadata( $attachment_id, $file ) {
$attachment = get_post( $attachment_id );
$metadata = array();
if ( preg_match('!^image/!', get_post_mime_type( $attachment )) ) {
$imagesize = getimagesize($file);
$metadata['width'] = $imagesize['0'];
$metadata['height'] = $imagesize['1'];
list($uwidth, $uheight) = get_udims($metadata['width'], $metadata['height']);
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
$metadata['file'] = $file;
$max = apply_filters( 'wp_thumbnail_creation_size_limit', 3 * 1024 * 1024, $attachment_id, $file );
if ( $max < 0 || $metadata['width'] * $metadata['height'] < $max ) {
$max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file );
$thumb = wp_create_thumbnail( $file, $max_side );
if ( @file_exists($thumb) )
$metadata['thumb'] = basename($thumb);
}
}
return apply_filters( 'wp_generate_attachment_metadata', $metadata );
}
function wp_load_image( $file ) {
if ( ctype_digit( $file ) )
$file = get_attached_file( $file );
if ( !file_exists( $file ) )
return sprintf(__("File '%s' doesn't exist?"), $file);
if ( ! function_exists('imagecreatefromstring') )
return __('The GD image library is not installed.');
$contents = file_get_contents( $file );
$image = imagecreatefromstring( $contents );
if ( !is_resource( $image ) )
return sprintf(__("File '%s' is not an image."), $file);
return $image;
}
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
if ( $height <= $hmax && $width <= $wmax )
return array( $width, $height);
elseif ( $width / $height > $wmax / $hmax )
return array( $wmax, (int) ($height / $width * $wmax ));
else
return array( (int) ($width / $height * $hmax ), $hmax );
}
?>

View File

@@ -1,45 +0,0 @@
<?php
function get_importers() {
global $wp_importers;
uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));
return $wp_importers;
}
function register_importer( $id, $name, $description, $callback ) {
global $wp_importers;
if ( is_wp_error( $callback ) )
return $callback;
$wp_importers[$id] = array ( $name, $description, $callback );
}
function wp_import_cleanup( $id ) {
wp_delete_attachment( $id );
}
function wp_import_handle_upload() {
$overrides = array( 'test_form' => false, 'test_type' => false );
$file = wp_handle_upload( $_FILES['import'], $overrides );
if ( isset( $file['error'] ) )
return $file;
$url = $file['url'];
$type = $file['type'];
$file = addslashes( $file['file'] );
$filename = basename( $file );
// Construct the object array
$object = array( 'post_title' => $filename,
'post_content' => $url,
'post_mime_type' => $type,
'guid' => $url
);
// Save the data
$id = wp_insert_attachment( $object, $file );
return array( 'file' => $file, 'id' => $id );
}
?>

View File

@@ -1,177 +0,0 @@
<?php
function got_mod_rewrite() {
global $is_apache;
// take 3 educated guesses as to whether or not mod_rewrite is available
if ( !$is_apache )
return false;
if ( function_exists( 'apache_get_modules' ) ) {
if ( !in_array( 'mod_rewrite', apache_get_modules() ) )
return false;
}
return true;
}
// Returns an array of strings from a file (.htaccess ) from between BEGIN
// and END markers.
function extract_from_markers( $filename, $marker ) {
$result = array ();
if (!file_exists( $filename ) ) {
return $result;
}
if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
{
$state = false;
foreach ( $markerdata as $markerline ) {
if (strpos($markerline, '# END ' . $marker) !== false)
$state = false;
if ( $state )
$result[] = $markerline;
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
$state = true;
}
}
return $result;
}
// Inserts an array of strings into a file (.htaccess ), placing it between
// BEGIN and END markers. Replaces existing marked info. Retains surrounding
// data. Creates file if none exists.
// Returns true on write success, false on failure.
function insert_with_markers( $filename, $marker, $insertion ) {
if (!file_exists( $filename ) || is_writeable( $filename ) ) {
if (!file_exists( $filename ) ) {
$markerdata = '';
} else {
$markerdata = explode( "\n", implode( '', file( $filename ) ) );
}
$f = fopen( $filename, 'w' );
$foundit = false;
if ( $markerdata ) {
$state = true;
foreach ( $markerdata as $n => $markerline ) {
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
$state = false;
if ( $state ) {
if ( $n + 1 < count( $markerdata ) )
fwrite( $f, "{$markerline}\n" );
else
fwrite( $f, "{$markerline}" );
}
if (strpos($markerline, '# END ' . $marker) !== false) {
fwrite( $f, "# BEGIN {$marker}\n" );
if ( is_array( $insertion ))
foreach ( $insertion as $insertline )
fwrite( $f, "{$insertline}\n" );
fwrite( $f, "# END {$marker}\n" );
$state = true;
$foundit = true;
}
}
}
if (!$foundit) {
fwrite( $f, "# BEGIN {$marker}\n" );
foreach ( $insertion as $insertline )
fwrite( $f, "{$insertline}\n" );
fwrite( $f, "# END {$marker}\n" );
}
fclose( $f );
return true;
} else {
return false;
}
}
/**
* Updates the htaccess file with the current rules if it is writable.
*
* Always writes to the file if it exists and is writable to ensure that we blank out old rules.
*/
function save_mod_rewrite_rules() {
global $wp_rewrite;
$home_path = get_home_path();
$htaccess_file = $home_path.'.htaccess';
// If the file doesn't already exists check for write access to the directory and whether of not we have some rules.
// else check for write access to the file.
if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
if ( got_mod_rewrite() ) {
$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
return insert_with_markers( $htaccess_file, 'WordPress', $rules );
}
}
return false;
}
function update_recently_edited( $file ) {
$oldfiles = (array ) get_option( 'recently_edited' );
if ( $oldfiles ) {
$oldfiles = array_reverse( $oldfiles );
$oldfiles[] = $file;
$oldfiles = array_reverse( $oldfiles );
$oldfiles = array_unique( $oldfiles );
if ( 5 < count( $oldfiles ))
array_pop( $oldfiles );
} else {
$oldfiles[] = $file;
}
update_option( 'recently_edited', $oldfiles );
}
// If siteurl or home changed, reset cookies and flush rewrite rules.
function update_home_siteurl( $old_value, $value ) {
global $wp_rewrite, $user_login, $user_pass_md5;
if ( defined( "WP_INSTALLING" ) )
return;
// If home changed, write rewrite rules to new location.
$wp_rewrite->flush_rules();
// Clear cookies for old paths.
wp_clearcookie();
// Set cookies for new paths.
wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' ));
}
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
function url_shorten( $url ) {
$short_url = str_replace( 'http://', '', stripslashes( $url ));
$short_url = str_replace( 'www.', '', $short_url );
if ('/' == substr( $short_url, -1 ))
$short_url = substr( $short_url, 0, -1 );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
return $short_url;
}
function wp_reset_vars( $vars ) {
for ( $i=0; $i<count( $vars ); $i += 1 ) {
$var = $vars[$i];
global $$var;
if (!isset( $$var ) ) {
if ( empty( $_POST["$var"] ) ) {
if ( empty( $_GET["$var"] ) )
$$var = '';
else
$$var = $_GET["$var"];
} else {
$$var = $_POST["$var"];
}
}
}
}
?>

View File

@@ -1,382 +0,0 @@
<?php
function get_plugin_data( $plugin_file ) {
$plugin_data = implode( '', file( $plugin_file ));
preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
$version = trim( $version[1] );
else
$version = '';
$description = wptexturize( trim( $description[1] ));
$name = $plugin_name[1];
$name = trim( $name );
$plugin = $name;
if ('' != trim($plugin_uri[1]) && '' != $name ) {
$plugin = '<a href="' . trim( $plugin_uri[1] ) . '" title="'.__( 'Visit plugin homepage' ).'">'.$plugin.'</a>';
}
if ('' == $author_uri[1] ) {
$author = trim( $author_name[1] );
} else {
$author = '<a href="' . trim( $author_uri[1] ) . '" title="'.__( 'Visit author homepage' ).'">' . trim( $author_name[1] ) . '</a>';
}
return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version);
}
function get_plugins() {
global $wp_plugins;
if ( isset( $wp_plugins ) ) {
return $wp_plugins;
}
$wp_plugins = array ();
$plugin_root = ABSPATH . PLUGINDIR;
// Files in wp-content/plugins directory
$plugins_dir = @ opendir( $plugin_root);
if ( $plugins_dir ) {
while (($file = readdir( $plugins_dir ) ) !== false ) {
if ( substr($file, 0, 1) == '.' )
continue;
if ( is_dir( $plugin_root.'/'.$file ) ) {
$plugins_subdir = @ opendir( $plugin_root.'/'.$file );
if ( $plugins_subdir ) {
while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
if ( substr($subfile, 0, 1) == '.' )
continue;
if ( substr($subfile, -4) == '.php' )
$plugin_files[] = "$file/$subfile";
}
}
} else {
if ( substr($file, -4) == '.php' )
$plugin_files[] = $file;
}
}
}
@closedir( $plugins_dir );
@closedir( $plugins_subdir );
if ( !$plugins_dir || !$plugin_files )
return $wp_plugins;
foreach ( $plugin_files as $plugin_file ) {
if ( !is_readable( "$plugin_root/$plugin_file" ) )
continue;
$plugin_data = get_plugin_data( "$plugin_root/$plugin_file" );
if ( empty ( $plugin_data['Name'] ) )
continue;
$wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
}
uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
return $wp_plugins;
}
//
// Menu
//
function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
global $menu, $admin_page_hooks;
$file = plugin_basename( $file );
$menu[] = array ( $menu_title, $access_level, $file, $page_title );
$admin_page_hooks[$file] = sanitize_title( $menu_title );
$hookname = get_plugin_page_hookname( $file, '' );
if (!empty ( $function ) && !empty ( $hookname ))
add_action( $hookname, $function );
return $hookname;
}
function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
global $submenu;
global $menu;
global $_wp_real_parent_file;
global $_wp_submenu_nopriv;
global $_wp_menu_nopriv;
$file = plugin_basename( $file );
$parent = plugin_basename( $parent);
if ( isset( $_wp_real_parent_file[$parent] ) )
$parent = $_wp_real_parent_file[$parent];
if ( !current_user_can( $access_level ) ) {
$_wp_submenu_nopriv[$parent][$file] = true;
return false;
}
// If the parent doesn't already have a submenu, add a link to the parent
// as the first item in the submenu. If the submenu file is the same as the
// parent file someone is trying to link back to the parent manually. In
// this case, don't automatically add a link back to avoid duplication.
if (!isset( $submenu[$parent] ) && $file != $parent ) {
foreach ( $menu as $parent_menu ) {
if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
$submenu[$parent][] = $parent_menu;
}
}
$submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title );
$hookname = get_plugin_page_hookname( $file, $parent);
if (!empty ( $function ) && !empty ( $hookname ))
add_action( $hookname, $function );
return $hookname;
}
function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
}
function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function );
}
function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
}
function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
if ( current_user_can('edit_users') )
$parent = 'users.php';
else
$parent = 'profile.php';
return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
}
//
// Pluggable Menu Support -- Private
//
function get_admin_page_parent() {
global $parent_file;
global $menu;
global $submenu;
global $pagenow;
global $plugin_page;
global $_wp_real_parent_file;
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
if ( !empty ( $parent_file ) ) {
if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
foreach ( $menu as $parent_menu ) {
if ( $parent_menu[2] == $plugin_page ) {
$parent_file = $plugin_page;
if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
}
if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) {
$parent_file = $plugin_page;
if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
}
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
$parent_file = $pagenow;
if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
foreach (array_keys( $submenu ) as $parent) {
foreach ( $submenu[$parent] as $submenu_array ) {
if ( isset( $_wp_real_parent_file[$parent] ) )
$parent = $_wp_real_parent_file[$parent];
if ( $submenu_array[2] == $pagenow ) {
$parent_file = $parent;
return $parent;
} else
if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) {
$parent_file = $parent;
return $parent;
}
}
}
$parent_file = '';
return '';
}
function get_admin_page_title() {
global $title;
global $menu;
global $submenu;
global $pagenow;
global $plugin_page;
if ( isset( $title ) && !empty ( $title ) ) {
return $title;
}
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
$parent = $parent1 = get_admin_page_parent();
if ( empty ( $parent) ) {
foreach ( $menu as $menu_array ) {
if ( isset( $menu_array[3] ) ) {
if ( $menu_array[2] == $pagenow ) {
$title = $menu_array[3];
return $menu_array[3];
} else
if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {
$title = $menu_array[3];
return $menu_array[3];
}
} else {
$title = $menu_array[0];
return $title;
}
}
} else {
foreach (array_keys( $submenu ) as $parent) {
foreach ( $submenu[$parent] as $submenu_array ) {
if ( isset( $plugin_page ) &&
($plugin_page == $submenu_array[2] ) &&
(($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
) {
$title = $submenu_array[3];
return $submenu_array[3];
}
if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page
continue;
if ( isset( $submenu_array[3] ) ) {
$title = $submenu_array[3];
return $submenu_array[3];
} else {
$title = $submenu_array[0];
return $title;
}
}
}
}
return $title;
}
function get_plugin_page_hook( $plugin_page, $parent_page ) {
global $wp_filter;
$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
if ( isset( $wp_filter[$hook] ))
return $hook;
else
return null;
}
function get_plugin_page_hookname( $plugin_page, $parent_page ) {
global $admin_page_hooks;
$parent = get_admin_page_parent();
if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
if ( isset( $admin_page_hooks[$plugin_page] ))
$page_type = 'toplevel';
else
if ( isset( $admin_page_hooks[$parent] ))
$page_type = $admin_page_hooks[$parent];
} else
if ( isset( $admin_page_hooks[$parent_page] ) ) {
$page_type = $admin_page_hooks[$parent_page];
} else {
$page_type = 'admin';
}
$plugin_name = preg_replace( '!\.php!', '', $plugin_page );
return $page_type.'_page_'.$plugin_name;
}
function user_can_access_admin_page() {
global $pagenow;
global $menu;
global $submenu;
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
global $plugin_page;
$parent = get_admin_page_parent();
if ( isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false;
if ( empty( $parent) ) {
if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false;
if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
return false;
foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false;
}
return true;
}
if ( isset( $submenu[$parent] ) ) {
foreach ( $submenu[$parent] as $submenu_array ) {
if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
} else if ( $submenu_array[2] == $pagenow ) {
if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
}
}
}
foreach ( $menu as $menu_array ) {
if ( $menu_array[2] == $parent) {
if ( current_user_can( $menu_array[1] ))
return true;
else
return false;
}
}
return true;
}
?>

View File

@@ -1,471 +0,0 @@
<?php
// Update an existing post with values provided in $_POST.
function edit_post() {
global $user_ID;
$post_ID = (int) $_POST['post_ID'];
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_ID ) )
wp_die( __('You are not allowed to edit this page.' ));
} else {
if ( !current_user_can( 'edit_post', $post_ID ) )
wp_die( __('You are not allowed to edit this post.' ));
}
// Autosave shouldn't save too soon after a real save
if ( 'autosave' == $_POST['action'] ) {
$post =& get_post( $post_ID );
$now = time();
$then = strtotime($post->post_date_gmt . ' +0000');
// Keep autosave_interval in sync with autosave-js.php.
$delta = apply_filters( 'autosave_interval', 120 ) / 2;
if ( ($now - $then) < $delta )
return $post_ID;
}
// Rename.
$_POST['ID'] = (int) $_POST['post_ID'];
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['to_ping'] = $_POST['trackback_url'];
if (!empty ( $_POST['post_author_override'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
} else
if (!empty ( $_POST['post_author'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_others_pages' ) )
wp_die( __('You are not allowed to edit pages as this user.' ));
} else {
if ( !current_user_can( 'edit_others_posts' ) )
wp_die( __('You are not allowed to edit posts as this user.' ));
}
}
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
if ('' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
if ('' != $_POST['publish'] )
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' ))
$_POST['post_status'] = 'pending';
} else {
if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' ))
$_POST['post_status'] = 'pending';
}
if (!isset( $_POST['comment_status'] ))
$_POST['comment_status'] = 'closed';
if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
$_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
}
// Meta Stuff
if ( $_POST['meta'] ) {
foreach ( $_POST['meta'] as $key => $value )
update_meta( $key, $value['key'], $value['value'] );
}
if ( $_POST['deletemeta'] ) {
foreach ( $_POST['deletemeta'] as $key => $value )
delete_meta( $key );
}
add_meta( $post_ID );
wp_update_post( $_POST );
// Reunite any orphaned attachments with their parent
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
$draft_ids = array();
if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
_relocate_children( $draft_temp_id, $post_ID );
// Now that we have an ID we can fix any attachment anchor hrefs
_fix_attachment_links( $post_ID );
return $post_ID;
}
// Default post information to use when populating the "Write Post" form.
function get_default_post_to_edit() {
if ( !empty( $_REQUEST['post_title'] ) )
$post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
else if ( !empty( $_REQUEST['popuptitle'] ) ) {
$post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
$post_title = funky_javascript_fix( $post_title );
} else {
$post_title = '';
}
if ( !empty( $_REQUEST['content'] ) )
$post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
else if ( !empty( $post_title ) ) {
$text = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
$text = funky_javascript_fix( $text);
$popupurl = clean_url($_REQUEST['popupurl']);
$post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
}
if ( !empty( $_REQUEST['excerpt'] ) )
$post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
else
$post_excerpt = '';
$post->post_status = 'draft';
$post->comment_status = get_option( 'default_comment_status' );
$post->ping_status = get_option( 'default_ping_status' );
$post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' );
$post->post_content = apply_filters( 'default_content', $post_content);
$post->post_title = apply_filters( 'default_title', $post_title );
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
$post->page_template = 'default';
$post->post_parent = 0;
$post->menu_order = 0;
return $post;
}
// Get an existing post and format it for editing.
function get_post_to_edit( $id ) {
$post = get_post( $id, OBJECT, 'edit' );
if ( $post->post_type == 'page' )
$post->page_template = get_post_meta( $id, '_wp_page_template', true );
return $post;
}
function post_exists($title, $content = '', $post_date = '') {
global $wpdb;
if (!empty ($post_date))
$post_date = "AND post_date = '$post_date'";
if (!empty ($title))
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
else
if (!empty ($content))
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
return 0;
}
// Creates a new post from the "Write Post" form using $_POST information.
function wp_write_post() {
global $user_ID;
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_pages' ) )
return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
} else {
if ( !current_user_can( 'edit_posts' ) )
return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
}
// Check for autosave collisions
$temp_id = false;
if ( isset($_POST['temp_ID']) ) {
$temp_id = (int) $_POST['temp_ID'];
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
$draft_ids = array();
foreach ( $draft_ids as $temp => $real )
if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )
unset($draft_ids[$temp]);
if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write
$_POST['post_ID'] = $draft_ids[$temp_id];
unset($_POST['temp_ID']);
update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
return edit_post();
}
}
// Rename.
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['to_ping'] = $_POST['trackback_url'];
if (!empty ( $_POST['post_author_override'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
} else {
if (!empty ( $_POST['post_author'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
}
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can( 'edit_others_pages' ) )
return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
} else {
if ( !current_user_can( 'edit_others_posts' ) )
return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
}
}
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
if ('' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
if ('' != $_POST['publish'] )
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
$_POST['post_status'] = 'pending';
} else {
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
$_POST['post_status'] = 'pending';
}
if (!isset( $_POST['comment_status'] ))
$_POST['comment_status'] = 'closed';
if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
}
// Create the post.
$post_ID = wp_insert_post( $_POST );
if ( is_wp_error( $post_ID ) )
return $post_ID;
if ( empty($post_ID) )
return 0;
add_meta( $post_ID );
// Reunite any orphaned attachments with their parent
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
$draft_ids = array();
if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
_relocate_children( $draft_temp_id, $post_ID );
if ( $temp_id && $temp_id != $draft_temp_id )
_relocate_children( $temp_id, $post_ID );
// Update autosave collision detection
if ( $temp_id ) {
$draft_ids[$temp_id] = $post_ID;
update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
}
// Now that we have an ID we can fix any attachment anchor hrefs
_fix_attachment_links( $post_ID );
return $post_ID;
}
function write_post() {
$result = wp_write_post();
if( is_wp_error( $result ) )
wp_die( $result->get_error_message() );
else
return $result;
}
//
// Post Meta
//
function add_meta( $post_ID ) {
global $wpdb;
$post_ID = (int) $post_ID;
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
$metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
$metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
$metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
$metavalue = $wpdb->escape( $metavalue );
if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
// We have a key/value pair. If both the select and the
// input for the key have data, the input takes precedence:
if ('#NONE#' != $metakeyselect)
$metakey = $metakeyselect;
if ( $metakeyinput)
$metakey = $metakeyinput; // default
if ( in_array($metakey, $protected) )
return false;
$result = $wpdb->query( "
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value )
VALUES ('$post_ID','$metakey','$metavalue' )
" );
return $wpdb->insert_id;
}
return false;
} // add_meta
function delete_meta( $mid ) {
global $wpdb;
$mid = (int) $mid;
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
}
// Get a list of previously defined keys
function get_meta_keys() {
global $wpdb;
$keys = $wpdb->get_col( "
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_key" );
return $keys;
}
function get_post_meta_by_id( $mid ) {
global $wpdb;
$mid = (int) $mid;
$meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
if ( is_serialized_string( $meta->meta_value ) )
$meta->meta_value = maybe_unserialize( $meta->meta_value );
return $meta;
}
// Some postmeta stuff
function has_meta( $postid ) {
global $wpdb;
return $wpdb->get_results( "
SELECT meta_key, meta_value, meta_id, post_id
FROM $wpdb->postmeta
WHERE post_id = '$postid'
ORDER BY meta_key,meta_id", ARRAY_A );
}
function update_meta( $mid, $mkey, $mvalue ) {
global $wpdb;
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
if ( in_array($mkey, $protected) )
return false;
$mvalue = maybe_serialize( stripslashes( $mvalue ));
$mvalue = $wpdb->escape( $mvalue );
$mid = (int) $mid;
return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
}
//
// Private
//
// Replace hrefs of attachment anchors with up-to-date permalinks.
function _fix_attachment_links( $post_ID ) {
global $wp_rewrite;
$post = & get_post( $post_ID, ARRAY_A );
$search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
// See if we have any rel="attachment" links
if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
return;
$i = 0;
$search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
foreach ( $anchor_matches[0] as $anchor ) {
if ( 0 == preg_match( $search, $anchor, $id_matches ) )
continue;
$id = (int) $id_matches[3];
// While we have the attachment ID, let's adopt any orphans.
$attachment = & get_post( $id, ARRAY_A );
if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
$attachment['post_parent'] = $post_ID;
// Escape data pulled from DB.
$attachment = add_magic_quotes( $attachment);
wp_update_post( $attachment);
}
$post_search[$i] = $anchor;
$post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
++$i;
}
$post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );
// Escape data pulled from DB.
$post = add_magic_quotes( $post);
return wp_update_post( $post);
}
// Move child posts to a new parent
function _relocate_children( $old_ID, $new_ID ) {
global $wpdb;
$old_ID = (int) $old_ID;
$new_ID = (int) $new_ID;
return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
}
?>

View File

@@ -1,148 +0,0 @@
<?php
//
// Category
//
function category_exists($cat_name) {
$id = is_term($cat_name, 'category');
if ( is_array($id) )
$id = $id['term_id'];
return $id;
}
function get_category_to_edit( $id ) {
$category = get_category( $id, OBJECT, 'edit' );
return $category;
}
function wp_create_category($cat_name) {
if ( $id = category_exists($cat_name) )
return $id;
return wp_insert_category( array('cat_name' => $cat_name) );
}
function wp_create_categories($categories, $post_id = '') {
$cat_ids = array ();
foreach ($categories as $category) {
if ($id = category_exists($category))
$cat_ids[] = $id;
else
if ($id = wp_create_category($category))
$cat_ids[] = $id;
}
if ($post_id)
wp_set_post_categories($post_id, $cat_ids);
return $cat_ids;
}
function wp_delete_category($cat_ID) {
global $wpdb;
$cat_ID = (int) $cat_ID;
$default = get_option('default_category');
// Don't delete the default cat
if ( $cat_ID == $default )
return 0;
return wp_delete_term($cat_ID, 'category', "default=$default");
}
function wp_insert_category($catarr) {
global $wpdb;
extract($catarr, EXTR_SKIP);
if ( trim( $cat_name ) == '' )
return 0;
$cat_ID = (int) $cat_ID;
// Are we updating or creating?
if ( !empty ($cat_ID) )
$update = true;
else
$update = false;
$name = $cat_name;
$description = $category_description;
$slug = $category_nicename;
$parent = $category_parent;
$parent = (int) $parent;
if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
$parent = 0;
$args = compact('name', 'slug', 'parent', 'description');
if ( $update )
$cat_ID = wp_update_term($cat_ID, 'category', $args);
else
$cat_ID = wp_insert_term($cat_name, 'category', $args);
if ( is_wp_error($cat_ID) )
return 0;
return $cat_ID['term_id'];
}
function wp_update_category($catarr) {
global $wpdb;
$cat_ID = (int) $catarr['cat_ID'];
if ( $cat_ID == $catarr['category_parent'] )
return false;
// First, get all of the original fields
$category = get_category($cat_ID, ARRAY_A);
// Escape data pulled from DB.
$category = add_magic_quotes($category);
// Merge old and new fields with new fields overwriting old ones.
$catarr = array_merge($category, $catarr);
return wp_insert_category($catarr);
}
//
// Tags
//
function get_tags_to_edit( $post_id ) {
global $wpdb;
$post_id = (int) $post_id;
if ( !$post_id )
return false;
$tags = wp_get_post_tags($post_id);
if ( !$tags )
return false;
foreach ( $tags as $tag )
$tag_names[] = $tag->name;
$tags_to_edit = join( ', ', $tag_names );
$tags_to_edit = attribute_escape( $tags_to_edit );
$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
return $tags_to_edit;
}
function tag_exists($tag_name) {
return is_term($tag_name, 'post_tag');
}
function wp_create_tag($tag_name) {
if ( $id = tag_exists($tag_name) )
return $id;
return wp_insert_term($tag_name, 'post_tag');
}
?>

View File

@@ -1,617 +0,0 @@
<?php
//
// Big Mess
//
// Dandy new recursive multiple category stuff.
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
if ( !$categories )
$categories = get_categories( 'hide_empty=0' );
$children = _get_term_hierarchy('category');
if ( $categories ) {
ob_start();
foreach ( $categories as $category ) {
if ( $category->parent == $parent) {
echo "\t" . _cat_row( $category, $level );
if ( isset($children[$category->term_id]) )
cat_rows( $category->term_id, $level +1, $categories );
}
}
$output = ob_get_contents();
ob_end_clean();
$output = apply_filters('cat_rows', $output);
echo $output;
} else {
return false;
}
}
function _cat_row( $category, $level, $name_override = false ) {
global $class;
$pad = str_repeat( '&#8212; ', $level );
if ( current_user_can( 'manage_categories' ) ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
$default_cat_id = (int) get_option( 'default_category' );
$default_link_cat_id = (int) get_option( 'default_link_category' );
if ( $category->term_id != $default_cat_id )
$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
else
$edit .= "<td style='text-align:center'>".__( "Default" );
} else
$edit = '';
$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
$category->count = number_format_i18n( $category->count );
$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='cat-$category->term_id'$class>
<th scope='row' style='text-align: center'>$category->term_id</th>
<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
<td>$category->description</td>
<td align='center'>$posts_count</td>
<td>$edit</td>\n\t</tr>\n";
return apply_filters('cat_row', $output);
}
function checked( $checked, $current) {
if ( $checked == $current)
echo ' checked="checked"';
}
// TODO: Remove?
function documentation_link( $for ) {
return;
}
function selected( $selected, $current) {
if ( $selected == $current)
echo ' selected="selected"';
}
//
// Nasty Category Stuff
//
function sort_cats( $cat1, $cat2 ) {
if ( $cat1['checked'] || $cat2['checked'] )
return ( $cat1['checked'] && !$cat2['checked'] ) ? -1 : 1;
else
return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
}
function get_nested_categories( $default = 0, $parent = 0 ) {
global $post_ID, $mode, $wpdb, $checked_categories;
if ( empty($checked_categories) ) {
if ( $post_ID ) {
$checked_categories = wp_get_post_categories($post_ID);
if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
} else {
$checked_categories[] = $default;
}
}
$cats = get_categories("parent=$parent&hide_empty=0&fields=ids");
$result = array ();
if ( is_array( $cats ) ) {
foreach ( $cats as $cat) {
$result[$cat]['children'] = get_nested_categories( $default, $cat);
$result[$cat]['cat_ID'] = $cat;
$result[$cat]['checked'] = in_array( $cat, $checked_categories );
$result[$cat]['cat_name'] = get_the_category_by_ID( $cat);
}
}
$result = apply_filters('get_nested_categories', $result);
usort( $result, 'sort_cats' );
return $result;
}
function write_nested_categories( $categories ) {
foreach ( $categories as $category ) {
echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), "</label></li>";
if ( $category['children'] ) {
echo "<ul>\n";
write_nested_categories( $category['children'] );
echo "</ul>\n";
}
}
}
function dropdown_categories( $default = 0 ) {
write_nested_categories( get_nested_categories( $default) );
}
function dropdown_link_categories( $default = 0 ) {
global $link_id;
if ( $link_id ) {
$checked_categories = wp_get_link_cats($link_id);
if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
} else {
$checked_categories[] = $default;
}
$categories = get_terms('link_category', 'orderby=count&hide_empty=0');
if ( empty($categories) )
return;
foreach ( $categories as $category ) {
$cat_id = $category->term_id;
$name = wp_specialchars( apply_filters('the_category', $category->name));
$checked = in_array( $cat_id, $checked_categories );
echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
}
}
function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
global $wpdb, $class, $post;
if (!$pages )
$pages = get_pages( 'sort_column=menu_order' );
if (! $pages )
return false;
foreach ( $pages as $post) {
setup_postdata( $post);
if ( $hierarchy && ($post->post_parent != $parent) )
continue;
$post->post_title = wp_specialchars( $post->post_title );
$pad = str_repeat( '&#8212; ', $level );
$id = (int) $post->ID;
$class = ('alternate' == $class ) ? '' : 'alternate';
?>
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<th scope="row" style="text-align: center"><?php echo $post->ID; ?></th>
<td>
<?php echo $pad; ?><?php the_title() ?>
</td>
<td><?php the_author() ?></td>
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
<td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
<td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
</tr>
<?php
if ( $hierarchy ) page_rows( $id, $level + 1, $pages );
}
}
function user_row( $user_object, $style = '' ) {
if ( !(is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
$user_object = new WP_User( (int) $user_object );
$email = $user_object->user_email;
$url = $user_object->user_url;
$short_url = str_replace( 'http://', '', $url );
$short_url = str_replace( 'www.', '', $short_url );
if ('/' == substr( $short_url, -1 ))
$short_url = substr( $short_url, 0, -1 );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
$numposts = get_usernumposts( $user_object->ID );
$r = "<tr id='user-$user_object->ID'$style>
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
<td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
<td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
<td><a href='$url' title='website: $url'>$short_url</a></td>";
$r .= "\n\t\t<td align='center'>";
if ( $numposts > 0 ) {
$r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
$r .= sprintf(__ngettext( 'View %s post', 'View %s posts', $numposts ), $numposts);
$r .= '</a>';
}
$r .= "</td>\n\t\t<td>";
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
$edit_link = add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" );
$r .= "<a href='$edit_link' class='edit'>".__( 'Edit' )."</a>";
}
$r .= "</td>\n\t</tr>";
return $r;
}
function _wp_get_comment_list( $s = false, $start, $num ) {
global $wpdb;
$start = abs( (int) $start );
$num = (int) $num;
if ( $s ) {
$s = $wpdb->escape($s);
$comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
(comment_author LIKE '%$s%' OR
comment_author_email LIKE '%$s%' OR
comment_author_url LIKE ('%$s%') OR
comment_author_IP LIKE ('%$s%') OR
comment_content LIKE ('%$s%') ) AND
comment_approved != 'spam'
ORDER BY comment_date DESC LIMIT $start, $num");
} else {
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" );
}
update_comment_cache($comments);
$total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
return array($comments, $total);
}
function _wp_comment_list_item( $id, $alt = 0 ) {
global $authordata, $comment, $wpdb;
$id = (int) $id;
$comment =& get_comment( $id );
$class = '';
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
$comment_status = wp_get_comment_status($comment->comment_ID);
if ( 'unapproved' == $comment_status )
$class .= ' unapproved';
if ( $alt % 2 )
$class .= ' alternate';
echo "<li id='comment-$comment->comment_ID' class='$class'>";
?>
<p><strong><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?>
<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [
<?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
}
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
}
$post = get_post($comment->comment_post_ID, OBJECT, 'display');
$post_title = wp_specialchars( $post->post_title, 'double' );
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
</li>
<?php
}
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
global $wpdb;
if (!$categories )
$categories = get_categories( 'hide_empty=0' );
if ( $categories ) {
foreach ( $categories as $category ) {
if ( $currentcat != $category->term_id && $parent == $category->parent) {
$pad = str_repeat( '&#8211; ', $level );
$category->name = wp_specialchars( $category->name );
echo "\n\t<option value='$category->term_id'";
if ( $currentparent == $category->term_id )
echo " selected='selected'";
echo ">$pad$category->name</option>";
wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
}
}
} else {
return false;
}
}
function list_meta( $meta ) {
global $post_ID;
// Exit if no meta
if (!$meta ) {
echo '<tbody id="the-list"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS
return;
}
$count = 0;
?>
<thead>
<tr>
<th><?php _e( 'Key' ) ?></th>
<th><?php _e( 'Value' ) ?></th>
<th colspan='2'><?php _e( 'Action' ) ?></th>
</tr>
</thead>
<?php
$r ="\n\t<tbody id='the-list'>";
foreach ( $meta as $entry ) {
++ $count;
if ( $count % 2 )
$style = 'alternate';
else
$style = '';
if ('_' == $entry['meta_key'] { 0 } )
$style .= ' hidden';
if ( is_serialized( $entry['meta_value'] ) ) {
if ( is_serialized_string( $entry['meta_value'] ) ) {
// this is a serialized string, so we should display it
$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
} else {
// this is a serialized array/object so we should NOT display it
--$count;
continue;
}
}
$key_js = js_escape( $entry['meta_key'] );
$entry['meta_key'] = attribute_escape($entry['meta_key']);
$entry['meta_value'] = attribute_escape($entry['meta_value']);
$entry['meta_id'] = (int) $entry['meta_id'];
$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
$r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
$r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
$r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />";
$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
$r .= js_escape(sprintf( __("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop." ), $key_js ) );
$r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>";
$r .= "\n\t</tr>";
}
echo $r;
echo "\n\t</tbody>";
}
function meta_form() {
global $wpdb;
$limit = (int) apply_filters( 'postmeta_form_limit', 30 );
$keys = $wpdb->get_col( "
SELECT meta_key
FROM $wpdb->postmeta
WHERE meta_key NOT LIKE '\_%'
GROUP BY meta_key
ORDER BY meta_id DESC
LIMIT $limit" );
if ( $keys )
natcasesort($keys);
?>
<h3><?php _e( 'Add a new custom field:' ) ?></h3>
<table id="newmeta" cellspacing="3" cellpadding="3">
<tr>
<th colspan="2"><?php _e( 'Key' ) ?></th>
<th><?php _e( 'Value' ) ?></th>
</tr>
<tr valign="top">
<td align="right" width="18%">
<?php if ( $keys ) : ?>
<select id="metakeyselect" name="metakeyselect" tabindex="7">
<option value="#NONE#"><?php _e( '- Select -' ); ?></option>
<?php
foreach ( $keys as $key ) {
$key = attribute_escape( $key );
echo "\n\t<option value='$key'>$key</option>";
}
?>
</select> <?php _e( 'or' ); ?>
<?php endif; ?>
</td>
<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
<td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
</tr>
</table>
<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e( 'Add Custom Field &raquo;' ) ?>" /></p>
<?php
}
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
global $wp_locale, $post, $comment;
if ( $for_post )
$edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
$tab_index_attribute = '';
if ( (int) $tab_index > 0 )
$tab_index_attribute = " tabindex=\"$tab_index\"";
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';
$time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
$jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
$mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
$aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
$hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
$mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
$ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
echo "<select name=\"mm\" onchange=\"edit_date.checked=true\"$tab_index_attribute>\n";
for ( $i = 1; $i < 13; $i = $i +1 ) {
echo "\t\t\t<option value=\"$i\"";
if ( $i == $mm )
echo ' selected="selected"';
echo '>' . $wp_locale->get_month( $i ) . "</option>\n";
}
?>
</select>
<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> />
<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> /> @
<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> /> :
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> />
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
<?php
if ( $edit ) {
printf( _c( 'Existing timestamp: %1$s %2$s, %3$s @ %4$s:%5$s|1: month, 2: month string, 3: full year, 4: hours, 5: minutes' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
}
?>
</fieldset>
<?php
}
function page_template_dropdown( $default = '' ) {
$templates = get_page_templates();
ksort( $templates );
foreach (array_keys( $templates ) as $template )
: if ( $default == $templates[$template] )
$selected = " selected='selected'";
else
$selected = '';
echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
endforeach;
}
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
global $wpdb, $post_ID;
$items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
if ( $items ) {
foreach ( $items as $item ) {
// A page cannot be its own parent.
if (!empty ( $post_ID ) ) {
if ( $item->ID == $post_ID ) {
continue;
}
}
$pad = str_repeat( '&nbsp;', $level * 3 );
if ( $item->ID == $default)
$current = ' selected="selected"';
else
$current = '';
echo "\n\t<option value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
parent_dropdown( $default, $item->ID, $level +1 );
}
} else {
return false;
}
}
function browse_happy() {
$getit = __( 'WordPress recommends a better browser' );
echo '
<p id="bh" style="text-align: center;"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></p>
';
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
add_action( 'admin_footer', 'browse_happy' );
function the_attachment_links( $id = false ) {
$id = (int) $id;
$post = & get_post( $id );
if ( $post->post_type != 'attachment' )
return false;
$icon = get_attachment_icon( $post->ID );
$attachment_data = wp_get_attachment_metadata( $id );
$thumb = isset( $attachment_data['thumb'] );
?>
<form id="the-attachment-links">
<table>
<col />
<col class="widefat" />
<tr>
<th scope="row"><?php _e( 'URL' ) ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><?php echo wp_get_attachment_url(); ?></textarea></td>
</tr>
<?php if ( $icon ) : ?>
<tr>
<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to file' ) : _e( 'Image linked to file' ); ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $icon ?></a></textarea></td>
</tr>
<tr>
<th scope="row"><?php $thumb ? _e( 'Thumbnail linked to page' ) : _e( 'Image linked to page' ); ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID; ?>"><?php echo $icon ?></a></textarea></td>
</tr>
<?php else : ?>
<tr>
<th scope="row"><?php _e( 'Link to file' ) ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
</tr>
<tr>
<th scope="row"><?php _e( 'Link to page' ) ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link( $post->ID ) ?>" rel="attachment wp-att-<?php echo $post->ID ?>"><?php the_title(); ?></a></textarea></td>
</tr>
<?php endif; ?>
</table>
</form>
<?php
}
function wp_dropdown_roles( $default = false ) {
global $wp_roles;
$r = '';
foreach( $wp_roles->role_names as $role => $name )
if ( $default == $role ) // Make default first in list
$p = "\n\t<option selected='selected' value='$role'>$name</option>";
else
$r .= "\n\t<option value='$role'>$name</option>";
echo $p . $r;
}
function wp_convert_hr_to_bytes( $size ) {
$size = strtolower($size);
$bytes = (int) $size;
if ( strpos($size, 'k') !== false )
$bytes = intval($size) * 1024;
elseif ( strpos($size, 'm') !== false )
$bytes = intval($size) * 1024 * 1024;
elseif ( strpos($size, 'g') !== false )
$bytes = intval($size) * 1024 * 1024 * 1024;
return $bytes;
}
function wp_convert_bytes_to_hr( $bytes ) {
$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
$log = log( $bytes, 1024 );
$power = (int) $log;
$size = pow(1024, $log - $power);
return $size . $units[$power];
}
function wp_import_upload_form( $action ) {
$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
$bytes = apply_filters( 'import_upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
$size = wp_convert_bytes_to_hr( $bytes );
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
<p>
<?php wp_nonce_field('import-upload'); ?>
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
</p>
<p class="submit">
<input type="submit" value="<?php _e( 'Upload file and import &raquo;' ); ?>" />
</p>
</form>
<?php
}
function wp_remember_old_slug() {
global $post;
$name = attribute_escape($post->post_name); // just in case
if ( strlen($name) )
echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
}
?>

View File

@@ -1,52 +0,0 @@
<?php
function current_theme_info() {
$themes = get_themes();
$current_theme = get_current_theme();
$ct->name = $current_theme;
$ct->title = $themes[$current_theme]['Title'];
$ct->version = $themes[$current_theme]['Version'];
$ct->parent_theme = $themes[$current_theme]['Parent Theme'];
$ct->template_dir = $themes[$current_theme]['Template Dir'];
$ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
$ct->template = $themes[$current_theme]['Template'];
$ct->stylesheet = $themes[$current_theme]['Stylesheet'];
$ct->screenshot = $themes[$current_theme]['Screenshot'];
$ct->description = $themes[$current_theme]['Description'];
$ct->author = $themes[$current_theme]['Author'];
return $ct;
}
function get_broken_themes() {
global $wp_broken_themes;
get_themes();
return $wp_broken_themes;
}
function get_page_templates() {
$themes = get_themes();
$theme = get_current_theme();
$templates = $themes[$theme]['Template Files'];
$page_templates = array ();
if ( is_array( $templates ) ) {
foreach ( $templates as $template ) {
$template_data = implode( '', file( ABSPATH.$template ));
preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
preg_match( '|Description:(.*)$|mi', $template_data, $description );
$name = $name[1];
$description = $description[1];
if ( !empty( $name ) ) {
$page_templates[trim( $name )] = basename( $template );
}
}
}
return $page_templates;
}
?>

View File

@@ -1,122 +0,0 @@
<?php
// The admin side of our 1.0 update system
function core_update_footer( $msg ) {
if ( !current_user_can('manage_options') )
return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
$cur = get_option( 'update_core' );
switch ( $cur->response ) {
case 'development' :
return sprintf( '| '.__( 'You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], 'http://wordpress.org/download/svn/' );
break;
case 'upgrade' :
return sprintf( '| <strong>'.__( 'Your WordPress %s is out of date. <a href="%s">Please update</a>.' ).'</strong>', $GLOBALS['wp_version'], $cur->url );
break;
case 'latest' :
default :
return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
break;
}
}
add_filter( 'update_footer', 'core_update_footer' );
function update_nag() {
$cur = get_option( 'update_core' );
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
return false;
if ( current_user_can('manage_options') )
$msg = sprintf( __('A new version of WordPress is available! <a href="%s">Please update now</a>.'), $cur->url );
else
$msg = __('A new version of WordPress is available! Please notify the site administrator.');
echo "<div id='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'update_nag', 3 );
function wp_update_plugins() {
global $wp_version;
if ( !function_exists('fsockopen') )
return false;
$plugins = get_plugins();
$active = get_option( 'active_plugins' );
$current = get_option( 'update_plugins' );
$new_option = '';
$new_option->last_checked = time();
$plugin_changed = false;
foreach ( $plugins as $file => $p ) {
$new_option->checked[ $file ] = $p['Version'];
if ( !isset( $current->checked[ $file ] ) ) {
$plugin_changed = true;
continue;
}
if ( $current->checked[ $file ] != $p['Version'] )
$plugin_changed = true;
}
if (
isset( $current->last_checked ) &&
43200 > ( time() - $current->last_checked ) &&
!$plugin_changed
)
return false;
$to_send->plugins = $plugins;
$to_send->active = $active;
$send = serialize( $to_send );
$request = 'plugins=' . urlencode( $send );
$http_request = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
$http_request .= "Host: api.wordpress.org\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
$http_request .= "Content-Length: " . strlen($request) . "\r\n";
$http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
$http_request .= "\r\n";
$http_request .= $request;
$response = '';
if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
}
$response = unserialize( $response[1] );
if ( $response )
$new_option->response = $response;
update_option( 'update_plugins', $new_option );
}
add_action( 'load-plugins.php', 'wp_update_plugins' );
function wp_plugin_update_row( $file ) {
global $plugin_data;
$current = get_option( 'update_plugins' );
if ( !isset( $current->response[ $file ] ) )
return false;
$r = $current->response[ $file ];
echo "<tr><td colspan='5' class='plugin-update'>";
printf( __('There is a new version of %s available. <a href="%s">Download version %s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version );
echo "</td></tr>";
}
add_action( 'after_plugin_row', 'wp_plugin_update_row' );
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,282 +0,0 @@
<?php
// Creates a new user from the "Users" form using $_POST information.
function add_user() {
if ( func_num_args() ) { // The hackiest hack that ever did hack
global $current_user, $wp_roles;
$user_id = (int) func_get_arg( 0 );
if ( isset( $_POST['role'] ) ) {
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
$user = new WP_User( $user_id );
$user->set_role( $_POST['role'] );
}
}
} else {
add_action( 'user_register', 'add_user' ); // See above
return edit_user();
}
}
function edit_user( $user_id = 0 ) {
global $current_user, $wp_roles, $wpdb;
if ( $user_id != 0 ) {
$update = true;
$user->ID = (int) $user_id;
$userdata = get_userdata( $user_id );
$user->user_login = $wpdb->escape( $userdata->user_login );
} else {
$update = false;
$user = '';
}
if ( isset( $_POST['user_login'] ))
$user->user_login = wp_specialchars( trim( $_POST['user_login'] ));
$pass1 = $pass2 = '';
if ( isset( $_POST['pass1'] ))
$pass1 = $_POST['pass1'];
if ( isset( $_POST['pass2'] ))
$pass2 = $_POST['pass2'];
if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
$user->role = $_POST['role'];
}
if ( isset( $_POST['email'] ))
$user->user_email = wp_specialchars( trim( $_POST['email'] ));
if ( isset( $_POST['url'] ) ) {
$user->user_url = clean_url( trim( $_POST['url'] ));
$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
}
if ( isset( $_POST['first_name'] ))
$user->first_name = wp_specialchars( trim( $_POST['first_name'] ));
if ( isset( $_POST['last_name'] ))
$user->last_name = wp_specialchars( trim( $_POST['last_name'] ));
if ( isset( $_POST['nickname'] ))
$user->nickname = wp_specialchars( trim( $_POST['nickname'] ));
if ( isset( $_POST['display_name'] ))
$user->display_name = wp_specialchars( trim( $_POST['display_name'] ));
if ( isset( $_POST['description'] ))
$user->description = trim( $_POST['description'] );
if ( isset( $_POST['jabber'] ))
$user->jabber = wp_specialchars( trim( $_POST['jabber'] ));
if ( isset( $_POST['aim'] ))
$user->aim = wp_specialchars( trim( $_POST['aim'] ));
if ( isset( $_POST['yim'] ))
$user->yim = wp_specialchars( trim( $_POST['yim'] ));
if ( !$update )
$user->rich_editing = 'true'; // Default to true for new users.
else if ( isset( $_POST['rich_editing'] ) )
$user->rich_editing = $_POST['rich_editing'];
else
$user->rich_editing = 'false';
$errors = new WP_Error();
/* checking that username has been typed */
if ( $user->user_login == '' )
$errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ));
/* checking the password has been typed twice */
do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 ));
if (!$update ) {
if ( $pass1 == '' || $pass2 == '' )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ));
} else {
if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) )
$errors->add( 'pass', __( "<strong>ERROR</strong>: you typed your new password only once." ));
}
/* Check for "\" in password */
if( strpos( " ".$pass1, "\\" ) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ));
/* checking the password has been typed twice the same */
if ( $pass1 != $pass2 )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please type the same password in the two password fields.' ));
if (!empty ( $pass1 ))
$user->user_pass = $pass1;
if ( !$update && !validate_username( $user->user_login ) )
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
if (!$update && username_exists( $user->user_login ))
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered, please choose another one.' ));
/* checking e-mail address */
if ( empty ( $user->user_email ) ) {
$errors->add( 'user_email', __( "<strong>ERROR</strong>: please type an e-mail address" ));
} else
if (!is_email( $user->user_email ) ) {
$errors->add( 'user_email', __( "<strong>ERROR</strong>: the email address isn't correct" ));
}
if ( $errors->get_error_codes() )
return $errors;
if ( $update ) {
$user_id = wp_update_user( get_object_vars( $user ));
} else {
$user_id = wp_insert_user( get_object_vars( $user ));
wp_new_user_notification( $user_id );
}
return $user_id;
}
function get_author_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
return $wpdb->get_col( $query );
}
function get_editable_authors( $user_id ) {
global $wpdb;
$editable = get_editable_user_ids( $user_id );
if( !$editable ) {
return false;
} else {
$editable = join(',', $editable);
$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
}
return apply_filters('get_editable_authors', $authors);
}
function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
global $wpdb;
$user = new WP_User( $user_id );
if ( ! $user->has_cap('edit_others_posts') ) {
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
return array($user->id);
else
return false;
}
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
if ( $exclude_zeros )
$query .= " AND meta_value != '0'";
return $wpdb->get_col( $query );
}
function get_nonauthor_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
return $wpdb->get_col( $query );
}
function get_others_unpublished_posts($user_id, $type='any') {
global $wpdb;
$user = get_userdata( $user_id );
$level_key = $wpdb->prefix . 'user_level';
$editable = get_editable_user_ids( $user_id );
if ( in_array($type, array('draft', 'pending')) )
$type_sql = " post_status = '$type' ";
else
$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
if( !$editable ) {
$other_unpubs = '';
} else {
$editable = join(',', $editable);
$other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir");
}
return apply_filters('get_others_drafts', $other_unpubs);
}
function get_others_drafts($user_id) {
return get_others_unpublished_posts($user_id, 'draft');
}
function get_others_pending($user_id) {
return get_others_unpublished_posts($user_id, 'pending');
}
function get_user_to_edit( $user_id ) {
$user = new WP_User( $user_id );
$user->user_login = attribute_escape($user->user_login);
$user->user_email = attribute_escape($user->user_email);
$user->user_url = clean_url($user->user_url);
$user->first_name = attribute_escape($user->first_name);
$user->last_name = attribute_escape($user->last_name);
$user->display_name = attribute_escape($user->display_name);
$user->nickname = attribute_escape($user->nickname);
$user->aim = attribute_escape($user->aim);
$user->yim = attribute_escape($user->yim);
$user->jabber = attribute_escape($user->jabber);
$user->description = wp_specialchars($user->description);
return $user;
}
function get_users_drafts( $user_id ) {
global $wpdb;
$user_id = (int) $user_id;
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
$query = apply_filters('get_users_drafts', $query);
return $wpdb->get_results( $query );
}
function wp_delete_user($id, $reassign = 'novalue') {
global $wpdb;
$id = (int) $id;
$user = get_userdata($id);
if ($reassign == 'novalue') {
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
if ($post_ids) {
foreach ($post_ids as $post_id)
wp_delete_post($post_id);
}
// Clean links
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
} else {
$reassign = (int) $reassign;
$wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
$wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
}
// FINALLY, delete user
do_action('delete_user', $id);
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
wp_cache_delete($id, 'users');
wp_cache_delete($user->user_login, 'userlogins');
return true;
}
function wp_revoke_user($id) {
$id = (int) $id;
$user = new WP_User($id);
$user->remove_all_caps();
}
?>

View File

@@ -2,19 +2,15 @@
require_once('admin.php');
require_once (ABSPATH . WPINC . '/rss.php');
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
switch ( $_GET['jax'] ) {
case 'incominglinks' :
$rss_feed = apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
$more_link = apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
$rss = @fetch_rss( $rss_feed );
$rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
if ( isset($rss->items) && 1 < count($rss->items) ) { // Technorati returns a 1-item feed when it has no results
?>
<h3><?php _e('Incoming Links'); ?> <cite><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('More &raquo;'); ?></a></cite></h3>
<h3><?php _e('Incoming Links'); ?> <cite><a href="http://www.technorati.com/search/<?php echo trailingslashit(get_option('home')); ?>?partner=wordpress"><?php _e('More &raquo;'); ?></a></cite></h3>
<ul>
<?php
$rss->items = array_slice($rss->items, 0, 10);
@@ -28,10 +24,10 @@ foreach ($rss->items as $item ) {
break;
case 'devnews' :
$rss = @fetch_rss(apply_filters( 'dashboard_primary_feed', 'http://wordpress.org/development/feed/' ));
$rss = @fetch_rss('http://wordpress.org/development/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php echo apply_filters( 'dashboard_primary_title', __('WordPress Development Blog') ); ?></h3>
<h3><?php _e('WordPress Development Blog'); ?></h3>
<?php
$rss->items = array_slice($rss->items, 0, 3);
foreach ($rss->items as $item ) {
@@ -47,10 +43,10 @@ foreach ($rss->items as $item ) {
break;
case 'planetnews' :
$rss = @fetch_rss(apply_filters( 'dashboard_secondary_feed', 'http://planet.wordpress.org/feed/' ));
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php echo apply_filters( 'dashboard_secondary_title', __('Other WordPress News') ); ?></h3>
<h3><?php _e('Other WordPress News'); ?></h3>
<ul>
<?php
$rss->items = array_slice($rss->items, 0, 20);
@@ -64,7 +60,7 @@ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
}
?>
</ul>
<p class="readmore"><a href="<?php echo apply_filters( 'dashboard_secondary_link', 'http://planet.wordpress.org/' ); ?>"><?php _e('Read more &raquo;'); ?></a></p>
<p class="readmore"><a href="http://planet.wordpress.org/"><?php _e('Read more'); ?> &raquo;</a></p>
<?php
}
break;

View File

@@ -1,22 +1,23 @@
<?php
require_once('admin.php');
require_once('admin.php');
function index_js() {
?>
<script type="text/javascript">
jQuery(function() {
jQuery('#incominglinks').load('index-extra.php?jax=incominglinks');
jQuery('#devnews').load('index-extra.php?jax=devnews');
jQuery('#planetnews').load('index-extra.php?jax=planetnews');
});
Event.observe( window, 'load', dashboard_init, false );
function dashboard_init() {
var update1 = new Ajax.Updater( 'incominglinks', 'index-extra.php?jax=incominglinks' );
var update2 = new Ajax.Updater( 'devnews', 'index-extra.php?jax=devnews' );
var update3 = new Ajax.Updater( 'planetnews', 'index-extra.php?jax=planetnews' );
}
</script>
<?php
}
add_action( 'admin_head', 'index_js' );
wp_enqueue_script('prototype');
wp_enqueue_script('interface');
wp_enqueue_script( 'jquery' );
$title = __('Dashboard');
$title = __('Dashboard');
$parent_file = 'index.php';
require_once('admin-header.php');
@@ -39,17 +40,17 @@ $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE commen
if ( $comments || $numcomments ) :
?>
<div>
<h3><?php printf( __( 'Comments <a href="%s" title="More comments&#8230;">&raquo;</a>' ), 'edit-comments.php' ); ?></h3>
<h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php _e('More comments...'); ?>">&raquo;</a></h3>
<?php if ( $numcomments ) : ?>
<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s) &raquo;'), number_format_i18n($numcomments) ); ?></a></strong></p>
<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</a></strong></p>
<?php endif; ?>
<ul>
<?php
if ( $comments ) {
foreach ($comments as $comment) {
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>');
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
echo '</li>';
}
@@ -63,7 +64,7 @@ foreach ($comments as $comment) {
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
?>
<div>
<h3><?php printf( __( 'Posts <a href="%s" title="More posts&#8230;">&raquo;</a>' ), 'edit.php' ); ?></h3>
<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">&raquo;</a></h3>
<ul>
<?php
foreach ($recentposts as $post) {
@@ -100,16 +101,14 @@ foreach ($scheduled as $post) {
<?php
$numposts = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
$numcomms = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
$numcats = wp_count_terms('category');
$numtags = wp_count_terms('post_tag');
$numcats = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format_i18n($numposts), 'edit.php');
$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format_i18n($numcomms), 'edit-comments.php');
$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format_i18n($numcats), 'categories.php');
$tag_str = sprintf(__ngettext('%1$s tag', '%1$s tags', $numtags), number_format_i18n($numtags));
$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format($numposts), 'edit.php');
$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format($numcomms), 'edit-comments.php');
$cat_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format($numcats), 'categories.php');
?>
<p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s and %4$s.'), $post_str, $comm_str, $cat_str, $tag_str); ?></p>
<p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
</div>
<?php do_action('activity_box_end'); ?>

View File

@@ -1,5 +1,5 @@
<?php
require_once(dirname(dirname(__FILE__)).'/wp-config.php');
require_once('../wp-config.php');
$debug = 0;
/**
@@ -149,4 +149,4 @@ if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
}
echo "</pre>";
*/
?>
?>

View File

@@ -1,19 +1,17 @@
<?php
define('WP_INSTALLING', true);
if (!file_exists('../wp-config.php')) {
require_once('../wp-includes/compat.php');
require_once('../wp-includes/functions.php');
wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress &rsaquo; Error");
}
require_once('../wp-config.php');
require_once('./includes/upgrade.php');
require_once('./upgrade-functions.php');
if (isset($_GET['step']))
$step = $_GET['step'];
else
$step = 0;
function display_header(){
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -21,33 +19,33 @@ header( 'Content-Type: text/html; charset=utf-8' );
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php _e('WordPress &rsaquo; Installation'); ?></title>
<?php wp_admin_css( 'css/install' ); ?>
<link rel="stylesheet" href="install.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
<link rel="stylesheet" href="install-rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php endif; ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php
}//end function display_header();
// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
if ( is_blog_installed() ) die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
switch($step) {
case 0:
case 1: // in case people are directly linking to this
display_header();
?>
<h1><?php _e('Welcome'); ?></h1>
<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step &raquo;'); ?></a></h2>-->
<h1><?php _e('Information needed'); ?></h1>
<p><?php _e("Please provide the following information. Don't worry, you can always change these settings later."); ?></p>
<p><?php printf(__('Welcome to WordPress installation. We&#8217;re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="%s">ReadMe documentation</a> at your leisure.'), '../readme.html'); ?></p>
<h2 class="step"><a href="install.php?step=1"><?php _e('First Step &raquo;'); ?></a></h2>
<?php
break;
case 1:
?>
<h1><?php _e('First Step'); ?></h1>
<p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p>
<form id="setup" method="post" action="install.php?step=2">
<table width="100%">
<tr>
<th width="33%"><?php _e('Blog title:'); ?></th>
<th width="33%"><?php _e('Weblog title:'); ?></th>
<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
</tr>
<tr>
@@ -55,43 +53,42 @@ switch($step) {
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
<th scope="row" valign="top"> <?php __('Privacy:'); ?></th>
<td><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('I would like my blog to appear in search engines like Google and Technorati.'); ?></label></td>
</tr>
</table>
<p><em><?php _e('Double-check your email address before continuing.'); ?></em></p>
<h2 class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress &raquo;'); ?>" /></h2>
<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
<h2 class="step"><input type="submit" name="Submit" value="<?php _e('Continue to Second Step &raquo;'); ?>" /></h2>
</form>
<?php
break;
case 2:
if ( !empty($wpdb->error) )
wp_die($wpdb->error->get_error_message());
display_header();
// Fill in the data we gathered
$weblog_title = stripslashes($_POST['weblog_title']);
$admin_email = stripslashes($_POST['admin_email']);
$public = (int) $_POST['blog_public'];
// check e-mail address
if (empty($admin_email)) {
// TODO: poka-yoke
die(__("<strong>ERROR</strong>: you must provide an e-mail address"));
die(__("<strong>ERROR</strong>: please type your e-mail address"));
} else if (!is_email($admin_email)) {
// TODO: poka-yoke
die(__('<strong>ERROR</strong>: that isn\'t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>'));
die(__("<strong>ERROR</strong>: the e-mail address isn't correct"));
}
$wpdb->show_errors();
$result = wp_install($weblog_title, 'admin', $admin_email, $public);
extract($result, EXTR_SKIP);
?>
<h1><?php _e('Second Step'); ?></h1>
<p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p>
<?php
$result = wp_install($weblog_title, 'admin', $admin_email, $public);
extract($result, EXTR_SKIP);
?>
<h1><?php _e('Success!'); ?></h1>
<p><em><?php _e('Finished!'); ?></em></p>
<p><?php printf(__('WordPress has been installed. Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $password); ?></p>
<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.'); ?></p>
<p><?php printf(__('Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $password); ?></p>
<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. So to review:'); ?></p>
<dl>
<dt><?php _e('Username'); ?></dt>
@@ -101,7 +98,7 @@ switch($step) {
<dt><?php _e('Login address'); ?></dt>
<dd><a href="../wp-login.php">wp-login.php</a></dd>
</dl>
<p><?php _e('Were you expecting more steps? Sorry to disappoint. :)'); ?></p>
<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
<?php
break;

View File

@@ -1,10 +0,0 @@
addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;});
addLoadEvent(newLinkCatAddIn);
function newLinkCatAddIn() {
var jaxcat = $('jaxcat');
if ( !jaxcat )
return false;
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how + '</span></span>');
$('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); };
$('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); };
}

View File

@@ -13,7 +13,7 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
if ( current_user_can( 'manage_categories' ) )
wp_enqueue_script( 'ajaxlinkcat' );
wp_enqueue_script( 'ajaxcat' );
require('admin-header.php');
?>

View File

@@ -1,71 +0,0 @@
<?php
require_once('admin.php');
wp_reset_vars(array('action', 'cat'));
switch($action) {
case 'addcat':
check_admin_referer('add-link-category');
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
if ( wp_insert_term($_POST['name'], 'link_category', $_POST ) ) {
wp_redirect('edit-link-categories.php?message=1#addcat');
} else {
wp_redirect('edit-link-categories.php?message=4#addcat');
}
exit;
break;
case 'delete':
$cat_ID = (int) $_GET['cat_ID'];
check_admin_referer('delete-link-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
$cat_name = get_term_field('name', $cat_ID, 'link_category');
// Don't delete the default cats.
if ( $cat_ID == get_option('default_link_category') )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_delete_term($cat_ID, 'link_category');
wp_redirect('edit-link-categories.php?message=2');
exit;
break;
case 'edit':
$title = __('Categories');
$parent_file = 'link-manager.php';
$submenu_file = 'edit-link-categories.php';
require_once ('admin-header.php');
$cat_ID = (int) $_GET['cat_ID'];
$category = get_term_to_edit($cat_ID, 'link_category');
include('edit-link-category-form.php');
include('admin-footer.php');
exit;
break;
case 'editedcat':
$cat_ID = (int) $_POST['cat_ID'];
check_admin_referer('update-link-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
if ( wp_update_term($cat_ID, 'link_category', $_POST) )
wp_redirect('edit-link-categories.php?message=3');
else
wp_redirect('edit-link-categories.php?message=5');
exit;
break;
}
?>

View File

@@ -45,10 +45,10 @@ switch ($step) {
<p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
<?php _e('Category:') ?> <select name="cat_id">
<?php
$categories = get_terms('link_category', 'get=all');
$categories = get_categories('hide_empty=0');
foreach ($categories as $category) {
?>
<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
<?php
} // end foreach
?>
@@ -98,7 +98,7 @@ foreach ($categories as $category) {
} else {
$opml = file_get_contents($opml_url);
}
include_once('link-parse-opml.php');
$link_count = count($names);
@@ -123,7 +123,7 @@ else
} // end else
if ( ! $blogrolling )
apply_filters( 'wp_delete_file', $opml_url);
apply_filters( 'wp_delete_file', $opml_url);
@unlink($opml_url);
?>
</div>

View File

@@ -76,11 +76,11 @@ if ( isset($_GET['deleted']) ) {
<p><?php _e('Here you <a href="link-add.php">add links</a> to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it&#8217;s called a &#8220;blogroll.&#8221;'); ?></p>
<form id="cats" method="get" action="">
<p><?php
$categories = get_terms('link_category', "hide_empty=1");
$categories = get_categories("hide_empty=1&type=link");
$select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
foreach ((array) $categories as $cat)
$select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
$select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
$select_cat .= "</select>\n";
$select_order = "<select name=\"order_by\">\n";
@@ -131,8 +131,9 @@ if ( $links ) {
<tbody id="the-list">
<?php
foreach ($links as $link) {
$link = sanitize_bookmark($link);
$link->link_name = attribute_escape($link->link_name);
$link->link_name = attribute_escape(apply_filters('link_title', $link->link_name));
$link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description));
$link->link_url = clean_url($link->link_url);
$link->link_category = wp_get_link_cats($link->link_id);
$short_url = str_replace('http://', '', $link->link_url);
$short_url = str_replace('www.', '', $short_url);
@@ -158,10 +159,8 @@ if ( $links ) {
?><td><?php
$cat_names = array();
foreach ($link->link_category as $category) {
$cat = get_term($category, 'link_category', OBJECT, 'display');
if ( is_wp_error( $cat ) )
echo $cat->get_error_message();
$cat_name = $cat->name;
$cat_name = get_the_category_by_ID($category);
$cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
if ( $cat_id != $category )
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
$cat_names[] = $cat_name;
@@ -196,7 +195,7 @@ if ( $links ) {
<div id="ajax-response"></div>
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links &raquo;') ?>" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p>
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> &raquo;" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p>
</form>
<?php } ?>

View File

@@ -3,9 +3,6 @@ require_once ('admin.php');
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
if ( ! current_user_can('manage_links') )
wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
if ('' != $_POST['deletebookmarks'])
$action = 'deletebookmarks';
if ('' != $_POST['move'])
@@ -16,9 +13,13 @@ if ('' != $_POST['linkcheck'])
$this_file = 'link-manager.php';
switch ($action) {
case 'deletebookmarks' :
case 'deletebookmarks' :
check_admin_referer('bulk-bookmarks');
// check the current user's level first.
if (!current_user_can('manage_links'))
wp_die(__('Cheatin&#8217; uh?'));
//for each link id (in $linkcheck[]) change category to selected value
if (count($linkcheck) == 0) {
wp_redirect($this_file);
@@ -40,6 +41,10 @@ switch ($action) {
case 'move' :
check_admin_referer('bulk-bookmarks');
// check the current user's level first.
if (!current_user_can('manage_links'))
wp_die(__('Cheatin&#8217; uh?'));
//for each link id (in $linkcheck[]) change category to selected value
if (count($linkcheck) == 0) {
wp_redirect($this_file);
@@ -58,7 +63,7 @@ switch ($action) {
add_link();
wp_redirect( wp_get_referer() . '?added=true' );
wp_redirect(wp_get_referer().'?added=true');
exit;
break;
@@ -76,6 +81,9 @@ switch ($action) {
$link_id = (int) $_GET['link_id'];
check_admin_referer('delete-bookmark_' . $link_id);
if (!current_user_can('manage_links'))
wp_die(__('Cheatin&#8217; uh?'));
wp_delete_link($link_id);
wp_redirect($this_file);
@@ -85,22 +93,25 @@ switch ($action) {
case 'edit' :
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
if ( current_user_can( 'manage_categories' ) )
wp_enqueue_script( 'ajaxlinkcat' );
wp_enqueue_script( 'ajaxcat' );
$parent_file = 'link-manager.php';
$submenu_file = 'link-manager.php';
$title = __('Edit Link');
include_once ('admin-header.php');
if (!current_user_can('manage_links'))
wp_die(__('You do not have sufficient permissions to edit the links for this blog.'));
$link_id = (int) $_GET['link_id'];
if (!$link = get_link_to_edit($link_id))
wp_die(__('Link not found.'));
include_once ('admin-header.php');
include ('edit-link-form.php');
include ('admin-footer.php');
break;
default :
break;
}
?>
include ('admin-footer.php');
?>

View File

@@ -46,7 +46,6 @@ $submenu['edit.php'][40] = array(__('Export'), 'import', 'export.php');
$submenu['link-manager.php'][5] = array(__('Manage Blogroll'), 'manage_links', 'link-manager.php');
$submenu['link-manager.php'][10] = array(__('Add Link'), 'manage_links', 'link-add.php');
$submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php');
$submenu['link-manager.php'][30] = array(__('Categories'), 'manage_links', 'edit-link-categories.php');
if ( current_user_can('edit_users') ) {
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
@@ -96,7 +95,7 @@ foreach ($submenu as $parent => $sub) {
// Menus for which the original parent is not acessible due to lack of privs will have the next
// submenu in line be assigned as the new menu parent.
foreach ( $menu as $id => $data ) {
if ( empty($submenu[$data[2]]) )
if ( empty($submenu[$data[2]]) )
continue;
$subs = $submenu[$data[2]];
$first_sub = array_shift($subs);

View File

@@ -1,226 +1,206 @@
<?php
require_once('admin.php');
require_once './admin.php';
$title = __( 'Moderate Comments' );
$title = __('Moderate comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
wp_reset_vars( array( 'action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky' ) );
wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));
$comment = array();
if ( isset( $_POST['comment'] ) && is_array( $_POST['comment'] ) ) {
foreach ( $_POST['comment'] as $k => $v ) {
$comment[intval( $k )] = $v;
if (isset($_POST["comment"])) {
foreach ($_POST["comment"] as $k => $v) {
$comment[intval($k)] = $v;
}
}
if ( $action == 'update' ) {
check_admin_referer( 'moderate-comments' );
switch($action) {
if ( !current_user_can( 'moderate_comments' ) ) {
wp_die( __( 'Your level is not high enough to moderate comments.' ) );
}
case 'update':
check_admin_referer('moderate-comments');
if ( !current_user_can('moderate_comments') )
wp_die(__('Your level is not high enough to moderate comments.'));
$item_ignored = 0;
$item_deleted = 0;
$item_approved = 0;
$item_spam = 0;
foreach ( $comment as $k => $v ) {
if ( $feelinglucky && $v == 'later' ) {
$v = 'delete';
}
switch ( $v ) {
case 'later' :
$item_ignored++;
break;
case 'delete' :
wp_set_comment_status( $k, 'delete' );
$item_deleted++;
break;
case 'spam' :
wp_set_comment_status( $k, 'spam' );
$item_spam++;
break;
case 'approve' :
wp_set_comment_status( $k, 'approve' );
if ( get_option( 'comments_notify' ) == true ) {
wp_notify_postauthor( $k );
foreach($comment as $key => $value) {
if ($feelinglucky && 'later' == $value)
$value = 'delete';
switch($value) {
case 'later':
// do nothing with that comment
// wp_set_comment_status($key, "hold");
++$item_ignored;
break;
case 'delete':
wp_set_comment_status($key, 'delete');
++$item_deleted;
break;
case 'spam':
wp_set_comment_status($key, 'spam');
++$item_spam;
break;
case 'approve':
wp_set_comment_status($key, 'approve');
if ( get_option('comments_notify') == true ) {
wp_notify_postauthor($key);
}
$item_approved++;
break;
++$item_approved;
break;
}
}
wp_redirect( basename( __FILE__ ) . '?ignored=' . $item_ignored . '&deleted=' . $item_deleted . '&approved=' . $item_approved . '&spam=' . $item_spam );
exit;
}
$file = basename(__FILE__);
wp_redirect("$file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
exit();
require_once './admin-header.php';
break;
if ( !current_user_can( 'moderate_comments' ) ) {
echo '<div class="wrap"><p>' . __( 'Your level is not high enough to moderate comments.' ) . '</p></div>';
include_once './admin-footer.php';
exit;
}
default:
if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
$approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
$deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
$spam = isset( $_GET['ignored'] ) ? (int) $_GET['spam'] : 0;
require_once('admin-header.php');
if ( $approved > 0 || $deleted > 0 || $spam > 0 ) {
echo '<div id="moderated" class="updated fade"><p>';
if ( $approved > 0 ) {
printf( __ngettext( '%s comment approved.', '%s comments approved.', $approved ), $approved );
echo '<br />';
}
if ( $deleted > 0 ) {
printf( __ngettext( '%s comment deleted', '%s comments deleted.', $deleted ), $deleted );
echo '<br />';
}
if ( $spam > 0 ) {
printf( __ngettext( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
echo '<br />';
}
echo '</p></div>';
if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored']) ) {
echo "<div id='moderated' class='updated fade'>\n<p>";
$approved = (int) $_GET['approved'];
$deleted = (int) $_GET['deleted'];
$ignored = (int) $_GET['ignored'];
$spam = (int) $_GET['spam'];
if ($approved) {
printf(__ngettext('%s comment approved', '%s comments approved', $approved), $approved);
echo "<br/>\n";
}
if ($deleted) {
printf(__ngettext('%s comment deleted', '%s comments deleted', $deleted), $deleted);
echo "<br/>\n";
}
if ($spam) {
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam', $spam), $spam);
echo "<br/>\n";
}
if ($ignored) {
printf(__ngettext('%s comment unchanged', '%s comments unchanged', $ignored), $ignored);
echo "<br/>\n";
}
echo "</p></div>\n";
}
?>
<div class="wrap">
<?php
if ( current_user_can('moderate_comments') )
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
else
$comments = '';
if ($comments) {
// list all comments that are waiting for approval
$file = basename(__FILE__);
?>
<h2><?php _e('Moderation Queue') ?></h2>
<form name="approval" action="moderation.php" method="post">
<?php wp_nonce_field('moderate-comments') ?>
<input type="hidden" name="action" value="update" />
<ol id="the-comment-list" class="commentlist">
<?php
$i = 0;
foreach($comments as $comment) {
++$i;
$comment_date = mysql2date(get_option("date_format") . " @ " . get_option("time_format"), $comment->comment_date);
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
if ($i % 2) $class = 'js-unapproved alternate';
else $class = 'js-unapproved';
echo "\n\t<li id='comment-$comment->comment_ID' class='$class'>";
?>
<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?>
<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [ <?php
echo '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';
echo " <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete') . "</a> | "; ?>
<?php
$post = get_post($comment->comment_post_ID);
$post_title = wp_specialchars( $post->post_title, 'double' );
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ] &#8212;
<?php _e('Bulk action:') ?>
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-approve" value="approve" /> <label for="comment-<?php echo $comment->comment_ID; ?>-approve"><?php _e('Approve') ?></label> &nbsp;
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-spam" value="spam" /> <label for="comment-<?php echo $comment->comment_ID; ?>-spam"><?php _e('Spam') ?></label> &nbsp;
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-delete" value="delete" /> <label for="comment-<?php echo $comment->comment_ID; ?>-delete"><?php _e('Delete') ?></label> &nbsp;
<input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-nothing" value="later" checked="checked" /> <label for="comment-<?php echo $comment->comment_ID; ?>-nothing"><?php _e('Defer until later') ?></label>
</p>
</li>
<?php
}
?>
</ol>
<div id="ajax-response"></div>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p>
<script type="text/javascript">
// <![CDATA[
function markAllForDelete() {
for (var i=0; i< document.approval.length; i++) {
if (document.approval[i].value == "delete") {
document.approval[i].checked = true;
}
}
}
function markAllForApprove() {
for (var i=0; i< document.approval.length; i++) {
if (document.approval[i].value == "approve") {
document.approval[i].checked = true;
}
}
}
function markAllForDefer() {
for (var i=0; i< document.approval.length; i++) {
if (document.approval[i].value == "later") {
document.approval[i].checked = true;
}
}
}
function markAllAsSpam() {
for (var i=0; i< document.approval.length; i++) {
if (document.approval[i].value == "spam") {
document.approval[i].checked = true;
}
}
}
document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllAsSpam()"><?php _e('Mark all as spam'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>');
// ]]>
</script>
<noscript>
<p>
<input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label>
</p>
</noscript>
</form>
<?php
} else {
// nothing to approve
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
}
?>
</div>
<?php
$comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'" );
if ( !$comments ) {
echo '<p>' . __( 'Currently there are no comments for you to moderate.' ) . '</p></div>';
include_once './admin-footer.php';
exit;
break;
}
$total = count( $comments );
$per = 100;
if ( isset( $_GET['paged'] ) ) {
$page = (int) $_GET['paged'];
} else {
$page = 1;
}
$start = ( $page * $per ) - $per;
$stop = $start + $per;
$page_links = paginate_links( array(
'base' => add_query_arg( 'paged', '%#%' ),
'format' => '',
'total' => ceil( $total / $per ),
'current' => $page,
'prev_text' => '&laquo;',
'next_text' => '&raquo;'
) );
$comments = array_slice( $comments, $start, $stop );
include('admin-footer.php');
?>
<h2><?php _e( 'Moderation Queue' ); ?></h2>
<?php
if ( $page_links ) {
echo '<p class="pagenav">' . $page_links . '</p>';
}
?>
<form name="approval" id="approval" action="<?php echo basename( __FILE__ ); ?>" method="post">
<?php wp_nonce_field( 'moderate-comments' ); ?>
<input type="hidden" name="action" value="update" />
<ol id="the-comments-list" class="commentlist">
<?php
$i = 0;
foreach ( $comments as $comment ) {
$class = 'js-unapproved';
if ( $i++ % 2 ) {
$class .= ' alternate';
}
?>
<li id="comment-<?php comment_ID(); ?>" class="<?php echo $class; ?>">
<p>
<strong><?php comment_author(); ?></strong>
<?php if ( !empty( $comment->comment_author_email ) ) { ?>| <?php comment_author_email_link(); ?> <?php } ?>
<?php if ( !empty( $comment->comment_author_url ) && $comment->comment_author_url != 'http://' ) { ?>| <?php comment_author_url_link(); ?> <?php } ?>
| <?php _e( 'IP:' ); ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP(); ?>"><?php comment_author_IP(); ?></a>
</p>
<p>
<?php comment_text(); ?>
</p>
<p><small>
<?php comment_date( __( 'M j, g:i A' ) ); ?> &#8212;
[ <a href="comment.php?action=editcomment&amp;c=<?php comment_ID(); ?>" title="<?php _e( 'Edit this comment' ); ?>"><?php _e( 'Edit' ); ?></a> |
<a href="post.php?action=deletecomment&amp;p=<?php echo $comment->comment_post_ID; ?>" title="<?php _e( 'Delete this comment' ); ?>" onclick="return deleteSomething( 'comment', <?php comment_ID(); ?>, '<?php echo js_escape( sprintf( __( "You are about to delete this comment by '%s'.\n'OK' to delete, 'Cancel' to stop." ), get_comment_author() ) ); ?>', theCommentList );"><?php _e( 'Delete' ); ?></a> ] &#8212;
<a href="<?php echo get_permalink( $comment->comment_post_ID ); ?>" title="<?php _e( 'View the post' ); ?>"><?php printf( __( 'View post &#8220;%s&#8221;' ), get_the_title( $comment->comment_post_ID ) ); ?></a>
</small></p>
<p><small>
<?php _e( 'Bulk action:' ); ?>
<label for="comment-<?php comment_ID(); ?>-approve"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-approve" value="approve" /> <?php _e( 'Approve' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-spam"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-spam" value="spam" /> <?php _e( 'Spam' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-delete"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-delete" value="delete" /> <?php _e( 'Delete' ); ?></label> &nbsp;
<label for="comment-<?php comment_ID(); ?>-nothing"><input type="radio" name="comment[<?php comment_ID(); ?>]" id="comment-<?php comment_ID(); ?>-nothing" value="later" checked="checked" /> <?php _e( 'No action' ); ?></label>
</small></p>
</li>
<?php
}
?>
</ol>
<?php
if ( $page_links ) {
echo '<p class="pagenav">' . $page_links . '</p>';
}
?>
<div id="ajax-response"></div>
<noscript>
<p class="submit">
<label for="feelinglucky"><input name="feelinglucky" id="feelinglucky" type="checkbox" value="true" /> <?php _e( 'Delete every comment marked &#8220;defer.&#8221; <strong>Warning: This can&#8217;t be undone.</strong>' ); ?></label>
</p>
</noscript>
<p class="submit">
<input type="submit" id="submit" name="submit" value="<?php _e( 'Bulk Moderate Comments &raquo;' ); ?>" />
</p>
<script type="text/javascript">
// <![CDATA[
function mark_all_as( what ) {
for ( var i = 0; i < document.approval.length; i++ ) {
if ( document.approval[i].value == what ) {
document.approval[i].checked = true;
}
}
}
document.write( '<p><strong><?php _e( 'Mark all:' ); ?></strong> <a href="javascript:mark_all_as(\'approve\')"><?php _e( 'Approved' ); ?></a> &ndash; <a href="javascript:mark_all_as(\'spam\')"><?php _e( 'Spam' ); ?></a> &ndash; <a href="javascript:mark_all_as(\'delete\')"><?php _e( 'Deleted' ); ?></a> &ndash; <a href="javascript:mark_all_as(\'later\')"><?php _e( 'Later' ); ?></a></p>' );
// ]]>
</script>
</form>
</div>
<?php include_once './admin-footer.php'; ?>

View File

@@ -7,80 +7,80 @@ $parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Discussion Options') ?></h2>
<form method="post" action="options.php">
<div class="wrap">
<h2><?php _e('Discussion Options') ?></h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
<fieldset class="options">
<legend><?php echo __('Usual settings for an article:').'<br /><small><em>('.__('These settings may be overridden for individual articles.').')</em></small>'; ?></legend>
<ul>
<li>
<label for="default_pingback_flag">
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
<?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
</li>
<li>
<label for="default_ping_status">
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
<?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
</li>
<li>
<label for="default_comment_status">
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
<?php _e('Allow people to post comments on the article') ?></label>
</li>
</ul>
<legend><?php echo __('Usual settings for an article:').'<br /><small><em>('.__('These settings may be overridden for individual articles.').')</em></small>'; ?></legend>
<ul>
<li>
<label for="default_pingback_flag">
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
<?php _e('Attempt to notify any Weblogs linked to from the article (slows down posting.)') ?></label>
</li>
<li>
<label for="default_ping_status">
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
<?php _e('Allow link notifications from other Weblogs (pingbacks and trackbacks.)') ?></label>
</li>
<li>
<label for="default_comment_status">
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
<?php _e('Allow people to post comments on the article') ?></label>
</li>
</ul>
</fieldset>
<fieldset class="options">
<legend><?php _e('E-mail me whenever:') ?></legend>
<ul>
<li>
<label for="comments_notify">
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
<?php _e('Anyone posts a comment') ?> </label>
</li>
<li>
<label for="moderation_notify">
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
<?php _e('A comment is held for moderation') ?> </label>
</li>
</ul>
<legend><?php _e('E-mail me whenever:') ?></legend>
<ul>
<li>
<label for="comments_notify">
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
<?php _e('Anyone posts a comment') ?> </label>
</li>
<li>
<label for="moderation_notify">
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
<?php _e('A comment is held for moderation') ?> </label>
</li>
</ul>
</fieldset>
<fieldset class="options">
<legend><?php _e('Before a comment appears:') ?></legend>
<legend><?php _e('Before a comment appears:') ?></legend>
<ul>
<li>
<label for="comment_moderation">
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
<?php _e('An administrator must always approve the comment') ?> </label>
</li>
<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li>
<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li>
</ul>
<label for="comment_moderation">
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
<?php _e('An administrator must always approve the comment') ?> </label>
</li>
<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li>
<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li>
</ul>
</fieldset>
<fieldset class="options">
<legend><?php _e('Comment Moderation') ?></legend>
<p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="moderation.php">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
<p>
<textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
</p>
<p>
<textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
</p>
</fieldset>
<fieldset class="options">
<legend><?php _e('Comment Blacklist') ?></legend>
<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
<p>
<textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
<p>
<textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
</p>
</fieldset>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p>
</form>
</div>
<?php include('./admin-footer.php'); ?>
<?php include('./admin-footer.php'); ?>

View File

@@ -6,65 +6,65 @@ $parent_file = 'options-general.php';
include('./admin-header.php');
?>
<div class="wrap">
<h2><?php _e('General Options') ?></h2>
<form method="post" action="options.php">
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
<table class="optiontable">
<tr valign="top">
<th scope="row"><?php _e('Blog title:') ?></th>
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Tagline:') ?></th>
<table class="optiontable">
<tr valign="top">
<th scope="row"><?php _e('Weblog title:') ?></th>
<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Tagline:') ?></th>
<td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
<br />
<?php _e('In a few words, explain what this blog is about.') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('WordPress address (URL):') ?></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
</tr>
<?php _e('In a few words, explain what this weblog is about.') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('WordPress address (URL):') ?></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Blog address (URL):') ?></th>
<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('E-mail address:') ?> </th>
<tr valign="top">
<th scope="row"><?php _e('E-mail address:') ?> </th>
<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
<br />
<?php _e('This address is used only for admin purposes.') ?></td>
<?php _e('This address is used only for admin purposes.') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Membership:') ?></th>
<td> <label for="users_can_register">
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
<tr valign="top">
<th scope="row"><?php _e('Membership:') ?></th>
<td> <label for="users_can_register">
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
<?php _e('Anyone can register') ?></label><br />
<label for="comment_registration">
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
<?php _e('Users must be registered and logged in to comment') ?>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('New User Default Role:') ?></th>
<td><label for="default_role">
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('New User Default Role:') ?></th>
<td><label for="default_role">
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select></label>
</td>
</tr>
</table>
<fieldset class="options">
<legend><?php _e('Date and Time') ?></legend>
<table class="optiontable">
<tr>
<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
<td><code><?php echo gmdate(__('Y-m-d g:i:s a')); ?></code></td>
</td>
</tr>
</table>
<fieldset class="options">
<legend><?php _e('Date and Time') ?></legend>
<table class="optiontable">
<tr>
<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
<td><code><?php echo gmdate(__('Y-m-d g:i:s a')); ?></code></td>
</tr>
<tr>
<th scope="row"><?php _e('Times in the blog should differ by:') ?> </th>
<td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
<th scope="row"><?php _e('Times in the weblog should differ by:') ?> </th>
<td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
<?php _e('hours') ?> (<?php _e('Your timezone offset, for example <code>-6</code> for Central Time.'); ?>)</td>
</tr>
<tr>
@@ -76,7 +76,7 @@ include('./admin-header.php');
<th scope="row"><?php _e('Default time format:') ?></th>
<td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
<?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong></td>
</tr>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td><?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Update options" to update sample output.') ?> </td>
@@ -93,14 +93,14 @@ endfor;
</select></td>
</tr>
</table>
</fieldset>
</fieldset>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
</p>
</form>
</div>
</div>
<?php include('./admin-footer.php') ?>

View File

@@ -73,18 +73,10 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
$category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
$wp_rewrite->set_category_base($category_base);
}
if ( isset($_POST['tag_base']) ) {
$tag_base = $_POST['tag_base'];
if (! empty($tag_base) )
$tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
$wp_rewrite->set_tag_base($tag_base);
}
}
$permalink_structure = get_option('permalink_structure');
$category_base = get_option('category_base');
$tag_base = get_option( 'tag_base' );
if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
$writable = true;
@@ -101,16 +93,16 @@ $wp_rewrite->flush_rules();
<?php if (isset($_POST['submit'])) : ?>
<div id="message" class="updated fade"><p><?php
if ( $permalink_structure && !$usingpi && !$writable )
_e('You should update your .htaccess now.');
else
if ($writable)
_e('Permalink structure updated.');
else
_e('You should update your .htaccess now.');
?></p></div>
<?php endif; ?>
<div class="wrap">
<h2><?php _e('Customize Permalink Structure') ?></h2>
<form name="form" action="options-permalink.php" method="post">
<div class="wrap">
<h2><?php _e('Customize Permalink Structure') ?></h2>
<form name="form" action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Update Permalink Structure &raquo;') ?>" /></p>
<p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
@@ -130,20 +122,20 @@ $structures = array(
<h3><?php _e('Common options:'); ?></h3>
<p>
<label>
<input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> />
<?php _e('Default'); ?><br /> <span> <?php echo _c('&raquo;|Used as a list bullet'); ?> <code><?php echo get_option('home'); ?>/?p=123</code></span>
<input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> />
<?php _e('Default'); ?><br /> <span> &raquo; <code><?php echo get_option('home'); ?>/?p=123</code></span>
</label>
</p>
<p>
<label>
<input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> />
<?php _e('Date and name based'); ?><br /> <span> <?php echo _c('&raquo;|Used as a list bullet'); ?> <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
<input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> />
<?php _e('Date and name based'); ?><br /> <span> &raquo; <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
</label>
</p>
<p>
<label>
<input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> />
<?php _e('Numeric'); ?><br /> <span> <?php echo _c('&raquo;|Used as a list bullet'); ?> <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span>
<input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> />
<?php _e('Numeric'); ?><br /> <span> &raquo; <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span>
</label>
</p>
<p>
@@ -161,25 +153,25 @@ checked="checked"
<h3><?php _e('Optional'); ?></h3>
<?php if ($is_apache) : ?>
<p><?php _e('If you like, you may enter custom bases for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/taxonomy/tags</code> would make your category links like <code>http://example.org/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
<?php else : ?>
<p><?php _e('If you like, you may enter custom bases for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/index.php/taxonomy/tags</code> would make your category links like <code>http://example.org/index.php/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
<?php endif; ?>
<p>
<?php _e('Category base'); ?>: <input name="category_base" id="category_base" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" />
</p>
<p>
<?php _e('Tag base'); ?>: <input name="tag_base" id="tag_base" type="text" class="code" value="<?php echo attribute_escape($tag_base); ?>" size="30" />
</p>
<p class="submit">
<input type="submit" name="submit" value="<?php _e('Update Permalink Structure &raquo;') ?>" />
</p>
</form>
<p>
<?php _e('Category base'); ?>: <input name="category_base" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" />
</p>
<p class="submit">
<input type="submit" name="submit" value="<?php _e('Update Permalink Structure &raquo;') ?>" />
</p>
</form>
<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
<p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Make_a_Directory_Writable">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
<form action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>
<p><textarea rows="5" style="width: 98%;" name="rules" id="rules"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
<p>
<textarea rows="5" style="width: 98%;" name="rules"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?>
</textarea>
</p>
</form>
<?php endif; ?>

View File

@@ -7,25 +7,25 @@ $parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Reading Options') ?></h2>
<div class="wrap">
<h2><?php _e('Reading Options') ?></h2>
<form name="form1" method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
<?php if ( get_pages() ): ?>
<fieldset class="options">
<legend><?php _e('Front Page') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Front page displays:')?></th>
<fieldset class="options">
<legend><?php _e('Front Page') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Front page displays:')?></th>
<td>
<p><label>
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
<?php _e('Your latest posts'); ?>
</label>
</p>
<p><label>
<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
</label>
</p>
@@ -40,30 +40,30 @@ include('admin-header.php');
</p>
</div>
<?php endif; ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<?php endif; ?>
<fieldset class="options">
<legend><?php _e('Blog Pages') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Show at most:') ?></th>
<fieldset class="options">
<legend><?php _e('Blog Pages') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Show at most:') ?></th>
<td>
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend><?php _e('Syndication Feeds') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Show the most recent:') ?></th>
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
<fieldset class="options">
<legend><?php _e('Syndication Feeds') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Show the most recent:') ?></th>
<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('For each article, show:') ?> </th>
@@ -72,25 +72,25 @@ include('admin-header.php');
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
<p><?php _e('Note: If you use the <code>&lt;!--more--&gt;</code> feature, it will cut off posts in RSS feeds.'); ?></p>
</td>
</tr>
</table>
</fieldset>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Encoding for pages and feeds:') ?></th>
</tr>
</table>
</fieldset>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Encoding for pages and feeds:') ?></th>
<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
<?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
<?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
</tr>
</table>
</table>
<p>
<label><input type="checkbox" name="gzipcompression" value="1" <?php checked('1', get_option('gzipcompression')); ?> />
<label><input type="checkbox" name="gzipcompression" value="1" <?php checked('1', get_option('gzipcompression')); ?> />
<?php _e('WordPress should compress articles (gzip) if browsers ask for them') ?></label>
</p>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p>
</form>
</div>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p>
</form>
</div>
<?php include('./admin-footer.php'); ?>

View File

@@ -7,17 +7,17 @@ $parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Writing Options') ?></h2>
<form method="post" action="options.php">
<div class="wrap">
<h2><?php _e('Writing Options') ?></h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
<?php _e('lines') ?></td>
</tr>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<tr valign="top">
<th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
<?php _e('lines') ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Formatting:') ?></th>
<td>
@@ -31,12 +31,11 @@ include('admin-header.php');
<th scope="row"><?php _e('Default post category:') ?></th>
<td><select name="default_category" id="default_category">
<?php
$categories = get_categories('get=all');
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
foreach ($categories as $category) :
$category = sanitize_category($category);
if ($category->term_id == get_option('default_category')) $selected = " selected='selected'";
if ($category->cat_ID == get_option('default_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
endforeach;
?>
</select></td>
@@ -45,12 +44,10 @@ endforeach;
<th scope="row"><?php _e('Default link category:') ?></th>
<td><select name="default_link_category" id="default_link_category">
<?php
$link_categories = get_terms('link_category', 'get=all');
foreach ($link_categories as $category) :
$category = sanitize_term($category, 'link_category');
if ($category->term_id == get_option('default_link_category')) $selected = " selected='selected'";
foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_link_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
endforeach;
?>
</select></td>
@@ -85,7 +82,6 @@ endforeach;
<?php
//Alreay have $categories from default_category
foreach ($categories as $category) :
$category = sanitize_category($category);
if ($category->cat_ID == get_option('default_email_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";

View File

@@ -29,14 +29,15 @@ case 'update':
if ($options) {
foreach ($options as $option) {
$option = trim($option);
$value = $_POST[$option];
if(!is_array($value)) $value = trim($value);
$value = stripslashes_deep($value);
$value = trim($_POST[$option]);
$value = sanitize_option($option, $value); // This does stripslashes on those that need it
update_option($option, $value);
}
}
$referred = remove_query_arg('updated' , wp_get_referer());
$goback = add_query_arg('updated', 'true', wp_get_referer());
$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
wp_redirect($goback);
break;
@@ -81,6 +82,7 @@ foreach ( (array) $options as $option) :
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
echo "</td>
<td>$option->option_description</td>
</tr>";
endforeach;
?>

View File

@@ -10,7 +10,7 @@ require_once('admin-header.php');
?>
<?php if ( (isset($_GET['posted']) && $_GET['posted']) || isset($_GET['saved']) ) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page &raquo;') ; ?></a></p></div>
<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page') ; ?> &raquo;</a></p></div>
<?php endif; ?>
<?php
@@ -23,4 +23,4 @@ if ( current_user_can('edit_pages') ) {
}
?>
<?php include('admin-footer.php'); ?>
<?php include('admin-footer.php'); ?>

View File

@@ -45,8 +45,6 @@ case 'edit':
$page_ID = $post_ID = $p = (int) $_GET['post'];
$post = get_post_to_edit($page_ID);
if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
if ( 'post' == $post->post_type ) {
wp_redirect("post.php?action=edit&post=$post_ID");
exit();
@@ -139,7 +137,7 @@ case 'delete':
if ( ! wp_delete_attachment($page_id) )
wp_die( __('Error in deleting...') );
} else {
if ( !wp_delete_post($page_id) )
if ( !wp_delete_post($page_id) )
wp_die( __('Error in deleting...') );
}

View File

@@ -11,7 +11,7 @@ if ( isset($_GET['action']) ) {
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
wp_die(__('Plugin file does not exist.'));
if (!in_array($plugin, $current)) {
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error
wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error
ob_start();
@include(ABSPATH . PLUGINDIR . '/' . $plugin);
$current[] = $plugin;
@@ -21,15 +21,7 @@ if ( isset($_GET['action']) ) {
ob_end_clean();
}
wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
} elseif ('error_scrape' == $_GET['action']) {
$plugin = trim($_GET['plugin']);
check_admin_referer('plugin-activation-error_' . $plugin);
if ( validate_file($plugin) )
wp_die(__('Invalid plugin.'));
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
wp_die(__('Plugin file does not exist.'));
include(ABSPATH . PLUGINDIR . '/' . $plugin);
} elseif ('deactivate' == $_GET['action']) {
} else if ('deactivate' == $_GET['action']) {
check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
$current = get_option('active_plugins');
array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
@@ -39,12 +31,12 @@ if ( isset($_GET['action']) ) {
} elseif ($_GET['action'] == 'deactivate-all') {
check_admin_referer('deactivate-all');
$current = get_option('active_plugins');
foreach ($current as $plugin) {
array_splice($current, array_search($plugin, $current), 1);
do_action('deactivate_' . $plugin);
}
update_option('active_plugins', array());
wp_redirect('plugins.php?deactivate-all=true');
}
@@ -81,15 +73,7 @@ foreach ($check_plugins as $check_plugin) {
?>
<?php if ( isset($_GET['error']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
<?php
$plugin = trim($_GET['plugin']);
if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) && 1 == strtolower(ini_get('display_errors'))) { ?>
<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($plugin); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
<?php
}
?>
</div>
<div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p></div>
<?php elseif ( isset($_GET['activate']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
<?php elseif ( isset($_GET['deactivate']) ) : ?>
@@ -152,20 +136,17 @@ if (empty($plugins)) {
else
$edit = '';
$author = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
echo "
<tr $style>
<td class='name'>{$plugin_data['Title']}</td>
<td class='vers'>{$plugin_data['Version']}</td>
<td class='desc'><p>{$plugin_data['Description']}$author</p></td>
<td class='desc'><p>{$plugin_data['Description']} <cite>".sprintf(__('By %s'), $plugin_data['Author']).".</cite></p></td>
<td class='togl'>$toggle</td>";
if ( current_user_can('edit_plugins') )
echo "
<td>$edit</td>";
echo"
</tr>";
do_action( 'after_plugin_row', $plugin_file );
}
?>

View File

@@ -10,7 +10,7 @@ require_once ('./admin-header.php');
if ( ! current_user_can('edit_posts') ) { ?>
<div class="wrap">
<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />
You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?>
</p>
@@ -21,65 +21,34 @@ When you&#8217;re promoted, just reload this page and you&#8217;ll be able to bl
}
if ( isset($_GET['posted']) && $_GET['posted'] ) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post &raquo;'); ?></a></p></div>
<div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?> &raquo;</a></p></div>
<?php
endif;
?>
if ( $drafts = get_users_drafts( $user_ID ) ) { ?>
<div class="wrap">
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
$my_drafts = get_users_drafts($user_ID);
$pending = get_others_pending($user_ID);
$others_drafts = get_others_drafts($user_ID);
$nag_posts_limit = (int) apply_filters('nag_posts_limit', 3);
$nag_posts = array(
array(
'my_drafts',
__('Your Drafts:'),
'edit.php?post_status=draft&amp;author=' . $user_ID,
count($my_drafts)),
array(
'pending',
__('Pending Review:'),
'edit.php?post_status=pending',
count($pending)),
array(
'others_drafts',
__('Others&#8217; Drafts:'),
'edit.php?post_status=draft&author=-' . $user_ID,
count($others_drafts))
);
if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) {
echo '<div class="wrap" id="draft-nag">';
foreach ( $nag_posts as $nag ) {
if ( ${$nag[0]} ) {
echo '<p><strong>' . wp_specialchars($nag[1]) . '</strong> ';
$i = 0;
foreach ( ${$nag[0]} as $post ) {
$i++;
if ( $i > $nag_posts_limit )
break;
echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
( '' == the_title('', '', FALSE) ) ? printf( __('Post #%s'), $post->ID ) : the_title();
echo '</a>';
if ( $i < min($nag[3], $nag_posts_limit) )
echo ', ';
}
if ( $nag[3] > $nag_posts_limit )
printf(__(', and <a href="%s">%d more</a>'), $nag[2], $nag[3] - $nag_posts_limit);
echo '.</p>';
}
// Show drafts.
$num_drafts = count($drafts);
if ( $num_drafts > 15 ) $num_drafts = 15;
for ( $i = 0; $i < $num_drafts; $i++ ) {
$draft = $drafts[$i];
if ( 0 != $i )
echo ', ';
if ( empty($draft->post_title) )
$draft->post_title = sprintf(__('Post # %s'), $draft->ID);
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
}
echo "</div>\n";
}
?>
if ( 15 < count($drafts) ) { ?>
, <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> &raquo;</a>
<?php } ?>
.</p>
</div>
<?php
}
// Show post form.
$post = get_default_post_to_edit();
include('edit-form-advanced.php');
@@ -88,17 +57,17 @@ include('edit-form-advanced.php');
<?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?>
<div id="wp-bookmarklet" class="wrap">
<h3><?php _e('WordPress Bookmarklet'); ?></h3>
<p><?php _e('Right click on the following link and choose &#0147;Bookmark This Link...&#0148; or &#0147;Add to Favorites...&#0148; to create a posting shortcut.'); ?></p>
<p><?php _e('Right click on the following link and choose "Add to favorites" to create a posting shortcut.'); ?></p>
<p>
<?php
if ($is_NS4 || $is_gecko) {
?>
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), get_bloginfo('name', 'display')); ?></a>
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_option('blogname'))); ?></a>
<?php
} else if ($is_winIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_bloginfo('name', 'display')); ?></a>
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
<script type="text/javascript">
<!--
function oneclickbookmarklet(blah) {
@@ -109,15 +78,15 @@ window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=50
<br />
<br />
<?php _e('One-click bookmarklet:') ?><br />
<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
<?php
} else if ($is_opera) {
?>
<a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
<a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
<?php
} else if ($is_macIE) {
?>
<a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
<a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
<?php
}
?>

View File

@@ -38,9 +38,6 @@ case 'post':
if ( isset($_POST['save']) )
$location = "post.php?action=edit&post=$post_ID";
if ( empty($post_ID) )
$location = 'post-new.php';
wp_redirect($location);
exit();
break;
@@ -51,8 +48,6 @@ case 'edit':
$post_ID = $p = (int) $_GET['post'];
$post = get_post($post_ID);
if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
if ( 'page' == $post->post_type ) {
wp_redirect("page.php?action=edit&post=$post_ID");
exit();
@@ -154,7 +149,7 @@ case 'delete':
if ( ! wp_delete_attachment($post_id) )
wp_die( __('Error in deleting...') );
} else {
if ( !wp_delete_post($post_id) )
if ( !wp_delete_post($post_id) )
wp_die( __('Error in deleting...') );
}

View File

@@ -39,23 +39,23 @@ $bookmarklet_height= 440;
<p class="submit"><input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" /></p>
<fieldset id="information">
<fieldset>
<legend><?php _e('Name'); ?></legend>
<p><label><?php _e('Username: (no editing)'); ?><br />
<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" />
</label></p>
<p><label><?php _e('First name:') ?><br />
<input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
<p><label><?php _e('Last name:') ?><br />
<input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p>
<input type="text" name="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p>
<p><label><?php _e('Nickname:') ?><br />
<input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
<p><label><?php _e('Display name publicly as:') ?> <br />
<select name="display_name" id="display_name">
<select name="display_name">
<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>
<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>
<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>
@@ -72,47 +72,47 @@ $bookmarklet_height= 440;
</select></label></p>
</fieldset>
<fieldset id="contact-info">
<fieldset>
<legend><?php _e('Contact Info'); ?></legend>
<p><label><?php _e('E-mail: (required)') ?><br />
<input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
<p><label><?php _e('Website:') ?><br />
<input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" />
<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" />
</label></p>
<p><label><?php _e('AIM:') ?><br />
<input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" />
<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" />
</label></p>
<p><label><?php _e('Yahoo IM:') ?><br />
<input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" />
<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
</label></p>
<p><label><?php _e('Jabber / Google Talk:') ?><br />
<input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
</p>
</fieldset>
<br clear="all" />
<fieldset id="about-yourself">
<fieldset>
<legend><?php _e('About Yourself'); ?></legend>
<p class="desc"><?php _e('Share a little biographical information. '); ?></p>
<p><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
</fieldset>
<?php
$show_password_fields = apply_filters('show_password_fields', true);
if ( $show_password_fields ) :
?>
<fieldset id="update-password">
<fieldset>
<legend><?php _e('Update Your Password'); ?></legend>
<p class="desc"><?php _e('If you would like to change your password type a new one twice below. Otherwise leave this blank.'); ?></p>
<p><label><?php _e('New Password:'); ?><br />
<input type="password" name="pass1" id="pass1" size="16" value="" />
<input type="password" name="pass1" size="16" value="" />
</label></p>
<p><label><?php _e('Type it one more time:'); ?><br />
<input type="password" name="pass2" id="pass2" size="16" value="" />
<input type="password" name="pass2" size="16" value="" />
</label></p>
</fieldset>
<?php endif; ?>

View File

@@ -1,133 +1,247 @@
html,
.dbx-handle,
#post_name,
input[name=link_url],
input[name=link_image],
input[name=opml_url],
input[name=file],
input#rss_uri,
#template #newcontent,
#devnews,
#planetnews,
#content,
body.login #login a,
#newcomment_author_url,
#email {
direction: ltr;
#viewarc, #viewcat, #namediv, #emaildiv, #uridiv, #planetnews li, #login ul li, #your-profile fieldset, #footer .logo, .alignleft .available-theme {
float: right;
}
#adminmenu,
#submenu,
#minisub,
.wrap,
.updated,
.confirm,
#devnews h3,
#planetnews h3,
#wphead,
#user_info,
body.login,
#login_error {
direction: rtl;
#templateside, .alignright {
float: left;
}
p.submit,
.dbx-handle {
#login #send, .readmore, .widefat th {
text-align: right;
}
#postcustomsubmit, form#upload th, .submit, .editform th {
text-align: left;
}
html *,
select,
input,
table * {
font-family: tahoma, Tahoma, "Times New Roman", Times, serif;
#devnews h4, #wphead h1, #your-profile legend, fieldset.options legend, #planetnews li .post {
font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
}
#wphead {
padding: .8em 2em .8em 19em;
}
#user_info {
right: auto;
left: 1em;
#wphead h1 {
font-size: 2.4em;
}
#postdiv, #titlediv, #guiddiv, #tagdiv {
margin: 0 0 0 8px;
}
#ed_toolbar input {
margin: 3px 0 2px 2px;
}
#edButtons input, #edButtons input:active {
margin: 0px 0 -1px 2px;
}
body, td {
font: 13px Tahoma, "Lucida Grande", "Lucida Sans Unicode", Verdana;
}
h1, h2, h3, h4, h5 {
font-family: "Times New Roman", Times, serif;
}
h3.dbx-handle {
font-family: tahoma, Verdana, Arial, Helvetica, sans-serif;
}
textarea, input, select {
font: 13px Tahoma, Verdana, Arial, Helvetica, sans-serif;
}
.quicktags, .search {
font: 12px Tahoma, Georgia, "Times New Roman", Times, serif;
}
.updated, .confirm {
padding: 0 3em 0 1em;
}
.submit input, .submit input:focus, .button, .button:focus {
border-left-color: #999;
border-right-color: #ccc;
}
.submit input:active, .button:active {
border-left-color: #ccc;
border-right-color: #999;
}
#adminmenu {
padding: .2em 2em .3em .2em;
height: 28px;
}
* html #adminmenu {
padding-bottom: 0;
}
#adminmenu a {
margin: 0 0 0 10px;
display: block;
float: right;
font: 700 16px/130% "Times New Roman", Times, serif;
}
#adminmenu a.current {
border-right: 0;
border-left: 2px solid #4f96c8;
}
#submenu, #minisub {
padding: 1px 3em 0 2em;
}
#submenu {
height: 28px;
}
#submenu a {
margin: 0 0 0 10px;
display: block;
float: right;
line-height: 155%;
}
#submenu .current {
border-right: 0;
border-left: 2px solid #045290;
}
.dbx-content input, .dbx-content select {
margin-right: 8px;
}
#newcat {
width: 100px;
}
.updated, .confirm {
background-position: 98.5%;
padding: 0 3em 0 1em;
}
.page-numbers {
#currenttheme img {
float: right;
margin-right: auto;
margin-left: 3px;
margin-left: 1em;
}
.wrap ul {
margin-right: 45%;
margin-left: 0;
#postdiv #quicktags {
padding-right: 0;
padding-left: 6px;
}
* html .wrap ul {
margin-right: 50%;
.readmore {
margin-right: auto;
margin-left: 5em;
}
.wrap h2 {
font-family: "Times New Roman", Times, serif;
#postexcerpt div, #attachmentlinks div {
margin-right: auto;
margin-left: 8px;
}
* html #postexcerpt .dbx-toggle-open {
padding-right: 0;
padding-left: 8px;
}
#searchform {
float: right;
margin-right: auto;
margin-left: 1em;
}
#poststuff {
margin-right: auto;
margin-left: 16em;
}
#template div {
margin-right: auto;
margin-left: 190px;
}
* html #template div {
margin-right: auto;
margin-left: 0px;
}
#user_info {
right: auto;
left: 1em;
}
#zeitgeist {
float: left;
margin-left: auto;
margin-right: 1em;
}
#zeitgeist ul {
margin: 0 .6em .3em 0;
padding: 0 .6em 0 0;
}
.wrap ul {
margin-left: 500px;
}
#categorydiv ul {
margin-left: auto;
margin-right: 10px;
}
a.view-link {
left: 6%;
#moremeta {
margin-right: 0;
margin-left: 15px;
right: auto;
left: 6%;
}
#moremeta .dbx-content {
background: url(images/box-butt.gif) no-repeat bottom left;
padding-right: 10px;
padding-left: 0;
text-align: right;
}
#moremeta .dbx-handle {
background: #2685af url(images/box-head.gif) no-repeat left;
margin-top: -2px;
}
#moremeta .dbx-box {
background: url(images/box-bg.gif) repeat-y left;
padding-bottom: 0;
}
a.dbx-toggle, a.dbx-toggle:visited {
right: auto;
left: 2px;
}
#categorychecklist {
margin-right: auto;
margin-left: 6px;
}
#postdiv #quicktags {
padding-right: 0;
padding-left: 6px;
margin-right: 0;
#ajax-response.alignleft {
margin-left: auto;
margin-right: 2em;
}
.options ul {
margin-right: 0;
#postdivrich #edButtons {
padding-left: 0;
padding-right: 3px;
}
*form#template > div > textarea#newcontent {
margin-right: -300px;
width: 107%;
.page-numbers {
margin-right: auto;
margin-left: 3px;
}
a.view-link {
right:auto;
left:5%;
margin-right:0;
margin-left:220px;
}
#advancedstuff {
direction: ltr;
}
#advancedstuff .dbx-handle {
text-align: right;
}
#advancedstuff .dbx-content * {
direction: rtl;
}

View File

@@ -1,29 +1,19 @@
<?php
define('WP_INSTALLING', true);
require_once('../wp-includes/compat.php');
require_once('../wp-includes/functions.php');
require_once('../wp-includes/classes.php');
if (!file_exists('../wp-config-sample.php'))
wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
$configFile = file('../wp-config-sample.php');
if ( !is_writable('../'))
wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
// Check if wp-config.php has been created
if (file_exists('../wp-config.php'))
wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
if (isset($_GET['step']))
$step = $_GET['step'];
else
$step = 0;
function display_header(){
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -86,11 +76,12 @@ function display_header(){
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php
}//end function display_header();
// Check if wp-config.php has been created
if (file_exists('../wp-config.php'))
die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p></body></html>");
switch($step) {
case 0:
display_header();
?>
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
@@ -107,7 +98,6 @@ switch($step) {
break;
case 1:
display_header();
?>
</p>
<form method="post" action="setup-config.php?step=2">
@@ -162,9 +152,6 @@ switch($step) {
// We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php');
if ( !empty($wpdb->error) )
wp_die($wpdb->error->get_error_message());
$handle = fopen('../wp-config.php', 'w');
foreach ($configFile as $line_num => $line) {
@@ -190,8 +177,6 @@ switch($step) {
}
fclose($handle);
chmod('../wp-config.php', 0666);
display_header();
?>
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
<?php

View File

@@ -13,7 +13,7 @@ if ('b' == $_GET['a']) {
<head>
<title>WordPress &#8250; Posted</title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
<?php wp_admin_css(); ?>
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
</head>
<body>
<p>Posted !</p>
@@ -28,7 +28,7 @@ if ('b' == $_GET['a']) {
<head>
<title>WordPress &#8250; Sidebar</title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
<?php wp_admin_css(); ?>
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<style type="text/css" media="screen">
form {
padding: 3px;

View File

@@ -97,7 +97,7 @@ default:
</form>
</div>
<div class="wrap">
<div class="wrap">
<?php
if ( is_writeable($real_file) ) {
echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file_show) . '</h2>';

View File

@@ -40,7 +40,7 @@ $ct = current_theme_info();
<?php if ( $ct->screenshot ) : ?>
<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
<?php endif; ?>
<h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3>
<p><?php echo $ct->description; ?></p>
<?php if ($ct->parent_theme) { ?>
<p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
@@ -69,10 +69,10 @@ foreach ($theme_names as $theme_name) {
$author = $themes[$theme_name]['Author'];
$screenshot = $themes[$theme_name]['Screenshot'];
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet", 'switch-theme_' . $template);
?>
<div class="available-theme">
<h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3>
<a href="<?php echo $activate_link; ?>" class="screenshot">
<?php if ( $screenshot ) : ?>

View File

@@ -1,5 +1,5 @@
<?php
require_once('../wp-config.php');
require_once( dirname( dirname(__FILE__) ) . '/wp-config.php');
require_once( ABSPATH . 'wp-includes/class-snoopy.php');
if ( !get_option('use_linksupdate') )

File diff suppressed because it is too large Load Diff

View File

@@ -10,29 +10,18 @@ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
$charset_collate .= " COLLATE $wpdb->collate";
}
$wp_queries="CREATE TABLE $wpdb->terms (
term_id bigint(20) NOT NULL auto_increment,
name varchar(55) NOT NULL default '',
slug varchar(200) NOT NULL default '',
term_group bigint(10) NOT NULL default 0,
PRIMARY KEY (term_id),
UNIQUE KEY slug (slug)
) $charset_collate;
CREATE TABLE $wpdb->term_taxonomy (
term_taxonomy_id bigint(20) NOT NULL auto_increment,
term_id bigint(20) NOT NULL default 0,
taxonomy varchar(32) NOT NULL default '',
description longtext NOT NULL,
parent bigint(20) NOT NULL default 0,
count bigint(20) NOT NULL default 0,
PRIMARY KEY (term_taxonomy_id),
UNIQUE KEY term_id_taxonomy (term_id,taxonomy)
) $charset_collate;
CREATE TABLE $wpdb->term_relationships (
object_id bigint(20) NOT NULL default 0,
term_taxonomy_id bigint(20) NOT NULL default 0,
PRIMARY KEY (object_id,term_taxonomy_id),
KEY term_taxonomy_id (term_taxonomy_id)
$wp_queries="CREATE TABLE $wpdb->categories (
cat_ID bigint(20) NOT NULL auto_increment,
cat_name varchar(55) NOT NULL default '',
category_nicename varchar(200) NOT NULL default '',
category_description longtext NOT NULL,
category_parent bigint(20) NOT NULL default '0',
category_count bigint(20) NOT NULL default '0',
link_count bigint(20) NOT NULL default '0',
posts_private tinyint(1) NOT NULL default '0',
links_private tinyint(1) NOT NULL default '0',
PRIMARY KEY (cat_ID),
KEY category_nicename (category_nicename)
) $charset_collate;
CREATE TABLE $wpdb->comments (
comment_ID bigint(20) unsigned NOT NULL auto_increment,
@@ -54,6 +43,13 @@ CREATE TABLE $wpdb->comments (
KEY comment_approved (comment_approved),
KEY comment_post_ID (comment_post_ID)
) $charset_collate;
CREATE TABLE $wpdb->link2cat (
rel_id bigint(20) NOT NULL auto_increment,
link_id bigint(20) NOT NULL default '0',
category_id bigint(20) NOT NULL default '0',
PRIMARY KEY (rel_id),
KEY link_id (link_id,category_id)
) $charset_collate;
CREATE TABLE $wpdb->links (
link_id bigint(20) NOT NULL auto_increment,
link_url varchar(255) NOT NULL default '',
@@ -77,11 +73,24 @@ CREATE TABLE $wpdb->options (
option_id bigint(20) NOT NULL auto_increment,
blog_id int(11) NOT NULL default '0',
option_name varchar(64) NOT NULL default '',
option_can_override enum('Y','N') NOT NULL default 'Y',
option_type int(11) NOT NULL default '1',
option_value longtext NOT NULL,
option_width int(11) NOT NULL default '20',
option_height int(11) NOT NULL default '8',
option_description tinytext NOT NULL,
option_admin_level int(11) NOT NULL default '1',
autoload enum('yes','no') NOT NULL default 'yes',
PRIMARY KEY (option_id,blog_id,option_name),
KEY option_name (option_name)
) $charset_collate;
CREATE TABLE $wpdb->post2cat (
rel_id bigint(20) NOT NULL auto_increment,
post_id bigint(20) NOT NULL default '0',
category_id bigint(20) NOT NULL default '0',
PRIMARY KEY (rel_id),
KEY post_id (post_id,category_id)
) $charset_collate;
CREATE TABLE $wpdb->postmeta (
meta_id bigint(20) NOT NULL auto_increment,
post_id bigint(20) NOT NULL default '0',
@@ -100,7 +109,7 @@ CREATE TABLE $wpdb->posts (
post_title text NOT NULL,
post_category int(4) NOT NULL default '0',
post_excerpt text NOT NULL,
post_status enum('publish','draft','private','static','object','attachment','inherit','future', 'pending') NOT NULL default 'publish',
post_status enum('publish','draft','private','static','object','attachment','inherit','future') NOT NULL default 'publish',
comment_status enum('open','closed','registered_only') NOT NULL default 'open',
ping_status enum('open','closed') NOT NULL default 'open',
post_password varchar(20) NOT NULL default '',
@@ -132,8 +141,7 @@ CREATE TABLE $wpdb->users (
user_status int(11) NOT NULL default '0',
display_name varchar(250) NOT NULL default '',
PRIMARY KEY (ID),
KEY user_login_key (user_login),
KEY user_nicename (user_nicename)
KEY user_login_key (user_login)
) $charset_collate;
CREATE TABLE $wpdb->usermeta (
umeta_id bigint(20) NOT NULL auto_increment,
@@ -150,9 +158,10 @@ function populate_options() {
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
add_option('siteurl', $guessurl);
add_option('blogname', __('My Blog'));
add_option('blogdescription', __('Just another WordPress weblog'));
add_option('siteurl', $guessurl, __('WordPress web address'));
add_option('blogname', __('My Weblog'), __('Blog title'));
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
add_option('new_users_can_blog', 0);
add_option('users_can_register', 0);
add_option('admin_email', 'you@example.com');
add_option('start_of_week', 1);
@@ -197,7 +206,7 @@ function populate_options() {
add_option('comment_max_links', 2);
add_option('gmt_offset', date('Z') / 3600);
// 1.5
add_option('default_email_category', 1);
add_option('default_email_category', 1, __('Posts by email go to this category'));
add_option('recently_edited');
add_option('use_linksupdate', 0);
add_option('template', 'default');
@@ -231,9 +240,6 @@ function populate_options() {
add_option('default_link_category', 2);
add_option('show_on_front', 'posts');
// 2.2
add_option('tag_base');
// Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing');
foreach ($unusedoptions as $option) :
@@ -250,7 +256,6 @@ function populate_options() {
function populate_roles() {
populate_roles_160();
populate_roles_210();
populate_roles_230();
}
function populate_roles_160() {
@@ -384,12 +389,4 @@ function populate_roles_210() {
}
}
function populate_roles_230() {
$role = get_role( 'administrator' );
if ( !empty( $role ) ) {
$role->add_cap( 'unfiltered_upload' );
}
}
?>
?>

View File

@@ -5,20 +5,23 @@ if (!file_exists('../wp-config.php'))
require('../wp-config.php');
timer_start();
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
if (isset($_GET['step']))
$step = (int) $_GET['step'];
else
$step = 0;
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php _e('WordPress &rsaquo; Upgrade'); ?></title>
<?php wp_admin_css( 'css/install' ); ?>
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/install.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/install-rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php endif; ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
@@ -36,7 +39,7 @@ switch($step) :
?>
<h2><?php _e('Database Upgrade Required'); ?></h2>
<p><?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?></p>
<p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
<p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
<?php
break;
@@ -47,7 +50,7 @@ switch($step) :
$backto = __get_option('home') . '/';
else
$backto = clean_url(stripslashes($_GET['backto']));
?>
?>
<h2><?php _e('Upgrade Complete'); ?></h2>
<p><?php _e('Your WordPress database has been successfully upgraded!'); ?></p>
<h2 class="step"><a href="<?php echo $backto; ?>"><?php _e('Continue &raquo;'); ?></a></h2>

View File

@@ -1,13 +1,11 @@
<?php
function wp_upload_display( $dims = false, $href = '' ) {
global $post;
$id = get_the_ID();
$attachment_data = wp_get_attachment_metadata( $id );
$is_image = (int) wp_attachment_is_image();
$filesystem_path = get_attached_file( $id );
if ( !isset($attachment_data['width']) && $is_image ) {
if ( $image_data = getimagesize( $filesystem_path ) ) {
if ( $image_data = getimagesize( get_attached_file( $id ) ) ) {
$attachment_data['width'] = $image_data[0];
$attachment_data['height'] = $image_data[1];
wp_update_attachment_metadata( $id, $attachment_data );
@@ -16,7 +14,10 @@ function wp_upload_display( $dims = false, $href = '' ) {
if ( isset($attachment_data['width']) )
list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
$post_title = attribute_escape( the_title( '', '', false ) );
ob_start();
the_title();
$post_title = attribute_escape(ob_get_contents());
ob_end_clean();
$post_content = attribute_escape(apply_filters( 'content_edit_pre', $post->post_content ));
$class = 'text';
@@ -31,9 +32,6 @@ function wp_upload_display( $dims = false, $href = '' ) {
$src = wp_make_link_relative( $src_base );
$src_base = str_replace($src, '', $src_base);
if ( !trim($post_title) )
$post_title = basename($src);
$r = '';
if ( $href )
@@ -42,9 +40,6 @@ function wp_upload_display( $dims = false, $href = '' ) {
$r .= "\t\t\t$innerHTML";
if ( $href )
$r .= "</a>\n";
$size = @filesize($filesystem_path);
if ( !empty($size) )
$r .= "\t\t\t\t<span class='upload-file-size'>".size_format($size)."</span>\n";
$r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n";
@@ -177,7 +172,7 @@ function wp_upload_form() {
<?php endif; ?>
<?php wp_nonce_field( 'inlineuploading' ); ?>
<div class="submit">
<input type="submit" value="<?php $id ? _e('Save &raquo;') : _e('Upload &raquo;'); ?>" />
<input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> &raquo;" />
</div>
</td>
</tr>
@@ -227,7 +222,7 @@ function wp_upload_tab_upload_action() {
// Construct the attachment array
$attachment = array(
'post_title' => $post_title,
'post_title' => $post_title ? $post_title : $filename,
'post_content' => $post_content,
'post_type' => 'attachment',
'post_parent' => $post_id,
@@ -289,7 +284,7 @@ function wp_upload_posts_where( $where ) {
}
function wp_upload_tab_browse() {
global $action, $paged;
global $wpdb, $action, $paged;
$old_vars = compact( 'paged' );
switch ( $action ) :
@@ -306,7 +301,11 @@ function wp_upload_tab_browse() {
add_action( 'pre_get_posts', 'wp_upload_grab_attachments' );
if ( 'browse' == $tab && $post_id )
add_filter( 'posts_where', 'wp_upload_posts_where' );
$attachments = query_posts("what_to_show=posts&post_status=any&posts_per_page=10&paged=$paged");
$attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged");
$count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'";
if ( $post_id )
$count_query .= " AND post_parent = '$post_id'";
$total = $wpdb->get_var($count_query);
echo "<ul id='upload-files'>\n";
if ( have_posts() ) : while ( have_posts() ) : the_post();
@@ -344,7 +343,10 @@ add_action( 'upload_files_browse', 'wp_upload_tab_browse_action' );
add_action( 'upload_files_browse-all', 'wp_upload_tab_browse_action' );
function wp_upload_admin_head() {
wp_admin_css( 'css/upload' );
global $wp_locale;
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
if ( 'rtl' == $wp_locale->text_direction )
echo "<link rel='stylesheet' href='" . get_option('siteurl') . '/wp-admin/upload-rtl.css?version=' . get_bloginfo('version') . "a' type='text/css' />\n";
if ( 'inline' == @$_GET['style'] ) {
echo "<style type='text/css' media='screen'>\n";
echo "\t#upload-menu { position: absolute; z-index: 2; }\n";
@@ -355,4 +357,4 @@ function wp_upload_admin_head() {
}
}
?>
?>

50
wp-admin/upload-rtl.css Normal file
View File

@@ -0,0 +1,50 @@
#upload-menu li a.upload-tab-link {
float: right;
margin: 0 .75em 0 0;
}
table { float: right; }
#upload-menu li #current-tab-nav {
float: right;
padding: 5px 0 0 5px;
margin-right: -5px;
}
#upload-file th, #the-attachment-links textarea { text-align: left; }
h2 { margin: 0 0 0 .2em; }
#upload-files li { margin: 0 15px 15px 0; }
#upload-file-view { padding: 0 75px 0 0; }
#upload-menu li {
display: block;
float: right;
}
#upload-menu li.current {
border-right: 0;
border-left: 2px solid #448abd;
}
#upload-file {
left: auto;
right: 0;
}
#file-title {
margin: 0 75px .2em 0;
font-family: Tahoma, Georgia, "Times New Roman", Times, serif;
}
.back {
left: auto;
right: 14px;
}
#uploadoptions td {
padding-left: 0;
padding-right: 1em;
}

Some files were not shown because too many files have changed in this diff Show More