Moving the webkit.opendarwin.org site into our Subversion repository.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2006 23:56:12 +0000 (23:56 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2006 23:56:12 +0000 (23:56 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12158 268f45cc-cd09-0410-ab3c-d52691b4dbfc

230 files changed:
WebKitSite/blog/index.php [new file with mode: 0644]
WebKitSite/blog/license.txt [new file with mode: 0644]
WebKitSite/blog/readme.html [new file with mode: 0644]
WebKitSite/blog/wp-admin/admin-footer.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/admin-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/admin-header.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/admin.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/bookmarklet.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/categories.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-comments.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-form-advanced.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-form-comment.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-form.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-page-form.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit-pages.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/edit.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-b2.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-blogger.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-greymatter.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-livejournal.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-mt.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-rss.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/import-textpattern.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/index.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/install-helper.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/install.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/link-add.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/link-categories.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/link-import.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/link-manager.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/link-parse-opml.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/menu-header.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/menu.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/moderation.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-discussion.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-general.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-head.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-misc.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-permalink.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-reading.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options-writing.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/options.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/page-new.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/plugin-editor.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/plugins.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/post.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/profile.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/quicktags.js [new file with mode: 0644]
WebKitSite/blog/wp-admin/setup-config.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/sidebar.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/templates.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/theme-editor.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/themes.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/update-links.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/upgrade-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/upgrade-schema.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/upgrade.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/upload.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/user-edit.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/users.php [new file with mode: 0644]
WebKitSite/blog/wp-admin/wp-admin.css [new file with mode: 0644]
WebKitSite/blog/wp-atom.php [new file with mode: 0644]
WebKitSite/blog/wp-blog-header.php [new file with mode: 0644]
WebKitSite/blog/wp-comments-post.php [new file with mode: 0644]
WebKitSite/blog/wp-commentsrss2.php [new file with mode: 0644]
WebKitSite/blog/wp-config-sample.php [new file with mode: 0644]
WebKitSite/blog/wp-config.php [new file with mode: 0644]
WebKitSite/blog/wp-content/plugins/hello.php [new file with mode: 0644]
WebKitSite/blog/wp-content/plugins/markdown.php [new file with mode: 0644]
WebKitSite/blog/wp-content/plugins/textile1.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/comments-popup.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/comments.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/footer.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/header.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/index.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/sidebar.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/classic/style.css [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/404.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/archive.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/archives.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/comments-popup.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/comments.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/footer.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/header.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/images/kubrickbg.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/images/kubrickbgcolor.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/images/kubrickbgwide.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/images/kubrickfooter.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/images/kubrickheader.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/index.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/links.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/page.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/search.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/searchform.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/sidebar.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/single.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/default/style.css [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/404.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/archive.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/archives.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/comments-popup.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/comments.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/footer.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/header.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/bluebanner.png [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/kubrickbg.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/kubrickbgcolor.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/kubrickbgwide.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/kubrickfooter.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/kubrickheader.jpg [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/separator.png [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/images/webkit-background.png [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/index.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/links.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/page.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/search.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/searchform.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/sidebar.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/single.php [new file with mode: 0644]
WebKitSite/blog/wp-content/themes/webkit/style.css [new file with mode: 0644]
WebKitSite/blog/wp-feed.php [new file with mode: 0644]
WebKitSite/blog/wp-images/fade-butt.png [new file with mode: 0644]
WebKitSite/blog/wp-images/get-firefox.png [new file with mode: 0644]
WebKitSite/blog/wp-images/header-shadow.png [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_arrow.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_biggrin.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_confused.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_cool.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_cry.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_eek.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_evil.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_exclaim.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_idea.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_lol.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_mad.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_mrgreen.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_neutral.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_question.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_razz.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_redface.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_rolleyes.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_sad.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_smile.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_surprised.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_twisted.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/smilies/icon_wink.gif [new file with mode: 0644]
WebKitSite/blog/wp-images/wp-small.png [new file with mode: 0644]
WebKitSite/blog/wp-images/wpminilogo.png [new file with mode: 0644]
WebKitSite/blog/wp-includes/class-IXR.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/class-pop3.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/class-snoopy.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/classes.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/comment-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/default-filters.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/feed-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/functions-compat.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/functions-formatting.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/functions-post.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/functions.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/gettext.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/kses.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/links.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/locale.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/pluggable-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/rss-functions.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/streams.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/template-functions-author.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/template-functions-category.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/template-functions-general.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/template-functions-links.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/template-functions-post.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/vars.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/version.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/wp-db.php [new file with mode: 0644]
WebKitSite/blog/wp-includes/wp-l10n.php [new file with mode: 0644]
WebKitSite/blog/wp-links-opml.php [new file with mode: 0644]
WebKitSite/blog/wp-login.php [new file with mode: 0644]
WebKitSite/blog/wp-mail.php [new file with mode: 0644]
WebKitSite/blog/wp-pass.php [new file with mode: 0644]
WebKitSite/blog/wp-rdf.php [new file with mode: 0644]
WebKitSite/blog/wp-register.php [new file with mode: 0644]
WebKitSite/blog/wp-rss.php [new file with mode: 0644]
WebKitSite/blog/wp-rss2.php [new file with mode: 0644]
WebKitSite/blog/wp-settings.php [new file with mode: 0644]
WebKitSite/blog/wp-trackback.php [new file with mode: 0644]
WebKitSite/blog/wp.php [new file with mode: 0644]
WebKitSite/blog/xmlrpc.php [new file with mode: 0644]
WebKitSite/building/build.html [new file with mode: 0644]
WebKitSite/building/checkout.html [new file with mode: 0644]
WebKitSite/coding/coding-style.html [new file with mode: 0644]
WebKitSite/coding/contributing.html [new file with mode: 0644]
WebKitSite/contact.html [new file with mode: 0644]
WebKitSite/images/bluebanner.png [new file with mode: 0644]
WebKitSite/images/separator.png [new file with mode: 0644]
WebKitSite/images/webkit-background.png [new file with mode: 0644]
WebKitSite/images/welcomeopen.gif [new file with mode: 0644]
WebKitSite/index.html [new file with mode: 0644]
WebKitSite/projects/accessibility/index.html [new file with mode: 0644]
WebKitSite/projects/cleanup/index.html [new file with mode: 0644]
WebKitSite/projects/compat/index.html [new file with mode: 0644]
WebKitSite/projects/css/index.html [new file with mode: 0644]
WebKitSite/projects/documentation/index.html [new file with mode: 0644]
WebKitSite/projects/dom/index.html [new file with mode: 0644]
WebKitSite/projects/editing/index.html [new file with mode: 0644]
WebKitSite/projects/forms/index.html [new file with mode: 0644]
WebKitSite/projects/html/index.html [new file with mode: 0644]
WebKitSite/projects/index.html [new file with mode: 0644]
WebKitSite/projects/javascript/index.html [new file with mode: 0644]
WebKitSite/projects/layout/index.html [new file with mode: 0644]
WebKitSite/projects/mathml/index.html [new file with mode: 0644]
WebKitSite/projects/performance/index.html [new file with mode: 0644]
WebKitSite/projects/plugins/index.html [new file with mode: 0644]
WebKitSite/projects/portability/index.html [new file with mode: 0644]
WebKitSite/projects/printing/index.html [new file with mode: 0644]
WebKitSite/projects/svg/index.html [new file with mode: 0644]
WebKitSite/projects/webkit/index.html [new file with mode: 0644]
WebKitSite/projects/xml/index.html [new file with mode: 0644]
WebKitSite/projects/xslt/index.html [new file with mode: 0644]
WebKitSite/quality/.htaccess [new file with mode: 0644]
WebKitSite/quality/Ahem.ttf [new file with mode: 0644]
WebKitSite/quality/bugpriorities.html [new file with mode: 0644]
WebKitSite/quality/bugwriting.html [new file with mode: 0644]
WebKitSite/quality/lifecycle.html [new file with mode: 0644]
WebKitSite/quality/reduction.html [new file with mode: 0644]
WebKitSite/quality/reporting.html [new file with mode: 0644]
WebKitSite/quality/testing.html [new file with mode: 0644]
WebKitSite/quality/testwriting.html [new file with mode: 0644]
WebKitSite/sidebar.css [new file with mode: 0644]
WebKitSite/sidebar.html [new file with mode: 0644]
WebKitSite/webkitdev.css [new file with mode: 0644]

diff --git a/WebKitSite/blog/index.php b/WebKitSite/blog/index.php
new file mode 100644 (file)
index 0000000..3e3db40
--- /dev/null
@@ -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/WebKitSite/blog/license.txt b/WebKitSite/blog/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/WebKitSite/blog/readme.html b/WebKitSite/blog/readme.html
new file mode 100644 (file)
index 0000000..848fcd7
--- /dev/null
@@ -0,0 +1,126 @@
+<!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 1.5.1</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>Launch <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 1.5:</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="notes">User Levels </h1>
+<p>You may allow or disallow user registration in your <a href="wp-admin/options-general.php">General options</a>. If &quot;new users can blog&quot; is disabled you must first raise the level of a newly registered user to allow them to post. Click the plus sign next to their name on the <a href="wp-admin/users.php">Users</a> page. </p>
+<h2>User Levels</h2>
+<ul>
+       <li>0 - New User </li>
+       <li>1 - User can post, edit, and delete their own posts.</li>
+       <li>5+ - Admin; can post, edit, delete other people's posts, and change the options.</li>
+       <li>Any user whose level is higher than 1, can edit and delete the posts and change the level of lower users. Example: a level 2 user is not an admin, but can edit the posts of level 1 users, and up the level of a new user from 0 to 1.</li>
+</ul>
+<p>Usually you want to have a team of level 1 users except for you.</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/WebKitSite/blog/wp-admin/admin-footer.php b/WebKitSite/blog/wp-admin/admin-footer.php
new file mode 100644 (file)
index 0000000..14b832b
--- /dev/null
@@ -0,0 +1,13 @@
+
+<div id="footer"><p><a href="http://wordpress.org/"><img src="../wp-images/wp-small.png" alt="WordPress" /></a><br />
+<?php bloginfo('version'); ?> <br /> 
+<a href="http://codex.wordpress.org/"><?php _e('Documentation'); ?></a> &#8212; <a href="http://wordpress.org/support/"><?php _e('Support Forums'); ?></a> <br />
+<?php printf(__('%s seconds'), number_format(timer_stop(), 2)); ?>
+</p>
+
+</div>
+
+<?php do_action('admin_footer', ''); ?>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/admin-functions.php b/WebKitSite/blog/wp-admin/admin-functions.php
new file mode 100644 (file)
index 0000000..e8f9159
--- /dev/null
@@ -0,0 +1,1085 @@
+<?php
+
+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, $sortbyname = FALSE )
+{
+        /*
+         * This function returns an list of all categories
+         * that have $parent as their parent
+         * if no parent is specified we will assume top level caegories
+         * are required.
+         */
+        global $wpdb;
+
+        // select sort order
+        $sort = "cat_id";
+        if( TRUE == $sortbyname )
+        {
+                $sort = "cat_name";
+        }
+
+        // First query the database
+        $cats_tmp = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY $sort");
+
+        // Now strip this down to a simple array of IDs
+        $cats = array();
+        if( count($cats_tmp) > 0 )
+        {
+                foreach( $cats_tmp as $cat )
+                {
+                        $cats[] = $cat->cat_ID;
+                }
+        }
+
+        // Return the list of categories
+        return $cats;
+}
+
+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, TRUE);
+ $result = array();
+
+ 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);
+ }
+
+ 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, $user_level;
+       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);
+                               $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
+                               $pad = str_repeat('&#8212; ', $level);
+                               if ( $user_level > 3 )
+                                       $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>" . __('Edit') . "</a></td><td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return confirm('".  sprintf(__("You are about to delete the category \'%s\'.  All of its posts will go to the default category.\\n  \'OK\' to delete, \'Cancel\' to stop."), addslashes($category->cat_name)) . "')\" class='delete'>" .  __('Delete') . "</a>";
+                               else
+                                       $edit = '';
+                               
+                               $class = ('alternate' == $class) ? '' : 'alternate';
+                               echo "<tr class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
+                               <td>$category->category_description</td>
+                               <td>$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, $user_level, $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 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 (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 
+    <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('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 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]);
+            
+            // move the thumbnail to it's final destination
+            
+            $path = explode('/', $file);
+            $thumbpath = substr($file, 0, strrpos($file, '/')) . '/thumb-' . $path[count($path)-1];
+            
+            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");
+                }
+            }
+            
+        }
+    }
+    
+    if(!empty($error))
+    {
+        return $error;
+    }
+    else
+    {
+        return 1;
+    }
+}
+
+// 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' width='10%'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='" . __('Update') ."' /></td>
+               <td align='center' width='10%'><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 to this post:') ?></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 (!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, $postdata, $commentdata;
+       if ( $for_post && ('draft' == $postdata->post_status) ) {
+               $checked = 'checked="checked" ';
+               $edit = false;
+       } else {
+               $checked = ' ';
+       }
+
+       echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label></legend>';
+       
+       $time_adj = time() + (get_settings('gmt_offset') * 3600);
+       $post_date = ($for_post) ? $postdata->post_date : $commentdata['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" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
+<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @ 
+<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> : 
+<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" /> 
+<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> 
+<?php _e('Existing timestamp'); ?>: 
+       <?php
+               // We might need to readjust to display proper existing timestamp
+               if ( $for_post && ('draft' == $postdata->post_status) ) {
+                       $jj = mysql2date('d', $post_date);
+                       $mm = mysql2date('m', $post_date);
+                       $aa = mysql2date('Y', $post_date);
+                       $hh = mysql2date('H', $post_date);
+                       $mn = mysql2date('i', $post_date);
+                       $ss = mysql2date('s', $post_date);
+               }
+               echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?>
+</fieldset>
+       <?php
+}
+
+function check_admin_referer() {
+       $adminurl = strtolower( get_settings('siteurl') ) . '/wp-admin';
+       $referer = strtolower( $_SERVER['HTTP_REFERER'] );
+       if ( !strstr($referer, $adminurl) )
+               die(__('Sorry, you need to <a href="http://codex.wordpress.org/Enable_Sending_Referrers">enable sending referrers</a> for this feature to work.'));
+       do_action('check_admin_referer');
+}
+
+// insert_with_markers: Owen Winkler
+// 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;
+                       $newline = '';
+                       foreach($markerdata as $markerline) {
+                               if (strstr($markerline, "# BEGIN {$marker}")) $state = false;
+                               if ($state) fwrite($f, "{$newline}{$markerline}");
+                               if (strstr($markerline, "# END {$marker}")) {
+                                       fwrite($f, "{$newline}# BEGIN {$marker}");
+                                       if(is_array($insertion)) foreach($insertion as $insertline) fwrite($f, "{$newline}{$insertline}");
+                                       fwrite($f, "{$newline}# END {$marker}");
+                                       $state = true;
+                                       $foundit = true;
+                               }
+                               $newline = "\n";
+                       }
+               }
+               if (!$foundit) {
+                       fwrite($f, "# BEGIN {$marker}\n");
+                       foreach($insertion as $insertline) fwrite($f, "{$insertline}\n");
+                       fwrite($f, "# END {$marker}");                          
+               }
+               fclose($f);
+               return true;
+       } else {
+               return false;
+       }
+}
+
+// insert_with_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 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 (! $is_apache)
+               return;
+
+       $rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
+       insert_with_markers($home_path.'.htaccess', 'WordPress', $rules);
+}
+
+function generate_page_rewrite_rules() {
+       global $wpdb;
+       $posts = $wpdb->get_results("SELECT ID, post_name FROM $wpdb->posts WHERE post_status = 'static' ORDER BY post_parent DESC");
+
+       $page_rewrite_rules = array();
+       
+       if ($posts) {
+               foreach ($posts as $post) {
+                       // URI => page name
+                       $uri = get_page_uri($post->ID);
+                       
+                       $page_rewrite_rules[$uri] = $post->post_name;
+               }
+               
+               update_option('page_uris', $page_rewrite_rules);
+               
+               save_mod_rewrite_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">
+       <a href="http://wordpress.org/docs/reference/post/#quicktags" title="' .  __('Help with quicktags') . '">' . __('Quicktags') . '</a>:
+       <script src="quicktags.js" type="text/javascript"></script>
+       <script type="text/javascript">edToolbar();</script>
+';
+       echo '</div>';
+endif;
+}
+
+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;
+       global $user_level;
+
+       $parent = get_admin_page_parent();
+
+       foreach ($menu as $menu_array) {
+               //echo "parent array: " . $menu_array[2];
+               if ($menu_array[2] == $parent) {
+                       if ($user_level < $menu_array[1]) {
+                               return false;
+                       } else {
+                               break;
+                       }
+               }
+       }
+
+       if (isset($submenu[$parent])) {
+               foreach ($submenu[$parent] as $submenu_array) {
+                       if ($submenu_array[2] == $pagenow) {
+                               if ($user_level < $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;
+       }
+
+       $parent = 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])) {
+                                       $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])) {
+                                               $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 plugin_basename($file) {
+       return preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
+}
+
+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 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 Template'),
+       'style.css' => __('Stylesheet'),
+       'comments.php' => __('Comments Template'),
+       'comments-popup.php' => __('Popup Comments Template'),
+       'footer.php' => __('Footer Template'),
+       'header.php' => __('Header Template'),
+       'sidebar.php' => __('Sidebar Template'),
+       'archive.php' => __('Archive Template'),
+       'category.php' => __('Category Template'),
+       'page.php' => __('Page Template'),
+       'search.php' => __('Search Template'),
+       'single.php' => __('Post Template'),
+       '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) {
+               $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 pimp_firefox() {
+       if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'Firefox' ) )
+               return;
+       $getit = __('WordPress recommends the open-source Firefox browser');
+       echo '
+       <p id="firefoxlink" style="text-align: center;"><a href="http://spreadfirefox.com/community/?q=affiliates&amp;id=2490&amp;t=1" title="' . $getit . '"><img src="../wp-images/get-firefox.png" alt="Get Firefox" /></a></p>
+       ';
+}
+//add_action('admin_footer', 'pimp_firefox');
+
+?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/admin-header.php b/WebKitSite/blog/wp-admin/admin-header.php
new file mode 100644 (file)
index 0000000..eecfe71
--- /dev/null
@@ -0,0 +1,98 @@
+<?php 
+@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+if (!isset($_GET["page"])) require_once('admin.php'); ?>
+<?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>
+<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" />
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
+
+<script type="text/javascript">
+//<![CDATA[
+
+function customToggleLink() {
+       // TODO: Only show link if there's a hidden row
+       document.write('<small>(<a href="javascript:;" id="customtoggle" onclick="toggleHidden()"><?php _e('Show hidden'); ?></a>)</small>');
+       // TODO: Rotate link to say "show" or "hide"
+       // TODO: Use DOM
+}
+
+function toggleHidden() {
+       var allElements = document.getElementsByTagName('tr');
+       for (i = 0; i < allElements.length; i++) {
+               if ( allElements[i].className.indexOf('hidden') != -1 ) {
+                        allElements[i].className = allElements[i].className.replace('hidden', '');
+               }
+       }
+}
+
+<?php if ( isset($xfn) ) : ?>
+
+function GetElementsWithClassName(elementName, className) {
+       var allElements = document.getElementsByTagName(elementName);
+       var elemColl = new Array();
+       for (i = 0; i < allElements.length; i++) {
+               if (allElements[i].className == className) {
+                       elemColl[elemColl.length] = allElements[i];
+               }
+       }
+       return elemColl;
+}
+
+function meChecked() {
+  var undefined;
+  var eMe = document.getElementById('me');
+  if (eMe == undefined) return false;
+  else return eMe.checked;
+}
+
+function upit() {
+       var isMe = meChecked(); //document.getElementById('me').checked;
+       var inputColl = GetElementsWithClassName('input', 'valinp');
+       var results = document.getElementById('rel');
+       var linkText, linkUrl, inputs = '';
+       for (i = 0; i < inputColl.length; i++) {
+                inputColl[i].disabled = isMe;
+                inputColl[i].parentNode.className = isMe ? 'disabled' : '';
+                if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
+                       inputs += inputColl[i].value + ' ';
+                               }
+                }
+       inputs = inputs.substr(0,inputs.length - 1);
+       if (isMe) inputs='me';
+       results.value = inputs;
+       }
+
+function blurry() {
+       if (!document.getElementById) return;
+
+       var aInputs = document.getElementsByTagName('input');
+
+       for (var i = 0; i < aInputs.length; i++) {              
+                aInputs[i].onclick = aInputs[i].onkeyup = upit;
+       }
+}
+
+window.onload = blurry;
+<?php endif; ?>
+
+//]]>
+</script>
+
+<?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>
+
+<?php
+require(ABSPATH . '/wp-admin/menu-header.php');
+
+if ( $parent_file == 'options-general.php' ) {
+       require(ABSPATH . '/wp-admin/options-head.php');
+}
+?>
diff --git a/WebKitSite/blog/wp-admin/admin.php b/WebKitSite/blog/wp-admin/admin.php
new file mode 100644 (file)
index 0000000..688cf6c
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+if ( defined('ABSPATH') )
+       require_once( ABSPATH . 'wp-config.php');
+else
+    require_once('../wp-config.php');
+    
+require_once(ABSPATH . 'wp-admin/admin-functions.php');
+auth_redirect();
+
+header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
+header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
+header('Cache-Control: no-cache, must-revalidate, max-age=0');
+header('Pragma: no-cache');
+
+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"];
+        }
+    }
+}
+
+require(ABSPATH . '/wp-admin/menu.php');
+
+// Handle plugin admin pages.
+if (isset($_GET['page'])) {
+       $plugin_page = plugin_basename($_GET['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.'), $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();
+}
+
+?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/bookmarklet.php b/WebKitSite/blog/wp-admin/bookmarklet.php
new file mode 100644 (file)
index 0000000..555abee
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+$mode = 'bookmarklet';
+require_once('admin.php');
+
+if ($user_level == 0)
+       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
+} else {
+       $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_title =  stripslashes($post_title);
+       } else {
+               $post_title = $popuptitle;
+       }
+       
+       $edited_post_title = wp_specialchars($post_title);
+
+// $post_pingback needs to be set in any file that includes edit-form.php
+    $post_pingback = get_settings('default_pingback_flag');
+    
+    $content  = wp_specialchars($_REQUEST['content']);
+       $popupurl = wp_specialchars($_REQUEST['popupurl']);
+    if ( !empty($content) ) {
+        $content = wp_specialchars( stripslashes($_REQUEST['content']) );
+    } else {
+        $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><?php
+}
+?>
diff --git a/WebKitSite/blog/wp-admin/categories.php b/WebKitSite/blog/wp-admin/categories.php
new file mode 100644 (file)
index 0000000..755c976
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+require_once('admin.php');
+
+$title = __('Categories');
+$parent_file = 'edit.php';
+
+$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 ($user_level < 3)
+               die (__('Cheatin&#8217; uh?'));
+       
+       $cat_name= wp_specialchars($_POST['cat_name']);
+       $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->categories'");
+       $cat_ID = $id_result->Auto_increment;
+       $category_nicename = sanitize_title($cat_name, $cat_ID);
+       $category_description = $_POST['category_description'];
+       $cat = intval($_POST['cat']);
+       
+       $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");
+       
+       header('Location: categories.php?message=1#addcat');
+break;
+
+case 'delete':
+
+       check_admin_referer();
+
+       $cat_ID = (int) $_GET['cat_ID'];
+       $cat_name = get_catname($cat_ID);
+       $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+       $cat_parent = $category->category_parent;
+
+       if ( 1 == $cat_ID )
+               die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+
+       if ( $user_level < 3 )
+               die (__('Cheatin&#8217; uh?'));
+
+       $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+       $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_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'");
+
+       header('Location: categories.php?message=2');
+
+break;
+
+case 'edit':
+
+    require_once ('admin-header.php');
+    $cat_ID = (int) $_GET['cat_ID'];
+    $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+    $cat_name = $category->cat_name;
+    ?>
+
+<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($cat_name); ?>" size="40" /> <input type="hidden" name="action" value="editedcat" />
+<input type="hidden" name="cat_ID" value="<?php echo $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='cat'>
+         <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 ($user_level < 3)
+               die (__('Cheatin&#8217; uh?'));
+       
+       $cat_name = wp_specialchars($_POST['cat_name']);
+       $cat_ID = (int) $_POST['cat_ID'];
+       $category_nicename = sanitize_title($_POST['category_nicename'], $cat_ID);
+       $category_description = $_POST['category_description'];
+       
+       $wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'");
+
+       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 class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
+<div class="wrap">
+<?php if ( $user_level > 3 ) : ?>
+       <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
+<?php else : ?>
+       <h2><?php _e('Categories') ?> </h2>
+<?php endif; ?>
+<table 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>
+
+<?php if ( $user_level > 3 ) : ?>
+<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(1)) ?>
+  </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='cat' 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/WebKitSite/blog/wp-admin/edit-comments.php b/WebKitSite/blog/wp-admin/edit-comments.php
new file mode 100644 (file)
index 0000000..bcfd4c2
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+require_once('admin.php');
+
+$title = __('Edit Comments');
+$parent_file = 'edit.php';
+
+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 ( user_can_delete_post_comments($user_ID, $post_id) ) :
+                       $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");
+                       ++$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 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 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) { ?> | <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 ( user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) {
+                               echo " | <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
+                       }
+                       if ( user_can_delete_post_comments($user_ID, $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) . "')\">" . __('Delete Comment') . "</a> &#8212; ";
+                       } // end if any comments to show
+                       // Get post title
+                       if ( user_can_edit_post($user_ID, $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>
+
+<?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 (user_can_delete_post_comments($user_ID, $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 ( user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) {
+       echo "<a href='post.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
+    <td><?php if ( user_can_delete_post_comments($user_ID, $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'); ?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/edit-form-advanced.php b/WebKitSite/blog/wp-admin/edit-form-advanced.php
new file mode 100644 (file)
index 0000000..3a215ea
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+$messages[1] = __('Post updated');
+$messages[2] = __('Custom field updated');
+$messages[3] = __('Custom field deleted.');
+?>
+<?php if (isset($_GET['message'])) : ?>
+<div class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
+<form name="post" action="post.php" method="post" id="post">
+
+<div class="wrap">
+<h2><?php _e('Write Post'); ?></h2>
+<?php
+
+if (0 == $post_ID) {
+       $form_action = 'post';
+} 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_status.'" />';
+
+$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" />';
+
+if ('' != $pinged) {
+       $pings .= '<p>'. __('Already pinged:') . '</p><ul>';
+       $already_pinged = explode("\n", trim($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="6" value="' . __('Save and Continue Editing') . '" />';
+
+if (empty($post_status)) $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_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();
+}
+window.onload = focusit;
+//-->
+</script>
+<?php endif; ?>
+<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 $edited_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(get_settings('default_category')); ?></div>
+    </fieldset>
+
+    <fieldset id="commentstatusdiv">
+      <legend><a href="http://wordpress.org/docs/reference/post/#comments" title="<?php _e('Help on comment status') ?>"><?php _e('Discussion') ?></a></legend> 
+         <div>
+         <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($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($ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+</div>
+</fieldset>
+    <fieldset id="postpassworddiv">
+      <legend><a href="http://wordpress.org/docs/reference/post/#post_password" title="<?php _e('Help on post password') ?>"><?php _e('Post Password') ?></a></legend> 
+         <div><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post_password ?>" /></div>
+    </fieldset>
+
+<br />
+<fieldset id="postexcerpt">
+<legend><a href="http://wordpress.org/docs/reference/post/#excerpt" title="<?php _e('Help with excerpts') ?>"><?php _e('Excerpt') ?></a></legend>
+<div><textarea rows="1" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $excerpt ?></textarea></div>
+</fieldset>
+<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="5" id="content"><?php echo $content ?></textarea></div>
+</fieldset>
+<?php
+?>
+<script type="text/javascript">
+<!--
+edCanvas = document.getElementById('content');
+//-->
+</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="6" /> 
+<?php 
+if ('publish' != $post_status || 0 == $post_ID) {
+?>
+<?php if ( user_can_create_post($user_ID) ) : ?>
+       <input name="publish" type="submit" id="publish" tabindex="10" value="<?php _e('Publish') ?>" /> 
+<?php endif; ?>
+<?php
+}
+?>
+       <input name="referredby" type="hidden" id="referredby" value="<?php echo wp_specialchars($_SERVER['HTTP_REFERER']); ?>" />
+</p>
+
+<?php do_action('edit_form_advanced', ''); ?>
+</div>
+
+</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('Post Status') ?>:</th>
+               <td><?php if ( user_can_create_post($user_ID) ) : ?>
+<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> <?php _e('Published') ?></label><br />
+<?php endif; ?>
+         <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post_status, 'draft'); ?> /> <?php _e('Draft') ?></label><br />
+         <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post_status, 'private'); ?> /> <?php _e('Private') ?></label></td>
+       </tr>
+       <tr>
+               <th scope="row" valign="top"><?php _e('Send trackbacks to'); ?>:</th>
+               <td><?php echo $form_trackback; ?> <br />
+               <?php _e('Separate multiple URIs with spaces'); ?></td>
+       </tr>
+       <tr valign="top">
+               <th scope="row" width="25%"><?php _e('Post slug') ?>:</th>
+               <td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td>
+       </tr>
+<?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login, user_firstname, user_lastname FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?>
+       <tr>
+               <th scope="row"><?php _e('Post author'); ?>:</th>
+               <td>
+               <select name="post_author_override" id="post_author_override">
+               <?php 
+               foreach ($users as $o) :
+                       if ( $post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
+                       else $selected = '';
+                       echo "<option value='$o->ID' $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>";
+               endforeach;
+               ?>
+               </select>
+               </td>
+       </tr>
+<?php endif; ?>
+<?php if ($user_level > 4) : ?>
+       <tr>
+               <th scope="row"><?php _e('Edit time'); ?>:</th>
+               <td><?php touch_time(($action == 'edit')); ?></td>
+       </tr>
+<?php endif; ?>
+<?php if ('edit' == $action) : ?>
+       <tr>
+               <th scope="row"><?php _e('Delete'); ?>:</th>
+               <td>
+               <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($edited_post_title) ) . "')\""; ?> />
+</td>
+<?php endif; ?>
+       </tr>
+</table>
+
+<fieldset id="postcustom">
+<legend><?php _e('Custom Fields') ?></legend>
+<div id="postcustomstuff">
+<?php 
+if($metadata = has_meta($post_ID)) {
+?>
+<?php
+       list_meta($metadata); 
+?>
+<?php
+}
+       meta_form();
+?>
+</div>
+</fieldset>
+<?php 
+if ('' != $pinged)
+       echo $pings;
+?>
+</div>
+
+</form>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/edit-form-comment.php b/WebKitSite/blog/wp-admin/edit-form-comment.php
new file mode 100644 (file)
index 0000000..c4d1208
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+$submitbutton_text = __('Edit Comment &raquo;');
+$toprow_title = sprintf(__('Editing Comment # %s'), $commentdata['comment_ID']);
+$form_action = 'editedcomment';
+$form_extra = "' />\n<input type='hidden' name='comment_ID' value='$comment' />\n<input type='hidden' name='comment_post_ID' value='".$commentdata["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();
+}
+window.onload = focusit;
+</script>
+<fieldset id="namediv">
+    <legend><?php _e('Name:') ?></legend>
+       <div>
+         <input type="text" name="newcomment_author" size="22" value="<?php echo format_to_edit($commentdata['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 format_to_edit($commentdata['comment_author_email']) ?>" tabindex="2" id="email" />
+    </div>
+</fieldset>
+<fieldset id="uridiv">
+        <legend><?php _e('URI:') ?></legend>
+               <div>
+                 <input type="text" name="newcomment_author_url" size="35" value="<?php echo format_to_edit($commentdata['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 rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo $content ?></textarea></div>
+</fieldset>
+
+<script type="text/javascript">
+<!--
+edCanvas = document.getElementById('content');
+//-->
+</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_status, '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_status, '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_status, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
+       </tr>
+
+<?php if ($user_level > 4) : ?>
+       <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 $commentdata['comment_ID']; ?>&amp;p=<?php echo $commentdata['comment_post_ID']; ?>"><?php _e('Delete comment') ?></a></p></td>
+       </tr>
+</table>
+
+</div>
+
+</form>
diff --git a/WebKitSite/blog/wp-admin/edit-form.php b/WebKitSite/blog/wp-admin/edit-form.php
new file mode 100644 (file)
index 0000000..a528da2
--- /dev/null
@@ -0,0 +1,76 @@
+
+<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();
+}
+window.onload = 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 $edited_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($default_post_cat); ?></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 $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 ( user_can_create_post($user_ID) ) : ?>
+  <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/WebKitSite/blog/wp-admin/edit-page-form.php b/WebKitSite/blog/wp-admin/edit-page-form.php
new file mode 100644 (file)
index 0000000..cdce8d6
--- /dev/null
@@ -0,0 +1,159 @@
+
+<div class="wrap">
+<h2><?php _e('Write Page'); ?></h2>
+<?php
+if (0 == $post_ID) {
+       $form_action = 'post';
+       $form_extra = '';
+} 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();
+}
+window.onload = focusit;
+//-->
+</script>
+    <fieldset id="titlediv">
+      <legend><?php _e('Page Title') ?></legend> 
+         <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $edited_post_title; ?>" id="title" /></div>
+    </fieldset>
+<fieldset id="commentstatusdiv">
+      <legend><?php _e('Discussion') ?></legend> 
+         <div>
+         <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($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($ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+       </div>
+</fieldset>
+    <fieldset id="postpassworddiv">
+      <legend><?php _e('Page Password') ?></legend> 
+         <div><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post_password ?>" /></div>
+    </fieldset>
+    <fieldset id="pageparent">
+      <legend><?php _e('Page Parent') ?></legend> 
+         <div><select name="parent_id">
+         <option value='0'><?php _e('Main Page (no parent)'); ?></option>
+                       <?php parent_dropdown($post_parent); ?>
+        </select>
+         </div>
+    </fieldset>
+<fieldset id="postdiv">
+    <legend><?php _e('Page Content') ?></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 $content ?></textarea></div>
+</fieldset>
+
+
+<script type="text/javascript">
+<!--
+edCanvas = document.getElementById('content');
+//-->
+</script>
+
+<p class="submit">
+  <input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php $post_ID ? _e('Edit Page') :_e('Create New Page') ?> &raquo;" /> 
+  <input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" />
+</p>
+
+<fieldset id="pageoptions">
+        <legend><?php _e('Page Options') ?></legend> 
+<table width="100%" cellspacing="2" cellpadding="5" class="editform">
+<?php if ( 0 != count( get_page_templates() ) ) { ?>
+       <tr valign="top">
+               <th scope="row" width="30%"><?php _e('Page Template:') ?></th>
+               <td><div><select name="page_template">
+               <option value='default'><?php _e('Default Template'); ?></option>
+               <?php page_template_dropdown($page_template); ?>
+               </select>
+               
+               </div>
+               </td>
+       </tr>
+<?php } ?>
+       <tr valign="top">
+               <th scope="row" width="30%"><?php _e('Page slug') ?>:</th>
+               <td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td>
+       </tr>
+<?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login, user_firstname, user_lastname FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?>
+       <tr>
+               <th scope="row" width="30%"><?php _e('Page owner'); ?>:</th>
+               <td>
+               <select name="post_author" id="post_author">
+               <?php 
+               foreach ($users as $o) :
+                       if ( $post_author == $o->ID ) $selected = 'selected="selected"';
+                       else $selected = '';
+                       echo "<option value='$o->ID' $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>";
+               endforeach;
+               ?>
+               </select>
+               </td>
+       </tr>
+<?php endif; ?>
+       <tr>
+               <th scope="row" width="25%"><?php _e('Page Order') ?>:</th>
+               <td><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $menu_order ?>" /></td>
+       </tr>
+       <tr>
+               <th scope="row"><?php _e('Delete'); ?>:</th>
+               <td><?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."), addslashes($edited_post_title) ) . "')\""; ?> />
+<?php endif; ?></td>
+       </tr>
+</table>
+</fieldset>
+
+<fieldset id="postcustom">
+<legend><?php _e('Custom Fields') ?> <script type="text/javascript">customToggleLink();</script></legend>
+<div id="postcustomstuff">
+<?php 
+if($metadata = has_meta($post_ID)) {
+?>
+<?php
+       list_meta($metadata); 
+?>
+<?php
+}
+       meta_form();
+?>
+</div>
+</fieldset>
+
+<?php do_action('edit_page_form', ''); ?>
+</form>
+
+</div>
diff --git a/WebKitSite/blog/wp-admin/edit-pages.php b/WebKitSite/blog/wp-admin/edit-pages.php
new file mode 100644 (file)
index 0000000..f68ddf2
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+require_once('admin.php');
+$title = __('Pages');
+$parent_file = 'edit.php';
+require_once('admin-header.php');
+
+get_currentuserinfo();
+?>
+
+<div class="wrap">
+<h2><?php _e('Page Management'); ?></h2>
+
+<?php
+if (isset($user_ID) && ('' != intval($user_ID))) {
+       $posts = $wpdb->get_results("
+       SELECT $wpdb->posts.*, $wpdb->users.user_level FROM $wpdb->posts
+       INNER JOIN $wpdb->users ON ($wpdb->posts.post_author = $wpdb->users.ID)
+       WHERE $wpdb->posts.post_status = 'static'
+       AND ($wpdb->users.user_level < $user_level OR $wpdb->posts.post_author = $user_ID)
+       ");
+} else {
+    $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");
+}
+
+if ($posts) {
+?>
+<table 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 page_rows(); ?>
+</table> 
+<?php
+} else {
+?>
+<p><?php _e('No pages yet.') ?></p>
+<?php
+} // end if ($posts)
+?> 
+<p><?php _e('Pages are like posts except they live outside of the normal blog chronology. You can use pages to organize and manage any amount of content.'); ?></p>
+<h3><a href="page-new.php"><?php _e('Create New Page'); ?> &raquo;</a></h3>
+</div> 
+
+
+<?php include('admin-footer.php'); ?> 
diff --git a/WebKitSite/blog/wp-admin/edit.php b/WebKitSite/blog/wp-admin/edit.php
new file mode 100644 (file)
index 0000000..ca81418
--- /dev/null
@@ -0,0 +1,301 @@
+<?php
+require_once('admin.php');
+
+$title = __('Posts');
+$parent_file = 'edit.php';
+require_once('admin-header.php');
+
+$_GET['m'] = (int) $_GET['m'];
+
+get_currentuserinfo();
+
+$drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
+if (1 < $user_level) {
+       $editable = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_level <= '$user_level' AND ID != $user_ID");
+       if( is_array( $editable ) == false )
+                       $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) ");
+       }
+} else {
+       $other_drafts = false;
+}
+
+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;
+
+include(ABSPATH.'wp-blog-header.php');
+
+if ( is_month() ) {
+       single_month_title(' ');
+} elseif ( is_search() ) {
+       printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
+} else {
+       if ( ! 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>
+
+<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
+               $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
+               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>
+
+<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 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 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 ( user_can_edit_post($user_ID,$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 ( user_can_edit_post($user_ID,$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' 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 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 (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
+                               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) && ($user_level >= 3) ) {
+                                       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/WebKitSite/blog/wp-admin/import-b2.php b/WebKitSite/blog/wp-admin/import-b2.php
new file mode 100644 (file)
index 0000000..28a84d5
--- /dev/null
@@ -0,0 +1,247 @@
+<?php
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
+require_once('../wp-config.php');
+require('upgrade-functions.php');
+$step = $_GET['step'];
+if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+       <title>WordPress &#8212; b2 Conversion</title>
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 15%;
+               margin-right: 15%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/wordpress.gif);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               height: 60px;
+       }
+       #logo a span {
+               display: none;
+       }
+       p, li {
+               line-height: 140%;
+       }
+       </style>
+</head>
+<body>
+<h1 id="logo"><a href="http://wordpress.org"><span>WordPress</span></a></h1>
+<?php
+switch($step) {
+
+       case 0:
+?>
+<p>Welcome to WordPress. Since you&#8217;re upgrading from b2 everything should be relatively 
+  familiar to you. Here are some notes on upgrading:</p>
+<ul>
+  <li>If you&#8217;re using an older version of b2, it's probably a good idea to upgrade 
+    to at least .61 before making the leap to WordPress.</li>
+  <li>The templates are so much better, and there is so much more going on than 
+    before it&#8217;s probably worth it to start from scratch and work back to your 
+    design.</li>
+  <li>You need to transfer some of your settings from your old <code>b2config.php</code>
+    to <code>wp-config.php</code> file.</li>
+  <li>WordPress issues should be discussed in our <a href="http://wordpress.org/support/">support 
+    forums</a>.</li>
+  <li><strong>Back up</strong> your database before you do anything. Yes, you.</li>
+</ul>
+<p>Have you looked at the <a href="../readme.html">readme</a>? If 
+  you&#8217;re all ready, <a href="import-b2.php?step=1">let&#8217;s go</a>!</p>
+<?php
+       break;
+       
+       case 1:
+?>
+<h1>Step 1</h1>
+<p>Okay first we&#8217;re going to set up the links database. This will allow you to host your own blogroll, complete with Weblogs.com updates.</p>
+<?php
+
+$got_links = false;
+$got_cats = false;
+$got_row = false;
+?>
+<p>Installing WP-Links.</p>
+<p>Checking for tables...</p>
+<?php
+$result = mysql_list_tables(DB_NAME);
+if (!$result) {
+    print "DB Error, could not list tables\n";
+    print 'MySQL Error: ' . mysql_error();
+    exit;
+}
+
+while ($row = mysql_fetch_row($result)) {
+    if ($row[0] == $wpdb->links)
+        $got_links = true;
+    if ($row[0] == $wpdb->linkcategories)
+        $got_cats = true;
+    //print "Table: $row[0]<br />\n";
+}
+if (!$got_cats) {
+    echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n";
+    $sql = "CREATE TABLE $wpdb->linkcategories ( " .
+           " cat_id int(11) NOT NULL auto_increment, " .
+           " cat_name tinytext NOT NULL, ".
+           " auto_toggle enum ('Y','N') NOT NULL default 'N', ".
+           " PRIMARY KEY (cat_id) ".
+           ") ";
+    $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
+    if ($result != false) {
+        echo "<p>Table '$wpdb->linkcategories' created OK</p>\n";
+        $got_cats = true;
+    }
+} else {
+    echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n";
+        $got_cats = true;
+}
+if (!$got_links) {
+    echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n";
+    $sql = "CREATE TABLE $wpdb->links ( " .
+           " link_id int(11) NOT NULL auto_increment,           " .
+           " link_url varchar(255) NOT NULL default '',         " .
+           " link_name varchar(255) NOT NULL default '',        " .
+           " link_image varchar(255) NOT NULL default '',       " .
+           " link_target varchar(25) NOT NULL default '',       " .
+           " link_category int(11) NOT NULL default 0,          " .
+           " link_description varchar(255) NOT NULL default '', " .
+           " link_visible enum ('Y','N') NOT NULL default 'Y',  " .
+           " link_owner int NOT NULL DEFAULT '1',               " .
+           " link_rating int NOT NULL DEFAULT '0',              " .
+           " link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " .
+           " link_rel varchar(255) NOT NULL default '',         " .
+           " link_notes MEDIUMTEXT NOT NULL default '',         " .
+           " PRIMARY KEY (link_id)                              " .
+           ") ";
+    $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error());
+       $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
+       $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
+       $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
+
+    if ($result != false) {
+        echo "<p>Table '$wpdb->links' created OK</p>\n";
+        $got_links = true;
+    }
+} else {
+    echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n";
+    echo "<p>... may need to update it though. Looking for column link_updated...</p>\n";
+    $query = "SELECT link_updated FROM $wpdb->links LIMIT 1";
+    $q = @mysql_query($query);
+    if ($q != false) {
+        if ($row = mysql_fetch_object($q)) {
+            echo "<p>You have  column link_updated. Good!</p>\n";
+        }
+    } else {
+        $query = "ALTER TABLE $wpdb->links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";
+        $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error());
+        echo "<p>Added column link_updated...</p>\n";
+    }
+    echo "<p>Looking for column link_rel...</p>\n";
+    $query = "SELECT link_rel FROM $wpdb->links LIMIT 1";
+    $q = @mysql_query($query);
+    if ($q != false) {
+        if ($row = mysql_fetch_object($q)) {
+            echo "<p>You have column link_rel. Good!</p>\n";
+        }
+    } else {
+        $query = "ALTER TABLE $wpdb->links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' ";
+        $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error());
+        echo "<p>Added column link_rel...</p>\n";
+    }
+    $got_links = true;
+}
+
+if ($got_links && $got_cats) {
+    echo "<p>Looking for category 1...</p>\n";
+    $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 ";
+    $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error());
+    if ($result != false) {
+        if ($row = mysql_fetch_object($result)) {
+            echo "<p>You have at least 1 category. Good!</p>\n";
+            $got_row = true;
+        } else {
+            echo "<p>Gonna insert category 1...</p>\n";
+            $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'General')";
+            $result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error());
+            if ($result != false) {
+                echo "<p>Inserted category Ok</p>\n";
+                $got_row = true;
+            }
+        }
+    }
+}
+
+if ($got_row) {
+    echo "<p>All done!</p>\n";
+}
+?>
+<p>Did you defeat the boss monster at the end? Good, then you&#8217;re ready for 
+  <a href="import-b2.php?step=2">Step 2</a>.</p>
+<?php
+       break;
+       case 2:
+?>
+<h1>Step 2</h1>
+<p>First we&#8217;re going to add excerpt, post, and password functionality...</p>
+
+<?php
+
+$query = "ALTER TABLE $wpdb->posts ADD COLUMN post_excerpt text NOT NULL;";
+$q = $wpdb->query($query);
+// 0.71 mods
+$query = "ALTER TABLE $wpdb->posts ADD post_status ENUM('publish','draft','private') NOT NULL,
+ADD comment_status ENUM('open','closed') NOT NULL,
+ADD ping_status ENUM('open','closed') NOT NULL,
+ADD post_password varchar(20) NOT NULL;";
+$q = $wpdb->query($query);
+?>
+
+<p>That went well! Now let's clean up the b2 database structure a bit...</p>
+
+<?php
+$query = "ALTER TABLE $wpdb->posts DROP INDEX ID";
+
+$q = $wpdb->query($query);
+
+?>
+
+<p>One down, two to go...</p>
+
+
+<p>So far so good.</p>
+<?php
+
+$query="ALTER TABLE $wpdb->posts DROP post_karma";
+$q = $wpdb->query($query);
+flush();
+?>
+
+<p>Almost there...</p>
+
+<?php
+
+$query = "ALTER TABLE $wpdb->users DROP INDEX ID";
+
+$q = $wpdb->query($query);
+upgrade_all();
+?>
+
+<p>Welcome to the family. <a href="../">Have fun</a>!</p>
+  <?php
+       break;
+}
+?>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/import-blogger.php b/WebKitSite/blog/wp-admin/import-blogger.php
new file mode 100644 (file)
index 0000000..c2ca831
--- /dev/null
@@ -0,0 +1,221 @@
+<?php
+
+$wpvarstoreset = array('action');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+       $wpvar = $wpvarstoreset[$i];
+       if (!isset($$wpvar)) {
+               if (empty($_POST["$wpvar"])) {
+                       if (empty($_GET["$wpvar"])) {
+                               $$wpvar = '';
+                       } else {
+                               $$wpvar = $_GET["$wpvar"];
+                       }
+               } else {
+                       $$wpvar = $_POST["$wpvar"];
+               }
+       }
+}
+require_once('../wp-config.php');
+require('upgrade-functions.php');
+header( 'Content-Type: text/html; charset=utf-8' );
+switch ($action) {
+
+case "step1":
+?>
+<!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" xml:lang="en">
+       <title>Blogger to WordPress - Converting...</title>
+       <link rel="stylesheet" href="wp-admin.css" type="text/css">
+</head>
+<body>
+<div class="wrap">
+<h1>Blogger to <img src="../wp-images/wpminilogo.png" width="50" height="50" border="0" alt="WordPress" align="top" /></h1>
+<p>The importer is running...</p>
+<ul>
+       <li>Importing posts and users
+               <ul><?php
+
+       for($bgy=1999; $bgy<=(date('Y')); $bgy++) {
+               for($bgm=1; $bgm<13; $bgm++) {
+
+               $bgmm = zeroise($bgm,2);
+       
+               $archivefile = "../$bgy"."_"."$bgmm"."_01_wordpress.php";
+               
+               if (file_exists($archivefile)) {
+
+                       $f = fopen($archivefile,"r");
+                       $archive = fread($f, filesize($archivefile));
+                       fclose($f);
+                       echo "<li>$bgy/$bgmm ";
+
+                       $posts = explode('<wordpresspost>', $archive);
+
+                       for ($i = 1; $i < count($posts); $i = $i + 1) {
+
+                       $postinfo = explode('|||', $posts[$i]);
+                       $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];
+
+                       $post_author = trim(addslashes($postinfo[1]));
+                       // we'll check the author is registered already
+                       $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'");
+                       if (!$user) { // seems s/he's not, so let's register
+                               $user_ip = '127.0.0.1';
+                               $user_domain = 'localhost';
+                               $user_browser = 'server';
+                               $user_joindate = '1979-06-06 00:41:00'; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
+                               $user_login = addslashes($post_author);
+                               $pass1 = addslashes('password');
+                               $user_nickname = addslashes($post_author);
+                               $user_email = addslashes('user@wordpress.org');
+                               $user_url = addslashes('');
+                               $user_joindate = addslashes($user_joindate);
+                               $result = $wpdb->query("
+                               INSERT INTO $wpdb->users (
+                                       user_login,
+                                       user_pass,
+                                       user_nickname,
+                                       user_email,
+                                       user_url,
+                                       user_ip,
+                                       user_domain,
+                                       user_browser,
+                                       user_registered,
+                                       user_level,
+                                       user_idmode
+                               ) VALUES (
+                                       '$user_login',
+                                       '$pass1',
+                                       '$user_nickname',
+                                       '$user_email',
+                                       '$user_url',
+                                       '$user_ip',
+                                       '$user_domain',
+                                       '$user_browser',
+                                       '$user_joindate',
+                                       '1',
+                                       'nickname'
+                               )");
+
+                               echo ": Registered user <strong>$user_login</strong>";
+                       }
+
+                       $post_author_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'");
+
+                       $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('<br>', '<br />', $post_content); // the XHTML touch... ;)
+                       
+                       $post_title = addslashes($post_title);
+                       
+                       // Quick-n-dirty check for dups:
+                       $dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $wpdb->posts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A);
+                       if ($dupcheck[0]['ID']) {
+                               print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
+                               print "Timestamp: " . $post_date . "<br />\n";
+                               print "Post Title: '" . stripslashes($post_title) . "'<br />\n";
+                               continue;
+                       }
+
+                       $result = $wpdb->query("
+                       INSERT INTO $wpdb->posts 
+                               (post_author,post_date,post_content,post_title,post_category)
+                       VALUES 
+                               ('$post_author_ID','$post_date','$post_content','$post_title','1')
+                       ");
+
+
+                       } echo '... <strong>Done</strong></li>';
+                       
+               }}
+       }
+
+       upgrade_all();
+       ?>
+</ul>
+<strong>Done</strong>
+</li>
+</ul>
+<p>&nbsp;</p>
+<p>Completed Blogger to WordPress import!</p>
+<p>Now you can go and <a href="../wp-login.php">log in</a>, have fun!</p>
+</div>
+</body>
+</html>
+       <?php
+       break;
+
+default:
+
+       ?>
+<!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" xml:lang="en">
+       <title>Blogger to WordPress Import Utility</title>
+       <link rel="stylesheet" href="wp-admin.css" type="text/css">
+</head>
+
+<body>
+<div class="wrap">
+<h1>Blogger to <img src="../wp-images/wpminilogo.png" width="50" height="50" border="0" alt="WordPress" align="top" /></h1>
+<p>This is a basic Blogger to WordPress import script.</p>
+<p>What it does:</p>
+<ul>
+       <li>Parses your archives to retrieve your blogger posts.</li>
+       <li>Adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'</li>
+</ul>
+<p>What it does not:</p>
+<ul>
+       <li>It sucks at making coffee.</li>
+       <li>It always forgets to call back.</li>
+</ul>
+
+<h2>First step: Install WordPress</h2>
+<p>Install the WordPress blog as explained in the <a href="../readme.html">read me</a>, then immediately come back here.</p>
+
+<h3>Second step: let's play with Blogger</h3>
+<p>Log into your Blogger account.<br />
+Go to the Settings, and make Blogger publish your files in the directory where your WordPress resides. Change the Date/Time format to be mm/dd/yyyy hh:mm:ss AM/PM (the first choice in the dropdown menu). In Archives: set the frequency to 'monthly' and the archive filename to 'wordpress.php' (without the quotes), set the ftp archive path to make Blogger publish the archives in your WordPress directory. Click 'save changes'.<br />
+Go to the Templates. Replace your existing template with this line (copy and paste):
+<blockquote>&lt;Blogger>&lt;wordpresspost>&lt;$BlogItemDateTime$>|||&lt;$BlogItemAuthorNickname$>|||&lt;$BlogItemBody$>|||&lt;$BlogItemNumber$>|||&lt;$BlogItemSubject$>&lt;/Blogger></blockquote>
+Go to the Archives, and click 'republish all'.<br />
+Check in your FTP that you've got the archive files published. They should look like this example: <code>2001_10_01_wordpress.php</code>. If they aren't there, redo the republish process.</p>
+<p>You're done with the hard part. :)</p>
+
+<form name="stepOne" method="get">
+<input type="hidden" name="action" value="step1" />
+<h3>Third step: w00t, let's click OK:</h3>
+<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" /><br /><br />
+<i>Note: the script might take some time, like 1 second for 100 entries
+imported. DO NOT STOP IT or else you won't have a complete import.</i></p>
+</form>
+</div>
+</body>
+</html>
+       <?php
+       break;
+
+}
+
+?>
diff --git a/WebKitSite/blog/wp-admin/import-greymatter.php b/WebKitSite/blog/wp-admin/import-greymatter.php
new file mode 100644 (file)
index 0000000..497d7b4
--- /dev/null
@@ -0,0 +1,322 @@
+<?php
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. You must install WordPress before you import any entries.");
+
+require_once('../wp-config.php');
+require('upgrade-functions.php');
+
+$wpvarstoreset = array('action', 'gmpath', 'archivespath', 'lastentry');
+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"];
+               }
+       }
+}
+
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>WordPress &rsaquo; Import from GreyMatter</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 20%;
+               margin-right: 20%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/logo.png);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               text-decoration: none;
+               text-indent: -100em;
+               height: 60px;
+       }
+       p {
+               line-height: 140%;
+       }
+       #authors li     {
+               padding:3px;
+               border: 1px solid #ccc;
+               width: 40%;
+               margin-bottom:2px;
+       }
+       </style>
+</head><body> 
+<h1 id="logo"><a href="http://wordpress.org">WordPress</a></h1> 
+
+<?php
+switch ($action) {
+
+case "step1":
+
+       function gm2autobr($string) { // transforms GM's |*| into wp's <br />\n
+               $string = str_replace("|*|","<br />\n",$string);
+               return($string);
+       }
+
+       if (!@chdir($archivespath))
+               die("Wrong path, $archivespath\ndoesn't exist\non the server");
+
+       if (!@chdir($gmpath))
+               die("Wrong path, $gmpath\ndoesn't exist\non the server");
+?>
+
+<p>The importer is running...</p>
+<ul>
+<li>importing users... <ul><?php
+
+       chdir($gmpath);
+       $userbase = file("gm-authors.cgi");
+
+       foreach($userbase as $user) {
+               $userdata=explode("|", $user);
+
+               $user_ip="127.0.0.1";
+               $user_domain="localhost";
+               $user_browser="server";
+
+               $s=$userdata[4];
+               $user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
+
+               $user_login=addslashes($userdata[0]);
+               $pass1=addslashes($userdata[1]);
+               $user_nickname=addslashes($userdata[0]);
+               $user_email=addslashes($userdata[2]);
+               $user_url=addslashes($userdata[3]);
+               $user_joindate=addslashes($user_joindate);
+
+               $loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
+               if ($loginthere) {
+                       echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>";
+                       continue;
+               }
+
+               $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
+               $result = $wpdb->query($query);
+               if ($result==false) {
+                       die ("<strong>ERROR</strong>: couldn't register an user!");
+               }
+               echo "<li>user <i>$user_login</i>... <b>Done</b></li>";
+
+       }
+
+?></ul><b>Done</b></li>
+<li>importing posts, comments, and karma...<br /><ul><?php
+
+       chdir($archivespath);
+       
+       for($i = 0; $i <= $lastentry; $i = $i + 1) {
+               
+               $entryfile = "";
+               
+               if ($i<10000000) {
+                       $entryfile .= "0";
+                       if ($i<1000000) {
+                               $entryfile .= "0";
+                               if ($i<100000) {
+                                       $entryfile .= "0";
+                                       if ($i<10000) {
+                                               $entryfile .= "0";
+                                               if ($i<1000) {
+                                                       $entryfile .= "0";
+                                                       if ($i<100) {
+                                                               $entryfile .= "0";
+                                                               if ($i<10) {
+                                                                       $entryfile .= "0";
+               }}}}}}}
+
+               $entryfile .= "$i";
+
+               if (is_file($entryfile.".cgi")) {
+
+                       $entry=file($entryfile.".cgi");
+                       echo "<li>entry # $entryfile ";
+                       $postinfo=explode("|",$entry[0]);
+                       $postmaincontent=gm2autobr($entry[2]);
+                       $postmorecontent=gm2autobr($entry[3]);
+
+                       $post_author=trim(addslashes($postinfo[1]));
+                       // we'll check the author is registered, or if it's a deleted author
+                       $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
+                       $result = $wpdb->query($sql);
+                       if (! $result) { // if deleted from GM, we register the author as a level 0 user in wp
+                               $user_ip="127.0.0.1";
+                               $user_domain="localhost";
+                               $user_browser="server";
+                               $user_joindate="1979-06-06 00:41:00";
+                               $user_login=addslashes($post_author);
+                               $pass1=addslashes("password");
+                               $user_nickname=addslashes($post_author);
+                               $user_email=addslashes("user@deleted.com");
+                               $user_url=addslashes("");
+                               $user_joindate=addslashes($user_joindate);
+                               $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
+                               $result = $wpdb->query($query);
+                               if ($result==false) {
+                                       die ("<strong>ERROR</strong>: couldn't register an user!");
+                               }
+                               echo ": registered deleted user <i>$user_login</i> at level 0 ";
+                       }
+
+                       $sql = "SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'";
+                       $post_author_ID = $wpdb->get_var($sql);
+
+                       $post_title=gm2autobr($postinfo[2]);
+                       $post_title=addslashes($post_title);
+
+                       $postyear=$postinfo[6];
+                       $postmonth=zeroise($postinfo[4],2);
+                       $postday=zeroise($postinfo[5],2);
+                       $posthour=zeroise($postinfo[7],2);
+                       $postminute=zeroise($postinfo[8],2);
+                       $postsecond=zeroise($postinfo[9],2);
+
+                       if (($postinfo[10]=="PM") && ($posthour!="12"))
+                               $posthour=$posthour+12;
+
+                       $post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
+
+                       $post_content=$postmaincontent;
+                       if (strlen($postmorecontent)>3)
+                               $post_content .= "<!--more--><br /><br />".$postmorecontent;
+                       $post_content=addslashes($post_content);
+
+                       $post_karma=$postinfo[12];
+
+                       $query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
+                       $result = $wpdb->query($query);
+
+                       if (!$result)
+                               die ("Error in posting...");
+                       
+                       $query = "SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1";
+                       $post_ID = $wpdb->get_var($query);
+
+                       // Grab a default category.
+                       $post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
+
+                       // Update the post2cat table.
+                       $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
+                         
+                       if (!$exists) {
+                         $wpdb->query("
+                                       INSERT INTO $wpdb->post2cat
+                                       (post_id, category_id)
+                                       VALUES
+                                       ($post_ID, $post_category)
+                                       ");
+                       }
+
+                       $c=count($entry);
+                       if ($c>4) {
+                               for ($j=4;$j<$c;$j++) {
+                                       $entry[$j]=gm2autobr($entry[$j]);
+                                       $commentinfo=explode("|",$entry[$j]);
+                                       $comment_post_ID=$post_ID;
+                                       $comment_author=addslashes($commentinfo[0]);
+                                       $comment_author_email=addslashes($commentinfo[2]);
+                                       $comment_author_url=addslashes($commentinfo[3]);
+                                       $comment_author_IP=addslashes($commentinfo[1]);
+
+                                       $commentyear=$commentinfo[7];
+                                       $commentmonth=zeroise($commentinfo[5],2);
+                                       $commentday=zeroise($commentinfo[6],2);
+                                       $commenthour=zeroise($commentinfo[8],2);
+                                       $commentminute=zeroise($commentinfo[9],2);
+                                       $commentsecond=zeroise($commentinfo[10],2);
+                                       if (($commentinfo[11]=="PM") && ($commenthour!="12"))
+                                               $commenthour=$commenthour+12;
+                                       $comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
+
+                                       $comment_content=addslashes($commentinfo[12]);
+
+                                       $sql3 = "INSERT INTO $wpdb->comments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
+                                       $result3 = $wpdb->query($sql3);
+                                       if (!$result3)
+                                               die ("There is an error with the database, it can't store your comment..");
+                               }
+                               $comments=$c-4;
+                               echo ": imported $comments comment";
+                               if ($comments>1)
+                                       echo "s";
+                       }
+                       echo "... <b>Done</b></li>";
+               }
+       } 
+       upgrade_all();
+       ?>
+</ul><b>Done</b></li></ul>
+<p>&nbsp;</p>
+<p>Completed GM 2 WordPress import !</p>
+<p>Now you can go and <a href="wp-login.php">log in</a>, have fun !</p>
+       <?php
+       break;
+
+default:
+?>
+
+<p>This is a basic GreyMatter to WordPress import script.</p>
+<p>What it does:</p>
+<ul>
+<li>parses gm-authors.cgi to import authors: everyone is imported at level 1</li>
+<li>parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress); if authors are found not to be in gm-authors.cgi, imports them at level 0</li>
+</ul>
+<p>What it does not:</p>
+<ul>
+<li>parse gm-counter.cgi (what's the use of that file ?), gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log)</li>
+<li>import gm-templates. you'll start with the basic template wp.php</li>
+<li>doesn't keep entries on top</li>
+</ul>
+
+<h3>First step: Install WordPress</h3>
+<p>Install the WordPress blog as explained in the <a href="../readme.html" target="_blank">ReadMe</a>, then immediately come back here.</p>
+
+<form name="stepOne" method="get">
+<input type="hidden" name="action" value="step1" />
+<h3>Second step: Provide GreyMatter details</h3>
+<table cellpadding="0">
+<tr>
+<td>Path to GM files:</td>
+<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
+</tr>
+<tr>
+<td>Path to GM entries:</td>
+<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
+</tr>
+</table>
+
+<p>This importer will search for files 00000001.cgi to 000-whatever.cgi, so you need to enter the number of the last GM post here. (If you don't know that number, just log into your FTP and look it up in the entries' folder)</p>
+
+<table>
+<tr>
+<td>Last entry's number:</td>
+<td><input type="text" name="lastentry" value="00000001" /></td>
+</tr>
+</table>
+
+<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" class="search" /></p>
+</form>
+
+</body>
+</html>
+       <?php
+       break;
+}
+
+?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/import-livejournal.php b/WebKitSite/blog/wp-admin/import-livejournal.php
new file mode 100644 (file)
index 0000000..f3e1379
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+define('XMLFILE', '');
+// Example:
+// define('XMLFILE', '/home/example/public_html/rss.xml');
+// or if it's in the same directory as import-rss.php
+// define('XMLFILE', 'rss.xml');
+
+$post_author = 1; // Author to import posts as author ID
+$timezone_offset = 0; // GMT offset of posts your importing
+
+
+$add_hours = intval($timezone_offset);
+$add_minutes = intval(60 * ($timezone_offset - $add_hours));
+
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. You must install WordPress before you import any entries.");
+require('../wp-config.php');
+
+$step = $_GET['step'];
+if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>WordPress &rsaquo; Import from RSS</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 20%;
+               margin-right: 20%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/logo.png);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               text-decoration: none;
+               text-indent: -100em;
+               height: 60px;
+       }
+       p {
+               line-height: 140%;
+       }
+       </style>
+</head><body> 
+<h1 id="logo"><a href="http://wordpress.org/">WordPress</a></h1> 
+<?php
+switch($step) {
+
+       case 0:
+?> 
+<p>Howdy! This importer allows you to extract posts from a LiveJournal XML export file. To get started you must edit the following line in this file (<code>import-livejournal.php</code>) </p>
+<p><code>define('XMLFILE', '');</code></p>
+<p>You want to define where the XML file we'll be working with is, for example: </p>
+<p><code>define('XMLFILE', '2002-04.xml');</code></p>
+<p>You have to do this manually for security reasons.</p>
+<p>If you've done that and you&#8217;re all ready, <a href="import-livejournal.php?step=1">let's go</a>!</p>
+<?php
+       break;
+       
+       case 1:
+if ('' != XMLFILE && !file_exists(XMLFILE)) die("The file you specified does not seem to exist. Please check the path you've given.");
+if ('' == XMLFILE) die("You must edit the XMLFILE line as described on the <a href='import-rss.php'>previous page</a> to continue.");
+
+// Bring in the data
+set_magic_quotes_runtime(0);
+$datalines = file(XMLFILE); // Read the file into an array
+$importdata = implode('', $datalines); // squish it
+$importdata = str_replace(array("\r\n", "\r"), "\n", $importdata);
+
+preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
+$posts = $posts[1];
+
+echo '<ol>';
+foreach ($posts as $post) :
+$title = $date = $categories = $content = $post_id =  '';
+echo "<li>Importing post... ";
+
+preg_match('|<subject>(.*?)</subject>|is', $post, $title);
+$title = addslashes( trim($title[1]) );
+$post_name = sanitize_title($title);
+
+preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $date);
+$date = strtotime($date[1]);
+
+$post_date = date('Y-m-d H:i:s', $date);
+
+
+preg_match('|<event>(.*?)</event>|is', $post, $content);
+$content = str_replace( array('<![CDATA[', ']]>'), '', addslashes( trim($content[1]) ) );
+
+// Now lets put it in the DB
+if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'")) :
+       echo 'Post already imported';
+else : 
+       
+       $wpdb->query("INSERT INTO $wpdb->posts 
+               (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
+               VALUES 
+               ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
+       $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
+       if (!$post_id) die("couldn't get post ID");
+       $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
+       if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
+       echo 'Done!</li>';
+endif;
+
+
+endforeach;
+?>
+</ol>
+
+<h3>All done. <a href="../">Have fun!</a></h3>
+<?php
+       break;
+}
+?> 
+</body>
+</html>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/import-mt.php b/WebKitSite/blog/wp-admin/import-mt.php
new file mode 100644 (file)
index 0000000..04d6ca0
--- /dev/null
@@ -0,0 +1,418 @@
+<?php
+define('MTEXPORT', '');
+// enter the relative path of the import.txt file containing the mt entries. If the file is called import.txt and it is /wp-admin, then this line
+//should be define('MTEXPORT', 'import.txt');
+
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. You must install WordPress before you import any entries.");
+require('../wp-config.php');
+require ('upgrade-functions.php');
+$step = $_GET['step'];
+if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>WordPress &rsaquo; Import from Movable Type</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 20%;
+               margin-right: 20%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/logo.png);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               text-decoration: none;
+               text-indent: -100em;
+               height: 60px;
+       }
+       p {
+               line-height: 140%;
+       }
+       #authors li     {
+               padding:3px;
+               border: 1px solid #ccc;
+               width: 40%;
+               margin-bottom:2px;
+       }
+       </style>
+</head><body> 
+<h1 id="logo"><a href="http://wordpress.org">WordPress</a></h1> 
+<?php
+switch($step) {
+
+       case 0:
+?> 
+<p>Howdy! We&#8217;re about to begin the process to import all of your Movable Type entries into WordPress. Before we get started, you need to edit this file (<code>import-mt.php</code>) and change one line so we know where to find your MT export file. To make this easy put the import file into the <code>wp-admin</code> directory. Look for the line that says:</p>
+<p><code>define('MTEXPORT', '');</code></p>
+<p>and change it to</p>
+<p><code>define('MTEXPORT', 'import.txt');</code></p>
+<p>You have to do this manually for security reasons.</p>
+<p>If you've done that and you&#8217;re all ready, <a href="import-mt.php?step=1">let's go</a>! Remember that the import process may take a minute or so if you have a large number of entries and comments. Think of all the rebuilding time you'll be saving once it's done. :)</p>
+<p>The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn't finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces. </p>
+<?php
+       break;
+       
+       case 1:
+if ('' != MTEXPORT && !file_exists(MTEXPORT)) die("The file you specified does not seem to exist. Please check the path you've given.");
+if ('' == MTEXPORT) die("You must edit the MTEXPORT line as described on the <a href='import-mt.php'>previous page</a> to continue.");
+// Bring in the data
+set_magic_quotes_runtime(0);
+$importdata = file(MTEXPORT); // Read the file into an array
+$importdata = implode('', $importdata); // squish it
+$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
+$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
+$authors = array();
+$temp = array();
+$posts = explode("--MT-ENTRY--", $importdata);
+unset( $importdata ); // Free up memory
+
+function users_form($n) {
+       global $wpdb, $testing;
+       $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
+       ?><select name="userselect[<?php echo $n; ?>]">
+       <option value="#NONE#">- Select -</option>
+       <?php foreach($users as $user) {
+               echo '<option value="'.$user->user_login.'">'.$user->user_login.'</option>';
+               } ?>
+       </select>
+<?php }
+
+$i = -1;
+foreach ($posts as $post) { 
+       if ('' != trim($post)) {
+               ++$i;
+               unset($post_categories);
+               preg_match("|AUTHOR:(.*)|", $post, $thematch);
+               $thematch = trim($thematch[1]);
+               array_push($temp,"$thematch"); //store the extracted author names in a temporary array
+               }
+       }//end of foreach
+//we need to find unique values of author names, while preserving the order, so this function emulates the unique_value(); php function, without the sorting.
+$authors[0] = array_shift($temp); 
+$y = count($temp) + 1;
+for ($x = 1; $x < $y; $x++) {
+       $next = array_shift($temp);
+       if (!(in_array($next,$authors))) array_push($authors, "$next");
+       }
+//by this point, we have all unique authors in the array $authors
+?><p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
+<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
+<p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
+       <?php
+       echo '<ol id="authors">';
+       echo '<form action="?step=2" method="post">';
+       $j = -1;
+       foreach ($authors as $author) {
+       ++$j;
+       echo '<li><i>'.$author.'</i><br />'.'<input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30">';
+       users_form($j);
+       echo '</li>';
+       }
+       echo '<input type="submit" value="Submit">'.'<br/>';
+       echo '</form>';
+       echo '</ol>';
+       
+       flush();
+
+       break;
+       
+       case 2:
+       $newauthornames = array();
+       $formnames = array();
+       $selectnames = array();
+       $mtnames = array();
+       foreach($_POST['user'] as $key => $line) { 
+       $newname = trim(stripslashes($line)); 
+       if ($newname == '') $newname = 'left_blank';//passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form.
+       array_push($formnames,"$newname");
+       }// $formnames is the array with the form entered names
+       foreach ($_POST['userselect'] as $user => $key) {
+       $selected = trim(stripslashes($key));
+       array_push($selectnames,"$selected");
+       }
+       $count = count($formnames);
+       for ($i = 0; $i < $count; $i++) {
+       if ( $selectnames[$i] != '#NONE#') {//if no name was selected from the select menu, use the name entered in the form
+       array_push($newauthornames,"$selectnames[$i]");
+       } 
+       else {
+       array_push($newauthornames,"$formnames[$i]");
+       }
+       }
+
+       $j = -1;
+       //function to check the authorname and do the mapping
+       function checkauthor($author) {
+       global $wpdb, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file
+       $md5pass = md5(changeme);
+       if (!(in_array($author, $mtnames))) { //a new mt author name is found
+               ++$j;
+               $mtnames[$j] = $author; //add that new mt author name to an array 
+               $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'"); //check if the new author name defined by the user is a pre-existing wp user
+               if (!$user_id) { //banging my head against the desk now. 
+                       if ($newauthornames[$j] == 'left_blank') { //check if the user does not want to change the authorname
+                               $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$author', '$md5pass', '$author')"); // if user does not want to change, insert the authorname $author
+                               $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$author'");
+                               $newauthornames[$j] = $author; //now we have a name, in the place of left_blank.
+                       } else {
+                       $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$newauthornames[$j]', '$md5pass', '$newauthornames[$j]')"); //if not left_blank, insert the user specified name
+                       $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'");
+                       }
+               } else return $user_id; // return pre-existing wp username if it exists
+    } else {
+    $key = array_search($author, $mtnames); //find the array key for $author in the $mtnames array
+    $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$key]'");//use that key to get the value of the author's name from $newauthornames
+       }
+       return $user_id;
+}//function checkauthor ends here
+
+       //bring in the posts now
+set_magic_quotes_runtime(0);
+$importdata = file(MTEXPORT); // Read the file into an array
+$importdata = implode('', $importdata); // squish it
+$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
+$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--", $importdata);
+$authors = array();
+$temp = array();
+$posts = explode("--MT-ENTRY--", $importdata);
+unset( $importdata ); // Free up memory
+
+$i = -1;
+echo "<ol>";
+foreach ($posts as $post) { if ('' != trim($post)) {
+       ++$i;
+       unset($post_categories);
+       echo "<li>Processing post... ";
+
+       // Take the pings out first
+       preg_match("|(-----\n\nPING:.*)|s", $post, $pings);
+       $post = preg_replace("|(-----\n\nPING:.*)|s", '', $post);
+
+       // Then take the comments out
+       preg_match("|(-----\nCOMMENT:.*)|s", $post, $comments);
+       $post = preg_replace("|(-----\nCOMMENT:.*)|s", '', $post);
+       
+       // We ignore the keywords
+       $post = preg_replace("|(-----\nKEYWORDS:.*)|s", '', $post);
+       
+       // We want the excerpt
+       preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
+       $excerpt = addslashes(trim($excerpt[1]));
+       $post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
+       
+       // We're going to put extended body into main body with a more tag
+       preg_match("|-----\nEXTENDED BODY:(.*)|s", $post, $extended);
+       $extended = trim($extended[1]);
+       if ('' != $extended) $extended = "\n<!--more-->\n$extended";
+       $post = preg_replace("|(-----\nEXTENDED BODY:.*)|s", '', $post);
+       
+       // Now for the main body
+       preg_match("|-----\nBODY:(.*)|s", $post, $body);
+       $body = trim($body[1]);
+       $post_content = addslashes($body . $extended);
+       $post = preg_replace("|(-----\nBODY:.*)|s", '', $post);
+       
+       // Grab the metadata from what's left
+       $metadata = explode("\n", $post);
+       foreach ($metadata as $line) {
+               preg_match("/^(.*?):(.*)/", $line, $token);
+               $key = trim($token[1]);
+               $value = trim($token[2]);
+               // Now we decide what it is and what to do with it
+        switch($key) {
+                       case '':
+                               break;
+            case 'AUTHOR':
+                $post_author = $value;
+                break;
+            case 'TITLE':
+                $post_title = addslashes($value);
+                               echo '<i>'.stripslashes($post_title).'</i>... ';
+                               $post_name = sanitize_title($post_title);
+                break;
+            case 'STATUS':
+                // "publish" and "draft" enumeration items match up; no change required
+                $post_status = $value;
+                               if (empty($post_status)) $post_status = 'publish';
+                break;
+            case 'ALLOW COMMENTS':
+                $post_allow_comments = $value;
+                if ($post_allow_comments == 1) {
+                    $comment_status = 'open';
+                } else {
+                    $comment_status = 'closed';
+                }
+                break;
+            case 'CONVERT BREAKS':
+                $post_convert_breaks = $value;
+                break;
+            case 'ALLOW PINGS':
+                $post_allow_pings = trim($meta[2][0]);
+                if ($post_allow_pings == 1) {
+                    $post_allow_pings = 'open';
+                } else {
+                    $post_allow_pings = 'closed';
+                }
+                break;
+            case 'PRIMARY CATEGORY':
+                               $post_categories[] = addslashes($value);
+                break;
+            case 'CATEGORY':    
+                               $post_categories[] = addslashes($value);
+                break;
+                       case 'DATE':
+                               $post_date = strtotime($value);
+                               $post_date = date('Y-m-d H:i:s', $post_date);
+                               $post_date_gmt = get_gmt_from_date("$post_date");
+                               break;
+                       default:
+//                             echo "\n$key: $value";
+                               break;
+        } // end switch
+       } // End foreach
+
+       // Let's check to see if it's in already
+       if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'")) {
+               echo "Post already imported.";
+       } else {
+               $post_author = checkauthor($post_author);//just so that if a post already exists, new users are not created by checkauthor
+           $wpdb->query("INSERT INTO $wpdb->posts (
+                       post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_name, post_modified, post_modified_gmt)
+                       VALUES 
+                       ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_name','$post_date', '$post_date_gmt')");
+               $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'");
+               if (0 != count($post_categories)) {
+                       foreach ($post_categories as $post_category) {
+                       // See if the category exists yet
+                       $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
+                       if (!$cat_id && '' != trim($post_category)) {
+                               $cat_nicename = sanitize_title($post_category);
+                               $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
+                               $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
+                       }
+                       if ('' == trim($post_category)) $cat_id = 1;
+                       // Double check it's not there already
+                       $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
+
+                        if (!$exists) { 
+                               $wpdb->query("
+                               INSERT INTO $wpdb->post2cat
+                               (post_id, category_id)
+                               VALUES
+                               ($post_id, $cat_id)
+                               ");
+                       }
+               } // end category loop
+               } else {
+                       $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
+                       if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
+               }
+               echo " Post imported successfully...";
+               // Now for comments
+               $comments = explode("-----\nCOMMENT:", $comments[0]);
+               foreach ($comments as $comment) {
+               if ('' != trim($comment)) {
+                       // Author
+                       preg_match("|AUTHOR:(.*)|", $comment, $comment_author);
+                       $comment_author = addslashes(trim($comment_author[1]));
+                       $comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment);
+
+                       preg_match("|EMAIL:(.*)|", $comment, $comment_email);
+                       $comment_email = addslashes(trim($comment_email[1]));
+                       $comment = preg_replace('|(\n?EMAIL:.*)|', '', $comment);
+
+                       preg_match("|IP:(.*)|", $comment, $comment_ip);
+                       $comment_ip = trim($comment_ip[1]);
+                       $comment = preg_replace('|(\n?IP:.*)|', '', $comment);
+
+                       preg_match("|URL:(.*)|", $comment, $comment_url);
+                       $comment_url = addslashes(trim($comment_url[1]));
+                       $comment = preg_replace('|(\n?URL:.*)|', '', $comment);
+
+                       preg_match("|DATE:(.*)|", $comment, $comment_date);
+                       $comment_date = trim($comment_date[1]);
+                       $comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
+                       $comment = preg_replace('|(\n?DATE:.*)|', '', $comment);
+
+                       $comment_content = addslashes(trim($comment));
+                       $comment_content = str_replace('-----', '', $comment_content);
+
+                       // Check if it's already there
+                       if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
+                               $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)
+                               VALUES
+                               ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')");
+                               echo " Comment added.";
+                       }
+               }
+               }
+
+               // Finally the pings
+               // fix the double newline on the first one
+               $pings[0] = str_replace("-----\n\n", "-----\n", $pings[0]);
+               $pings = explode("-----\nPING:", $pings[0]);
+               foreach ($pings as $ping) {
+               if ('' != trim($ping)) {
+                       // 'Author'
+                       preg_match("|BLOG NAME:(.*)|", $ping, $comment_author);
+                       $comment_author = addslashes(trim($comment_author[1]));
+                       $ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping);
+
+                       $comment_email = '';
+
+                       preg_match("|IP:(.*)|", $ping, $comment_ip);
+                       $comment_ip = trim($comment_ip[1]);
+                       $ping = preg_replace('|(\n?IP:.*)|', '', $ping);
+
+                       preg_match("|URL:(.*)|", $ping, $comment_url);
+                       $comment_url = addslashes(trim($comment_url[1]));
+                       $ping = preg_replace('|(\n?URL:.*)|', '', $ping);
+
+                       preg_match("|DATE:(.*)|", $ping, $comment_date);
+                       $comment_date = trim($comment_date[1]);
+                       $comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
+                       $ping = preg_replace('|(\n?DATE:.*)|', '', $ping);
+      
+                       preg_match("|TITLE:(.*)|", $ping, $ping_title);
+                       $ping_title = addslashes(trim($ping_title[1]));
+                       $ping = preg_replace('|(\n?TITLE:.*)|', '', $ping);
+
+                       $comment_content = addslashes(trim($ping));
+                       $comment_content = str_replace('-----', '', $comment_content);
+                       
+                       $comment_content = "<strong>$ping_title</strong>\n\n$comment_content";
+      
+                       // Check if it's already there
+                       if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
+                               $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved, comment_type)
+                               VALUES
+                               ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1', 'trackback')");
+                               echo " Comment added.";
+                       }
+
+               }
+               }
+       }
+       echo "</li>";
+       flush();
+
+} }
+upgrade_all();
+?>
+</ol>
+<h3>All done. <a href="../">Have fun!</a></h3>
+<?php
+       break;
+}
+?> 
+</body>
+</html>
diff --git a/WebKitSite/blog/wp-admin/import-rss.php b/WebKitSite/blog/wp-admin/import-rss.php
new file mode 100644 (file)
index 0000000..2c3efc9
--- /dev/null
@@ -0,0 +1,191 @@
+<?php
+define('RSSFILE', '');
+// Example:
+// define('RSSFILE', '/home/example/public_html/rss.xml');
+// or if it's in the same directory as import-rss.php
+// define('RSSFILE', 'rss.xml');
+
+$post_author = 1; // Author to import posts as author ID
+$timezone_offset = 0; // GMT offset of posts your importing
+
+function unhtmlentities($string) { // From php.net for < 4.3 compat
+   $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+   $trans_tbl = array_flip($trans_tbl);
+   return strtr($string, $trans_tbl);
+}
+
+$add_hours = intval($timezone_offset);
+$add_minutes = intval(60 * ($timezone_offset - $add_hours));
+
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. You must install WordPress before you import any entries.");
+require('../wp-config.php');
+
+$step = $_GET['step'];
+if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>WordPress &rsaquo; Import from RSS</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 20%;
+               margin-right: 20%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/logo.png);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               text-decoration: none;
+               text-indent: -100em;
+               height: 60px;
+       }
+       p {
+               line-height: 140%;
+       }
+       </style>
+</head><body> 
+<h1 id="logo"><a href="http://wordpress.org/">WordPress</a></h1> 
+<?php
+switch($step) {
+
+       case 0:
+?> 
+<p>Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. To get started you must edit the following line in this file (<code>import-rss.php</code>) </p>
+<p><code>define('RSSFILE', '');</code></p>
+<p>You want to define where the RSS file we'll be working with is, for example: </p>
+<p><code>define('RSSFILE', 'rss.xml');</code></p>
+<p>You have to do this manually for security reasons. When you're done reload this page and we'll take you to the next step.</p>
+<?php if ('' != RSSFILE) : ?>
+<h2 style="text-align: right;"><a href="import-rss.php?step=1">Begin RSS Import &raquo;</a></h2>
+<?php endif; ?>
+<?php
+       break;
+
+       case 1:
+
+// Bring in the data
+set_magic_quotes_runtime(0);
+$datalines = file(RSSFILE); // Read the file into an array
+$importdata = implode('', $datalines); // squish it
+$importdata = str_replace(array("\r\n", "\r"), "\n", $importdata);
+
+preg_match_all('|<item>(.*?)</item>|is', $importdata, $posts);
+$posts = $posts[1];
+
+echo '<ol>';
+foreach ($posts as $post) :
+$title = $date = $categories = $content = $post_id =  '';
+echo "<li>Importing post... ";
+
+preg_match('|<title>(.*?)</title>|is', $post, $title);
+$title = addslashes( trim($title[1]) );
+$post_name = sanitize_title($title);
+
+preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $date);
+
+if ($date) :
+       $date = strtotime($date[1]);
+else : // if we don't already have something from pubDate
+       preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $date);
+       $date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $date[1]);
+       $date = str_replace('T', ' ', $date);
+       $date = strtotime($date);
+endif;
+
+$post_date = gmdate('Y-m-d H:i:s', $date);
+
+preg_match_all('|<category>(.*?)</category>|is', $post, $categories);
+$categories = $categories[1];
+
+if (!$categories) :
+       preg_match_all('|<dc:subject>(.*?)</dc:subject>|is', $post, $categories);
+       $categories = $categories[1];
+endif;
+
+preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid);
+if ($guid) $guid = addslashes( trim($guid[1]) );
+else $guid = '';
+
+preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $content);
+$content = str_replace( array('<![CDATA[', ']]>'), '', addslashes( trim($content[1]) ) );
+
+if (!$content) : // This is for feeds that put content in description
+       preg_match('|<description>(.*?)</description>|is', $post, $content);
+       $content = $wpdb->escape( unhtmlentities( trim($content[1]) ) );
+endif;
+
+// Clean up content
+$content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $content);
+$content = str_replace('<br>', '<br />', $content);
+$content = str_replace('<hr>', '<hr />', $content);
+
+// This can mess up on posts with no titles, but checking content is much slower
+// So we do it as a last resort
+if ('' == $title) : 
+       $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'");
+else :
+       $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
+endif;
+
+// Now lets put it in the DB
+if ($dupe) :
+       echo 'Post already imported';
+else : 
+       
+       $wpdb->query("INSERT INTO $wpdb->posts 
+               (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid)
+               VALUES 
+               ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')");
+       $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
+       if (!$post_id) die("couldn't get post ID");
+       if (0 != count($categories)) :
+               foreach ($categories as $post_category) :
+               $post_category = unhtmlentities($post_category);
+               // See if the category exists yet
+               $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
+               if (!$cat_id && '' != trim($post_category)) {
+                       $cat_nicename = sanitize_title($post_category);
+                       $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
+                       $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
+               }
+               if ('' == trim($post_category)) $cat_id = 1;
+               // Double check it's not there already
+               $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
+       
+                if (!$exists) { 
+                       $wpdb->query("
+                       INSERT INTO $wpdb->post2cat
+                       (post_id, category_id)
+                       VALUES
+                       ($post_id, $cat_id)
+                       ");
+                       }
+       endforeach;
+       else:
+               $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
+               if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
+       endif;
+       echo 'Done!</li>';
+endif;
+
+
+endforeach;
+?>
+</ol>
+
+<h3>All done. <a href="../">Have fun!</a></h3>
+<?php
+       break;
+}
+?> 
+</body>
+</html>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/import-textpattern.php b/WebKitSite/blog/wp-admin/import-textpattern.php
new file mode 100644 (file)
index 0000000..b53ea2e
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+
+// For security reasons, fill in the connection details to your Textpattern database below:
+
+$tp_database_name = 'textpattern';
+$tp_database_username = 'username';
+$tp_database_password = 'password';
+$tp_database_host = 'localhost';
+
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
+require('../wp-config.php');
+require('upgrade-functions.php');
+
+$step = $_GET['step'];
+if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>WordPress &rsaquo; Textpattern Import</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style media="screen" type="text/css">
+       body {
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 15%;
+               margin-right: 15%;
+       }
+       #logo {
+               margin: 0;
+               padding: 0;
+               background-image: url(http://wordpress.org/images/wordpress.gif);
+               background-repeat: no-repeat;
+               height: 60px;
+               border-bottom: 4px solid #333;
+       }
+       #logo a {
+               display: block;
+               text-decoration: none;
+               text-indent: -100em;
+               height: 60px;
+       }
+       p {
+               line-height: 140%;
+       }
+       </style>
+</head><body> 
+<h1 id="logo"><a href="http://wordpress.org">WordPress</a></h1> 
+<?php
+switch($step) {
+
+       case 0:
+?> 
+<p>This script imports your entries from Textpattern into WordPress. It should be relatively painless, and we hope you're happy with the result.</p>
+<p>To run this, you first need to edit this file (<code>import-textpattern.php</code>) and enter your Textpattern database connection details. Let's check if the database connection information works...</p>
+<?php
+$connection = @mysql_connect($tp_database_host, $tp_database_username, $tp_database_password);
+$database = @mysql_select_db($tp_database_name);
+if ($connection && $database) {
+?>
+<p>Everything seems dandy so far, <a href="?step=1">let's get started</a>!</p>
+<?php
+} else {
+?>
+<p><em>It looks like your database information is incorrect. Please re-edit this file and double-check all the settings.</em></p>
+<?php
+}
+       break;
+       
+       case 1:
+?> 
+<h1>Step 1</h1> 
+<p>First let's get posts and comments.</p> 
+<?php
+// For people running this on .72
+$query = "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL";
+maybe_add_column($wpdb->posts, 'post_name', $query);
+
+// Create post_name field
+$connection = @mysql_connect($tp_database_host, $tp_database_username, $tp_database_password);
+$database = @mysql_select_db($tp_database_name);
+
+// For now we're going to give everything the same author and same category
+$author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_level = 10 LIMIT 1");
+$category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
+
+$posts = mysql_query('SELECT * FROM textpattern', $connection);
+
+while ($post = mysql_fetch_array($posts)) {
+       //  ID, AuthorID, LastMod, LastModID, Posted, Title, Body, Body_html, Abstract, Category1, Category2, Annotate, AnnotateInvite, Status, Listing1, Listing2, Section
+       $posted = $post['Posted'];
+       // 20030216162119
+       $year = substr($posted,0,4);
+       $month = substr($posted,4,2);
+       $day = substr($posted,6,2);
+       $hour = substr($posted,8,2);
+       $minute = substr($posted,10,2);
+       $second = substr($posted,12,2);
+       $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+       $posted = date('Y-m-d H:i:s', $timestamp);
+       
+       $content = addslashes($post['Body_html']);
+       $title = addslashes($post['Title']);
+       $post_name = sanitize_title($title);
+
+       $wpdb->query("INSERT INTO $wpdb->posts
+               (post_author, post_date, post_content, post_title, post_category, post_name, post_status)
+               VALUES
+               ('$author', '$posted', '$content', '$title', '$category', '$post_name', 'publish')");
+
+       // Get wordpress post id
+       $wp_post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
+       
+       // Now let's insert comments if there are any for the TP post
+       $tp_id = $post['ID'];
+       $comments = mysql_query("SELECT * FROM txp_Discuss WHERE parentid = $tp_id");
+       if ($comments) {
+               while($comment = mysql_fetch_object($comments)) {
+                       //  discussid, parentid, name, email, web, ip, posted, message
+                       // For some reason here "posted" is a real MySQL date, so we don't have to do anything about it
+                       //  comment_post_ID      comment_author          comment_author_email    comment_author_url      comment_author_IP       comment_date    comment_content         comment_karma
+                       $wpdb->query("INSERT INTO $wpdb->comments
+                               (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content)
+                               VALUES
+                               ($wp_post_ID, '$comment->name', '$comment->email', '$comment->web', '$comment->ip', '$comment->posted', '$comment->message')");
+               }
+       }
+}
+
+upgrade_all();
+?>
+<p><strong>All done.</strong> Wasn&#8217;t that fun? <a href="../">Have fun</a>.</p> 
+<?php
+break;
+}
+?> 
+
+</body>
+</html>
diff --git a/WebKitSite/blog/wp-admin/index.php b/WebKitSite/blog/wp-admin/index.php
new file mode 100644 (file)
index 0000000..52de37c
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+require_once('admin.php'); 
+$title = __('Dashboard'); 
+require_once('admin-header.php');
+require_once (ABSPATH . WPINC . '/rss-functions.php');
+
+$today = current_time('mysql', 1);
+?>
+
+<div class="wrap">
+<div id="zeitgeist">
+<h2><?php _e('Latest Activity'); ?></h2>
+<?php
+if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
+?>
+<div>
+<h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">&raquo;</a></h3>
+<ul>
+<?php
+foreach ($recentposts as $post) {
+       if ($post->post_title == '')
+               $post->post_title = sprintf(__('Post #%s'), $post->ID);
+       echo "<li><a href='post.php?action=edit&amp;post=$post->ID'>";
+       the_title();
+       echo '</a></li>';
+}
+?>
+</ul>
+</div>
+<?php endif; ?>
+
+<?php
+if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today'") ) :
+?> 
+<div>
+<h3><?php _e('Scheduled Entries:') ?></h3>
+<ul>
+<?php
+foreach ($scheduled as $post) {
+       if ($post->post_title == '')
+               $post->post_title = sprintf(__('Post #%s'), $post->ID);
+       echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ))  . "</li>";
+}
+?> 
+</ul>
+</div>
+<?php endif; ?>
+
+<?php
+if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5") ) :
+?>
+<div>
+<h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php _e('More comments...'); ?>">&raquo;</a></h3>
+<ul>
+<?php 
+foreach ($comments as $comment) {
+       echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
+       edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
+       echo '</li>';
+}
+?>
+</ul>
+<?php 
+if ( $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_approved = '0'") ) :
+?>
+<p><strong><a href="moderation.php"><?php echo sprintf(__('There are comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</a></strong></p>
+<?php endif; ?>
+</div>
+
+<?php endif; ?>
+
+<div>
+<h3><?php _e('Blog Stats'); ?></h3>
+<?php
+$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
+if (0 < $numposts) $numposts = number_format($numposts); 
+
+$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
+if (0 < $numcomms) $numcomms = number_format($numcomms);
+
+$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
+if (0 < $numcats) $numcats = number_format($numcats);
+?>
+<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php',  $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
+</div>
+
+<?php
+$rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
+if ( isset($rss->items) && 0 != count($rss->items) ) {
+?>
+<div id="incominglinks">
+<h3><?php _e('Incoming Links'); ?> <cite><a href="http://www.technorati.com/cosmos/search.html?url=<?php echo trailingslashit(get_option('home')); ?>&amp;partner=wordpress"><?php _e('More'); ?> &raquo;</a></cite></h3>
+<ul>
+<?php
+$rss->items = array_slice($rss->items, 0, 10);
+foreach ($rss->items as $item ) {
+?>
+       <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wp_specialchars($item['title']); ?></a></li>
+<?php } ?>
+</ul>
+</div>
+<?php } ?>
+
+</div>
+
+<h2><?php _e('Dashboard'); ?></h2>
+<p><?php _e('Below is the latest news from the official WordPress development blog, click on a title to read the full entry.'); ?></p>
+<?php
+$rss = @fetch_rss('http://wordpress.org/development/feed/');
+if ( isset($rss->items) && 0 != count($rss->items) ) {
+?>
+<h3>WordPress Development Blog</h3>
+<?php
+$rss->items = array_slice($rss->items, 0, 3);
+foreach ($rss->items as $item ) {
+?>
+<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php echo human_time_diff( strtotime($item['pubdate'], time() ) ); ?> <?php _e('ago'); ?></h4>
+<p><?php echo $item['description']; ?></p>
+<?php
+       }
+}
+?>
+
+
+<?php
+$rss = @fetch_rss('http://planet.wordpress.org/feed/');
+if ( isset($rss->items) && 0 != count($rss->items) ) {
+?>
+<div id="planetnews">
+<h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> &raquo;</a></h3>
+<ul>
+<?php
+$rss->items = array_slice($rss->items, 0, 20);
+foreach ($rss->items as $item ) {
+?>
+<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
+<?php
+       }
+?>
+</ul>
+</div>
+<?php
+}
+?>
+<div style="clear: both">&nbsp;
+<br clear="all" />
+</div>
+</div>
+<?php
+$drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
+if ($drafts) {
+?>
+<div class="wrap">
+
+    <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> 
+</div>
+<?php } ?>
+<?php
+require('./admin-footer.php');
+?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/install-helper.php b/WebKitSite/blog/wp-admin/install-helper.php
new file mode 100644 (file)
index 0000000..86138db
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+require_once('../wp-config.php');
+$debug = 0;
+
+/**
+ ** maybe_create_table()
+ ** Create db table if it doesn't exist.
+ ** Returns:  true if already exists or on successful completion
+ **           false on error
+ */
+function maybe_create_table($table_name, $create_ddl) {
+    global $wpdb;
+    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+        if ($table == $table_name) {
+            return true;
+        }
+    }
+    //didn't find it try to create it.
+    $q = $wpdb->query($create_ddl);
+    // we cannot directly tell that whether this succeeded!
+    foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+        if ($table == $table_name) {
+            return true;
+        }
+    }
+    return false;
+}
+
+/**
+ ** maybe_add_column()
+ ** Add column to db table if it doesn't exist.
+ ** Returns:  true if already exists or on successful completion
+ **           false on error
+ */
+function maybe_add_column($table_name, $column_name, $create_ddl) {
+    global $wpdb, $debug;
+    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+        if ($debug) echo("checking $column == $column_name<br />");
+        if ($column == $column_name) {
+            return true;
+        }
+    }
+    //didn't find it try to create it.
+    $q = $wpdb->query($create_ddl);
+    // we cannot directly tell that whether this succeeded!
+    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+        if ($column == $column_name) {
+            return true;
+        }
+    }
+    return false;
+}
+
+
+/**
+ ** maybe_drop_column()
+ ** Drop column from db table if it exists.
+ ** Returns:  true if it doesn't already exist or on successful drop
+ **           false on error
+ */
+function maybe_drop_column($table_name, $column_name, $drop_ddl) {
+    global $wpdb;
+    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+        if ($column == $column_name) {
+            //found it try to drop it.
+            $q = $wpdb->query($drop_ddl);
+            // we cannot directly tell that whether this succeeded!
+            foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+                if ($column == $column_name) {
+                    return false;
+                }
+            }
+        }
+    }
+    // else didn't find it
+    return true;
+}
+
+
+/**
+ ** check_column()
+ ** Check column matches passed in criteria.
+ ** Pass in null to skip checking that criteria
+ ** Returns:  true if it matches
+ **           false otherwise
+ ** (case sensitive) Column names returned from DESC table are:
+ **      Field
+ **      Type
+ **      Null
+ **      Key
+ **      Default
+ **      Extra
+ */
+function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
+    global $wpdb, $debug;
+    $diffs = 0;
+    $results = $wpdb->get_results("DESC $table_name");
+    
+    foreach ($results as $row ) {
+        if ($debug > 1) print_r($row);
+        if ($row->Field == $col_name) {
+            // got our column, check the params
+            if ($debug) echo ("checking $row->Type against $col_type\n");
+            if (($col_type != null) && ($row->Type != $col_type)) {
+                ++$diffs;
+            }
+            if (($is_null != null) && ($row->Null != $is_null)) {
+                ++$diffs;
+            }
+            if (($key != null) && ($row->Key  != $key)) {
+                ++$diffs;
+            }
+            if (($default != null) && ($row->Default != $default)) {
+                ++$diffs;
+            }
+            if (($extra != null) && ($row->Extra != $extra)) {
+                ++$diffs;
+            }
+            if ($diffs > 0) {
+                if ($debug) echo ("diffs = $diffs returning false\n");
+                return false;
+            }
+            return true;
+        } // end if found our column
+    }
+    return false;
+}
+    
+/*
+echo "<p>testing</p>";
+echo "<pre>";
+
+//check_column('wp_links', 'link_description', 'mediumtext'); 
+//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
+//    echo "ok\n";
+$error_count = 0;
+$tablename = $wpdb->links;
+// check the column
+if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
+{
+    $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
+    $q = $wpdb->query($ddl);
+}
+if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
+    $res .= $tablename . ' - ok <br />';
+} else {
+    $res .= 'There was a problem with ' . $tablename . '<br />';
+    ++$error_count;
+}
+echo "</pre>";
+*/
+?>
\ No newline at end of file
diff --git a/WebKitSite/blog/wp-admin/install.php b/WebKitSite/blog/wp-admin/install.php
new file mode 100644 (file)
index 0000000..99c78b6
--- /dev/null
@@ -0,0 +1,214 @@
+<?php
+define('WP_INSTALLING', true);
+if (!file_exists('../wp-config.php')) 
+    die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
+
+require_once('../wp-config.php');
+require_once('./upgrade-functions.php');
+
+$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
+
+if (isset($_GET['step']))
+       $step = $_GET['step'];
+else
+       $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+       <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <style media="screen" type="text/css">
+       <!--
+       html {
+               background: #eee;
+       }
+       body {
+               background: #fff;
+               color: #000;
+               font-family: Georgia, "Times New Roman", Times, serif;
+               margin-left: 20%;
+               margin-right: 20%;
+               padding: .2em 2em;
+       }
+       
+       h1 {
+               color: #006;
+               font-size: 18px;
+               font-weight: lighter;
+       }
+       
+       h2 {
+               font-size: 16px;
+       }
+       
+       p, li, dt {
+               line-height: 140%;
+               padding-bottom: 2px;
+       }
+
+       ul, ol {
+               padding: 5px 5px 5px 20px;
+       }
+       #logo {
+               margin-bottom: 2em;
+       }
+       .step a, .step input {
+               font-size: 2em;
+       }
+       td input {
+               font-size: 1.5em;
+       }
+       .step, th {
+               text-align: right;
+       }
+       #footer {
+               text-align: center; 
+               border-top: 1px solid #ccc; 
+               padding-top: 1em; 
+               font-style: italic;
+       }
+       -->
+       </style>
+</head>
+<body>
+<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1>
+<?php
+// Let's check to make sure WP isn't already installed.
+$wpdb->hide_errors();
+$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
+if ($installed) die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
+$wpdb->show_errors();
+
+switch($step) {
+
+       case 0:
+?>
+<p><?php printf(__('Welcome to WordPress installation. We&#8217;re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="%s">ReadMe documentation</a> at your leisure.'), '../readme.html'); ?></p>
+       <h2 class="step"><a href="install.php?step=1"><?php _e('First Step &raquo;'); ?></a></h2>
+<?php
+       break;
+
+       case 1:
+
+?>
+<h1><?php _e('First Step'); ?></h1>
+<p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p>
+
+<form id="setup" method="post" action="install.php?step=2">
+<table width="100%">
+<tr>
+<th width="33%"><?php _e('Weblog title:'); ?></th>
+<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
+</tr>
+<tr>
+<th><?php _e('Your e-mail:'); ?></th>
+       <td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
+</tr>
+</table>
+<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
+<h2 class="step">
+<input type="submit" name="Submit" value="<?php _e('Continue to Second Step &raquo;'); ?>" />
+</h2>
+</form>
+
+<?php
+       break;
+       case 2:
+
+// Fill in the data we gathered
+$weblog_title = $_POST['weblog_title'];
+$admin_email = $_POST['admin_email'];
+// check e-mail address
+if (empty($admin_email)) {
+       die (__("<strong>ERROR</strong>: please type your e-mail address"));
+} else if (!is_email($admin_email)) {
+       die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
+}
+       
+?>
+<h1><?php _e('Second Step'); ?></h1>
+<p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p>
+
+
+<?php
+flush();
+
+// Set everything up
+make_db_current_silent();
+populate_options();
+
+$wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'");
+$wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'");
+
+// Now drop in some default links
+$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".addslashes(__('Blogroll'))."')");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blog.carthik.net/index.php', 'Carthik', 1, 'http://blog.carthik.net/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php');");
+$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/');");
+
+// Default category
+$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename) VALUES ('0', '".addslashes(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."')");
+
+// First post
+$now = date('Y-m-d H:i:s');
+$now_gmt = gmdate('Y-m-d H:i:s');
+$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', '".addslashes(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '".addslashes(__('Hello world!'))."', '0', '".addslashes(__('hello-world'))."', '$now', '$now_gmt')");
+
+$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
+
+// Default comment
+$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".addslashes(__('Mr WordPress'))."', '', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', '".addslashes(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
+
+// Set up admin user
+$random_password = substr(md5(uniqid(microtime())), 0, 6);
+$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), '".addslashes(__('Administrator'))."', '$admin_email', '10', 'nickname', NOW() )");
+
+$message_headers = 'From: ' . stripslashes($_POST['weblog_title']) . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
+$message = sprintf(__("Your new WordPress blog has been successfully set up at:
+
+%1\$s
+
+You can log in to the administrator account with the following information:
+
+Username: admin
+Password: %2\$s
+
+We hope you enjoy your new weblog. Thanks!
+
+--The WordPress Team
+http://wordpress.org/
+"), $guessurl, $random_password);
+
+@mail($admin_email, __('New WordPress Blog'), $message, $message_headers);
+
+upgrade_all();
+?>
+
+<p><em><?php _e('Finished!'); ?></em></p>
+
+<p><?php printf(__('Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $random_password); ?></p>
+<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. So to review:'); ?>
+</p>
+<dl>
+<dt><?php _e('Username'); ?></dt>
+<dd><code>admin</code></dd>
+<dt><?php _e('Password'); ?></dt>
+<dd><code><?php echo $random_password; ?></code></dd>
+       <dt><?php _e('Login address'); ?></dt>
+<dd><a href="../wp-login.php">wp-login.php</a></dd>
+</dl>
+<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
+<?php
+       break;
+}
+?>
+<p id="footer"><?php _e('<a href="http://wordpress.org/">WordPress</a>, personal publishing platform.'); ?></p>
+</body>
+</html>
diff --git a/WebKitSite/blog/wp-admin/link-add.php b/WebKitSite/blog/wp-admin/link-add.php
new file mode 100644 (file)
index 0000000..56f2d1e
--- /dev/null
@@ -0,0 +1,272 @@
+<?php
+require_once('admin.php');
+
+$title = __('Add Link');
+$this_file = 'link-manager.php';
+$parent_file = 'link-manager.php';
+
+function 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 xfn_check($class, $value = '', $type = 'check') {
+       global $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"';
+       }
+}
+
+$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
+                       'description', 'visible', 'target', 'category', 'link_id',
+                       'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
+                       'notes', 'linkcheck[]');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+    $wpvar = $wpvarstoreset[$i];
+    if (!isset($$wpvar)) {
+        if (empty($_POST["$wpvar"])) {
+            if (empty($_GET["$wpvar"])) {
+                $$wpvar = '';
+            } else {
+                $$wpvar = $_GET["$wpvar"];
+            }
+        } else {
+            $$wpvar = $_POST["$wpvar"];
+        }
+    }
+}
+$link_url = stripslashes($_GET['linkurl']);
+$link_name = htmlentities(stripslashes(urldecode($_GET['name'])));
+
+
+$xfn = true;
+require('admin-header.php');
+?>
+
+<?php if ($_GET['added']) : ?>
+<div class="updated"><p><?php _e('Link added.'); ?></p></div>
+<?php endif; ?>
+<div class="wrap">
+<h2><?php _e('<strong>Add</strong> a link:') ?></h2>
+     <form name="addlink" method="post" action="link-manager.php">
+<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="linkurl" value="<?php echo wp_specialchars($_GET['linkurl'], 1); ?>" style="width: 95%;" /></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Link Name:') ?></th>
+           <td><input type="text" name="name" value="<?php echo wp_specialchars( urldecode($_GET['name']), 1 ); ?>" style="width: 95%" /></td>
+         </tr>
+         <tr>
+               <th scope="row"><?php _e('Short description:') ?></th>
+               <td><input type="text" name="description" value="" style="width: 95%" /></td>
+               </tr>
+        <tr>
+           <th scope="row"><?php _e('Category:') ?></th>
+           <td><?php category_dropdown('category'); ?></td>
+         </tr>
+</table>
+</fieldset>
+       <p class="submit">
+         <input type="submit" name="submit" value="<?php _e('Add Link &raquo;') ?>" /> 
+       </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="rel" id="rel" size="50" value="<?php echo $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 _e('Add Link &raquo;') ?>" /> 
+       </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="image" size="50" value="" style="width: 95%" /></td>
+         </tr>
+<tr>
+           <th scope="row"><?php _e('RSS URI:') ?> </th>
+           <td><input name="rss_uri" type="text" id="rss_uri" value="" size="50" style="width: 95%" /></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Notes:') ?></th>
+           <td><textarea name="notes" cols="50" rows="10" style="width: 95%"></textarea></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Rating:') ?></th>
+           <td><select name="rating" size="1">
+             <?php
+    for ($r = 0; $r < 10; $r++) {
+      echo('            <option value="'.$r.'">'.$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="target" value="_blank" />
+             <code>_blank</code></label>
+<br />
+<label><input type="radio" name="target" value="_top" />
+<code>_top</code></label>
+<br />
+<label><input type="radio" name="target" value="" checked="checked" />
+<?php _e('none') ?></label>
+<?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="visible" checked="checked" value="Y" />
+<?php _e('Yes') ?></label><br />
+<label><input type="radio" name="visible" value="N" /> <input type="hidden" name="action" value="Add" /> 
+<?php _e('No') ?></label></td>
+         </tr>
+</table>
+</fieldset>
+
+       <p class="submit">
+         <input type="submit" name="submit" value="<?php _e('Add Link &raquo;') ?>" /> 
+       </p>
+  </form>
+</div>
+
+<div class="wrap">
+<?php printf(__('<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you&#8217;re on to your links! Right now this only works on Mozilla or Netscape, but we&#8217;re working on it.</p>'), "javascript:void(linkmanpopup=window.open('" . get_settings('siteurl') . "/wp-admin/link-add.php?action=popup&amp;linkurl='+escape(location.href)+'&amp;name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?>
+</div>
+
+<?php
+require('admin-footer.php');
+?>
diff --git a/WebKitSite/blog/wp-admin/link-categories.php b/WebKitSite/blog/wp-admin/link-categories.php
new file mode 100644 (file)
index 0000000..4ca3e2a
--- /dev/null
@@ -0,0 +1,453 @@
+<?php
+// Links
+// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
+require_once('admin.php');
+$title = __('Link Categories');
+$this_file='link-categories.php';
+$parent_file = 'link-manager.php';
+
+$wpvarstoreset = array('action', 'cat', 'auto_toggle');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+    $wpvar = $wpvarstoreset[$i];
+    if (!isset($$wpvar)) {
+        if (empty($_POST["$wpvar"])) {
+            if (empty($_GET["$wpvar"])) {
+                $$wpvar = '';
+            } else {
+                $$wpvar = $_GET["$wpvar"];
+            }
+        } else {
+            $$wpvar = $_POST["$wpvar"];
+        }
+    }
+}
+
+switch ($action) {
+  case 'addcat':
+  {
+      if ($user_level < 5)
+          die (__("Cheatin' uh ?"));
+
+      $cat_name = wp_specialchars($_POST['cat_name']);
+      $auto_toggle = $_POST['auto_toggle'];
+      if ($auto_toggle != 'Y') {
+          $auto_toggle = 'N';
+      }
+
+      $show_images = $_POST['show_images'];
+      if ($show_images != 'Y') {
+          $show_images = 'N';
+      }
+
+      $show_description = $_POST['show_description'];
+      if ($show_description != 'Y') {
+          $show_description = 'N';
+      }
+
+      $show_rating = $_POST['show_rating'];
+      if ($show_rating != 'Y') {
+          $show_rating = 'N';
+      }
+
+      $show_updated = $_POST['show_updated'];
+      if ($show_updated != 'Y') {
+          $show_updated = 'N';
+      }
+
+      $sort_order = $_POST['sort_order'];
+
+      $sort_desc = $_POST['sort_desc'];
+      if ($sort_desc != 'Y') {
+          $sort_desc = 'N';
+      }
+      $text_before_link = addslashes($_POST['text_before_link']);
+      $text_after_link = addslashes($_POST['text_after_link']);
+      $text_after_all = addslashes($_POST['text_after_all']);
+
+      $list_limit = $_POST['list_limit'];
+      if ($list_limit == '')
+          $list_limit = -1;
+
+      $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
+             " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
+             " VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
+             " '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
+             " '$text_after_all', $list_limit)");
+
+      header('Location: link-categories.php');
+    break;
+  } // end addcat
+  case 'Delete':
+  {
+    $cat_id = (int) $_GET['cat_id'];
+    $cat_name=get_linkcatname($cat_id);
+
+    if ($cat_id=="1")
+        die(sprintf(__("Can't delete the <strong>%s</strong> link category: this is the default one"), $cat_name));
+
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'");
+    $wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$cat_id'");
+
+    header('Location: link-categories.php');
+    break;
+  } // end delete
+  case 'Edit':
+  {
+    include_once ('admin-header.php');
+    $cat_id = (int) $_GET['cat_id'];
+    $row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
+         . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
+         . " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$cat_id");
+    if ($row) {
+        if ($row->list_limit == -1) {
+            $row->list_limit = '';
+        }
+?>
+
+<div class="wrap">
+  <h2><?php printf(__('Edit &#8220%s&#8221; Category'), wp_specialchars($row->cat_name)); ?></h2>
+
+  <form name="editcat" method="post">
+      <input type="hidden" name="action" value="editedcat" />
+      <input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
+<fieldset class="options">
+<legend><?php _e('Category Options') ?></legend>
+<table class="editform" width="100%" cellspacing="2" cellpadding="5">
+<tr>
+       <th width="33%" scope="row"><?php _e('Name:') ?></th>
+       <td width="67%"><input name="cat_name" type="text" value="<?php echo wp_specialchars($row->cat_name)?>" size="30" /></td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Show:') ?></th>
+        <td>
+            <label>
+            <input type="checkbox" name="show_images"  value="Y" <?php checked('Y', $row->show_images); ?> /> 
+            <?php _e('Image') ?></label> <br />
+            <label>
+            <input type="checkbox" name="show_description" value="Y" <?php checked('Y', $row->show_description); ?> /> 
+            <?php _e('Description') ?></label> 
+            <?php _e('(shown in <code>title</code> regardless)') ?><br />
+            <label>
+            <input type="checkbox" name="show_rating"  value="Y" <?php checked('Y', $row->show_rating); ?> /> 
+            <?php _e('Rating') ?></label> <br />
+            <label>
+            <input type="checkbox" name="show_updated" value="Y" <?php checked('Y', $row->show_updated); ?> /> 
+            <?php _e('Updated') ?></label>
+<?php _e('(shown in <code>title</code> regardless)') ?></td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Sort order:') ?></th>
+       <td>
+       <select name="sort_order" size="1">
+            <option value="name" <?php echo ($row->sort_order == 'name') ? 'selected="selected"' : ''?>><?php _e('Name') ?></option>
+            <option value="id"      <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>><?php _e('Id') ?></option>
+            <option value="url"     <?php echo ($row->sort_order == 'url') ? 'selected' : ''?>><?php _e('URL') ?></option>
+            <option value="rating"  <?php echo ($row->sort_order == 'rating') ? 'selected' : ''?>><?php _e('Rating') ?></option>
+            <option value="updated" <?php echo ($row->sort_order == 'updated') ? 'selected' : ''?>><?php _e('Updated') ?></option>
+            <option value="rand"  <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>><?php _e('Random') ?></option>
+            <option value="length"  <?php echo ($row->sort_order == 'length') ? 'selected' : ''?>><?php _e('Name Length') ?></option>
+       </select>
+       <label>
+       <input type="checkbox" name="sort_desc" value="Y" <?php checked('Y', $row->sort_desc); ?> /> 
+       <?php _e('Descending') ?></label>
+       </td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Limit:') ?></th>
+       <td>
+       <input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit ?>" /> 
+       <?php _e('(Leave empty for no limit to number of links shown)') ?>
+       </td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Toggle:') ?></th>
+       <td><label>
+               <input type="checkbox" name="auto_toggle"  value="Y" <?php checked('Y', $row->auto_toggle); ?> /> 
+               <?php _e('When new link is added toggle all others to be invisible') ?></label></td>
+</tr>
+
+</table>
+</fieldset>
+<fieldset class="options">
+<legend><?php _e('Formatting') ?></legend>
+<table class="editform" width="100%" cellspacing="2" cellpadding="5">
+<tr>
+       <th width="33%" scope="row"><?php _e('Before Link:') ?></th>
+       <td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo wp_specialchars($row->text_before_link)?>" /></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Between Link and Description:') ?></th>
+<td><input type="text" name="text_after_link" size="45" value="<?php echo wp_specialchars($row->text_after_link)?>" /></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('After Link:') ?></th>
+<td><input type="text" name="text_after_all" size="45" value="<?php echo wp_specialchars($row->text_after_all)?>"/></td>
+</tr>
+</table>
+</fieldset>
+<p class="submit"><input type="submit" name="submit" value="<?php _e('Save Category Settings &raquo;') ?>" /></p>
+</form>
+
+</div>
+<?php
+    } // end if row
+    break;
+  } // end Edit
+  case "editedcat":
+  {
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    $submit=$_POST["submit"];
+    if (isset($submit)) {
+
+    $cat_id = (int)$_POST["cat_id"];
+
+    $cat_name= wp_specialchars($_POST["cat_name"]);
+    $auto_toggle = $_POST["auto_toggle"];
+    if ($auto_toggle != 'Y') {
+        $auto_toggle = 'N';
+    }
+
+    $show_images = $_POST["show_images"];
+    if ($show_images != 'Y') {
+        $show_images = 'N';
+    }
+
+    $show_description = $_POST["show_description"];
+    if ($show_description != 'Y') {
+        $show_description = 'N';
+    }
+
+    $show_rating = $_POST["show_rating"];
+    if ($show_rating != 'Y') {
+        $show_rating = 'N';
+    }
+
+    $show_updated = $_POST["show_updated"];
+    if ($show_updated != 'Y') {
+        $show_updated = 'N';
+    }
+
+    $sort_order = $_POST["sort_order"];
+
+    $sort_desc = $_POST["sort_desc"];
+    if ($sort_desc != 'Y') {
+        $sort_desc = 'N';
+    }
+    $text_before_link = addslashes($_POST["text_before_link"]);
+    $text_after_link = addslashes($_POST["text_after_link"]);
+    $text_after_all = addslashes($_POST["text_after_all"]);
+
+    $list_limit = $_POST["list_limit"];
+    if ($list_limit == '')
+        $list_limit = -1;
+
+    $wpdb->query("UPDATE $wpdb->linkcategories set
+            cat_name='$cat_name',
+            auto_toggle='$auto_toggle',
+            show_images='$show_images',
+            show_description='$show_description',
+            show_rating='$show_rating',
+            show_updated='$show_updated',
+            sort_order='$sort_order',
+            sort_desc='$sort_desc',
+            text_before_link='$text_before_link',
+            text_after_link='$text_after_link',
+            text_after_all='$text_after_all',
+            list_limit=$list_limit
+            WHERE cat_id=$cat_id
+            ");
+    } // end if save
+
+
+    header("Location: link-categories.php");
+    break;
+  } // end editcat
+  default:
+  {
+    include_once ("admin-header.php");
+    if ($user_level < 5) {
+      die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)"));
+    }
+?>
+
+<div class="wrap">
+            <h2><?php _e('Link Categories:') ?></h2>
+            <table width="100%" cellpadding="5" cellspacing="0" border="0">
+              <tr>
+               <th rowspan="2" valign="bottom"><?php _e('Name') ?></th>
+                <th rowspan="2" valign="bottom"><?php _e('ID') ?></th>
+                <th rowspan="2" valign="bottom"><?php _e('Toggle?') ?></th>
+                <th colspan="4" valign="bottom" class="alternate"><?php _e('Show') ?></th>
+                <th rowspan="2" valign="bottom"><?php _e('Sort Order') ?></th>
+                <th rowspan="2" valign="bottom"><?php _e('Desc?') ?></th>
+                <th colspan="3" valign="bottom" class="alternate"><?php _e('Formatting') ?></th>
+                <th rowspan="2" valign="bottom"><?php _e('Limit') ?></th>
+                <th rowspan="2" colspan="2">&nbsp;</th>
+              </tr>
+              <tr>
+                <th valign="top"><?php _e('Images') ?></th>
+                <th valign="top"><?php _e('Description') ?></th>
+                <th valign="top"><?php _e('Rating') ?></th>
+                <th valign="top"><?php _e('Updated') ?></th>
+                <th valign="top"><?php _e('Before') ?></th>
+                <th valign="top"><?php _e('Between') ?></th>
+                <th valign="top"><?php _e('After') ?></th>
+              </tr>
+<?php
+$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
+         . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
+         . " text_after_all, list_limit FROM $wpdb->linkcategories ORDER BY cat_id");
+$i = 1;
+foreach ($results as $row) {
+    if ($row->list_limit == -1) {
+        $row->list_limit = __('none');
+    }
+    $style = ($i % 2) ? ' class="alternate"' : '';
+    /*
+       Manually internationalize every sort order option.
+    */
+    switch ($row->sort_order) {
+       case 'name':
+               $row->sort_order = __('name');
+               break;
+       case 'id':
+               $row->sort_order = __('id');
+               break;
+       case 'url':
+               $row->sort_order = __('url');
+               break;
+       case 'rating':
+               $row->sort_order = __('rating');
+               break;
+       case 'updated':
+               $row->sort_order = __('updated');
+               break;
+       case 'rand':
+               $row->sort_order = __('rand');
+               break;
+       case 'length':
+               $row->sort_order = __('length');
+               break;
+    }
+?>
+              <tr valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
+                <td><?php echo wp_specialchars($row->cat_name)?></td>
+                               <td ><?php echo $row->cat_id?></td>
+                <td><?php echo $row->auto_toggle == 'Y' ? __('Yes') : __('No') ?></td>
+                <td><?php echo $row->show_images == 'Y' ? __('Yes') : __('No') ?></td>
+                <td><?php echo $row->show_description == 'Y' ? __('Yes') : __('No') ?></td>
+                <td><?php echo $row->show_rating == 'Y' ? __('Yes') : __('No') ?></td>
+                <td><?php echo $row->show_updated == 'Y' ? __('Yes') : __('No') ?></td>
+                <td><?php echo $row->sort_order ?></td>
+                <td><?php echo $row->sort_desc == 'Y' ? __('Yes') : __('No') ?></td>
+                <td nowrap="nowrap"><?php echo htmlentities($row->text_before_link)?>&nbsp;</td>
+                <td nowrap="nowrap"><?php echo htmlentities($row->text_after_link)?>&nbsp;</td>
+                <td nowrap="nowrap"><?php echo htmlentities($row->text_after_all)?></td>
+                <td><?php echo $row->list_limit ?></td>
+                <td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&amp;action=Edit" class="edit"><?php _e('Edit') ?></a></td>
+                <td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&amp;action=Delete" onclick="return confirm('<?php _e("You are about to delete this category.\\n  \'Cancel\' to stop, \'OK\' to delete.") ?>');" class="delete"><?php _e('Delete') ?></a></td>
+              </tr>
+<?php
+        ++$i;
+    }
+?>
+            </table>
+<p><?php _e('These are the defaults for when you call a link category with no additional arguments. All of these settings may be overwritten.') ?></p>
+
+</div>
+
+<div class="wrap">
+    <form name="addcat" method="post">
+      <input type="hidden" name="action" value="addcat" />
+         <h2><?php _e('Add a Link Category:') ?></h2>
+<fieldset class="options">
+<legend><?php _e('Category Options') ?></legend>
+<table class="editform" width="100%" cellspacing="2" cellpadding="5">
+<tr>
+       <th width="33%" scope="row"><?php _e('Name:') ?></th>
+       <td width="67%"><input type="text" name="cat_name" size="30" /></td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Show:') ?></th>
+        <td>
+            <label>
+            <input type="checkbox" name="show_images"  value="Y" /> 
+            <?php _e('Image') ?></label> <br />
+            <label>
+            <input type="checkbox" name="show_description" value="Y" /> 
+            <?php _e('Description') ?></label> 
+            <?php _e('(shown in <code>title</code> regardless)') ?><br />
+            <label>
+            <input type="checkbox" name="show_rating"  value="Y" /> 
+            <?php _e('Rating') ?></label> <br />
+            <label>
+            <input type="checkbox" name="show_updated" value="Y" /> 
+            <?php _e('Updated') ?></label>
+<?php _e('(shown in <code>title</code> regardless)') ?></td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Sort order:') ?></th>
+       <td>
+       <select name="sort_order" size="1">
+       <option value="name"><?php _e('Name') ?></option>
+       <option value="id"><?php _e('Id') ?></option>
+       <option value="url"><?php _e('URL') ?></option>
+       <option value="rating"><?php _e('Rating') ?></option>
+       <option value="updated"><?php _e('Updated') ?></option>
+       <option value="rand"><?php _e('Random') ?></option>
+       </select>
+       <label>
+       <input type="checkbox" name="sort_desc" value="Y" /> 
+       <?php _e('Descending') ?></label>
+       </td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Limit:') ?></th>
+       <td>
+       <input type="text" name="list_limit" size="5" value="" /> <?php _e('(Leave empty for no limit to number of links shown)') ?>
+       </td>
+</tr>
+<tr>
+       <th scope="row"><?php _e('Toggle:') ?></th>
+       <td><label>
+               <input type="checkbox" name="auto_toggle"  value="Y" /> 
+               <?php _e('When new link is added toggle all others to be invisible') ?></label></td>
+</tr>
+
+</table>
+</fieldset>
+<fieldset class="options">
+<legend><?php _e('Formatting') ?></legend>
+<table class="editform" width="100%" cellspacing="2" cellpadding="5">
+<tr>
+       <th width="33%" scope="row"><?php _e('Before Link:') ?></th>
+       <td width="67%"><input type="text" name="text_before_link" size="45" value="&lt;li&gt;" /></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Between Link and Description:') ?></th>
+<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('After Link:') ?></th>
+<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
+</tr>
+</table>
+</fieldset>
+<p class="submit"><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
+  </form>
+</div>
+<div class="wrap">
+    <h3><?php _e('Note:') ?></h3>
+    <?php printf(__('<p>Deleting a link category does not delete links from that category.<br />It will just set them back to the default category <b>%s</b>.'), get_linkcatname(1)) ?></p>
+</div>
+<?php
+    break;
+  } // end default
+} // end case
+?>
+<?php include('admin-footer.php'); ?>
diff --git a/WebKitSite/blog/wp-admin/link-import.php b/WebKitSite/blog/wp-admin/link-import.php
new file mode 100644 (file)
index 0000000..51c1bf8
--- /dev/null
@@ -0,0 +1,131 @@
+<?php
+// Links
+// Copyright (C) 2002 Mike Little -- mike@zed1.com
+
+require_once('admin.php');
+$parent_file = 'link-manager.php';
+$title = __('Import Blogroll');
+$this_file = 'link-import.php';
+
+$step = $_POST['step'];
+if (!$step) $step = 0;
+?>
+<?php
+switch ($step) {
+    case 0:
+    {
+        include_once('admin-header.php');
+        if ($user_level < 5)
+            die (__("Cheatin&#8217; uh?"));
+
+        $opmltype = 'blogrolling'; // default.
+?>
+
+<div class="wrap">
+
+    <h2><?php _e('Import your blogroll from another system') ?> </h2>
+       <!-- <form name="blogroll" action="link-import.php" method="get"> -->
+       <form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
+
+       <ol>
+    <li><?php _e('Go to <a href="http://www.blogrolling.com">Blogrolling.com</a> and sign in. Once you&#8217;ve done that, click on <strong>Get Code</strong>, and then look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr> code</strong>') ?>.</li>
+    <li><?php _e('Or go to <a href="http://blo.gs">Blo.gs</a> and sign in. Once you&#8217;ve done that in the \'Welcome Back\' box on the right, click on <strong>share</strong>, and then look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr> link</strong> (favorites.opml).') ?></li>
+    <li><?php _e('Select that text and copy it or copy the link/shortcut into the box below.') ?><br />
+       <input type="hidden" name="step" value="1" />
+       <?php _e('Your OPML URL:') ?> <input type="text" name="opml_url" size="65" />
+       </li>
+    <li>
+          <?php _e('<strong>or</strong> you can upload an OPML file from your desktop aggregator:') ?><br />
+       <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
+       <label><?php _e('Upload this file:') ?> <input name="userfile" type="file" /></label>
+    </li>
+
+    <li><?php _e('Now select a category you want to put these links in.') ?><br />
+       <?php _e('Category:') ?> <select name="cat_id">
+<?php
+       $categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
+       foreach ($categories as $category) {
+?>
+    <option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>
+<?php
+        } // end foreach
+?>
+    </select>
+
+       </li>
+
+    <li><input type="submit" name="submit" value="<?php _e('Import!') ?>" /></li>
+       </ol>
+    </form>
+
+</div>
+<?php
+                break;
+            } // end case 0
+
+    case 1: {
+                include_once('admin-header.php');
+                if ($user_level < 5)
+                    die (__("Cheatin' uh ?"));
+?>
+<div class="wrap">
+
+     <h2><?php _e('Importing...') ?></h2>
+<?php
+                $cat_id = $_POST['cat_id'];
+                if (($cat_id == '') || ($cat_id == 0)) {
+                    $cat_id  = 1;
+                }
+
+                $opml_url = $_POST['opml_url'];
+                if (isset($opml_url) && $opml_url != '') {
+                                       $blogrolling = true;
+                }
+                else // try to get the upload file.
+                               {
+                                       $uploaddir = get_settings('fileupload_realpath');
+                                       $uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];
+
+                                       if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
+                                       {
+                                               //echo "Upload successful.";
+                                               $blogrolling = false;
+                                               $opml_url = $uploadfile;
+                                       } else {
+                                               echo __("Upload error");
+                                       }
+                               }
+
+                if (isset($opml_url) && $opml_url != '') {
+                    $opml = implode('', file($opml_url));
+                    include_once('link-parse-opml.php');
+
+                    $link_count = count($names);
+                    for ($i = 0; $i < $link_count; $i++) {
+                        if ('Last' == substr($titles[$i], 0, 4))
+                            $titles[$i] = '';
+                        if ('http' == substr($titles[$i], 0, 4))
+                            $titles[$i] = '';
+                        $query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
+                                VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
+                        $result = $wpdb->query($query);
+                        echo sprintf(__("<p>Inserted <strong>%s</strong></p>"), $names[$i]);
+                    }
+?>
+     <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
+<?php
+                } // end if got url
+                else
+                {
+                    echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
+                } // end else
+
+?>
+</div>
+<?php
+                break;
+            } // end case 1
+} // end switch
+?>
+</body>
+</html>
diff --git a/WebKitSite/blog/wp-admin/link-manager.php b/WebKitSite/blog/wp-admin/link-manager.php
new file mode 100644 (file)
index 0000000..2f0a140
--- /dev/null
@@ -0,0 +1,755 @@
+<?php
+// Links
+// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
+
+require_once('admin.php');
+
+$title = __('Manage Links');
+$this_file = $parent_file = 'link-manager.php';
+
+function xfn_check($class, $value = '', $type = 'check') {
+       global $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"';
+       }
+}
+
+function 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'>";
+       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 ('Y' == $row->auto_toggle)
+                       echo ' (auto toggle)';
+               echo "</option>\n";
+       }
+       echo "\n</select>\n";
+}
+
+$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image',
+                       'description', 'visible', 'target', 'category', 'link_id',
+                       'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
+                       'notes', 'linkcheck[]');
+
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+    $wpvar = $wpvarstoreset[$i];
+    if (!isset($$wpvar)) {
+        if (empty($_POST["$wpvar"])) {
+            if (empty($_GET["$wpvar"])) {
+                $$wpvar = '';
+            } else {
+                $$wpvar = $_GET["$wpvar"];
+            }
+        } else {
+            $$wpvar = $_POST["$wpvar"];
+        }
+    }
+}
+
+$links_show_cat_id = $_COOKIE['links_show_cat_id_' . COOKIEHASH];
+$links_show_order = $_COOKIE['links_show_order_' . COOKIEHASH];
+
+if ('' != $_POST['assign']) $action = 'assign';
+if ('' != $_POST['visibility']) $action = 'visibility';
+if ('' != $_POST['move']) $action = 'move';
+if ('' != $_POST['linkcheck']) $linkcheck = $_POST[linkcheck];
+
+switch ($action) {
+  case 'assign':
+  {
+    check_admin_referer();
+
+    // check the current user's level first.
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    //for each link id (in $linkcheck[]): if the current user level >= the
+    //userlevel of the owner of the link then we can proceed.
+
+    if (count($linkcheck) == 0) {
+        header('Location: ' . $this_file);
+        exit;
+    }
+    $all_links = join(',', $linkcheck);
+    $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)");
+    foreach ($results as $row) {
+      if (($user_level >= $row->user_level)) { // ok to proceed
+        $ids_to_change[] = $row->link_id;
+      }
+    }
+
+    // should now have an array of links we can change
+    $all_links = join(',', $ids_to_change);
+    $q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)");
+
+    header('Location: ' . $this_file);
+    break;
+  }
+  case 'visibility':
+  {
+    check_admin_referer();
+
+    // check the current user's level first.
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    //for each link id (in $linkcheck[]): toggle the visibility
+    if (count($linkcheck) == 0) {
+        header('Location: ' . $this_file);
+        exit;
+    }
+    $all_links = join(',', $linkcheck);
+    $results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)");
+    foreach ($results as $row) {
+        if ($row->link_visible == 'Y') { // ok to proceed
+            $ids_to_turnoff[] = $row->link_id;
+        } else {
+            $ids_to_turnon[] = $row->link_id;
+        }
+    }
+
+    // should now have two arrays of links to change
+    if (count($ids_to_turnoff)) {
+        $all_linksoff = join(',', $ids_to_turnoff);
+        $q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)");
+    }
+
+    if (count($ids_to_turnon)) {
+        $all_linkson = join(',', $ids_to_turnon);
+        $q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)");
+    }
+
+    header('Location: ' . $this_file);
+    break;
+  }
+  case 'move':
+  {
+    check_admin_referer();
+
+    // check the current user's level first.
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    //for each link id (in $linkcheck[]) change category to selected value
+    if (count($linkcheck) == 0) {
+        header('Location: ' . $this_file);
+        exit;
+    }
+    $all_links = join(',', $linkcheck);
+    // should now have an array of links we can change
+    $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
+
+    header('Location: ' . $this_file);
+    break;
+  }
+
+  case 'Add':
+  {
+    check_admin_referer();
+
+    $link_url = wp_specialchars($_POST['linkurl']);
+    $link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://' . $link_url; 
+    $link_name = wp_specialchars($_POST['name']);
+    $link_image = wp_specialchars($_POST['image']);
+    $link_target = $_POST['target'];
+    $link_category = $_POST['category'];
+    $link_description = $_POST['description'];
+    $link_visible = $_POST['visible'];
+    $link_rating = $_POST['rating'];
+    $link_rel = $_POST['rel'];
+    $link_notes = $_POST['notes'];
+       $link_rss_uri =  wp_specialchars($_POST['rss_uri']);
+    $auto_toggle = get_autotoggle($link_category);
+
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    // 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.
+    if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
+      $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
+    }
+    $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', $user_ID, $link_rating, '" . $link_rel . "', '" . $link_notes . "', '$link_rss_uri')");
+
+    header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true');
+    break;
+  } // end Add
+
+  case 'editlink':
+  {
+    if (isset($submit)) {
+
+      if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
+        $cat_id = $links_show_cat_id;
+
+      if (!isset($cat_id) || ($cat_id == '')) {
+        if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
+          $cat_id = 'All';
+      }
+      $links_show_cat_id = $cat_id;
+
+      check_admin_referer();
+
+      $link_id = (int) $_POST['link_id'];
+      $link_url = wp_specialchars($_POST['linkurl']);
+      $link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://' . $link_url; 
+      $link_name = wp_specialchars($_POST['name']);
+      $link_image = wp_specialchars($_POST['image']);
+      $link_target = wp_specialchars($_POST['target']);
+      $link_category = $_POST['category'];
+      $link_description = $_POST['description'];
+      $link_visible = $_POST['visible'];
+      $link_rating = $_POST['rating'];
+      $link_rel = $_POST['rel'];
+      $link_notes = $_POST['notes'];
+         $link_rss_uri =  $_POST['rss_uri'];
+      $auto_toggle = get_autotoggle($link_category);
+
+      if ($user_level < 5)
+        die (__("Cheatin' uh ?"));
+
+      // if we are in an auto toggle category and this one is visible then we
+      // need to make the others invisible before we update this one.
+      if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
+        $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
+      }
+
+      $wpdb->query("UPDATE $wpdb->links SET link_url='" . $link_url . "',
+         link_name='" . $link_name . "',\n link_image='" . $link_image . "',
+         link_target='$link_target',\n link_category=$link_category,
+         link_visible='$link_visible',\n link_description='" . $link_description . "',
+         link_rating=$link_rating,
+         link_rel='" . $link_rel . "',
+         link_notes='" . $link_notes . "',
+         link_rss = '$link_rss_uri'
+         WHERE link_id=$link_id");
+    } // end if save
+    setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
+    wp_redirect($this_file);
+    break;
+  } // end Save
+
+  case 'Delete':
+  {
+    check_admin_referer();
+
+    $link_id = (int) $_GET['link_id'];
+
+    if ($user_level < 5)
+      die (__("Cheatin' uh ?"));
+
+    $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id");
+
+    if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
+        $cat_id = $links_show_cat_id;
+
+    if (!isset($cat_id) || ($cat_id == '')) {
+        if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
+        $cat_id = 'All';
+    }
+    $links_show_cat_id = $cat_id;
+    setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
+    wp_redirect($this_file);
+    break;
+  } // end Delete
+
+  case 'linkedit': {
+       $xfn = true;
+    include_once ('admin-header.php');
+    if ($user_level < 5)
+      die(__('You do not have sufficient permissions to edit the links for this blog.'));
+
+    $link_id = (int) $_GET['link_id'];
+    $row = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = $link_id");
+
+    if ($row) {
+      $link_url = wp_specialchars($row->link_url, 1);
+      $link_name = wp_specialchars($row->link_name, 1);
+      $link_image = $row->link_image;
+      $link_target = $row->link_target;
+      $link_category = $row->link_category;
+      $link_description = wp_specialchars($row->link_description);
+      $link_visible = $row->link_visible;
+      $link_rating = $row->link_rating;
+      $link_rel = $row->link_rel;
+      $link_notes = wp_specialchars($row->link_notes);
+         $link_rss_uri = wp_specialchars($row->link_rss);
+    } else {
+               die( __('Link not found.') ); 
+       }
+
+?>
+
+<div class="wrap"> 
+  <form action="" method="post" name="editlink" id="editlink"> 
+  <h2><?php _e('Edit a link:') ?></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="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" /></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Link Name:') ?></th>
+           <td><input type="text" name="name" value="<?php echo $link_name; ?>" style="width: 95%" /></td>
+         </tr>
+         <tr>
+            <th scope="row"><?php _e('Short description:') ?></th>
+               <td><input type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" /></td>
+               </tr>
+        <tr>
+           <th scope="row"><?php _e('Category:') ?></th>
+           <td><?php category_dropdown('category', $link_category); ?></td>
+         </tr>
+</table>
+</fieldset>
+       <p class="submit">
+       <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
+       </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="rel" id="rel" size="50" value="<?php echo $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 _e('Save Changes &raquo;') ?>" />
+       </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="image" size="50" value="<?php echo $link_image; ?>" style="width: 95%" /></td>
+         </tr>
+<tr>
+           <th scope="row"><?php _e('RSS URI:') ?> </th>
+           <td><input name="rss_uri" type="text" id="rss_uri" value="<?php echo $link_rss_uri; ?>" size="50" style="width: 95%" /></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Notes:') ?></th>
+           <td><textarea name="notes" cols="50" rows="10" style="width: 95%"><?php echo $link_notes; ?></textarea></td>
+         </tr>
+         <tr>
+           <th scope="row"><?php _e('Rating:') ?></th>
+           <td><select name="rating" size="1">
+<?php
+    for ($r = 0; $r < 10; $r++) {
+      echo('            <option value="'.$r.'" ');
+      if ($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="target" value="_blank"   <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?> />
+          <code>_blank</code></label><br />
+<label>
+<input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?> />
+<code>_top</code></label><br />
+<label>
+<input type="radio" name="target" value=""     <?php echo(($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></