Compare commits

..

265 Commits
2.2.3 ... 2.0.6

Author SHA1 Message Date
matt
4aa6902a9c I hear tagging is hip
git-svn-id: http://svn.automattic.com/wordpress/tags/2.0.6@4683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-01-06 04:24:41 +00:00
markjaquith
94bf4acfc0 Change wording for Blogger import to note that it only works with OLD Blogger accounts. Props foolswisdom. fixes #3490
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-01-05 08:46:27 +00:00
markjaquith
92a6143e65 2.0.6 ump-bay
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-01-05 08:39:45 +00:00
markjaquith
1d58dcdcba Delay Trackback data escaping until after mb_convert_encoding(). Props to Stefan Esser.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-01-05 05:46:01 +00:00
ryan
b1b79a5ebd Add kses protocol checking to clean_url. Props Andy. fixes #3515
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-01-02 21:22:41 +00:00
ryan
8f8cb400d1 RC2
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-28 17:44:00 +00:00
markjaquith
fbd8f67ffd wp_specialchars() treatment for recent file list
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-27 05:59:20 +00:00
markjaquith
bf83dbd55f Sync balanceTags() and force_balance_tags() to trunk. fixes #2714
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-23 06:33:24 +00:00
ryan
70902a4e04 Add js_escape and attribute_escape filters.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-22 05:27:45 +00:00
markjaquith
3495490d2f Whitespace cleanup for [4656]
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-21 10:45:58 +00:00
markjaquith
be708ef9a7 new function for escaping within attributes: attribute_escape()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-21 10:10:04 +00:00
ryan
8ca9789e29 kses function reorg to match trunk.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-21 01:54:15 +00:00
markjaquith
e0bf270665 Let my candidate go!
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-15 18:50:55 +00:00
markjaquith
6fd3cacaa2 _() => __() typo fix. props tai. fixes #1540
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-11 21:24:02 +00:00
markjaquith
d308d88f46 Enable quicktags for Safari. Props mattyrob. fixes #3051
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-10 22:26:40 +00:00
markjaquith
07d1b2759f Revert overzealous i18n from [4545]. Props nbachiyski. fixes #3438
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-10 00:23:10 +00:00
markjaquith
988e4018fa Don't dbxize wrappers. Props andy. fixes #2987
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-08 22:40:05 +00:00
markjaquith
709bdc5d9a Add überpowerful "query" filter, for SQL queries. fixes #2721
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-07 00:02:24 +00:00
markjaquith
49cb0def04 trailingslashit() fix for paged posts links from activeingredient. fixes #3163
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-04 14:45:08 +00:00
markjaquith
1a3f75b48a change post_parent on orphaned attachments. props ryanscheuermann. fixes #2681
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-04 14:31:09 +00:00
markjaquith
4c99f09227 To beta, or not to beta... this joke sounds best in the U.K. (BEE-tah)
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-04 12:58:47 +00:00
ryan
16f9581218 Fix pregs. Props Mordred.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-12-01 22:42:14 +00:00
ryan
fd47a416c5 Can't pass function return to array_shift.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-30 07:31:21 +00:00
ryan
f5d26b3033 gettext date format strings in wp_get_archives. fixes #1540
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-29 21:34:51 +00:00
ryan
b6f11d1a09 Filter post_content_filtered
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-25 17:54:41 +00:00
markjaquith
d198bc8c34 Avoid confusion: next version in 2.0 branch will be 2.0.6
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-25 06:53:18 +00:00
markjaquith
c699a495a1 ID fixes to allow label clicking in the moderation queue, from JeremyVisser. fixes #3391
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-25 06:37:24 +00:00
ryan
0c3ff47735 Include post_content_filtered in queries to comply with MySQL strict mode. fixes #3112
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-25 06:30:05 +00:00
markjaquith
57ff8770c0 trying Ryan's suggestion for #3215
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-22 04:59:31 +00:00
ryan
4411066167 Handle empty authors list. Props MichaelH. fixes #2384
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-19 08:05:46 +00:00
ryan
d0cc33e98e Quote strings in SQL with single quotes instead of double quotes to be more correct and consistent. Props WillemGrooters. fixes #3367
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-19 07:41:12 +00:00
ryan
440297d7a8 Reg singletons.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-19 00:16:27 +00:00
markjaquith
22ad434597 silence the fopen() in wp_remote_fopen()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-15 22:47:17 +00:00
markjaquith
00c98cc513 Set extract type and rename car to avoid overwrites (backport from trunk [4469])
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-15 22:29:20 +00:00
markjaquith
27da557de4 backport of post-redirect exit() fixes from [4467] and [4468]
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-15 22:23:43 +00:00
markjaquith
0c771d5595 You have rah-ceived a bimp. One could get a concussion from such a bimp.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-27 22:37:52 +00:00
markjaquith
7fbee06616 Database bump needed to add the post_status key for existing installs. Props Brian Layman. fixes #3170
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-27 04:13:20 +00:00
markjaquith
22a0270310 Treat those chars specially, and sanitize inline-uploading params
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-23 05:54:54 +00:00
markjaquith
fde479b704 Cast to array in xmlrpc.php. fixes #3266
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-21 10:41:43 +00:00
markjaquith
8a46b9e8c2 Questions should have question marks. Props Viper007Bond. Partially addresses: #3263
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-20 16:18:11 +00:00
markjaquith
d0e056c717 Saving the default-category behavior change for 2.1
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-18 21:42:23 +00:00
markjaquith
fbfe5360e9 Alex, I'll take 'things that go bump in the night' for 00
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-17 20:21:13 +00:00
markjaquith
2d8ad48991 Only run stripslashes() on strings in update_usermeta(). Props stm. fixes #3240
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-14 05:35:27 +00:00
markjaquith
6651c29d96 fix function name error in last two commits. fixes #3228
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-13 06:08:27 +00:00
markjaquith
3d71ec4384 make_clickable() now faster and supports more link positions, from mdawaffe and myself. fixes #3228
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-13 06:01:14 +00:00
markjaquith
2e621f422f Prevent users from entering strings that will be interpreted as serialized arrays/objects on the way out. fixes #2591
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-13 00:24:51 +00:00
markjaquith
bd9c700f79 Display postmeta correctly
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-11 10:52:17 +00:00
markjaquith
9e9f4de19f Post meta caching fix by mdawaffe. fixes #3229
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-11 09:19:10 +00:00
markjaquith
d0de38aacc the_meta() should ignore keys that start with an underscore. Props Nazgul. fixes #2478
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-10 05:29:08 +00:00
markjaquith
3af6f3bfd9 Less run-on first comment. fixes #3196
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-10 04:48:59 +00:00
markjaquith
5770b65295 Order get_editable_authors() by display_name. Props Paolo Gabrielli. fixes #2370
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-10 04:16:27 +00:00
markjaquith
278d36bc89 avoid double time offset in calendar. props to priv. fixes #2189
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-06 11:24:26 +00:00
markjaquith
23ddeba64d allow timer_stop() to use number_format() when returning. Props mdawaffe and nbachiyski. fixes #991
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 22:00:26 +00:00
markjaquith
a7050af4f7 Better tabbing and newlining for RSS categories. Props coffee2code and Nazgul. fixes #1156
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 21:46:54 +00:00
markjaquith
a70ccb1336 cast to array. fixes 2331
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 21:40:06 +00:00
markjaquith
1b40159dc4 CSS and consistency fixes for options.php
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 12:57:34 +00:00
markjaquith
09b8472832 Prevent non-option form elements from sneaking in to the options table. fixes #2595
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 12:19:05 +00:00
markjaquith
5014cbb45c preserve multi-line options in options.php. Props Viper007Bond. fixes #2456
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 11:28:52 +00:00
markjaquith
e464b28558 cast to array in retrospaminator. Props mdawaffe. fixes #2745
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 10:58:32 +00:00
markjaquith
b5b10e358d move plugin sorting (by Name) to get_plugins() so that it works for the Edit Plugins page too. fixes: #2412
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 09:35:25 +00:00
markjaquith
8bd0a19b46 sort plugins by plugin name, for real. fixes #2412
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 08:57:03 +00:00
markjaquith
27a756db3b Strip out British pound sterling (pound) symbol from post slug. fixes #2735
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 07:51:01 +00:00
markjaquith
e219fa9656 Better notice and link after post/page saving. Props mdawaffe. fixes #1690
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 07:47:20 +00:00
markjaquith
6b08dcf49f Refrain from reading files of 0 length. Props technosailor. fixes #1999
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 07:34:55 +00:00
markjaquith
6d48598e84 default category starts out unchecked. Props Viper007Bond. fixes #2938
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 06:17:22 +00:00
markjaquith
c414f577d5 Allow user replacement of cockney replacement array. fixes #1032
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 06:08:06 +00:00
markjaquith
85cb3060e7 avoid $HTTP_RAW_POST_DATA notices. props mgeisler and Nazgul. fixes #1494
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 05:23:23 +00:00
markjaquith
8cedbe992c Clarify comment_max_links option text. Props chrisdolan and Nazgul. fixes 1397
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 05:07:01 +00:00
markjaquith
ab408f48b3 remove unused mkdir_p() function. props Nazgul. fixes #3079
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 04:54:32 +00:00
markjaquith
beece40a1c comment link counting improvements from Nazgul. fixes: #938
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 04:45:22 +00:00
markjaquith
5c0b777a29 Better phrasing for date format text. Props abhay and zedlander. fixes: #2602
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 04:37:11 +00:00
markjaquith
cd8787c026 pass incoming Technorati links through wptexturize(). Props Nazgul. fixes: #2856
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 04:23:34 +00:00
markjaquith
c943974cbb remove comment_user_domain cruft. Props Nazgul. fixes #3197
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 03:59:45 +00:00
markjaquith
fdb244801f nocache_headers from _ck_ and Nazgul. fixes #3027
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 03:55:04 +00:00
markjaquith
052b0b8c37 case insensitive sorting. props Nazgul. fixes #3108
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 03:50:14 +00:00
ryan
3302eb70fa Silence gethostbyaddr(). Props MarkJaquith. fixes #2759
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 03:05:46 +00:00
ryan
763204f5ec Quote weblog title in email From header. Props graeme and Nazgul. fixes #1716
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 03:03:41 +00:00
ryan
8603907c61 Remove 2.1 code that slipped in.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 02:42:13 +00:00
ryan
7096084a5a Grammar fix. Props Nazgul. fixes #3196
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-04 02:30:13 +00:00
markjaquith
992ae3261b Frickity frack, and all that jazz. fixes #2663
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-03 22:30:55 +00:00
markjaquith
e5d44de18c cast to array. props to Denis de Bernardy, Nazgul. fixes #3179
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-03 22:04:34 +00:00
ryan
5a1552a8ac Increment tok_index. fixes #2785
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-03 15:56:23 +00:00
ryan
42c3650097 Don't do status_header for IIS. Props Mark Jaquith. fixes #3190
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-03 00:28:06 +00:00
markjaquith
589d768e06 Default cat deletion fix from westi (part 2). fixes #2789
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-02 21:14:22 +00:00
markjaquith
822be1f784 run _page_level_out() link text through wp_specialchars(). Props to hughbiquitous. fixes #2507
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-02 21:07:42 +00:00
ryan
cfb0f495ab Do only the minimum sanitization on the URL redirect. fixes #2994
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-10-02 19:26:47 +00:00
ryan
668dd63122 comment_post_redirect and comment_edit_redirect from Mark J. fixes #2590
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-28 19:16:44 +00:00
ryan
aa7af36ab7 Add post_status key. fixes #3170
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-26 14:10:10 +00:00
ryan
e5352f1262 Send 302 on redirect. Props leflo. fixes #3166
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-26 00:55:58 +00:00
ryan
9f74ddf170 Add some IDs. Props Mark Jaquith. fixes #3164
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 18:53:20 +00:00
ryan
1567d96ae1 Bump ver. fixes #3165
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 18:51:54 +00:00
ryan
a4b370df2b Fix backport errors.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 07:55:15 +00:00
ryan
731b0ba8e9 Remove merge arrows
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 05:13:03 +00:00
ryan
7c20970027 Bump up the ver, bump it up.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:59:49 +00:00
ryan
b793c730cd Don't show user form without privs. Props westi. fixes #3142
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:54:23 +00:00
ryan
6b4ffb78eb Encode percent to avoid broken permalinks. Props majelbstoat. fixes #569
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:50:11 +00:00
ryan
3477651fdc Validate good times, come on. Props Viper007Bond. fixes #3113
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:43:26 +00:00
ryan
f29014a1bb Add bloginfo_url filter from Kafkaesqui. fixes #2643
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:41:02 +00:00
ryan
719ffcb1dc Recognize paragraph tags with attributes when stripping breaks. Props rockinfree. fixes #1706
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:39:47 +00:00
ryan
a4f582c8e6 i18n fixes from nbachiyski. fixes #3109
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:38:55 +00:00
ryan
4d667513b5 Use home instead of PHP_SELF. Props mdawaffe. fixes #895
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:27:51 +00:00
ryan
b745294bac strip CDATA from title. Props pgarrett and mdawaffe. fixes #879
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:27:00 +00:00
ryan
907019e813 Post date fixes. Props mdawaffe. fixes #878
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:26:14 +00:00
ryan
e715b4553e Fix percent stripping in clean_url.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:25:24 +00:00
ryan
65ce9a329f Deprecate idmode. fixes #2386
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:21:05 +00:00
ryan
a0ebe5b7b5 Don't duplicate nofollow on edit. Props filosofo. fixes #2995
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:16:18 +00:00
ryan
5f4d439a1b Cast page_id to int before deciding if is_page. fixes #2769
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:14:44 +00:00
ryan
5077b4e5de Keep the frag at the end. Props mdawaffe. fixes #3078
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:12:34 +00:00
ryan
1b88cb8ea2 Don't specialchar user description on save. fixes #3069
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:10:50 +00:00
ryan
abcbe47015 Make those chars feel special.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 02:09:08 +00:00
ryan
95139ceac6 Don't page off the end. Props Mark J. fixes #3039
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:55:41 +00:00
ryan
5d6f4b5ca5 Preserve is_feed setting when handling a 404. Props skeltoac. fixes #3019
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:51:37 +00:00
ryan
e4070117c3 Validate backup and fragment files. Don't allow traversal.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:48:48 +00:00
ryan
906efe5418 Init last_result to an empty array. fixes #2913
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:46:22 +00:00
ryan
277349165b Sanitize proxy IP check.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:45:29 +00:00
ryan
96b3fea74d Validation fixes
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:40:06 +00:00
ryan
6d8a449d6b Don't forget to concat. Props cschneid. fixes #2988
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-09-25 01:38:34 +00:00
ryan
7f6eafe9cc No magic vals
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-29 01:44:58 +00:00
ryan
c1928c6c58 htmlspecial
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-29 01:38:27 +00:00
ryan
a4f7883ff8 Bu-bump.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-28 23:38:34 +00:00
ryan
d6c6f2b985 specialchars DB error.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-28 22:57:58 +00:00
ryan
3c3ab6eea7 Fix redirect and publish.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-28 22:09:09 +00:00
ryan
53fcff7767 Make nicename optional.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-28 10:50:21 +00:00
ryan
f6e1f1b6ab Use get_userdata(). fixes #2976
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-27 23:25:45 +00:00
ryan
8b62852b61 Sack encoding fix from hgfischer. fixes #2977
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-27 07:11:46 +00:00
ryan
0977aef844 Faster remove accents. Props skeltoac. fixes #2978
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-26 22:57:15 +00:00
ryan
b764af3717 Menu and plugin tweaks.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-26 22:56:56 +00:00
ryan
17af24fdff Don't use blank user agent when pinging. Props error. fixes #2931
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-26 17:45:19 +00:00
ryan
f4623e8afe fix div tags. Props leftjustified. fixes #2728
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-26 17:42:30 +00:00
ryan
e955abbb7d specialchars feed titles. Props leftjustified. fixes #1451
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-26 17:40:30 +00:00
ryan
99a3475bfb Damn editor.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 21:28:36 +00:00
ryan
b7a195b220 Trim theme and plugin data. fixes #2943
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 19:20:50 +00:00
ryan
79c550d82a Escape quotes. Props westi. fixes #2923
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 18:41:48 +00:00
ryan
fc7e3804e6 Bump version.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 18:36:52 +00:00
ryan
9d7419b504 Default cat deletion fix from westi. fixes #2789
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 18:27:00 +00:00
ryan
0ee416e9b8 Snoopy fread fixes. Props JeremyVisser. fixes #2733
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 18:24:15 +00:00
ryan
710ac302ea Custom field AJAX fix from mdawaffe. fixes #2970
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-23 17:14:20 +00:00
ryan
9b274f27be Don't let get_calendar travel into the future. Props Mark Jaquith. fixes #2961
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-21 19:03:21 +00:00
ryan
21e7f8d7b1 Make clickable fix from whooami. fixes #2889
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-11 03:30:22 +00:00
ryan
9d3aff53ae Use wp_die() in wp_nonce_ays(). fixes #2929
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-10 17:21:48 +00:00
ryan
fcb186c059 get_category filter form majelbstoat. fixes #2466
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-10 16:13:04 +00:00
ryan
6515a4d959 Update to php-gettext 1.0.7+. fixes #1727
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 22:36:44 +00:00
ryan
5c69f2fb9d Nice curves. Props ketsugi. fixes #2896
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 06:35:28 +00:00
ryan
cc22930f0b Validation fixes from leftjustified. fixes #2909
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 02:44:40 +00:00
ryan
418ba348e8 Add single/double support to wp_specialchars(). Backported from trunk.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 02:31:06 +00:00
ryan
74302dc057 specialchars quotes in comment title. Props deko. fixes #2915
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 02:27:53 +00:00
ryan
96e1fc875c specialchars comment title. Props deko. fixes #2915
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 02:24:48 +00:00
ryan
9591f04a8f Use HTTP_USER_AGENT from _SERVER.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-06 00:08:53 +00:00
ryan
e78cfdcae9 Bump kses to 0.2.2. Props westi. fixes #2661
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 22:39:56 +00:00
ryan
0f4b1cd1fd Strip and texturize importer title. Props Nazgul. fixes #2897
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 22:34:15 +00:00
ryan
c97495ea1f Validation fixes from leftjustified. fixes #2907
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 20:21:45 +00:00
ryan
89424cdb4b Lower case post. Props leftjustified. fixes #2908
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 20:16:54 +00:00
ryan
cb66ab04dd Markup fixes from leftjustified. fixes #2906
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 17:09:32 +00:00
ryan
29091eb8a6 Add ids to inputs. Props leftjustified. fixes #2911
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 16:48:55 +00:00
ryan
006284f925 wp_specialchars() within wp_nonce_url(). Props Nazgul. fixes #2857
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 09:52:18 +00:00
ryan
5a066aafe6 Don't trigger warning when first visiting login. fixes #2901
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 09:44:43 +00:00
ryan
0ed88d8182 Freshen up setup-config styling.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 02:30:36 +00:00
ryan
d9fb2727a3 Give feedback if username or password fields are empty. Props Nazgul. fixes #2901
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 01:56:47 +00:00
ryan
7befc5a652 Force balanced tags in comments. Props Nazgul. fixes #2714
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-04 22:10:32 +00:00
ryan
3c4edd4079 Add bottoms to the boxes on post screen, fixes #2894. Props: filosofo.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-04 21:51:07 +00:00
ryan
129e43009f Update RBL site and turn open proxy check off by default. Props Nazgul. fixes #2821
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-04 21:40:41 +00:00
ryan
590a1a168f Don't allow negative values when paging. fixes #2893
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-04 20:01:31 +00:00
ryan
b3b39cc608 Relocate /div.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-04 19:24:41 +00:00
ryan
8bb9a2fa95 Delete comment fix from tenpura. fixes #2807
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-01 02:05:34 +00:00
ryan
f57d0c3309 Fix ref check.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-30 22:17:07 +00:00
ryan
00e5ef9609 Allow % so entities such as slashes don't break.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-30 00:44:21 +00:00
ryan
443cfab1a3 Use wp_redirect().
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-27 23:10:02 +00:00
ryan
928b059aa5 wp_explain_nonce() and wp_nonce_ays(). Props mdawaffe. #2734
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-27 22:57:49 +00:00
ryan
91d8b1f827 Add delete page nonce. fixes #2847
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-27 07:02:49 +00:00
ryan
cd05f3c004 More thorough URI sanitizer in wp_redirect().
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-27 01:44:02 +00:00
ryan
3c161f06ef Default theme updates. fixes #1941
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-26 19:33:36 +00:00
ryan
421007958a Use wp_get_referer(). fixes #2800 #2855
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 21:37:24 +00:00
ryan
6367948cac Bump ver
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 21:29:01 +00:00
ryan
ecc5807556 Have wp_referer_field() set the referer to the current page. fixes #2858
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 18:22:57 +00:00
ryan
98f17d3898 Silence pingomatic fsockopen. Props Mark Jaquith. fixes #2522
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 06:04:09 +00:00
ryan
16a3b7125d Send Content-type for 404s. Props Nazgul. fixes #2841
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 06:00:13 +00:00
ryan
6ecc7d5a65 Markup fix from ckr and Nazgul. fixes #2842
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 05:57:35 +00:00
ryan
908edca85a Fixed pagenow regex. Props herr_ernst. fixes #2843
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 05:54:52 +00:00
ryan
8fdd6dadab wp_get_referer() and friends from robmiller and markjaquith. fixes #2800
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 05:41:59 +00:00
ryan
814a876b43 js_escape() in onclicks. fixes #2851
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 01:20:01 +00:00
ryan
112ebb6172 Don't forget the protocol. Props tereshchenko. #2853
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-23 20:17:39 +00:00
ryan
342b43e18a wp_get_current_commenter()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-22 22:09:17 +00:00
ryan
c69c8bdfd8 Fix bug in add_query_arg when url like http://example.com (no trailing slash). Props skel to the ac.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-22 03:52:18 +00:00
ryan
8dce026973 wp_check_filetype() from skeltoac.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-21 23:24:13 +00:00
ryan
d76c03a449 Filename sanitation from sanitation engineer skeltoac. fixes #2823
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-19 22:01:21 +00:00
ryan
0c91c9df15 Sort those smilies. Props HenkvandeKamer and robmiller. fixes #2778
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-19 17:20:45 +00:00
ryan
805b2ad8e8 wp_update_comment_count() from MarkJaquith. fixes #2836
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-19 17:18:19 +00:00
ryan
ab7f591796 Specialchars title. Props David House and Mark Jaquith. fixes #2625
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-15 07:31:28 +00:00
ryan
ed480389cd Really cancel. Props skeltoac. fixes #2826
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-15 07:28:54 +00:00
ryan
f5f583085a Delete bookmark nonce fix from westi and markjaquith. fixes #2806
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-09 01:05:51 +00:00
ryan
dacaa7594f Make replacement strings backref safe without using \${1} so as to preserve php <= 4.2 compatible. Props mdawaffe. fixes #2774
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-08 03:21:04 +00:00
ryan
c1d27f3113 Undef var fix from Denis-de-Bernardy. fixes #2780
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-04 21:07:18 +00:00
ryan
acfc53adce Nonce fix from Mark Jaquith. fixes #2782
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-04 21:00:32 +00:00
ryan
4d0ae7b3f9 Edit profile nonce fix from markjaquith. fixes #2776
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-04 03:41:26 +00:00
ryan
bcb92dfc50 Rollback. fixes #2764
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-02 05:11:30 +00:00
ryan
627ec22359 Strip extra slashes from _POST when doing nonce AYS. Props MarkJaquith and mdawaffe. fixes #2761
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 23:39:03 +00:00
ryan
b027b64a18 Be less aggressive in stripping user description.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 22:01:36 +00:00
ryan
34e0b7b5ea Comment redirect fix from mdawaffe. fixes #2764
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 21:47:50 +00:00
ryan
c80bebbcd6 Comment nonce fixes from Mark Jaquith and mdawaffe. fixes #2760
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 16:58:44 +00:00
ryan
df86f53ebc Verbump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 07:47:02 +00:00
ryan
8cf110280c get_permalink() performance improvement from arnee. fixes #2463
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 05:48:36 +00:00
ryan
84aec8183a Dots fix to work around mod_mime problem. Props skeltoac.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-31 17:06:33 +00:00
ryan
61551a5880 Backup plugin fixes.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-31 06:34:57 +00:00
ryan
1cf5d38c2e Typo fix.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-31 06:27:50 +00:00
ryan
4a44b8410e Backup plugin fixes.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-31 06:03:55 +00:00
ryan
22fd6e5d14 wp_hash(), wp_salt(), and server secret.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-31 05:01:09 +00:00
ryan
97acdb6f44 nonce and comment fixes from Juergen. fixes #2748
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-28 23:33:05 +00:00
ryan
b200480838 Don't show comment author name in AYS dialog to avoid JS escaping issues with untrusted data. fixes #2744
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-27 03:21:46 +00:00
ryan
90395a478c Missed one.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 23:43:08 +00:00
ryan
b4affc0640 Update nonce action strings. Props mdawaffe.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 23:31:24 +00:00
ryan
bcc0151f73 Don't show comment author name in AYS dialog to avoid JS escaping issues with untrusted data.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 23:03:02 +00:00
ryan
9bd85f8e4d Add some user filters.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 22:49:31 +00:00
ryan
5a0d39f624 Add some category filters.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 22:47:55 +00:00
ryan
6e826bcb8b base64 cached objects and store within multi-line comment block to avoid CRLF injections into the cache. Props Peter Westwood.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 21:09:06 +00:00
ryan
660326591e Ver bump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 17:36:49 +00:00
ryan
ddab6df876 sanitize_user regex fix from grigs. fixes #2729
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 17:27:33 +00:00
ryan
1204f35648 Enclosure redirect fix from aegrumet. fixes #2551
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 17:25:20 +00:00
ryan
58bf75d3d8 Excerpt fix from Mike Little. fixes #2686
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-19 06:22:55 +00:00
ryan
32e899d12b Backport js_escape()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-18 01:10:57 +00:00
ryan
a5547588d7 Fallback to admin referer check instead of nonce if no action is given to check_admin_referer(). For plugin compatibility.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-18 01:02:25 +00:00
ryan
a512f85b1f Backport nonce fixes. #2678
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-18 00:59:04 +00:00
ryan
7428c2fbbc Backport nonces and pluggable cookies.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-11 23:05:45 +00:00
ryan
e1e33b5eea Add some prophylactic int casts and quoting.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-04 22:25:24 +00:00
ryan
925ced49fc wp_specialchars comment author name.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-02 21:56:59 +00:00
ryan
548e41f466 wp_specialchars comment author name.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-02 18:33:06 +00:00
ryan
32ba187c48 Don't try to do paging for single page queries. Props westi. fixes #2578
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-25 23:00:56 +00:00
ryan
87c5d9bfec Remove this artificial limit, it messes up posting with seldom-used categories
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:31:27 +00:00
ryan
deb71d2ba1 texturize fix from that Andy guy. fixes #2634
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:29:05 +00:00
ryan
d1e844c514 Don't texturize home. Props Mark Jaquith and David House. fixes #2381
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:27:31 +00:00
ryan
f9aeed2164 Fix backreferences in mysql2date(). Props tenpura. fixes #2564
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:22:28 +00:00
ryan
1c4d1096df update_option() action fix. fixes #2553
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:18:35 +00:00
ryan
b0e9d668cc Disable cache by default.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:16:28 +00:00
ryan
e28c79f070 ent2ncr optimization. Props random. fixes #2548
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:11:08 +00:00
ryan
4d999b3f51 Remove smilies sort. Props random. fixes #2550
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-22 00:10:12 +00:00
ryan
033a947a4c Split on '; ' not ';'.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-21 22:18:58 +00:00
ryan
5e3516bd23 Only flush cache if the DB is out-of-date.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-21 21:33:50 +00:00
ryan
85a2305bd4 Ref checks. Comment filter.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-04-21 21:18:32 +00:00
matt
ba8bb5af9e Austin bump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-10 05:46:13 +00:00
ryan
a4d3381149 Bump
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-07 07:57:32 +00:00
ryan
8c0ad8bb36 Sanitize user_login in register form
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-07 07:06:43 +00:00
ryan
7222dede3e Bumpity bump bump.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-06 23:07:26 +00:00
ryan
f03b1f2d2a Language support for TinyMCE. Props capt_kirk and Stephen Chu. fixes #2476
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-06 22:52:15 +00:00
ryan
cbad39d10b Use wp_delete_link()
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-06 18:49:49 +00:00
ryan
5f17bc2a8c Add referer check. Props masquerade.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-06 08:32:03 +00:00
ryan
084d69c9ae Add referer checks. Props masquerade.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-06 08:21:58 +00:00
ryan
50996fe3ba Check admin referer.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-05 22:48:30 +00:00
ryan
85f6698047 Mac meta keys from Alex King. fixes #2182
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-04 23:01:33 +00:00
ryan
8ff9fa1259 Relative links in RTE. fixes #2492
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-04 22:45:13 +00:00
ryan
cab11a0488 Isolate backref. fixes #2521
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-04 22:42:01 +00:00
ryan
0f43c76667 Set charset in blogger importer iframe. Props Sewar. fixes #2404
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-04 22:11:48 +00:00
ryan
4af5cbb92d Entitize
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-04 21:09:24 +00:00
ryan
1acb5366d9 Make sure posts array is not empty before checking preview state. #2498
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-03 02:18:55 +00:00
ryan
b81908910f Back port of #2398 to 2.0 branch. fixes #2398
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-02 03:08:56 +00:00
ryan
d235862593 DB escaping in fix_attachment_links(). #2434
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-02 02:49:06 +00:00
ryan
4fb60ce690 Sanitize comment coookies.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-03-01 21:17:34 +00:00
ryan
b66c98e979 _SERVER is not escaped by magic_quotes_gpc so don't strip it.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-28 21:50:06 +00:00
ryan
7ddf41069e i18n fix for next month links from bob58. fixes #2399
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 11:25:30 +00:00
ryan
10c4b7f229 Category count fix from MichaelH. fixes #2212
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 11:24:21 +00:00
ryan
b4166d8f13 Fix edit and delete page buttons. Props wellsdjohn. fixes #2382
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 11:22:28 +00:00
ryan
879bd88403 Honor comment_status and ping_status when writing a new post. Props Mark Jaquith. fixes #2445
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 10:57:27 +00:00
ryan
b0955e263c Hide add cat if user does not have mange_categories cap. Props Mark Jaquith. fixes #2432
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 10:52:03 +00:00
ryan
f8df40a153 Use current_user_can. fixes #2441
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 10:47:51 +00:00
ryan
1f2edc0f05 Don't walk rewrite structure when generating comment feed rewrite rules. This fixes a bug uncovered when we switched from unions to merges. Props joshkidd. fixes #2379
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-19 10:28:09 +00:00
ryan
bd2ef6f582 2.0 branch
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-17 23:54:32 +00:00
ryan
7ce71f8001 WordPress 2.0.1
git-svn-id: http://svn.automattic.com/wordpress/tags/2.0.1@3503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-01 22:11:17 +00:00
325 changed files with 26901 additions and 58073 deletions

View File

@@ -1,4 +1,4 @@
<?php
<?php
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');

View File

@@ -1,83 +1,112 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress &rsaquo; ReadMe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="wp-admin/install.css" type="text/css" />
<title>WordPress &rsaquo; ReadMe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
<!--
html {
background: #eee;
}
body {
background: #fff;
color: #000;
font-family: Georgia, "Times New Roman", Times, serif;
margin-left: 25%;
margin-right: 25%;
padding: .2em 2em;
}
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
h2 {
font-size: 16px;
}
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
}
ul, ol {
padding: 5px 5px 5px 20px;
}
-->
</style>
</head>
<body>
<h1 id="logo" style="text-align: center">
<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
<br /> Version 2.2
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
<h1 style="text-align: center"><img alt="WordPress" src="http://wordpress.org/images/wordpress.gif" /> <br />
Version 2.0</h1>
<p style="text-align: center"> Semantic Personal Publishing Platform </p>
<h1>First Things First</h1>
<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I'm proud to be a part of. Thousands of hours have gone into WordPress, and we're dedicated to making it better every day. Thank you for making it part of your world.</p>
<p style="text-align: right;">&#8212; Matt Mullenweg</p>
<p style="text-align: right;">&#8212; Matt Mullenweg </p>
<h1>Installation: Famous 5-minute install</h1>
<h1 id="installation">Installation: Famous 5-minute install</h1>
<ol>
<li>Unzip the package in an empty directory.</li>
<li>Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
<li>Save the file as <code>wp-config.php</code></li>
<li>Unzip the package in an empty directory</li>
<li>Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details</li>
<li>Save the file as <code>wp-config.php</code> </li>
<li>Upload everything.</li>
<li>Open <span class="file"><a href="wp-admin/install.php">/wp-admin/install.php</a></span> in your browser. This should setup the tables needed for your blog. If there is an error, double check your <span class="file">wp-config.php</span> file, and try again. If it fails again, please go to the <a href="http://wordpress.org/support/">support forums</a> with as much data as you can gather.</li>
<li>Open <span class="file"><a href="wp-admin/install.php">/wp-admin/install.php</a></span> in your browser. This should setup the tables needed for your blog. If there is an error, double check your <span class="file">wp-config.php</span> file, and try again. If it fails again, please go to the <a href="http://wordpress.org/support/">support forums</a> with as much data as you can gather. </li>
<li><strong>Note the password given to you.</strong></li>
<li> The install script should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username <code>admin</code> and the password generated during the installation. You can then click on 'Profile' to change the password.</li>
</ol>
<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.2:</h2>
<h2>Upgrading from any previous WordPress to 2.0:</h2>
<ol>
<li>Delete your old WP files, saving ones you've modified.</li>
<li>Upload the new files.</li>
<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
<li>Delete your old WP files, saving ones you've modified </li>
<li>Upload the new files</li>
<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a></span></li>
<li>You wanted more, perhaps? That's it!</li>
</ol>
<h2>Template Changes</h2>
<p>If you have customized your templates you will probably have to make some changes to them. If you're converting your 1.2 or earlier templates, <a href="http://codex.wordpress.org/Upgrade_1.2_to_1.5">we've created a special guide for you</a>. </p>
<h1>Online Resources</h1>
<p>If you have any questions that aren't addressed in this document, please take advantage of WordPress' numerous online resources:</p>
<dl>
<dt><a href="http://codex.wordpress.org/">The WordPress Codex </a></dt>
<dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
<dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available. </dd>
<dt><a href="http://wordpress.org/development/">The Development Blog</a></dt>
<dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often.</dd>
<dd>This is where you'll find the latest updates and news related to WordPress. Bookmark and check often. </dd>
<dt><a href="http://planet.wordpress.org/">WordPress Planet </a></dt>
<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web. </dd>
<dt><a href="http://wordpress.org/support/">WordPress Support Forums</a></dt>
<dd>If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
<dd>If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible. </dd>
<dt><a href="http://codex.wordpress.org/IRC">WordPress IRC Channel</a></dt>
<dd>Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
<dd>Finally, there is an online chat channel that is used for discussion amoung people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (irc.freenode.net #wordpresss) </dd>
</dl>
<h1>System Recommendations</h1>
<h1 id="requirements">System Recommendations</h1>
<ul>
<li>PHP version <strong>4.2</strong> or higher.</li>
<li>MySQL version <strong>4.0</strong> or higher.</li>
<li>PHP version <strong>4.1</strong> or higher</li>
<li>MySQL version <strong>3.23.23</strong> or higher</li>
<li>... and a link to <a href="http://wordpress.org/">http://wordpress.org</a> on your site.</li>
</ul>
<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&eacute;log</a>, which came from Michel V. The work has been continued by the <a href="http://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="http://wordpress.org/donate/">donating</a>.</p>
<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&eacute;log</a>, which came from Michel V. The work has been continued by the <a href="http://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="http://wordpress.org/donate/">donating</a>. </p>
<h1>Upgrading from another system</h1>
<p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>
<p>WordPress can <a href="http://codex.wordpress.org/Importing_from_other_blogging_software">import from a number of systems</a>. First you need to get WordPress installed and working as described above.</p>
<h1>XML-RPC and Atom Interface</h1>
<p>You can now post to your WordPress blog with tools like <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>, <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>
<h1 id="templates">XML-RPC Interface</h1>
<p>You can now post to your WordPress blog with tools like <a href="http://ecto.kung-foo.tv/">Ecto</a>, <a href="http://blogbuddy.sourceforge.net">BlogBuddy</a>, <a href="http://bloggar.com/">Bloggar</a>, <a href="http://www.ubique.ch/wapblogger/">WapBlogger</a> (post from your Wap cellphone!), <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), <a href="http://www.zempt.com/">Zempt</a>, <a href="http://www.newzcrawler.com/">NewzCrawler</a>, and other tools that support the Blogging APIs! :) You can read more about <a href="http://codex.wordpress.org/XML-RPC_Support">XML-RPC support on the Codex</a>.</p>
<h1>Post via Email</h1>
<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL.</p>
<p>Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address dicrete. The script will <i>delete</i> emails that are successfully posted.</p>
<p>You can post from an email client! To set this up go to your &quot;Writing&quot; options screen and fill in the connection details for your secret POP3 account. Then you need to set up <code>wp-mail.php</code> to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your <code>wp-mail.php</code> URL. </p>
<p> Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address dicrete. The script will <i>delete</i> emails that are successfully posted. </p>
<h1 id="roles">User Roles </h1>
<h1>User Roles</h1>
<p>We've eliminated user levels in order to make way for the much more flexible roles system introduced in 2.0. You can <a href="http://codex.wordpress.org/Roles_and_Capabilities">read more about Roles and Capabilities on the Codex</a>.</p>
<h1> Final notes</h1>
<ul>
<li>If you have any suggestions, ideas, comments, or if you (gasp!) found a bug, join us in the <a href="http://wordpress.org/support/">Support Forums</a>.</li>
<li>If you have any suggestions, ideas, comments, or if you (gasp!) found a bug, join us in the <a href="http://wordpress.org/support/">Support Forums</a></li>
<li>WordPress now has a robust plugin API that makes extending the code easy. If you are a developer interested in utilizing this see the <a href="http://codex.wordpress.org/Plugin_API">plugin documentation in the Codex</a>. In most all cases you shouldn't modify any of the core code.</li>
</ul>
@@ -88,4 +117,4 @@
<p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr> (see <a href="license.txt">license.txt</a>).</p>
</body>
</html>
</html>

View File

@@ -1,296 +0,0 @@
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');
define('DOING_AJAX', true);
check_ajax_referer();
if ( !is_user_logged_in() )
die('-1');
function get_out_now() { exit; }
add_action( 'shutdown', 'get_out_now', -1 );
function wp_ajax_meta_row( $pid, $mid, $key, $value ) {
$value = attribute_escape($value);
$key_js = addslashes(wp_specialchars($key, 'double'));
$key = attribute_escape($key);
$r .= "<tr id='meta-$mid'><td valign='top'>";
$r .= "<input name='meta[$mid][key]' tabindex='6' onkeypress='return killSubmit(\"theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);\",event);' type='text' size='20' value='$key' />";
$r .= "</td><td><textarea name='meta[$mid][value]' tabindex='6' rows='2' cols='30'>$value</textarea></td><td align='center'>";
$r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='".attribute_escape(__('Update'))."' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
$r .= "<input name='deletemeta[$mid]' type='submit' onclick=\"return deleteSomething( 'meta', $mid, '";
$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></tr>";
return $r;
}
$id = (int) $_POST['id'];
switch ( $_POST['action'] ) :
case 'delete-comment' :
if ( !$comment = get_comment( $id ) )
die('0');
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
die('-1');
if ( wp_delete_comment( $comment->comment_ID ) )
die('1');
else die('0');
break;
case 'delete-comment-as-spam' :
if ( !$comment = get_comment( $id ) )
die('0');
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
die('-1');
if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) )
die('1');
else die('0');
break;
case 'delete-cat' :
if ( !current_user_can( 'manage_categories' ) )
die('-1');
if ( wp_delete_category( $id ) )
die('1');
else die('0');
break;
case 'delete-link' :
if ( !current_user_can( 'manage_links' ) )
die('-1');
if ( wp_delete_link( $id ) )
die('1');
else die('0');
break;
case 'delete-meta' :
if ( !$meta = get_post_meta_by_id( $id ) )
die('0');
if ( !current_user_can( 'edit_post', $meta->post_id ) )
die('-1');
if ( delete_meta( $meta->meta_id ) )
die('1');
die('0');
break;
case 'delete-post' :
if ( !current_user_can( 'delete_post', $id ) )
die('-1');
if ( wp_delete_post( $id ) )
die('1');
else die('0');
break;
case 'delete-page' :
if ( !current_user_can( 'delete_page', $id ) )
die('-1');
if ( wp_delete_post( $id ) )
die('1');
else die('0');
break;
case 'dim-comment' :
if ( !$comment = get_comment( $id ) )
die('0');
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
die('-1');
if ( !current_user_can( 'moderate_comments' ) )
die('-1');
if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) {
if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
die('1');
} else {
if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) )
die('1');
}
die('0');
break;
case 'add-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 ( !$category_nicename = sanitize_title($cat_name) )
die('0');
if ( !$cat_id = category_exists( $cat_name ) )
$cat_id = wp_create_category( $cat_name );
$cat_name = wp_specialchars(stripslashes($cat_name));
$x->add( array(
'what' => 'category',
'id' => $cat_id,
'data' => "<li id='category-$cat_id'><label for='in-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='post_category[]' id='in-category-$cat_id'/> $cat_name</label></li>"
) );
}
$x->send();
break;
case 'add-cat' : // From Manage->Categories
if ( !current_user_can( 'manage_categories' ) )
die('-1');
if ( !$cat = wp_insert_category( $_POST ) )
die('0');
if ( !$cat = get_category( $cat ) )
die('0');
$level = 0;
$cat_full_name = $cat->cat_name;
$_cat = $cat;
while ( $_cat->category_parent ) {
$_cat = get_category( $_cat->category_parent );
$cat_full_name = $_cat->cat_name . ' &#8212; ' . $cat_full_name;
$level++;
}
$cat_full_name = attribute_escape($cat_full_name);
$x = new WP_Ajax_Response( array(
'what' => 'cat',
'id' => $cat->cat_ID,
'data' => _cat_row( $cat, $level, $cat_full_name ),
'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->cat_ID", $cat_full_name))
) );
$x->send();
break;
case 'add-comment' :
if ( !current_user_can( 'edit_post', $id ) )
die('-1');
$search = isset($_POST['s']) ? $_POST['s'] : false;
$start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25;
list($comments, $total) = _wp_get_comment_list( $search, $start, 1 );
if ( !$comments )
die('1');
$x = new WP_Ajax_Response();
foreach ( (array) $comments as $comment ) {
get_comment( $comment );
ob_start();
_wp_comment_list_item( $comment->comment_ID );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item
) );
}
$x->send();
break;
case 'add-meta' :
if ( !current_user_can( 'edit_post', $id ) )
die('-1');
if ( $id < 0 ) {
$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))
) ) )
$mid = add_meta( $pid );
else
die('0');
} else if ( !$mid = add_meta( $id ) ) {
die('0');
}
$meta = get_post_meta_by_id( $mid );
$key = $meta->meta_key;
$value = $meta->meta_value;
$pid = (int) $meta->post_id;
$x = new WP_Ajax_Response( array(
'what' => 'meta',
'id' => $mid,
'data' => wp_ajax_meta_row( $pid, $mid, $key, $value ),
'supplemental' => array('postid' => $pid)
) );
$x->send();
break;
case 'update-meta' :
$mid = (int) array_pop(array_keys($_POST['meta']));
$key = $_POST['meta'][$mid]['key'];
$value = $_POST['meta'][$mid]['value'];
if ( !$meta = get_post_meta_by_id( $mid ) )
die('0'); // if meta doesn't exist
if ( !current_user_can( 'edit_post', $meta->post_id ) )
die('-1');
if ( $u = update_meta( $mid, $key, $value ) ) {
$key = stripslashes($key);
$value = stripslashes($value);
$x = new WP_Ajax_Response( array(
'what' => 'meta',
'id' => $mid,
'data' => wp_ajax_meta_row( $meta->post_id, $mid, $key, $value ),
'supplemental' => array('postid' => $meta->post_id)
) );
$x->send();
}
die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
break;
case 'add-user' :
if ( !current_user_can('edit_users') )
die('-1');
require_once(ABSPATH . WPINC . '/registration.php');
if ( !$user_id = add_user() )
die('0');
elseif ( is_wp_error( $user_id ) ) {
foreach( $user_id->get_error_messages() as $message )
echo "<p>$message<p>";
exit;
}
$user_object = new WP_User( $user_id );
$x = new WP_Ajax_Response( array(
'what' => 'user',
'id' => $user_id,
'data' => user_row( $user_object ),
'supplemental' => array('show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login))
) );
$x->send();
break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_status'] = 'draft';
$_POST['post_category'] = explode(",", $_POST['catslist']);
if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
unset($_POST['post_category']);
if($_POST['post_ID'] < 0) {
$_POST['temp_ID'] = $_POST['post_ID'];
$id = wp_write_post();
if( is_wp_error($id) )
die($id->get_error_message());
else
die("$id");
} else {
$post_ID = (int) $_POST['post_ID'];
$_POST['ID'] = $post_ID;
$post = get_post($post_ID);
if ( 'page' == $post->post_type ) {
if ( !current_user_can('edit_page', $post_ID) )
die(__('You are not allowed to edit this page.'));
} else {
if ( !current_user_can('edit_post', $post_ID) )
die(__('You are not allowed to edit this post.'));
}
wp_update_post($_POST);
}
die('0');
break;
case 'autosave-generate-nonces' :
$ID = (int) $_POST['post_ID'];
if($_POST['post_type'] == 'post') {
if(current_user_can('edit_post', $ID))
die(wp_create_nonce('update-post_' . $ID));
}
if($_POST['post_type'] == 'page') {
if(current_user_can('edit_page', $ID)) {
die(wp_create_nonce('update-page_' . $ID));
}
}
die('0');
break;
default :
do_action( 'wp_ajax_' . $_POST['action'] );
die('0');
break;
endswitch;
?>

View File

@@ -3,7 +3,7 @@
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 = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
$query = apply_filters('get_users_drafts', $query);
return $wpdb->get_results( $query );
}
@@ -14,12 +14,12 @@ function get_others_drafts( $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' ");
$other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
}
return apply_filters('get_others_drafts', $other_drafts);
@@ -42,13 +42,13 @@ function get_editable_authors( $user_id ) {
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
else
return false;
}
@@ -57,7 +57,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
$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 );
}
@@ -82,10 +82,7 @@ function get_nonauthor_user_ids() {
function wp_insert_category($catarr) {
global $wpdb;
extract($catarr, EXTR_SKIP);
if( trim( $cat_name ) == '' )
return 0;
extract($catarr);
$cat_ID = (int) $cat_ID;
@@ -96,7 +93,7 @@ function wp_insert_category($catarr) {
$update = false;
$cat_name = apply_filters('pre_category_name', $cat_name);
if (empty ($category_nicename))
$category_nicename = sanitize_title($cat_name);
else
@@ -108,51 +105,31 @@ function wp_insert_category($catarr) {
$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) ) )
if (empty ($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;
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent')");
$cat_ID = $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'");
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'");
}
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
wp_cache_delete($cat_ID, 'category');
if ($update) {
do_action('edit_category', $cat_ID);
} else {
wp_cache_delete('all_category_ids', 'category');
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;
}
@@ -161,9 +138,6 @@ function wp_update_category($catarr) {
$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);
@@ -180,47 +154,30 @@ 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 )
// Don't delete the default cat.
if ($cat_ID == get_option('default_category'))
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;
// Delete the category.
$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
// Update children to point to new parent
// 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);
}
// TODO: Only set categories to general if they're not in another category already
$default_cat = get_option('default_category');
$wpdb->query("UPDATE $wpdb->post2cat SET category_id='$default_cat' WHERE category_id='$cat_ID'");
$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);
}
wp_cache_delete($cat_ID, 'category');
wp_cache_delete('all_category_ids', 'category');
clean_category_cache($cat_ID);
do_action('delete_category', $cat_ID);
return 1;
}
@@ -240,7 +197,7 @@ function wp_create_categories($categories, $post_id = '') {
}
if ($post_id)
wp_set_post_categories($post_id, $cat_ids);
wp_set_post_cats('', $post_id, $cat_ids);
return $cat_ids;
}
@@ -250,7 +207,7 @@ function category_exists($cat_name) {
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'");
return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
}
function wp_delete_user($id, $reassign = 'novalue') {
@@ -276,36 +233,43 @@ function wp_delete_user($id, $reassign = 'novalue') {
}
// 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');
do_action('delete_user', $id);
return true;
}
function wp_revoke_user($id) {
$id = (int) $id;
function get_link($link_id, $output = OBJECT) {
global $wpdb;
$link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
$user = new WP_User($id);
$user->remove_all_caps();
if ( $output == OBJECT ) {
return $link;
} elseif ( $output == ARRAY_A ) {
return get_object_vars($link);
} elseif ( $output == ARRAY_N ) {
return array_values(get_object_vars($link));
} else {
return $link;
}
}
function wp_insert_link($linkdata) {
global $wpdb, $current_user;
extract($linkdata, EXTR_SKIP);
extract($linkdata);
$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);
@@ -315,7 +279,7 @@ function wp_insert_link($linkdata) {
$link_url = apply_filters('pre_link_url', $link_url);
if ( empty($link_rating) )
$link_rating = 0;
$link_rating = 0;
else
$link_rating = (int) $link_rating;
@@ -324,7 +288,7 @@ function wp_insert_link($linkdata) {
$link_image = apply_filters('pre_link_image', $link_image);
if ( empty($link_target) )
$link_target = '';
$link_target = '';
$link_target = apply_filters('pre_link_target', $link_target);
if ( empty($link_visible) )
@@ -352,26 +316,19 @@ function wp_insert_link($linkdata) {
$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_target='$link_target', link_category='$link_category',
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;
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = $wpdb->insert_id;
}
wp_set_link_cats($link_id, $link_category);
if ( $update )
do_action('edit_link', $link_id);
else
@@ -384,22 +341,14 @@ 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);
}
@@ -408,98 +357,9 @@ 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;
return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
}
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;

View File

@@ -1,10 +1,19 @@
<div id="footer">
<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 id="footer"><p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
<p>
<a href="http://codex.wordpress.org/"><?php _e('Documentation'); ?></a> &#8212; <a href="http://wordpress.org/support/"><?php _e('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>
<?php
if ( (substr(php_sapi_name(), 0, 3) == 'cgi') && spawn_pinger() ) {
echo '<iframe id="pingcheck" src="' . get_settings('siteurl') .'/wp-admin/execute-pings.php?time=' . time() . '" style="border:none;width:1px;height:1px;"></iframe>';
}
?>
</body>
</html>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,67 @@
<?php
<?php
@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') );
$dbx_js = true;
if ( current_user_can('manage_categories') )
wp_enqueue_script( 'ajaxcat' );
if ( user_can_richedit() )
wp_enqueue_script( 'wp_tiny_mce' );
$cat_js = true;
}
get_admin_page_title();
if ( $list_js || $cat_js )
$sack_js = true;
?>
<?php get_admin_page_title(); ?>
<!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 do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<html xmlns="http://www.w3.org/1999/xhtml">
<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>
<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; ?>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<script type="text/javascript">
//<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
//]]>
</script>
<script type="text/javascript" src="../wp-includes/js/fat.js"></script>
<?php if ( $xfn_js ) { ?>
<script type="text/javascript" src="xfn.js"></script>
<?php } ?>
<?php if ( $sack_js ) { ?>
<script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
<?php } ?>
<?php if ( $list_js ) { ?>
<script type="text/javascript" src="list-manipulation.js"></script>
<?php } ?>
<?php if ( $dbx_js ) { ?>
<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
<script type="text/javascript">
//<![CDATA[
addLoadEvent( function() {
<?php switch ( $pagenow ) : case 'post.php' : ?>
var manager = new dbxManager('postmeta');
<?php break; case 'page-new.php' : ?>
var manager = new dbxManager('pagemeta');
<?php break; endswitch; ?>
});
//]]>
</script>
<script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script>
<?php } ?>
<?php if ( $editing && user_can_richedit() ) { ?>
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script>
<?php } ?>
<?php if ( $cat_js ) { ?>
<script type="text/javascript" src="cat-js.php"></script>
<?php } ?>
<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?>
<style type="text/css">* html { overflow-x: hidden; }</style>
<?php endif;
if ( isset($page_hook) )
do_action('admin_print_scripts-' . $page_hook);
else if ( isset($plugin_page) )
do_action('admin_print_scripts-' . $plugin_page);
do_action('admin_print_scripts');
if ( isset($page_hook) )
do_action('admin_head-' . $page_hook);
else if ( isset($plugin_page) )
do_action('admin_head-' . $plugin_page);
do_action('admin_head');
?>
<?php endif; ?>
<?php do_action('admin_head'); ?>
</head>
<body>
<div id="wphead">
<h1><?php bloginfo('name'); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('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>
<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('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 Account'); ?></a>] </p></div>
<?php
require(ABSPATH . '/wp-admin/menu-header.php');

View File

@@ -4,14 +4,12 @@ if ( defined('ABSPATH') )
else
require_once('../wp-config.php');
if ( get_option('db_version') != $wp_db_version ) {
wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
exit;
}
if ( get_option('db_version') != $wp_db_version )
die (sprintf(__("Your database is out-of-date. Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
require_once(ABSPATH . 'wp-admin/admin-functions.php');
require_once(ABSPATH . 'wp-admin/admin-db.php');
require_once(ABSPATH . WPINC . '/registration.php');
require_once(ABSPATH . WPINC . '/registration-functions.php');
auth_redirect();
@@ -21,16 +19,28 @@ update_category_cache();
wp_get_current_user();
$posts_per_page = get_option('posts_per_page');
$what_to_show = get_option('what_to_show');
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$posts_per_page = get_settings('posts_per_page');
$what_to_show = get_settings('what_to_show');
$date_format = get_settings('date_format');
$time_format = get_settings('time_format');
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
wp_enqueue_script( 'fat' );
$editing = false;
$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
if (isset($_GET['page'])) {
$plugin_page = stripslashes($_GET['page']);
@@ -44,64 +54,59 @@ if (isset($plugin_page)) {
$page_hook = get_plugin_page_hook($plugin_page, $pagenow);
if ( $page_hook ) {
do_action('load-' . $page_hook);
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
do_action($page_hook);
} else {
if ( validate_file($plugin_page) ) {
wp_die(__('Invalid plugin page'));
die(__('Invalid plugin page'));
}
if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page"))
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
do_action('load-' . $plugin_page);
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php');
include(ABSPATH . PLUGINDIR . "/$plugin_page");
include(ABSPATH . "wp-content/plugins/$plugin_page");
}
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
} else if (isset($_GET['import'])) {
$importer = $_GET['import'];
if ( ! current_user_can('import') )
wp_die(__('You are not allowed to import.'));
if ( validate_file($importer) ) {
wp_die(__('Invalid importer.'));
die(__('Invalid importer.'));
}
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
wp_die(__('Cannot load importer.'));
die(__('Cannot load importer.'));
include(ABSPATH . "wp-admin/import/$importer.php");
$parent_file = 'edit.php';
$submenu_file = 'import.php';
$parent_file = 'import.php';
$title = __('Import');
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
define('WP_IMPORTING', true);
kses_init_filters(); // Always filter imported data with kses.
call_user_func($wp_importers[$importer][2]);
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
} else {
do_action("load-$pagenow");
}
?>

View File

@@ -3,7 +3,7 @@ $mode = 'bookmarklet';
require_once('admin.php');
if ( ! current_user_can('edit_posts') )
wp_die(__('Cheatin&#8217; uh?'));
die ("Cheatin' uh?");
if ('b' == $a):
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -25,32 +25,32 @@ $post = get_default_post_to_edit();
$popuptitle = wp_specialchars(stripslashes($popuptitle));
$text = wp_specialchars(stripslashes(urldecode($text)));
$popuptitle = funky_javascript_fix($popuptitle);
$text = funky_javascript_fix($text);
$post_title = wp_specialchars($_REQUEST['post_title']);
if (!empty($post_title))
$post->post_title = stripslashes($post_title);
else
$post->post_title = $popuptitle;
$content = wp_specialchars($_REQUEST['content']);
$popupurl = clean_url($_REQUEST['popupurl']);
if ( !empty($content) ) {
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else {
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}
$popupurl = attribute_escape(stripslashes($_REQUEST['popupurl']));
if ( !empty($content) ) {
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else {
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}
/* /big funky fixes */
/* /big funky fixes */
?><!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">
<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'); ?>" />
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<style type="text/css">
@@ -77,15 +77,15 @@ if ( !empty($content) ) {
}
#wpbookmarklet .wrap {
border: 0px;
border: 0px;
}
#wpbookmarklet #postdiv {
margin-bottom: 0.5em;
margin-bottom: 0.5em;
}
#wpbookmarklet #titlediv {
margin-bottom: 1em;
margin-bottom: 1em;
}
-->

178
wp-admin/cat-js.php Normal file
View File

@@ -0,0 +1,178 @@
<?php
require_once('admin.php');
header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
?>
var ajaxCat = new sack();
var newcat;
function newCatAddIn() {
if ( !document.getElementById('jaxcat') ) return false;
var ajaxcat = document.createElement('span');
ajaxcat.id = 'ajaxcat';
newcat = document.createElement('input');
newcat.type = 'text';
newcat.name = 'newcat';
newcat.id = 'newcat';
newcat.size = '16';
newcat.setAttribute('autocomplete', 'off');
newcat.onkeypress = ajaxNewCatKeyPress;
var newcatSub = document.createElement('input');
newcatSub.type = 'button';
newcatSub.name = 'Button';
newcatSub.id = 'catadd';
newcatSub.value = '<?php echo addslashes(__('Add')); ?>';
newcatSub.onclick = ajaxNewCat;
ajaxcat.appendChild(newcat);
ajaxcat.appendChild(newcatSub);
document.getElementById('jaxcat').appendChild(ajaxcat);
howto = document.createElement('span');
howto.innerHTML = '<?php echo addslashes(__('Separate multiple categories with commas.')); ?>';
howto.id = 'howto';
ajaxcat.appendChild(howto);
}
addLoadEvent(newCatAddIn);
function getResponseElement() {
var p = document.getElementById('ajaxcatresponse');
if (!p) {
p = document.createElement('span');
document.getElementById('jaxcat').appendChild(p);
p.id = 'ajaxcatresponse';
}
return p;
}
function newCatLoading() {
var p = getResponseElement();
p.innerHTML = '<?php echo addslashes(__('Sending Data...')); ?>';
}
function newCatLoaded() {
var p = getResponseElement();
p.innerHTML = '<?php echo addslashes(__('Data Sent...')); ?>';
}
function newCatInteractive() {
var p = getResponseElement();
p.innerHTML = '<?php echo addslashes(__('Processing Request...')); ?>';
}
function newCatCompletion() {
var p = getResponseElement();
var id = 0;
var ids = new Array();
var names = new Array();
ids = myPload( ajaxCat.response );
names = myPload( newcat.value );
for ( i = 0; i < ids.length; i++ ) {
id = ids[i].replace(/[\n\r]+/g, "");
if ( id == '-1' ) {
p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>";
return;
}
if ( id == '0' ) {
p.innerHTML = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>";
return;
}
var exists = document.getElementById('category-' + id);
if (exists) {
var moveIt = exists.parentNode;
var container = moveIt.parentNode;
container.removeChild(moveIt);
container.insertBefore(moveIt, container.firstChild);
moveIt.id = 'new-category-' + id;
exists.checked = 'checked';
var nowClass = moveIt.className;
moveIt.className = nowClass + ' fade';
Fat.fade_all();
moveIt.className = nowClass;
} else {
var catDiv = document.getElementById('categorychecklist');
var newLabel = document.createElement('label');
newLabel.setAttribute('for', 'category-' + id);
newLabel.id = 'new-category-' + id;
newLabel.className = 'selectit fade';
var newCheck = document.createElement('input');
newCheck.type = 'checkbox';
newCheck.value = id;
newCheck.name = 'post_category[]';
newCheck.id = 'category-' + id;
newLabel.appendChild(newCheck);
var newLabelText = document.createTextNode(' ' + names[i]);
newLabel.appendChild(newLabelText);
catDiv.insertBefore(newLabel, catDiv.firstChild);
newCheck.checked = 'checked';
Fat.fade_all();
newLabel.className = 'selectit';
}
newcat.value = '';
}
p.parentNode.removeChild(p);
// var id = parseInt(ajaxCat.response, 10);
}
function ajaxNewCatKeyPress(e) {
if (!e) {
if (window.event) {
e = window.event;
} else {
return;
}
}
if (e.keyCode == 13) {
ajaxNewCat();
e.returnValue = false;
e.cancelBubble = true;
return false;
}
}
function ajaxNewCat() {
var newcat = document.getElementById('newcat');
var split_cats = new Array(1);
var catString = '';
catString = ajaxCat.encVar('ajaxnewcat', newcat.value) + '&' + ajaxCat.encVar('cookie', document.cookie);
ajaxCat.requestFile = 'edit-form-ajax-cat.php';
ajaxCat.method = 'POST';
ajaxCat.onLoading = newCatLoading;
ajaxCat.onLoaded = newCatLoaded;
ajaxCat.onInteractive = newCatInteractive;
ajaxCat.onCompletion = newCatCompletion;
ajaxCat.runAJAX(catString);
}
function myPload( str ) {
var fixedExplode = new Array();
var comma = new String(',');
var count = 0;
var currentElement = '';
for( x=0; x < str.length; x++) {
andy = str.charAt(x);
if ( comma.indexOf(andy) != -1 ) {
currentElement = currentElement.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // trim
fixedExplode[count] = currentElement;
currentElement = "";
count++;
} else {
currentElement += andy;
}
}
if ( currentElement != "" )
fixedExplode[count] = currentElement;
return fixedExplode;
}

View File

@@ -1,10 +0,0 @@
addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
addLoadEvent(newCatAddIn);
function newCatAddIn() {
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="' + 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

@@ -1,16 +0,0 @@
addLoadEvent(function() {
if (!theList.theList) return false;
document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
theList.addComplete = function(what, where, update, transport) {
var name = getNodeValue(transport.responseXML, 'name').unescapeHTML();
var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id');
var options = document.forms['addcat'].category_parent.options;
options[options.length] = new Option(name, id);
};
theList.delComplete = function(what, id) {
var options = document.forms['addcat'].category_parent.options;
for ( var o = 0; o < options.length; o++ )
if ( id == options[o].value )
options[o] = null;
};
});

View File

@@ -3,8 +3,23 @@ require_once('admin.php');
$title = __('Categories');
$parent_file = 'edit.php';
$list_js = true;
wp_reset_vars(array('action', 'cat'));
$wpvarstoreset = array('action','cat');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
switch($action) {
@@ -13,13 +28,11 @@ case 'addcat':
check_admin_referer('add-category');
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
die (__('Cheatin&#8217; uh?'));
wp_insert_category($_POST);
if( wp_insert_category($_POST ) ) {
wp_redirect('categories.php?message=1#addcat');
} else {
wp_redirect('categories.php?message=4#addcat');
}
wp_redirect('categories.php?message=1#addcat');
exit;
break;
@@ -28,30 +41,59 @@ case 'delete':
check_admin_referer('delete-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
die (__('Cheatin&#8217; uh?'));
$cat_name = get_catname($cat_ID);
// Don't delete the default cats.
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));
if ( $cat_ID == get_option('default_category') )
die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_delete_category($cat_ID);
wp_redirect('categories.php?message=2');
exit;
break;
case 'edit':
require_once ('admin-header.php');
$cat_ID = (int) $_GET['cat_ID'];
$category = get_category_to_edit($cat_ID);
include('edit-category-form.php');
require_once ('admin-header.php');
$cat_ID = (int) $_GET['cat_ID'];
$category = get_category_to_edit($cat_ID);
?>
<div class="wrap">
<h2><?php _e('Edit Category') ?></h2>
<form name="editcat" action="categories.php" method="post">
<?php wp_nonce_field('update-category_' . $category->cat_ID); ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Category name:') ?></th>
<td width="67%"><input name="cat_name" type="text" value="<?php echo attribute_escape($category->cat_name); ?>" size="40" /> <input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_ID" value="<?php echo $category->cat_ID ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Category slug:') ?></th>
<td><input name="category_nicename" type="text" value="<?php echo attribute_escape($category->category_nicename); ?>" size="40" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Category parent:') ?></th>
<td>
<select name='category_parent'>
<option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
<?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
</select></td>
</tr>
<tr>
<th scope="row"><?php _e('Description:') ?></th>
<td><textarea name="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 _e('Edit category') ?> &raquo;" /></p>
</form>
<p><a href="categories.php"><?php _e('&laquo; Return to category list'); ?></a></p>
</div>
<?php
break;
@@ -60,26 +102,21 @@ case 'editedcat':
check_admin_referer('update-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
if ( wp_update_category($_POST) )
wp_redirect('categories.php?message=3');
else
wp_redirect('categories.php?message=5');
die (__('Cheatin&#8217; uh?'));
wp_update_category($_POST);
wp_redirect('categories.php?message=3');
exit;
break;
default:
wp_enqueue_script( 'admin-categories' );
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.');
?>
<?php if (isset($_GET['message'])) : ?>
@@ -92,32 +129,44 @@ $messages[5] = __('Category not updated.');
<?php else : ?>
<h2><?php _e('Categories') ?> </h2>
<?php endif; ?>
<table class="widefat">
<thead>
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
<th scope="col"><?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('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>
<th scope="col"><?php _e('# Posts') ?></th>
<th colspan="2"><?php _e('Action') ?></th>
</tr>
</thead>
<tbody id="the-list">
<?php
cat_rows();
?>
</tbody>
</table>
<div id="ajax-response"></div>
</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 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>
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(get_option('default_category'))) ?></p>
</div>
<?php include('edit-category-form.php'); ?>
<div class="wrap">
<h2><?php _e('Add New Category') ?></h2>
<form name="addcat" id="addcat" action="categories.php" method="post">
<?php wp_nonce_field('add-category'); ?>
<p><?php _e('Name:') ?><br />
<input type="text" name="cat_name" value="" /></p>
<p><?php _e('Category parent:') ?><br />
<select name='category_parent' class='postform'>
<option value='0'><?php _e('None') ?></option>
<?php wp_dropdown_cats(0); ?>
</select></p>
<p><?php _e('Description: (optional)') ?> <br />
<textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
<p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
</form>
</div>
<?php endif; ?>
<?php
@@ -125,5 +174,4 @@ break;
}
include('admin-footer.php');
?>

View File

@@ -1,213 +0,0 @@
<?php
require_once('admin.php');
$parent_file = 'edit-comments.php';
$submenu_file = 'edit-comments.php';
wp_reset_vars(array('action'));
if ( isset( $_POST['deletecomment'] ) )
$action = 'deletecomment';
switch($action) {
case 'editcomment':
$title = __('Edit Comment');
require_once ('admin-header.php');
$comment = (int) $_GET['c'];
if ( ! $comment = get_comment($comment) )
wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'javascript:history.go(-1)'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
wp_die( __('You are not allowed to edit comments on this post.') );
$comment = get_comment_to_edit($comment);
include('edit-form-comment.php');
break;
case 'cdc':
case 'mac':
require_once('./admin-header.php');
$comment = (int) $_GET['c'];
$formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment';
$nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_';
$nonce_action .= $comment;
if ( ! $comment = get_comment_to_edit($comment) )
wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
wp_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
?>
<div class='wrap'>
<div class="narrow">
<?php if ( 'spam' == $_GET['dt'] ) { ?>
<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to mark the following comment as spam:'); ?></p>
<?php } elseif ( 'cdc' == $action ) { ?>
<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to delete the following comment:'); ?></p>
<?php } else { ?>
<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to approve the following comment:'); ?></p>
<?php } ?>
<p><?php _e('Are you sure you want to do that?'); ?></p>
<form action='<?php echo get_option('siteurl'); ?>/wp-admin/comment.php' method='get'>
<table width="100%">
<tr>
<td><input type='button' value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td>
<td align="right"><input type='submit' value='<?php _e('Yes'); ?>' /></td>
</tr>
</table>
<?php wp_nonce_field($nonce_action); ?>
<input type='hidden' name='action' value='<?php echo $formaction; ?>' />
<?php if ( 'spam' == $_GET['dt'] ) { ?>
<input type='hidden' name='dt' value='spam' />
<?php } ?>
<input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' />
<input type='hidden' name='c' value='<?php echo $comment->comment_ID; ?>' />
<input type='hidden' name='noredir' value='1' />
</form>
<table class="editform" cellpadding="5">
<tr class="alt">
<th scope="row"><?php _e('Author:'); ?></th>
<td><?php echo $comment->comment_author; ?></td>
</tr>
<?php if ( $comment->comment_author_email ) { ?>
<tr>
<th scope="row"><?php _e('E-mail:'); ?></th>
<td><?php echo $comment->comment_author_email; ?></td>
</tr>
<?php } ?>
<?php if ( $comment->comment_author_url ) { ?>
<tr>
<th scope="row"><?php _e('URL:'); ?></th>
<td><?php echo $comment->comment_author_url; ?></td>
</tr>
<?php } ?>
<tr>
<th scope="row" valign="top"><p><?php _e('Comment:'); ?></p></th>
<td><?php echo $comment->comment_content; ?></td>
</tr>
</table>
</div>
</div>
<?php
break;
case 'deletecomment':
$comment = (int) $_REQUEST['c'];
check_admin_referer('delete-comment_' . $comment);
if ( isset($_REQUEST['noredir']) ) {
$noredir = true;
} else {
$noredir = false;
}
if ( ! $comment = get_comment($comment) )
wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
wp_die( __('You are not allowed to edit comments on this post.') );
if ( 'spam' == $_REQUEST['dt'] )
wp_set_comment_status($comment->comment_ID, 'spam');
else
wp_delete_comment($comment->comment_ID);
if ((wp_get_referer() != '') && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_option('siteurl') .'/wp-admin/edit-comments.php');
}
exit();
break;
case 'unapprovecomment':
$comment = (int) $_GET['c'];
check_admin_referer('unapprove-comment_' . $comment);
if (isset($_GET['noredir'])) {
$noredir = true;
} else {
$noredir = false;
}
if ( ! $comment = get_comment($comment) )
wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
wp_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
wp_set_comment_status($comment->comment_ID, "hold");
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');
}
exit();
break;
case 'approvecomment':
$comment = (int) $_GET['c'];
check_admin_referer('approve-comment_' . $comment);
if (isset($_GET['noredir'])) {
$noredir = true;
} else {
$noredir = false;
}
if ( ! $comment = get_comment($comment) )
wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
wp_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
wp_set_comment_status($comment->comment_ID, "approve");
if (get_option("comments_notify") == true) {
wp_notify_postauthor($comment->comment_ID);
}
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');
}
exit();
break;
case 'editedcomment':
$comment_ID = (int) $_POST['comment_ID'];
$comment_post_ID = (int) $_POST['comment_post_id'];
check_admin_referer('update-comment_' . $comment_ID);
edit_comment();
$location = ( empty($_POST['referredby']) ? "edit.php?p=$comment_post_ID&c=1" : $_POST['referredby'] ) . '#comment-' . $comment_ID;
$location = apply_filters('comment_edit_redirect', $location, $comment_ID);
wp_redirect($location);
exit();
break;
default:
break;
} // end switch
include('admin-footer.php');
?>

View File

@@ -1,26 +0,0 @@
function customFieldsOnComplete( what, where, update, transport ) {
var pidEl = $('post_ID');
pidEl.name = 'post_ID';
pidEl.value = getNodeValue(transport.responseXML, 'postid');
var aEl = $('hiddenaction')
if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
}
addLoadEvent(customFieldsAddIn);
function customFieldsAddIn() {
theList.showLink=0;
theList.addComplete = customFieldsOnComplete;
if (!theList.theList) return false;
inputs = theList.theList.getElementsByTagName('input');
for ( var i=0; i < inputs.length; i++ ) {
if ('text' == inputs[i].type) {
inputs[i].setAttribute('autocomplete', 'off');
inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
}
if ('updatemeta' == inputs[i].className) {
inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
}
}
$('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
$('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
}

View File

@@ -1,332 +0,0 @@
<?php
class Custom_Image_Header {
var $admin_header_callback;
function Custom_Image_Header($admin_header_callback) {
$this->admin_header_callback = $admin_header_callback;
}
function init() {
$page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
add_action("admin_head-$page", array(&$this, 'js'), 50);
add_action("admin_head-$page", $this->admin_header_callback, 51);
}
function js_includes() {
wp_enqueue_script('cropper');
wp_enqueue_script('colorpicker');
}
function js() {
if ( isset( $_POST['textcolor'] ) ) {
check_admin_referer('custom-header');
if ( 'blank' == $_POST['textcolor'] ) {
set_theme_mod('header_textcolor', 'blank');
} else {
$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
if ( strlen($color) == 6 || strlen($color) == 3 )
set_theme_mod('header_textcolor', $color);
}
}
if ( isset($_POST['resetheader']) ) {
check_admin_referer('custom-header');
remove_theme_mods();
}
?>
<script type="text/javascript">
function onEndCrop( coords, dimensions ) {
$( 'x1' ).value = coords.x1;
$( 'y1' ).value = coords.y1;
$( 'x2' ).value = coords.x2;
$( 'y2' ).value = coords.y2;
$( 'width' ).value = dimensions.width;
$( 'height' ).value = dimensions.height;
}
// with a supplied ratio
Event.observe(
window,
'load',
function() {
var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
var ratio = xinit / yinit;
var ximg = $('upload').width;
var yimg = $('upload').height;
if ( yimg < yinit || ximg < xinit ) {
if ( ximg / yimg > ratio ) {
yinit = yimg;
xinit = yinit * ratio;
} else {
xinit = ximg;
yinit = xinit / ratio;
}
}
new Cropper.Img(
'upload',
{
ratioDim: { x: xinit, y: yinit },
displayOnInit: true,
onEndCrop: onEndCrop
}
)
}
);
var cp = new ColorPicker();
function pickColor(color) {
$('name').style.color = color;
$('desc').style.color = color;
$('textcolor').value = color;
}
function PopupWindow_hidePopup(magicword) {
if ( magicword != 'prettyplease' )
return false;
if (this.divName != null) {
if (this.use_gebi) {
document.getElementById(this.divName).style.visibility = "hidden";
}
else if (this.use_css) {
document.all[this.divName].style.visibility = "hidden";
}
else if (this.use_layers) {
document.layers[this.divName].visibility = "hidden";
}
}
else {
if (this.popupWindow && !this.popupWindow.closed) {
this.popupWindow.close();
this.popupWindow = null;
}
}
return false;
}
function colorSelect(t,p) {
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) {
cp.hidePopup('prettyplease');
} else {
cp.p = p;
cp.select(t,p);
}
}
function colorDefault() {
pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
}
function hide_text() {
$('name').style.display = 'none';
$('desc').style.display = 'none';
$('pickcolor').style.display = 'none';
$('defaultcolor').style.display = 'none';
$('textcolor').value = 'blank';
$('hidetext').value = '<?php _e('Show Text'); ?>';
// $('hidetext').onclick = 'show_text()';
Event.observe( $('hidetext'), 'click', show_text );
}
function show_text() {
$('name').style.display = 'block';
$('desc').style.display = 'block';
$('pickcolor').style.display = 'inline';
$('defaultcolor').style.display = 'inline';
$('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
$('hidetext').value = '<?php _e('Hide Text'); ?>';
Event.stopObserving( $('hidetext'), 'click', show_text );
Event.observe( $('hidetext'), 'click', hide_text );
}
<?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
Event.observe( window, 'load', hide_text );
<?php } ?>
</script>
<?php
}
function step_1() {
if ( $_GET['updated'] ) { ?>
<div id="message" class="updated fade">
<p><?php _e('Header updated.') ?></p>
</div>
<?php } ?>
<div class="wrap">
<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: 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>
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&amp;updated=true">
<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>
<?php } ?>
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
</div>
<div class="wrap">
<h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
<input type="hidden" name="action" value="save" />
<?php wp_nonce_field('custom-header') ?>
<p class="submit">
<input type="submit" value="<?php _e('Upload'); ?> &raquo;" />
</p>
</form>
</div>
<?php if ( get_theme_mod('header_image') || get_theme_mod('header_textcolor') ) : ?>
<div class="wrap">
<h2><?php _e('Reset Header Image and Color'); ?></h2>
<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
<?php wp_nonce_field('custom-header'); ?>
<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
</form>
</div>
<?php endif;
}
function step_2() {
check_admin_referer('custom-header');
$overrides = array('test_form' => false);
$file = wp_handle_upload($_FILES['import'], $overrides);
if ( isset($file['error']) )
die( $file['error'] );
$url = $file['url'];
$file = $file['file'];
$filename = basename($file);
// Construct the object array
$object = array(
'post_title' => $filename,
'post_content' => $url,
'post_mime_type' => 'import',
'guid' => $url);
// Save the data
$id = wp_insert_attachment($object, $file);
$upload = array('file' => $file, 'id' => $id);
list($width, $height, $type, $attr) = getimagesize( $file );
if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
set_theme_mod('header_image', clean_url($url));
$header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication
return $this->finished();
} elseif ( $width > HEADER_IMAGE_WIDTH ) {
$oitar = $width / HEADER_IMAGE_WIDTH;
$image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
$image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
$url = str_replace(basename($url), basename($image), $url);
$width = $width / $oitar;
$height = $height / $oitar;
} else {
$oitar = 1;
}
?>
<div class="wrap">
<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
<div id="testWrap">
<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
</div>
<p class="submit">
<input type="hidden" name="x1" id="x1" />
<input type="hidden" name="y1" id="y1" />
<input type="hidden" name="x2" id="x2" />
<input type="hidden" name="y2" id="y2" />
<input type="hidden" name="width" id="width" />
<input type="hidden" name="height" id="height" />
<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
<?php wp_nonce_field('custom-header') ?>
<input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" />
</p>
</form>
</div>
<?php
}
function step_3() {
check_admin_referer('custom-header');
if ( $_POST['oitar'] > 1 ) {
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
$_POST['width'] = $_POST['width'] * $_POST['oitar'];
$_POST['height'] = $_POST['height'] * $_POST['oitar'];
}
$header = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);
$header = apply_filters('wp_create_file_in_uploads', $header); // For replication
$parent = get_post($_POST['attachment_id']);
$parent_url = $parent->guid;
$url = str_replace(basename($parent_url), basename($header), $parent_url);
set_theme_mod('header_image', $url);
// cleanup
$file = get_attached_file( $_POST['attachment_id'] );
$medium = str_replace(basename($file), 'midsize-'.basename($file), $file);
@unlink( apply_filters( 'wp_delete_file', $medium ) );
wp_delete_attachment( $_POST['attachment_id'] );
return $this->finished();
}
function finished() {
?>
<div class="wrap">
<h2><?php _e('Header complete!'); ?></h2>
<p><?php _e('Visit your site and you should see the new header now.'); ?></p>
</div>
<?php
}
function admin_page() {
if ( !isset( $_GET['step'] ) )
$step = 1;
else
$step = (int) $_GET['step'];
if ( 1 == $step ) {
$this->step_1();
} elseif ( 2 == $step ) {
$this->step_2();
} elseif ( 3 == $step ) {
$this->step_3();
}
}
}
?>

View File

@@ -1,47 +0,0 @@
addLoadEvent( function() {var manager = new dbxManager( dbxL10n.manager );} );
addLoadEvent( function()
{
//create new docking boxes group
var meta = new dbxGroup(
'grabit', // container ID [/-_a-zA-Z0-9/]
'vertical', // orientation ['vertical'|'horizontal']
'10', // drag threshold ['n' pixels]
'no', // restrict drag movement to container axis ['yes'|'no']
'10', // animate re-ordering [frames per transition, or '0' for no effect]
'yes', // include open/close toggle buttons ['yes'|'no']
'closed', // default state ['open'|'closed']
dbxL10n.open, // word for "open", as in "open this box"
dbxL10n.close, // word for "close", as in "close this box"
dbxL10n.moveMouse, // sentence for "move this box" by mouse
dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse
dbxL10n.moveKey, // sentence for "move this box" by keyboard
dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
);
// Boxes are closed by default. Open the Category box if the cookie isn't already set.
var catdiv = document.getElementById('categorydiv');
if ( catdiv ) {
var button = catdiv.getElementsByTagName('A')[0];
if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
meta.toggleBoxState(button, true);
}
var advanced = new dbxGroup(
'advancedstuff',
'vertical',
'10',
'yes', // restrict drag movement to container axis ['yes'|'no']
'10',
'yes',
'closed',
dbxL10n.open,
dbxL10n.close,
dbxL10n.moveMouse,
dbxL10n.toggleMouse,
dbxL10n.moveKey,
dbxL10n.toggleKey,
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
);
});

View File

@@ -1,49 +0,0 @@
<?php
if ( ! empty($cat_ID) ) {
$heading = __('Edit Category');
$submit_text = __('Edit Category &raquo;');
$form = '<form name="editcat" id="editcat" method="post" action="categories.php">';
$action = 'editedcat';
$nonce_action = 'update-category_' . $cat_ID;
do_action('edit_category_form_pre', $category);
} else {
$heading = __('Add Category');
$submit_text = __('Add Category &raquo;');
$form = '<form name="addcat" id="addcat" method="post" action="categories.php">';
$action = 'addcat';
$nonce_action = 'add-category';
do_action('add_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->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->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->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->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->category_description); ?></textarea></td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
<?php do_action('edit_category_form', $category); ?>
</form>
</div>

View File

@@ -1,59 +0,0 @@
addLoadEvent(function() {
theCommentList = new listMan('the-comment-list');
if ( !theCommentList )
return false;
theExtraCommentList = new listMan('the-extra-comment-list');
if ( theExtraCommentList ) {
theExtraCommentList.showLink = 0;
theExtraCommentList.altOffset = 1;
if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes )
var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
else
var commentNum = 0;
var urlQ = document.location.href.split('?');
var params = urlQ[1] ? urlQ[1].toQueryParams() : [];
var search = params['s'] ? params['s'] : '';
var page = params['apage'] ? params['apage'] : 1;
}
theCommentList.dimComplete = function(what,id,dimClass) {
var m = document.getElementById('awaitmod');
if ( document.getElementById(what + '-' + id).className.match(dimClass) )
m.innerHTML = parseInt(m.innerHTML,10) + 1;
else
m.innerHTML = parseInt(m.innerHTML,10) - 1;
}
theCommentList.delComplete = function(what,id) {
var m = document.getElementById('awaitmod');
what = what.split('-')[0];
if ( document.getElementById(what + '-' + id).className.match('unapproved') )
m.innerHTML = parseInt(m.innerHTML,10) - 1;
if ( theExtraCommentList && commentNum ) {
var theMover = theExtraCommentList.theList.childNodes[0];
Element.removeClassName(theMover,'alternate');
theCommentList.theList.appendChild(theMover);
theExtraCommentList.inputData += '&page=' + page;
if ( search )
theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box
theExtraCommentList.addComplete = function() {
if ( theExtraCommentList.theList.childNodes )
var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
else
var commentNum = 0;
}
theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request
}
}
if ( theList ) // the post list: edit.php
theList.delComplete = function() {
var comments = document.getElementById('comments');
var commdel = encloseFunc(function(a){a.parentNode.removeChild(a);},comments);
var listdel = encloseFunc(function(a){a.parentNode.removeChild(a);},theCommentList.theList);
setTimeout(commdel,705);
setTimeout(listdel,705);
}
});

View File

@@ -2,8 +2,8 @@
require_once('admin.php');
$title = __('Edit Comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
$parent_file = 'edit.php';
$list_js = true;
require_once('admin-header.php');
if (empty($_GET['mode'])) $mode = 'view';
@@ -23,29 +23,17 @@ function checkAll(form)
}
}
}
function getNumChecked(form)
{
var num = 0;
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].checked == true)
num++;
}
}
return num;
}
//-->
</script>
<div class="wrap">
<h2><?php _e('Comments'); ?></h2>
<form name="searchform" action="" method="get" id="editcomments">
<form name="searchform" action="" method="get">
<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.)') ?>
<?php _e('(Searches within comment text, e-mail, URI, and IP address.)') ?>
</fieldset>
</form>
<p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p>
@@ -56,82 +44,83 @@ if ( !empty( $_POST['delete_comments'] ) ) :
$i = 0;
foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
$comment = (int) $comment;
$post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
// $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
if ( current_user_can('edit_post', $post_id) ) {
if ( !empty( $_POST['spam_button'] ) )
wp_set_comment_status($comment, 'spam');
else
wp_set_comment_status($comment, 'delete');
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
$authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
if ( current_user_can('edit_post', $post_id) ) :
wp_set_comment_status($comment, "delete");
++$i;
}
endif;
endforeach;
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
if ( !empty( $_POST['spam_button'] ) ) {
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam.', $i), $i);
} else {
printf(__ngettext('%s comment deleted.', '%s comments deleted.', $i), $i);
}
echo '</p></div>';
echo "<div class='wrap'><p>" . sprintf(__('%s comments deleted.'), $i) . "</p></div>";
endif;
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
$start = $offset = ( $page - 1 ) * 20;
list($_comments, $total) = _wp_get_comment_list( isset($_GET['s']) ? $_GET['s'] : false, $start, 25 ); // Grab a few extra
$comments = array_slice($_comments, 0, 20);
$extra_comments = array_slice($_comments, 20);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
'total' => ceil($total / 20),
'current' => $page
));
if ( $page_links )
echo "<p class='pagenav'>$page_links</p>";
if (isset($_GET['s'])) {
$s = $wpdb->escape($_GET['s']);
$comments = $wpdb->get_results("SELECT * 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");
} else {
if ( isset($_GET['offset']) )
$offset = (int) $_GET['offset'] * 20;
else
$offset = 0;
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $offset,20");
}
if ('view' == $mode) {
if ($comments) {
$offset = $offset + 1;
$start = " start='$offset'";
if ($offset)
$start = " start='$offset'";
else
$start = '';
echo "<ol id='the-comment-list' class='commentlist' $start>\n";
echo "<ol id='the-list' class='commentlist' $start>";
$i = 0;
foreach ( $comments as $comment ) {
get_comment( $comment ); // Cache it
_wp_comment_list_item( $comment->comment_ID, ++$i );
}
echo "</ol>\n\n";
foreach ($comments as $comment) {
++$i; $class = '';
$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';
if ($i % 2)
$class .= ' alternate';
echo "<li id='comment-$comment->comment_ID' class='$class'>";
?>
<p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?>
if ( $extra_comments ) : ?>
<div id="extra-comments" style="display:none">
<ul id="the-extra-comment-list" class="commentlist">
<?php
foreach ( $extra_comments as $comment ) {
get_comment( $comment ); // Cache it
_wp_comment_list_item( $comment->comment_ID, ++$i );
}
?>
</ul>
</div>
<?php endif; // $extra_comments ?>
<p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " | <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
echo ' | <a href="' . wp_nonce_url('post.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . __("You are about to delete this comment.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete.") . "' );\">" . __('Delete Comment') . '</a> ';
} // end if any comments to show
// Get post title
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID");
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?> | <a href="post.php?action=edit&amp;post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post &#8220;%s&#8221;'), stripslashes($post_title)); ?></a>
<?php } ?>
| <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
</li>
<?php } // end foreach ?>
</ol>
<div id="ajax-response"></div>
<?php
} else { //no comments to show
} else {
?>
<p>
<strong><?php _e('No comments found.') ?></strong></p>
<strong><?php _e('No comments found.') ?></strong></p>
<?php
} // end if ($comments)
} elseif ('edit' == $mode) {
@@ -139,49 +128,37 @@ if ( $extra_comments ) : ?>
if ($comments) {
echo '<form name="deletecomments" id="deletecomments" action="" method="post"> ';
wp_nonce_field('bulk-comments');
echo '<table class="widefat">
<thead>
echo '<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById(\'deletecomments\'));" /></th>
<th scope="col">*</th>
<th scope="col">' . __('Name') . '</th>
<th scope="col">' . __('E-mail') . '</th>
<th scope="col">' . __('IP') . '</th>
<th scope="col">' . __('Comment Excerpt') . '</th>
<th scope="col" colspan="3" style="text-align: center">' . __('Actions') . '</th>
</tr>
</thead>';
<th scope="col" colspan="3">' . __('Actions') . '</th>
</tr>';
foreach ($comments as $comment) {
$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; ?>'>
<tr class='<?php echo $class; ?>'>
<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="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) { ?>
(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>
<td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo "<a href='comment.php?action=editcomment&amp;c=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
echo "<a href='post.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
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>
echo "<a href=\"" . wp_nonce_url("post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return confirm('" . __("You are about to delete this comment.\\n \'Cancel\' to stop, \'OK\' to delete.") . "')\" class='delete'>" . __('Delete') . "</a>"; } ?></td>
</tr>
<?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 + '"); ?>')" />
<input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php echo js_escape(__("Please select some comments to mark as spam")); ?>'); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to mark %s comments as spam \n 'Cancel' to stop, 'OK' to mark as spam.")), "' + numchecked + '"); ?>')" /></p>
<p><a href="javascript:;" onclick="checkAll(document.getElementById('deletecomments')); return false; "><?php _e('Invert Checkbox Selection') ?></a></p>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Delete Checked Comments') ?> &raquo;" onclick="return confirm('<?php _e("You are about to delete these comments permanently.\\n \'Cancel\' to stop, \'OK\' to delete.") ?>')" /> </p>
</form>
<div id="ajax-response"></div>
<?php
} else {
?>
@@ -191,11 +168,7 @@ if ( $extra_comments ) : ?>
<?php
} // end if ($comments)
}
if ( $page_links )
echo "<p class='pagenav'>$page_links</p>";
?>
?>
</div>

View File

@@ -1,39 +1,39 @@
<?php
if ( isset($_GET['message']) )
$_GET['message'] = (int) $_GET['message'];
$messages[1] = __('Post updated');
$messages[2] = __('Custom field updated');
$messages[3] = __('Custom field deleted.');
?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo wp_specialchars($messages[$_GET['message']]); ?></p></div>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>
<form name="post" action="post.php" method="post" id="post">
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
<?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
isset($_GET['popupurl']) ): ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>
<div class="wrap">
<h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
<small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
<?php
if (0 == $post_ID) {
$form_action = 'post';
$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
$temp_ID = -1 * time();
$form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
wp_nonce_field('add-post');
} else {
$post_ID = (int) $post_ID;
$form_action = 'editpost';
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
$form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
wp_nonce_field('update-post_' . $post_ID);
}
$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
$form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="' . $post->post_status . '" />';
$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />';
if ('' != $post->pinged) {
$pings = '<p>'. __('Already pinged:') . '</p><ul>';
@@ -44,17 +44,15 @@ if ('' != $post->pinged) {
$pings .= '</ul>';
}
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
if (empty($post->post_status)) $post->post_status = 'draft';
?>
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
<input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<input type="hidden" id="post_type" name="post_type" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value="<?php echo $form_action ?>" />
<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
<?php echo $form_extra ?>
<?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
@@ -71,13 +69,6 @@ addLoadEvent(focusit);
<div id="moremeta">
<div id="grabit" class="dbx-group">
<fieldset id="categorydiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content">
<p id="jaxcat"></p>
<ul id="categorychecklist"><?php dropdown_categories(); ?></ul></div>
</fieldset>
<fieldset id="commentstatusdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
<div class="dbx-content">
@@ -90,19 +81,26 @@ addLoadEvent(focusit);
</fieldset>
<fieldset id="passworddiv" class="dbx-box">
<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>
<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
</fieldset>
<fieldset id="slugdiv" class="dbx-box">
<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>
<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 $post->post_name ?>" /></div>
</fieldset>
<fieldset id="categorydiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content">
<p id="jaxcat"></p>
<div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></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>
<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'); ?> /> <?php _e('Published') ?></label>
<?php endif; ?>
<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>
@@ -110,25 +108,22 @@ addLoadEvent(focusit);
<?php if ( current_user_can('edit_posts') ) : ?>
<fieldset id="posttimestampdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?></h3>
<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
</fieldset>
<?php endif; ?>
<?php
$authors = get_editable_authors( $current_user->id ); // TODO: ROLE SYSTEM
if ( $authors && count( $authors ) > 1 ) :
?>
<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
<fieldset id="authordiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Post Author'); ?></h3>
<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
<div class="dbx-content">
<select name="post_author_override" id="post_author_override">
<?php
<?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>";
echo "<option value='$o->ID' $selected>$o->display_name</option>";
endforeach;
?>
</select>
@@ -142,55 +137,93 @@ endforeach;
</div>
<fieldset id="titlediv">
<legend><?php _e('Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /></div>
<legend><?php _e('Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
</fieldset>
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Post') ?>
<legend><?php _e('Post') ?></legend>
<?php if ( 'publish' == $post->post_status ) { ?>
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View &raquo;'); ?></a>
<?php } elseif ( 'edit' == $action ) { ?>
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview &raquo;'); ?></a>
<?php } ?>
</legend>
<?php the_editor($post->post_content); ?>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 12;
}
?>
<?php the_quicktags(); ?>
</fieldset>
<div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
</fieldset>
<script type="text/javascript">
// <![CDATA[
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('title').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('title').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
// ]]>
</script>
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
<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" />
<p class="submit"><?php echo $saveasdraft; ?> <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'); ?>" />
<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
if ( !empty($_REQUEST['popupurl']) )
echo clean_url(stripslashes($_REQUEST['popupurl']));
else if ( url_to_postid(wp_get_referer()) == $post_ID )
echo attribute_escape(stripslashes($_REQUEST['popupurl']));
else if ( url_to_postid(stripslashes(wp_get_referer())) == $post_ID )
echo 'redo';
else
echo clean_url(stripslashes(wp_get_referer()));
echo attribute_escape(stripslashes(wp_get_referer()));
?>" /></p>
<?php do_action('edit_form_advanced'); ?>
<?php
if (current_user_can('upload_files')) {
$uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
$uploading_iframe_src = wp_nonce_url("inline-uploading.php?action=view&amp;post=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
@@ -216,8 +249,8 @@ if (current_user_can('upload_files')) {
<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
</div>
<div class="dbx-c-ontent-wrapper">
<div class="dbx-content"><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?> (<?php _e('Separate multiple URLs with spaces'); ?>)
<?php
<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
<?php
if ( ! empty($pings) )
echo $pings;
?>
@@ -233,17 +266,16 @@ if ( ! empty($pings) )
</div>
<div class="dbx-c-ontent-wrapper">
<div id="postcustomstuff" class="dbx-content">
<table cellpadding="3">
<?php
$metadata = has_meta($post_ID);
list_meta($metadata);
<?php
if($metadata = has_meta($post_ID)) {
?>
</table>
<?php
list_meta($metadata);
?>
<?php
}
meta_form();
?>
<div id="ajax-response"></div>
</div>
</div>
</fieldset>
@@ -254,7 +286,7 @@ list_meta($metadata);
</div>
<?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
<input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
<?php endif; ?>
</div>

View File

@@ -0,0 +1,37 @@
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');
if ( !current_user_can('manage_categories') )
die('-1');
if ( !check_ajax_referer() )
die('-1');
function get_out_now() { exit; }
add_action('shutdown', 'get_out_now', -1);
$names = explode(',', rawurldecode($_POST['ajaxnewcat']) );
$ids = array();
foreach ($names as $cat_name) {
$cat_name = trim( $cat_name );
if ( !$category_nicename = sanitize_title($cat_name) )
continue;
if ( $already = category_exists($cat_name) ) {
$ids[] = (string) $already;
continue;
}
$new_cat_id = wp_create_category($cat_name);
$ids[] = (string) $new_cat_id;
}
$return = join(',', $ids);
die( (string) $return );
?>

View File

@@ -2,13 +2,13 @@
$submitbutton_text = __('Edit Comment &raquo;');
$toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
$form_action = 'editedcomment';
$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='" . $comment->comment_post_ID;
$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID;
?>
<form name="post" action="comment.php" method="post" id="post">
<form name="post" action="post.php" method="post" id="post">
<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
<div class="wrap">
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
<script type="text/javascript">
@@ -18,29 +18,76 @@ function focusit() { // focus on first input field
addLoadEvent(focusit);
</script>
<fieldset id="namediv">
<legend><label for="name"><?php _e('Name:') ?></label></legend>
<legend><?php _e('Name:') ?></legend>
<div>
<input type="text" name="newcomment_author" size="25" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
<input type="text" name="newcomment_author" size="22" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" />
</div>
</fieldset>
<fieldset id="emaildiv">
<legend><label for="email"><?php _e('E-mail:') ?></label></legend>
<legend><?php _e('E-mail:') ?></legend>
<div>
<input type="text" name="newcomment_author_email" size="20" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
<input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email ?>" tabindex="2" id="email" />
</div>
</fieldset>
<fieldset id="uridiv">
<legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend>
<legend><?php _e('URI:') ?></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="3" />
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" />
</div>
</fieldset>
<fieldset style="clear: both;">
<legend><?php _e('Comment') ?></legend>
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url'); ?>
<?php the_quicktags(); ?>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 10;
}
?>
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div>
</fieldset>
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Author URL to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('newcomment_author_url').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('newcomment_author_url').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
</p>
@@ -54,24 +101,20 @@ addLoadEvent(focusit);
<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'); ?> /> <?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>
<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); ?> </td>
<th scope="row"><?php _e('Edit time'); ?>:</th>
<td><?php touch_time(('editcomment' == $action), 0); ?></td>
</tr>
<?php endif; ?>
<tr>
<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" />
</td>
<th scope="row"><?php _e('Delete'); ?>:</th>
<td><p><a class="delete" href="post.php?action=confirmdeletecomment&amp;noredir=true&amp;comment=<?php echo $comment->comment_ID; ?>&amp;p=<?php echo $comment->comment_post_ID; ?>"><?php _e('Delete comment') ?></a></p></td>
</tr>
</table>

View File

@@ -6,7 +6,7 @@
<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>
<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value='post' />
<script type="text/javascript">
@@ -21,7 +21,7 @@ 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>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
</fieldset>
<fieldset id="categorydiv">
@@ -34,7 +34,7 @@ addLoadEvent(focusit);
<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');
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 10;
}
@@ -49,22 +49,22 @@ edCanvas = document.getElementById('content');
//-->
</script>
<input type="hidden" name="post_pingback" value="<?php echo (int) get_option('default_pingback_flag') ?>" id="post_pingback" />
<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?>
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
<?php if ( current_user_can('edit_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
<?php endif; ?>
<?php if ('bookmarklet' != $mode) {
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />';
} ?>
<input name="referredby" type="hidden" id="referredby" value="<?php if ( $refby = wp_get_referer() ) echo urlencode($refby); ?>" />
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />';
} ?>
<input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
</p>
<?php do_action('simple_edit_form', ''); ?>

View File

@@ -1,13 +1,15 @@
<?php
if ( ! empty($link_id) ) {
$heading = __('Edit Link');
$editing = true;
$heading = __('Edit a link:');
$submit_text = __('Save Changes &raquo;');
$form = '<form name="editlink" id="editlink" method="post" action="link.php">';
$form = '<form action="" method="post" name="editlink" id="editlink">';
$nonce_action = 'update-bookmark_' . $link_id;
} else {
$heading = __('Add Link');
$editing = false;
$heading = __('<strong>Add</strong> a link:');
$submit_text = __('Add Link &raquo;');
$form = '<form name="addlink" id="addlink" method="post" action="link.php">';
$form = '<form name="addlink" method="post" action="link-manager.php">';
$nonce_action = 'add-bookmark';
}
@@ -22,236 +24,216 @@ function xfn_check($class, $value = '', $type = 'check') {
}
if ('' == $value) {
if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
}
}
?>
<div class="wrap">
<h2><?php echo $heading ?></h2>
<?php echo $form ?>
<?php wp_nonce_field($nonce_action); ?>
<div id="poststuff">
<div id="moremeta">
<div id="grabit" class="dbx-group">
<fieldset id="categorydiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content">
<p id="jaxcat"></p>
<ul id="categorychecklist"><?php dropdown_link_categories(get_option('default_link_category')); ?></ul>
</div>
</fieldset>
<fieldset class="dbx-box">
<h3 class="dbx-handle"><?php _e('Target') ?></h3>
<div class="dbx-content">
<label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
<code>_blank</code></label>
<label for="link_target_top" class="selectit">
<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
<code>_top</code></label>
<label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
<?php _e('none') ?></label>
</div>
</fieldset>
<fieldset class="dbx-box">
<h3 class="dbx-handle"><?php _e('Visible') ?></h3>
<div class="dbx-content">
<label for="link_visible_yes" class="selectit">
<input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
<?php _e('Yes') ?></label>
<label for="link_visible_no" class="selectit">
<input id="link_visible_no" type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
<?php _e('No') ?></label>
</div>
</fieldset>
</div>
</div>
<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" 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" 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" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" name="submit" value="<?php echo $submit_text ?>" />
</p>
<div id="advancedstuff" class="dbx-group" >
<fieldset id="xfn" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Link Relationship (XFN)') ?></h3>
<div class="dbx-content">
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="20%" scope="row"><?php _e('rel:') ?></th>
<td width="80%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
<td>
<table cellpadding="3" cellspacing="5">
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
<td>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
<?php _e('another web address of mine') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('friendship') ?> </th>
<td>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
<label for="friend">
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('physical') ?> </th>
<td>
<label for="met">
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
<?php _e('met') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('professional') ?> </th>
<td>
<label for="co-worker">
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
<?php _e('co-worker') ?></label>
<label for="colleague">
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
<?php _e('colleague') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('geographical') ?> </th>
<td>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
<?php _e('co-resident') ?></label>
<label for="neighbor">
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
<?php _e('neighbor') ?></label>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
<?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('family') ?> </th>
<td>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
<?php _e('child') ?></label>
<label for="kin">
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
<?php _e('kin') ?></label>
<label for="parent">
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
<?php _e('parent') ?></label>
<label for="sibling">
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
<?php _e('sibling') ?></label>
<label for="spouse">
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
<?php _e('spouse') ?></label>
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
<?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('romantic') ?> </th>
<td>
<label for="muse">
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
<?php _e('muse') ?></label>
<label for="crush">
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
<?php _e('crush') ?></label>
<label for="date">
<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
<?php _e('date') ?></label>
<label for="romantic">
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
<?php _e('sweetheart') ?></label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</fieldset>
<fieldset id="advanced" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Advanced') ?></h3>
<div class="dbx-content">
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="20%" scope="row"><?php _e('Image Address:') ?></th>
<td width="80%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('RSS Address:') ?> </th>
<td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Notes:') ?></th>
<td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
</tr>
<tr>
<th scope="row"><?php _e('Rating:') ?></th>
<td><select name="link_rating" size="1">
<?php
for ($r = 0; $r < 10; $r++) {
echo(' <option value="'.$r.'" ');
if ($link->link_rating == $r)
echo 'selected="selected"';
echo('>'.$r.'</option>');
}
?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
</td>
</tr>
<div class="wrap">
<?php echo $form ?>
<?php wp_nonce_field($nonce_action); ?>
<h2><?php echo $heading ?></h2>
<fieldset class="options">
<legend><?php _e('Basics') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('URI:') ?></th>
<td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Link Name:') ?></th>
<td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Short description:') ?></th>
<td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Category:') ?></th>
<td><?php link_category_dropdown('link_category', $link->link_category); ?></td>
</tr>
</table>
</fieldset>
</div>
<?php if ( $link_id ) : ?>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
<p class="submit">
<input type="submit" name="submit" value="<?php echo $submit_text ?>" />
</p>
<fieldset class="options">
<legend><?php _e('Link Relationship (XFN)') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('rel:') ?></th>
<td width="67%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
<td>
<table cellpadding="3" cellspacing="5">
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
<td>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
<?php _e('another web address of mine') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('friendship') ?> </th>
<td>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
<label for="friend">
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('physical') ?> </th>
<td>
<label for="met">
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
<?php _e('met') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('professional') ?> </th>
<td>
<label for="co-worker">
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
<?php _e('co-worker') ?></label>
<label for="colleague">
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
<?php _e('colleague') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('geographical') ?> </th>
<td>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
<?php _e('co-resident') ?></label>
<label for="neighbor">
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
<?php _e('neighbor') ?></label>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
<?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('family') ?> </th>
<td>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
<?php _e('child') ?></label>
<label for="kin">
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
<?php _e('kin') ?></label>
<label for="parent">
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
<?php _e('parent') ?></label>
<label for="sibling">
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
<?php _e('sibling') ?></label>
<label for="spouse">
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
<?php _e('spouse') ?></label>
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
<?php _e('none') ?></label>
</td>
</tr>
<tr>
<th scope="row"> <?php _e('romantic') ?> </th>
<td>
<label for="muse">
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
<?php _e('muse') ?></label>
<label for="crush">
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
<?php _e('crush') ?></label>
<label for="date">
<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
<?php _e('date') ?></label>
<label for="romantic">
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
<?php _e('sweetheart') ?></label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="submit" value="<?php echo $submit_text ?>" />
</p>
<fieldset class="options">
<legend><?php _e('Advanced') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Image URI:') ?></th>
<td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('RSS URI:') ?> </th>
<td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Notes:') ?></th>
<td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
</tr>
<tr>
<th scope="row"><?php _e('Rating:') ?></th>
<td><select name="link_rating" size="1">
<?php
for ($r = 0; $r < 10; $r++) {
echo(' <option value="'.$r.'" ');
if ($link->link_rating == $r)
echo 'selected="selected"';
echo('>'.$r.'</option>');
}
?>
</select>
&nbsp;<?php _e('(Leave at 0 for no rating.)') ?> </td>
</tr>
<tr>
<th scope="row"><?php _e('Target') ?></th>
<td><label>
<input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
<code>_blank</code></label><br />
<label>
<input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
<code>_top</code></label><br />
<label>
<input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
<?php _e('none') ?></label><br />
<?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
</tr>
<tr>
<th scope="row"><?php _e('Visible:') ?></th>
<td><label>
<input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
<?php _e('Yes') ?></label><br /><label>
<input type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
<?php _e('No') ?></label></td>
</tr>
</table>
</fieldset>
<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
<?php if ( $editing ) : ?>
<input type="hidden" name="action" value="editlink" />
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
<?php else: ?>
<input type="hidden" name="action" value="add" />
<input type="hidden" name="action" value="Add" />
<?php endif; ?>
</div>
</form>
</div>
</form>
</div>

View File

@@ -1,43 +1,39 @@
<div class="wrap">
<h2 id="write-post"><?php _e('Write Page'); ?></h2>
<h2 id="write-post"><?php _e('Write Page'); ?><?php if ( 0 != $post_ID ) : ?>
<small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
<?php
if (0 == $post_ID) {
$form_action = 'post';
$nonce_action = 'add-page';
$temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
$nonce_action = 'add-post';
$temp_ID = -1 * time();
$form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
} else {
$post_ID = (int) $post_ID;
$form_action = 'editpost';
$nonce_action = 'update-page_' . $post_ID;
$nonce_action = 'update-post_' . $post_ID;
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
}
$temp_ID = (int) $temp_ID;
$user_ID = (int) $user_ID;
$sendto = clean_url(stripslashes(wp_get_referer()));
$sendto = attribute_escape(wp_get_referer());
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
$sendto = 'redo';
$sendto = 'redo';
?>
<form name="post" action="page.php" method="post" id="post">
<form name="post" action="post.php" method="post" id="post">
<?php
wp_nonce_field($nonce_action);
if (isset($mode) && 'bookmarklet' == $mode) {
echo '<input type="hidden" name="mode" value="bookmarklet" />';
echo '<input type="hidden" name="mode" value="bookmarklet" />';
}
?>
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
<?php echo $form_extra ?>
<input type="hidden" id="post_type" name="post_type" value="page" />
<input type="hidden" name="post_status" value="static" />
<script type="text/javascript">
// <![CDATA[
@@ -57,27 +53,18 @@ 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 class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Status') ?></h3>
<div class="dbx-content"><?php if ( current_user_can('publish_pages') ) : ?>
<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_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>
<fieldset id="passworddiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page 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>
<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
</fieldset>
<fieldset id="pageparent" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Parent') ?></h3>
<h3 class="dbx-handle"><?php _e('Page Parent') ?></h3>
<div class="dbx-content"><p><select name="parent_id">
<option value='0'><?php _e('Main Page (no parent)'); ?></option>
<?php parent_dropdown($post->post_parent); ?>
@@ -87,7 +74,7 @@ addLoadEvent(focusit);
<?php if ( 0 != count( get_page_templates() ) ) { ?>
<fieldset id="pagetemplate" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Template') ?></h3>
<h3 class="dbx-handle"><?php _e('Page Template:') ?></h3>
<div class="dbx-content"><p><select name="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($post->page_template); ?>
@@ -97,22 +84,20 @@ addLoadEvent(focusit);
<?php } ?>
<fieldset id="slugdiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page 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>
<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 $post->post_name ?>" /></div>
</fieldset>
<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
<fieldset id="authordiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Author'); ?></h3>
<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
<div class="dbx-content">
<select name="post_author_override" id="post_author_override">
<?php
<?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 = '';
$o->ID = (int) $o->ID;
$o->display_name = wp_specialchars( $o->display_name );
echo "<option value='$o->ID' $selected>$o->display_name</option>";
endforeach;
?>
@@ -122,7 +107,7 @@ endforeach;
<?php endif; ?>
<fieldset id="pageorder" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
</fieldset>
@@ -132,33 +117,70 @@ endforeach;
</div>
<fieldset id="titlediv">
<legend><?php _e('Page Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
<legend><?php _e('Page Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
</fieldset>
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
<legend><?php _e('Page Content') ?>
<legend><?php _e('Page Content') ?></legend>
<?php
$rows = get_settings('default_post_edit_rows');
if (($rows < 3) || ($rows > 100)) {
$rows = 10;
}
?>
<?php the_quicktags(); ?>
<?php if ( 'publish' == $post->post_status ) { ?>
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('View &raquo;'); ?></a>
<?php } elseif ( 'edit' == $action ) { ?>
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('Preview &raquo;'); ?></a>
<?php } ?>
</legend>
<?php the_editor($post->post_content); ?>
<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
</fieldset>
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
<?php if ( user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('title').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('title').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
<?php endif; ?>
//-->
</script>
<p class="submit">
<span id="autosave"></span>
<input name="save" type="submit" id="save" tabindex="3" value="<?php _e('Save and Continue Editing'); ?>" />
<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_pages') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php endif; endif;?>
<?php if ( $post_ID ) : ?>
<input name="save" type="submit" id="save" tabindex="5" value=" <?php _e('Save and Continue Editing'); ?> "/>
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Save') : _e('Create New Page') ?> &raquo;" />
<?php else : ?>
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> &raquo;" />
<?php endif; ?>
<input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" />
</p>
@@ -167,7 +189,7 @@ if ('publish' != $post->post_status || 0 == $post_ID):
<?php
if (current_user_can('upload_files')) {
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = wp_nonce_url("inline-uploading.php?action=view&amp;post=$uploading_iframe_ID", 'inlineuploading');
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
@@ -179,14 +201,14 @@ if (current_user_can('upload_files')) {
<fieldset id="postcustom" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
<div id="postcustomstuff" class="dbx-content">
<table cellpadding="3">
<?php
$metadata = has_meta($post_ID);
list_meta($metadata);
<?php
if($metadata = has_meta($post_ID)) {
?>
</table>
<?php
list_meta($metadata);
?>
<?php
}
meta_form();
?>
</div>
@@ -198,9 +220,8 @@ list_meta($metadata);
</div>
<?php if ('edit' == $action) :
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
if ( current_user_can('delete_page', $post->ID) ) ?>
<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); ?>
<input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
<?php endif; ?>
</div>

View File

@@ -2,48 +2,65 @@
require_once('admin.php');
$title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script( 'listman' );
$list_js = true;
require_once('admin-header.php');
?>
<div class="wrap">
<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>
<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" 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>
<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>
</form>
<?php
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
if ( $_GET['s'] )
$all = false;
$show_post_type = 'page';
if ( isset($_GET['s']) )
wp();
else
$all = true;
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
if ($posts) {
?>
<table class="widefat">
<thead>
<tr>
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
<th scope="col"><?php _e('Title') ?></th>
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col"><?php _e('ID') ?></th>
<th scope="col"><?php _e('Title') ?></th>
<th scope="col"><?php _e('Owner') ?></th>
<th scope="col"><?php _e('Updated') ?></th>
<th scope="col" colspan="3" style="text-align: center"><?php _e('Action'); ?></th>
</tr>
</thead>
<tbody id="the-list">
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
<?php
page_rows(0, 0, $posts, $all);
if ( isset($_GET['s']) ) {
foreach ( $posts as $post ) :
$class = ('alternate' != $class) ? 'alternate' : ''; ?>
<tr id='page-<?php echo $post->ID; ?>' class='<?php echo $class; ?>'>
<th scope="row"><?php echo $post->ID; ?></th>
<td>
<?php echo $pad; ?><?php the_title() ?>
</td>
<td><?php the_author() ?></td>
<td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
<td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$post->ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<td><?php if ( current_user_can('edit_pages') ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title('','',0))) . "' );\">" . __('Delete') . "</a>"; } ?></td>
</tr>
<?php
endforeach;
} else {
page_rows();
}
?>
</tbody>
</table>
</table>
<div id="ajax-response"></div>
@@ -53,10 +70,10 @@ page_rows(0, 0, $posts, $all);
<p><?php _e('No pages yet.') ?></p>
<?php
} // end if ($posts)
?>
?>
<h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3>
<h3><a href="page-new.php"><?php _e('Create New Page'); ?> &raquo;</a></h3>
</div>
<?php include('admin-footer.php'); ?>
<?php include('admin-footer.php'); ?>

View File

@@ -3,7 +3,7 @@ require_once('admin.php');
$title = __('Posts');
$parent_file = 'edit.php';
wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
$list_js = true;
require_once('admin-header.php');
$_GET['m'] = (int) $_GET['m'];
@@ -12,40 +12,40 @@ $drafts = get_users_drafts( $user_ID );
$other_drafts = get_others_drafts( $user_ID);
if ($drafts || $other_drafts) {
?>
?>
<div class="wrap">
<?php if ($drafts) { ?>
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
<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));
$draft->post_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>
?>
.</p>
<?php } ?>
<?php if ($other_drafts) { ?>
<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
<?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));
$draft->post_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>
?>
.</p>
<?php } ?>
@@ -55,8 +55,11 @@ if ($drafts || $other_drafts) {
<div class="wrap">
<h2>
<?php
$what_to_show = 'posts';
$posts_per_page = 15;
$posts_per_archive_page = -1;
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
wp();
if ( is_month() ) {
single_month_title(' ');
@@ -64,7 +67,7 @@ if ( is_month() ) {
printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
} else {
if ( is_single() )
printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
printf(__('Comments on %s'), $post->post_title);
elseif ( ! is_paged() || get_query_var('paged') == 1 )
_e('Last 15 Posts');
else
@@ -73,66 +76,56 @@ if ( is_month() ) {
?>
</h2>
<form name="searchform" id="searchform" action="" method="get">
<form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;">
<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" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
</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");
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
if ( count($arc_result) ) { ?>
<form name="viewarc" id="viewarc" action="" method="get">
<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
<fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<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'] )
foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth;
if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (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 $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
echo $month[zeroise($arc_month, 2)] . " $arc_year";
echo "</option>\n";
}
?>
</select>
<input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" />
<input type="submit" name="submit" value="<?php _e('Show Month') ?>" />
</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(
'id' => '<div style="text-align: center">' . __('ID') . '</div>',
'date' => __('When'),
'title' => __('Title'),
'categories' => __('Categories'),
'comments' => '<div style="text-align: center">' . __('Comments') . '</div>',
'author' => __('Author')
'id' => __('ID'),
'date' => __('When'),
'title' => __('Title'),
'categories' => __('Categories'),
'comments' => __('Comments'),
'author' => __('Author')
);
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
@@ -143,8 +136,7 @@ $posts_columns['control_delete'] = '';
?>
<table class="widefat">
<thead>
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
<tr>
<?php foreach($posts_columns as $column_display_name) { ?>
@@ -152,15 +144,12 @@ $posts_columns['control_delete'] = '';
<?php } ?>
</tr>
</thead>
<tbody id="the-list">
<?php
if ($posts) {
$bgcolor = '';
while (have_posts()) : the_post();
add_filter('the_title','wp_specialchars');
foreach ($posts as $post) { start_wp();
$class = ('alternate' == $class) ? '' : 'alternate';
?>
?>
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<?php
@@ -168,16 +157,16 @@ $class = ('alternate' == $class) ? '' : 'alternate';
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>
<th scope="row"><?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>
<td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td>
<?php
break;
case 'title':
@@ -195,9 +184,9 @@ foreach($posts_columns as $column_name=>$column_display_name) {
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>
<td><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
<?php comments_number(__('0'), __('1'), __('%')) ?>
</a></td>
<?php
break;
@@ -221,7 +210,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
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>
<td><?php if ( current_user_can('edit_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 . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
<?php
break;
@@ -235,7 +224,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
?>
</tr>
<?php
endwhile;
}
} else {
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
@@ -243,8 +232,7 @@ endwhile;
</tr>
<?php
} // end if ($posts)
?>
</tbody>
?>
</table>
<div id="ajax-response"></div>
@@ -259,48 +247,54 @@ 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) {
?>
<h3 id="comments"><?php _e('Comments') ?></h3>
<ol id="the-comment-list" class="commentlist">
?>
<h3><?php _e('Comments') ?></h3>
<ol id="comments">
<?php
$i = 0;
foreach ($comments as $comment) {
$comment_status = wp_get_comment_status($comment->comment_ID);
?>
++$i; $class = '';
$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';
if ($i % 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>
<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
<?php comment_date('Y-n-j') ?>
@
<?php comment_time('g:m:s a') ?>
<?php
if ( current_user_can('edit_post', $post->ID) ) {
echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit') . "</a>";
echo ' - <a href="' . wp_nonce_url('post.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return confirm(\'' . __("You are about to delete this comment.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete.") . "');\">" . __('Delete') . '</a> ';
<?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> ";
}
?>
</p>
</li>
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
if ('approved' == wp_get_comment_status($comment->comment_ID)) {
echo ' - <a href="' . wp_nonce_url('post.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '">' . __('Unapprove') . '</a> ';
} else {
echo ' - <a href="' . wp_nonce_url('post.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '">' . __('Approve') . '</a> ';
}
}
echo "]";
} // end if any comments to show
?>
<br />
<strong>
<?php comment_author() ?>
(
<?php comment_author_email_link() ?>
/
<?php comment_author_url_link() ?>
)</strong> (IP:
<?php comment_author_IP() ?>
)
<?php comment_text() ?>
</li>
<!-- /comment -->
<?php //end of the loop, don't delete
} // end foreach
echo '</ol>';
}//end if comments
?>
<?php } ?>
</div>
<?php
<?php } ?>
</div>
<?php
include('admin-footer.php');
?>
?>

View File

@@ -0,0 +1,25 @@
<?php
require_once('../wp-config.php');
// Do pingbacks
while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
pingback($ping->post_content, $ping->ID);
}
// Do Enclosures
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
do_enclose($enclosure->post_content, $enclosure->ID);
}
// Do Trackbacks
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
if ( is_array($trackbacks) ) {
foreach ( $trackbacks as $trackback ) {
do_trackbacks($trackback->ID);
}
}
?>

View File

@@ -1,227 +0,0 @@
<?php
require_once ('admin.php');
$title = __('Export');
$parent_file = 'edit.php';
if ( isset( $_GET['download'] ) )
export_wp();
require_once ('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Export'); ?></h2>
<div class="narrow">
<p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
<p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, comments, custom fields, and categories.'); ?></p>
<p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></p>
<form action="" method="get">
<h3><?php _e('Optional options'); ?></h3>
<table>
<tr>
<th><?php _e('Restrict Author:'); ?></th>
<td>
<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" );
foreach ( $authors as $id ) {
$o = get_userdata( $id );
echo "<option value='$o->ID'>$o->display_name</option>";
}
?>
</select>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Download Export File'); ?> &raquo;" />
<input type="hidden" name="download" value="true" />
</p>
</form>
</div>
</div>
<?php
function 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);
$where = '';
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
$author_id = (int) $_GET['author'];
$where = " WHERE post_author = '$author_id' ";
}
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
$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->cat_ID] = $category->category_parent;
$parents = array_unique(array_diff($parents, array_keys($parents)));
if ( $zero = array_search('0', $parents) )
unset($parents[$zero]);
return $parents;
}
while ( $parents = wxr_missing_parents($categories) ) {
$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
break;
}
// Put them in order to be inserted with no child going before its parent
$pass = 0;
$passes = 1000 + count($categories);
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) {
$cats[$cat->cat_ID] = $cat;
} else {
$categories[] = $cat;
}
}
unset($categories);
function wxr_cdata($str) {
if ( seems_utf8($str) == false )
$str = utf8_encode($str);
// $str = ent2ncr(wp_specialchars($str));
$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
return $str;
}
function wxr_cat_name($c) {
if ( empty($c->cat_name) )
return;
echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
}
function wxr_category_description($c) {
if ( empty($c->category_description) )
return;
echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
}
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.
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"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<title><?php bloginfo_rss('name'); ?></title>
<link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss("description") ?></description>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
<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->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 ($posts) { foreach ($posts as $post) { start_wp(); ?>
<item>
<title><?php the_title_rss() ?></title>
<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 the_category_rss() ?>
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
<wp:status><?php echo $post->post_status; ?></wp:status>
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<?php
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
if ( $postmeta ) {
?>
<?php foreach( $postmeta as $meta ) { ?>
<wp:postmeta>
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
</wp:postmeta>
<?php } ?>
<?php } ?>
<?php
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
<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>
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
</wp:comment>
<?php } } ?>
</item>
<?php } } ?>
</channel>
</rss>
<?php
die();
}
include ('admin-footer.php');
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,13 +1,13 @@
<?php
require_once ('admin.php');
$title = __('Import');
$parent_file = 'edit.php';
$parent_file = 'import.php';
require_once ('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Import'); ?></h2>
<p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>
<p><?php _e('If you have posts or comments in another system WordPress can import them into your current blog. To get started, choose a system to import from below:'); ?></p>
<?php
@@ -17,11 +17,10 @@ $import_root = ABSPATH.$import_loc;
$imports_dir = @ dir($import_root);
if ($imports_dir) {
while (($file = $imports_dir->read()) !== false) {
if ($file{0} == '.') {
if (preg_match('|^\.+$|', $file))
continue;
} elseif (substr($file, -4) == '.php') {
require_once($import_root . '/' . $file);
}
if (preg_match('|\.php$|', $file))
require_once("$import_root/$file");
}
}
@@ -31,7 +30,7 @@ if (empty ($importers)) {
echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
} else {
?>
<table class="widefat">
<table width="100%" cellpadding="3" cellspacing="3">
<?php
$style = '';
@@ -43,8 +42,8 @@ if (empty ($importers)) {
$style = 'class="'.$style.'"';
echo "
<tr $style>
<td class='import-system'>$action</td>
<td class='desc'>{$data[1]}</td>
<td class=\"togl\">$action</td>
<td class=\"desc\">{$data[1]}</td>
</tr>";
}
?>

0
wp-admin/import/b2.php Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,194 +0,0 @@
<?php
/* By Shayne Sweeney - http://www.theshayne.com/ */
class BW_Import {
var $file;
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Blogware').'</h2>';
}
function footer() {
echo '</div>';
}
function unhtmlentities($string) { // From php.net for < 4.3 compat
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=blogware&amp;step=1");
echo '</div>';
}
function import_posts() {
global $wpdb, $current_user;
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
$importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);
preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
$posts = $posts[1];
unset($importdata);
echo '<ol>';
foreach ($posts as $post) {
flush();
preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
$post_type = $post_type[1];
if($post_type == "photo") {
preg_match('|<photoFilename>(.*?)</photoFilename>|is', $post, $post_title);
} else {
preg_match('|<title>(.*?)</title>|is', $post, $post_title);
}
$post_title = $wpdb->escape(trim($post_title[1]));
preg_match('|<pubDate>(.*?)</pubDate>|is', $post, $post_date);
$post_date = strtotime($post_date[1]);
$post_date = gmdate('Y-m-d H:i:s', $post_date);
preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
$categories = $categories[1];
$cat_index = 0;
foreach ($categories as $category) {
$categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category));
$cat_index++;
}
if(strcasecmp($post_type, "photo") === 0) {
preg_match('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
$post_content = '<img src="'.trim($post_content[1]).'" />';
$post_content = $this->unhtmlentities($post_content);
} else {
preg_match('|<body>(.*?)</body>|is', $post, $post_content);
$post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
$post_content = $this->unhtmlentities($post_content);
}
// Clean up content
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
$post_content = str_replace('<hr>', '<hr />', $post_content);
$post_content = $wpdb->escape($post_content);
$post_author = $current_user->ID;
preg_match('|<postStatus>(.*?)</postStatus>|is', $post, $post_status);
$post_status = trim($post_status[1]);
echo '<li>';
if ($post_id = post_exists($post_title, $post_content, $post_date)) {
printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
} else {
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 (!$post_id) {
_e("Couldn't get post ID");
echo '</li>';
break;
}
if(0 != count($categories))
wp_create_categories($categories, $post_id);
}
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1];
if ( $comments ) {
$comment_post_ID = (int) $post_id;
$num_comments = 0;
foreach ($comments as $comment) {
preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
$comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
$comment_content = $this->unhtmlentities($comment_content);
// Clean up content
$comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content);
$comment_content = str_replace('<br>', '<br />', $comment_content);
$comment_content = str_replace('<hr>', '<hr />', $comment_content);
$comment_content = $wpdb->escape($comment_content);
preg_match('|<pubDate>(.*?)</pubDate>|is', $comment, $comment_date);
$comment_date = trim($comment_date[1]);
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
preg_match('|<author>(.*?)</author>|is', $comment, $comment_author);
$comment_author = $wpdb->escape(trim($comment_author[1]));
$comment_author_email = NULL;
$comment_approved = 1;
// Check if it's already there
if (!comment_exists($comment_author, $comment_date)) {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved');
$commentdata = wp_filter_comment($commentdata);
wp_insert_comment($commentdata);
$num_comments++;
}
}
}
if ( $num_comments ) {
echo ' ';
printf(__('(%s comments)'), $num_comments);
}
echo '</li>';
flush();
ob_flush();
}
echo '</ol>';
}
function import() {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
echo $file['error'];
return;
}
$this->file = $file['file'];
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
}
function dispatch() {
if (empty ($_GET['step']))
$step = 0;
else
$step = (int) $_GET['step'];
$this->header();
switch ($step) {
case 0 :
$this->greet();
break;
case 1 :
$this->import();
break;
}
$this->footer();
}
function BW_Import() {
// Nothing.
}
}
$blogware_import = new BW_Import();
register_importer('blogware', __('Blogware'), __('Import posts from Blogware'), array ($blogware_import, 'dispatch'));
?>

View File

@@ -1,21 +1,16 @@
<?php
/*
* DotClear import plugin
* by Thomas Quinot - http://thomas.quinot.org/
*/
/**
Add These Functions to make our lives easier
**/
if(!function_exists('get_catbynicename'))
{
function get_catbynicename($category_nicename)
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;
}
}
@@ -60,58 +55,57 @@ if(!function_exists('link_exists'))
//
// This cries out for a C-implementation to be included in PHP core
//
function valid_1byte($char) {
if(!is_int($char)) return false;
return ($char & 0x80) == 0x00;
}
function valid_2byte($char) {
if(!is_int($char)) return false;
return ($char & 0xE0) == 0xC0;
}
function valid_1byte($char) {
if(!is_int($char)) return false;
return ($char & 0x80) == 0x00;
}
function valid_3byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0;
}
function valid_2byte($char) {
if(!is_int($char)) return false;
return ($char & 0xE0) == 0xC0;
}
function valid_3byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0;
}
function valid_4byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0;
}
function valid_nextbyte($char) {
if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80;
}
function valid_utf8($string) {
$len = strlen($string);
$i = 0;
while( $i < $len ) {
$char = ord(substr($string, $i++, 1));
if(valid_1byte($char)) { // continue
continue;
} else if(valid_2byte($char)) { // check 1 byte
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_3byte($char)) { // check 2 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_4byte($char)) { // check 3 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} // goto next char
}
return true; // done
}
function valid_4byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0;
}
function valid_nextbyte($char) {
if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80;
}
function valid_utf8($string) {
$len = strlen($string);
$i = 0;
while( $i < $len ) {
$char = ord(substr($string, $i++, 1));
if(valid_1byte($char)) { // continue
continue;
} else if(valid_2byte($char)) { // check 1 byte
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_3byte($char)) { // check 2 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_4byte($char)) { // check 3 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} // goto next char
}
return true; // done
}
function csc ($s) {
if (valid_utf8 ($s)) {
@@ -133,7 +127,7 @@ class Dotclear_Import {
function header()
{
echo '<div class="wrap">';
echo '<h2>'.__('Import DotClear').'</h2>';
echo '<h2>'.__('Import Dotclear').'</h2>';
echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
}
@@ -141,79 +135,78 @@ class Dotclear_Import {
{
echo '</div>';
}
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>';
echo '<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>';
echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
wp_nonce_field('import-dotclear');
$this->db_form();
echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories &raquo;')).'" /></p>';
echo '</form></div>';
echo '<input type="submit" name="submit" value="'.__('Import Categories').'" />';
echo '</form>';
}
function get_dc_cats()
function get_dc_cats()
{
global $wpdb;
// General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$dbprefix = get_option('dcdbprefix');
$prefix = get_option('tpre');
// Get Categories
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'categorie', ARRAY_A);
return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);
}
function get_dc_users()
{
global $wpdb;
// General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$dbprefix = get_option('dcdbprefix');
$prefix = get_option('tpre');
// Get Users
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'user', ARRAY_A);
return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);
}
function get_dc_posts()
{
// General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$dbprefix = get_option('dcdbprefix');
$prefix = get_option('tpre');
// Get Posts
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name
FROM dc_post INNER JOIN dc_categorie
ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);
}
function get_dc_comments()
{
global $wpdb;
// General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$dbprefix = get_option('dcdbprefix');
$prefix = get_option('tpre');
// Get Comments
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'comment', ARRAY_A);
return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);
}
function get_dc_links()
{
//General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0);
$dbprefix = get_option('dcdbprefix');
$prefix = get_option('tpre');
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
}
function cat2wp($categories='')
function cat2wp($categories='')
{
// General Housekeeping
global $wpdb;
@@ -223,11 +216,11 @@ class Dotclear_Import {
if(is_array($categories))
{
echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
foreach ($categories as $category)
foreach ($categories as $category)
{
$count++;
extract($category);
// Make Nice Variables
$name = $wpdb->escape($cat_libelle_url);
$title = $wpdb->escape(csc ($cat_libelle));
@@ -243,7 +236,7 @@ class Dotclear_Import {
}
$dccat2wpcat[$id] = $ret_id;
}
// Store category translation for future use
add_option('dccat2wpcat',$dccat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@@ -252,14 +245,14 @@ class Dotclear_Import {
echo __('No Categories to Import!');
return false;
}
function users2wp($users='')
{
// General Housekeeping
global $wpdb;
$count = 0;
$dcid2wpid = array();
// Midnight Mojo
if(is_array($users))
{
@@ -268,14 +261,14 @@ class Dotclear_Import {
{
$count++;
extract($user);
// Make Nice Variables
$name = $wpdb->escape(csc ($name));
$RealName = $wpdb->escape(csc ($user_pseudo));
if($uinfo = get_userdatabylogin($name))
{
$ret_id = wp_insert_user(array(
'ID' => $uinfo->ID,
'user_login' => $user_id,
@@ -285,7 +278,7 @@ class Dotclear_Import {
'display_name' => $Realname)
);
}
else
else
{
$ret_id = wp_insert_user(array(
'user_login' => $user_id,
@@ -296,9 +289,9 @@ class Dotclear_Import {
);
}
$dcid2wpid[$user_id] = $ret_id;
// Set DotClear-to-WordPress permissions translation
// Set Dotclear-to-WordPress permissions translation
// Update Usermeta Data
$user = new WP_User($ret_id);
$wp_perms = $user_level + 1;
@@ -309,26 +302,26 @@ class Dotclear_Import {
else if(3 <= $wp_perms) { $user->set_role('contributor'); }
else if(2 <= $wp_perms) { $user->set_role('contributor'); }
else { $user->set_role('subscriber'); }
update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
update_usermeta( $ret_id, 'rich_editing', 'false');
update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
update_usermeta( $ret_id, 'last_name', csc ($user_nom));
}// End foreach($users as $user)
// Store id translation array for future use
add_option('dcid2wpid',$dcid2wpid);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true;
}// End if(is_array($users)
echo __('No Users to Import!');
return false;
}// End function user2wp()
function posts2wp($posts='')
{
// General Housekeeping
@@ -345,18 +338,17 @@ class Dotclear_Import {
{
$count++;
extract($post);
// Set DotClear-to-WordPress status translation
// Set Dotclear-to-WordPress status translation
$stattrans = array(0 => 'draft', 1 => 'publish');
$comment_status_map = array (0 => 'closed', 1 => 'open');
//Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
$Title = $wpdb->escape(csc ($post_titre));
$post_content = textconv ($post_content);
$post_excerpt = "";
if ($post_chapo != "") {
$post_excerpt = textconv ($post_chapo);
$post_content = $post_excerpt ."\n<!--more-->\n".$post_content;
@@ -364,9 +356,9 @@ class Dotclear_Import {
$post_excerpt = $wpdb->escape ($post_excerpt);
$post_content = $wpdb->escape ($post_content);
$post_status = $stattrans[$post_pub];
// Import Post data into WordPress
if($pinfo = post_exists($Title,$post_content))
{
$ret_id = wp_insert_post(array(
@@ -386,7 +378,7 @@ class Dotclear_Import {
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
}
else
else
{
$ret_id = wp_insert_post(array(
'post_author' => $authorid,
@@ -405,21 +397,21 @@ class Dotclear_Import {
);
}
$dcposts2wpposts[$post_id] = $ret_id;
// Make Post-to-Category associations
$cats = array();
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
if(!empty($cats)) { wp_set_post_cats('', $ret_id, $cats); }
}
}
// Store ID translation for later use
add_option('dcposts2wpposts',$dcposts2wpposts);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
return true;
return true;
}
function comments2wp($comments='')
{
// General Housekeeping
@@ -427,7 +419,7 @@ class Dotclear_Import {
$count = 0;
$dccm2wpcm = array();
$postarr = get_option('dcposts2wpposts');
// Magic Mojo
if(is_array($comments))
{
@@ -436,16 +428,16 @@ class Dotclear_Import {
{
$count++;
extract($comment);
// WordPressify Data
$comment_ID = (int) ltrim($comment_id, '0');
$comment_post_ID = (int) $postarr[$post_id];
$comment_ID = ltrim($comment_id, '0');
$comment_post_ID = $postarr[$post_id];
$comment_approved = "$comment_pub";
$name = $wpdb->escape(csc ($comment_auteur));
$email = $wpdb->escape($comment_email);
$web = "http://".$wpdb->escape($comment_site);
$message = $wpdb->escape(textconv ($comment_content));
if($cinfo = comment_exists($name, $comment_dt))
{
// Update comments
@@ -462,7 +454,7 @@ class Dotclear_Import {
'comment_approved' => $comment_approved)
);
}
else
else
{
// Insert comments
$ret_id = wp_insert_comment(array(
@@ -480,25 +472,25 @@ class Dotclear_Import {
$dccm2wpcm[$comment_ID] = $ret_id;
}
// Store Comment ID translation for future use
add_option('dccm2wpcm', $dccm2wpcm);
add_option('dccm2wpcm', $dccm2wpcm);
// Associate newly formed categories with posts
get_comment_count($ret_id);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Comments to Import!');
return false;
}
function links2wp($links='')
{
// General Housekeeping
global $wpdb;
$count = 0;
// Deal with the links
if(is_array($links))
{
@@ -507,7 +499,7 @@ class Dotclear_Import {
{
$count++;
extract($link);
if ($title != "") {
if ($cinfo = link_cat_exists (csc ($title))) {
$category = $cinfo;
@@ -519,7 +511,7 @@ class Dotclear_Import {
} else {
$linkname = $wpdb->escape(csc ($label));
$description = $wpdb->escape(csc ($title));
if($linfo = link_exists($linkname)) {
$ret_id = wp_insert_link(array(
'link_id' => $linfo,
@@ -548,75 +540,70 @@ class Dotclear_Import {
echo __('No Links to Import!');
return false;
}
function import_categories()
{
// Category Import
function import_categories()
{
// Category Import
$cats = $this->get_dc_cats();
$this->cat2wp($cats);
add_option('dc_cats', $cats);
echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
wp_nonce_field('import-dotclear');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>';
}
function import_users()
{
// User Import
$users = $this->get_dc_users();
$users = $this->get_dc_users();
$this->users2wp($users);
echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
wp_nonce_field('import-dotclear');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
echo '</form>';
}
function import_posts()
{
// Post Import
$posts = $this->get_dc_posts();
$this->posts2wp($posts);
echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
wp_nonce_field('import-dotclear');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
echo '</form>';
}
function import_comments()
{
// Comment Import
$comments = $this->get_dc_comments();
$this->comments2wp($comments);
echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
wp_nonce_field('import-dotclear');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
echo '</form>';
}
function import_links()
{
//Link Import
$links = $this->get_dc_links();
$this->links2wp($links);
add_option('dc_links', $links);
echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
wp_nonce_field('import-dotclear');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
echo '</form>';
}
function cleanup_dcimport()
{
delete_option('dcdbprefix');
delete_option('tpre');
delete_option('dc_cats');
delete_option('dcid2wpid');
delete_option('dccat2wpcat');
@@ -630,16 +617,16 @@ class Dotclear_Import {
delete_option('dccharset');
$this->tips();
}
function tips()
{
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from DotClear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
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\'t have that login in DotClear, 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 DotClear 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 '<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 Dotclear, 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 Dotclear 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\'re coming from DotClear, 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 '<p>'.__('Also, since you\'re coming from Dotclear, 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>';
@@ -649,20 +636,20 @@ class Dotclear_Import {
echo '</ul>';
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()
{
echo '<table class="editform">';
printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:'));
printf('<tr><th><label for="dbname">%s</label></th><td><input type="text" name="dbname" id="dbname" /></td></tr>', __('DotClear Database Name:'));
printf('<tr><th><label for="dbhost">%s</label></th><td><input type="text" name="dbhost" nameid="dbhost" value="localhost" /></td></tr>', __('DotClear Database Host:'));
printf('<tr><th><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" value="dc_"/></td></tr>', __('DotClear Table prefix:'));
printf('<tr><th><label for="dccharset">%s</label></th><td><input type="text" name="dccharset" id="dccharset" value="ISO-8859-15"/></td></tr>', __('Originating character set:'));
echo '</table>';
echo '<ul>';
printf('<li><label for="dbuser">%s</label> <input type="text" name="dbuser" id="dbuser" /></li>', __('Dotclear Database User:'));
printf('<li><label for="dbpass">%s</label> <input type="password" name="dbpass" id="dbpass" /></li>', __('Dotclear Database Password:'));
printf('<li><label for="dbname">%s</label> <input type="text" name="dbname" id="dbname" /></li>', __('Dotclear Database Name:'));
printf('<li><label for="dbhost">%s</label> <input type="text" name="dbhost" id="dbhost" value="localhost" /></li>', __('Dotclear Database Host:'));
/* printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Dotclear Table prefix (if any):')); */
printf('<li><label for="dccharset">%s</label> <input type="text" id="dccharset" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));
echo '</ul>';
}
function dispatch()
function dispatch()
{
if (empty ($_GET['step']))
@@ -670,53 +657,51 @@ class Dotclear_Import {
else
$step = (int) $_GET['step'];
$this->header();
if ( $step > 0 )
if ( $step > 0 )
{
check_admin_referer('import-dotclear');
if($_POST['dbuser'])
{
if(get_option('dcuser'))
delete_option('dcuser');
add_option('dcuser', sanitize_user($_POST['dbuser'], true));
delete_option('dcuser');
add_option('dcuser',$_POST['dbuser']);
}
if($_POST['dbpass'])
{
if(get_option('dcpass'))
delete_option('dcpass');
add_option('dcpass', sanitize_user($_POST['dbpass'], true));
delete_option('dcpass');
add_option('dcpass',$_POST['dbpass']);
}
if($_POST['dbname'])
{
if(get_option('dcname'))
delete_option('dcname');
add_option('dcname', sanitize_user($_POST['dbname'], true));
delete_option('dcname');
add_option('dcname',$_POST['dbname']);
}
if($_POST['dbhost'])
{
if(get_option('dchost'))
delete_option('dchost');
add_option('dchost', sanitize_user($_POST['dbhost'], true));
add_option('dchost',$_POST['dbhost']);
}
if($_POST['dccharset'])
{
if(get_option('dccharset'))
delete_option('dccharset');
add_option('dccharset', sanitize_user($_POST['dccharset'], true));
}
add_option('dccharset',$_POST['dccharset']);
}
if($_POST['dbprefix'])
{
if(get_option('dcdbprefix'))
delete_option('dcdbprefix');
add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true));
}
if(get_option('tpre'))
delete_option('tpre');
add_option('tpre',$_POST['dbprefix']);
}
}
switch ($step)
switch ($step)
{
default:
case 0 :
@@ -741,16 +726,16 @@ class Dotclear_Import {
$this->cleanup_dcimport();
break;
}
$this->footer();
}
function Dotclear_Import()
function Dotclear_Import()
{
// Nothing.
// Nothing.
}
}
$dc_import = new Dotclear_Import();
register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog'), array ($dc_import, 'dispatch'));
register_importer('dotclear', __('Dotclear'), __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch'));
?>

View File

@@ -6,7 +6,7 @@ class GM_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import GreyMatter').'</h2>';
echo '<h2>'.__('Import Greymatter').'</h2>';
}
function footer() {
@@ -34,7 +34,6 @@ class GM_Import {
<form name="stepOne" method="get">
<input type="hidden" name="import" value="greymatter" />
<input type="hidden" name="step" value="1" />
<?php wp_nonce_field('import-greymatter'); ?>
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
<p><table cellpadding="0">
<tr>
@@ -67,10 +66,10 @@ class GM_Import {
$string = str_replace("|*|","<br />\n",$string);
return($string);
}
function import() {
global $wpdb;
$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
@@ -88,13 +87,11 @@ class GM_Import {
}
if (!chdir($archivespath))
wp_die(__("Wrong path, the path to the GM entries does not exist on the server"));
die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $archivespath));
if (!chdir($gmpath))
wp_die(__("Wrong path, the path to the GM files does not exist on the server"));
$lastentry = (int) $lastentry;
die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
$this->header();
?>
<p><?php _e('The importer is running...') ?></p>
@@ -131,7 +128,7 @@ class GM_Import {
$user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname");
$user_id = wp_insert_user($user_info);
$this->gmnames[$userdata[0]] = $user_id;
printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
}
@@ -139,11 +136,11 @@ class GM_Import {
<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
chdir($archivespath);
for($i = 0; $i <= $lastentry; $i = $i + 1) {
$entryfile = "";
if ($i<10000000) {
$entryfile .= "0";
if ($i<1000000) {
@@ -197,7 +194,7 @@ class GM_Import {
$post_status = 'publish'; //in greymatter, there are no drafts
$comment_status = 'open';
$ping_status = 'closed';
if ($post_ID = post_exists($post_title, '', $post_date)) {
echo ' ';
_e('(already exists)');
@@ -216,21 +213,21 @@ class GM_Import {
$user_email=$wpdb->escape("user@deleted.com");
$user_url=$wpdb->escape("");
$user_joindate=$wpdb->escape($user_joindate);
$user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
$user_id = wp_insert_user($user_info);
$this->gmnames[$postinfo[1]] = $user_id;
echo ': ';
printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
}
if (array_key_exists($postinfo[1], $this->gmnames)) {
$post_author = $this->gmnames[$postinfo[1]];
} else {
$post_author = $user_id;
}
$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);
}
@@ -284,7 +281,7 @@ class GM_Import {
?>
</ul><strong><?php _e('Done') ?></strong></li></ul>
<p>&nbsp;</p>
<p><?php _e('Completed GreyMatter import!') ?></p>
<p><?php _e('Completed Greymatter import!') ?></p>
<?php
$this->footer();
}
@@ -300,18 +297,17 @@ class GM_Import {
$this->greet();
break;
case 1:
check_admin_referer('import-greymatter');
$this->import();
break;
}
}
function GM_Import() {
// Nothing.
// Nothing.
}
}
$gm_import = new GM_Import();
register_importer('greymatter', __('GreyMatter'), __('Import users, posts, and comments from a Greymatter blog'), array ($gm_import, 'dispatch'));
register_importer('greymatter', __('Greymatter'), __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch'));
?>

View File

@@ -18,18 +18,15 @@ class LJ_Import {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! Upload your LiveJournal XML export file and we&#8217;ll import the posts into this blog.').'</p>';
echo '<p>'.__('Choose a LiveJournal XML file to upload, then click Upload file and import.').'</p>';
echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
echo '</div>';
}
function import_posts() {
global $wpdb, $current_user;
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
@@ -38,8 +35,9 @@ class LJ_Import {
preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
$posts = $posts[1];
unset($importdata);
echo '<ol>';
echo '<ol>';
foreach ($posts as $post) {
flush();
preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
$post_title = $wpdb->escape(trim($post_title[1]));
if ( empty($post_title) ) {
@@ -80,9 +78,9 @@ class LJ_Import {
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1];
if ( $comments ) {
$comment_post_ID = (int) $post_id;
$comment_post_ID = $post_id;
$num_comments = 0;
foreach ($comments as $comment) {
preg_match('|<event>(.*?)</event>|is', $comment, $comment_content);
@@ -120,6 +118,8 @@ class LJ_Import {
printf(__('(%s comments)'), $num_comments);
}
echo '</li>';
flush();
ob_flush();
}
echo '</ol>';
}
@@ -134,7 +134,7 @@ class LJ_Import {
$this->file = $file['file'];
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
@@ -147,26 +147,25 @@ class LJ_Import {
$step = (int) $_GET['step'];
$this->header();
switch ($step) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-upload');
$this->import();
break;
}
$this->footer();
}
function LJ_Import() {
// Nothing.
// Nothing.
}
}
$livejournal_import = new LJ_Import();
register_importer('livejournal', __('LiveJournal'), __('Import posts from a LiveJournal XML export file'), array ($livejournal_import, 'dispatch'));
register_importer('livejournal', __('LiveJournal'), __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch'));
?>

View File

@@ -11,7 +11,7 @@ class MT_Import {
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import Movable Type or TypePad').'</h2>';
echo '<h2>'.__('Import Movable Type and Typepad').'</h2>';
}
function footer() {
@@ -21,11 +21,9 @@ class MT_Import {
function greet() {
$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, choose a file to upload and click Upload file and import.'); ?></p>
<p><?php _e('Howdy! We&#8217;re about to begin the process to import all of your Movable Type entries into WordPress. To begin, select a file to upload and click Import.'); ?></p>
<?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
<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();
}
@@ -55,9 +53,9 @@ class MT_Import {
$pass = 'changeme';
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
++ $this->j;
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
if (!$user_id) { //banging my head against the desk now.
if (!$user_id) { //banging my head against the desk now.
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
$user_id = wp_create_user($author, $pass);
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
@@ -147,7 +145,6 @@ class MT_Import {
$authors = $this->get_mt_authors();
echo '<ol id="authors">';
echo '<form action="?import=mt&amp;step=2&amp;id=' . $this->id . '" method="post">';
wp_nonce_field('import-mt');
$j = -1;
foreach ($authors as $author) {
++ $j;
@@ -172,7 +169,7 @@ class MT_Import {
return;
}
$this->file = $file['file'];
$this->id = (int) $file['id'];
$this->id = $file['id'];
$this->get_entries();
$this->mt_authors_form();
@@ -296,7 +293,7 @@ class MT_Import {
}
}
$comment_post_ID = (int) $post_id;
$comment_post_ID = $post_id;
$comment_approved = 1;
// Now for comments
@@ -400,7 +397,7 @@ class MT_Import {
function import() {
$this->id = (int) $_GET['id'];
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries();
@@ -418,11 +415,9 @@ class MT_Import {
$this->greet();
break;
case 1 :
check_admin_referer('import-upload');
$this->select_authors();
break;
case 2:
check_admin_referer('import-mt');
$this->import();
break;
}
@@ -435,5 +430,5 @@ 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'));
?>
register_importer('mt', __('Movable Type and Typepad'), __('Imports <strong>posts and comments</strong> from your Movable Type or Typepad blog'), array ($mt_import, 'dispatch'));
?>

View File

@@ -19,17 +19,15 @@ class RSS_Import {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from an RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=rss&amp;step=1");
echo '</div>';
}
function get_posts() {
global $wpdb;
set_magic_quotes_runtime(0);
$datalines = file($this->file); // Read the file into an array
$importdata = implode('', $datalines); // squish it
@@ -137,7 +135,7 @@ class RSS_Import {
$this->get_posts();
$this->import_posts();
wp_import_cleanup($file['id']);
echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>';
@@ -150,22 +148,21 @@ class RSS_Import {
$step = (int) $_GET['step'];
$this->header();
switch ($step) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-upload');
$this->import();
break;
}
$this->footer();
}
function RSS_Import() {
// Nothing.
// Nothing.
}
}

View File

@@ -4,13 +4,13 @@
**/
if(!function_exists('get_catbynicename'))
{
function get_catbynicename($category_nicename)
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;
}
}
@@ -49,18 +49,15 @@ class Textpattern_Import {
{
echo '</div>';
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! This imports categories, users, posts, comments, and links from any Textpattern 4.0.2+ into this blog.').'</p>';
echo '<p>'.__('This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>';
function greet()
{
echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>';
echo '<p>'.__('Your Textpattern Configuration settings are as follows:').'</p>';
echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
wp_nonce_field('import-textpattern');
$this->db_form();
echo '<p class="submit"><input type="submit" name="submit" value="'.attribute_escape(__('Import Categories &raquo;')).'" /></p>';
echo '<input type="submit" name="submit" value="'.__('Import Categories').'" />';
echo '</form>';
echo '</div>';
}
function get_txp_cats()
@@ -70,17 +67,17 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
// Get Categories
return $txpdb->get_results('SELECT
id,
name,
title
FROM '.$prefix.'txp_category
WHERE type = "article"',
ARRAY_A);
return $txpdb->get_results('SELECT
id,
name,
title
FROM '.$prefix.'txp_category
WHERE type = "article"',
ARRAY_A);
}
function get_txp_users()
{
global $wpdb;
@@ -88,44 +85,44 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
// Get Users
return $txpdb->get_results('SELECT
user_id,
name,
RealName,
email,
privs
FROM '.$prefix.'txp_users', ARRAY_A);
user_id,
name,
RealName,
email,
privs
FROM '.$prefix.'txp_users', ARRAY_A);
}
function get_txp_posts()
{
// General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
// Get Posts
return $txpdb->get_results('SELECT
ID,
Posted,
AuthorID,
LastMod,
Title,
Body,
Excerpt,
Category1,
Category2,
Status,
Keywords,
url_title,
comments_count
FROM '.$prefix.'textpattern
', ARRAY_A);
return $txpdb->get_results('SELECT
ID,
Posted,
AuthorID,
LastMod,
Title,
Body,
Excerpt,
Category1,
Category2,
Status,
Keywords,
url_title,
comments_count
FROM '.$prefix.'textpattern
', ARRAY_A);
}
function get_txp_comments()
{
global $wpdb;
@@ -133,30 +130,30 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
// Get Comments
return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
}
function get_txp_links()
{
//General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0);
$prefix = get_option('tpre');
return $txpdb->get_results('SELECT
id,
date,
category,
url,
linkname,
description
FROM '.$prefix.'txp_link',
ARRAY_A);
return $txpdb->get_results('SELECT
id,
date,
category,
url,
linkname,
description
FROM '.$prefix.'txp_link',
ARRAY_A);
}
function cat2wp($categories='')
function cat2wp($categories='')
{
// General Housekeeping
global $wpdb;
@@ -166,16 +163,16 @@ class Textpattern_Import {
if(is_array($categories))
{
echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
foreach ($categories as $category)
foreach ($categories as $category)
{
$count++;
extract($category);
// Make Nice Variables
$name = $wpdb->escape($name);
$title = $wpdb->escape($title);
if($cinfo = category_exists($name))
{
$ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
@@ -186,7 +183,7 @@ class Textpattern_Import {
}
$txpcat2wpcat[$id] = $ret_id;
}
// Store category translation for future use
add_option('txpcat2wpcat',$txpcat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@@ -195,14 +192,14 @@ class Textpattern_Import {
echo __('No Categories to Import!');
return false;
}
function users2wp($users='')
{
// General Housekeeping
global $wpdb;
$count = 0;
$txpid2wpid = array();
// Midnight Mojo
if(is_array($users))
{
@@ -211,14 +208,14 @@ class Textpattern_Import {
{
$count++;
extract($user);
// Make Nice Variables
$name = $wpdb->escape($name);
$RealName = $wpdb->escape($RealName);
if($uinfo = get_userdatabylogin($name))
{
$ret_id = wp_insert_user(array(
'ID' => $uinfo->ID,
'user_login' => $name,
@@ -228,7 +225,7 @@ class Textpattern_Import {
'display_name' => $name)
);
}
else
else
{
$ret_id = wp_insert_user(array(
'user_login' => $name,
@@ -239,10 +236,10 @@ class Textpattern_Import {
);
}
$txpid2wpid[$user_id] = $ret_id;
// Set Textpattern-to-WordPress permissions translation
$transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
// Update Usermeta Data
$user = new WP_User($ret_id);
if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
@@ -252,24 +249,24 @@ class Textpattern_Import {
if('3' == $transperms[$privs]) { $user->set_role('contributor'); }
if('2' == $transperms[$privs]) { $user->set_role('contributor'); }
if('0' == $transperms[$privs]) { $user->set_role('subscriber'); }
update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
update_usermeta( $ret_id, 'rich_editing', 'false');
}// End foreach($users as $user)
// Store id translation array for future use
add_option('txpid2wpid',$txpid2wpid);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true;
}// End if(is_array($users)
echo __('No Users to Import!');
return false;
}// End function user2wp()
function posts2wp($posts='')
{
// General Housekeeping
@@ -286,10 +283,10 @@ class Textpattern_Import {
{
$count++;
extract($post);
// Set Textpattern-to-WordPress status translation
$stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
//Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
@@ -298,59 +295,59 @@ class Textpattern_Import {
$Body = $wpdb->escape($Body);
$Excerpt = $wpdb->escape($Excerpt);
$post_status = $stattrans[$Status];
// Import Post data into WordPress
if($pinfo = post_exists($Title,$Body))
{
$ret_id = wp_insert_post(array(
'ID' => $pinfo,
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
'ID' => $pinfo,
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
}
else
else
{
$ret_id = wp_insert_post(array(
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
}
$txpposts2wpposts[$ID] = $ret_id;
// Make Post-to-Category associations
$cats = array();
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); }
if(!empty($cats)) { wp_set_post_cats('', $ret_id, $cats); }
}
}
// Store ID translation for later use
add_option('txpposts2wpposts',$txpposts2wpposts);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
return true;
return true;
}
function comments2wp($comments='')
{
// General Housekeeping
@@ -358,7 +355,7 @@ class Textpattern_Import {
$count = 0;
$txpcm2wpcm = array();
$postarr = get_option('txpposts2wpposts');
// Magic Mojo
if(is_array($comments))
{
@@ -367,7 +364,7 @@ class Textpattern_Import {
{
$count++;
extract($comment);
// WordPressify Data
$comment_ID = ltrim($discussid, '0');
$comment_post_ID = $postarr[$parentid];
@@ -376,57 +373,57 @@ class Textpattern_Import {
$email = $wpdb->escape($email);
$web = $wpdb->escape($web);
$message = $wpdb->escape($message);
if($cinfo = comment_exists($name, $posted))
{
// Update comments
$ret_id = wp_update_comment(array(
'comment_ID' => $cinfo,
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
'comment_ID' => $cinfo,
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
}
else
else
{
// Insert comments
$ret_id = wp_insert_comment(array(
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_author_IP' => $ip,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_author_IP' => $ip,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
}
$txpcm2wpcm[$comment_ID] = $ret_id;
}
// Store Comment ID translation for future use
add_option('txpcm2wpcm', $txpcm2wpcm);
add_option('txpcm2wpcm', $txpcm2wpcm);
// Associate newly formed categories with posts
get_comment_count($ret_id);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true;
}
echo __('No Comments to Import!');
return false;
}
function links2wp($links='')
{
// General Housekeeping
global $wpdb;
$count = 0;
// Deal with the links
if(is_array($links))
{
@@ -435,12 +432,12 @@ class Textpattern_Import {
{
$count++;
extract($link);
// Make nice vars
$category = $wpdb->escape($category);
$linkname = $wpdb->escape($linkname);
$description = $wpdb->escape($description);
if($linfo = link_exists($linkname))
{
$ret_id = wp_insert_link(array(
@@ -452,7 +449,7 @@ class Textpattern_Import {
'link_updated' => $date)
);
}
else
else
{
$ret_id = wp_insert_link(array(
'link_url' => $url,
@@ -473,72 +470,67 @@ class Textpattern_Import {
echo __('No Links to Import!');
return false;
}
function import_categories()
{
// Category Import
function import_categories()
{
// Category Import
$cats = $this->get_txp_cats();
$this->cat2wp($cats);
add_option('txp_cats', $cats);
echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
wp_nonce_field('import-textpattern');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>';
}
function import_users()
{
// User Import
$users = $this->get_txp_users();
$users = $this->get_txp_users();
$this->users2wp($users);
echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
wp_nonce_field('import-textpattern');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
echo '</form>';
}
function import_posts()
{
// Post Import
$posts = $this->get_txp_posts();
$this->posts2wp($posts);
echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
wp_nonce_field('import-textpattern');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
echo '</form>';
}
function import_comments()
{
// Comment Import
$comments = $this->get_txp_comments();
$this->comments2wp($comments);
echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
wp_nonce_field('import-textpattern');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
echo '</form>';
}
function import_links()
{
//Link Import
$links = $this->get_txp_links();
$this->links2wp($links);
add_option('txp_links', $links);
echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
wp_nonce_field('import-textpattern');
printf('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
echo '</form>';
}
function cleanup_txpimport()
{
delete_option('tpre');
@@ -554,7 +546,7 @@ class Textpattern_Import {
delete_option('txphost');
$this->tips();
}
function tips()
{
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>';
@@ -573,19 +565,19 @@ class Textpattern_Import {
echo '</ul>';
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()
{
echo '<table class="editform">';
printf('<tr><th scope="row"><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('Textpattern Database User:'));
printf('<tr><th scope="row"><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('Textpattern Database Password:'));
printf('<tr><th scope="row"><label for="dbname">%s</label></th><td><input type="text" id="dbname" name="dbname" /></td></tr>', __('Textpattern Database Name:'));
printf('<tr><th scope="row"><label for="dbhost">%s</label></th><td><input type="text" id="dbhost" name="dbhost" value="localhost" /></td></tr>', __('Textpattern Database Host:'));
printf('<tr><th scope="row"><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" /></td></tr>', __('Textpattern Table prefix (if any):'));
echo '</table>';
echo '<ul>';
printf('<li><label for="dbuser">%s</label> <input type="text" name="dbuser" id="dbuser" /></li>', __('Textpattern Database User:'));
printf('<li><label for="dbpass">%s</label> <input type="password" name="dbpass" id="dbpass" /></li>', __('Textpattern Database Password:'));
printf('<li><label for="dbname">%s</label> <input type="text" id="dbname" name="dbname" /></li>', __('Textpattern Database Name:'));
printf('<li><label for="dbhost">%s</label> <input type="text" id="dbhost" name="dbhost" value="localhost" /></li>', __('Textpattern Database Host:'));
printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" id="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
echo '</ul>';
}
function dispatch()
function dispatch()
{
if (empty ($_GET['step']))
@@ -593,47 +585,45 @@ class Textpattern_Import {
else
$step = (int) $_GET['step'];
$this->header();
if ( $step > 0 )
if ( $step > 0 )
{
check_admin_referer('import-textpattern');
if($_POST['dbuser'])
{
if(get_option('txpuser'))
delete_option('txpuser');
add_option('txpuser', sanitize_user($_POST['dbuser'], true));
delete_option('txpuser');
add_option('txpuser',$_POST['dbuser']);
}
if($_POST['dbpass'])
{
if(get_option('txppass'))
delete_option('txppass');
add_option('txppass', sanitize_user($_POST['dbpass'], true));
delete_option('txppass');
add_option('txppass',$_POST['dbpass']);
}
if($_POST['dbname'])
{
if(get_option('txpname'))
delete_option('txpname');
add_option('txpname', sanitize_user($_POST['dbname'], true));
delete_option('txpname');
add_option('txpname',$_POST['dbname']);
}
if($_POST['dbhost'])
{
if(get_option('txphost'))
delete_option('txphost');
add_option('txphost', sanitize_user($_POST['dbhost'], true));
add_option('txphost',$_POST['dbhost']);
}
if($_POST['dbprefix'])
{
if(get_option('tpre'))
delete_option('tpre');
add_option('tpre', sanitize_user($_POST['dbprefix']));
}
add_option('tpre',$_POST['dbprefix']);
}
}
switch ($step)
switch ($step)
{
default:
case 0 :
@@ -658,16 +648,16 @@ class Textpattern_Import {
$this->cleanup_txpimport();
break;
}
$this->footer();
}
function Textpattern_Import()
function Textpattern_Import()
{
// Nothing.
// Nothing.
}
}
$txp_import = new Textpattern_Import();
register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog'), array ($txp_import, 'dispatch'));
register_importer('textpattern', __('Textpattern'), __('Import posts from a Textpattern Blog'), array ($txp_import, 'dispatch'));
?>

View File

@@ -1,408 +0,0 @@
<?php
class WP_Import {
var $posts = array ();
var $posts_processed = array ();
// Array of arrays. [[0] => XML fragment, [1] => New post ID]
var $file;
var $id;
var $mtnames = array ();
var $newauthornames = array ();
var $j = -1;
function header() {
echo '<div class="wrap">';
echo '<h2>'.__('Import WordPress').'</h2>';
}
function footer() {
echo '</div>';
}
function unhtmlentities($string) { // From php.net for < 4.3 compat
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
function greet() {
echo '<div class="narrow">';
echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, comments, custom fields, and categories into this blog.').'</p>';
echo '<p>'.__('Choose a WordPress WXR file to upload, then click Upload file and import.').'</p>';
wp_import_upload_form("admin.php?import=wordpress&amp;step=1");
echo '</div>';
}
function get_tag( $string, $tag ) {
global $wpdb;
preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
$return = preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
$return = $wpdb->escape( trim( $return ) );
return $return;
}
function users_form($n) {
global $wpdb, $testing;
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo $n; ?>]">
<option value="#NONE#">- Select -</option>
<?php
foreach ($users as $user) {
echo '<option value="'.$user->user_login.'">'.$user->user_login.'</option>';
}
?>
</select>
<?php
}
//function to check the authorname and do the mapping
function checkauthor($author) {
global $wpdb;
//mtnames is an array with the names in the mt import file
$pass = 'changeme';
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
++ $this->j;
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
if (!$user_id) { //banging my head against the desk now.
if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
$user_id = wp_create_user($author, $pass);
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
} else {
$user_id = wp_create_user($this->newauthornames[$this->j], $pass);
}
} else {
return $user_id; // return pre-existing wp username if it exists
}
} else {
$key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
$user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
}
return $user_id;
}
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();
$num = 0;
$doing_entry = false;
foreach ($importdata as $importline) {
if ( false !== strpos($importline, '<wp:category>') ) {
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
$this->categories[] = $category[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 ($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;
}
}
}
function get_wp_authors() {
$temp = array ();
$i = -1;
foreach ($this->posts as $post) {
if ('' != trim($post)) {
++ $i;
$author = $this->get_tag( $post, 'dc:creator' );
array_push($temp, "$author"); //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.
$authors[0] = array_shift($temp);
$y = count($temp) + 1;
for ($x = 1; $x < $y; $x ++) {
$next = array_shift($temp);
if (!(in_array($next, $authors)))
array_push($authors, "$next");
}
return $authors;
}
function get_authors_from_post() {
$formnames = array ();
$selectnames = array ();
foreach ($_POST['user'] as $key => $line) {
$newname = trim(stripslashes($line));
if ($newname == '')
$newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
array_push($formnames, "$newname");
} // $formnames is the array with the form entered names
foreach ($_POST['userselect'] as $user => $key) {
$selected = trim(stripslashes($key));
array_push($selectnames, "$selected");
}
$count = count($formnames);
for ($i = 0; $i < $count; $i ++) {
if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form
array_push($this->newauthornames, "$selectnames[$i]");
} else {
array_push($this->newauthornames, "$formnames[$i]");
}
}
}
function wp_authors_form() {
?>
<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 <code>admin</code>s entries.'); ?></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
$authors = $this->get_wp_authors();
echo '<ol id="authors">';
echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
wp_nonce_field('import-wordpress');
$j = -1;
foreach ($authors as $author) {
++ $j;
echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($j);
echo '</li>';
}
echo '<input type="submit" value="Submit">'.'<br/>';
echo '</form>';
echo '</ol>';
}
function select_authors() {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
echo '<p>'.__('Sorry, there has been an error.').'</p>';
echo '<p><strong>' . $file['error'] . '</strong></p>';
return;
}
$this->file = $file['file'];
$this->id = (int) $file['id'];
$this->get_entries();
$this->wp_authors_form();
}
function process_categories() {
global $wpdb;
$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' ));
// If the category exists we leave it alone
if ( in_array($cat_name, $cat_names) )
continue;
$category_nicename = $this->get_tag( $c, 'wp:category_nicename' );
$posts_private = (int) $this->get_tag( $c, 'wp:posts_private' );
$links_private = (int) $this->get_tag( $c, 'wp:links_private' );
$parent = $this->get_tag( $c, 'wp:category_parent' );
if ( empty($parent) )
$category_parent = '0';
else
$category_parent = category_exists($parent);
$catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');
$cat_ID = wp_insert_category($catarr);
}
}
function process_posts() {
$i = -1;
echo '<ol>';
foreach ($this->posts as $post)
$this->process_post($post);
echo '</ol>';
wp_import_cleanup($this->id);
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' );
$post_date_gmt = $this->get_tag( $post, 'wp:post_date_gmt' );
$comment_status = $this->get_tag( $post, 'wp:comment_status' );
$ping_status = $this->get_tag( $post, 'wp:ping_status' );
$post_status = $this->get_tag( $post, 'wp:status' );
$post_name = $this->get_tag( $post, 'wp:post_name' );
$post_parent = $this->get_tag( $post, 'wp:post_parent' );
$menu_order = $this->get_tag( $post, 'wp:menu_order' );
$post_type = $this->get_tag( $post, 'wp:post_type' );
$guid = $this->get_tag( $post, 'guid' );
$post_author = $this->get_tag( $post, 'dc:creator' );
$post_content = $this->get_tag( $post, 'content:encoded' );
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
$post_content = str_replace('<hr>', '<hr />', $post_content);
preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
$categories = $categories[1];
$cat_index = 0;
foreach ($categories as $category) {
$categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category)));
$cat_index++;
}
if ($post_id = post_exists($post_title, '', $post_date)) {
echo '<li>';
printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
} else {
// If it has parent, process parent first.
$post_parent = (int) $post_parent;
if ($parent = $this->posts_processed[$post_parent]) {
if (!$parent[1]) $this->process_post($parent[0]); // If not yet, process the parent first.
$post_parent = $parent[1]; // New ID of the parent;
}
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', '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);
// 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) {
$cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'");
if ($cat_ID == 0) {
$cat_ID = wp_insert_category(array('cat_name' => $category));
}
$post_cats[] = $cat_ID;
}
wp_set_post_categories($post_id, $post_cats);
}
}
// Now for comments
preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
$comments = $comments[1];
$num_comments = 0;
if ( $comments) { foreach ($comments as $comment) {
$comment_author = $this->get_tag( $comment, 'wp:comment_author');
$comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email');
$comment_author_IP = $this->get_tag( $comment, 'wp:comment_author_IP');
$comment_author_url = $this->get_tag( $comment, 'wp:comment_author_url');
$comment_date = $this->get_tag( $comment, 'wp:comment_date');
$comment_date_gmt = $this->get_tag( $comment, 'wp:comment_date_gmt');
$comment_content = $this->get_tag( $comment, 'wp:comment_content');
$comment_approved = $this->get_tag( $comment, 'wp:comment_approved');
$comment_type = $this->get_tag( $comment, 'wp:comment_type');
$comment_parent = $this->get_tag( $comment, 'wp:comment_parent');
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_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent');
wp_insert_comment($commentdata);
$num_comments++;
}
} }
if ( $num_comments )
printf(' '.__('(%s comments)'), $num_comments);
// Now for post meta
preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
$postmeta = $postmeta[1];
if ( $postmeta) { foreach ($postmeta as $p) {
$key = $this->get_tag( $p, 'wp:meta_key' );
$value = $this->get_tag( $p, 'wp:meta_value' );
$value = stripslashes($value); // add_post_meta() will escape.
add_post_meta( $post_id, $key, $value );
} }
}
function import() {
$this->id = (int) $_GET['id'];
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries();
$this->process_categories();
$this->process_posts();
}
function dispatch() {
if (empty ($_GET['step']))
$step = 0;
else
$step = (int) $_GET['step'];
$this->header();
switch ($step) {
case 0 :
$this->greet();
break;
case 1 :
check_admin_referer('import-upload');
$this->select_authors();
break;
case 2:
check_admin_referer('import-wordpress');
$this->import();
break;
}
$this->footer();
}
function WP_Import() {
// Nothing.
}
}
$wp_import = new WP_Import();
register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, pages, and categories</strong> from a WordPress export file'), array ($wp_import, 'dispatch'));
?>

View File

@@ -1,69 +0,0 @@
<?php
require_once('admin.php');
require_once (ABSPATH . WPINC . '/rss.php');
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
switch ( $_GET['jax'] ) {
case 'incominglinks' :
$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="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);
foreach ($rss->items as $item ) {
?>
<li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wptexturize(wp_specialchars($item['title'])); ?></a></li>
<?php } ?>
</ul>
<?php
}
break;
case 'devnews' :
$rss = @fetch_rss('http://wordpress.org/development/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php _e('WordPress Development Blog'); ?></h3>
<?php
$rss->items = array_slice($rss->items, 0, 3);
foreach ($rss->items as $item ) {
?>
<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
<p><?php echo $item['description']; ?></p>
<?php
}
}
?>
<?php
break;
case 'planetnews' :
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php _e('Other WordPress News'); ?></h3>
<ul>
<?php
$rss->items = array_slice($rss->items, 0, 20);
foreach ($rss->items as $item ) {
$title = wp_specialchars($item['title']);
$author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
$post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
?>
<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><span class="post"><?php echo $post; ?></span><span class="hidden"> - </span><cite><?php echo $author; ?></cite></a></li>
<?php
}
?>
</ul>
<p class="readmore"><a href="http://planet.wordpress.org/"><?php _e('Read more'); ?> &raquo;</a></p>
<?php
}
break;
}
?>

View File

@@ -1,37 +1,35 @@
<?php
require_once('admin.php');
function index_js() {
?>
<script type="text/javascript">
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');
$title = __('Dashboard');
$parent_file = 'index.php';
require_once('admin-header.php');
require_once (ABSPATH . WPINC . '/rss-functions.php');
$today = current_time('mysql', 1);
?>
<div class="wrap">
<h2><?php _e('Welcome to WordPress'); ?></h2>
<h2><?php _e('Dashboard'); ?></h2>
<div id="zeitgeist">
<h2><?php _e('Latest Activity'); ?></h2>
<div id="incominglinks"></div>
<?php
$rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<div id="incominglinks">
<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);
foreach ($rss->items as $item ) {
?>
<li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wptexturize(wp_specialchars($item['title'])); ?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php
$comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");
@@ -47,11 +45,11 @@ if ( $comments || $numcomments ) :
<?php endif; ?>
<ul>
<?php
<?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 . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>');
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
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>');
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
echo '</li>';
}
}
@@ -60,8 +58,9 @@ foreach ($comments as $comment) {
</div>
<?php endif; ?>
<?php
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") ) :
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
?>
<div>
<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">&raquo;</a></h3>
@@ -80,8 +79,8 @@ foreach ($recentposts as $post) {
<?php endif; ?>
<?php
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
?>
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC") ) :
?>
<div>
<h3><?php _e('Scheduled Entries:') ?></h3>
<ul>
@@ -91,7 +90,7 @@ foreach ($scheduled as $post) {
$post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>";
}
?>
?>
</ul>
</div>
<?php endif; ?>
@@ -99,41 +98,70 @@ foreach ($scheduled as $post) {
<div>
<h3><?php _e('Blog Stats'); ?></h3>
<?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 = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
$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');
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s.'), $post_str, $comm_str, $cat_str); ?></p>
<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php', $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
</div>
<?php do_action('activity_box_end'); ?>
</div>
<h3><?php _e('Welcome to WordPress'); ?></h3>
<p><?php _e('Use these links to get started:'); ?></p>
<ul>
<?php if ( current_user_can('edit_posts') ) : ?>
<li><a href="post-new.php"><?php _e('Write a post'); ?></a></li>
<?php endif; ?>
<li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
<?php if ( current_user_can('manage_links') ) : ?>
<li><a href="link-add.php"><?php _e('Add a link to your blogroll'); ?></a></li>
<?php endif; ?>
<?php if ( current_user_can('switch_themes') ) : ?>
<li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
<?php endif; ?>
<li><a href="post.php"><?php _e('Write a post'); ?></a></li>
<li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
<li><a href="link-add.php"><?php _e('Add a link to your blogroll'); ?></a></li>
<li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
</ul>
<p><?php _e("Need help with WordPress? Please see our <a href='http://codex.wordpress.org/'>documentation</a> or visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
<div id="devnews"></div>
<p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
<?php
$rss = @fetch_rss('http://wordpress.org/development/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php _e('WordPress Development Blog'); ?></h3>
<?php
$rss->items = array_slice($rss->items, 0, 3);
foreach ($rss->items as $item ) {
?>
<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
<p><?php echo $item['description']; ?></p>
<?php
}
}
?>
<div id="planetnews"></div>
<?php
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<div id="planetnews">
<h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> &raquo;</a></h3>
<ul>
<?php
$rss->items = array_slice($rss->items, 0, 20);
foreach ($rss->items as $item ) {
?>
<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<div style="clear: both">&nbsp;
<br clear="all" />
</div>

View File

@@ -0,0 +1,724 @@
<?php
require_once('admin.php');
header('Content-Type: text/html; charset=' . get_option('blog_charset'));
if (!current_user_can('upload_files'))
die(__('You do not have permission to upload files.'));
$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$all = ( 'true' == $all ) ? 'true' : 'false';
$start = (int) $start;
$post = (int) $post;
$images_width = 1;
switch($action) {
case 'links':
// Do not pass GO.
break;
case 'delete':
check_admin_referer('inlineuploading');
if ( !current_user_can('edit_post', (int) $attachment) )
die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
wp_delete_attachment($attachment);
wp_redirect(basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start");
die;
case 'save':
check_admin_referer('inlineuploading');
$overrides = array('action'=>'save');
$file = wp_handle_upload($_FILES['image'], $overrides);
if ( isset($file['error']) )
die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$filename = basename($file);
// Construct the attachment array
$attachment = array(
'post_title' => $imgtitle ? $imgtitle : $filename,
'post_content' => $descr,
'post_status' => 'attachment',
'post_parent' => $post,
'post_mime_type' => $type,
'guid' => $url
);
// Save the data
$id = wp_insert_attachment($attachment, $file, $post);
if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
// Generate the attachment's postmeta.
$imagesize = getimagesize($file);
$imagedata['width'] = $imagesize['0'];
$imagedata['height'] = $imagesize['1'];
list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
$imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
$imagedata['file'] = $file;
add_post_meta($id, '_wp_attachment_metadata', $imagedata);
if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
$thumb = wp_create_thumbnail($file, 128);
elseif ( $imagedata['height'] > 96 )
$thumb = wp_create_thumbnail($file, 96);
if ( @file_exists($thumb) ) {
$newdata = $imagedata;
$newdata['thumb'] = basename($thumb);
update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata);
} else {
$error = $thumb;
}
}
} else {
add_post_meta($id, '_wp_attachment_metadata', array());
}
wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
die();
case 'upload':
$current_1 = ' class="current"';
$back = $next = false;
break;
case 'view':
// How many images do we show? How many do we query?
$num = 5;
$double = $num * 2;
if ( $post && (empty($all) || $all == 'false') ) {
$and_post = "AND post_parent = '$post'";
$current_2 = ' class="current"';
} else {
$current_3 = ' class="current"';
}
if (! current_user_can('edit_others_posts') )
$and_user = "AND post_author = " . $user_ID;
if ( $last )
$start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' $and_user $and_post") - $num;
else
$start = (int) $start;
if ( $start < 0 )
$start = 0;
if ( '' == $sort )
$sort = "post_date_gmt DESC";
$attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_status = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
if ( count($attachments) == 0 ) {
wp_redirect( basename(__FILE__) ."?post=$post&action=upload" );
die;
} elseif ( count($attachments) > $num ) {
$next = $start + count($attachments) - $num;
} else {
$next = false;
}
if ( $start > 0 ) {
$back = $start - $num;
if ( $back < 1 )
$back = '0';
} else {
$back = false;
}
$uwidth_sum = 0;
$html = '';
$popups = '';
$style = '';
$script = '';
if ( count($attachments) > 0 ) {
$attachments = array_slice( $attachments, 0, $num );
$__delete = __('Delete');
$__not_linked = __('Not Linked');
$__linked_to_page = __('Linked to Page');
$__linked_to_image = __('Linked to Image');
$__linked_to_file = __('Linked to File');
$__using_thumbnail = __('Using Thumbnail');
$__using_original = __('Using Original');
$__using_title = __('Using Title');
$__using_filename = __('Using Filename');
$__using_icon = __('Using Icon');
$__no_thumbnail = '<del>'.__('No Thumbnail').'</del>';
$__send_to_editor = __('Send to editor');
$__close = __('Close Options');
$__confirmdelete = __('Delete this file from the server?');
$__nothumb = __('There is no thumbnail associated with this photo.');
$script .= "notlinked = '$__not_linked';
linkedtoimage = '$__linked_to_image';
linkedtopage = '$__linked_to_page';
linkedtofile = '$__linked_to_file';
usingthumbnail = '$__using_thumbnail';
usingoriginal = '$__using_original';
usingtitle = '$__using_title';
usingfilename = '$__using_filename';
usingicon = '$__using_icon';
var aa = new Array();
var ab = new Array();
var imga = new Array();
var imgb = new Array();
var srca = new Array();
var srcb = new Array();
var title = new Array();
var filename = new Array();
var icon = new Array();
";
foreach ( $attachments as $key => $attachment ) {
$ID = $attachment['ID'];
$href = get_attachment_link($ID);
$meta = get_post_meta($ID, '_wp_attachment_metadata', true);
if (!is_array($meta)) {
$meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key
if (!is_array($meta)) {
$meta = array();
}
add_post_meta($ID, '_wp_attachment_metadata', $meta);
}
$attachment = array_merge($attachment, $meta);
$noscript = "<noscript>
<div class='caption'><a href=\"".basename(__FILE__)."?action=links&amp;attachment={$ID}&amp;post={$post}&amp;all={$all}&amp;start={$start}\">Choose Links</a></div>
</noscript>
";
$send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a>
<a onclick=\"return confirm('$__confirmdelete')\" href=\"" . wp_nonce_url( basename(__FILE__) . "?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post", inlineuploading) . "\">$__delete</a>
<a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
";
$uwidth_sum += 128;
if ( preg_match('!^image/!', $attachment['post_mime_type'] ) ) {
$image = & $attachment;
if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
$src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']);
$script .= "srca[{$ID}] = '$src';
srcb[{$ID}] = '{$image['guid']}';
";
$thumb = 'true';
$thumbtext = $__using_thumbnail;
} else {
$src = $image['guid'];
$thumb = 'false';
$thumbtext = $__no_thumbnail;
}
list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
$height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
$style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
$title = attribute_escape($image['post_title']);
$script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />';
imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$title}\" $height_width />';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
<div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />
</div>
{$noscript}
</div>
";
$popups .= "<div id='popup{$ID}' class='popup'>
<a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
<a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
{$send_delete_cancel}
</div>
";
} else {
$title = attribute_escape($attachment['post_title']);
$filename = basename($attachment['guid']);
$icon = get_attachment_icon($ID);
$toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";
$script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
title[{$ID}] = '{$title}';
filename[{$ID}] = '{$filename}';
icon[{$ID}] = '{$icon}';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
<div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
<a id=\"p{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$title}</a>
</div>
{$noscript}
</div>
";
$popups .= "<div id='popup{$ID}' class='popup'>
<div class='filetype'>".__('File Type:').' '.str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
<a id=\"L{$ID}\" onclick=\"toggleOtherLink({$ID});return false;\" href=\"javascript:void()\">$__linked_to_file</a>
{$toggle_icon}
{$send_delete_cancel}
</div>
";
}
}
}
$images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
break;
default:
die(__('This script was not meant to be called directly.'));
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
<title></title>
<meta http-equiv="imagetoolbar" content="no" />
<script type="text/javascript">
// <![CDATA[
/* Define any variables we'll need, such as alternate URLs. */
<?php echo $script; ?>
function htmldecode(st) {
o = document.getElementById('htmldecode');
if (! o) {
o = document.createElement("A");
o.id = "htmldecode"
}
o.innerHTML = st;
r = o.innerHTML;
return r;
}
function cancelUpload() {
o = document.getElementById('uploadForm');
o.method = 'GET';
o.action.value = 'view';
o.submit();
}
function doPopup(i) {
if ( popup )
popup.style.display = 'none';
target = document.getElementById('target'+i);
popup = document.getElementById('popup'+i);
popup.style.left = (target.offsetLeft) + 'px';
popup.style.top = (target.offsetTop) + 'px';
popup.style.display = 'block';
}
popup = false;
function selectLink(n) {
o=document.getElementById('div'+n);
if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 )
return;
r = document.body.createTextRange();
if ( typeof r != 'undefined' ) {
r.moveToElementText(o);
r.select();
}
}
function toggleLink(n) {
ol=document.getElementById('L'+n);
if ( ol.innerHTML == htmldecode(notlinked) ) {
ol.innerHTML = linkedtoimage;
} else if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
ol.innerHTML = linkedtopage;
} else {
ol.innerHTML = notlinked;
}
updateImage(n);
}
function toggleOtherLink(n) {
ol=document.getElementById('L'+n);
if ( ol.innerHTML == htmldecode(linkedtofile) ) {
ol.innerHTML = linkedtopage;
} else {
ol.innerHTML = linkedtofile;
}
updateOtherIcon(n);
}
function toggleImage(n) {
oi = document.getElementById('I'+n);
if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
oi.innerHTML = usingoriginal;
} else {
oi.innerHTML = usingthumbnail;
}
updateImage(n);
}
function toggleOtherIcon(n) {
od = document.getElementById('div'+n);
oi = document.getElementById('I'+n);
if ( oi.innerHTML == htmldecode(usingtitle) ) {
oi.innerHTML = usingfilename;
od.className = 'otherwrap usingtext';
} else if ( oi.innerHTML == htmldecode(usingfilename) && icon[n] != '' ) {
oi.innerHTML = usingicon;
od.className = 'otherwrap usingicon';
} else {
oi.innerHTML = usingtitle;
od.className = 'otherwrap usingtext';
}
updateOtherIcon(n);
}
function updateImage(n) {
od=document.getElementById('div'+n);
ol=document.getElementById('L'+n);
oi=document.getElementById('I'+n);
if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
img = imga[n];
} else {
img = imgb[n];
}
if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
od.innerHTML = ab[n]+img+'</a>';
} else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
od.innerHTML = aa[n]+img+'</a>';
} else {
od.innerHTML = img;
}
}
function updateOtherIcon(n) {
od=document.getElementById('div'+n);
ol=document.getElementById('L'+n);
oi=document.getElementById('I'+n);
if ( oi.innerHTML == htmldecode(usingfilename) ) {
txt = filename[n];
} else if ( oi.innerHTML == htmldecode(usingicon) ) {
txt = icon[n];
} else {
txt = title[n];
}
if ( ol.innerHTML == htmldecode(linkedtofile) ) {
od.innerHTML = ab[n]+txt+'</a>';
} else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
od.innerHTML = aa[n]+txt+'</a>';
} else {
od.innerHTML = txt;
}
}
var win = window.opener ? window.opener : window.dialogArguments;
if (!win) win = top;
tinyMCE = win.tinyMCE;
richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );
function sendToEditor(n) {
o = document.getElementById('div'+n);
h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim
h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes
h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints
h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events
h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames
h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
if ( richedit )
win.tinyMCE.execCommand('mceInsertContent', false, h);
else
win.edInsertContent(win.edCanvas, h);
}
// ]]>
</script>
<style type="text/css">
<?php if ( $action == 'links' ) : ?>
* html { overflow-x: hidden; }
<?php else : ?>
* html { overflow-y: hidden; }
<?php endif; ?>
body {
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
border: none;
margin: 0px;
height: 150px;
background: #dfe8f1;
}
form {
margin: 3px 2px 0px 6px;
}
#wrap {
clear: both;
padding: 0px;
width: 100%;
}
#images {
position: absolute;
clear: both;
margin: 0px;
padding: 15px 15px;
width: <?php echo $images_width; ?>px;
}
#images img {
background-color: rgb(209, 226, 239);
}
<?php echo $style; ?>
.attwrap, .attwrap * {
margin: 0px;
padding: 0px;
border: 0px;
}
.imagewrap {
margin-right: 5px;
overflow: hidden;
width: 128px;
}
.otherwrap {
margin-right: 5px;
overflow: hidden;
background-color: #f9fcfe;
}
.otherwrap a {
display: block;
}
.otherwrap a, .otherwrap a:hover, .otherwrap a:active, .otherwrap a:visited {
color: blue;
}
.usingicon {
padding: 0px;
height: 96px;
text-align: center;
width: 128px;
}
.usingtext {
padding: 3px;
height: 90px;
text-align: left;
width: 122px;
}
.filetype {
font-size: 80%;
border-bottom: 3px double #89a
}
.imagewrap, .imagewrap img, .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
text-decoration: none;
}
#upload-menu {
background: #fff;
margin: 0px;
padding: 0;
list-style: none;
height: 2em;
border-bottom: 1px solid #448abd;
width: 100%;
}
#upload-menu li {
float: left;
margin: 0 0 0 .75em;
}
#upload-menu a {
display: block;
padding: 5px;
text-decoration: none;
color: #000;
border-top: 3px solid #fff;
}
#upload-menu .current a {
background: #dfe8f1;
border-right: 2px solid #448abd;
}
#upload-menu a:hover {
background: #dfe8f1;
color: #000;
}
.tip {
color: rgb(68, 138, 189);
padding: 2px 1em;
}
.inactive {
color: #fff;
padding: 1px 3px;
}
.left {
float: left;
}
.right {
float: right;
}
.center {
text-align: center;
}
#upload-menu li.spacer {
margin-left: 40px;
}
#title, #descr {
width: 99%;
margin-top: 1px;
}
th {
width: 4.5em;
}
#descr {
height: 36px;
}
#buttons {
margin-top: 2px;
text-align: right;
}
.popup {
margin: 4px 4px;
padding: 1px;
position: absolute;
width: 114px;
display: none;
background-color: rgb(240, 240, 238);
border-top: 2px solid #fff;
border-right: 2px solid #ddd;
border-bottom: 2px solid #ddd;
border-left: 2px solid #fff;
text-align: center;
}
.imagewrap .popup {
opacity: .90;
filter:alpha(opacity=90);
}
.otherwrap .popup {
padding-top: 20px;
}
.popup a, .popup a:visited, .popup a:active {
background-color: transparent;
display: block;
width: 100%;
text-decoration: none;
color: #246;
}
.popup a:hover {
background-color: #fff;
color: #000;
}
.caption {
text-align: center;
}
#submit {
margin: 1px;
width: 99%;
}
#submit input, #submit input:focus {
background: url( images/fade-butt.png );
border: 3px double #999;
border-left-color: #ccc;
border-top-color: #ccc;
color: #333;
padding: 0.25em;
}
#submit input:active {
background: #f4f4f4;
border: 3px double #ccc;
border-left-color: #999;
border-top-color: #999;
}
.zerosize {
width: 0px;
height: 0px;
overflow: hidden;
position: absolute;
}
#links {
margin: 3px 8px;
line-height: 2em;
}
#links textarea {
width: 95%;
height: 4.5em;
}
</style>
</head>
<body>
<ul id="upload-menu">
<li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__) . "?action=upload&amp;post=$post&amp;all=$all&amp;start=$start"; ?>"><?php _e('Upload'); ?></a></li>
<?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?>
<li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=false"; ?>"><?php _e('Browse'); ?></a></li>
<?php } ?>
<?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment'")) { ?>
<li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=true"; ?>"><?php _e('Browse All'); ?></a></li>
<?php } ?>
<li> </li>
<?php if ( $action == 'view' ) { ?>
<?php if ( false !== $back ) : ?>
<li class="spacer"><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=0"; ?>" title="<?php _e('First'); ?>">|&laquo;</a></li>
<li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$back"; ?>">&laquo; <?php _e('Back'); ?></a></li>
<?php else : ?>
<li class="inactive spacer">|&laquo;</li>
<li class="inactive">&laquo; <?php _e('Back'); ?></li>
<?php endif; ?>
<?php if ( false !== $next ) : ?>
<li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;start=$next"; ?>"><?php _e('Next &raquo;'); ?></a></li>
<li><a href="<?php echo basename(__FILE__) . "?action=$action&amp;post=$post&amp;all=$all&amp;last=true"; ?>" title="<?php _e('Last'); ?>">&raquo;|</a></li>
<?php else : ?>
<li class="inactive"><?php _e('Next'); ?> &raquo;</li>
<li class="inactive">&raquo;|</li>
<?php endif; ?>
<?php } // endif not upload?>
</ul>
<?php if ( $action == 'view' ) : ?>
<div id="wrap">
<!--<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>-->
<div id="images">
<?php echo $html; ?>
<?php echo $popups; ?>
</div>
</div>
<?php elseif ( $action == 'upload' ) : ?>
<div class="tip"></div>
<form enctype="multipart/form-data" id="uploadForm" method="post" action="<?php echo basename(__FILE__); ?>">
<table style="width:99%;">
<tr>
<th scope="row" align="right"><label for="upload"><?php _e('File:'); ?></label></th>
<td><input type="file" id="upload" name="image" /></td>
</tr>
<tr>
<th scope="row" align="right"><label for="title"><?php _e('Title:'); ?></label></th>
<td><input type="text" id="title" name="imgtitle" /></td>
</tr>
<tr>
<th scope="row" align="right"><label for="descr"><?php _e('Description:'); ?></label></th>
<td><input type="textarea" name="descr" id="descr" value="" /></td>
</tr>
<tr id="buttons">
<th></th>
<td>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="post" value="<?php echo $post; ?>" />
<input type="hidden" name="all" value="<?php echo $all; ?>" />
<input type="hidden" name="start" value="<?php echo $start; ?>" />
<?php wp_nonce_field( 'inlineuploading' ); ?>
<div id="submit">
<input type="submit" value="<?php _e('Upload'); ?>" />
<?php if ( !empty($all) ) : ?>
<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
<?php endif; ?>
</div>
</td>
</tr>
</table>
</form>
<?php elseif ( $action == 'links' ) : ?>
<div id="links">
<?php the_attachment_links($attachment); ?>
</div>
<?php endif; ?>
</body>
</html>

View File

@@ -9,21 +9,21 @@ $debug = 0;
** false on error
*/
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
}
/**
@@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) {
** false on error
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
}
@@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
** false on error
*/
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
//found it try to drop it.
$q = $wpdb->query($drop_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
return false;
}
}
}
}
// else didn't find it
return true;
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
//found it try to drop it.
$q = $wpdb->query($drop_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
return false;
}
}
}
}
// else didn't find it
return true;
}
@@ -92,45 +92,45 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
** Extra
*/
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
global $wpdb, $debug;
$diffs = 0;
$results = $wpdb->get_results("DESC $table_name");
foreach ($results as $row ) {
if ($debug > 1) print_r($row);
if ($row->Field == $col_name) {
// got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
if (($is_null != null) && ($row->Null != $is_null)) {
++$diffs;
}
if (($key != null) && ($row->Key != $key)) {
++$diffs;
}
if (($default != null) && ($row->Default != $default)) {
++$diffs;
}
if (($extra != null) && ($row->Extra != $extra)) {
++$diffs;
}
if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n");
return false;
}
return true;
} // end if found our column
}
return false;
global $wpdb, $debug;
$diffs = 0;
$results = $wpdb->get_results("DESC $table_name");
foreach ($results as $row ) {
if ($debug > 1) print_r($row);
if ($row->Field == $col_name) {
// got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
if (($is_null != null) && ($row->Null != $is_null)) {
++$diffs;
}
if (($key != null) && ($row->Key != $key)) {
++$diffs;
}
if (($default != null) && ($row->Default != $default)) {
++$diffs;
}
if (($extra != null) && ($row->Extra != $extra)) {
++$diffs;
}
if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n");
return false;
}
return true;
} // end if found our column
}
return false;
}
/*
echo "<p>testing</p>";
echo "<pre>";
//check_column('wp_links', 'link_description', 'mediumtext');
//check_column('wp_links', 'link_description', 'mediumtext');
//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
// echo "ok\n";
$error_count = 0;
@@ -138,14 +138,14 @@ $tablename = $wpdb->links;
// check the column
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
{
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$q = $wpdb->query($ddl);
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$q = $wpdb->query($ddl);
}
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
$res .= $tablename . ' - ok <br />';
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
echo "</pre>";
*/

View File

@@ -1,15 +0,0 @@
body { font: 13px Tahoma, Georgia, "Times New Roman", Times, serif; }
ul, ol { padding: 5px 20px 5px 5px; }
h1, h2, h3 { font-family: "Times New Roman", Times, serif; font-weight: 700 }
.step, th { text-align: left }
input { font-family: "Times New Roman", Times, serif; padding: 1px }
#logo { background: url(../wp-content/plugins/WP-Jalali/wp-fa-logo.png) center right no-repeat; text-align: left; }
#admin_email {direction: ltr; text-align: left; }
#footer { font-style: normal; }

View File

@@ -1,40 +0,0 @@
html { background: #eee; }
body {
background: #fff;
color: #000;
font-family: Georgia, "Times New Roman", Times, serif;
margin-left: 20%;
margin-right: 20%;
padding: .2em 2em;
}
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
h2 { font-size: 16px; }
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
}
ul, ol { padding: 5px 5px 5px 20px; }
#logo { margin-bottom: 2em; }
.step a, .step input { font-size: 2em; }
td input { font-size: 1.5em; }
.step, th { text-align: right; }
#footer {
text-align: center;
border-top: 1px solid #ccc;
padding-top: 1em;
font-style: italic;
}

View File

@@ -1,13 +1,14 @@
<?php
define('WP_INSTALLING', true);
if (!file_exists('../wp-config.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");
}
if (!file_exists('../wp-config.php'))
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://wordpress.org/docs/faq/#wp-config'>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.");
require_once('../wp-config.php');
require_once('./upgrade-functions.php');
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$guessurl = str_replace('/wp-admin/install.php?step=2', '', $schema . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
if (isset($_GET['step']))
$step = $_GET['step'];
else
@@ -15,96 +16,210 @@ else
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" <?php language_attributes(); ?>>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php _e('WordPress &rsaquo; Installation'); ?></title>
<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; ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style media="screen" type="text/css">
<!--
html {
background: #eee;
}
body {
background: #fff;
color: #000;
font-family: Georgia, "Times New Roman", Times, serif;
margin-left: 20%;
margin-right: 20%;
padding: .2em 2em;
}
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
h2 {
font-size: 16px;
}
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
}
ul, ol {
padding: 5px 5px 5px 20px;
}
#logo {
margin-bottom: 2em;
}
.step a, .step input {
font-size: 2em;
}
td input {
font-size: 1.5em;
}
.step, th {
text-align: right;
}
#footer {
text-align: center;
border-top: 1px solid #ccc;
padding-top: 1em;
font-style: italic;
}
-->
</style>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php
// Let's check to make sure WP isn't already installed.
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>');
$wpdb->hide_errors();
$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
if ($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>');
$wpdb->show_errors();
switch($step) {
case 0:
?>
<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>
<h2 class="step"><a href="install.php?step=1"><?php _e('First Step &raquo;'); ?></a></h2>
<?php
break;
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('Weblog title:'); ?></th>
<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
</tr>
<tr>
<th><?php _e('Your e-mail:'); ?></th>
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
</tr>
<tr>
<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 that email address before continuing.'); ?></em></p>
<h2 class="step"><input type="submit" name="Submit" value="<?php _e('Continue to Second Step &raquo;'); ?>" /></h2>
<table width="100%">
<tr>
<th width="33%"><?php _e('Weblog title:'); ?></th>
<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
</tr>
<tr>
<th><?php _e('Your e-mail:'); ?></th>
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
</tr>
</table>
<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;
break;
case 2:
// 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)) {
die(__("<strong>ERROR</strong>: please type your e-mail address"));
} else if (!is_email($admin_email)) {
die(__("<strong>ERROR</strong>: the e-mail address isn't correct"));
}
// Fill in the data we gathered
$weblog_title = stripslashes($_POST['weblog_title']);
$admin_email = stripslashes($_POST['admin_email']);
// check e-mail address
if (empty($admin_email)) {
die (__("<strong>ERROR</strong>: please type your e-mail address"));
} else if (!is_email($admin_email)) {
die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
}
?>
<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);
flush();
// Set everything up
wp_cache_flush();
make_db_current_silent();
populate_options();
populate_roles();
update_option('blogname', $weblog_title);
update_option('admin_email', $admin_email);
// Now drop in some default links
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');");
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');");
// Default category
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')");
// First post
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");
$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
// Default comment
$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
// First Page
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')");
$wp_rewrite->flush_rules();
// Set up admin user
$random_password = substr(md5(uniqid(microtime())), 0, 6);
$display_name_array = explode('@', $admin_email);
$display_name = $display_name_array[0];
$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_email, user_registered, display_name, user_nicename) VALUES ( '1', 'admin', MD5('$random_password'), '$admin_email', NOW(), '$display_name', 'admin')");
$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}user_level', '10');");
$admin_caps = serialize(array('administrator' => true));
$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}capabilities', '{$admin_caps}');");
$message_headers = 'From: "' . $weblog_title . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
$message = sprintf(__("Your new WordPress blog has been successfully set up at:
%1\$s
You can log in to the administrator account with the following information:
Username: admin
Password: %2\$s
We hope you enjoy your new weblog. Thanks!
--The WordPress Team
http://wordpress.org/
"), $guessurl, $random_password);
@wp_mail($admin_email, __('New WordPress Blog'), $message, $message_headers);
wp_cache_flush();
?>
<p><em><?php _e('Finished!'); ?></em></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>
<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', $random_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>
<dd><code>admin</code></dd>
<dt><?php _e('Password'); ?></dt>
<dd><code><?php echo $password; ?></code></dd>
<dt><?php _e('Username'); ?></dt>
<dd><code>admin</code></dd>
<dt><?php _e('Password'); ?></dt>
<dd><code><?php echo $random_password; ?></code></dd>
<dt><?php _e('Login address'); ?></dt>
<dd><a href="../wp-login.php">wp-login.php</a></dd>
<dd><a href="../wp-login.php">wp-login.php</a></dd>
</dl>
<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
<?php
break;
break;
}
?>
<p id="footer"><?php _e('<a href="http://wordpress.org/">WordPress</a>, personal publishing platform.'); ?></p>
</body>
</html>
</html>

View File

@@ -6,18 +6,30 @@ $this_file = 'link-manager.php';
$parent_file = 'link-manager.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[]'));
$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
'notes', 'linkcheck[]');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
if ( current_user_can( 'manage_categories' ) )
wp_enqueue_script( 'ajaxcat' );
$xfn_js = true;
require('admin-header.php');
?>
<?php if ($_GET['added'] && '' != $_POST['link_name']) : ?>
<?php if ($_GET['added']) : ?>
<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
<?php endif; ?>
@@ -26,10 +38,8 @@ require('admin-header.php');
include('edit-link-form.php');
?>
<div id="wp-link-bookmarklet" class="wrap">
<h3><?php _e('Add Link 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 Link This shortcut.'); ?></p>
<?php printf('<p><a href="%s" title="'.__('Link add bookmarklet').'">'.__('Link This').'</a></p>', "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
<div class="wrap">
<?php printf(__('<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you&#8217;re on to your links! Right now this only works on Mozilla or Netscape, but we&#8217;re working on it.</p>'), "javascript:void(linkmanpopup=window.open('" . get_settings('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
</div>
<?php

View File

@@ -0,0 +1,467 @@
<?php
// Links
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
require_once('admin.php');
$title = __('Link Categories');
$this_file='link-categories.php';
$parent_file = 'link-manager.php';
$list_js = true;
$wpvarstoreset = array('action', 'cat', 'auto_toggle');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
switch ($action) {
case 'addcat':
{
check_admin_referer('add-link-category');
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
$cat_name = wp_specialchars($_POST['cat_name']);
$auto_toggle = $_POST['auto_toggle'];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$show_images = $_POST['show_images'];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $_POST['show_description'];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $_POST['show_rating'];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $_POST['show_updated'];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $_POST['sort_order'];
$sort_desc = $_POST['sort_desc'];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = $_POST['text_before_link'];
$text_after_link = $_POST['text_after_link'];
$text_after_all = $_POST['text_after_all'];
$list_limit = $_POST['list_limit'];
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
" show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
" VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
" '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
" '$text_after_all', $list_limit)");
wp_redirect('link-categories.php');
break;
} // end addcat
case 'Delete':
{
$cat_id = (int) $_GET['cat_id'];
check_admin_referer('delete-link-category_' . $cat_id);
$cat_name=get_linkcatname($cat_id);
if ($cat_id=="1")
die(sprintf(__("Can't delete the <strong>%s</strong> link category: this is the default one"), $cat_name));
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
$wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'");
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$cat_id'");
wp_redirect('link-categories.php');
break;
} // end delete
case 'Edit':
{
include_once ('admin-header.php');
$cat_id = (int) $_GET['cat_id'];
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$cat_id");
if ($row) {
if ($row->list_limit == -1) {
$row->list_limit = '';
}
?>
<div class="wrap">
<h2><?php printf(__('Edit &#8220%s&#8221; Category'), wp_specialchars($row->cat_name)); ?></h2>
<form name="editcat" method="post">
<?php wp_nonce_field('update-link-category_' . $row->cat_id) ?>
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
<fieldset class="options">
<legend><?php _e('Category Options') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Name:') ?></th>
<td width="67%"><input name="cat_name" type="text" value="<?php echo attribute_escape($row->cat_name)?>" size="30" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Show:') ?></th>
<td>
<label>
<input type="checkbox" name="show_images" value="Y" <?php checked('Y', $row->show_images); ?> />
<?php _e('Image') ?></label> <br />
<label>
<input type="checkbox" name="show_description" value="Y" <?php checked('Y', $row->show_description); ?> />
<?php _e('Description') ?></label>
<?php _e('(shown in <code>title</code> regardless)') ?><br />
<label>
<input type="checkbox" name="show_rating" value="Y" <?php checked('Y', $row->show_rating); ?> />
<?php _e('Rating') ?></label> <br />
<label>
<input type="checkbox" name="show_updated" value="Y" <?php checked('Y', $row->show_updated); ?> />
<?php _e('Updated') ?></label>
<?php _e('(shown in <code>title</code> regardless)') ?></td>
</tr>
<tr>
<th scope="row"><?php _e('Sort order:') ?></th>
<td>
<select name="sort_order" size="1">
<option value="name" <?php echo ($row->sort_order == 'name') ? 'selected="selected"' : ''?>><?php _e('Name') ?></option>
<option value="id" <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>><?php _e('Id') ?></option>
<option value="url" <?php echo ($row->sort_order == 'url') ? 'selected' : ''?>><?php _e('URL') ?></option>
<option value="rating" <?php echo ($row->sort_order == 'rating') ? 'selected' : ''?>><?php _e('Rating') ?></option>
<option value="updated" <?php echo ($row->sort_order == 'updated') ? 'selected' : ''?>><?php _e('Updated') ?></option>
<option value="rand" <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>><?php _e('Random') ?></option>
<option value="length" <?php echo ($row->sort_order == 'length') ? 'selected' : ''?>><?php _e('Name Length') ?></option>
</select>
<label>
<input type="checkbox" name="sort_desc" value="Y" <?php checked('Y', $row->sort_desc); ?> />
<?php _e('Descending') ?></label>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Limit:') ?></th>
<td>
<input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit ?>" />
<?php _e('(Leave empty for no limit to number of links shown)') ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Toggle:') ?></th>
<td><label>
<input type="checkbox" name="auto_toggle" value="Y" <?php checked('Y', $row->auto_toggle); ?> />
<?php _e('When new link is added toggle all others to be invisible') ?></label></td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend><?php _e('Formatting') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
<td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo wp_specialchars($row->text_before_link,'double')?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Between Link and Description:') ?></th>
<td><input type="text" name="text_after_link" size="45" value="<?php echo wp_specialchars($row->text_after_link,'double')?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('After Link:') ?></th>
<td><input type="text" name="text_after_all" size="45" value="<?php echo wp_specialchars($row->text_after_all,'double')?>"/></td>
</tr>
</table>
</fieldset>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Save Category Settings &raquo;') ?>" /></p>
</form>
</div>
<?php
} // end if row
break;
} // end Edit
case "editedcat":
{
$cat_id = (int)$_POST["cat_id"];
check_admin_referer('update-link-category_' . $cat_id);
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
$submit=$_POST["submit"];
if (isset($submit)) {
$cat_name= wp_specialchars($_POST["cat_name"]);
$auto_toggle = $_POST["auto_toggle"];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$show_images = $_POST["show_images"];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $_POST["show_description"];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $_POST["show_rating"];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $_POST["show_updated"];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $_POST["sort_order"];
$sort_desc = $_POST["sort_desc"];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = $_POST["text_before_link"];
$text_after_link = $_POST["text_after_link"];
$text_after_all = $_POST["text_after_all"];
$list_limit = $_POST["list_limit"];
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("UPDATE $wpdb->linkcategories set
cat_name='$cat_name',
auto_toggle='$auto_toggle',
show_images='$show_images',
show_description='$show_description',
show_rating='$show_rating',
show_updated='$show_updated',
sort_order='$sort_order',
sort_desc='$sort_desc',
text_before_link='$text_before_link',
text_after_link='$text_after_link',
text_after_all='$text_after_all',
list_limit=$list_limit
WHERE cat_id=$cat_id
");
} // end if save
wp_redirect("link-categories.php");
break;
} // end editcat
default:
{
include_once ("admin-header.php");
if ( !current_user_can('manage_links') )
die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)"));
?>
<div class="wrap">
<h2><?php _e('Link Categories:') ?></h2>
<table id="the-list" width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
<th rowspan="2" valign="bottom"><?php _e('Name') ?></th>
<th rowspan="2" valign="bottom"><?php _e('ID') ?></th>
<th rowspan="2" valign="bottom"><?php _e('Toggle?') ?></th>
<th colspan="4" valign="bottom" class="alternate"><?php _e('Show') ?></th>
<th rowspan="2" valign="bottom"><?php _e('Sort Order') ?></th>
<th rowspan="2" valign="bottom"><?php _e('Desc?') ?></th>
<th colspan="3" valign="bottom" class="alternate"><?php _e('Formatting') ?></th>
<th rowspan="2" valign="bottom"><?php _e('Limit') ?></th>
<th rowspan="2" colspan="2">&nbsp;</th>
</tr>
<tr>
<th valign="top"><?php _e('Images') ?></th>
<th valign="top"><?php _e('Description') ?></th>
<th valign="top"><?php _e('Rating') ?></th>
<th valign="top"><?php _e('Updated') ?></th>
<th valign="top"><?php _e('Before') ?></th>
<th valign="top"><?php _e('Between') ?></th>
<th valign="top"><?php _e('After') ?></th>
</tr>
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $wpdb->linkcategories ORDER BY cat_id");
$i = 1;
foreach ( (array) $results as $row) {
if ($row->list_limit == -1) {
$row->list_limit = __('none');
}
$style = ($i % 2) ? ' class="alternate"' : '';
/*
Manually internationalize every sort order option.
*/
switch ($row->sort_order) {
case 'name':
$row->sort_order = __('name');
break;
case 'id':
$row->sort_order = __('id');
break;
case 'url':
$row->sort_order = __('url');
break;
case 'rating':
$row->sort_order = __('rating');
break;
case 'updated':
$row->sort_order = __('updated');
break;
case 'rand':
$row->sort_order = __('rand');
break;
case 'length':
$row->sort_order = __('length');
break;
}
?>
<tr id="link-category-<?php echo $row->cat_id; ?>" valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
<td><?php echo wp_specialchars($row->cat_name)?></td>
<td ><?php echo $row->cat_id?></td>
<td><?php echo $row->auto_toggle == 'Y' ? __('Yes') : __('No') ?></td>
<td><?php echo $row->show_images == 'Y' ? __('Yes') : __('No') ?></td>
<td><?php echo $row->show_description == 'Y' ? __('Yes') : __('No') ?></td>
<td><?php echo $row->show_rating == 'Y' ? __('Yes') : __('No') ?></td>
<td><?php echo $row->show_updated == 'Y' ? __('Yes') : __('No') ?></td>
<td><?php echo $row->sort_order ?></td>
<td><?php echo $row->sort_desc == 'Y' ? __('Yes') : __('No') ?></td>
<td nowrap="nowrap"><?php echo wp_specialchars($row->text_before_link)?>&nbsp;</td>
<td nowrap="nowrap"><?php echo wp_specialchars($row->text_after_link)?>&nbsp;</td>
<td nowrap="nowrap"><?php echo wp_specialchars($row->text_after_all)?></td>
<td><?php echo $row->list_limit ?></td>
<td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&amp;action=Edit" class="edit"><?php _e('Edit') ?></a></td>
<td>
<?php if (1 == $row->cat_id ) {
_e('Default');
} else { ?>
<a href="<?php echo wp_nonce_url("link-categories.php?cat_id=$row->cat_id?>&amp;action=Delete", 'delete-link-category_' . $row->cat_id) ?>" onclick="return deleteSomething( 'link category', <?php echo $row->cat_id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; link category.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($row->cat_name)); ?>' );" class="delete"><?php _e('Delete') ?></a></td>
<?php } ?>
</tr>
<?php
++$i;
}
?>
</table>
<p><?php _e('These are the defaults for when you call a link category with no additional arguments. All of these settings may be overwritten.') ?></p>
<div id="ajax-response"></div>
</div>
<div class="wrap">
<form name="addcat" method="post" action="">
<?php wp_nonce_field('add-link-category'); ?>
<input type="hidden" name="action" value="addcat" />
<h2><?php _e('Add a Link Category:') ?></h2>
<fieldset class="options">
<legend><?php _e('Category Options') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Name:') ?></th>
<td width="67%"><input type="text" name="cat_name" size="30" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Show:') ?></th>
<td>
<label>
<input type="checkbox" name="show_images" value="Y" />
<?php _e('Image') ?></label> <br />
<label>
<input type="checkbox" name="show_description" value="Y" />
<?php _e('Description') ?></label>
<?php _e('(shown in <code>title</code> regardless)') ?><br />
<label>
<input type="checkbox" name="show_rating" value="Y" />
<?php _e('Rating') ?></label> <br />
<label>
<input type="checkbox" name="show_updated" value="Y" />
<?php _e('Updated') ?></label>
<?php _e('(shown in <code>title</code> regardless)') ?></td>
</tr>
<tr>
<th scope="row"><?php _e('Sort order:') ?></th>
<td>
<select name="sort_order" size="1">
<option value="name"><?php _e('Name') ?></option>
<option value="id"><?php _e('Id') ?></option>
<option value="url"><?php _e('URL') ?></option>
<option value="rating"><?php _e('Rating') ?></option>
<option value="updated"><?php _e('Updated') ?></option>
<option value="rand"><?php _e('Random') ?></option>
</select>
<label>
<input type="checkbox" name="sort_desc" value="Y" />
<?php _e('Descending') ?></label>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Limit:') ?></th>
<td>
<input type="text" name="list_limit" size="5" value="" /> <?php _e('(Leave empty for no limit to number of links shown)') ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Toggle:') ?></th>
<td><label>
<input type="checkbox" name="auto_toggle" value="Y" />
<?php _e('When new link is added toggle all others to be invisible') ?></label></td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend><?php _e('Formatting') ?></legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
<td width="67%"><input type="text" name="text_before_link" size="45" value="&lt;li&gt;" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Between Link and Description:') ?></th>
<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
</tr>
<tr>
<th scope="row"><?php _e('After Link:') ?></th>
<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
</tr>
</table>
</fieldset>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
</form>
</div>
<div class="wrap">
<h3><?php _e('Note:') ?></h3>
<p><?php printf(__('Deleting a link category does not delete links from that category.<br />It will just set them back to the default category <strong>%s</strong>.'), get_linkcatname(1)) ?></p>
</div>
<?php
break;
} // end default
} // end case
?>
<?php include('admin-footer.php'); ?>

View File

@@ -12,21 +12,21 @@ if (!$step) $step = 0;
?>
<?php
switch ($step) {
case 0: {
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
case 0:
{
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
die (__("Cheatin&#8217; uh?"));
$opmltype = 'blogrolling'; // default.
$opmltype = 'blogrolling'; // default.
?>
<div class="wrap">
<h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?>
<p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
<p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?>
<div style="width: 70%; margin: auto; height: 8em;">
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
@@ -40,98 +40,96 @@ switch ($step) {
<input id="userfile" name="userfile" type="file" size="30" />
</div>
</div>
<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_categories('hide_empty=0');
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
foreach ($categories as $category) {
?>
<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
<option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>
<?php
} // end foreach
?>
</select></p>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File &raquo;') ?>" /></p>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File') ?> &raquo;" /></p>
</form>
</div>
<?php
break;
} // end case 0
break;
} // end case 0
case 1: {
case 1: {
check_admin_referer('import-bookmarks');
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
?>
<div class="wrap">
<h2><?php _e('Importing...') ?></h2>
<h2><?php _e('Importing...') ?></h2>
<?php
$cat_id = abs( (int) $_POST['cat_id'] );
if ( $cat_id < 1 )
$cat_id = 1;
$cat_id = $_POST['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) {
$cat_id = 1;
}
$opml_url = $_POST['opml_url'];
if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
$blogrolling = true;
} else { // try to get the upload file.
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
$opml_url = $_POST['opml_url'];
if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
$blogrolling = true;
}
else // try to get the upload file.
{
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
if ( isset($file['error']) )
wp_die($file['error']);
if ( isset($file['error']) )
die($file['error']);
$url = $file['url'];
$opml_url = $file['file'];
$blogrolling = false;
}
$url = $file['url'];
$opml_url = $file['file'];
$blogrolling = false;
}
if ( isset($opml_url) && $opml_url != '' ) {
if ( $blogrolling === true ) {
$opml = wp_remote_fopen($opml_url);
} else {
$opml = file_get_contents($opml_url);
}
include_once('link-parse-opml.php');
if (isset($opml_url) && $opml_url != '') {
$opml = wp_remote_fopen($opml_url);
include_once('link-parse-opml.php');
$link_count = count($names);
for ( $i = 0; $i < $link_count; $i++ ) {
if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = '';
if ( 'http' == substr($titles[$i], 0, 4) )
$titles[$i] = '';
$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
wp_insert_link($link);
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
}
$link_count = count($names);
for ($i = 0; $i < $link_count; $i++) {
if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4))
$titles[$i] = '';
// FIXME: Use wp_insert_link().
$query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
VALUES('{$urls[$i]}', '".$wpdb->escape($names[$i])."', '', $cat_id, '".$wpdb->escape($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
$result = $wpdb->query($query);
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
}
?>
<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
<?php
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
if ( ! $blogrolling )
apply_filters( 'wp_delete_file', $opml_url);
@unlink($opml_url);
if ( ! $blogrolling )
@unlink($opml_url);
?>
</div>
<?php
break;
} // end case 1
break;
} // end case 1
} // end switch
include('admin-footer.php');
?>
?>

View File

@@ -1,49 +1,257 @@
<?php
// Links
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
require_once ('admin.php');
require_once('admin.php');
wp_enqueue_script( 'listman' );
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 (empty ($cat_id))
$cat_id = 'all';
if (empty ($order_by))
$order_by = 'order_name';
$title = __('Manage Blogroll');
$title = __('Manage Links');
$this_file = $parent_file = 'link-manager.php';
include_once ("./admin-header.php");
$list_js = true;
if (!current_user_can('manage_links'))
wp_die(__("You do not have sufficient permissions to edit the links for this blog."));
$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
'notes', 'linkcheck[]');
switch ($order_by) {
case 'order_id' :
$sqlorderby = 'id';
break;
case 'order_url' :
$sqlorderby = 'url';
break;
case 'order_desc' :
$sqlorderby = 'description';
break;
case 'order_owner' :
$sqlorderby = 'owner';
break;
case 'order_rating' :
$sqlorderby = 'rating';
break;
case 'order_name' :
default :
$sqlorderby = 'name';
break;
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$links_show_cat_id = $_COOKIE['links_show_cat_id_' . COOKIEHASH];
$links_show_order = $_COOKIE['links_show_order_' . COOKIEHASH];
if ('' != $_POST['assign']) $action = 'assign';
if ('' != $_POST['visibility']) $action = 'visibility';
if ('' != $_POST['move']) $action = 'move';
if ('' != $_POST['linkcheck']) $linkcheck = $_POST[linkcheck];
switch ($action) {
case 'assign':
{
check_admin_referer('bulk-bookmarks');
// check the current user's level first.
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
//for each link id (in $linkcheck[]): if the current user level >= the
//userlevel of the owner of the link then we can proceed.
if (count($linkcheck) == 0) {
wp_redirect($this_file);
exit;
}
$all_links = join(',', $linkcheck);
$results = $wpdb->get_results("SELECT link_id, link_owner FROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)");
foreach ($results as $row) {
$ids_to_change[] = $row->link_id;
}
// should now have an array of links we can change
$all_links = join(',', $ids_to_change);
$q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)");
wp_redirect($this_file);
exit;
break;
}
case 'visibility':
{
check_admin_referer('bulk-bookmarks');
// check the current user's level first.
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
//for each link id (in $linkcheck[]): toggle the visibility
if (count($linkcheck) == 0) {
wp_redirect($this_file);
exit;
}
$all_links = join(',', $linkcheck);
$results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)");
foreach ($results as $row) {
if ($row->link_visible == 'Y') { // ok to proceed
$ids_to_turnoff[] = $row->link_id;
} else {
$ids_to_turnon[] = $row->link_id;
}
}
// should now have two arrays of links to change
if (count($ids_to_turnoff)) {
$all_linksoff = join(',', $ids_to_turnoff);
$q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)");
}
if (count($ids_to_turnon)) {
$all_linkson = join(',', $ids_to_turnon);
$q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)");
}
wp_redirect($this_file);
exit;
break;
}
case 'move':
{
check_admin_referer('bulk-bookmarks');
// check the current user's level first.
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
//for each link id (in $linkcheck[]) change category to selected value
if (count($linkcheck) == 0) {
wp_redirect($this_file);
exit;
}
$all_links = join(',', $linkcheck);
// should now have an array of links we can change
$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
wp_redirect($this_file);
exit();
break;
}
case 'Add':
{
check_admin_referer('add-bookmark');
add_link();
wp_redirect(wp_get_referer() . '?added=true');
exit;
break;
} // end Add
case 'editlink':
{
$link_id = (int) $_POST['link_id'];
check_admin_referer('update-bookmark_' . $link_id);
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
edit_link($link_id);
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
wp_redirect($this_file);
exit;
break;
} // end Save
case 'delete':
{
$link_id = (int) $_GET['link_id'];
check_admin_referer('delete-bookmark_' . $link_id);
if ( !current_user_can('manage_links') )
die (__("Cheatin' uh ?"));
wp_delete_link($link_id);
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
wp_redirect($this_file);
exit;
break;
} // end Delete
case 'linkedit': {
$xfn_js = true;
include_once ('admin-header.php');
if ( !current_user_can('manage_links') )
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) )
die( __('Link not found.') );
include('edit-link-form.php');
break;
} // end linkedit
case __("Show"):
{
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
if (!isset($order_by) || ($order_by == '')) {
if (!isset($links_show_order) || ($links_show_order == ''))
$order_by = 'order_name';
}
$links_show_order = $order_by;
//break; fall through
} // end Show
case "popup":
{
$link_url = stripslashes($_GET["linkurl"]);
$link_name = stripslashes($_GET["name"]);
//break; fall through
}
default:
{
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
if (isset($links_show_order) && ($links_show_order != ''))
$order_by = $links_show_order;
if (!isset($order_by) || ($order_by == ''))
$order_by = 'order_name';
$links_show_order = $order_by;
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600);
include_once ("./admin-header.php");
if ( !current_user_can('manage_links') )
die(__("You do not have sufficient permissions to edit the links for this blog."));
switch ($order_by)
{
case 'order_id': $sqlorderby = 'id'; break;
case 'order_url': $sqlorderby = 'url'; break;
case 'order_desc': $sqlorderby = 'description'; break;
case 'order_owner': $sqlorderby = 'owner'; break;
case 'order_rating': $sqlorderby = 'rating'; break;
case 'order_name':
default: $sqlorderby = 'name'; break;
}
if ($action != "popup") {
?>
<script type="text/javascript">
<!--
@@ -61,145 +269,183 @@ function checkAll(form)
//-->
</script>
<div class="wrap">
<form name="cats" method="post" action="">
<table width="75%" cellpadding="3" cellspacing="3">
<tr>
<td>
<?php _e('<strong>Show</strong> links in category:'); ?><br />
</td>
<td>
<?php _e('<strong>Order</strong> by:');?>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<?php
if ( isset($_GET['deleted']) ) {
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
$deleted = (int) $_GET['deleted'];
printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
echo '</p></div>';
}
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo " <select name=\"cat_id\">\n";
echo " <option value=\"All\"";
if ($cat_id == 'All')
echo " selected='selected'";
echo "> " . __('All') . "</option>\n";
foreach ($results as $row) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $cat_id)
echo " selected='selected'";
echo ">".$row->cat_id.": ".wp_specialchars($row->cat_name);
if ($row->auto_toggle == 'Y')
echo ' '.__('(auto toggle)');
echo "</option>\n";
}
echo " </select>\n";
?>
</td>
<td>
<select name="order_by">
<option value="order_id" <?php if ($order_by == 'order_id') echo " selected='selected'";?>><?php _e('Link ID') ?></option>
<option value="order_name" <?php if ($order_by == 'order_name') echo " selected='selected'";?>><?php _e('Name') ?></option>
<option value="order_url" <?php if ($order_by == 'order_url') echo " selected='selected'";?>><?php _e('URI') ?></option>
<option value="order_desc" <?php if ($order_by == 'order_desc') echo " selected='selected'";?>><?php _e('Description') ?></option>
<option value="order_owner" <?php if ($order_by == 'order_owner') echo " selected='selected'";?>><?php _e('Owner') ?></option>
<option value="order_rating" <?php if ($order_by == 'order_rating') echo " selected='selected'";?>><?php _e('Rating') ?></option>
</select>
</td>
<td>
<input type="submit" name="action" value="<?php _e('Show') ?>" />
</td>
</tr>
</table>
</form>
</div>
<form name="links" id="links" method="post" action="">
<div class="wrap">
<h2><?php _e('Blogroll Management'); ?></h2>
<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_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->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";
$select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' . __('Link ID') . "</option>\n";
$select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' . __('Name') . "</option>\n";
$select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' . __('Address') . "</option>\n";
$select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' . __('Rating') . "</option>\n";
$select_order .= "</select>\n";
printf(__('Currently showing %1$s links ordered by %2$s'), $select_cat, $select_order);
?>
<input type="submit" name="action" value="<?php _e('Update &raquo;') ?>" /></p>
</form>
<?php wp_nonce_field('bulk-bookmarks') ?>
<input type="hidden" name="link_id" value="" />
<input type="hidden" name="action" value="" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
<tr>
<th width="15%"><?php _e('Name') ?></th>
<th><?php _e('URI') ?></th>
<th><?php _e('Category') ?></th>
<th><?php _e('rel') ?></th>
<th><?php _e('Image') ?></th>
<th><?php _e('Visible') ?></th>
<th colspan="2"><?php _e('Action') ?></th>
<th>&nbsp;</th>
</tr>
<?php
$link_columns = array(
'name' => '<th width="15%">' . __('Name') . '</th>',
'url' => '<th>' . __('URL') . '</th>',
'categories' => '<th>' . __('Categories') . '</th>',
'rel' => '<th style="text-align: center">' . __('rel') . '</th>',
'visible' => '<th style="text-align: center">' . __('Visible') . '</th>',
'action' => '<th colspan="2" style="text-align: center">' . __('Action') . '</th>',
);
$link_columns = apply_filters('manage_link_columns', $link_columns);
$sql = "SELECT link_url, link_name, link_image, link_description, link_visible,
link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id,
link_rating, link_rel
FROM $wpdb->links
LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id
LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner ";
if (isset($cat_id) && ($cat_id != 'All')) {
$sql .= " WHERE link_category = $cat_id ";
}
$sql .= ' ORDER BY link_' . $sqlorderby;
// echo "$sql";
$links = $wpdb->get_results($sql);
if ($links) {
foreach ($links as $link) {
$link->link_name = attribute_escape($link->link_name);
$link->link_category = wp_specialchars($link->link_category);
$link->link_description = wp_specialchars($link->link_description);
$link->link_url = attribute_escape($link->link_url);
$short_url = str_replace('http://', '', $link->link_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).'...';
$image = ($link->link_image != null) ? __('Yes') : __('No');
$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
++$i;
$style = ($i % 2) ? '' : ' class="alternate"';
?>
<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
<td><strong><?php echo $link->link_name; ?></strong><br />
<?php
echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
echo <<<LINKS
<td>$link->category</td>
<td>$link->link_rel</td>
<td align='center'>$image</td>
<td align='center'>$visible</td>
LINKS;
$show_buttons = 1; // default
<?php
if ( 'all' == $cat_id )
$cat_id = '';
$links = get_bookmarks( "category=$cat_id&hide_invisible=0&orderby=$sqlorderby&hide_empty=0" );
if ( $links ) {
?>
if ($show_buttons) {
echo '<td><a href="link-manager.php?link_id=' . $link->link_id . '&amp;action=linkedit" class="edit">' . __('Edit') . '</a></td>';
echo '<td><a href="' . wp_nonce_url('link-manager.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." class='delete' onclick=\"return deleteSomething( 'link', $link->link_id , '".sprintf(__("You are about to delete the &quot;%s&quot; bookmark to %s.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($link->link_name), js_escape($link->link_url)).'\' );">'.__('Delete').'</a></td>';
echo '<td><input type="checkbox" name="linkcheck[]" value="' . $link->link_id . '" /></td>';
} else {
echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
}
<form id="links" method="post" action="link.php">
<?php wp_nonce_field('bulk-bookmarks') ?>
<input type="hidden" name="link_id" value="" />
<input type="hidden" name="action" value="" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
<table class="widefat">
<thead>
<tr>
<?php foreach($link_columns as $column_display_name) {
echo $column_display_name;
} ?>
<th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
</tr>
</thead>
<tbody id="the-list">
<?php
foreach ($links as $link) {
$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);
if ('/' == substr($short_url, -1))
$short_url = substr($short_url, 0, -1);
if (strlen($short_url) > 35)
$short_url = substr($short_url, 0, 32).'...';
$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
++ $i;
$style = ($i % 2) ? '' : ' class="alternate"';
?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
foreach($link_columns as $column_name=>$column_display_name) {
switch($column_name) {
case 'name':
?><td><strong><?php echo $link->link_name; ?></strong><br /><?php
echo $link->link_description . "</td>";
break;
case 'url':
echo "<td><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
break;
case 'categories':
?><td><?php
$cat_names = array();
foreach ($link->link_category as $category) {
$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;
}
echo implode(', ', $cat_names);
?> </td><?php
break;
case 'rel':
?><td><?php echo $link->link_rel; ?></td><?php
break;
case 'visible':
?><td align='center'><?php echo $visible; ?></td><?php
break;
case 'action':
echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>';
echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the '%s' link to %s.\n'Cancel' to stop, 'OK' to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
break;
default:
?>
<td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
<?php
break;
}
}
echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>';
echo "\n </tr>\n";
}
}
}
?>
</tbody>
</table>
<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>
</form>
<?php } ?>
</div>
<div class="wrap">
<table width="100%" cellpadding="3" cellspacing="3">
<tr><th colspan="4"><?php _e('Manage Multiple Links:') ?></th></tr>
<tr><td colspan="4"><?php _e('Use the checkboxes on the right to select multiple links and choose an action below:') ?></td></tr>
<tr>
<td>
<?php _e('Assign ownership to:'); ?>
<?php
$results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY ID");
echo " <select name=\"newowner\" size=\"1\">\n";
foreach ($results as $row) {
echo " <option value=\"".$row->ID."\"";
echo ">".$row->user_login;
echo "</option>\n";
}
echo " </select>\n";
?>
<input name="assign" type="submit" id="assign" value="<?php _e('Go') ?>" />
</td>
<td>
<input name="visibility" type="submit" id="visibility" value="<?php _e('Toggle Visibility') ?>" />
</td>
<td>
<?php _e('Move to category:'); link_category_dropdown('category'); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" />
</td>
<td align="right">
<a href="#" onclick="checkAll(document.getElementById('links')); return false; "><?php _e('Toggle Checkboxes') ?></a>
</td>
</tr>
</table>
<?php
} // end if !popup
?>
</div>
</form>
<?php
break;
} // end default
} // end case
?>
<?php include('admin-footer.php'); ?>

View File

@@ -4,12 +4,12 @@ require_once('../wp-config.php');
// columns we wish to find are: link_url, link_name, link_target, link_description
// we need to map XML attribute names to our columns
$opml_map = array('URL' => 'link_url',
'HTMLURL' => 'link_url',
'TEXT' => 'link_name',
'TITLE' => 'link_name',
'TARGET' => 'link_target',
'DESCRIPTION' => 'link_description',
'XMLURL' => 'link_rss'
'HTMLURL' => 'link_url',
'TEXT' => 'link_name',
'TITLE' => 'link_name',
'TARGET' => 'link_target',
'DESCRIPTION' => 'link_description',
'XMLURL' => 'link_rss'
);
$map = $opml_map;
@@ -20,24 +20,24 @@ $map = $opml_map;
**/
function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map;
global $names, $urls, $targets, $descriptions, $feeds;
global $names, $urls, $targets, $descriptions, $feeds;
if ($tagName == 'OUTLINE') {
foreach (array_keys($map) as $key) {
if (isset($attrs[$key])) {
$$map[$key] = $attrs[$key];
}
}
foreach (array_keys($map) as $key) {
if (isset($attrs[$key])) {
$$map[$key] = $attrs[$key];
}
}
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
// save the data away.
$names[] = $link_name;
$urls[] = $link_url;
$targets[] = $link_target;
// save the data away.
$names[] = $link_name;
$urls[] = $link_url;
$targets[] = $link_target;
$feeds[] = $link_rss;
$descriptions[] = $link_description;
} // end if outline
$descriptions[] = $link_description;
} // end if outline
}
/**
@@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!xml_parse($xml_parser, $opml, true)) {
echo(sprintf(__('XML error: %1$s at line %2$s'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
echo(sprintf(__('XML error: %1$s at line %2$s'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
// Free up memory used by the XML parser

View File

@@ -1,117 +0,0 @@
<?php
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 ('' != $_POST['deletebookmarks'])
$action = 'deletebookmarks';
if ('' != $_POST['move'])
$action = 'move';
if ('' != $_POST['linkcheck'])
$linkcheck = $_POST[linkcheck];
$this_file = 'link-manager.php';
switch ($action) {
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);
exit;
}
$deleted = 0;
foreach ($linkcheck as $link_id) {
$link_id = (int) $link_id;
if ( wp_delete_link($link_id) )
$deleted++;
}
wp_redirect("$this_file?deleted=$deleted");
exit;
break;
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);
exit;
}
$all_links = join(',', $linkcheck);
// should now have an array of links we can change
//$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
wp_redirect($this_file);
exit;
break;
case 'add' :
check_admin_referer('add-bookmark');
add_link();
wp_redirect(wp_get_referer().'?added=true');
exit;
break;
case 'save' :
$link_id = (int) $_POST['link_id'];
check_admin_referer('update-bookmark_' . $link_id);
edit_link($link_id);
wp_redirect($this_file);
exit;
break;
case 'delete' :
$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);
exit;
break;
case 'edit' :
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
if ( current_user_can( 'manage_categories' ) )
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 ('edit-link-form.php');
break;
default :
break;
}
include ('admin-footer.php');
?>

View File

@@ -0,0 +1,96 @@
var listItems;
var reg_color = '#FFFFFF';
var alt_color = '#F1F1F1';
addLoadEvent(getListItems);
function deleteSomething( what, id, message ) {
what.replace('-', ' ');
if (!message) message = 'Are you sure you want to delete this ' + what + '?';
if ( confirm(message) ) {
return ajaxDelete( what.replace(' ', '-'), id );
} else {
return false;
}
}
function getResponseElement() {
var p = document.getElementById('ajax-response-p');
if (!p) {
p = document.createElement('p');
p.id = 'ajax-response-p';
document.getElementById('ajax-response').appendChild(p);
return p;
}
}
function ajaxDelete(what, id) {
ajaxDel = new sack('list-manipulation.php');
if ( ajaxDel.failed ) return true;
ajaxDel.myResponseElement = getResponseElement();
ajaxDel.method = 'POST';
ajaxDel.onLoading = function() { ajaxDel.myResponseElement.innerHTML = 'Sending Data...'; };
ajaxDel.onLoaded = function() { ajaxDel.myResponseElement.innerHTML = 'Data Sent...'; };
ajaxDel.onInteractive = function() { ajaxDel.myResponseElement.innerHTML = 'Processing Data...'; };
ajaxDel.onCompletion = function() { removeThisItem( what + '-' + id ); };
ajaxDel.runAJAX('action=delete-' + what + '&id=' + id + '&' + ajaxDel.encVar('cookie', document.cookie));
return false;
}
function removeThisItem(id) {
var response = ajaxDel.response;
if ( isNaN(response) ) { ajaxDel.myResponseElement.innerHTML = response; return false; }
response = parseInt(response, 10);
if ( -1 == response ) { ajaxDel.myResponseElement.innerHTML = "You don't have permission to do that."; }
else if ( 0 == response ) { ajaxDel.myResponseElement.interHTML = "Something odd happened. Try refreshing the page? Either that or what you tried to delete never existed in the first place."; }
else if ( 1 == response ) {
theItem = document.getElementById(id);
Fat.fade_element(id,null,700,'#FF3333');
setTimeout('theItem.parentNode.removeChild(theItem)', 705);
var pos = getListPos(id);
listItems.splice(pos,1);
recolorList(pos);
ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
}
}
function getListPos(id) {
for (var i = 0; i < listItems.length; i++) {
if (id == listItems[i]) {
var pos = i;
break;
}
}
return pos;
}
function getListItems() {
if (list) return;
listItems = new Array();
var extra = false;
var list = document.getElementById('the-list');
if (!list) { var list = document.getElementById('the-list-x'); extra = true; }
if (list) {
var items = list.getElementsByTagName('tr');
if (!items[0]) { items = list.getElementsByTagName('li'); }
for (var i=0; i<items.length; i++) { listItems.push(items[i].id); }
if (extra) { listItems.splice(0,1); }
}
}
function recolorList(pos,dur,from) {
if (!pos) pos = 0;
if (!from) {
reg_from = alt_color;
alt_from = reg_color;
} else {
reg_from = from;
alt_from = from;
}
for (var i = pos; i < listItems.length; i++) {
if (i % 2 == 1) Fat.fade_element(listItems[i],null,dur,reg_from,reg_color);
else Fat.fade_element(listItems[i],null,dur,alt_from,alt_color);
}
}

View File

@@ -0,0 +1,81 @@
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');
header("Content-type: text/plain", true);
if ( !is_user_logged_in() )
die('-1');
if ( !check_ajax_referer() )
die('-1');
function grab_results() {
global $ajax_results;
$ajax_results = func_get_arg(0);
}
function get_out_now() { exit; }
add_action('shutdown', 'get_out_now', -1);
switch ( $_POST['action'] ) :
case 'delete-link' :
$id = (int) $_POST['id'];
if ( !current_user_can('manage_links') )
die ('-1');
if ( wp_delete_link($id) )
die('1');
else die('0');
break;
case 'delete-post' :
case 'delete-page' :
$id = (int) $_POST['id'];
if ( !current_user_can('edit_post', $id) ) {
die('-1');
}
if ( wp_delete_post($id) ) {
die('1');
} else die('0');
break;
case 'delete-cat' :
if ( !current_user_can('manage_categories') )
die ('-1');
$id = (int) $_POST['id'];
$cat_name = get_catname($cat_ID);
if ( wp_delete_category($id) )
die('1');
else die('0');
break;
case 'delete-comment' :
$id = (int) $_POST['id'];
if ( !$comment = get_comment($id) )
die('0');
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die('-1');
if ( wp_delete_comment($comment->comment_ID) ) {
die('1');
} else {
die('0');
}
break;
case 'delete-link-category' :
$id = (int) $_POST['id'];
if ( 1 == $id )
die('0');
if ( !current_user_can('manage_links') )
die('-1');
if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) {
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'");
die('1');
} else {
die('0');
}
break;
endswitch;
?>

View File

@@ -10,19 +10,12 @@ foreach ($menu as $item) {
// 0 = name, 1 = capability, 2 = file
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
if ( !empty($submenu[$item[2]]) ) {
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
if ( current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
} else if ( current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
}
@@ -34,8 +27,8 @@ foreach ($menu as $item) {
if ( isset($submenu["$parent_file"]) ) :
?>
<ul id="submenu">
<?php
foreach ($submenu["$parent_file"] as $item) :
<?php
foreach ($submenu["$parent_file"] as $item) :
if ( !current_user_can($item[1]) )
continue;
@@ -47,25 +40,21 @@ else $class = '';
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
if ( 'admin.php' == $pagenow )
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
} else {
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
endforeach;
?>
</ul>
<?php
else :
?>
<div id="minisub"></div>
<?php
endif;
endif;
do_action('admin_notices');

View File

@@ -5,63 +5,43 @@
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
$menu[0] = array(__('Dashboard'), 'read', 'index.php');
if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false)
$menu[5] = array(__('Write'), 'edit_pages', 'page-new.php');
else
$menu[5] = array(__('Write'), 'edit_posts', 'post-new.php');
if (strpos($_SERVER['REQUEST_URI'], 'page-new.php') !== false)
$menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
else
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
$menu[5] = array(__('Write'), 'edit_posts', 'post.php');
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
$menu[20] = array(__('Links'), 'manage_links', 'link-manager.php');
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
if ( current_user_can('edit_users') )
$menu[35] = array(__('Users'), 'edit_users', 'users.php');
$menu[35] = array(__('Users'), 'read', 'profile.php');
else
$menu[35] = array(__('Profile'), 'read', 'profile.php');
$menu[40] = array(__('Options'), 'manage_options', 'options-general.php');
$menu[45] = array(__('Import'), 'import', 'import.php');
$_wp_real_parent_file['post.php'] = 'post-new.php'; // Back-compat
$submenu['post-new.php'][5] = array(__('Write Post'), 'edit_posts', 'post-new.php');
$submenu['post-new.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.php');
$submenu['edit-comments.php'][5] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
$submenu['edit-comments.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "<span id='awaitmod'>$awaiting_mod</span>"), 'edit_posts', 'moderation.php');
$submenu['post.php'][5] = array(__('Write Post'), 'edit_posts', 'post.php');
$submenu['post.php'][10] = array(__('Write Page'), 'edit_pages', 'page-new.php');
$submenu['edit.php'][5] = array(__('Posts'), 'edit_posts', 'edit.php');
$submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
$submenu['edit.php'][12] = array(__('Uploads'), 'upload_files', 'upload.php');
$submenu['edit.php'][15] = array(__('Categories'), 'manage_categories', 'categories.php');
$submenu['edit.php'][20] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), $awaiting_mod), 'edit_posts', 'moderation.php');
$submenu['edit.php'][30] = array(__('Files'), 'edit_files', 'templates.php');
$submenu['edit.php'][35] = array(__('Import'), 'import', 'import.php');
$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'][5] = array(__('Manage Links'), 'manage_links', 'link-manager.php');
$submenu['link-manager.php'][10] = array(__('Add Link'), 'manage_links', 'link-add.php');
$submenu['link-manager.php'][15] = array(__('Link Categories'), 'manage_links', 'link-categories.php');
$submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php');
if ( current_user_can('edit_users') ) {
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
$submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
$submenu['users.php'][10] = array(__('Your Profile'), 'read', 'profile.php');
} else {
$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
}
$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
$submenu['profile.php'][10] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
$submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
$submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
$submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
$submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
$submenu['options-general.php'][30] = array(__('Privacy'), 'manage_options', 'options-privacy.php');
$submenu['options-general.php'][35] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
$submenu['options-general.php'][40] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
$submenu['options-general.php'][30] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
$submenu['options-general.php'][35] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php');
@@ -69,74 +49,16 @@ $submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php');
do_action('_admin_menu');
// Create list of page plugin hook names.
foreach ($menu as $menu_page) {
$admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
}
$_wp_submenu_nopriv = array();
$_wp_menu_nopriv = array();
// Loop over submenus and remove pages for which the user does not have privs.
foreach ($submenu as $parent => $sub) {
foreach ($sub as $index => $data) {
if ( ! current_user_can($data[1]) ) {
unset($submenu[$parent][$index]);
$_wp_submenu_nopriv[$parent][$data[2]] = true;
}
}
if ( empty($submenu[$parent]) )
unset($submenu[$parent]);
}
// Loop over the top-level menu.
// 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]]) )
continue;
$subs = $submenu[$data[2]];
$first_sub = array_shift($subs);
$old_parent = $data[2];
$new_parent = $first_sub[2];
// If the first submenu is not the same as the assigned parent,
// make the first submenu the new parent.
if ( $new_parent != $old_parent ) {
$_wp_real_parent_file[$old_parent] = $new_parent;
$menu[$id][2] = $new_parent;
foreach ($submenu[$old_parent] as $index => $data) {
$submenu[$new_parent][$index] = $submenu[$old_parent][$index];
unset($submenu[$old_parent][$index]);
}
unset($submenu[$old_parent]);
$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
}
}
do_action('admin_menu', '');
// Remove menus that have no accessible submenus and require privs that the user does not have.
// Run re-parent loop again.
foreach ( $menu as $id => $data ) {
// If submenu is empty...
if ( empty($submenu[$data[2]]) ) {
// And user doesn't have privs, remove menu.
if ( ! current_user_can($data[1]) ) {
$_wp_menu_nopriv[$data[2]] = true;
unset($menu[$id]);
}
}
}
unset($id);
uksort($menu, "strnatcasecmp"); // make it all pretty
if (! user_can_access_admin_page()) {
wp_die( __('You do not have sufficient permissions to access this page.') );
die( __('You do not have sufficient permissions to access this page.') );
}
?>

View File

@@ -2,10 +2,24 @@
require_once('admin.php');
$title = __('Moderate comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
$parent_file = 'edit.php';
$list_js = true;
wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));
$wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$comment = array();
if (isset($_POST["comment"])) {
@@ -20,8 +34,8 @@ case 'update':
check_admin_referer('moderate-comments');
if ( !current_user_can('moderate_comments') )
wp_die(__('Your level is not high enough to moderate comments.'));
if ( ! current_user_can('moderate_comments') )
die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
$item_ignored = 0;
$item_deleted = 0;
@@ -31,7 +45,7 @@ case 'update':
foreach($comment as $key => $value) {
if ($feelinglucky && 'later' == $value)
$value = 'delete';
switch($value) {
switch($value) {
case 'later':
// do nothing with that comment
// wp_set_comment_status($key, "hold");
@@ -41,18 +55,18 @@ case 'update':
wp_set_comment_status($key, 'delete');
++$item_deleted;
break;
case 'spam':
wp_set_comment_status($key, 'spam');
++$item_spam;
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 ) {
if ( get_settings('comments_notify') == true ) {
wp_notify_postauthor($key);
}
++$item_approved;
break;
}
}
}
$file = basename(__FILE__);
@@ -72,26 +86,38 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
$ignored = (int) $_GET['ignored'];
$spam = (int) $_GET['spam'];
if ($approved) {
printf(__ngettext('%s comment approved', '%s comments approved', $approved), $approved);
echo "<br/>\n";
if ('1' == $approved) {
echo __("1 comment approved") . " <br/>\n";
} else {
echo sprintf(__("%s comments approved <br />"), $approved) . "\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 ('1' == $deleted) {
echo __("1 comment deleted") . " <br/>\n";
} else {
echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
}
}
if ($spam) {
if ('1' == $spam) {
echo __("1 comment marked as spam") . " <br/>\n";
} else {
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
}
}
if ($ignored) {
printf(__ngettext('%s comment unchanged', '%s comments unchanged', $ignored), $ignored);
echo "<br/>\n";
if ('1' == $ignored) {
echo __("1 comment unchanged") . " <br/>\n";
} else {
echo sprintf(__("%s comments unchanged"), $ignored) . " <br/>\n";
}
}
echo "</p></div>\n";
}
?>
<div class="wrap">
<?php
@@ -108,44 +134,39 @@ if ($comments) {
<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">
<ol id="the-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);
$comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("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'>";
if ($i % 2) $class = 'class="alternate"';
else $class = '';
echo "\n\t<li id='comment-$comment->comment_ID' $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>
<p><strong><?php _e('Name:') ?></strong> <?php comment_author_link() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a> | <strong><?php _e('Date:') ?></strong> <?php comment_date(); ?></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;
<p><?php
echo '<a href="post.php?action=editcomment&amp;comment='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';?>
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a> |
<?php
echo " <a href=\"" . wp_nonce_url("post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . __("You are about to delete this comment.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete.") . "' );\">" . __('Delete just this comment') . "</a> | "; ?> <?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>
<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>
<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>
<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>
</ol>
<div id="ajax-response"></div>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Moderate Comments &raquo;') ?>" /></p>
<script type="text/javascript">
// <![CDATA[
function markAllForDelete() {
@@ -185,10 +206,10 @@ document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark
<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>
</form>
<?php
} else {
// nothing to approve
// nothing to approve
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
}
?>
@@ -201,6 +222,4 @@ break;
}
include('admin-footer.php');
?>
include('admin-footer.php') ?>

View File

@@ -5,29 +5,39 @@ $title = __('Discussion Options');
$parent_file = 'options-general.php';
include('admin-header.php');
if ($action == 'retrospam') {
if ( $_GET['move'] == 'true' ) {
retrospam_mgr::move_spam( $_GET[ids] );
}
$retrospaminator = new retrospam_mgr();
$result = $retrospaminator->find_spam();
echo $retrospaminator->display_edit_form( $result );
include('./admin-footer.php');
exit;
}
?>
<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>
<legend><?php _e('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')); ?> />
<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_settings('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')); ?> />
<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_settings('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')); ?> />
<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_settings('default_comment_status')); ?> />
<?php _e('Allow people to post comments on the article') ?></label>
</li>
</ul>
@@ -37,12 +47,12 @@ include('admin-header.php');
<ul>
<li>
<label for="comments_notify">
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_settings('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')); ?> />
<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_settings('moderation_notify')); ?> />
<?php _e('A comment is held for moderation') ?> </label>
</li>
</ul>
@@ -52,35 +62,40 @@ include('admin-header.php');
<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>
<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_settings('comment_moderation')); ?> />
<?php _e('An administrator must approve the comment (regardless of any matches below)') ?> </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>
<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_settings('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_settings('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 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_settings('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><?php _e('When a comment contains any of these words in its content, name, URI, e-mail, or IP, hold it in the moderation queue: (Separate multiple words with new lines.) <a href="http://codex.wordpress.org/Spam_Words">Common spam words</a>.') ?></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>
<a id="retrospambutton" href="options-discussion.php?action=retrospam"><?php _e('Check past comments against moderation list'); ?></a>
</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><?php _e('This is a list of words that you want completely blacklisted from your blog. Be very careful what you add here, because if a comment matches something here it will be completely nuked and there will be no notification. Remember that partial words can match, so if there is any chance something here might match it would be better to put it in the moderation box above.') ?></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>
<p><label for="open_proxy_check">
<input name="open_proxy_check" type="checkbox" id="open_proxy_check" value="1" <?php checked('1', get_settings('open_proxy_check')); ?> />
<?php _e('Blacklist comments from open and insecure proxies.') ?></label></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;') ?>" />
</p>
</form>
<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,open_proxy_check" />
<input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
</p>
</form>
</div>
<?php include('./admin-footer.php'); ?>
<?php include('./admin-footer.php'); ?>

View File

@@ -11,7 +11,6 @@ include('./admin-header.php');
<h2><?php _e('General 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 class="optiontable">
<tr valign="top">
<th scope="row"><?php _e('Weblog title:') ?></th>
@@ -24,12 +23,12 @@ include('./admin-header.php');
<?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>
<th scope="row"><?php _e('WordPress address (URI):') ?></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></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>
<th scope="row"><?php _e('Blog address (URI):') ?></th>
<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('E-mail address:') ?> </th>
@@ -40,10 +39,10 @@ include('./admin-header.php');
<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')); ?> />
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_settings('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_settings('comment_registration')); ?> />
<?php _e('Users must be registered and logged in to comment') ?>
</label>
</td>
@@ -51,7 +50,12 @@ include('./admin-header.php');
<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>
<select name="default_role" id="default_role"><?php
foreach($wp_roles->role_names as $role => $name) {
$selected = (get_settings('default_role') == $role) ? 'selected="selected"' : '';
echo "<option {$selected} value=\"{$role}\">{$name}</option>";
}
?></select></label>
</td>
</tr>
</table>
@@ -60,22 +64,22 @@ include('./admin-header.php');
<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><code><?php echo gmdate('Y-m-d g:i:s a'); ?></code></td>
</tr>
<tr>
<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>
<?php _e('hours') ?> </td>
</tr>
<tr>
<th scope="row"><?php _e('Default date format:') ?></th>
<td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
<?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td>
<?php _e('Output:') ?> <strong><?php echo mysql2date(get_settings('date_format'), current_time('mysql')); ?></strong></td>
</tr>
<tr>
<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>
<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
@@ -86,8 +90,9 @@ include('./admin-header.php');
<td><select name="start_of_week" id="start_of_week">
<?php
for ($day_index = 0; $day_index <= 6; $day_index++) :
$selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
if ($day_index == get_settings('start_of_week')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$day_index' $selected>$weekday[$day_index]</option>";
endfor;
?>
</select></td>
@@ -95,12 +100,12 @@ endfor;
</table>
</fieldset>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<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="page_options" value="blogname,blogdescription,siteurl,admin_email,users_can_register,gmt_offset,date_format,time_format,home,start_of_week,comment_registration,default_role" />
</p>
</form>
</div>
<?php include('./admin-footer.php') ?>
<?php include('./admin-footer.php') ?>

View File

@@ -1,4 +1,23 @@
<?php wp_reset_vars(array('action', 'standalone', 'option_group_id')); ?>
<?php
$wpvarstoreset = array('action','standalone', 'option_group_id');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
?>
<br clear="all" />
<?php if (isset($_GET['updated'])) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>

View File

@@ -7,18 +7,17 @@ $parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Miscellaneous Options') ?></h2>
<div class="wrap">
<h2><?php _e('Miscellaneous 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 _e('Uploading'); ?></legend>
<table class="editform optiontable">
<tr valign="top">
<th scope="row"><?php _e('Store uploads in this folder'); ?>:</th>
<td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" size="40" />
<td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_settings('upload_path'))); ?>" size="40" />
<br />
<?php _e('Default is <code>wp-content/uploads</code>'); ?>
</td>
@@ -27,7 +26,7 @@ include('admin-header.php');
<td></td>
<td>
<label for="uploads_use_yearmonth_folders">
<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" <?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" <?php checked('1', get_settings('uploads_use_yearmonth_folders')); ?> />
<?php _e('Organize my uploads into month- and year-based folders'); ?>
</label>
</td>
@@ -35,18 +34,18 @@ include('admin-header.php');
</table>
</fieldset>
<p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_option('use_linksupdate')); ?> />
<p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_settings('use_linksupdate')); ?> />
<label for="use_linksupdate"><?php _e('Track Links&#8217; Update Times') ?></label></p>
<p>
<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_option('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label>
<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_settings('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label>
</p>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
</p>
</form>
</form>
</div>
<?php include('./admin-footer.php'); ?>

View File

@@ -41,7 +41,7 @@ structure.onfocus = function () { document.getElementById('custom_selection').ch
var aInputs = document.getElementsByTagName('input');
for (var i = 0; i < aInputs.length; i++) {
for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}
@@ -66,7 +66,7 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
$permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
$wp_rewrite->set_permalink_structure($permalink_structure);
}
if ( isset($_POST['category_base']) ) {
$category_base = $_POST['category_base'];
if (! empty($category_base) )
@@ -74,9 +74,9 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
$wp_rewrite->set_category_base($category_base);
}
}
$permalink_structure = get_option('permalink_structure');
$category_base = get_option('category_base');
$permalink_structure = get_settings('permalink_structure');
$category_base = get_settings('category_base');
if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
$writable = true;
@@ -102,10 +102,7 @@ else
<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>
<p><?php _e('By default WordPress uses web URIs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URI 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>
<?php
$prefix = '';
@@ -119,23 +116,25 @@ $structures = array(
$prefix . '/archives/%post_id%'
);
?>
<form name="form" action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>
<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> &raquo; <code><?php echo get_option('home'); ?>/?p=123</code></span>
<?php _e('Default'); ?><br /> <span> &raquo; <code><?php echo get_settings('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> &raquo; <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
<?php _e('Date and name based'); ?><br /> <span> &raquo; <code><?php echo get_settings('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> &raquo; <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span>
<?php _e('Numeric'); ?><br /> <span> &raquo; <code><?php echo get_settings('home') . $prefix ; ?>/archives/123</code></span>
</label>
</p>
<p>
@@ -144,8 +143,8 @@ $structures = array(
<?php if ( !in_array($permalink_structure, $structures) ) { ?>
checked="checked"
<?php } ?>
/>
<?php _e('Custom, specify below'); ?>
/>
<?php _e('Custom, specify below'); ?>
</label>
<br />
</p>
@@ -153,9 +152,9 @@ checked="checked"
<h3><?php _e('Optional'); ?></h3>
<?php if ($is_apache) : ?>
<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>
<p><?php _e('If you like, you may enter a custom prefix for your category URIs 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 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>
<p><?php _e('If you like, you may enter a custom prefix for your category URIs 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" type="text" class="code" value="<?php echo attribute_escape($category_base); ?>" size="30" />
@@ -169,7 +168,7 @@ checked="checked"
<form action="options-permalink.php" method="post">
<?php wp_nonce_field('update-permalink') ?>
<p>
<textarea rows="5" style="width: 98%;" name="rules"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?>
<textarea rows="5" style="width: 98%;" name="rules"><?php echo $wp_rewrite->mod_rewrite_rules(); ?>
</textarea>
</p>
</form>

View File

@@ -1,35 +0,0 @@
<?php
require_once('./admin.php');
$title = __('Privacy Options');
$parent_file = 'options-general.php';
include('./admin-header.php');
?>
<div class="wrap">
<h2><?php _e('Privacy Options') ?></h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<table class="optiontable">
<tr valign="top">
<th scope="row"><?php _e('Blog visibility:') ?> </th>
<td>
<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
<?php do_action('blog_privacy_selector'); ?>
</td>
</tr>
</table>
<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="blog_public" />
</p>
</form>
</div>
<?php include('./admin-footer.php') ?>

View File

@@ -11,48 +11,18 @@ include('admin-header.php');
<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>
<td>
<p><label>
<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')); ?> />
<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
</label>
</p>
<ul>
<li><?php printf(__('Front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
<li><?php printf(__('Posts page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
</ul>
<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
<div id="front-page-warning" class="updated fade-ff0000">
<p>
<?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?>
</p>
</div>
<?php endif; ?>
</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">
<table width="100%" cellspacing="2" cellpadding="5" class="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') ?>
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" />
<select name="what_to_show" id="what_to_show" >
<option value="days" <?php selected('days', get_settings('what_to_show')); ?>><?php _e('days') ?></option>
<option value="posts" <?php selected('posts', get_settings('what_to_show')); ?>><?php _e('posts') ?></option>
</select>
</td>
</tr>
</table>
@@ -60,7 +30,7 @@ include('admin-header.php');
<fieldset class="options">
<legend><?php _e('Syndication Feeds') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<table width="100%" cellspacing="2" cellpadding="5" class="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>
@@ -68,14 +38,13 @@ include('admin-header.php');
<tr valign="top">
<th scope="row"><?php _e('For each article, show:') ?> </th>
<td>
<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br />
<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>
<label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_settings('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br />
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_settings('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label>
</td>
</tr>
</table>
</fieldset>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<table width="100%" cellspacing="2" cellpadding="5" class="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 />
@@ -83,13 +52,13 @@ include('admin-header.php');
</tr>
</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_settings('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;') ?>" />
<input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression" />
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
</p>
</form>
</div>

View File

@@ -11,8 +11,7 @@ include('admin-header.php');
<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">
<table width="100%" cellspacing="2" cellpadding="5" class="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; " />
@@ -21,10 +20,13 @@ include('admin-header.php');
<tr valign="top">
<th scope="row"><?php _e('Formatting:') ?></th>
<td>
<label for="rich_editing">
<input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_settings('rich_editing')); ?> />
<?php _e('Users should use the visual rich editor by default') ?></label><br />
<label for="use_smilies">
<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_settings('use_smilies')); ?> />
<?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_settings('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
</td>
</tr>
<tr valign="top">
@@ -33,19 +35,7 @@ include('admin-header.php');
<?php
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
endforeach;
?>
</select></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Default link category:') ?></th>
<td><select name="default_link_category" id="default_link_category">
<?php
foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_link_category')) $selected = " selected='selected'";
if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
endforeach;
@@ -55,14 +45,14 @@ endforeach;
</table>
<fieldset class="options">
<legend><?php _e('Post via e-mail') ?></legend>
<legend><?php _e('Writing by e-mail') ?></legend>
<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <code>%s</code>, <code>%s</code>, <code>%s</code>.'), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5)) ?></p>
<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th scope="row"><?php _e('Mail server:') ?></th>
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
<label for="mailserver_port"><?php _e('Port:') ?></label>
<label for="mailserver_port"><?php _e('Port:') ?></label>
<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
</td>
</tr>
@@ -77,12 +67,12 @@ endforeach;
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Default mail category:') ?></th>
<th scope="row"><?php _e('Default post by mail category:') ?></th>
<td><select name="default_email_category" id="default_email_category">
<?php
//Alreay have $categories from default_category
foreach ($categories as $category) :
if ($category->cat_ID == get_option('default_email_category')) $selected = " selected='selected'";
if ($category->cat_ID == get_settings('default_email_category')) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
endforeach;
@@ -94,27 +84,17 @@ endforeach;
<fieldset class="options">
<legend><?php _e('Update Services') ?></legend>
<?php if ( get_option('blog_public') ) : ?>
<p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></p>
<p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service URIs with line breaks.') ?></p>
<textarea name="ping_sites" id="ping_sites" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea>
<?php else : ?>
<p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog\'s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?>
<?php endif; ?>
</fieldset>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
<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_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags" />
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
</p>
</form>
</div>
</form>
</div>
<?php include('./admin-footer.php') ?>

View File

@@ -5,16 +5,91 @@ $title = __('Options');
$this_file = 'options.php';
$parent_file = 'options-general.php';
wp_reset_vars(array('action'));
$wpvarstoreset = array('action');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
if ( !current_user_can('manage_options') )
wp_die(__('Cheatin&#8217; uh?'));
die ( __('Cheatin&#8217; uh?') );
function sanitize_option($option, $value) {
switch ($option) {
case 'admin_email':
$value = sanitize_email($value);
break;
case 'default_post_edit_rows':
case 'mailserver_port':
case 'comment_max_links':
$value = abs((int) $value);
break;
case 'posts_per_page':
case 'posts_per_rss':
$value = (int) $value;
if ( empty($value) ) $value = 1;
if ( $value < -1 ) $value = abs($value);
break;
case 'default_ping_status':
case 'default_comment_status':
// Options that if not there have 0 value but need to be something like "closed"
if ( $value == '0' || $value == '')
$value = 'closed';
break;
case 'blogdescription':
case 'blogname':
if (current_user_can('unfiltered_html') == false)
$value = wp_filter_post_kses( $value );
break;
case 'blog_charset':
$value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value);
break;
case 'date_format':
case 'time_format':
case 'mailserver_url':
case 'mailserver_login':
case 'mailserver_pass':
case 'ping_sites':
case 'upload_path':
$value = strip_tags($value);
$value = wp_filter_kses($value);
break;
case 'gmt_offset':
$value = preg_replace('/[^0-9:.-]/', '', $value);
break;
case 'siteurl':
case 'home':
$value = clean_url($value);
break;
}
return $value;
}
switch($action) {
case 'update':
$any_changed = 0;
check_admin_referer('update-options');
if ( !$_POST['page_options'] ) {
@@ -26,15 +101,36 @@ case 'update':
$options = explode(',', stripslashes($_POST['page_options']));
}
// Save for later.
$old_siteurl = get_settings('siteurl');
$old_home = get_settings('home');
if ($options) {
foreach ($options as $option) {
$option = trim($option);
$value = trim($_POST[$option]);
$value = sanitize_option($option, $value); // This does stripslashes on those that need it
update_option($option, $value);
$value = trim(stripslashes($_POST[$option]));
$value = sanitize_option($option, $value);
if (update_option($option, $value) ) {
$any_changed++;
}
}
}
if ($any_changed) {
// If siteurl or home changed, reset cookies.
if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
// 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_settings('home'), get_settings('siteurl'));
}
//$message = sprintf(__('%d setting(s) saved... '), $any_changed);
}
$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);
@@ -49,18 +145,16 @@ default:
<form name="form" action="options.php" method="post" id="all-options">
<?php wp_nonce_field('update-options') ?>
<input type="hidden" name="action" value="update" />
<p class="submit"><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
<table width="98%">
<?php
$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
foreach ( (array) $options as $option) :
$disabled = '';
$option->option_name = attribute_escape($option->option_name);
if ( is_serialized($option->option_value) ) {
if ( is_serialized_string($option->option_value) ) {
// this is a serialized string, so we should display it
$value = maybe_unserialize($option->option_value);
$value = wp_specialchars(maybe_unserialize($option->option_value), 'single');
$options_to_update[] = $option->option_name;
$class = 'all-options';
} else {
@@ -69,7 +163,7 @@ foreach ( (array) $options as $option) :
$class = 'all-options disabled';
}
} else {
$value = $option->option_value;
$value = wp_specialchars($option->option_value, 'single');
$options_to_update[] = $option->option_name;
$class = 'all-options';
}
@@ -78,9 +172,9 @@ foreach ( (array) $options as $option) :
<th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
<td>";
if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
echo "</td>
<td>$option->option_description</td>
</tr>";
@@ -88,7 +182,7 @@ endforeach;
?>
</table>
<?php $options_to_update = implode(',', $options_to_update); ?>
<p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
<p class="submit"><input type="hidden" name="page_options" value="<?php echo attribute_escape($options_to_update); ?>" /><input type="submit" name="Update" value="<?php _e('Update Options &raquo;') ?>" /></p>
</form>
</div>

View File

@@ -1,26 +1,23 @@
<?php
require_once('admin.php');
$title = __('New Page');
$parent_file = 'post-new.php';
$parent_file = 'post.php';
$editing = true;
wp_enqueue_script('prototype');
wp_enqueue_script('interface');
wp_enqueue_script('autosave');
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>
<?php if ( 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( $_GET['saved'] ); ?>"><?php _e('View page'); ?> &raquo;</a></p></div>
<?php endif; ?>
<?php
if ( current_user_can('edit_pages') ) {
$action = 'post';
$post = get_default_post_to_edit();
$post->post_type = 'page';
$post->post_status = 'static';
include('edit-page-form.php');
}
?>
<?php include('admin-footer.php'); ?>
<?php include('admin-footer.php'); ?>

View File

@@ -1,158 +0,0 @@
<?php
require_once('admin.php');
$parent_file = 'edit.php';
$submenu_file = 'edit-pages.php';
wp_reset_vars(array('action'));
if (isset($_POST['deletepost'])) {
$action = "delete";
}
switch($action) {
case 'post':
check_admin_referer('add-page');
$page_ID = write_post();
// Redirect.
if (!empty($_POST['mode'])) {
switch($_POST['mode']) {
case 'bookmarklet':
$location = $_POST['referredby'];
break;
case 'sidebar':
$location = 'sidebar.php?a=b';
break;
default:
$location = 'page-new.php';
break;
}
} else {
$location = "page-new.php?posted=$page_ID";
}
if ( isset($_POST['save']) )
$location = "page.php?action=edit&post=$page_ID";
wp_redirect($location);
exit();
break;
case 'edit':
$title = __('Edit');
$editing = true;
$page_ID = $post_ID = $p = (int) $_GET['post'];
$post = get_post_to_edit($page_ID);
if ( 'post' == $post->post_type ) {
wp_redirect("post.php?action=edit&post=$post_ID");
exit();
}
if($post->post_status == 'draft') {
wp_enqueue_script('prototype');
wp_enqueue_script('interface');
wp_enqueue_script('autosave');
}
require_once('admin-header.php');
if ( !current_user_can('edit_page', $page_ID) )
die ( __('You are not allowed to edit this page.') );
include('edit-page-form.php');
break;
case 'editattachment':
$page_id = $post_ID = (int) $_POST['post_ID'];
check_admin_referer('update-attachment_' . $page_id);
// Don't let these be changed
unset($_POST['guid']);
$_POST['post_type'] = 'attachment';
// Update the thumbnail filename
$newmeta = wp_get_attachment_metadata( $page_id, true );
$newmeta['thumb'] = $_POST['thumb'];
wp_update_attachment_metadata( $newmeta );
case 'editpost':
$page_ID = (int) $_POST['post_ID'];
check_admin_referer('update-page_' . $page_ID);
$page_ID = edit_post();
if ( 'post' == $_POST['originalaction'] ) {
if (!empty($_POST['mode'])) {
switch($_POST['mode']) {
case 'bookmarklet':
$location = $_POST['referredby'];
break;
case 'sidebar':
$location = 'sidebar.php?a=b';
break;
default:
$location = 'page-new.php';
break;
}
} else {
$location = "page-new.php?posted=$page_ID";
}
if ( isset($_POST['save']) )
$location = "page.php?action=edit&post=$page_ID";
} else {
if ($_POST['save']) {
$location = "page.php?action=edit&post=$page_ID";
} elseif ($_POST['updatemeta']) {
$location = wp_get_referer() . '&message=2#postcustom';
} elseif ($_POST['deletemeta']) {
$location = wp_get_referer() . '&message=3#postcustom';
} elseif (!empty($_POST['referredby']) && $_POST['referredby'] != wp_get_referer()) {
$location = $_POST['referredby'];
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $page_ID );
} elseif ($action == 'editattachment') {
$location = 'attachments.php';
} else {
$location = 'page-new.php';
}
}
wp_redirect($location); // Send user on their way while we keep working
exit();
break;
case 'delete':
$page_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
check_admin_referer('delete-page_' . $page_id);
$page = & get_post($page_id);
if ( !current_user_can('delete_page', $page_id) )
wp_die( __('You are not allowed to delete this page.') );
if ( $page->post_type == 'attachment' ) {
if ( ! wp_delete_attachment($page_id) )
wp_die( __('Error in deleting...') );
} else {
if ( !wp_delete_post($page_id) )
wp_die( __('Error in deleting...') );
}
$sendback = wp_get_referer();
if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
exit();
break;
default:
wp_redirect('edit-pages.php');
exit();
break;
} // end switch
include('admin-footer.php');
?>

View File

@@ -4,7 +4,21 @@ require_once('admin.php');
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$plugins = get_plugins();
$plugin_files = array_keys($plugins);
@@ -14,7 +28,7 @@ if (empty($file)) {
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
$real_file = get_real_file_to_edit("wp-content/plugins/$file");
switch($action) {
@@ -23,24 +37,13 @@ case 'update':
check_admin_referer('edit-plugin_' . $file);
if ( !current_user_can('edit_plugins') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
// Deactivate so we can test it.
$current = get_option('active_plugins');
if ( in_array($file, $current) || isset($_POST['phperror']) ) {
if ( in_array($file, $current) ) {
array_splice($current, array_search( $file, $current), 1 ); // Array-fu!
update_option('active_plugins', $current);
}
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1"));
exit();
}
wp_redirect("plugin-editor.php?file=$file&a=te");
} else {
wp_redirect("plugin-editor.php?file=$file");
@@ -51,35 +54,16 @@ case 'update':
break;
default:
if ( !current_user_can('edit_plugins') )
wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
if ( $_GET['liveupdate'] ) {
check_admin_referer('edit-plugin-test_' . $file);
$current = get_option('active_plugins');
$plugin = $file;
if ( validate_file($plugin) )
wp_die(__('Invalid plugin.'));
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
wp_die(__('Plugin file does not exist.'));
if (!in_array($plugin, $current)) {
wp_redirect("plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
@include(ABSPATH . PLUGINDIR . '/' . $plugin);
$current[] = $plugin;
sort($current);
update_option('active_plugins', $current);
}
wp_redirect("plugin-editor.php?file=$file&a=te");
}
require_once('admin-header.php');
if ( !current_user_can('edit_plugins') )
die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>');
update_recently_edited(PLUGINDIR . "/$file");
update_recently_edited("wp-content/plugins/$file");
if (!is_file($real_file))
$error = 1;
if (!$error) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
@@ -89,23 +73,13 @@ default:
?>
<?php if (isset($_GET['a'])) : ?>
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php elseif (isset($_GET['phperror'])) : ?>
<div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p></div>
<?php endif; ?>
<div class="wrap">
<?php
if ( in_array($file, (array) get_option('active_plugins')) ) {
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (active)'), $file) . '</h2>';
} else {
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (active)'), $file) . '</h2>';
}
<div class="wrap">
<?php
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
} else {
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong> (inactive)'), $file) . '</h2>';
} else {
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file) . '</h2>';
}
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file) . '</h2>';
}
?>
<div id="templateside">
@@ -114,45 +88,39 @@ default:
<?php
if ($plugin_files) :
?>
<ul>
<?php foreach($plugin_files as $plugin_file) : ?>
<ul>
<?php foreach($plugin_files as $plugin_file) : ?>
<li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php if (!$error) { ?>
<form name="template" id="template" action="plugin-editor.php" method="post">
<?php wp_nonce_field('edit-plugin_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<?php if (!$error) { ?>
<form name="template" id="template" action="plugin-editor.php" method="post">
<?php wp_nonce_field('edit-plugin_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
<?php } ?>
<p class="submit">
<?php
if ( isset($_GET['phperror']) )
echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' value='" . __('Update File and Attempt to Reactivate &raquo;') . "' tabindex='2' />";
else
echo "<input type='submit' name='submit' value='" . __('Update File &raquo;') . "' tabindex='2' />";
?>
</p>
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File') . " &raquo;' tabindex='2' />";
?>
</p>
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}
?>
?>
<div class="clear"> &nbsp; </div>
</div>
</div>
<?php
break;
}
include("admin-footer.php") ?>
include("admin-footer.php") ?>

View File

@@ -4,41 +4,22 @@ require_once('admin.php');
if ( isset($_GET['action']) ) {
if ('activate' == $_GET['action']) {
check_admin_referer('activate-plugin_' . $_GET['plugin']);
$current = get_option('active_plugins');
$plugin = trim($_GET['plugin']);
if ( validate_file($plugin) )
wp_die(__('Invalid plugin.'));
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
wp_die(__('Plugin file does not exist.'));
if (!in_array($plugin, $current)) {
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;
$current = get_settings('active_plugins');
if (!in_array($_GET['plugin'], $current)) {
$current[] = trim( $_GET['plugin'] );
sort($current);
update_option('active_plugins', $current);
do_action('activate_' . $plugin);
ob_end_clean();
include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
do_action('activate_' . trim( $_GET['plugin'] ));
}
wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
wp_redirect('plugins.php?activate=true');
} else if ('deactivate' == $_GET['action']) {
check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
$current = get_option('active_plugins');
$current = get_settings('active_plugins');
array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
update_option('active_plugins', $current);
do_action('deactivate_' . trim( $_GET['plugin'] ));
wp_redirect('plugins.php?deactivate=true');
} 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');
}
exit;
}
@@ -49,20 +30,20 @@ require_once('admin-header.php');
// Clean up options
// If any plugins don't exist, axe 'em
$check_plugins = get_option('active_plugins');
$check_plugins = get_settings('active_plugins');
// Sanity check. If the active plugin list is not an array, make it an
// empty array.
if ( !is_array($check_plugins) ) {
$check_plugins = array();
update_option('active_plugins', $check_plugins);
update_option('active_plugins', $check_plugins);
}
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ($check_plugins as $check_plugin) {
if (!file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin)) {
$current = get_option('active_plugins');
if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
$current = get_settings('active_plugins');
$key = array_search($check_plugin, $current);
if ( false !== $key && NULL !== $key ) {
unset($current[$key]);
@@ -72,14 +53,13 @@ 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></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']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
<?php elseif (isset($_GET['deactivate-all'])) : ?>
<div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
<?php if (isset($_GET['activate'])) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p>
</div>
<?php endif; ?>
<?php if (isset($_GET['deactivate'])) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p>
</div>
<?php endif; ?>
<div class="wrap">
@@ -87,26 +67,24 @@ foreach ($check_plugins as $check_plugin) {
<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
<?php
if ( get_option('active_plugins') )
$current_plugins = get_option('active_plugins');
if ( get_settings('active_plugins') )
$current_plugins = get_settings('active_plugins');
$plugins = get_plugins();
if (empty($plugins)) {
echo '<p>';
_e("Couldn&#8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
_e("Couldn't open plugins directory or there are no plugins available."); // TODO: make more helpful
echo '</p>';
} else {
?>
<table class="widefat plugins">
<thead>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th><?php _e('Plugin'); ?></th>
<th style="text-align: center"><?php _e('Version'); ?></th>
<th><?php _e('Version'); ?></th>
<th><?php _e('Description'); ?></th>
<th style="text-align: center"<?php if ( current_user_can('edit_plugins') ) echo ' colspan="2"'; ?>><?php _e('Action'); ?></th>
<th><?php _e('Action'); ?></th>
</tr>
</thead>
<?php
$style = '';
@@ -114,57 +92,33 @@ if (empty($plugins)) {
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
$toggle = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
$action = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
$plugin_data['Title'] = "<strong>{$plugin_data['Title']}</strong>";
$style .= $style == 'alternate' ? ' active' : 'active';
} else {
$toggle = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
$action = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
}
$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
// Sanitize all displayed data
$plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags);
$plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags);
$plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
$plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags);
if ( $style != '' )
$style = 'class="' . $style . '"';
if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) )
$edit = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
else
$edit = '';
$plugin_data['Description'] = wp_kses($plugin_data['Description'], array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()) ); ;
if ($style != '') $style = 'class="' . $style . '"';
echo "
<tr $style>
<td class='name'>{$plugin_data['Title']}</td>
<td class='vers'>{$plugin_data['Version']}</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"
<td class='desc'>{$plugin_data['Description']} <cite>".sprintf(__('By %s'), $plugin_data['Author']).".</cite></td>
<td class='togl'>$action</td>
</tr>";
}
?>
<tr>
<td colspan="3">&nbsp;</td>
<td colspan="2" style="width:12em;"><a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a></td>
</tr>
</table>
<?php
}
?>
<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p>
<p><?php _e('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p>
<h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?></p>
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p>
</div>

View File

@@ -1,97 +0,0 @@
<?php
require_once('admin.php');
$title = __('Create New Post');
$parent_file = 'post-new.php';
$editing = true;
wp_enqueue_script('prototype');
wp_enqueue_script('interface');
wp_enqueue_script('autosave');
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 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>
</div>
<?php
include('admin-footer.php');
exit();
}
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>
<?php
endif;
if ( $drafts = get_users_drafts( $user_ID ) ) { ?>
<div class="wrap">
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
// 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>";
}
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');
?>
<?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 "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'), 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_option('blogname')); ?></a>
<script type="text/javascript">
<!--
function oneclickbookmarklet(blah) {
window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
}
// -->
</script>
<br />
<br />
<?php _e('One-click bookmarklet:') ?><br />
<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>
<?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>
<?php
}
?>
</p>
</div>
<?php } ?>
<?php include('admin-footer.php'); ?>

View File

@@ -1,22 +1,38 @@
<?php
require_once('admin.php');
$parent_file = 'edit.php';
$submenu_file = 'edit.php';
$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder' );
wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
if ( isset( $_POST['deletepost'] ) )
$action = 'delete';
if (isset($_POST['deletepost'])) {
$action = "delete";
}
// Fix submenu highlighting for pages.
if ( isset($_REQUEST['post']) && 'static' == get_post_status($_REQUEST['post']) )
$submenu_file = 'page-new.php';
$editing = true;
switch($action) {
case 'postajaxpost':
case 'post':
$parent_file = 'post-new.php';
$submenu_file = 'post-new.php';
check_admin_referer('add-post');
$post_ID = 'post' == $action ? write_post() : edit_post();
$post_ID = write_post();
// Redirect.
if (!empty($_POST['mode'])) {
@@ -28,13 +44,16 @@ case 'post':
$location = 'sidebar.php?a=b';
break;
default:
$location = 'post-new.php';
$location = 'post.php';
break;
}
} else {
$location = "post-new.php?posted=$post_ID";
$location = "post.php?posted=$post_ID";
}
if ( 'static' == $_POST['post_status'] )
$location = "page-new.php?saved=$post_ID";
if ( isset($_POST['save']) )
$location = "post.php?action=edit&post=$post_ID";
@@ -44,28 +63,27 @@ case 'post':
case 'edit':
$title = __('Edit');
$editing = true;
$post_ID = $p = (int) $_GET['post'];
$post = get_post($post_ID);
if ( 'page' == $post->post_type ) {
wp_redirect("page.php?action=edit&post=$post_ID");
exit();
}
if($post->post_status == 'draft') {
wp_enqueue_script('prototype');
wp_enqueue_script('autosave');
}
require_once('admin-header.php');
$post_ID = $p = (int) $_GET['post'];
if ( !current_user_can('edit_post', $post_ID) )
die ( __('You are not allowed to edit this post.') );
$post = get_post_to_edit($post_ID);
if ($post->post_status == 'static')
include('edit-page-form.php');
else
include('edit-form-advanced.php');
include('edit-form-advanced.php');
?>
<div id='preview' class='wrap'>
<h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
<iframe src="<?php echo attribute_escape(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
</div>
<?php
break;
case 'editattachment':
@@ -75,60 +93,42 @@ case 'editattachment':
// Don't let these be changed
unset($_POST['guid']);
$_POST['post_type'] = 'attachment';
$_POST['post_status'] = 'attachment';
// Update the thumbnail filename
$newmeta = wp_get_attachment_metadata( $post_id, true );
$oldmeta = $newmeta = get_post_meta($post_id, '_wp_attachment_metadata', true);
$newmeta['thumb'] = $_POST['thumb'];
wp_update_attachment_metadata( $post_id, $newmeta );
if ( '' !== $oldmeta )
update_post_meta($post_id, '_wp_attachment_metadata', $newmeta, $oldmeta);
else
add_post_meta($post_id, '_wp_attachment_metadata', $newmeta);
case 'editpost':
$post_ID = (int) $_POST['post_ID'];
check_admin_referer('update-post_' . $post_ID);
$post_ID = edit_post();
if ( 'post' == $_POST['originalaction'] ) {
if (!empty($_POST['mode'])) {
switch($_POST['mode']) {
case 'bookmarklet':
$location = $_POST['referredby'];
break;
case 'sidebar':
$location = 'sidebar.php?a=b';
break;
default:
$location = 'post-new.php';
break;
}
} else {
$location = "post-new.php?posted=$post_ID";
}
if ( isset($_POST['save']) )
$location = "post.php?action=edit&post=$post_ID";
$referredby = '';
if ( !empty($_POST['referredby']) )
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ($_POST['save']) {
$location = wp_get_referer();
} elseif ($_POST['updatemeta']) {
$location = wp_get_referer() . '&message=2#postcustom';
} elseif ($_POST['deletemeta']) {
$location = wp_get_referer() . '&message=3#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $post_ID );
} elseif ($action == 'editattachment') {
$location = 'attachments.php';
} else {
$referredby = '';
if ( !empty($_POST['referredby']) )
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ($_POST['save']) {
$location = "post.php?action=edit&post=$post_ID";
} elseif ($_POST['updatemeta']) {
$location = wp_get_referer() . '&message=2#postcustom';
} elseif ($_POST['deletemeta']) {
$location = wp_get_referer() . '&message=3#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $post_ID );
} elseif ($action == 'editattachment') {
$location = 'attachments.php';
} else {
$location = 'post-new.php';
}
$location = 'post.php';
}
wp_redirect($location); // Send user on their way while we keep working
@@ -141,30 +141,297 @@ case 'delete':
check_admin_referer('delete-post_' . $post_id);
$post = & get_post($post_id);
if ( !current_user_can('edit_post', $post_id) )
die( __('You are not allowed to delete this post.') );
if ( !current_user_can('delete_post', $post_id) )
wp_die( __('You are not allowed to delete this post.') );
if ( $post->post_type == 'attachment' ) {
if ( $post->post_status == 'attachment' ) {
if ( ! wp_delete_attachment($post_id) )
wp_die( __('Error in deleting...') );
die( __('Error in deleting...') );
} else {
if ( !wp_delete_post($post_id) )
wp_die( __('Error in deleting...') );
die( __('Error in deleting...') );
}
$sendback = wp_get_referer();
if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php';
elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php';
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
break;
case 'editcomment':
$title = __('Edit Comment');
$parent_file = 'edit.php';
require_once ('admin-header.php');
get_currentuserinfo();
$comment = (int) $_GET['comment'];
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') );
$comment = get_comment_to_edit($comment);
include('edit-form-comment.php');
break;
case 'confirmdeletecomment':
require_once('./admin-header.php');
$comment = (int) $_GET['comment'];
$p = (int) $_GET['p'];
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to delete comments on this post.') );
echo "<div class='wrap'>\n";
echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
echo "<table border='0'>\n";
echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n";
echo "<tr><td>" . __('E-mail:') . "</td><td>$comment->comment_author_email</td></tr>\n";
echo "<tr><td>". __('URL:') . "</td><td>$comment->comment_author_url</td></tr>\n";
echo "<tr><td>". __('Comment:') . "</td><td>$comment->comment_content</td></tr>\n";
echo "</table>\n";
echo "<p>" . __('Are you sure you want to do that?') . "</p>\n";
echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n";
echo "<input type='hidden' name='action' value='deletecomment' />\n";
echo "<input type='hidden' name='p' value='$p' />\n";
echo "<input type='hidden' name='comment' value='{$comment->comment_ID}' />\n";
echo "<input type='hidden' name='noredir' value='1' />\n";
wp_nonce_field('delete-comment_' . $comment->comment_ID);
echo "<input type='submit' value='" . __('Yes') . "' />";
echo "&nbsp;&nbsp;";
echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&amp;c=1#comments';\" />\n";
echo "</form>\n";
echo "</div>\n";
break;
case 'deletecomment':
$comment = (int) $_GET['comment'];
check_admin_referer('delete-comment_' . $comment);
$p = (int) $_GET['p'];
if (isset($_GET['noredir'])) {
$noredir = true;
} else {
$noredir = false;
}
$postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') );
wp_set_comment_status($comment->comment_ID, "delete");
do_action('delete_comment', $comment->comment_ID);
if ((wp_get_referer() != "") && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
}
break;
case 'unapprovecomment':
$comment = (int) $_GET['comment'];
check_admin_referer('unapprove-comment_' . $comment);
$p = (int) $_GET['p'];
if (isset($_GET['noredir'])) {
$noredir = true;
} else {
$noredir = false;
}
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
wp_set_comment_status($comment->comment_ID, "hold");
if ((wp_get_referer() != "") && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
}
break;
case 'mailapprovecomment':
$comment = (int) $_GET['comment'];
check_admin_referer('approve-comment_' . $comment);
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
if ('1' != $comment->comment_approved) {
wp_set_comment_status($comment->comment_ID, 'approve');
if (true == get_option('comments_notify'))
wp_notify_postauthor($comment->comment_ID);
}
wp_redirect(get_option('siteurl') . '/wp-admin/moderation.php?approved=1');
break;
case 'approvecomment':
$comment = (int) $_GET['comment'];
check_admin_referer('approve-comment_' . $comment);
$p = (int) $_GET['p'];
if (isset($_GET['noredir'])) {
$noredir = true;
} else {
$noredir = false;
}
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
wp_set_comment_status($comment->comment_ID, "approve");
if (get_settings("comments_notify") == true) {
wp_notify_postauthor($comment->comment_ID);
}
if ((wp_get_referer() != "") && (false == $noredir)) {
wp_redirect(wp_get_referer());
} else {
wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
}
break;
case 'editedcomment':
$comment_ID = (int) $_POST['comment_ID'];
$comment_post_ID = (int) $_POST['comment_post_ID'];
check_admin_referer('update-comment_' . $comment_ID);
edit_comment();
$location = ( empty($_POST['referredby']) ? "edit.php?p=$comment_post_ID&c=1" : $_POST['referredby'] ) . '#comment-' . $comment_ID;
$location = apply_filters('comment_edit_redirect', $location, $comment_ID);
wp_redirect($location);
exit();
break;
default:
wp_redirect('edit.php');
exit();
$title = __('Create New Post');
require_once ('./admin-header.php');
?>
<?php if ( isset($_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>
<?php endif; ?>
<?php
if ( current_user_can('edit_posts') ) {
$action = 'post';
get_currentuserinfo();
if ( $drafts = get_users_drafts( $user_ID ) ) {
?>
<div class="wrap">
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
$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 ', ';
$draft->post_title = stripslashes($draft->post_title);
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>";
}
?>
<?php if ( 15 < count($drafts) ) { ?>
, <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> &raquo;</a>
<?php } ?>
.</p>
</div>
<?php
}
$post = get_default_post_to_edit();
include('edit-form-advanced.php');
?>
<div id="wp-bookmarklet" class="wrap">
<?php echo '<h3>'.__('WordPress bookmarklet').'</h3>
<p>'.__('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_settings('siteurl') ?>/wp-admin/post.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_settings('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_settings('siteurl') ?>/wp-admin/post.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
<script type="text/javascript">
<!--
function oneclickbookmarklet(blah) {
window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
}
// -->
</script>
<br />
<br />
<?php _e('One-click bookmarklet:') ?><br />
<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
<?php
} else if ($is_opera) {
?>
<a href="javascript:location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/post.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
<?php
} else if ($is_macIE) {
?>
<a href="javascript:Q='';location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
<?php
}
?>
</p>
</div>
<?php
} else {
?>
<div class="wrap">
<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_settings('admin_email')); ?>
</p>
</div>
<?php
}
break;
} // end switch
/* </Edit> */
include('admin-footer.php');
?>

View File

@@ -1,22 +1,25 @@
<?php
$parent_file = 'profile.php';
$submenu_file = 'profile.php';
require_once('admin.php');
check_admin_referer('update-profile_' . $user_ID);
if ( !$_POST )
wp_die( __('No post?') );
die( __('No post?') );
$errors = edit_user($user_ID);
if ( is_wp_error( $errors ) ) {
foreach( $errors->get_error_messages() as $message )
echo "$message<br />";
if (count($errors) != 0) {
foreach ($errors as $id => $error) {
echo $error . '<br/>';
}
exit;
}
if ( !isset( $_POST['rich_editing'] ) )
$_POST['rich_editing'] = 'false';
update_user_option( $current_user->id, 'rich_editing', $_POST['rich_editing'], true );
do_action('personal_options_update');
if ( 'profile' == $_POST['from'] )
@@ -27,4 +30,4 @@ else
wp_redirect( $to );
exit;
?>
?>

View File

@@ -1,12 +1,9 @@
<?php
<?php
require_once('admin.php');
$title = __('Profile');
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
$parent_file = 'profile.php';
include_once('admin-header.php');
$profileuser = get_user_to_edit($user_ID);
@@ -28,17 +25,6 @@ $bookmarklet_height= 440;
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
</p>
<h3><?php _e('Personal Options'); ?></h3>
<?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
<p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />
<?php _e('Use the visual editor when writing') ?></label></p>
<?php endif; ?>
<?php do_action('profile_personal_options'); ?>
<p class="submit"><input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" /></p>
<fieldset>
<legend><?php _e('Name'); ?></legend>
<p><label><?php _e('Username: (no editing)'); ?><br />
@@ -90,14 +76,14 @@ $bookmarklet_height= 440;
<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
</label></p>
<p><label><?php _e('Jabber / Google Talk:') ?><br />
<p><label><?php _e('Jabber / Google Talk:') ?>
<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
</p>
</fieldset>
<br clear="all" />
<fieldset>
<legend><?php _e('About Yourself'); ?></legend>
<p class="desc"><?php _e('Share a little biographical information. '); ?></p>
<legend><?php _e('About yourself'); ?></legend>
<p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
</fieldset>
@@ -121,13 +107,20 @@ if ( $show_password_fields ) :
<br clear="all" />
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php
if(count($profileuser->caps) > count($profileuser->roles)):
?>
<tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php
<h3><?php _e('Personal Options'); ?></h3>
<p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />
<?php _e('Use the visual rich editor when writing') ?></label></p>
<?php do_action('profile_personal_options'); ?>
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php
if(count($profileuser->caps) > count($profileuser->roles)):
?>
<tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php
$output = '';
foreach($profileuser->caps as $cap => $value) {
if(!$wp_roles->is_role($cap)) {
@@ -142,7 +135,9 @@ if ( $show_password_fields ) :
endif;
?>
</table>
<p class="submit"><input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" /></p>
<p class="submit">
<input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" />
</p>
</form>
</div>

View File

@@ -1,247 +0,0 @@
#viewarc, #viewcat, #namediv, #emaildiv, #uridiv, #planetnews li, #login ul li, #your-profile fieldset, #footer .logo, .alignleft .available-theme {
float: right;
}
#templateside, .alignright {
float: left;
}
#login #send, .readmore, .widefat th {
text-align: right;
}
#postcustomsubmit, form#upload th, .submit, .editform th {
text-align: left;
}
#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;
}
#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;
}
#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;
}
#currenttheme img {
float: right;
margin-right: auto;
margin-left: 1em;
}
#postdiv #quicktags {
padding-right: 0;
padding-left: 6px;
}
.readmore {
margin-right: auto;
margin-left: 5em;
}
#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;
}
#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;
}
#ajax-response.alignleft {
margin-left: auto;
margin-right: 2em;
}
#postdivrich #edButtons {
padding-left: 0;
padding-right: 3px;
}
.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

@@ -2,7 +2,7 @@
define('WP_INSTALLING', true);
if (!file_exists('../wp-config-sample.php'))
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');
@@ -82,103 +82,103 @@ if (file_exists('../wp-config.php'))
switch($step) {
case 0:
?>
?>
<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>
<ol>
<li>Database name</li>
<li>Database username</li>
<li>Database password</li>
<li>Database host</li>
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
</ol>
<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>
<ol>
<li>Database name</li>
<li>Database username</li>
<li>Database password</li>
<li>Database host</li>
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
</ol>
<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready, <a href="setup-config.php?step=1">let&#8217;s go</a>! </p>
<?php
break;
case 1:
?>
</p>
?>
</p>
<form method="post" action="setup-config.php?step=2">
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
<table>
<tr>
<th scope="row">Database Name</th>
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td>
</tr>
<tr>
<th scope="row">User Name</th>
<td><input name="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td>
</tr>
<tr>
<th scope="row">Password</th>
<td><input name="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td>
</tr>
<tr>
<th scope="row">Database Host</th>
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td>
</tr>
<tr>
<th scope="row">Table Prefix</th>
<td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
<td>If you want to run multiple WordPress installations in a single database, change this.</td>
</tr>
</table>
<h2 class="step">
<input name="submit" type="submit" value="Submit" />
</h2>
</form>
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
<table>
<tr>
<th scope="row">Database Name</th>
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td>
</tr>
<tr>
<th scope="row">User Name</th>
<td><input name="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td>
</tr>
<tr>
<th scope="row">Password</th>
<td><input name="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td>
</tr>
<tr>
<th scope="row">Database Host</th>
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td>
</tr>
<tr>
<th scope="row">Table Prefix</th>
<td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
<td>If you want to run multiple WordPress installations in a single database, change this.</td>
</tr>
</table>
<h2 class="step">
<input name="submit" type="submit" value="Submit" />
</h2>
</form>
<?php
break;
case 2:
$dbname = trim($_POST['dbname']);
$uname = trim($_POST['uname']);
$passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']);
$uname = trim($_POST['uname']);
$passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']);
$prefix = trim($_POST['prefix']);
if (empty($prefix)) $prefix = 'wp_';
// Test the db connection.
define('DB_NAME', $dbname);
define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost);
// Test the db connection.
define('DB_NAME', $dbname);
define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost);
// We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php');
// We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php');
$handle = fopen('../wp-config.php', 'w');
foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) {
case "define('DB_NAME'":
fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line));
break;
case "define('DB_USER'":
fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line));
break;
case "define('DB_PASSW":
fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line));
break;
case "define('DB_HOST'":
fwrite($handle, str_replace("localhost", $dbhost, $line));
break;
foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) {
case "define('DB_NAME'":
fwrite($handle, str_replace("wordpress", $dbname, $line));
break;
case "define('DB_USER'":
fwrite($handle, str_replace("'username'", "'$uname'", $line));
break;
case "define('DB_PASSW":
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
break;
case "define('DB_HOST'":
fwrite($handle, str_replace("localhost", $dbhost, $line));
break;
case '$table_prefix =':
fwrite($handle, str_replace('wp_', $prefix, $line));
break;
default:
fwrite($handle, $line);
}
}
fclose($handle);
default:
fwrite($handle, $line);
}
}
fclose($handle);
chmod('../wp-config.php', 0666);
?>
<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>
?>
<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
break;
}

View File

@@ -4,7 +4,7 @@ $mode = 'sidebar';
require_once('admin.php');
if ( ! current_user_can('edit_posts') )
wp_die(__('Cheatin&#8217; uh?'));
die ("Cheatin' uh ?");
if ('b' == $_GET['a']) {
@@ -34,15 +34,15 @@ form {
padding: 3px;
}
.sidebar-categories {
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
}
.sidebar-categories label {
font-size: 10px;
display: block;
width: 90%;
display: block;
width: 90%;
}
</style>
</head>
@@ -65,9 +65,9 @@ Post:
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
</p>
<p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
<?php endif; ?>
</p>
</div>

View File

@@ -3,7 +3,21 @@ require_once('admin.php');
$title = __('Template &amp; File Editing');
$parent_file = 'edit.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$recents = get_option('recently_edited');
@@ -25,7 +39,7 @@ case 'update':
check_admin_referer('edit-file_' . $file);
if ( ! current_user_can('edit_files') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
@@ -48,19 +62,18 @@ break;
default:
require_once('./admin-header.php');
if ( ! current_user_can('edit_files') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
if (strpos($file, 'wp-config.php') !== false)
wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
if ( strstr( $file, 'wp-config.php' ) )
die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
update_recently_edited($file);
if (!is_file($real_file))
if ( !is_file($real_file) ) {
$error = true;
if (!$error) {
} else {
$f = @ fopen($real_file, 'r');
if ( $f ) {
if ( filesize($real_file ) > 0 ) {
@@ -80,9 +93,9 @@ default:
<div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
<?php else: ?>
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<div class="wrap">
<div class="wrap">
<?php
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>';
@@ -91,8 +104,8 @@ if (is_writeable($real_file)) {
}
?>
<div id="templateside">
<?php
if ( $recents ) :
<?php
if ( $recents ) :
?>
<h3><?php _e('Recent'); ?></h3>
<?php
@@ -110,30 +123,30 @@ endif;
if (file_exists(ABSPATH . $old_file))
$common_files[] = $old_file;
} ?>
<ul>
<?php foreach ($common_files as $common_file) : ?>
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
<?php endforeach; ?>
</ul>
<ul>
<?php foreach ($common_files as $common_file) : ?>
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php if (!$error) { ?>
<form name="template" id="template" action="templates.php" method="post">
<?php wp_nonce_field('edit-file_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
</div>
<form name="template" id="template" action="templates.php" method="post">
<?php wp_nonce_field('edit-file_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<p class="submit">
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
echo "<input type='submit' name='submit' value=' " . __('Update File') . " &raquo;' tabindex='2' />";
?>
</p>
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}
@@ -143,14 +156,14 @@ endif;
<div class="wrap">
<h2><?php _e('Other Files') ?></h2>
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
<form name="file" action="templates.php" method="get">
<input type="text" name="file" />
<input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" />
</form>
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
<form name="file" action="templates.php" method="get">
<input type="text" name="file" />
<input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" />
</form>
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
</div>
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
</div>
<?php
break;

View File

@@ -4,7 +4,21 @@ require_once('admin.php');
$title = __("Edit Themes");
$parent_file = 'themes.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$themes = get_themes();
@@ -16,7 +30,7 @@ if (empty($theme)) {
if ( ! isset($themes[$theme]) )
wp_die(__('The requested theme does not exist.'));
die(__('The requested theme does not exist.'));
$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
@@ -36,7 +50,7 @@ case 'update':
check_admin_referer('edit-theme_' . $file . $theme);
if ( !current_user_can('edit_themes') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
$newcontent = stripslashes($_POST['newcontent']);
$theme = urlencode($theme);
@@ -58,17 +72,16 @@ case 'update':
break;
default:
if ( !current_user_can('edit_themes') )
wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
require_once('admin-header.php');
if ( !current_user_can('edit_themes') )
die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
update_recently_edited($file);
if (!is_file($real_file))
$error = 1;
if (!$error && filesize($real_file) > 0) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
@@ -80,7 +93,7 @@ default:
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
<div class="wrap">
<form name="theme" action="theme-editor.php" method="post">
<form name="theme" action="theme-editor.php" method="post">
<?php _e('Select theme to edit:') ?>
<select name="theme" id="theme">
<?php
@@ -93,7 +106,7 @@ default:
}
?>
</select>
<input type="submit" name="Submit" value="<?php _e('Select &raquo;') ?>" class="button" />
<input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
</form>
</div>
@@ -106,47 +119,47 @@ default:
}
?>
<div id="templateside">
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
<?php
if ($allowed_files) :
?>
<ul>
<ul>
<?php foreach($allowed_files as $allowed_file) : ?>
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
<?php endforeach; ?>
</ul>
</ul>
<?php endif; ?>
</div>
</div>
<?php
if (!$error) {
?>
<form name="template" id="template" action="theme-editor.php" method="post">
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
?>
<form name="template" id="template" action="theme-editor.php" method="post">
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<p class="submit">
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
echo "<input type='submit' name='submit' value=' " . __('Update File') . " &raquo;' tabindex='2' />";
?>
</p>
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}
?>
<div class="clear"> &nbsp; </div>
</div>
</div>
<?php
break;
}
include("admin-footer.php") ?>
include("admin-footer.php") ?>

View File

@@ -3,16 +3,16 @@ require_once('admin.php');
if ( isset($_GET['action']) ) {
check_admin_referer('switch-theme_' . $_GET['template']);
if ('activate' == $_GET['action']) {
if ( isset($_GET['template']) )
update_option('template', $_GET['template']);
if ( isset($_GET['stylesheet']) )
update_option('stylesheet', $_GET['stylesheet']);
do_action('switch_theme', get_current_theme());
wp_redirect('themes.php?activated=true');
exit;
}
@@ -26,7 +26,7 @@ require_once('admin-header.php');
<?php if ( ! validate_current_theme() ) : ?>
<div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
<?php elseif ( isset($_GET['activated']) ) : ?>
<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('url') . '/'); ?></p></div>
<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div>
<?php endif; ?>
<?php
@@ -102,7 +102,7 @@ if ( count($broken_themes) ) {
</tr>
<?php
$theme = '';
$theme_names = array_keys($broken_themes);
natcasesort($theme_names);
@@ -112,10 +112,10 @@ if ( count($broken_themes) ) {
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
echo "
<tr $theme>
<td>$title</td>
<td>$description</td>
</tr>";
<tr $theme>
<td>$title</td>
<td>$description</td>
</tr>";
}
?>
</table>

View File

@@ -3,12 +3,12 @@ require_once( dirname( dirname(__FILE__) ) . '/wp-config.php');
require_once( ABSPATH . 'wp-includes/class-snoopy.php');
if ( !get_option('use_linksupdate') )
wp_die(__('Feature disabled.'));
die(__('Feature disabled.'));
$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
if ( !$link_uris )
wp_die(__('No links'));
die('No links');
$link_uris = urlencode( join( $link_uris, "\n" ) );
@@ -16,7 +16,7 @@ $query_string = "uris=$link_uris";
$http_request = "POST /updated-batch/ HTTP/1.0\r\n";
$http_request .= "Host: api.pingomatic.com\r\n";
$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n";
$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_settings('blog_charset')."\r\n";
$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
$http_request .= 'User-Agent: WordPress/' . $wp_version . "\r\n";
$http_request .= "\r\n";
@@ -28,13 +28,13 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
$body = trim( $response[1] );
$body = str_replace(array("\r\n", "\r"), "\n", $body);
$returns = explode("\n", $body);
foreach ($returns as $return) :
$time = $wpdb->escape( substr($return, 0, 19) );
$uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );

View File

@@ -1,153 +1,7 @@
<?php
if ( file_exists(ABSPATH . 'wp-content/install.php') )
require (ABSPATH . 'wp-content/install.php');
require_once(ABSPATH . '/wp-admin/admin-functions.php');
require_once(ABSPATH . '/wp-admin/admin-db.php');
require_once(ABSPATH . '/wp-admin/upgrade-schema.php');
require_once(ABSPATH . WPINC . '/registration.php');
if ( !function_exists('wp_install') ) :
function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
global $wp_rewrite;
wp_check_mysql_version();
wp_cache_flush();
make_db_current_silent();
populate_options();
populate_roles();
update_option('blogname', $blog_title);
update_option('admin_email', $user_email);
update_option('blog_public', $public);
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
if ( defined('WP_SITEURL') && '' != WP_SITEURL )
$guessurl = WP_SITEURL;
else
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
update_option('siteurl', $guessurl);
// If not a public blog, don't ping.
if ( ! $public )
update_option('default_pingback_flag', 0);
// Create default user. If the user already exists, the user tables are
// being shared among blogs. Just set the role in that case.
$user_id = username_exists($user_name);
if ( !$user_id ) {
$random_password = substr(md5(uniqid(microtime())), 0, 6);
$user_id = wp_create_user($user_name, $random_password, $user_email);
} else {
$random_password = __('User already exists. Password inherited.');
}
$user = new WP_User($user_id);
$user->set_role('administrator');
wp_install_defaults($user_id);
$wp_rewrite->flush_rules();
wp_new_blog_notification($blog_title, $guessurl, $user_id, $random_password);
wp_cache_flush();
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password);
}
endif;
if ( !function_exists('wp_install_defaults') ) :
function wp_install_defaults($user_id) {
global $wpdb;
// Default category
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')");
// Default link category
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, link_count, category_description) VALUES ('0', '".$wpdb->escape(__('Blogroll'))."', '".sanitize_title(__('Blogroll'))."', '7', '')");
// Now drop in some default links
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://inphotos.org/', 'Donncha', 0, 'http://inphotos.org/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (1, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 0, 'http://zengun.org/weblog/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (2, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 0, 'http://boren.nu/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (3, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 0, 'http://xml.photomatt.net/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (4, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 0, 'http://zed1.com/journalized/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (5, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 0, 'http://www.alexking.org/blog/wp-rss2.php', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (6, 2)" );
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 0, 'http://dougal.gunters.org/feed/', '');");
$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (7, 2)" );
// First post
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");
$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
// Default comment
$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
// First Page
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')");
}
endif;
if ( !function_exists('wp_new_blog_notification') ) :
function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
$user = new WP_User($user_id);
$email = $user->user_email;
$name = $user->user_login;
$message_headers = 'From: "' . $blog_title . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
$message = sprintf(__("Your new WordPress blog has been successfully set up at:
%1\$s
You can log in to the administrator account with the following information:
Username: %2\$s
Password: %3\$s
We hope you enjoy your new weblog. Thanks!
--The WordPress Team
http://wordpress.org/
"), $blog_url, $name, $password);
@wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
}
endif;
if ( !function_exists('wp_upgrade') ) :
function wp_upgrade() {
global $wp_current_db_version, $wp_db_version;
$wp_current_db_version = __get_option('db_version');
// We are up-to-date. Nothing to do.
if ( $wp_db_version == $wp_current_db_version )
return;
wp_check_mysql_version();
wp_cache_flush();
make_db_current_silent();
upgrade_all();
wp_cache_flush();
}
endif;
// Functions to be called in install and upgrade scripts
function upgrade_all() {
global $wp_current_db_version, $wp_db_version, $wp_rewrite;
@@ -166,7 +20,7 @@ function upgrade_all() {
if ( !empty($template) )
$wp_current_db_version = 2541;
}
populate_options();
if ( $wp_current_db_version < 2541 ) {
@@ -176,19 +30,11 @@ function upgrade_all() {
upgrade_130();
}
maybe_disable_automattic_widgets();
if ( $wp_current_db_version < 3308 )
upgrade_160();
if ( $wp_current_db_version < 4772 )
upgrade_210();
if ( $wp_current_db_version < 4351 )
upgrade_old_slugs();
$wp_rewrite->flush_rules();
update_option('db_version', $wp_db_version);
}
@@ -199,16 +45,16 @@ function upgrade_100() {
$posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
if ($posts) {
foreach($posts as $post) {
if ('' == $post->post_name) {
if ('' == $post->post_name) {
$newtitle = sanitize_title($post->post_title);
$wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
}
}
}
$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
foreach ($categories as $category) {
if ('' == $category->category_nicename) {
if ('' == $category->category_nicename) {
$newtitle = sanitize_title($category->cat_name);
$wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
}
@@ -228,7 +74,7 @@ function upgrade_100() {
else:
$catwhere = '';
endif;
$allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
if ($allposts) :
foreach ($allposts as $post) {
@@ -262,20 +108,20 @@ function upgrade_101() {
function upgrade_110() {
global $wpdb;
// Set user_nicename.
// Set user_nicename.
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
foreach ($users as $user) {
if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname);
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
}
}
foreach ($users as $user) {
if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname);
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
}
}
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
foreach ($users as $row) {
if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
}
}
@@ -317,63 +163,63 @@ function upgrade_110() {
}
function upgrade_130() {
global $wpdb;
global $wpdb, $table_prefix;
// Remove extraneous backslashes.
// Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
if ($posts) {
foreach($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
if ( empty($post->guid) )
$guid = get_permalink($post->ID);
else
$guid = $post->guid;
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
}
}
// Remove extraneous backslashes.
// Remove extraneous backslashes.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
if ($comments) {
foreach($comments as $comment) {
$comment_content = addslashes(deslash($comment->comment_content));
$comment_author = addslashes(deslash($comment->comment_author));
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
$comment_content = addslashes(deslash($comment->comment_content));
$comment_author = addslashes(deslash($comment->comment_author));
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
}
}
// Remove extraneous backslashes.
// Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
if ($links) {
foreach($links as $link) {
$link_name = addslashes(deslash($link->link_name));
$link_description = addslashes(deslash($link->link_description));
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
$link_name = addslashes(deslash($link->link_name));
$link_description = addslashes(deslash($link->link_description));
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
}
}
// The "paged" option for what_to_show is no more.
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
}
// The "paged" option for what_to_show is no more.
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
}
$active_plugins = __get_option('active_plugins');
$active_plugins = __get_option('active_plugins');
// If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options');
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroups');
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroup_options');
// Update comments table to use comment_type
$wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
@@ -394,7 +240,7 @@ function upgrade_130() {
}
function upgrade_160() {
global $wpdb, $wp_current_db_version;
global $wpdb, $table_prefix, $wp_current_db_version;
populate_roles_160();
@@ -407,7 +253,7 @@ function upgrade_160() {
if ( !empty( $user->user_nickname ) )
update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
if ( !empty( $user->user_level ) )
update_usermeta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
update_usermeta( $user->ID, $table_prefix . 'user_level', $user->user_level );
if ( !empty( $user->user_icq ) )
update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
if ( !empty( $user->user_aim ) )
@@ -431,22 +277,22 @@ function upgrade_160() {
$id = $wpdb->escape( $id );
$wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
endif;
// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
$caps = get_usermeta( $user->ID, $wpdb->prefix . 'capabilities');
$caps = get_usermeta( $user->ID, $table_prefix . 'capabilities');
if ( empty($caps) || defined('RESET_CAPS') ) {
$level = get_usermeta($user->ID, $wpdb->prefix . 'user_level');
$level = get_usermeta($user->ID, $table_prefix . 'user_level');
$role = translate_level_to_role($level);
update_usermeta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
}
endforeach;
$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
$wpdb->hide_errors();
foreach ( $old_user_fields as $old )
$wpdb->query("ALTER TABLE $wpdb->users DROP $old");
$wpdb->show_errors();
if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts
$categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
foreach ( $categories as $cat_id ) {
@@ -472,127 +318,33 @@ function upgrade_160() {
post_mime_type = '$object->post_type',
post_type = ''
WHERE ID = $object->ID");
$meta = get_post_meta($object->ID, 'imagedata', true);
if ( ! empty($meta['file']) )
update_attached_file( $object->ID, $meta['file'] );
add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
}
}
}
function upgrade_210() {
global $wpdb, $wp_current_db_version;
if ( $wp_current_db_version < 3506 ) {
// Update status and type.
$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
if ( ! empty($posts) ) foreach ($posts as $post) {
$status = $post->post_status;
$type = 'post';
if ( 'static' == $status ) {
$status = 'publish';
$type = 'page';
} else if ( 'attachment' == $status ) {
$status = 'inherit';
$type = 'attachment';
}
$wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
}
}
if ( $wp_current_db_version < 3845 ) {
populate_roles_210();
}
if ( $wp_current_db_version < 3531 ) {
// Give future posts a post_status of future.
$now = gmdate('Y-m-d H:i:59');
$wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
if ( !empty($posts) )
foreach ( $posts as $post )
wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID));
}
if ( $wp_current_db_version < 3570 ) {
// Create categories for link categories if a category with the same
// name doesn't exist. Create a map of link cat IDs to cat IDs.
$link_cat_id_map = array();
$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories');
foreach ( $link_cats as $link_cat) {
if ( $cat_id = category_exists($link_cat->cat_name) ) {
$link_cat_id_map[$link_cat->cat_id] = $cat_id;
$default_link_cat = $cat_id;
} else {
$link_cat_id_map[$link_cat->cat_id] = wp_create_category($link_cat->cat_name);
$default_link_cat = $link_cat_id_map[$link_cat->cat_id];
}
}
// Associate links to cats.
$links = $wpdb->get_results("SELECT link_id, link_category FROM $wpdb->links");
if ( !empty($links) ) foreach ( $links as $link ) {
if ( 0 == $link->link_category )
continue;
if ( ! isset($link_cat_id_map[$link->link_category]) )
continue;
$link_cat = $link_cat_id_map[$link->link_category];
$cat = $wpdb->get_row("SELECT * FROM $wpdb->link2cat WHERE link_id = '$link->link_id' AND category_id = '$link_cat'");
if ( !$cat ) {
$wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ('$link->link_id', '$link_cat')");
}
}
// Set default to the last category we grabbed during the upgrade loop.
update_option('default_link_category', $default_link_cat);
// Count links per category.
if ( 0 == $wpdb->get_var("SELECT SUM(link_count) FROM $wpdb->categories") ) {
$categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
foreach ( $categories 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'");
}
}
}
if ( $wp_current_db_version < 4772 ) {
// Obsolete linkcategories table
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories');
}
}
function upgrade_old_slugs() {
// upgrade people who were using the Redirect Old Slugs plugin
global $wpdb;
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
}
// The functions we use to actually do stuff
// General
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
}
function drop_index($table, $index) {
@@ -621,22 +373,22 @@ function add_clean_index($table, $index) {
** false on error
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
}
@@ -645,7 +397,7 @@ function get_alloptions_110() {
global $wpdb;
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
foreach ($options as $option) {
// "When trying to design a foolproof system,
// "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)" -- Dougal
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
@@ -659,15 +411,7 @@ function get_alloptions_110() {
// Version of get_option that is private to install/upgrade.
function __get_option($setting) {
global $wpdb;
if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
}
if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
}
$option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
if ( 'home' == $setting && '' == $option )
@@ -684,35 +428,35 @@ function __get_option($setting) {
}
function deslash($content) {
// Note: \\\ inside a regex denotes a single backslash.
// Note: \\\ inside a regex denotes a single backslash.
// Replace one or more backslashes followed by a single quote with
// a single quote.
$content = preg_replace("/\\\+'/", "'", $content);
// Replace one or more backslashes followed by a single quote with
// a single quote.
$content = preg_replace("/\\\+'/", "'", $content);
// Replace one or more backslashes followed by a double quote with
// a double quote.
$content = preg_replace('/\\\+"/', '"', $content);
// Replace one or more backslashes followed by a double quote with
// a double quote.
$content = preg_replace('/\\\+"/', '"', $content);
// Replace one or more backslashes with one backslash.
$content = preg_replace("/\\\+/", "\\", $content);
// Replace one or more backslashes with one backslash.
$content = preg_replace("/\\\+/", "\\", $content);
return $content;
return $content;
}
function dbDelta($queries, $execute = true) {
global $wpdb;
// Seperate individual queries into an array
if( !is_array($queries) ) {
$queries = explode( ';', $queries );
if('' == $queries[count($queries) - 1]) array_pop($queries);
}
$cqueries = array(); // Creation Queries
$iqueries = array(); // Insertion Queries
$for_update = array();
// Create a tablename index for an array ($cqueries) of queries
foreach($queries as $qry) {
if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
@@ -731,7 +475,7 @@ function dbDelta($queries, $execute = true) {
else {
// Unrecognized query type
}
}
}
// Check to see which tables and fields exist
if($tables = $wpdb->get_col('SHOW TABLES;')) {
@@ -750,13 +494,13 @@ function dbDelta($queries, $execute = true) {
$flds = explode("\n", $qryline);
//echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
// For every field line specified in the query
foreach($flds as $fld) {
// Extract the field name
preg_match("|^([^ ]*)|", trim($fld), $fvals);
$fieldname = $fvals[1];
// Verify the found field name
$validfield = true;
switch(strtolower($fieldname))
@@ -772,18 +516,18 @@ function dbDelta($queries, $execute = true) {
break;
}
$fld = trim($fld);
// If it's a valid field, add it to the field array
if($validfield) {
$cfields[strtolower($fieldname)] = trim($fld, ", \n");
}
}
// Fetch the table column structure from the database
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
// For every field in the table
foreach($tablefields as $tablefield) {
foreach($tablefields as $tablefield) {
// If the table field exists in the field array...
if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
// Get the field type from the query
@@ -796,7 +540,7 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
$for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
}
// Get the default value from the array
//echo "{$cfields[strtolower($tablefield->Field)]}<br>";
if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
@@ -823,11 +567,11 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
$for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
}
// Index stuff goes here
// Fetch the table index structure from the database
$tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
if($tableindices) {
// Clear the index array
unset($index_ary);
@@ -856,7 +600,7 @@ function dbDelta($queries, $execute = true) {
}
$index_columns = '';
// For each column in the index
foreach($index_data['columns'] as $column_data) {
foreach($index_data['columns'] as $column_data) {
if($index_columns != '') $index_columns .= ',';
// Add the field to the column list string
$index_columns .= $column_data['fieldname'];
@@ -864,7 +608,7 @@ function dbDelta($queries, $execute = true) {
$index_columns .= '('.$column_data['subpart'].')';
}
}
// Add the column list to the index create string
// Add the column list to the index create string
$index_string .= ' ('.$index_columns.')';
if(!(($aindex = array_search($index_string, $indices)) === false)) {
@@ -937,7 +681,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
if ($oldfile == 'index.php') { // Check to make sure it's not a new index
$index = implode('', file("$oldpath/$oldfile"));
if (strpos($index, 'WP_USE_THEMES') !== false) {
if ( strstr( $index, 'WP_USE_THEMES' ) ) {
if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
return false;
continue; // Don't copy anything
@@ -1009,12 +753,12 @@ function make_site_theme_from_default($theme_name, $template) {
$f = fopen("$site_dir/style.css", 'w');
foreach ($stylelines as $line) {
if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
fwrite($f, $line . "\n");
if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
elseif (strstr($line, "Description:")) $line = "Description: Your theme";
elseif (strstr($line, "Version:")) $line = "Version: 1";
elseif (strstr($line, "Author:")) $line = "Author: You";
fwrite($f, "{$line}\n");
}
fclose($f);
}
@@ -1100,25 +844,4 @@ function translate_level_to_role($level) {
}
}
function wp_check_mysql_version() {
global $wp_version;
// Make sure the server has MySQL 4.0
$mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
if ( version_compare($mysql_version, '4.0.0', '<') )
die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
}
function maybe_disable_automattic_widgets() {
$plugins = __get_option( 'active_plugins' );
foreach ( (array) $plugins as $plugin ) {
if ( basename( $plugin ) == 'widgets.php' ) {
array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
update_option( 'active_plugins', $plugins );
break;
}
}
}
?>
?>

View File

@@ -1,15 +1,6 @@
<?php
// Here we keep the DB structure and option values
$charset_collate = '';
if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
$charset_collate .= " COLLATE $wpdb->collate";
}
$wp_queries="CREATE TABLE $wpdb->categories (
cat_ID bigint(20) NOT NULL auto_increment,
cat_name varchar(55) NOT NULL default '',
@@ -17,12 +8,9 @@ $wp_queries="CREATE TABLE $wpdb->categories (
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,
comment_post_ID int(11) NOT NULL default '0',
@@ -42,14 +30,23 @@ CREATE TABLE $wpdb->comments (
PRIMARY KEY (comment_ID),
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->linkcategories (
cat_id bigint(20) NOT NULL auto_increment,
cat_name tinytext NOT NULL,
auto_toggle enum('Y','N') NOT NULL default 'N',
show_images enum('Y','N') NOT NULL default 'Y',
show_description enum('Y','N') NOT NULL default 'N',
show_rating enum('Y','N') NOT NULL default 'Y',
show_updated enum('Y','N') NOT NULL default 'Y',
sort_order varchar(64) NOT NULL default 'rand',
sort_desc enum('Y','N') NOT NULL default 'N',
text_before_link varchar(128) NOT NULL default '<li>',
text_after_link varchar(128) NOT NULL default '<br />',
text_after_all varchar(128) NOT NULL default '</li>',
list_limit int(11) NOT NULL default '-1',
PRIMARY KEY (cat_id)
);
CREATE TABLE $wpdb->links (
link_id bigint(20) NOT NULL auto_increment,
link_url varchar(255) NOT NULL default '',
@@ -68,7 +65,7 @@ CREATE TABLE $wpdb->links (
PRIMARY KEY (link_id),
KEY link_category (link_category),
KEY link_visible (link_visible)
) $charset_collate;
);
CREATE TABLE $wpdb->options (
option_id bigint(20) NOT NULL auto_increment,
blog_id int(11) NOT NULL default '0',
@@ -83,14 +80,14 @@ CREATE TABLE $wpdb->options (
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',
@@ -99,7 +96,7 @@ CREATE TABLE $wpdb->postmeta (
PRIMARY KEY (meta_id),
KEY post_id (post_id),
KEY meta_key (meta_key)
) $charset_collate;
);
CREATE TABLE $wpdb->posts (
ID bigint(20) unsigned NOT NULL auto_increment,
post_author bigint(20) NOT NULL default '0',
@@ -109,7 +106,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') NOT NULL default 'publish',
post_status enum('publish','draft','private','static','object','attachment') 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 '',
@@ -122,13 +119,13 @@ CREATE TABLE $wpdb->posts (
post_parent bigint(20) NOT NULL default '0',
guid varchar(255) NOT NULL default '',
menu_order int(11) NOT NULL default '0',
post_type varchar(20) NOT NULL default 'post',
post_type varchar(100) NOT NULL default '',
post_mime_type varchar(100) NOT NULL default '',
comment_count bigint(20) NOT NULL default '0',
PRIMARY KEY (ID),
KEY post_name (post_name),
KEY type_status_date (post_type,post_status,post_date,ID)
) $charset_collate;
KEY post_status (post_status)
);
CREATE TABLE $wpdb->users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
@@ -142,7 +139,7 @@ CREATE TABLE $wpdb->users (
display_name varchar(250) NOT NULL default '',
PRIMARY KEY (ID),
KEY user_login_key (user_login)
) $charset_collate;
);
CREATE TABLE $wpdb->usermeta (
umeta_id bigint(20) NOT NULL auto_increment,
user_id bigint(20) NOT NULL default '0',
@@ -151,7 +148,7 @@ CREATE TABLE $wpdb->usermeta (
PRIMARY KEY (umeta_id),
KEY user_id (user_id),
KEY meta_key (meta_key)
) $charset_collate;";
);";
function populate_options() {
global $wpdb, $wp_db_version;
@@ -215,12 +212,14 @@ function populate_options() {
add_option('page_uris');
add_option('blacklist_keys');
add_option('comment_registration', 0);
add_option('open_proxy_check', 0);
add_option('rss_language', 'en');
add_option('html_type', 'text/html');
// 1.5.1
add_option('use_trackback', 0);
// 2.0
add_option('default_role', 'subscriber');
add_option('rich_editing', 'true');
add_option('db_version', $wp_db_version);
// 2.0.1
if ( ini_get('safe_mode') ) {
@@ -231,17 +230,12 @@ function populate_options() {
add_option('uploads_use_yearmonth_folders', 1);
add_option('upload_path', 'wp-content/uploads');
}
// 2.0.3
add_option('secret', md5(uniqid(microtime())));
// 2.1
add_option('blog_public', '1');
add_option('default_link_category', 2);
add_option('show_on_front', 'posts');
// 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');
$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');
foreach ($unusedoptions as $option) :
delete_option($option);
endforeach;
@@ -254,8 +248,7 @@ function populate_options() {
}
function populate_roles() {
populate_roles_160();
populate_roles_210();
populate_roles_160();
}
function populate_roles_160() {
@@ -267,7 +260,7 @@ function populate_roles_160() {
add_role('author', __('Author'));
add_role('contributor', __('Contributor'));
add_role('subscriber', __('Subscriber'));
// Add caps for Administrator role
$role = get_role('administrator');
$role->add_cap('switch_themes');
@@ -300,7 +293,7 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
// Add caps for Editor role
$role = get_role('editor');
$role->add_cap('moderate_comments');
@@ -322,7 +315,7 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
// Add caps for Author role
$role = get_role('author');
$role->add_cap('upload_files');
@@ -333,60 +326,18 @@ function populate_roles_160() {
$role->add_cap('level_2');
$role->add_cap('level_1');
$role->add_cap('level_0');
// Add caps for Contributor role
$role = get_role('contributor');
$role->add_cap('edit_posts');
$role->add_cap('read');
$role->add_cap('level_1');
$role->add_cap('level_0');
// Add caps for Subscriber role
$role = get_role('subscriber');
$role->add_cap('read');
$role->add_cap('level_0');
}
function populate_roles_210() {
$roles = array('administrator', 'editor');
foreach ($roles as $role) {
$role = get_role($role);
if ( empty($role) )
continue;
$role->add_cap('edit_others_pages');
$role->add_cap('edit_published_pages');
$role->add_cap('publish_pages');
$role->add_cap('delete_pages');
$role->add_cap('delete_others_pages');
$role->add_cap('delete_published_pages');
$role->add_cap('delete_posts');
$role->add_cap('delete_others_posts');
$role->add_cap('delete_published_posts');
$role->add_cap('delete_private_posts');
$role->add_cap('edit_private_posts');
$role->add_cap('read_private_posts');
$role->add_cap('delete_private_pages');
$role->add_cap('edit_private_pages');
$role->add_cap('read_private_pages');
}
$role = get_role('administrator');
if ( ! empty($role) ) {
$role->add_cap('delete_users');
$role->add_cap('create_users');
}
$role = get_role('author');
if ( ! empty($role) ) {
$role->add_cap('delete_posts');
$role->add_cap('delete_published_posts');
}
$role = get_role('contributor');
if ( ! empty($role) ) {
$role->add_cap('delete_posts');
}
}
?>
?>

View File

@@ -1,59 +1,95 @@
<?php
define('WP_INSTALLING', true);
if (!file_exists('../wp-config.php'))
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/Installing_WordPress#Step_3:_Set_up_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.");
if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
require('../wp-config.php');
timer_start();
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'));
$step = $_GET['step'];
if (!$step) $step = 0;
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" <?php language_attributes(); ?>>
<html xmlns="http://www.w3.org/1999/xhtml">
<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>
<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; ?>
<title>WordPress &rsaquo; Upgrade</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style media="screen" type="text/css">
<!--
html {
background: #eee;
}
body {
background: #fff;
color: #000;
font-family: Georgia, "Times New Roman", Times, serif;
margin-left: 20%;
margin-right: 20%;
padding: .2em 2em;
}
h1 {
color: #006;
font-size: 18px;
font-weight: lighter;
}
h2 {
font-size: 16px;
}
p, li, dt {
line-height: 140%;
padding-bottom: 2px;
}
ul, ol {
padding: 5px 5px 5px 20px;
}
#logo {
margin-bottom: 2em;
}
.step a, .step input {
font-size: 2em;
}
.step, th {
text-align: right;
}
#footer {
text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic;
}
-->
</style>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php if ( get_option('db_version') == $wp_db_version ) : ?>
<h2><?php _e('No Upgrade Required'); ?></h2>
<p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
<h2 class="step"><a href="<?php echo get_option('home'); ?>/"><?php _e('Continue &raquo;'); ?></a></h2>
<?php else :
switch($step) :
case 0:
$goback = clean_url(stripslashes(wp_get_referer()));
?>
<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>
<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
<?php
break;
case 1:
wp_upgrade();
switch($step) {
if ( empty( $_GET['backto'] ) )
$backto = __get_option('home') . '/';
else
$backto = clean_url(stripslashes($_GET['backto']));
case 0:
$goback = attribute_escape(stripslashes(wp_get_referer()));
?>
<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>
<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so 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;
case 1:
$wp_current_db_version = __get_option('db_version');
if ( $wp_db_version != $wp_current_db_version ) {
wp_cache_flush();
make_db_current_silent();
upgrade_all();
wp_cache_flush();
}
if ( empty( $_GET['backto'] ) )
$backto = __get_option('home');
else
$backto = attribute_escape(stripslashes($_GET['backto']));
?>
<h2><?php _e('Step 1'); ?></h2>
<p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), $backto); ?></p>
<!--
<pre>
@@ -64,9 +100,8 @@ switch($step) :
-->
<?php
break;
endswitch;
endif;
?>
break;
}
?>
</body>
</html>
</html>

View File

@@ -1,360 +0,0 @@
<?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();
if ( !isset($attachment_data['width']) && $is_image ) {
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 );
}
}
if ( isset($attachment_data['width']) )
list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
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';
$innerHTML = get_attachment_innerHTML( $id, false, $dims );
if ( $image_src = get_attachment_icon_src() ) {
$image_rel = wp_make_link_relative($image_src);
$innerHTML = '&nbsp;' . str_replace($image_src, $image_rel, $innerHTML);
$class = 'image';
}
$src_base = wp_get_attachment_url();
$src = wp_make_link_relative( $src_base );
$src_base = str_replace($src, '', $src_base);
$r = '';
if ( $href )
$r .= "<a id='file-link-$id' href='$href' title='$post_title' class='file-link $class'>\n";
if ( $href || $image_src )
$r .= "\t\t\t$innerHTML";
if ( $href )
$r .= "</a>\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";
if ( !$thumb_base = wp_get_attachment_thumb_url() )
$thumb_base = wp_mime_type_icon();
if ( $thumb_base ) {
$thumb_rel = wp_make_link_relative( $thumb_base );
$thumb_base = str_replace( $thumb_rel, '', $thumb_base );
$r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-$id' id='attachment-thumb-url-$id' value='$thumb_rel' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-thumb-url-base-$id' id='attachment-thumb-url-base-$id' value='$thumb_base' />\n";
}
$r .= "\t\t\t\t<input type='hidden' name='attachment-is-image-$id' id='attachment-is-image-$id' value='$is_image' />\n";
if ( isset($width) ) {
$r .= "\t\t\t\t<input type='hidden' name='attachment-width-$id' id='attachment-width-$id' value='$width' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-height-$id' id='attachment-height-$id' value='$height' />\n";
}
$r .= "\t\t\t\t<input type='hidden' name='attachment-page-url-$id' id='attachment-page-url-$id' value='" . get_attachment_link( $id ) . "' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-title-$id' id='attachment-title-$id' value='$post_title' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-description-$id' id='attachment-description-$id' value='$post_content' />\n";
$r .= "\t\t\t</p>\n\t\t</div>\n";
return $r;
}
function wp_upload_view() {
global $style, $post_id, $style;
$id = get_the_ID();
$attachment_data = wp_get_attachment_metadata( $id );
?>
<div id="upload-file">
<div id="file-title">
<h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>";
the_title();
if ( !isset($attachment_data['width']) && 'inline' != $style )
echo '</a>';
?></h2>
<span><?php
echo '[&nbsp;';
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
echo '&nbsp;|&nbsp;';
echo '<a href="' . clean_url(add_query_arg('action', 'edit')) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
echo '&nbsp;|&nbsp;';
echo '<a href="' . clean_url(remove_query_arg(array('action', 'ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
echo '&nbsp;]'; ?></span>
</div>
<div id="upload-file-view" class="alignleft">
<?php if ( isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>";
echo wp_upload_display( array(171, 128) );
if ( isset($attachment_data['width']) && 'inline' != $style )
echo '</a>'; ?>
</div>
<?php the_attachment_links( $id ); ?>
</div>
<?php echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n";
}
function wp_upload_form() {
$id = get_the_ID();
global $post_id, $tab, $style;
$enctype = $id ? '' : ' enctype="multipart/form-data"';
$post_id = (int) $post_id;
?>
<form<?php echo $enctype; ?> id="upload-file" method="post" action="<?php echo get_option('siteurl') . '/wp-admin/upload.php?style=' . attribute_escape($style . '&amp;tab=upload&amp;post_id=' . $post_id); ?>">
<?php
if ( $id ) :
$attachment = get_post_to_edit( $id );
$attachment_data = wp_get_attachment_metadata( $id );
?>
<div id="file-title">
<h2><?php if ( !isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>";
the_title();
if ( !isset($attachment_data['width']) && 'inline' != $style )
echo '</a>';
?></h2>
<span><?php
echo '[&nbsp;';
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
echo '&nbsp;|&nbsp;';
echo '<a href="' . clean_url(add_query_arg('action', 'view')) . '">' . __('links') . '</a>';
echo '&nbsp;|&nbsp;';
echo '<a href="' . clean_url(remove_query_arg(array('action','ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
echo '&nbsp;]'; ?></span>
</div>
<div id="upload-file-view" class="alignleft">
<?php if ( isset($attachment_data['width']) && 'inline' != $style )
echo "<a href='" . wp_get_attachment_url() . "' title='" . __('Direct link to file') . "'>";
echo wp_upload_display( array(171, 128) );
if ( isset($attachment_data['width']) && 'inline' != $style )
echo '</a>'; ?>
</div>
<?php endif; ?>
<table><col /><col class="widefat" />
<?php if ( $id ): ?>
<tr>
<th scope="row"><label for="url"><?php _e('URL'); ?></label></th>
<td><input type="text" id="url" class="readonly" value="<?php echo wp_get_attachment_url(); ?>" readonly="readonly" /></td>
</tr>
<?php else : ?>
<tr>
<th scope="row"><label for="upload"><?php _e('File'); ?></label></th>
<td><input type="file" id="upload" name="image" /></td>
</tr>
<?php endif; ?>
<tr>
<th scope="row"><label for="post_title"><?php _e('Title'); ?></label></th>
<td><input type="text" id="post_title" name="post_title" value="<?php echo $attachment->post_title; ?>" /></td>
</tr>
<tr>
<th scope="row"><label for="post_content"><?php _e('Description'); ?></label></th>
<td><textarea name="post_content" id="post_content"><?php echo $attachment->post_content; ?></textarea></td>
</tr>
<tr id="buttons" class="submit">
<td colspan='2'>
<?php if ( $id ) : ?>
<input type="submit" name="delete" id="delete" class="delete alignleft" value="<?php _e('Delete File'); ?>" />
<?php endif; ?>
<input type="hidden" name="from_tab" value="<?php echo $tab; ?>" />
<input type="hidden" name="action" value="<?php echo $id ? 'save' : 'upload'; ?>" />
<?php if ( $post_id ) : ?>
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
<?php endif; if ( $id ) : ?>
<input type="hidden" name="ID" value="<?php echo $id; ?>" />
<?php endif; ?>
<?php wp_nonce_field( 'inlineuploading' ); ?>
<div class="submit">
<input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?> &raquo;" />
</div>
</td>
</tr>
</table>
</form>
<?php
}
function wp_upload_tab_upload() {
wp_upload_form();
}
function wp_upload_tab_upload_action() {
global $action;
if ( isset($_POST['delete']) )
$action = 'delete';
switch ( $action ) :
case 'upload' :
global $from_tab, $post_id, $style;
if ( !$from_tab )
$from_tab = 'upload';
check_admin_referer( 'inlineuploading' );
global $post_id, $post_title, $post_content;
if ( !current_user_can( 'upload_files' ) )
wp_die( __('You are not allowed to upload files.')
. " <a href='" . get_option('siteurl') . "/wp-admin/upload.php?style=" . attribute_escape($style . "&amp;tab=browse-all&amp;post_id=$post_id") . "'>"
. __('Browse Files') . '</a>'
);
$overrides = array('action'=>'upload');
$file = wp_handle_upload($_FILES['image'], $overrides);
if ( isset($file['error']) )
wp_die($file['error'] . "<br /><a href='" . get_option('siteurl')
. "/wp-admin/upload.php?style=" . attribute_escape($style . "&amp;tab=$from_tab&amp;post_id=$post_id") . "'>" . __('Back to Image Uploading') . '</a>'
);
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$filename = basename($file);
// Construct the attachment array
$attachment = array(
'post_title' => $post_title ? $post_title : $filename,
'post_content' => $post_content,
'post_type' => 'attachment',
'post_parent' => $post_id,
'post_mime_type' => $type,
'guid' => $url
);
// Save the data
$id = wp_insert_attachment($attachment, $file, $post_id);
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=browse&action=view&ID=$id&post_id=$post_id");
die;
break;
case 'save' :
global $from_tab, $post_id, $style;
if ( !$from_tab )
$from_tab = 'upload';
check_admin_referer( 'inlineuploading' );
wp_update_post($_POST);
wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=$from_tab&post_id=$post_id");
die;
break;
case 'delete' :
global $ID, $post_id, $from_tab, $style;
if ( !$from_tab )
$from_tab = 'upload';
check_admin_referer( 'inlineuploading' );
if ( !current_user_can('edit_post', (int) $ID) )
wp_die( __('You are not allowed to delete this attachment.')
. " <a href='" . get_option('siteurl') . "/wp-admin/upload.php?style=" . attribute_escape($style . "&amp;tab=$from_tab&amp;post_id=$post_id") . "'>"
. __('Go back') . '</a>'
);
wp_delete_attachment($ID);
wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=$from_tab&post_id=$post_id" );
die;
break;
endswitch;
}
add_action( 'upload_files_upload', 'wp_upload_tab_upload_action' );
function wp_upload_grab_attachments( $obj ) {
$obj->is_attachment = true;
}
function wp_upload_posts_where( $where ) {
global $post_id;
return $where . " AND post_parent = '" . (int) $post_id . "'";
}
function wp_upload_tab_browse() {
global $wpdb, $action, $paged;
$old_vars = compact( 'paged' );
switch ( $action ) :
case 'edit' :
case 'view' :
global $ID;
$attachments = query_posts("attachment_id=$ID");
if ( have_posts() ) : while ( have_posts() ) : the_post();
'edit' == $action ? wp_upload_form() : wp_upload_view();
endwhile; endif;
break;
default :
global $tab, $post_id, $style;
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&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();
$href = wp_specialchars( add_query_arg( array(
'action' => 'inline' == $style ? 'view' : 'edit',
'ID' => get_the_ID())
), 1 );
echo "\t<li id='file-";
the_ID();
echo "' class='alignleft'>\n";
echo wp_upload_display( array(128,128), $href );
echo "\t</li>\n";
endwhile;
else :
echo "\t<li>" . __('There are no attachments to show.') . "</li>\n";
endif;
echo "</ul>\n\n";
echo "<form action='' id='browse-form'><input type='hidden' id='nonce-value' value='" . wp_create_nonce( 'inlineuploading' ) . "' /></form>\n";
break;
endswitch;
extract($old_vars);
}
function wp_upload_tab_browse_action() {
global $style;
if ( 'inline' == $style )
wp_enqueue_script('upload');
}
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() {
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";
echo "\tbody > #upload-menu { position: fixed; }\n";
echo "\t#upload-content { top: 2em; }\n";
echo "\t#upload-file { position: absolute; top: 15px; }\n";
echo "</style>";
}
}
?>

View File

@@ -1,50 +0,0 @@
#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;
}

View File

@@ -1,204 +0,0 @@
body { background: #f9fcfe; }
.upload-file-data { display: none; }
#upload-menu {
border-top: 2em solid #247fab;
margin: 0;
padding: 0;
height: 0;
list-style: none;
width: 100%;
}
body > #upload-menu { border-bottom: 7px solid #fff; }
#upload-menu li {
margin: 0;
position: relative;
top: -2em;
padding-bottom: 5px;
border: none;
border-top: 3px solid #247fab;
}
#upload-menu li a.upload-tab-link {
margin-left: 0.75em;
padding: 5px 5px 0;
display: block;
float: left;
height: 100%;
text-decoration: none;
border-bottom: none;
color: #fff;
}
#upload-menu li.current {
border-right: 2px solid #448abd;
color: #000;
}
#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
background: #f9fcfe;
color: #000;
}
#upload-menu li #current-tab-nav {
background: #f9fcfe;
float: left;
padding: 5px 5px 0 0;
margin-left: -5px;
}
#upload-menu li span .page-numbers {
padding: 0;
border: none;
}
#upload-menu li span a.page-numbers { color: #00019b; }
#upload-menu li span a.page-numbers:hover { text-decoration: underline; }
#upload-content {
position: relative;
clear: both;
margin: 0;
padding: 0;
border: none;
width: 100%;
height: 100%;
background: none;
}
#upload-file {
margin: 0 auto;
top: 0;
left: 0;
width: 95%;
height: 100%;
background: #f9fcfe;
}
#upload-file th {
width: 8em;
}
form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
form#upload-file .submit input { width: auto; }
#upload-file-view { padding: 0 0 0 75px; }
#file-title {
margin: 0 0 .2em 75px;
padding: 0;
display: block;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
}
h2 {
margin: 0 .2em 0 0;
padding: 0;
display: inline;
border: none;
color: #000;
font-size: 1.4em;
line-height: 1.4em;
}
.wrap h2 {
margin: .4em 0 .5em;
display: block;
border-bottom: .5em solid #e5f3ff;
color: #333;
font: normal 32px/5px serif;
clear: both;
}
* html .wrap h2 {
margin-top: 1em;
}
.back {
display: block;
position: absolute;
left: 14px;
top: 10px;
}
#upload-files {
list-style-type: none;
margin: 0;
padding: 15px 0 0;
}
#upload-files li { margin: 0 0 15px 15px; }
#upload-files a, #upload-file-view a, a.file-link {
border: none;
text-decoration: none;
}
#upload-file-view a img { padding-bottom: .2em; border-bottom: 1px solid #6699CC; }
#upload-files a.file-link {
display: block;
width: 130px;
height: 128px;
background-color: rgb(209, 226, 239);
text-align: center;
overflow: hidden;
}
#upload-files a.text {
padding-top: 40px;
height: 88px;
font-size: 16px;
}
#upload-files a.file-link.image {
font-size: 2px;
letter-spacing: 0;
}
#upload-files a.file-link img { vertical-align: middle; }
#the-attachment-links textarea {
font-size: 10px;
overflow: hidden;
}
form table { float: none; padding: 0 15px; }
table {
float: left;
margin: 0;
padding: 0;
}
th { text-align: right; vertical-align: text-top; }
tr, td, th {
margin-top: 0;
padding-top: 0;
}
#uploadoptions th {
width: 80px;
}
#uploadoptions p {
margin: 0;
padding: 0;
}
#uploadoptions td {
padding-left: 1em;
line-height: 140%;
}
#uploadoptions table {
width: 300px;
}
input.readonly { background-color: #ddd; }

View File

@@ -1,273 +0,0 @@
addLoadEvent( function() {
theFileList = {
currentImage: {ID: 0},
nonce: '',
tab: '',
postID: 0,
initializeVars: function() {
this.urlData = document.location.href.split('?');
this.params = this.urlData[1].toQueryParams();
this.postID = this.params['post_id'];
this.tab = this.params['tab'];
this.style = this.params['style'];
this.ID = this.params['ID'];
if ( !this.style )
this.style = 'default';
var nonceEl = $('nonce-value');
if ( nonceEl )
this.nonce = nonceEl.value;
if ( this.ID ) {
this.grabImageData( this.ID );
this.imageView( this.ID );
}
},
initializeLinks: function() {
if ( this.ID )
return;
$$('a.file-link').each( function(i) {
var id = i.id.split('-').pop();
i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); }
} );
},
grabImageData: function(id) {
if ( id == this.currentImage.ID )
return;
var thumbEl = $('attachment-thumb-url-' + id);
if ( thumbEl ) {
this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value );
} else {
this.currentImage.thumb = false;
}
this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value );
this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value );
this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value );
this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value );
var widthEl = $('attachment-width-' + id);
if ( widthEl ) {
this.currentImage.width = ( 0 == id ? '' : widthEl.value );
this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value );
} else {
this.currentImage.width = false;
this.currentImage.height = false;
}
this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value );
this.currentImage.ID = id;
},
imageView: function(id, e) {
this.prepView(id);
var h = '';
h += "<div id='upload-file'>"
if ( this.ID ) {
var params = $H(this.params);
params.ID = '';
params.action = '';
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
} else {
h += "<a href='#' onclick='return theFileList.cancelView();'";
}
h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
h += "<div id='file-title'>"
if ( 0 == this.currentImage.isImage )
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
else
h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>";
h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
h += "</span>";
h += '</div>'
h += "<div id='upload-file-view' class='alignleft'>";
if ( 1 == this.currentImage.isImage ) {
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
h += "</a>";
} else
h += '&nbsp;';
h += "</div>";
h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
h += "<table>";
var display = [];
var checked = 'display-title';
if ( 1 == this.currentImage.isImage ) {
checked = 'display-full';
if ( this.currentImage.thumb ) {
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />");
checked = 'display-thumb';
}
display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
} else if ( this.currentImage.thumb ) {
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
}
if ( display.length ) {
display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
$A(display).each( function(i) { h += i; } );
h += "</td></tr>";
}
h += "<tr><th>" + this.link + "</th><td>";
h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />";
h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />";
h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>";
h += "</td></tr>";
h += "<tr><td colspan='2'><p class='submit'>";
h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />";
h += "</p></td></tr></table>";
h += "</form>";
h += "</div>";
new Insertion.Top('upload-content', h);
var displayEl = $(checked);
if ( displayEl )
displayEl.checked = true;
if (e) Event.stop(e);
return false;
},
editView: function(id, e) {
this.prepView(id);
var h = '';
var action = 'upload.php?style=' + this.style + '&amp;tab=upload';
if ( this.postID )
action += '&amp;post_id=' + this.postID;
h += "<form id='upload-file' method='post' action='" + action + "'>";
if ( this.ID ) {
var params = $H(this.params);
params.ID = '';
params.action = '';
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
} else {
h += "<a href='#' onclick='return theFileList.cancelView();'";
}
h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
h += "<div id='file-title'>"
if ( 0 == this.currentImage.isImage )
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
else
h += "<h2>" + this.currentImage.title + "</h2>";
h += " &#8212; <span>";
h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
h += "</span>";
h += '</div>'
h += "<div id='upload-file-view' class='alignleft'>";
if ( 1 == this.currentImage.isImage ) {
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
h += "</a>";
} else
h += '&nbsp;';
h += "</div>";
h += "<table><col /><col class='widefat' /><tr>";
h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>";
h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
h += "</tr><tr>";
h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>";
h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
h += "</tr><tr>";
h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>";
h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
h += "<input type='hidden' name='action' id='action-value' value='save' />";
h += "<input type='hidden' name='ID' value='" + id + "' />";
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
h += "</td></tr></table></form>";
new Insertion.Top('upload-content', h);
if (e) Event.stop(e);
return false;
},
prepView: function(id) {
this.cancelView( true );
var filesEl = $('upload-files');
if ( filesEl )
filesEl.hide();
var navEl = $('current-tab-nav');
if ( navEl )
navEl.hide();
this.grabImageData(id);
},
cancelView: function( prep ) {
if ( !prep ) {
var filesEl = $('upload-files');
if ( filesEl )
Element.show(filesEl);
var navEl = $('current-tab-nav');
if ( navEl )
Element.show(navEl);
}
if ( !this.ID )
this.grabImageData(0);
var div = $('upload-file');
if ( div )
Element.remove(div);
return false;
},
sendToEditor: function(id) {
this.grabImageData(id);
var link = '';
var display = '';
var h = '';
link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value;
displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )
if ( displayEl )
display = displayEl.value;
else if ( 1 == this.currentImage.isImage )
display = 'full';
if ( 'none' != link )
h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";
if ( display && 'title' != display )
h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
else
h += this.currentImage.title;
if ( 'none' != link )
h += "</a>";
var win = window.opener ? window.opener : window.dialogArguments;
if ( !win )
win = top;
tinyMCE = win.tinyMCE;
if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {
tinyMCE.selectedInstance.getWin().focus();
tinyMCE.execCommand('mceInsertContent', false, h);
} else
win.edInsertContent(win.edCanvas, h);
if ( !this.ID )
this.cancelView();
return false;
},
deleteFile: function(id) {
if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
$('action-value').value = 'delete';
$('upload-file').submit();
return true;
}
return false;
}
};
Object.extend( theFileList, uploadL10n );
theFileList.initializeVars();
theFileList.initializeLinks();
} );

View File

@@ -1,138 +0,0 @@
<?php
require_once('admin.php');
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
if (!current_user_can('upload_files'))
wp_die(__('You do not have permission to upload files.'));
wp_reset_vars(array('action', 'tab', 'from_tab', 'style', 'post_id', 'ID', 'paged', 'post_title', 'post_content', 'delete'));
// IDs should be integers
$ID = (int) $ID;
$post_id = (int) $post_id;
// Require an ID for the edit screen
if ( $action == 'edit' && !$ID )
wp_die(__("You are not allowed to be here"));
require_once('upload-functions.php');
if ( !$tab )
$tab = 'browse-all';
do_action( "upload_files_$tab" );
$pid = 0;
if ( $post_id < 0 )
$pid = $post_id;
elseif ( get_post( $post_id ) )
$pid = $post_id;
$wp_upload_tabs = array();
$all_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'");
$post_atts = 0;
if ( $pid ) {
// 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args
$wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0);
if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") )
$wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts);
if ( $post_atts < $all_atts )
$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
} else
$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
$wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() ));
if ( !is_callable($wp_upload_tabs[$tab][2]) ) {
$to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all';
wp_redirect( add_query_arg( 'tab', $to_tab ) );
exit;
}
foreach ( $wp_upload_tabs as $t => $tab_array ) {
if ( !current_user_can( $tab_array[1] ) ) {
unset($wp_upload_tabs[$t]);
if ( $tab == $t )
wp_die(__("You are not allowed to be here"));
}
}
if ( 'inline' == $style ) : ?>
<!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 bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; WordPress</title>
<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();}}}
//]]>
</script>
<?php do_action('admin_print_scripts'); wp_upload_admin_head(); ?>
</head>
<body>
<?php
else :
add_action( 'admin_head', 'wp_upload_admin_head' );
include_once('admin-header.php');
?>
<div class='wrap'>
<h2><?php _e('Uploads'); ?></h2>
<?php
endif;
echo "<ul id='upload-menu'>\n";
foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
$href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
if ( isset($tab_array[4]) && is_array($tab_array[4]) )
$href = add_query_arg( $tab_array[4], $href );
$_href = clean_url( $href);
$page_links = '';
$class = 'upload-tab alignleft';
if ( $tab == $t ) {
$class .= ' current';
if ( $tab_array[3] ) {
if ( is_array($tab_array[3]) ) {
$total = $tab_array[3][0];
$per = $tab_array[3][1];
} else {
$total = $tab_array[3];
$per = 10;
}
$page_links = paginate_links( array(
'base' => add_query_arg( 'paged', '%#%' ),
'format' => '',
'total' => ceil($total / $per),
'current' => $paged ? $paged : 1,
'prev_text' => '&laquo;',
'next_text' => '&raquo;'
));
if ( $page_links )
$page_links = "<span id='current-tab-nav'>: $page_links</span>";
}
}
echo "\t<li class='$class'><a href='$_href' class='upload-tab-link' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</li>\n";
}
unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
echo "</ul>\n\n";
echo "<div id='upload-content' class='$tab'>\n";
call_user_func( $wp_upload_tabs[$tab][2] );
echo "</div>\n";
if ( 'inline' != $style ) :
echo "<div class='clear'></div></div>";
include_once('admin-footer.php');
else : ?>
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
</body>
</html>
<?php endif; ?>

View File

@@ -2,20 +2,29 @@
require_once('admin.php');
$title = __('Edit User');
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
$parent_file = 'profile.php';
$submenu_file = 'users.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
$user_id = (int) $user_id;
if ( !$user_id )
wp_die(__('Invalid user ID.'));
die(__('Invalid user ID.'));
switch ($action) {
case 'switchposts':
@@ -30,41 +39,38 @@ case 'update':
check_admin_referer('update-user_' . $user_id);
if ( !current_user_can('edit_user', $user_id) )
wp_die(__('You do not have permission to edit this user.'));
$errors = array();
$errors = edit_user($user_id);
if (!current_user_can('edit_users'))
die(__('You do not have permission to edit this user.'));
else
$errors = edit_user($user_id);
if( !is_wp_error( $errors ) ) {
$redirect = "user-edit.php?user_id=$user_id&updated=true";
$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
wp_redirect($redirect);
if(count($errors) == 0) {
wp_redirect("user-edit.php?user_id=$user_id&updated=true");
exit;
}
default:
include ('admin-header.php');
$profileuser = get_user_to_edit($user_id);
if ( !current_user_can('edit_user', $user_id) )
wp_die(__('You do not have permission to edit this user.'));
if (!current_user_can('edit_users'))
die__('You do not have permission to edit this user.');
include ('admin-header.php');
?>
<?php if ( isset($_GET['updated']) ) : ?>
<div id="message" class="updated fade">
<p><strong><?php _e('User updated.') ?></strong></p>
<?php if ( $wp_http_referer ) : ?>
<p><a href="users.php"><?php _e('&laquo; Back to Authors and Users'); ?></a></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( is_wp_error( $errors ) ) : ?>
<?php if ( count($errors) != 0 ) : ?>
<div class="error">
<ul>
<?php
foreach( $errors->get_error_messages() as $message )
echo "<li>$message</li>";
foreach($errors as $error) echo "<li>$error</li>";
?>
</ul>
</div>
@@ -75,18 +81,11 @@ include ('admin-header.php');
<form name="profile" id="your-profile" action="user-edit.php" method="post">
<?php wp_nonce_field('update-user_' . $user_id) ?>
<?php if ( $wp_http_referer ) : ?>
<input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
<?php endif; ?>
<p>
<input type="hidden" name="from" value="profile" />
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
</p>
<p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></p>
<p class="submit"><input type="submit" value="<?php _e('Update User &raquo;'); ?>" name="submit" /></p>
<fieldset>
<legend><?php _e('Name'); ?></legend>
<p><label><?php _e('Username: (no editing)'); ?><br />
@@ -97,22 +96,11 @@ include ('admin-header.php');
<?php
// print_r($profileuser);
echo '<select name="role">';
$role_list = '';
$user_has_role = false;
foreach($wp_roles->role_names as $role => $name) {
if ( $profileuser->has_cap($role) ) {
$selected = ' selected="selected"';
$user_has_role = true;
} else {
$selected = '';
}
$role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>";
$selected = ($profileuser->has_cap($role)) ? ' selected="selected"' : '';
echo "<option value=\"{$role}\"{$selected}>{$name}</option>";
}
if ( $user_has_role )
$role_list .= '<option value="">' . __('&mdash; No role for this blog &mdash;') . '</option>';
else
$role_list .= '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
echo $role_list . '</select>';
echo '</select>';
?></label></p>
<p><label><?php _e('First name:') ?><br />
@@ -124,7 +112,7 @@ echo $role_list . '</select>';
<p><label><?php _e('Nickname:') ?><br />
<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
<p><label><?php _e('Display name publicly as:') ?> <br />
</p><label><?php _e('Display name publicly as:') ?> <br />
<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>
@@ -160,7 +148,7 @@ echo $role_list . '</select>';
<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
</label></p>
<p><label><?php _e('Jabber / Google Talk:') ?><br />
<p><label><?php _e('Jabber / Google Talk:') ?>
<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
</p>
</fieldset>
@@ -190,13 +178,13 @@ if ( $show_password_fields ) :
<?php do_action('edit_user_profile'); ?>
<br clear="all" />
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php
if(count($profileuser->caps) > count($profileuser->roles)):
?>
<tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php
if(count($profileuser->caps) > count($profileuser->roles)):
?>
<tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php
$output = '';
foreach($profileuser->caps as $cap => $value) {
if(!$wp_roles->is_role($cap)) {
@@ -206,15 +194,15 @@ if ( $show_password_fields ) :
}
echo $output;
?></td>
</tr>
<?php
endif;
?>
</table>
</tr>
<?php
endif;
?>
</table>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
<input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
<input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
</p>
</form>
</div>

View File

@@ -1,21 +0,0 @@
addLoadEvent(function() {
theListEls = document.getElementsByTagName('tbody');
theUserLists = new Array();
for ( var l = 0; l < theListEls.length; l++ ) {
if ( theListEls[l].id )
theUserLists[theListEls[l].id] = new listMan(theListEls[l].id);
}
addUserInputs = document.getElementById('adduser').getElementsByTagName('input');
for ( var i = 0; i < addUserInputs.length; i++ ) {
addUserInputs[i].onkeypress = function(e) { return killSubmit('addUserSubmit();', e); }
}
document.getElementById('addusersub').onclick = function(e) { return killSubmit('addUserSubmit();', e); }
}
);
function addUserSubmit() {
var roleEl = document.getElementById('role');
var role = roleEl.options[roleEl.selectedIndex].value;
if ( !theUserLists['role-' + role] ) return true;
return theUserLists['role-' + role].ajaxAdder('user', 'adduser');
}

View File

@@ -1,150 +1,40 @@
<?php
require_once('admin.php');
require_once( ABSPATH . WPINC . '/registration.php');
if ( !current_user_can('edit_users') )
wp_die(__('Cheatin&#8217; uh?'));
require_once( ABSPATH . WPINC . '/registration-functions.php');
$title = __('Users');
$parent_file = 'users.php';
$parent_file = 'profile.php';
$action = $_REQUEST['action'];
$update = '';
if ( empty($_POST) ) {
$referer = '<input type="hidden" name="wp_http_referer" value="'. attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
} elseif ( isset($_POST['wp_http_referer']) ) {
$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_POST['wp_http_referer']));
$referer = '<input type="hidden" name="wp_http_referer" value="' . attribute_escape($redirect) . '" />';
} else {
$redirect = 'users.php';
}
// WP_User_Search class
// by Mark Jaquith
class WP_User_Search {
var $results;
var $search_term;
var $page;
var $raw_page;
var $users_per_page = 50;
var $first_user;
var $last_user;
var $query_limit;
var $query_from_where;
var $total_users_for_query = 0;
var $too_many_total_users = false;
var $search_errors;
function WP_User_Search ($search_term = '', $page = '') { // constructor
$this->search_term = $search_term;
$this->raw_page = ( '' == $page ) ? false : (int) $page;
$this->page = (int) ( '' == $page ) ? 1 : $page;
$this->prepare_query();
$this->query();
$this->prepare_vars_for_template_usage();
$this->do_paging();
}
function prepare_query() {
global $wpdb;
$this->first_user = ($this->page - 1) * $this->users_per_page;
$this->query_limit = 'LIMIT ' . $this->first_user . ',' . $this->users_per_page;
if ( $this->search_term ) {
$searches = array();
$search_sql = 'AND (';
foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
$searches[] = $col . " LIKE '%$this->search_term%'";
$search_sql .= implode(' OR ', $searches);
$search_sql .= ')';
}
$this->query_from_where = "FROM $wpdb->users WHERE 1=1 $search_sql";
}
function query() {
global $wpdb;
$this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_limit);
if ( $this->results )
$this->total_users_for_query = $wpdb->get_var('SELECT COUNT(ID) ' . $this->query_from_where); // no limit
else
$this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
}
function prepare_vars_for_template_usage() {
$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
}
function do_paging() {
if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
$this->paging_text = paginate_links( array(
'total' => ceil($this->total_users_for_query / $this->users_per_page),
'current' => $this->page,
'prev_text' => __('&laquo; Previous Page'),
'next_text' => __('Next Page &raquo;'),
'base' => 'users.php?%_%',
'format' => 'userspage=%#%',
'add_args' => array( 'usersearch' => urlencode($this->search_term) )
) );
}
}
function get_results() {
return (array) $this->results;
}
function page_links() {
echo $this->paging_text;
}
function results_are_paged() {
if ( $this->paging_text )
return true;
return false;
}
function is_search() {
if ( $this->search_term )
return true;
return false;
}
}
switch ($action) {
case 'promote':
check_admin_referer('bulk-users');
if (empty($_POST['users'])) {
wp_redirect($redirect);
wp_redirect('users.php');
exit();
}
if ( !current_user_can('edit_users') )
wp_die(__('You can&#8217;t edit users.'));
die(__('You can&#8217;t edit users.'));
$userids = $_POST['users'];
$userids = $_POST['users'];
$update = 'promote';
foreach($userids as $id) {
if ( ! current_user_can('edit_user', $id) )
wp_die(__('You can&#8217;t edit that user.'));
foreach($userids as $id) {
// The new role of the current user must also have edit_users caps
if($id == $current_user->ID && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
$update = 'err_admin_role';
continue;
}
$user = new WP_User($id);
$user->set_role($_POST['new_role']);
}
wp_redirect(add_query_arg('update', $update, $redirect));
$user = new WP_User($id);
$user->set_role($_POST['new_role']);
}
wp_redirect('users.php?update=' . $update);
exit();
break;
@@ -154,26 +44,22 @@ case 'dodelete':
check_admin_referer('delete-users');
if ( empty($_POST['users']) ) {
wp_redirect($redirect);
wp_redirect('users.php');
exit();
}
if ( !current_user_can('delete_users') )
wp_die(__('You can&#8217;t delete users.'));
if ( !current_user_can('edit_users') )
die(__('You can&#8217;t delete users.'));
$userids = $_POST['users'];
$update = 'del';
$delete_count = 0;
foreach ( (array) $userids as $id) {
if ( ! current_user_can('delete_user', $id) )
wp_die(__('You can&#8217;t delete that user.'));
if($id == $current_user->ID) {
foreach ($userids as $id) {
if($id == $current_user->id) {
$update = 'err_admin_del';
continue;
}
switch($_POST['delete_option']) {
switch($_POST['delete_option']) {
case 'delete':
wp_delete_user($id);
break;
@@ -181,13 +67,10 @@ case 'dodelete':
wp_delete_user($id, $_POST['reassign_user']);
break;
}
++$delete_count;
}
$redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
wp_redirect($redirect);
wp_redirect('users.php?update=' . $update);
exit();
break;
case 'delete':
@@ -195,12 +78,12 @@ case 'delete':
check_admin_referer('bulk-users');
if ( empty($_POST['users']) ) {
wp_redirect($redirect);
wp_redirect('users.php');
exit();
}
if ( !current_user_can('delete_users') )
$errors = new WP_Error('edit_users', __('You can&#8217;t delete users.'));
if ( !current_user_can('edit_users') )
$error['edit_users'] = __('You can&#8217;t delete users.');
$userids = $_POST['users'];
@@ -208,32 +91,33 @@ case 'delete':
?>
<form action="" method="post" name="updateusers" id="updateusers">
<?php wp_nonce_field('delete-users') ?>
<?php echo $referer; ?>
<div class="wrap">
<h2><?php _e('Delete Users'); ?></h2>
<p><?php _e('You have specified these users for deletion:'); ?></p>
<ul>
<?php
$go_delete = false;
foreach ( (array) $userids as $id ) {
$user = new WP_User($id);
if ( $id == $current_user->ID ) {
foreach ($userids as $id) {
$user = new WP_User($id);
if ($id == $current_user->id) {
echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
} else {
echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n";
$go_delete = true;
}
}
$all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
$user_dropdown = '<select name="reassign_user">';
foreach ( (array) $all_logins as $login )
if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
$user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
$user_dropdown .= '</select>';
?>
</ul>
<?php if ( $go_delete ) : ?>
<p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
}
$all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
$user_dropdown = '<select name="reassign_user">';
foreach ($all_logins as $login) {
if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) {
$user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
}
}
$user_dropdown .= '</select>';
?>
</ul>
<?php if($go_delete) : ?>
<p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
<ul style="list-style:none;">
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
<?php _e('Delete all posts and links.'); ?></label></li>
@@ -253,44 +137,35 @@ break;
case 'adduser':
check_admin_referer('add-user');
if ( ! current_user_can('create_users') )
wp_die(__('You can&#8217;t create users.'));
$user_id = add_user();
$update = 'add';
if ( is_wp_error( $user_id ) )
$add_user_errors = $user_id;
else {
$new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_POST['user_login']), true));
$redirect = add_query_arg( array('usersearch' => urlencode($new_user_login), 'update' => $update), $redirect );
wp_redirect( $redirect . '#user-' . $user_id );
die();
$errors = add_user();
if ( count($errors) == 0 ) {
wp_redirect('users.php?update=add');
exit();
}
default:
wp_enqueue_script('admin-users');
include('admin-header.php');
// Query the users
$wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage']);
// Make the user objects
foreach ( $wp_user_search->get_results() as $userid ) {
include ('admin-header.php');
$userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;");
foreach($userids as $userid) {
$tmp_user = new WP_User($userid);
$roles = $tmp_user->roles;
$role = array_shift($roles);
$roleclasses[$role][$tmp_user->user_login] = $tmp_user;
}
}
?>
if ( isset($_GET['update']) ) :
<?php
if (isset($_GET['update'])) :
switch($_GET['update']) {
case 'del':
case 'del_many':
?>
<?php $delete_count = (int) $_GET['delete_count']; ?>
<div id="message" class="updated fade"><p><?php printf(__ngettext('%s user deleted', '%s users deleted', $delete_count), $delete_count); ?></p></div>
<div id="message" class="updated fade"><p><?php _e('User deleted.'); ?></p></div>
<?php
break;
case 'add':
@@ -316,204 +191,145 @@ default:
<?php
break;
}
endif; ?>
<?php if ( is_wp_error( $errors ) ) : ?>
endif;
if ( isset($errors) ) : ?>
<div class="error">
<ul>
<?php
foreach ( $errors->get_error_messages() as $message )
echo "<li>$message</li>";
foreach($errors as $error) echo "<li>$error</li>";
?>
</ul>
</div>
<?php endif; ?>
<div class="wrap">
<?php if ( $wp_user_search->is_search() ) : ?>
<h2><?php printf(__('Users Matching "%s" by Role'), wp_specialchars($wp_user_search->search_term)); ?></h2>
<?php else : ?>
<h2><?php _e('User List by Role'); ?></h2>
<?php endif; ?>
<form action="" method="get" name="search" id="search">
<p><input type="text" name="usersearch" id="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php _e('Search Users &raquo;'); ?>" class="button" /></p>
</form>
<?php if ( is_wp_error( $wp_user_search->search_errors ) ) : ?>
<div class="error">
<ul>
<?php
foreach ( $wp_user_search->search_errors->get_error_messages() as $message )
echo "<li>$message</li>";
?>
</ul>
</div>
<?php endif; ?>
<?php if ( $wp_user_search->get_results() ) : ?>
<?php if ( $wp_user_search->is_search() ) : ?>
<p><a href="users.php"><?php _e('&laquo; Back to All Users'); ?></a></p>
<?php endif; ?>
<h3><?php
if ( 0 == $wp_user_search->first_user && $wp_user_search->total_users_for_query <= 50 )
printf(__('%3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query);
else
printf(__('%1$s &#8211; %2$s of %3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query); ?></h3>
<?php if ( $wp_user_search->results_are_paged() ) : ?>
<div class="user-paging-text"><p><?php $wp_user_search->page_links(); ?></p></div>
<?php endif; ?>
<?php
endif;
?>
<form action="" method="post" name="updateusers" id="updateusers">
<?php wp_nonce_field('bulk-users') ?>
<table class="widefat">
<?php
foreach($roleclasses as $role => $roleclass) {
uksort($roleclass, "strnatcasecmp");
?>
<tbody>
<tr>
<?php if ( !empty($role) ) : ?>
<th colspan="7"><h3><?php echo $wp_roles->role_names[$role]; ?></h3></th>
<?php else : ?>
<th colspan="7"><h3><em><?php _e('No role for this blog'); ?></em></h3></th>
<?php endif; ?>
</tr>
<tr class="thead">
<div class="wrap">
<h2><?php _e('User List by Role'); ?></h2>
<table cellpadding="3" cellspacing="3" width="100%">
<?php
foreach($roleclasses as $role => $roleclass) {
uksort($roleclass, "strnatcasecmp");
?>
<tr>
<th colspan="8" align="left">
<h3><?php echo $wp_roles->role_names[$role]; ?></h3>
</th></tr>
<tr>
<th><?php _e('ID') ?></th>
<th><?php _e('Username') ?></th>
<th><?php _e('Name') ?></th>
<th><?php _e('E-mail') ?></th>
<th><?php _e('Website') ?></th>
<th colspan="2" style="text-align: center"><?php _e('Actions') ?></th>
</tr>
</tbody>
<tbody id="role-<?php echo $role; ?>"><?php
$style = '';
foreach ( (array) $roleclass as $user_object ) {
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
echo "\n\t" . user_row($user_object, $style);
}
?>
</tbody>
<?php } ?>
</table>
<?php if ( $wp_user_search->results_are_paged() ) : ?>
<div class="user-paging-text"><p><?php $wp_user_search->page_links(); ?></p></div>
<?php endif; ?>
<h3><?php _e('Update Selected'); ?></h3>
<ul style="list-style:none;">
<li><input type="radio" name="action" id="action0" value="delete" /> <label for="action0"><?php _e('Delete checked users.'); ?></label></li>
<li>
<input type="radio" name="action" id="action1" value="promote" /> <label for="action1"><?php _e('Set the Role of checked users to:'); ?></label>
<select name="new_role" onchange="getElementById('action1').checked = 'true'"><?php wp_dropdown_roles(); ?></select>
</li>
</ul>
<p class="submit" style="width: 420px">
<?php echo $referer; ?>
<input type="submit" value="<?php _e('Bulk Update &raquo;'); ?>" />
</p>
</form>
<?php endif; ?>
</div>
<th><?php _e('Posts') ?></th>
<th>&nbsp;</th>
</tr>
<?php
$style = '';
foreach ($roleclass as $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).'...';
$style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_object->ID' and post_status = 'publish'");
if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_object->ID' title='" . __('View posts') . "'>$numposts</a>";
echo "
<tr $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>";
echo "<td align='right'>$numposts</td>";
echo '<td>';
if (current_user_can('edit_users'))
echo "<a href='user-edit.php?user_id=$user_object->ID' class='edit'>".__('Edit')."</a>";
echo '</td>';
echo '</tr>';
}
?>
<?php
if ( is_wp_error($add_user_errors) ) {
foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
$var = 'new_' . $var;
$$var = attribute_escape(stripslashes($_POST[$formpost]));
}
unset($name);
}
?>
</table>
<div class="wrap">
<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
<?php if ( is_wp_error( $add_user_errors ) ) : ?>
<div class="error">
<?php
foreach ( $add_user_errors->get_error_messages() as $message )
echo "<p>$message</p>";
?>
</div>
<?php endif; ?>
<div id="ajax-response"></div>
<div class="narrow">
<?php
if ( get_option('users_can_register') )
echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_option('siteurl').'/wp-register.php') . '</p>';
else
echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), get_option('siteurl').'/wp-admin/options-general.php#users_can_register') . '</p>';
?>
<form action="#add-new-user" method="post" name="adduser" id="adduser">
<?php wp_nonce_field('add-user') ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th scope="row" width="33%"><?php _e('Username (required)') ?><input name="action" type="hidden" id="action" value="adduser" /></th>
<td width="66%"><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('First Name') ?> </th>
<td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Last Name') ?> </th>
<td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('E-mail (required)') ?></th>
<td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Website') ?></th>
<td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
</tr>
<?php if ( apply_filters('show_password_fields', true) ) : ?>
<tr>
<th scope="row"><?php _e('Password (twice)') ?> </th>
<td><input name="pass1" type="password" id="pass1" />
<br />
<input name="pass2" type="password" id="pass2" /></td>
</tr>
<?php endif; ?>
<tr>
<th scope="row"><?php _e('Role'); ?></th>
<td><select name="role" id="role">
<?php
if ( !$new_user_role )
$new_user_role = get_option('default_role');
wp_dropdown_roles($new_user_role);
?>
</select>
</td>
</tr>
</table>
<p class="submit">
<?php echo $referer; ?>
<input name="adduser" type="submit" id="addusersub" value="<?php _e('Add User &raquo;') ?>" />
</p>
<h2><?php _e('Update Users'); ?></h2>
<?php
$role_select = '<select name="new_role">';
foreach($wp_roles->role_names as $role => $name) {
$role_select .= "<option value=\"{$role}\">{$name}</option>";
}
$role_select .= '</select>';
?>
<ul style="list-style:none;">
<li><input type="radio" name="action" id="action0" value="delete" /> <label for="action0"><?php _e('Delete checked users.'); ?></label></li>
<li><input type="radio" name="action" id="action1" value="promote" /> <?php echo '<label for="action1">'.__('Set the Role of checked users to:')."</label> $role_select"; ?></li>
</ul>
<p class="submit"><input type="submit" value="<?php _e('Update &raquo;'); ?>" /></p>
</div>
</form>
</div>
</div>
<div class="wrap">
<h2><?php _e('Add New User') ?></h2>
<?php echo '<p>'.sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_settings('siteurl').'/wp-register.php').'</p>'; ?>
<form action="" method="post" name="adduser" id="adduser">
<?php wp_nonce_field('add-user') ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th scope="row" width="33%"><?php _e('Nickname') ?>
<input name="action" type="hidden" id="action" value="adduser" /></th>
<td width="66%"><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('First Name') ?> </th>
<td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Last Name') ?> </th>
<td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('E-mail') ?></th>
<td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
</tr>
<tr>
<th scope="row"><?php _e('Website') ?></th>
<td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
</tr>
<?php
break;
$show_password_fields = apply_filters('show_password_fields', true);
if ( $show_password_fields ) :
?>
<tr>
<th scope="row"><?php _e('Password (twice)') ?> </th>
<td><input name="pass1" type="password" id="pass1" />
<br />
<input name="pass2" type="password" id="pass2" /></td>
</tr>
<?php endif; ?>
</table>
<p class="submit">
<input name="adduser" type="submit" id="adduser" value="<?php _e('Add User') ?> &raquo;" />
</p>
</form>
</div>
<?php
} // end of the $action switch
break;
}
include('admin-footer.php');
?>

View File

@@ -1,40 +0,0 @@
#sbreset, #lastmodule, #palettediv .module, .dropzone, .dropzone ul { float: right; }
* .module, #lastmodule { text-align: right; }
* html #palettediv ul { padding: 0 10px 0 0; }
#palettediv ul { padding: 0 10px 0 0;
margin-left: 1px!important;}
* .handle, #lastmodule span {
border-right: 1px solid #f2f2f2;
border-left: 1px solid #e8e8e8;
}
#sbadmin p.submit {
padding-right: 0;
padding-left: 10px;
clear: right;
}
#palettediv .module, #lastmodule, .dropzone {
margin-right: auto;
margin-left: 10px;
}
* .popper {
right: auto;
left: 3px;
background-position: 5px 0;
}
.controlcloser {
right: auto;
left: 8px;
}
#shadow {
left: auto;
right: 0px;
}

View File

@@ -1,214 +0,0 @@
body {
height: 100%;
}
#sbadmin #zones {
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
}
#sbreset {
float: left;
margin: 1px 0;
}
.dropzone {
float: left;
margin-right: 10px;
padding: 5px;
border: 1px solid #bbb;
background-color: #f0f8ff;
}
.dropzone h3 {
text-align: center;
color: #333;
}
.dropzone ul {
list-style-type: none;
width: 240px;
float: left;
margin: 0;
padding: 0;
}
* .module, #lastmodule {
width: 238px;
padding: 0;
margin: 5px 0;
cursor: move;
display: block;
border: 1px solid #ccc;
background-color: #fbfbfb;
text-align: left;
line-height: 25px;
}
* .handle, #lastmodule span {
display: block;
width: 216px;
padding: 0 10px;
border-top: 1px solid #f2f2f2;
border-right: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
border-left: 1px solid #f2f2f2;
}
* .popper {
margin: 0;
display: inline;
position: absolute;
top: 3px;
right: 3px;
overflow: hidden;
text-align: center;
height: 16px;
font-size: 18px;
line-height: 14px;
cursor: pointer;
padding: 0 3px 1px;
border-top: 4px solid #6da6d1;
background: url( images/fade-butt.png ) -5px 0px;
}
* html .popper {
padding: 1px 6px 0;
font-size: 16px;
}
#sbadmin p.submit {
padding-right: 10px;
clear: left;
}
.placematt {
cursor: default;
margin: 10px 0 0;
padding: 0;
width: 238px;
float:left;
background-color: #ffe;
}
* html .placematt {
margin-top: 5px;
}
.placematt h4 {
text-align: center;
margin-bottom: 5px;
}
.placematt span {
padding: 0 10px 10px;
text-align: justify;
}
#palettediv {
border: 1px solid #bbb;
background-color: #f0f8ff;
height:auto;
margin-top: 10px;
}
#palettediv h3 {
text-align: center;
color: #333;
}
#palettediv ul {
padding: 0 0 0 10px;
}
#palettediv .module, #lastmodule {
margin-right: 10px;
float: left;
width: 120px;
}
#palettediv .handle, #lastmodule span {
height: 40px;
font-size: 90%;
width: 110px;
padding: 0 5px;
}
#palettediv .popper {
visibility: hidden;
}
#lastmodule {
visibility: hidden;
}
* html #palettediv ul {
margin: 0;
padding: 0 0 0 10px;
}
* html #palettediv .module {
float: none;
display: inline;
}
#controls {
height: 0px;
}
.control {
position: absolute;
display: block;
background: #f9fcfe;
padding: 0;
}
.controlhandle {
cursor: move;
background-color: #6da6d1;
border-bottom: 2px solid #448abd;
color: #333;
display: block;
margin: 0 0 5px;
padding: 4px;
font-size: 120%;
}
.controlcloser {
cursor: pointer;
font-size: 120%;
display: block;
position: absolute;
top: 2px;
right: 8px;
padding: 0 3px;
font-weight: bold;
}
.controlform {
margin: 20px 30px;
}
.controlform p {
text-align: center;
}
.control .checkbox {
border: none;
background: transparent;
}
.hidden {
display: none;
}
#shadow {
background: black;
display: none;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
}

View File

@@ -1,392 +0,0 @@
<?php
require_once 'admin.php';
if ( ! current_user_can('switch_themes') )
wp_die( __( 'Cheatin&#8217; uh?' ));
wp_enqueue_script( 'scriptaculous-effects' );
wp_enqueue_script( 'scriptaculous-dragdrop' );
function wp_widgets_admin_head() {
global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls;
define( 'WP_WIDGETS_WIDTH', 1 + 262 * ( count( $wp_registered_sidebars ) ) );
define( 'WP_WIDGETS_HEIGHT', 35 * ( count( $wp_registered_widgets ) ) );
?>
<link rel="stylesheet" href="widgets.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<!--[if IE 7]>
<style type="text/css">
#palette {float:left;}
</style>
<![endif]-->
<style type="text/css">
.dropzone ul { height: <?php echo constant( 'WP_WIDGETS_HEIGHT' ); ?>px; }
#sbadmin #zones { width: <?php echo constant( 'WP_WIDGETS_WIDTH' ); ?>px; }
</style>
<?php
if ( get_bloginfo( 'text_direction' ) == 'rtl' ) {
?>
<link rel="stylesheet" href="widgets-rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<?php
}
$cols = array();
foreach ( $wp_registered_sidebars as $index => $sidebar ) {
$cols[] = '\'' . $index . '\'';
}
$cols = implode( ', ', $cols );
$widgets = array();
foreach ( $wp_registered_widgets as $name => $widget ) {
$widgets[] = '\'' . $widget['id'] . '\'';
}
$widgets = implode( ', ', $widgets );
?>
<script type="text/javascript">
// <![CDATA[
var cols = [<?php echo $cols; ?>];
var widgets = [<?php echo $widgets; ?>];
var controldims = new Array;
<?php foreach ( $wp_registered_widget_controls as $name => $widget ) : ?>
controldims['<?php echo $widget['id']; ?>control'] = new Array;
controldims['<?php echo $widget['id']; ?>control']['width'] = <?php echo (int) $widget['width']; ?>;
controldims['<?php echo $widget['id']; ?>control']['height'] = <?php echo (int) $widget['height']; ?>;
<?php endforeach; ?>
function initWidgets() {
<?php foreach ( $wp_registered_widget_controls as $name => $widget ) : ?>
$('<?php echo $widget['id']; ?>popper').onclick = function() {popControl('<?php echo $widget['id']; ?>control');};
$('<?php echo $widget['id']; ?>closer').onclick = function() {unpopControl('<?php echo $widget['id']; ?>control');};
new Draggable('<?php echo $widget['id']; ?>control', {revert:false,handle:'controlhandle',starteffect:function(){},endeffect:function(){},change:function(o){dragChange(o);}});
if ( true && window.opera )
$('<?php echo $widget['id']; ?>control').style.border = '1px solid #bbb';
<?php endforeach; ?>
if ( true && window.opera )
$('shadow').style.background = 'transparent';
new Effect.Opacity('shadow', {to:0.0});
widgets.map(function(o) {o='widgetprefix-'+o; Position.absolutize(o); Position.relativize(o);} );
$A(Draggables.drags).map(function(o) {o.startDrag(null); o.finishDrag(null);});
//for ( var n in Draggables.drags ) {
for ( n=0; n<=Draggables.drags.length; n++ ) {
if ( parseInt( n ) ) {
if ( Draggables.drags[n].element.id == 'lastmodule' ) {
Draggables.drags[n].destroy();
break;
}
}
}
resetPaletteHeight();
}
function resetDroppableHeights() {
var max = 6;
cols.map(function(o) {var c = $(o).childNodes.length; if ( c > max ) max = c;} );
var height = 35 * ( max + 1);
cols.map(function(o) {h = (($(o).childNodes.length + 1) * 35); $(o).style.height = (h > 280 ? h : 280) + 'px';} );
}
function resetPaletteHeight() {
var p = $('palette'), pd = $('palettediv'), last = $('lastmodule');
p.appendChild(last);
if ( Draggables.activeDraggable && last.id == Draggables.activeDraggable.element.id )
last = last.previousSibling;
var y1 = Position.cumulativeOffset(last)[1] + last.offsetHeight;
var y2 = Position.cumulativeOffset(pd)[1] + pd.offsetHeight;
var dy = y1 - y2;
pd.style.height = (pd.offsetHeight + dy + 9) + "px";
}
function maxHeight(elm) {
htmlheight = document.body.parentNode.clientHeight;
bodyheight = document.body.clientHeight;
var height = htmlheight > bodyheight ? htmlheight : bodyheight;
$(elm).style.height = height + 'px';
}
function dragChange(o) {
el = o.element ? o.element : $(o);
var p = Position.page(el);
var right = p[0];
var top = p[1];
var left = $('shadow').offsetWidth - (el.offsetWidth + right);
var bottom = $('shadow').offsetHeight - (el.offsetHeight + top);
if ( right < 1 ) el.style.left = 0;
if ( top < 1 ) el.style.top = 0;
if ( left < 1 ) el.style.left = (left + right) + 'px';
if ( bottom < 1 ) el.style.top = (top + bottom) + 'px';
}
function popControl(elm) {
el = $(elm);
el.style.width = controldims[elm]['width'] + 'px';
el.style.height = controldims[elm]['height'] + 'px';
var x = ( document.body.clientWidth - controldims[elm]['width'] ) / 2;
var y = ( document.body.parentNode.clientHeight - controldims[elm]['height'] ) / 2;
el.style.position = 'absolute';
el.style.right = '' + x + 'px';
el.style.top = '' + y + 'px';
el.style.zIndex = 1000;
el.className='control';
$('shadow').onclick = function() {unpopControl(elm);};
window.onresize = function(){maxHeight('shadow');dragChange(elm);};
popShadow();
}
function popShadow() {
maxHeight('shadow');
var shadow = $('shadow');
shadow.style.zIndex = 999;
shadow.style.display = 'block';
new Effect.Opacity('shadow', {duration:0.5, from:0.0, to:0.2});
}
function unpopShadow() {
new Effect.Opacity('shadow', {to:0.0});
$('shadow').style.display = 'none';
}
function unpopControl(el) {
$(el).className='hidden';
unpopShadow();
}
function serializeAll() {
<?php foreach ( $wp_registered_sidebars as $index => $sidebar ) : ?>
$('<?php echo $index; ?>order').value = Sortable.serialize('<?php echo $index; ?>');
<?php endforeach; ?>
}
function updateAll() {
resetDroppableHeights();
resetPaletteHeight();
cols.map(function(o){
var pm = $(o+'placematt');
if ( $(o).childNodes.length == 0 ) {
pm.style.display = 'block';
//Position.absolutize(o+'placematt');
} else {
pm.style.display = 'none';
}
});
}
function noSelection(event) {
if ( document.selection ) {
var range = document.selection.createRange();
range.collapse(false);
range.select();
return false;
}
}
addLoadEvent(updateAll);
addLoadEvent(initWidgets);
Event.observe(window, 'resize', resetPaletteHeight);
// ]]>
</script>
<?php
}
add_action( 'admin_head', 'wp_widgets_admin_head' );
do_action( 'sidebar_admin_setup' );
function wp_widget_draggable( $name ) {
global $wp_registered_widgets, $wp_registered_widget_controls;
if ( !isset( $wp_registered_widgets[$name] ) ) {
return;
}
$sanitized_name = sanitize_title( $wp_registered_widgets[$name]['id'] );
$link_title = __( 'Configure' );
$popper = ( isset( $wp_registered_widget_controls[$name] ) )
? ' <div class="popper" id="' . $sanitized_name . 'popper" title="' . $link_title . '">&#8801;</div>'
: '';
$output = '<li class="module" id="widgetprefix-%1$s"><span class="handle">%2$s</span></li>';
printf( $output, $sanitized_name, $wp_registered_widgets[$name]['name'] . $popper );
}
$title = __( 'Widgets' );
$parent_file = 'themes.php';
require_once 'admin-header.php';
if ( count( $wp_registered_sidebars ) < 1 ) {
?>
<div class="wrap">
<h2><?php _e( 'No Sidebars Defined' ); ?></h2>
<p><?php _e( 'You are seeing this message because the theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p>
</div>
<?php
require_once 'admin-footer.php';
exit;
}
$sidebars_widgets = wp_get_sidebars_widgets();
if ( empty( $sidebars_widgets ) ) {
$sidebars_widgets = wp_get_widget_defaults();
}
if ( isset( $_POST['action'] ) ) {
check_admin_referer( 'widgets-save-widget-order' );
switch ( $_POST['action'] ) {
case 'default' :
$sidebars_widgets = wp_get_widget_defaults();
wp_set_sidebars_widgets( $sidebars_widgets );
break;
case 'save_widget_order' :
$sidebars_widgets = array();
foreach ( $wp_registered_sidebars as $index => $sidebar ) {
$postindex = $index . 'order';
parse_str( $_POST[$postindex], $order );
$new_order = $order[$index];
if ( is_array( $new_order ) ) {
foreach ( $new_order as $sanitized_name ) {
foreach ( $wp_registered_widgets as $name => $widget ) {
if ( $sanitized_name == $widget['id'] ) {
$sidebars_widgets[$index][] = $name;
}
}
}
}
}
wp_set_sidebars_widgets( $sidebars_widgets );
break;
}
}
ksort( $wp_registered_widgets );
$inactive_widgets = array();
foreach ( $wp_registered_widgets as $name => $widget ) {
$is_active = false;
foreach ( $wp_registered_sidebars as $index => $sidebar ) {
if ( is_array( $sidebars_widgets[$index] ) && in_array( $name, $sidebars_widgets[$index] ) ) {
$is_active = true;
break;
}
}
if ( !$is_active ) {
$inactive_widgets[] = $name;
}
}
$containers = array( 'palette' );
foreach ( $wp_registered_sidebars as $index => $sidebar ) {
$containers[] = $index;
}
$c_string = '';
foreach ( $containers as $container ) {
$c_string .= '"' . $container . '",';
}
$c_string = substr( $c_string, 0, -1 );
if ( isset( $_POST['action'] ) ) {
?>
<div class="fade updated" id="message">
<p><?php printf( __( 'Sidebar updated. <a href="%s">View site &raquo;</a>' ), get_bloginfo( 'url' ) . '/' ); ?></p>
</div>
<?php
}
?>
<div class="wrap">
<h2><?php _e( 'Sidebar Arrangement' ); ?></h2>
<p><?php _e( 'You can drag and drop widgets onto your sidebar below.' ); ?></p>
<form id="sbadmin" method="post" onsubmit="serializeAll();">
<p class="submit">
<input type="submit" value="<?php _e( 'Save Changes &raquo;' ); ?>" />
</p>
<div id="zones">
<?php
foreach ( $wp_registered_sidebars as $index => $sidebar ) {
?>
<input type="hidden" id="<?php echo $index; ?>order" name="<?php echo $index; ?>order" value="" />
<div class="dropzone">
<h3><?php echo $sidebar['name']; ?></h3>
<div id="<?php echo $index; ?>placematt" class="module placemat">
<span class="handle">
<h4><?php _e( 'Default Sidebar' ); ?></h4>
<?php _e( 'Your theme will display its usual sidebar when this box is empty. Dragging widgets into this box will replace the usual sidebar with your customized sidebar.' ); ?>
</span>
</div>
<ul id="<?php echo $index; ?>">
<?php
if ( is_array( $sidebars_widgets[$index] ) ) {
foreach ( $sidebars_widgets[$index] as $name ) {
wp_widget_draggable( $name );
}
}
?>
</ul>
</div>
<?php
}
?>
<br class="clear" />
</div>
<div id="palettediv">
<h3><?php _e( 'Available Widgets' ); ?></h3>
<ul id="palette">
<?php
foreach ( $inactive_widgets as $name ) {
wp_widget_draggable( $name );
}
?>
<li id="lastmodule"><span></span></li>
</ul>
</div>
<script type="text/javascript">
// <![CDATA[
<?php foreach ( $containers as $container ) { ?>
Sortable.create("<?php echo $container; ?>", {
dropOnEmpty: true, containment: [<?php echo $c_string; ?>],
handle: 'handle', constraint: false, onUpdate: updateAll,
format: /^widgetprefix-(.*)$/
});
<?php } ?>
// ]]>
</script>
<p class="submit">
<?php wp_nonce_field( 'widgets-save-widget-order' ); ?>
<input type="hidden" name="action" id="action" value="save_widget_order" />
<input type="submit" value="<?php _e( 'Save Changes &raquo;' ); ?>" />
</p>
<div id="controls">
<?php foreach ( $wp_registered_widget_controls as $name => $widget ) { ?>
<div class="hidden" id="<?php echo $widget['id']; ?>control">
<span class="controlhandle"><?php echo $widget['name']; ?></span>
<span id="<?php echo $widget['id']; ?>closer" class="controlcloser">&#215;</span>
<div class="controlform">
<?php call_user_func_array( $widget['callback'], $widget['params'] ); ?>
</div>
</div>
<?php } ?>
</div>
</form>
<br class="clear" />
</div>
<div id="shadow"> </div>
<?php do_action( 'sidebar_admin_page' ); ?>
<?php require_once 'admin-footer.php'; ?>

View File

@@ -20,12 +20,6 @@ a.delete:hover {
color: #fff;
}
#devnews h4 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 18px;
font-weight: normal;
}
#planetnews ul {
list-style: none;
margin: 0;
@@ -46,63 +40,6 @@ a.delete:hover {
overflow: hidden;
}
#planetnews cite {
font-size: 11px;
}
#planetnews li .post {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 18px;
display: block;
height: 60px;
overflow: hidden;
}
#planetnews .hidden {
display: none;
}
.readmore {
clear: both;
text-align: right;
margin-right: 5em;
}
.widefat {
width: 100%;
}
.widefat td, .widefat th {
padding: 5px 6px;
}
.widefat th {
text-align: left;
}
.plugins p {
margin: 4px;
padding: 0;
}
.plugins .name {
font-size: 16px;
}
.import-system {
font-size: 16px;
}
thead, .thead {
background: #dfdfdf
}
#import-upload-form {
margin: auto;
background: #eee;
padding: 1em;
}
a.edit, a.delete, a.edit:hover, a.delete:hover {
border-bottom: none;
display: block;
@@ -154,14 +91,17 @@ fieldset legend {
padding: .1em .3em;
}
fieldset span.cat-nest {
display: block;
margin-left: 10px;
}
fieldset.options {
padding: 1em;
}
fieldset.options legend {
font-size: 1.5em;
font-weight: bold;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
}
form, label input {
@@ -170,12 +110,25 @@ form, label input {
}
h2 {
border-bottom: .5em solid #e5f3ff;
border-bottom: .5em solid #f0f8ff;
color: #333;
font: normal 32px/5px serif;
font: normal 30px/5px serif;
margin: 5px 10px;
}
h2 small.quickjump {
display: block;
text-align: right;
}
h2 small.quickjump a {
text-decoration: none;
border-bottom: 0;
font-size: 15px;
background: #f0f8ff;
padding: 5px 10px;
}
img, #footer a {
border: 0;
}
@@ -194,24 +147,25 @@ li, dd {
}
p, li, dl, dd, dt {
line-height: 140%;
line-height: 130%;
}
textarea, input, select {
background: #f4f4f4;
border: 1px solid #b2b2b2;
color: #000;
font: 13px Verdana, Arial, Helvetica, sans-serif;
font: 13px Verdana, Arial, Helvetica, sans-serif;
margin: 1px;
padding: 3px;
}
#uploading {
border-style: none;
padding: 0;
padding: 0px;
margin-bottom: 16px;
height: 18em;
height: 15em;
width: 100%;
/* overflow-y: hidden;*/
}
form#upload th {
@@ -287,19 +241,8 @@ form#upload #post_content {
}
.commentlist li {
border-bottom: 1px solid #ccc;
padding: 1em 1em .2em;
margin: 0;
}
.commentlist li li {
border-bottom: 0px;
padding: 0;
}
.commentlist p {
padding: 0;
margin: 0 0 .8em;
border-bottom: 1px solid #369;
padding: .3em 1em;
}
.clear {
@@ -334,7 +277,7 @@ form#upload #post_content {
font: 12px Georgia, "Times New Roman", Times, serif;
}
.submit input, .submit input:focus, .button, .button:focus {
.submit input, .submit input:focus, .button {
background: url( images/fade-butt.png );
border: 3px double #999;
border-left-color: #ccc;
@@ -350,14 +293,6 @@ form#upload #post_content {
border-top-color: #999;
}
.button, .button:focus {
padding: 0.15em;
}
* html .button {
padding: 0;
}
.submit, .editform th, #postcustomsubmit {
text-align: right;
}
@@ -373,8 +308,6 @@ form#upload #post_content {
.optiontable th {
width: 33%;
text-align: right;
font-size: 1.3em;
font-weight: normal;
}
.unapproved {
@@ -393,20 +326,8 @@ form#upload #post_content {
color: #009ef0;
}
.approve {
display: none;
}
.unapproved .approve {
display: inline;
}
.unapproved .unapprove {
display: none;
}
.updated, .confirm {
background: #CFEBF7 url(images/notice.gif) no-repeat 1em;
.updated {
background: #CFEBF7 url(images/notice.gif) no-repeat 1em ;
border: 1px solid #2580B2;
margin: 1em 5% 10px;
padding: 0 1em 0 3em;
@@ -424,28 +345,15 @@ form#upload #post_content {
border: 1px solid #ccc;
clear: both;
margin: 15px 5%;
padding: 1em;
}
.narrow {
width: 450px;
margin: auto;
}
.narrow p {
line-height: 150%;
padding: .5em 1em;
}
.wrap h2 {
margin: .4em 0 .5em;
margin: .8em 0 .5em;
clear: both;
}
* html .wrap h2 {
margin-top: 1em;
}
table .vers {
table .vers, table .name {
text-align: center;
}
@@ -458,15 +366,14 @@ input.disabled, textarea.disabled {
}
#adminmenu {
background: #83B4D8;
background: #6da6d1;
border-top: 3px solid #448abd;
margin: 0;
padding: .2em .2em .3em 2em;
padding: .2em .2em .2em 2em;
}
#adminmenu .current, #submenu .current {
font-weight: bold;
text-decoration: none;
}
#adminmenu a {
@@ -475,10 +382,10 @@ input.disabled, textarea.disabled {
font-weight: normal;
margin: 0;
padding: 3px 5px;
border-bottom: none;
text-decoration: none;
}
#adminmenu a:hover, #adminmenu a.current {
#adminmenu a:hover, .current {
background: #ddeaf4;
color: #333;
}
@@ -488,28 +395,15 @@ input.disabled, textarea.disabled {
line-height: 200%;
list-style: none;
text-align: center;
white-space: nowrap;
}
#adminmenu a.current {
background: #0d324f;
border-right: 2px solid #4f96c8;
border-top: 1px solid #96c0de;
color: #fff;
padding-bottom: 8px;
}
#submenu, #minisub {
#submenu {
background: #0d324f;
border-bottom: none;
margin: 0;
padding: 3px 2em 0 3em;
}
#minisub {
height: 6px;
}
#submenu .current {
background: #f9fcfe;
border-top: 1px solid #045290;
@@ -521,7 +415,7 @@ input.disabled, textarea.disabled {
border: none;
color: #fff;
font-size: 12px;
padding: .3em .4em .4em;
padding: .3em .4em .33em;
}
#submenu a:hover {
@@ -530,39 +424,43 @@ input.disabled, textarea.disabled {
}
#submenu li {
line-height: 180%;
height: 25px;
line-height: 170%;
}
#categorydiv input, #poststatusdiv input, #commentstatusdiv input, #pingstatusdiv input {
border: none;
}
#postdiv, #titlediv, #guiddiv {
#titlediv, #guiddiv {
margin: 0 8px 0 0;
padding: 0;
padding: 0px;
}
#postdiv {
margin: 0 8px 0 0;
padding: 0px;
}
#postdivrich {
margin: 0;
padding: 0;
margin: 0px;
padding: 0px;
}
#content {
margin: 0;
margin: 0 0 0 0;
width: 100%;
}
#postdivrich #content {
padding: 5px;
line-height: 140%;
}
#titlediv input, #guiddiv input {
margin: 0;
margin: 0px;
width: 100%;
}
#quicktags {
margin-left: -1px;
}
#currenttheme img {
float: left;
border: 1px solid #666;
@@ -571,40 +469,11 @@ input.disabled, textarea.disabled {
width: 300px;
}
input.delete:hover {
#deletepost:hover {
background: #ce0000;
color: #fff;
}
#deletebookmarks:hover {
background: #ce0000;
color: #fff;
}
#postdivrich #quicktags {
background: #f0f0ee;
padding: 0;
border: 1px solid #ccc;
border-bottom: none;
}
#postdiv #quicktags {
padding-right: 6px;
}
#postdivrich #quicktags {
display: none;
}
#quicktags #ed_toolbar {
padding: 0 2px;
}
#ed_toolbar input {
background: #fff url( images/fade-butt.png ) repeat-x 0 -2px;
margin: 3px 2px 2px;
}
#quicktags #ed_strong {
font-weight: bold;
}
@@ -624,12 +493,10 @@ input.delete:hover {
#quicktags #ed_code {
font-family: "Courier New", Courier, mono;
margin-bottom: 3px;
}
#title {
font-size: 1.7em;
padding: 4px 3px;
font-size: 1.5em;
}
#postexcerpt div, #attachmentlinks div {
@@ -647,7 +514,7 @@ input.delete:hover {
}
#excerpt, .attachmentlinks {
margin: 0;
margin: 0px;
height: 4em;
width: 100%;
}
@@ -655,158 +522,61 @@ input.delete:hover {
#footer {
clear: both;
text-align: center;
width: 500px;
margin: auto;
height: 100px;
}
#footer .docs {
padding-top: 19px;
line-height: 160%;
}
#footer .docs a {
text-decoration: underline;
}
#footer .logo {
float: left;
margin: 0;
padding: 0;
}
#login {
position: relative;
background: url('images/login-bkg-tile.gif') no-repeat top center;
color: #fff;
margin: 5em auto 1em;
padding: 20px 0 0;
width: 425px;
_width: 390px;
}
#login form {
background: url('images/login-bkg-bottom.gif') no-repeat bottom center;
padding: 0 50px 25px;
_width: 325px;
_margin: 0 auto;
background: #fff;
border: 1px solid #a2a2a2;
margin: 5em auto;
padding: 1.5em;
width: 25em;
}
#login #login_error {
background: #0e3350;
border: 1px solid #2571ab;
color: #ebcd4e;
font-size: 11px;
background: #c00;
border: 1px solid #a40000;
color: #fff;
font-size: 16px;
font-weight: bold;
padding: .6em;
width: 310px;
margin: 0 50px;
padding: .5em;
text-align: center;
}
#login p {
font-size: 12px;
}
#login p.message {
width: 310px;
margin: 0 auto 1em;
}
#login #login_error a {
color: #ebcd4e;
border-color: #ebcd4e;
}
#login #send {
color: #fff;
text-align: left;
font-weight: normal;
font-size: 1.1em;
_width: 325px;
_margin: 0 auto 15px;
#login h1 {
background: url(images/wordpress-logo.png) no-repeat top left;
margin-top: 0;
}
#login h1 a {
margin: 0 auto;
height: 88px;
width: 320px;
display: block;
text-indent: -1000px;
height: 66px;
border-bottom: none;
text-indent: -9999px;
}
#login .message {
font-size: 10pt;
text-align: center;
}
#login .register {
font-size: 20px;
}
#login input {
padding: 4px;
padding: 3px;
}
.login ul, #protected #login .bottom {
#login ul {
list-style: none;
width: 325px;
margin: 0 auto;
margin: 0;
padding: 0;
line-height: 1.2;
}
.login ul li {
font-size: 11px;
#login ul li {
display: inline;
margin-left: 1.4em;
text-align: center;
}
.login ul li a {
color: #0d324f;
border: none;
}
#login ul li a:hover {
color: #fff;
}
#login .input {
font-size: 1.8em;
margin-top: 3px;
width: 97%;
}
#login p label {
font-size: 11px;
#login #log, #pwd {
font-size: 1.7em;
width: 80%;
}
#login #submit {
margin: 0;
font-size: 15px;
}
.plugins p {
}
#login .fullwidth {
width: 320px;
}
#searchform {
float: left;
margin-right: 1em;
width: 18em;
}
#viewarc {
float: left;
width: 23em;
margin-bottom: 1em;
}
#viewcat {
float: left;
width: 30em;
margin-bottom: 1em;
font-size: 1.7em;
}
#postcustom .updatemeta, #postcustom .deletemeta {
@@ -815,7 +585,7 @@ input.delete:hover {
#postcustom table {
border: 1px solid #ccc;
margin: 0;
margin: 0px;
width: 100%;
}
@@ -836,7 +606,7 @@ input.delete:hover {
}
* html #template div {
margin-right: 0;
margin-right: 0px;
}
#template, #template div, #editcat, #addcat {
@@ -851,10 +621,9 @@ input.delete:hover {
#templateside {
float: right;
width: 170px;
overflow: hidden;
}
#templateside h3, #postcustom p.submit {
#templateside h3, #postcustom p {
margin: 0;
}
@@ -891,7 +660,7 @@ input.delete:hover {
font-weight: normal;
letter-spacing: -.05em;
margin: 0;
font-family: Georgia, "Times New Roman", Times, serif;
font-family: Georgia, "Times New Roman", Times, serif
}
#wphead h1 span {
@@ -901,7 +670,7 @@ input.delete:hover {
#zeitgeist {
background: #eee;
border: 1px solid #c5c5c5;
border: 1px solid #69c;
float: right;
font-size: 90%;
margin-bottom: .5em;
@@ -915,10 +684,6 @@ input.delete:hover {
border-bottom: none;
}
* html #zeitgeist h2 {
padding-top: 10px;
}
#zeitgeist h2 {
margin-top: .4em;
}
@@ -956,44 +721,36 @@ input.delete:hover {
background: #8B8;
}
#namediv, #emaildiv, #uridiv {
float: left;
}
#ajax-response {
padding: .5em;
}
/* A handy div class for hiding controls.
Some browsers will disable them when you
set display:none; */
Some browsers will disable them when you
set display:none; */
.zerosize {
height: 0;
width: 0;
margin: 0;
border: 0;
padding: 0;
height: 0px;
width: 0px;
margin: 0px;
border: 0px;
padding: 0px;
overflow: hidden;
position: absolute;
}
/* Box stuff */
.dbx-clone {
position: absolute;
visibility: hidden;
position:absolute;
visibility:hidden;
}
.dbx-clone, .dbx-clone .dbx-handle-cursor {
cursor: move !important;
cursor:move !important;
}
.dbx-dummy {
display: block;
width: 0;
height: 0;
overflow: hidden;
display:block;
width:0;
height:0;
overflow:hidden;
}
.dbx-group, .dbx-box, .dbx-handle {
position: relative;
display: block;
position:relative;
display:block;
}
#grabit {
@@ -1001,19 +758,19 @@ set display:none; */
}
* html #themeselect {
padding: 0 3px;
padding: 0px 3px;
height: 22px;
}
/****************************************************************
avoid padding, margins or borders on dbx-box,
to reduce visual discrepancies between it and the clone.
overall, dbx-box is best left as visually unstyled as possible
avoid padding, margins or borders on dbx-box,
to reduce visual discrepancies between it and the clone.
overall, dbx-box is best left as visually unstyled as possible
*****************************************************************/
.dbx-box {
margin: 0;
padding: 0;
border: none;
margin:0;
padding:0;
border:none;
}
/* Can change this */
@@ -1021,7 +778,7 @@ overall, dbx-box is best left as visually unstyled as possible
margin-bottom: 1em;
}
#moremeta fieldset div {
margin: 2px 0 0 0;
margin: 2px 0 0 0px;
padding: 7px;
}
#moremeta {
@@ -1050,41 +807,24 @@ overall, dbx-box is best left as visually unstyled as possible
margin-top: .5em;
}
#categorydiv ul {
list-style: none;
padding: 0;
margin-left: 10px;
}
#categorychecklist {
#categorydiv div div {
height: 12em;
overflow: auto;
margin-top: 8px;
}
#categorychecklist li {
margin: 0;
padding: 0;
}
#ajaxcat input {
border: 1px solid #ccc;
}
#your-profile #rich_editing {
border: none;
background: #fff;
}
#your-profile fieldset {
border: 1px solid #ccc;
float: left;
width: 40%;
padding: .5em 2em 1em;
margin: 1em 1em 1em 0;
padding: .5em 2em;
margin: 1em;
}
#your-profile fieldset input {
#your-profile fieldset input {
width: 100%;
font-size: 20px;
padding: 2px;
@@ -1123,7 +863,7 @@ overall, dbx-box is best left as visually unstyled as possible
/* handles */
.dbx-handle {
.dbx-handle {
background: #2685af;
padding: 6px 1em 2px;
font-size: 12px;
@@ -1145,8 +885,6 @@ overall, dbx-box is best left as visually unstyled as possible
margin-left: 7px;
margin-bottom: -7px;
padding: 6px 1em 0 3px;
height: 19px;
font-size: 12px;
background: #2685af url(images/box-head-right.gif) no-repeat top right;
}
@@ -1158,7 +896,7 @@ overall, dbx-box is best left as visually unstyled as possible
#advancedstuff div.dbx-content {
margin-left: 8px;
background: url(images/box-bg-right.gif) repeat-y right;
padding: 10px 10px 15px 0;
padding: 10px 10px 15px 0px;
}
#postexcerpt div.dbx-content {
@@ -1191,29 +929,30 @@ overall, dbx-box is best left as visually unstyled as possible
background: url(images/box-butt-right.gif) no-repeat bottom right;
}
/* handle cursors */
.dbx-handle-cursor {
cursor: move;
}
/* toggle images */
a.dbx-toggle, a.dbx-toggle:visited {
display: block;
display:block;
overflow: hidden;
background-image: url( images/toggle.gif );
position: absolute;
top: 0;
right: 0;
top: 0px;
right: 0px;
background-repeat: no-repeat;
border: 0;
margin: 0;
padding: 0;
border: 0px;
margin: 0px;
padding: 0px;
}
#moremeta a.dbx-toggle, #moremeta a.dbx-toggle-open:visited {
height: 25px;
width: 27px;
background-position: 0 0;
background-position: 0 0px;
}
#moremeta a.dbx-toggle-open, #moremeta a.dbx-toggle-open:visited {
@@ -1250,13 +989,8 @@ a.dbx-toggle, a.dbx-toggle:visited {
filter: alpha(opacity=80);
}
#newcat {
width: 120px;
margin-right: 5px;
}
input #catadd {
background: #a4a4a4;
#newcat { width: 120px; margin-right: 5px; }
input#catadd { background: #a4a4a4;
border-bottom: 1px solid #898989;
border-left: 1px solid #bcbcbc;
border-right: 1px solid #898989;
@@ -1269,73 +1003,13 @@ input #catadd {
height: 20px;
margin-bottom: 2px;
text-align: center;
width: 37px;
}
width: 37px; }
#howto {
font-size: 11px;
margin: 0 5px;
display: block;
}
#jaxcat {
margin: 0;
padding: 0;
}
#ajax-response.alignleft {
margin-left: 2em;
}
#postdivrich #edButtons {
padding-left: 3px;
}
#postdivrich #content, #postdivrich #content:active {
border: 1px solid #ccc;
}
#edButtons input, #edButtons input:active {
margin: 0 2px -1px;
}
#edButtons input.edButtonFore, #edButtons input.edButtonFore:active {
background: #f0f0ee;
border-bottom: 1px solid #f0f0ee;
}
#edButtons input.edButtonBack, #edButtons input.edButtonBack:active {
background: #fff url( images/fade-butt.png ) repeat-x 0 15px;
border-bottom: 1px solid #ccc;
}
.page-numbers {
padding: 4px 7px;
border: 1px solid #fff;
margin-right: 3px;
}
a.page-numbers {
border: 1px solid #ccc;
}
a.page-numbers:hover {
border: 1px solid #999;
}
.page-numbers.current {
border: 1px solid #999;
font-weight: bold;
}
.pagenav span {
font-weight: bold;
margin: 0 6px;
}
a.view-link {
position: absolute;
right: 5%;
margin-right: 220px;
text-decoration:underline;
}
}

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