Wordpress 2.0.2 wordpress-2.0.2
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 2 Nov 2009 23:42:54 +0000 (18:42 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 2 Nov 2009 23:42:54 +0000 (18:42 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
315 files changed:
index.php [new file with mode: 0644]
license.txt [new file with mode: 0644]
readme.html [new file with mode: 0644]
wp-admin/admin-db.php [new file with mode: 0644]
wp-admin/admin-footer.php [new file with mode: 0644]
wp-admin/admin-functions.php [new file with mode: 0644]
wp-admin/admin-header.php [new file with mode: 0644]
wp-admin/admin.php [new file with mode: 0644]
wp-admin/bookmarklet.php [new file with mode: 0644]
wp-admin/cat-js.php [new file with mode: 0644]
wp-admin/categories.php [new file with mode: 0644]
wp-admin/edit-comments.php [new file with mode: 0644]
wp-admin/edit-form-advanced.php [new file with mode: 0644]
wp-admin/edit-form-ajax-cat.php [new file with mode: 0644]
wp-admin/edit-form-comment.php [new file with mode: 0644]
wp-admin/edit-form.php [new file with mode: 0644]
wp-admin/edit-link-form.php [new file with mode: 0644]
wp-admin/edit-page-form.php [new file with mode: 0644]
wp-admin/edit-pages.php [new file with mode: 0644]
wp-admin/edit.php [new file with mode: 0644]
wp-admin/execute-pings.php [new file with mode: 0644]
wp-admin/images/box-bg.gif [new file with mode: 0644]
wp-admin/images/box-butt.gif [new file with mode: 0644]
wp-admin/images/box-head.gif [new file with mode: 0644]
wp-admin/images/browse-happy.gif [new file with mode: 0644]
wp-admin/images/fade-butt.png [new file with mode: 0644]
wp-admin/images/notice.gif [new file with mode: 0644]
wp-admin/images/toggle.gif [new file with mode: 0644]
wp-admin/images/wordpress-logo.png [new file with mode: 0644]
wp-admin/import.php [new file with mode: 0644]
wp-admin/import/b2.php [new file with mode: 0644]
wp-admin/import/blogger.php [new file with mode: 0644]
wp-admin/import/dotclear.php [new file with mode: 0644]
wp-admin/import/greymatter.php [new file with mode: 0644]
wp-admin/import/livejournal.php [new file with mode: 0644]
wp-admin/import/mt.php [new file with mode: 0644]
wp-admin/import/rss.php [new file with mode: 0644]
wp-admin/import/textpattern.php [new file with mode: 0644]
wp-admin/index.php [new file with mode: 0644]
wp-admin/inline-uploading.php [new file with mode: 0644]
wp-admin/install-helper.php [new file with mode: 0644]
wp-admin/install.php [new file with mode: 0644]
wp-admin/link-add.php [new file with mode: 0644]
wp-admin/link-categories.php [new file with mode: 0644]
wp-admin/link-import.php [new file with mode: 0644]
wp-admin/link-manager.php [new file with mode: 0644]
wp-admin/link-parse-opml.php [new file with mode: 0644]
wp-admin/list-manipulation.js [new file with mode: 0644]
wp-admin/list-manipulation.php [new file with mode: 0644]
wp-admin/menu-header.php [new file with mode: 0644]
wp-admin/menu.php [new file with mode: 0644]
wp-admin/moderation.php [new file with mode: 0644]
wp-admin/options-discussion.php [new file with mode: 0644]
wp-admin/options-general.php [new file with mode: 0644]
wp-admin/options-head.php [new file with mode: 0644]
wp-admin/options-misc.php [new file with mode: 0644]
wp-admin/options-permalink.php [new file with mode: 0644]
wp-admin/options-reading.php [new file with mode: 0644]
wp-admin/options-writing.php [new file with mode: 0644]
wp-admin/options.php [new file with mode: 0644]
wp-admin/page-new.php [new file with mode: 0644]
wp-admin/plugin-editor.php [new file with mode: 0644]
wp-admin/plugins.php [new file with mode: 0644]
wp-admin/post.php [new file with mode: 0644]
wp-admin/profile-update.php [new file with mode: 0644]
wp-admin/profile.php [new file with mode: 0644]
wp-admin/setup-config.php [new file with mode: 0644]
wp-admin/sidebar.php [new file with mode: 0644]
wp-admin/templates.php [new file with mode: 0644]
wp-admin/theme-editor.php [new file with mode: 0644]
wp-admin/themes.php [new file with mode: 0644]
wp-admin/update-links.php [new file with mode: 0644]
wp-admin/upgrade-functions.php [new file with mode: 0644]
wp-admin/upgrade-schema.php [new file with mode: 0644]
wp-admin/upgrade.php [new file with mode: 0644]
wp-admin/user-edit.php [new file with mode: 0644]
wp-admin/users.php [new file with mode: 0644]
wp-admin/wp-admin.css [new file with mode: 0644]
wp-admin/xfn.js [new file with mode: 0644]
wp-atom.php [new file with mode: 0644]
wp-blog-header.php [new file with mode: 0644]
wp-comments-post.php [new file with mode: 0644]
wp-commentsrss2.php [new file with mode: 0644]
wp-config-sample.php [new file with mode: 0644]
wp-content/index.php [new file with mode: 0644]
wp-content/plugins/akismet/akismet.php [new file with mode: 0644]
wp-content/plugins/hello.php [new file with mode: 0644]
wp-content/plugins/wp-db-backup.php [new file with mode: 0644]
wp-content/themes/classic/comments-popup.php [new file with mode: 0644]
wp-content/themes/classic/comments.php [new file with mode: 0644]
wp-content/themes/classic/footer.php [new file with mode: 0644]
wp-content/themes/classic/header.php [new file with mode: 0644]
wp-content/themes/classic/index.php [new file with mode: 0644]
wp-content/themes/classic/screenshot.png [new file with mode: 0644]
wp-content/themes/classic/sidebar.php [new file with mode: 0644]
wp-content/themes/classic/style.css [new file with mode: 0644]
wp-content/themes/default/404.php [new file with mode: 0644]
wp-content/themes/default/archive.php [new file with mode: 0644]
wp-content/themes/default/archives.php [new file with mode: 0644]
wp-content/themes/default/attachment.php [new file with mode: 0644]
wp-content/themes/default/comments-popup.php [new file with mode: 0644]
wp-content/themes/default/comments.php [new file with mode: 0644]
wp-content/themes/default/footer.php [new file with mode: 0644]
wp-content/themes/default/functions.php [new file with mode: 0644]
wp-content/themes/default/header.php [new file with mode: 0644]
wp-content/themes/default/images/audio.jpg [new file with mode: 0644]
wp-content/themes/default/images/header-img.php [new file with mode: 0644]
wp-content/themes/default/images/kubrickbg.jpg [new file with mode: 0644]
wp-content/themes/default/images/kubrickbgcolor.jpg [new file with mode: 0644]
wp-content/themes/default/images/kubrickbgwide.jpg [new file with mode: 0644]
wp-content/themes/default/images/kubrickfooter.jpg [new file with mode: 0644]
wp-content/themes/default/images/kubrickheader.jpg [new file with mode: 0644]
wp-content/themes/default/index.php [new file with mode: 0644]
wp-content/themes/default/links.php [new file with mode: 0644]
wp-content/themes/default/page.php [new file with mode: 0644]
wp-content/themes/default/screenshot.png [new file with mode: 0644]
wp-content/themes/default/search.php [new file with mode: 0644]
wp-content/themes/default/searchform.php [new file with mode: 0644]
wp-content/themes/default/sidebar.php [new file with mode: 0644]
wp-content/themes/default/single.php [new file with mode: 0644]
wp-content/themes/default/style.css [new file with mode: 0644]
wp-feed.php [new file with mode: 0644]
wp-includes/cache.php [new file with mode: 0644]
wp-includes/capabilities.php [new file with mode: 0644]
wp-includes/class-IXR.php [new file with mode: 0644]
wp-includes/class-pop3.php [new file with mode: 0644]
wp-includes/class-snoopy.php [new file with mode: 0644]
wp-includes/classes.php [new file with mode: 0644]
wp-includes/comment-functions.php [new file with mode: 0644]
wp-includes/default-filters.php [new file with mode: 0644]
wp-includes/feed-functions.php [new file with mode: 0644]
wp-includes/functions-compat.php [new file with mode: 0644]
wp-includes/functions-formatting.php [new file with mode: 0644]
wp-includes/functions-post.php [new file with mode: 0644]
wp-includes/functions.php [new file with mode: 0644]
wp-includes/gettext.php [new file with mode: 0644]
wp-includes/images/smilies/icon_arrow.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_biggrin.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_confused.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_cool.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_cry.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_eek.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_evil.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_exclaim.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_idea.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_lol.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_mad.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_mrgreen.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_neutral.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_question.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_razz.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_redface.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_rolleyes.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_sad.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_smile.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_surprised.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_twisted.gif [new file with mode: 0644]
wp-includes/images/smilies/icon_wink.gif [new file with mode: 0644]
wp-includes/js/colorpicker.js [new file with mode: 0644]
wp-includes/js/dbx-key.js [new file with mode: 0644]
wp-includes/js/dbx.js [new file with mode: 0644]
wp-includes/js/fat.js [new file with mode: 0644]
wp-includes/js/quicktags.js [new file with mode: 0644]
wp-includes/js/tinymce/blank.htm [new file with mode: 0644]
wp-includes/js/tinymce/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/license.html [new file with mode: 0644]
wp-includes/js/tinymce/license.txt [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/langs/cs.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/langs/sv.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/autosave/readme.txt [new file with mode: 0644]
wp-includes/js/tinymce/plugins/directionality/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/directionality/images/ltr.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/directionality/images/rtl.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/directionality/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/inlinepopups/readme.txt [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/images/help.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/images/more.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/images/page.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/wordpress.css [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wphelp/images/help.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wphelp/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/about.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/anchor.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/charmap.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/color_picker.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/css/editor_content.css [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/css/editor_popup.css [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/css/editor_ui.css [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/editor_template.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/editor_template_src.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/image.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/anchor.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/anchor_symbol.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/backcolor.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/bold.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/bold_de_se.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/bold_fr.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/bold_ru.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/browse.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/bullist.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/buttons.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/cancel_button_bg.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/center.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/charmap.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/cleanup.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/close.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/code.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/color.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/copy.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/custom_1.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/cut.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/forecolor.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/full.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/hr.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/image.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/indent.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/insert_button_bg.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/italic.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/italic_de_se.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/italic_ru.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/left.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/link.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/newdocument.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/numlist.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/outdent.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/paste.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/redo.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/removeformat.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/right.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/spacer.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/statusbar_resize.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/strikethrough.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/sub.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/sup.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_delete_col.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_delete_row.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_insert_col_after.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_insert_col_before.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_insert_row_after.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/table_insert_row_before.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/underline.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/underline_fr.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/underline_ru.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/undo.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/unlink.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/visualaid.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/xp/tab_bg.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/xp/tab_end.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_bg.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/xp/tab_sel_end.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/images/xp/tabs_bg.gif [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/about.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/anchor.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/image.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/link.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/langs/en.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/link.htm [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/source_editor.htm [new file with mode: 0644]
wp-includes/js/tinymce/tiny_mce.js [new file with mode: 0644]
wp-includes/js/tinymce/tiny_mce_gzip.php [new file with mode: 0644]
wp-includes/js/tinymce/tiny_mce_popup.js [new file with mode: 0644]
wp-includes/js/tinymce/utils/form_utils.js [new file with mode: 0644]
wp-includes/js/tinymce/utils/mctabs.js [new file with mode: 0644]
wp-includes/js/tinymce/utils/validate.js [new file with mode: 0644]
wp-includes/js/tinymce/wp-mce-help.php [new file with mode: 0644]
wp-includes/js/tw-sack.js [new file with mode: 0644]
wp-includes/kses.php [new file with mode: 0644]
wp-includes/links.php [new file with mode: 0644]
wp-includes/locale.php [new file with mode: 0644]
wp-includes/pluggable-functions.php [new file with mode: 0644]
wp-includes/registration-functions.php [new file with mode: 0644]
wp-includes/rss-functions.php [new file with mode: 0644]
wp-includes/streams.php [new file with mode: 0644]
wp-includes/template-functions-author.php [new file with mode: 0644]
wp-includes/template-functions-category.php [new file with mode: 0644]
wp-includes/template-functions-general.php [new file with mode: 0644]
wp-includes/template-functions-links.php [new file with mode: 0644]
wp-includes/template-functions-post.php [new file with mode: 0644]
wp-includes/template-loader.php [new file with mode: 0644]
wp-includes/vars.php [new file with mode: 0644]
wp-includes/version.php [new file with mode: 0644]
wp-includes/wp-db.php [new file with mode: 0644]
wp-includes/wp-l10n.php [new file with mode: 0644]
wp-links-opml.php [new file with mode: 0644]
wp-login.php [new file with mode: 0644]
wp-mail.php [new file with mode: 0644]
wp-pass.php [new file with mode: 0644]
wp-rdf.php [new file with mode: 0644]
wp-register.php [new file with mode: 0644]
wp-rss.php [new file with mode: 0644]
wp-rss2.php [new file with mode: 0644]
wp-settings.php [new file with mode: 0644]
wp-trackback.php [new file with mode: 0644]
xmlrpc.php [new file with mode: 0644]

diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..3e3db40
--- /dev/null
+++ b/index.php
@@ -0,0 +1,5 @@
+<?php 
+/* Short and sweet */
+define('WP_USE_THEMES', true);
+require('./wp-blog-header.php');
+?>
\ No newline at end of file
diff --git a/license.txt b/license.txt
new file mode 100644 (file)
index 0000000..8882205
--- /dev/null
@@ -0,0 +1,280 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+
diff --git a/readme.html b/readme.html
new file mode 100644 (file)
index 0000000..2a63016
--- /dev/null
@@ -0,0 +1,120 @@
+<!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" />
+<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 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>
+
+<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>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><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.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>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>
+       <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>
+       <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>
+       <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>
+       <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 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 id="requirements">System Recommendations</h1>
+<ul>
+       <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>
+
+<h1>Upgrading from another system</h1>
+<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 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>
+<h1 id="roles">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>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>
+
+<h1>Share the Love</h1>
+<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.</p>
+
+<h1>Copyright</h1>
+<p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr> (see <a href="license.txt">license.txt</a>).</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php
new file mode 100644 (file)
index 0000000..bf8692a
--- /dev/null
@@ -0,0 +1,349 @@
+<?php
+
+function get_users_drafts( $user_id ) {
+       global $wpdb;
+       $user_id = (int) $user_id;
+       $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 );
+}
+
+function get_others_drafts( $user_id ) {
+       global $wpdb;
+       $user = get_userdata( $user_id );
+       $level_key = $wpdb->prefix . 'user_level';
+
+       $editable = get_editable_user_ids( $user_id );
+       
+       if( !$editable ) {
+               $other_drafts = '';
+       } else {
+               $editable = join(',', $editable);
+               $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
+       }
+
+       return apply_filters('get_others_drafts', $other_drafts);
+}
+
+function get_editable_authors( $user_id ) {
+       global $wpdb;
+
+       $editable = get_editable_user_ids( $user_id );
+
+       if( !$editable ) {
+               return false;
+       } else {
+               $editable = join(',', $editable);
+               $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable)" );
+       }
+
+       return apply_filters('get_editable_authors', $authors);
+}
+
+function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
+       global $wpdb;
+       
+       $user = new WP_User( $user_id );
+       
+       if ( ! $user->has_cap('edit_others_posts') ) {
+               if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
+                       return array($user->id);
+               else 
+                       return false;
+       }
+
+       $level_key = $wpdb->prefix . 'user_level';
+
+       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
+       if ( $exclude_zeros )
+               $query .= " AND meta_value != '0'";
+               
+       return $wpdb->get_col( $query );
+}
+
+function get_author_user_ids() {
+       global $wpdb;
+       $level_key = $wpdb->prefix . 'user_level';
+
+       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
+
+       return $wpdb->get_col( $query );
+}
+
+function get_nonauthor_user_ids() {
+       global $wpdb;
+       $level_key = $wpdb->prefix . 'user_level';
+
+       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
+
+       return $wpdb->get_col( $query );
+}
+
+function wp_insert_category($catarr) {
+       global $wpdb;
+
+       extract($catarr);
+
+       $cat_ID = (int) $cat_ID;
+
+       // Are we updating or creating?
+       if (!empty ($cat_ID))
+               $update = true;
+       else
+               $update = false;
+
+       $cat_name = wp_specialchars($cat_name);
+
+       if (empty ($category_nicename))
+               $category_nicename = sanitize_title($cat_name);
+       else
+               $category_nicename = sanitize_title($category_nicename);
+
+       if (empty ($category_description))
+               $category_description = '';
+
+       if (empty ($category_parent))
+               $category_parent = 0;
+
+       if (!$update) {
+               $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' 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'" );
+       }
+
+       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);
+       }
+
+       return $cat_ID;
+}
+
+function wp_update_category($catarr) {
+       global $wpdb;
+
+       $cat_ID = (int) $catarr['cat_ID'];
+
+       // First, get all of the original fields
+       $category = get_category($cat_ID, ARRAY_A);
+
+       // Escape data pulled from DB.
+       $category = add_magic_quotes($category);
+
+       // Merge old and new fields with new fields overwriting old ones.
+       $catarr = array_merge($category, $catarr);
+
+       return wp_insert_category($catarr);
+}
+
+function wp_delete_category($cat_ID) {
+       global $wpdb;
+
+       $cat_ID = (int) $cat_ID;
+
+       // Don't delete the default cat.
+       if (1 == $cat_ID)
+               return 0;
+
+       $category = get_category($cat_ID);
+
+       $parent = $category->category_parent;
+
+       // Delete the category.
+       $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+
+       // Update children to point to new parent.
+       $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
+
+       // TODO: Only set categories to general if they're not in another category already
+       $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
+
+       wp_cache_delete($cat_ID, 'category');
+       wp_cache_delete('all_category_ids', 'category');
+
+       do_action('delete_category', $cat_ID);
+
+       return 1;
+}
+
+function wp_create_category($cat_name) {
+       $cat_array = compact('cat_name');
+       return wp_insert_category($cat_array);
+}
+
+function wp_create_categories($categories, $post_id = '') {
+       $cat_ids = array ();
+       foreach ($categories as $category) {
+               if ($id = category_exists($category))
+                       $cat_ids[] = $id;
+               else
+                       if ($id = wp_create_category($category))
+                               $cat_ids[] = $id;
+       }
+
+       if ($post_id)
+               wp_set_post_cats('', $post_id, $cat_ids);
+
+       return $cat_ids;
+}
+
+function category_exists($cat_name) {
+       global $wpdb;
+       if (!$category_nicename = sanitize_title($cat_name))
+               return 0;
+
+       return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
+}
+
+function wp_delete_user($id, $reassign = 'novalue') {
+       global $wpdb;
+
+       $id = (int) $id;
+       $user = get_userdata($id);
+
+       if ($reassign == 'novalue') {
+               $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
+
+               if ($post_ids) {
+                       foreach ($post_ids as $post_id)
+                               wp_delete_post($post_id);
+               }
+
+               // Clean links
+               $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
+       } else {
+               $reassign = (int) $reassign;
+               $wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
+               $wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
+       }
+
+       // FINALLY, delete user
+       $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 get_link($link_id, $output = OBJECT) {
+       global $wpdb;
+       
+       $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
+
+       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);
+
+       $update = false;
+       if ( !empty($link_id) )
+               $update = true;
+
+       if ( empty($link_rating) )
+               $link_rating = 0;       
+
+       if ( empty($link_target) )
+               $link_target = '';      
+
+       if ( empty($link_visible) )
+               $link_visible = 'Y';
+               
+       if ( empty($link_owner) )
+               $link_owner = $current_user->id;
+
+       if ( empty($link_notes) )
+               $link_notes = '';
+
+       if ( $update ) {
+               $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
+                       link_name='$link_name', link_image='$link_image',
+                       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_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;
+       }
+       
+       if ( $update )
+               do_action('edit_link', $link_id);
+       else
+               do_action('add_link', $link_id);
+
+       return $link_id;
+}
+
+function wp_update_link($linkdata) {
+       global $wpdb;
+
+       $link_id = (int) $linkdata['link_id'];
+       
+       $link = get_link($link_id, ARRAY_A);
+       
+       // Escape data pulled from DB.
+       $link = add_magic_quotes($link);
+       
+       // Merge old and new fields with new fields overwriting old ones.
+       $linkdata = array_merge($link, $linkdata);
+
+       return wp_insert_link($linkdata);
+}
+
+function wp_delete_link($link_id) {
+       global $wpdb;
+
+       do_action('delete_link', $link_id);
+       return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");     
+}
+
+function post_exists($title, $content = '', $post_date = '') {
+       global $wpdb;
+
+       if (!empty ($post_date))
+               $post_date = "AND post_date = '$post_date'";
+
+       if (!empty ($title))
+               return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
+       else
+               if (!empty ($content))
+                       return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
+
+       return 0;
+}
+
+function comment_exists($comment_author, $comment_date) {
+       global $wpdb;
+
+       return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
+                       WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
+}
+
+?>
diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php
new file mode 100644 (file)
index 0000000..e660be2
--- /dev/null
@@ -0,0 +1,19 @@
+
+<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'), number_format(timer_stop(), 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>
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
new file mode 100644 (file)
index 0000000..6afef35
--- /dev/null
@@ -0,0 +1,1889 @@
+<?php
+
+// Creates a new post from the "Write Post" form using $_POST information.
+function write_post() {
+       global $user_ID;
+
+       if (!current_user_can('edit_posts'))
+               die(__('You are not allowed to create posts or drafts on this blog.'));
+
+       // Rename.
+       $_POST['post_content'] = $_POST['content'];
+       $_POST['post_excerpt'] = $_POST['excerpt'];
+       $_POST['post_parent'] = $_POST['parent_id'];
+       $_POST['to_ping'] = $_POST['trackback_url'];
+
+       if (!empty ($_POST['post_author_override'])) {
+               $_POST['post_author'] = (int) $_POST['post_author_override'];
+       } else
+               if (!empty ($_POST['post_author'])) {
+                       $_POST['post_author'] = (int) $_POST['post_author'];
+               } else {
+                       $_POST['post_author'] = (int) $_POST['user_ID'];
+               }
+
+       if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
+               die(__('You cannot post as this user.'));
+
+       // What to do based on which button they pressed
+       if ('' != $_POST['saveasdraft'])
+               $_POST['post_status'] = 'draft';
+       if ('' != $_POST['saveasprivate'])
+               $_POST['post_status'] = 'private';
+       if ('' != $_POST['publish'])
+               $_POST['post_status'] = 'publish';
+       if ('' != $_POST['advanced'])
+               $_POST['post_status'] = 'draft';
+       if ('' != $_POST['savepage'])
+               $_POST['post_status'] = 'static';
+
+       if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
+               $_POST['post_status'] = 'draft';
+
+       if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
+               die(__('This user cannot edit pages.'));
+
+       if (!isset ($_POST['comment_status']))
+               $_POST['comment_status'] = 'closed';
+
+       if (!isset ($_POST['ping_status']))
+               $_POST['ping_status'] = 'closed';
+
+       if (!empty ($_POST['edit_date'])) {
+               $aa = $_POST['aa'];
+               $mm = $_POST['mm'];
+               $jj = $_POST['jj'];
+               $hh = $_POST['hh'];
+               $mn = $_POST['mn'];
+               $ss = $_POST['ss'];
+               $jj = ($jj > 31) ? 31 : $jj;
+               $hh = ($hh > 23) ? $hh -24 : $hh;
+               $mn = ($mn > 59) ? $mn -60 : $mn;
+               $ss = ($ss > 59) ? $ss -60 : $ss;
+               $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+               $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
+       }
+
+       // Create the post.
+       $post_ID = wp_insert_post($_POST);
+       add_meta($post_ID);
+
+       // Reunite any orphaned attachments with their parent
+       if ( $_POST['temp_ID'] )
+               relocate_children($_POST['temp_ID'], $post_ID);
+
+       // Now that we have an ID we can fix any attachment anchor hrefs
+       fix_attachment_links($post_ID);
+
+       return $post_ID;
+}
+
+// Move child posts to a new parent
+function relocate_children($old_ID, $new_ID) {
+       global $wpdb;
+       $old_ID = (int) $old_ID;
+       $new_ID = (int) $new_ID;
+       return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID");
+}
+
+// Replace hrefs of attachment anchors with up-to-date permalinks.
+function fix_attachment_links($post_ID) {
+       global $wp_rewrite;
+
+       $post = & get_post($post_ID, ARRAY_A);
+
+       $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
+
+       // See if we have any rel="attachment" links
+       if ( 0 == preg_match_all($search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER) )
+               return;
+
+       $i = 0;
+       $search = "# id=(\"|')p(\d+)\\1#i";
+       foreach ( $anchor_matches[0] as $anchor ) {
+               if ( 0 == preg_match($search, $anchor, $id_matches) )
+                       continue;
+
+               $id = $id_matches[2];
+
+               // While we have the attachment ID, let's adopt any orphans.
+               $attachment = & get_post($id, ARRAY_A);
+               if ( ! empty($attachment) && ! is_object(get_post($attachment['post_parent'])) ) {
+                       $attachment['post_parent'] = $post_ID;
+                       // Escape data pulled from DB.
+                       $attachment = add_magic_quotes($attachment);
+                       wp_update_post($attachment);
+               }
+
+               $post_search[$i] = $anchor;
+               $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
+               ++$i;
+       }
+
+       $post['post_content'] = str_replace($post_search, $post_replace, $post['post_content']);
+
+       // Escape data pulled from DB.
+       $post = add_magic_quotes($post);
+
+       return wp_update_post($post);
+}
+
+// Update an existing post with values provided in $_POST.
+function edit_post() {
+       global $user_ID;
+
+       $post_ID = (int) $_POST['post_ID'];
+
+       if (!current_user_can('edit_post', $post_ID))
+               die(__('You are not allowed to edit this post.'));
+
+       // Rename.
+       $_POST['ID'] = (int) $_POST['post_ID'];
+       $_POST['post_content'] = $_POST['content'];
+       $_POST['post_excerpt'] = $_POST['excerpt'];
+       $_POST['post_parent'] = $_POST['parent_id'];
+       $_POST['to_ping'] = $_POST['trackback_url'];
+
+       if (!empty ($_POST['post_author_override'])) {
+               $_POST['post_author'] = (int) $_POST['post_author_override'];
+       } else
+               if (!empty ($_POST['post_author'])) {
+                       $_POST['post_author'] = (int) $_POST['post_author'];
+               } else {
+                       $_POST['post_author'] = (int) $_POST['user_ID'];
+               }
+
+       if (($_POST['post_author'] != $_POST['user_ID']) && !current_user_can('edit_others_posts'))
+               die(__('You cannot post as this user.'));
+
+       // What to do based on which button they pressed
+       if ('' != $_POST['saveasdraft'])
+               $_POST['post_status'] = 'draft';
+       if ('' != $_POST['saveasprivate'])
+               $_POST['post_status'] = 'private';
+       if ('' != $_POST['publish'])
+               $_POST['post_status'] = 'publish';
+       if ('' != $_POST['advanced'])
+               $_POST['post_status'] = 'draft';
+       if ('' != $_POST['savepage'])
+               $_POST['post_status'] = 'static';
+
+       if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
+               $_POST['post_status'] = 'draft';
+
+       if ('static' == $_POST['post_status'] && !current_user_can('edit_pages'))
+               die(__('This user cannot edit pages.'));
+
+       if (!isset ($_POST['comment_status']))
+               $_POST['comment_status'] = 'closed';
+
+       if (!isset ($_POST['ping_status']))
+               $_POST['ping_status'] = 'closed';
+
+       if (!empty ($_POST['edit_date'])) {
+               $aa = $_POST['aa'];
+               $mm = $_POST['mm'];
+               $jj = $_POST['jj'];
+               $hh = $_POST['hh'];
+               $mn = $_POST['mn'];
+               $ss = $_POST['ss'];
+               $jj = ($jj > 31) ? 31 : $jj;
+               $hh = ($hh > 23) ? $hh -24 : $hh;
+               $mn = ($mn > 59) ? $mn -60 : $mn;
+               $ss = ($ss > 59) ? $ss -60 : $ss;
+               $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+               $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
+       }
+
+       // Meta Stuff
+       if ($_POST['meta']) {
+               foreach ($_POST['meta'] as $key => $value)
+                       update_meta($key, $value['key'], $value['value']);
+       }
+       
+       if ($_POST['deletemeta']) {
+               foreach ($_POST['deletemeta'] as $key => $value)
+                       delete_meta($key);
+       }
+
+       add_meta($post_ID);
+
+       wp_update_post($_POST);
+
+       // Now that we have an ID we can fix any attachment anchor hrefs
+       fix_attachment_links($post_ID);
+
+       return $post_ID;
+}
+
+function edit_comment() {
+       global $user_ID;
+
+       $comment_ID = (int) $_POST['comment_ID'];
+       $comment_post_ID = (int) $_POST['comment_post_ID'];
+
+       if (!current_user_can('edit_post', $comment_post_ID))
+               die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
+
+       $_POST['comment_author'] = $_POST['newcomment_author'];
+       $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
+       $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
+       $_POST['comment_approved'] = $_POST['comment_status'];
+       $_POST['comment_content'] = $_POST['content'];
+       $_POST['comment_ID'] = (int) $_POST['comment_ID'];
+
+       if (!empty ($_POST['edit_date'])) {
+               $aa = $_POST['aa'];
+               $mm = $_POST['mm'];
+               $jj = $_POST['jj'];
+               $hh = $_POST['hh'];
+               $mn = $_POST['mn'];
+               $ss = $_POST['ss'];
+               $jj = ($jj > 31) ? 31 : $jj;
+               $hh = ($hh > 23) ? $hh -24 : $hh;
+               $mn = ($mn > 59) ? $mn -60 : $mn;
+               $ss = ($ss > 59) ? $ss -60 : $ss;
+               $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+       }
+
+       wp_update_comment($_POST);
+}
+
+// Get an existing post and format it for editing.
+function get_post_to_edit($id) {
+       global $richedit;
+       $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
+
+       $post = get_post($id);
+
+       $post->post_content = format_to_edit($post->post_content, $richedit);
+       $post->post_content = apply_filters('content_edit_pre', $post->post_content);
+
+       $post->post_excerpt = format_to_edit($post->post_excerpt);
+       $post->post_excerpt = apply_filters('excerpt_edit_pre', $post->post_excerpt);
+
+       $post->post_title = format_to_edit($post->post_title);
+       $post->post_title = apply_filters('title_edit_pre', $post->post_title);
+
+       if ($post->post_status == 'static')
+               $post->page_template = get_post_meta($id, '_wp_page_template', true);
+
+       return $post;
+}
+
+// Default post information to use when populating the "Write Post" form.
+function get_default_post_to_edit() {
+       if ( !empty($_REQUEST['post_title']) )
+               $post_title = wp_specialchars(stripslashes($_REQUEST['post_title']));
+       else if ( !empty($_REQUEST['popuptitle']) ) {
+               $post_title = wp_specialchars(stripslashes($_REQUEST['popuptitle']));
+               $post_title = funky_javascript_fix($post_title);
+       } else {
+               $post_title = '';
+       }
+
+       if ( !empty($_REQUEST['content']) )
+               $post_content = wp_specialchars(stripslashes($_REQUEST['content']));
+       else if ( !empty($post_title) ) {
+               $text       = wp_specialchars(stripslashes(urldecode($_REQUEST['text'])));
+               $text       = funky_javascript_fix($text);
+               $popupurl   = wp_specialchars($_REQUEST['popupurl']);
+        $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
+    }
+
+       if ( !empty($_REQUEST['excerpt']) )
+               $post_excerpt = wp_specialchars(stripslashes($_REQUEST['excerpt']));
+       else
+               $post_excerpt = '';
+
+       $post->post_status = 'draft';
+       $post->comment_status = get_settings('default_comment_status');
+       $post->ping_status = get_settings('default_ping_status');
+       $post->post_pingback = get_settings('default_pingback_flag');
+       $post->post_category = get_settings('default_category');
+       $post->post_content = apply_filters('default_content', $post_content);
+       $post->post_title = apply_filters('default_title', $post_title);
+       $post->post_excerpt = apply_filters('default_excerpt', $post_excerpt);
+       $post->page_template = 'default';
+       $post->post_parent = 0;
+       $post->menu_order = 0;
+
+       return $post;
+}
+
+function get_comment_to_edit($id) {
+       global $richedit;
+       $richedit = ( 'true' == get_user_option('rich_editing') ) ? true : false;
+
+       $comment = get_comment($id);
+
+       $comment->comment_content = format_to_edit($comment->comment_content, $richedit);
+       $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
+
+       $comment->comment_author = format_to_edit($comment->comment_author);
+       $comment->comment_author_email = format_to_edit($comment->comment_author_email);
+       $comment->comment_author_url = format_to_edit($comment->comment_author_url);
+
+       return $comment;
+}
+
+function get_category_to_edit($id) {
+       $category = get_category($id);
+
+       return $category;
+}
+
+// Creates a new user from the "Users" form using $_POST information.
+
+function add_user() {
+       return edit_user();
+}
+
+function edit_user($user_id = 0) {
+       global $current_user, $wp_roles, $wpdb;
+
+       if ($user_id != 0) {
+               $update = true;
+               $user->ID = $user_id;
+               $userdata = get_userdata($user_id);
+               $user->user_login = $wpdb->escape($userdata->user_login);
+       } else {
+               $update = false;
+               $user = '';
+       }
+
+       if (isset ($_POST['user_login']))
+               $user->user_login = wp_specialchars(trim($_POST['user_login']));
+
+       $pass1 = $pass2 = '';
+       if (isset ($_POST['pass1']))
+               $pass1 = $_POST['pass1'];
+       if (isset ($_POST['pass2']))
+               $pass2 = $_POST['pass2'];
+
+       if (isset ($_POST['role'])) {
+               if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
+                       $user->role = $_POST['role'];
+       }
+
+       if (isset ($_POST['email']))
+               $user->user_email = wp_specialchars(trim($_POST['email']));
+       if (isset ($_POST['url'])) {
+               $user->user_url = wp_specialchars(trim($_POST['url']));
+               $user->user_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
+       }
+       if (isset ($_POST['first_name']))
+               $user->first_name = wp_specialchars(trim($_POST['first_name']));
+       if (isset ($_POST['last_name']))
+               $user->last_name = wp_specialchars(trim($_POST['last_name']));
+       if (isset ($_POST['nickname']))
+               $user->nickname = wp_specialchars(trim($_POST['nickname']));
+       if (isset ($_POST['display_name']))
+               $user->display_name = wp_specialchars(trim($_POST['display_name']));
+       if (isset ($_POST['description']))
+               $user->description = wp_specialchars(trim($_POST['description']));
+       if (isset ($_POST['jabber']))
+               $user->jabber = wp_specialchars(trim($_POST['jabber']));
+       if (isset ($_POST['aim']))
+               $user->aim = wp_specialchars(trim($_POST['aim']));
+       if (isset ($_POST['yim']))
+               $user->yim = wp_specialchars(trim($_POST['yim']));
+
+       $errors = array ();
+
+       /* checking that username has been typed */
+       if ($user->user_login == '')
+               $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
+
+       /* checking the password has been typed twice */
+       do_action('check_passwords', array ($user->user_login, & $pass1, & $pass2));
+
+       if (!$update) {
+               if ($pass1 == '' || $pass2 == '')
+                       $errors['pass'] = __('<strong>ERROR</strong>: Please enter your password twice.');
+       } else {
+               if ((empty ($pass1) && !empty ($pass2)) || (empty ($pass2) && !empty ($pass1)))
+                       $errors['pass'] = __("<strong>ERROR</strong>: you typed your new password only once.");
+       }
+
+       /* Check for "\" in password */
+       if( strpos( " ".$pass1, "\\" ) )
+               $errors['pass'] = __('<strong>ERROR</strong>: Passwords may not contain the character "\\".');
+
+       /* checking the password has been typed twice the same */
+       if ($pass1 != $pass2)
+               $errors['pass'] = __('<strong>ERROR</strong>: Please type the same password in the two password fields.');
+
+       if (!empty ($pass1))
+               $user->user_pass = $pass1;
+
+       if ( !validate_username($user->user_login) )
+               $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.');
+
+       if (!$update && username_exists($user->user_login))
+               $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
+
+       /* checking e-mail address */
+       if (empty ($user->user_email)) {
+               $errors['user_email'] = __("<strong>ERROR</strong>: please type an e-mail address");
+       } else
+               if (!is_email($user->user_email)) {
+                       $errors['user_email'] = __("<strong>ERROR</strong>: the email address isn't correct");
+               }
+
+       if (count($errors) != 0)
+               return $errors;
+
+       if ($update) {
+               $user_id = wp_update_user(get_object_vars($user));
+       } else {
+               $user_id = wp_insert_user(get_object_vars($user));
+               wp_new_user_notification($user_id);
+       }
+
+       return $errors;
+}
+
+
+function get_link_to_edit($link_id) {
+       $link = get_link($link_id);
+       
+       $link->link_url = wp_specialchars($link->link_url, 1);
+       $link->link_name = wp_specialchars($link->link_name, 1);
+       $link->link_description = wp_specialchars($link->link_description);
+       $link->link_notes = wp_specialchars($link->link_notes);
+       $link->link_rss = wp_specialchars($link->link_rss);
+       
+       return $link;
+}
+
+function get_default_link_to_edit() {
+       if ( isset($_GET['linkurl']) )
+               $link->link_url = wp_specialchars($_GET['linkurl'], 1);
+       else
+               $link->link_url = '';
+       
+       if ( isset($_GET['name']) )
+               $link->link_name = wp_specialchars($_GET['name'], 1);
+       else
+               $link->link_name = '';
+               
+       return $link;
+}
+
+function add_link() {
+       return edit_link();     
+}
+
+function edit_link($link_id = '') {
+       if (!current_user_can('manage_links'))
+               die(__("Cheatin' uh ?"));
+
+       $_POST['link_url'] = wp_specialchars($_POST['link_url']);
+       $_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
+       $_POST['link_name'] = wp_specialchars($_POST['link_name']);
+       $_POST['link_image'] = wp_specialchars($_POST['link_image']);
+       $_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
+       $auto_toggle = get_autotoggle($_POST['link_category']);
+       
+       // if we are in an auto toggle category and this one is visible then we
+       // need to make the others invisible before we add this new one.
+       // FIXME Add category toggle func.
+       //if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
+       //      $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
+       //}
+
+       if ( !empty($link_id) ) {
+               $_POST['link_id'] = $link_id;
+               return wp_update_link($_POST);
+       } else {
+               return wp_insert_link($_POST);
+       }
+}
+
+function url_shorten($url) {
+       $short_url = str_replace('http://', '', stripslashes($url));
+       $short_url = str_replace('www.', '', $short_url);
+       if ('/' == substr($short_url, -1))
+               $short_url = substr($short_url, 0, -1);
+       if (strlen($short_url) > 35)
+               $short_url = substr($short_url, 0, 32).'...';
+       return $short_url;
+}
+
+function selected($selected, $current) {
+       if ($selected == $current)
+               echo ' selected="selected"';
+}
+
+function checked($checked, $current) {
+       if ($checked == $current)
+               echo ' checked="checked"';
+}
+
+function return_categories_list($parent = 0) {
+       global $wpdb;
+       return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC LIMIT 100");
+}
+
+function sort_cats($cat1, $cat2) {
+       return strcasecmp($cat1['cat_name'], $cat2['cat_name']);
+}
+
+function get_nested_categories($default = 0, $parent = 0) {
+       global $post_ID, $mode, $wpdb;
+
+       if ($post_ID) {
+               $checked_categories = $wpdb->get_col("
+                    SELECT category_id
+                    FROM $wpdb->categories, $wpdb->post2cat
+                    WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
+                    ");
+
+               if (count($checked_categories) == 0) {
+                       // No selected categories, strange
+                       $checked_categories[] = $default;
+               }
+
+       } else {
+               $checked_categories[] = $default;
+       }
+
+       $cats = return_categories_list($parent);
+       $result = array ();
+
+       if (is_array($cats)) {
+               foreach ($cats as $cat) {
+                       $result[$cat]['children'] = get_nested_categories($default, $cat);
+                       $result[$cat]['cat_ID'] = $cat;
+                       $result[$cat]['checked'] = in_array($cat, $checked_categories);
+                       $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
+               }
+       }
+       
+       usort($result, 'sort_cats');
+
+       return $result;
+}
+
+function write_nested_categories($categories) {
+       foreach ($categories as $category) {
+               echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
+
+               if (isset ($category['children'])) {
+                       echo "\n<span class='cat-nest'>\n";
+                       write_nested_categories($category['children']);
+                       echo "</span>\n";
+               }
+       }
+}
+
+function dropdown_categories($default = 0) {
+       write_nested_categories(get_nested_categories($default));
+}
+
+// Dandy new recursive multiple category stuff.
+function cat_rows($parent = 0, $level = 0, $categories = 0) {
+       global $wpdb, $class;
+
+       if (!$categories)
+               $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
+
+       if ($categories) {
+               foreach ($categories as $category) {
+                       if ($category->category_parent == $parent) {
+                               $category->cat_name = wp_specialchars($category->cat_name);
+                               $pad = str_repeat('&#8212; ', $level);
+                               if ( current_user_can('manage_categories') ) {
+                                       $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
+                                       $default_cat_id = get_option('default_category');
+                                       
+                                       if ($category->cat_ID != $default_cat_id)
+                                               $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
+                                       else
+                                               $edit .= "<td style='text-align:center'>".__("Default");
+                               }
+                               else
+                                       $edit = '';
+
+                               $class = ('alternate' == $class) ? '' : 'alternate';
+                               echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
+                                                               <td>$category->category_description</td>
+                                                               <td>$category->category_count</td>
+                                                               <td>$edit</td>
+                                                               </tr>";
+                               cat_rows($category->cat_ID, $level +1, $categories);
+                       }
+               }
+       } else {
+               return false;
+       }
+}
+
+function page_rows($parent = 0, $level = 0, $pages = 0) {
+       global $wpdb, $class, $post;
+       if (!$pages)
+               $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
+
+       if ($pages) {
+               foreach ($pages as $post) {
+                       start_wp();
+                       if ($post->post_parent == $parent) {
+                               $post->post_title = wp_specialchars($post->post_title);
+                               $pad = str_repeat('&#8212; ', $level);
+                               $id = $post->ID;
+                               $class = ('alternate' == $class) ? '' : 'alternate';
+?>
+  <tr id='page-<?php echo $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=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 
+    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;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."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 
+  </tr> 
+
+<?php
+
+                               page_rows($id, $level +1, $pages);
+                       }
+               }
+       } else {
+               return false;
+       }
+}
+
+function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) {
+       global $wpdb, $bgcolor;
+       if (!$categories) {
+               $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
+       }
+       if ($categories) {
+               foreach ($categories as $category) {
+                       if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
+                               $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
+                               $pad = str_repeat('&#8211; ', $level);
+                               $category->cat_name = wp_specialchars($category->cat_name);
+                               echo "\n\t<option value='$category->cat_ID'";
+                               if ($currentparent == $category->cat_ID)
+                                       echo " selected='selected'";
+                               echo ">$pad$category->cat_name</option>";
+                               wp_dropdown_cats($currentcat, $currentparent, $category->cat_ID, $level +1, $categories);
+                       }
+               }
+       } else {
+               return false;
+       }
+}
+
+function link_category_dropdown($fieldname, $selected = 0) {
+       global $wpdb;
+       
+       $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
+       echo "\n<select name='$fieldname' size='1'>\n";
+       foreach ($results as $row) {
+               echo "\n\t<option value='$row->cat_id'";
+               if ($row->cat_id == $selected)
+                       echo " selected='selected'";
+               echo ">$row->cat_id : " . wp_specialchars($row->cat_name);
+               if ($row->auto_toggle == 'Y')
+                       echo ' (auto toggle)';
+               echo "</option>";
+       }
+       echo "\n</select>\n";
+}
+
+function wp_create_thumbnail($file, $max_side, $effect = '') {
+
+               // 1 = GIF, 2 = JPEG, 3 = PNG
+
+       if (file_exists($file)) {
+               $type = getimagesize($file);
+
+               // if the associated function doesn't exist - then it's not
+               // handle. duh. i hope.
+
+               if (!function_exists('imagegif') && $type[2] == 1) {
+                       $error = __('Filetype not supported. Thumbnail not created.');
+               }
+               elseif (!function_exists('imagejpeg') && $type[2] == 2) {
+                       $error = __('Filetype not supported. Thumbnail not created.');
+               }
+               elseif (!function_exists('imagepng') && $type[2] == 3) {
+                       $error = __('Filetype not supported. Thumbnail not created.');
+               } else {
+
+                       // create the initial copy from the original file
+                       if ($type[2] == 1) {
+                               $image = imagecreatefromgif($file);
+                       }
+                       elseif ($type[2] == 2) {
+                               $image = imagecreatefromjpeg($file);
+                       }
+                       elseif ($type[2] == 3) {
+                               $image = imagecreatefrompng($file);
+                       }
+
+                       if (function_exists('imageantialias'))
+                               imageantialias($image, TRUE);
+
+                       $image_attr = getimagesize($file);
+
+                       // figure out the longest side
+
+                       if ($image_attr[0] > $image_attr[1]) {
+                               $image_width = $image_attr[0];
+                               $image_height = $image_attr[1];
+                               $image_new_width = $max_side;
+
+                               $image_ratio = $image_width / $image_new_width;
+                               $image_new_height = $image_height / $image_ratio;
+                               //width is > height
+                       } else {
+                               $image_width = $image_attr[0];
+                               $image_height = $image_attr[1];
+                               $image_new_height = $max_side;
+
+                               $image_ratio = $image_height / $image_new_height;
+                               $image_new_width = $image_width / $image_ratio;
+                               //height > width
+                       }
+
+                       $thumbnail = imagecreatetruecolor($image_new_width, $image_new_height);
+                       @ imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1]);
+
+                       // If no filters change the filename, we'll do a default transformation.
+                       if ( basename($file) == $thumb = apply_filters('thumbnail_filename', basename($file)) )
+                               $thumb = preg_replace('!(\.[^.]+)?$!', __('.thumbnail').'$1', basename($file), 1);
+
+                       $thumbpath = str_replace(basename($file), $thumb, $file);
+
+                       // move the thumbnail to it's final destination
+                       if ($type[2] == 1) {
+                               if (!imagegif($thumbnail, $thumbpath)) {
+                                       $error = __("Thumbnail path invalid");
+                               }
+                       }
+                       elseif ($type[2] == 2) {
+                               if (!imagejpeg($thumbnail, $thumbpath)) {
+                                       $error = __("Thumbnail path invalid");
+                               }
+                       }
+                       elseif ($type[2] == 3) {
+                               if (!imagepng($thumbnail, $thumbpath)) {
+                                       $error = __("Thumbnail path invalid");
+                               }
+                       }
+
+               }
+       } else {
+               $error = __('File not found');
+       }
+
+       if (!empty ($error)) {
+               return $error;
+       } else {
+               return $thumbpath;
+       }
+}
+
+// Some postmeta stuff
+function has_meta($postid) {
+       global $wpdb;
+
+       return $wpdb->get_results("
+                       SELECT meta_key, meta_value, meta_id, post_id
+                       FROM $wpdb->postmeta
+                       WHERE post_id = '$postid'
+                       ORDER BY meta_key,meta_id", ARRAY_A);
+
+}
+
+function list_meta($meta) {
+       global $post_ID;
+       // Exit if no meta
+       if (!$meta)
+               return;
+       $count = 0;
+?>
+<table id='meta-list' cellpadding="3">
+       <tr>
+               <th><?php _e('Key') ?></th>
+               <th><?php _e('Value') ?></th>
+               <th colspan='2'><?php _e('Action') ?></th>
+       </tr>
+<?php
+
+
+       foreach ($meta as $entry) {
+               ++ $count;
+               if ($count % 2)
+                       $style = 'alternate';
+               else
+                       $style = '';
+               if ('_' == $entry['meta_key'] { 0 })
+                       $style .= ' hidden';
+               echo "
+                       <tr class='$style'>
+                               <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
+                               <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>
+                               <td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />
+                               <input name='deletemeta[{$entry['meta_id']}]' type='submit' class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>
+                       </tr>
+               ";
+       }
+       echo "
+               </table>
+       ";
+}
+
+// Get a list of previously defined keys
+function get_meta_keys() {
+       global $wpdb;
+
+       $keys = $wpdb->get_col("
+                       SELECT meta_key
+                       FROM $wpdb->postmeta
+                       GROUP BY meta_key
+                       ORDER BY meta_key");
+
+       return $keys;
+}
+
+function meta_form() {
+       global $wpdb;
+       $keys = $wpdb->get_col("
+                       SELECT meta_key
+                       FROM $wpdb->postmeta
+                       GROUP BY meta_key
+                       ORDER BY meta_id DESC
+                       LIMIT 10");
+?>
+<h3><?php _e('Add a new custom field:') ?></h3>
+<table cellspacing="3" cellpadding="3">
+       <tr>
+<th colspan="2"><?php _e('Key') ?></th>
+<th><?php _e('Value') ?></th>
+</tr>
+       <tr valign="top">
+               <td align="right" width="18%">
+<?php if ($keys) : ?>
+<select id="metakeyselect" name="metakeyselect" tabindex="7">
+<option value="#NONE#"><?php _e('- Select -'); ?></option>
+<?php
+
+       foreach ($keys as $key) {
+               echo "\n\t<option value='$key'>$key</option>";
+       }
+?>
+</select> <?php _e('or'); ?>
+<?php endif; ?>
+</td>
+<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
+               <td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
+       </tr>
+
+</table>
+<p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
+<?php
+
+}
+
+function add_meta($post_ID) {
+       global $wpdb;
+
+       $metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
+       $metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
+       $metavalue = $wpdb->escape(stripslashes(trim($_POST['metavalue'])));
+
+       if ( ('0' === $metavalue || !empty ($metavalue)) && ((('#NONE#' != $metakeyselect) && !empty ($metakeyselect)) || !empty ($metakeyinput)) ) {
+               // We have a key/value pair. If both the select and the 
+               // input for the key have data, the input takes precedence:
+
+               if ('#NONE#' != $metakeyselect)
+                       $metakey = $metakeyselect;
+
+               if ($metakeyinput)
+                       $metakey = $metakeyinput; // default
+
+               $result = $wpdb->query("
+                                               INSERT INTO $wpdb->postmeta 
+                                               (post_id,meta_key,meta_value) 
+                                               VALUES ('$post_ID','$metakey','$metavalue')
+                                       ");
+       }
+} // add_meta
+
+function delete_meta($mid) {
+       global $wpdb;
+
+       $result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+}
+
+function update_meta($mid, $mkey, $mvalue) {
+       global $wpdb;
+
+       return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
+}
+
+function touch_time($edit = 1, $for_post = 1) {
+       global $month, $post, $comment;
+
+       if ( $for_post )
+               $edit = ( ('draft' == $post->post_status) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date) ) ? false : true;
+       echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__('Edit timestamp').'</label></legend>';
+
+       $time_adj = time() + (get_settings('gmt_offset') * 3600);
+       $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
+       $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
+       $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
+       $aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
+       $hh = ($edit) ? mysql2date('H', $post_date) : gmdate('H', $time_adj);
+       $mn = ($edit) ? mysql2date('i', $post_date) : gmdate('i', $time_adj);
+       $ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj);
+
+       echo "<select name=\"mm\">\n";
+       for ($i = 1; $i < 13; $i = $i +1) {
+               echo "\t\t\t<option value=\"$i\"";
+               if ($i == $mm)
+                       echo " selected='selected'";
+               if ($i < 10) {
+                       $ii = "0".$i;
+               } else {
+                       $ii = "$i";
+               }
+               echo ">".$month["$ii"]."</option>\n";
+       }
+?>
+</select>
+<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
+<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @ 
+<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> : 
+<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" /> 
+<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> 
+<?php
+       if ( $edit ) {
+               _e('Existing timestamp');
+               echo ": {$month[$mm]} $jj, $aa @ $hh:$mn";
+       }
+?>
+</fieldset>
+       <?php
+
+}
+
+// insert_with_markers: Owen Winkler, fixed by Eric Anderson
+// Inserts an array of strings into a file (.htaccess), placing it between
+// BEGIN and END markers.  Replaces existing marked info.  Retains surrounding
+// data.  Creates file if none exists.
+// Returns true on write success, false on failure.
+function insert_with_markers($filename, $marker, $insertion) {
+       if (!file_exists($filename) || is_writeable($filename)) {
+               if (!file_exists($filename)) {
+                       $markerdata = '';
+               } else {
+                       $markerdata = explode("\n", implode('', file($filename)));
+               }
+
+               $f = fopen($filename, 'w');
+               $foundit = false;
+               if ($markerdata) {
+                       $state = true;
+                       foreach ($markerdata as $markerline) {
+                               if (strstr($markerline, "# BEGIN {$marker}"))
+                                       $state = false;
+                               if ($state)
+                                       fwrite($f, "{$markerline}\n");
+                               if (strstr($markerline, "# END {$marker}")) {
+                                       fwrite($f, "# BEGIN {$marker}\n");
+                                       if (is_array($insertion))
+                                               foreach ($insertion as $insertline)
+                                                       fwrite($f, "{$insertline}\n");
+                                       fwrite($f, "# END {$marker}\n");
+                                       $state = true;
+                                       $foundit = true;
+                               }
+                       }
+               }
+               if (!$foundit) {
+                       fwrite($f, "# BEGIN {$marker}\n");
+                       foreach ($insertion as $insertline)
+                               fwrite($f, "{$insertline}\n");
+                       fwrite($f, "# END {$marker}\n");
+               }
+               fclose($f);
+               return true;
+       } else {
+               return false;
+       }
+}
+
+// extract_from_markers: Owen Winkler
+// Returns an array of strings from a file (.htaccess) from between BEGIN
+// and END markers.
+function extract_from_markers($filename, $marker) {
+       $result = array ();
+
+       if (!file_exists($filename)) {
+               return $result;
+       }
+
+       if ($markerdata = explode("\n", implode('', file($filename))));
+       {
+               $state = false;
+               foreach ($markerdata as $markerline) {
+                       if (strstr($markerline, "# END {$marker}"))
+                               $state = false;
+                       if ($state)
+                               $result[] = $markerline;
+                       if (strstr($markerline, "# BEGIN {$marker}"))
+                               $state = true;
+               }
+       }
+
+       return $result;
+}
+
+function got_mod_rewrite() {
+       global $is_apache;
+
+       // take 3 educated guesses as to whether or not mod_rewrite is available
+       if ( !$is_apache )
+               return false;
+
+       if ( function_exists('apache_get_modules') ) {
+               if ( !in_array('mod_rewrite', apache_get_modules()) )
+                       return false;
+       }
+
+       return true;
+}
+
+function save_mod_rewrite_rules() {
+       global $is_apache, $wp_rewrite;
+       $home_path = get_home_path();
+
+       if (!$wp_rewrite->using_mod_rewrite_permalinks())
+               return;
+
+       if (!((!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')))
+               return;
+
+       if (! got_mod_rewrite())
+               return;
+
+       $rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
+       insert_with_markers($home_path.'.htaccess', 'WordPress', $rules);
+}
+
+function the_quicktags() {
+       // Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
+       if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
+               echo '
+               <div id="quicktags">
+                       <script src="../wp-includes/js/quicktags.js" type="text/javascript"></script>
+                       <script type="text/javascript">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script>
+               </div>
+';
+       else echo '
+<script type="text/javascript">
+function edInsertContent(myField, myValue) {
+       //IE support
+       if (document.selection) {
+               myField.focus();
+               sel = document.selection.createRange();
+               sel.text = myValue;
+               myField.focus();
+       }
+       //MOZILLA/NETSCAPE support
+       else if (myField.selectionStart || myField.selectionStart == "0") {
+               var startPos = myField.selectionStart;
+               var endPos = myField.selectionEnd;
+               myField.value = myField.value.substring(0, startPos)
+                             + myValue 
+                      + myField.value.substring(endPos, myField.value.length);
+               myField.focus();
+               myField.selectionStart = startPos + myValue.length;
+               myField.selectionEnd = startPos + myValue.length;
+       } else {
+               myField.value += myValue;
+               myField.focus();
+       }
+}
+</script>
+';
+}
+
+function validate_current_theme() {
+       $theme_loc = 'wp-content/themes';
+       $theme_root = ABSPATH.$theme_loc;
+
+       $template = get_settings('template');
+       $stylesheet = get_settings('stylesheet');
+
+       if (($template != 'default') && (!file_exists("$theme_root/$template/index.php"))) {
+               update_option('template', 'default');
+               update_option('stylesheet', 'default');
+               do_action('switch_theme', 'Default');
+               return false;
+       }
+
+       if (($stylesheet != 'default') && (!file_exists("$theme_root/$stylesheet/style.css"))) {
+               update_option('template', 'default');
+               update_option('stylesheet', 'default');
+               do_action('switch_theme', 'Default');
+               return false;
+       }
+
+       return true;
+}
+
+function get_broken_themes() {
+       global $wp_broken_themes;
+
+       get_themes();
+       return $wp_broken_themes;
+}
+
+function get_page_templates() {
+       $themes = get_themes();
+       $theme = get_current_theme();
+       $templates = $themes[$theme]['Template Files'];
+       $page_templates = array ();
+
+       if (is_array($templates)) {
+               foreach ($templates as $template) {
+                       $template_data = implode('', file(ABSPATH.$template));
+                       preg_match("|Template Name:(.*)|i", $template_data, $name);
+                       preg_match("|Description:(.*)|i", $template_data, $description);
+
+                       $name = $name[1];
+                       $description = $description[1];
+
+                       if (!empty ($name)) {
+                               $page_templates[trim($name)] = basename($template);
+                       }
+               }
+       }
+
+       return $page_templates;
+}
+
+function page_template_dropdown($default = '') {
+       $templates = get_page_templates();
+       foreach (array_keys($templates) as $template)
+               : if ($default == $templates[$template])
+                       $selected = " selected='selected'";
+               else
+                       $selected = '';
+       echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
+       endforeach;
+}
+
+function parent_dropdown($default = 0, $parent = 0, $level = 0) {
+       global $wpdb, $post_ID;
+       $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order");
+
+       if ($items) {
+               foreach ($items as $item) {
+                       // A page cannot be it's own parent.
+                       if (!empty ($post_ID)) {
+                               if ($item->ID == $post_ID) {
+                                       continue;
+                               }
+                       }
+                       $pad = str_repeat('&nbsp;', $level * 3);
+                       if ($item->ID == $default)
+                               $current = ' selected="selected"';
+                       else
+                               $current = '';
+
+                       echo "\n\t<option value='$item->ID'$current>$pad $item->post_title</option>";
+                       parent_dropdown($default, $item->ID, $level +1);
+               }
+       } else {
+               return false;
+       }
+}
+
+function user_can_access_admin_page() {
+       global $pagenow;
+       global $menu;
+       global $submenu;
+
+       $parent = get_admin_page_parent();
+
+       foreach ($menu as $menu_array) {
+               //echo "parent array: " . $menu_array[2];
+               if ($menu_array[2] == $parent) {
+                       if (!current_user_can($menu_array[1])) {
+                               return false;
+                       } else {
+                               break;
+                       }
+               }
+       }
+
+       if (isset ($submenu[$parent])) {
+               foreach ($submenu[$parent] as $submenu_array) {
+                       if ($submenu_array[2] == $pagenow) {
+                               if (!current_user_can($submenu_array[1])) {
+                                       return false;
+                               } else {
+                                       return true;
+                               }
+                       }
+               }
+       }
+
+       return true;
+}
+
+function get_admin_page_title() {
+       global $title;
+       global $menu;
+       global $submenu;
+       global $pagenow;
+       global $plugin_page;
+
+       if (isset ($title) && !empty ($title)) {
+               return $title;
+       }
+
+       $hook = get_plugin_page_hook($plugin_page, $pagenow);
+
+       $parent = $parent1 = get_admin_page_parent();
+       if (empty ($parent)) {
+               foreach ($menu as $menu_array) {
+                       if (isset ($menu_array[3])) {
+                               if ($menu_array[2] == $pagenow) {
+                                       $title = $menu_array[3];
+                                       return $menu_array[3];
+                               } else
+                                       if (isset ($plugin_page) && ($plugin_page == $menu_array[2]) && ($hook == $menu_array[3])) {
+                                               $title = $menu_array[3];
+                                               return $menu_array[3];
+                                       }
+                       }
+               }
+       } else {
+               foreach (array_keys($submenu) as $parent) {
+                       foreach ($submenu[$parent] as $submenu_array) {
+                               if (isset ($submenu_array[3])) {
+                                       if ($submenu_array[2] == $pagenow) {
+                                               $title = $submenu_array[3];
+                                               return $submenu_array[3];
+                                       } else
+                                               if (isset ($plugin_page) && ($plugin_page == $submenu_array[2]) && (($parent == $pagenow) || ($parent == $plugin_page) || ($plugin_page == $hook) || (($pagenow == 'admin.php') && ($parent1 != $submenu_array[2])))) {
+                                                       $title = $submenu_array[3];
+                                                       return $submenu_array[3];
+                                               }
+                               }
+                       }
+               }
+       }
+
+       return '';
+}
+
+function get_admin_page_parent() {
+       global $parent_file;
+       global $menu;
+       global $submenu;
+       global $pagenow;
+       global $plugin_page;
+
+       if (isset ($parent_file) && !empty ($parent_file)) {
+               return $parent_file;
+       }
+
+       if ($pagenow == 'admin.php' && isset ($plugin_page)) {
+               foreach ($menu as $parent_menu) {
+                       if ($parent_menu[2] == $plugin_page) {
+                               $parent_file = $plugin_page;
+                               return $plugin_page;
+                       }
+               }
+       }
+
+       foreach (array_keys($submenu) as $parent) {
+               foreach ($submenu[$parent] as $submenu_array) {
+                       if ($submenu_array[2] == $pagenow) {
+                               $parent_file = $parent;
+                               return $parent;
+                       } else
+                               if (isset ($plugin_page) && ($plugin_page == $submenu_array[2])) {
+                                       $parent_file = $parent;
+                                       return $parent;
+                               }
+               }
+       }
+
+       $parent_file = '';
+       return '';
+}
+
+function add_menu_page($page_title, $menu_title, $access_level, $file, $function = '') {
+       global $menu, $admin_page_hooks;
+
+       $file = plugin_basename($file);
+
+       $menu[] = array ($menu_title, $access_level, $file, $page_title);
+
+       $admin_page_hooks[$file] = sanitize_title($menu_title);
+
+       $hookname = get_plugin_page_hookname($file, '');
+       if (!empty ($function) && !empty ($hookname))
+               add_action($hookname, $function);
+
+       return $hookname;
+}
+
+function add_submenu_page($parent, $page_title, $menu_title, $access_level, $file, $function = '') {
+       global $submenu;
+       global $menu;
+
+       $parent = plugin_basename($parent);
+       $file = plugin_basename($file);
+
+       // If the parent doesn't already have a submenu, add a link to the parent
+       // as the first item in the submenu.  If the submenu file is the same as the
+       // parent file someone is trying to link back to the parent manually.  In
+       // this case, don't automatically add a link back to avoid duplication.
+       if (!isset ($submenu[$parent]) && $file != $parent) {
+               foreach ($menu as $parent_menu) {
+                       if ($parent_menu[2] == $parent) {
+                               $submenu[$parent][] = $parent_menu;
+                       }
+               }
+       }
+
+       $submenu[$parent][] = array ($menu_title, $access_level, $file, $page_title);
+
+       $hookname = get_plugin_page_hookname($file, $parent);
+       if (!empty ($function) && !empty ($hookname))
+               add_action($hookname, $function);
+
+       return $hookname;
+}
+
+function add_options_page($page_title, $menu_title, $access_level, $file, $function = '') {
+       return add_submenu_page('options-general.php', $page_title, $menu_title, $access_level, $file, $function);
+}
+
+function add_management_page($page_title, $menu_title, $access_level, $file, $function = '') {
+       return add_submenu_page('edit.php', $page_title, $menu_title, $access_level, $file, $function);
+}
+
+function add_theme_page($page_title, $menu_title, $access_level, $file, $function = '') {
+       return add_submenu_page('themes.php', $page_title, $menu_title, $access_level, $file, $function);
+}
+
+function validate_file($file, $allowed_files = '') {
+       if (false !== strpos($file, './'))
+               return 1;
+
+       if (':' == substr($file, 1, 1))
+               return 2;
+
+       if (!empty ($allowed_files) && (!in_array($file, $allowed_files)))
+               return 3;
+
+       return 0;
+}
+
+function validate_file_to_edit($file, $allowed_files = '') {
+       $file = stripslashes($file);
+
+       $code = validate_file($file, $allowed_files);
+
+       if (!$code)
+               return $file;
+
+       switch ($code) {
+               case 1 :
+                       die(__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
+
+               case 2 :
+                       die(__('Sorry, can&#8217;t call files with their real path.'));
+
+               case 3 :
+                       die(__('Sorry, that file cannot be edited.'));
+       }
+}
+
+function get_home_path() {
+       $home = get_settings('home');
+       if ($home != '' && $home != get_settings('siteurl')) {
+               $home_path = parse_url($home);
+               $home_path = $home_path['path'];
+               $root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"]);
+               $home_path = trailingslashit($root.$home_path);
+       } else {
+               $home_path = ABSPATH;
+       }
+
+       return $home_path;
+}
+
+function get_real_file_to_edit($file) {
+       if ('index.php' == $file || '.htaccess' == $file) {
+               $real_file = get_home_path().$file;
+       } else {
+               $real_file = ABSPATH.$file;
+       }
+
+       return $real_file;
+}
+
+$wp_file_descriptions = array ('index.php' => __('Main Index Template'), 'style.css' => __('Stylesheet'), 'comments.php' => __('Comments'), 'comments-popup.php' => __('Popup Comments'), 'footer.php' => __('Footer'), 'header.php' => __('Header'), 'sidebar.php' => __('Sidebar'), 'archive.php' => __('Archives'), 'category.php' => __('Category Template'), 'page.php' => __('Page Template'), 'search.php' => __('Search Results'), 'single.php' => __('Single Post'), '404.php' => __('404 Template'), 'my-hacks.php' => __('my-hacks.php (legacy hacks support)'), '.htaccess' => __('.htaccess (for rewrite rules)'),
+       // Deprecated files
+       'wp-layout.css' => __('Stylesheet'), 'wp-comments.php' => __('Comments Template'), 'wp-comments-popup.php' => __('Popup Comments Template'));
+
+function get_file_description($file) {
+       global $wp_file_descriptions;
+
+       if (isset ($wp_file_descriptions[basename($file)])) {
+               return $wp_file_descriptions[basename($file)];
+       }
+       elseif (file_exists(ABSPATH.$file)) {
+               $template_data = implode('', file(ABSPATH.$file));
+               if (preg_match("|Template Name:(.*)|i", $template_data, $name))
+                       return $name[1];
+       }
+
+       return basename($file);
+}
+
+function update_recently_edited($file) {
+       $oldfiles = (array) get_option('recently_edited');
+       if ($oldfiles) {
+               $oldfiles = array_reverse($oldfiles);
+               $oldfiles[] = $file;
+               $oldfiles = array_reverse($oldfiles);
+               $oldfiles = array_unique($oldfiles);
+               if (5 < count($oldfiles))
+                       array_pop($oldfiles);
+       } else {
+               $oldfiles[] = $file;
+       }
+       update_option('recently_edited', $oldfiles);
+}
+
+function get_plugin_data($plugin_file) {
+       $plugin_data = implode('', file($plugin_file));
+       preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name);
+       preg_match("|Plugin URI:(.*)|i", $plugin_data, $plugin_uri);
+       preg_match("|Description:(.*)|i", $plugin_data, $description);
+       preg_match("|Author:(.*)|i", $plugin_data, $author_name);
+       preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri);
+       if (preg_match("|Version:(.*)|i", $plugin_data, $version))
+               $version = $version[1];
+       else
+               $version = '';
+
+       $description = wptexturize($description[1]);
+
+       $name = $plugin_name[1];
+       $name = trim($name);
+       $plugin = $name;
+       if ('' != $plugin_uri[1] && '' != $name) {
+               $plugin = '<a href="'.$plugin_uri[1].'" title="'.__('Visit plugin homepage').'">'.$plugin.'</a>';
+       }
+
+       if ('' == $author_uri[1]) {
+               $author = $author_name[1];
+       } else {
+               $author = '<a href="'.$author_uri[1].'" title="'.__('Visit author homepage').'">'.$author_name[1].'</a>';
+       }
+
+       return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);
+}
+
+function get_plugins() {
+       global $wp_plugins;
+
+       if (isset ($wp_plugins)) {
+               return $wp_plugins;
+       }
+
+       $wp_plugins = array ();
+       $plugin_loc = 'wp-content/plugins';
+       $plugin_root = ABSPATH.$plugin_loc;
+
+       // Files in wp-content/plugins directory
+       $plugins_dir = @ dir($plugin_root);
+       if ($plugins_dir) {
+               while (($file = $plugins_dir->read()) !== false) {
+                       if (preg_match('|^\.+$|', $file))
+                               continue;
+                       if (is_dir($plugin_root.'/'.$file)) {
+                               $plugins_subdir = @ dir($plugin_root.'/'.$file);
+                               if ($plugins_subdir) {
+                                       while (($subfile = $plugins_subdir->read()) !== false) {
+                                               if (preg_match('|^\.+$|', $subfile))
+                                                       continue;
+                                               if (preg_match('|\.php$|', $subfile))
+                                                       $plugin_files[] = "$file/$subfile";
+                                       }
+                               }
+                       } else {
+                               if (preg_match('|\.php$|', $file))
+                                       $plugin_files[] = $file;
+                       }
+               }
+       }
+
+       if (!$plugins_dir || !$plugin_files) {
+               return $wp_plugins;
+       }
+
+       sort($plugin_files);
+
+       foreach ($plugin_files as $plugin_file) {
+               if ( !is_readable("$plugin_root/$plugin_file"))
+                       continue;
+
+               $plugin_data = get_plugin_data("$plugin_root/$plugin_file");
+
+               if (empty ($plugin_data['Name'])) {
+                       continue;
+               }
+
+               $wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
+       }
+
+       return $wp_plugins;
+}
+
+function get_plugin_page_hookname($plugin_page, $parent_page) {
+       global $admin_page_hooks;
+
+       $parent = get_admin_page_parent();
+
+       if (empty ($parent_page) || 'admin.php' == $parent_page) {
+               if (isset ($admin_page_hooks[$plugin_page]))
+                       $page_type = 'toplevel';
+               else
+                       if (isset ($admin_page_hooks[$parent]))
+                               $page_type = $admin_page_hooks[$parent];
+       } else
+               if (isset ($admin_page_hooks[$parent_page])) {
+                       $page_type = $admin_page_hooks[$parent_page];
+               } else {
+                       $page_type = 'admin';
+               }
+
+       $plugin_name = preg_replace('!\.php!', '', $plugin_page);
+
+       return $page_type.'_page_'.$plugin_name;
+}
+
+function get_plugin_page_hook($plugin_page, $parent_page) {
+       global $wp_filter;
+
+       $hook = get_plugin_page_hookname($plugin_page, $parent_page);
+       if (isset ($wp_filter[$hook]))
+               return $hook;
+       else
+               return '';
+}
+
+function browse_happy() {
+       $getit = __('WordPress recommends a better browser');
+       echo '
+               <p id="bh" style="text-align: center;"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></p>
+               ';
+}
+if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
+       add_action('admin_footer', 'browse_happy');
+
+function documentation_link($for) {
+       return;
+}
+
+function register_importer($id, $name, $description, $callback) {
+       global $wp_importers;
+
+       $wp_importers[$id] = array ($name, $description, $callback);
+}
+
+function get_importers() {
+       global $wp_importers;
+
+       return $wp_importers;
+}
+
+function current_theme_info() {
+       $themes = get_themes();
+       $current_theme = get_current_theme();
+       $ct->name = $current_theme;
+       $ct->title = $themes[$current_theme]['Title'];
+       $ct->version = $themes[$current_theme]['Version'];
+       $ct->parent_theme = $themes[$current_theme]['Parent Theme'];
+       $ct->template_dir = $themes[$current_theme]['Template Dir'];
+       $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
+       $ct->template = $themes[$current_theme]['Template'];
+       $ct->stylesheet = $themes[$current_theme]['Stylesheet'];
+       $ct->screenshot = $themes[$current_theme]['Screenshot'];
+       $ct->description = $themes[$current_theme]['Description'];
+       $ct->author = $themes[$current_theme]['Author'];
+       return $ct;
+}
+
+
+// array wp_handle_upload ( array &file [, array overrides] )
+// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
+// overrides: an associative array of names=>values to override default variables with extract($overrides, EXTR_OVERWRITE).
+// On success, returns an associative array of file attributes.
+// On failure, returns $overrides['upload_error_handler'](&$file, $message) or array('error'=>$message).
+function wp_handle_upload(&$file, $overrides = false) {
+       // The default error handler.
+       if (! function_exists('wp_handle_upload_error') ) {
+               function wp_handle_upload_error(&$file, $message) {
+                       return array('error'=>$message);
+               }
+       }
+
+       // You may define your own function and pass the name in $overrides['upload_error_handler']
+       $upload_error_handler = 'wp_handle_upload_error';
+
+       // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
+       $action = 'wp_handle_upload';
+
+       // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
+       $upload_error_strings = array(false,
+               __("The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>."),
+               __("The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form."),
+               __("The uploaded file was only partially uploaded."),
+               __("No file was uploaded."),
+               __("Missing a temporary folder."),
+               __("Failed to write file to disk."));
+
+       // Accepted MIME types are set here as PCRE. Override with $override['mimes'].
+       $mimes = apply_filters('upload_mimes', array (
+               'jpg|jpeg|jpe' => 'image/jpeg',
+               'gif' => 'image/gif',
+               'png' => 'image/png',
+               'bmp' => 'image/bmp',
+               'tif|tiff' => 'image/tiff',
+               'ico' => 'image/x-icon',
+               'asf|asx|wax|wmv|wmx' => 'video/asf',
+               'avi' => 'video/avi',
+               'mov|qt' => 'video/quicktime',
+               'mpeg|mpg|mpe' => 'video/mpeg',
+               'txt|c|cc|h' => 'text/plain',
+               'rtx' => 'text/richtext',
+               'css' => 'text/css',
+               'htm|html' => 'text/html',
+               'mp3|mp4' => 'audio/mpeg',
+               'ra|ram' => 'audio/x-realaudio',
+               'wav' => 'audio/wav',
+               'ogg' => 'audio/ogg',
+               'mid|midi' => 'audio/midi',
+               'wma' => 'audio/wma',
+               'rtf' => 'application/rtf',
+               'js' => 'application/javascript',
+               'pdf' => 'application/pdf',
+               'doc' => 'application/msword',
+               'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
+               'wri' => 'application/vnd.ms-write',
+               'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
+               'mdb' => 'application/vnd.ms-access',
+               'mpp' => 'application/vnd.ms-project',
+               'swf' => 'application/x-shockwave-flash',
+               'class' => 'application/java',
+               'tar' => 'application/x-tar',
+               'zip' => 'application/zip',
+               'gz|gzip' => 'application/x-gzip',
+               'exe' => 'application/x-msdownload'
+       ));
+
+       // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
+       $test_form = true;
+       $test_size = true;
+
+       // If you override this, you must provide $ext and $type!!!!
+       $test_type = true;
+
+       // Install user overrides. Did we mention that this voids your warranty?
+       if ( is_array($overrides) )
+               extract($overrides, EXTR_OVERWRITE);
+
+       // A correct form post will pass this test.
+       if ( $test_form && (!isset($_POST['action']) || ($_POST['action'] != $action)) )
+               return $upload_error_handler($file, __('Invalid form submission.'));
+
+       // A successful upload will pass this test. It makes no sense to override this one.
+       if ( $file['error'] > 0 )
+               return $upload_error_handler($file, $upload_error_strings[$file['error']]);
+
+       // A non-empty file will pass this test.
+       if ( $test_size && !($file['size'] > 0) )
+               return $upload_error_handler($file, __('File is empty. Please upload something more substantial.'));
+
+       // A properly uploaded file will pass this test. There should be no reason to override this one.
+       if (! @ is_uploaded_file($file['tmp_name']) )
+               return $upload_error_handler($file, __('Specified file failed upload test.'));
+
+       // A correct MIME type will pass this test.
+       if ( $test_type ) {
+               $type = false;
+               $ext = false;
+               foreach ($mimes as $ext_preg => $mime_match) {
+                       $ext_preg = '![^.]\.(' . $ext_preg . ')$!i';
+                       if ( preg_match($ext_preg, $file['name'], $ext_matches) ) {
+                               $type = $mime_match;
+                               $ext = $ext_matches[1];
+                       }
+               }
+
+               if ( !$type || !$ext )
+                       return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.'));
+       }
+
+       // A writable uploads dir will pass this test. Again, there's no point overriding this one.
+       if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+               return $upload_error_handler($file, $uploads['error']);
+
+       // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
+       if ( isset($unique_filename_callback) && function_exists($unique_filename_callback) ) {
+               $filename = $unique_filename_callback($uploads['path'], $file['name']);
+       } else {
+               $number = '';
+               $filename = str_replace('#', '_', $file['name']);
+               $filename = str_replace(array('\\', "'"), '', $filename);
+               if ( empty($ext) )
+                       $ext = '';
+               else
+                       $ext = ".$ext";
+               while ( file_exists($uploads['path'] . "/$filename") ) {
+                       if ( '' == "$number$ext" )
+                               $filename = $filename . ++$number . $ext;
+                       else
+                               $filename = str_replace("$number$ext", ++$number . $ext, $filename);
+               }
+       }
+
+       // Move the file to the uploads dir
+       $new_file = $uploads['path'] . "/$filename";
+       if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) )
+               die(printf(__('The uploaded file could not be moved to %s.'), $file['path']));
+
+       // Set correct file permissions
+       $stat = stat(dirname($new_file));
+       $perms = $stat['mode'] & 0000666;
+       @ chmod($new_file, $perms);
+
+       // Compute the URL
+       $url = $uploads['url'] . "/$filename";
+
+       return array('file' => $new_file, 'url' => $url, 'type' => $type);
+}
+
+function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) {
+       if ( $height <= $hmax && $width <= $wmax )
+               return array($width, $height);
+       elseif ( $width / $height > $wmax / $hmax )
+               return array($wmax, (int) ($height / $width * $wmax));
+       else
+               return array((int) ($width / $height * $hmax), $hmax);
+}
+
+function wp_import_cleanup($id) {
+       wp_delete_attachment($id);
+}
+
+function wp_import_upload_form($action) {
+?>
+<script type="text/javascript">
+function cancelUpload() {
+o = document.getElementById('uploadForm');
+o.method = 'GET';
+o.action.value = 'view';
+o.submit();
+}
+</script>
+<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo $action ?>">
+<label for="upload"><?php _e('File:'); ?></label><input type="file" id="upload" name="import" />
+<input type="hidden" name="action" value="save" />
+<div id="buttons">
+<input type="submit" value="<?php _e('Import'); ?>" />
+<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
+</div>
+</form>
+<?php  
+}
+
+function wp_import_handle_upload() {
+       $overrides = array('test_form' => false, 'test_type' => false);
+       $file = wp_handle_upload($_FILES['import'], $overrides);
+
+       if ( isset($file['error']) )
+               return $file;
+
+       $url = $file['url'];
+       $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);
+
+       return array('file' => $file, 'id' => $id);
+}
+
+function user_can_richedit() {
+       if ( 'true' != get_user_option('rich_editing') )
+               return false;
+
+       if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
+               return false;
+
+       return true; // Best guess
+}
+
+function the_attachment_links($id = false) {
+       $id = (int) $id;
+       $post = & get_post($id);
+
+       if ( $post->post_status != 'attachment' )
+               return false;
+
+       $icon = get_attachment_icon($post->ID);
+
+?>
+<p><?php _e('Text linked to file') ?><br />
+<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo basename($post->guid) ?></a></textarea></p>
+<p><?php _e('Text linked to subpost') ?><br />
+<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $post->post_title ?></a></textarea></p>
+<?php if ( $icon ) : ?>
+<p><?php _e('Thumbnail linked to file') ?><br />
+<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo $post->guid ?>" class="attachmentlink"><?php echo $icon ?></a></textarea></p>
+<p><?php _e('Thumbnail linked to subpost') ?><br />
+<textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo get_attachment_link($post->ID) ?>" rel="attachment" id="<?php echo $post->ID ?>"><?php echo $icon ?></a></textarea></p>
+<?php endif; ?>
+<?php
+}
+
+function get_udims($width, $height) {
+       if ( $height <= 96 && $width <= 128 )
+               return array($width, $height);
+       elseif ( $width / $height > 4 / 3 )
+               return array(128, (int) ($height / $width * 128));
+       else
+               return array((int) ($width / $height * 96), 96);
+}
+
+?>
diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
new file mode 100644 (file)
index 0000000..b994f7c
--- /dev/null
@@ -0,0 +1,72 @@
+<?php 
+@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+if (!isset($_GET["page"])) require_once('admin.php');
+if ( $editing ) {
+       $dbx_js = true;
+       if ( current_user_can('manage_categories') )
+               $cat_js = true;
+}
+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">
+<head>
+<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; ?>
+<?php do_action('admin_head'); ?>
+</head>
+<body>
+<div id="wphead">
+<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_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');
+
+if ( $parent_file == 'options-general.php' ) {
+       require(ABSPATH . '/wp-admin/options-head.php');
+}
+?>
diff --git a/wp-admin/admin.php b/wp-admin/admin.php
new file mode 100644 (file)
index 0000000..9c5a88c
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+if ( defined('ABSPATH') )
+       require_once( ABSPATH . 'wp-config.php');
+else
+    require_once('../wp-config.php');
+
+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-functions.php');
+
+auth_redirect();
+
+nocache_headers();
+
+update_category_cache();
+
+get_currentuserinfo();
+
+$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');
+
+$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"];
+        }
+    }
+}
+
+$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
+
+require(ABSPATH . '/wp-admin/menu.php');
+
+// Handle plugin admin pages.
+if (isset($_GET['page'])) {
+       $plugin_page = stripslashes($_GET['page']);
+       $plugin_page = plugin_basename($plugin_page);
+       $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
+
+       if ( $page_hook ) {
+               if (! isset($_GET['noheader']))
+                       require_once(ABSPATH . '/wp-admin/admin-header.php');
+               
+               do_action($page_hook);
+       } else {
+               if ( validate_file($plugin_page) ) {
+                       die(__('Invalid 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 . "wp-content/plugins/$plugin_page");
+       }
+       
+       include(ABSPATH . 'wp-admin/admin-footer.php');
+
+       exit();
+} else if (isset($_GET['import'])) {
+       
+       $importer = $_GET['import'];
+
+       if ( validate_file($importer) ) {
+               die(__('Invalid importer.'));
+       }
+               
+       if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
+               die(__('Cannot load importer.'));
+       
+       include(ABSPATH . "wp-admin/import/$importer.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();
+}
+
+?>
diff --git a/wp-admin/bookmarklet.php b/wp-admin/bookmarklet.php
new file mode 100644 (file)
index 0000000..195e35c
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+$mode = 'bookmarklet';
+require_once('admin.php');
+
+if ( ! current_user_can('edit_posts') )
+       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">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script type="text/javascript">
+<!--
+window.close()
+-->
+</script>
+</head>
+<body></body>
+</html>
+<?php
+exit;
+endif;
+
+$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 = wp_specialchars($_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 */
+
+?><!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_settings('blog_charset'); ?>" />
+<link rel="stylesheet" href="wp-admin.css" type="text/css" />
+
+<style type="text/css">
+<!--
+
+#wpbookmarklet textarea,input,select {
+       border-width: 1px;
+       border-color: #cccccc;
+       border-style: solid;
+       padding: 2px;
+       margin: 1px;
+}
+
+#wpbookmarklet .checkbox {
+       background-color: #ffffff;
+       border-width: 0px;
+       padding: 0px;
+       margin: 0px;
+}
+
+#wpbookmarklet textarea {
+       font-family: Verdana, Geneva, Arial, Helvetica;
+       font-size: 0.9em;
+}
+
+#wpbookmarklet .wrap {
+    border: 0px;
+}
+
+#wpbookmarklet #postdiv {
+    margin-bottom: 0.5em;
+}
+
+#wpbookmarklet #titlediv {
+    margin-bottom: 1em;
+}
+
+-->
+</style>
+</head>
+<body id="wpbookmarklet">
+<div id="wphead">
+<h1><?php bloginfo('name') ?></h1>
+</div>
+
+<?php require('edit-form.php'); ?>
+
+<?php do_action('admin_footer', ''); ?>
+
+</body>
+</html>
diff --git a/wp-admin/cat-js.php b/wp-admin/cat-js.php
new file mode 100644 (file)
index 0000000..156e8f5
--- /dev/null
@@ -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 = 'ajaxnewcat=' + encodeURIComponent(newcat.value);
+       ajaxCat.requestFile = 'edit-form-ajax-cat.php';
+       ajaxCat.method = 'GET';
+       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;
+}
\ No newline at end of file
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
new file mode 100644 (file)
index 0000000..79163a9
--- /dev/null
@@ -0,0 +1,169 @@
+<?php
+require_once('admin.php');
+
+$title = __('Categories');
+$parent_file = 'edit.php';
+$list_js = true;
+
+$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) {
+
+case 'addcat':
+
+       if ( !current_user_can('manage_categories') )
+               die (__('Cheatin&#8217; uh?'));
+       
+       wp_insert_category($_POST);
+
+       header('Location: categories.php?message=1#addcat');
+break;
+
+case 'delete':
+
+       check_admin_referer();
+
+       if ( !current_user_can('manage_categories') )
+               die (__('Cheatin&#8217; uh?'));
+
+       $cat_ID = (int) $_GET['cat_ID'];
+       $cat_name = get_catname($cat_ID);
+
+       if ( 1 == $cat_ID )
+               die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+
+       wp_delete_category($cat_ID);
+
+       header('Location: categories.php?message=2');
+
+break;
+
+case 'edit':
+
+    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">
+         <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 wp_specialchars($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 wp_specialchars($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, 1); ?></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;
+
+case 'editedcat':
+       if ( !current_user_can('manage_categories') )
+               die (__('Cheatin&#8217; uh?'));
+       
+       wp_update_category($_POST);
+
+       header('Location: categories.php?message=3');
+break;
+
+default:
+
+require_once ('admin-header.php');
+
+$messages[1] = __('Category added.');
+$messages[2] = __('Category deleted.');
+$messages[3] = __('Category updated.');
+?>
+
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
+<div class="wrap">
+<?php if ( current_user_can('manage_categories') ) : ?>
+       <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
+<?php else : ?>
+       <h2><?php _e('Categories') ?> </h2>
+<?php endif; ?>
+<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
+       <tr>
+               <th scope="col"><?php _e('ID') ?></th>
+        <th scope="col"><?php _e('Name') ?></th>
+        <th scope="col"><?php _e('Description') ?></th>
+        <th scope="col"><?php _e('# Posts') ?></th>
+        <th colspan="2"><?php _e('Action') ?></th>
+       </tr>
+<?php
+cat_rows();
+?>
+</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 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>
+
+<div class="wrap">
+    <h2><?php _e('Add New Category') ?></h2>
+    <form name="addcat" id="addcat" action="categories.php" method="post">
+        
+        <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
+break;
+}
+
+include('admin-footer.php');
+?>
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
new file mode 100644 (file)
index 0000000..e74ebb4
--- /dev/null
@@ -0,0 +1,172 @@
+<?php
+require_once('admin.php');
+
+$title = __('Edit Comments');
+$parent_file = 'edit.php';
+$list_js = true;
+
+require_once('admin-header.php');
+if (empty($_GET['mode'])) $mode = 'view';
+else $mode = wp_specialchars($_GET['mode'], 1);
+?>
+
+<script type="text/javascript">
+<!--
+function checkAll(form)
+{
+       for (i = 0, n = form.elements.length; i < n; i++) {
+               if(form.elements[i].type == "checkbox") {
+                       if(form.elements[i].checked == true)
+                               form.elements[i].checked = false;
+                       else
+                               form.elements[i].checked = true;
+               }
+       }
+}
+//-->
+</script>
+<div class="wrap">
+<h2><?php _e('Comments'); ?></h2>
+<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 wp_specialchars($_GET['s'], 1); ?>" 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, 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>
+<?php
+if ( !empty( $_POST['delete_comments'] ) ) :
+       $i = 0;
+       foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
+               $comment = (int) $comment;
+               $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 class='wrap'><p>" . sprintf(__('%s comments deleted.'), $i) . "</p></div>";
+endif;
+
+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) {
+               if ($offset)
+                       $start = " start='$offset'";
+               else
+                       $start = '';
+
+               echo "<ol id='the-list' class='commentlist' $start>";
+               $i = 0;
+               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() ?>
+
+        <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=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\">" . __('Delete Comment') . "</a> &#8212; ";
+                       } // 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 {
+
+               ?>
+               <p>
+        <strong><?php _e('No comments found.') ?></strong></p>
+               
+               <?php
+       } // end if ($comments)
+} elseif ('edit' == $mode) {
+
+       if ($comments) {
+               echo '<form name="deletecomments" id="deletecomments" action="" method="post"> 
+               <table width="100%" cellpadding="3" cellspacing="3">
+  <tr>
+    <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">' .  __('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"));
+               $class = ('alternate' == $class) ? '' : 'alternate';
+?>
+  <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><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='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=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\"    class='delete'>" . __('Delete') . "</a>"; } ?></td>
+  </tr>
+               <?php 
+               } // end foreach
+       ?></table>
+    <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>
+<?php
+       } else {
+?>
+<p>
+<strong><?php _e('No results found.') ?></strong>
+</p>
+<?php
+       } // end if ($comments)
+}
+       ?>
+
+</div>
+
+<?php include('admin-footer.php'); ?>
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
new file mode 100644 (file)
index 0000000..3f9390a
--- /dev/null
@@ -0,0 +1,275 @@
+<?php
+$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 $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']) ): ?>
+<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();
+       $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
+} else {
+       $form_action = 'editpost';
+       $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
+}
+
+$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="' . $post->post_status . '" />';
+
+$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>';
+       $already_pinged = explode("\n", trim($post->pinged));
+       foreach ($already_pinged as $pinged_url) {
+               $pings .= "\n\t<li>$pinged_url</li>";
+       }
+       $pings .= '</ul>';
+}
+
+$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 $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']) : ?>
+<script type="text/javascript">
+function focusit() {
+       // focus on first input field
+       document.post.title.focus();
+}
+addLoadEvent(focusit);
+</script>
+<?php endif; ?>
+<div id="poststuff">
+
+<div id="moremeta">
+<div id="grabit" class="dbx-group">
+
+<fieldset id="commentstatusdiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
+<div class="dbx-content">
+<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> 
+<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+</div>
+</fieldset>
+
+<fieldset id="passworddiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('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 $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 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'); ?> /> <?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>
+
+<?php if ( current_user_can('edit_posts') ) : ?>
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
+<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
+</fieldset>
+<?php endif; ?>
+
+<?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>
+<div class="dbx-content">
+<select name="post_author_override" id="post_author_override">
+<?php 
+foreach ($authors as $o) :
+$o = get_userdata( $o->ID );
+if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
+else $selected = '';
+echo "<option value='$o->ID' $selected>$o->display_name</option>";
+endforeach;
+?>
+</select>
+</div>
+</fieldset>
+<?php endif; ?>
+
+<?php do_action('dbx_post_sidebar'); ?>
+
+</div>
+</div>
+
+<fieldset id="titlediv">
+  <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
+ $rows = get_settings('default_post_edit_rows');
+ if (($rows < 3) || ($rows > 100)) {
+     $rows = 12;
+ }
+?>
+<?php the_quicktags(); ?>
+
+<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">
+<!--
+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"><?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') ?>" /> 
+<?php endif; ?>
+<?php
+}
+?>
+<input name="referredby" type="hidden" id="referredby" value="<?php 
+if ( !empty($_REQUEST['popupurl']) )
+       echo wp_specialchars($_REQUEST['popupurl']);
+else if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
+       echo 'redo';
+else
+       echo wp_specialchars($_SERVER['HTTP_REFERER']);
+?>" /></p>
+
+<?php do_action('edit_form_advanced'); ?>
+
+<?php
+if (current_user_can('upload_files')) {
+       $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
+       $uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID";
+       $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
+       if ( false != $uploading_iframe_src )
+               echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
+}
+?>
+
+<div id="advancedstuff" class="dbx-group" >
+
+<fieldset id="postexcerpt" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
+<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
+</fieldset>
+
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
+<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;
+?>
+</div>
+</fieldset>
+
+<fieldset id="postcustom" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
+<div id="postcustomstuff" class="dbx-content">
+<?php 
+if($metadata = has_meta($post_ID)) {
+?>
+<?php
+       list_meta($metadata); 
+?>
+<?php
+}
+       meta_form();
+?>
+</div>
+</fieldset>
+
+<?php do_action('dbx_post_advanced'); ?>
+
+</div>
+
+<?php if ('edit' == $action) : ?>
+<input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), addslashes($post->post_title) ) . "')\""; ?> />
+<?php endif; ?>
+
+</div>
+
+</div>
+
+</form>
diff --git a/wp-admin/edit-form-ajax-cat.php b/wp-admin/edit-form-ajax-cat.php
new file mode 100644 (file)
index 0000000..d023f94
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+require_once('../wp-config.php');
+require_once('admin-functions.php');
+require_once('admin-db.php');
+
+get_currentuserinfo();
+
+if ( !current_user_can('manage_categories') )
+       die('-1');
+
+function get_out_now() { exit; }
+
+add_action('shutdown', 'get_out_now', -1);
+
+$names = explode(',', rawurldecode($_GET['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 );
+
+?>
\ No newline at end of file
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
new file mode 100644 (file)
index 0000000..fb72058
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+$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 name="post" action="post.php" method="post" id="post">
+<div class="wrap">
+<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">
+function focusit() { // focus on first input field
+       document.post.name.focus();
+}
+addLoadEvent(focusit);
+</script>
+<fieldset id="namediv">
+    <legend><?php _e('Name:') ?></legend>
+       <div>
+         <input type="text" name="newcomment_author" size="22" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" />
+    </div>
+</fieldset>
+<fieldset id="emaildiv">
+        <legend><?php _e('E-mail:') ?></legend>
+               <div>
+                 <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><?php _e('URI:') ?></legend>
+               <div>
+                 <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_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 $_SERVER['HTTP_REFERER']; ?>" />
+</p>
+
+</div>
+
+<div class="wrap">
+<h2><?php _e('Advanced'); ?></h2>
+
+<table width="100%" cellspacing="2" cellpadding="5" class="editform">
+       <tr>
+               <th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
+               <td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
+         <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
+         <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
+       </tr>
+
+<?php if ( current_user_can('edit_posts') ) : ?>
+       <tr>
+               <th scope="row"><?php _e('Edit time'); ?>:</th>
+               <td><?php touch_time(('editcomment' == $action), 0); ?></td>
+       </tr>
+<?php endif; ?>
+
+       <tr>
+               <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>
+
+</div>
+
+</form>
diff --git a/wp-admin/edit-form.php b/wp-admin/edit-form.php
new file mode 100644 (file)
index 0000000..dd4bc75
--- /dev/null
@@ -0,0 +1,75 @@
+
+<div class="wrap">
+<h2><?php _e('Write Post'); ?></h2>
+<form name="post" action="post.php" method="post" id="simple">
+
+<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
+<input type="hidden" name="mode" value="bookmarklet" />
+<?php endif; ?>
+<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="action" value='post' />
+
+<script type="text/javascript">
+<!--
+function focusit() { // focus on first input field
+       document.getElementById('title').focus();
+}
+addLoadEvent(focusit);
+//-->
+</script>
+
+<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 $post->post_title; ?>" id="title" /></div>
+    </fieldset>
+
+    <fieldset id="categorydiv">
+      <legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend> 
+         <div><?php dropdown_categories($post->post_category); ?></div>
+    </fieldset>
+
+<br />
+<fieldset id="postdiv">
+    <legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
+<?php the_quicktags(); ?>
+<?php
+ $rows = get_settings('default_post_edit_rows');
+ if (($rows < 3) || ($rows > 100)) {
+     $rows = 10;
+ }
+?>
+<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
+</fieldset>
+
+
+<script type="text/javascript">
+<!--
+edCanvas = document.getElementById('content');
+//-->
+</script>
+
+<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 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') ?>" />
+
+        <?php if ( current_user_can('edit_posts') ) : ?>
+  <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 (isset($_SERVER['HTTP_REFERER'])) echo urlencode($_SERVER['HTTP_REFERER']); ?>" />
+</p>
+
+<?php do_action('simple_edit_form', ''); ?>
+
+</div>
+</form>
+
+</div>
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php
new file mode 100644 (file)
index 0000000..d782813
--- /dev/null
@@ -0,0 +1,236 @@
+<?php
+if ( ! empty($link_id) ) {
+       $editing = true;
+       $heading = __('Edit a link:');
+       $submit_text = __('Save Changes &raquo;');
+       $form = '<form action="" method="post" name="editlink" id="editlink">'; 
+} else {
+       $editing = false;
+       $heading = __('<strong>Add</strong> a link:');
+       $submit_text = __('Add Link &raquo;');
+       $form = '<form name="addlink" method="post" action="link-manager.php">';
+}
+
+function xfn_check($class, $value = '', $type = 'check') {
+       global $link;
+
+       $link_rel = $link->link_rel;
+       $rels = preg_split('/\s+/', $link_rel);
+
+       if ('' != $value && in_array($value, $rels) ) {
+               echo ' checked="checked"';
+       }
+
+       if ('' == $value) {
+               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"> 
+  <?php echo $form ?>
+  <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>
+       <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 id="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 wp_specialchars($order_by, 1); ?>" />
+          <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
+<?php else: ?>
+               <input type="hidden" name="action" value="Add" />
+<?php endif; ?>
+</form> 
+</div>
\ No newline at end of file
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
new file mode 100644 (file)
index 0000000..ae59489
--- /dev/null
@@ -0,0 +1,225 @@
+
+<div class="wrap">
+<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';
+       $temp_ID = -1 * time();
+       $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
+} else {
+       $form_action = 'editpost';
+       $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
+}
+
+$sendto = $_SERVER['HTTP_REFERER'];
+
+if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
+       $sendto = 'redo';
+$sendto = wp_specialchars( $sendto );
+
+?>
+
+<form name="post" action="post.php" method="post" id="post">
+
+<?php
+if (isset($mode) && 'bookmarklet' == $mode) {
+    echo '<input type="hidden" name="mode" value="bookmarklet" />';
+}
+?>
+<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="action" value='<?php echo $form_action ?>' />
+<?php echo $form_extra ?>
+<input type="hidden" name="post_status" value="static" />
+
+<script type="text/javascript">
+<!--
+function focusit() { // focus on first input field
+       document.post.title.focus();
+}
+addLoadEvent(focusit);
+//-->
+</script>
+<div id="poststuff">
+
+<div id="moremeta">
+<div id="grabit" class="dbx-group">
+<fieldset id="commentstatusdiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
+<div class="dbx-content">
+<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> 
+<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+</div>
+</fieldset>
+
+<fieldset id="passworddiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('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> 
+<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); ?>
+</select></p>
+</div>
+</fieldset>
+
+<?php if ( 0 != count( get_page_templates() ) ) { ?>
+<fieldset id="pageparent" class="dbx-box">
+<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); ?>
+               </select></p>
+</div>
+</fieldset>
+<?php } ?>
+
+<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 $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('Post author'); ?>:</h3>
+<div class="dbx-content">
+<select name="post_author_override" id="post_author_override">
+<?php 
+foreach ($authors as $o) :
+$o = get_userdata( $o->ID );
+if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
+else $selected = '';
+echo "<option value='$o->ID' $selected>$o->display_name</option>";
+endforeach;
+?>
+</select>
+</div>
+</fieldset>
+<?php endif; ?>
+
+<fieldset id="pageorder" class="dbx-box">
+<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>
+
+<?php do_action('dbx_page_sidebar'); ?>
+
+</div>
+</div>
+
+<fieldset id="titlediv">
+  <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
+ $rows = get_settings('default_post_edit_rows');
+ if (($rows < 3) || ($rows > 100)) {
+     $rows = 10;
+ }
+?>
+<?php the_quicktags(); ?>
+
+<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">
+<?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>
+
+<?php do_action('edit_page_form'); ?>
+
+<?php
+if (current_user_can('upload_files')) {
+       $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
+       $uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID";
+       $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
+       if ( false != $uploading_iframe_src )
+               echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
+}
+?>
+
+<div id="advancedstuff" class="dbx-group">
+
+<fieldset id="postcustom" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
+<div id="postcustomstuff" class="dbx-content">
+<?php 
+if($metadata = has_meta($post_ID)) {
+?>
+<?php
+       list_meta($metadata); 
+?>
+<?php
+}
+       meta_form();
+?>
+</div>
+</fieldset>
+
+<?php do_action('dbx_page_advanced'); ?>
+
+</div>
+
+<?php if ('edit' == $action) : ?>
+               <input name="deletepost" class="delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $wpdb->escape($post->post_title) ) . "')\""; ?> />
+<?php endif; ?>
+</form>
+
+</div>
+
+</div>
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
new file mode 100644 (file)
index 0000000..8d44faf
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+require_once('admin.php');
+$title = __('Pages');
+$parent_file = 'edit.php';
+$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>
+
+<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 wp_specialchars($_GET['s'], 1); ?>" size="17" /> 
+  <input type="submit" name="submit" value="<?php _e('Search') ?>"  /> 
+  </fieldset>
+</form>
+
+<?php
+
+$show_post_type = 'page';
+
+if ( isset($_GET['s']) )
+       wp();
+else
+       $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
+
+if ($posts) {
+?>
+<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"></th> 
+    <th scope="col"></th> 
+    <th scope="col"></th> 
+  </tr> 
+<?php
+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='post.php?action=delete&amp;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."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 
+  </tr>
+<?php
+endforeach;
+} else {
+       page_rows();
+}
+?>
+</table> 
+
+<div id="ajax-response"></div>
+
+<?php
+} else {
+?>
+<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>
+
+</div>
+
+<?php include('admin-footer.php'); ?> 
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
new file mode 100644 (file)
index 0000000..27d3bc4
--- /dev/null
@@ -0,0 +1,299 @@
+<?php
+require_once('admin.php');
+
+$title = __('Posts');
+$parent_file = 'edit.php';
+$list_js = true;
+require_once('admin-header.php');
+
+$_GET['m'] = (int) $_GET['m'];
+
+$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
+       $i = 0;
+       foreach ($drafts as $draft) {
+               if (0 != $i)
+                       echo ', ';
+               $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> 
+<?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 = stripslashes($draft->post_title);
+               if ($draft->post_title == '')
+                       $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
+               echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
+               ++$i;
+               }
+       ?> 
+    .</p> 
+
+<?php } ?>
+
+</div>
+<?php } ?>
+
+<div class="wrap">
+<h2>
+<?php
+$what_to_show = 'posts';
+$posts_per_page = 15;
+$posts_per_archive_page = -1;
+
+wp();
+
+if ( is_month() ) {
+       single_month_title(' ');
+} elseif ( is_search() ) {
+       printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
+} else {
+       if ( is_single() )
+               printf(__('Comments on %s'), $post->post_title);
+       elseif ( ! is_paged() || get_query_var('paged') == 1 )
+               _e('Last 15 Posts');
+       else
+               _e('Previous Posts');
+}
+?>
+</h2>
+
+<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 wp_specialchars($s, 1); ?>" size="17" /> 
+  <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_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
+
+if ( count($arc_result) ) { ?>
+
+<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'>
+       <?php
+               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_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') ?>"  /> 
+       </fieldset>
+</form>
+
+<?php } ?>
+
+<br style="clear:both;" />
+
+<?php
+
+// define the columns to display, the syntax is 'internal name' => 'display name'
+$posts_columns = array(
+  'id'         => __('ID'),
+  'date'       => __('When'),
+  'title'      => __('Title'),
+  'categories' => __('Categories'),
+  'comments'   => __('Comments'),
+  'author'     => __('Author')
+);
+$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
+// you can not edit these at the moment
+$posts_columns['control_view']   = '';
+$posts_columns['control_edit']   = '';
+$posts_columns['control_delete'] = '';
+
+?>
+
+<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> 
+       <tr>
+
+<?php foreach($posts_columns as $column_display_name) { ?>
+       <th scope="col"><?php echo $column_display_name; ?></th>
+<?php } ?>
+
+       </tr>
+<?php
+if ($posts) {
+$bgcolor = '';
+foreach ($posts as $post) { start_wp();
+$class = ('alternate' == $class) ? '' : 'alternate';
+?> 
+       <tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
+
+<?php
+
+foreach($posts_columns as $column_name=>$column_display_name) {
+
+       switch($column_name) {
+       
+       case 'id':
+               ?>
+               <th scope="row"><?php echo $id ?></th>
+               <?php
+               break;
+
+       case 'date':
+               ?>
+               <td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td>
+               <?php
+               break;
+       case 'title':
+               ?>
+               <td><?php the_title() ?>
+               <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
+               <?php
+               break;
+
+       case 'categories':
+               ?>
+               <td><?php the_category(','); ?></td>
+               <?php
+               break;
+
+       case 'comments':
+               ?>
+               <td><a href="edit.php?p=<?php echo $id ?>&amp;c=1"> 
+      <?php comments_number(__('0'), __('1'), __('%')) ?> 
+      </a></td>
+               <?php
+               break;
+
+       case 'author':
+               ?>
+               <td><?php the_author() ?></td>
+               <?php
+               break;
+
+       case 'control_view':
+               ?>
+               <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
+               <?php
+               break;
+
+       case 'control_edit':
+               ?>
+               <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
+               <?php
+               break;
+
+       case 'control_delete':
+               ?>
+               <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;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."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+               <?php
+               break;
+
+       default:
+               ?>
+               <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
+               <?php
+               break;
+       }
+}
+?>
+       </tr> 
+<?php
+}
+} else {
+?>
+  <tr style='background-color: <?php echo $bgcolor; ?>'> 
+    <td colspan="8"><?php _e('No posts found.') ?></td> 
+  </tr> 
+<?php
+} // end if ($posts)
+?> 
+</table>
+
+<div id="ajax-response"></div>
+
+<div class="navigation">
+<div class="alignleft"><?php next_posts_link(__('&laquo; Previous Entries')) ?></div>
+<div class="alignright"><?php previous_posts_link(__('Next Entries &raquo;')) ?></div>
+</div>
+
+<?php
+if ( 1 == count($posts) ) {
+
+       $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+       if ($comments) {
+       ?> 
+<h3><?php _e('Comments') ?></h3> 
+<ol id="comments"> 
+<?php
+foreach ($comments as $comment) {
+$comment_status = wp_get_comment_status($comment->comment_ID);
+?> 
+
+<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=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
+                               if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
+                                       if ('approved' == wp_get_comment_status($comment->comment_ID)) {
+                                               echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
+                                       } else {
+                                               echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;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 
+ include('admin-footer.php');
+?> 
diff --git a/wp-admin/execute-pings.php b/wp-admin/execute-pings.php
new file mode 100644 (file)
index 0000000..8dc2945
--- /dev/null
@@ -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);
+       }
+}
+
+?>
diff --git a/wp-admin/images/box-bg.gif b/wp-admin/images/box-bg.gif
new file mode 100644 (file)
index 0000000..2eb7f58
Binary files /dev/null and b/wp-admin/images/box-bg.gif differ
diff --git a/wp-admin/images/box-butt.gif b/wp-admin/images/box-butt.gif
new file mode 100644 (file)
index 0000000..514a165
Binary files /dev/null and b/wp-admin/images/box-butt.gif differ
diff --git a/wp-admin/images/box-head.gif b/wp-admin/images/box-head.gif
new file mode 100644 (file)
index 0000000..5c09a9a
Binary files /dev/null and b/wp-admin/images/box-head.gif differ
diff --git a/wp-admin/images/browse-happy.gif b/wp-admin/images/browse-happy.gif
new file mode 100644 (file)
index 0000000..09f13bc
Binary files /dev/null and b/wp-admin/images/browse-happy.gif differ
diff --git a/wp-admin/images/fade-butt.png b/wp-admin/images/fade-butt.png
new file mode 100644 (file)
index 0000000..42f08b7
Binary files /dev/null and b/wp-admin/images/fade-butt.png differ
diff --git a/wp-admin/images/notice.gif b/wp-admin/images/notice.gif
new file mode 100644 (file)
index 0000000..ba6eab0
Binary files /dev/null and b/wp-admin/images/notice.gif differ
diff --git a/wp-admin/images/toggle.gif b/wp-admin/images/toggle.gif
new file mode 100644 (file)
index 0000000..72e8b44
Binary files /dev/null and b/wp-admin/images/toggle.gif differ
diff --git a/wp-admin/images/wordpress-logo.png b/wp-admin/images/wordpress-logo.png
new file mode 100644 (file)
index 0000000..3c852f4
Binary files /dev/null and b/wp-admin/images/wordpress-logo.png differ
diff --git a/wp-admin/import.php b/wp-admin/import.php
new file mode 100644 (file)
index 0000000..2ed94ee
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+require_once ('admin.php');
+$title = __('Import');
+$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 them into your current blog. To get started, choose a system to import from below:'); ?></p>
+
+<?php
+
+// Load all importers so that they can register.
+$import_loc = 'wp-admin/import';
+$import_root = ABSPATH.$import_loc;
+$imports_dir = @ dir($import_root);
+if ($imports_dir) {
+       while (($file = $imports_dir->read()) !== false) {
+               if (preg_match('|^\.+$|', $file))
+                       continue;
+               if (preg_match('|\.php$|', $file))
+                       require_once("$import_root/$file");
+       }
+}
+
+$importers = get_importers();
+
+if (empty ($importers)) {
+       echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
+} else {
+?>
+<table width="100%" cellpadding="3" cellspacing="3">
+
+<?php
+       $style = '';
+       foreach ($importers as $id => $data) {
+               $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
+               $action = "<a href='admin.php?import=$id' title='{$data[1]}'>{$data[0]}</a>";
+
+               if ($style != '')
+                       $style = 'class="'.$style.'"';
+               echo "
+                       <tr $style>
+                               <td class=\"togl\">$action</td>
+                               <td class=\"desc\">{$data[1]}</td>
+                       </tr>";
+       }
+?>
+
+</table>
+<?php
+}
+?>
+
+</div>
+
+<?php
+
+include ('admin-footer.php');
+?>
+
diff --git a/wp-admin/import/b2.php b/wp-admin/import/b2.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
new file mode 100644 (file)
index 0000000..88aa405
--- /dev/null
@@ -0,0 +1,667 @@
+<?php
+
+class Blogger_Import {
+
+       var $lump_authors = false;
+       var $import = array();
+
+       // Shows the welcome screen and the magic iframe.
+       function greet() {
+               $title = __('Import Blogger');
+               $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
+               $noiframes = __('This feature requires iframe support.');
+               $warning = __('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?');
+               $reset = __('Reset this importer');
+               $incompat = __('Your web server is not properly configured to use this importer. Please enable the CURL extension for PHP and then reload this page.');
+
+               echo "<div class='wrap'><h2>$title</h2><p>$welcome</p>";
+               if ( function_exists('curl_init') )
+                       echo "<iframe src='admin.php?import=blogger&amp;noheader=true' height='350px' width = '99%'>$noiframes</iframe><p><a href='admin.php?import=blogger&amp;restart=true&amp;noheader=true' onclick='return confirm(\"$warning\")'>$reset</a></p>";
+               else
+                       echo "<p>$incompat</p>";
+               echo "</div>\n";
+       }
+
+       // Deletes saved data and redirect.
+       function restart() {
+               delete_option('import-blogger');
+               header("Location: admin.php?import=blogger");
+               die();
+       }
+
+       // Generates a string that will make the page reload in a specified interval.
+       function refresher($msec) {
+               if ( $msec )
+                       return "<html><head><script type='text/javascript'>window.onload=setTimeout('window.location.reload()', $msec);</script>\n</head>\n<body>\n";
+               else
+                       return "<html><head><script type='text/javascript'>window.onload=window.location.reload();</script>\n</head>\n<body>\n";
+       }
+
+       // Returns associative array of code, header, cookies, body. Based on code from php.net.
+       function parse_response($this_response) {
+               // Split response into header and body sections
+               list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
+               $response_header_lines = explode("\r\n", $response_headers);
+
+               // First line of headers is the HTTP response code
+               $http_response_line = array_shift($response_header_lines);
+               if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
+
+               // put the rest of the headers in an array
+               $response_header_array = array();
+               foreach($response_header_lines as $header_line) {
+                       list($header,$value) = explode(': ', $header_line, 2);
+                       $response_header_array[$header] .= $value."\n";
+               }
+
+               $cookie_array = array();
+               $cookies = explode("\n", $response_header_array["Set-Cookie"]);
+               foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); }
+
+               return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body);
+       }
+
+       // Prints a form for the user to enter Blogger creds.
+       function login_form($text='') {
+               echo '<h1>' . __('Log in to Blogger') . "</h1>\n$text\n";
+               echo '<form method="post" action="admin.php?import=blogger&amp;noheader=true&amp;step=0"><table><tr><td>' . __('Username') . ':</td><td><input type="text" name="user" /></td></tr><tr><td>' . __('Password') . ':</td><td><input type="password" name="pass" /></td><td><input type="submit" value="' . __('Start') . '" /></td></tr></table></form>';
+               die;
+       }
+
+       // Sends creds to Blogger, returns the session cookies an array of headers.
+       function login_blogger($user, $pass) {
+               $_url = 'http://www.blogger.com/login.do';
+               $params = "username=$user&password=$pass";
+               $ch = curl_init();
+               curl_setopt($ch, CURLOPT_POST,1);
+               curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
+               curl_setopt($ch, CURLOPT_URL,$_url);
+               curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
+               curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
+               curl_setopt($ch, CURLOPT_HEADER,1);
+               curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+               $response = curl_exec ($ch);
+
+               $response = $this->parse_response($response);
+
+               sleep(1);
+
+               return $response['cookies'];
+       }
+
+       // Requests page from Blogger, returns the response array.
+       function get_blogger($url, $header = '', $user=false, $pass=false) {
+               $ch = curl_init();
+               if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}");
+               curl_setopt($ch, CURLOPT_URL,$url);
+               curl_setopt($ch, CURLOPT_TIMEOUT, 10);
+               curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+               curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+               curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
+               curl_setopt($ch, CURLOPT_HEADER,1);
+               if (is_array($header)) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
+               $response = curl_exec ($ch);
+
+               $response = $this->parse_response($response);
+               $response['url'] = $url;
+
+               if (curl_errno($ch)) {
+                       print curl_error($ch);
+               } else {
+                       curl_close($ch);
+               }
+
+               return $response;
+       }
+
+       // Posts data to Blogger, returns response array.
+       function post_blogger($url, $header = false, $paramary = false, $parse=true) {
+               $params = '';
+               if ( is_array($paramary) ) {
+                       foreach($paramary as $key=>$value)
+                               if($key && $value != '')
+                                       $params.=$key."=".urlencode(stripslashes($value))."&";
+               }
+               if ($user && $pass) $params .= "username=$user&password=$pass";
+               $params = trim($params,'&');
+               $ch = curl_init();
+               curl_setopt($ch, CURLOPT_POST,1);
+               curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
+               if ($user && $pass) curl_setopt($ch, CURLOPT_USERPWD,"{$user}:{$pass}");
+               curl_setopt($ch, CURLOPT_URL,$url);
+               curl_setopt($ch, CURLOPT_USERAGENT, 'Blogger Exporter');
+               curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+               curl_setopt($ch, CURLOPT_HEADER,$parse);
+               curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+               if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
+               $response = curl_exec ($ch);
+       
+               if ($parse) {
+                       $response = $this->parse_response($response);
+                       $response['url'] = $url;
+                       return $response;
+               }
+       
+               return $response;
+       }
+
+       // Prints the list of blogs for import.
+       function show_blogs() {
+               global $import;
+               echo '<h1>' . __('Selecting a Blog') . "</h1>\n<ul>";
+               foreach ( $this->import['blogs'] as $blog ) {
+                       if (9 == $blog['nextstep']) $status = "100%";
+                       elseif (8 == $blog['nextstep']) $status = "90%";
+                       elseif (7 == $blog['nextstep']) $status = "82.5%";
+                       elseif (6 == $blog['nextstep']) $status = "75%";
+                       elseif (5 == $blog['nextstep']) $status = "57%";
+                       elseif (4 == $blog['nextstep']) $status = "28%";
+                       elseif (3 == $blog['nextstep']) $status = "14%";
+                       else $status = "0%";
+                       echo "\t<li><a href='admin.php?import=blogger&amp;noheader=true&amp;blog={$blog['id']}'>{$blog['title']}</a> $status</li>\n";
+               }
+               die("</ul>\n");
+       }
+
+       // Publishes.
+       function publish_blogger($i, $text) {
+               $head = $this->refresher(2000) . "<h1>$text</h1>\n";
+               if ( ! strstr($this->import['blogs'][$_GET['blog']]['publish'][$i], 'http') ) {
+                       // First call. Start the publish process with a fresh set of cookies.
+                       $this->import['cookies'] = $this->login_blogger($this->import['user'], $this->import['pass']);
+                       update_option('import-blogger', $this->import);
+                       $paramary = array('blogID' => $_GET['blog'], 'all' => '1', 'republishAll' => 'Republish Entire Blog', 'publish' => '1', 'redirectUrl' => "/publish.do?blogID={$_GET['blog']}&inprogress=true");
+
+                       $response = $this->post_blogger("http://www.blogger.com/publish.do?blogID={$_GET['blog']}", $this->import['cookies'], $paramary);
+                       if ( $response['code'] == '302' ) {
+                               $url = str_replace('publish.g', 'publish-body.g', $response['header']['Location']);
+                               $this->import['blogs'][$_GET['blog']]['publish'][$i] = $url;
+                               update_option('import-blogger', $this->import);
+                               $response = $this->get_blogger($url, $this->import['cookies']);
+                               preg_match('#<p class="progressIndicator">.*</p>#U', $response['body'], $matches);
+                               $progress = $matches[0];
+                               die($head . $progress);
+                       } else {
+                               $this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
+                               update_option('import-blogger', $this->import);
+                               die($head);
+                       }
+               } else {
+                       // Subsequent call. Keep checking status until Blogger reports publish complete.
+                       $url = $this->import['blogs'][$_GET['blog']]['publish'][$i];
+                       $response = $this->get_blogger($url, $this->import['cookies']);
+                       if ( preg_match('#<p class="progressIndicator">.*</p>#U', $response['body'], $matches) ) {
+                               $progress = $matches[0];
+                               if ( strstr($progress, '100%') ) {
+                                       $this->set_next_step($i);
+                                       $progress .= '<p>'.__('Moving on...').'</p>';
+                               }
+                               die($head . $progress);
+                       } else {
+                               $this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
+                               update_option('import-blogger', $this->import);
+                               die("$head<p>" . __('Trying again...') . '</p>');
+                       }
+               }
+       }
+
+       // Sets next step, saves options
+       function set_next_step($step) {
+               $this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
+               update_option('import-blogger', $this->import);
+       }
+       
+       // Redirects to next step
+       function do_next_step() {
+               header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
+               die();
+       }
+
+       // Step 0: Do Blogger login, get blogid/title pairs.
+       function do_login() {
+               if ( ( ! $this->import['user'] && ! is_array($this->import['cookies']) ) ) {
+                       // The user must provide a Blogger username and password.
+                       if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
+                               $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
+                       }
+               
+                       // Try logging in. If we get an array of cookies back, we at least connected.           
+                       $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
+                       if ( !is_array( $this->import['cookies'] ) ) {
+                               $this->login_form(__('Login failed. Please enter your credentials again.'));
+                       }
+                       
+                       // Save the password so we can log the browser in when it's time to publish.
+                       $this->import['pass'] = $_POST['pass'];
+                       $this->import['user'] = $_POST['user'];
+
+                       // Get the Blogger welcome page and scrape the blog numbers and names from it
+                       $response = $this->get_blogger('http://www.blogger.com/home', $this->import['cookies']);
+                       if (! stristr($response['body'], 'signed in as') ) $this->login_form(__('Login failed. Please re-enter your username and password.'));
+                       $blogsary = array();
+                       preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#U', $response['body'], $blogsary);
+                       if ( ! count( $blogsary[1] < 1 ) )
+                               die(__('No blogs found for this user.'));
+                       $this->import['blogs'] = array();
+                       $template = '<MainPage><br /><br /><br /><p>'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. Meanwhile, discover <a href="http://wordpress.org/">a better blogging tool</a>.').'</p><BloggerArchives><a class="archive" href="<$BlogArchiveURL$>"><$BlogArchiveName$></a><br /></BloggerArchives></MainPage><ArchivePage><Blogger><wordpresspost><$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><BlogItemCommentsEnabled><BlogItemComments><wordpresscomment><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$></BlogItemComments></BlogItemCommentsEnabled></Blogger></ArchivePage>';
+                       foreach ( $blogsary[1] as $key => $id ) {
+                               // Define the required Blogger options.
+                               $blog_opts = array(
+                                       'blog-options-basic' => false,
+                                       'blog-options-archiving' => array('archiveFrequency' => 'm'),
+                                       'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'),
+                                       'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'),
+                                       'blog-comments' => array('commentsTimeStampFormat' => '0'),
+                                       'template-edit' => array( 'templateText' =>  str_replace('%title%', trim($blogsary[2][$key]), $template) )
+                               );
+
+                               // Build the blog options array template
+                               foreach ($blog_opts as $blog_opt => $modify)
+                                       $new_opts["$blog_opt"] = array('backup'=>false, 'modify' => $modify, 'error'=>false);
+
+                               $this->import['blogs']["$id"] = array(
+                                       'id' => $id,
+                                       'title' => trim($blogsary[2][$key]),
+                                       'options' => $new_opts,
+                                       'url' => false,
+                                       'publish_cookies' => false,
+                                       'published' => false,
+                                       'archives' => false,
+                                       'lump_authors' => false,
+                                       'newusers' => array(),
+                                       'nextstep' => 2
+                               );
+                       }
+                       update_option('import-blogger', $this->import);
+                       header("Location: admin.php?import=blogger&noheader=true&step=1");
+               }
+               die();
+       }
+
+       // Step 1: Select one of the blogs belonging to the user logged in.
+       function select_blog() {
+               if ( is_array($this->import['blogs']) ) {
+                       $this->show_blogs();
+                       die();
+               } else {
+                       $this->restart();
+               }
+       }
+
+       // Step 2: Backup the Blogger options pages, updating some of them.
+       function backup_settings() {
+               $output.= '<h1>'.__('Backing up Blogger options')."</h1>\n";
+               $form = false;
+               foreach ($this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary) {
+                       if ( $blog_opt == $_GET['form'] ) {
+                               // Save the posted form data
+                               $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup'] = $_POST;
+                               update_option('import-blogger',$this->import);
+
+                               // Post the modified form data to Blogger
+                               if ( $optary['modify'] ) {
+                                       $posturl = "http://www.blogger.com/{$blog_opt}.do";
+                                       $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']);
+                                       if ( 'blog-publishing' == $blog_opt ) {
+                                               if ( $_POST['publishMode'] > 0 ) {
+                                                       $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers);
+                                                       if ( $response['code'] >= 400 )
+                                                               die('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
+                                                       $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/';
+                                                       sleep(2);
+                                               } else {
+                                                       $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $_POST['subdomain'] . '.blogspot.com/';
+                                                       update_option('import-blogger', $this->import);
+                                                       $output .= "<del><p>$blog_opt</p></del>\n";
+                                                       continue;
+                                               }
+                                               $paramary = $optary['modify'];
+                                       } else {
+                                               $paramary = array_merge($_POST, $optary['modify']);
+                                       }
+                                       $response = $this->post_blogger($posturl, $headers, $paramary);
+                                       if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') )
+                                               die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
+                               }
+                               $output .= "<del><p>$blog_opt</p></del>\n";
+                       } elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) {
+                               // This option set has already been backed up.
+                               $output .= "<del><p>$blog_opt</p></del>\n";
+                       } elseif ( ! $form ) {
+                               // This option page needs to be downloaded and given to the browser for submission back to this script.
+                               $response = $this->get_blogger("http://www.blogger.com/{$blog_opt}.g?blogID={$_GET['blog']}", $this->import['cookies']);
+                               $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'] = $response['cookies'];
+                               update_option('import-blogger',$this->import);
+                               $body = $response['body'];
+                               $body = preg_replace("|\<!DOCTYPE.*\<body[^>]*>|ms","",$body);
+                               $body = preg_replace("|/?{$blog_opt}.do|","admin.php?import=blogger&amp;noheader=true&amp;step=2&amp;blog={$_GET['blog']}&amp;form={$blog_opt}",$body);
+                               $body = str_replace("name='submit'","name='supermit'",$body);
+                               $body = str_replace('name="submit"','name="supermit"',$body);
+                               $body = str_replace('</body>','',str_replace('</html>','',$body));
+                               $form = "<div style='height:0px;width:0px;overflow:hidden;'>";
+                               $form.= $body;
+                               $form.= "</div><script type='text/javascript'>forms=document.getElementsByTagName('form');for(i=0;i<forms.length;i++){if(forms[i].action.search('{$blog_opt}')){forms[i].submit();break;}}</script>";
+                               $output.= '<p>'.sprintf('<strong>%s</strong> in progress, please wait...', $blog_opt)."</p>\n";
+                       } else {
+                               $output.= "<p>$blog_opt</p>\n";
+                       }
+               }
+               if ( $form )
+                       die($output . $form);
+
+               $this->set_next_step(4);
+               $this->do_next_step();
+       }
+
+       // Step 3: Cancelled :-)
+
+       // Step 4: Publish with the new template and settings.
+       function publish_blog() {
+               $this->publish_blogger(5, __('Publishing with new template and options'));
+       }
+
+       // Step 5: Get the archive URLs from the new blog.
+       function get_archive_urls() {
+               $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']);
+               if (! strstr($bloghtml['body'], '<a class="archive"') )
+                       die(__('Your Blogger blog did not take the new template or did not respond.'));
+               preg_match_all('#<a class="archive" href="([^"]*)"#', $bloghtml['body'], $archives);
+               foreach ($archives[1] as $archive) {
+                       $this->import['blogs'][$_GET['blog']]['archives'][$archive] = false;
+               }
+               $this->set_next_step(6);
+               $this->do_next_step();
+       }
+
+       // Step 6: Get each monthly archive, import it, mark it done.
+       function get_archive() {
+               global $wpdb;
+               $output = '<h2>'.__('Importing Blogger archives into WordPress').'</h2>';
+               $did_one = false;
+               $post_array = $posts = array();
+               foreach ( $this->import['blogs'][$_GET['blog']]['archives'] as $url => $status ) {
+                       $archivename = substr(basename($url),0,7);
+                       if ( $status || $did_one ) {
+                               $foo = 'bar';
+                               // Do nothing.
+                       } else {
+                               // Import the selected month
+                               $postcount = 0;
+                               $skippedpostcount = 0;
+                               $commentcount = 0;
+                               $skippedcommentcount = 0;
+                               $status = __('in progress...');
+                               $this->import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
+                               update_option('import-blogger', $import);
+                               $archive = $this->get_blogger($url);
+                               if ( $archive['code'] > 200 )
+                                       continue;       
+                               $posts = explode('<wordpresspost>', $archive['body']);
+                               for ($i = 1; $i < count($posts); $i = $i + 1) {
+                                       $postparts = explode('<wordpresscomment>', $posts[$i]);
+                                       $postinfo = explode('|W|P|', $postparts[0]);
+                                       $post_date = $postinfo[0];
+                                       $post_content = $postinfo[2];
+                                       // Don't try to re-use the original numbers
+                                       // because the new, longer numbers are too
+                                       // big to handle as ints.
+                                       //$post_number = $postinfo[3];
+                                       $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
+                                       $post_author_name = $wpdb->escape(trim($postinfo[1]));
+                                       $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
+       
+                                       if ( $this->lump_authors ) {
+                                               // Ignore Blogger authors. Use the current user_ID for all posts imported.
+                                               $post_author = $GLOBALS['user_ID'];
+                                       } else {
+                                               // Add a user for each new author encountered.
+                                               if (! username_exists($post_author_name) ) {
+                                                       $user_login = $wpdb->escape($post_author_name);
+                                                       $user_email = $wpdb->escape($post_author_email);
+                                                       $user_password = substr(md5(uniqid(microtime())), 0, 6);
+                                                       $result = wp_create_user( $user_login, $user_password, $user_email );
+                                                       $status.= sprintf('Registered user <strong>%s</strong>.', $user_login);
+                                                       $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login;
+                                               }
+                                               $userdata = get_userdatabylogin( $post_author_name );
+                                               $post_author = $userdata->ID;
+                                       }
+                                       $post_date = explode(' ', $post_date);
+                                       $post_date_Ymd = explode('/', $post_date[0]);
+                                       $postyear = $post_date_Ymd[2];
+                                       $postmonth = zeroise($post_date_Ymd[0], 2);
+                                       $postday = zeroise($post_date_Ymd[1], 2);
+                                       $post_date_His = explode(':', $post_date[1]);
+                                       $posthour = zeroise($post_date_His[0], 2);
+                                       $postminute = zeroise($post_date_His[1], 2);
+                                       $postsecond = zeroise($post_date_His[2], 2);
+       
+                                       if (($post_date[2] == 'PM') && ($posthour != '12'))
+                                               $posthour = $posthour + 12;
+                                       else if (($post_date[2] == 'AM') && ($posthour == '12'))
+                                               $posthour = '00';
+       
+                                       $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
+       
+                                       $post_content = addslashes($post_content);
+                                       $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
+       
+                                       $post_title = addslashes($post_title);
+                       
+                                       $post_status = 'publish';
+       
+                                       if ( $ID = post_exists($post_title, '', $post_date) ) {
+                                               $post_array[$i]['ID'] = $ID;
+                                               $skippedpostcount++;
+                                       } else {
+                                               $post_array[$i]['post'] = compact('post_author', 'post_content', 'post_title', 'post_category', 'post_author', 'post_date', 'post_status');
+                                               $post_array[$i]['comments'] = false;
+                                       }
+
+                                       // Import any comments attached to this post.
+                                       if ($postparts[1]) :
+                                       for ($j = 1; $j < count($postparts); $j = $j + 1) {
+                                               $commentinfo = explode('|W|P|', $postparts[$j]);
+                                               $comment_date = explode(' ', $commentinfo[0]);
+                                               $comment_date_Ymd = explode('/', $comment_date[0]);
+                                               $commentyear = $comment_date_Ymd[2];
+                                               $commentmonth = zeroise($comment_date_Ymd[0], 2);
+                                               $commentday = zeroise($comment_date_Ymd[1], 2);
+                                               $comment_date_His = explode(':', $comment_date[1]);
+                                               $commenthour = zeroise($comment_date_His[0], 2);
+                                               $commentminute = zeroise($comment_date_His[1], 2);
+                                               $commentsecond = '00';
+                                               if (($comment_date[2] == 'PM') && ($commenthour != '12'))
+                                                       $commenthour = $commenthour + 12;
+                                               else if (($comment_date[2] == 'AM') && ($commenthour == '12'))
+                                                       $commenthour = '00';
+                                               $comment_date = "$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
+                                               $comment_author = addslashes(strip_tags($commentinfo[1]));
+                                               if ( strpos($commentinfo[1], 'a href') ) {
+                                                       $comment_author_parts = explode('&quot;', htmlentities($commentinfo[1]));
+                                                       $comment_author_url = $comment_author_parts[1];
+                                               } else $comment_author_url = '';
+                                               $comment_content = $commentinfo[2];
+                                               $comment_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $comment_content);
+                                               $comment_approved = 1;
+                                               if ( comment_exists($comment_author, $comment_date) ) {
+                                                       $skippedcommentcount++;
+                                               } else {
+                                                       $comment = compact('comment_author', 'comment_author_url', 'comment_date', 'comment_content', 'comment_approved');
+                                                       $post_array[$i]['comments'][$j] = wp_filter_comment($comment);
+                                               }
+                                               $commentcount++;
+                                       }
+                                       endif;
+                                       $postcount++;
+                               }
+                               if ( count($post_array) ) {
+                                       krsort($post_array);
+                                       foreach($post_array as $post) {
+                                               if ( ! $comment_post_ID = $post['ID'] )
+                                                       $comment_post_ID = wp_insert_post($post['post']);
+                                               if ( $post['comments'] ) {
+                                                       foreach ( $post['comments'] as $comment ) {
+                                                               $comment['comment_post_ID'] = $comment_post_ID;
+                                                               wp_insert_comment($comment);
+                                                       }
+                                               }
+                                       }
+                               }
+                               $status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount,  $skippedpostcount).' '.
+                                       sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcoun, $skippedcommentcount).' '.
+                                       ' <strong>'.__('Done').'</strong>';
+                               $import = $this->import;
+                               $import['blogs'][$_GET['blog']]['archives']["$url"] = $status;
+                               update_option('import-blogger', $import);
+                               $did_one = true;
+                       }
+                       $output.= "<p>$archivename $status</p>\n";
+               }
+               if ( ! $did_one )
+                       $this->set_next_step(7);
+               die( $this->refresher(1000) . $output );
+       }
+
+       // Step 7: Restore the backed-up settings to Blogger
+       function restore_settings() {
+               $output = '<h1>'.__('Restoring your Blogger options')."</h1>\n";
+               $did_one = false;
+               // Restore options in reverse order.
+               if ( ! $this->import['reversed'] ) {
+                       $this->import['blogs'][$_GET['blog']]['options'] = array_reverse($this->import['blogs'][$_GET['blog']]['options'], true);
+                       $this->import['reversed'] = true;
+                       update_option('import-blogger', $this->import);
+               }
+               foreach ( $this->import['blogs'][$_GET['blog']]['options'] as $blog_opt => $optary ) {
+                       if ( $did_one ) {
+                               $output .= "<p>$blog_opt</p>\n";
+                       } elseif ( $optary['restored'] || ! $optary['modify'] ) {
+                               $output .= "<p><del>$blog_opt</del></p>\n";
+                       } else {
+                               $posturl = "http://www.blogger.com/{$blog_opt}.do";
+                               $headers = array_merge($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['cookies'], $this->import['cookies']);
+                               if ( 'blog-publishing' == $blog_opt) {
+                                       if ( $optary['backup']['publishMode'] > 0 ) {
+                                               $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers);
+                                               sleep(2);
+                                               if ( $response['code'] >= 400 )
+                                                       die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
+                                       }
+                               }
+                               if ( $optary['backup'] != $optary['modify'] ) {
+                                       $response = $this->post_blogger($posturl, $headers, $optary['backup']);
+                                       if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) {
+                                               $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['error'] = true;
+                                               update_option('import-blogger', $this->import);
+                                               $output .= sprintf(__('%s failed. Trying again.'), "<p><strong>$blog_opt</strong> ").'</p>';
+                                       } else {
+                                               $this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['restored'] = true;
+                                               update_option('import-blogger', $this->import);
+                                               $output .= sprintf(__('%s restored.'), "<p><strong>$blog_opt</strong> ").'</p>';
+                                       }
+                               }
+                               $did_one = true;
+                       }
+               }
+
+               if ( $did_one ) {
+                       die( $this->refresher(1000) . $output );
+               } elseif ( $this->import['blogs'][$_GET['blog']]['options']['blog-publishing']['backup']['publishMode'] > 0 ) {
+                       $this->set_next_step(9);
+               } else {
+                       $this->set_next_step(8);
+               }
+
+               $this->do_next_step();
+       }
+
+       // Step 8: Republish, all back to normal
+       function republish_blog() {
+               $this->publish_blogger(9, __('Publishing with original template and options'));
+       }
+
+       // Step 9: Congratulate the user
+       function congrats() {
+               echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
+               if ( count($this->import['blogs']) > 1 )
+                       echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
+               if ( $n = count($this->import['blogs'][$_GET['blog']]['newusers']) )
+                       echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
+               echo '<li>'.__('For security, click the link below to reset this importer. That will clear your Blogger credentials and options from the database.').'</li>';
+               echo '</ul>';
+       }
+
+       // Figures out what to do, then does it.
+       function start() {
+               if ( $_GET['restart'] == 'true' ) {
+                       $this->restart();
+               }
+               
+               if ( isset($_GET['noheader']) ) {
+                       header('Content-Type: text/html; charset=utf-8');
+
+                       $this->import = get_settings('import-blogger');
+
+                       if ( false === $this->import ) {
+                               $step = 0;
+                       } elseif ( isset($_GET['step']) ) {
+                               $step = (int) $_GET['step'];
+                       } elseif ( isset($_GET['blog']) && isset($this->import['blogs'][$_GET['blog']]['nextstep']) ) {
+                               $step = $this->import['blogs'][$_GET['blog']]['nextstep'];
+                       } elseif ( is_array($this->import['blogs']) ) {
+                               $step = 1;
+                       } else {
+                               $step = 0;
+                       }
+//echo "Step $step.";
+//die('<pre>'.print_r($this->import,1).'</pre');
+                       switch ($step) {
+                               case 0 :
+                                       $this->do_login();
+                                       break;
+                               case 1 :
+                                       $this->select_blog();
+                                       break;
+                               case 2 :
+                                       $this->backup_settings();
+                                       break;
+                               case 3 :
+                                       $this->wait_for_blogger();
+                                       break;
+                               case 4 :
+                                       $this->publish_blog();
+                                       break;
+                               case 5 :
+                                       $this->get_archive_urls();
+                                       break;
+                               case 6 :
+                                       $this->get_archive();
+                                       break;
+                               case 7 :
+                                       $this->restore_settings();
+                                       break;
+                               case 8 :
+                                       $this->republish_blog();
+                                       break;
+                               case 9 :
+                                       $this->congrats();
+                                       break;
+                       }
+                       die;
+                       
+               } else {
+                       $this->greet();
+               }
+       }
+
+       function Blogger_Import() {
+               // This space intentionally left blank.
+       }
+}
+
+$blogger_import = new Blogger_Import();
+
+register_importer('blogger', 'Blogger', __('Import posts and comments from a Blogger account'), array ($blogger_import, 'start'));
+
+?>
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
new file mode 100644 (file)
index 0000000..2caab8c
--- /dev/null
@@ -0,0 +1,741 @@
+<?php
+/**
+       Add These Functions to make our lives easier
+**/
+if(!function_exists('get_catbynicename'))
+{
+       function get_catbynicename($category_nicename) 
+       {
+       global $wpdb;
+       
+       $cat_id -= 0;   // force numeric
+       $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
+       
+       return $name;
+       }
+}
+
+if(!function_exists('get_comment_count'))
+{
+       function get_comment_count($post_ID)
+       {
+               global $wpdb;
+               return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+       }
+}
+
+if(!function_exists('link_cat_exists'))
+{
+       function link_cat_exists($catname)
+       {
+               global $wpdb;
+               return $wpdb->get_var('SELECT cat_id FROM '.$wpdb->linkcategories.' WHERE cat_name = "'.$wpdb->escape($catname).'"');
+       }
+}
+
+if(!function_exists('link_exists'))
+{
+       function link_exists($linkname)
+       {
+               global $wpdb;
+               return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
+       }
+}
+
+/*
+ Identify UTF-8 text
+ Taken from http://www.php.net/manual/fr/function.mb-detect-encoding.php#50087
+*/
+//
+//    utf8 encoding validation developed based on Wikipedia entry at:
+//    http://en.wikipedia.org/wiki/UTF-8
+//
+//    Implemented as a recursive descent parser based on a simple state machine
+//    copyright 2005 Maarten Meijer
+//
+//    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_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 csc ($s) {
+       if (valid_utf8 ($s)) {
+               return $s;
+       } else {
+               return iconv(get_option ("dccharset"),"UTF-8",$s);
+       }
+}
+
+function textconv ($s) {
+       return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
+}
+
+/**
+       The Main Importer Class
+**/
+class Dotclear_Import {
+
+       function header() 
+       {
+               echo '<div class="wrap">';
+               echo '<h2>'.__('Import Dotclear').'</h2>';
+               echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
+       }
+
+       function footer() 
+       {
+               echo '</div>';
+       }
+       
+       function greet() 
+       {
+               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">';
+               $this->db_form();
+               echo '<input type="submit" name="submit" value="'.__('Import Categories').'" />';
+               echo '</form>';
+       }
+
+       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);
+               $prefix = get_option('tpre');
+               
+               // Get Categories
+               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);
+               $prefix = get_option('tpre');
+               
+               // Get Users
+               
+               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);
+               $prefix = get_option('tpre');
+               
+               // Get Posts
+               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);
+               $prefix = get_option('tpre');
+               
+               // Get Comments
+               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);
+               $prefix = get_option('tpre');
+
+               return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
+       }
+       
+       function cat2wp($categories='') 
+       {
+               // General Housekeeping
+               global $wpdb;
+               $count = 0;
+               $dccat2wpcat = array();
+               // Do the Magic
+               if(is_array($categories))
+               {
+                       echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
+                       foreach ($categories as $category) 
+                       {
+                               $count++;
+                               extract($category);
+                               
+                               // Make Nice Variables
+                               $name = $wpdb->escape($cat_libelle_url);
+                               $title = $wpdb->escape(csc ($cat_libelle));
+                               $desc = $wpdb->escape(csc ($cat_desc));
+
+                               if($cinfo = category_exists($name))
+                               {
+                                       $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
+                               }
+                               else
+                               {
+                                       $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
+                               }
+                               $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>';
+                       return true;
+               }
+               echo __('No Categories to Import!');
+               return false;
+       }
+       
+       function users2wp($users='')
+       {
+               // General Housekeeping
+               global $wpdb;
+               $count = 0;
+               $dcid2wpid = array();
+               
+               // Midnight Mojo
+               if(is_array($users))
+               {
+                       echo '<p>'.__('Importing Users...').'<br /><br /></p>';
+                       foreach($users as $user)
+                       {
+                               $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,
+                                                               'user_nicename' => $Realname,
+                                                               'user_email'    => $user_email,
+                                                               'user_url'      => 'http://',
+                                                               'display_name'  => $Realname)
+                                                               );
+                               }
+                               else 
+                               {
+                                       $ret_id = wp_insert_user(array(
+                                                               'user_login'    => $user_id,
+                                                               'user_nicename' => csc ($user_pseudo),
+                                                               'user_email'    => $user_email,
+                                                               'user_url'      => 'http://',
+                                                               'display_name'  => $Realname)
+                                                               );
+                               }
+                               $dcid2wpid[$user_id] = $ret_id;
+                               
+                               // Set Dotclear-to-WordPress permissions translation
+                               
+                               // Update Usermeta Data
+                               $user = new WP_User($ret_id);
+                               $wp_perms = $user_level + 1;
+                               if(10 == $wp_perms) { $user->set_role('administrator'); }
+                               else if(9  == $wp_perms) { $user->set_role('editor'); }
+                               else if(5  <= $wp_perms) { $user->set_role('editor'); }
+                               else if(4  <= $wp_perms) { $user->set_role('author'); }
+                               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
+               global $wpdb;
+               $count = 0;
+               $dcposts2wpposts = array();
+               $cats = array();
+
+               // Do the Magic
+               if(is_array($posts))
+               {